~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to libgimpwidgets/gimpwidgets.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 **/
56
56
GtkWidget *
57
57
gimp_radio_group_new (gboolean            in_frame,
58
 
                      const gchar        *frame_title,
59
 
 
60
 
                      /* specify radio buttons as va_list:
61
 
                       *  const gchar    *label,
62
 
                       *  GCallback       callback,
63
 
                       *  gpointer        callback_data,
64
 
                       *  gpointer        item_data,
65
 
                       *  GtkWidget     **widget_ptr,
66
 
                       *  gboolean        active,
67
 
                       */
68
 
 
69
 
                      ...)
 
58
                      const gchar        *frame_title,
 
59
 
 
60
                      /* specify radio buttons as va_list:
 
61
                       *  const gchar    *label,
 
62
                       *  GCallback       callback,
 
63
                       *  gpointer        callback_data,
 
64
                       *  gpointer        item_data,
 
65
                       *  GtkWidget     **widget_ptr,
 
66
                       *  gboolean        active,
 
67
                       */
 
68
 
 
69
                      ...)
70
70
{
71
71
  GtkWidget *vbox;
72
72
  GtkWidget *button;
98
98
      active        = va_arg (args, gboolean);
99
99
 
100
100
      if (label != (gpointer) 1)
101
 
        button = gtk_radio_button_new_with_mnemonic (group, label);
 
101
        button = gtk_radio_button_new_with_mnemonic (group, label);
102
102
      else
103
 
        button = gtk_radio_button_new (group);
 
103
        button = gtk_radio_button_new (group);
104
104
 
105
105
      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
106
106
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
114
114
        }
115
115
 
116
116
      if (widget_ptr)
117
 
        *widget_ptr = button;
 
117
        *widget_ptr = button;
118
118
 
119
119
      if (active)
120
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
120
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
121
121
 
122
122
      g_signal_connect (button, "toggled",
123
 
                        callback,
124
 
                        callback_data);
 
123
                        callback,
 
124
                        callback_data);
125
125
 
126
126
      gtk_widget_show (button);
127
127
 
164
164
 **/
165
165
GtkWidget *
166
166
gimp_radio_group_new2 (gboolean         in_frame,
167
 
                       const gchar     *frame_title,
168
 
                       GCallback        radio_button_callback,
169
 
                       gpointer         callback_data,
170
 
                       gpointer         initial, /* item_data */
171
 
 
172
 
                       /* specify radio buttons as va_list:
173
 
                        *  const gchar *label,
174
 
                        *  gpointer     item_data,
175
 
                        *  GtkWidget  **widget_ptr,
176
 
                        */
177
 
 
178
 
                       ...)
 
167
                       const gchar     *frame_title,
 
168
                       GCallback        radio_button_callback,
 
169
                       gpointer         callback_data,
 
170
                       gpointer         initial, /* item_data */
 
171
 
 
172
                       /* specify radio buttons as va_list:
 
173
                        *  const gchar *label,
 
174
                        *  gpointer     item_data,
 
175
                        *  GtkWidget  **widget_ptr,
 
176
                        */
 
177
 
 
178
                       ...)
179
179
{
180
180
  GtkWidget *vbox;
181
181
  GtkWidget *button;
202
202
      widget_ptr = va_arg (args, GtkWidget **);
203
203
 
204
204
      if (label != (gpointer) 1)
205
 
        button = gtk_radio_button_new_with_mnemonic (group, label);
 
205
        button = gtk_radio_button_new_with_mnemonic (group, label);
206
206
      else
207
 
        button = gtk_radio_button_new (group);
 
207
        button = gtk_radio_button_new (group);
208
208
 
209
209
      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
210
210
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
218
218
        }
219
219
 
220
220
      if (widget_ptr)
221
 
        *widget_ptr = button;
 
221
        *widget_ptr = button;
222
222
 
223
223
      if (initial == item_data)
224
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
224
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
225
225
 
226
226
      g_signal_connect (button, "toggled",
227
 
                        radio_button_callback,
228
 
                        callback_data);
 
227
                        radio_button_callback,
 
228
                        callback_data);
229
229
 
230
230
      gtk_widget_show (button);
231
231
 
271
271
 **/
