Commit 3229e67f authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/Makefile.am new files implementing a log facility which can be enabled

2007-11-15  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/gimp-log.[ch]: new files implementing a log facility which
	can be enabled using the GIMP_LOG environment variable.

	* app/main.c: initialize it.

	* app/display/gimpdisplayshell-callbacks.c: use it instead of
	private debugging macros that need to be enabled at compile time.


svn path=/trunk/; revision=24160
parent ab465c74
2007-11-15 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/gimp-log.[ch]: new files implementing a log facility which
can be enabled using the GIMP_LOG environment variable.
* app/main.c: initialize it.
* app/display/gimpdisplayshell-callbacks.c: use it instead of
private debugging macros that need to be enabled at compile time.
2007-11-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpviewable.[ch]: add read-only property "frozen" and
......@@ -12,7 +23,7 @@
* app/tools/gimpcurvestool.c: set the background histogram instead.
* app/widgets/gimphistogrameditor.[ch]: connect to "notify::frozen"
of the drawable and show its histogram at thje freezing point in
of the drawable and show its histogram at the freezing point in
the background. This way the original histogram is visible while
we are doing color corrections.
......
......@@ -50,6 +50,8 @@ app_sources = \
sanity.h \
units.c \
units.h \
gimp-log.c \
gimp-log.h \
gimp-intl.h
gimp_2_5_SOURCES = $(app_sources)
......
......@@ -76,18 +76,10 @@
#include "gimpdisplayshell-transform.h"
#include "gimpnavigationeditor.h"
#include "gimp-log.h"
#include "gimp-intl.h"
/* #define DEBUG_TOOL_EVENTS */
#ifdef DEBUG_TOOL_EVENTS
#define D(stmnt) stmnt
#else
#define D(stmnt)
#endif
/* local function prototypes */
static void gimp_display_shell_vscrollbar_update (GtkAdjustment *adjustment,
......@@ -676,7 +668,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{
GdkEventCrossing *cevent = (GdkEventCrossing *) event;
D (g_printerr ("tool event (display %p): ENTER_NOTIFY\n", display));
GIMP_LOG (TOOLS, "event (display %p): ENTER_NOTIFY", display);
if (cevent->mode != GDK_CROSSING_NORMAL)
return TRUE;
......@@ -694,7 +686,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{
GdkEventCrossing *cevent = (GdkEventCrossing *) event;
D (g_printerr ("tool event (display %p): LEAVE_NOTIFY\n", display));
GIMP_LOG (TOOLS, "event (display %p): LEAVE_NOTIFY", display);
if (cevent->mode != GDK_CROSSING_NORMAL)
return TRUE;
......@@ -710,7 +702,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
break;
case GDK_PROXIMITY_IN:
D (g_printerr ("tool event (display %p): PROXIMITY_IN\n", display));
GIMP_LOG (TOOLS, "event (display %p): PROXIMITY_IN", display);
tool_manager_oper_update_active (gimp,
&image_coords, state,
......@@ -719,7 +711,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
break;
case GDK_PROXIMITY_OUT:
D (g_printerr ("tool event (display %p): PROXIMITY_OUT\n", display));
GIMP_LOG (TOOLS, "event (display %p): PROXIMITY_OUT", display);
shell->proximity = FALSE;
gimp_display_shell_clear_cursor (shell);
......@@ -736,7 +728,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
if (fevent->in)
{
D (g_printerr ("tool event (display %p): FOCUS_IN\n", display));
GIMP_LOG (TOOLS, "event (display %p): FOCUS_IN", display);
GTK_WIDGET_SET_FLAGS (canvas, GTK_HAS_FOCUS);
......@@ -752,7 +744,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
}
else
{
D (g_printerr ("tool event (display %p): FOCUS_OUT\n", display));
GIMP_LOG (TOOLS, "event (display %p): FOCUS_OUT", display);
GTK_WIDGET_UNSET_FLAGS (canvas, GTK_HAS_FOCUS);
......@@ -782,7 +774,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GdkEventButton *bevent = (GdkEventButton *) event;
GdkEventMask event_mask;
D (g_printerr ("tool event (display %p): BUTTON_PRESS\n", display));
GIMP_LOG (TOOLS, "event (display %p): BUTTON_PRESS", display);
if (! GTK_WIDGET_HAS_FOCUS (canvas))
{
......@@ -928,7 +920,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{
GdkEventButton *bevent = (GdkEventButton *) event;
D (g_printerr ("tool event (display %p): BUTTON_RELEASE\n", display));
GIMP_LOG (TOOLS, "event (display %p): BUTTON_RELEASE", display);
gimp_display_shell_autoscroll_stop (shell);
......@@ -994,7 +986,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GdkScrollDirection direction;
GimpController *wheel;
D (g_printerr ("tool event (display %p): SCROLL\n", display));
GIMP_LOG (TOOLS, "event (display %p): SCROLL", display);
wheel = gimp_controllers_get_wheel (gimp);
......@@ -1097,7 +1089,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GdkEventMotion *mevent = (GdkEventMotion *) event;
GdkEvent *compressed_motion = NULL;
D (g_printerr ("tool event (display %p): MOTION_NOTIFY\n", display));
GIMP_LOG (TOOLS, "event (display %p): MOTION_NOTIFY", display);
if (gimp->busy)
return TRUE;
......@@ -1258,7 +1250,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
break;
case GDK_KEY_PRESS:
D (g_printerr ("tool event (display %p): KEY_PRESS\n", display));
GIMP_LOG (TOOLS, "event (display %p): KEY_PRESS", display);
if (state & GDK_BUTTON1_MASK)
{
......@@ -1370,7 +1362,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
break;
case GDK_KEY_RELEASE:
D (g_printerr ("tool event (display %p): KEY_RELEASE\n", display));
GIMP_LOG (TOOLS, "event (display %p): KEY_RELEASE", display);
if (state & GDK_BUTTON1_MASK)
{
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "glib-object.h"
#include "gimp-log.h"
GimpLogFlags gimp_log_flags = 0;
void
gimp_log_init (void)
{
const gchar *env_log_val = g_getenv ("GIMP_LOG");
if (env_log_val)
{
const GDebugKey log_keys[] =
{
{ "tools", GIMP_LOG_TOOLS }
};
gimp_log_flags = g_parse_debug_string (env_log_val,
log_keys,
G_N_ELEMENTS (log_keys));
}
}
void
gimp_log (const gchar *function,
gint line,
const gchar *domain,
const gchar *format,
...)
{
va_list args;
gchar *message;
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
g_log (domain, G_LOG_LEVEL_DEBUG,
"%s(%d): %s", function, line, message);
g_free (message);
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_LOG_H__
#define __GIMP_LOG_H__
typedef enum
{
GIMP_LOG_TOOLS = 1 << 0
} GimpLogFlags;
#define GIMP_LOG(type, format...) \
G_STMT_START { \
if (gimp_log_flags && GIMP_LOG_##type) \
gimp_log (G_STRFUNC, __LINE__, #type, format); \
} G_STMT_END
extern GimpLogFlags gimp_log_flags;
void gimp_log_init (void);
void gimp_log (const gchar *function,
gint line,
const gchar *domain,
const gchar *format,
...) G_GNUC_PRINTF (4, 5);
#endif /* __GIMP_LOG_H__ */
......@@ -74,6 +74,7 @@
#include <conio.h>
#endif
#include "gimp-log.h"
#include "gimp-intl.h"
......@@ -299,6 +300,8 @@ main (int argc,
gimp_env_init (FALSE);
gimp_log_init ();
gimp_init_i18n ();
g_set_application_name (GIMP_NAME);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment