From fcbbdfbd18e15b4ee8322a0217cf03a689a5e033 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- widgets/text/e-reflow-model.c | 31 ++++-- widgets/text/e-reflow.c | 110 ++++++++++++++------- widgets/text/e-text-model-repos.c | 9 +- widgets/text/e-text-model.c | 59 ++++++++---- widgets/text/e-text.c | 170 ++++++++++++++++++++------------- widgets/text/gal-a11y-e-text-factory.c | 2 +- widgets/text/gal-a11y-e-text.c | 148 ++++++++++++++-------------- 7 files changed, 322 insertions(+), 207 deletions(-) (limited to 'widgets/text') diff --git a/widgets/text/e-reflow-model.c b/widgets/text/e-reflow-model.c index f96d512f1e..05457d0145 100644 --- a/widgets/text/e-reflow-model.c +++ b/widgets/text/e-reflow-model.c @@ -52,7 +52,8 @@ static guint e_reflow_model_signals[LAST_SIGNAL] = { 0, }; * @width: The new value for the width of each item. */ void -e_reflow_model_set_width (EReflowModel *e_reflow_model, gint width) +e_reflow_model_set_width (EReflowModel *e_reflow_model, + gint width) { g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); @@ -84,7 +85,9 @@ e_reflow_model_count (EReflowModel *e_reflow_model) * Returns: the height of the nth item. */ gint -e_reflow_model_height (EReflowModel *e_reflow_model, gint n, GnomeCanvasGroup *parent) +e_reflow_model_height (EReflowModel *e_reflow_model, + gint n, + GnomeCanvasGroup *parent) { g_return_val_if_fail (e_reflow_model != NULL, 0); g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); @@ -103,7 +106,9 @@ e_reflow_model_height (EReflowModel *e_reflow_model, gint n, GnomeCanvasGroup *p * Returns: the new GnomeCanvasItem. */ GnomeCanvasItem * -e_reflow_model_incarnate (EReflowModel *e_reflow_model, gint n, GnomeCanvasGroup *parent) +e_reflow_model_incarnate (EReflowModel *e_reflow_model, + gint n, + GnomeCanvasGroup *parent) { g_return_val_if_fail (e_reflow_model != NULL, NULL); g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL); @@ -148,7 +153,10 @@ e_reflow_model_create_cmp_cache (EReflowModel *e_reflow_model) * Returns: strcmp like semantics for the comparison value. */ gint -e_reflow_model_compare (EReflowModel *e_reflow_model, gint n1, gint n2, GHashTable *cmp_cache) +e_reflow_model_compare (EReflowModel *e_reflow_model, + gint n1, + gint n2, + GHashTable *cmp_cache) { #if 0 g_return_val_if_fail (e_reflow_model != NULL, 0); @@ -167,7 +175,9 @@ e_reflow_model_compare (EReflowModel *e_reflow_model, gint n1, gint n2, GHashTab * Update item to represent the nth piece of data. */ void -e_reflow_model_reincarnate (EReflowModel *e_reflow_model, gint n, GnomeCanvasItem *item) +e_reflow_model_reincarnate (EReflowModel *e_reflow_model, + gint n, + GnomeCanvasItem *item) { g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); @@ -312,7 +322,9 @@ e_reflow_model_comparison_changed (EReflowModel *e_reflow_model) * Use this function to notify any views of the reflow model that a number of items have been inserted. **/ void -e_reflow_model_items_inserted (EReflowModel *e_reflow_model, gint position, gint count) +e_reflow_model_items_inserted (EReflowModel *e_reflow_model, + gint position, + gint count) { g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); @@ -335,8 +347,8 @@ e_reflow_model_items_inserted (EReflowModel *e_reflow_model, gint position, gint * item has been removed. **/ void -e_reflow_model_item_removed (EReflowModel *e_reflow_model, - gint n) +e_reflow_model_item_removed (EReflowModel *e_reflow_model, + gint n) { g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); @@ -362,7 +374,8 @@ e_reflow_model_item_removed (EReflowModel *e_reflow_model, * object */ void -e_reflow_model_item_changed (EReflowModel *e_reflow_model, gint n) +e_reflow_model_item_changed (EReflowModel *e_reflow_model, + gint n) { g_return_if_fail (e_reflow_model != NULL); g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); diff --git a/widgets/text/e-reflow.c b/widgets/text/e-reflow.c index 1b99d6aec7..02535d7b34 100644 --- a/widgets/text/e-reflow.c +++ b/widgets/text/e-reflow.c @@ -85,14 +85,18 @@ er_create_cmp_cache (gpointer user_data) } static gint -er_compare (gint i1, gint i2, GHashTable *cmp_cache, gpointer user_data) +er_compare (gint i1, + gint i2, + GHashTable *cmp_cache, + gpointer user_data) { EReflow *reflow = user_data; return e_reflow_model_compare (reflow->model, i1, i2, cmp_cache); } static gint -e_reflow_pick_line (EReflow *reflow, gdouble x) +e_reflow_pick_line (EReflow *reflow, + gdouble x) { x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; x /= reflow->column_width + E_REFLOW_FULL_GUTTER; @@ -100,7 +104,8 @@ e_reflow_pick_line (EReflow *reflow, gdouble x) } static gint -er_find_item (EReflow *reflow, GnomeCanvasItem *item) +er_find_item (EReflow *reflow, + GnomeCanvasItem *item) { gint i; for (i = 0; i < reflow->count; i++) { @@ -129,7 +134,8 @@ e_reflow_resize_children (GnomeCanvasItem *item) } static inline void -e_reflow_update_selection_row (EReflow *reflow, gint row) +e_reflow_update_selection_row (EReflow *reflow, + gint row) { if (reflow->items[row]) { g_object_set (reflow->items[row], @@ -157,13 +163,16 @@ e_reflow_update_selection (EReflow *reflow) } static void -selection_changed (ESelectionModel *selection, EReflow *reflow) +selection_changed (ESelectionModel *selection, + EReflow *reflow) { e_reflow_update_selection (reflow); } static void -selection_row_changed (ESelectionModel *selection, gint row, EReflow *reflow) +selection_row_changed (ESelectionModel *selection, + gint row, + EReflow *reflow) { e_reflow_update_selection_row (reflow, row); } @@ -208,7 +217,10 @@ do_adjustment (gpointer user_data) } static void -cursor_changed (ESelectionModel *selection, gint row, gint col, EReflow *reflow) +cursor_changed (ESelectionModel *selection, + gint row, + gint col, + EReflow *reflow) { gint count = reflow->count; gint old_cursor = reflow->cursor_row; @@ -329,8 +341,8 @@ reflow_columns (EReflow *reflow) } else { /* we start one column before the earliest new entry, - so we can handle the case where the new entry is - inserted at the start of the column */ + * so we can handle the case where the new entry is + * inserted at the start of the column */ column_start = reflow->reflow_from_column - 1; start = reflow->columns[column_start]; column_count = column_start + 1; @@ -371,7 +383,9 @@ reflow_columns (EReflow *reflow) } static void -item_changed (EReflowModel *model, gint i, EReflow *reflow) +item_changed (EReflowModel *model, + gint i, + EReflow *reflow) { if (i < 0 || i >= reflow->count) return; @@ -386,7 +400,9 @@ item_changed (EReflowModel *model, gint i, EReflow *reflow) } static void -item_removed (EReflowModel *model, gint i, EReflow *reflow) +item_removed (EReflowModel *model, + gint i, + EReflow *reflow) { gint c; gint sorted; @@ -428,7 +444,10 @@ item_removed (EReflowModel *model, gint i, EReflow *reflow) } static void -items_inserted (EReflowModel *model, gint position, gint count, EReflow *reflow) +items_inserted (EReflowModel *model, + gint position, + gint count, + EReflow *reflow) { gint i, oldcount; @@ -481,7 +500,8 @@ items_inserted (EReflowModel *model, gint position, gint count, EReflow *reflow) } static void -model_changed (EReflowModel *model, EReflow *reflow) +model_changed (EReflowModel *model, + EReflow *reflow) { gint i; gint count; @@ -518,7 +538,8 @@ model_changed (EReflowModel *model, EReflow *reflow) } static void -comparison_changed (EReflowModel *model, EReflow *reflow) +comparison_changed (EReflowModel *model, + EReflow *reflow) { e_sorter_array_clean (reflow->sorter); reflow->reflow_from_column = -1; @@ -615,7 +636,8 @@ disconnect_selection (EReflow *reflow) } static void -connect_model (EReflow *reflow, EReflowModel *model) +connect_model (EReflow *reflow, + EReflowModel *model) { if (reflow->model != NULL) disconnect_model (reflow); @@ -644,7 +666,8 @@ connect_model (EReflow *reflow, EReflowModel *model) } static void -adjustment_changed (GtkAdjustment *adjustment, EReflow *reflow) +adjustment_changed (GtkAdjustment *adjustment, + EReflow *reflow) { queue_incarnate (reflow); } @@ -668,7 +691,8 @@ disconnect_adjustment (EReflow *reflow) } static void -connect_adjustment (EReflow *reflow, GtkAdjustment *adjustment) +connect_adjustment (EReflow *reflow, + GtkAdjustment *adjustment) { if (reflow->adjustment != NULL) disconnect_adjustment (reflow); @@ -688,7 +712,10 @@ connect_adjustment (EReflow *reflow, GtkAdjustment *adjustment) #if 0 static void -set_scroll_adjustments (GtkLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj, EReflow *reflow) +set_scroll_adjustments (GtkLayout *layout, + GtkAdjustment *hadj, + GtkAdjustment *vadj, + EReflow *reflow) { connect_adjustment (reflow, hadj); } @@ -723,7 +750,10 @@ column_width_changed (EReflow *reflow) /* Virtual functions */ static void -e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +e_reflow_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) { GnomeCanvasItem *item; EReflow *reflow; @@ -731,7 +761,7 @@ e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GPar item = GNOME_CANVAS_ITEM (object); reflow = E_REFLOW (object); - switch (prop_id) { + switch (property_id) { case PROP_HEIGHT: reflow->height = g_value_get_double (value); reflow->need_reflow_columns = TRUE; @@ -785,13 +815,16 @@ e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GPar } static void -e_reflow_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +e_reflow_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) { EReflow *reflow; reflow = E_REFLOW (object); - switch (prop_id) { + switch (property_id) { case PROP_MINIMUM_WIDTH: g_value_set_double (value, reflow->minimum_width); break; @@ -811,7 +844,7 @@ e_reflow_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec g_value_set_double (value, reflow->column_width); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } @@ -922,7 +955,8 @@ e_reflow_unrealize (GnomeCanvasItem *item) } static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) +e_reflow_event (GnomeCanvasItem *item, + GdkEvent *event) { EReflow *reflow; gint return_val = FALSE; @@ -1054,7 +1088,7 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) value = gtk_adjustment_get_value (adjustment); reflow->temp_column_width = reflow->column_width + - (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line (reflow, value)); + (button->x - reflow->start_x) / (reflow->which_column_dragged - e_reflow_pick_line (reflow, value)); if (reflow->temp_column_width < 50) reflow->temp_column_width = 50; reflow->column_drag = FALSE; @@ -1094,7 +1128,7 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) value = gtk_adjustment_get_value (adjustment); reflow->temp_column_width = reflow->column_width + - (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line (reflow, value)); + (motion->x - reflow->start_x) / (reflow->which_column_dragged - e_reflow_pick_line (reflow, value)); if (reflow->temp_column_width < 50) reflow->temp_column_width = 50; if (old_width != reflow->temp_column_width) { @@ -1268,7 +1302,9 @@ e_reflow_draw (GnomeCanvasItem *item, } static void -e_reflow_update (GnomeCanvasItem *item, const cairo_matrix_t *i2c, gint flags) +e_reflow_update (GnomeCanvasItem *item, + const cairo_matrix_t *i2c, + gint flags) { EReflow *reflow; gdouble x0, x1, y0, y1; @@ -1359,7 +1395,10 @@ e_reflow_update (GnomeCanvasItem *item, const cairo_matrix_t *i2c, gint flags) static GnomeCanvasItem * e_reflow_point (GnomeCanvasItem *item, - gdouble x, gdouble y, gint cx, gint cy) + gdouble x, + gdouble y, + gint cx, + gint cy) { GnomeCanvasItem *child; @@ -1383,7 +1422,8 @@ e_reflow_point (GnomeCanvasItem *item, } static void -e_reflow_reflow ( GnomeCanvasItem *item, gint flags ) +e_reflow_reflow (GnomeCanvasItem *item, + gint flags) { EReflow *reflow = E_REFLOW (item); gdouble old_width; @@ -1429,7 +1469,9 @@ e_reflow_reflow ( GnomeCanvasItem *item, gint flags ) } static gint -e_reflow_selection_event_real (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event) +e_reflow_selection_event_real (EReflow *reflow, + GnomeCanvasItem *item, + GdkEvent *event) { gint row; gint return_val = TRUE; @@ -1484,7 +1526,7 @@ e_reflow_class_init (EReflowClass *klass) GObjectClass *object_class; GnomeCanvasItemClass *item_class; - object_class = (GObjectClass*) klass; + object_class = (GObjectClass *) klass; item_class = (GnomeCanvasItemClass *) klass; object_class->set_property = e_reflow_set_property; @@ -1612,13 +1654,13 @@ e_reflow_init (EReflow *reflow) NULL); reflow->selection_changed_id = - g_signal_connect(reflow->selection, "selection_changed", + g_signal_connect (reflow->selection, "selection_changed", G_CALLBACK (selection_changed), reflow); reflow->selection_row_changed_id = - g_signal_connect(reflow->selection, "selection_row_changed", + g_signal_connect (reflow->selection, "selection_row_changed", G_CALLBACK (selection_row_changed), reflow); reflow->cursor_changed_id = - g_signal_connect(reflow->selection, "cursor_changed", + g_signal_connect (reflow->selection, "cursor_changed", G_CALLBACK (cursor_changed), reflow); e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (reflow), e_reflow_reflow); diff --git a/widgets/text/e-text-model-repos.c b/widgets/text/e-text-model-repos.c index 0b7a3433fd..b56a213215 100644 --- a/widgets/text/e-text-model-repos.c +++ b/widgets/text/e-text-model-repos.c @@ -30,7 +30,8 @@ #define MODEL_CLAMP(model, pos) (CLAMP((pos), 0, strlen((model)->text))) gint -e_repos_absolute (gint pos, gpointer data) +e_repos_absolute (gint pos, + gpointer data) { EReposAbsolute *info = (EReposAbsolute *) data; g_return_val_if_fail (data, -1); @@ -45,7 +46,8 @@ e_repos_absolute (gint pos, gpointer data) } gint -e_repos_insert_shift (gint pos, gpointer data) +e_repos_insert_shift (gint pos, + gpointer data) { EReposInsertShift *info = (EReposInsertShift *) data; g_return_val_if_fail (data, -1); @@ -57,7 +59,8 @@ e_repos_insert_shift (gint pos, gpointer data) } gint -e_repos_delete_shift (gint pos, gpointer data) +e_repos_delete_shift (gint pos, + gpointer data) { EReposDeleteShift *info = (EReposDeleteShift *) data; g_return_val_if_fail (data, -1); diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index f079346b72..a2c34a7a84 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -171,7 +171,8 @@ e_text_model_dispose (GObject *object) } static gint -e_text_model_real_validate_position (ETextModel *model, gint pos) +e_text_model_real_validate_position (ETextModel *model, + gint pos) { gint len = e_text_model_get_text_length (model); @@ -199,7 +200,8 @@ e_text_model_real_get_text_length (ETextModel *model) } static void -e_text_model_real_set_text (ETextModel *model, const gchar *text) +e_text_model_real_set_text (ETextModel *model, + const gchar *text) { EReposAbsolute repos; gboolean changed = FALSE; @@ -226,7 +228,9 @@ e_text_model_real_set_text (ETextModel *model, const gchar *text) } static void -e_text_model_real_insert (ETextModel *model, gint position, const gchar *text) +e_text_model_real_insert (ETextModel *model, + gint position, + const gchar *text) { e_text_model_insert_length (model, position, text, strlen (text)); } @@ -268,7 +272,9 @@ e_text_model_real_insert_length (ETextModel *model, } static void -e_text_model_real_delete (ETextModel *model, gint position, gint length) +e_text_model_real_delete (ETextModel *model, + gint position, + gint length) { EReposDeleteShift repos; gint byte_position, byte_length; @@ -322,7 +328,9 @@ e_text_model_cancel_completion (ETextModel *model) } void -e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data) +e_text_model_reposition (ETextModel *model, + ETextModelReposFn fn, + gpointer repos_data) { g_return_if_fail (E_IS_TEXT_MODEL (model)); g_return_if_fail (fn != NULL); @@ -333,7 +341,8 @@ e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos } gint -e_text_model_validate_position (ETextModel *model, gint pos) +e_text_model_validate_position (ETextModel *model, + gint pos) { g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0); @@ -380,7 +389,8 @@ e_text_model_get_text_length (ETextModel *model) } void -e_text_model_set_text (ETextModel *model, const gchar *text) +e_text_model_set_text (ETextModel *model, + const gchar *text) { g_return_if_fail (E_IS_TEXT_MODEL (model)); @@ -389,7 +399,9 @@ e_text_model_set_text (ETextModel *model, const gchar *text) } void -e_text_model_insert (ETextModel *model, gint position, const gchar *text) +e_text_model_insert (ETextModel *model, + gint position, + const gchar *text) { g_return_if_fail (E_IS_TEXT_MODEL (model)); @@ -417,7 +429,8 @@ e_text_model_insert_length (ETextModel *model, } void -e_text_model_prepend (ETextModel *model, const gchar *text) +e_text_model_prepend (ETextModel *model, + const gchar *text) { g_return_if_fail (E_IS_TEXT_MODEL (model)); @@ -428,7 +441,8 @@ e_text_model_prepend (ETextModel *model, const gchar *text) } void -e_text_model_append (ETextModel *model, const gchar *text) +e_text_model_append (ETextModel *model, + const gchar *text) { g_return_if_fail (E_IS_TEXT_MODEL (model)); @@ -439,7 +453,9 @@ e_text_model_append (ETextModel *model, const gchar *text) } void -e_text_model_delete (ETextModel *model, gint position, gint length) +e_text_model_delete (ETextModel *model, + gint position, + gint length) { gint txt_len; @@ -469,7 +485,9 @@ e_text_model_object_count (ETextModel *model) } const gchar * -e_text_model_get_nth_object (ETextModel *model, gint n, gint *len) +e_text_model_get_nth_object (ETextModel *model, + gint n, + gint *len) { g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL); @@ -483,7 +501,8 @@ e_text_model_get_nth_object (ETextModel *model, gint n, gint *len) } gchar * -e_text_model_strdup_nth_object (ETextModel *model, gint n) +e_text_model_strdup_nth_object (ETextModel *model, + gint n) { const gchar *obj; gint len = 0; @@ -503,7 +522,10 @@ e_text_model_strdup_nth_object (ETextModel *model, gint n) } void -e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start, gint *end) +e_text_model_get_nth_object_bounds (ETextModel *model, + gint n, + gint *start, + gint *end) { const gchar *txt = NULL, *obj = NULL; gint len = 0; @@ -522,7 +544,8 @@ e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start, gint } gint -e_text_model_get_object_at_offset (ETextModel *model, gint offset) +e_text_model_get_object_at_offset (ETextModel *model, + gint offset) { g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1); @@ -553,7 +576,8 @@ e_text_model_get_object_at_offset (ETextModel *model, gint offset) } gint -e_text_model_get_object_at_pointer (ETextModel *model, const gchar *s) +e_text_model_get_object_at_pointer (ETextModel *model, + const gchar *s) { g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1); g_return_val_if_fail (s != NULL, -1); @@ -563,7 +587,8 @@ e_text_model_get_object_at_pointer (ETextModel *model, const gchar *s) } void -e_text_model_activate_nth_object (ETextModel *model, gint n) +e_text_model_activate_nth_object (ETextModel *model, + gint n) { g_return_if_fail (model != NULL); g_return_if_fail (E_IS_TEXT_MODEL (model)); diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index fefc0a3317..b57cec835d 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -191,7 +191,8 @@ disconnect_im_context (EText *text) #if 0 static void -e_text_style_set (EText *text, GtkStyle *previous_style) +e_text_style_set (EText *text, + GtkStyle *previous_style) { if (text->line_wrap) { text->needs_split_into_lines = 1; @@ -463,7 +464,8 @@ reset_layout (EText *text) } static void -e_text_text_model_changed (ETextModel *model, EText *text) +e_text_text_model_changed (ETextModel *model, + EText *text) { gint model_len = e_text_model_get_text_length (model); text->text = e_text_model_get_text (model); @@ -494,7 +496,7 @@ e_text_text_model_reposition (ETextModel *model, text->selection_end = fn (text->selection_end, repos_data); /* Our repos function should make sure we don't overrun the buffer, but it never - hurts to be paranoid. */ + * hurts to be paranoid. */ text->selection_start = CLAMP (text->selection_start, 0, model_len); text->selection_end = CLAMP (text->selection_end, 0, model_len); @@ -506,7 +508,11 @@ e_text_text_model_reposition (ETextModel *model, } static void -get_bounds (EText *text, gdouble *px1, gdouble *py1, gdouble *px2, gdouble *py2) +get_bounds (EText *text, + gdouble *px1, + gdouble *py1, + gdouble *px2, + gdouble *py2) { GnomeCanvasItem *item; gdouble wx, wy, clip_width, clip_height; @@ -608,7 +614,7 @@ split_into_lines (EText *text) /* Set_arg handler for the text item */ static void e_text_set_property (GObject *object, - guint prop_id, + guint property_id, const GValue *value, GParamSpec *pspec) { @@ -623,7 +629,7 @@ e_text_set_property (GObject *object, item = GNOME_CANVAS_ITEM (object); text = E_TEXT (object); - switch (prop_id) { + switch (property_id) { case PROP_MODEL: if (text->model_changed_signal_id) @@ -726,9 +732,9 @@ e_text_set_property (GObject *object, text->clip_height = fabs (g_value_get_double (value)); text->needs_recalc_bounds = 1; /* toshok: kind of a hack - set needs_reset_layout - here so when something about the style/them - changes, we redraw the text at the proper size/with - the proper font. */ + * here so when something about the style/them + * changes, we redraw the text at the proper size/with + * the proper font. */ text->needs_reset_layout = 1; needs_reflow = 1; break; @@ -936,7 +942,7 @@ e_text_set_property (GObject *object, /* Get_arg handler for the text item */ static void e_text_get_property (GObject *object, - guint prop_id, + guint property_id, GValue *value, GParamSpec *pspec) { @@ -944,7 +950,7 @@ e_text_get_property (GObject *object, text = E_TEXT (object); - switch (prop_id) { + switch (property_id) { case PROP_MODEL: g_value_set_object (value, text->model); break; @@ -1070,14 +1076,15 @@ e_text_get_property (GObject *object, break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /* Update handler for the text item */ static void -e_text_reflow (GnomeCanvasItem *item, gint flags) +e_text_reflow (GnomeCanvasItem *item, + gint flags) { EText *text; @@ -1106,7 +1113,9 @@ e_text_reflow (GnomeCanvasItem *item, gint flags) /* Update handler for the text item */ static void -e_text_update (GnomeCanvasItem *item, const cairo_matrix_t *i2c, gint flags) +e_text_update (GnomeCanvasItem *item, + const cairo_matrix_t *i2c, + gint flags) { EText *text; gdouble x1, y1, x2, y2; @@ -1213,7 +1222,8 @@ draw_pango_rectangle (cairo_t *cr, } static gboolean -show_pango_rectangle (EText *text, PangoRectangle rect) +show_pango_rectangle (EText *text, + PangoRectangle rect) { gint x1 = rect.x / PANGO_SCALE; gint x2 = (rect.x + rect.width) / PANGO_SCALE; @@ -1278,8 +1288,12 @@ show_pango_rectangle (EText *text, PangoRectangle rect) /* Draw handler for the text item */ static void -e_text_draw (GnomeCanvasItem *item, cairo_t *cr, - gint x, gint y, gint width, gint height) +e_text_draw (GnomeCanvasItem *item, + cairo_t *cr, + gint x, + gint y, + gint width, + gint height) { EText *text; gint xpos, ypos; @@ -1536,8 +1550,11 @@ e_text_draw (GnomeCanvasItem *item, cairo_t *cr, /* Point handler for the text item */ static GnomeCanvasItem * -e_text_point (GnomeCanvasItem *item, gdouble x, gdouble y, - gint cx, gint cy) +e_text_point (GnomeCanvasItem *item, + gdouble x, + gdouble y, + gint cx, + gint cy) { EText *text; gdouble clip_width; @@ -1609,7 +1626,9 @@ e_text_bounds (GnomeCanvasItem *item, } static gint -get_position_from_xy (EText *text, gint x, gint y) +get_position_from_xy (EText *text, + gint x, + gint y) { gint index; gint trailing; @@ -1801,7 +1820,8 @@ _click (gpointer data) } static gint -e_text_event (GnomeCanvasItem *item, GdkEvent *event) +e_text_event (GnomeCanvasItem *item, + GdkEvent *event) { EText *text = E_TEXT (item); ETextEventProcessorEvent e_tep_event; @@ -1896,7 +1916,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) if (text->im_context && gtk_im_context_filter_keypress ( text->im_context, - (GdkEventKey*) event)) { + (GdkEventKey *) event)) { text->need_im_reset = TRUE; return 1; } @@ -1982,7 +2002,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) } /* Create our own double and triple click events, - as gnome-canvas doesn't forward them to us */ + * as gnome-canvas doesn't forward them to us */ if (event->type == GDK_BUTTON_PRESS) { if (text->dbl_timeout == 0 && text->tpl_timeout == 0) { @@ -2135,10 +2155,10 @@ e_text_select_all (EText *text) } static void -primary_get_cb (GtkClipboard *clipboard, - GtkSelectionData *selection_data, - guint info, - gpointer data) +primary_get_cb (GtkClipboard *clipboard, + GtkSelectionData *selection_data, + guint info, + gpointer data) { EText *text = E_TEXT (data); gint sel_start, sel_end; @@ -2159,7 +2179,7 @@ primary_get_cb (GtkClipboard *clipboard, static void primary_clear_cb (GtkClipboard *clipboard, - gpointer data) + gpointer data) { #ifdef notyet /* XXX */ @@ -2197,8 +2217,8 @@ e_text_update_primary_selection (EText *text) static void paste_received (GtkClipboard *clipboard, - const gchar *text, - gpointer data) + const gchar *text, + gpointer data) { EText *etext = E_TEXT (data); @@ -2213,7 +2233,8 @@ paste_received (GtkClipboard *clipboard, } static void -e_text_paste (EText *text, GdkAtom selection) +e_text_paste (EText *text, + GdkAtom selection) { g_object_ref (text); gtk_clipboard_request_text ( @@ -2230,7 +2251,7 @@ typedef struct { static void popup_menu_detach (GtkWidget *attach_widget, - GtkMenu *menu) + GtkMenu *menu) { } @@ -2258,9 +2279,9 @@ popup_menu_placement_cb (GtkMenu *menu, } static void -popup_targets_received (GtkClipboard *clipboard, - GtkSelectionData *data, - gpointer user_data) +popup_targets_received (GtkClipboard *clipboard, + GtkSelectionData *data, + gpointer user_data) { PopupClosure *closure = user_data; EText *text = closure->text; @@ -2348,7 +2369,9 @@ popup_targets_received (GtkClipboard *clipboard, } static void -e_text_do_popup (EText *text, GdkEventButton *button, gint position) +e_text_do_popup (EText *text, + GdkEventButton *button, + gint position) { PopupClosure *closure = g_new (PopupClosure, 1); @@ -2377,7 +2400,8 @@ e_text_reset_im_context (EText *text) /* fixme: */ static gint -next_word (EText *text, gint start) +next_word (EText *text, + gint start) { gchar *p = g_utf8_offset_to_pointer (text->text, start); gint length; @@ -2406,7 +2430,9 @@ next_word (EText *text, gint start) } static gint -find_offset_into_line (EText *text, gint offset_into_text, gchar **start_of_line) +find_offset_into_line (EText *text, + gint offset_into_text, + gchar **start_of_line) { gchar *p; @@ -2436,10 +2462,11 @@ find_offset_into_line (EText *text, gint offset_into_text, gchar **start_of_line } /* direction = TRUE (move forward), FALSE (move backward) - Any error shall return length (text->text) or 0 or - text->selection_end (as deemed fit) */ + * Any error shall return length (text->text) or 0 or + * text->selection_end (as deemed fit) */ static gint -_get_updated_position (EText *text, gboolean direction) +_get_updated_position (EText *text, + gboolean direction) { PangoLogAttr *log_attrs = NULL; gint n_attrs; @@ -2469,7 +2496,7 @@ _get_updated_position (EText *text, gboolean direction) pango_layout_get_log_attrs (text->layout, &log_attrs, &n_attrs); /* Fetch the current gchar index in the line & keep moving - forward until we can display cursor */ + * forward until we can display cursor */ p = g_utf8_offset_to_pointer (text->text, text->selection_end); new_pos = text->selection_end; @@ -2489,7 +2516,7 @@ _get_updated_position (EText *text, gboolean direction) new_pos = g_utf8_pointer_to_offset (text->text, p); /* if is_cursor_position is set, cursor can appear in front of character. - i.e. this is a grapheme boundary AND make some sanity checks */ + * i.e. this is a grapheme boundary AND make some sanity checks */ if ((new_pos >=0) && (new_pos < n_attrs) && (log_attrs[new_pos].is_cursor_position)) break; @@ -2507,7 +2534,8 @@ _get_updated_position (EText *text, gboolean direction) } static gint -_get_position (EText *text, ETextEventProcessorCommand *command) +_get_position (EText *text, + ETextEventProcessorCommand *command) { gint length, obj_num; gunichar unival; @@ -2636,7 +2664,7 @@ _get_position (EText *text, ETextEventProcessorCommand *command) return text->selection_end; /* now we search forward til we hit a \n, and then - offset_into_line more characters */ + * offset_into_line more characters */ p = g_utf8_offset_to_pointer (text->text, text->selection_end); while (p && *p) { if (*p == '\n') @@ -2645,7 +2673,7 @@ _get_position (EText *text, ETextEventProcessorCommand *command) } if (p && *p == '\n') { /* now we loop forward offset_into_line - characters, or until we hit \n or \0 */ + * characters, or until we hit \n or \0 */ p = g_utf8_next_char (p); while (offset_into_line > 0 && p && *p != '\n' && *p != '\0') { @@ -2655,7 +2683,7 @@ _get_position (EText *text, ETextEventProcessorCommand *command) } /* at this point, p points to the new location, - convert it to an offset and we're done */ + * convert it to an offset and we're done */ new_pos = g_utf8_pointer_to_offset (text->text, p); break; } @@ -2666,8 +2694,8 @@ _get_position (EText *text, ETextEventProcessorCommand *command) return text->selection_end; /* p points to the first character on our line. if we - have a \n before it, skip it and scan til we hit - the next one */ + * have a \n before it, skip it and scan til we hit + * the next one */ if (p != text->text) { p = g_utf8_find_prev_char (text->text, p); if (*p == '\n') { @@ -2683,8 +2711,8 @@ _get_position (EText *text, ETextEventProcessorCommand *command) } /* at this point 'p' points to the start of the - previous line, move forward 'offset_into_line' - times. */ + * previous line, move forward 'offset_into_line' + * times. */ while (offset_into_line > 0 && p && *p != '\n' && *p != '\0') { p = g_utf8_next_char (p); @@ -2692,14 +2720,14 @@ _get_position (EText *text, ETextEventProcessorCommand *command) } /* at this point, p points to the new location, - convert it to an offset and we're done */ + * convert it to an offset and we're done */ new_pos = g_utf8_pointer_to_offset (text->text, p); break; } case E_TEP_SELECT_WORD: /* This is a silly hack to cause double-clicking on an object - to activate that object. - (Normally, double click == select word, which is why this is here.) */ + * to activate that object. + * (Normally, double click == select word, which is why this is here.) */ obj_num = e_text_model_get_object_at_offset ( text->model, text->selection_start); @@ -2781,7 +2809,8 @@ _get_position (EText *text, ETextEventProcessorCommand *command) } static void -e_text_insert (EText *text, const gchar *string) +e_text_insert (EText *text, + const gchar *string) { gint len = strlen (string); @@ -2820,7 +2849,10 @@ e_text_insert (EText *text, const gchar *string) } static void -capitalize (EText *text, gint start, gint end, ETextEventProcessorCaps type) +capitalize (EText *text, + gint start, + gint end, + ETextEventProcessorCaps type) { gboolean first = TRUE; const gchar *p = g_utf8_offset_to_pointer (text->text, start); @@ -2992,17 +3024,17 @@ e_text_command (ETextEventProcessor *tep, e_text_reset_im_context (text); /* it's possible to get here without ever having been realized - by our canvas (if the e-text started completely obscured.) - so let's create our layout object if we don't already have - one. */ + * by our canvas (if the e-text started completely obscured.) + * so let's create our layout object if we don't already have + * one. */ if (!text->layout) create_layout (text); /* We move cursor only if scroll is TRUE */ if (scroll && !text->button_down) { /* XXX do we really need the @trailing logic here? if - we don't we can scrap the loop and just use - pango_layout_index_to_pos */ + * we don't we can scrap the loop and just use + * pango_layout_index_to_pos */ PangoLayoutLine *cur_line = NULL; gint selection_index; PangoLayoutIter *iter = pango_layout_get_iter (text->layout); @@ -3477,8 +3509,8 @@ e_text_init (EText *text) /* IM Context Callbacks */ static void e_text_commit_cb (GtkIMContext *context, - const gchar *str, - EText *text) + const gchar *str, + EText *text) { if (g_utf8_validate (str, strlen (str), NULL)) { if (text->selection_end != text->selection_start) @@ -3490,7 +3522,7 @@ e_text_commit_cb (GtkIMContext *context, static void e_text_preedit_changed_cb (GtkIMContext *context, - EText *etext) + EText *etext) { gchar *preedit_string = NULL; gint cursor_pos; @@ -3509,7 +3541,7 @@ e_text_preedit_changed_cb (GtkIMContext *context, static gboolean e_text_retrieve_surrounding_cb (GtkIMContext *context, - EText *text) + EText *text) { gtk_im_context_set_surrounding ( context, text->text, strlen (text->text), @@ -3520,10 +3552,10 @@ e_text_retrieve_surrounding_cb (GtkIMContext *context, } static gboolean -e_text_delete_surrounding_cb (GtkIMContext *context, - gint offset, - gint n_chars, - EText *text) +e_text_delete_surrounding_cb (GtkIMContext *context, + gint offset, + gint n_chars, + EText *text) { e_text_model_delete (text->model, MIN (text->selection_start, text->selection_end) + offset, diff --git a/widgets/text/gal-a11y-e-text-factory.c b/widgets/text/gal-a11y-e-text-factory.c index a1ffaa0d90..8da12ee294 100644 --- a/widgets/text/gal-a11y-e-text-factory.c +++ b/widgets/text/gal-a11y-e-text-factory.c @@ -39,7 +39,7 @@ gal_a11y_e_text_factory_get_accessible_type (void) return GAL_A11Y_TYPE_E_TEXT; } -static AtkObject* +static AtkObject * gal_a11y_e_text_factory_create_accessible (GObject *obj) { AtkObject *atk_object; diff --git a/widgets/text/gal-a11y-e-text.c b/widgets/text/gal-a11y-e-text.c index a657543305..609b23a900 100644 --- a/widgets/text/gal-a11y-e-text.c +++ b/widgets/text/gal-a11y-e-text.c @@ -57,11 +57,11 @@ et_dispose (GObject *object) static void et_get_extents (AtkComponent *component, - gint *x, - gint *y, - gint *width, - gint *height, - AtkCoordType coord_type) + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coord_type) { EText *item = E_TEXT (atk_gobject_accessible_get_object ( ATK_GOBJECT_ACCESSIBLE (component))); @@ -107,7 +107,7 @@ et_get_full_text (AtkText *text) static void et_set_full_text (AtkEditableText *text, - const gchar *full_text) + const gchar *full_text) { EText *etext = E_TEXT (atk_gobject_accessible_get_object ( ATK_GOBJECT_ACCESSIBLE (text))); @@ -120,8 +120,8 @@ et_set_full_text (AtkEditableText *text, static gchar * et_get_text (AtkText *text, - gint start_offset, - gint end_offset) + gint start_offset, + gint end_offset) { gint start, end, real_start, real_end, len; const gchar *full_text = et_get_full_text (text); @@ -153,8 +153,8 @@ is_a_seperator (gunichar c) static gint find_word_start (const gchar *text, - gint begin_offset, - gint step) + gint begin_offset, + gint step) { gint offset; gchar *at_offset; @@ -167,7 +167,7 @@ find_word_start (const gchar *text, while (offset > 0 && offset < len) { at_offset = g_utf8_offset_to_pointer (text, offset); current = g_utf8_get_char_validated (at_offset, -1); - at_offset = g_utf8_offset_to_pointer (text, offset-1); + at_offset = g_utf8_offset_to_pointer (text, offset - 1); previous = g_utf8_get_char_validated (at_offset, -1); if ((!is_a_seperator (current)) && is_a_seperator (previous)) break; @@ -179,8 +179,8 @@ find_word_start (const gchar *text, static gint find_word_end (const gchar *text, - gint begin_offset, - gint step) + gint begin_offset, + gint step) { gint offset; gchar *at_offset; @@ -193,7 +193,7 @@ find_word_end (const gchar *text, while (offset > 0 && offset < len) { at_offset = g_utf8_offset_to_pointer (text, offset); current = g_utf8_get_char_validated (at_offset, -1); - at_offset = g_utf8_offset_to_pointer (text, offset-1); + at_offset = g_utf8_offset_to_pointer (text, offset - 1); previous = g_utf8_get_char_validated (at_offset, -1); if (is_a_seperator (current) && (!is_a_seperator (previous))) break; @@ -205,8 +205,8 @@ find_word_end (const gchar *text, static gint find_sentence_start (const gchar *text, - gint begin_offset, - gint step) + gint begin_offset, + gint step) { gint offset, last_word_end, len; gchar *at_offset; @@ -216,7 +216,7 @@ find_sentence_start (const gchar *text, offset = find_word_start (text, begin_offset, step); len = g_utf8_strlen (text, -1); - while (offset>0 && offset 0 && offset