272
272
GtkWidget *
273
273
gimp_int_radio_group_new (gboolean         in_frame,
274
 
                          const gchar     *frame_title,
275
 
                          GCallback        radio_button_callback,
276
 
                          gpointer         callback_data,
277
 
                          gint             initial, /* item_data */
278
 
 
279
 
                          /* specify radio buttons as va_list:
280
 
                           *  const gchar *label,
281
 
                           *  gint         item_data,
282
 
                           *  GtkWidget  **widget_ptr,
283
 
                           */
284
 
 
285
 
                          ...)
 
274
                          const gchar     *frame_title,
 
275
                          GCallback        radio_button_callback,
 
276
                          gpointer         callback_data,
 
277
                          gint             initial, /* item_data */
 
278
 
 
279
                          /* specify radio buttons as va_list:
 
280
                           *  const gchar *label,
 
281
                           *  gint         item_data,
 
282
                           *  GtkWidget  **widget_ptr,
 
283
                           */
 
284
 
 
285
                          ...)
286
286
{
287
287
  GtkWidget *vbox;
288
288
  GtkWidget *button;
312
312
      item_ptr = GINT_TO_POINTER (item_data);
313
313
 
314
314
      if (label != GINT_TO_POINTER (1))
315
 
        button = gtk_radio_button_new_with_mnemonic (group, label);
 
315
        button = gtk_radio_button_new_with_mnemonic (group, label);
316
316
      else
317
 
        button = gtk_radio_button_new (group);
 
317
        button = gtk_radio_button_new (group);
318
318
 
319
319
      group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
320
320
      gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
328
328
        }
329
329
 
330
330
      if (widget_ptr)
331
 
        *widget_ptr = button;
 
331
        *widget_ptr = button;
332
332
 
333
333
      if (initial == item_data)
334
 
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
334
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
335
335
 
336
336
      g_signal_connect (button, "toggled",
337
 
                        radio_button_callback,
338
 
                        callback_data);
 
337
                        radio_button_callback,
 
338
                        callback_data);
339
339
 
340
340
      gtk_widget_show (button);
341
341
 
419
419
 * @climb_rate:     The spinbutton's climb rate.
420
420
 * @digits:         The spinbutton's number of decimal digits.
421
421
 *
422
 
 * This function is a shortcut for gtk_adjustment_new() and a subsequent
423
 
 * gtk_spin_button_new() and does some more initialisation stuff like
424
 
 * setting a standard minimum horizontal size.
 
422
 * This function is a shortcut for gtk_adjustment_new() and a
 
423
 * subsequent gtk_spin_button_new(). It also calls
 
424
 * gtk_spin_button_set_numeric() so that non-numeric text cannot be
 
425
 * entered.
425
426
 *
426
427
 * Returns: A #GtkSpinbutton and it's #GtkAdjustment.
427
428
 **/
428
429
GtkWidget *
429
430
gimp_spin_button_new (GtkObject **adjustment,  /* return value */
430
 
                      gdouble     value,
431
 
                      gdouble     lower,
432
 
                      gdouble     upper,
433
 
                      gdouble     step_increment,
434
 
                      gdouble     page_increment,
435
 
                      gdouble     page_size,
436
 
                      gdouble     climb_rate,
437
 
                      guint       digits)
 
431
                      gdouble     value,
 
432
                      gdouble     lower,
 
433
                      gdouble     upper,
 
434
                      gdouble     step_increment,
 
435
                      gdouble     page_increment,
 
436
                      gdouble     page_size,
 
437
                      gdouble     climb_rate,
 
438
                      guint       digits)
438
439
{
439
440
  GtkWidget *spinbutton;
440
441
 
441
442
  *adjustment = gtk_adjustment_new (value, lower, upper,
442
 
                                    step_increment, page_increment, page_size);
 
443
                                    step_increment, page_increment, page_size);
443
444
 
444
445
  spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment),
445
 
                                    climb_rate, digits);
 
446
                                    climb_rate, digits);
 
447
 
446
448
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
447
449
 
448
450
  return spinbutton;
450
452
 
451
453
static void
452
454
gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment,
453
 
                                                    GtkAdjustment *other_adj)
 
455
                                                    GtkAdjustment *other_adj)
