gimp/app/widgets/gimpdevices.c

1253 lines
33 KiB
C
Raw Normal View History

/* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
1999-03-07 20:56:03 +08:00
#include "config.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 <stdio.h>
#include <string.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 <gtk/gtk.h>
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
#include "libgimpcolor/gimpcolor.h"
Makefile.am configure.in added the new library below. 2001-01-24 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added the new library below. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.[ch] * libgimpwidgets/gimpcolorbutton.[ch] * libgimpwidgets/gimpdialog.[ch] * libgimpwidgets/gimpfileselection.[ch] * libgimpwidgets/gimphelpui.[ch] * libgimpwidgets/gimppatheditor.[ch] * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpquerybox.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch] * libgimpwidgets/gimpwidgets.[ch] * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgetstypes.h: new shared library. Currently there are some ugly dependencies into libgimp. These will be removed and go to a "libgimpglue" library which will be a library for functions which share a common interface between plug-ins and the app but have different implementations. Include "libgimp/gimpunit.h" from "libgimpwidgets/gimpwidgetstypes.h" to simulate this upcoming separation. * libgimp/Makefile.am * libgimp/gimpchainbutton.[ch] * libgimp/gimpcolorarea.[ch] * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimpfileselection.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimppixmap.[ch] * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: removed from here. * libgimp/gimpui.h * libgimp/gimpuitypes.h * libgimp/makefile.mingw.in * libgimp/makefile.msc: changed accordingly. * app/[all ui files] * app/pdb/palette_cmds.c * app/pdb/tools_cmds.c * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/tools.pdb: #include "libgimpwidgets/gimpwidgets.h" and removed useless includes. * app/apptypes.h: #include "libgimpwidgets/gimpwidgetstypes.h" * app/Makefile.am * plug-ins/[all makefiles which link against libgimpui]: link against libgimpwidgets.la * po-libgimp/POTFILES.in: changed file locations.
2001-01-25 06:36:18 +08:00
#include "libgimpwidgets/gimpwidgets.h"
Makefile.am configure.in added stuff for the new library below. 2001-01-23 Michael Natterer <mitch@gimp.org> * Makefile.am * configure.in * gimptool.in: added stuff for the new library below. * libgimpcolor/.cvsignore * libgimpcolor/Makefile.am * libgimpcolor/gimpcolor.h * libgimpcolor/gimpcolorspace.c * libgimpcolor/gimpcolorspace.h * libgimpcolor/gimpcolortypes.h * libgimpcolor/gimphsv.c * libgimpcolor/gimphsv.h * libgimpcolor/gimprgb.c * libgimpcolor/gimprgb.h: new shared library which both the app and plug-ins link against. The library depends only on glib. * libgimpcolor/gimpcolor.def * libgimpcolor/makefile.mingw.in * libgimpcolor/makefile.msc: added Win32 build files which definitely don't work. * libgimp/Makefile.am * libgimp/gimpcolor.[ch] * libgimp/gimpcolorspace.[ch]: removed. * libgimp/gimp.h * libgimp/gimpadaptivesupersample.c * libgimp/gimpbilinear.c * libgimp/gimppalette.c * libgimp/gimptypes.h: include the stuff from libgimpcolor. Plug-Ins don't need to include <libgimpcolor/gimpcolor.h> explicitely. LibGimp depends on libgimpcolor and thus also includes it's headers. * libgimp/gimp.def * libgimp/makefile.mingw.in: fiddled around with Win32 stuff... * app/Makefile.am: link against libgimpcolor.la * app/apptypes.h: include "libgimpcolor/gimpcolortypes.h" * app/asupsample.c * app/channels_dialog.c * app/colormap_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/disp_callbacks.c * app/drawable.c * app/gimpcontext.c * app/gimpdnd.c * app/gimpimage.c * app/gimppalette.c * app/gimprc.c * app/gradient.c * app/libgimp_glue.c * app/palette.c * app/palette_import.c * app/qmask.c * app/xcf.c * app/tools/paint_core.c * app/tools/paintbrush.c * app/tools/pencil.c: include "libgimpcolor/gimpcolor.h" before all gimp includes because it's a standalone library. * plug-ins/FractalExplorer/Makefile.am * plug-ins/Lighting/Makefile.am * plug-ins/MapObject/Makefile.am * plug-ins/bmp/Makefile.am * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/dbbrowser/Makefile.am * plug-ins/faxg3/Makefile.am * plug-ins/fits/Makefile.am * plug-ins/flame/Makefile.am * plug-ins/fp/Makefile.am * plug-ins/gap/Makefile.am * plug-ins/gdyntext/Makefile.am * plug-ins/gfig/Makefile.am * plug-ins/gflare/Makefile.am * plug-ins/gfli/Makefile.am * plug-ins/gimpressionist/Makefile.am * plug-ins/helpbrowser/Makefile.am * plug-ins/ifscompose/Makefile.am * plug-ins/imagemap/Makefile.am * plug-ins/maze/Makefile.am * plug-ins/mosaic/Makefile.am * plug-ins/pagecurl/Makefile.am * plug-ins/print/Makefile.am * plug-ins/rcm/Makefile.am * plug-ins/script-fu/Makefile.am * plug-ins/sel2path/Makefile.am * plug-ins/sgi/Makefile.am * plug-ins/webbrowser/Makefile.am * plug-ins/xjt/Makefile.am: add libgimpcolor.la to LDADD. * INSTALL: don't recommend to --disable-shared for development. * TODO.xml: increased some percentages, added plug-in help stuff.
2001-01-24 02:49:44 +08:00
#include "apptypes.h"
#include "appenv.h"
#include "devices.h"
#include "dialog_handler.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 "gimpbrush.h"
#include "gimpcontextpreview.h"
1999-09-04 11:36:54 +08:00
#include "gimpdnd.h"
1999-10-27 02:27:27 +08:00
#include "gimpbrushlist.h"
#include "gimpcontext.h"
#include "gimprc.h"
1999-10-28 23:05:49 +08:00
#include "gradient.h"
1999-10-27 02:27:27 +08:00
#include "gradient_header.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 "patterns.h"
#include "session.h"
#include "tools/tools.h"
1999-03-07 20:56:03 +08:00
#include "libgimp/gimpenv.h"
#include "libgimp/gimpintl.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
#define CELL_SIZE 20 /* The size of the preview cells */
1999-10-27 02:27:27 +08:00
#define DEVICE_CONTEXT_MASK (GIMP_CONTEXT_TOOL_MASK | \
GIMP_CONTEXT_FOREGROUND_MASK | \
GIMP_CONTEXT_BACKGROUND_MASK | \
GIMP_CONTEXT_BRUSH_MASK | \
GIMP_CONTEXT_PATTERN_MASK | \
GIMP_CONTEXT_GRADIENT_MASK)
1999-10-27 02:27:27 +08:00
typedef struct _DeviceInfo DeviceInfo;
1999-10-27 02:27:27 +08:00
struct _DeviceInfo
{
guint32 device; /* device ID */
gchar *name;
gshort is_present; /* is the device currently present */
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
1999-10-27 02:27:27 +08:00
/* gdk_input options - for not present devices */
1999-10-27 02:27:27 +08:00
GdkInputMode mode;
gint num_axes;
GdkAxisUse *axes;
gint num_keys;
GdkDeviceKey *keys;
1999-10-27 02:27:27 +08:00
GimpContext *context;
};
typedef struct _DeviceInfoDialog DeviceInfoDialog;
1999-10-27 02:27:27 +08:00
struct _DeviceInfoDialog
{
gint num_devices;
guint32 current;
guint32 *ids;
GtkWidget *shell;
GtkWidget *table;
GtkWidget **frames;
GtkWidget **tools;
GtkWidget **foregrounds;
GtkWidget **backgrounds;
GtkWidget **brushes;
GtkWidget **patterns;
1999-10-28 23:05:49 +08:00
GtkWidget **gradients;
1998-08-13 23:25:41 +08:00
GtkWidget **eventboxes;
};
1999-10-27 02:27:27 +08:00
/* local functions */
static void input_dialog_able_callback (GtkWidget *widget,
guint32 deviceid,
gpointer data);
1999-10-28 23:05:49 +08:00
static void devices_write_rc_device (DeviceInfo *device_info,
FILE *fp);
1999-10-28 23:05:49 +08:00
static void devices_write_rc (void);
static void device_status_destroy_callback (void);
static void devices_close_callback (GtkWidget *widget,
gpointer data);
1999-10-28 23:05:49 +08:00
static void device_status_update (guint32 deviceid);
1999-10-28 23:05:49 +08:00
static void device_status_update_current (void);
static ToolType device_status_drag_tool (GtkWidget *widget,
gpointer data);
static void device_status_drop_tool (GtkWidget *widget,
ToolType tool,
gpointer data);
static void device_status_foreground_changed (GtkWidget *widget,
gpointer data);
static void device_status_background_changed (GtkWidget *widget,
gpointer data);
static void device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data);
static void device_status_drop_pattern (GtkWidget *widget,
GPattern *pattern,
gpointer data);
static void device_status_drop_gradient (GtkWidget *widget,
gradient_t *gradient,
gpointer data);
1999-10-28 23:05:49 +08:00
static void device_status_data_changed (GimpContext *context,
gpointer dummy,
gpointer data);
static void device_status_context_connect (GimpContext *context,
guint32 deviceid);
1999-09-04 11:36:54 +08:00
1999-10-27 02:27:27 +08:00
/* global data */
gint current_device = GDK_CORE_POINTER;
1999-10-27 02:27:27 +08:00
/* local data */
static GList *device_info_list = NULL;
static DeviceInfoDialog *deviceD = NULL;
/* if true, don't update device information dialog */
static gboolean suppress_update = FALSE;
1999-09-04 11:36:54 +08:00
/* dnd stuff */
1999-10-28 23:05:49 +08:00
static GtkTargetEntry tool_target_table[] =
{
GIMP_TARGET_TOOL
};
static guint n_tool_targets = (sizeof (tool_target_table) /
sizeof (tool_target_table[0]));
1999-10-27 02:27:27 +08:00
1999-10-27 02:27:27 +08:00
/* utility functions for the device lists */
static GdkDeviceInfo *
gdk_device_info_get_by_id (guint32 deviceid)
{
GdkDeviceInfo *info;
GList *list;
for (list = gdk_input_list_devices (); list; list = g_list_next (list))
{
info = (GdkDeviceInfo *) list->data;
if (info->deviceid == deviceid)
return info;
}
return NULL;
}
static DeviceInfo *
device_info_get_by_id (guint32 deviceid)
{
DeviceInfo *info;
GList *list;
for (list = device_info_list; list; list = g_list_next (list))
{
info = (DeviceInfo *) list->data;
if (info->device == deviceid)
return info;
}
return NULL;
}
static DeviceInfo *
device_info_get_by_name (gchar *name)
{
DeviceInfo *info;
GList *list;
for (list = device_info_list; list; list = g_list_next (list))
{
info = (DeviceInfo *) list->data;
if (!strcmp (info->name, name))
return info;
}
return NULL;
}
/* the gtk input dialog */
1999-09-04 11:36:54 +08:00
void
1999-10-27 02:27:27 +08:00
input_dialog_create (void)
{
static GtkWidget *inputd = NULL;
GtkWidget *hbbox;
if (!inputd)
{
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
inputd = gtk_input_dialog_new ();
/* register this one only */
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
dialog_register (inputd);
1999-10-27 02:27:27 +08:00
gtk_container_set_border_width
(GTK_CONTAINER (GTK_DIALOG (inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
FALSE);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
hbbox = gtk_hbutton_box_new ();
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->save_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->save_button,
GTK_CAN_DEFAULT);
gtk_widget_reparent (GTK_INPUT_DIALOG (inputd)->close_button, hbbox);
GTK_WIDGET_SET_FLAGS (GTK_INPUT_DIALOG (inputd)->close_button,
GTK_CAN_DEFAULT);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (inputd)->action_area), hbbox,
FALSE, FALSE, 0);
gtk_widget_grab_default (GTK_INPUT_DIALOG (inputd)->close_button);
gtk_widget_show(hbbox);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->save_button),
"clicked",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (devices_write_rc),
NULL);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_signal_connect (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
"clicked",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (devices_close_callback),
inputd);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_signal_connect (GTK_OBJECT (inputd), "destroy",
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&inputd);
1999-10-27 02:27:27 +08:00
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_signal_connect (GTK_OBJECT (inputd), "enable_device",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (input_dialog_able_callback),
NULL);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_signal_connect (GTK_OBJECT (inputd), "disable_device",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (input_dialog_able_callback),
NULL);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
/* Connect the "F1" help key */
gimp_help_connect_help_accel (inputd,
gimp_standard_help_func,
The GIMP Help System part II: press "F1" while browsing a menu to show the 1999-10-03 Michael Natterer <mitch@gimp.org> The GIMP Help System part II: press "F1" while browsing a menu to show the help page for the menu entry you're currently over with the mouse. * app/color_notebook.c: all color selectors have to register with a help page now. * app/color_select.[ch]: register with a help string. Removed the dialog part of the files because it's use was deprecated anyway (use color notebooks instead). * app/colormap_dialog.i.c * app/colormap_dialog.p.h * app/palette.c * app/palette_select.c: use a color notebook instead of a color selector. * app/gimphelp.c * app/gimpui.c: minor changes. * app/gimprc.c: "use help" defaults to TRUE now. * app/lc_dialog.c * app/lc_dialogP.h: a special help function which shows the help for the currently selected notebook page. * app/menus.c: some weird code which catches "key_press_event" in all menu shells and pops up the corresp. help page for the selected item. Embedded the GtkItemFactoryEntry in a new GimpItemFactoryEntry to allow a help path to be stored. Will be partially exported and moved to gimphelp.[ch] later to catch key_press for plug-in menu items (don't try this now ;-) * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/channel_ops.c * app/channels_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/file_new_dialog.c * app/fileops.c * app/gdisplay.c * app/gdisplay_color.c * app/gdisplay_color_ui.c * app/gdisplay_ops.c * app/global_edit.c * app/gradient.c * app/gradient_select.c * app/interface.c * app/layers_dialog.c * app/module_db.c * app/paths_dialog.c * app/pattern_select.c * app/preferences_dialog.c * app/qmask.c * app/resize.c * app/undo_history.c: changed all dialog constructors to point to the right place in the new help file structure. * configure.in * help/*: the basic new help file structure. * modules/colorsel_gtk.c * modules/colorsel_triangle.c * modules/colorsel_water.c: register a help page. * plug-ins/helpbrowser/helpbrowser.c: load the help files according to the new help file structure.
1999-10-03 21:50:19 +08:00
"dialogs/input_devices.html");
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_widget_show (inputd);
}
else
{
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
if (!GTK_WIDGET_MAPPED (inputd))
gtk_widget_show (inputd);
else
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gdk_window_raise (inputd->window);
}
}
1999-10-27 02:27:27 +08:00
static void
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
input_dialog_able_callback (GtkWidget *widget,
guint32 deviceid,
gpointer data)
{
device_status_update (deviceid);
}
void
devices_init (void)
{
1999-10-27 02:27:27 +08:00
GdkDeviceInfo *gdk_info;
DeviceInfo *device_info;
GList *list;
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
1999-10-27 02:27:27 +08:00
/* create device info structures for present devices */
for (list = gdk_input_list_devices (); list; list = g_list_next (list))
{
1999-10-27 02:27:27 +08:00
gdk_info = (GdkDeviceInfo *) list->data;
1999-10-27 02:27:27 +08:00
device_info = g_new (DeviceInfo, 1);
1999-10-27 02:27:27 +08:00
device_info->device = gdk_info->deviceid;
device_info->name = g_strdup (gdk_info->name);
device_info->is_present = TRUE;
1999-10-27 02:27:27 +08:00
device_info->mode = gdk_info->mode;
device_info->num_axes = gdk_info->num_axes;
device_info->axes = NULL;
device_info->context = gimp_context_new (device_info->name, NULL);
gimp_context_define_args (device_info->context,
DEVICE_CONTEXT_MASK,
FALSE);
gimp_context_copy_args (gimp_context_get_user (), device_info->context,
DEVICE_CONTEXT_MASK);
device_status_context_connect (device_info->context, device_info->device);
device_info_list = g_list_append (device_info_list, device_info);
}
1998-08-13 23:25:41 +08:00
}
void
devices_restore (void)
1999-10-27 02:27:27 +08:00
{
DeviceInfo *device_info;
1999-10-27 02:27:27 +08:00
GimpContext *context;
gchar *filename;
1998-08-13 23:25:41 +08:00
/* Augment with information from rc file */
1999-03-07 20:56:03 +08:00
filename = gimp_personal_rc_file ("devicerc");
parse_gimprc_file (filename);
g_free (filename);
1998-08-13 23:25:41 +08:00
1999-10-27 02:27:27 +08:00
if ((device_info = device_info_get_by_id (current_device)) == NULL)
return;
1998-08-13 23:25:41 +08:00
suppress_update = TRUE;
1999-10-27 02:27:27 +08:00
context = gimp_context_get_user ();
gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK);
gimp_context_set_parent (device_info->context, context);
1998-08-13 23:25:41 +08:00
suppress_update = FALSE;
}
void
devices_rc_update (gchar *name,
DeviceValues values,
GdkInputMode mode,
gint num_axes,
GdkAxisUse *axes,
gint num_keys,
GdkDeviceKey *keys,
ToolType tool,
GimpRGB *foreground,
GimpRGB *background,
1999-10-27 02:27:27 +08:00
gchar *brush_name,
gchar *pattern_name,
gchar *gradient_name)
{
DeviceInfo *device_info;
1999-10-27 02:27:27 +08:00
/* Find device if we have it */
device_info = device_info_get_by_name (name);
if (!device_info)
{
device_info = g_new (DeviceInfo, 1);
device_info->name = g_strdup (name);
device_info->is_present = FALSE;
if (values & DEVICE_AXES)
{
device_info->num_axes = num_axes;
device_info->axes = g_new (GdkAxisUse, num_axes);
memcpy (device_info->axes, axes, num_axes * sizeof (GdkAxisUse));
}
else
{
device_info->num_axes = 0;
device_info->axes = NULL;
}
if (values & DEVICE_KEYS)
{
device_info->num_keys = num_keys;
device_info->keys = g_new (GdkDeviceKey, num_keys);
memcpy (device_info->keys, axes, num_keys * sizeof (GdkDeviceKey));
}
if (values & DEVICE_MODE)
device_info->mode = mode;
else
device_info->mode = GDK_MODE_DISABLED;
1999-10-27 02:27:27 +08:00
device_info->context = gimp_context_new (device_info->name, NULL);
gimp_context_define_args (device_info->context,
DEVICE_CONTEXT_MASK,
FALSE);
gimp_context_copy_args (gimp_context_get_user (), device_info->context,
DEVICE_CONTEXT_MASK);
device_status_context_connect (device_info->context, device_info->device);
1999-10-27 02:27:27 +08:00
device_info_list = g_list_append (device_info_list, device_info);
}
else
{
1999-10-27 02:27:27 +08:00
GdkDeviceInfo *gdk_info;
1999-10-27 02:27:27 +08:00
gdk_info = gdk_device_info_get_by_id (device_info->device);
if (gdk_info != NULL)
{
if (values & DEVICE_MODE)
gdk_input_set_mode (gdk_info->deviceid, mode);
if ((values & DEVICE_AXES) && num_axes >= gdk_info->num_axes)
gdk_input_set_axes (gdk_info->deviceid, axes);
1999-10-27 02:27:27 +08:00
if ((values & DEVICE_KEYS) && num_keys >= gdk_info->num_keys)
{
1999-10-27 02:27:27 +08:00
gint i;
for (i=0; i<MAX (num_keys, gdk_info->num_keys); i++)
gdk_input_set_key (gdk_info->deviceid, i,
keys[i].keyval, keys[i].modifiers);
}
}
else
{
1999-11-23 06:38:02 +08:00
g_warning ("devices_rc_update called multiple times "
"for not present device\n");
return;
}
}
1999-10-27 02:27:27 +08:00
if (values & DEVICE_TOOL)
{
gimp_context_set_tool (device_info->context, tool);
}
1999-10-27 02:27:27 +08:00
if (values & DEVICE_FOREGROUND)
{
gimp_context_set_foreground (device_info->context, foreground);
1999-10-27 02:27:27 +08:00
}
if (values & DEVICE_BACKGROUND)
{
gimp_context_set_background (device_info->context, background);
1999-10-27 02:27:27 +08:00
}
if (values & DEVICE_BRUSH)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
GimpBrush *brush;
brush = gimp_brush_list_get_brush (brush_list, brush_name);
if (brush)
{
gimp_context_set_brush (device_info->context, brush);
}
else if (no_data)
{
g_free (device_info->context->brush_name);
device_info->context->brush_name = g_strdup (brush_name);
}
}
if (values & DEVICE_PATTERN)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
GPattern *pattern;
pattern = pattern_list_get_pattern (pattern_list, pattern_name);
if (pattern)
{
gimp_context_set_pattern (device_info->context, pattern);
}
else if (no_data)
{
g_free (device_info->context->pattern_name);
device_info->context->pattern_name = g_strdup (pattern_name);
}
}
1999-10-27 02:27:27 +08:00
if (values & DEVICE_GRADIENT)
{
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
gradient_t *gradient;
gradient = gradient_list_get_gradient (gradients_list, gradient_name);
if (gradient)
{
gimp_context_set_gradient (device_info->context, gradient);
}
else if (no_data)
{
g_free (device_info->context->gradient_name);
device_info->context->gradient_name = g_strdup (gradient_name);
}
}
}
app/airbrush.c app/apptypes.h app/brushes_cmds.c 1999-11-14 Michael Natterer <mitch@gimp.org> * app/airbrush.c * app/apptypes.h * app/brushes_cmds.c * tools/pdbgen/pdb/brushes.pdb * app/bucket_fill.c * app/clone.c * app/gimpbrushpipe.c * app/paint_core.c * app/patterns.h * app/patterns_cmds.c * tools/pdbgen/pdb/patterns.pdb: removed the GimpBrushP and GPatternP types and use ordinary pointers instead. The following stuff makes the "no_data" behaviour consistent. As a side-effect it should make the gimp work when there are _really_ no brushes/patterns/gradients. * app/brush_select.c * app/pattern_select.c: set the initial brush/pattern name to "No Brushes/Patterns available" instead of "Active". * app/devices.c: set the device contexts' brush/pattern/gradient names if we started with no_data, so we find them on refresh. * app/gimpbrushlist.c: set the name of the standard_brush to "Standard". * app/gimpcontext.c: don't replace the current brush/pattern/gradient's name if the new one to be set is the standard one. Together with the change in devices.c, this ensures that we get what is set in devicerc. Minor fixes. * app/gradient.c: changed gradients_init() to work like the other data init functions. Only insert a default gradient in the gradients list when the editor is opened (this means that the gradients now behave like brushes/patterns when we start with "no_data"). New function gradient_update() avoids tons of useless redraws of all clist gradient previews whenever the gradient editor wants to update it's large preview. * app/gradient_select.c: don't segfault when the user tries to drag from an empty gradient list. * app/patterns.c: set the index of the standard_pattern to -1 to indicate that it's not part of the pattern list.
1999-11-14 18:50:19 +08:00
void
select_device (guint32 new_device)
{
DeviceInfo *device_info;
1999-10-27 02:27:27 +08:00
GimpContext *context;
device_info = device_info_get_by_id (current_device);
gimp_context_unset_parent (device_info->context);
suppress_update = TRUE;
1999-10-27 02:27:27 +08:00
device_info = device_info_get_by_id (new_device);
1999-10-27 02:27:27 +08:00
current_device = new_device;
1999-10-27 02:27:27 +08:00
context = gimp_context_get_user ();
1999-10-27 02:27:27 +08:00
gimp_context_copy_args (device_info->context, context, DEVICE_CONTEXT_MASK);
gimp_context_set_parent (device_info->context, context);
suppress_update = FALSE;
device_status_update_current ();
}
gint
devices_check_change (GdkEvent *event)
{
guint32 device;
switch (event->type)
{
case GDK_MOTION_NOTIFY:
device = ((GdkEventMotion *)event)->deviceid;
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
device = ((GdkEventButton *)event)->deviceid;
break;
case GDK_PROXIMITY_OUT:
device = ((GdkEventProximity *)event)->deviceid;
break;
default:
device = current_device;
}
1999-10-27 02:27:27 +08:00
if (device != current_device)
{
select_device (device);
return TRUE;
}
else
{
1999-10-27 02:27:27 +08:00
return FALSE;
}
}
static void
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
devices_write_rc_device (DeviceInfo *device_info,
FILE *fp)
{
1999-10-27 02:27:27 +08:00
GdkDeviceInfo *gdk_info = NULL;
gchar *mode = NULL;
gint i;
if (device_info->is_present)
1999-10-27 02:27:27 +08:00
gdk_info = gdk_device_info_get_by_id (device_info->device);
1999-10-27 02:27:27 +08:00
fprintf (fp, "(device \"%s\"", device_info->name);
switch (gdk_info ? gdk_info->mode : device_info->mode)
{
case GDK_MODE_DISABLED:
mode = "disabled";
break;
case GDK_MODE_SCREEN:
mode = "screen";
break;
case GDK_MODE_WINDOW:
mode = "window";
break;
}
fprintf (fp, "\n (mode %s)", mode);
fprintf (fp, "\n (axes %d",
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gdk_info ? gdk_info->num_axes : device_info->num_axes);
1999-10-27 02:27:27 +08:00
for (i=0; i< (gdk_info ? gdk_info->num_axes : device_info->num_axes); i++)
{
gchar *axis_type = NULL; /* Quiet gcc */
1999-10-27 02:27:27 +08:00
switch (gdk_info ? gdk_info->axes[i] : device_info->axes[i])
{
case GDK_AXIS_IGNORE:
axis_type = "ignore";
break;
case GDK_AXIS_X:
axis_type = "x";
break;
case GDK_AXIS_Y:
axis_type = "y";
break;
case GDK_AXIS_PRESSURE:
axis_type = "pressure";
break;
case GDK_AXIS_XTILT:
axis_type = "xtilt";
break;
case GDK_AXIS_YTILT:
axis_type = "ytilt";
break;
#ifdef GTK_HAVE_SIX_VALUATORS
case GDK_AXIS_WHEEL:
axis_type = "wheel";
break;
#endif /* GTK_HAVE_SIX_VALUATORS */
}
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
fprintf (fp, " %s",axis_type);
}
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
fprintf (fp,")");
fprintf (fp, "\n (keys %d",
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gdk_info ? gdk_info->num_keys : device_info->num_keys);
for (i = 0; i < (gdk_info ? gdk_info->num_keys : device_info->num_keys); i++)
{
GdkModifierType modifiers = gdk_info ? gdk_info->keys[i].modifiers :
device_info->keys[i].modifiers;
guint keyval = gdk_info ? gdk_info->keys[i].keyval :
device_info->keys[i].keyval;
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
if (keyval)
{
/* FIXME: integrate this back with menus_install_accelerator */
1999-10-27 02:27:27 +08:00
gchar accel[64];
gchar t2[2];
accel[0] = '\0';
if (modifiers & GDK_CONTROL_MASK)
strcat (accel, "<control>");
if (modifiers & GDK_SHIFT_MASK)
strcat (accel, "<shift>");
if (modifiers & GDK_MOD1_MASK)
strcat (accel, "<alt>");
t2[0] = keyval;
t2[1] = '\0';
strcat (accel, t2);
fprintf (fp, " \"%s\"",accel);
}
else
fprintf (fp, " \"\"");
}
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
fprintf (fp,")");
1999-10-27 02:27:27 +08:00
/* Fixme: hard coded last tool.... see gimprc */
if (gimp_context_get_tool (device_info->context) >= FIRST_TOOLBOX_TOOL &&
gimp_context_get_tool (device_info->context) <= LAST_TOOLBOX_TOOL)
{
fprintf (fp, "\n (tool \"%s\")",
1999-10-27 02:27:27 +08:00
tool_info[gimp_context_get_tool (device_info->context)].tool_name);
}
1999-10-27 02:27:27 +08:00
{
GimpRGB color;
gimp_context_get_foreground (device_info->context, &color);
fprintf (fp, "\n (foreground (color-rgb %f %f %f))",
color.r, color.g, color.b);
gimp_context_get_background (device_info->context, &color);
fprintf (fp, "\n (background (color-rgb %f %f %f))",
color.r, color.g, color.b);
1999-10-27 02:27:27 +08:00
}
if (gimp_context_get_brush (device_info->context))
{
fprintf (fp, "\n (brush \"%s\")",
GIMP_OBJECT (gimp_context_get_brush (device_info->context))->name);
1999-10-27 02:27:27 +08:00
}
if (gimp_context_get_pattern (device_info->context))
{
fprintf (fp, "\n (pattern \"%s\")",
1999-10-27 02:27:27 +08:00
gimp_context_get_pattern (device_info->context)->name);
}
1999-10-28 23:05:49 +08:00
if (gimp_context_get_gradient (device_info->context))
{
fprintf (fp, "\n (gradient \"%s\")",
1999-10-28 23:05:49 +08:00
gimp_context_get_gradient (device_info->context)->name);
}
fprintf(fp,")\n");
}
static void
devices_write_rc (void)
{
1999-10-27 02:27:27 +08:00
DeviceInfo *device_info;
gchar *filename;
FILE *fp;
1999-10-27 02:27:27 +08:00
device_info = device_info_get_by_id (current_device);
1999-03-07 20:56:03 +08:00
filename = gimp_personal_rc_file ("devicerc");
fp = fopen (filename, "wb");
g_free (filename);
1999-03-07 20:56:03 +08:00
if (!fp)
return;
1999-10-27 02:27:27 +08:00
g_list_foreach (device_info_list, (GFunc) devices_write_rc_device, fp);
1999-03-07 20:56:03 +08:00
fclose (fp);
}
void
1999-10-27 02:27:27 +08:00
device_status_create (void)
{
DeviceInfo *device_info;
GtkWidget *label;
GimpRGB color;
GList *list;
gint i;
if (deviceD == NULL)
{
deviceD = g_new (DeviceInfoDialog, 1);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
deviceD->shell =
gimp_dialog_new (_("Device Status"), "device_status",
gimp_standard_help_func,
The GIMP Help System part II: press "F1" while browsing a menu to show the 1999-10-03 Michael Natterer <mitch@gimp.org> The GIMP Help System part II: press "F1" while browsing a menu to show the help page for the menu entry you're currently over with the mouse. * app/color_notebook.c: all color selectors have to register with a help page now. * app/color_select.[ch]: register with a help string. Removed the dialog part of the files because it's use was deprecated anyway (use color notebooks instead). * app/colormap_dialog.i.c * app/colormap_dialog.p.h * app/palette.c * app/palette_select.c: use a color notebook instead of a color selector. * app/gimphelp.c * app/gimpui.c: minor changes. * app/gimprc.c: "use help" defaults to TRUE now. * app/lc_dialog.c * app/lc_dialogP.h: a special help function which shows the help for the currently selected notebook page. * app/menus.c: some weird code which catches "key_press_event" in all menu shells and pops up the corresp. help page for the selected item. Embedded the GtkItemFactoryEntry in a new GimpItemFactoryEntry to allow a help path to be stored. Will be partially exported and moved to gimphelp.[ch] later to catch key_press for plug-in menu items (don't try this now ;-) * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/channel_ops.c * app/channels_dialog.c * app/commands.c * app/convert.c * app/devices.c * app/file_new_dialog.c * app/fileops.c * app/gdisplay.c * app/gdisplay_color.c * app/gdisplay_color_ui.c * app/gdisplay_ops.c * app/global_edit.c * app/gradient.c * app/gradient_select.c * app/interface.c * app/layers_dialog.c * app/module_db.c * app/paths_dialog.c * app/pattern_select.c * app/preferences_dialog.c * app/qmask.c * app/resize.c * app/undo_history.c: changed all dialog constructors to point to the right place in the new help file structure. * configure.in * help/*: the basic new help file structure. * modules/colorsel_gtk.c * modules/colorsel_triangle.c * modules/colorsel_water.c: register a help page. * plug-ins/helpbrowser/helpbrowser.c: load the help files according to the new help file structure.
1999-10-03 21:50:19 +08:00
"dialogs/device_status.html",
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
_("Save"), (GtkSignalFunc) devices_write_rc,
NULL, NULL, NULL, FALSE, FALSE,
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
_("Close"), devices_close_callback,
NULL, NULL, NULL, TRUE, TRUE,
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
NULL);
dialog_register (deviceD->shell);
session_set_window_geometry (deviceD->shell, &device_status_session_info,
FALSE);
deviceD->num_devices = 0;
1999-10-27 02:27:27 +08:00
for (list = device_info_list; list; list = g_list_next (list))
{
1999-10-27 02:27:27 +08:00
if (((DeviceInfo *) list->data)->is_present)
deviceD->num_devices++;
}
1999-10-27 02:27:27 +08:00
/* devices table */
deviceD->table = gtk_table_new (deviceD->num_devices, 7, FALSE);
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
gtk_container_set_border_width (GTK_CONTAINER (deviceD->table), 3);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (deviceD->shell)->vbox),
deviceD->table);
gtk_widget_realize (deviceD->table);
gtk_widget_show (deviceD->table);
deviceD->ids = g_new (guint32, deviceD->num_devices);
deviceD->frames = g_new (GtkWidget *, deviceD->num_devices);
deviceD->tools = g_new (GtkWidget *, deviceD->num_devices);
deviceD->foregrounds = g_new (GtkWidget *, deviceD->num_devices);
deviceD->backgrounds = g_new (GtkWidget *, deviceD->num_devices);
deviceD->brushes = g_new (GtkWidget *, deviceD->num_devices);
deviceD->patterns = g_new (GtkWidget *, deviceD->num_devices);
deviceD->gradients = g_new (GtkWidget *, deviceD->num_devices);
deviceD->eventboxes = g_new (GtkWidget *, deviceD->num_devices);
1999-10-27 02:27:27 +08:00
for (list = device_info_list, i = 0; list; list = g_list_next (list), i++)
{
1999-10-27 02:27:27 +08:00
if (!((DeviceInfo *) list->data)->is_present)
continue;
device_info = (DeviceInfo *) list->data;
deviceD->ids[i] = device_info->device;
1999-10-27 02:27:27 +08:00
/* the device name */
deviceD->frames[i] = gtk_frame_new (NULL);
1999-10-27 02:27:27 +08:00
gtk_frame_set_shadow_type (GTK_FRAME(deviceD->frames[i]),
GTK_SHADOW_OUT);
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->frames[i],
0, 1, i, i+1,
GTK_FILL, GTK_FILL, 2, 0);
label = gtk_label_new (device_info->name);
gtk_misc_set_padding (GTK_MISC(label), 2, 0);
gtk_container_add (GTK_CONTAINER(deviceD->frames[i]), label);
gtk_widget_show(label);
1999-10-27 02:27:27 +08:00
/* the tool */
deviceD->eventboxes[i] = gtk_event_box_new ();
deviceD->tools[i] = gtk_pixmap_new (tool_get_pixmap (RECT_SELECT),
tool_get_mask (RECT_SELECT));
1999-10-28 23:05:49 +08:00
gtk_drag_source_set (deviceD->eventboxes[i],
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
1999-10-28 23:05:49 +08:00
tool_target_table, n_tool_targets,
GDK_ACTION_COPY);
gimp_dnd_tool_source_set (deviceD->eventboxes[i],
device_status_drag_tool,
GUINT_TO_POINTER (device_info->device));
gtk_drag_dest_set (deviceD->eventboxes[i],
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
tool_target_table, n_tool_targets,
GDK_ACTION_COPY);
gimp_dnd_tool_dest_set (deviceD->eventboxes[i],
device_status_drop_tool,
GUINT_TO_POINTER (device_info->device));
1999-10-27 02:27:27 +08:00
gtk_container_add (GTK_CONTAINER (deviceD->eventboxes[i]),
deviceD->tools[i]);
gtk_table_attach (GTK_TABLE (deviceD->table), deviceD->eventboxes[i],
1, 2, i, i+1,
0, 0, 2, 2);
1999-10-27 02:27:27 +08:00
/* the foreground color */
deviceD->foregrounds[i] =
gimp_color_area_new (&color,
GIMP_COLOR_AREA_FLAT,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
gtk_widget_set_usize (deviceD->foregrounds[i], CELL_SIZE, CELL_SIZE);
gtk_signal_connect (GTK_OBJECT (deviceD->foregrounds[i]),
"color_changed",
GTK_SIGNAL_FUNC (device_status_foreground_changed),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE (deviceD->table),
deviceD->foregrounds[i],
2, 3, i, i+1,
0, 0, 2, 2);
/* the background color */
deviceD->backgrounds[i] =
gimp_color_area_new (&color,
GIMP_COLOR_AREA_FLAT,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
gtk_widget_set_usize (deviceD->backgrounds[i], CELL_SIZE, CELL_SIZE);
gtk_signal_connect (GTK_OBJECT (deviceD->backgrounds[i]),
"color_changed",
GTK_SIGNAL_FUNC (device_status_background_changed),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE (deviceD->table),
deviceD->backgrounds[i],
3, 4, i, i+1,
0, 0, 2, 2);
1999-10-27 02:27:27 +08:00
/* the brush */
1999-10-28 23:05:49 +08:00
deviceD->brushes[i] =
gimp_context_preview_new (GCP_BRUSH,
CELL_SIZE, CELL_SIZE,
FALSE, TRUE,
1999-10-28 23:05:49 +08:00
GTK_SIGNAL_FUNC (device_status_drop_brush),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->brushes[i],
4, 5, i, i+1,
0, 0, 2, 2);
1999-10-27 02:27:27 +08:00
/* the pattern */
1999-10-28 23:05:49 +08:00
deviceD->patterns[i] =
gimp_context_preview_new (GCP_PATTERN,
CELL_SIZE, CELL_SIZE,
FALSE, TRUE,
1999-10-28 23:05:49 +08:00
GTK_SIGNAL_FUNC (device_status_drop_pattern),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->patterns[i],
5, 6, i, i+1,
0, 0, 2, 2);
1999-10-28 23:05:49 +08:00
/* the gradient */
deviceD->gradients[i] =
gimp_context_preview_new (GCP_GRADIENT,
CELL_SIZE * 2, CELL_SIZE,
FALSE, TRUE,
1999-10-28 23:05:49 +08:00
GTK_SIGNAL_FUNC (device_status_drop_gradient),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->gradients[i],
6, 7, i, i+1,
1999-10-28 23:05:49 +08:00
0, 0, 2, 2);
1999-10-27 02:27:27 +08:00
device_status_update (device_info->device);
}
deviceD->current = 0xffffffff; /* random, but doesn't matter */
device_status_update_current ();
gtk_widget_show (deviceD->shell);
gtk_signal_connect (GTK_OBJECT (deviceD->shell), "destroy",
1999-10-27 02:27:27 +08:00
GTK_SIGNAL_FUNC (device_status_destroy_callback),
NULL);
}
else
{
1999-10-27 02:27:27 +08:00
if (!GTK_WIDGET_MAPPED (deviceD->shell))
gtk_widget_show (deviceD->shell);
else
1999-10-27 02:27:27 +08:00
gdk_window_raise (deviceD->shell->window);
}
}
static void
device_status_destroy_callback (void)
{
1999-10-27 02:27:27 +08:00
g_free (deviceD->ids);
g_free (deviceD->frames);
g_free (deviceD->tools);
g_free (deviceD->eventboxes);
g_free (deviceD->foregrounds);
g_free (deviceD->backgrounds);
1999-10-27 02:27:27 +08:00
g_free (deviceD->brushes);
g_free (deviceD->patterns);
1999-10-28 23:05:49 +08:00
g_free (deviceD->gradients);
1999-10-27 02:27:27 +08:00
g_free (deviceD);
deviceD = NULL;
}
static void
app/Makefile.am app/gimphelp.[ch] new files 1999-09-27 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gimphelp.[ch] * app/gimpui.[ch]: new files * app/interface.[ch] * app/preferences_dialog.[ch] The GIMP Help System part 1: Press "F1" in any dialog to pop up the help page for this dialog. Moved the widget constructors from preferences_dialog.[ch] and the query boxes from interface.[ch] to gimpui.[ch]. The dialog constructors take a help_func and a help_data parameter and install the "F1" accelerator which emits the new "help" signal. The "help" signal callback calls help_func(help_data) which finally has to call gimp_help() which in turn invokes the help browser. Still have to find a proper way to (1) prevent "F1" being assigned to some menu item and (2) to catch "F1" while browsing the menu trees in order to pop up the help for the selected item. * app/menus.c: a <Toolbox>/File/Help... menu item. * app/commands.[ch]: a command callback for the "Help..." menu item. * app/gimprc.[ch]: new boolean gimprc variable "use_help". * app/info_dialog.[ch]: pass a help function and data to the info dialog constructor. * app/tools.[ch]: store the tools help page names in the tool info structure. Export a special tools_help_func() which shows the help page for the active tool. * app/[all files calling a dialog constructor]: pass the dialog's help page to the constructor. Most dialogs are now created by gimp_dialog_new() which also sets up the action_area and the WM delete event callback, so I removed the resp. code from these files. Fixed some minor bugs and did some other stuff but didn't change any logic except dialog creation. * plug-ins/helpbrowser/helpbrowser.c: don't try to call a running help browser and don't install any menu path (all done in app/gimphelp.[ch] now).
1999-09-28 01:58:10 +08:00
devices_close_callback (GtkWidget *widget,
gpointer data)
{
1999-10-27 02:27:27 +08:00
gtk_widget_hide (GTK_WIDGET (data));
}
void
device_status_free (void)
{
1998-08-13 23:25:41 +08:00
/* Save device status on exit */
1999-10-27 02:27:27 +08:00
if (save_device_status)
devices_write_rc ();
1998-08-13 23:25:41 +08:00
if (deviceD)
{
session_get_window_info (deviceD->shell, &device_status_session_info);
device_status_destroy_callback ();
}
}
static void
1999-10-27 02:27:27 +08:00
device_status_update_current (void)
{
1999-10-27 02:27:27 +08:00
gint i;
if (deviceD)
{
1999-10-27 02:27:27 +08:00
for (i = 0; i < deviceD->num_devices; i++)
{
if (deviceD->ids[i] == deviceD->current)
gtk_frame_set_shadow_type (GTK_FRAME(deviceD->frames[i]),
GTK_SHADOW_OUT);
else if (deviceD->ids[i] == current_device)
gtk_frame_set_shadow_type (GTK_FRAME(deviceD->frames[i]),
GTK_SHADOW_IN);
}
1999-10-27 02:27:27 +08:00
deviceD->current = current_device;
}
}
void
device_status_update (guint32 deviceid)
{
GdkDeviceInfo *gdk_info;
1999-10-27 02:27:27 +08:00
DeviceInfo *device_info;
GimpRGB color;
guchar red, green, blue;
gchar ttbuf[64];
gint i;
1999-10-27 02:27:27 +08:00
if (!deviceD || suppress_update)
return;
if ((device_info = device_info_get_by_id (deviceid)) == NULL)
return;
if ((gdk_info = gdk_device_info_get_by_id (deviceid)) == NULL)
return;
for (i = 0; i < deviceD->num_devices; i++)
{
1999-10-27 02:27:27 +08:00
if (deviceD->ids[i] == deviceid)
break;
}
1999-10-27 02:27:27 +08:00
g_return_if_fail (i < deviceD->num_devices);
1999-10-27 02:27:27 +08:00
if (gdk_info->mode == GDK_MODE_DISABLED)
{
gtk_widget_hide (deviceD->frames[i]);
gtk_widget_hide (deviceD->tools[i]);
gtk_widget_hide (deviceD->eventboxes[i]);
gtk_widget_hide (deviceD->foregrounds[i]);
gtk_widget_hide (deviceD->backgrounds[i]);
1999-10-27 02:27:27 +08:00
gtk_widget_hide (deviceD->brushes[i]);
gtk_widget_hide (deviceD->patterns[i]);
1999-10-28 23:05:49 +08:00
gtk_widget_hide (deviceD->gradients[i]);
1999-10-27 02:27:27 +08:00
}
else
{
gtk_widget_show (deviceD->frames[i]);
gtk_pixmap_set (GTK_PIXMAP (deviceD->tools[i]),
tool_get_pixmap (gimp_context_get_tool (device_info->context)),
tool_get_mask (gimp_context_get_tool (device_info->context)));
1999-10-27 02:27:27 +08:00
gtk_widget_draw (deviceD->tools[i], NULL);
gtk_widget_show (deviceD->tools[i]);
gtk_widget_show (deviceD->eventboxes[i]);
gimp_help_set_help_data (deviceD->eventboxes[i],
tool_info[(gint) gimp_context_get_tool (device_info->context)].tool_desc,
tool_info[(gint) gimp_context_get_tool (device_info->context)].private_tip);
1999-10-27 02:27:27 +08:00
/* foreground color */
gimp_context_get_foreground (device_info->context, &color);
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->foregrounds[i]),
&color);
gtk_widget_show (deviceD->foregrounds[i]);
/* Set the tip to be the RGB value */
gimp_rgb_get_uchar (&color, &red, &green, &blue);
g_snprintf (ttbuf, sizeof (ttbuf), _("Foreground: %d, %d, %d"),
red, green, blue);
gtk_widget_add_events (deviceD->foregrounds[i],
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gimp_help_set_help_data (deviceD->foregrounds[i], ttbuf, NULL);
/* background color */
gimp_context_get_background (device_info->context, &color);
gimp_color_area_set_color (GIMP_COLOR_AREA (deviceD->backgrounds[i]),
&color);
gtk_widget_show (deviceD->backgrounds[i]);
/* Set the tip to be the RGB value */
gimp_rgb_get_uchar (&color, &red, &green, &blue);
g_snprintf (ttbuf, sizeof (ttbuf), _("Background: %d, %d, %d"),
red, green, blue);
gtk_widget_add_events (deviceD->backgrounds[i],
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gimp_help_set_help_data (deviceD->backgrounds[i], ttbuf, NULL);
1999-10-27 02:27:27 +08:00
if (gimp_context_get_brush (device_info->context))
{
gimp_context_preview_update
(GIMP_CONTEXT_PREVIEW (deviceD->brushes[i]),
gimp_context_get_brush (device_info->context));
gtk_widget_show (deviceD->brushes[i]);
}
1999-10-27 02:27:27 +08:00
if (gimp_context_get_pattern (device_info->context))
{
gimp_context_preview_update
(GIMP_CONTEXT_PREVIEW (deviceD->patterns[i]),
gimp_context_get_pattern (device_info->context));
gtk_widget_show (deviceD->patterns[i]);
}
1999-10-28 23:05:49 +08:00
if (gimp_context_get_gradient (device_info->context))
{
gimp_context_preview_update
(GIMP_CONTEXT_PREVIEW (deviceD->gradients[i]),
gimp_context_get_gradient (device_info->context));
gtk_widget_show (deviceD->gradients[i]);
}
}
}
1999-09-04 11:36:54 +08:00
/* dnd stuff */
1999-10-27 02:27:27 +08:00
1999-10-28 23:05:49 +08:00
static ToolType
device_status_drag_tool (GtkWidget *widget,
gpointer data)
{
DeviceInfo *device_info;
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
if (device_info)
{
return gimp_context_get_tool (device_info->context);
}
else
{
return RECT_SELECT;
}
}
static void
device_status_drop_tool (GtkWidget *widget,
ToolType tool,
gpointer data)
{
DeviceInfo *device_info;
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
if (device_info && device_info->is_present)
{
gimp_context_set_tool (device_info->context, tool);
}
}
1999-09-04 11:36:54 +08:00
static void
device_status_foreground_changed (GtkWidget *widget,
gpointer data)
1999-09-04 11:36:54 +08:00
{
1999-10-27 02:27:27 +08:00
DeviceInfo *device_info;
GimpRGB color;
1999-09-04 11:36:54 +08:00
1999-10-27 02:27:27 +08:00
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
1999-09-04 11:36:54 +08:00
if (device_info && device_info->is_present)
1999-09-04 11:36:54 +08:00
{
gimp_color_area_get_color (GIMP_COLOR_AREA (widget), &color);
gimp_context_set_foreground (device_info->context, &color);
1999-09-04 11:36:54 +08:00
}
}
static void
device_status_background_changed (GtkWidget *widget,
gpointer data)
1999-09-04 11:36:54 +08:00
{
1999-10-27 02:27:27 +08:00
DeviceInfo *device_info;
GimpRGB color;
1999-09-04 11:36:54 +08:00
1999-10-27 02:27:27 +08:00
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
1999-09-04 11:36:54 +08:00
if (device_info && device_info->is_present)
{
gimp_color_area_get_color (GIMP_COLOR_AREA (widget), &color);
gimp_context_set_background (device_info->context, &color);
1999-09-04 11:36:54 +08:00
}
}
static void
1999-10-28 23:05:49 +08:00
device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
{
1999-10-27 02:27:27 +08:00
DeviceInfo *device_info;
1999-10-10 04:33:53 +08:00
1999-10-27 02:27:27 +08:00
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
if (device_info && device_info->is_present)
{
1999-10-27 02:27:27 +08:00
gimp_context_set_brush (device_info->context, brush);
}
}
static void
1999-10-28 23:05:49 +08:00
device_status_drop_pattern (GtkWidget *widget,
GPattern *pattern,
gpointer data)
{
1999-10-27 02:27:27 +08:00
DeviceInfo *device_info;
1999-10-28 23:05:49 +08:00
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
1999-10-28 23:05:49 +08:00
if (device_info && device_info->is_present)
{
gimp_context_set_pattern (device_info->context, pattern);
}
}
1999-10-27 02:27:27 +08:00
1999-10-28 23:05:49 +08:00
static void
device_status_drop_gradient (GtkWidget *widget,
gradient_t *gradient,
gpointer data)
{
DeviceInfo *device_info;
1999-10-10 04:33:53 +08:00
1999-10-27 02:27:27 +08:00
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
1999-09-04 11:36:54 +08:00
if (device_info && device_info->is_present)
{
1999-10-28 23:05:49 +08:00
gimp_context_set_gradient (device_info->context, gradient);
}
}
1999-10-27 02:27:27 +08:00
/* context callbacks */
static void
device_status_data_changed (GimpContext *context,
gpointer dummy,
gpointer data)
{
DeviceInfo *device_info;
device_info = device_info_get_by_id (GPOINTER_TO_UINT (data));
device_status_update (device_info->device);
}
static void
device_status_context_connect (GimpContext *context,
guint32 deviceid)
{
gtk_signal_connect (GTK_OBJECT (context), "foreground_changed",
GTK_SIGNAL_FUNC (device_status_data_changed),
1999-10-27 02:27:27 +08:00
(gpointer) deviceid);
gtk_signal_connect (GTK_OBJECT (context), "background_changed",
GTK_SIGNAL_FUNC (device_status_data_changed),
(gpointer) deviceid);
1999-10-27 02:27:27 +08:00
gtk_signal_connect (GTK_OBJECT (context), "tool_changed",
GTK_SIGNAL_FUNC (device_status_data_changed),
(gpointer) deviceid);
gtk_signal_connect (GTK_OBJECT (context), "brush_changed",
GTK_SIGNAL_FUNC (device_status_data_changed),
(gpointer) deviceid);
gtk_signal_connect (GTK_OBJECT (context), "pattern_changed",
GTK_SIGNAL_FUNC (device_status_data_changed),
(gpointer) deviceid);
1999-10-28 23:05:49 +08:00
gtk_signal_connect (GTK_OBJECT (context), "gradient_changed",
GTK_SIGNAL_FUNC (device_status_data_changed),
(gpointer) deviceid);
1999-10-27 02:27:27 +08:00
}