Handle the grab and ungrab command instead of doing focus by hand. This
2000-01-28 Christopher James Lahey <clahey@helixcode.com> * widgets/e-text.c (e_text_command): Handle the grab and ungrab command instead of doing focus by hand. This fixes a problem related to the scroll wheel. (e_text_command): Reset the blink timer in many more command situations so that the cursor blinks less when you're interacting with it. * widgets/e-text-event-processor-emacs-like.c: Send the grab focus command when starting a selection and the ungrab focus command when ending it. * widgets/e-text-event-processor-types.h: Added grab command type so that the event processor can tell the widget to grab the focus. * widgets/e-reflow.c: Redefined all sizes using #defines so that they can be tweaked later. Added scroll wheel handling and set up adjustment increments so that the scroll bars will work correctly. * widgets/e-minicard.h: Added minicard focus type enum. This doesn't mean anything yet, but it will later be used to say which direction the focus is coming from (below for shift-tab, above for tab.) svn path=/trunk/; revision=1650
This commit is contained in:

committed by
Chris Lahey

parent
905f7de48f
commit
12ba6679ac
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
|||||||
|
2000-01-28 Christopher James Lahey <clahey@helixcode.com>
|
||||||
|
|
||||||
|
* widgets/e-text.c (e_text_command): Handle the grab and ungrab
|
||||||
|
command instead of doing focus by hand. This fixes a problem
|
||||||
|
related to the scroll wheel.
|
||||||
|
(e_text_command): Reset the blink timer in many more command
|
||||||
|
situations so that the cursor blinks less when you're interacting
|
||||||
|
with it.
|
||||||
|
|
||||||
|
* widgets/e-text-event-processor-emacs-like.c: Send the grab focus
|
||||||
|
command when starting a selection and the ungrab focus command
|
||||||
|
when ending it.
|
||||||
|
|
||||||
|
* widgets/e-text-event-processor-types.h: Added grab command type
|
||||||
|
so that the event processor can tell the widget to grab the focus.
|
||||||
|
|
||||||
|
* widgets/e-reflow.c: Redefined all sizes using #defines so that
|
||||||
|
they can be tweaked later. Added scroll wheel handling and set up
|
||||||
|
adjustment increments so that the scroll bars will work correctly.
|
||||||
|
|
||||||
|
* widgets/e-minicard.h: Added minicard focus type enum. This
|
||||||
|
doesn't mean anything yet, but it will later be used to say which
|
||||||
|
direction the focus is coming from (below for shift-tab, above for
|
||||||
|
tab.)
|
||||||
|
|
||||||
2000-01-28 Christopher James Lahey <clahey@helixcode.com>
|
2000-01-28 Christopher James Lahey <clahey@helixcode.com>
|
||||||
|
|
||||||
* widgets/e-minicard-label.c, widgets/e-minicard.c: Use
|
* widgets/e-minicard-label.c, widgets/e-minicard.c: Use
|
||||||
|
@ -48,6 +48,12 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct _EMinicard EMinicard;
|
typedef struct _EMinicard EMinicard;
|
||||||
typedef struct _EMinicardClass EMinicardClass;
|
typedef struct _EMinicardClass EMinicardClass;
|
||||||
|
typedef enum _EMinicardFocusType EMinicardFocusType;
|
||||||
|
|
||||||
|
enum _EMinicardFocusType {
|
||||||
|
E_MINICARD_FOCUS_TYPE_START,
|
||||||
|
E_MINICARD_FOCUS_TYPE_END
|
||||||
|
};
|
||||||
|
|
||||||
struct _EMinicard
|
struct _EMinicard
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,10 @@ static void _update_reflow ( EReflow *reflow );
|
|||||||
static void _resize( GtkObject *object, gpointer data );
|
static void _resize( GtkObject *object, gpointer data );
|
||||||
static void _queue_reflow(EReflow *e_reflow);
|
static void _queue_reflow(EReflow *e_reflow);
|
||||||
|
|
||||||
|
#define E_REFLOW_DIVIDER_WIDTH 2
|
||||||
|
#define E_REFLOW_BORDER_WIDTH 7
|
||||||
|
#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
|
||||||
|
|
||||||
static GnomeCanvasGroupClass *parent_class = NULL;
|
static GnomeCanvasGroupClass *parent_class = NULL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -196,6 +200,7 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
EReflow *e_reflow;
|
EReflow *e_reflow;
|
||||||
GnomeCanvasGroup *group;
|
GnomeCanvasGroup *group;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
e_reflow = E_REFLOW (item);
|
e_reflow = E_REFLOW (item);
|
||||||
group = GNOME_CANVAS_GROUP( item );
|
group = GNOME_CANVAS_GROUP( item );
|
||||||
@ -219,6 +224,11 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
|
|
||||||
_queue_reflow( e_reflow );
|
_queue_reflow( e_reflow );
|
||||||
|
|
||||||
|
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
|
adjustment->step_increment = (e_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) {
|
if (!item->canvas->aa) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,8 +257,8 @@ e_reflow_unrealize (GnomeCanvasItem *item)
|
|||||||
static gint
|
static gint
|
||||||
e_reflow_pick_line (EReflow *e_reflow, double x)
|
e_reflow_pick_line (EReflow *e_reflow, double x)
|
||||||
{
|
{
|
||||||
x += 9;
|
x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
x /= e_reflow->column_width + 16;
|
x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,15 +301,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
|
switch(event->button.button)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
{
|
{
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = button->x;
|
n_x = button->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( button->y >= 7 && button->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
||||||
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + 16) - 1;
|
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
|
||||||
e_reflow->temp_column_width = e_reflow->column_width;
|
e_reflow->temp_column_width = e_reflow->column_width;
|
||||||
e_reflow->column_drag = TRUE;
|
e_reflow->column_drag = TRUE;
|
||||||
|
|
||||||
@ -315,18 +328,47 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
|
gdouble old_width = e_reflow->column_width;
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
e_reflow->temp_column_width = e_reflow->column_width +
|
e_reflow->temp_column_width = e_reflow->column_width +
|
||||||
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
||||||
if ( e_reflow->temp_column_width < 50 )
|
if ( e_reflow->temp_column_width < 50 )
|
||||||
e_reflow->temp_column_width = 50;
|
e_reflow->temp_column_width = 50;
|
||||||
|
e_reflow->column_drag = FALSE;
|
||||||
|
if ( old_width != e_reflow->temp_column_width ) {
|
||||||
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
||||||
e_reflow->column_width = e_reflow->temp_column_width;
|
e_reflow->column_width = e_reflow->temp_column_width;
|
||||||
e_reflow->column_drag = FALSE;
|
adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
|
||||||
|
adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
|
||||||
|
gtk_adjustment_changed(adjustment);
|
||||||
_queue_reflow(e_reflow);
|
_queue_reflow(e_reflow);
|
||||||
|
} else {
|
||||||
|
e_reflow->need_column_resize = TRUE;
|
||||||
|
gnome_canvas_item_request_update(item);
|
||||||
|
}
|
||||||
gnome_canvas_item_ungrab (item, button->time);
|
gnome_canvas_item_ungrab (item, button->time);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -349,9 +391,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventMotion *motion = (GdkEventMotion *) event;
|
GdkEventMotion *motion = (GdkEventMotion *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = motion->x;
|
n_x = motion->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( motion->y >= 7 && motion->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -369,9 +411,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -384,9 +426,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( !( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) ) {
|
if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
|
||||||
if ( ! e_reflow->default_cursor_shown ) {
|
if ( ! e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
||||||
e_reflow->default_cursor_shown = TRUE;
|
e_reflow->default_cursor_shown = TRUE;
|
||||||
@ -433,16 +475,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
||||||
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
||||||
column_width = e_reflow->column_width;
|
column_width = e_reflow->column_width;
|
||||||
running_width = 7 + column_width + 7;
|
running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i = x;
|
i = x;
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -459,25 +501,25 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect,
|
width_rect,
|
||||||
height_rect);
|
height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
int start_line = e_reflow_pick_line(e_reflow,
|
int start_line = e_reflow_pick_line(e_reflow,
|
||||||
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
||||||
i = x - start_line * (column_width + 16);
|
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width = start_line * (column_width + 16);
|
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
i += start_line * (column_width + 16);
|
i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -490,7 +532,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect - 1,
|
width_rect - 1,
|
||||||
height_rect - 1);
|
height_rect - 1);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,34 +584,34 @@ e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gin
|
|||||||
double column_width;
|
double column_width;
|
||||||
|
|
||||||
if ( e_reflow->previous_temp_column_width != -1 ) {
|
if ( e_reflow->previous_temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->previous_temp_column_width;
|
column_width = e_reflow->previous_temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e_reflow->temp_column_width != -1 ) {
|
if ( e_reflow->temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,17 +633,21 @@ e_reflow_point (GnomeCanvasItem *item,
|
|||||||
if (*actual_item)
|
if (*actual_item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (y >= 7 && y <= e_reflow->height - 7) {
|
*actual_item = item;
|
||||||
|
return 0;
|
||||||
|
#if 0
|
||||||
|
if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) {
|
||||||
float n_x;
|
float n_x;
|
||||||
n_x = x;
|
n_x = x;
|
||||||
n_x += 9.0;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x, (e_reflow->column_width + 16));
|
n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if (n_x < 16.0) {
|
if (n_x < E_REFLOW_FULL_GUTTER) {
|
||||||
*actual_item = item;
|
*actual_item = item;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return distance;
|
return distance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -629,7 +675,7 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count = 1;
|
e_reflow->column_count = 1;
|
||||||
|
|
||||||
@ -639,12 +685,12 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
if (running_height + item_height + 7 > e_reflow->height) {
|
if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) {
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count ++;
|
e_reflow->column_count ++;
|
||||||
} else {
|
} else {
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +707,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
old_width = e_reflow->width;
|
old_width = e_reflow->width;
|
||||||
|
|
||||||
running_width = 7;
|
running_width = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
if (e_reflow->items == NULL) {
|
if (e_reflow->items == NULL) {
|
||||||
} else {
|
} else {
|
||||||
@ -670,7 +716,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
gdouble item_height;
|
gdouble item_height;
|
||||||
gdouble running_height;
|
gdouble running_height;
|
||||||
|
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
list = e_reflow->items;
|
list = e_reflow->items;
|
||||||
gtk_object_set (GTK_OBJECT(list->data),
|
gtk_object_set (GTK_OBJECT(list->data),
|
||||||
@ -682,7 +728,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
next_column = g_list_next(e_reflow->columns);
|
next_column = g_list_next(e_reflow->columns);
|
||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
|
|
||||||
@ -696,18 +742,18 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
if (next_column && (next_column->data == list)) {
|
if (next_column && (next_column->data == list)) {
|
||||||
next_column = g_list_next (next_column);
|
next_column = g_list_next (next_column);
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
running_width += e_reflow->column_width + 7 + 2 + 7;
|
running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
|
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
e_reflow->width = running_width + e_reflow->column_width + 7;
|
e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
if ( e_reflow->width < e_reflow->minimum_width )
|
if ( e_reflow->width < e_reflow->minimum_width )
|
||||||
e_reflow->width = e_reflow->minimum_width;
|
e_reflow->width = e_reflow->minimum_width;
|
||||||
if (old_width != e_reflow->width)
|
if (old_width != e_reflow->width)
|
||||||
|
@ -48,6 +48,12 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct _EMinicard EMinicard;
|
typedef struct _EMinicard EMinicard;
|
||||||
typedef struct _EMinicardClass EMinicardClass;
|
typedef struct _EMinicardClass EMinicardClass;
|
||||||
|
typedef enum _EMinicardFocusType EMinicardFocusType;
|
||||||
|
|
||||||
|
enum _EMinicardFocusType {
|
||||||
|
E_MINICARD_FOCUS_TYPE_START,
|
||||||
|
E_MINICARD_FOCUS_TYPE_END
|
||||||
|
};
|
||||||
|
|
||||||
struct _EMinicard
|
struct _EMinicard
|
||||||
{
|
{
|
||||||
|
@ -146,6 +146,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_GRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
if (event->button.state & GDK_SHIFT_MASK)
|
if (event->button.state & GDK_SHIFT_MASK)
|
||||||
command.action = E_TEP_SELECT;
|
command.action = E_TEP_SELECT;
|
||||||
else
|
else
|
||||||
@ -158,6 +161,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
break;
|
break;
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_UNGRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
command.time = event->button.time;
|
command.time = event->button.time;
|
||||||
tep_el->mouse_down = FALSE;
|
tep_el->mouse_down = FALSE;
|
||||||
} else if (event->button.button == 2) {
|
} else if (event->button.button == 2) {
|
||||||
|
@ -83,6 +83,9 @@ enum _ETextEventProcessorCommandAction {
|
|||||||
E_TEP_SET_SELECT_BY_WORD,
|
E_TEP_SET_SELECT_BY_WORD,
|
||||||
E_TEP_ACTIVATE,
|
E_TEP_ACTIVATE,
|
||||||
|
|
||||||
|
E_TEP_GRAB,
|
||||||
|
E_TEP_UNGRAB,
|
||||||
|
|
||||||
E_TEP_NOP
|
E_TEP_NOP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,6 +48,12 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct _EMinicard EMinicard;
|
typedef struct _EMinicard EMinicard;
|
||||||
typedef struct _EMinicardClass EMinicardClass;
|
typedef struct _EMinicardClass EMinicardClass;
|
||||||
|
typedef enum _EMinicardFocusType EMinicardFocusType;
|
||||||
|
|
||||||
|
enum _EMinicardFocusType {
|
||||||
|
E_MINICARD_FOCUS_TYPE_START,
|
||||||
|
E_MINICARD_FOCUS_TYPE_END
|
||||||
|
};
|
||||||
|
|
||||||
struct _EMinicard
|
struct _EMinicard
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,12 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct _EMinicard EMinicard;
|
typedef struct _EMinicard EMinicard;
|
||||||
typedef struct _EMinicardClass EMinicardClass;
|
typedef struct _EMinicardClass EMinicardClass;
|
||||||
|
typedef enum _EMinicardFocusType EMinicardFocusType;
|
||||||
|
|
||||||
|
enum _EMinicardFocusType {
|
||||||
|
E_MINICARD_FOCUS_TYPE_START,
|
||||||
|
E_MINICARD_FOCUS_TYPE_END
|
||||||
|
};
|
||||||
|
|
||||||
struct _EMinicard
|
struct _EMinicard
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,10 @@ static void _update_reflow ( EReflow *reflow );
|
|||||||
static void _resize( GtkObject *object, gpointer data );
|
static void _resize( GtkObject *object, gpointer data );
|
||||||
static void _queue_reflow(EReflow *e_reflow);
|
static void _queue_reflow(EReflow *e_reflow);
|
||||||
|
|
||||||
|
#define E_REFLOW_DIVIDER_WIDTH 2
|
||||||
|
#define E_REFLOW_BORDER_WIDTH 7
|
||||||
|
#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
|
||||||
|
|
||||||
static GnomeCanvasGroupClass *parent_class = NULL;
|
static GnomeCanvasGroupClass *parent_class = NULL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -196,6 +200,7 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
EReflow *e_reflow;
|
EReflow *e_reflow;
|
||||||
GnomeCanvasGroup *group;
|
GnomeCanvasGroup *group;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
e_reflow = E_REFLOW (item);
|
e_reflow = E_REFLOW (item);
|
||||||
group = GNOME_CANVAS_GROUP( item );
|
group = GNOME_CANVAS_GROUP( item );
|
||||||
@ -219,6 +224,11 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
|
|
||||||
_queue_reflow( e_reflow );
|
_queue_reflow( e_reflow );
|
||||||
|
|
||||||
|
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
|
adjustment->step_increment = (e_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) {
|
if (!item->canvas->aa) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,8 +257,8 @@ e_reflow_unrealize (GnomeCanvasItem *item)
|
|||||||
static gint
|
static gint
|
||||||
e_reflow_pick_line (EReflow *e_reflow, double x)
|
e_reflow_pick_line (EReflow *e_reflow, double x)
|
||||||
{
|
{
|
||||||
x += 9;
|
x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
x /= e_reflow->column_width + 16;
|
x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,15 +301,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
|
switch(event->button.button)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
{
|
{
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = button->x;
|
n_x = button->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( button->y >= 7 && button->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
||||||
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + 16) - 1;
|
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
|
||||||
e_reflow->temp_column_width = e_reflow->column_width;
|
e_reflow->temp_column_width = e_reflow->column_width;
|
||||||
e_reflow->column_drag = TRUE;
|
e_reflow->column_drag = TRUE;
|
||||||
|
|
||||||
@ -315,18 +328,47 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
|
gdouble old_width = e_reflow->column_width;
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
e_reflow->temp_column_width = e_reflow->column_width +
|
e_reflow->temp_column_width = e_reflow->column_width +
|
||||||
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
||||||
if ( e_reflow->temp_column_width < 50 )
|
if ( e_reflow->temp_column_width < 50 )
|
||||||
e_reflow->temp_column_width = 50;
|
e_reflow->temp_column_width = 50;
|
||||||
|
e_reflow->column_drag = FALSE;
|
||||||
|
if ( old_width != e_reflow->temp_column_width ) {
|
||||||
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
||||||
e_reflow->column_width = e_reflow->temp_column_width;
|
e_reflow->column_width = e_reflow->temp_column_width;
|
||||||
e_reflow->column_drag = FALSE;
|
adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
|
||||||
|
adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
|
||||||
|
gtk_adjustment_changed(adjustment);
|
||||||
_queue_reflow(e_reflow);
|
_queue_reflow(e_reflow);
|
||||||
|
} else {
|
||||||
|
e_reflow->need_column_resize = TRUE;
|
||||||
|
gnome_canvas_item_request_update(item);
|
||||||
|
}
|
||||||
gnome_canvas_item_ungrab (item, button->time);
|
gnome_canvas_item_ungrab (item, button->time);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -349,9 +391,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventMotion *motion = (GdkEventMotion *) event;
|
GdkEventMotion *motion = (GdkEventMotion *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = motion->x;
|
n_x = motion->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( motion->y >= 7 && motion->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -369,9 +411,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -384,9 +426,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( !( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) ) {
|
if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
|
||||||
if ( ! e_reflow->default_cursor_shown ) {
|
if ( ! e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
||||||
e_reflow->default_cursor_shown = TRUE;
|
e_reflow->default_cursor_shown = TRUE;
|
||||||
@ -433,16 +475,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
||||||
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
||||||
column_width = e_reflow->column_width;
|
column_width = e_reflow->column_width;
|
||||||
running_width = 7 + column_width + 7;
|
running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i = x;
|
i = x;
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -459,25 +501,25 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect,
|
width_rect,
|
||||||
height_rect);
|
height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
int start_line = e_reflow_pick_line(e_reflow,
|
int start_line = e_reflow_pick_line(e_reflow,
|
||||||
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
||||||
i = x - start_line * (column_width + 16);
|
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width = start_line * (column_width + 16);
|
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
i += start_line * (column_width + 16);
|
i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -490,7 +532,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect - 1,
|
width_rect - 1,
|
||||||
height_rect - 1);
|
height_rect - 1);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,34 +584,34 @@ e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gin
|
|||||||
double column_width;
|
double column_width;
|
||||||
|
|
||||||
if ( e_reflow->previous_temp_column_width != -1 ) {
|
if ( e_reflow->previous_temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->previous_temp_column_width;
|
column_width = e_reflow->previous_temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e_reflow->temp_column_width != -1 ) {
|
if ( e_reflow->temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,17 +633,21 @@ e_reflow_point (GnomeCanvasItem *item,
|
|||||||
if (*actual_item)
|
if (*actual_item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (y >= 7 && y <= e_reflow->height - 7) {
|
*actual_item = item;
|
||||||
|
return 0;
|
||||||
|
#if 0
|
||||||
|
if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) {
|
||||||
float n_x;
|
float n_x;
|
||||||
n_x = x;
|
n_x = x;
|
||||||
n_x += 9.0;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x, (e_reflow->column_width + 16));
|
n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if (n_x < 16.0) {
|
if (n_x < E_REFLOW_FULL_GUTTER) {
|
||||||
*actual_item = item;
|
*actual_item = item;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return distance;
|
return distance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -629,7 +675,7 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count = 1;
|
e_reflow->column_count = 1;
|
||||||
|
|
||||||
@ -639,12 +685,12 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
if (running_height + item_height + 7 > e_reflow->height) {
|
if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) {
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count ++;
|
e_reflow->column_count ++;
|
||||||
} else {
|
} else {
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +707,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
old_width = e_reflow->width;
|
old_width = e_reflow->width;
|
||||||
|
|
||||||
running_width = 7;
|
running_width = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
if (e_reflow->items == NULL) {
|
if (e_reflow->items == NULL) {
|
||||||
} else {
|
} else {
|
||||||
@ -670,7 +716,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
gdouble item_height;
|
gdouble item_height;
|
||||||
gdouble running_height;
|
gdouble running_height;
|
||||||
|
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
list = e_reflow->items;
|
list = e_reflow->items;
|
||||||
gtk_object_set (GTK_OBJECT(list->data),
|
gtk_object_set (GTK_OBJECT(list->data),
|
||||||
@ -682,7 +728,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
next_column = g_list_next(e_reflow->columns);
|
next_column = g_list_next(e_reflow->columns);
|
||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
|
|
||||||
@ -696,18 +742,18 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
if (next_column && (next_column->data == list)) {
|
if (next_column && (next_column->data == list)) {
|
||||||
next_column = g_list_next (next_column);
|
next_column = g_list_next (next_column);
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
running_width += e_reflow->column_width + 7 + 2 + 7;
|
running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
|
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
e_reflow->width = running_width + e_reflow->column_width + 7;
|
e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
if ( e_reflow->width < e_reflow->minimum_width )
|
if ( e_reflow->width < e_reflow->minimum_width )
|
||||||
e_reflow->width = e_reflow->minimum_width;
|
e_reflow->width = e_reflow->minimum_width;
|
||||||
if (old_width != e_reflow->width)
|
if (old_width != e_reflow->width)
|
||||||
|
@ -40,6 +40,10 @@ static void _update_reflow ( EReflow *reflow );
|
|||||||
static void _resize( GtkObject *object, gpointer data );
|
static void _resize( GtkObject *object, gpointer data );
|
||||||
static void _queue_reflow(EReflow *e_reflow);
|
static void _queue_reflow(EReflow *e_reflow);
|
||||||
|
|
||||||
|
#define E_REFLOW_DIVIDER_WIDTH 2
|
||||||
|
#define E_REFLOW_BORDER_WIDTH 7
|
||||||
|
#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
|
||||||
|
|
||||||
static GnomeCanvasGroupClass *parent_class = NULL;
|
static GnomeCanvasGroupClass *parent_class = NULL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -196,6 +200,7 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
EReflow *e_reflow;
|
EReflow *e_reflow;
|
||||||
GnomeCanvasGroup *group;
|
GnomeCanvasGroup *group;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
e_reflow = E_REFLOW (item);
|
e_reflow = E_REFLOW (item);
|
||||||
group = GNOME_CANVAS_GROUP( item );
|
group = GNOME_CANVAS_GROUP( item );
|
||||||
@ -219,6 +224,11 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
|
|
||||||
_queue_reflow( e_reflow );
|
_queue_reflow( e_reflow );
|
||||||
|
|
||||||
|
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
|
adjustment->step_increment = (e_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) {
|
if (!item->canvas->aa) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,8 +257,8 @@ e_reflow_unrealize (GnomeCanvasItem *item)
|
|||||||
static gint
|
static gint
|
||||||
e_reflow_pick_line (EReflow *e_reflow, double x)
|
e_reflow_pick_line (EReflow *e_reflow, double x)
|
||||||
{
|
{
|
||||||
x += 9;
|
x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
x /= e_reflow->column_width + 16;
|
x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,15 +301,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
|
switch(event->button.button)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
{
|
{
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = button->x;
|
n_x = button->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( button->y >= 7 && button->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
||||||
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + 16) - 1;
|
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
|
||||||
e_reflow->temp_column_width = e_reflow->column_width;
|
e_reflow->temp_column_width = e_reflow->column_width;
|
||||||
e_reflow->column_drag = TRUE;
|
e_reflow->column_drag = TRUE;
|
||||||
|
|
||||||
@ -315,18 +328,47 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
|
gdouble old_width = e_reflow->column_width;
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
e_reflow->temp_column_width = e_reflow->column_width +
|
e_reflow->temp_column_width = e_reflow->column_width +
|
||||||
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
||||||
if ( e_reflow->temp_column_width < 50 )
|
if ( e_reflow->temp_column_width < 50 )
|
||||||
e_reflow->temp_column_width = 50;
|
e_reflow->temp_column_width = 50;
|
||||||
|
e_reflow->column_drag = FALSE;
|
||||||
|
if ( old_width != e_reflow->temp_column_width ) {
|
||||||
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
||||||
e_reflow->column_width = e_reflow->temp_column_width;
|
e_reflow->column_width = e_reflow->temp_column_width;
|
||||||
e_reflow->column_drag = FALSE;
|
adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
|
||||||
|
adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
|
||||||
|
gtk_adjustment_changed(adjustment);
|
||||||
_queue_reflow(e_reflow);
|
_queue_reflow(e_reflow);
|
||||||
|
} else {
|
||||||
|
e_reflow->need_column_resize = TRUE;
|
||||||
|
gnome_canvas_item_request_update(item);
|
||||||
|
}
|
||||||
gnome_canvas_item_ungrab (item, button->time);
|
gnome_canvas_item_ungrab (item, button->time);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -349,9 +391,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventMotion *motion = (GdkEventMotion *) event;
|
GdkEventMotion *motion = (GdkEventMotion *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = motion->x;
|
n_x = motion->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( motion->y >= 7 && motion->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -369,9 +411,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -384,9 +426,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( !( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) ) {
|
if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
|
||||||
if ( ! e_reflow->default_cursor_shown ) {
|
if ( ! e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
||||||
e_reflow->default_cursor_shown = TRUE;
|
e_reflow->default_cursor_shown = TRUE;
|
||||||
@ -433,16 +475,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
||||||
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
||||||
column_width = e_reflow->column_width;
|
column_width = e_reflow->column_width;
|
||||||
running_width = 7 + column_width + 7;
|
running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i = x;
|
i = x;
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -459,25 +501,25 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect,
|
width_rect,
|
||||||
height_rect);
|
height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
int start_line = e_reflow_pick_line(e_reflow,
|
int start_line = e_reflow_pick_line(e_reflow,
|
||||||
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
||||||
i = x - start_line * (column_width + 16);
|
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width = start_line * (column_width + 16);
|
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
i += start_line * (column_width + 16);
|
i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -490,7 +532,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect - 1,
|
width_rect - 1,
|
||||||
height_rect - 1);
|
height_rect - 1);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,34 +584,34 @@ e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gin
|
|||||||
double column_width;
|
double column_width;
|
||||||
|
|
||||||
if ( e_reflow->previous_temp_column_width != -1 ) {
|
if ( e_reflow->previous_temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->previous_temp_column_width;
|
column_width = e_reflow->previous_temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e_reflow->temp_column_width != -1 ) {
|
if ( e_reflow->temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,17 +633,21 @@ e_reflow_point (GnomeCanvasItem *item,
|
|||||||
if (*actual_item)
|
if (*actual_item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (y >= 7 && y <= e_reflow->height - 7) {
|
*actual_item = item;
|
||||||
|
return 0;
|
||||||
|
#if 0
|
||||||
|
if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) {
|
||||||
float n_x;
|
float n_x;
|
||||||
n_x = x;
|
n_x = x;
|
||||||
n_x += 9.0;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x, (e_reflow->column_width + 16));
|
n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if (n_x < 16.0) {
|
if (n_x < E_REFLOW_FULL_GUTTER) {
|
||||||
*actual_item = item;
|
*actual_item = item;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return distance;
|
return distance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -629,7 +675,7 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count = 1;
|
e_reflow->column_count = 1;
|
||||||
|
|
||||||
@ -639,12 +685,12 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
if (running_height + item_height + 7 > e_reflow->height) {
|
if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) {
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count ++;
|
e_reflow->column_count ++;
|
||||||
} else {
|
} else {
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +707,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
old_width = e_reflow->width;
|
old_width = e_reflow->width;
|
||||||
|
|
||||||
running_width = 7;
|
running_width = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
if (e_reflow->items == NULL) {
|
if (e_reflow->items == NULL) {
|
||||||
} else {
|
} else {
|
||||||
@ -670,7 +716,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
gdouble item_height;
|
gdouble item_height;
|
||||||
gdouble running_height;
|
gdouble running_height;
|
||||||
|
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
list = e_reflow->items;
|
list = e_reflow->items;
|
||||||
gtk_object_set (GTK_OBJECT(list->data),
|
gtk_object_set (GTK_OBJECT(list->data),
|
||||||
@ -682,7 +728,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
next_column = g_list_next(e_reflow->columns);
|
next_column = g_list_next(e_reflow->columns);
|
||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
|
|
||||||
@ -696,18 +742,18 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
if (next_column && (next_column->data == list)) {
|
if (next_column && (next_column->data == list)) {
|
||||||
next_column = g_list_next (next_column);
|
next_column = g_list_next (next_column);
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
running_width += e_reflow->column_width + 7 + 2 + 7;
|
running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
|
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
e_reflow->width = running_width + e_reflow->column_width + 7;
|
e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
if ( e_reflow->width < e_reflow->minimum_width )
|
if ( e_reflow->width < e_reflow->minimum_width )
|
||||||
e_reflow->width = e_reflow->minimum_width;
|
e_reflow->width = e_reflow->minimum_width;
|
||||||
if (old_width != e_reflow->width)
|
if (old_width != e_reflow->width)
|
||||||
|
@ -40,6 +40,10 @@ static void _update_reflow ( EReflow *reflow );
|
|||||||
static void _resize( GtkObject *object, gpointer data );
|
static void _resize( GtkObject *object, gpointer data );
|
||||||
static void _queue_reflow(EReflow *e_reflow);
|
static void _queue_reflow(EReflow *e_reflow);
|
||||||
|
|
||||||
|
#define E_REFLOW_DIVIDER_WIDTH 2
|
||||||
|
#define E_REFLOW_BORDER_WIDTH 7
|
||||||
|
#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
|
||||||
|
|
||||||
static GnomeCanvasGroupClass *parent_class = NULL;
|
static GnomeCanvasGroupClass *parent_class = NULL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -196,6 +200,7 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
EReflow *e_reflow;
|
EReflow *e_reflow;
|
||||||
GnomeCanvasGroup *group;
|
GnomeCanvasGroup *group;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
e_reflow = E_REFLOW (item);
|
e_reflow = E_REFLOW (item);
|
||||||
group = GNOME_CANVAS_GROUP( item );
|
group = GNOME_CANVAS_GROUP( item );
|
||||||
@ -219,6 +224,11 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
|
|
||||||
_queue_reflow( e_reflow );
|
_queue_reflow( e_reflow );
|
||||||
|
|
||||||
|
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
|
adjustment->step_increment = (e_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) {
|
if (!item->canvas->aa) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,8 +257,8 @@ e_reflow_unrealize (GnomeCanvasItem *item)
|
|||||||
static gint
|
static gint
|
||||||
e_reflow_pick_line (EReflow *e_reflow, double x)
|
e_reflow_pick_line (EReflow *e_reflow, double x)
|
||||||
{
|
{
|
||||||
x += 9;
|
x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
x /= e_reflow->column_width + 16;
|
x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,15 +301,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
|
switch(event->button.button)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
{
|
{
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = button->x;
|
n_x = button->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( button->y >= 7 && button->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
||||||
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + 16) - 1;
|
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
|
||||||
e_reflow->temp_column_width = e_reflow->column_width;
|
e_reflow->temp_column_width = e_reflow->column_width;
|
||||||
e_reflow->column_drag = TRUE;
|
e_reflow->column_drag = TRUE;
|
||||||
|
|
||||||
@ -315,18 +328,47 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
|
gdouble old_width = e_reflow->column_width;
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
e_reflow->temp_column_width = e_reflow->column_width +
|
e_reflow->temp_column_width = e_reflow->column_width +
|
||||||
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
||||||
if ( e_reflow->temp_column_width < 50 )
|
if ( e_reflow->temp_column_width < 50 )
|
||||||
e_reflow->temp_column_width = 50;
|
e_reflow->temp_column_width = 50;
|
||||||
|
e_reflow->column_drag = FALSE;
|
||||||
|
if ( old_width != e_reflow->temp_column_width ) {
|
||||||
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
||||||
e_reflow->column_width = e_reflow->temp_column_width;
|
e_reflow->column_width = e_reflow->temp_column_width;
|
||||||
e_reflow->column_drag = FALSE;
|
adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
|
||||||
|
adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
|
||||||
|
gtk_adjustment_changed(adjustment);
|
||||||
_queue_reflow(e_reflow);
|
_queue_reflow(e_reflow);
|
||||||
|
} else {
|
||||||
|
e_reflow->need_column_resize = TRUE;
|
||||||
|
gnome_canvas_item_request_update(item);
|
||||||
|
}
|
||||||
gnome_canvas_item_ungrab (item, button->time);
|
gnome_canvas_item_ungrab (item, button->time);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -349,9 +391,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventMotion *motion = (GdkEventMotion *) event;
|
GdkEventMotion *motion = (GdkEventMotion *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = motion->x;
|
n_x = motion->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( motion->y >= 7 && motion->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -369,9 +411,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -384,9 +426,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( !( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) ) {
|
if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
|
||||||
if ( ! e_reflow->default_cursor_shown ) {
|
if ( ! e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
||||||
e_reflow->default_cursor_shown = TRUE;
|
e_reflow->default_cursor_shown = TRUE;
|
||||||
@ -433,16 +475,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
||||||
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
||||||
column_width = e_reflow->column_width;
|
column_width = e_reflow->column_width;
|
||||||
running_width = 7 + column_width + 7;
|
running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i = x;
|
i = x;
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -459,25 +501,25 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect,
|
width_rect,
|
||||||
height_rect);
|
height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
int start_line = e_reflow_pick_line(e_reflow,
|
int start_line = e_reflow_pick_line(e_reflow,
|
||||||
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
||||||
i = x - start_line * (column_width + 16);
|
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width = start_line * (column_width + 16);
|
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
i += start_line * (column_width + 16);
|
i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -490,7 +532,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect - 1,
|
width_rect - 1,
|
||||||
height_rect - 1);
|
height_rect - 1);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,34 +584,34 @@ e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gin
|
|||||||
double column_width;
|
double column_width;
|
||||||
|
|
||||||
if ( e_reflow->previous_temp_column_width != -1 ) {
|
if ( e_reflow->previous_temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->previous_temp_column_width;
|
column_width = e_reflow->previous_temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e_reflow->temp_column_width != -1 ) {
|
if ( e_reflow->temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,17 +633,21 @@ e_reflow_point (GnomeCanvasItem *item,
|
|||||||
if (*actual_item)
|
if (*actual_item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (y >= 7 && y <= e_reflow->height - 7) {
|
*actual_item = item;
|
||||||
|
return 0;
|
||||||
|
#if 0
|
||||||
|
if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) {
|
||||||
float n_x;
|
float n_x;
|
||||||
n_x = x;
|
n_x = x;
|
||||||
n_x += 9.0;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x, (e_reflow->column_width + 16));
|
n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if (n_x < 16.0) {
|
if (n_x < E_REFLOW_FULL_GUTTER) {
|
||||||
*actual_item = item;
|
*actual_item = item;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return distance;
|
return distance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -629,7 +675,7 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count = 1;
|
e_reflow->column_count = 1;
|
||||||
|
|
||||||
@ -639,12 +685,12 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
if (running_height + item_height + 7 > e_reflow->height) {
|
if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) {
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count ++;
|
e_reflow->column_count ++;
|
||||||
} else {
|
} else {
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +707,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
old_width = e_reflow->width;
|
old_width = e_reflow->width;
|
||||||
|
|
||||||
running_width = 7;
|
running_width = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
if (e_reflow->items == NULL) {
|
if (e_reflow->items == NULL) {
|
||||||
} else {
|
} else {
|
||||||
@ -670,7 +716,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
gdouble item_height;
|
gdouble item_height;
|
||||||
gdouble running_height;
|
gdouble running_height;
|
||||||
|
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
list = e_reflow->items;
|
list = e_reflow->items;
|
||||||
gtk_object_set (GTK_OBJECT(list->data),
|
gtk_object_set (GTK_OBJECT(list->data),
|
||||||
@ -682,7 +728,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
next_column = g_list_next(e_reflow->columns);
|
next_column = g_list_next(e_reflow->columns);
|
||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
|
|
||||||
@ -696,18 +742,18 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
if (next_column && (next_column->data == list)) {
|
if (next_column && (next_column->data == list)) {
|
||||||
next_column = g_list_next (next_column);
|
next_column = g_list_next (next_column);
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
running_width += e_reflow->column_width + 7 + 2 + 7;
|
running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
|
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
e_reflow->width = running_width + e_reflow->column_width + 7;
|
e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
if ( e_reflow->width < e_reflow->minimum_width )
|
if ( e_reflow->width < e_reflow->minimum_width )
|
||||||
e_reflow->width = e_reflow->minimum_width;
|
e_reflow->width = e_reflow->minimum_width;
|
||||||
if (old_width != e_reflow->width)
|
if (old_width != e_reflow->width)
|
||||||
|
@ -146,6 +146,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_GRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
if (event->button.state & GDK_SHIFT_MASK)
|
if (event->button.state & GDK_SHIFT_MASK)
|
||||||
command.action = E_TEP_SELECT;
|
command.action = E_TEP_SELECT;
|
||||||
else
|
else
|
||||||
@ -158,6 +161,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
break;
|
break;
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_UNGRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
command.time = event->button.time;
|
command.time = event->button.time;
|
||||||
tep_el->mouse_down = FALSE;
|
tep_el->mouse_down = FALSE;
|
||||||
} else if (event->button.button == 2) {
|
} else if (event->button.button == 2) {
|
||||||
|
@ -83,6 +83,9 @@ enum _ETextEventProcessorCommandAction {
|
|||||||
E_TEP_SET_SELECT_BY_WORD,
|
E_TEP_SET_SELECT_BY_WORD,
|
||||||
E_TEP_ACTIVATE,
|
E_TEP_ACTIVATE,
|
||||||
|
|
||||||
|
E_TEP_GRAB,
|
||||||
|
E_TEP_UNGRAB,
|
||||||
|
|
||||||
E_TEP_NOP
|
E_TEP_NOP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1781,18 +1781,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
text->lastx = button.x;
|
text->lastx = button.x;
|
||||||
text->lasty = button.y;
|
text->lasty = button.y;
|
||||||
text->last_state = button.state;
|
text->last_state = button.state;
|
||||||
if (event->type == GDK_BUTTON_PRESS && text->timer) {
|
} else if (text->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) {
|
||||||
g_timer_reset(text->timer);
|
|
||||||
}
|
|
||||||
if (event->type == GDK_BUTTON_PRESS) {
|
|
||||||
gnome_canvas_item_grab (item,
|
|
||||||
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
|
|
||||||
text->i_cursor,
|
|
||||||
button.time);
|
|
||||||
} else {
|
|
||||||
gnome_canvas_item_ungrab (item, button.time);
|
|
||||||
}
|
|
||||||
} else if (text->editable && event->type == GDK_BUTTON_RELEASE) {
|
|
||||||
gnome_canvas_item_grab_focus (item);
|
gnome_canvas_item_grab_focus (item);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1972,6 +1961,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
case E_TEP_MOVE:
|
case E_TEP_MOVE:
|
||||||
text->selection_start = _get_position(text, command);
|
text->selection_start = _get_position(text, command);
|
||||||
text->selection_end = text->selection_start;
|
text->selection_end = text->selection_start;
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_SELECT:
|
case E_TEP_SELECT:
|
||||||
text->selection_end = _get_position(text, command);
|
text->selection_end = _get_position(text, command);
|
||||||
@ -1979,6 +1971,8 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
sel_end = MAX(text->selection_start, text->selection_end);
|
sel_end = MAX(text->selection_start, text->selection_end);
|
||||||
if (sel_start != sel_end) {
|
if (sel_start != sel_end) {
|
||||||
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
|
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
|
||||||
|
} else if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_DELETE:
|
case E_TEP_DELETE:
|
||||||
@ -1988,6 +1982,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
_delete_selection(text);
|
_delete_selection(text);
|
||||||
split_into_lines (text);
|
split_into_lines (text);
|
||||||
recalc_bounds (text);
|
recalc_bounds (text);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_TEP_INSERT:
|
case E_TEP_INSERT:
|
||||||
@ -1997,6 +1994,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
_insert(text, command->string, command->value);
|
_insert(text, command->string, command->value);
|
||||||
split_into_lines (text);
|
split_into_lines (text);
|
||||||
recalc_bounds (text);
|
recalc_bounds (text);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_COPY:
|
case E_TEP_COPY:
|
||||||
sel_start = MIN(text->selection_start, text->selection_end);
|
sel_start = MIN(text->selection_start, text->selection_end);
|
||||||
@ -2004,18 +2004,36 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
if (sel_start != sel_end) {
|
if (sel_start != sel_end) {
|
||||||
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
|
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
|
||||||
}
|
}
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_PASTE:
|
case E_TEP_PASTE:
|
||||||
e_text_get_selection (text, clipboard_atom, command->time);
|
e_text_get_selection (text, clipboard_atom, command->time);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_GET_SELECTION:
|
case E_TEP_GET_SELECTION:
|
||||||
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
|
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
|
||||||
break;
|
break;
|
||||||
case E_TEP_ACTIVATE:
|
case E_TEP_ACTIVATE:
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_SET_SELECT_BY_WORD:
|
case E_TEP_SET_SELECT_BY_WORD:
|
||||||
text->select_by_word = command->value;
|
text->select_by_word = command->value;
|
||||||
break;
|
break;
|
||||||
|
case E_TEP_GRAB:
|
||||||
|
gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text),
|
||||||
|
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
|
||||||
|
text->i_cursor,
|
||||||
|
command->time);
|
||||||
|
break;
|
||||||
|
case E_TEP_UNGRAB:
|
||||||
|
gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time);
|
||||||
|
break;
|
||||||
case E_TEP_NOP:
|
case E_TEP_NOP:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -146,6 +146,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_GRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
if (event->button.state & GDK_SHIFT_MASK)
|
if (event->button.state & GDK_SHIFT_MASK)
|
||||||
command.action = E_TEP_SELECT;
|
command.action = E_TEP_SELECT;
|
||||||
else
|
else
|
||||||
@ -158,6 +161,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
break;
|
break;
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_UNGRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
command.time = event->button.time;
|
command.time = event->button.time;
|
||||||
tep_el->mouse_down = FALSE;
|
tep_el->mouse_down = FALSE;
|
||||||
} else if (event->button.button == 2) {
|
} else if (event->button.button == 2) {
|
||||||
|
@ -83,6 +83,9 @@ enum _ETextEventProcessorCommandAction {
|
|||||||
E_TEP_SET_SELECT_BY_WORD,
|
E_TEP_SET_SELECT_BY_WORD,
|
||||||
E_TEP_ACTIVATE,
|
E_TEP_ACTIVATE,
|
||||||
|
|
||||||
|
E_TEP_GRAB,
|
||||||
|
E_TEP_UNGRAB,
|
||||||
|
|
||||||
E_TEP_NOP
|
E_TEP_NOP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1781,18 +1781,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
text->lastx = button.x;
|
text->lastx = button.x;
|
||||||
text->lasty = button.y;
|
text->lasty = button.y;
|
||||||
text->last_state = button.state;
|
text->last_state = button.state;
|
||||||
if (event->type == GDK_BUTTON_PRESS && text->timer) {
|
} else if (text->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) {
|
||||||
g_timer_reset(text->timer);
|
|
||||||
}
|
|
||||||
if (event->type == GDK_BUTTON_PRESS) {
|
|
||||||
gnome_canvas_item_grab (item,
|
|
||||||
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
|
|
||||||
text->i_cursor,
|
|
||||||
button.time);
|
|
||||||
} else {
|
|
||||||
gnome_canvas_item_ungrab (item, button.time);
|
|
||||||
}
|
|
||||||
} else if (text->editable && event->type == GDK_BUTTON_RELEASE) {
|
|
||||||
gnome_canvas_item_grab_focus (item);
|
gnome_canvas_item_grab_focus (item);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1972,6 +1961,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
case E_TEP_MOVE:
|
case E_TEP_MOVE:
|
||||||
text->selection_start = _get_position(text, command);
|
text->selection_start = _get_position(text, command);
|
||||||
text->selection_end = text->selection_start;
|
text->selection_end = text->selection_start;
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_SELECT:
|
case E_TEP_SELECT:
|
||||||
text->selection_end = _get_position(text, command);
|
text->selection_end = _get_position(text, command);
|
||||||
@ -1979,6 +1971,8 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
sel_end = MAX(text->selection_start, text->selection_end);
|
sel_end = MAX(text->selection_start, text->selection_end);
|
||||||
if (sel_start != sel_end) {
|
if (sel_start != sel_end) {
|
||||||
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
|
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
|
||||||
|
} else if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_DELETE:
|
case E_TEP_DELETE:
|
||||||
@ -1988,6 +1982,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
_delete_selection(text);
|
_delete_selection(text);
|
||||||
split_into_lines (text);
|
split_into_lines (text);
|
||||||
recalc_bounds (text);
|
recalc_bounds (text);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_TEP_INSERT:
|
case E_TEP_INSERT:
|
||||||
@ -1997,6 +1994,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
_insert(text, command->string, command->value);
|
_insert(text, command->string, command->value);
|
||||||
split_into_lines (text);
|
split_into_lines (text);
|
||||||
recalc_bounds (text);
|
recalc_bounds (text);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_COPY:
|
case E_TEP_COPY:
|
||||||
sel_start = MIN(text->selection_start, text->selection_end);
|
sel_start = MIN(text->selection_start, text->selection_end);
|
||||||
@ -2004,18 +2004,36 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
if (sel_start != sel_end) {
|
if (sel_start != sel_end) {
|
||||||
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
|
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
|
||||||
}
|
}
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_PASTE:
|
case E_TEP_PASTE:
|
||||||
e_text_get_selection (text, clipboard_atom, command->time);
|
e_text_get_selection (text, clipboard_atom, command->time);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_GET_SELECTION:
|
case E_TEP_GET_SELECTION:
|
||||||
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
|
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
|
||||||
break;
|
break;
|
||||||
case E_TEP_ACTIVATE:
|
case E_TEP_ACTIVATE:
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_SET_SELECT_BY_WORD:
|
case E_TEP_SET_SELECT_BY_WORD:
|
||||||
text->select_by_word = command->value;
|
text->select_by_word = command->value;
|
||||||
break;
|
break;
|
||||||
|
case E_TEP_GRAB:
|
||||||
|
gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text),
|
||||||
|
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
|
||||||
|
text->i_cursor,
|
||||||
|
command->time);
|
||||||
|
break;
|
||||||
|
case E_TEP_UNGRAB:
|
||||||
|
gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time);
|
||||||
|
break;
|
||||||
case E_TEP_NOP:
|
case E_TEP_NOP:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@ static void _update_reflow ( EReflow *reflow );
|
|||||||
static void _resize( GtkObject *object, gpointer data );
|
static void _resize( GtkObject *object, gpointer data );
|
||||||
static void _queue_reflow(EReflow *e_reflow);
|
static void _queue_reflow(EReflow *e_reflow);
|
||||||
|
|
||||||
|
#define E_REFLOW_DIVIDER_WIDTH 2
|
||||||
|
#define E_REFLOW_BORDER_WIDTH 7
|
||||||
|
#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
|
||||||
|
|
||||||
static GnomeCanvasGroupClass *parent_class = NULL;
|
static GnomeCanvasGroupClass *parent_class = NULL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -196,6 +200,7 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
EReflow *e_reflow;
|
EReflow *e_reflow;
|
||||||
GnomeCanvasGroup *group;
|
GnomeCanvasGroup *group;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
|
||||||
e_reflow = E_REFLOW (item);
|
e_reflow = E_REFLOW (item);
|
||||||
group = GNOME_CANVAS_GROUP( item );
|
group = GNOME_CANVAS_GROUP( item );
|
||||||
@ -219,6 +224,11 @@ e_reflow_realize (GnomeCanvasItem *item)
|
|||||||
|
|
||||||
_queue_reflow( e_reflow );
|
_queue_reflow( e_reflow );
|
||||||
|
|
||||||
|
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
|
adjustment->step_increment = (e_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) {
|
if (!item->canvas->aa) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,8 +257,8 @@ e_reflow_unrealize (GnomeCanvasItem *item)
|
|||||||
static gint
|
static gint
|
||||||
e_reflow_pick_line (EReflow *e_reflow, double x)
|
e_reflow_pick_line (EReflow *e_reflow, double x)
|
||||||
{
|
{
|
||||||
x += 9;
|
x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
x /= e_reflow->column_width + 16;
|
x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,15 +301,18 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
|
switch(event->button.button)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
{
|
{
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = button->x;
|
n_x = button->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( button->y >= 7 && button->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
|
||||||
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + 16) - 1;
|
e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
|
||||||
e_reflow->temp_column_width = e_reflow->column_width;
|
e_reflow->temp_column_width = e_reflow->column_width;
|
||||||
e_reflow->column_drag = TRUE;
|
e_reflow->column_drag = TRUE;
|
||||||
|
|
||||||
@ -315,18 +328,47 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
|
gdouble old_width = e_reflow->column_width;
|
||||||
GdkEventButton *button = (GdkEventButton *) event;
|
GdkEventButton *button = (GdkEventButton *) event;
|
||||||
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
|
||||||
e_reflow->temp_column_width = e_reflow->column_width +
|
e_reflow->temp_column_width = e_reflow->column_width +
|
||||||
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
(button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
|
||||||
if ( e_reflow->temp_column_width < 50 )
|
if ( e_reflow->temp_column_width < 50 )
|
||||||
e_reflow->temp_column_width = 50;
|
e_reflow->temp_column_width = 50;
|
||||||
|
e_reflow->column_drag = FALSE;
|
||||||
|
if ( old_width != e_reflow->temp_column_width ) {
|
||||||
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
|
||||||
e_reflow->column_width = e_reflow->temp_column_width;
|
e_reflow->column_width = e_reflow->temp_column_width;
|
||||||
e_reflow->column_drag = FALSE;
|
adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
|
||||||
|
adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
|
||||||
|
gtk_adjustment_changed(adjustment);
|
||||||
_queue_reflow(e_reflow);
|
_queue_reflow(e_reflow);
|
||||||
|
} else {
|
||||||
|
e_reflow->need_column_resize = TRUE;
|
||||||
|
gnome_canvas_item_request_update(item);
|
||||||
|
}
|
||||||
gnome_canvas_item_ungrab (item, button->time);
|
gnome_canvas_item_ungrab (item, button->time);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -349,9 +391,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventMotion *motion = (GdkEventMotion *) event;
|
GdkEventMotion *motion = (GdkEventMotion *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = motion->x;
|
n_x = motion->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( motion->y >= 7 && motion->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -369,9 +411,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) {
|
if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) {
|
||||||
if ( e_reflow->default_cursor_shown ) {
|
if ( e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
|
||||||
e_reflow->default_cursor_shown = FALSE;
|
e_reflow->default_cursor_shown = FALSE;
|
||||||
@ -384,9 +426,9 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
GdkEventCrossing *crossing = (GdkEventCrossing *) event;
|
||||||
double n_x;
|
double n_x;
|
||||||
n_x = crossing->x;
|
n_x = crossing->x;
|
||||||
n_x += 9;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x,(e_reflow->column_width + 16));
|
n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if ( !( crossing->y >= 7 && crossing->y <= e_reflow->height - 7 && n_x < 16 ) ) {
|
if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
|
||||||
if ( ! e_reflow->default_cursor_shown ) {
|
if ( ! e_reflow->default_cursor_shown ) {
|
||||||
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
|
||||||
e_reflow->default_cursor_shown = TRUE;
|
e_reflow->default_cursor_shown = TRUE;
|
||||||
@ -433,16 +475,16 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
|
||||||
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
|
||||||
column_width = e_reflow->column_width;
|
column_width = e_reflow->column_width;
|
||||||
running_width = 7 + column_width + 7;
|
running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i = x;
|
i = x;
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -459,25 +501,25 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect,
|
width_rect,
|
||||||
height_rect);
|
height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
if (e_reflow->column_drag) {
|
if (e_reflow->column_drag) {
|
||||||
int start_line = e_reflow_pick_line(e_reflow,
|
int start_line = e_reflow_pick_line(e_reflow,
|
||||||
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
|
||||||
i = x - start_line * (column_width + 16);
|
i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width = start_line * (column_width + 16);
|
running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
i += start_line * (column_width + 16);
|
i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
/* Compute first column to draw. */
|
/* Compute first column to draw. */
|
||||||
i /= column_width + 16;
|
i /= column_width + E_REFLOW_FULL_GUTTER;
|
||||||
running_width += i * (column_width + 16);
|
running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
|
|
||||||
for ( ; i < e_reflow->column_count; i++) {
|
for ( ; i < e_reflow->column_count; i++) {
|
||||||
if ( running_width > x + width )
|
if ( running_width > x + width )
|
||||||
@ -490,7 +532,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
|||||||
y_rect - y,
|
y_rect - y,
|
||||||
width_rect - 1,
|
width_rect - 1,
|
||||||
height_rect - 1);
|
height_rect - 1);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,34 +584,34 @@ e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gin
|
|||||||
double column_width;
|
double column_width;
|
||||||
|
|
||||||
if ( e_reflow->previous_temp_column_width != -1 ) {
|
if ( e_reflow->previous_temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->previous_temp_column_width;
|
column_width = e_reflow->previous_temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( e_reflow->temp_column_width != -1 ) {
|
if ( e_reflow->temp_column_width != -1 ) {
|
||||||
running_width = start_line * (e_reflow->column_width + 16);
|
running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
|
||||||
column_width = e_reflow->temp_column_width;
|
column_width = e_reflow->temp_column_width;
|
||||||
running_width -= start_line * (column_width + 16);
|
running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
|
||||||
running_width += 7 + column_width + 7;
|
running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
y_rect = 7;
|
y_rect = E_REFLOW_BORDER_WIDTH;
|
||||||
width_rect = 2;
|
width_rect = E_REFLOW_DIVIDER_WIDTH;
|
||||||
height_rect = e_reflow->height - 14;
|
height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
|
||||||
|
|
||||||
for ( i = 0; i < e_reflow->column_count; i++) {
|
for ( i = 0; i < e_reflow->column_count; i++) {
|
||||||
x_rect = running_width;
|
x_rect = running_width;
|
||||||
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
|
||||||
running_width += 2 + 7 + column_width + 7;
|
running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,17 +633,21 @@ e_reflow_point (GnomeCanvasItem *item,
|
|||||||
if (*actual_item)
|
if (*actual_item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (y >= 7 && y <= e_reflow->height - 7) {
|
*actual_item = item;
|
||||||
|
return 0;
|
||||||
|
#if 0
|
||||||
|
if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) {
|
||||||
float n_x;
|
float n_x;
|
||||||
n_x = x;
|
n_x = x;
|
||||||
n_x += 9.0;
|
n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
|
||||||
n_x = fmod(n_x, (e_reflow->column_width + 16));
|
n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER));
|
||||||
if (n_x < 16.0) {
|
if (n_x < E_REFLOW_FULL_GUTTER) {
|
||||||
*actual_item = item;
|
*actual_item = item;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return distance;
|
return distance;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -629,7 +675,7 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count = 1;
|
e_reflow->column_count = 1;
|
||||||
|
|
||||||
@ -639,12 +685,12 @@ _reflow( EReflow *e_reflow )
|
|||||||
gtk_object_get (GTK_OBJECT(list->data),
|
gtk_object_get (GTK_OBJECT(list->data),
|
||||||
"height", &item_height,
|
"height", &item_height,
|
||||||
NULL);
|
NULL);
|
||||||
if (running_height + item_height + 7 > e_reflow->height) {
|
if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) {
|
||||||
running_height = 7 + item_height + 7;
|
running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
e_reflow->columns = g_list_append (e_reflow->columns, list);
|
||||||
e_reflow->column_count ++;
|
e_reflow->column_count ++;
|
||||||
} else {
|
} else {
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -661,7 +707,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
old_width = e_reflow->width;
|
old_width = e_reflow->width;
|
||||||
|
|
||||||
running_width = 7;
|
running_width = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
if (e_reflow->items == NULL) {
|
if (e_reflow->items == NULL) {
|
||||||
} else {
|
} else {
|
||||||
@ -670,7 +716,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
gdouble item_height;
|
gdouble item_height;
|
||||||
gdouble running_height;
|
gdouble running_height;
|
||||||
|
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
|
|
||||||
list = e_reflow->items;
|
list = e_reflow->items;
|
||||||
gtk_object_set (GTK_OBJECT(list->data),
|
gtk_object_set (GTK_OBJECT(list->data),
|
||||||
@ -682,7 +728,7 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
next_column = g_list_next(e_reflow->columns);
|
next_column = g_list_next(e_reflow->columns);
|
||||||
list = g_list_next(list);
|
list = g_list_next(list);
|
||||||
|
|
||||||
@ -696,18 +742,18 @@ _update_reflow( EReflow *e_reflow )
|
|||||||
|
|
||||||
if (next_column && (next_column->data == list)) {
|
if (next_column && (next_column->data == list)) {
|
||||||
next_column = g_list_next (next_column);
|
next_column = g_list_next (next_column);
|
||||||
running_height = 7;
|
running_height = E_REFLOW_BORDER_WIDTH;
|
||||||
running_width += e_reflow->column_width + 7 + 2 + 7;
|
running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
|
||||||
(double) running_width,
|
(double) running_width,
|
||||||
(double) running_height);
|
(double) running_height);
|
||||||
|
|
||||||
running_height += item_height + 7;
|
running_height += item_height + E_REFLOW_BORDER_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
e_reflow->width = running_width + e_reflow->column_width + 7;
|
e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH;
|
||||||
if ( e_reflow->width < e_reflow->minimum_width )
|
if ( e_reflow->width < e_reflow->minimum_width )
|
||||||
e_reflow->width = e_reflow->minimum_width;
|
e_reflow->width = e_reflow->minimum_width;
|
||||||
if (old_width != e_reflow->width)
|
if (old_width != e_reflow->width)
|
||||||
|
@ -146,6 +146,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_GRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
if (event->button.state & GDK_SHIFT_MASK)
|
if (event->button.state & GDK_SHIFT_MASK)
|
||||||
command.action = E_TEP_SELECT;
|
command.action = E_TEP_SELECT;
|
||||||
else
|
else
|
||||||
@ -158,6 +161,9 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
|
|||||||
break;
|
break;
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
if (event->button.button == 1) {
|
if (event->button.button == 1) {
|
||||||
|
command.action = E_TEP_UNGRAB;
|
||||||
|
command.time = event->button.time;
|
||||||
|
gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
|
||||||
command.time = event->button.time;
|
command.time = event->button.time;
|
||||||
tep_el->mouse_down = FALSE;
|
tep_el->mouse_down = FALSE;
|
||||||
} else if (event->button.button == 2) {
|
} else if (event->button.button == 2) {
|
||||||
|
@ -83,6 +83,9 @@ enum _ETextEventProcessorCommandAction {
|
|||||||
E_TEP_SET_SELECT_BY_WORD,
|
E_TEP_SET_SELECT_BY_WORD,
|
||||||
E_TEP_ACTIVATE,
|
E_TEP_ACTIVATE,
|
||||||
|
|
||||||
|
E_TEP_GRAB,
|
||||||
|
E_TEP_UNGRAB,
|
||||||
|
|
||||||
E_TEP_NOP
|
E_TEP_NOP
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1781,18 +1781,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
|
|||||||
text->lastx = button.x;
|
text->lastx = button.x;
|
||||||
text->lasty = button.y;
|
text->lasty = button.y;
|
||||||
text->last_state = button.state;
|
text->last_state = button.state;
|
||||||
if (event->type == GDK_BUTTON_PRESS && text->timer) {
|
} else if (text->editable && event->type == GDK_BUTTON_RELEASE && event->button.button == 1) {
|
||||||
g_timer_reset(text->timer);
|
|
||||||
}
|
|
||||||
if (event->type == GDK_BUTTON_PRESS) {
|
|
||||||
gnome_canvas_item_grab (item,
|
|
||||||
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
|
|
||||||
text->i_cursor,
|
|
||||||
button.time);
|
|
||||||
} else {
|
|
||||||
gnome_canvas_item_ungrab (item, button.time);
|
|
||||||
}
|
|
||||||
} else if (text->editable && event->type == GDK_BUTTON_RELEASE) {
|
|
||||||
gnome_canvas_item_grab_focus (item);
|
gnome_canvas_item_grab_focus (item);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1972,6 +1961,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
case E_TEP_MOVE:
|
case E_TEP_MOVE:
|
||||||
text->selection_start = _get_position(text, command);
|
text->selection_start = _get_position(text, command);
|
||||||
text->selection_end = text->selection_start;
|
text->selection_end = text->selection_start;
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_SELECT:
|
case E_TEP_SELECT:
|
||||||
text->selection_end = _get_position(text, command);
|
text->selection_end = _get_position(text, command);
|
||||||
@ -1979,6 +1971,8 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
sel_end = MAX(text->selection_start, text->selection_end);
|
sel_end = MAX(text->selection_start, text->selection_end);
|
||||||
if (sel_start != sel_end) {
|
if (sel_start != sel_end) {
|
||||||
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
|
e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start);
|
||||||
|
} else if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_DELETE:
|
case E_TEP_DELETE:
|
||||||
@ -1988,6 +1982,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
_delete_selection(text);
|
_delete_selection(text);
|
||||||
split_into_lines (text);
|
split_into_lines (text);
|
||||||
recalc_bounds (text);
|
recalc_bounds (text);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case E_TEP_INSERT:
|
case E_TEP_INSERT:
|
||||||
@ -1997,6 +1994,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
_insert(text, command->string, command->value);
|
_insert(text, command->string, command->value);
|
||||||
split_into_lines (text);
|
split_into_lines (text);
|
||||||
recalc_bounds (text);
|
recalc_bounds (text);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_COPY:
|
case E_TEP_COPY:
|
||||||
sel_start = MIN(text->selection_start, text->selection_end);
|
sel_start = MIN(text->selection_start, text->selection_end);
|
||||||
@ -2004,18 +2004,36 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
|
|||||||
if (sel_start != sel_end) {
|
if (sel_start != sel_end) {
|
||||||
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
|
e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start);
|
||||||
}
|
}
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_PASTE:
|
case E_TEP_PASTE:
|
||||||
e_text_get_selection (text, clipboard_atom, command->time);
|
e_text_get_selection (text, clipboard_atom, command->time);
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_GET_SELECTION:
|
case E_TEP_GET_SELECTION:
|
||||||
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
|
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
|
||||||
break;
|
break;
|
||||||
case E_TEP_ACTIVATE:
|
case E_TEP_ACTIVATE:
|
||||||
|
if (text->timer) {
|
||||||
|
g_timer_reset(text->timer);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case E_TEP_SET_SELECT_BY_WORD:
|
case E_TEP_SET_SELECT_BY_WORD:
|
||||||
text->select_by_word = command->value;
|
text->select_by_word = command->value;
|
||||||
break;
|
break;
|
||||||
|
case E_TEP_GRAB:
|
||||||
|
gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text),
|
||||||
|
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
|
||||||
|
text->i_cursor,
|
||||||
|
command->time);
|
||||||
|
break;
|
||||||
|
case E_TEP_UNGRAB:
|
||||||
|
gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time);
|
||||||
|
break;
|
||||||
case E_TEP_NOP:
|
case E_TEP_NOP:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user