454
456
{
455
457
  g_signal_handlers_block_by_func (other_adj,
456
 
                                   gimp_scale_entry_unconstrained_adjustment_callback,
457
 
                                   adjustment);
 
458
                                   gimp_scale_entry_unconstrained_adjustment_callback,
 
459
                                   adjustment);
458
460
 
459
461
  gtk_adjustment_set_value (other_adj, adjustment->value);
460
462
 
461
463
  g_signal_handlers_unblock_by_func (other_adj,
462
 
                                     gimp_scale_entry_unconstrained_adjustment_callback,
463
 
                                     adjustment);
 
464
                                     gimp_scale_entry_unconstrained_adjustment_callback,
 
465
                                     adjustment);
464
466
}
465
467
 
466
468
static void
540
542
 
541
543
  if (tooltip)
542
544
    {
543
 
      ebox = gtk_event_box_new ();
 
545
      ebox = g_object_new (GTK_TYPE_EVENT_BOX,
 
546
                           "visible-window", FALSE,
 
547
                           NULL);
544
548
      gtk_table_attach (GTK_TABLE (table), ebox,
545
549
                        column, column + 1, row, row + 1,
546
550
                        GTK_FILL, GTK_FILL, 0, 0);
565
569
      GtkObject *constrained_adj;
566
570
 
567
571
      constrained_adj = gtk_adjustment_new (value, lower, upper,
568
 
                                            step_increment, page_increment,
569
 
                                            0.0);
 
572
                                            step_increment, page_increment,
 
573
                                            0.0);
570
574
 
571
575
      spinbutton = gimp_spin_button_new (&adjustment, value,
572
 
                                         unconstrained_lower,
573
 
                                         unconstrained_upper,
574
 
                                         step_increment, page_increment, 0.0,
575
 
                                         1.0, digits);
576
 
 
577
 
      g_signal_connect
578
 
        (G_OBJECT (constrained_adj), "value_changed",
579
 
         G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
580
 
         adjustment);
581
 
 
582
 
      g_signal_connect
583
 
        (G_OBJECT (adjustment), "value_changed",
584
 
         G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
585
 
         constrained_adj);
 
576
                                         unconstrained_lower,
 
577
                                         unconstrained_upper,
 
578
                                         step_increment, page_increment, 0.0,
 
579
                                         1.0, digits);
 
580
 
 
581
      g_signal_connect
 
582
        (G_OBJECT (constrained_adj), "value-changed",
 
583
         G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
 
584
         adjustment);
 
585
 
 
586
      g_signal_connect
 
587
        (G_OBJECT (adjustment), "value-changed",
 
588
         G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
 
589
         constrained_adj);
586
590
 
587
591
      return_adj = adjustment;
588
592
 
591
595
  else
592
596
    {
593
597
      spinbutton = gimp_spin_button_new (&adjustment, value, lower, upper,
594
 
                                         step_increment, page_increment, 0.0,
595
 
                                         1.0, digits);
 
598
                                         step_increment, page_increment, 0.0,
 
599
                                         1.0, digits);
596
600
 
597
601
      return_adj = adjustment;
598
602
    }
625
629
  gtk_scale_set_digits (GTK_SCALE (scale), digits);
626
630
  gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
627
631
  gtk_table_attach (GTK_TABLE (table), scale,
628
 
                    column + 1, column + 2, row, row + 1,
629
 
                    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
 
632
                    column + 1, column + 2, row, row + 1,
 
633
                    GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
630
634
  gtk_widget_show (scale);
631
635
 
632
636
  gtk_table_attach (GTK_TABLE (table), spinbutton,
633
 
                    column + 2, column + 3, row, row + 1,
634
 
                    GTK_SHRINK, GTK_SHRINK, 0, 0);
 
637
                    column + 2, column + 3, row, row + 1,
 
638
                    GTK_SHRINK, GTK_SHRINK, 0, 0);
635
639
  gtk_widget_show (spinbutton);
636
640
 
637
641
  if (tooltip || help_id)
683
687
 **/
