mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 06:14:03 +00:00
app/main.c moved "message_handler" from here...
2001-12-01 Michael Natterer <mitch@gimp.org> * app/main.c * app/appenv.h: moved "message_handler" from here... * app/core/gimp.[ch]: ...to here. Added gimp_message() and a "gui_message_func" pointer... * app/gui/gui.c: ...which gets set here to gui_message(). * app/errors.c: don't include any gui stuff but simply call gimp_message(). * app/app_procs.c: don't set "message_handler" here, it's done in gui.c now. * app/gui/error-console-dialog.[ch]: use gimp->message_handler. * app/gui/dialogs-constructors.c: pass a Gimp pointer to error_console_create(). * app/widgets/gimpwidgets-utils.[ch]: made the "message" parameter of gimp_message_box() a const gchar*, not just gchar*. * tools/pdbgen/pdb/message.pdb: use gimp->message_handler, don't include "appenv.h". * app/pdb/message_cmds.c: regenerated. * app/devices.[ch]: cleanup before chopping: removed global variable "current_device", added devices_get_current(), pass lots of Gimp pointers around. * app/gimprc.c: pass a Gimp pointer to devices_rc_update(). * app/display/gimpdisplayshell-callbacks.c * app/gui/toolbox.c * app/tools/gimppainttool.c: use devices_get_current(), pass Gimp pointers to all devices_foo() functions. * app/core/gimpimage-mask.c: no need to include "pdb/pdb-types.h".
This commit is contained in:
parent
d214dbdb5d
commit
f77c7ade89
44
ChangeLog
44
ChangeLog
|
@ -1,3 +1,45 @@
|
|||
2001-12-01 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/main.c
|
||||
* app/appenv.h: moved "message_handler" from here...
|
||||
|
||||
* app/core/gimp.[ch]: ...to here. Added gimp_message() and a
|
||||
"gui_message_func" pointer...
|
||||
|
||||
* app/gui/gui.c: ...which gets set here to gui_message().
|
||||
|
||||
* app/errors.c: don't include any gui stuff but simply call
|
||||
gimp_message().
|
||||
|
||||
* app/app_procs.c: don't set "message_handler" here, it's done in
|
||||
gui.c now.
|
||||
|
||||
* app/gui/error-console-dialog.[ch]: use gimp->message_handler.
|
||||
|
||||
* app/gui/dialogs-constructors.c: pass a Gimp pointer to
|
||||
error_console_create().
|
||||
|
||||
* app/widgets/gimpwidgets-utils.[ch]: made the "message" parameter
|
||||
of gimp_message_box() a const gchar*, not just gchar*.
|
||||
|
||||
* tools/pdbgen/pdb/message.pdb: use gimp->message_handler, don't
|
||||
include "appenv.h".
|
||||
|
||||
* app/pdb/message_cmds.c: regenerated.
|
||||
|
||||
* app/devices.[ch]: cleanup before chopping: removed global
|
||||
variable "current_device", added devices_get_current(), pass lots
|
||||
of Gimp pointers around.
|
||||
|
||||
* app/gimprc.c: pass a Gimp pointer to devices_rc_update().
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c
|
||||
* app/gui/toolbox.c
|
||||
* app/tools/gimppainttool.c: use devices_get_current(), pass Gimp
|
||||
pointers to all devices_foo() functions.
|
||||
|
||||
* app/core/gimpimage-mask.c: no need to include "pdb/pdb-types.h".
|
||||
|
||||
2001-12-01 Daniel Egger <degger@fhm.edu>
|
||||
|
||||
* app/core/Makefile.am
|
||||
|
@ -36,7 +78,7 @@
|
|||
|
||||
* tools/pdbgen/enumcode.pl: added a general check to prevent
|
||||
enums which are defined in libgimp* from being written to
|
||||
"libgimp/gimpenums.c".
|
||||
"libgimp/gimpenums.h".
|
||||
|
||||
* libgimp/gimpenums.h
|
||||
* plug-ins/script-fu/script-fu-constants.c
|
||||
|
|
|
@ -19,17 +19,13 @@ scriptdata =
|
|||
bin_PROGRAMS = gimp-1.3
|
||||
|
||||
##
|
||||
## gui stuff that needs to go to libgimp/, gui/ or /dev/null
|
||||
## gui stuff for gui/, display/ or widgets/
|
||||
##
|
||||
gui_sources = \
|
||||
devices.c \
|
||||
devices.h \
|
||||
gimpprogress.c \
|
||||
gimpprogress.h \
|
||||
nav_window.c \
|
||||
nav_window.h \
|
||||
ops_buttons.c \
|
||||
ops_buttons.h \
|
||||
undo_history.c \
|
||||
undo_history.h
|
||||
|
||||
|
@ -37,6 +33,8 @@ gui_sources = \
|
|||
## stuff that needs to be split up in core / ui files
|
||||
##
|
||||
core_ui_sources = \
|
||||
gimpprogress.c \
|
||||
gimpprogress.h \
|
||||
image_map.c \
|
||||
image_map.h
|
||||
|
||||
|
@ -51,7 +49,6 @@ core_sources = \
|
|||
## config stuff
|
||||
##
|
||||
config_sources = \
|
||||
appenv.h \
|
||||
general.c \
|
||||
general.h \
|
||||
gimprc.c \
|
||||
|
@ -61,6 +58,8 @@ config_sources = \
|
|||
## stuff which is about to be replaced by new subsystems
|
||||
##
|
||||
bye_sources = \
|
||||
ops_buttons.c \
|
||||
ops_buttons.h \
|
||||
path.c \
|
||||
path.h \
|
||||
pathP.h \
|
||||
|
@ -77,6 +76,7 @@ bye_sources = \
|
|||
## stuff
|
||||
##
|
||||
stuff_sources = \
|
||||
appenv.h \
|
||||
app_procs.c \
|
||||
app_procs.h \
|
||||
main.c \
|
||||
|
|
|
@ -92,6 +92,8 @@ app_init (gint gimp_argc,
|
|||
no_interface,
|
||||
stack_trace_mode);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (the_gimp), prog_name);
|
||||
|
||||
/* Check if the user's gimp_directory exists
|
||||
*/
|
||||
gimp_dir = gimp_directory ();
|
||||
|
@ -165,9 +167,6 @@ app_init (gint gimp_argc,
|
|||
if (! no_splash)
|
||||
splash_destroy ();
|
||||
|
||||
/* FIXME: This needs to go in preferences */
|
||||
message_handler = GIMP_MESSAGE_BOX;
|
||||
|
||||
gui_restore (the_gimp, restore_session);
|
||||
}
|
||||
|
||||
|
@ -223,8 +222,6 @@ app_init_update_status (const gchar *text1,
|
|||
static void
|
||||
app_exit_finish (void)
|
||||
{
|
||||
message_handler = GIMP_CONSOLE;
|
||||
|
||||
if (! no_interface)
|
||||
{
|
||||
gui_shutdown (the_gimp);
|
||||
|
|
|
@ -35,8 +35,7 @@ extern gchar *alternate_system_gimprc;
|
|||
extern gchar **batch_cmds;
|
||||
|
||||
/* other global variables */
|
||||
extern gchar *prog_name;
|
||||
extern GimpMessageHandlerType message_handler;
|
||||
extern gchar *prog_name;
|
||||
|
||||
|
||||
#endif /* __APPENV_H__ */
|
||||
|
|
|
@ -120,6 +120,7 @@ gimp_init (Gimp *gimp)
|
|||
gimp->be_verbose = FALSE;
|
||||
gimp->no_data = FALSE;
|
||||
gimp->no_interface = FALSE;
|
||||
gimp->message_handler = GIMP_CONSOLE;
|
||||
gimp->stack_trace_mode = GIMP_STACK_TRACE_NEVER;
|
||||
|
||||
gimp->main_loops = NULL;
|
||||
|
@ -129,6 +130,7 @@ gimp_init (Gimp *gimp)
|
|||
gimp->gui_create_display_func = NULL;
|
||||
gimp->gui_set_busy_func = NULL;
|
||||
gimp->gui_unset_busy_func = NULL;
|
||||
gimp->gui_message_func = NULL;
|
||||
|
||||
gimp->busy = 0;
|
||||
gimp->busy_idle_id = 0;
|
||||
|
@ -585,6 +587,30 @@ gimp_unset_busy (Gimp *gimp)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_message (Gimp *gimp,
|
||||
const gchar *message)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
switch (gimp->message_handler)
|
||||
{
|
||||
case GIMP_MESSAGE_BOX:
|
||||
case GIMP_ERROR_CONSOLE:
|
||||
if (gimp->gui_message_func)
|
||||
{
|
||||
gimp->gui_message_func (gimp, message);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_printerr ("%s: %s\n", GIMP_OBJECT (gimp)->name, message);
|
||||
}
|
||||
|
||||
GimpImage *
|
||||
gimp_create_image (Gimp *gimp,
|
||||
gint width,
|
||||
|
|
|
@ -24,11 +24,13 @@
|
|||
#include "gimpimage-new.h"
|
||||
|
||||
|
||||
typedef void (* GimpMainLoopFunc) (Gimp *gimp);
|
||||
typedef GimpObject * (* GimpCreateDisplayFunc) (GimpImage *gimage,
|
||||
guint scale);
|
||||
typedef void (* GimpSetBusyFunc) (Gimp *gimp);
|
||||
typedef void (* GimpUnsetBusyFunc) (Gimp *gimp);
|
||||
typedef void (* GimpMainLoopFunc) (Gimp *gimp);
|
||||
typedef GimpObject * (* GimpCreateDisplayFunc) (GimpImage *gimage,
|
||||
guint scale);
|
||||
typedef void (* GimpSetBusyFunc) (Gimp *gimp);
|
||||
typedef void (* GimpUnsetBusyFunc) (Gimp *gimp);
|
||||
typedef void (* GimpMessageFunc) (Gimp *gimp,
|
||||
const gchar *message);
|
||||
|
||||
|
||||
#define GIMP_TYPE_GIMP (gimp_get_type ())
|
||||
|
@ -49,6 +51,7 @@ struct _Gimp
|
|||
gboolean be_verbose;
|
||||
gboolean no_data;
|
||||
gboolean no_interface;
|
||||
GimpMessageHandlerType message_handler;
|
||||
GimpStackTraceMode stack_trace_mode;
|
||||
|
||||
GList *main_loops;
|
||||
|
@ -58,6 +61,7 @@ struct _Gimp
|
|||
GimpCreateDisplayFunc gui_create_display_func;
|
||||
GimpSetBusyFunc gui_set_busy_func;
|
||||
GimpUnsetBusyFunc gui_unset_busy_func;
|
||||
GimpMessageFunc gui_message_func;
|
||||
|
||||
gint busy;
|
||||
guint busy_idle_id;
|
||||
|
@ -147,6 +151,9 @@ void gimp_set_busy (Gimp *gimp);
|
|||
void gimp_set_busy_until_idle (Gimp *gimp);
|
||||
void gimp_unset_busy (Gimp *gimp);
|
||||
|
||||
void gimp_message (Gimp *gimp,
|
||||
const gchar *message);
|
||||
|
||||
GimpImage * gimp_create_image (Gimp *gimp,
|
||||
gint width,
|
||||
gint height,
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <glib-object.h>
|
||||
|
||||
#include "core-types.h"
|
||||
#include "pdb/pdb-types.h"
|
||||
|
||||
#include "base/boundary.h"
|
||||
#include "base/pixel-region.h"
|
||||
|
|
|
@ -141,10 +141,9 @@ static void device_status_context_connect (GimpContext *context,
|
|||
GdkDevice *device);
|
||||
|
||||
|
||||
/* global data */
|
||||
GdkDevice *current_device = NULL;
|
||||
|
||||
/* local data */
|
||||
|
||||
static GdkDevice *current_device = NULL;
|
||||
static GList *device_info_list = NULL;
|
||||
static DeviceInfoDialog *deviceD = NULL;
|
||||
|
||||
|
@ -191,10 +190,12 @@ device_info_get_by_name (gchar *name)
|
|||
/* the gtk input dialog */
|
||||
|
||||
GtkWidget *
|
||||
input_dialog_create (void)
|
||||
input_dialog_create (Gimp *gimp)
|
||||
{
|
||||
static GtkWidget *inputd = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (inputd)
|
||||
return inputd;
|
||||
|
||||
|
@ -309,8 +310,17 @@ devices_restore (Gimp *gimp)
|
|||
suppress_update = FALSE;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
devices_get_current (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
return current_device;
|
||||
}
|
||||
|
||||
void
|
||||
devices_rc_update (gchar *name,
|
||||
devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
|
@ -510,11 +520,15 @@ devices_rc_update (gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
select_device (GdkDevice *new_device)
|
||||
select_device (Gimp *gimp,
|
||||
GdkDevice *new_device)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GimpContext *context;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GDK_IS_DEVICE (new_device));
|
||||
|
||||
device_info = device_info_get_by_device (current_device);
|
||||
|
||||
gimp_context_unset_parent (device_info->context);
|
||||
|
@ -537,10 +551,14 @@ select_device (GdkDevice *new_device)
|
|||
}
|
||||
|
||||
gboolean
|
||||
devices_check_change (GdkEvent *event)
|
||||
devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkDevice *device;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
|
@ -570,7 +588,7 @@ devices_check_change (GdkEvent *event)
|
|||
|
||||
if (device != current_device)
|
||||
{
|
||||
select_device (device);
|
||||
select_device (gimp, device);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -743,7 +761,7 @@ devices_write_rc (void)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
device_status_create (void)
|
||||
device_status_create (Gimp *gimp)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GtkWidget *label;
|
||||
|
@ -751,6 +769,8 @@ device_status_create (void)
|
|||
GList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (deviceD)
|
||||
return deviceD->shell;
|
||||
|
||||
|
@ -977,8 +997,10 @@ devices_close_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
device_status_free (void)
|
||||
{
|
||||
device_status_free (Gimp *gimp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
/* Save device status on exit */
|
||||
if (gimprc.save_device_status)
|
||||
devices_write_rc ();
|
||||
|
|
|
@ -33,47 +33,48 @@ typedef enum
|
|||
DEVICE_GRADIENT = 1 << 8
|
||||
} DeviceValues;
|
||||
|
||||
|
||||
/* Initialize the input devices */
|
||||
void devices_init (Gimp *gimp);
|
||||
void devices_init (Gimp *gimp);
|
||||
|
||||
/* Restores device settings from rc file */
|
||||
void devices_restore (Gimp *gimp);
|
||||
void devices_restore (Gimp *gimp);
|
||||
|
||||
/* Create device info dialog */
|
||||
GtkWidget * input_dialog_create (void);
|
||||
|
||||
/* Create the device status dialog */
|
||||
GtkWidget * device_status_create (void);
|
||||
GdkDevice * devices_get_current (Gimp *gimp);
|
||||
|
||||
/* Returns TRUE, and makes necessary global changes
|
||||
* if event is not for current_device
|
||||
*/
|
||||
gboolean devices_check_change (GdkEvent *event);
|
||||
gboolean devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event);
|
||||
|
||||
/* Loads stored device settings (tool, cursor, ...) */
|
||||
void select_device (GdkDevice *device);
|
||||
void devices_select_device (Gimp *gimp,
|
||||
GdkDevice *device);
|
||||
|
||||
/* The device info dialog */
|
||||
GtkWidget * input_dialog_create (Gimp *gimp);
|
||||
void input_dialog_free (Gimp *gimp);
|
||||
|
||||
/* The device status dialog */
|
||||
GtkWidget * device_status_create (Gimp *gimp);
|
||||
void device_status_free (Gimp *gimp);
|
||||
|
||||
/* Add information about one tool from rc file */
|
||||
void devices_rc_update (gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
const gchar *tool_name,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
const gchar *brush_name,
|
||||
const gchar *pattern_name,
|
||||
const gchar *gradient_name);
|
||||
|
||||
/* Free device status (only for session-managment) */
|
||||
void device_status_free (void);
|
||||
|
||||
|
||||
/* Current device */
|
||||
extern GdkDevice *current_device;
|
||||
void devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
const gchar *tool_name,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
const gchar *brush_name,
|
||||
const gchar *pattern_name,
|
||||
const gchar *gradient_name);
|
||||
|
||||
|
||||
#endif /* __DEVICES_H__ */
|
||||
|
|
|
@ -177,7 +177,7 @@ dialogs_device_status_get (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
return device_status_create ();
|
||||
return device_status_create (context->gimp);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -225,7 +225,7 @@ dialogs_input_devices_get (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
return input_dialog_create ();
|
||||
return input_dialog_create (context->gimp);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -806,7 +806,7 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
if (view)
|
||||
return NULL;
|
||||
|
||||
view = error_console_create ();
|
||||
view = error_console_create (context->gimp);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ gimp_display_shell_check_device_cursor (GimpDisplayShell *shell)
|
|||
{
|
||||
GdkDevice *device = (GdkDevice *) list->data;
|
||||
|
||||
if (device == current_device)
|
||||
if (device == devices_get_current (shell->gdisp->gimage->gimp))
|
||||
{
|
||||
shell->draw_cursor = ! device->has_cursor;
|
||||
break;
|
||||
|
@ -317,11 +317,17 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
gimage = gdisp->gimage;
|
||||
|
||||
/* Find out what device the event occurred upon */
|
||||
if (! gimage->gimp->busy && devices_check_change (event))
|
||||
gimp_display_shell_check_device_cursor (shell);
|
||||
if (! gimage->gimp->busy && devices_check_change (gimage->gimp, event))
|
||||
{
|
||||
gimp_display_shell_check_device_cursor (shell);
|
||||
}
|
||||
|
||||
gimp_display_shell_get_coords (shell, event, current_device, &display_coords);
|
||||
gimp_display_shell_get_state (shell, event, current_device, &state);
|
||||
gimp_display_shell_get_coords (shell, event,
|
||||
devices_get_current (gimage->gimp),
|
||||
&display_coords);
|
||||
gimp_display_shell_get_state (shell, event,
|
||||
devices_get_current (gimage->gimp),
|
||||
&state);
|
||||
time = gdk_event_get_time (event);
|
||||
|
||||
image_coords = display_coords;
|
||||
|
|
108
app/errors.c
108
app/errors.c
|
@ -26,16 +26,13 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "widgets/widgets-types.h"
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "gui/dialogs.h"
|
||||
#include "gui/error-console-dialog.h"
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "appenv.h"
|
||||
#include "errors.h"
|
||||
|
||||
|
@ -44,35 +41,28 @@
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_eek (const gchar *reason,
|
||||
const gchar *message,
|
||||
gboolean use_handler);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_message_log_func (const gchar *log_domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *message,
|
||||
gpointer data)
|
||||
{
|
||||
if (console_messages == FALSE)
|
||||
if (! console_messages && GIMP_IS_GIMP (the_gimp))
|
||||
{
|
||||
switch (message_handler)
|
||||
{
|
||||
case GIMP_MESSAGE_BOX:
|
||||
gimp_message_box ((gchar *) message, NULL, NULL);
|
||||
break;
|
||||
|
||||
case GIMP_ERROR_CONSOLE:
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
"gimp:error-console", -1);
|
||||
error_console_add ((gchar *) message);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_printerr ("%s: %s\n", prog_name, (gchar *) message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("%s: %s\n", prog_name, (gchar *) message);
|
||||
gimp_message (the_gimp, message);
|
||||
}
|
||||
|
||||
g_printerr ("%s: %s\n", prog_name, message);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -81,7 +71,7 @@ gimp_error_log_func (const gchar *domain,
|
|||
const gchar *message,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_fatal_error ("%s", message);
|
||||
gimp_fatal_error (message);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -94,48 +84,7 @@ gimp_fatal_error (const gchar *fmt, ...)
|
|||
message = g_strdup_vprintf (fmt, args);
|
||||
va_end (args);
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
|
||||
g_printerr ("%s: fatal error: %s\n", prog_name, message);
|
||||
|
||||
switch (stack_trace_mode)
|
||||
{
|
||||
case GIMP_STACK_TRACE_NEVER:
|
||||
break;
|
||||
|
||||
case GIMP_STACK_TRACE_QUERY:
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_query (prog_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_STACK_TRACE_ALWAYS:
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_stack_trace (prog_name);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* g_on_error_* don't do anything reasonable on Win32. */
|
||||
|
||||
MessageBox (NULL, message, prog_name, MB_OK|MB_ICONERROR);
|
||||
|
||||
#endif /* ! G_OS_WIN32 */
|
||||
|
||||
gtk_exit (1);
|
||||
gimp_eek ("fatal error", message, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -148,11 +97,22 @@ gimp_terminate (const gchar *fmt, ...)
|
|||
message = g_strdup_vprintf (fmt, args);
|
||||
va_end (args);
|
||||
|
||||
gimp_eek ("terminated", message, use_debug_handler);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_eek (const gchar *reason,
|
||||
const gchar *message,
|
||||
gboolean use_handler)
|
||||
{
|
||||
#ifndef G_OS_WIN32
|
||||
|
||||
g_printerr ("%s terminated: %s\n", prog_name, message);
|
||||
g_printerr ("%s: %s: %s\n", prog_name, reason, message);
|
||||
|
||||
if (use_debug_handler)
|
||||
if (use_handler)
|
||||
{
|
||||
switch (stack_trace_mode)
|
||||
{
|
||||
|
@ -192,5 +152,5 @@ gimp_terminate (const gchar *fmt, ...)
|
|||
|
||||
#endif /* ! G_OS_WIN32 */
|
||||
|
||||
gtk_exit (1);
|
||||
exit (1);
|
||||
}
|
||||
|
|
|
@ -2313,7 +2313,8 @@ parse_device (gpointer val1p,
|
|||
goto error;
|
||||
token = get_next_token ();
|
||||
|
||||
devices_rc_update (name, values, mode, num_axes, axes, num_keys, keys,
|
||||
devices_rc_update (the_gimp,
|
||||
name, values, mode, num_axes, axes, num_keys, keys,
|
||||
tool_name,
|
||||
&foreground,
|
||||
&background,
|
||||
|
|
|
@ -141,10 +141,9 @@ static void device_status_context_connect (GimpContext *context,
|
|||
GdkDevice *device);
|
||||
|
||||
|
||||
/* global data */
|
||||
GdkDevice *current_device = NULL;
|
||||
|
||||
/* local data */
|
||||
|
||||
static GdkDevice *current_device = NULL;
|
||||
static GList *device_info_list = NULL;
|
||||
static DeviceInfoDialog *deviceD = NULL;
|
||||
|
||||
|
@ -191,10 +190,12 @@ device_info_get_by_name (gchar *name)
|
|||
/* the gtk input dialog */
|
||||
|
||||
GtkWidget *
|
||||
input_dialog_create (void)
|
||||
input_dialog_create (Gimp *gimp)
|
||||
{
|
||||
static GtkWidget *inputd = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (inputd)
|
||||
return inputd;
|
||||
|
||||
|
@ -309,8 +310,17 @@ devices_restore (Gimp *gimp)
|
|||
suppress_update = FALSE;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
devices_get_current (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
return current_device;
|
||||
}
|
||||
|
||||
void
|
||||
devices_rc_update (gchar *name,
|
||||
devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
|
@ -510,11 +520,15 @@ devices_rc_update (gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
select_device (GdkDevice *new_device)
|
||||
select_device (Gimp *gimp,
|
||||
GdkDevice *new_device)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GimpContext *context;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GDK_IS_DEVICE (new_device));
|
||||
|
||||
device_info = device_info_get_by_device (current_device);
|
||||
|
||||
gimp_context_unset_parent (device_info->context);
|
||||
|
@ -537,10 +551,14 @@ select_device (GdkDevice *new_device)
|
|||
}
|
||||
|
||||
gboolean
|
||||
devices_check_change (GdkEvent *event)
|
||||
devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkDevice *device;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
|
@ -570,7 +588,7 @@ devices_check_change (GdkEvent *event)
|
|||
|
||||
if (device != current_device)
|
||||
{
|
||||
select_device (device);
|
||||
select_device (gimp, device);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -743,7 +761,7 @@ devices_write_rc (void)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
device_status_create (void)
|
||||
device_status_create (Gimp *gimp)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GtkWidget *label;
|
||||
|
@ -751,6 +769,8 @@ device_status_create (void)
|
|||
GList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (deviceD)
|
||||
return deviceD->shell;
|
||||
|
||||
|
@ -977,8 +997,10 @@ devices_close_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
device_status_free (void)
|
||||
{
|
||||
device_status_free (Gimp *gimp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
/* Save device status on exit */
|
||||
if (gimprc.save_device_status)
|
||||
devices_write_rc ();
|
||||
|
|
|
@ -177,7 +177,7 @@ dialogs_device_status_get (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
return device_status_create ();
|
||||
return device_status_create (context->gimp);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -225,7 +225,7 @@ dialogs_input_devices_get (GimpDialogFactory *factory,
|
|||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
return input_dialog_create ();
|
||||
return input_dialog_create (context->gimp);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -806,7 +806,7 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
if (view)
|
||||
return NULL;
|
||||
|
||||
view = error_console_create ();
|
||||
view = error_console_create (context->gimp);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
|
|
|
@ -50,7 +50,9 @@
|
|||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "error-console-dialog.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
@ -92,7 +94,7 @@ static GtkWidget *error_console = NULL;
|
|||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
error_console_create (void)
|
||||
error_console_create (Gimp *gimp)
|
||||
{
|
||||
GtkTextBuffer *text_buffer;
|
||||
GtkWidget *text_view;
|
||||
|
@ -100,6 +102,8 @@ error_console_create (void)
|
|||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (error_console)
|
||||
return error_console;
|
||||
|
||||
|
@ -111,7 +115,7 @@ error_console_create (void)
|
|||
|
||||
g_object_weak_ref (G_OBJECT (error_console),
|
||||
(GWeakNotify) error_console_destroy_callback,
|
||||
NULL);
|
||||
gimp);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
|
@ -164,20 +168,22 @@ error_console_create (void)
|
|||
G_CALLBACK (text_clicked_callback),
|
||||
menu);
|
||||
|
||||
/* FIXME: interact with preferences */
|
||||
message_handler = GIMP_ERROR_CONSOLE;
|
||||
gimp->message_handler = GIMP_ERROR_CONSOLE;
|
||||
|
||||
return error_console;
|
||||
}
|
||||
|
||||
void
|
||||
error_console_add (const gchar *errormsg)
|
||||
error_console_add (Gimp *gimp,
|
||||
const gchar *errormsg)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
if (! error_console)
|
||||
{
|
||||
g_warning ("%s: error_console widget is NULL", G_STRLOC);
|
||||
|
||||
message_handler = GIMP_MESSAGE_BOX;
|
||||
gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
g_message (errormsg);
|
||||
|
||||
return;
|
||||
|
@ -204,10 +210,13 @@ error_console_add (const gchar *errormsg)
|
|||
static void
|
||||
error_console_destroy_callback (gpointer data)
|
||||
{
|
||||
Gimp *gimp;
|
||||
|
||||
gimp = GIMP (data);
|
||||
|
||||
error_console = NULL;
|
||||
|
||||
/* FIXME: interact with preferences */
|
||||
message_handler = GIMP_MESSAGE_BOX;
|
||||
gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
#define __ERROR_CONSOLE_DIALOG_H__
|
||||
|
||||
|
||||
void error_console_add (const gchar *errormsg);
|
||||
GtkWidget * error_console_create (Gimp *gimp);
|
||||
|
||||
GtkWidget * error_console_create (void);
|
||||
void error_console_add (Gimp *gimp,
|
||||
const gchar *errormsg);
|
||||
|
||||
|
||||
#endif /* __ERROR_CONSOLE_DIALOG_H__ */
|
||||
|
|
|
@ -41,11 +41,13 @@
|
|||
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "brush-select.h"
|
||||
#include "color-select.h"
|
||||
#include "devices.h"
|
||||
#include "dialogs.h"
|
||||
#include "error-console-dialog.h"
|
||||
#include "file-open-dialog.h"
|
||||
#include "file-save-dialog.h"
|
||||
#include "gradient-select.h"
|
||||
|
@ -71,6 +73,8 @@ static void gui_main (Gimp *gimp);
|
|||
static void gui_main_quit (Gimp *gimp);
|
||||
static void gui_set_busy (Gimp *gimp);
|
||||
static void gui_unset_busy (Gimp *gimp);
|
||||
static void gui_message (Gimp *gimp,
|
||||
const gchar *message);
|
||||
static GimpObject * gui_display_new (GimpImage *gimage,
|
||||
guint scale);
|
||||
|
||||
|
@ -216,9 +220,10 @@ gui_init (Gimp *gimp)
|
|||
|
||||
gimp->gui_main_loop_func = gui_main;
|
||||
gimp->gui_main_loop_quit_func = gui_main_quit;
|
||||
gimp->gui_create_display_func = gui_display_new;
|
||||
gimp->gui_set_busy_func = gui_set_busy;
|
||||
gimp->gui_unset_busy_func = gui_unset_busy;
|
||||
gimp->gui_message_func = gui_message;
|
||||
gimp->gui_create_display_func = gui_display_new;
|
||||
|
||||
image_disconnect_handler_id =
|
||||
gimp_container_add_handler (gimp->images, "disconnect",
|
||||
|
@ -262,6 +267,8 @@ gui_restore (Gimp *gimp,
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
|
||||
file_open_dialog_menu_init (gimp);
|
||||
file_save_dialog_menu_init (gimp);
|
||||
|
||||
|
@ -295,8 +302,10 @@ gui_shutdown (Gimp *gimp)
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
gimp->message_handler = GIMP_CONSOLE;
|
||||
|
||||
session_save (gimp);
|
||||
device_status_free ();
|
||||
device_status_free (gimp);
|
||||
|
||||
brush_dialog_free ();
|
||||
pattern_dialog_free ();
|
||||
|
@ -402,6 +411,45 @@ gui_main_quit (Gimp *gimp)
|
|||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
gui_set_busy (Gimp *gimp)
|
||||
{
|
||||
gdisplays_set_busy ();
|
||||
gimp_dialog_factories_idle ();
|
||||
|
||||
gdk_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gui_unset_busy (Gimp *gimp)
|
||||
{
|
||||
gdisplays_unset_busy ();
|
||||
gimp_dialog_factories_unidle ();
|
||||
|
||||
gdk_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gui_message (Gimp *gimp,
|
||||
const gchar *message)
|
||||
{
|
||||
switch (gimp->message_handler)
|
||||
{
|
||||
case GIMP_MESSAGE_BOX:
|
||||
gimp_message_box (message, NULL, NULL);
|
||||
break;
|
||||
|
||||
case GIMP_ERROR_CONSOLE:
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
"gimp:error-console", -1);
|
||||
error_console_add (gimp, message);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean double_speed = FALSE;
|
||||
|
||||
static GimpObject *
|
||||
|
@ -428,24 +476,6 @@ gui_display_new (GimpImage *gimage,
|
|||
return GIMP_OBJECT (gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
gui_set_busy (Gimp *gimp)
|
||||
{
|
||||
gdisplays_set_busy ();
|
||||
gimp_dialog_factories_idle ();
|
||||
|
||||
gdk_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gui_unset_busy (Gimp *gimp)
|
||||
{
|
||||
gdisplays_unset_busy ();
|
||||
gimp_dialog_factories_unidle ();
|
||||
|
||||
gdk_flush ();
|
||||
}
|
||||
|
||||
static gint
|
||||
gui_rotate_the_shield_harmonics (GtkWidget *widget,
|
||||
GdkEvent *eevent,
|
||||
|
|
|
@ -141,10 +141,9 @@ static void device_status_context_connect (GimpContext *context,
|
|||
GdkDevice *device);
|
||||
|
||||
|
||||
/* global data */
|
||||
GdkDevice *current_device = NULL;
|
||||
|
||||
/* local data */
|
||||
|
||||
static GdkDevice *current_device = NULL;
|
||||
static GList *device_info_list = NULL;
|
||||
static DeviceInfoDialog *deviceD = NULL;
|
||||
|
||||
|
@ -191,10 +190,12 @@ device_info_get_by_name (gchar *name)
|
|||
/* the gtk input dialog */
|
||||
|
||||
GtkWidget *
|
||||
input_dialog_create (void)
|
||||
input_dialog_create (Gimp *gimp)
|
||||
{
|
||||
static GtkWidget *inputd = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (inputd)
|
||||
return inputd;
|
||||
|
||||
|
@ -309,8 +310,17 @@ devices_restore (Gimp *gimp)
|
|||
suppress_update = FALSE;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
devices_get_current (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
return current_device;
|
||||
}
|
||||
|
||||
void
|
||||
devices_rc_update (gchar *name,
|
||||
devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
|
@ -510,11 +520,15 @@ devices_rc_update (gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
select_device (GdkDevice *new_device)
|
||||
select_device (Gimp *gimp,
|
||||
GdkDevice *new_device)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GimpContext *context;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GDK_IS_DEVICE (new_device));
|
||||
|
||||
device_info = device_info_get_by_device (current_device);
|
||||
|
||||
gimp_context_unset_parent (device_info->context);
|
||||
|
@ -537,10 +551,14 @@ select_device (GdkDevice *new_device)
|
|||
}
|
||||
|
||||
gboolean
|
||||
devices_check_change (GdkEvent *event)
|
||||
devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkDevice *device;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
|
@ -570,7 +588,7 @@ devices_check_change (GdkEvent *event)
|
|||
|
||||
if (device != current_device)
|
||||
{
|
||||
select_device (device);
|
||||
select_device (gimp, device);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -743,7 +761,7 @@ devices_write_rc (void)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
device_status_create (void)
|
||||
device_status_create (Gimp *gimp)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GtkWidget *label;
|
||||
|
@ -751,6 +769,8 @@ device_status_create (void)
|
|||
GList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (deviceD)
|
||||
return deviceD->shell;
|
||||
|
||||
|
@ -977,8 +997,10 @@ devices_close_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
device_status_free (void)
|
||||
{
|
||||
device_status_free (Gimp *gimp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
/* Save device status on exit */
|
||||
if (gimprc.save_device_status)
|
||||
devices_write_rc ();
|
||||
|
|
|
@ -150,7 +150,7 @@ toolbox_check_device (GtkWidget *widget,
|
|||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
devices_check_change (event);
|
||||
devices_check_change (GIMP (data), event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ toolbox_create (Gimp *gimp)
|
|||
{
|
||||
g_signal_connect (G_OBJECT (window), "motion_notify_event",
|
||||
G_CALLBACK (toolbox_check_device),
|
||||
NULL);
|
||||
gimp);
|
||||
|
||||
gtk_widget_set_events (window, GDK_POINTER_MOTION_MASK);
|
||||
gtk_widget_set_extension_events (window, GDK_EXTENSION_EVENTS_CURSOR);
|
||||
|
|
|
@ -77,8 +77,7 @@ gchar *alternate_system_gimprc = NULL;
|
|||
gchar **batch_cmds = NULL;
|
||||
|
||||
/* other global variables */
|
||||
gchar *prog_name = NULL; /* our executable name */
|
||||
GimpMessageHandlerType message_handler = GIMP_CONSOLE;
|
||||
gchar *prog_name = NULL; /* our executable name */
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -56,6 +57,7 @@
|
|||
#include "gimpconvolvetool.h"
|
||||
#include "gimppainttool.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "devices.h"
|
||||
#include "gimprc.h"
|
||||
#include "undo.h"
|
||||
|
@ -1318,7 +1320,7 @@ gimp_paint_tool_calculate_brush_size (MaskBuf *mask,
|
|||
{
|
||||
scale = CLAMP (scale, 0.0, 1.0);
|
||||
|
||||
if (current_device == gdk_device_get_core_pointer ())
|
||||
if (devices_get_current (the_gimp) == gdk_device_get_core_pointer ())
|
||||
{
|
||||
*width = mask->width;
|
||||
*height = mask->height;
|
||||
|
@ -1636,9 +1638,12 @@ gimp_paint_tool_get_brush_mask (GimpPaintTool *paint_tool,
|
|||
BrushApplicationMode brush_hardness,
|
||||
gdouble scale)
|
||||
{
|
||||
MaskBuf *mask;
|
||||
GimpTool *tool;
|
||||
MaskBuf *mask;
|
||||
|
||||
if (current_device == gdk_device_get_core_pointer ())
|
||||
tool = GIMP_TOOL (paint_tool);
|
||||
|
||||
if (devices_get_current (tool->tool_info->gimp) == gdk_device_get_core_pointer ())
|
||||
mask = paint_tool->brush->mask;
|
||||
else
|
||||
mask = gimp_paint_tool_scale_mask (paint_tool->brush->mask, scale);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "pdb-types.h"
|
||||
#include "procedural_db.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "libgimpbase/gimpbasetypes.h"
|
||||
|
||||
|
@ -93,7 +93,7 @@ message_get_handler_invoker (Gimp *gimp,
|
|||
Argument *return_args;
|
||||
|
||||
return_args = procedural_db_return_args (&message_get_handler_proc, TRUE);
|
||||
return_args[1].value.pdb_int = message_handler;
|
||||
return_args[1].value.pdb_int = gimp->message_handler;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ message_set_handler_invoker (Gimp *gimp,
|
|||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
message_handler = handler;
|
||||
gimp->message_handler = handler;
|
||||
|
||||
return procedural_db_return_args (&message_set_handler_proc, success);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -56,6 +57,7 @@
|
|||
#include "gimpconvolvetool.h"
|
||||
#include "gimppainttool.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "devices.h"
|
||||
#include "gimprc.h"
|
||||
#include "undo.h"
|
||||
|
@ -1318,7 +1320,7 @@ gimp_paint_tool_calculate_brush_size (MaskBuf *mask,
|
|||
{
|
||||
scale = CLAMP (scale, 0.0, 1.0);
|
||||
|
||||
if (current_device == gdk_device_get_core_pointer ())
|
||||
if (devices_get_current (the_gimp) == gdk_device_get_core_pointer ())
|
||||
{
|
||||
*width = mask->width;
|
||||
*height = mask->height;
|
||||
|
@ -1636,9 +1638,12 @@ gimp_paint_tool_get_brush_mask (GimpPaintTool *paint_tool,
|
|||
BrushApplicationMode brush_hardness,
|
||||
gdouble scale)
|
||||
{
|
||||
MaskBuf *mask;
|
||||
GimpTool *tool;
|
||||
MaskBuf *mask;
|
||||
|
||||
if (current_device == gdk_device_get_core_pointer ())
|
||||
tool = GIMP_TOOL (paint_tool);
|
||||
|
||||
if (devices_get_current (tool->tool_info->gimp) == gdk_device_get_core_pointer ())
|
||||
mask = paint_tool->brush->mask;
|
||||
else
|
||||
mask = gimp_paint_tool_scale_mask (paint_tool->brush->mask, scale);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
@ -56,6 +57,7 @@
|
|||
#include "gimpconvolvetool.h"
|
||||
#include "gimppainttool.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "devices.h"
|
||||
#include "gimprc.h"
|
||||
#include "undo.h"
|
||||
|
@ -1318,7 +1320,7 @@ gimp_paint_tool_calculate_brush_size (MaskBuf *mask,
|
|||
{
|
||||
scale = CLAMP (scale, 0.0, 1.0);
|
||||
|
||||
if (current_device == gdk_device_get_core_pointer ())
|
||||
if (devices_get_current (the_gimp) == gdk_device_get_core_pointer ())
|
||||
{
|
||||
*width = mask->width;
|
||||
*height = mask->height;
|
||||
|
@ -1636,9 +1638,12 @@ gimp_paint_tool_get_brush_mask (GimpPaintTool *paint_tool,
|
|||
BrushApplicationMode brush_hardness,
|
||||
gdouble scale)
|
||||
{
|
||||
MaskBuf *mask;
|
||||
GimpTool *tool;
|
||||
MaskBuf *mask;
|
||||
|
||||
if (current_device == gdk_device_get_core_pointer ())
|
||||
tool = GIMP_TOOL (paint_tool);
|
||||
|
||||
if (devices_get_current (tool->tool_info->gimp) == gdk_device_get_core_pointer ())
|
||||
mask = paint_tool->brush->mask;
|
||||
else
|
||||
mask = gimp_paint_tool_scale_mask (paint_tool->brush->mask, scale);
|
||||
|
|
|
@ -141,10 +141,9 @@ static void device_status_context_connect (GimpContext *context,
|
|||
GdkDevice *device);
|
||||
|
||||
|
||||
/* global data */
|
||||
GdkDevice *current_device = NULL;
|
||||
|
||||
/* local data */
|
||||
|
||||
static GdkDevice *current_device = NULL;
|
||||
static GList *device_info_list = NULL;
|
||||
static DeviceInfoDialog *deviceD = NULL;
|
||||
|
||||
|
@ -191,10 +190,12 @@ device_info_get_by_name (gchar *name)
|
|||
/* the gtk input dialog */
|
||||
|
||||
GtkWidget *
|
||||
input_dialog_create (void)
|
||||
input_dialog_create (Gimp *gimp)
|
||||
{
|
||||
static GtkWidget *inputd = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (inputd)
|
||||
return inputd;
|
||||
|
||||
|
@ -309,8 +310,17 @@ devices_restore (Gimp *gimp)
|
|||
suppress_update = FALSE;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
devices_get_current (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
return current_device;
|
||||
}
|
||||
|
||||
void
|
||||
devices_rc_update (gchar *name,
|
||||
devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
|
@ -510,11 +520,15 @@ devices_rc_update (gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
select_device (GdkDevice *new_device)
|
||||
select_device (Gimp *gimp,
|
||||
GdkDevice *new_device)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GimpContext *context;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GDK_IS_DEVICE (new_device));
|
||||
|
||||
device_info = device_info_get_by_device (current_device);
|
||||
|
||||
gimp_context_unset_parent (device_info->context);
|
||||
|
@ -537,10 +551,14 @@ select_device (GdkDevice *new_device)
|
|||
}
|
||||
|
||||
gboolean
|
||||
devices_check_change (GdkEvent *event)
|
||||
devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkDevice *device;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
|
@ -570,7 +588,7 @@ devices_check_change (GdkEvent *event)
|
|||
|
||||
if (device != current_device)
|
||||
{
|
||||
select_device (device);
|
||||
select_device (gimp, device);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -743,7 +761,7 @@ devices_write_rc (void)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
device_status_create (void)
|
||||
device_status_create (Gimp *gimp)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GtkWidget *label;
|
||||
|
@ -751,6 +769,8 @@ device_status_create (void)
|
|||
GList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (deviceD)
|
||||
return deviceD->shell;
|
||||
|
||||
|
@ -977,8 +997,10 @@ devices_close_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
device_status_free (void)
|
||||
{
|
||||
device_status_free (Gimp *gimp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
/* Save device status on exit */
|
||||
if (gimprc.save_device_status)
|
||||
devices_write_rc ();
|
||||
|
|
|
@ -141,10 +141,9 @@ static void device_status_context_connect (GimpContext *context,
|
|||
GdkDevice *device);
|
||||
|
||||
|
||||
/* global data */
|
||||
GdkDevice *current_device = NULL;
|
||||
|
||||
/* local data */
|
||||
|
||||
static GdkDevice *current_device = NULL;
|
||||
static GList *device_info_list = NULL;
|
||||
static DeviceInfoDialog *deviceD = NULL;
|
||||
|
||||
|
@ -191,10 +190,12 @@ device_info_get_by_name (gchar *name)
|
|||
/* the gtk input dialog */
|
||||
|
||||
GtkWidget *
|
||||
input_dialog_create (void)
|
||||
input_dialog_create (Gimp *gimp)
|
||||
{
|
||||
static GtkWidget *inputd = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (inputd)
|
||||
return inputd;
|
||||
|
||||
|
@ -309,8 +310,17 @@ devices_restore (Gimp *gimp)
|
|||
suppress_update = FALSE;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
devices_get_current (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
return current_device;
|
||||
}
|
||||
|
||||
void
|
||||
devices_rc_update (gchar *name,
|
||||
devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
|
@ -510,11 +520,15 @@ devices_rc_update (gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
select_device (GdkDevice *new_device)
|
||||
select_device (Gimp *gimp,
|
||||
GdkDevice *new_device)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GimpContext *context;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GDK_IS_DEVICE (new_device));
|
||||
|
||||
device_info = device_info_get_by_device (current_device);
|
||||
|
||||
gimp_context_unset_parent (device_info->context);
|
||||
|
@ -537,10 +551,14 @@ select_device (GdkDevice *new_device)
|
|||
}
|
||||
|
||||
gboolean
|
||||
devices_check_change (GdkEvent *event)
|
||||
devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkDevice *device;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
|
@ -570,7 +588,7 @@ devices_check_change (GdkEvent *event)
|
|||
|
||||
if (device != current_device)
|
||||
{
|
||||
select_device (device);
|
||||
select_device (gimp, device);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -743,7 +761,7 @@ devices_write_rc (void)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
device_status_create (void)
|
||||
device_status_create (Gimp *gimp)
|
||||
{
|
||||
DeviceInfo *device_info;
|
||||
GtkWidget *label;
|
||||
|
@ -751,6 +769,8 @@ device_status_create (void)
|
|||
GList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (deviceD)
|
||||
return deviceD->shell;
|
||||
|
||||
|
@ -977,8 +997,10 @@ devices_close_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
device_status_free (void)
|
||||
{
|
||||
device_status_free (Gimp *gimp)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
/* Save device status on exit */
|
||||
if (gimprc.save_device_status)
|
||||
devices_write_rc ();
|
||||
|
|
|
@ -33,47 +33,48 @@ typedef enum
|
|||
DEVICE_GRADIENT = 1 << 8
|
||||
} DeviceValues;
|
||||
|
||||
|
||||
/* Initialize the input devices */
|
||||
void devices_init (Gimp *gimp);
|
||||
void devices_init (Gimp *gimp);
|
||||
|
||||
/* Restores device settings from rc file */
|
||||
void devices_restore (Gimp *gimp);
|
||||
void devices_restore (Gimp *gimp);
|
||||
|
||||
/* Create device info dialog */
|
||||
GtkWidget * input_dialog_create (void);
|
||||
|
||||
/* Create the device status dialog */
|
||||
GtkWidget * device_status_create (void);
|
||||
GdkDevice * devices_get_current (Gimp *gimp);
|
||||
|
||||
/* Returns TRUE, and makes necessary global changes
|
||||
* if event is not for current_device
|
||||
*/
|
||||
gboolean devices_check_change (GdkEvent *event);
|
||||
gboolean devices_check_change (Gimp *gimp,
|
||||
GdkEvent *event);
|
||||
|
||||
/* Loads stored device settings (tool, cursor, ...) */
|
||||
void select_device (GdkDevice *device);
|
||||
void devices_select_device (Gimp *gimp,
|
||||
GdkDevice *device);
|
||||
|
||||
/* The device info dialog */
|
||||
GtkWidget * input_dialog_create (Gimp *gimp);
|
||||
void input_dialog_free (Gimp *gimp);
|
||||
|
||||
/* The device status dialog */
|
||||
GtkWidget * device_status_create (Gimp *gimp);
|
||||
void device_status_free (Gimp *gimp);
|
||||
|
||||
/* Add information about one tool from rc file */
|
||||
void devices_rc_update (gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
const gchar *tool_name,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
const gchar *brush_name,
|
||||
const gchar *pattern_name,
|
||||
const gchar *gradient_name);
|
||||
|
||||
/* Free device status (only for session-managment) */
|
||||
void device_status_free (void);
|
||||
|
||||
|
||||
/* Current device */
|
||||
extern GdkDevice *current_device;
|
||||
void devices_rc_update (Gimp *gimp,
|
||||
gchar *name,
|
||||
DeviceValues values,
|
||||
GdkInputMode mode,
|
||||
gint num_axes,
|
||||
GdkAxisUse *axes,
|
||||
gint num_keys,
|
||||
GdkDeviceKey *keys,
|
||||
const gchar *tool_name,
|
||||
GimpRGB *foreground,
|
||||
GimpRGB *background,
|
||||
const gchar *brush_name,
|
||||
const gchar *pattern_name,
|
||||
const gchar *gradient_name);
|
||||
|
||||
|
||||
#endif /* __DEVICES_H__ */
|
||||
|
|
|
@ -150,7 +150,7 @@ toolbox_check_device (GtkWidget *widget,
|
|||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
devices_check_change (event);
|
||||
devices_check_change (GIMP (data), event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ toolbox_create (Gimp *gimp)
|
|||
{
|
||||
g_signal_connect (G_OBJECT (window), "motion_notify_event",
|
||||
G_CALLBACK (toolbox_check_device),
|
||||
NULL);
|
||||
gimp);
|
||||
|
||||
gtk_widget_set_events (window, GDK_POINTER_MOTION_MASK);
|
||||
gtk_widget_set_extension_events (window, GDK_EXTENSION_EVENTS_CURSOR);
|
||||
|
|
|
@ -61,7 +61,7 @@ struct _MessageBox
|
|||
static GList *message_boxes = NULL;
|
||||
|
||||
void
|
||||
gimp_message_box (gchar *message,
|
||||
gimp_message_box (const gchar *message,
|
||||
GtkCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
typedef gpointer (* GimpGetAccelContextFunc) (gpointer data);
|
||||
|
||||
|
||||
void gimp_message_box (gchar *message,
|
||||
void gimp_message_box (const gchar *message,
|
||||
GtkCallback callback,
|
||||
gpointer data);
|
||||
|
||||
|
|
|
@ -151,8 +151,8 @@ WILBER_VARIABLES = @STRIP_BEGIN@ \
|
|||
noinst_DATA = gimp-stock-pixbufs.h gimp-wilber-pixbufs.h
|
||||
CLEANFILES = $(noinst_DATA)
|
||||
|
||||
gimp-stock-pixbufs.h: $(STOCK_IMAGES) $(STOCK_TOOL_IMAGES)
|
||||
gimp-stock-pixbufs.h: $(STOCK_IMAGES) $(STOCK_TOOL_IMAGES) Makefile.am
|
||||
gdk-pixbuf-csource --raw --build-list $(STOCK_VARIABLES) $(STOCK_TOOL_VARIABLES) >$(srcdir)/gimp-stock-pixbufs.h
|
||||
|
||||
gimp-wilber-pixbufs.h: $(WILBER_IMAGES)
|
||||
gimp-wilber-pixbufs.h: $(WILBER_IMAGES) Makefile.am
|
||||
gdk-pixbuf-csource --raw --build-list $(WILBER_VARIABLES) >$(srcdir)/gimp-wilber-pixbufs.h
|
||||
|
|
|
@ -54,7 +54,7 @@ HELP
|
|||
@outargs = (
|
||||
{ name => 'handler', type => 'enum GimpMessageHandlerType',
|
||||
desc => 'The current handler type: { %%desc%% }',
|
||||
alias => 'message_handler', no_declare => 1 }
|
||||
alias => 'gimp->message_handler', no_declare => 1 }
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,10 @@ HELP
|
|||
desc => 'The new handler type: { %%desc%% }' }
|
||||
);
|
||||
|
||||
%invoke = ( code => 'message_handler = handler;' );
|
||||
%invoke = ( code => 'gimp->message_handler = handler;' );
|
||||
}
|
||||
|
||||
@headers = qw("appenv.h");
|
||||
@headers = qw("core/gimp.h");
|
||||
|
||||
@procs = qw(message message_get_handler message_set_handler);
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
|
Loading…
Reference in a new issue