1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an 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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
1999-03-07 20:56:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-07-01 17:13:39 +08:00
|
|
|
#include <string.h>
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "app_procs.h"
|
|
|
|
#include "color_area.h"
|
|
|
|
#include "commands.h"
|
1998-06-06 11:49:01 +08:00
|
|
|
#include "devices.h"
|
1999-03-07 20:56:03 +08:00
|
|
|
#include "dialog_handler.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "disp_callbacks.h"
|
1999-07-01 17:13:39 +08:00
|
|
|
#include "fileops.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gdisplay.h"
|
|
|
|
#include "gdisplay_ops.h"
|
|
|
|
#include "gimage.h"
|
1999-08-20 03:53:30 +08:00
|
|
|
#include "gimpdnd.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimphelp.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gimprc.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimpui.h"
|
1999-09-02 09:41:18 +08:00
|
|
|
#include "gtkhwrapbox.h"
|
1999-09-03 08:15:11 +08:00
|
|
|
#include "gtkvwrapbox.h"
|
1999-06-02 13:55:02 +08:00
|
|
|
#include "indicator_area.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "interface.h"
|
|
|
|
#include "menus.h"
|
1999-09-02 06:39:44 +08:00
|
|
|
#include "nav_window.h"
|
1999-07-07 11:18:54 +08:00
|
|
|
#include "qmask.h"
|
1998-06-23 01:30:40 +08:00
|
|
|
#include "session.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "tools.h"
|
|
|
|
|
|
|
|
#include "pixmaps.h"
|
1999-07-07 11:18:54 +08:00
|
|
|
#include "pixmaps/qmasksel.xpm"
|
|
|
|
#include "pixmaps/qmasknosel.xpm"
|
1999-09-02 06:39:44 +08:00
|
|
|
#include "pixmaps/navbutton.xpm"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-11-23 22:47:09 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
2000-02-09 07:45:20 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* local functions */
|
1999-10-27 02:27:27 +08:00
|
|
|
static void tools_select_update (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static gint tools_button_press (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
GdkEventButton *bevent,
|
1999-10-27 02:27:27 +08:00
|
|
|
gpointer data);
|
|
|
|
static void gdisplay_destroy (GtkWidget *widget,
|
|
|
|
GDisplay *display);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
static gint gdisplay_delete (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
GDisplay *display);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void toolbox_destroy (void);
|
1999-10-27 02:27:27 +08:00
|
|
|
static gint toolbox_delete (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data);
|
|
|
|
static gint toolbox_check_device (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
static GdkPixmap *create_pixmap (GdkWindow *parent,
|
|
|
|
GdkBitmap **mask,
|
|
|
|
gchar **data,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
1999-08-20 03:53:30 +08:00
|
|
|
|
2000-06-04 23:09:16 +08:00
|
|
|
static void toolbox_style_set_callback (GtkWidget *window,
|
|
|
|
GtkStyle *previous_style,
|
|
|
|
gpointer data);
|
2000-04-02 23:34:30 +08:00
|
|
|
static void toolbox_set_drag_dest (GtkWidget *widget);
|
|
|
|
static gboolean toolbox_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time);
|
|
|
|
static ToolType toolbox_drag_tool (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void toolbox_drop_tool (GtkWidget *widget,
|
|
|
|
ToolType tool,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
static gint pixmap_colors[8][3] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-04-02 23:34:30 +08:00
|
|
|
{ 0x00, 0x00, 0x00 }, /* a - 0 */
|
|
|
|
{ 0x24, 0x24, 0x24 }, /* b - 36 */
|
|
|
|
{ 0x49, 0x49, 0x49 }, /* c - 73 */
|
1997-11-25 06:05:25 +08:00
|
|
|
{ 0x6D, 0x6D, 0x6D }, /* d - 109 */
|
|
|
|
{ 0x92, 0x92, 0x92 }, /* e - 146 */
|
|
|
|
{ 0xB6, 0xB6, 0xB6 }, /* f - 182 */
|
|
|
|
{ 0xDB, 0xDB, 0xDB }, /* g - 219 */
|
|
|
|
{ 0xFF, 0xFF, 0xFF }, /* h - 255 */
|
|
|
|
};
|
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
#define COLUMNS 3
|
|
|
|
#define ROWS 8
|
|
|
|
#define MARGIN 2
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
/* local variables */
|
1999-11-03 17:58:46 +08:00
|
|
|
static GdkColor colors[11];
|
1999-06-21 07:29:34 +08:00
|
|
|
static GtkWidget * toolbox_shell = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
static GtkTargetEntry toolbox_target_table[] =
|
1999-07-01 17:13:39 +08:00
|
|
|
{
|
1999-08-20 03:53:30 +08:00
|
|
|
GIMP_TARGET_URI_LIST,
|
|
|
|
GIMP_TARGET_TEXT_PLAIN,
|
|
|
|
GIMP_TARGET_NETSCAPE_URL,
|
|
|
|
GIMP_TARGET_LAYER,
|
|
|
|
GIMP_TARGET_CHANNEL,
|
1999-10-28 23:05:49 +08:00
|
|
|
GIMP_TARGET_LAYER_MASK,
|
|
|
|
GIMP_TARGET_TOOL
|
1999-07-01 17:13:39 +08:00
|
|
|
};
|
1999-08-20 03:53:30 +08:00
|
|
|
static guint toolbox_n_targets = (sizeof (toolbox_target_table) /
|
|
|
|
sizeof (toolbox_target_table[0]));
|
1999-07-01 17:13:39 +08:00
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
static GtkTargetEntry tool_target_table[] =
|
|
|
|
{
|
|
|
|
GIMP_TARGET_TOOL
|
|
|
|
};
|
|
|
|
static guint tool_n_targets = (sizeof (tool_target_table) /
|
|
|
|
sizeof (tool_target_table[0]));
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
static GtkTargetEntry display_target_table[] =
|
|
|
|
{
|
|
|
|
GIMP_TARGET_LAYER,
|
|
|
|
GIMP_TARGET_CHANNEL,
|
1999-08-23 22:19:26 +08:00
|
|
|
GIMP_TARGET_LAYER_MASK,
|
1999-10-10 04:33:53 +08:00
|
|
|
GIMP_TARGET_COLOR,
|
|
|
|
GIMP_TARGET_PATTERN
|
1999-08-20 03:53:30 +08:00
|
|
|
};
|
|
|
|
static guint display_n_targets = (sizeof (display_target_table) /
|
|
|
|
sizeof (display_target_table[0]));
|
1999-07-01 17:13:39 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
tools_select_update (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ToolType tool_type;
|
|
|
|
|
|
|
|
tool_type = (ToolType) data;
|
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
if ((tool_type != -1) && GTK_TOGGLE_BUTTON (widget)->active)
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_context_set_tool (gimp_context_get_user (), tool_type);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
tools_button_press (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
1999-08-08 04:55:26 +08:00
|
|
|
GDisplay * gdisp;
|
|
|
|
gdisp = data;
|
|
|
|
|
1999-10-30 18:39:48 +08:00
|
|
|
if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1))
|
|
|
|
tool_options_dialog_show ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
toolbox_delete (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
1999-06-21 07:29:34 +08:00
|
|
|
gpointer data)
|
1998-02-04 06:54:35 +08:00
|
|
|
{
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
app_exit (FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-03-15 11:15:35 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-09-03 08:15:11 +08:00
|
|
|
toolbox_destroy (void)
|
1998-02-04 06:54:35 +08:00
|
|
|
{
|
|
|
|
app_exit_finish ();
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1998-06-06 11:49:01 +08:00
|
|
|
static gint
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
toolbox_check_device (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
1999-06-21 07:29:34 +08:00
|
|
|
gpointer data)
|
1998-06-06 11:49:01 +08:00
|
|
|
{
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
devices_check_change (event);
|
1998-06-07 12:22:57 +08:00
|
|
|
|
1998-06-06 11:49:01 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gdisplay_destroy (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
GDisplay *gdisp)
|
|
|
|
{
|
|
|
|
gdisplay_remove_and_delete (gdisp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gdisplay_delete (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
1999-06-21 07:29:34 +08:00
|
|
|
GDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
gdisplay_close_window (gdisp, FALSE);
|
|
|
|
|
1998-03-15 11:15:35 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
allocate_colors (GtkWidget *parent)
|
|
|
|
{
|
|
|
|
GdkColormap *colormap;
|
1999-10-27 02:27:27 +08:00
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_realize (parent);
|
|
|
|
colormap = gdk_window_get_colormap (parent->window);
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
{
|
|
|
|
colors[i].red = pixmap_colors[i][0] << 8;
|
|
|
|
colors[i].green = pixmap_colors[i][1] << 8;
|
|
|
|
colors[i].blue = pixmap_colors[i][2] << 8;
|
|
|
|
|
|
|
|
gdk_color_alloc (colormap, &colors[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
colors[8] = parent->style->bg[GTK_STATE_NORMAL];
|
|
|
|
gdk_color_alloc (colormap, &colors[8]);
|
|
|
|
|
|
|
|
colors[9] = parent->style->bg[GTK_STATE_ACTIVE];
|
|
|
|
gdk_color_alloc (colormap, &colors[9]);
|
|
|
|
|
|
|
|
colors[10] = parent->style->bg[GTK_STATE_PRELIGHT];
|
|
|
|
gdk_color_alloc (colormap, &colors[10]);
|
|
|
|
}
|
|
|
|
|
1999-06-02 13:55:02 +08:00
|
|
|
static void
|
|
|
|
create_indicator_area (GtkWidget *parent)
|
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *ind_area;
|
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
if (! GTK_WIDGET_REALIZED (parent))
|
|
|
|
gtk_widget_realize (parent);
|
1999-06-02 13:55:02 +08:00
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
2000-02-07 18:51:08 +08:00
|
|
|
gtk_wrap_box_pack (GTK_WRAP_BOX (parent), frame, TRUE, TRUE, TRUE, TRUE);
|
1999-06-02 13:55:02 +08:00
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (alignment, NULL, "#indicator_area");
|
|
|
|
|
1999-09-01 19:29:39 +08:00
|
|
|
ind_area = indicator_area_create ();
|
1999-06-02 13:55:02 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), ind_area);
|
2000-04-02 23:34:30 +08:00
|
|
|
|
1999-06-02 13:55:02 +08:00
|
|
|
gtk_widget_show (ind_area);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
create_color_area (GtkWidget *parent)
|
|
|
|
{
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *col_area;
|
|
|
|
GdkPixmap *default_pixmap;
|
2000-02-22 23:14:54 +08:00
|
|
|
GdkBitmap *default_mask;
|
1997-11-25 06:05:25 +08:00
|
|
|
GdkPixmap *swap_pixmap;
|
2000-02-22 23:14:54 +08:00
|
|
|
GdkBitmap *swap_mask;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
if (! GTK_WIDGET_REALIZED (parent))
|
|
|
|
gtk_widget_realize (parent);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-22 23:14:54 +08:00
|
|
|
default_pixmap = create_pixmap (parent->window, &default_mask, default_bits,
|
1997-11-25 06:05:25 +08:00
|
|
|
default_width, default_height);
|
2000-02-22 23:14:54 +08:00
|
|
|
swap_pixmap = create_pixmap (parent->window, &swap_mask, swap_bits,
|
1997-11-25 06:05:25 +08:00
|
|
|
swap_width, swap_height);
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
2000-02-07 18:51:08 +08:00
|
|
|
gtk_wrap_box_pack (GTK_WRAP_BOX (parent), frame, TRUE, TRUE, TRUE, TRUE);
|
|
|
|
gtk_wrap_box_set_child_forced_break (GTK_WRAP_BOX (parent), frame, TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
1999-03-12 11:44:59 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 3);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (alignment, NULL, "#color_area");
|
|
|
|
|
2000-02-22 23:14:54 +08:00
|
|
|
col_area = color_area_create (54, 42,
|
|
|
|
default_pixmap, default_mask,
|
|
|
|
swap_pixmap, swap_mask);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), col_area);
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data
|
|
|
|
(col_area,
|
|
|
|
_("Foreground & background colors. The black "
|
|
|
|
"and white squares reset colors. The arrows swap colors. Double "
|
|
|
|
"click to select a color from a colorrequester."), NULL);
|
2000-04-02 23:34:30 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (col_area);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
}
|
|
|
|
|
2000-02-09 07:45:20 +08:00
|
|
|
/* creates all icons */
|
|
|
|
static void
|
|
|
|
create_tool_pixmaps (GtkWidget *parent)
|
1998-06-06 11:49:01 +08:00
|
|
|
{
|
2000-02-09 07:45:20 +08:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_if_fail (parent != NULL);
|
1998-06-06 11:49:01 +08:00
|
|
|
|
2000-02-09 07:45:20 +08:00
|
|
|
for (i = 0; i < num_tools; i++)
|
|
|
|
{
|
2000-02-10 09:49:45 +08:00
|
|
|
if (tool_info[i].icon_data)
|
2000-02-20 10:46:53 +08:00
|
|
|
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
|
|
|
&tool_info[i].icon_mask,
|
2000-02-10 09:49:45 +08:00
|
|
|
tool_info[i].icon_data,
|
2000-02-09 07:45:20 +08:00
|
|
|
22, 22);
|
|
|
|
else
|
2000-02-20 10:46:53 +08:00
|
|
|
tool_info[i].icon_pixmap = create_pixmap (parent->window,
|
|
|
|
&tool_info[i].icon_mask,
|
2000-02-09 07:45:20 +08:00
|
|
|
dialog_bits,
|
|
|
|
22, 22);
|
|
|
|
}
|
1998-06-06 11:49:01 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
create_tools (GtkWidget *parent)
|
|
|
|
{
|
1999-09-02 09:41:18 +08:00
|
|
|
GtkWidget *wbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *alignment;
|
|
|
|
GtkWidget *pixmap;
|
|
|
|
GSList *group;
|
2000-04-02 23:34:30 +08:00
|
|
|
gint i, j;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-07 18:51:08 +08:00
|
|
|
wbox = parent;
|
1999-09-02 09:41:18 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
if (! GTK_WIDGET_REALIZED (gtk_widget_get_toplevel (wbox)))
|
|
|
|
gtk_widget_realize (gtk_widget_get_toplevel (wbox));
|
|
|
|
|
2000-02-09 07:45:20 +08:00
|
|
|
create_tool_pixmaps (wbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
group = NULL;
|
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
i = 0;
|
|
|
|
for (j = 0; j < num_tools; j++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-02-10 09:49:45 +08:00
|
|
|
if (j <= LAST_TOOLBOX_TOOL &&
|
|
|
|
j != SCALE && j!= SHEAR && j != PERSPECTIVE)
|
1998-06-22 04:17:21 +08:00
|
|
|
{
|
|
|
|
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
1999-03-12 11:44:59 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
|
1998-06-22 04:17:21 +08:00
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1999-09-02 09:41:18 +08:00
|
|
|
gtk_wrap_box_pack (GTK_WRAP_BOX (wbox), button,
|
2000-02-07 18:51:08 +08:00
|
|
|
FALSE, FALSE, FALSE, FALSE);
|
1998-06-22 04:17:21 +08:00
|
|
|
|
|
|
|
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
1999-03-12 11:44:59 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (alignment), 0);
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (button), alignment);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
2000-02-20 10:46:53 +08:00
|
|
|
pixmap = gtk_pixmap_new (tool_get_pixmap ((ToolType)j),
|
|
|
|
tool_get_mask ((ToolType)j));
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (alignment), pixmap);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (tools_select_update),
|
1998-06-22 04:17:21 +08:00
|
|
|
(gpointer) tool_info[j].tool_id);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (tools_button_press),
|
1998-06-22 04:17:21 +08:00
|
|
|
(gpointer) tool_info[j].tool_id);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
/* dnd stuff */
|
|
|
|
gtk_drag_source_set (tool_info[j].tool_widget,
|
|
|
|
GDK_BUTTON2_MASK,
|
|
|
|
tool_target_table, tool_n_targets,
|
|
|
|
GDK_ACTION_COPY);
|
|
|
|
gimp_dnd_tool_source_set (tool_info[j].tool_widget,
|
|
|
|
toolbox_drag_tool, (gpointer) j);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (button,
|
|
|
|
gettext(tool_info[j].tool_desc),
|
|
|
|
tool_info[j].private_tip);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
gtk_widget_show (alignment);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
i++;
|
|
|
|
}
|
1998-07-20 23:07:13 +08:00
|
|
|
else
|
1998-06-22 04:17:21 +08:00
|
|
|
{
|
|
|
|
tool_info[j].tool_widget = button = gtk_radio_button_new (group);
|
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (tools_select_update),
|
1998-06-22 04:17:21 +08:00
|
|
|
(gpointer) tool_info[j].tool_id);
|
|
|
|
}
|
1998-07-20 23:07:13 +08:00
|
|
|
}
|
2000-04-02 23:34:30 +08:00
|
|
|
|
1999-09-02 09:41:18 +08:00
|
|
|
gtk_widget_show (wbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixmap *
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
create_pixmap (GdkWindow *parent,
|
|
|
|
GdkBitmap **mask,
|
|
|
|
gchar **data,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-04-02 23:34:30 +08:00
|
|
|
GdkPixmap *pixmap;
|
|
|
|
GdkImage *image;
|
|
|
|
GdkGC *gc;
|
|
|
|
GdkVisual *visual;
|
1997-11-25 06:05:25 +08:00
|
|
|
GdkColormap *cmap;
|
2000-04-02 23:34:30 +08:00
|
|
|
gint r, s, t, cnt;
|
|
|
|
guchar *mem;
|
|
|
|
guchar value;
|
|
|
|
guint32 pixel;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
visual = gdk_window_get_visual (parent);
|
|
|
|
cmap = gdk_window_get_colormap (parent);
|
1998-06-07 05:25:10 +08:00
|
|
|
image = gdk_image_new (GDK_IMAGE_NORMAL, visual, width, height);
|
1997-11-25 06:05:25 +08:00
|
|
|
pixmap = gdk_pixmap_new (parent, width, height, -1);
|
|
|
|
gc = NULL;
|
|
|
|
|
|
|
|
if (mask)
|
|
|
|
{
|
|
|
|
GdkColor tmp_color;
|
|
|
|
|
|
|
|
*mask = gdk_pixmap_new (parent, width, height, 1);
|
|
|
|
gc = gdk_gc_new (*mask);
|
|
|
|
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
|
|
|
|
|
|
|
tmp_color.pixel = 1;
|
|
|
|
gdk_gc_set_foreground (gc, &tmp_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (r = 0; r < height; r++)
|
|
|
|
{
|
|
|
|
mem = image->mem;
|
|
|
|
mem += image->bpl * r;
|
|
|
|
|
|
|
|
for (s = 0, cnt = 0; s < width; s++)
|
|
|
|
{
|
|
|
|
value = data[r][s];
|
|
|
|
|
|
|
|
if (value == '.')
|
|
|
|
{
|
|
|
|
pixel = colors[8].pixel;
|
|
|
|
|
|
|
|
if (mask)
|
|
|
|
{
|
|
|
|
if (cnt < s)
|
|
|
|
gdk_draw_line (*mask, gc, cnt, r, s - 1, r);
|
|
|
|
cnt = s + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pixel = colors[value - 'a'].pixel;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (image->byte_order == GDK_LSB_FIRST)
|
|
|
|
{
|
|
|
|
for (t = 0; t < image->bpp; t++)
|
2000-04-02 23:34:30 +08:00
|
|
|
*mem++ = (guchar) ((pixel >> (t * 8)) & 0xFF);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (t = 0; t < image->bpp; t++)
|
2000-04-02 23:34:30 +08:00
|
|
|
*mem++ = (guchar) ((pixel >> ((image->bpp - t - 1) * 8)) & 0xFF);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mask && (cnt < s))
|
|
|
|
gdk_draw_line (*mask, gc, cnt, r, s - 1, r);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mask)
|
|
|
|
gdk_gc_destroy (gc);
|
|
|
|
|
|
|
|
gc = gdk_gc_new (parent);
|
|
|
|
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, width, height);
|
|
|
|
gdk_gc_destroy (gc);
|
|
|
|
gdk_image_destroy (image);
|
|
|
|
|
|
|
|
return pixmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-09-03 08:15:11 +08:00
|
|
|
create_toolbox (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *main_vbox;
|
1999-09-03 08:15:11 +08:00
|
|
|
GtkWidget *wbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *menubar;
|
2000-04-02 23:34:30 +08:00
|
|
|
GList *list;
|
1998-06-07 21:55:36 +08:00
|
|
|
GtkAccelGroup *table;
|
2000-04-16 20:10:24 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
1999-01-11 07:20:33 +08:00
|
|
|
|
|
|
|
/* Register dialog */
|
1999-09-28 01:58:10 +08:00
|
|
|
dialog_register_toolbox (window);
|
1999-01-11 07:20:33 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
|
|
|
GTK_SIGNAL_FUNC (toolbox_delete),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (toolbox_destroy),
|
1997-11-25 06:05:25 +08:00
|
|
|
NULL);
|
|
|
|
|
1998-06-06 11:49:01 +08:00
|
|
|
/* We need to know when the current device changes, so we can update
|
|
|
|
* the correct tool - to do this we connect to motion events.
|
|
|
|
* We can't just use EXTENSION_EVENTS_CURSOR though, since that
|
|
|
|
* would get us extension events for the mouse pointer, and our
|
|
|
|
* device would change to that and not change back. So we check
|
|
|
|
* manually that all devices have a cursor, before establishing the check.
|
|
|
|
*/
|
1999-10-27 02:27:27 +08:00
|
|
|
for (list = gdk_input_list_devices (); list; list = g_list_next (list))
|
1998-06-06 11:49:01 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
if (!((GdkDeviceInfo *) (list->data))->has_cursor)
|
1998-06-06 11:49:01 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
if (!list) /* all devices have cursor */
|
1998-06-06 11:49:01 +08:00
|
|
|
{
|
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "motion_notify_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (toolbox_check_device),
|
|
|
|
NULL);
|
1998-06-07 12:22:57 +08:00
|
|
|
|
1998-06-06 11:49:01 +08:00
|
|
|
gtk_widget_set_events (window, GDK_POINTER_MOTION_MASK);
|
|
|
|
gtk_widget_set_extension_events (window, GDK_EXTENSION_EVENTS_CURSOR);
|
|
|
|
}
|
2000-04-16 20:10:24 +08:00
|
|
|
|
|
|
|
/* set up the window geometry after the events have been set,
|
|
|
|
since we need to realize the widget */
|
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
|
|
|
|
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
|
|
|
|
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
|
|
|
|
2000-06-04 23:09:16 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (window), "style_set",
|
|
|
|
GTK_SIGNAL_FUNC (toolbox_style_set_callback),
|
|
|
|
NULL);
|
2000-04-16 20:10:24 +08:00
|
|
|
|
|
|
|
session_set_window_geometry (window, &toolbox_session_info, TRUE);
|
1998-06-06 11:49:01 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
main_vbox = gtk_vbox_new (FALSE, 1);
|
1999-03-12 11:44:59 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (window), main_vbox);
|
|
|
|
gtk_widget_show (main_vbox);
|
|
|
|
|
|
|
|
/* allocate the colors for creating pixmaps */
|
|
|
|
allocate_colors (main_vbox);
|
|
|
|
|
|
|
|
/* tooltips */
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_init ();
|
1997-12-11 08:57:08 +08:00
|
|
|
if (!show_tool_tips)
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_disable_tooltips ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Build the menu bar with menus */
|
|
|
|
menus_get_toolbox_menubar (&menubar, &table);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show (menubar);
|
|
|
|
|
|
|
|
/* Install the accelerator table in the main window */
|
1998-06-07 21:55:36 +08:00
|
|
|
gtk_window_add_accel_group (GTK_WINDOW (window), table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
/* Connect the "F1" help key */
|
|
|
|
gimp_help_connect_help_accel (window,
|
|
|
|
gimp_standard_help_func,
|
1999-10-04 16:40:33 +08:00
|
|
|
"toolbox/toolbox.html");
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2000-02-07 18:51:08 +08:00
|
|
|
wbox = gtk_hwrap_box_new (FALSE);
|
|
|
|
gtk_wrap_box_set_justify (GTK_WRAP_BOX (wbox), GTK_JUSTIFY_TOP);
|
|
|
|
gtk_wrap_box_set_line_justify (GTK_WRAP_BOX (wbox), GTK_JUSTIFY_LEFT);
|
2000-04-16 20:10:24 +08:00
|
|
|
/* magic number to set a default 5x5 layout */
|
|
|
|
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (wbox), 5.0 / 5.9);
|
1999-09-03 08:15:11 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (wbox), 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), wbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (wbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-03 08:15:11 +08:00
|
|
|
create_tools (wbox);
|
2000-02-07 18:51:08 +08:00
|
|
|
|
1999-09-03 08:15:11 +08:00
|
|
|
create_color_area (wbox);
|
1999-11-08 03:03:43 +08:00
|
|
|
if (show_indicators)
|
1999-11-03 17:58:46 +08:00
|
|
|
create_indicator_area (wbox);
|
2000-02-07 18:51:08 +08:00
|
|
|
|
1998-06-11 12:36:22 +08:00
|
|
|
gtk_widget_show (window);
|
1999-08-20 03:53:30 +08:00
|
|
|
toolbox_set_drag_dest (window);
|
1999-07-07 11:18:54 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
toolbox_shell = window;
|
|
|
|
}
|
|
|
|
|
1998-02-04 06:54:35 +08:00
|
|
|
void
|
1999-09-03 08:15:11 +08:00
|
|
|
toolbox_free (void)
|
1998-02-04 06:54:35 +08:00
|
|
|
{
|
1999-10-27 02:27:27 +08:00
|
|
|
gint i;
|
1998-02-04 06:54:35 +08:00
|
|
|
|
1998-07-12 06:23:23 +08:00
|
|
|
session_get_window_info (toolbox_shell, &toolbox_session_info);
|
1998-06-23 01:30:40 +08:00
|
|
|
|
1998-02-04 06:54:35 +08:00
|
|
|
gtk_widget_destroy (toolbox_shell);
|
1998-06-22 04:17:21 +08:00
|
|
|
for (i = 0; i < num_tools; i++)
|
1998-02-04 06:54:35 +08:00
|
|
|
{
|
2000-02-09 07:45:20 +08:00
|
|
|
if (tool_info[i].icon_pixmap)
|
|
|
|
gdk_pixmap_unref (tool_info[i].icon_pixmap);
|
|
|
|
|
1998-06-22 04:17:21 +08:00
|
|
|
if (!tool_info[i].icon_data)
|
1999-10-27 02:27:27 +08:00
|
|
|
gtk_object_sink (GTK_OBJECT (tool_info[i].tool_widget));
|
1998-06-07 12:22:57 +08:00
|
|
|
}
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_free ();
|
1998-02-04 06:54:35 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
|
|
|
toolbox_raise_callback (GtkWidget *widget,
|
2000-04-02 23:34:30 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-09-28 01:58:10 +08:00
|
|
|
gdk_window_raise (toolbox_shell->window);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-06-04 23:09:16 +08:00
|
|
|
static void
|
|
|
|
toolbox_style_set_callback (GtkWidget *window,
|
|
|
|
GtkStyle *previous_style,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GdkGeometry geometry;
|
|
|
|
GtkStyle *style;
|
|
|
|
gint xthickness;
|
|
|
|
gint ythickness;
|
|
|
|
|
|
|
|
style = gtk_widget_get_style (window);
|
|
|
|
xthickness = ((GtkStyleClass *) style->klass)->xthickness;
|
|
|
|
ythickness = ((GtkStyleClass *) style->klass)->ythickness;
|
|
|
|
|
|
|
|
geometry.min_width = 2 + 24 + 2 * xthickness;
|
|
|
|
geometry.min_height = 80 + 24 + 2 * ythickness;
|
|
|
|
geometry.width_inc = 24 + 2 * xthickness;
|
|
|
|
geometry.height_inc = 24 + 2 * ythickness;
|
|
|
|
|
|
|
|
gtk_window_set_geometry_hints (GTK_WINDOW (window),
|
|
|
|
NULL,
|
|
|
|
&geometry,
|
|
|
|
GDK_HINT_MIN_SIZE | GDK_HINT_RESIZE_INC);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
void
|
2000-04-02 23:34:30 +08:00
|
|
|
create_display_shell (GDisplay *gdisp,
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gchar *title,
|
|
|
|
gint type)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-04-02 23:34:30 +08:00
|
|
|
static GtkWidget *image_popup_menu = NULL;
|
1998-06-07 21:55:36 +08:00
|
|
|
static GtkAccelGroup *image_accel_group = NULL;
|
2000-02-09 07:45:20 +08:00
|
|
|
|
|
|
|
static GdkPixmap *qmasksel_pixmap = NULL;
|
|
|
|
static GdkBitmap *qmasksel_mask = NULL;
|
|
|
|
static GdkPixmap *qmasknosel_pixmap = NULL;
|
|
|
|
static GdkBitmap *qmasknosel_mask = NULL;
|
|
|
|
static GdkPixmap *navbutton_pixmap = NULL;
|
|
|
|
static GdkBitmap *navbutton_mask = NULL;
|
2000-04-02 23:34:30 +08:00
|
|
|
|
|
|
|
GtkWidget *main_vbox;
|
|
|
|
GtkWidget *disp_vbox;
|
|
|
|
GtkWidget *upper_hbox;
|
|
|
|
GtkWidget *lower_hbox;
|
|
|
|
GtkWidget *inner_table;
|
|
|
|
GtkWidget *status_hbox;
|
1998-06-09 17:20:46 +08:00
|
|
|
GtkWidget *arrow;
|
1999-07-07 11:18:54 +08:00
|
|
|
GtkWidget *pixmap;
|
2000-04-02 23:34:30 +08:00
|
|
|
GtkWidget *label_frame;
|
|
|
|
GtkWidget *nav_ebox;
|
1999-07-07 11:18:54 +08:00
|
|
|
|
|
|
|
GSList *group = NULL;
|
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gint n_width, n_height;
|
|
|
|
gint s_width, s_height;
|
|
|
|
gint scalesrc, scaledest;
|
|
|
|
gint contextid;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* adjust the initial scale -- so that window fits on screen */
|
2000-11-12 08:43:15 +08:00
|
|
|
/* the 75% value is the same as in gdisplay_shrink_wrap. It */
|
|
|
|
/* probably should be a user-configurable option. */
|
|
|
|
s_width = gdk_screen_width () * 0.75;
|
|
|
|
s_height = gdk_screen_height () * 0.75;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
scalesrc = SCALESRC (gdisp);
|
|
|
|
scaledest = SCALEDEST (gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
n_width = SCALEX (gdisp, width);
|
|
|
|
n_height = SCALEX (gdisp, height);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* Limit to the size of the screen... */
|
|
|
|
while (n_width > s_width || n_height > s_height)
|
|
|
|
{
|
|
|
|
if (scaledest > 1)
|
|
|
|
scaledest--;
|
|
|
|
else
|
|
|
|
if (scalesrc < 0xff)
|
|
|
|
scalesrc++;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
n_width = width *
|
|
|
|
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
|
|
|
|
n_height = height *
|
|
|
|
(scaledest * SCREEN_XRES (gdisp)) / (scalesrc * gdisp->gimage->xresolution);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
gdisp->scale = (scaledest << 8) + scalesrc;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the toplevel shell */
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisp->shell = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
1998-02-14 23:30:31 +08:00
|
|
|
gtk_widget_ref (gdisp->shell);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (gdisp->shell), title);
|
1998-01-26 06:13:00 +08:00
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (gdisp->shell), "image_window", "Gimp");
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_window_set_policy (GTK_WINDOW (gdisp->shell), TRUE, TRUE, TRUE);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (gdisp->shell), (gpointer) gdisp);
|
1999-11-03 17:58:46 +08:00
|
|
|
gtk_widget_set_events (gdisp->shell,
|
|
|
|
GDK_POINTER_MOTION_MASK |
|
|
|
|
GDK_POINTER_MOTION_HINT_MASK |
|
|
|
|
GDK_BUTTON_PRESS_MASK |
|
|
|
|
GDK_KEY_PRESS_MASK |
|
|
|
|
GDK_KEY_RELEASE_MASK);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "delete_event",
|
|
|
|
GTK_SIGNAL_FUNC (gdisplay_delete),
|
|
|
|
gdisp);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "destroy",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (gdisplay_destroy),
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisp);
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
/* active display callback */
|
1999-06-04 02:28:39 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (gdisplay_shell_events),
|
1999-06-04 02:28:39 +08:00
|
|
|
gdisp);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "key_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (gdisplay_shell_events),
|
1999-06-04 02:28:39 +08:00
|
|
|
gdisp);
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
/* dnd stuff */
|
|
|
|
gtk_drag_dest_set (gdisp->shell,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
|
|
|
display_target_table, display_n_targets,
|
|
|
|
GDK_ACTION_COPY);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->shell), "drag_drop",
|
|
|
|
GTK_SIGNAL_FUNC (gdisplay_drag_drop),
|
|
|
|
gdisp);
|
1999-10-28 23:05:49 +08:00
|
|
|
gimp_dnd_color_dest_set (gdisp->shell, gdisplay_drop_color, gdisp);
|
|
|
|
gimp_dnd_pattern_dest_set (gdisp->shell, gdisplay_drop_pattern, gdisp);
|
1999-08-20 03:53:30 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
if (! image_popup_menu)
|
|
|
|
menus_get_image_menu (&image_popup_menu, &image_accel_group);
|
1998-06-15 12:46:32 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the popup menu */
|
|
|
|
gdisp->popup = image_popup_menu;
|
1998-06-15 12:46:32 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* The accelerator table for images */
|
|
|
|
gtk_window_add_accel_group (GTK_WINDOW (gdisp->shell), image_accel_group);
|
|
|
|
|
|
|
|
/* connect the "F1" help key */
|
|
|
|
gimp_help_connect_help_accel (gdisp->shell,
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"image/image_window.html");
|
|
|
|
|
|
|
|
/* GtkTable widgets are not able to shrink a row/column correctly if
|
|
|
|
* widgets are attached with GTK_EXPAND even if those widgets have
|
|
|
|
* other rows/columns in their rowspan/colspan where they could
|
|
|
|
* nicely expand without disturbing the row/column which is supposed
|
|
|
|
* to shrink. --Mitch
|
|
|
|
*
|
|
|
|
* Changed the packing to use hboxes and vboxes which behave nicer:
|
|
|
|
*
|
|
|
|
* main_vbox
|
|
|
|
* |
|
|
|
|
* +-- disp_vbox
|
|
|
|
* | |
|
|
|
|
* | +-- upper_hbox
|
|
|
|
* | | |
|
|
|
|
* | | +-- inner_table
|
|
|
|
* | | | |
|
|
|
|
* | | | +-- origin
|
|
|
|
* | | | +-- hruler
|
|
|
|
* | | | +-- vruler
|
|
|
|
* | | | +-- canvas
|
|
|
|
* | | |
|
|
|
|
* | | +-- vscrollbar
|
|
|
|
* | |
|
|
|
|
* | +-- lower_hbox
|
|
|
|
* | |
|
|
|
|
* | +-- qmaskoff
|
|
|
|
* | +-- qmaskon
|
|
|
|
* | +-- hscrollbar
|
|
|
|
* | +-- navbutton
|
|
|
|
* |
|
|
|
|
* +-- statusarea
|
|
|
|
* |
|
|
|
|
* +-- cursorlabel
|
|
|
|
* +-- statusbar
|
|
|
|
* +-- progressbar
|
|
|
|
* +-- cancelbutton
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* first, set up the container hierarchy *********************************/
|
|
|
|
|
|
|
|
/* the vbox containing all widgets */
|
|
|
|
main_vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gdisp->shell), main_vbox);
|
|
|
|
|
|
|
|
/* another vbox for everything except the statusbar */
|
|
|
|
disp_vbox = gtk_vbox_new (FALSE, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), disp_vbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (disp_vbox);
|
|
|
|
|
|
|
|
/* a hbox for the inner_table and the vertical scrollbar */
|
|
|
|
upper_hbox = gtk_hbox_new (FALSE, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (disp_vbox), upper_hbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (upper_hbox);
|
|
|
|
|
|
|
|
/* the table containing origin, rulers and the canvas */
|
|
|
|
inner_table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (inner_table), 0, 1);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (inner_table), 0, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (upper_hbox), inner_table, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (inner_table);
|
|
|
|
|
|
|
|
/* the hbox containing qmask buttons, vertical scrollbar and nav button */
|
|
|
|
lower_hbox = gtk_hbox_new (FALSE, 1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (disp_vbox), lower_hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (lower_hbox);
|
|
|
|
|
|
|
|
/* eventbox and hbox for status area */
|
|
|
|
gdisp->statusarea = gtk_event_box_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), gdisp->statusarea, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (gdisp->statusarea, NULL, "#status_area");
|
|
|
|
|
|
|
|
status_hbox = gtk_hbox_new (FALSE, 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gdisp->statusarea), status_hbox);
|
|
|
|
gtk_widget_show (status_hbox);
|
|
|
|
|
|
|
|
gtk_container_set_resize_mode (GTK_CONTAINER (status_hbox),
|
|
|
|
GTK_RESIZE_QUEUE);
|
1998-06-15 12:46:32 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* create the scrollbars *************************************************/
|
1999-11-03 17:58:46 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the horizontal scrollbar */
|
|
|
|
gdisp->hsbdata =
|
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, width, 1, 1, width));
|
|
|
|
gdisp->hsb = gtk_hscrollbar_new (gdisp->hsbdata);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (gdisp->hsb, GTK_CAN_FOCUS);
|
1999-11-03 17:58:46 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the vertical scrollbar */
|
|
|
|
gdisp->vsbdata =
|
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height, 1, 1, height));
|
|
|
|
gdisp->vsb = gtk_vscrollbar_new (gdisp->vsbdata);
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (gdisp->vsb, GTK_CAN_FOCUS);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* create the contents of the inner_table ********************************/
|
1998-06-15 10:25:27 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the menu popup button */
|
1998-06-09 17:20:46 +08:00
|
|
|
gdisp->origin = gtk_button_new ();
|
1999-06-04 02:28:39 +08:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (gdisp->origin, GTK_CAN_FOCUS);
|
1998-06-09 17:20:46 +08:00
|
|
|
gtk_widget_set_events (GTK_WIDGET (gdisp->origin),
|
|
|
|
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->origin), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (gdisplay_origin_button_press),
|
1998-06-09 17:20:46 +08:00
|
|
|
gdisp);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (gdisp->origin, NULL, "#origin_button");
|
|
|
|
|
1998-06-09 17:20:46 +08:00
|
|
|
arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
|
1999-03-12 11:44:59 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (gdisp->origin), 0);
|
1998-06-09 17:20:46 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (gdisp->origin), arrow);
|
2000-04-02 23:34:30 +08:00
|
|
|
gtk_widget_show (arrow);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the horizontal ruler */
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisp->hrule = gtk_hruler_new ();
|
|
|
|
gtk_widget_set_events (GTK_WIDGET (gdisp->hrule),
|
|
|
|
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (gdisp->shell), "motion_notify_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (GTK_WIDGET_CLASS (GTK_OBJECT (gdisp->hrule)->klass)->motion_notify_event),
|
1997-11-25 06:05:25 +08:00
|
|
|
GTK_OBJECT (gdisp->hrule));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->hrule), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (gdisplay_hruler_button_press),
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisp);
|
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (gdisp->hrule, NULL, "#ruler");
|
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the vertical ruler */
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisp->vrule = gtk_vruler_new ();
|
|
|
|
gtk_widget_set_events (GTK_WIDGET (gdisp->vrule),
|
|
|
|
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
|
|
|
gtk_signal_connect_object (GTK_OBJECT (gdisp->shell), "motion_notify_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (GTK_WIDGET_CLASS (GTK_OBJECT (gdisp->vrule)->klass)->motion_notify_event),
|
1997-11-25 06:05:25 +08:00
|
|
|
GTK_OBJECT (gdisp->vrule));
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->vrule), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (gdisplay_vruler_button_press),
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisp);
|
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (gdisp->vrule, NULL, "#ruler");
|
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the canvas */
|
|
|
|
gdisp->canvas = gtk_drawing_area_new ();
|
|
|
|
gtk_drawing_area_size (GTK_DRAWING_AREA (gdisp->canvas), n_width, n_height);
|
|
|
|
gtk_widget_set_events (gdisp->canvas, CANVAS_EVENT_MASK);
|
|
|
|
gtk_widget_set_extension_events (gdisp->canvas, GDK_EXTENSION_EVENTS_ALL);
|
|
|
|
GTK_WIDGET_SET_FLAGS (gdisp->canvas, GTK_CAN_FOCUS);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (gdisp->canvas), (gpointer) gdisp);
|
|
|
|
|
|
|
|
/* set the active display before doing any other canvas event processing */
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->canvas), "event",
|
|
|
|
GTK_SIGNAL_FUNC (gdisplay_shell_events),
|
|
|
|
gdisp);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->canvas), "event",
|
|
|
|
GTK_SIGNAL_FUNC (gdisplay_canvas_events),
|
1999-10-27 02:27:27 +08:00
|
|
|
gdisp);
|
1999-09-02 06:39:44 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* create the contents of the lower_hbox *********************************/
|
1999-11-03 17:58:46 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the qmask buttons */
|
1999-10-27 02:27:27 +08:00
|
|
|
gdisp->qmaskoff = gtk_radio_button_new (group);
|
1999-07-07 11:18:54 +08:00
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (gdisp->qmaskoff));
|
2000-04-02 23:34:30 +08:00
|
|
|
gtk_widget_set_usize (GTK_WIDGET (gdisp->qmaskoff), 15, 15);
|
1999-07-07 11:18:54 +08:00
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (gdisp->qmaskoff), FALSE);
|
2000-04-02 23:34:30 +08:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (gdisp->qmaskoff, GTK_CAN_FOCUS);
|
1999-07-07 11:18:54 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->qmaskoff), "toggled",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (qmask_deactivate),
|
|
|
|
gdisp);
|
1999-08-08 04:55:26 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->qmaskoff), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (qmask_click_handler),
|
|
|
|
gdisp);
|
1999-07-07 11:18:54 +08:00
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (gdisp->qmaskoff, NULL, "#qmask_off_button");
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
gdisp->qmaskon = gtk_radio_button_new (group);
|
1999-07-07 11:18:54 +08:00
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (gdisp->qmaskon));
|
2000-04-02 23:34:30 +08:00
|
|
|
gtk_widget_set_usize (GTK_WIDGET (gdisp->qmaskon), 15, 15);
|
1999-07-07 11:18:54 +08:00
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (gdisp->qmaskon), FALSE);
|
2000-04-02 23:34:30 +08:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (gdisp->qmaskon, GTK_CAN_FOCUS);
|
1999-07-07 11:18:54 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->qmaskon), "toggled",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (qmask_activate),
|
|
|
|
gdisp);
|
1999-08-08 04:55:26 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (gdisp->qmaskon), "button_press_event",
|
1999-10-27 02:27:27 +08:00
|
|
|
GTK_SIGNAL_FUNC (qmask_click_handler),
|
|
|
|
gdisp);
|
1999-07-07 11:18:54 +08:00
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
gimp_help_set_help_data (gdisp->qmaskon, NULL, "#qmask_on_button");
|
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gdisp->qmaskoff), TRUE);
|
2000-02-09 04:48:48 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the navigation window button */
|
|
|
|
nav_ebox = gtk_event_box_new ();
|
|
|
|
gtk_signal_connect (GTK_OBJECT (nav_ebox), "button_press_event",
|
|
|
|
GTK_SIGNAL_FUNC (nav_popup_click_handler),
|
|
|
|
gdisp);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (nav_ebox, NULL, "#nav_window_button");
|
|
|
|
|
|
|
|
/* create the pixmaps ****************************************************/
|
2000-02-09 07:45:20 +08:00
|
|
|
if (!qmasksel_pixmap)
|
|
|
|
{
|
|
|
|
GtkStyle *style;
|
2000-04-02 23:34:30 +08:00
|
|
|
|
2000-02-09 07:45:20 +08:00
|
|
|
gtk_widget_realize (gdisp->shell);
|
|
|
|
style = gtk_widget_get_style (gdisp->shell);
|
2000-04-02 23:34:30 +08:00
|
|
|
|
|
|
|
qmasksel_pixmap =
|
|
|
|
gdk_pixmap_create_from_xpm_d (gdisp->shell->window,
|
|
|
|
&qmasksel_mask,
|
|
|
|
&style->bg[GTK_STATE_NORMAL],
|
|
|
|
qmasksel_xpm);
|
|
|
|
qmasknosel_pixmap =
|
|
|
|
gdk_pixmap_create_from_xpm_d (gdisp->shell->window,
|
|
|
|
&qmasknosel_mask,
|
|
|
|
&style->bg[GTK_STATE_NORMAL],
|
|
|
|
qmasknosel_xpm);
|
|
|
|
navbutton_pixmap =
|
|
|
|
gdk_pixmap_create_from_xpm_d (gdisp->shell->window,
|
|
|
|
&navbutton_mask,
|
|
|
|
&style->bg[GTK_STATE_NORMAL],
|
|
|
|
navbutton_xpm);
|
2000-02-09 07:45:20 +08:00
|
|
|
}
|
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* create the GtkPixmaps */
|
2000-02-09 07:45:20 +08:00
|
|
|
pixmap = gtk_pixmap_new (qmasksel_pixmap, qmasksel_mask);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gdisp->qmaskon), pixmap);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
|
|
|
pixmap = gtk_pixmap_new (qmasknosel_pixmap, qmasknosel_mask);
|
|
|
|
gtk_container_add (GTK_CONTAINER (gdisp->qmaskoff), pixmap);
|
|
|
|
gtk_widget_show (pixmap);
|
|
|
|
|
|
|
|
pixmap = gtk_pixmap_new (navbutton_pixmap, navbutton_mask);
|
2000-04-02 23:34:30 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (nav_ebox), pixmap);
|
2000-02-09 07:45:20 +08:00
|
|
|
gtk_widget_show (pixmap);
|
1999-06-26 19:16:47 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* create the contents of the status area *********************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the cursor label */
|
|
|
|
label_frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (label_frame), GTK_SHADOW_IN);
|
1998-07-16 11:23:14 +08:00
|
|
|
|
1998-11-20 04:20:46 +08:00
|
|
|
gdisp->cursor_label = gtk_label_new (" ");
|
2000-04-02 23:34:30 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (label_frame), gdisp->cursor_label);
|
|
|
|
gtk_widget_show (gdisp->cursor_label);
|
1998-12-13 01:41:41 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the statusbar */
|
1998-08-05 20:38:11 +08:00
|
|
|
gdisp->statusbar = gtk_statusbar_new ();
|
|
|
|
gtk_widget_set_usize (gdisp->statusbar, 1, -1);
|
1998-06-19 09:39:02 +08:00
|
|
|
gtk_container_set_resize_mode (GTK_CONTAINER (gdisp->statusbar),
|
|
|
|
GTK_RESIZE_QUEUE);
|
1998-06-15 10:25:27 +08:00
|
|
|
contextid = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar),
|
|
|
|
"title");
|
1998-08-05 20:38:11 +08:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar),
|
|
|
|
contextid,
|
|
|
|
title);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the progress bar */
|
1999-11-03 17:58:46 +08:00
|
|
|
gdisp->progressbar = gtk_progress_bar_new ();
|
1998-08-05 20:38:11 +08:00
|
|
|
gtk_widget_set_usize (gdisp->progressbar, 80, -1);
|
1998-07-20 23:07:13 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* the cancel button */
|
|
|
|
gdisp->cancelbutton = gtk_button_new_with_label (_("Cancel"));
|
1998-07-12 23:18:07 +08:00
|
|
|
gtk_widget_set_sensitive (gdisp->cancelbutton, FALSE);
|
1998-07-15 20:15:24 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* pack all the widgets **************************************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* fill the upper_hbox */
|
|
|
|
gtk_box_pack_start (GTK_BOX (upper_hbox), gdisp->vsb, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* fill the inner_table */
|
|
|
|
gtk_table_attach (GTK_TABLE (inner_table), gdisp->origin, 0, 1, 0, 1,
|
|
|
|
GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_table_attach (GTK_TABLE (inner_table), gdisp->hrule, 1, 2, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
|
|
|
gtk_table_attach (GTK_TABLE (inner_table), gdisp->vrule, 0, 1, 1, 2,
|
|
|
|
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_table_attach (GTK_TABLE (inner_table), gdisp->canvas, 1, 2, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL,
|
|
|
|
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* fill the lower_hbox */
|
|
|
|
gtk_box_pack_start (GTK_BOX (lower_hbox), gdisp->qmaskoff, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (lower_hbox), gdisp->qmaskon, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (lower_hbox), gdisp->hsb, TRUE, TRUE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (lower_hbox), nav_ebox, FALSE, FALSE, 0);
|
1999-07-07 11:18:54 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* fill the status area */
|
|
|
|
gtk_box_pack_start (GTK_BOX (status_hbox), label_frame, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (status_hbox), gdisp->statusbar, TRUE, TRUE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (status_hbox), gdisp->progressbar, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (status_hbox), gdisp->cancelbutton, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* show everything *******************************************************/
|
1998-10-07 16:59:11 +08:00
|
|
|
|
1998-08-05 20:38:11 +08:00
|
|
|
if (show_rulers)
|
|
|
|
{
|
|
|
|
gtk_widget_show (gdisp->origin);
|
|
|
|
gtk_widget_show (gdisp->hrule);
|
|
|
|
gtk_widget_show (gdisp->vrule);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (gdisp->canvas);
|
2000-04-02 23:34:30 +08:00
|
|
|
|
|
|
|
gtk_widget_show (gdisp->vsb);
|
|
|
|
gtk_widget_show (gdisp->hsb);
|
|
|
|
|
|
|
|
gtk_widget_show (gdisp->qmaskoff);
|
|
|
|
gtk_widget_show (gdisp->qmaskon);
|
|
|
|
gtk_widget_show (nav_ebox);
|
|
|
|
|
|
|
|
gtk_widget_show (label_frame);
|
1998-06-15 10:25:27 +08:00
|
|
|
gtk_widget_show (gdisp->statusbar);
|
|
|
|
gtk_widget_show (gdisp->progressbar);
|
1998-07-12 23:18:07 +08:00
|
|
|
gtk_widget_show (gdisp->cancelbutton);
|
1998-08-05 20:38:11 +08:00
|
|
|
if (show_statusbar)
|
|
|
|
{
|
|
|
|
gtk_widget_show (gdisp->statusarea);
|
|
|
|
}
|
1999-12-26 15:54:39 +08:00
|
|
|
|
1998-10-04 04:14:00 +08:00
|
|
|
gtk_widget_realize (gdisp->canvas);
|
2000-04-06 10:13:18 +08:00
|
|
|
gdk_window_set_back_pixmap (gdisp->canvas->window, NULL, FALSE);
|
1998-10-04 04:14:00 +08:00
|
|
|
|
2000-04-02 23:34:30 +08:00
|
|
|
/* we need to realize the cursor_label widget here, so the size gets
|
|
|
|
* computed correctly
|
|
|
|
*/
|
|
|
|
gtk_widget_realize (gdisp->cursor_label);
|
|
|
|
gdisplay_resize_cursor_label (gdisp);
|
|
|
|
|
|
|
|
gtk_widget_show (main_vbox);
|
|
|
|
gtk_widget_show (gdisp->shell);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* set the focus to the canvas area */
|
|
|
|
gtk_widget_grab_focus (gdisp->canvas);
|
1999-03-12 11:44:59 +08:00
|
|
|
}
|
|
|
|
|
1999-07-01 17:13:39 +08:00
|
|
|
/* DnD functions */
|
|
|
|
static void
|
1999-08-20 03:53:30 +08:00
|
|
|
toolbox_set_drag_dest (GtkWidget *object)
|
1999-07-01 17:13:39 +08:00
|
|
|
{
|
|
|
|
gtk_drag_dest_set (object,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
1999-08-20 03:53:30 +08:00
|
|
|
toolbox_target_table, toolbox_n_targets,
|
1999-07-01 17:13:39 +08:00
|
|
|
GDK_ACTION_COPY);
|
1999-08-20 03:53:30 +08:00
|
|
|
|
2000-06-09 20:31:19 +08:00
|
|
|
gimp_dnd_file_dest_set (object);
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (object), "drag_drop",
|
|
|
|
GTK_SIGNAL_FUNC (toolbox_drag_drop),
|
|
|
|
NULL);
|
1999-10-28 23:05:49 +08:00
|
|
|
|
|
|
|
gimp_dnd_tool_dest_set (object, toolbox_drop_tool, NULL);
|
1999-07-01 17:13:39 +08:00
|
|
|
}
|
|
|
|
|
1999-08-20 03:53:30 +08:00
|
|
|
static gboolean
|
|
|
|
toolbox_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
GtkWidget *src_widget;
|
|
|
|
gboolean return_val = FALSE;
|
|
|
|
|
|
|
|
if ((src_widget = gtk_drag_get_source_widget (context)))
|
|
|
|
{
|
1999-08-21 03:59:06 +08:00
|
|
|
GimpDrawable *drawable = NULL;
|
|
|
|
Layer *layer = NULL;
|
|
|
|
Channel *channel = NULL;
|
1999-08-22 19:45:31 +08:00
|
|
|
LayerMask *layer_mask = NULL;
|
|
|
|
GImage *component = NULL;
|
1999-08-21 03:59:06 +08:00
|
|
|
ChannelType component_type = -1;
|
1999-08-20 03:53:30 +08:00
|
|
|
|
|
|
|
layer = (Layer *) gtk_object_get_data (GTK_OBJECT (src_widget),
|
|
|
|
"gimp_layer");
|
|
|
|
channel = (Channel *) gtk_object_get_data (GTK_OBJECT (src_widget),
|
|
|
|
"gimp_channel");
|
1999-08-22 19:45:31 +08:00
|
|
|
layer_mask = (LayerMask *) gtk_object_get_data (GTK_OBJECT (src_widget),
|
|
|
|
"gimp_layer_mask");
|
1999-08-21 03:59:06 +08:00
|
|
|
component = (GImage *) gtk_object_get_data (GTK_OBJECT (src_widget),
|
|
|
|
"gimp_component");
|
1999-08-20 03:53:30 +08:00
|
|
|
|
|
|
|
if (layer)
|
|
|
|
{
|
|
|
|
drawable = GIMP_DRAWABLE (layer);
|
|
|
|
}
|
|
|
|
else if (channel)
|
|
|
|
{
|
|
|
|
drawable = GIMP_DRAWABLE (channel);
|
|
|
|
}
|
|
|
|
else if (layer_mask)
|
|
|
|
{
|
1999-08-22 19:45:31 +08:00
|
|
|
drawable = GIMP_DRAWABLE (layer_mask);
|
1999-08-21 03:59:06 +08:00
|
|
|
}
|
|
|
|
else if (component)
|
|
|
|
{
|
|
|
|
component_type =
|
|
|
|
(ChannelType) gtk_object_get_data (GTK_OBJECT (src_widget),
|
|
|
|
"gimp_component_type");
|
1999-08-20 03:53:30 +08:00
|
|
|
}
|
|
|
|
|
1999-08-21 03:59:06 +08:00
|
|
|
if (drawable)
|
1999-08-20 03:53:30 +08:00
|
|
|
{
|
1999-08-21 03:59:06 +08:00
|
|
|
GImage *gimage;
|
|
|
|
GImage *new_gimage;
|
|
|
|
Layer *new_layer;
|
|
|
|
gint width, height;
|
|
|
|
gint off_x, off_y;
|
|
|
|
gint bytes;
|
|
|
|
|
|
|
|
GimpImageBaseType type;
|
1999-08-20 03:53:30 +08:00
|
|
|
|
|
|
|
gimage = gimp_drawable_gimage (drawable);
|
|
|
|
width = gimp_drawable_width (drawable);
|
|
|
|
height = gimp_drawable_height (drawable);
|
1999-08-21 03:59:06 +08:00
|
|
|
bytes = gimp_drawable_bytes (drawable);
|
|
|
|
|
|
|
|
switch (gimp_drawable_type (drawable))
|
|
|
|
{
|
|
|
|
case RGB_GIMAGE: case RGBA_GIMAGE:
|
|
|
|
type = RGB; break;
|
|
|
|
case GRAY_GIMAGE: case GRAYA_GIMAGE:
|
|
|
|
type = GRAY; break;
|
|
|
|
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
|
|
|
|
type = INDEXED; break;
|
|
|
|
default:
|
|
|
|
type = RGB; break;
|
|
|
|
}
|
1999-08-20 03:53:30 +08:00
|
|
|
|
1999-08-21 03:59:06 +08:00
|
|
|
new_gimage = gimage_new (width, height, type);
|
1999-08-20 03:53:30 +08:00
|
|
|
gimage_disable_undo (new_gimage);
|
|
|
|
|
2000-02-01 02:37:36 +08:00
|
|
|
if (type == INDEXED) /* copy the colormap */
|
|
|
|
{
|
|
|
|
new_gimage->num_cols = gimage->num_cols;
|
|
|
|
memcpy (new_gimage->cmap, gimage->cmap, COLORMAP_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimage_set_resolution (new_gimage, gimage->xresolution, gimage->yresolution);
|
1999-08-20 03:53:30 +08:00
|
|
|
gimage_set_unit (new_gimage, gimage->unit);
|
|
|
|
|
1999-08-21 03:59:06 +08:00
|
|
|
if (layer)
|
|
|
|
{
|
|
|
|
new_layer = layer_copy (layer, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* a non-layer drawable can't have an alpha channel,
|
|
|
|
* so add one
|
|
|
|
*/
|
|
|
|
PixelRegion srcPR, destPR;
|
|
|
|
TileManager *tiles;
|
|
|
|
|
|
|
|
tiles = tile_manager_new (width, height, bytes + 1);
|
|
|
|
|
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
|
|
|
0, 0, width, height, FALSE);
|
|
|
|
pixel_region_init (&destPR, tiles,
|
|
|
|
0, 0, width, height, TRUE);
|
|
|
|
|
|
|
|
add_alpha_region (&srcPR, &destPR);
|
|
|
|
|
2000-01-12 04:08:45 +08:00
|
|
|
new_layer = layer_new_from_tiles (new_gimage,
|
|
|
|
gimp_image_base_type_with_alpha(new_gimage),
|
|
|
|
tiles,
|
2000-01-02 02:33:40 +08:00
|
|
|
"", OPAQUE_OPACITY, NORMAL_MODE);
|
1999-08-21 03:59:06 +08:00
|
|
|
|
|
|
|
tile_manager_destroy (tiles);
|
|
|
|
}
|
1999-08-20 03:53:30 +08:00
|
|
|
|
|
|
|
gimp_drawable_set_gimage (GIMP_DRAWABLE (new_layer), new_gimage);
|
|
|
|
|
|
|
|
layer_set_name (GIMP_LAYER (new_layer),
|
1999-08-21 03:59:06 +08:00
|
|
|
gimp_drawable_get_name (drawable));
|
1999-08-20 03:53:30 +08:00
|
|
|
|
1999-08-21 03:59:06 +08:00
|
|
|
if (layer)
|
1999-08-20 03:53:30 +08:00
|
|
|
{
|
1999-08-21 03:59:06 +08:00
|
|
|
LayerMask *mask;
|
|
|
|
LayerMask *new_mask;
|
|
|
|
|
|
|
|
mask = layer_get_mask (layer);
|
|
|
|
new_mask = layer_get_mask (new_layer);
|
|
|
|
|
|
|
|
if (new_mask)
|
|
|
|
{
|
|
|
|
gimp_drawable_set_name (GIMP_DRAWABLE (new_mask),
|
|
|
|
gimp_drawable_get_name (GIMP_DRAWABLE (mask)));
|
|
|
|
}
|
1999-08-20 03:53:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_drawable_offsets (GIMP_DRAWABLE (new_layer), &off_x, &off_y);
|
|
|
|
layer_translate (new_layer, -off_x, -off_y);
|
|
|
|
|
|
|
|
gimage_add_layer (new_gimage, new_layer, 0);
|
|
|
|
|
1999-08-22 19:45:31 +08:00
|
|
|
gimp_context_set_display (gimp_context_get_user (),
|
|
|
|
gdisplay_new (new_gimage, 0x0101));
|
1999-08-20 03:53:30 +08:00
|
|
|
|
|
|
|
gimage_enable_undo (new_gimage);
|
|
|
|
|
|
|
|
return_val = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_drag_finish (context, return_val, FALSE, time);
|
|
|
|
|
|
|
|
return return_val;
|
|
|
|
}
|
|
|
|
|
1999-11-03 17:58:46 +08:00
|
|
|
static ToolType
|
|
|
|
toolbox_drag_tool (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
return (ToolType) data;
|
|
|
|
}
|
|
|
|
|
1999-10-28 23:05:49 +08:00
|
|
|
static void
|
|
|
|
toolbox_drop_tool (GtkWidget *widget,
|
|
|
|
ToolType tool,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gimp_context_set_tool (gimp_context_get_user (), tool);
|
|
|
|
}
|