684
688
GtkObject *
685
689
gimp_scale_entry_new (GtkTable    *table,
686
 
                      gint         column,
687
 
                      gint         row,
688
 
                      const gchar *text,
689
 
                      gint         scale_width,
690
 
                      gint         spinbutton_width,
691
 
                      gdouble      value,
692
 
                      gdouble      lower,
693
 
                      gdouble      upper,
694
 
                      gdouble      step_increment,
695
 
                      gdouble      page_increment,
696
 
                      guint        digits,
697
 
                      gboolean     constrain,
698
 
                      gdouble      unconstrained_lower,
699
 
                      gdouble      unconstrained_upper,
700
 
                      const gchar *tooltip,
701
 
                      const gchar *help_id)
 
690
                      gint         column,
 
691
                      gint         row,
 
692
                      const gchar *text,
 
693
                      gint         scale_width,
 
694
                      gint         spinbutton_width,
 
695
                      gdouble      value,
 
696
                      gdouble      lower,
 
697
                      gdouble      upper,
 
698
                      gdouble      step_increment,
 
699
                      gdouble      page_increment,
 
700
                      guint        digits,
 
701
                      gboolean     constrain,
 
702
                      gdouble      unconstrained_lower,
 
703
                      gdouble      unconstrained_upper,
 
704
                      const gchar *tooltip,
 
705
                      const gchar *help_id)
