~ubuntu-branches/ubuntu/karmic/gimp/karmic-security

« back to all changes in this revision

Viewing changes to app/gimp-log.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20081006133041-axco233xt49jobn7
Tags: 2.6.0-1ubuntu1
* Sync on debian and new version (lp: #276839)
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch:
  - updated some strings for ubuntu
* debian/rules:
  - updated translation templates

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#ifndef __GIMP_LOG_H__
 
20
#define __GIMP_LOG_H__
 
21
 
 
22
 
 
23
typedef enum
 
24
{
 
25
  GIMP_LOG_TOOL_EVENTS    = 1 << 0,
 
26
  GIMP_LOG_TOOL_FOCUS     = 1 << 1,
 
27
  GIMP_LOG_DND            = 1 << 2,
 
28
  GIMP_LOG_HELP           = 1 << 3,
 
29
  GIMP_LOG_DIALOG_FACTORY = 1 << 4,
 
30
  GIMP_LOG_MENUS          = 1 << 5,
 
31
  GIMP_LOG_SAVE_DIALOG    = 1 << 6,
 
32
  GIMP_LOG_IMAGE_SCALE    = 1 << 7,
 
33
  GIMP_LOG_SHADOW_TILES   = 1 << 8,
 
34
  GIMP_LOG_SCALE          = 1 << 9
 
35
} GimpLogFlags;
 
36
 
 
37
 
 
38
extern GimpLogFlags gimp_log_flags;
 
39
 
 
40
 
 
41
void   gimp_log_init (void);
 
42
void   gimp_log      (const gchar *function,
 
43
                      gint         line,
 
44
                      const gchar *domain,
 
45
                      const gchar *format,
 
46
                      ...) G_GNUC_PRINTF (4, 5);
 
47
void   gimp_logv     (const gchar *function,
 
48
                      gint         line,
 
49
                      const gchar *domain,
 
50
                      const gchar *format,
 
51
                      va_list      args);
 
52
 
 
53
 
 
54
#ifdef G_HAVE_ISO_VARARGS
 
55
 
 
56
#define GIMP_LOG(type, ...) \
 
57
        G_STMT_START { \
 
58
        if (gimp_log_flags & GIMP_LOG_##type) \
 
59
          gimp_log (G_STRFUNC, __LINE__, #type, __VA_ARGS__); \
 
60
        } G_STMT_END
 
61
 
 
62
#elif defined(G_HAVE_GNUC_VARARGS)
 
63
 
 
64
#define GIMP_LOG(type, format...) \
 
65
        G_STMT_START { \
 
66
        if (gimp_log_flags & GIMP_LOG_##type) \
 
67
          gimp_log (G_STRFUNC, __LINE__, #type, format); \
 
68
        } G_STMT_END
 
69
 
 
70
#else /* no varargs macros */
 
71
 
 
72
/* need to expand all the short forms
 
73
 * to make them known constants at compile time
 
74
 */
 
75
#define TOOL_EVENTS    GIMP_LOG_TOOL_EVENTS
 
76
#define TOOL_FOCUS     GIMP_LOG_TOOL_FOCUS
 
77
#define DND            GIMP_LOG_DND
 
78
#define HELP           GIMP_LOG_HELP
 
79
#define DIALOG_FACTORY GIMP_LOG_DIALOG_FACTORY
 
80
#define MENUS          GIMP_LOG_MENUS
 
81
#define SAVE_DIALOG    GIMP_LOG_SAVE_DIALOG
 
82
#define IMAGE_SCALE    GIMP_LOG_IMAGE_SCALE
 
83
#define SHADOW_TILES   GIMP_LOG_SHADOW_TILES
 
84
#define SCALE          GIMP_LOG_SCALE
 
85
 
 
86
#if 0 /* last resort */
 
87
#  define GIMP_LOG /* nothing => no varargs, no log */
 
88
#endif
 
89
 
 
90
static void
 
91
GIMP_LOG (GimpLogFlags flags,
 
92
          const gchar *format,
 
93
          ...)
 
94
{
 
95
  va_list args;
 
96
  va_start (args, format);
 
97
  if (gimp_log_flags & flags)
 
98
    gimp_logv ("", 0, "", format, args);
 
99
  va_end (args);
 
100
}
 
101
 
 
102
#endif  /* !__GNUC__ */
 
103
 
 
104
#endif /* __GIMP_LOG_H__ */