gimp/app/widgets/gimppaletteeditor.c

1101 lines
30 KiB
C
Raw Normal View History

1997-11-24 22:05:25 +00:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-24 22:05:25 +00:00
*/
#include "config.h"
derive from GtkDrawingArea instead of deprecated GtkPreview. 2002-01-30 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpcolorarea.[ch]: derive from GtkDrawingArea instead of deprecated GtkPreview. * app/nav_window.c * app/gui/brush-editor.c * app/gui/buffers-commands.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/device-status-dialog.c * app/gui/dialogs-constructors.c * app/gui/file-open-dialog.c * app/gui/gradient-editor.c * app/gui/indicator-area.c * app/gui/info-window.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palettes-commands.c * app/gui/test-commands.c * app/gui/tool-options-dialog.c * app/gui/toolbox.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpdnd.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpimagedock.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.c * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.c * libgimp/gimpbrushmenu.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/blinds.c * plug-ins/common/curve_bend.c * plug-ins/common/depthmerge.c * plug-ins/common/despeckle.c * plug-ins/common/destripe.c * plug-ins/common/diffraction.c * plug-ins/common/emboss.c * plug-ins/common/exchange.c * plug-ins/common/flarefx.c * plug-ins/common/fractaltrace.c * plug-ins/common/glasstile.c * plug-ins/common/gqbist.c * plug-ins/common/grid.c * plug-ins/common/illusion.c * plug-ins/common/iwarp.c * plug-ins/common/jigsaw.c * plug-ins/common/mapcolor.c * plug-ins/common/max_rgb.c * plug-ins/common/newsprint.c * plug-ins/common/nlfilt.c * plug-ins/common/noisify.c * plug-ins/common/nova.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/sharpen.c * plug-ins/common/sinus.c * plug-ins/common/tileit.c * plug-ins/common/video.c * plug-ins/common/waves.c * plug-ins/common/whirlpinch.c * plug-ins/common/wind.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gimpressionist/brush.c * plug-ins/mosaic/mosaic.c * plug-ins/rcm/rcm_dialog.c: define GTK_DISABLE_DEPRECATED to make it compile. We really need a generic plug-in preview system that doesn't use GtkPreview.
2002-01-30 14:54:27 +00:00
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#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-23 18:49:44 +00:00
#include "libgimpcolor/gimpcolor.h"
#include "libgimpbase/gimpbase.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-24 22:36:18 +00:00
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
app/core/Makefile.am app/core/core-types.h added an "application object" 2001-07-04 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimp.[ch]: added an "application object" called Gimp. Currently, it contains the image list, the clipboard, the data factories, the procedural hashtable and the tool info list. It's the toplevel object of the core object system. Finally, creating a Gimp object will return a standalone gimp core engine instance with no other global states/variables involved. * app/app_procs.[ch]: allocate a "Gimp" instance called "the_gimp" :) Removed stuff which is now done by the "Gimp" object. Merged gimp_init() into app_init() because gimp_init() is taken now. * app/context_manager.[ch]: removed stuff done by "Gimp". * app/batch.[ch] * app/gimage.[ch] * app/xcf/xcf-load.[ch] * app/xcf/xcf.[ch] * app/core/gimpedit.[ch] * app/tools/tool_manager.[ch]: pass around an additional "Gimp" argument. * app/pdb/procedural_db.[ch]: pass a "Gimp" pointer as first parameter to all internal procedures and to all procedural_db_* functions. * app/core/gimpcontext.[ch] * app/core/gimpimage.[ch]: added a "Gimp" pointer to the structs. * app/devices.c * app/errors.c * app/file-open.c * app/file-save.c * app/gimphelp.c * app/gimpunit.c * app/image_new.c * app/main.c * app/nav_window.c * app/plug_in.c * app/base/base.c * app/core/gimpdatafactory.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-mask.c * app/core/gimptoolinfo.[ch] * app/gui/brush-select.c * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/edit-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/gradient-select.c * app/gui/gui.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/menus.c * app/gui/palette-editor.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/paths-dialog.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/test-commands.c * app/gui/toolbox.c * app/gui/tools-commands.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbucketfilltool.c * app/tools/gimppainttool.h * app/tools/gimptexttool.c * app/tools/gimptransformtool.h * app/widgets/gimpbufferview.c * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpcursor.c * app/widgets/gimpdnd.c * app/widgets/gimpimagedock.c: changed accordingly. Cleaned up lots of includes. Many files still access the global "the_gimp" variable exported by app_procs.h. * tools/pdbgen/app.pl * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/edit.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed accordingly. Don't use "the_gimp" here because all procedures get passed a "Gimp" pointer now. * app/pdb/*: regenerated.
2001-07-04 19:31:35 +00:00
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimppalette.h"
#include "gimpdnd.h"
#include "gimpitemfactory.h"
#include "gimppaletteeditor.h"
#include "gimppreview.h"
g_strdup() the stock_id passed to gimp_tool_info_new() because the 2002-03-14 Michael Natterer <mitch@gimp.org> * app/core/gimptoolinfo.c: g_strdup() the stock_id passed to gimp_tool_info_new() because the caller's memory may disappear after registering the tool (tool modules). Made a GimpDock out of the toolbox: * app/gui/Makefile.am * app/gui/color-area.[ch] * app/gui/indicator-area.[ch] * app/gui/toolbox.[ch]: removed... * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimptoolbox-color-area.[ch] * app/widgets/gimptoolbox-indicator-area.[ch] * app/widgets/gimptoolbox.[ch]: ...and added here. * app/widgets/gimpdock.[ch]: don't set a minimal width. Added a "destroy_if_empty" boolean so we can prevent destruction of the toolbox if it's last dockable is removed. Added gimp_dock_construct() which is called from GimpImageDock and GimpToolbox. * app/widgets/gimpimagedock.[ch]: Default to not showing the image menu, set a minimal width here, misc. minor cleanup. * app/widgets/gimpdockbook.c: some more GIMP_IS_IMAGE_DOCK() checks, fixed dnd widget creation. * app/widgets/gimpdialogfactory.[ch]: changed gimp_dialog_factories_toggle() to take just the toolbox_factory as parameter. When restoring the session use the created dock's dialog factory to create dockables, not the the factory we created the dock from (for the toolbox). * app/display/gimpdisplayshell-callbacks.c: changed accordingly. * app/gui/dialogs.[ch]: create an own dialog factory for the toolbox and set dialogs_toolbox_new() as it's new_dock_func. * app/gui/dialogs-constructors.[ch]: changed dialogs_toolbox_get() accordingly. * app/gui/dialogs-commands.[ch]: added dialogs_show_toolbox(), ckeck if a dock is really a GimpImageDock before casting. * app/gui/gui.c * app/gui/menus.c * app/widgets/gimppaletteeditor.c: changed accordingly. * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/palette-editor-commands.c: removed useless inclusion of "gui/color-area.h". * themes/Default/gtkrc: set "gimp-dock-style" for GimpToolbox widgets.
2002-03-14 17:07:02 +00:00
#include "gimptoolbox-color-area.h"
2001-04-11 01:13:53 +00:00
#include "gui/color-notebook.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 15:22:01 +00:00
#define ENTRY_WIDTH 12
#define ENTRY_HEIGHT 10
#define SPACING 1
#define COLUMNS 16
#define ROWS 11
1997-11-24 22:05:25 +00:00
#define PREVIEW_WIDTH ((ENTRY_WIDTH * COLUMNS) + (SPACING * (COLUMNS + 1)))
#define PREVIEW_HEIGHT ((ENTRY_HEIGHT * ROWS) + (SPACING * (ROWS + 1)))
1997-11-24 22:05:25 +00:00
#define PALETTE_EVENT_MASK (GDK_EXPOSURE_MASK | \
GDK_BUTTON_PRESS_MASK | \
GDK_ENTER_NOTIFY_MASK)
1997-11-24 22:05:25 +00:00
/* local function prototypes */
static void gimp_palette_editor_class_init (GimpPaletteEditorClass *klass);
static void gimp_palette_editor_init (GimpPaletteEditor *editor);
static void gimp_palette_editor_destroy (GtkObject *object);
static void gimp_palette_editor_unmap (GtkWidget *widget);
1997-11-24 22:05:25 +00:00
static void gimp_palette_editor_set_data (GimpDataEditor *editor,
GimpData *data);
static gint palette_editor_eventbox_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpPaletteEditor *editor);
static gint palette_editor_color_area_events (GtkWidget *widget,
GdkEvent *event,
GimpPaletteEditor *editor);
static void palette_editor_draw_entries (GimpPaletteEditor *editor,
gint row_start,
gint column_highlight);
static void palette_editor_redraw (GimpPaletteEditor *editor);
static void palette_editor_scroll_top_left (GimpPaletteEditor *editor);
static void palette_editor_color_name_changed (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_columns_changed (GtkAdjustment *adj,
GimpPaletteEditor *editor);
static void palette_editor_zoom_in_callback (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_zoom_out_callback (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_zoom_all_callback (GtkWidget *widget,
GimpPaletteEditor *editor);
static void palette_editor_redraw_zoom (GimpPaletteEditor *editor);
static void palette_editor_drag_color (GtkWidget *widget,
GimpRGB *color,
gpointer data);
static void palette_editor_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data);
static void palette_editor_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data);
static void palette_editor_invalidate_preview (GimpPalette *palette,
GimpPaletteEditor *editor);
1999-10-26 18:27:27 +00:00
1997-11-24 22:05:25 +00:00
/* dnd stuff */
static GtkTargetEntry color_palette_target_table[] =
{
GIMP_TARGET_COLOR,
GIMP_TARGET_PALETTE
};
1997-11-24 22:05:25 +00:00
static GimpDataEditorClass *parent_class = NULL;
1999-10-26 18:27:27 +00:00
GType
gimp_palette_editor_get_type (void)
{
static GType type = 0;
if (! type)
{
static const GTypeInfo info =
{
sizeof (GimpPaletteEditorClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_palette_editor_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPaletteEditor),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_palette_editor_init,
};
type = g_type_register_static (GIMP_TYPE_DATA_EDITOR,
"GimpPaletteEditor",
&info, 0);
}
return type;
}
static void
gimp_palette_editor_class_init (GimpPaletteEditorClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpDataEditorClass *editor_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
editor_class = GIMP_DATA_EDITOR_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
1997-11-24 22:05:25 +00:00
object_class->destroy = gimp_palette_editor_destroy;
1999-10-26 18:27:27 +00:00
widget_class->unmap = gimp_palette_editor_unmap;
1997-11-24 22:05:25 +00:00
editor_class->set_data = gimp_palette_editor_set_data;
1997-11-24 22:05:25 +00:00
}
static void
gimp_palette_editor_init (GimpPaletteEditor *editor)
{
GtkWidget *scrolledwindow;
GtkWidget *palette_region;
GtkWidget *eventbox;
GtkWidget *alignment;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *spinbutton;
editor->zoom_factor = 1.0;
editor->columns = COLUMNS;
editor->columns_valid = TRUE;
editor->freeze_update = FALSE;
editor->scrolled_window = scrolledwindow =
gtk_scrolled_window_new (NULL, NULL);
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 13:26:29 +00:00
gtk_widget_set_size_request (scrolledwindow, -1, PREVIEW_HEIGHT);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (editor), scrolledwindow, TRUE, TRUE, 0);
gtk_widget_show (scrolledwindow);
eventbox = gtk_event_box_new ();
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow),
eventbox);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-03 19:43:19 +00:00
gtk_widget_show (eventbox);
g_signal_connect (G_OBJECT (eventbox), "button_press_event",
G_CALLBACK (palette_editor_eventbox_button_press),
editor);
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (eventbox), alignment);
gtk_widget_show (alignment);
editor->color_area = palette_region = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_set_dither (GTK_PREVIEW (editor->color_area), GDK_RGB_DITHER_MAX);
gtk_preview_size (GTK_PREVIEW (palette_region), PREVIEW_WIDTH, PREVIEW_HEIGHT);
gtk_widget_set_events (palette_region, PALETTE_EVENT_MASK);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-03 19:43:19 +00:00
gtk_container_add (GTK_CONTAINER (alignment), palette_region);
gtk_widget_show (palette_region);
g_signal_connect (G_OBJECT (editor->color_area), "event",
G_CALLBACK (palette_editor_color_area_events),
editor);
/* dnd stuff */
gtk_drag_source_set (palette_region,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
Cleanup weekend... 2001-10-29 Michael Natterer <mitch@gimp.org> Cleanup weekend... * app/app_procs.c: pass "no_interface" to gimp_new(). * app/core/gimp.[ch]: added "gboolean no_interface" and the load_procs and save_procs GSLists. * app/core/gimptoolinfo.[ch]: added a "Gimp" pointer to the GimpToolInfo object so more functions find their context without accessing the global "the_gimp" variable. * app/display/display-types.h: removed the GDisplay -> GimpDisplay typedef. * app/display/gimpdisplay.c: look at gimp->no_interface, don't include "appenv.h". * app/file/file-open.[ch] * app/file/file-save.[ch]: don't use "the_gimp" any more. Instead, pass around lots of "Gimp" pointers. Removed the global load_procs and save_procs variables here. Use access() to find out whether a file is readable/writable, removed the manual voodoo and it's Win32 wrappers. Added an optional (can be NULL) "PlunInProcDef" parameter to file_save(), removed file_save_with_proc(). * app/gui/menus.c: Use the unused "gpointer data" parameter of the GtkItemFactory callbacks to pass a "Gimp" pointer to all of them. This reduces the usage of the global "the_gimp" hack to zero in app/gui/... yeah. * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/palettes-commands.c * app/gui/select-commands.c * app/gui/test-commands.c * app/gui/tools-commands.c * app/gui/view-commands.c: use the passed "Gimp" pointer. * app/gui/color-area.[ch] * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/gui.c * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/palette-editor.c * app/gui/palette-import-dialog.[ch] * app/gui/paths-dialog.c * app/gui/preferences-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/tool-options-dialog.[ch] * app/gui/toolbox.c: pass around lots more "Gimp" and "GimpContext" pointers and don't use "the_gimp" any more. * app/tools/gimptool.h: added a pointer to the corresponding GimpToolInfo object (which in turn has a pointer to a Gimp). * app/tools/tool_manager.[ch]: set the pointer after creating the tool object. Removed tool_manager_get_info_by_tool() as there is a tool->tool_info pointer now. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/path_tool.c * app/tools/xinput_airbrush.c: s/GDisplay/GimpDisplay/g. Use tool->tool_info and tool_info->gimp in some places to get rid of using "the_gimp". Removing the remaining ones involves changing the tool options system and is scheduled next... * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c: pass a "Gimp" pointer to all file_open_*() functions. * app/gdisplay_color.[ch] * app/gdisplay_color_ui.[ch] * app/image_map.[ch] * app/nav_window.[ch] * app/path.c * app/path_bezier.c * app/path_transform.h * app/qmask.[ch]: s/GDisplay/GimpDisplay/g * tools/pdbgen/pdb/fileops.pdb: load_procs and save_procs are members of the "Gimp" object now. * tools/pdbgen/pdb/plug_in.pdb: use gimp->no_interface, don't include "appenv.h". * app/pdb/fileops_cmds.c * app/pdb/plug_in_cmds.c: regenerated.
2001-10-29 11:47:11 +00:00
color_palette_target_table,
G_N_ELEMENTS (color_palette_target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (palette_region,
palette_editor_drag_color,
editor);
gtk_drag_dest_set (eventbox,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
Cleanup weekend... 2001-10-29 Michael Natterer <mitch@gimp.org> Cleanup weekend... * app/app_procs.c: pass "no_interface" to gimp_new(). * app/core/gimp.[ch]: added "gboolean no_interface" and the load_procs and save_procs GSLists. * app/core/gimptoolinfo.[ch]: added a "Gimp" pointer to the GimpToolInfo object so more functions find their context without accessing the global "the_gimp" variable. * app/display/display-types.h: removed the GDisplay -> GimpDisplay typedef. * app/display/gimpdisplay.c: look at gimp->no_interface, don't include "appenv.h". * app/file/file-open.[ch] * app/file/file-save.[ch]: don't use "the_gimp" any more. Instead, pass around lots of "Gimp" pointers. Removed the global load_procs and save_procs variables here. Use access() to find out whether a file is readable/writable, removed the manual voodoo and it's Win32 wrappers. Added an optional (can be NULL) "PlunInProcDef" parameter to file_save(), removed file_save_with_proc(). * app/gui/menus.c: Use the unused "gpointer data" parameter of the GtkItemFactory callbacks to pass a "Gimp" pointer to all of them. This reduces the usage of the global "the_gimp" hack to zero in app/gui/... yeah. * app/gui/channels-commands.c * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/image-commands.c * app/gui/layers-commands.c * app/gui/palettes-commands.c * app/gui/select-commands.c * app/gui/test-commands.c * app/gui/tools-commands.c * app/gui/view-commands.c: use the passed "Gimp" pointer. * app/gui/color-area.[ch] * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/gui.c * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/palette-editor.c * app/gui/palette-import-dialog.[ch] * app/gui/paths-dialog.c * app/gui/preferences-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/tool-options-dialog.[ch] * app/gui/toolbox.c: pass around lots more "Gimp" and "GimpContext" pointers and don't use "the_gimp" any more. * app/tools/gimptool.h: added a pointer to the corresponding GimpToolInfo object (which in turn has a pointer to a Gimp). * app/tools/tool_manager.[ch]: set the pointer after creating the tool object. Removed tool_manager_get_info_by_tool() as there is a tool->tool_info pointer now. * app/tools/gimpbezierselecttool.c * app/tools/gimpblendtool.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimpdodgeburntool.c * app/tools/gimpdrawtool.c * app/tools/gimpeditselectiontool.c * app/tools/gimpellipseselecttool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimppathtool.c * app/tools/gimpperspectivetool.c * app/tools/gimpposterizetool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptexttool.c * app/tools/gimpthresholdtool.c * app/tools/path_tool.c * app/tools/xinput_airbrush.c: s/GDisplay/GimpDisplay/g. Use tool->tool_info and tool_info->gimp in some places to get rid of using "the_gimp". Removing the remaining ones involves changing the tool options system and is scheduled next... * app/widgets/gimpdnd.c * app/widgets/gimpdocumentview.c: pass a "Gimp" pointer to all file_open_*() functions. * app/gdisplay_color.[ch] * app/gdisplay_color_ui.[ch] * app/image_map.[ch] * app/nav_window.[ch] * app/path.c * app/path_bezier.c * app/path_transform.h * app/qmask.[ch]: s/GDisplay/GimpDisplay/g * tools/pdbgen/pdb/fileops.pdb: load_procs and save_procs are members of the "Gimp" object now. * tools/pdbgen/pdb/plug_in.pdb: use gimp->no_interface, don't include "appenv.h". * app/pdb/fileops_cmds.c * app/pdb/plug_in_cmds.c: regenerated.
2001-10-29 11:47:11 +00:00
color_palette_target_table,
G_N_ELEMENTS (color_palette_target_table),
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (eventbox, palette_editor_drop_color, editor);
gimp_dnd_viewable_dest_set (eventbox, GIMP_TYPE_PALETTE,
palette_editor_drop_palette,
editor);
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
/* The color name entry */
editor->color_name = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), editor->color_name, TRUE, TRUE, 0);
gtk_entry_set_text (GTK_ENTRY (editor->color_name), _("Undefined"));
gtk_widget_set_sensitive (editor->color_name, FALSE);
gtk_widget_show (editor->color_name);
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-03 19:43:19 +00:00
editor->entry_sig_id =
g_signal_connect (G_OBJECT (editor->color_name), "changed",
G_CALLBACK (palette_editor_color_name_changed),
editor);
label = gtk_label_new (_("Columns:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
spinbutton = gimp_spin_button_new ((GtkObject **) &editor->columns_data,
0, 0, 64, 1, 4, 4, 1, 0);
gtk_widget_set_size_request (spinbutton, 50, -1);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
gtk_widget_show (spinbutton);
g_signal_connect (G_OBJECT (editor->columns_data), "value_changed",
G_CALLBACK (palette_editor_columns_changed),
editor);
/* + and - buttons */
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_FIT,
_("Zoom All"), NULL,
G_CALLBACK (palette_editor_zoom_all_callback),
NULL,
editor);
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_IN,
_("Zoom In"), NULL,
G_CALLBACK (palette_editor_zoom_in_callback),
NULL,
editor);
gimp_editor_add_button (GIMP_EDITOR (editor),
GTK_STOCK_ZOOM_OUT,
_("Zoom Out"), NULL,
G_CALLBACK (palette_editor_zoom_out_callback),
NULL,
editor);
}
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-03 19:43:19 +00:00
static void
gimp_palette_editor_destroy (GtkObject *object)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (object);
if (editor->color_notebook)
{
color_notebook_free (editor->color_notebook);
editor->color_notebook = NULL;
editor->color_notebook_active = FALSE;
}
set style properties for dockables. 2001-08-03 Michael Natterer <mitch@gimp.org> * gtkrc: set style properties for dockables. * app/main.c: some #if 0'ed code for mem profiling. * app/gui/commands.[ch] * app/gui/menus.c: added a mem profiling menu entry + callback. * app/gui/palette-editor.c: added a #warning as reminder, use gtk_dialog_set_has_separator(). * app/widgets/gimpcontainereditor.[ch] * app/widgets/gimpcontainerview.[ch] * app/widgets/gimpdockable.[ch] * app/widgets/gimpdrawablelistview.[ch]: added some style properties to set GimpDockable and friends' borders and spacings. * libgimpwidgets/gimppixmap.[ch] * libgimpwidgets/gimpsizeentry.[ch] * libgimpwidgets/gimpunitmenu.[ch]: GObject stuff, cleanup. * app/docindex.c * app/errorconsole.c * app/gdisplay_color_ui.c * app/gimpprogress.c * app/module_db.c * app/undo_history.c * app/user_install.c * app/gui/channels-commands.c * app/gui/gradient-editor.c * app/gui/info-window.c * app/gui/tips-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphistogramtool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpmeasuretool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c * app/widgets/gimpdatafactoryview.c * libgimp/gimpexport.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * plug-ins/[lots of files]: Some perl mass processing applying s/_("Foo")/GTK_STOCK_FOO/g, minor manual cleanup in some files.
2001-08-03 19:43:19 +00:00
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_palette_editor_unmap (GtkWidget *widget)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (widget);
if (editor->color_notebook_active)
{
color_notebook_hide (editor->color_notebook);
editor->color_notebook_active = FALSE;
}
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
static void
gimp_palette_editor_set_data (GimpDataEditor *editor,
GimpData *data)
{
GimpPaletteEditor *palette_editor;
palette_editor = GIMP_PALETTE_EDITOR (editor);
g_signal_handler_block (G_OBJECT (palette_editor->color_name),
palette_editor->entry_sig_id);
g_signal_handlers_block_by_func (G_OBJECT (palette_editor->columns_data),
palette_editor_columns_changed,
editor);
if (editor->data)
{
if (palette_editor->color_notebook)
{
color_notebook_free (palette_editor->color_notebook);
palette_editor->color_notebook = NULL;
palette_editor->color_notebook_active = FALSE;
}
g_signal_handlers_disconnect_by_func (G_OBJECT (editor->data),
palette_editor_invalidate_preview,
editor);
palette_editor->columns_valid = FALSE;
palette_editor->color = NULL;
gtk_entry_set_text (GTK_ENTRY (palette_editor->color_name),
_("Undefined"));
gtk_widget_set_sensitive (palette_editor->color_name, FALSE);
gtk_adjustment_set_value (palette_editor->columns_data, 0);
}
GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);
if (editor->data)
{
GimpPalette *palette;
palette = GIMP_PALETTE (editor->data);
g_signal_connect (G_OBJECT (editor->data), "invalidate_preview",
G_CALLBACK (palette_editor_invalidate_preview),
editor);
gtk_adjustment_set_value (palette_editor->columns_data,
palette->n_columns);
palette_editor_invalidate_preview (GIMP_PALETTE (editor->data),
palette_editor);
palette_editor_scroll_top_left (palette_editor);
}
g_signal_handlers_unblock_by_func (G_OBJECT (palette_editor->columns_data),
palette_editor_columns_changed,
editor);
g_signal_handler_unblock (G_OBJECT (palette_editor->color_name),
palette_editor->entry_sig_id);
}
/* public functions */
GimpDataEditor *
gimp_palette_editor_new (Gimp *gimp)
{
GimpPaletteEditor *palette_editor;
palette_editor = g_object_new (GIMP_TYPE_PALETTE_EDITOR, NULL);
gimp_data_editor_construct (GIMP_DATA_EDITOR (palette_editor),
gimp,
GIMP_TYPE_PALETTE);
return GIMP_DATA_EDITOR (palette_editor);
}
void
gimp_palette_editor_update_color (GimpContext *context,
const GimpRGB *color,
GimpUpdateColorState state)
{
#ifdef __GNUC__
#warning FIXME: palette_set_active_color()
#endif
#if 0
if (top_level_edit_palette)
{
GimpPalette *palette;
palette = gimp_context_get_palette (top_level_edit_palette->context);
if (palette)
{
switch (state)
{
case GIMP_UPDATE_COLOR_STATE_NEW:
top_level_edit_palette->color = gimp_palette_add_entry (palette,
NULL,
color);
break;
case GIMP_UPDATE_COLOR_STATE_UPDATE_NEW:
top_level_edit_palette->color->color = *color;
gimp_data_dirty (GIMP_DATA (palette));
break;
default:
break;
}
}
}
#endif
}
/* private functions */
/* the color area event callbacks ******************************************/
static gint
palette_editor_eventbox_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpPaletteEditor *editor)
{
if (gtk_get_event_widget ((GdkEvent *) bevent) == editor->color_area)
return FALSE;
if (bevent->button == 3)
{
GimpItemFactory *factory;
factory = gimp_item_factory_from_path ("<PaletteEditor>");
gimp_item_factory_popup_with_data (factory, editor, NULL);
}
return TRUE;
}
1999-10-26 18:27:27 +00:00
static gint
palette_editor_color_area_events (GtkWidget *widget,
GdkEvent *event,
GimpPaletteEditor *editor)
1997-11-24 22:05:25 +00:00
{
GimpPalette *palette;
GimpContext *user_context;
GdkEventButton *bevent;
GList *list;
gint entry_width;
gint entry_height;
gint row, col;
gint pos;
1997-11-24 22:05:25 +00:00
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->gimp);
switch (event->type)
1997-11-24 22:05:25 +00:00
{
case GDK_EXPOSE:
palette_editor_redraw (editor);
return FALSE;
case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event;
entry_width = editor->col_width + SPACING;
entry_height = (ENTRY_HEIGHT * editor->zoom_factor) + SPACING;
col = (bevent->x - 1) / entry_width;
row = (bevent->y - 1) / entry_height;
pos = row * editor->columns + col;
if (palette)
list = g_list_nth (palette->colors, pos);
else
list = NULL;
if (list)
editor->dnd_color = list->data;
else
editor->dnd_color = NULL;
if ((bevent->button == 1 || bevent->button == 3) && palette)
1997-11-24 22:05:25 +00:00
{
if (list)
1997-11-24 22:05:25 +00:00
{
if (editor->color)
1997-11-24 22:05:25 +00:00
{
editor->freeze_update = TRUE;
palette_editor_draw_entries (editor, -1, -1);
editor->freeze_update = FALSE;
1997-11-24 22:05:25 +00:00
}
editor->color = (GimpPaletteEntry *) list->data;
1997-11-24 22:05:25 +00:00
if (active_color == FOREGROUND)
{
if (bevent->state & GDK_CONTROL_MASK)
gimp_context_set_background (user_context,
&editor->color->color);
else
gimp_context_set_foreground (user_context,
&editor->color->color);
}
else if (active_color == BACKGROUND)
{
if (bevent->state & GDK_CONTROL_MASK)
gimp_context_set_foreground (user_context,
&editor->color->color);
else
gimp_context_set_background (user_context,
&editor->color->color);
}
1997-11-24 22:05:25 +00:00
palette_editor_draw_entries (editor, row, col);
/* Update the active color name */
g_signal_handler_block (G_OBJECT (editor->color_name),
editor->entry_sig_id);
gtk_entry_set_text (GTK_ENTRY (editor->color_name),
editor->color->name);
g_signal_handler_unblock (G_OBJECT (editor->color_name),
editor->entry_sig_id);
gtk_widget_set_sensitive (editor->color_name, TRUE);
/* palette_update_current_entry (editor); */
if (bevent->button == 3)
{
GimpItemFactory *factory;
factory = gimp_item_factory_from_path ("<PaletteEditor>");
gimp_item_factory_popup_with_data (factory, editor, NULL);
}
}
else
{
1999-10-26 18:27:27 +00:00
if (bevent->button == 3)
{
GimpItemFactory *factory;
factory = gimp_item_factory_from_path ("<PaletteEditor>");
gimp_item_factory_popup_with_data (factory, editor, NULL);
}
1997-11-24 22:05:25 +00:00
}
}
break;
default:
break;
1997-11-24 22:05:25 +00:00
}
return TRUE;
1997-11-24 22:05:25 +00:00
}
1999-10-26 18:27:27 +00:00
/* functions for drawing & updating the palette dialog color area **********/
1997-11-24 22:05:25 +00:00
static gint
palette_editor_draw_color_row (guchar *colors,
gint n_colors,
gint y,
gint column_highlight,
guchar *buffer,
GimpPaletteEditor *palette_editor)
{
guchar *p;
guchar bcolor;
gint width, height;
gint entry_width;
gint entry_height;
gint vsize;
gint vspacing;
gint i, j;
GtkWidget *preview;
if (! palette_editor)
return -1;
preview = palette_editor->color_area;
1997-11-24 22:05:25 +00:00
bcolor = 0;
width = preview->requisition.width;
height = preview->requisition.height;
entry_width = palette_editor->col_width;
entry_height = (ENTRY_HEIGHT * palette_editor->zoom_factor);
1997-11-24 22:05:25 +00:00
if ((y >= 0) && ((y + SPACING) < height))
vspacing = SPACING;
else if (y < 0)
vspacing = SPACING + y;
else
vspacing = height - y;
if (vspacing > 0)
{
if (y < 0)
y += SPACING - vspacing;
for (i = SPACING - vspacing; i < SPACING; i++, y++)
{
p = buffer;
for (j = 0; j < width; j++)
{
*p++ = bcolor;
*p++ = bcolor;
*p++ = bcolor;
}
if (column_highlight >= 0)
{
guchar *ph;
ph = &buffer[3 * column_highlight * (entry_width + SPACING)];
for (j = 0 ; j <= entry_width + SPACING; j++)
{
*ph++ = ~bcolor;
*ph++ = ~bcolor;
*ph++ = ~bcolor;
}
gtk_preview_draw_row (GTK_PREVIEW (preview), buffer, 0,
y + entry_height + 1, width);
}
1997-11-24 22:05:25 +00:00
gtk_preview_draw_row (GTK_PREVIEW (preview), buffer, 0, y, width);
}
if (y > SPACING)
y += SPACING - vspacing;
}
else
y += SPACING;
vsize = (y >= 0) ? (entry_height) : (entry_height + y);
if ((y >= 0) && ((y + entry_height) < height))
vsize = entry_height;
else if (y < 0)
vsize = entry_height + y;
else
vsize = height - y;
if (vsize > 0)
{
p = buffer;
for (i = 0; i < n_colors; i++)
1997-11-24 22:05:25 +00:00
{
for (j = 0; j < SPACING; j++)
{
*p++ = bcolor;
*p++ = bcolor;
*p++ = bcolor;
}
for (j = 0; j < entry_width; j++)
{
*p++ = colors[i * 3];
*p++ = colors[i * 3 + 1];
*p++ = colors[i * 3 + 2];
1997-11-24 22:05:25 +00:00
}
}
for (i = 0; i < (palette_editor->columns - n_colors); i++)
1997-11-24 22:05:25 +00:00
{
for (j = 0; j < (SPACING + entry_width); j++)
{
*p++ = 0;
*p++ = 0;
*p++ = 0;
}
}
for (j = 0; j < SPACING; j++)
{
if (n_colors == column_highlight)
{
*p++ = ~bcolor;
*p++ = ~bcolor;
*p++ = ~bcolor;
}
else
{
*p++ = bcolor;
*p++ = bcolor;
*p++ = bcolor;
}
1997-11-24 22:05:25 +00:00
}
if (y < 0)
y += entry_height - vsize;
for (i = 0; i < vsize; i++, y++)
{
if (column_highlight >= 0)
{
guchar *ph;
ph = &buffer[3 * column_highlight * (entry_width + SPACING)];
*ph++ = ~bcolor;
*ph++ = ~bcolor;
*ph++ = ~bcolor;
ph += 3 * (entry_width);
*ph++ = ~bcolor;
*ph++ = ~bcolor;
*ph++ = ~bcolor;
}
gtk_preview_draw_row (GTK_PREVIEW (preview), buffer, 0, y, width);
}
1997-11-24 22:05:25 +00:00
if (y > entry_height)
y += entry_height - vsize;
}
else
y += entry_height;
return y;
}
static void
palette_editor_draw_entries (GimpPaletteEditor *editor,
gint row_start,
gint column_highlight)
1997-11-24 22:05:25 +00:00
{
GimpPalette *palette;
GimpPaletteEntry *entry;
guchar *buffer;
guchar *colors;
GList *list;
gint width, height;
gint entry_width;
gint entry_height;
gint index, y;
1997-11-24 22:05:25 +00:00
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! palette)
return;
1997-11-24 22:05:25 +00:00
width = editor->color_area->requisition.width;
height = editor->color_area->requisition.height;
1997-11-24 22:05:25 +00:00
entry_width = editor->col_width;
entry_height = (ENTRY_HEIGHT * editor->zoom_factor);
if (entry_width <= 0)
return;
1997-11-24 22:05:25 +00:00
colors = g_new (guchar, editor->columns * 3);
buffer = g_new (guchar, width * 3);
if (row_start < 0)
{
y = 0;
list = palette->colors;
column_highlight = -1;
}
else
{
y = (entry_height + SPACING) * row_start;
list = g_list_nth (palette->colors,
row_start * editor->columns);
}
1997-11-24 22:05:25 +00:00
index = 0;
1997-11-24 22:05:25 +00:00
for (; list; list = g_list_next (list))
{
entry = (GimpPaletteEntry *) list->data;
1997-11-24 22:05:25 +00:00
gimp_rgb_get_uchar (&entry->color,
&colors[index * 3],
&colors[index * 3 + 1],
&colors[index * 3 + 2]);
index++;
if (index == editor->columns)
1997-11-24 22:05:25 +00:00
{
index = 0;
y = palette_editor_draw_color_row (colors,
editor->columns, y,
column_highlight, buffer,
editor);
1997-11-24 22:05:25 +00:00
if (y >= height || row_start >= 0)
{
/* This row only */
gtk_widget_queue_draw (editor->color_area);
g_free (buffer);
g_free (colors);
return;
}
}
}
while (y < height)
{
y = palette_editor_draw_color_row (colors, index, y, column_highlight,
buffer, editor);
index = 0;
if (row_start >= 0)
break;
1997-11-24 22:05:25 +00:00
}
g_free (buffer);
g_free (colors);
if (! editor->freeze_update)
gtk_widget_queue_draw (editor->color_area);
1997-11-24 22:05:25 +00:00
}
static void
palette_editor_scroll_top_left (GimpPaletteEditor *palette_editor)
1997-11-24 22:05:25 +00:00
{
GtkAdjustment *hadj;
GtkAdjustment *vadj;
1997-11-24 22:05:25 +00:00
if (! (palette_editor && palette_editor->scrolled_window))
return;
1999-10-26 18:27:27 +00:00
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (palette_editor->scrolled_window));
vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (palette_editor->scrolled_window));
if (hadj)
gtk_adjustment_set_value (hadj, 0.0);
if (vadj)
gtk_adjustment_set_value (vadj, 0.0);
}
1997-11-24 22:05:25 +00:00
static void
palette_editor_redraw (GimpPaletteEditor *editor)
{
GimpPalette *palette;
gint vsize;
gint nrows;
gint n_entries;
gint preview_width;
guint width;
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! palette)
return;
width = editor->color_area->parent->parent->parent->allocation.width;
if ((editor->columns_valid) && editor->last_width == width)
return;
editor->last_width = width;
editor->col_width = width / (editor->columns + 1) - SPACING;
if (editor->col_width < 0)
editor->col_width = 0;
editor->columns_valid = TRUE;
n_entries = palette->n_colors;
nrows = n_entries / editor->columns;
if (n_entries % editor->columns)
nrows += 1;
1997-11-24 22:05:25 +00:00
vsize = nrows * (SPACING + (gint) (ENTRY_HEIGHT * editor->zoom_factor)) + SPACING;
Add default to Cancel button, remove unset GTK_RECEIVES_DEFAULT from Sat Feb 20 16:12:33 CST 1999 Shawn T. Amundson <amundson@gimp.org> * app/tips_dialog.c: Add default to Cancel button, remove unset GTK_RECEIVES_DEFAULT from prev/next buttons (they are like toolbar buttons), changed abreviated prev to previous, prev/next button are now same size, cancel button is in a button box. Added vboxes where necessary to prevent prev/next and check button from filling vertically. * app/app_procs.c: when splashscreen dialog is larger than the logo, (due to huge font), center logo. * app/file_new_dialog.c: patch from Marco Lamb <lm@geocities.com> disallows resizing, changes vertical expanding of widgets to not occur * app/palette.c: patch from Marco Lamb <lm@geocities.com>. Makes +/- buttons for zoom pixmaps (eventually, these can be replaced with a magnifying glass with a little +/- I think), so that they no longer expand as they did before. I modified his patch so it did not create a misused toolbar. I did some other stuff here too, moved Close button to the left, made it the window's default, and unset GTK_RECEIVES_DEFAULT off of the non-bottom buttons. * app/actionarea.c: another patch from Marco Lamb <lm@geocities.com>. This one changes buttons to be put in a button box which is right justified. If we decide later that spread is better, we can change this easy enough. * app/tools/zoom_in.xpm, app/tools/zoom_out.xpm: + and - graphics. * libgimp/gimpunit.h libgimp/gimpunit.c: New files from Michael Natterer <mitschel@cs.tu-berlin.de>, gimp_unit_* routines. * app/gimage.h app/gimpimage.h app/gimpimage.c app/gimpimageP.h app/xcf.c: Patches from Michael Natterer <mitschel@cs.tu-berlin.de>, which keep a unit assocated with an image.
1999-02-21 02:08:15 +00:00
preview_width = (editor->col_width + SPACING) * editor->columns + SPACING;
1997-11-24 22:05:25 +00:00
gtk_preview_size (GTK_PREVIEW (editor->color_area), preview_width, vsize);
gtk_widget_queue_resize (editor->color_area);
1997-11-24 22:05:25 +00:00
palette_editor_draw_entries (editor, -1, -1);
if (editor->color)
{
palette_editor_draw_entries (editor,
editor->color->position / editor->columns,
editor->color->position % editor->columns);
}
1997-11-24 22:05:25 +00:00
}
/* the color name entry callback *******************************************/
1997-11-24 22:05:25 +00:00
static void
palette_editor_color_name_changed (GtkWidget *widget,
GimpPaletteEditor *editor)
1997-11-24 22:05:25 +00:00
{
GimpPalette *palette;
1997-11-24 22:05:25 +00:00
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! palette)
return;
if (editor->color->name)
g_free (editor->color->name);
editor->color->name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (editor->color_name)));
gimp_data_dirty (GIMP_DATA (palette));
}
1997-11-24 22:05:25 +00:00
/* the columns spinbutton callback *****************************************/
static void
palette_editor_columns_changed (GtkAdjustment *adj,
GimpPaletteEditor *editor)
{
GimpPalette *palette;
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (! palette)
return;
gimp_palette_set_n_columns (palette, ROUND (adj->value));
}
/* palette zoom functions & callbacks **************************************/
1999-10-26 18:27:27 +00:00
static void
palette_editor_zoom_in_callback (GtkWidget *widget,
GimpPaletteEditor *editor)
{
editor->zoom_factor += 0.1;
palette_editor_redraw_zoom (editor);
1999-10-26 18:27:27 +00:00
}
1999-10-26 18:27:27 +00:00
static void
palette_editor_zoom_out_callback (GtkWidget *widget,
GimpPaletteEditor *editor)
{
editor->zoom_factor -= 0.1;
palette_editor_redraw_zoom (editor);
1999-10-26 18:27:27 +00:00
}
1999-10-26 18:27:27 +00:00
static void
palette_editor_zoom_all_callback (GtkWidget *widget,
GimpPaletteEditor *editor)
1999-10-26 18:27:27 +00:00
{
if (GIMP_DATA_EDITOR (editor)->data)
{
GimpPalette *palette;
gint window_height;
gint rows;
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
window_height =
editor->color_area->parent->parent->parent->allocation.height;
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-27 17:58:10 +00:00
if (palette->n_columns)
rows = palette->n_colors / palette->n_columns;
else
rows = palette->n_colors / COLUMNS;
rows = MAX (1, rows);
editor->zoom_factor =
(((gdouble) window_height - 2 * SPACING) / (gdouble) rows - SPACING) /
ENTRY_HEIGHT;
palette_editor_redraw_zoom (editor);
}
1999-10-26 18:27:27 +00: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-27 17:58:10 +00:00
1999-10-26 18:27:27 +00:00
static void
palette_editor_redraw_zoom (GimpPaletteEditor *editor)
1999-10-26 18:27:27 +00:00
{
if (editor->zoom_factor > 4.0)
{
editor->zoom_factor = 4.0;
}
else if (editor->zoom_factor < 0.1)
{
editor->zoom_factor = 0.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-27 17:58:10 +00:00
if (GIMP_DATA_EDITOR (editor)->data)
{
GimpPalette *palette;
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
if (palette->n_columns)
editor->columns = palette->n_columns;
else
editor->columns = COLUMNS;
Made a GimpContainer out of the palette list: 2001-02-11 Michael Natterer <mitch@gimp.org> Made a GimpContainer out of the palette list: * app/Makefile.am * app/palettes.[ch]: new files for the global palette list. * app/gimpgradientpreview.[ch] * app/gimppalettepreview.[ch]: new widgets. * app/gimppalette.[ch]: derive it from GimpData to get all the preview etc. stuff. * app/datafiles.[ch]: new function datafiles_check_extension(), added a "loader_data" parameter to datafiles_read_directories() and pass it to the loader function. * app/gimpcontext.[ch]: added the palette (not really used yet except by the test dialogs). * app/gimpdatalist.[ch]: new function gimp_data_list_save_and_clear() which does everything needed for patterns_free(), brushes_free() ... * app/gimpdnd.c: added palette DND. * app/app_procs.c * app/brushes.c * app/color_notebook.h * app/commands.c * app/convert.c * app/gimpbrush.h * app/gimpbrushpipe.h * app/gimpgradient.c * app/gimppattern.h * app/gimppreview.c * app/gradients.c * app/module_db.c * app/palette.[ch] * app/paletteP.h * app/palette_import.c * app/palette_select.[ch] * app/patterns.c * app/plug_in.c * app/pdb/convert_cmds.c * app/pdb/palette_cmds.c * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/palette.pdb: lotsa stuff: changed due to the above API changes, #define the file extensions in the GimpData subclasses' header files instead of hardcoding them in several places, ... * data/palettes/*: The same file format change as for the gradient files: - Save the palette name in a parsable form (as part of the file format, not in a comment. - Removed unserscores from the palette names. - Added an extension (Gimp PaLettes are ".gpl" files now ;-)
2001-02-11 16:14:25 +00:00
editor->columns_valid = FALSE;
palette_editor_redraw (editor);
palette_editor_scroll_top_left (editor);
}
1999-10-26 18:27:27 +00:00
}
/* the palette dialog color dnd callbacks **********************************/
static void
palette_editor_drag_color (GtkWidget *widget,
GimpRGB *color,
1999-10-26 18:27:27 +00:00
gpointer data)
{
GimpPaletteEditor *editor;
1999-10-26 18:27:27 +00:00
editor = GIMP_PALETTE_EDITOR (data);
1999-10-26 18:27:27 +00:00
if (editor && GIMP_DATA_EDITOR (editor)->data && editor->dnd_color)
1999-10-26 18:27:27 +00:00
{
*color = editor->dnd_color->color;
}
else
{
gimp_rgba_set (color, 0.0, 0.0, 0.0, 1.0);
1999-10-26 18:27:27 +00:00
}
}
static void
palette_editor_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data)
1999-10-26 18:27:27 +00:00
{
GimpPaletteEditor *editor;
1999-10-26 18:27:27 +00:00
editor = GIMP_PALETTE_EDITOR (data);
1999-10-26 18:27:27 +00:00
if (editor && GIMP_DATA_EDITOR (editor)->data)
1999-10-26 18:27:27 +00:00
{
editor->color =
gimp_palette_add_entry (GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data),
NULL,
(GimpRGB *) color);
1999-10-26 18:27:27 +00:00
}
}
static void
palette_editor_drop_palette (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
gimp_data_editor_set_data (GIMP_DATA_EDITOR (data), GIMP_DATA (viewable));
}
static void
palette_editor_invalidate_preview (GimpPalette *palette,
GimpPaletteEditor *editor)
1999-10-26 18:27:27 +00:00
{
if (palette->n_columns)
editor->columns = palette->n_columns;
else
editor->columns = COLUMNS;
editor->columns_valid = FALSE;
palette_editor_redraw (editor);
}