702
706
{
703
707
  return gimp_scale_entry_new_internal (FALSE,
704
708
                                        table, column, row,
841
845
       scale_adj->step_increment = log_step_increment;
842
846
       scale_adj->page_increment = log_page_increment;
843
847
 
844
 
       g_signal_connect (scale_adj, "value_changed",
 
848
       g_signal_connect (scale_adj, "value-changed",
845
849
                         G_CALLBACK (gimp_scale_entry_exp_adjustment_callback),
846
850
                         adj);
847
851
 
848
 
       g_signal_connect (adj, "value_changed",
 
852
       g_signal_connect (adj, "value-changed",
849
853
                         G_CALLBACK (gimp_scale_entry_log_adjustment_callback),
850
854
                         scale_adj);
851
855
 
881
885
      scale_adj->step_increment = adj->step_increment;
882
886
      scale_adj->page_increment = adj->page_increment;
883
887
 
884
 
      g_signal_connect (scale_adj, "value_changed",
 
888
      g_signal_connect (scale_adj, "value-changed",
885
889
                        G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
886
890
                        adj);
887
891
 
888
 
      g_signal_connect (adj, "value_changed",
 
892
      g_signal_connect (adj, "value-changed",
889
893
                        G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
890
894
                        scale_adj);
891
895
 
942
946
 
943
947
static void
944
948
gimp_random_seed_update (GtkWidget *widget,
945
 
                         gpointer   data)
 
949
                         gpointer   data)
946
950
{
947
951
  GtkWidget *spinbutton = data;
948
952
 
993
997
  gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
994
998
  gtk_widget_show (spinbutton);
995
999
 
996
 
  g_signal_connect (adj, "value_changed",
 
1000
  g_signal_connect (adj, "value-changed",
997
1001
                    G_CALLBACK (gimp_uint_adjustment_update),
998
1002
                    seed);
999
1003
 
1061
1065
 
1062
1066
static void
1063
1067
gimp_coordinates_callback (GtkWidget           *widget,
1064
 
                           GimpCoordinatesData *gcd)
 
1068
                           GimpCoordinatesData *gcd)
1065
1069
{
1066
1070
  gdouble new_x;
1067
1071
  gdouble new_y;
1072
1076
  if (gimp_chain_button_get_active (gcd->chainbutton))
1073
1077
    {
1074
1078
      if (gcd->chain_constrains_ratio)
1075
 
        {
1076
 
          if ((gcd->orig_x != 0) && (gcd->orig_y != 0))
1077
 
            {
1078
 
              if (ROUND (new_x) != ROUND (gcd->last_x))
1079
 
                {
1080
 
                  gcd->last_x = new_x;
1081
 
                  new_y = (new_x * gcd->orig_y) / gcd->orig_x;
 
1079
        {
 
1080
          if ((gcd->orig_x != 0) && (gcd->orig_y != 0))
 
1081
            {
 
1082
              if (ROUND (new_x) != ROUND (gcd->last_x))
 
1083
                {
 
1084
                  gcd->last_x = new_x;
 
1085
                  new_y = (new_x * gcd->orig_y) / gcd->orig_x;
1082
1086
 
1083
 
                  g_signal_stop_emission_by_name (widget, "value_changed");
1084
 
                  gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1,
 
1087
/*                   g_signal_stop_emission_by_name (widget, "value-changed"); */
 
1088
                  gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1,
1085
1089
                                              new_y);
1086
 
                  gcd->last_y
 
1090
                  gcd->last_y
1087
1091
                    = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
1088
 
                }
1089
 
              else if (ROUND (new_y) != ROUND (gcd->last_y))
1090
 
                {
1091
 
                  gcd->last_y = new_y;
1092
 
                  new_x = (new_y * gcd->orig_x) / gcd->orig_y;
 
1092
                }
 
1093
              else if (ROUND (new_y) != ROUND (gcd->last_y))
 
1094
                {
 
1095
                  gcd->last_y = new_y;
 
1096
                  new_x = (new_y * gcd->orig_x) / gcd->orig_y;
1093
1097
 
1094
 
                  g_signal_stop_emission_by_name (widget, "value_changed");
1095
 
                  gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0,
 
1098
/*                   g_signal_stop_emission_by_name (widget, "value-changed"); */
 
1099
                  gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0,
1096
1100
                                              new_x);
1097
1101
                  gcd->last_x
1098
1102
                    = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
1099
 
                }
1100
 
            }
1101
 
        }
 
1103
                }
 
1104
            }
 
1105
        }
1102
1106
      else
1103
 
        {
1104
 
          if (new_x != gcd->last_x)
1105
 
            {
1106
 
              new_y = new_x;
 
1107
        {
 
1108
          if (new_x != gcd->last_x)
 
1109
            {
 
1110
              new_y = new_x;
1107
1111
 
1108
 
              g_signal_stop_emission_by_name (widget, "value_changed");
1109
 
              gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x);
 
1112
/*               g_signal_stop_emission_by_name (widget, "value-changed"); */
 
1113
              gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x);
1110
1114
              gcd->last_y = gcd->last_x
1111
1115
                = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
1112
 
            }
1113
 
          else if (new_y != gcd->last_y)
1114
 
            {
1115
 
              new_x = new_y;
 
1116
            }
 
1117
          else if (new_y != gcd->last_y)
 
1118
            {
 
1119
              new_x = new_y;
1116
1120
 
1117
 
              g_signal_stop_emission_by_name (widget, "value_changed");
1118
 
              gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y);
 
1121
/*               g_signal_stop_emission_by_name (widget, "value-changed"); */
 
1122
              gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y);
1119
1123
              gcd->last_x = gcd->last_y
1120
1124
                = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
1121
 
            }
1122
 
        }
 
1125
            }
 
1126
        }
1123
1127
    }
1124
1128
  else
1125
1129
    {
1170
1174
 **/
1171
1175
GtkWidget *
1172
1176
gimp_coordinates_new (GimpUnit         unit,
1173
 
                      const gchar     *unit_format,
1174
 
                      gboolean         menu_show_pixels,
1175
 
                      gboolean         menu_show_percent,
1176
 
                      gint             spinbutton_width,
1177
 
                      GimpSizeEntryUpdatePolicy  update_policy,
1178
 
 
1179
 
                      gboolean         chainbutton_active,
1180
 
                      gboolean         chain_constrains_ratio,
1181
 
 
1182
 
                      const gchar     *xlabel,
1183
 
                      gdouble          x,
1184
 
                      gdouble          xres,
1185
 
                      gdouble          lower_boundary_x,
1186
 
                      gdouble          upper_boundary_x,
1187
 
                      gdouble          xsize_0,   /* % */
1188
 
                      gdouble          xsize_100, /* % */
1189
 
 
1190
 
                      const gchar     *ylabel,
1191
 
                      gdouble          y,
1192
 
                      gdouble          yres,
1193
 
                      gdouble          lower_boundary_y,
1194
 
                      gdouble          upper_boundary_y,
1195
 
                      gdouble          ysize_0,   /* % */
1196
 
                      gdouble          ysize_100  /* % */)
 
1177
                      const gchar     *unit_format,
 
1178
                      gboolean         menu_show_pixels,
 
1179
                      gboolean         menu_show_percent,
 
1180
                      gint             spinbutton_width,
 
1181
                      GimpSizeEntryUpdatePolicy  update_policy,
 
1182
 
 
1183
                      gboolean         chainbutton_active,
 
1184
                      gboolean         chain_constrains_ratio,
 
1185
 
 
1186
                      const gchar     *xlabel,
 
1187
                      gdouble          x,
 
1188
                      gdouble          xres,
 
1189
                      gdouble          lower_boundary_x,
 
1190
                      gdouble          upper_boundary_x,
 
1191
                      gdouble          xsize_0,   /* % */
 
1192
                      gdouble          xsize_100, /* % */
 
1193
 
 
1194
                      const gchar     *ylabel,
 
1195
                      gdouble          y,
 
1196
                      gdouble          yres,
 
1197
                      gdouble          lower_boundary_y,
 
1198
                      gdouble          upper_boundary_y,
 
1199
                      gdouble          ysize_0,   /* % */
 
1200
                      gdouble          ysize_100  /* % */)
1197
1201
{
1198
1202
  GimpCoordinatesData *gcd;
1199
1203
  GtkObject *adjustment;
1212
1216
    }
1213
1217
 
1214
1218
  sizeentry = gimp_size_entry_new (1, unit, unit_format,
1215
 
                                   menu_show_pixels,
1216
 
                                   menu_show_percent,
1217
 
                                   FALSE,
1218
 
                                   spinbutton_width,
1219
 
                                   update_policy);
 
1219
                                   menu_show_pixels,
 
1220
                                   menu_show_percent,
 
1221
                                   FALSE,
 
1222
                                   spinbutton_width,
 
1223
                                   update_policy);
