~bratsche/ubuntu/maverick/gtk+2.0/menu-activation-fix

« back to all changes in this revision

Viewing changes to gtk/gtktexttag.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-06-13 10:00:13 UTC
  • mto: (72.2.1 lenny) (1.5.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20070613100013-qstao3cwpm6xdlxc
Tags: upstream-2.11.2
ImportĀ upstreamĀ versionĀ 2.11.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
#include "gtktexttag.h"
53
53
#include "gtktexttypes.h"
54
54
#include "gtktexttagtable.h"
55
 
#include "gtkmain.h"
56
55
#include "gtkintl.h"
57
56
#include "gtkmarshalers.h"
58
57
#include "gtkprivate.h"
107
106
  PROP_INVISIBLE,
108
107
  PROP_PARAGRAPH_BACKGROUND,
109
108
  PROP_PARAGRAPH_BACKGROUND_GDK,
 
109
 
 
110
  /* Behavior args */
 
111
  PROP_ACCUMULATIVE_MARGIN,
110
112
  
111
113
  /* Whether-a-style-arg-is-set args */
112
114
  PROP_BACKGROUND_SET,
535
537
                                                       GDK_TYPE_COLOR,
536
538
                                                       GTK_PARAM_READWRITE));
537
539
 
 
540
  /**
 
541
   * GtkTextTag:accumulative-margin:
 
542
   *
 
543
   * Whether the margins accumulate or override each other.
 
544
   *
 
545
   * When set to %TRUE the margins of this tag are added to the margins 
 
546
   * of any other non-accumulative margins present. When set to %FALSE 
 
547
   * the margins override one another (the default).
 
548
   *
 
549
   * Since: 2.12
 
550
   */
 
551
  g_object_class_install_property (object_class,
 
552
                                   PROP_ACCUMULATIVE_MARGIN,
 
553
                                   g_param_spec_boolean ("accumulative-margin",
 
554
                                                         P_("Margin Accumulates"),
 
555
                                                         P_("Whether left and right margins accumulate."),
 
556
                                                         FALSE,
 
557
                                                         GTK_PARAM_READWRITE));
 
558
 
538
559
  /* Style props are set or not */
539
560
 
540
561
#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE))
650
671
  ADD_SET_PROP ("paragraph-background-set", PROP_PARAGRAPH_BACKGROUND_SET,
651
672
                P_("Paragraph background set"),
652
673
                P_("Whether this tag affects the paragraph background color"));
653
 
  
 
674
 
 
675
  /**
 
676
   * GtkTextTag::event:
 
677
   * @tag: the #GtkTextTag on which the signal is emitted
 
678
   * @object: the object the event was fired from (typically a #GtkTextView)
 
679
   * @event: the event which triggered the signal
 
680
   * @iter: a #GtkTextIter pointing at the location the event occured
 
681
   *
 
682
   * The ::event signal is emitted when an event occurs on a region of the
 
683
   * buffer marked with this tag.
 
684
   *
 
685
   * Returns: %TRUE to stop other handlers from being invoked for the
 
686
   * event. %FALSE to propagate the event further.
 
687
   */
654
688
  signals[EVENT] =
655
689
    g_signal_new (I_("event"),
656
690
                  G_OBJECT_CLASS_TYPE (object_class),
1278
1312
      }
1279
1313
      break;
1280
1314
 
 
1315
    case PROP_ACCUMULATIVE_MARGIN:
 
1316
      text_tag->accumulative_margin = g_value_get_boolean (value);
 
1317
      g_object_notify (object, "accumulative-margin");
 
1318
      size_changed = TRUE;
 
1319
      break;
 
1320
 
1281
1321
      /* Whether the value should be used... */
1282
1322
 
1283
1323
    case PROP_BACKGROUND_SET:
1604
1644
      g_value_set_boxed (value, tag->values->pg_bg_color);
1605
1645
      break;
1606
1646
 
 
1647
    case PROP_ACCUMULATIVE_MARGIN:
 
1648
      g_value_set_boolean (value, tag->accumulative_margin);
 
1649
      break;
 
1650
 
1607
1651
    case PROP_BACKGROUND_SET:
1608
1652
      g_value_set_boolean (value, tag->bg_color_set);
1609
1653
      break;
2136
2180
{
2137
2181
  guint n = 0;
2138
2182
 
 
2183
  guint left_margin_accumulative = 0;
 
2184
  guint right_margin_accumulative = 0;
 
2185
 
2139
2186
  g_return_if_fail (!dest->realized);
2140
2187
 
2141
2188
  while (n < n_tags)
2197
2244
      if (vals->direction != GTK_TEXT_DIR_NONE)
2198
2245
        dest->direction = vals->direction;
2199
2246
 
2200
 
      if (tag->left_margin_set)
2201
 
        dest->left_margin = vals->left_margin;
 
2247
      if (tag->left_margin_set) 
 
2248
        {
 
2249
          if (tag->accumulative_margin)
 
2250
            left_margin_accumulative += vals->left_margin;
 
2251
          else
 
2252
            dest->left_margin = vals->left_margin;
 
2253
        }
2202
2254
 
2203
2255
      if (tag->indent_set)
2204
2256
        dest->indent = vals->indent;
2206
2258
      if (tag->rise_set)
2207
2259
        dest->appearance.rise = vals->appearance.rise;
2208
2260
 
2209
 
      if (tag->right_margin_set)
2210
 
        dest->right_margin = vals->right_margin;
 
2261
      if (tag->right_margin_set) 
 
2262
        {
 
2263
          if (tag->accumulative_margin)
 
2264
            right_margin_accumulative += vals->right_margin;
 
2265
          else
 
2266
            dest->right_margin = vals->right_margin;
 
2267
        }
2211
2268
 
2212
2269
      if (tag->pixels_above_lines_set)
2213
2270
        dest->pixels_above_lines = vals->pixels_above_lines;
2248
2305
 
2249
2306
      ++n;
2250
2307
    }
 
2308
 
 
2309
  dest->left_margin += left_margin_accumulative;
 
2310
  dest->right_margin += right_margin_accumulative;
2251
2311
}
2252
2312
 
2253
2313
gboolean