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

« back to all changes in this revision

Viewing changes to app/gui/color-history.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
 * color-history.c
25
25
 
26
26
#include "libgimpbase/gimpbase.h"
27
27
#include "libgimpcolor/gimpcolor.h"
 
28
#include "libgimpconfig/gimpconfig.h"
28
29
 
29
30
#include "gui-types.h"
30
31
 
31
 
#include "config/gimpconfig-utils.h"
32
 
#include "config/gimpconfigwriter.h"
33
 
#include "config/gimpscanner.h"
 
32
#include "core/gimp.h"
34
33
 
35
34
#include "color-history.h"
36
35
 
50
49
 
51
50
 
52
51
void
53
 
color_history_save (void)
 
52
color_history_save (Gimp *gimp)
54
53
{
55
54
  GimpConfigWriter *writer;
56
55
  gchar            *filename;
57
56
  gint              i;
58
57
 
 
58
  g_return_if_fail (GIMP_IS_GIMP (gimp));
 
59
 
59
60
  filename = gimp_personal_rc_file ("colorrc");
 
61
 
 
62
  if (gimp->be_verbose)
 
63
    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
 
64
 
60
65
  writer = gimp_config_writer_new_file (filename,
61
66
                                        TRUE,
62
67
                                        "GIMP colorrc\n\n"
98
103
}
99
104
 
100
105
void
101
 
color_history_restore (void)
 
106
color_history_restore (Gimp *gimp)
102
107
{
103
108
  gchar      *filename;
104
109
  GScanner   *scanner;
105
110
  GTokenType  token;
106
111
 
 
112
  g_return_if_fail (GIMP_IS_GIMP (gimp));
 
113
 
107
114
  filename = gimp_personal_rc_file ("colorrc");
 
115
 
 
116
  if (gimp->be_verbose)
 
117
    g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
 
118
 
108
119
  scanner = gimp_scanner_new_file (filename, NULL);
109
120
  g_free (filename);
110
121
 
198
209
  for (i = 0; i < COLOR_HISTORY_SIZE; i++)
199
210
    {
200
211
      if (gimp_rgba_distance (&color_history[i], rgb) < 0.0001)
201
 
        {
202
 
          shift_begin = i;
 
212
        {
 
213
          shift_begin = i;
203
214
 
204
 
          goto doit;
205
 
        }
 
215
          goto doit;
 
216
        }
206
217
    }
207
218
 
208
219
  /*  if not, are there two equal colors?  */
209
220
  if (shift_begin == -1)
210
221
    {
211
222
      for (i = 0; i < COLOR_HISTORY_SIZE; i++)
212
 
        {
213
 
          for (j = i + 1; j < COLOR_HISTORY_SIZE; j++)
214
 
            {
215
 
              if (gimp_rgba_distance (&color_history[i],
216
 
                                      &color_history[j]) < 0.0001)
217
 
                {
218
 
                  shift_begin = i;
 
223
        {
 
224
          for (j = i + 1; j < COLOR_HISTORY_SIZE; j++)
 
225
            {
 
226
              if (gimp_rgba_distance (&color_history[i],
 
227
                                      &color_history[j]) < 0.0001)
 
228
                {
 
229
                  shift_begin = i;
219
230
 
220
 
                  goto doit;
221
 
                }
222
 
            }
223
 
        }
 
231
                  goto doit;
 
232
                }
 
233
            }
 
234
        }
224
235
    }
225
236
 
226
237
  /*  if not, shift them all  */