1220
1224
  gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 0, 4);
1221
1225
  gtk_table_set_col_spacing (GTK_TABLE (sizeentry), 2, 4);
1222
1226
  gimp_size_entry_add_field (GIMP_SIZE_ENTRY (sizeentry),
1225
1229
  gtk_widget_show (spinbutton);
1226
1230
 
1227
1231
  gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
1228
 
                            (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) ||
 
1232
                            (update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION) ||
1229
1233
                            (menu_show_pixels == FALSE) ?
1230
 
                            GIMP_UNIT_INCH : GIMP_UNIT_PIXEL);
 
1234
                            GIMP_UNIT_INCH : GIMP_UNIT_PIXEL);
1231
1235
 
1232
1236
  gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0, xres, TRUE);
1233
1237
  gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 1, yres, TRUE);
1234
1238
  gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 0,
1235
 
                                         lower_boundary_x, upper_boundary_x);
 
1239
                                         lower_boundary_x, upper_boundary_x);
1236
1240
  gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry), 1,
1237
 
                                         lower_boundary_y, upper_boundary_y);
 
1241
                                         lower_boundary_y, upper_boundary_y);
1238
1242
 
1239
1243
  if (menu_show_percent)
1240
1244
    {
1241
1245
      gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 0,
1242
 
                                xsize_0, xsize_100);
 
1246
                                xsize_0, xsize_100);
1243
1247
      gimp_size_entry_set_size (GIMP_SIZE_ENTRY (sizeentry), 1,
1244
 
                                ysize_0, ysize_100);
 
1248
                                ysize_0, ysize_100);
1245
1249
    }
1246
1250
 
1247
1251
  gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, x);
1256
1260
  if (chainbutton_active)
1257
1261
    gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
1258
1262
  gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2,
1259
 
                    GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
1263
                    GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
1260
1264
  gtk_widget_show (chainbutton);
1261
1265
 
1262
1266
  gcd = g_new (GimpCoordinatesData, 1);
1268
1272
  gcd->last_y                 = y;
1269
1273
 
1270
1274
  g_signal_connect_swapped (sizeentry, "destroy",
1271
 
                            G_CALLBACK (g_free),
1272
 
                            gcd);
 
1275
                            G_CALLBACK (g_free),
 
1276
                            gcd);
1273
1277
 
1274
 
  g_signal_connect (sizeentry, "value_changed",
1275
 
                    G_CALLBACK (gimp_coordinates_callback),
1276
 
                    gcd);
 
1278
  g_signal_connect (sizeentry, "value-changed",
 
1279
                    G_CALLBACK (gimp_coordinates_callback),
 
1280
                    gcd);
1277
1281
 
1278
1282
  g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton);
