gimp/app/core/gimpprojection.c

2650 lines
65 KiB
C
Raw Normal View History

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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +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
#include "config.h"
#include <sys/types.h>
1997-11-25 06:05:25 +08:00
#include <stdlib.h>
#include <string.h>
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
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
Makefile.am configure.in added new directory libgimpbase/ 2001-05-21 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool-1.4.in: added new directory libgimpbase/ * app/Makefile.am: link against the new lib. * app/appenums.h: removed the PDB enums which are in libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed. * app/apptypes.h: #include "libgimpbase/gimpbasetypes.h" * app/[lots] * app/core/[of] * app/gui/[files] * app/tools/: changed includes and all PDB types. * app/pdb/*: regenerated. * libgimp/Makefile.am: don't build libgimpi.a uglyness any more. * libgimp/gimpenv.[ch] * libgimp/gimplimits.[hh] * libgimp/gimpparasite.[ch] * libgimp/gimpparasiteio.[ch] * libgimp/gimpprotocol.[ch] * libgimp/gimpsignal.[ch] * libgimp/gimpunit.h * libgimp/gimputils.[ch] * libgimp/gimpwire.[ch]: removed... * libgimpbase/*: ...and added here as new library. * libgimp/gimp.[ch] * libgimp/gimpdrawable.[ch] * libgimp/gimpenums.h * libgimp/gimpimage.[ch] * libgimp/gimptile.c * libgimp/gimptypes.h * libgimp/gimpunit.c: changed accordingly. Added the gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and gimpimage.[ch]. * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpsizeentry.c * libgimpwidgets/gimpunitmenu.c * libgimpwidgets/gimpwidgets.c * libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly. * plug-ins/*/Makefile.am * plug-ins/common/mkgen.pl: link against libgimpbase. * tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so the enums are known to pdbgen... * tools/pdbgen/enumcode.pl: ...but don't write them out to libgimp/gimpenums.h * tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c files. Added GIMP_ to the type names ganerated in app/. * tools/pdbgen/enums.pl: regenerated. * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/unit.pdb: changed includes.
2001-05-21 21:58:46 +08:00
#include "libgimpbase/gimpbase.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
new directory app/base/ 2001-05-15 Michael Natterer <mitch@gimp.org> * configure.in: new directory app/base/ * app/Makefile.am * app/boundary.[ch] * app/brush_scale.[ch] * app/gimpchecks.h * app/gimplut.[ch] * app/pixel_processor.[ch] * app/pixel_region.[ch] * app/pixel_surround.[ch] * app/temp_buf.[ch] * app/tile.[ch] * app/tile_cache.[ch] * app/tile_manager.[ch] * app/tile_manager_pvt.h * app/tile_pvt.h * app/tile_swap.[ch]: moved to base/ * app/base/Makefile.am * app/base/base-types.h * app/base/*: new directory for the sub-object pixel maniplation and storage stuff. Does not include Gtk+ or anything outside base/. Did some cleanup in all files. * app/appenums.h * app/apptypes.h * app/core/gimpimage.h: removed types which are now in base/base-types.h. * app/base/base-config.[ch] * app/gimprc.[ch]: put the config variables for base/ to their own file so base/ doesn not have to include gimprc.h (does not yet work, i.e. the variables are un-configurable right now) * app/main.c: set a log handler for "Gimp-Base". * app/paint-funcs/Makefile.am * app/paint-funcs/paint-funcs.[ch]: removed the color hash which maps RGB to color indices because it's a totally standalone system which has nothing to do with the paint-funcs and introduced a GimpImage dependency. paint-funcs/ should be considered on the same sub-object (glib-only) level as base/, only in a different directory. * app/core/Makefile.am * app/core/gimpimage-colorhash.[ch]: put the color hash here. * app/gimage.c: don't invalidate the color hash here... * app/core/gimpimage.c: ... but in the colormap_changed() default inplementation. Initialize the hash in class_init(). * tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums. * tools/pdbgen/enums.pl: regenerated. * app/[lots] * app/core/[of] * app/gui/[files] * app/pdb/[all] * app/tools/[over] * app/widgets/[the] * tools/pdbgen/pdb/[place]: changed #includes accordingly. And use base_config->value instead of the stuff from gimprc.h.
2001-05-15 19:25:25 +08:00
#include "base/temp-buf.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
#include "widgets/gimpcursor.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
1997-11-25 06:05:25 +08:00
#include "disp_callbacks.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
app/Makefile.am app/gui/Makefile.am app/about_dialog.[ch] 2001-04-17 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gui/Makefile.am * app/about_dialog.[ch] * app/brush_edit.[ch] * app/brush_select.[ch] * app/channels_dialog.[ch] * app/color_area.[ch] * app/color_notebook.[ch] * app/color_select.[ch] * app/colormap_dialog.[ch] * app/commands.[ch] * app/file_new_dialog.[ch] * app/gradient_editor.[ch] * app/gradient_select.[ch] * app/indicator_area.[ch] * app/info_dialog.[ch] * app/info_window.[ch] * app/layer_select.[ch] * app/layers_dialog.[ch] * app/menus.[ch] * app/palette.[ch] * app/palette_import.[ch] * app/palette_select.[ch] * app/paths_dialog.[ch] * app/pattern_select.[ch] * app/preferences_dialog.[ch] * app/session.[ch] * app/test_commands.[ch] * app/tips_dialog.[ch] * app/toolbox.[ch]: moved to gui/ (s/_/-/ and some more useful filenames on the way). * app/app_procs.c * app/context_manager.c * app/convert.c * app/disp_callbacks.c * app/errorconsole.c * app/file-open.c * app/file-save.c * app/file-utils.c * app/gdisplay.c * app/gimage.c * app/gimprc.c * app/image_new.c * app/interface.c * app/nav_window.c * app/path.c * app/plug_in.c * app/gui/dialogs-constructors.c * app/pdb/brush_select_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpscaletool.c * app/tools/gimptransformtool.c * app/widgets/gimpcolorpanel.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * po/POTFILES.in: changed accordingly.
2001-04-18 05:43:29 +08:00
#include "gui/info-window.h"
#include "interface.h"
#include "gui/menus.h"
#include "nav_window.h"
#include "appenv.h"
#include "colormaps.h"
1997-11-25 06:05:25 +08:00
#include "gimprc.h"
#include "gximage.h"
#include "image_render.h"
#include "plug_in.h"
#include "qmask.h"
1997-11-25 06:05:25 +08:00
#include "scale.h"
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
#include "selection.h"
1997-11-25 06:05:25 +08:00
#include "undo.h"
#ifdef DISPLAY_FILTERS
#include "gdisplay_color.h"
#endif /* DISPLAY_FILTERS */
#include "libgimp/gimpintl.h"
app/Makefile.am app/gui/Makefile.am app/about_dialog.[ch] 2001-04-17 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gui/Makefile.am * app/about_dialog.[ch] * app/brush_edit.[ch] * app/brush_select.[ch] * app/channels_dialog.[ch] * app/color_area.[ch] * app/color_notebook.[ch] * app/color_select.[ch] * app/colormap_dialog.[ch] * app/commands.[ch] * app/file_new_dialog.[ch] * app/gradient_editor.[ch] * app/gradient_select.[ch] * app/indicator_area.[ch] * app/info_dialog.[ch] * app/info_window.[ch] * app/layer_select.[ch] * app/layers_dialog.[ch] * app/menus.[ch] * app/palette.[ch] * app/palette_import.[ch] * app/palette_select.[ch] * app/paths_dialog.[ch] * app/pattern_select.[ch] * app/preferences_dialog.[ch] * app/session.[ch] * app/test_commands.[ch] * app/tips_dialog.[ch] * app/toolbox.[ch]: moved to gui/ (s/_/-/ and some more useful filenames on the way). * app/app_procs.c * app/context_manager.c * app/convert.c * app/disp_callbacks.c * app/errorconsole.c * app/file-open.c * app/file-save.c * app/file-utils.c * app/gdisplay.c * app/gimage.c * app/gimprc.c * app/image_new.c * app/interface.c * app/nav_window.c * app/path.c * app/plug_in.c * app/gui/dialogs-constructors.c * app/pdb/brush_select_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpscaletool.c * app/tools/gimptransformtool.c * app/widgets/gimpcolorpanel.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * po/POTFILES.in: changed accordingly.
2001-04-18 05:43:29 +08:00
#include "pixmaps/wilber.xpm"
app/Makefile.am app/gui/Makefile.am app/about_dialog.[ch] 2001-04-17 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gui/Makefile.am * app/about_dialog.[ch] * app/brush_edit.[ch] * app/brush_select.[ch] * app/channels_dialog.[ch] * app/color_area.[ch] * app/color_notebook.[ch] * app/color_select.[ch] * app/colormap_dialog.[ch] * app/commands.[ch] * app/file_new_dialog.[ch] * app/gradient_editor.[ch] * app/gradient_select.[ch] * app/indicator_area.[ch] * app/info_dialog.[ch] * app/info_window.[ch] * app/layer_select.[ch] * app/layers_dialog.[ch] * app/menus.[ch] * app/palette.[ch] * app/palette_import.[ch] * app/palette_select.[ch] * app/paths_dialog.[ch] * app/pattern_select.[ch] * app/preferences_dialog.[ch] * app/session.[ch] * app/test_commands.[ch] * app/tips_dialog.[ch] * app/toolbox.[ch]: moved to gui/ (s/_/-/ and some more useful filenames on the way). * app/app_procs.c * app/context_manager.c * app/convert.c * app/disp_callbacks.c * app/errorconsole.c * app/file-open.c * app/file-save.c * app/file-utils.c * app/gdisplay.c * app/gimage.c * app/gimprc.c * app/image_new.c * app/interface.c * app/nav_window.c * app/path.c * app/plug_in.c * app/gui/dialogs-constructors.c * app/pdb/brush_select_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpscaletool.c * app/tools/gimptransformtool.c * app/widgets/gimpcolorpanel.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * po/POTFILES.in: changed accordingly.
2001-04-18 05:43:29 +08:00
#define OVERHEAD 25 /* in units of pixel area */
#define EPSILON 5
1997-11-25 06:05:25 +08:00
#define MAX_TITLE_BUF 256
typedef struct _GimpArea GimpArea;
struct _GimpArea
{
gint x1, y1, x2, y2; /* area bounds */
};
1997-11-25 06:05:25 +08:00
/* variable declarations */
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
GSList * display_list = NULL;
static gint display_num = 1;
1997-11-25 06:05:25 +08:00
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
1997-11-25 06:05:25 +08:00
/* Local functions */
static void gdisplay_format_title (GDisplay *gdisp,
gchar *title,
gint title_len);
static void gdisplay_delete (GDisplay *gdisp);
static GSList * gdisplay_free_area_list (GSList *list);
static GSList * gdisplay_process_area_list (GSList *list,
GimpArea *ga1);
static void gdisplay_add_update_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h);
static void gdisplay_add_display_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h);
static void gdisplay_paint_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h);
static void gdisplay_draw_cursor (GDisplay *gdisp);
static void gdisplay_display_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h);
static guint gdisplay_hash (GDisplay *gdisp);
static void gdisplay_cleandirty_handler (GimpImage *gdisp,
gpointer data);
1997-11-25 06:05:25 +08:00
1997-11-25 06:05:25 +08:00
static GHashTable *display_ht = NULL;
/* FIXME: GDisplays really need to be GtkObjects */
1997-11-25 06:05:25 +08:00
GDisplay *
gdisplay_new (GimpImage *gimage,
guint scale)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
gchar title [MAX_TITLE_BUF];
1997-11-25 06:05:25 +08:00
/* If there isn't an interface, never create a gdisplay */
if (no_interface)
return NULL;
/*
* Set all GDisplay parameters...
*/
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
gdisp = g_new0 (GDisplay, 1);
gdisp->ID = display_num++;
gdisp->ifactory = NULL;
gdisp->shell = NULL;
gdisp->canvas = NULL;
gdisp->hsb = NULL;
gdisp->vsb = NULL;
gdisp->qmaskoff = NULL;
gdisp->qmaskon = NULL;
gdisp->hrule = NULL;
gdisp->vrule = NULL;
gdisp->origin = NULL;
gdisp->statusarea = NULL;
gdisp->progressbar = NULL;
gdisp->cursor_label = NULL;
gdisp->cursor_format_str[0] = '\0';
gdisp->cancelbutton = NULL;
gdisp->progressid = FALSE;
gdisp->window_info_dialog = NULL;
gdisp->window_nav_dialog = NULL;
gdisp->nav_popup = NULL;
gdisp->warning_dialog = NULL;
gdisp->hsbdata = NULL;
gdisp->vsbdata = NULL;
gdisp->icon = NULL;
gdisp->iconmask = NULL;
gdisp->iconsize = 0;
gdisp->icon_needs_update = FALSE;
gdisp->icon_timeout_id = 0;
gdisp->icon_idle_id = 0;
gdisp->gimage = gimage;
gdisp->instance = gimage->instance_count;
gdisp->disp_width = 0;
gdisp->disp_height = 0;
gdisp->disp_xoffset = 0;
gdisp->disp_yoffset = 0;
gdisp->offset_x = 0;
gdisp->offset_y = 0;
gdisp->scale = scale;
gdisp->dot_for_dot = gimprc.default_dot_for_dot;
gdisp->draw_guides = TRUE;
gdisp->snap_to_guides = TRUE;
gdisp->select = NULL;
gdisp->scroll_gc = NULL;
gdisp->update_areas = NULL;
gdisp->display_areas = NULL;
gdisp->current_cursor = (GdkCursorType) -1;
gdisp->tool_cursor = GIMP_TOOL_CURSOR_NONE;
gdisp->cursor_modifier = GIMP_CURSOR_MODIFIER_NONE;
gdisp->override_cursor = (GdkCursorType) -1;
gdisp->using_override_cursor = FALSE;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisp->draw_cursor = FALSE;
gdisp->cursor_x = 0;
gdisp->cursor_y = 0;
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
gdisp->proximity = FALSE;
gdisp->have_cursor = FALSE;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisp->idle_render.idleid = -1;
gdisp->idle_render.update_areas = NULL;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisp->idle_render.active = FALSE;
#ifdef DISPLAY_FILTERS
gdisp->cd_list = NULL;
gdisp->cd_ui = NULL;
#endif /* DISPLAY_FILTERS */
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
1997-11-25 06:05:25 +08:00
/* add the new display to the list so that it isn't lost */
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
display_list = g_slist_append (display_list, gdisp);
1997-11-25 06:05:25 +08:00
/* create the shell for the image */
create_display_shell (gdisp, gimage->width, gimage->height,
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
title, gimp_image_base_type (gimage));
/* update the title to correct the initially displayed scale */
gdisplay_update_title (gdisp);
/* set the qmask buttons */
qmask_buttons_update (gdisp);
1997-11-25 06:05:25 +08:00
/* set the user data */
if (!display_ht)
display_ht = g_hash_table_new ((GHashFunc) gdisplay_hash, NULL);
g_hash_table_insert (display_ht, gdisp->shell, gdisp);
g_hash_table_insert (display_ht, gdisp->canvas, gdisp);
/* set the current tool cursor */
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gdisplay_install_tool_cursor (gdisp,
default_gdisplay_cursor,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
1997-11-25 06:05:25 +08:00
gimage->instance_count++; /* this is obsolete */
gimage->disp_count++;
gtk_object_ref (GTK_OBJECT (gimage));
gtk_object_sink (GTK_OBJECT (gimage));
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
/* We're interested in clean and dirty signals so we can update the
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
* title if need be.
*/
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
gtk_signal_connect (GTK_OBJECT (gimage), "dirty",
GTK_SIGNAL_FUNC (gdisplay_cleandirty_handler), gdisp);
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
gtk_signal_connect (GTK_OBJECT (gimage), "clean",
GTK_SIGNAL_FUNC (gdisplay_cleandirty_handler), gdisp);
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
1997-11-25 06:05:25 +08:00
return gdisp;
}
static int print (char *, int, int, const char *, ...) G_GNUC_PRINTF (4, 5);
static int
print (char *buf, int len, int start, const char *fmt, ...)
{
va_list args;
int printed;
va_start (args, fmt);
printed = g_vsnprintf (buf + start, len - start, fmt, args);
if (printed < 0)
printed = len - start;
va_end (args);
return printed;
}
1997-11-25 06:05:25 +08:00
static void
gdisplay_format_title (GDisplay *gdisp,
gchar *title,
gint title_len)
1997-11-25 06:05:25 +08:00
{
GimpImage *gimage;
gchar *image_type_str;
gint empty;
gint i;
gchar *format;
gimage = gdisp->gimage;
1997-11-25 06:05:25 +08:00
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
empty = gimp_image_is_empty (gimage);
1997-11-25 06:05:25 +08:00
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
switch (gimp_image_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? _("RGB-empty") : _("RGB");
break;
case GRAY:
image_type_str = (empty) ? _("grayscale-empty") : _("grayscale");
break;
case INDEXED:
image_type_str = (empty) ? _("indexed-empty") : _("indexed");
break;
default:
image_type_str = NULL;
}
1997-11-25 06:05:25 +08:00
i = 0;
format = gimprc.image_title_format;
while (i < title_len && *format)
{
switch (*format)
{
case '%':
format++;
switch (*format)
{
case 0:
g_warning ("image-title-format string ended within %%-sequence");
break;
case '%':
title[i++] = '%';
break;
case 'f': /* pruned filename */
i += print (title, title_len, i,
"%s", g_basename (gimp_image_filename (gimage)));
break;
case 'F': /* full filename */
i += print (title, title_len, i, "%s", gimp_image_filename (gimage));
break;
case 'p': /* PDB id */
i += print (title, title_len, i, "%d", gimp_image_get_ID (gimage));
break;
case 'i': /* instance */
i += print (title, title_len, i, "%d", gdisp->instance);
break;
case 't': /* type */
i += print (title, title_len, i, "%s", image_type_str);
break;
case 's': /* user source zoom factor */
i += print (title, title_len, i, "%d", SCALESRC (gdisp));
break;
case 'd': /* user destination zoom factor */
i += print (title, title_len, i, "%d", SCALEDEST (gdisp));
break;
case 'z': /* user zoom factor (percentage) */
i += print (title, title_len, i,
"%d", 100 * SCALEDEST (gdisp) / SCALESRC (gdisp));
break;
case 'D': /* dirty flag */
if (format[1] == 0)
{
g_warning("image-title-format string ended within %%D-sequence");
break;
}
if (gimage->dirty)
title[i++] = format[1];
format++;
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
break;
/* Other cool things to be added:
* %m = memory used by picture
* some kind of resolution / image size thing
* people seem to want to know the active layer name
*/
default:
g_warning ("image-title-format contains unknown format sequence '%%%c'", *format);
break;
}
break;
default:
title[i++] = *format;
break;
}
format++;
}
title[MIN(i, title_len-1)] = 0;
1997-11-25 06:05:25 +08:00
}
static void
gdisplay_delete (GDisplay *gdisp)
{
g_hash_table_remove (display_ht, gdisp->shell);
g_hash_table_remove (display_ht, gdisp->canvas);
/* stop any active tool */
tool_manager_control_active (HALT, (void *) gdisp);
1997-11-25 06:05:25 +08:00
namespace cleanups. 1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de> * app/context_manager.c: namespace cleanups. * app/commands.[ch] * app/menus.c: moved the "Toggle Selection" menu entry to "View", sprinkled some separators and made the layers/channels/paths popup menus consistent with Tigert's last ops buttons change. * app/fileops.c * app/plug_in.c: check for gdisplay_active() returning NULL in some more places. * app/[all tool related files]: - Turned the ToolAction and ToolState #define's into typedef'ed enums, so the compiler can do some more sanity checking. - Removed one more unused global variable "active_tool_layer". - Removed some #include's from tools.c. - Standardized the individual tools' structure names. - Moved showing/hiding the tool options to separate functions. - Stuff... * app/commands.c * app/disp_callbacks.c * app/gdisplay.c * app/tools.c: fixed the segfaults which happened when the image of one of the tools which have dialogs (levels/posterize/...) was deleted. My approach was to do stricter sanity checking and to set some gdisplay pointers correctly where appropriate, so I can't tell exactly where the bug was. The curves tool now(??) updates on every _second_ display change only, which is really obscure. Finding/changing the display to operate on should definitely be done by connecting to the user context's "display_changed" signal. * app/gimpset.c: emit the "remove" signal _after_ removing the pointer from the set. If this was not a bug but a feature, please let me know, we'll need two signals then.
1999-06-22 06:12:07 +08:00
/* clear out the pointer to this gdisp from the active tool */
if (active_tool &&
active_tool->gdisp == gdisp)
namespace cleanups. 1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de> * app/context_manager.c: namespace cleanups. * app/commands.[ch] * app/menus.c: moved the "Toggle Selection" menu entry to "View", sprinkled some separators and made the layers/channels/paths popup menus consistent with Tigert's last ops buttons change. * app/fileops.c * app/plug_in.c: check for gdisplay_active() returning NULL in some more places. * app/[all tool related files]: - Turned the ToolAction and ToolState #define's into typedef'ed enums, so the compiler can do some more sanity checking. - Removed one more unused global variable "active_tool_layer". - Removed some #include's from tools.c. - Standardized the individual tools' structure names. - Moved showing/hiding the tool options to separate functions. - Stuff... * app/commands.c * app/disp_callbacks.c * app/gdisplay.c * app/tools.c: fixed the segfaults which happened when the image of one of the tools which have dialogs (levels/posterize/...) was deleted. My approach was to do stricter sanity checking and to set some gdisplay pointers correctly where appropriate, so I can't tell exactly where the bug was. The curves tool now(??) updates on every _second_ display change only, which is really obscure. Finding/changing the display to operate on should definitely be done by connecting to the user context's "display_changed" signal. * app/gimpset.c: emit the "remove" signal _after_ removing the pointer from the set. If this was not a bug but a feature, please let me know, we'll need two signals then.
1999-06-22 06:12:07 +08:00
{
active_tool->drawable = NULL;
active_tool->gdisp = NULL;
}
1997-11-25 06:05:25 +08:00
/* free the selection structure */
selection_free (gdisp->select);
/* If this gdisplay was idlerendering at the time when it was deleted,
deactivate the idlerendering thread before deletion! */
if (gdisp->idle_render.active)
{
gtk_idle_remove (gdisp->idle_render.idleid);
gdisp->idle_render.active = FALSE;
}
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
#ifdef DISPLAY_FILTERS
/* detach any color displays */
gdisplay_color_detach_all (gdisp);
#endif /* DISPLAY_FILTERS */
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
/* get rid of signals handled by this display */
gtk_signal_disconnect_by_data (GTK_OBJECT (gdisp->gimage), gdisp);
if (gdisp->scroll_gc)
gdk_gc_destroy (gdisp->scroll_gc);
1997-11-25 06:05:25 +08:00
/* free the area lists */
gdisplay_free_area_list (gdisp->update_areas);
gdisplay_free_area_list (gdisp->display_areas);
gdisplay_free_area_list (gdisp->idle_render.update_areas);
/* remove dialogs before removing the image because they may want to
* disconnect from image signals
*/
1997-11-25 06:05:25 +08:00
/* insure that if a window information dialog exists, it is removed */
info_window_free (gdisp->window_info_dialog);
1997-11-25 06:05:25 +08:00
/* Remove navigation dialog */
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
nav_dialog_free (gdisp, gdisp->window_nav_dialog);
/* free the gimage */
gdisp->gimage->disp_count--;
gtk_object_unref (GTK_OBJECT (gdisp->gimage));
1999-10-14 07:07:45 +08:00
if (gdisp->nav_popup)
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
nav_dialog_free (gdisp, gdisp->nav_popup);
if (gdisp->icon_timeout_id)
g_source_remove (gdisp->icon_timeout_id);
if (gdisp->icon_idle_id)
g_source_remove (gdisp->icon_idle_id);
gdk_pixmap_unref (gdisp->icon);
gdk_pixmap_unref (gdisp->iconmask);
gtk_widget_unref (gdisp->shell);
1997-11-25 06:05:25 +08:00
g_free (gdisp);
}
static GSList *
gdisplay_free_area_list (GSList *list)
1997-11-25 06:05:25 +08:00
{
GSList *l;
GimpArea *ga;
1997-11-25 06:05:25 +08:00
for (l = list; l; l = g_slist_next (l))
1997-11-25 06:05:25 +08:00
{
ga = (GimpArea *) l->data;
1997-11-25 06:05:25 +08:00
g_free (ga);
1997-11-25 06:05:25 +08:00
}
if (list)
g_slist_free (list);
1997-11-25 06:05:25 +08:00
return NULL;
}
/*
* As far as I can tell, this function takes a GimpArea and unifies it with
* an existing list of GimpAreas, trying to avoid overdraw. [adam]
*/
static GSList *
gdisplay_process_area_list (GSList *list,
GimpArea *ga1)
1997-11-25 06:05:25 +08:00
{
GSList *new_list;
GSList *l = list;
gint area1, area2, area3;
GimpArea *ga2;
1997-11-25 06:05:25 +08:00
/* start new list off */
new_list = g_slist_prepend (NULL, ga1);
1997-11-25 06:05:25 +08:00
while (l)
{
/* process the data */
ga2 = (GimpArea *) l->data;
1997-11-25 06:05:25 +08:00
area1 = (ga1->x2 - ga1->x1) * (ga1->y2 - ga1->y1) + OVERHEAD;
area2 = (ga2->x2 - ga2->x1) * (ga2->y2 - ga2->y1) + OVERHEAD;
area3 = (MAX (ga2->x2, ga1->x2) - MIN (ga2->x1, ga1->x1)) *
(MAX (ga2->y2, ga1->y2) - MIN (ga2->y1, ga1->y1)) + OVERHEAD;
1997-11-25 06:05:25 +08:00
if ((area1 + area2) < area3)
new_list = g_slist_prepend (new_list, ga2);
1997-11-25 06:05:25 +08:00
else
{
ga1->x1 = MIN (ga1->x1, ga2->x1);
ga1->y1 = MIN (ga1->y1, ga2->y1);
ga1->x2 = MAX (ga1->x2, ga2->x2);
ga1->y2 = MAX (ga1->y2, ga2->y2);
1997-11-25 06:05:25 +08:00
g_free (ga2);
}
l = g_slist_next (l);
1997-11-25 06:05:25 +08:00
}
if (list)
g_slist_free (list);
1997-11-25 06:05:25 +08:00
return new_list;
}
static int
idle_render_next_area (GDisplay *gdisp)
1997-11-25 06:05:25 +08:00
{
GimpArea *ga;
GSList *list;
list = gdisp->idle_render.update_areas;
1997-11-25 06:05:25 +08:00
if (list == NULL)
{
return (-1);
}
ga = (GimpArea*) list->data;
1997-11-25 06:05:25 +08:00
gdisp->idle_render.update_areas =
g_slist_remove (gdisp->idle_render.update_areas, ga);
gdisp->idle_render.x = gdisp->idle_render.basex = ga->x1;
gdisp->idle_render.y = gdisp->idle_render.basey = ga->y1;
gdisp->idle_render.width = ga->x2 - ga->x1;
gdisp->idle_render.height = ga->y2 - ga->y1;
g_free (ga);
return (0);
}
/* Unless specified otherwise, display re-rendering is organised
by IdleRender, which amalgamates areas to be re-rendered and
breaks them into bite-sized chunks which are chewed on in a low-
priority idle thread. This greatly improves responsiveness for
many GIMP operations. -- Adam */
static int
idlerender_callback (gpointer data)
{
const gint CHUNK_WIDTH = 256;
const gint CHUNK_HEIGHT = 128;
gint workx, worky, workw, workh;
GDisplay* gdisp = data;
workw = CHUNK_WIDTH;
workh = CHUNK_HEIGHT;
workx = gdisp->idle_render.x;
worky = gdisp->idle_render.y;
if (workx+workw > gdisp->idle_render.basex+gdisp->idle_render.width)
{
workw = gdisp->idle_render.basex+gdisp->idle_render.width-workx;
}
if (worky+workh > gdisp->idle_render.basey+gdisp->idle_render.height)
{
workh = gdisp->idle_render.basey+gdisp->idle_render.height-worky;
}
gdisplay_paint_area (gdisp, workx, worky,
workw, workh);
gdisplay_flush_displays_only (gdisp);
gdisp->idle_render.x += CHUNK_WIDTH;
if (gdisp->idle_render.x >= gdisp->idle_render.basex+gdisp->idle_render.width)
{
gdisp->idle_render.x = gdisp->idle_render.basex;
gdisp->idle_render.y += CHUNK_HEIGHT;
if (gdisp->idle_render.y >=
gdisp->idle_render.basey + gdisp->idle_render.height)
{
if (idle_render_next_area(gdisp) != 0)
{
/* FINISHED */
gdisp->idle_render.active = FALSE;
return 0;
}
}
}
/* Still work to do. */
return 1;
}
static void
gdisplay_idlerender_init (GDisplay *gdisp)
{
GSList *list;
GimpArea *ga, *new_ga;
/* gdisplay_install_override_cursor(gdisp, GDK_CIRCLE); */
/* We need to merge the IdleRender's and the GDisplay's update_areas list
to keep track of which of the updates have been flushed and hence need
to be drawn. */
1997-11-25 06:05:25 +08:00
list = gdisp->update_areas;
while (list)
{
ga = (GimpArea *) list->data;
new_ga = g_malloc (sizeof(GimpArea));
memcpy (new_ga, ga, sizeof(GimpArea));
gdisp->idle_render.update_areas =
gdisplay_process_area_list (gdisp->idle_render.update_areas, new_ga);
1997-11-25 06:05:25 +08:00
list = g_slist_next (list);
1997-11-25 06:05:25 +08:00
}
/* If an idlerender was already running, merge the remainder of its
unrendered area with the update_areas list, and make it start work
on the next unrendered area in the list. */
if (gdisp->idle_render.active)
{
new_ga = g_malloc (sizeof(GimpArea));
new_ga->x1 = gdisp->idle_render.basex;
new_ga->y1 = gdisp->idle_render.y;
new_ga->x2 = gdisp->idle_render.basex + gdisp->idle_render.width;
new_ga->y2 = gdisp->idle_render.y +
(gdisp->idle_render.height -
(gdisp->idle_render.y - gdisp->idle_render.basey)
);
gdisp->idle_render.update_areas =
gdisplay_process_area_list (gdisp->idle_render.update_areas, new_ga);
idle_render_next_area(gdisp);
}
else
{
if (gdisp->idle_render.update_areas == NULL)
{
configure.in removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so * configure.in * Makefile.am: removed tips files, AC_SUBST GIMP_PLUGINS and GIMP_MODULES so you can easily skip those parts of the build * acinclude.m4 * config.sub * config.guess * ltconfig * ltmain.sh: libtool 1.3.2 * app/fileops.c: shuffle #includes to avoid warning about MIN and MAX [ The following is a big i18n patch from David Monniaux <david.monniaux@ens.fr> ] * tips/gimp_conseils.fr.txt * tips/gimp_tips.txt * tips/Makefile.am * configure.in: moved tips to separate dir * po-plugins: new dir for plug-in translation files * configure.in: add po-plugins dir and POTFILES processing * app/boundary.c * app/brightness_contrast.c * app/by_color_select.c * app/color_balance.c * app/convert.c * app/curves.c * app/free_select.c * app/gdisplay.c * app/gimpimage.c * app/gimpunit.c * app/gradient.c * app/gradient_select.c * app/install.c * app/session.c: various i18n tweaks * app/tips_dialog.c: localize tips filename * libgimp/gimpunit.c * libgimp/gimpunitmenu.c: #include "config.h" * plug-ins/CEL * plug-ins/CML_explorer * plug-ins/Lighting * plug-ins/apply_lens * plug-ins/autostretch_hsv * plug-ins/blur * plug-ins/bmp * plug-ins/borderaverage * plug-ins/bumpmap * plug-ins/bz2 * plug-ins/checkerboard * plug-ins/colorify * plug-ins/compose * plug-ins/convmatrix * plug-ins/cubism * plug-ins/depthmerge * plug-ins/destripe * plug-ins/gif * plug-ins/gifload * plug-ins/jpeg * plug-ins/mail * plug-ins/oilify * plug-ins/png * plug-ins/print * plug-ins/ps * plug-ins/xbm * plug-ins/xpm * plug-ins/xwd: plug-in i18n stuff -Yosh
1999-05-30 00:35:47 +08:00
g_warning ("Wanted to start idlerender thread with no update_areas. (+memleak)");
return;
}
idle_render_next_area(gdisp);
gdisp->idle_render.active = TRUE;
gdisp->idle_render.idleid =
gtk_idle_add_priority (GTK_PRIORITY_LOW,
idlerender_callback, gdisp);
}
/* Caller frees gdisp->update_areas */
}
void
gdisplay_flush_displays_only (GDisplay *gdisp)
{
GSList *list;
GimpArea *ga;
1997-11-25 06:05:25 +08:00
list = gdisp->display_areas;
if (list)
{
/* stop the currently active tool */
tool_manager_control_active (PAUSE, (void *) gdisp);
1997-11-25 06:05:25 +08:00
while (list)
{
/* Paint the area specified by the GimpArea */
ga = (GimpArea *) list->data;
1997-11-25 06:05:25 +08:00
gdisplay_display_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1));
list = g_slist_next (list);
1997-11-25 06:05:25 +08:00
}
/* Free the update lists */
gdisp->display_areas = gdisplay_free_area_list (gdisp->display_areas);
/* draw the guides */
gdisplay_draw_guides (gdisp);
/* and the cursor (if we have a software cursor */
if (gdisp->have_cursor)
gdisplay_draw_cursor (gdisp);
1997-11-25 06:05:25 +08:00
/* restart (and recalculate) the selection boundaries */
selection_start (gdisp->select, TRUE);
/* start the currently active tool */
tool_manager_control_active (RESUME, (void *) gdisp);
}
}
static void
gdisplay_flush_whenever (GDisplay *gdisp,
gboolean now)
{
GSList *list;
GimpArea *ga;
/* Flush the items in the displays and updates lists -
* but only if gdisplay has been mapped and exposed
*/
if (!gdisp->select)
return;
/* First the updates... */
if (now)
{ /* Synchronous */
list = gdisp->update_areas;
while (list)
{
/* Paint the area specified by the GimpArea */
ga = (GimpArea *) list->data;
if ((ga->x1 != ga->x2) && (ga->y1 != ga->y2))
{
gdisplay_paint_area (gdisp, ga->x1, ga->y1,
(ga->x2 - ga->x1), (ga->y2 - ga->y1));
}
list = g_slist_next (list);
}
1997-11-25 06:05:25 +08:00
}
else
{ /* Asynchronous */
if (gdisp->update_areas)
gdisplay_idlerender_init (gdisp);
}
/* Free the update lists */
gdisp->update_areas = gdisplay_free_area_list (gdisp->update_areas);
/* Next the displays... */
gdisplay_flush_displays_only (gdisp);
/* update the gdisplay's info dialog */
info_window_update (gdisp);
/* update the gdisplay's qmask buttons */
qmask_buttons_update (gdisp);
/* ensure the consistency of the tear-off menus */
if (!now && gimp_context_get_display (gimp_context_get_user ()) == gdisp)
gdisplay_set_menu_sensitivity (gdisp);
1997-11-25 06:05:25 +08:00
}
void
gdisplay_flush (GDisplay *gdisp)
{
/* Redraw on idle time */
gdisplay_flush_whenever (gdisp, FALSE);
}
void
gdisplay_flush_now (GDisplay *gdisp)
{
/* Redraw NOW */
gdisplay_flush_whenever (gdisp, TRUE);
}
/* Force all gdisplays to finish their idlerender projection */
void
gdisplays_finish_draw (void)
{
GSList *list = display_list;
GDisplay* gdisp;
while (list)
{
gdisp = (GDisplay*) list->data;
if (gdisp->idle_render.active)
{
gtk_idle_remove (gdisp->idle_render.idleid);
while (idlerender_callback(gdisp));
}
list = g_slist_next (list);
}
}
void
gdisplay_update_icon (GDisplay *gdisp)
{
/* Warning: Lots of obscure Gdk-Stuff ahead. */
static GdkPixmap *wilber_pixmap = NULL;
static GdkBitmap *wilber_mask = NULL;
GtkStyle *style;
GdkGC *icongc, *iconmaskgc;
GdkColormap *colormap;
GdkColor black, white;
TempBuf *icondata;
guchar *data;
gint width, height;
gdouble factor;
if (!gdisp->icon)
{
gdk_rgb_init ();
gdisp->icon = gdk_pixmap_new (gdisp->shell->window,
gdisp->iconsize,
gdisp->iconsize,
-1);
gdisp->iconmask = gdk_pixmap_new (NULL,
gdisp->iconsize,
gdisp->iconsize,
1);
}
icongc = gdk_gc_new (gdisp->icon);
iconmaskgc = gdk_gc_new (gdisp->iconmask);
colormap = gdk_colormap_get_system (); /* or gdk_rgb_get_cmap () */
gdk_color_white (colormap, &white);
gdk_color_black (colormap, &black);
if (! gdisp->icon_needs_update)
return;
style = gtk_widget_get_style (gdisp->shell);
if (wilber_pixmap == NULL)
wilber_pixmap =
gdk_pixmap_create_from_xpm_d (gdisp->shell->window,
&wilber_mask,
&style->bg[GTK_STATE_NORMAL],
wilber_xpm);
factor = ((gfloat) gimp_image_get_height (gdisp->gimage)) /
gimp_image_get_width (gdisp->gimage);
if (factor >= 1)
{
height = MAX (gdisp->iconsize, 1);
width = MAX (((gfloat) gdisp->iconsize) / factor, 1);
}
else
{
height = MAX (((gfloat) gdisp->iconsize) * factor, 1);
width = MAX (gdisp->iconsize, 1);
}
icondata = gimp_viewable_get_new_preview (GIMP_VIEWABLE (gdisp->gimage),
width, height);
data = temp_buf_data (icondata);
/* Set up an icon mask */
gdk_gc_set_foreground (iconmaskgc, &black);
gdk_draw_rectangle (gdisp->iconmask, iconmaskgc, TRUE, 0, 0,
gdisp->iconsize, gdisp->iconsize);
gdk_gc_set_foreground (iconmaskgc, &white);
gdk_draw_rectangle (gdisp->iconmask, iconmaskgc, TRUE,
(gdisp->iconsize - icondata->width) / 2,
(gdisp->iconsize - icondata->height) / 2,
icondata->width, icondata->height);
/* This is an ugly bad hack. There should be a clean way to get
* a preview in a specified depth with a nicely rendered
* checkerboard if no alpha channel is requested.
* We ignore the alpha channel for now. Also the aspect ratio is
* incorrect.
*
* Currently the icons are updated when you press the "menu" button in
* the top left corner of the window. Of course this should go in an
* idle routine.
*/
if (icondata->bytes == 1)
{
gdk_draw_gray_image (gdisp->icon,
icongc,
(gdisp->iconsize - icondata->width) / 2,
(gdisp->iconsize - icondata->height) / 2,
icondata->width,
icondata->height,
GDK_RGB_DITHER_MAX,
data,
icondata->width * icondata->bytes);
gdk_window_set_icon (gdisp->shell->window,
NULL, gdisp->icon, gdisp->iconmask);
}
else if (icondata->bytes == 3)
{
gdk_draw_rgb_image (gdisp->icon,
icongc,
(gdisp->iconsize - icondata->width) / 2,
(gdisp->iconsize - icondata->height) / 2,
icondata->width,
icondata->height,
GDK_RGB_DITHER_MAX,
data,
icondata->width * icondata->bytes);
gdk_window_set_icon (gdisp->shell->window,
NULL, gdisp->icon, gdisp->iconmask);
}
else if (icondata->bytes == 4)
{
gdk_draw_rgb_32_image (gdisp->icon,
icongc,
(gdisp->iconsize - icondata->width) / 2,
(gdisp->iconsize - icondata->height) / 2,
icondata->width,
icondata->height,
GDK_RGB_DITHER_MAX,
data,
icondata->width * icondata->bytes);
gdk_window_set_icon (gdisp->shell->window,
NULL, gdisp->icon, gdisp->iconmask);
}
else
{
g_printerr ("gdisplay_update_icon: falling back to default\n");
gdk_window_set_icon (gdisp->shell->window,
NULL, wilber_pixmap, wilber_mask);
}
gdisp->icon_needs_update = 0;
gdk_gc_unref (icongc);
gdk_gc_unref (iconmaskgc);
temp_buf_free (icondata);
}
/* This function marks the icon as invalid and sets up the infrastructure
* to check every 8 seconds if an update is necessary.
*/
void
gdisplay_update_icon_scheduler (GimpImage *gimage,
gpointer data)
{
GDisplay *gdisp;
gdisp = (GDisplay *) data;
if (gdisp == gdisplays_check_valid (gdisp, gimage))
{
gdisp->icon_needs_update = 1;
if (!gdisp->icon_timeout_id)
{
gdisp->icon_timeout_id = g_timeout_add (7500,
gdisplay_update_icon_timer,
gdisp);
if (!gdisp->icon_idle_id)
gdisp->icon_idle_id = g_idle_add (gdisplay_update_icon_invoker,
gdisp);
}
}
else
{
g_printerr ("gdisplay_update_icon_scheduler called for invalid gdisplay\n");
}
}
/* this timer is necessary to check if the icon is invalid and if yes
* adds the update function to the idle loop
*/
gboolean
gdisplay_update_icon_timer (gpointer data)
{
GDisplay *gdisp;
/* we should check this for validity... */
gdisp = (GDisplay *) data;
if (gdisp->icon_needs_update == 1 && !gdisp->icon_idle_id)
gdisp->icon_idle_id = g_idle_add (gdisplay_update_icon_invoker, gdisp);
return TRUE;
}
/* Just a dumb invoker for gdisplay_update_icon () */
gboolean
gdisplay_update_icon_invoker (gpointer data)
{
GDisplay *gdisp;
/* we should check this for validity... */
gdisp = (GDisplay *) data;
gdisplay_update_icon (gdisp);
gdisp->icon_idle_id = 0;
return FALSE;
}
1997-11-25 06:05:25 +08:00
void
gdisplay_draw_guides (GDisplay *gdisp)
{
GList *list;
GimpGuide *guide;
1997-11-25 06:05:25 +08:00
if (gdisp->draw_guides)
{
for (list = gdisp->gimage->guides; list; list = g_list_next (list))
1997-11-25 06:05:25 +08:00
{
guide = (GimpGuide *) list->data;
1997-11-25 06:05:25 +08:00
gdisplay_draw_guide (gdisp, guide, FALSE);
}
}
}
void
gdisplay_draw_guide (GDisplay *gdisp,
GimpGuide *guide,
gboolean active)
1997-11-25 06:05:25 +08:00
{
static GdkGC *normal_hgc = NULL;
static GdkGC *active_hgc = NULL;
static GdkGC *normal_vgc = NULL;
static GdkGC *active_vgc = NULL;
static gboolean initialize = TRUE;
gint x1, x2;
gint y1, y2;
gint w, h;
gint x, y;
1997-11-25 06:05:25 +08:00
if (guide->position < 0)
return;
if (initialize)
{
GdkGCValues values;
const char stipple[] =
1997-11-25 06:05:25 +08:00
{
0xF0, /* ####---- */
0xE1, /* ###----# */
0xC3, /* ##----## */
0x87, /* #----### */
0x0F, /* ----#### */
0x1E, /* ---####- */
0x3C, /* --####-- */
0x78, /* -####--- */
};
initialize = FALSE;
values.foreground.pixel = gdisplay_black_pixel (gdisp);
values.background.pixel = g_normal_guide_pixel;
values.fill = GDK_OPAQUE_STIPPLED;
values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window,
(char*) stipple, 8, 1);
1997-11-25 06:05:25 +08:00
normal_hgc = gdk_gc_new_with_values (gdisp->canvas->window, &values,
GDK_GC_FOREGROUND |
GDK_GC_BACKGROUND |
GDK_GC_FILL |
GDK_GC_STIPPLE);
values.background.pixel = g_active_guide_pixel;
active_hgc = gdk_gc_new_with_values (gdisp->canvas->window, &values,
GDK_GC_FOREGROUND |
GDK_GC_BACKGROUND |
GDK_GC_FILL |
GDK_GC_STIPPLE);
values.foreground.pixel = gdisplay_black_pixel (gdisp);
values.background.pixel = g_normal_guide_pixel;
values.fill = GDK_OPAQUE_STIPPLED;
values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window,
(char*) stipple, 1, 8);
1997-11-25 06:05:25 +08:00
normal_vgc = gdk_gc_new_with_values (gdisp->canvas->window, &values,
GDK_GC_FOREGROUND |
GDK_GC_BACKGROUND |
GDK_GC_FILL |
GDK_GC_STIPPLE);
values.background.pixel = g_active_guide_pixel;
active_vgc = gdk_gc_new_with_values (gdisp->canvas->window, &values,
GDK_GC_FOREGROUND |
GDK_GC_BACKGROUND |
GDK_GC_FILL |
GDK_GC_STIPPLE);
}
gdisplay_transform_coords (gdisp, 0, 0, &x1, &y1, FALSE);
gdisplay_transform_coords (gdisp,
gdisp->gimage->width, gdisp->gimage->height,
&x2, &y2, FALSE);
1997-11-25 06:05:25 +08:00
gdk_window_get_size (gdisp->canvas->window, &w, &h);
if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0;
if (x2 > w) x2 = w;
if (y2 > h) y2 = h;
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
if (guide->orientation == ORIENTATION_HORIZONTAL)
1997-11-25 06:05:25 +08:00
{
gdisplay_transform_coords (gdisp, 0, guide->position, &x, &y, FALSE);
if (active)
gdk_draw_line (gdisp->canvas->window, active_hgc, x1, y, x2, y);
else
gdk_draw_line (gdisp->canvas->window, normal_hgc, x1, y, x2, y);
}
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
else if (guide->orientation == ORIENTATION_VERTICAL)
1997-11-25 06:05:25 +08:00
{
gdisplay_transform_coords (gdisp, guide->position, 0, &x, &y, FALSE);
if (active)
gdk_draw_line (gdisp->canvas->window, active_vgc, x, y1, x, y2);
else
gdk_draw_line (gdisp->canvas->window, normal_vgc, x, y1, x, y2);
}
}
GimpGuide *
1997-11-25 06:05:25 +08:00
gdisplay_find_guide (GDisplay *gdisp,
gdouble x,
gdouble y)
1997-11-25 06:05:25 +08:00
{
GList *list;
GimpGuide *guide;
gint offset_x, offset_y;
gdouble scalex, scaley;
gdouble pos;
1997-11-25 06:05:25 +08:00
if (gdisp->draw_guides)
{
offset_x = gdisp->offset_x - gdisp->disp_xoffset;
offset_y = gdisp->offset_y - gdisp->disp_yoffset;
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
1997-11-25 06:05:25 +08:00
for (list = gdisp->gimage->guides; list; list = g_list_next (list))
1997-11-25 06:05:25 +08:00
{
guide = (GimpGuide *) list->data;
1997-11-25 06:05:25 +08:00
switch (guide->orientation)
{
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
case ORIENTATION_HORIZONTAL:
pos = scaley * guide->position - offset_y;
if ((guide->position != -1) &&
(pos > (y - EPSILON)) &&
1997-11-25 06:05:25 +08:00
(pos < (y + EPSILON)))
return guide;
break;
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
if ((guide->position != -1) &&
(pos > (x - EPSILON)) &&
1997-11-25 06:05:25 +08:00
(pos < (x + EPSILON)))
return guide;
break;
default:
break;
1997-11-25 06:05:25 +08:00
}
}
}
return NULL;
}
gboolean
1997-11-25 06:05:25 +08:00
gdisplay_snap_point (GDisplay *gdisp,
gdouble x,
gdouble y,
gdouble *tx,
gdouble *ty)
1997-11-25 06:05:25 +08:00
{
GList *list;
GimpGuide *guide;
gdouble scalex, scaley;
gdouble pos;
gint offset_x, offset_y;
gint minhdist, minvdist;
gint dist;
gboolean snapped = FALSE;
1997-11-25 06:05:25 +08:00
*tx = x;
*ty = y;
if (gdisp->draw_guides &&
gdisp->snap_to_guides &&
gdisp->gimage->guides)
{
offset_x = gdisp->offset_x - gdisp->disp_xoffset;
offset_y = gdisp->offset_y - gdisp->disp_yoffset;
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
1997-11-25 06:05:25 +08:00
minhdist = G_MAXINT;
minvdist = G_MAXINT;
for (list = gdisp->gimage->guides; list; list = g_list_next (list))
1997-11-25 06:05:25 +08:00
{
guide = (GimpGuide *) list->data;
1997-11-25 06:05:25 +08:00
switch (guide->orientation)
{
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
case ORIENTATION_HORIZONTAL:
pos = scaley * guide->position - offset_y;
1997-11-25 06:05:25 +08:00
if ((pos > (y - EPSILON)) &&
(pos < (y + EPSILON)))
{
dist = (int) pos - y;
1997-11-25 06:05:25 +08:00
dist = ABS (dist);
if (dist < minhdist)
{
minhdist = dist;
*ty = pos;
snapped = TRUE;
1997-11-25 06:05:25 +08:00
}
}
break;
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
case ORIENTATION_VERTICAL:
pos = scalex * guide->position - offset_x;
1997-11-25 06:05:25 +08:00
if ((pos > (x - EPSILON)) &&
(pos < (x + EPSILON)))
{
dist = (int) pos - x;
1997-11-25 06:05:25 +08:00
dist = ABS (dist);
if (dist < minvdist)
{
minvdist = dist;
*tx = pos;
snapped = TRUE;
1997-11-25 06:05:25 +08:00
}
}
break;
default:
break;
1997-11-25 06:05:25 +08:00
}
}
}
return snapped;
1997-11-25 06:05:25 +08:00
}
void
gdisplay_snap_rectangle (GDisplay *gdisp,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gdouble *tx1,
gdouble *ty1)
1997-11-25 06:05:25 +08:00
{
gdouble nx1, ny1;
gdouble nx2, ny2;
gboolean snap1, snap2;
1997-11-25 06:05:25 +08:00
*tx1 = x1;
*ty1 = y1;
snap1 = gdisplay_snap_point (gdisp, x1, y1, &nx1, &ny1);
snap2 = gdisplay_snap_point (gdisp, x2, y2, &nx2, &ny2);
if (snap1 || snap2)
1997-11-25 06:05:25 +08:00
{
if (x1 != nx1)
1997-11-25 06:05:25 +08:00
*tx1 = nx1;
else if (x2 != nx2)
1997-11-25 06:05:25 +08:00
*tx1 = x1 + (nx2 - x2);
if (y1 != ny1)
1997-11-25 06:05:25 +08:00
*ty1 = ny1;
else if (y2 != ny2)
1997-11-25 06:05:25 +08:00
*ty1 = y1 + (ny2 - y2);
}
}
void
gdisplay_draw_cursor (GDisplay *gdisp)
{
gint x = gdisp->cursor_x;
gint y = gdisp->cursor_y;
gdk_draw_line (gdisp->canvas->window,
gdisp->canvas->style->white_gc,
x - 7, y-1, x + 7, y-1);
gdk_draw_line (gdisp->canvas->window,
gdisp->canvas->style->black_gc,
x - 7, y, x + 7, y);
gdk_draw_line (gdisp->canvas->window,
gdisp->canvas->style->white_gc,
x - 7, y+1, x + 7, y+1);
gdk_draw_line (gdisp->canvas->window,
gdisp->canvas->style->white_gc,
x-1, y - 7, x-1, y + 7);
gdk_draw_line (gdisp->canvas->window,
gdisp->canvas->style->black_gc,
x, y - 7, x, y + 7);
gdk_draw_line (gdisp->canvas->window,
gdisp->canvas->style->white_gc,
x+1, y - 7, x+1, y + 7);
}
void
gdisplay_update_cursor (GDisplay *gdisp,
gint x,
gint y)
{
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gint new_cursor;
gchar buffer[CURSOR_STR_LENGTH];
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gint t_x;
gint t_y;
new_cursor = gdisp->draw_cursor && gdisp->proximity;
/* Erase old cursor, if necessary */
if (gdisp->have_cursor && (!new_cursor || x != gdisp->cursor_x ||
y != gdisp->cursor_y))
{
gdisplay_expose_area (gdisp, gdisp->cursor_x - 7,
gdisp->cursor_y - 7,
15, 15);
if (!new_cursor)
{
gdisp->have_cursor = FALSE;
gdisplay_flush (gdisp);
}
}
gdisplay_untransform_coords (gdisp, x, y, &t_x, &t_y, FALSE, FALSE);
1998-08-14 02:53:12 +08:00
if (t_x < 0 ||
t_y < 0 ||
t_x >= gdisp->gimage->width ||
t_y >= gdisp->gimage->height)
{
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), "");
info_window_update_extended (gdisp, -1, -1);
}
else
{
if (gdisp->dot_for_dot)
{
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str, "", t_x, ", ", t_y);
}
else /* show real world units */
{
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf
(buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str,
"",
(gdouble) t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(gdouble) t_y * unit_factor / gdisp->gimage->yresolution);
}
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_label_set_text (GTK_LABEL (gdisp->cursor_label), buffer);
info_window_update_extended (gdisp, t_x, t_y);
}
gdisp->have_cursor = new_cursor;
gdisp->cursor_x = x;
gdisp->cursor_y = y;
if (new_cursor)
gdisplay_flush (gdisp);
}
1997-11-25 06:05:25 +08:00
void
gdisplay_set_dot_for_dot (GDisplay *gdisp,
gboolean dot_for_dot)
{
if (dot_for_dot != gdisp->dot_for_dot)
{
gdisp->dot_for_dot = dot_for_dot;
gdisplay_resize_cursor_label (gdisp);
resize_display (gdisp, gimprc.allow_resize_windows, TRUE);
}
}
void
gdisplay_resize_cursor_label (GDisplay *gdisp)
{
/* Set a proper size for the coordinates display in the statusbar. */
gchar buffer[CURSOR_STR_LENGTH];
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gint cursor_label_width;
gint label_frame_size_difference;
if (gdisp->dot_for_dot)
{
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
g_snprintf (gdisp->cursor_format_str, sizeof (gdisp->cursor_format_str),
"%%s%%d%%s%%d");
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
g_snprintf (buffer, sizeof (buffer), gdisp->cursor_format_str,
"", gdisp->gimage->width, ", ", gdisp->gimage->height);
}
else /* show real world units */
{
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
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
g_snprintf (gdisp->cursor_format_str, sizeof (gdisp->cursor_format_str),
"%%s%%.%df%%s%%.%df %s",
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_symbol (gdisp->gimage->unit));
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
g_snprintf (buffer, sizeof (buffer), gdisp->cursor_format_str,
"",
(gdouble) gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(gdouble) gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width (gtk_widget_get_style (gdisp->cursor_label)->font, buffer);
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
/* find out how many pixels the label's parent frame is bigger than
* the label itself
*/
label_frame_size_difference =
gdisp->cursor_label->parent->allocation.width -
gdisp->cursor_label->allocation.width;
gtk_widget_set_usize (gdisp->cursor_label, cursor_label_width, -1);
if (label_frame_size_difference) /* don't resize if this is a new display */
gtk_widget_set_usize (gdisp->cursor_label->parent,
cursor_label_width + label_frame_size_difference, -1);
gdisplay_update_cursor (gdisp, gdisp->cursor_x, gdisp->cursor_y);
}
1997-11-25 06:05:25 +08:00
void
gdisplay_remove_and_delete (GDisplay *gdisp)
{
/* remove the display from the list */
display_list = g_slist_remove (display_list, (void *) gdisp);
1997-11-25 06:05:25 +08:00
gdisplay_delete (gdisp);
}
static void
gdisplay_add_update_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h)
1997-11-25 06:05:25 +08:00
{
GimpArea * ga;
1997-11-25 06:05:25 +08:00
ga = (GimpArea *) g_malloc (sizeof (GimpArea));
ga->x1 = CLAMP (x, 0, gdisp->gimage->width);
ga->y1 = CLAMP (y, 0, gdisp->gimage->height);
ga->x2 = CLAMP (x + w, 0, gdisp->gimage->width);
ga->y2 = CLAMP (y + h, 0, gdisp->gimage->height);
1997-11-25 06:05:25 +08:00
gdisp->update_areas = gdisplay_process_area_list (gdisp->update_areas, ga);
}
static void
gdisplay_add_display_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h)
1997-11-25 06:05:25 +08:00
{
GimpArea * ga;
1997-11-25 06:05:25 +08:00
ga = g_new (GimpArea, 1);
1997-11-25 06:05:25 +08:00
ga->x1 = CLAMP (x, 0, gdisp->disp_width);
ga->y1 = CLAMP (y, 0, gdisp->disp_height);
ga->x2 = CLAMP (x + w, 0, gdisp->disp_width);
ga->y2 = CLAMP (y + h, 0, gdisp->disp_height);
1997-11-25 06:05:25 +08:00
gdisp->display_areas = gdisplay_process_area_list (gdisp->display_areas, ga);
}
static void
gdisplay_paint_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h)
1997-11-25 06:05:25 +08:00
{
gint x1, y1, x2, y2;
1997-11-25 06:05:25 +08:00
/* Bounds check */
x1 = CLAMP (x, 0, gdisp->gimage->width);
y1 = CLAMP (y, 0, gdisp->gimage->height);
x2 = CLAMP (x + w, 0, gdisp->gimage->width);
y2 = CLAMP (y + h, 0, gdisp->gimage->height);
x = x1;
y = y1;
w = (x2 - x1);
h = (y2 - y1);
1997-11-25 06:05:25 +08:00
/* calculate the extents of the update as limited by what's visible */
gdisplay_untransform_coords (gdisp, 0, 0, &x1, &y1, FALSE, FALSE);
gdisplay_untransform_coords (gdisp, gdisp->disp_width, gdisp->disp_height,
&x2, &y2, FALSE, FALSE);
1997-11-25 06:05:25 +08:00
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
gimp_image_invalidate (gdisp->gimage, x, y, w, h, x1, y1, x2, y2);
1997-11-25 06:05:25 +08:00
/* display the area */
gdisplay_transform_coords (gdisp, x, y, &x1, &y1, FALSE);
gdisplay_transform_coords (gdisp, x + w, y + h, &x2, &y2, FALSE);
gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1));
1997-11-25 06:05:25 +08:00
}
static void
gdisplay_display_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h)
{
gint sx, sy;
gint x1, y1;
gint x2, y2;
gint dx, dy;
gint i, j;
guchar *buf;
gint bpp, bpl;
#ifdef DISPLAY_FILTERS
GList *list;
#endif /* DISPLAY_FILTERS */
buf = gximage_get_data ();
bpp = gximage_get_bpp ();
bpl = gximage_get_bpl ();
1997-11-25 06:05:25 +08:00
sx = SCALEX (gdisp, gdisp->gimage->width);
sy = SCALEY (gdisp, gdisp->gimage->height);
1997-11-25 06:05:25 +08:00
/* Bounds check */
x1 = CLAMP (x, 0, gdisp->disp_width);
y1 = CLAMP (y, 0, gdisp->disp_height);
x2 = CLAMP (x + w, 0, gdisp->disp_width);
y2 = CLAMP (y + h, 0, gdisp->disp_height);
1997-11-25 06:05:25 +08:00
if (y1 < gdisp->disp_yoffset)
1997-11-25 06:05:25 +08:00
{
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
x, y, w, gdisp->disp_yoffset - y);
/* X X X
. # .
. . . */
1997-11-25 06:05:25 +08:00
y1 = gdisp->disp_yoffset;
1997-11-25 06:05:25 +08:00
}
if (x1 < gdisp->disp_xoffset)
1997-11-25 06:05:25 +08:00
{
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
x, y1, gdisp->disp_xoffset - x, h);
/* . . .
X # .
X . . */
1997-11-25 06:05:25 +08:00
x1 = gdisp->disp_xoffset;
1997-11-25 06:05:25 +08:00
}
if (x2 > (gdisp->disp_xoffset + sx))
{
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
gdisp->disp_xoffset + sx, y1,
x2 - (gdisp->disp_xoffset + sx), h - (y1-y));
/* . . .
. # X
. . X */
1997-11-25 06:05:25 +08:00
x2 = gdisp->disp_xoffset + sx;
}
if (y2 > (gdisp->disp_yoffset + sy))
{
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
x1, gdisp->disp_yoffset + sy,
x2-x1,
y2 - (gdisp->disp_yoffset + sy));
/* . . .
. # .
. X . */
1997-11-25 06:05:25 +08:00
y2 = gdisp->disp_yoffset + sy;
}
/* display the image in GXIMAGE_WIDTH x GXIMAGE_HEIGHT sized chunks */
for (i = y1; i < y2; i += GXIMAGE_HEIGHT)
for (j = x1; j < x2; j += GXIMAGE_WIDTH)
{
dx = MIN (x2 - j, GXIMAGE_WIDTH);
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset,
dx, dy);
#if 0
/* Invalidate the projection just after we render it! */
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
gimp_image_invalidate_without_render (gdisp->gimage,
j - gdisp->disp_xoffset,
i - gdisp->disp_yoffset,
dx, dy,
0, 0, 0, 0);
#endif
#ifdef DISPLAY_FILTERS
list = gdisp->cd_list;
while (list)
{
ColorDisplayNode *node = (ColorDisplayNode *) list->data;
node->cd_convert (node->cd_ID, buf, dx, dy, bpp, bpl);
list = list->next;
}
#endif /* DISPLAY_FILTERS */
1997-11-25 06:05:25 +08:00
gximage_put (gdisp->canvas->window,
j, i, dx, dy,
gdisp->offset_x,
gdisp->offset_y);
1997-11-25 06:05:25 +08:00
}
}
gint
1997-11-25 06:05:25 +08:00
gdisplay_mask_value (GDisplay *gdisp,
gint x,
gint y)
1997-11-25 06:05:25 +08:00
{
/* move the coordinates from screen space to image space */
gdisplay_untransform_coords (gdisp, x, y, &x, &y, FALSE, 0);
return gimage_mask_value (gdisp->gimage, x, y);
}
gint
1997-11-25 06:05:25 +08:00
gdisplay_mask_bounds (GDisplay *gdisp,
gint *x1,
gint *y1,
gint *x2,
gint *y2)
1997-11-25 06:05:25 +08:00
{
GimpLayer *layer;
gint off_x;
gint off_y;
1997-11-25 06:05:25 +08:00
/* If there is a floating selection, handle things differently */
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
if ((layer = gimp_image_floating_sel (gdisp->gimage)))
1997-11-25 06:05:25 +08:00
{
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if (! gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage),
x1, y1, x2, y2))
1997-11-25 06:05:25 +08:00
{
*x1 = off_x;
*y1 = off_y;
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
*x2 = off_x + gimp_drawable_width (GIMP_DRAWABLE (layer));
*y2 = off_y + gimp_drawable_height (GIMP_DRAWABLE (layer));
1997-11-25 06:05:25 +08:00
}
else
{
*x1 = MIN (off_x, *x1);
*y1 = MIN (off_y, *y1);
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
*x2 = MAX (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)), *x2);
*y2 = MAX (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer)), *y2);
1997-11-25 06:05:25 +08:00
}
}
else if (! gimp_channel_bounds (gimp_image_get_mask (gdisp->gimage),
x1, y1, x2, y2))
1997-11-25 06:05:25 +08:00
return FALSE;
gdisplay_transform_coords (gdisp, *x1, *y1, x1, y1, 0);
gdisplay_transform_coords (gdisp, *x2, *y2, x2, y2, 0);
/* Make sure the extents are within bounds */
*x1 = CLAMP (*x1, 0, gdisp->disp_width);
*y1 = CLAMP (*y1, 0, gdisp->disp_height);
*x2 = CLAMP (*x2, 0, gdisp->disp_width);
*y2 = CLAMP (*y2, 0, gdisp->disp_height);
1997-11-25 06:05:25 +08:00
return TRUE;
}
void
gdisplay_transform_coords (GDisplay *gdisp,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean use_offsets)
1997-11-25 06:05:25 +08:00
{
gdouble scalex;
gdouble scaley;
gint offset_x;
gint offset_y;
1997-11-25 06:05:25 +08:00
/* transform from image coordinates to screen coordinates */
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
1997-11-25 06:05:25 +08:00
if (use_offsets)
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&offset_x, &offset_y);
1997-11-25 06:05:25 +08:00
else
{
offset_x = offset_y = 0;
}
*nx = (int) (scalex * (x + offset_x) - gdisp->offset_x);
*ny = (int) (scaley * (y + offset_y) - gdisp->offset_y);
1997-11-25 06:05:25 +08:00
*nx += gdisp->disp_xoffset;
*ny += gdisp->disp_yoffset;
}
void
gdisplay_untransform_coords (GDisplay *gdisp,
gint x,
gint y,
gint *nx,
gint *ny,
gboolean round,
gboolean use_offsets)
1997-11-25 06:05:25 +08:00
{
gdouble scalex;
gdouble scaley;
gint offset_x;
gint offset_y;
1997-11-25 06:05:25 +08:00
x -= gdisp->disp_xoffset;
y -= gdisp->disp_yoffset;
/* transform from screen coordinates to image coordinates */
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
1997-11-25 06:05:25 +08:00
if (use_offsets)
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&offset_x, &offset_y);
1997-11-25 06:05:25 +08:00
else
{
offset_x = offset_y = 0;
}
if (round)
{
*nx = ROUND ((x + gdisp->offset_x) / scalex - offset_x);
*ny = ROUND ((y + gdisp->offset_y) / scaley - offset_y);
1997-11-25 06:05:25 +08:00
}
else
{
*nx = (int) ((x + gdisp->offset_x) / scalex - offset_x);
*ny = (int) ((y + gdisp->offset_y) / scaley - offset_y);
1997-11-25 06:05:25 +08:00
}
}
void
gdisplay_transform_coords_f (GDisplay *gdisp,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets)
1997-11-25 06:05:25 +08:00
{
gdouble scalex;
gdouble scaley;
gint offset_x;
gint offset_y;
1997-11-25 06:05:25 +08:00
/* transform from gimp coordinates to screen coordinates */
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
1997-11-25 06:05:25 +08:00
if (use_offsets)
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&offset_x, &offset_y);
1997-11-25 06:05:25 +08:00
else
{
offset_x = offset_y = 0;
}
*nx = scalex * (x + offset_x) - gdisp->offset_x;
*ny = scaley * (y + offset_y) - gdisp->offset_y;
1997-11-25 06:05:25 +08:00
*nx += gdisp->disp_xoffset;
*ny += gdisp->disp_yoffset;
}
void
gdisplay_untransform_coords_f (GDisplay *gdisp,
gdouble x,
gdouble y,
gdouble *nx,
gdouble *ny,
gboolean use_offsets)
1997-11-25 06:05:25 +08:00
{
gdouble scalex;
gdouble scaley;
gint offset_x;
gint offset_y;
1997-11-25 06:05:25 +08:00
x -= gdisp->disp_xoffset;
y -= gdisp->disp_yoffset;
/* transform from screen coordinates to gimp coordinates */
scalex = SCALEFACTOR_X (gdisp);
scaley = SCALEFACTOR_Y (gdisp);
1997-11-25 06:05:25 +08:00
if (use_offsets)
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
&offset_x, &offset_y);
1997-11-25 06:05:25 +08:00
else
{
offset_x = offset_y = 0;
}
*nx = (x + gdisp->offset_x) / scalex - offset_x;
*ny = (y + gdisp->offset_y) / scaley - offset_y;
1997-11-25 06:05:25 +08:00
}
/* install and remove tool cursor from gdisplay... */
void
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gdisplay_real_install_tool_cursor (GDisplay *gdisp,
GdkCursorType cursor_type,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier,
gboolean always_install)
1997-11-25 06:05:25 +08:00
{
if (cursor_type != GIMP_BAD_CURSOR)
{
switch (gimprc.cursor_mode)
{
case CURSOR_MODE_TOOL_ICON:
break;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
case CURSOR_MODE_TOOL_CROSSHAIR:
cursor_type = GIMP_CROSSHAIR_SMALL_CURSOR;
break;
case CURSOR_MODE_CROSSHAIR:
cursor_type = GIMP_CROSSHAIR_CURSOR;
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
tool_cursor = GIMP_TOOL_CURSOR_NONE;
modifier = GIMP_CURSOR_MODIFIER_NONE;
break;
}
}
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
if (gdisp->current_cursor != cursor_type ||
gdisp->tool_cursor != tool_cursor ||
gdisp->cursor_modifier != modifier ||
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
always_install)
1997-11-25 06:05:25 +08:00
{
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
GdkCursor *cursor;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisp->current_cursor = cursor_type;
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gdisp->tool_cursor = tool_cursor;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisp->cursor_modifier = modifier;
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
cursor = gimp_cursor_new (cursor_type,
tool_cursor,
modifier);
gdk_window_set_cursor (gdisp->canvas->window, cursor);
gdk_cursor_destroy (cursor);
}
}
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
void
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gdisplay_install_tool_cursor (GDisplay *gdisp,
GdkCursorType cursor_type,
GimpToolCursorType tool_cursor,
GimpCursorModifier modifier)
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
{
if (!gdisp->using_override_cursor)
gdisplay_real_install_tool_cursor (gdisp,
cursor_type,
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
tool_cursor,
modifier,
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
FALSE);
}
void
gdisplay_install_override_cursor (GDisplay *gdisp,
GdkCursorType cursor_type)
{
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
if (!gdisp->using_override_cursor ||
(gdisp->using_override_cursor &&
(gdisp->override_cursor != cursor_type)))
{
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
GdkCursor *cursor;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisp->override_cursor = cursor_type;
gdisp->using_override_cursor = TRUE;
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
cursor = gimp_cursor_new (cursor_type,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
gdk_window_set_cursor (gdisp->canvas->window, cursor);
gdk_cursor_destroy (cursor);
1997-11-25 06:05:25 +08:00
}
}
void
gdisplay_remove_override_cursor (GDisplay *gdisp)
{
if (gdisp->using_override_cursor)
{
gdisp->using_override_cursor = FALSE;
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
gdisplay_real_install_tool_cursor (gdisp,
gdisp->current_cursor,
updated. 2001-02-24 Michael Natterer <mitch@gimp.org> * TODO.xml: updated. * app/appenums.h * app/apptypes.h: prefixed the cursor stuff with "Gimp", added the new stock tool cursor enum. Removed the old ToolType enum. * app/cursorutil.[ch] * app/gdisplay.[ch]: removed the old ToolType enum and prefixed the functions with "gimp_". Also stripped all "toggle cursor" stuff from the cursor code, so the new API is easier and not depending on the tool system. All existing tool cursors can be used via the new stock tool cursor enum, so no tool has to fiddle around with bitmap cursors. There will be an cursorutil function for registering stock tool cursor types on the fly. * app/disp_callbacks.c * app/scroll.[ch]: moved the display scrollbar callbacks from scroll.[ch] to disp_callbacks.c. Removed some crap from scroll.h * app/tools/tool.[ch]: removed the BitmapCursor pointers from the tool class struct and add cursor and toggle cursor IDs to the GimpTool struct. Work in progress. * app/dialog_handler.c * app/tools/bezier_select.c * app/tools/blend.c * app/tools/bucket_fill.c * app/tools/by_color_select.c * app/tools/clone.c * app/tools/color_picker.c * app/tools/convolve.c * app/tools/crop.c * app/tools/dodgeburn.c * app/tools/edit_selection.c * app/tools/ellipse_select.c * app/tools/flip_tool.c * app/tools/free_select.c * app/tools/fuzzy_select.c * app/tools/ink.c * app/tools/iscissors.c * app/tools/magnify.c * app/tools/measure.c * app/tools/move.c * app/tools/paint_core.[ch] * app/tools/perspective_tool.c * app/tools/rect_select.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.[ch]: changed accordingly. Did this "blind" for most tools because they don't compile. The changes are minimal, so there should be no conflicts.
2001-02-25 03:29:47 +08:00
gdisp->tool_cursor,
gdisp->cursor_modifier,
Cursor patch II: This is only the logic inside the cursor system and not 2000-06-09 Michael Natterer <mitch@gimp.org> Cursor patch II: This is only the logic inside the cursor system and not yet used. * app/cursorutil.[ch]: [gimp]_change_win_cursor() take lots of parameters now and compose cursors from up to three cursor bitmaps/masks. * app/gdisplay.[ch]: As a test, create a hardcoded example cursor if "Cursor Mode" is set to "Tool Icon with Crosshair" in prefs. * app/curves.c * app/dialog_handler.c * app/scroll.c: changed the calls to the win_cursor function. * app/tools.[ch]: added a cursor and a toggle cursor to the ToolInfo structure of all tools. * app/toolsF.h: new ToolType TOOL_TYPE_NONE. * app/gimpdnd.c * app/interface.c: check for silly filenames in the file dnd callback. Closes #13733. * Makefile.am * cursors/bucket_fill_small.xbm * cursors/bucket_fill_small_mask.xbm * cursors/crop_small.xbm * cursors/crop_small_mask.xbm * cursors/crosshair_small.xbm * cursors/crosshair_small_mask.xbm * cursors/ellipse_select_small.xbm * cursors/ellipse_select_small_mask.xbm * cursors/eraser_small.xbm * cursors/eraser_small_mask.xbm * cursors/free_select_small.xbm * cursors/free_select_small_mask.xbm * cursors/fuzzy_select_small.xbm * cursors/fuzzy_select_small_mask.xbm * cursors/intersect.xbm * cursors/intersect_mask.xbm * cursors/minus.xbm * cursors/minus_mask.xbm * cursors/move.xbm * cursors/move_mask.xbm * cursors/paintbrush_small.xbm * cursors/paintbrush_small_mask.xbm * cursors/pencil_small.xbm * cursors/pencil_small_mask.xbm * cursors/plus.xbm * cursors/plus_mask.xbm * cursors/rect_select_small.xbm * cursors/rect_select_small_mask.xbm * cursors/resize_small.xbm * cursors/resize_small_mask.xbm * cursors/zoom.xbm * cursors/zoom_mask.xbm * cursors/zoom_small.xbm * cursors/zoom_small_mask.xbm: new files extracted from Tigert's gimp-tool-cursors.xcf created at GimpCon. Tigert, I'll commit the xcf as soon as I've added empty layers with the names of the cursors that are missing. * cursors/mouse.xbm * cursors/mouse_mask.xbm: made it 32x32 to allow for cursor composition.
2000-06-09 20:31:19 +08:00
TRUE);
}
}
1997-11-25 06:05:25 +08:00
void
gdisplay_remove_tool_cursor (GDisplay *gdisp)
{
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
gdk_window_set_cursor (gdisp->canvas->window, NULL);
1997-11-25 06:05:25 +08:00
}
void
gdisplay_set_menu_sensitivity (GDisplay *gdisp)
{
GimpImageBaseType base_type = 0;
GimpImageType type = -1;
GimpDrawable *drawable = NULL;
GimpLayer *layer = NULL;
gboolean fs = FALSE;
gboolean aux = FALSE;
gboolean lm = FALSE;
gboolean lp = FALSE;
gboolean alpha = FALSE;
gint lind = -1;
gint lnum = -1;
if (gdisp)
{
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
base_type = gimp_image_base_type (gdisp->gimage);
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
fs = (gimp_image_floating_sel (gdisp->gimage) != NULL);
aux = (gimp_image_get_active_channel (gdisp->gimage) != NULL);
lp = ! gimp_image_is_empty (gdisp->gimage);
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
drawable = gimp_image_active_drawable (gdisp->gimage);
if (drawable)
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
type = gimp_drawable_type (drawable);
if (lp)
{
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +08:00
layer = gimp_image_get_active_layer (gdisp->gimage);
if (layer)
{
lm = gimp_layer_get_mask (layer) ? TRUE : FALSE;
alpha = gimp_layer_has_alpha (layer);
lind = gimp_image_get_layer_index (gdisp->gimage, layer);
}
lnum = gimp_container_num_children (gdisp->gimage->layers);
}
}
#define SET_SENSITIVE(menu,condition) \
menus_set_sensitive ("<Image>/" menu, (condition) != 0)
#define SET_STATE(menu,condition) \
menus_set_state ("<Image>/" menu, (condition) != 0)
SET_SENSITIVE ("File/Save", gdisp && drawable);
SET_SENSITIVE ("File/Save as...", gdisp && drawable);
SET_SENSITIVE ("File/Save a Copy as...", gdisp && drawable);
SET_SENSITIVE ("File/Revert...", gdisp && GIMP_OBJECT (gdisp->gimage)->name);
SET_SENSITIVE ("File/Close", gdisp);
SET_SENSITIVE ("Edit", gdisp);
SET_SENSITIVE ("Edit/Buffer", gdisp);
if (gdisp)
{
/* Interactive tools such as CURVES, COLOR_BALANCE, LEVELS disable */
/* undo to fake some kind of atomic behaviour. G. R. Osgood #14072 */
if (gimp_image_undo_is_enabled (gdisp->gimage))
{
/* If undo/redo stacks are empty, disable respective menu */
SET_SENSITIVE ("Edit/Undo", undo_get_undo_name (gdisp->gimage));
SET_SENSITIVE ("Edit/Redo", undo_get_redo_name (gdisp->gimage));
}
else
{
SET_SENSITIVE ("Edit/Undo", FALSE);
SET_SENSITIVE ("Edit/Redo", FALSE);
}
SET_SENSITIVE ("Edit/Cut", lp);
SET_SENSITIVE ("Edit/Copy", lp);
SET_SENSITIVE ("Edit/Buffer/Cut Named...", lp);
SET_SENSITIVE ("Edit/Buffer/Copy Named...", lp);
SET_SENSITIVE ("Edit/Clear", lp);
SET_SENSITIVE ("Edit/Fill with FG Color", lp);
SET_SENSITIVE ("Edit/Fill with BG Color", lp);
SET_SENSITIVE ("Edit/Stroke", lp);
}
SET_SENSITIVE ("Select", gdisp && lp);
1999-12-14 22:10:34 +08:00
SET_SENSITIVE ("Select/Save to Channel", !fs);
SET_SENSITIVE ("View", gdisp);
SET_SENSITIVE ("View/Zoom", gdisp);
if (gdisp)
1997-11-25 06:05:25 +08:00
{
SET_STATE ("View/Toggle Selection", !gdisp->select->hidden);
SET_STATE ("View/Toggle Rulers",
GTK_WIDGET_VISIBLE (gdisp->origin) ? 1 : 0);
SET_STATE ("View/Toggle Guides", gdisp->draw_guides);
1999-12-14 22:10:34 +08:00
SET_STATE ("View/Snap to Guides", gdisp->snap_to_guides);
SET_STATE ("View/Toggle Statusbar",
GTK_WIDGET_VISIBLE (gdisp->statusarea) ? 1 : 0);
1999-12-14 22:10:34 +08:00
SET_STATE ("View/Dot for Dot", gdisp->dot_for_dot);
1997-11-25 06:05:25 +08:00
}
SET_SENSITIVE ("Image", gdisp);
SET_SENSITIVE ("Image/Mode", gdisp);
SET_SENSITIVE ("Image/Colors", gdisp);
SET_SENSITIVE ("Image/Colors/Auto", gdisp);
SET_SENSITIVE ("Image/Alpha", gdisp);
SET_SENSITIVE ("Image/Transforms", gdisp);
SET_SENSITIVE ("Image/Transforms/Rotate", gdisp);
if (gdisp)
{
SET_SENSITIVE ("Image/Mode/RGB", (base_type != RGB));
SET_SENSITIVE ("Image/Mode/Grayscale", (base_type != GRAY));
SET_SENSITIVE ("Image/Mode/Indexed...", (base_type != INDEXED));
SET_SENSITIVE ("Image/Histogram...", lp);
SET_SENSITIVE ("Image/Colors", lp);
SET_SENSITIVE ("Image/Colors/Color Balance...", (base_type == RGB));
SET_SENSITIVE ("Image/Colors/Hue-Saturation...", (base_type == RGB));
SET_SENSITIVE ("Image/Colors/Brightness-Contrast...", (base_type != INDEXED));
SET_SENSITIVE ("Image/Colors/Threshold...", (base_type != INDEXED));
SET_SENSITIVE ("Image/Colors/Levels...", (base_type != INDEXED));
SET_SENSITIVE ("Image/Colors/Curves...", (base_type != INDEXED));
SET_SENSITIVE ("Image/Colors/Desaturate", (base_type == RGB));
SET_SENSITIVE ("Image/Colors/Posterize...", (base_type != INDEXED));
SET_SENSITIVE ("Image/Colors/Invert", (base_type != INDEXED));
SET_SENSITIVE ("Image/Colors/Auto/Equalize", (base_type != INDEXED));
SET_SENSITIVE ("Image/Alpha/Add Alpha Channel",
!fs && !aux && lp && !lm && !alpha);
namespace cleanups. 1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de> * app/context_manager.c: namespace cleanups. * app/commands.[ch] * app/menus.c: moved the "Toggle Selection" menu entry to "View", sprinkled some separators and made the layers/channels/paths popup menus consistent with Tigert's last ops buttons change. * app/fileops.c * app/plug_in.c: check for gdisplay_active() returning NULL in some more places. * app/[all tool related files]: - Turned the ToolAction and ToolState #define's into typedef'ed enums, so the compiler can do some more sanity checking. - Removed one more unused global variable "active_tool_layer". - Removed some #include's from tools.c. - Standardized the individual tools' structure names. - Moved showing/hiding the tool options to separate functions. - Stuff... * app/commands.c * app/disp_callbacks.c * app/gdisplay.c * app/tools.c: fixed the segfaults which happened when the image of one of the tools which have dialogs (levels/posterize/...) was deleted. My approach was to do stricter sanity checking and to set some gdisplay pointers correctly where appropriate, so I can't tell exactly where the bug was. The curves tool now(??) updates on every _second_ display change only, which is really obscure. Finding/changing the display to operate on should definitely be done by connecting to the user context's "display_changed" signal. * app/gimpset.c: emit the "remove" signal _after_ removing the pointer from the set. If this was not a bug but a feature, please let me know, we'll need two signals then.
1999-06-22 06:12:07 +08:00
SET_SENSITIVE ("Image/Transforms/Offset...", lp);
}
SET_SENSITIVE ("Layers/Stack", gdisp);
if (gdisp)
{
SET_SENSITIVE ("Layers/Stack/Previous Layer",
!fs && !aux && lp && lind > 0);
SET_SENSITIVE ("Layers/Stack/Next Layer",
!fs && !aux && lp && lind < (lnum - 1));
SET_SENSITIVE ("Layers/Stack/Raise Layer",
!fs && !aux && lp && alpha && lind > 0);
SET_SENSITIVE ("Layers/Stack/Lower Layer",
!fs && !aux && lp && alpha && lind < (lnum - 1));
SET_SENSITIVE ("Layers/Stack/Layer to Top",
!fs && !aux && lp && alpha && lind > 0);
SET_SENSITIVE ("Layers/Stack/Layer to Bottom",
!fs && !aux && lp && alpha && lind < (lnum - 1));
}
SET_SENSITIVE ("Layers/Rotate", gdisp && !aux && !lm & lp);
SET_SENSITIVE ("Layers/Layer to Imagesize", gdisp && !aux && lp);
SET_SENSITIVE ("Layers/Anchor Layer", gdisp && fs && !aux && lp);
SET_SENSITIVE ("Layers/Merge Visible Layers...", gdisp && !fs && !aux && lp);
SET_SENSITIVE ("Layers/Flatten Image", gdisp && !fs && !aux && lp);
1999-12-14 22:10:34 +08:00
SET_SENSITIVE ("Layers/Alpha to Selection", gdisp && !aux && lp && alpha);
SET_SENSITIVE ("Layers/Mask to Selection", gdisp && !aux && lm && lp);
SET_SENSITIVE ("Layers/Add Alpha Channel",
gdisp && !fs && !aux && lp && !lm && !alpha);
SET_SENSITIVE ("Filters", gdisp && lp);
SET_SENSITIVE ("Script-Fu", gdisp && lp);
#undef SET_STATE
#undef SET_SENSITIVE
1997-11-25 06:05:25 +08:00
plug_in_set_menu_sensitivity (type);
}
void
gdisplay_expose_area (GDisplay *gdisp,
gint x,
gint y,
gint w,
gint h)
1997-11-25 06:05:25 +08:00
{
gdisplay_add_display_area (gdisp, x, y, w, h);
}
void
gdisplay_expose_guide (GDisplay *gdisp,
GimpGuide *guide)
1997-11-25 06:05:25 +08:00
{
gint x;
gint y;
1997-11-25 06:05:25 +08:00
if (guide->position < 0)
return;
gdisplay_transform_coords (gdisp, guide->position,
guide->position, &x, &y, FALSE);
1997-11-25 06:05:25 +08:00
switch (guide->orientation)
{
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
case ORIENTATION_HORIZONTAL:
gdisplay_expose_area (gdisp, 0, y, gdisp->disp_width, 1);
1997-11-25 06:05:25 +08:00
break;
add sample_colorize and curve_bend defs * plug-ins/common/plugin-defs.pl: add sample_colorize and curve_bend defs * libgimp/color_selector.h: minor consistency cleanup * libgimp/gimpchainbutton.[ch]: use new style gtk object helper macros * libgimp/gimpfileselection.c * libgimp/gimpmatrix.h: minor cleanup * libgimp/gimpintl.h: resync with gnome-i18n.h * libgimp/color_display.h * app/gimp.sym * app/gdisplay_color.[ch] * app/app_procs.c * app/gdisplay.h * app/image_render.c: color display transformation code. Still unfinished, so it's not activated yet. * app/buildmenu.h: remove unused defines (PULLDOWN, POPUP, OPTION) * app/colormaps.[ch] * app/image_render.c: remove vestigal dithering stuff * app/convolve.h * app/gimpdrawable.h * app/gimpimage.h * app/lut_funcs.h * app/paint_funcs.h * app/plug_in.h: enum nick changes from Marc * app/channel_ops.c * app/crop.c * app/gdisplay.c * app/gimpimage.[ch] * app/move.c: s/([A-Z]+)_GUIDE/ORIENTATION_$1/ * app/flip_tool.[ch] * app/shear_tool.[ch]: use ORIENTATION_* constants instead of our own * app/disp_callbacks.c: remove HORIZONTAL and VERTICAL #defines * app/general.h: enumified TOKEN_* symbols * app/lc_dialog.c * app/paint_funcs.c: remove unused variables * tools/pdbgen/lib.pl: autogen gimpenums.h (unfinished) * tools/pdbgen/stddefs.pdb: new std_orientation_enum, remove layer_mode shortcut since we've skipped it in app/ * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/gimage.pdb * tools/pdbgen/pdb/guides.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/tools.pdb: reflect above enum changes, whitespace cleanups * tools/pdbgen/enums.pl * app/brush_select_cmds.c * app/brushes_cmds.c * app/color_cmds.c * app/drawable_cmds.c * app/gimage_cmds.c * app/layer_cmds.c * app/procedural_db_cmds.c * app/tools_cmds.c: reflect pdb and enum nick changes above -Yosh
1999-07-29 07:00:08 +08:00
case ORIENTATION_VERTICAL:
gdisplay_expose_area (gdisp, x, 0, 1, gdisp->disp_height);
1997-11-25 06:05:25 +08:00
break;
default:
break;
1997-11-25 06:05:25 +08:00
}
}
void
gdisplay_expose_full (GDisplay *gdisp)
{
gdisplay_add_display_area (gdisp, 0, 0,
gdisp->disp_width,
gdisp->disp_height);
}
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
void
gdisplay_selection_visibility (GDisplay *gdisp,
SelectionControl function)
{
if (gdisp->select)
{
switch (function)
{
case SELECTION_OFF:
selection_invis (gdisp->select);
break;
case SELECTION_LAYER_OFF:
selection_layer_invis (gdisp->select);
break;
case SELECTION_ON:
selection_start (gdisp->select, TRUE);
break;
case SELECTION_PAUSE:
selection_pause (gdisp->select);
break;
case SELECTION_RESUME:
selection_resume (gdisp->select);
break;
}
}
}
1997-11-25 06:05:25 +08:00
/**************************************************/
/* Functions independent of a specific gdisplay */
/**************************************************/
GDisplay *
gdisplay_active (void)
1997-11-25 06:05:25 +08:00
{
GdkEvent *event;
/* Whoever finds out why we do this (see below) gets a free beer.
* Report back the reason to Sven and Mitch ...
*/
event = gtk_get_current_event ();
if (event != NULL)
{
gdk_event_free (event);
}
return gimp_context_get_display (gimp_context_get_user ());
1997-11-25 06:05:25 +08:00
}
GDisplay *
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
gdisplay_get_by_ID (gint ID)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
GSList *list;
1997-11-25 06:05:25 +08:00
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
/* Traverse the list of displays, returning the one that matches the ID
* If no display in the list is a match, return NULL.
*/
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
app/channel.[ch] app/drawable.[ch] app/gdisplay.[ch] app/gimpdrawable.[ch] 2001-01-14 Michael Natterer <mitch@gimp.org> * app/channel.[ch] * app/drawable.[ch] * app/gdisplay.[ch] * app/gimpdrawable.[ch] * app/layer.[ch]: - Removed all "typedef drawable_function gimp_drawable_function". - Renamed all *_get_ID() functions to *_get_by_ID(). - For symmetry reasons, renamed drawable_ID() to gimp_drawable_get_ID(). - Removed the *_get_ID() functions of GimpLayer, GimpLayerMask and GimpChannel. * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convert.c * app/convolve.c * app/crop.c * app/curves.c * app/desaturate.c * app/dodgeburn.c * app/edit_selection.c * app/eraser.c * app/fileops.c * app/flip_tool.c * app/floating_sel.c * app/fuzzy_select.c * app/gimage.c * app/gimage_mask.c * app/gimphistogram.c * app/gimpimage.c * app/global_edit.c * app/histogram_tool.c * app/hue_saturation.c * app/image_map.c * app/ink.c * app/invert.c * app/layer_select.c * app/layers_dialog.c * app/levels.c * app/paint_core.c * app/paintbrush.c * app/pencil.c * app/plug_in.c * app/posterize.c * app/scan_convert.c * app/smudge.c * app/text_tool.c * app/threshold.c * app/transform_core.c * app/undo.c * app/undo_history.c * app/channel_cmds.c * app/channel_ops_cmds.c * app/color_cmds.c * app/display_cmds.c * app/drawable_cmds.c * app/edit_cmds.c * app/floating_sel_cmds.c * app/image_cmds.c * app/layer_cmds.c * app/parasite_cmds.c * app/selection_cmds.c * app/text_tool_cmds.c * app/tools_cmds.c * libgimp/gimpdrawable_pdb.c * tools/pdbgen/pdb.pl * tools/pdbgen/pdb/channel_ops.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb: changed accordingly.
2001-01-15 05:11:52 +08:00
1997-11-25 06:05:25 +08:00
if (gdisp->ID == ID)
return gdisp;
}
return NULL;
}
void
gdisplay_update_title (GDisplay *gdisp)
{
gchar title [MAX_TITLE_BUF];
guint context_id;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);
gdk_window_set_title (gdisp->shell->window, title);
/* update the statusbar */
context_id =
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "title");
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), context_id);
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), context_id, title);
}
1997-11-25 06:05:25 +08:00
void
gdisplays_update_title (GimpImage *gimage)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
gdisplay_update_title (gdisp);
1997-11-25 06:05:25 +08:00
}
}
void
gdisplays_resize_cursor_label (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list;
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
gdisplay_resize_cursor_label (gdisp);
}
}
1997-11-25 06:05:25 +08:00
void
gdisplays_setup_scale (GimpImage *gimage)
{
GDisplay *gdisp;
GSList *list;
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
setup_scale (gdisp);
}
}
1997-11-25 06:05:25 +08:00
void
1999-10-14 07:07:45 +08:00
gdisplays_update_area (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
gdisplay_add_update_area (gdisp, x, y, w, h);
1997-11-25 06:05:25 +08:00
}
}
void
1999-10-14 07:07:45 +08:00
gdisplays_expose_guides (GimpImage *gimage)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
GList *guide_list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
1997-11-25 06:05:25 +08:00
{
for (guide_list = gdisp->gimage->guides;
guide_list;
guide_list = g_list_next (guide_list))
1997-11-25 06:05:25 +08:00
{
gdisplay_expose_guide (gdisp, guide_list->data);
1997-11-25 06:05:25 +08:00
}
}
}
}
void
1999-10-14 07:07:45 +08:00
gdisplays_expose_guide (GimpImage *gimage,
GimpGuide *guide)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
gdisplay_expose_guide (gdisp, guide);
1997-11-25 06:05:25 +08:00
}
}
void
gdisplays_update_full (GimpImage *gimage)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
gdisplay_add_update_area (gdisp, 0, 0,
gdisp->gimage->width,
gdisp->gimage->height);
1997-11-25 06:05:25 +08:00
}
}
void
1999-10-14 07:07:45 +08:00
gdisplays_shrink_wrap (GimpImage *gimage)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
if (gdisp->gimage == gimage)
1997-11-25 06:05:25 +08:00
shrink_wrap_display (gdisp);
}
}
void
comment typo fix, plus add %D* to default image-title-format string, so Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org> * gimprc.in: comment typo fix, plus add %D* to default image-title-format string, so people get a '*' in the titlebar if their image is dirty. * app/fileops.c: initialise filename before using it. * app/gdisplay.c: empty parameter list () is K&R - should be stronger (void) in ANSI C. * app/gimpdrawable.c: gimp_drawable_{dirty,clean} functions removed - no one uses them anyway. Parasite undo type is proper parasite undo type, not MISC_UNDO. * app/gimpdrawableP.h: drawable dirty bit removed. * app/gimpimage.c: don't change the resolution if there's no difference from the old one. Call gdisplay_shrink_wrap() to re-calculate scale factors and refresh the display on resolution change. Layer undo doesn't have sub-types anymore, uses main UndoType instead. * app/layer.h: Remove LayerUndoType * app/qmask.c: fix qmask undo so it actually works. * app/undo.h: new types for undo_push_layer{,_mask} and undo_push_qmask. * app/undo.c: change way group boundaries are represented: each Undo has a group_boundary boolean set to TRUE if this is the start or the end of a group, and the type of the Undo is the group's type. Within a group, each Undo keeps its own type. This allows pop funcs and free funcs to do type-specific things (eg needed by layer and channel stuff). Don't maintain per-drawable dirty flags anymore. Floating sel to layer and layer rename now uses meaningful undo types. * app/undo_types.h: more specific undo types: LAYER_{ADD,REMOVE}_UNDO, LAYER_MASK_{ADD,REMOVE}_UNDO, LAYER_RENAME_UNDO, and PARASITE_{ATTACH,DETACH}_UNDO. * app/undo_history.c: oops - undo stack was being placed into gtk list in wrong order. * app/edit_selection.c: push more descriptive LAYER_DISPLACE_UNDO rather than MISC_UNDO. * app/layers_dialog.c: better tagging of undo types
1999-10-02 02:43:24 +08:00
gdisplays_expose_full (void)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
1997-11-25 06:05:25 +08:00
gdisplay_expose_full (gdisp);
}
}
void
comment typo fix, plus add %D* to default image-title-format string, so Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org> * gimprc.in: comment typo fix, plus add %D* to default image-title-format string, so people get a '*' in the titlebar if their image is dirty. * app/fileops.c: initialise filename before using it. * app/gdisplay.c: empty parameter list () is K&R - should be stronger (void) in ANSI C. * app/gimpdrawable.c: gimp_drawable_{dirty,clean} functions removed - no one uses them anyway. Parasite undo type is proper parasite undo type, not MISC_UNDO. * app/gimpdrawableP.h: drawable dirty bit removed. * app/gimpimage.c: don't change the resolution if there's no difference from the old one. Call gdisplay_shrink_wrap() to re-calculate scale factors and refresh the display on resolution change. Layer undo doesn't have sub-types anymore, uses main UndoType instead. * app/layer.h: Remove LayerUndoType * app/qmask.c: fix qmask undo so it actually works. * app/undo.h: new types for undo_push_layer{,_mask} and undo_push_qmask. * app/undo.c: change way group boundaries are represented: each Undo has a group_boundary boolean set to TRUE if this is the start or the end of a group, and the type of the Undo is the group's type. Within a group, each Undo keeps its own type. This allows pop funcs and free funcs to do type-specific things (eg needed by layer and channel stuff). Don't maintain per-drawable dirty flags anymore. Floating sel to layer and layer rename now uses meaningful undo types. * app/undo_types.h: more specific undo types: LAYER_{ADD,REMOVE}_UNDO, LAYER_MASK_{ADD,REMOVE}_UNDO, LAYER_RENAME_UNDO, and PARASITE_{ATTACH,DETACH}_UNDO. * app/undo_history.c: oops - undo stack was being placed into gtk list in wrong order. * app/edit_selection.c: push more descriptive LAYER_DISPLACE_UNDO rather than MISC_UNDO. * app/layers_dialog.c: better tagging of undo types
1999-10-02 02:43:24 +08:00
gdisplays_nav_preview_resized (void)
{
GDisplay *gdisp;
GSList *list;
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
if (gdisp->window_nav_dialog)
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
nav_dialog_preview_resized (gdisp->window_nav_dialog);
if (gdisp->nav_popup)
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
{
nav_dialog_free (NULL, gdisp->nav_popup);
gdisp->nav_popup = NULL;
}
}
}
1997-11-25 06:05:25 +08:00
void
gdisplays_selection_visibility (GimpImage *gimage,
SelectionControl function)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays, handling each one */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) list->data;
major cleanup. After being finished, I decided that it needs to be 2001-06-18 Michael Natterer <mitch@gimp.org> * app/nav_window.[ch]: major cleanup. After being finished, I decided that it needs to be factored out to a widget (see below), so like 90% of this file will go away soon. * app/apptypes.h: added opaque NavigationDialog typedef. * app/gdisplay.[ch]: Added gdisplay_selection_visibility() which is called from gdisplays_selection_visibility(). Capitalized the SelectionControl enum values. Cleaned up the GDisplay struct and it's initialisation while i was on it. * app/gimage.c: gimage_size_changed_handler(): removed stuff which is now done by GimpImage itself. * app/scale.c * app/scroll.c: also update the navigation popup, not only the dialog. * app/selection.[ch]: major indentation & cleanup attack. Maybe found the "Selection vanishes" bug (the timeout id was assinged to a gint, not a _guint_). * app/undo.c: s/gimp_image_size_changed/gimp_viweable_size_changed/ * app/core/gimpdrawable.c: invalidate the image's preview from our "invalidate_preview" implementation. This means that the image's preview is invalidated way too often currently, which cries for some general freeze/thaw mechanism on the GimpViewable level. (Note that previews are rendered in the idle loop, so this is not really a major performance impact, it's just ugly). * app/core/gimpimage.[ch]: removed the "size_changed" signal... * app/core/gimpviewable.[ch]: ...and added it here. * app/core/gimplayer.c: invalidate_preview(): always chain up, also if it's a floating selection. * app/gui/info-dialog.[ch] * app/gui/info-window.c: minor cleanups. * app/gui/preferences-dialog.c: no need to invalidate the image after we have invalidated all it's layers. * app/core/gimpimage-mask.c * app/gui/commands.c * app/tools/gimpeditselectiontool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c: capitalized the SelectionCommand enum values. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpnavigationpreview.[ch]: new widget. * app/widgets/gimppreview.[ch]: added a non-working non-dot-for-dot mode. Added xres/yres params to the gimp_preview_calc_size() helper function. Cache the "size" value which was passed to the simple function variants (gimp_preview_new() and gimp_preview_set_size()) so we can re-calculate the preview's extents on the underlying viewable's "size_changed" signal and on gimp_preview_set_viewable(). * app/widgets/gimpdrawablepreview.c * app/widgets/gimpimagepreview.c: changed accordingly.
2001-06-18 21:10:03 +08:00
if (gdisp->gimage == gimage)
gdisplay_selection_visibility (gdisp, function);
1997-11-25 06:05:25 +08:00
}
}
gboolean
comment typo fix, plus add %D* to default image-title-format string, so Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org> * gimprc.in: comment typo fix, plus add %D* to default image-title-format string, so people get a '*' in the titlebar if their image is dirty. * app/fileops.c: initialise filename before using it. * app/gdisplay.c: empty parameter list () is K&R - should be stronger (void) in ANSI C. * app/gimpdrawable.c: gimp_drawable_{dirty,clean} functions removed - no one uses them anyway. Parasite undo type is proper parasite undo type, not MISC_UNDO. * app/gimpdrawableP.h: drawable dirty bit removed. * app/gimpimage.c: don't change the resolution if there's no difference from the old one. Call gdisplay_shrink_wrap() to re-calculate scale factors and refresh the display on resolution change. Layer undo doesn't have sub-types anymore, uses main UndoType instead. * app/layer.h: Remove LayerUndoType * app/qmask.c: fix qmask undo so it actually works. * app/undo.h: new types for undo_push_layer{,_mask} and undo_push_qmask. * app/undo.c: change way group boundaries are represented: each Undo has a group_boundary boolean set to TRUE if this is the start or the end of a group, and the type of the Undo is the group's type. Within a group, each Undo keeps its own type. This allows pop funcs and free funcs to do type-specific things (eg needed by layer and channel stuff). Don't maintain per-drawable dirty flags anymore. Floating sel to layer and layer rename now uses meaningful undo types. * app/undo_types.h: more specific undo types: LAYER_{ADD,REMOVE}_UNDO, LAYER_MASK_{ADD,REMOVE}_UNDO, LAYER_RENAME_UNDO, and PARASITE_{ATTACH,DETACH}_UNDO. * app/undo_history.c: oops - undo stack was being placed into gtk list in wrong order. * app/edit_selection.c: push more descriptive LAYER_DISPLACE_UNDO rather than MISC_UNDO. * app/layers_dialog.c: better tagging of undo types
1999-10-02 02:43:24 +08:00
gdisplays_dirty (void)
1997-11-25 06:05:25 +08:00
{
gboolean dirty = FALSE;
GSList *list;
1997-11-25 06:05:25 +08:00
/* traverse the linked list of displays */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
if (((GDisplay *) list->data)->gimage->dirty != 0)
dirty = TRUE;
1997-11-25 06:05:25 +08:00
}
return dirty;
}
void
comment typo fix, plus add %D* to default image-title-format string, so Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org> * gimprc.in: comment typo fix, plus add %D* to default image-title-format string, so people get a '*' in the titlebar if their image is dirty. * app/fileops.c: initialise filename before using it. * app/gdisplay.c: empty parameter list () is K&R - should be stronger (void) in ANSI C. * app/gimpdrawable.c: gimp_drawable_{dirty,clean} functions removed - no one uses them anyway. Parasite undo type is proper parasite undo type, not MISC_UNDO. * app/gimpdrawableP.h: drawable dirty bit removed. * app/gimpimage.c: don't change the resolution if there's no difference from the old one. Call gdisplay_shrink_wrap() to re-calculate scale factors and refresh the display on resolution change. Layer undo doesn't have sub-types anymore, uses main UndoType instead. * app/layer.h: Remove LayerUndoType * app/qmask.c: fix qmask undo so it actually works. * app/undo.h: new types for undo_push_layer{,_mask} and undo_push_qmask. * app/undo.c: change way group boundaries are represented: each Undo has a group_boundary boolean set to TRUE if this is the start or the end of a group, and the type of the Undo is the group's type. Within a group, each Undo keeps its own type. This allows pop funcs and free funcs to do type-specific things (eg needed by layer and channel stuff). Don't maintain per-drawable dirty flags anymore. Floating sel to layer and layer rename now uses meaningful undo types. * app/undo_types.h: more specific undo types: LAYER_{ADD,REMOVE}_UNDO, LAYER_MASK_{ADD,REMOVE}_UNDO, LAYER_RENAME_UNDO, and PARASITE_{ATTACH,DETACH}_UNDO. * app/undo_history.c: oops - undo stack was being placed into gtk list in wrong order. * app/edit_selection.c: push more descriptive LAYER_DISPLACE_UNDO rather than MISC_UNDO. * app/layers_dialog.c: better tagging of undo types
1999-10-02 02:43:24 +08:00
gdisplays_delete (void)
1997-11-25 06:05:25 +08:00
{
GDisplay *gdisp;
1997-11-25 06:05:25 +08:00
/* destroying the shell removes the GDisplay from the list, so
* do a while loop "around" the first element to get them all
*/
while (display_list)
1997-11-25 06:05:25 +08:00
{
gdisp = (GDisplay *) display_list->data;
gtk_widget_destroy (gdisp->shell);
1997-11-25 06:05:25 +08:00
}
}
GDisplay *
gdisplays_check_valid (GDisplay *gtest,
GimpImage *gimage)
{
/* Give a gdisp check that it is still valid and points to the required
* GimpImage. If not return the first gDisplay that does point to the
* gimage. If none found return NULL;
*/
GDisplay *gdisp;
GDisplay *gdisp_found = NULL;
GSList *list;
/* traverse the linked list of displays */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
if (gdisp == gtest)
return gtest;
if (!gdisp_found && gdisp->gimage == gimage)
gdisp_found = gdisp;
}
return gdisp_found;
}
static void
gdisplays_flush_whenever (gboolean now)
1997-11-25 06:05:25 +08:00
{
static gboolean flushing = FALSE;
GSList *list;
1997-11-25 06:05:25 +08:00
/* no flushing necessary without an interface */
if (no_interface)
return;
/* this prevents multiple recursive calls to this procedure */
if (flushing == TRUE)
{
1999-09-23 19:49:16 +08:00
g_warning ("gdisplays_flush() called recursively.");
return;
}
1997-11-25 06:05:25 +08:00
flushing = TRUE;
/* traverse the linked list of displays */
for (list = display_list; list; list = g_slist_next (list))
1997-11-25 06:05:25 +08:00
{
gdisplay_flush_whenever ((GDisplay *) list->data, now);
1997-11-25 06:05:25 +08:00
}
flushing = FALSE;
}
void
gdisplays_flush (void)
{
gdisplays_flush_whenever (FALSE);
}
void
gdisplays_flush_now (void)
{
gdisplays_flush_whenever (TRUE);
}
static guint
gdisplay_hash (GDisplay *display)
{
return (gulong) display;
}
1999-01-12 09:31:49 +08:00
void
gdisplay_reconnect (GDisplay *gdisp,
GimpImage *gimage)
1999-01-12 09:31:49 +08:00
{
gint instance;
1999-01-12 09:31:49 +08:00
g_return_if_fail (gdisp != NULL && gimage != NULL);
1999-01-12 09:31:49 +08:00
if (gdisp->idle_render.active)
{
gtk_idle_remove (gdisp->idle_render.idleid);
gdisp->idle_render.active = FALSE;
}
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
gtk_signal_disconnect_by_data (GTK_OBJECT (gdisp->gimage), gdisp);
gdisp->gimage->disp_count--;
gtk_object_unref (GTK_OBJECT (gdisp->gimage));
1999-01-12 09:31:49 +08:00
instance = gimage->instance_count;
gimage->instance_count++;
gimage->disp_count++;
1999-01-12 09:31:49 +08:00
gdisp->gimage = gimage;
gdisp->instance = instance;
gtk_object_ref (GTK_OBJECT (gimage));
gtk_object_sink (GTK_OBJECT (gimage));
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
/* reconnect our clean / dirty signals */
gtk_signal_connect (GTK_OBJECT (gimage), "dirty",
GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp);
gtk_signal_connect (GTK_OBJECT (gimage), "clean",
GTK_SIGNAL_FUNC(gdisplay_cleandirty_handler), gdisp);
gdisplays_update_title (gimage);
1999-01-12 09:31:49 +08:00
gdisplay_expose_full (gdisp);
gdisplay_flush (gdisp);
}
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
void
gdisplays_reconnect (GimpImage *old,
GimpImage *new)
{
GSList *list;
GDisplay *gdisp;
g_return_if_fail (old != NULL && new != NULL);
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = list->data;
if (gdisp->gimage == old)
gdisplay_reconnect (gdisp, new);
}
}
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
/* Called whenever the underlying gimage is dirtied or cleaned */
static void
gdisplay_cleandirty_handler (GimpImage *gimage,
void *data)
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
{
GDisplay *gdisp = data;
gdisplay_update_title (gdisp);
}
Dirty flag now correct in all cases. Can be displayed in image window Mon Aug 23 10:15:32 EDT 1999 Austin Donnelly <austin@gimp.org> Dirty flag now correct in all cases. Can be displayed in image window title too. See NOTE near gimp_image_dirty() for details. * app/fileops.c: gimp_image_clean_all() after reverting an image. * app/gdisplay.c: register handlers for gimage dirty and clean signals to update image title. New image-title-format expansion: %Dx expands to x if the image is dirty. * app/gdisplay_ops.c: gimage->dirty flags != 0 is the correct condition to test to see if an image is dirty. * app/gimpdrawable.c: gimp_image_dirty() should never be called except from an undo_push_* function. Call undo_push_cantundo() if you want to dirty the image but can't be bothered writing an undo handler (be ashamed of yourself!). * app/gimpimage.c: new gimage signal: clean. Emitted when an undo operation takes place. Gimage changes when either dirty or clean is emitted, so if you need to update previews etc, look for both! Move group_count into gimage structure, since leaving it as a static in undo.c is bad if two undo groups are started on different images at the same time. More changes of gimp_image_dirty() to undo_push_cantundo() (parasite-related, plus layer moves). See the NOTE on dirty counter near gimp_image_dirty() for the full story. gimp_image_dirty() and gimp_image_clean() simplified - counter can go negative. * app/gimpimageP.h: group_count moved from undo.c * app/layers_dialog.c: push undo for layer name change, rather than dirtying the image. * app/undo.c: layer rename undo functions added. undo_push_cantundo() convenience functions added. group_count made per-gimage since everything else is. When blowing away redo stack, make image infinitely dirty if redo info contained file save point. * app/undo.h: added undo_push_layer_rename() and undo_push_cantundo(). * TODO: added idea for undo history window.
1999-08-23 22:34:58 +08:00
void
gdisplays_foreach (GFunc func,
gpointer user_data)
{
g_slist_foreach (display_list, func, user_data);
}