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

« back to all changes in this revision

Viewing changes to app/dialogs/channel-options-dialog.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:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
48
48
/*  public functions  */
49
49
 
50
50
ChannelOptionsDialog *
51
 
channel_options_dialog_new (GimpImage     *gimage,
 
51
channel_options_dialog_new (GimpImage     *image,
 
52
                            GimpChannel   *channel,
52
53
                            GimpContext   *context,
53
 
                            GimpChannel   *channel,
54
54
                            GtkWidget     *parent,
55
55
                            const GimpRGB *channel_color,
56
56
                            const gchar   *channel_name,
60
60
                            const gchar   *desc,
61
61
                            const gchar   *help_id,
62
62
                            const gchar   *color_label,
63
 
                            const gchar   *opacity_label)
 
63
                            const gchar   *opacity_label,
 
64
                            gboolean       show_from_sel)
64
65
{
65
66
  ChannelOptionsDialog *options;
66
67
  GimpViewable         *viewable;
69
70
  GtkWidget            *table;
70
71
  GtkObject            *opacity_adj;
71
72
 
72
 
  g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
 
73
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
74
  g_return_val_if_fail (channel == NULL || GIMP_IS_CHANNEL (channel), NULL);
73
75
  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
74
 
  g_return_val_if_fail (channel == NULL || GIMP_IS_CHANNEL (channel), NULL);
75
76
  g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
76
77
  g_return_val_if_fail (channel_color != NULL, NULL);
77
78
  g_return_val_if_fail (title != NULL, NULL);
84
85
 
85
86
  options = g_new0 (ChannelOptionsDialog, 1);
86
87
 
87
 
  options->gimage  = gimage;
 
88
  options->image   = image;
88
89
  options->context = context;
89
90
  options->channel = channel;
90
91
 
91
92
  options->color_panel = gimp_color_panel_new (color_label,
92
 
                                               channel_color,
93
 
                                               GIMP_COLOR_AREA_LARGE_CHECKS,
94
 
                                               48, 64);
 
93
                                               channel_color,
 
94
                                               GIMP_COLOR_AREA_LARGE_CHECKS,
 
95
                                               48, 64);
95
96
  gimp_color_panel_set_context (GIMP_COLOR_PANEL (options->color_panel),
96
97
                                context);
97
98
 
98
99
  if (channel)
99
100
    viewable = GIMP_VIEWABLE (channel);
100
101
  else
101
 
    viewable = GIMP_VIEWABLE (gimage);
 
102
    viewable = GIMP_VIEWABLE (image);
102
103
 
103
104
  options->dialog =
104
 
    gimp_viewable_dialog_new (viewable,
 
105
    gimp_viewable_dialog_new (viewable, context,
105
106
                              title, role, stock_id, desc,
106
107
                              parent,
107
108
                              gimp_standard_help_func, help_id,
112
113
                              NULL);
113
114
 
114
115
  g_object_weak_ref (G_OBJECT (options->dialog),
115
 
                     (GWeakNotify) g_free,
116
 
                     options);
 
116
                     (GWeakNotify) g_free,
 
117
                     options);
 
118
 
 
119
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (options->dialog),
 
120
                                           GTK_RESPONSE_OK,
 
121
                                           GTK_RESPONSE_CANCEL,
 
122
                                           -1);
117
123
 
118
124
  hbox = gtk_hbox_new (FALSE, 12);
119
125
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
135
141
      options->name_entry = gtk_entry_new ();
136
142
      gtk_entry_set_activates_default (GTK_ENTRY (options->name_entry), TRUE);
137
143
      gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
138
 
                                 _("Channel Name:"), 0.0, 0.5,
 
144
                                 _("Channel _name:"), 0.0, 0.5,
139
145
                                 options->name_entry, 2, FALSE);
140
146
 
141
147
      gtk_entry_set_text (GTK_ENTRY (options->name_entry), channel_name);
142
148
    }
143
149
 
144
 
  opacity_adj = gimp_scale_entry_new (GTK_TABLE (table), 0, channel_name ? 1 : 0,
 
150
  opacity_adj = gimp_scale_entry_new (GTK_TABLE (table),
 
151
                                      0, channel_name ? 1 : 0,
145
152
                                      opacity_label, 100, -1,
146
153
                                      channel_color->a * 100.0,
147
154
                                      0.0, 100.0, 1.0, 10.0, 1,
148
155
                                      TRUE, 0.0, 0.0,
149
156
                                      NULL, NULL);
150
157
 
151
 
  g_signal_connect (opacity_adj, "value_changed",
152
 
                    G_CALLBACK (channel_options_opacity_update),
153
 
                    options->color_panel);
 
158
  g_signal_connect (opacity_adj, "value-changed",
 
159
                    G_CALLBACK (channel_options_opacity_update),
 
160
                    options->color_panel);
154
161
 
155
162
  gtk_box_pack_start (GTK_BOX (hbox), options->color_panel,
156
 
                      TRUE, TRUE, 0);
 
163
                      TRUE, TRUE, 0);
157
164
  gtk_widget_show (options->color_panel);
158
165
 
159
 
  g_signal_connect (options->color_panel, "color_changed",
160
 
                    G_CALLBACK (channel_options_color_changed),
161
 
                    opacity_adj);
 
166
  g_signal_connect (options->color_panel, "color-changed",
 
167
                    G_CALLBACK (channel_options_color_changed),
 
168
                    opacity_adj);
 
169
 
 
170
  if (show_from_sel)
 
171
    {
 
172
      options->save_sel_checkbutton =
 
173
        gtk_check_button_new_with_mnemonic (_("Initialize from _selection"));
 
174
 
 
175
      gtk_box_pack_start (GTK_BOX (vbox), options->save_sel_checkbutton,
 
176
                          FALSE, FALSE, 0);
 
177
      gtk_widget_show (options->save_sel_checkbutton);
 
178
    }
162
179
 
163
180
  return options;
164
181
}