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

« back to all changes in this revision

Viewing changes to app/dialogs/print-size-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
25
25
 
26
26
#include "dialogs-types.h"
27
27
 
 
28
#include "core/gimpcontext.h"
28
29
#include "core/gimpimage.h"
 
30
#include "core/gimp-utils.h"
29
31
 
30
32
#include "widgets/gimphelp-ids.h"
31
33
#include "widgets/gimpviewabledialog.h"
73
75
 
74
76
GtkWidget *
75
77
print_size_dialog_new (GimpImage              *image,
 
78
                       GimpContext            *context,
76
79
                       const gchar            *title,
77
80
                       const gchar            *role,
78
81
                       GtkWidget              *parent,
95
98
  GList           *focus_chain = NULL;
96
99
 
97
100
  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
101
  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
98
102
  g_return_val_if_fail (callback != NULL, NULL);
99
103
 
100
 
  dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (image),
 
104
  dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (image), context,
101
105
                                     title, role,
102
106
                                     GIMP_STOCK_PRINT_RESOLUTION, title,
103
107
                                     parent,
119
123
                    G_CALLBACK (print_size_dialog_response),
120
124
                    private);
121
125
 
 
126
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
127
                                           RESPONSE_RESET,
 
128
                                           GTK_RESPONSE_OK,
 
129
                                           GTK_RESPONSE_CANCEL,
 
130
                                           -1);
 
131
 
122
132
  private->image     = image;
123
133
  private->callback  = callback;
124
134
  private->user_data = user_data;
147
157
  height = gimp_spin_button_new (&adj, 1, 1, 1, 1, 10, 0, 1, 2);
148
158
  gtk_entry_set_width_chars (GTK_ENTRY (height), SB_WIDTH);
149
159
 
150
 
  entry = gimp_size_entry_new (0, gimp_image_get_unit (image), "%p",
 
160
  entry = gimp_size_entry_new (0, gimp_get_default_unit (), "%p",
151
161
                               FALSE, FALSE, FALSE, SB_WIDTH,
152
162
                               GIMP_SIZE_ENTRY_UPDATE_SIZE);
153
163
  private->size_entry = GIMP_SIZE_ENTRY (entry);
156
166
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
157
167
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), width);
158
168
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
159
 
                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
 
169
                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
160
170
  gtk_widget_show (label);
161
171
 
162
172
  label = gtk_label_new_with_mnemonic (_("H_eight:"));
163
173
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
164
174
  gtk_label_set_mnemonic_widget (GTK_LABEL (label), height);
165
175
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
166
 
                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
 
176
                    GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
167
177
  gtk_widget_show (label);
168
178
 
169
179
  hbox = gtk_hbox_new (FALSE, 0);
177
187
  gtk_widget_show (entry);
178
188
 
179
189
  gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
180
 
                             GTK_SPIN_BUTTON (height), NULL);
 
190
                             GTK_SPIN_BUTTON (height), NULL);
181
191
  gtk_table_attach_defaults (GTK_TABLE (entry), height, 0, 1, 1, 2);
182
192
  gtk_widget_show (height);
183
193
 
184
194
  gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
185
 
                             GTK_SPIN_BUTTON (width), NULL);
 
195
                             GTK_SPIN_BUTTON (width), NULL);
186
196
  gtk_table_attach_defaults (GTK_TABLE (entry), width, 0, 1, 0, 1);
187
197
  gtk_widget_show (width);
188
198
 
272
282
  gtk_container_set_focus_chain (GTK_CONTAINER (entry), focus_chain);
273
283
  g_list_free (focus_chain);
274
284
 
275
 
  g_signal_connect (private->size_entry, "value_changed",
276
 
                    G_CALLBACK (print_size_dialog_size_changed),
277
 
                    private);
278
 
  g_signal_connect (private->resolution_entry, "value_changed",
279
 
                    G_CALLBACK (print_size_dialog_resolution_changed),
280
 
                    private);
 
285
  g_signal_connect (private->size_entry, "value-changed",
 
286
                    G_CALLBACK (print_size_dialog_size_changed),
 
287
                    private);
 
288
  g_signal_connect (private->resolution_entry, "value-changed",
 
289
                    G_CALLBACK (print_size_dialog_resolution_changed),
 
290
                    private);
281
291
 
282
292
  return dialog;
283
293
}
316
326
  gdouble  xres, yres;
317
327
 
318
328
  gimp_size_entry_set_unit (private->resolution_entry,
319
 
                            gimp_image_get_unit (private->image));
 
329
                            gimp_get_default_unit ());
320
330
 
321
331
  gimp_image_get_resolution (private->image, &xres, &yres);
322
332
  print_size_dialog_set_resolution (private, xres, yres);
384
394
  if (private->chain && gimp_chain_button_get_active (private->chain))
385
395
    {
386
396
      if (xres != private->xres)
387
 
        {
388
 
          yres = xres;
389
 
        }
 
397
        {
 
398
          yres = xres;
 
399
        }
390
400
      else
391
 
        {
392
 
          xres = yres;
393
 
        }
 
401
        {
 
402
          xres = yres;
 
403
        }
394
404
    }
395
405
 
396
406
  private->xres = xres;