1279
1283
 
1293
1297
 **/
1294
1298
GtkWidget *
1295
1299
gimp_pixmap_button_new (gchar       **xpm_data,
1296
 
                        const gchar  *text)
 
1300
                        const gchar  *text)
1297
1301
{
1298
1302
  GtkWidget *button;
1299
1303
  GtkWidget *pixmap;
1391
1395
 **/
1392
1396
void
1393
1397
gimp_toggle_button_update (GtkWidget *widget,
1394
 
                           gpointer   data)
 
1398
                           gpointer   data)
1395
1399
{
1396
 
  gint *toggle_val;
1397
 
 
1398
 
  toggle_val = (gint *) data;
 
1400
  gint *toggle_val = (gint *) data;
1399
1401
 
1400
1402
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
1401
1403
    *toggle_val = TRUE;
1415
1417
 **/
1416
1418
void
1417
1419
gimp_radio_button_update (GtkWidget *widget,
1418
 
                          gpointer   data)
 
1420
                          gpointer   data)
1419
1421
{
1420
 
  gint *toggle_val;
1421
 
 
1422
1422
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
1423
1423
    {
1424
 
      toggle_val = (gint *) data;
 
1424
      gint *toggle_val = (gint *) data;
1425
1425
 
1426
1426
      *toggle_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
1427
 
                                                        "gimp-item-data"));
 
1427
                                                        "gimp-item-data"));
1428
1428
    }
1429
1429
 
1430
1430
  gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
1441
1441
 **/
1442
1442
void
1443
1443
gimp_int_adjustment_update (GtkAdjustment *adjustment,
1444
 
                            gpointer       data)
 
1444
                            gpointer       data)
1445
1445
{
1446
 
  gint *val;
 
1446
  gint *val = (gint *) data;
1447
1447
 
1448
 
  val = (gint *) data;
1449
1448
  *val = RINT (adjustment->value);
1450
1449
}
1451
1450
 
1460
1459
 **/
1461
1460
void
1462
1461
gimp_uint_adjustment_update (GtkAdjustment *adjustment,
1463
 
                             gpointer       data)
 
1462
                             gpointer       data)
1464
1463
{
1465
 
  guint *val;
 
1464
  guint *val = (guint *) data;
1466
1465
 
1467
 
  val = (guint *) data;
1468
1466
  *val = (guint) (adjustment->value + 0.5);
1469
1467
}
1470
1468
 
1476
1474
 **/
1477
1475
void
1478
1476
gimp_float_adjustment_update (GtkAdjustment *adjustment,
1479
 
                              gpointer       data)
 
1477
                              gpointer       data)
1480
1478
{
1481
 
  gfloat *val;
1482
 
 
1483
 
  val = (gfloat *) data;
 
1479
  gfloat *val = (gfloat *) data;
1484
1480
  *val = adjustment->value;
 
1481
 
1485
1482
}
1486
1483
 
1487
1484
/**
1492
1489
 **/
1493
1490
void
1494
1491
gimp_double_adjustment_update (GtkAdjustment *adjustment,
1495
 
                               gpointer       data)
 
1492
                               gpointer       data)
1496
1493
{
1497
 
  gdouble *val;
 
1494
  gdouble *val = (gdouble *) data;
1498
1495
 
1499
 
  val = (gdouble *) data;
1500
1496
  *val = adjustment->value;
1501
1497
}
1502
1498
 
1516
1512
 **/
1517
1513
void
1518
1514
gimp_unit_menu_update (GtkWidget *widget,
1519
 
                       gpointer   data)
 
1515
                       gpointer   data)
