57
57
gimp_radio_group_new (gboolean in_frame,
58
const gchar *frame_title,
60
/* specify radio buttons as va_list:
63
* gpointer callback_data,
65
* GtkWidget **widget_ptr,
58
const gchar *frame_title,
60
/* specify radio buttons as va_list:
63
* gpointer callback_data,
65
* GtkWidget **widget_ptr,
98
98
active = va_arg (args, gboolean);
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);
103
button = gtk_radio_button_new (group);
103
button = gtk_radio_button_new (group);
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);
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 */
172
/* specify radio buttons as va_list:
173
* const gchar *label,
174
* gpointer item_data,
175
* GtkWidget **widget_ptr,
167
const gchar *frame_title,
168
GCallback radio_button_callback,
169
gpointer callback_data,
170
gpointer initial, /* item_data */
172
/* specify radio buttons as va_list:
173
* const gchar *label,
174
* gpointer item_data,
175
* GtkWidget **widget_ptr,
181
181
GtkWidget *button;
202
202
widget_ptr = va_arg (args, GtkWidget **);
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);
207
button = gtk_radio_button_new (group);
207
button = gtk_radio_button_new (group);
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);
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 */
279
/* specify radio buttons as va_list:
280
* const gchar *label,
282
* GtkWidget **widget_ptr,
274
const gchar *frame_title,
275
GCallback radio_button_callback,
276
gpointer callback_data,
277
gint initial, /* item_data */
279
/* specify radio buttons as va_list:
280
* const gchar *label,
282
* GtkWidget **widget_ptr,
288
288
GtkWidget *button;
312
312
item_ptr = GINT_TO_POINTER (item_data);
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);
317
button = gtk_radio_button_new (group);
317
button = gtk_radio_button_new (group);
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);
419
419
* @climb_rate: The spinbutton's climb rate.
420
420
* @digits: The spinbutton's number of decimal digits.
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
426
427
* Returns: A #GtkSpinbutton and it's #GtkAdjustment.
429
430
gimp_spin_button_new (GtkObject **adjustment, /* return value */
433
gdouble step_increment,
434
gdouble page_increment,
434
gdouble step_increment,
435
gdouble page_increment,
439
440
GtkWidget *spinbutton;
441
442
*adjustment = gtk_adjustment_new (value, lower, upper,
442
step_increment, page_increment, page_size);
443
step_increment, page_increment, page_size);
444
445
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (*adjustment),
446
448
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
448
450
return spinbutton;
452
454
gimp_scale_entry_unconstrained_adjustment_callback (GtkAdjustment *adjustment,
453
GtkAdjustment *other_adj)
455
GtkAdjustment *other_adj)
455
457
g_signal_handlers_block_by_func (other_adj,
456
gimp_scale_entry_unconstrained_adjustment_callback,
458
gimp_scale_entry_unconstrained_adjustment_callback,
459
461
gtk_adjustment_set_value (other_adj, adjustment->value);
461
463
g_signal_handlers_unblock_by_func (other_adj,
462
gimp_scale_entry_unconstrained_adjustment_callback,
464
gimp_scale_entry_unconstrained_adjustment_callback,
543
ebox = gtk_event_box_new ();
545
ebox = g_object_new (GTK_TYPE_EVENT_BOX,
546
"visible-window", FALSE,
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;
567
571
constrained_adj = gtk_adjustment_new (value, lower, upper,
568
step_increment, page_increment,
572
step_increment, page_increment,
571
575
spinbutton = gimp_spin_button_new (&adjustment, value,
574
step_increment, page_increment, 0.0,
578
(G_OBJECT (constrained_adj), "value_changed",
579
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
583
(G_OBJECT (adjustment), "value_changed",
584
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
578
step_increment, page_increment, 0.0,
582
(G_OBJECT (constrained_adj), "value-changed",
583
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
587
(G_OBJECT (adjustment), "value-changed",
588
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
587
591
return_adj = adjustment;
593
597
spinbutton = gimp_spin_button_new (&adjustment, value, lower, upper,
594
step_increment, page_increment, 0.0,
598
step_increment, page_increment, 0.0,
597
601
return_adj = adjustment;
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);
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);
637
641
if (tooltip || help_id)
685
689
gimp_scale_entry_new (GtkTable *table,
690
gint spinbutton_width,
694
gdouble step_increment,
695
gdouble page_increment,
698
gdouble unconstrained_lower,
699
gdouble unconstrained_upper,
700
const gchar *tooltip,
701
const gchar *help_id)
694
gint spinbutton_width,
698
gdouble step_increment,
699
gdouble page_increment,
702
gdouble unconstrained_lower,
703
gdouble unconstrained_upper,
704
const gchar *tooltip,
705
const gchar *help_id)
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;
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),
848
g_signal_connect (adj, "value_changed",
852
g_signal_connect (adj, "value-changed",
849
853
G_CALLBACK (gimp_scale_entry_log_adjustment_callback),
881
885
scale_adj->step_increment = adj->step_increment;
882
886
scale_adj->page_increment = adj->page_increment;
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),
888
g_signal_connect (adj, "value_changed",
892
g_signal_connect (adj, "value-changed",
889
893
G_CALLBACK (gimp_scale_entry_unconstrained_adjustment_callback),
993
997
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
994
998
gtk_widget_show (spinbutton);
996
g_signal_connect (adj, "value_changed",
1000
g_signal_connect (adj, "value-changed",
997
1001
G_CALLBACK (gimp_uint_adjustment_update),
1072
1076
if (gimp_chain_button_get_active (gcd->chainbutton))
1074
1078
if (gcd->chain_constrains_ratio)
1076
if ((gcd->orig_x != 0) && (gcd->orig_y != 0))
1078
if (ROUND (new_x) != ROUND (gcd->last_x))
1080
gcd->last_x = new_x;
1081
new_y = (new_x * gcd->orig_y) / gcd->orig_x;
1080
if ((gcd->orig_x != 0) && (gcd->orig_y != 0))
1082
if (ROUND (new_x) != ROUND (gcd->last_x))
1084
gcd->last_x = new_x;
1085
new_y = (new_x * gcd->orig_y) / gcd->orig_x;
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,
1087
1091
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
1089
else if (ROUND (new_y) != ROUND (gcd->last_y))
1091
gcd->last_y = new_y;
1092
new_x = (new_y * gcd->orig_x) / gcd->orig_y;
1093
else if (ROUND (new_y) != ROUND (gcd->last_y))
1095
gcd->last_y = new_y;
1096
new_x = (new_y * gcd->orig_x) / gcd->orig_y;
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,
1098
1102
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
1104
if (new_x != gcd->last_x)
1108
if (new_x != gcd->last_x)
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);
1113
else if (new_y != gcd->last_y)
1117
else if (new_y != gcd->last_y)
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);
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,
1179
gboolean chainbutton_active,
1180
gboolean chain_constrains_ratio,
1182
const gchar *xlabel,
1185
gdouble lower_boundary_x,
1186
gdouble upper_boundary_x,
1187
gdouble xsize_0, /* % */
1188
gdouble xsize_100, /* % */
1190
const gchar *ylabel,
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,
1183
gboolean chainbutton_active,
1184
gboolean chain_constrains_ratio,
1186
const gchar *xlabel,
1189
gdouble lower_boundary_x,
1190
gdouble upper_boundary_x,
1191
gdouble xsize_0, /* % */
1192
gdouble xsize_100, /* % */
1194
const gchar *ylabel,
1197
gdouble lower_boundary_y,
1198
gdouble upper_boundary_y,
1199
gdouble ysize_0, /* % */
1200
gdouble ysize_100 /* % */)
1198
1202
GimpCoordinatesData *gcd;
1199
1203
GtkObject *adjustment;
1214
1218
sizeentry = gimp_size_entry_new (1, unit, unit_format,
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);
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);
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);
1239
1243
if (menu_show_percent)
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);
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);
1262
1266
gcd = g_new (GimpCoordinatesData, 1);
1268
1272
gcd->last_y = y;
1270
1274
g_signal_connect_swapped (sizeentry, "destroy",
1271
G_CALLBACK (g_free),
1275
G_CALLBACK (g_free),
1274
g_signal_connect (sizeentry, "value_changed",
1275
G_CALLBACK (gimp_coordinates_callback),
1278
g_signal_connect (sizeentry, "value-changed",
1279
G_CALLBACK (gimp_coordinates_callback),
1278
1282
g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton);
1417
1419
gimp_radio_button_update (GtkWidget *widget,
1422
1422
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
1424
toggle_val = (gint *) data;
1424
gint *toggle_val = (gint *) data;
1426
1426
*toggle_val = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
1430
1430
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
1518
1514
gimp_unit_menu_update (GtkWidget *widget,
1517
GimpUnit *val = (GimpUnit *) data;
1522
1518
GtkWidget *spinbutton;
1525
val = (GimpUnit *) data;
1526
1521
*val = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
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))))));
1532
1527
digits += gimp_unit_menu_get_pixel_digits (GIMP_UNIT_MENU (widget));
1548
1543
find_mnemonic_widget (GtkWidget *widget,
1551
GtkWidget *mnemonic_widget = NULL;
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)
1558
mnemonic_widget = widget;
1555
if (GIMP_IS_SIZE_ENTRY (widget))
1557
GimpSizeEntry *entry = GIMP_SIZE_ENTRY (widget);
1559
return gimp_size_entry_get_help_widget (entry,
1560
entry->number_of_fields - 1);
1560
1562
else if (GTK_IS_CONTAINER (widget))
1564
GtkWidget *mnemonic_widget = NULL;
1565
1568
children = gtk_container_get_children (GTK_CONTAINER (widget));
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,
1622
GTK_FILL, GTK_FILL, 0, 0);
1627
GTK_FILL, GTK_FILL, 0, 0);
1623
1628
gtk_widget_show (label);
1625
1630
mnemonic_widget = find_mnemonic_widget (widget, 0);
1641
1646
gtk_table_attach (table, widget,
1642
column + 1, column + 1 + colspan,
1644
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
1647
column + 1, column + 1 + colspan,
1649
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
1646
1651
gtk_widget_show (widget);