1520
1516
{
1521
 
  GimpUnit  *val;
 
1517
  GimpUnit  *val = (GimpUnit *) data;
1522
1518
  GtkWidget *spinbutton;
1523
1519
  gint       digits;
1524
1520
 
1525
 
  val = (GimpUnit *) data;
1526
1521
  *val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
1527
1522
 
1528
1523
  digits = ((*val == GIMP_UNIT_PIXEL) ? 0 :
1529
 
            ((*val == GIMP_UNIT_PERCENT) ? 2 :
1530
 
             (MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
 
1524
            ((*val == GIMP_UNIT_PERCENT) ? 2 :
 
1525
             (MIN (6, MAX (3, gimp_unit_get_digits (*val))))));
1531
1526
 
1532
1527
  digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
1533
1528
 
1548
1543
find_mnemonic_widget (GtkWidget *widget,
1549
1544
                      gint       level)
1550
1545
{
1551
 
  GtkWidget *mnemonic_widget = NULL;
1552
1546
 
1553
1547
  if (GTK_WIDGET_GET_CLASS (widget)->activate_signal ||
1554
1548
      GTK_WIDGET_CAN_FOCUS (widget)                  ||
1555
1549
      GTK_WIDGET_GET_CLASS (widget)->mnemonic_activate !=
1556
1550
      GTK_WIDGET_CLASS (g_type_class_peek (GTK_TYPE_WIDGET))->mnemonic_activate)
1557
1551
    {
1558
 
      mnemonic_widget = widget;
 
1552
      return widget;
 
1553
    }
 
1554
 
 
1555
  if (GIMP_IS_SIZE_ENTRY (widget))
 
1556
    {
 
1557
      GimpSizeEntry *entry = GIMP_SIZE_ENTRY (widget);
 
1558
 
 
1559
      return gimp_size_entry_get_help_widget (entry,
 
1560
                                              entry->number_of_fields - 1);
1559
1561
    }
1560
1562
  else if (GTK_IS_CONTAINER (widget))
1561
1563
    {
1562
 
      GList *children;
1563
 
      GList *list;
 
1564
      GtkWidget *mnemonic_widget = NULL;
 
1565
      GList     *children;
 
1566
      GList     *list;
1564
1567
 
1565
1568
      children = gtk_container_get_children (GTK_CONTAINER (widget));
1566
1569
 
1573
1576
        }
1574
1577
 
1575
1578
      g_list_free (children);
 
1579
 
 
1580
      return mnemonic_widget;
1576
1581
    }
1577
1582
 
1578
 
  return mnemonic_widget;
 
1583
  return NULL;
1579
1584
}
1580
1585
 
1581
1586
/**
1598
1603
 **/
1599
1604
GtkWidget *
1600
1605
gimp_table_attach_aligned (GtkTable    *table,
1601
 
                           gint         column,
1602
 
                           gint         row,
1603
 
                           const gchar *label_text,
1604
 
                           gfloat       xalign,
1605
 
                           gfloat       yalign,
1606
 
                           GtkWidget   *widget,
1607
 
                           gint         colspan,
1608
 
                           gboolean     left_align)
 
1606
                           gint         column,
 
1607
                           gint         row,
 
1608
                           const gchar *label_text,
 
1609
                           gfloat       xalign,
 
1610
                           gfloat       yalign,
 
1611
                           GtkWidget   *widget,
 
1612
                           gint         colspan,
 
1613
                           gboolean     left_align)
1609
1614
{
1610
1615
  GtkWidget *label = NULL;
1611
1616
 
1617
1622
      gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
1618
1623
      gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1619
1624
      gtk_table_attach (table, label,
1620
 
                        column, column + 1,
1621
 
                        row, row + 1,
1622
 
                        GTK_FILL, GTK_FILL, 0, 0);
 
1625
                        column, column + 1,
 
1626
                        row, row + 1,
 
1627
                        GTK_FILL, GTK_FILL, 0, 0);
1623
1628
      gtk_widget_show (label);
1624
1629
 
1625
1630
      mnemonic_widget = find_mnemonic_widget (widget, 0);
1639
1644
    }
1640
1645
 
1641
1646
  gtk_table_attach (table, widget,
1642
 
                    column + 1, column + 1 + colspan,
1643
 
                    row, row + 1,
1644
 
                    GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
1647
                    column + 1, column + 1 + colspan,
 
1648
                    row, row + 1,
 
1649
                    GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
1645
1650
 
1646
1651
  gtk_widget_show (widget);
1647
1652
 
1744
1749
          break;
1745
1750
 
1746
1751
        case PANGO_ATTR_STRIKETHROUGH:
1747
 
          attr = pango_attr_underline_new (va_arg (args, gboolean));
 
1752
          attr = pango_attr_strikethrough_new (va_arg (args, gboolean));
1748
1753
          break;
1749
1754
 
1750
1755
        case PANGO_ATTR_RISE: