gimp/libgimpwidgets/gimpcolorselect.c

2146 lines
50 KiB
C
Raw Normal View History

1997-11-25 06:05:25 +08:00
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
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
1997-11-25 06:05:25 +08:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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
1997-11-25 06:05:25 +08:00
#include "appenv.h"
#include "color_select.h"
#include "colormaps.h"
#include "errors.h"
#include "gimpdnd.h"
1997-11-25 06:05:25 +08:00
#include "gimprc.h"
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
#include "gimpui.h"
#include "session.h"
#include "color_area.h" /* for color_area_draw_rect */
1997-11-25 06:05:25 +08:00
new ui for the "Layer Offset" dialog. 1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de> * app/channel_ops.[ch]: new ui for the "Layer Offset" dialog. * app/channels_dialog.c * app/layers_dialog.c: major code cleanup: Folded some callbacks into common ones, "widget" instead of "w", indentation, ... * app/commands.c * app/interface.[ch] * app/global_edit.c: the query boxes must be shown by the caller now. There's no need to split up the string for the message box manually as the Gtk 1.2 label widget handles newlines corectly. Added the "edge_lock" toggle to the "Shrink Selection" dialog. Nicer spacings for the query and message boxes. * app/ink.c: tried to grab the pointer in the blob preview but failed. Left the code there as a reminder (commented out). * app/menus.c: reordered <Image>/Select. I was bored and grep-ed the sources for ancient or deprecated stuff: * app/about_dialog.[ch] * app/actionarea.[ch] * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/color_select.c * app/convert.c * app/devices.c * app/gdisplay.c * app/gdisplay_ops.c * app/histogram_tool.[ch] * app/info_window.c * app/install.c * app/ops_buttons.c * app/palette.c * app/palette_select.c * app/paths_dialog.c * app/pattern_select.c * app/resize.c * app/scale_toolc.c * app/text_tool.c: s/container_border_width/container_set_border_width/g, s/sprintf/g_snprintf/g, replaced some constant string lengths with strlen(x). * app/bezier_select.c * app/blend.c * app/boundary.c * app/errors.[ch] * app/free_select.c * app/gimpbrushlist.c * app/gimprc.c * app/iscissors.c * app/main.c * app/patterns.[ch] * app/text_tool.c: namespace fanaticism: prefixed all gimp error functions with "gimp_" and formated the messages more uniformly. * app/gradient.c * app/gradient_select.c: same stuff as above for the ui code. There are still some sub-dialogs which need cleanup. Did some cleanup in most of these files: prototypes, removed tons of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
#include "libgimp/color_selector.h"
#include "libgimp/gimpintl.h"
#define XY_DEF_WIDTH 240
#define XY_DEF_HEIGHT 240
1997-11-25 06:05:25 +08:00
#define Z_DEF_WIDTH 15
#define Z_DEF_HEIGHT 240
1997-11-25 06:05:25 +08:00
#define COLOR_AREA_WIDTH 74
#define COLOR_AREA_HEIGHT 20
#define COLOR_AREA_MASK GDK_EXPOSURE_MASK | \
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | \
GDK_BUTTON1_MOTION_MASK | GDK_ENTER_NOTIFY_MASK
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
typedef enum
{
COLOR_SELECT_OK,
COLOR_SELECT_CANCEL,
COLOR_SELECT_UPDATE
} ColorSelectState;
typedef enum
{
1999-10-28 23:05:49 +08:00
COLOR_SELECT_HUE = 0,
COLOR_SELECT_SATURATION,
COLOR_SELECT_VALUE,
COLOR_SELECT_RED,
COLOR_SELECT_GREEN,
COLOR_SELECT_BLUE,
COLOR_SELECT_HUE_SATURATION,
COLOR_SELECT_HUE_VALUE,
COLOR_SELECT_SATURATION_VALUE,
COLOR_SELECT_RED_GREEN,
COLOR_SELECT_RED_BLUE,
COLOR_SELECT_GREEN_BLUE
1997-11-25 06:05:25 +08:00
} ColorSelectFillType;
typedef enum
{
UPDATE_VALUES = 1 << 0,
UPDATE_POS = 1 << 1,
UPDATE_XY_COLOR = 1 << 2,
UPDATE_Z_COLOR = 1 << 3,
UPDATE_NEW_COLOR = 1 << 4,
1997-11-25 06:05:25 +08:00
UPDATE_ORIG_COLOR = 1 << 5,
UPDATE_CALLER = 1 << 6
1997-11-25 06:05:25 +08:00
} ColorSelectUpdateType;
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
typedef void (*ColorSelectCallback) (gint, gint, gint, ColorSelectState, void *);
typedef struct _ColorSelect ColorSelect, *ColorSelectP;
struct _ColorSelect
{
GtkWidget *xy_color;
GtkWidget *z_color;
GtkWidget *new_color;
GtkWidget *orig_color;
GtkWidget *toggles[6];
GtkWidget *entries[6];
GtkWidget *hex_entry;
GtkAdjustment *slider_data[6];
gint pos[3];
gint values[6];
gint z_color_fill;
gint xy_color_fill;
gint orig_values[3];
gboolean wants_updates;
GdkGC *gc;
ColorSelectCallback callback;
void *client_data;
};
1997-11-25 06:05:25 +08:00
typedef struct _ColorSelectFill ColorSelectFill;
1997-11-25 06:05:25 +08:00
typedef void (*ColorSelectFillUpdateProc) (ColorSelectFill *);
struct _ColorSelectFill
{
guchar *buffer;
gint y;
gint width;
gint height;
gint *values;
1997-11-25 06:05:25 +08:00
ColorSelectFillUpdateProc update;
};
static GtkWidget * color_select_widget_new (ColorSelect *, gint, gint, gint);
static void color_select_drag_new_color (GtkWidget *,
guchar *, guchar *, guchar *,
gpointer);
static void color_select_drop_new_color (GtkWidget *,
guchar, guchar, guchar,
gpointer);
static void color_select_drag_old_color (GtkWidget *,
guchar *, guchar *, guchar *,
gpointer);
static void color_select_update (ColorSelect *,
ColorSelectUpdateType);
static void color_select_update_caller (ColorSelect *);
static void color_select_update_values (ColorSelect *);
static void color_select_update_rgb_values (ColorSelect *);
static void color_select_update_hsv_values (ColorSelect *);
static void color_select_update_pos (ColorSelect *);
static void color_select_update_sliders (ColorSelect *, gint);
static void color_select_update_entries (ColorSelect *, gint);
static void color_select_update_colors (ColorSelect *, gint);
static gint color_select_xy_expose (GtkWidget *, GdkEventExpose *,
ColorSelect *);
static gint color_select_xy_events (GtkWidget *, GdkEvent *,
ColorSelect *);
static gint color_select_z_expose (GtkWidget *, GdkEventExpose *,
ColorSelect *);
static gint color_select_z_events (GtkWidget *, GdkEvent *,
ColorSelect *);
static gint color_select_color_events (GtkWidget *, GdkEvent *);
static void color_select_slider_update (GtkAdjustment *, gpointer);
static void color_select_entry_update (GtkWidget *, gpointer);
static void color_select_toggle_update (GtkWidget *, gpointer);
static gint color_select_hex_entry_leave (GtkWidget *, GdkEvent *, gpointer);
1997-11-25 06:05:25 +08:00
static void color_select_image_fill (GtkWidget *, ColorSelectFillType,
gint *);
static void color_select_draw_z_marker (ColorSelect *, GdkRectangle *);
static void color_select_draw_xy_marker (ColorSelect *, GdkRectangle *);
static void color_select_update_red (ColorSelectFill *);
static void color_select_update_green (ColorSelectFill *);
static void color_select_update_blue (ColorSelectFill *);
static void color_select_update_hue (ColorSelectFill *);
static void color_select_update_saturation (ColorSelectFill *);
static void color_select_update_value (ColorSelectFill *);
static void color_select_update_red_green (ColorSelectFill *);
static void color_select_update_red_blue (ColorSelectFill *);
static void color_select_update_green_blue (ColorSelectFill *);
static void color_select_update_hue_saturation (ColorSelectFill *);
static void color_select_update_hue_value (ColorSelectFill *);
1997-11-25 06:05:25 +08:00
static void color_select_update_saturation_value (ColorSelectFill *);
static GtkWidget * color_select_notebook_new (gint, gint, gint,
GimpColorSelector_Callback,
void *, void **);
static void color_select_notebook_free (void *);
static void color_select_notebook_setcolor (void *, gint, gint, gint,
gboolean);
static void color_select_notebook_update_callback (gint, gint, gint,
ColorSelectState,
void *);
/* Static variables */
1997-11-25 06:05:25 +08:00
static ColorSelectFillUpdateProc update_procs[] =
{
color_select_update_hue,
color_select_update_saturation,
color_select_update_value,
color_select_update_red,
color_select_update_green,
color_select_update_blue,
color_select_update_hue_saturation,
color_select_update_hue_value,
color_select_update_saturation_value,
color_select_update_red_green,
color_select_update_red_blue,
color_select_update_green_blue,
};
/* dnd stuff */
static GtkTargetEntry color_select_target_table[] =
1997-11-25 06:05:25 +08:00
{
GIMP_TARGET_COLOR
1997-11-25 06:05:25 +08:00
};
static guint n_color_select_targets = (sizeof (color_select_target_table) /
sizeof (color_select_target_table[0]));
1997-11-25 06:05:25 +08:00
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
/* Register the GIMP colour selector with the color notebook */
void
color_select_init (void)
{
GimpColorSelectorMethods methods =
{
color_select_notebook_new,
color_select_notebook_free,
color_select_notebook_setcolor
};
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
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
gimp_color_selector_register ("GIMP", "built_in.html", &methods);
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
}
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
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
static GtkWidget *
color_select_widget_new (ColorSelect *csp,
gint r,
gint g,
gint b)
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
{
static gchar *toggle_titles[6] = { "H", "S", "V", "R", "G", "B" };
static gfloat slider_max_vals[6] = { 360, 100, 100, 255, 255, 255 };
static gfloat slider_incs[6] = { 0.1, 0.1, 0.1, 1.0, 1.0, 1.0 };
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
GtkWidget *main_vbox;
GtkWidget *main_hbox;
GtkWidget *xy_frame;
GtkWidget *z_frame;
GtkWidget *colors_frame;
GtkWidget *colors_hbox;
GtkWidget *right_vbox;
GtkWidget *table;
GtkWidget *slider;
GtkWidget *hex_hbox;
GtkWidget *label;
GSList *group;
gchar buffer[16];
gint i;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
1997-11-25 06:05:25 +08:00
main_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
1997-11-25 06:05:25 +08:00
main_hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 0);
1997-11-25 06:05:25 +08:00
gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, TRUE, 2);
gtk_widget_show (main_hbox);
/* The x/y component preview */
1997-11-25 06:05:25 +08:00
xy_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (xy_frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (main_hbox), xy_frame, FALSE, FALSE, 2);
gtk_widget_show (xy_frame);
csp->xy_color = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_set_dither (GTK_PREVIEW (csp->xy_color), GDK_RGB_DITHER_MAX);
1997-11-25 06:05:25 +08:00
gtk_preview_size (GTK_PREVIEW (csp->xy_color), XY_DEF_WIDTH, XY_DEF_HEIGHT);
gtk_widget_set_events (csp->xy_color, COLOR_AREA_MASK);
gtk_signal_connect_after (GTK_OBJECT (csp->xy_color), "expose_event",
(GtkSignalFunc) color_select_xy_expose,
csp);
gtk_signal_connect (GTK_OBJECT (csp->xy_color), "event",
(GtkSignalFunc) color_select_xy_events,
csp);
gtk_container_add (GTK_CONTAINER (xy_frame), csp->xy_color);
gtk_widget_show (csp->xy_color);
/* dnd stuff */
gtk_drag_dest_set (csp->xy_color,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_select_target_table, n_color_select_targets,
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (csp->xy_color, color_select_drop_new_color, csp);
/* The z component preview */
1997-11-25 06:05:25 +08:00
z_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (z_frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (main_hbox), z_frame, FALSE, FALSE, 2);
gtk_widget_show (z_frame);
csp->z_color = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_set_dither (GTK_PREVIEW (csp->z_color), GDK_RGB_DITHER_MAX);
1997-11-25 06:05:25 +08:00
gtk_preview_size (GTK_PREVIEW (csp->z_color), Z_DEF_WIDTH, Z_DEF_HEIGHT);
gtk_widget_set_events (csp->z_color, COLOR_AREA_MASK);
gtk_signal_connect_after (GTK_OBJECT (csp->z_color), "expose_event",
(GtkSignalFunc) color_select_z_expose,
csp);
gtk_signal_connect (GTK_OBJECT (csp->z_color), "event",
(GtkSignalFunc) color_select_z_events,
csp);
gtk_container_add (GTK_CONTAINER (z_frame), csp->z_color);
gtk_widget_show (csp->z_color);
/* The right vertical box with old/new color area and color space sliders */
right_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (right_vbox), 0);
1997-11-25 06:05:25 +08:00
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
gtk_widget_show (right_vbox);
/* The old/new color area frame and hbox */
1997-11-25 06:05:25 +08:00
colors_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (colors_frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (right_vbox), colors_frame, FALSE, FALSE, 0);
gtk_widget_show (colors_frame);
colors_hbox = gtk_hbox_new (TRUE, 2);
gtk_container_add (GTK_CONTAINER (colors_frame), colors_hbox);
gtk_widget_show (colors_hbox);
/* The new color area */
1997-11-25 06:05:25 +08:00
csp->new_color = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (csp->new_color),
COLOR_AREA_WIDTH, COLOR_AREA_HEIGHT);
1997-11-25 06:05:25 +08:00
gtk_widget_set_events (csp->new_color, GDK_EXPOSURE_MASK);
gtk_signal_connect (GTK_OBJECT (csp->new_color), "event",
(GtkSignalFunc) color_select_color_events,
csp);
gtk_object_set_user_data (GTK_OBJECT (csp->new_color), csp);
gtk_box_pack_start (GTK_BOX (colors_hbox), csp->new_color, TRUE, TRUE, 0);
gtk_widget_show (csp->new_color);
/* dnd stuff */
gtk_drag_source_set (csp->new_color,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_select_target_table, n_color_select_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (csp->new_color, color_select_drag_new_color, csp);
gtk_drag_dest_set (csp->new_color,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_select_target_table, n_color_select_targets,
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (csp->new_color, color_select_drop_new_color, csp);
/* The old color area */
1997-11-25 06:05:25 +08:00
csp->orig_color = gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (csp->orig_color),
COLOR_AREA_WIDTH, COLOR_AREA_HEIGHT);
1997-11-25 06:05:25 +08:00
gtk_widget_set_events (csp->orig_color, GDK_EXPOSURE_MASK);
gtk_signal_connect (GTK_OBJECT (csp->orig_color), "event",
(GtkSignalFunc) color_select_color_events,
csp);
gtk_object_set_user_data (GTK_OBJECT (csp->orig_color), csp);
gtk_box_pack_start (GTK_BOX (colors_hbox), csp->orig_color, TRUE, TRUE, 0);
gtk_widget_show (csp->orig_color);
/* dnd stuff */
gtk_drag_source_set (csp->orig_color,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_select_target_table, n_color_select_targets,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (csp->orig_color, color_select_drag_old_color, csp);
1997-11-25 06:05:25 +08:00
/* The color space sliders, toggle buttons and entries */
table = gtk_table_new (6, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
gtk_table_set_col_spacings (GTK_TABLE (table), 3);
new ui for the "Layer Offset" dialog. 1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de> * app/channel_ops.[ch]: new ui for the "Layer Offset" dialog. * app/channels_dialog.c * app/layers_dialog.c: major code cleanup: Folded some callbacks into common ones, "widget" instead of "w", indentation, ... * app/commands.c * app/interface.[ch] * app/global_edit.c: the query boxes must be shown by the caller now. There's no need to split up the string for the message box manually as the Gtk 1.2 label widget handles newlines corectly. Added the "edge_lock" toggle to the "Shrink Selection" dialog. Nicer spacings for the query and message boxes. * app/ink.c: tried to grab the pointer in the blob preview but failed. Left the code there as a reminder (commented out). * app/menus.c: reordered <Image>/Select. I was bored and grep-ed the sources for ancient or deprecated stuff: * app/about_dialog.[ch] * app/actionarea.[ch] * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/color_select.c * app/convert.c * app/devices.c * app/gdisplay.c * app/gdisplay_ops.c * app/histogram_tool.[ch] * app/info_window.c * app/install.c * app/ops_buttons.c * app/palette.c * app/palette_select.c * app/paths_dialog.c * app/pattern_select.c * app/resize.c * app/scale_toolc.c * app/text_tool.c: s/container_border_width/container_set_border_width/g, s/sprintf/g_snprintf/g, replaced some constant string lengths with strlen(x). * app/bezier_select.c * app/blend.c * app/boundary.c * app/errors.[ch] * app/free_select.c * app/gimpbrushlist.c * app/gimprc.c * app/iscissors.c * app/main.c * app/patterns.[ch] * app/text_tool.c: namespace fanaticism: prefixed all gimp error functions with "gimp_" and formated the messages more uniformly. * app/gradient.c * app/gradient_select.c: same stuff as above for the ui code. There are still some sub-dialogs which need cleanup. Did some cleanup in most of these files: prototypes, removed tons of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
1997-11-25 06:05:25 +08:00
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
gtk_widget_show (table);
group = NULL;
for (i = 0; i < 6; i++)
{
csp->toggles[i] =
gtk_radio_button_new_with_label (group, toggle_titles[i]);
1997-11-25 06:05:25 +08:00
group = gtk_radio_button_group (GTK_RADIO_BUTTON (csp->toggles[i]));
gtk_table_attach (GTK_TABLE (table), csp->toggles[i],
0, 1, i, i+1, GTK_FILL, GTK_EXPAND, 0, 0);
gtk_signal_connect (GTK_OBJECT (csp->toggles[i]), "toggled",
(GtkSignalFunc) color_select_toggle_update,
csp);
gtk_widget_show (csp->toggles[i]);
csp->slider_data[i] =
GTK_ADJUSTMENT (gtk_adjustment_new (csp->values[i], 0.0,
slider_max_vals[i],
slider_incs[i],
1.0, 0.0));
1997-11-25 06:05:25 +08:00
slider = gtk_hscale_new (csp->slider_data[i]);
gtk_table_attach (GTK_TABLE (table), slider, 1, 2, i, i+1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_signal_connect (GTK_OBJECT (csp->slider_data[i]), "value_changed",
(GtkSignalFunc) color_select_slider_update,
csp);
gtk_widget_show (slider);
csp->entries[i] = gtk_entry_new ();
new ui for the "Layer Offset" dialog. 1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de> * app/channel_ops.[ch]: new ui for the "Layer Offset" dialog. * app/channels_dialog.c * app/layers_dialog.c: major code cleanup: Folded some callbacks into common ones, "widget" instead of "w", indentation, ... * app/commands.c * app/interface.[ch] * app/global_edit.c: the query boxes must be shown by the caller now. There's no need to split up the string for the message box manually as the Gtk 1.2 label widget handles newlines corectly. Added the "edge_lock" toggle to the "Shrink Selection" dialog. Nicer spacings for the query and message boxes. * app/ink.c: tried to grab the pointer in the blob preview but failed. Left the code there as a reminder (commented out). * app/menus.c: reordered <Image>/Select. I was bored and grep-ed the sources for ancient or deprecated stuff: * app/about_dialog.[ch] * app/actionarea.[ch] * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/color_select.c * app/convert.c * app/devices.c * app/gdisplay.c * app/gdisplay_ops.c * app/histogram_tool.[ch] * app/info_window.c * app/install.c * app/ops_buttons.c * app/palette.c * app/palette_select.c * app/paths_dialog.c * app/pattern_select.c * app/resize.c * app/scale_toolc.c * app/text_tool.c: s/container_border_width/container_set_border_width/g, s/sprintf/g_snprintf/g, replaced some constant string lengths with strlen(x). * app/bezier_select.c * app/blend.c * app/boundary.c * app/errors.[ch] * app/free_select.c * app/gimpbrushlist.c * app/gimprc.c * app/iscissors.c * app/main.c * app/patterns.[ch] * app/text_tool.c: namespace fanaticism: prefixed all gimp error functions with "gimp_" and formated the messages more uniformly. * app/gradient.c * app/gradient_select.c: same stuff as above for the ui code. There are still some sub-dialogs which need cleanup. Did some cleanup in most of these files: prototypes, removed tons of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
g_snprintf (buffer, sizeof (buffer), "%d", csp->values[i]);
1997-11-25 06:05:25 +08:00
gtk_entry_set_text (GTK_ENTRY (csp->entries[i]), buffer);
gtk_widget_set_usize (GTK_WIDGET (csp->entries[i]), 40, 0);
gtk_table_attach (GTK_TABLE (table), csp->entries[i],
2, 3, i, i+1, GTK_FILL, GTK_EXPAND, 0, 0);
gtk_signal_connect (GTK_OBJECT (csp->entries[i]), "changed",
(GtkSignalFunc) color_select_entry_update,
csp);
gtk_widget_show (csp->entries[i]);
}
/* The hex triplet entry */
hex_hbox = gtk_hbox_new (FALSE, 3);
gtk_box_pack_start (GTK_BOX (right_vbox), hex_hbox, FALSE, FALSE, 0);
gtk_widget_show (hex_hbox);
csp->hex_entry = gtk_entry_new ();
new ui for the "Layer Offset" dialog. 1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de> * app/channel_ops.[ch]: new ui for the "Layer Offset" dialog. * app/channels_dialog.c * app/layers_dialog.c: major code cleanup: Folded some callbacks into common ones, "widget" instead of "w", indentation, ... * app/commands.c * app/interface.[ch] * app/global_edit.c: the query boxes must be shown by the caller now. There's no need to split up the string for the message box manually as the Gtk 1.2 label widget handles newlines corectly. Added the "edge_lock" toggle to the "Shrink Selection" dialog. Nicer spacings for the query and message boxes. * app/ink.c: tried to grab the pointer in the blob preview but failed. Left the code there as a reminder (commented out). * app/menus.c: reordered <Image>/Select. I was bored and grep-ed the sources for ancient or deprecated stuff: * app/about_dialog.[ch] * app/actionarea.[ch] * app/app_procs.c * app/brush_edit.c * app/brush_select.c * app/color_select.c * app/convert.c * app/devices.c * app/gdisplay.c * app/gdisplay_ops.c * app/histogram_tool.[ch] * app/info_window.c * app/install.c * app/ops_buttons.c * app/palette.c * app/palette_select.c * app/paths_dialog.c * app/pattern_select.c * app/resize.c * app/scale_toolc.c * app/text_tool.c: s/container_border_width/container_set_border_width/g, s/sprintf/g_snprintf/g, replaced some constant string lengths with strlen(x). * app/bezier_select.c * app/blend.c * app/boundary.c * app/errors.[ch] * app/free_select.c * app/gimpbrushlist.c * app/gimprc.c * app/iscissors.c * app/main.c * app/patterns.[ch] * app/text_tool.c: namespace fanaticism: prefixed all gimp error functions with "gimp_" and formated the messages more uniformly. * app/gradient.c * app/gradient_select.c: same stuff as above for the ui code. There are still some sub-dialogs which need cleanup. Did some cleanup in most of these files: prototypes, removed tons of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
gtk_entry_set_text (GTK_ENTRY (csp->hex_entry), buffer);
1999-04-20 19:13:33 +08:00
gtk_widget_set_usize (GTK_WIDGET (csp->hex_entry), 75, 0);
gtk_box_pack_end (GTK_BOX (hex_hbox), csp->hex_entry, FALSE, FALSE, 2);
gtk_signal_connect (GTK_OBJECT (csp->hex_entry), "focus_out_event",
(GtkSignalFunc) color_select_hex_entry_leave,
csp);
gtk_widget_show (csp->hex_entry);
label = gtk_label_new (_("Hex Triplet:"));
gtk_box_pack_end (GTK_BOX (hex_hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
return main_vbox;
}
1997-11-25 06:05:25 +08:00
static void
color_select_drag_new_color (GtkWidget *widget,
guchar *r,
guchar *g,
guchar *b,
gpointer data)
{
ColorSelect *csp;
csp = (ColorSelect *) data;
1999-10-28 23:05:49 +08:00
*r = (guchar) csp->values[COLOR_SELECT_RED];
*g = (guchar) csp->values[COLOR_SELECT_GREEN];
*b = (guchar) csp->values[COLOR_SELECT_BLUE];
}
static void
color_select_drop_new_color (GtkWidget *widget,
guchar r,
guchar g,
guchar b,
gpointer data)
{
ColorSelect *csp;
csp = (ColorSelect *) data;
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = (gint) r;
csp->values[COLOR_SELECT_GREEN] = (gint) g;
csp->values[COLOR_SELECT_BLUE] = (gint) b;
color_select_update_hsv_values (csp);
color_select_update_pos (csp);
color_select_update_sliders (csp, -1);
color_select_update_entries (csp, -1);
color_select_update_colors (csp, 0);
color_select_update (csp, UPDATE_Z_COLOR);
color_select_update (csp, UPDATE_XY_COLOR);
}
static void
color_select_drag_old_color (GtkWidget *widget,
guchar *r,
guchar *g,
guchar *b,
gpointer data)
{
ColorSelect *csp;
csp = (ColorSelect *) data;
*r = (guchar) csp->orig_values[0];
*g = (guchar) csp->orig_values[1];
*b = (guchar) csp->orig_values[2];
}
1997-11-25 06:05:25 +08:00
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
static void
color_select_set_color (ColorSelect *csp,
gint r,
gint g,
gint b,
gboolean set_current)
1997-11-25 06:05:25 +08:00
{
if (csp)
{
csp->orig_values[0] = r;
csp->orig_values[1] = g;
csp->orig_values[2] = b;
color_select_update_colors (csp, 1);
if (set_current)
{
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = r;
csp->values[COLOR_SELECT_GREEN] = g;
csp->values[COLOR_SELECT_BLUE] = b;
1997-11-25 06:05:25 +08:00
color_select_update_hsv_values (csp);
color_select_update_pos (csp);
color_select_update_sliders (csp, -1);
color_select_update_entries (csp, -1);
color_select_update_colors (csp, 0);
color_select_update (csp, UPDATE_Z_COLOR);
color_select_update (csp, UPDATE_XY_COLOR);
}
}
}
static void
color_select_update (ColorSelect *csp,
ColorSelectUpdateType update)
1997-11-25 06:05:25 +08:00
{
if (csp)
{
if (update & UPDATE_POS)
color_select_update_pos (csp);
if (update & UPDATE_VALUES)
{
color_select_update_values (csp);
color_select_update_sliders (csp, -1);
color_select_update_entries (csp, -1);
if (!(update & UPDATE_NEW_COLOR))
color_select_update_colors (csp, 0);
}
if (update & UPDATE_XY_COLOR)
{
color_select_image_fill (csp->xy_color, csp->xy_color_fill, csp->values);
gtk_widget_draw (csp->xy_color, NULL);
}
if (update & UPDATE_Z_COLOR)
{
color_select_image_fill (csp->z_color, csp->z_color_fill, csp->values);
gtk_widget_draw (csp->z_color, NULL);
}
if (update & UPDATE_NEW_COLOR)
color_select_update_colors (csp, 0);
if (update & UPDATE_ORIG_COLOR)
color_select_update_colors (csp, 1);
/*if (update & UPDATE_CALLER)*/
color_select_update_caller (csp);
}
}
static void
color_select_update_caller (ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
if (csp && csp->wants_updates && csp->callback)
1997-11-25 06:05:25 +08:00
{
1999-10-28 23:05:49 +08:00
(* csp->callback) (csp->values[COLOR_SELECT_RED],
csp->values[COLOR_SELECT_GREEN],
csp->values[COLOR_SELECT_BLUE],
1997-11-25 06:05:25 +08:00
COLOR_SELECT_UPDATE,
csp->client_data);
}
}
static void
color_select_update_values (ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
if (csp)
{
switch (csp->z_color_fill)
{
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_RED:
csp->values[COLOR_SELECT_BLUE] = csp->pos[0];
csp->values[COLOR_SELECT_GREEN] = csp->pos[1];
csp->values[COLOR_SELECT_RED] = csp->pos[2];
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_GREEN:
csp->values[COLOR_SELECT_BLUE] = csp->pos[0];
csp->values[COLOR_SELECT_RED] = csp->pos[1];
csp->values[COLOR_SELECT_GREEN] = csp->pos[2];
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_BLUE:
csp->values[COLOR_SELECT_GREEN] = csp->pos[0];
csp->values[COLOR_SELECT_RED] = csp->pos[1];
csp->values[COLOR_SELECT_BLUE] = csp->pos[2];
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_HUE:
csp->values[COLOR_SELECT_VALUE] = csp->pos[0] * 100 / 255;
csp->values[COLOR_SELECT_SATURATION] = csp->pos[1] * 100 / 255;
csp->values[COLOR_SELECT_HUE] = csp->pos[2] * 360 / 255;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_SATURATION:
csp->values[COLOR_SELECT_VALUE] = csp->pos[0] * 100 / 255;
csp->values[COLOR_SELECT_HUE] = csp->pos[1] * 360 / 255;
csp->values[COLOR_SELECT_SATURATION] = csp->pos[2] * 100 / 255;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_VALUE:
csp->values[COLOR_SELECT_SATURATION] = csp->pos[0] * 100 / 255;
csp->values[COLOR_SELECT_HUE] = csp->pos[1] * 360 / 255;
csp->values[COLOR_SELECT_VALUE] = csp->pos[2] * 100 / 255;
1997-11-25 06:05:25 +08:00
break;
}
switch (csp->z_color_fill)
{
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_RED:
case COLOR_SELECT_GREEN:
case COLOR_SELECT_BLUE:
1997-11-25 06:05:25 +08:00
color_select_update_hsv_values (csp);
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_HUE:
case COLOR_SELECT_SATURATION:
case COLOR_SELECT_VALUE:
1997-11-25 06:05:25 +08:00
color_select_update_rgb_values (csp);
break;
}
}
}
static void
color_select_update_rgb_values (ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
gfloat h, s, v;
gfloat f, p, q, t;
1997-11-25 06:05:25 +08:00
if (csp)
{
1999-10-28 23:05:49 +08:00
h = csp->values[COLOR_SELECT_HUE];
s = csp->values[COLOR_SELECT_SATURATION] / 100.0;
v = csp->values[COLOR_SELECT_VALUE] / 100.0;
1997-11-25 06:05:25 +08:00
if (s == 0)
{
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = v * 255;
csp->values[COLOR_SELECT_GREEN] = v * 255;
csp->values[COLOR_SELECT_BLUE] = v * 255;
1997-11-25 06:05:25 +08:00
}
else
{
if (h == 360)
h = 0;
h /= 60;
f = h - (int) h;
p = v * (1 - s);
q = v * (1 - (s * f));
t = v * (1 - (s * (1 - f)));
switch ((int) h)
{
case 0:
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = v * 255;
csp->values[COLOR_SELECT_GREEN] = t * 255;
csp->values[COLOR_SELECT_BLUE] = p * 255;
1997-11-25 06:05:25 +08:00
break;
case 1:
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = q * 255;
csp->values[COLOR_SELECT_GREEN] = v * 255;
csp->values[COLOR_SELECT_BLUE] = p * 255;
1997-11-25 06:05:25 +08:00
break;
case 2:
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = p * 255;
csp->values[COLOR_SELECT_GREEN] = v * 255;
csp->values[COLOR_SELECT_BLUE] = t * 255;
1997-11-25 06:05:25 +08:00
break;
case 3:
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = p * 255;
csp->values[COLOR_SELECT_GREEN] = q * 255;
csp->values[COLOR_SELECT_BLUE] = v * 255;
1997-11-25 06:05:25 +08:00
break;
case 4:
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = t * 255;
csp->values[COLOR_SELECT_GREEN] = p * 255;
csp->values[COLOR_SELECT_BLUE] = v * 255;
1997-11-25 06:05:25 +08:00
break;
case 5:
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = v * 255;
csp->values[COLOR_SELECT_GREEN] = p * 255;
csp->values[COLOR_SELECT_BLUE] = q * 255;
1997-11-25 06:05:25 +08:00
break;
}
}
}
}
static void
color_select_update_hsv_values (ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
gint r, g, b;
gfloat h, s, v;
gint min, max;
gint delta;
1997-11-25 06:05:25 +08:00
if (csp)
{
1999-10-28 23:05:49 +08:00
r = csp->values[COLOR_SELECT_RED];
g = csp->values[COLOR_SELECT_GREEN];
b = csp->values[COLOR_SELECT_BLUE];
1997-11-25 06:05:25 +08:00
if (r > g)
{
if (r > b)
max = r;
else
max = b;
if (g < b)
min = g;
else
min = b;
}
else
{
if (g > b)
max = g;
else
max = b;
if (r < b)
min = r;
else
min = b;
}
v = max;
if (max != 0)
s = (max - min) / (float) max;
else
s = 0;
if (s == 0)
h = 0;
else
{
h = 0;
delta = max - min;
if (r == max)
h = (g - b) / (float) delta;
else if (g == max)
h = 2 + (b - r) / (float) delta;
else if (b == max)
h = 4 + (r - g) / (float) delta;
h *= 60;
if (h < 0)
h += 360;
}
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_HUE] = h;
csp->values[COLOR_SELECT_SATURATION] = s * 100;
csp->values[COLOR_SELECT_VALUE] = v * 100 / 255;
1997-11-25 06:05:25 +08:00
}
}
static void
color_select_update_pos (ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
if (csp)
{
switch (csp->z_color_fill)
{
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_RED:
csp->pos[0] = csp->values[COLOR_SELECT_BLUE];
csp->pos[1] = csp->values[COLOR_SELECT_GREEN];
csp->pos[2] = csp->values[COLOR_SELECT_RED];
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_GREEN:
csp->pos[0] = csp->values[COLOR_SELECT_BLUE];
csp->pos[1] = csp->values[COLOR_SELECT_RED];
csp->pos[2] = csp->values[COLOR_SELECT_GREEN];
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_BLUE:
csp->pos[0] = csp->values[COLOR_SELECT_GREEN];
csp->pos[1] = csp->values[COLOR_SELECT_RED];
csp->pos[2] = csp->values[COLOR_SELECT_BLUE];
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_HUE:
csp->pos[0] = csp->values[COLOR_SELECT_VALUE] * 255 / 100;
csp->pos[1] = csp->values[COLOR_SELECT_SATURATION] * 255 / 100;
csp->pos[2] = csp->values[COLOR_SELECT_HUE] * 255 / 360;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_SATURATION:
csp->pos[0] = csp->values[COLOR_SELECT_VALUE] * 255 / 100;
csp->pos[1] = csp->values[COLOR_SELECT_HUE] * 255 / 360;
csp->pos[2] = csp->values[COLOR_SELECT_SATURATION] * 255 / 100;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_VALUE:
csp->pos[0] = csp->values[COLOR_SELECT_SATURATION] * 255 / 100;
csp->pos[1] = csp->values[COLOR_SELECT_HUE] * 255 / 360;
csp->pos[2] = csp->values[COLOR_SELECT_VALUE] * 255 / 100;
1997-11-25 06:05:25 +08:00
break;
}
}
}
static void
color_select_update_sliders (ColorSelect *csp,
gint skip)
1997-11-25 06:05:25 +08:00
{
gint i;
1997-11-25 06:05:25 +08:00
if (csp)
{
for (i = 0; i < 6; i++)
if (i != skip)
{
csp->slider_data[i]->value = (gfloat) csp->values[i];
gtk_signal_handler_block_by_data (GTK_OBJECT (csp->slider_data[i]), csp);
gtk_signal_emit_by_name (GTK_OBJECT (csp->slider_data[i]), "value_changed");
gtk_signal_handler_unblock_by_data (GTK_OBJECT (csp->slider_data[i]), csp);
}
}
}
static void
color_select_update_entries (ColorSelect *csp,
gint skip)
1997-11-25 06:05:25 +08:00
{
gchar buffer[16];
gint i;
1997-11-25 06:05:25 +08:00
if (csp)
{
for (i = 0; i < 6; i++)
if (i != skip)
{
g_snprintf (buffer, sizeof (buffer), "%d", csp->values[i]);
1997-11-25 06:05:25 +08:00
gtk_signal_handler_block_by_data (GTK_OBJECT (csp->entries[i]), csp);
gtk_entry_set_text (GTK_ENTRY (csp->entries[i]), buffer);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (csp->entries[i]), csp);
}
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x",
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED],
csp->values[COLOR_SELECT_GREEN],
csp->values[COLOR_SELECT_BLUE]);
gtk_entry_set_text (GTK_ENTRY (csp->hex_entry), buffer);
1997-11-25 06:05:25 +08:00
}
}
static void
color_select_update_colors (ColorSelect *csp,
gint which)
1997-11-25 06:05:25 +08:00
{
GdkWindow *window;
GdkColor color;
gint red, green, blue;
gint width, height;
1997-11-25 06:05:25 +08:00
if (csp)
{
if (which)
{
window = csp->orig_color->window;
color.pixel = old_color_pixel;
red = csp->orig_values[0];
1997-11-25 06:05:25 +08:00
green = csp->orig_values[1];
blue = csp->orig_values[2];
1997-11-25 06:05:25 +08:00
}
else
{
window = csp->new_color->window;
color.pixel = new_color_pixel;
1999-10-28 23:05:49 +08:00
red = csp->values[COLOR_SELECT_RED];
green = csp->values[COLOR_SELECT_GREEN];
blue = csp->values[COLOR_SELECT_BLUE];
1997-11-25 06:05:25 +08:00
}
/* if we haven't yet been realised, there's no need to redraw
* anything. */
if (!window)
return;
1997-11-25 06:05:25 +08:00
color.pixel = get_color (red, green, blue);
1997-11-25 06:05:25 +08:00
gdk_window_get_size (window, &width, &height);
1997-11-25 06:05:25 +08:00
if (csp->gc)
{
#ifdef OLD_COLOR_AREA
1997-11-25 06:05:25 +08:00
gdk_gc_set_foreground (csp->gc, &color);
gdk_draw_rectangle (window, csp->gc, 1,
0, 0, width, height);
#else
color_area_draw_rect (window, csp->gc,
0, 0, width, height,
red, green, blue);
#endif
1997-11-25 06:05:25 +08:00
}
}
}
static gint
color_select_xy_expose (GtkWidget *widget,
GdkEventExpose *event,
ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
if (!csp->gc)
csp->gc = gdk_gc_new (widget->window);
color_select_draw_xy_marker (csp, &event->area);
1997-11-25 06:05:25 +08:00
return FALSE;
}
static gint
color_select_xy_events (GtkWidget *widget,
GdkEvent *event,
ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
GdkEventButton *bevent;
GdkEventMotion *mevent;
gint tx, ty;
1997-11-25 06:05:25 +08:00
switch (event->type)
{
case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event;
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
csp->pos[0] = (bevent->x * 255) / (XY_DEF_WIDTH - 1);
csp->pos[1] = 255 - (bevent->y * 255) / (XY_DEF_HEIGHT - 1);
if (csp->pos[0] < 0)
csp->pos[0] = 0;
if (csp->pos[0] > 255)
csp->pos[0] = 255;
if (csp->pos[1] < 0)
csp->pos[1] = 0;
if (csp->pos[1] > 255)
csp->pos[1] = 255;
gdk_pointer_grab (csp->xy_color->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
1997-11-25 06:05:25 +08:00
NULL, NULL, bevent->time);
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_VALUES);
break;
case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event;
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
csp->pos[0] = (bevent->x * 255) / (XY_DEF_WIDTH - 1);
csp->pos[1] = 255 - (bevent->y * 255) / (XY_DEF_HEIGHT - 1);
if (csp->pos[0] < 0)
csp->pos[0] = 0;
if (csp->pos[0] > 255)
csp->pos[0] = 255;
if (csp->pos[1] < 0)
csp->pos[1] = 0;
if (csp->pos[1] > 255)
csp->pos[1] = 255;
gdk_pointer_ungrab (bevent->time);
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_VALUES);
break;
case GDK_MOTION_NOTIFY:
mevent = (GdkEventMotion *) event;
if (mevent->is_hint)
{
gdk_window_get_pointer (widget->window, &tx, &ty, NULL);
mevent->x = tx;
mevent->y = ty;
}
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
csp->pos[0] = (mevent->x * 255) / (XY_DEF_WIDTH - 1);
csp->pos[1] = 255 - (mevent->y * 255) / (XY_DEF_HEIGHT - 1);
if (csp->pos[0] < 0)
csp->pos[0] = 0;
if (csp->pos[0] > 255)
csp->pos[0] = 255;
if (csp->pos[1] < 0)
csp->pos[1] = 0;
if (csp->pos[1] > 255)
csp->pos[1] = 255;
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_VALUES);
break;
default:
break;
}
return FALSE;
}
static gint
color_select_z_expose (GtkWidget *widget,
GdkEventExpose *event,
ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
if (!csp->gc)
csp->gc = gdk_gc_new (widget->window);
color_select_draw_z_marker (csp, &event->area);
1997-11-25 06:05:25 +08:00
return FALSE;
}
static gint
color_select_z_events (GtkWidget *widget,
GdkEvent *event,
ColorSelect *csp)
1997-11-25 06:05:25 +08:00
{
GdkEventButton *bevent;
GdkEventMotion *mevent;
gint tx, ty;
1997-11-25 06:05:25 +08:00
switch (event->type)
{
case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event;
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
csp->pos[2] = 255 - (bevent->y * 255) / (Z_DEF_HEIGHT - 1);
if (csp->pos[2] < 0)
csp->pos[2] = 0;
if (csp->pos[2] > 255)
csp->pos[2] = 255;
gdk_pointer_grab (csp->z_color->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
1997-11-25 06:05:25 +08:00
NULL, NULL, bevent->time);
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_VALUES);
break;
case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event;
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
csp->pos[2] = 255 - (bevent->y * 255) / (Z_DEF_HEIGHT - 1);
if (csp->pos[2] < 0)
csp->pos[2] = 0;
if (csp->pos[2] > 255)
csp->pos[2] = 255;
gdk_pointer_ungrab (bevent->time);
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_VALUES | UPDATE_XY_COLOR);
break;
case GDK_MOTION_NOTIFY:
mevent = (GdkEventMotion *) event;
if (mevent->is_hint)
{
gdk_window_get_pointer (widget->window, &tx, &ty, NULL);
mevent->x = tx;
mevent->y = ty;
}
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
csp->pos[2] = 255 - (mevent->y * 255) / (Z_DEF_HEIGHT - 1);
if (csp->pos[2] < 0)
csp->pos[2] = 0;
if (csp->pos[2] > 255)
csp->pos[2] = 255;
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_VALUES);
break;
default:
break;
}
return FALSE;
}
static gint
color_select_color_events (GtkWidget *widget,
GdkEvent *event)
{
ColorSelect *csp;
csp = (ColorSelect *) gtk_object_get_user_data (GTK_OBJECT (widget));
1997-11-25 06:05:25 +08:00
if (!csp)
return FALSE;
switch (event->type)
{
case GDK_EXPOSE:
if (!csp->gc)
csp->gc = gdk_gc_new (widget->window);
if (widget == csp->new_color)
color_select_update (csp, UPDATE_NEW_COLOR);
else if (widget == csp->orig_color)
color_select_update (csp, UPDATE_ORIG_COLOR);
break;
default:
break;
}
return FALSE;
}
static void
color_select_slider_update (GtkAdjustment *adjustment,
gpointer data)
{
ColorSelect *csp;
gint old_values[6];
gint update_z_marker;
gint update_xy_marker;
gint i, j;
1997-11-25 06:05:25 +08:00
csp = (ColorSelect *) data;
1997-11-25 06:05:25 +08:00
if (csp)
{
for (i = 0; i < 6; i++)
if (csp->slider_data[i] == adjustment)
break;
for (j = 0; j < 6; j++)
old_values[j] = csp->values[j];
csp->values[i] = (int) adjustment->value;
1999-10-28 23:05:49 +08:00
if ((i >= COLOR_SELECT_HUE) && (i <= COLOR_SELECT_VALUE))
1997-11-25 06:05:25 +08:00
color_select_update_rgb_values (csp);
1999-10-28 23:05:49 +08:00
else if ((i >= COLOR_SELECT_RED) && (i <= COLOR_SELECT_BLUE))
1997-11-25 06:05:25 +08:00
color_select_update_hsv_values (csp);
color_select_update_sliders (csp, i);
color_select_update_entries (csp, -1);
update_z_marker = 0;
update_xy_marker = 0;
for (j = 0; j < 6; j++)
{
if (j == csp->z_color_fill)
{
if (old_values[j] != csp->values[j])
update_z_marker = 1;
}
else
{
if (old_values[j] != csp->values[j])
update_xy_marker = 1;
}
}
if (update_z_marker)
{
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_POS | UPDATE_XY_COLOR);
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
}
else
{
if (update_z_marker)
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
if (update_xy_marker)
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_POS);
if (update_z_marker)
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
if (update_xy_marker)
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
}
color_select_update (csp, UPDATE_NEW_COLOR);
}
}
static void
color_select_entry_update (GtkWidget *widget,
1997-11-25 06:05:25 +08:00
gpointer data)
{
ColorSelect *csp;
1997-11-25 06:05:25 +08:00
int old_values[6];
int update_z_marker;
int update_xy_marker;
gint i, j;
1997-11-25 06:05:25 +08:00
csp = (ColorSelect *) data;
1997-11-25 06:05:25 +08:00
if (csp)
{
for (i = 0; i < 6; i++)
if (csp->entries[i] == widget)
1997-11-25 06:05:25 +08:00
break;
for (j = 0; j < 6; j++)
old_values[j] = csp->values[j];
csp->values[i] = atoi (gtk_entry_get_text (GTK_ENTRY (csp->entries[i])));
if (csp->values[i] == old_values[i])
return;
1999-10-28 23:05:49 +08:00
if ((i >= COLOR_SELECT_HUE) && (i <= COLOR_SELECT_VALUE))
1997-11-25 06:05:25 +08:00
color_select_update_rgb_values (csp);
1999-10-28 23:05:49 +08:00
else if ((i >= COLOR_SELECT_RED) && (i <= COLOR_SELECT_BLUE))
1997-11-25 06:05:25 +08:00
color_select_update_hsv_values (csp);
color_select_update_entries (csp, i);
color_select_update_sliders (csp, -1);
update_z_marker = 0;
update_xy_marker = 0;
for (j = 0; j < 6; j++)
{
if (j == csp->z_color_fill)
{
if (old_values[j] != csp->values[j])
update_z_marker = 1;
}
else
{
if (old_values[j] != csp->values[j])
update_xy_marker = 1;
}
}
if (update_z_marker)
{
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_POS | UPDATE_XY_COLOR);
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
}
else
{
if (update_z_marker)
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
if (update_xy_marker)
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
color_select_update (csp, UPDATE_POS);
if (update_z_marker)
color_select_draw_z_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
if (update_xy_marker)
color_select_draw_xy_marker (csp, NULL);
1997-11-25 06:05:25 +08:00
}
color_select_update (csp, UPDATE_NEW_COLOR);
}
}
static void
color_select_toggle_update (GtkWidget *widget,
1997-11-25 06:05:25 +08:00
gpointer data)
{
ColorSelect *csp;
1999-10-28 23:05:49 +08:00
ColorSelectFillType type = COLOR_SELECT_HUE;
gint i;
1997-11-25 06:05:25 +08:00
if (!GTK_TOGGLE_BUTTON (widget)->active)
1997-11-25 06:05:25 +08:00
return;
csp = (ColorSelect *) data;
1997-11-25 06:05:25 +08:00
if (csp)
{
for (i = 0; i < 6; i++)
if (widget == csp->toggles[i])
1997-11-25 06:05:25 +08:00
type = (ColorSelectFillType) i;
switch (type)
{
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_HUE:
csp->z_color_fill = COLOR_SELECT_HUE;
csp->xy_color_fill = COLOR_SELECT_SATURATION_VALUE;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_SATURATION:
csp->z_color_fill = COLOR_SELECT_SATURATION;
csp->xy_color_fill = COLOR_SELECT_HUE_VALUE;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_VALUE:
csp->z_color_fill = COLOR_SELECT_VALUE;
csp->xy_color_fill = COLOR_SELECT_HUE_SATURATION;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_RED:
csp->z_color_fill = COLOR_SELECT_RED;
csp->xy_color_fill = COLOR_SELECT_GREEN_BLUE;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_GREEN:
csp->z_color_fill = COLOR_SELECT_GREEN;
csp->xy_color_fill = COLOR_SELECT_RED_BLUE;
1997-11-25 06:05:25 +08:00
break;
1999-10-28 23:05:49 +08:00
case COLOR_SELECT_BLUE:
csp->z_color_fill = COLOR_SELECT_BLUE;
csp->xy_color_fill = COLOR_SELECT_RED_GREEN;
1997-11-25 06:05:25 +08:00
break;
default:
break;
}
color_select_update (csp, UPDATE_POS);
color_select_update (csp, UPDATE_Z_COLOR | UPDATE_XY_COLOR);
}
}
static gint
color_select_hex_entry_leave (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
ColorSelect *csp;
gchar buffer[8];
gchar *hex_color;
guint hex_rgb;
csp = (ColorSelect *) data;
if (csp)
{
hex_color = g_strdup (gtk_entry_get_text (GTK_ENTRY (csp->hex_entry)));
g_snprintf(buffer, sizeof (buffer), "#%.2x%.2x%.2x",
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED],
csp->values[COLOR_SELECT_GREEN],
csp->values[COLOR_SELECT_BLUE]);
if ((strlen (hex_color) == 7) &&
(g_strcasecmp (buffer, hex_color) != 0))
{
if ((sscanf (hex_color, "#%x", &hex_rgb) == 1) &&
(hex_rgb < (1 << 24)))
color_select_set_color (csp,
(hex_rgb & 0xff0000) >> 16,
(hex_rgb & 0x00ff00) >> 8,
hex_rgb & 0x0000ff,
TRUE);
}
g_free (hex_color);
}
return FALSE;
}
1997-11-25 06:05:25 +08:00
static void
color_select_image_fill (GtkWidget *preview,
ColorSelectFillType type,
gint *values)
1997-11-25 06:05:25 +08:00
{
ColorSelectFill csf;
gint height;
1997-11-25 06:05:25 +08:00
csf.buffer = g_malloc (preview->requisition.width * 3);
csf.update = update_procs[type];
csf.y = -1;
csf.width = preview->requisition.width;
csf.height = preview->requisition.height;
csf.values = values;
height = csf.height;
if (height > 0)
while (height--)
{
(* csf.update) (&csf);
gtk_preview_draw_row (GTK_PREVIEW (preview),
csf.buffer, 0, csf.y, csf.width);
1997-11-25 06:05:25 +08:00
}
g_free (csf.buffer);
}
static void
color_select_draw_z_marker (ColorSelect *csp,
GdkRectangle *clip)
1997-11-25 06:05:25 +08:00
{
gint width;
gint height;
gint y;
gint minx;
gint miny;
1997-11-25 06:05:25 +08:00
if (csp->gc)
{
y = (Z_DEF_HEIGHT - 1) - ((Z_DEF_HEIGHT - 1) * csp->pos[2]) / 255;
width = csp->z_color->requisition.width;
height = csp->z_color->requisition.height;
minx = 0;
miny = 0;
1997-11-25 06:05:25 +08:00
if (width <= 0)
return;
if (clip)
{
width = MIN(width, clip->x + clip->width);
height = MIN(height, clip->y + clip->height);
minx = MAX(0, clip->x);
miny = MAX(0, clip->y);
}
if (y >= miny && y < height)
{
gdk_gc_set_function (csp->gc, GDK_INVERT);
gdk_draw_line (csp->z_color->window, csp->gc, minx, y, width - 1, y);
gdk_gc_set_function (csp->gc, GDK_COPY);
}
1997-11-25 06:05:25 +08:00
}
}
static void
color_select_draw_xy_marker (ColorSelect *csp,
GdkRectangle *clip)
1997-11-25 06:05:25 +08:00
{
gint width;
gint height;
gint x, y;
gint minx, miny;
1997-11-25 06:05:25 +08:00
if (csp->gc)
{
x = ((XY_DEF_WIDTH - 1) * csp->pos[0]) / 255;
y = (XY_DEF_HEIGHT - 1) - ((XY_DEF_HEIGHT - 1) * csp->pos[1]) / 255;
width = csp->xy_color->requisition.width;
height = csp->xy_color->requisition.height;
minx = 0;
miny = 0;
1997-11-25 06:05:25 +08:00
if ((width <= 0) || (height <= 0))
return;
gdk_gc_set_function (csp->gc, GDK_INVERT);
if (clip)
{
width = MIN(width, clip->x + clip->width);
height = MIN(height, clip->y + clip->height);
minx = MAX(0, clip->x);
miny = MAX(0, clip->y);
}
if (y >= miny && y < height)
gdk_draw_line (csp->xy_color->window, csp->gc, minx, y, width - 1, y);
if (x >= minx && x < width)
gdk_draw_line (csp->xy_color->window, csp->gc, x, miny, x, height - 1);
1997-11-25 06:05:25 +08:00
gdk_gc_set_function (csp->gc, GDK_COPY);
}
}
static void
color_select_update_red (ColorSelectFill *csf)
{
guchar *p;
gint i, r;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
r = (csf->height - csf->y + 1) * 255 / csf->height;
if (r < 0)
r = 0;
if (r > 255)
r = 255;
for (i = 0; i < csf->width; i++)
{
*p++ = r;
*p++ = 0;
*p++ = 0;
}
}
static void
color_select_update_green (ColorSelectFill *csf)
{
guchar *p;
gint i, g;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
g = (csf->height - csf->y + 1) * 255 / csf->height;
if (g < 0)
g = 0;
if (g > 255)
g = 255;
for (i = 0; i < csf->width; i++)
{
*p++ = 0;
*p++ = g;
*p++ = 0;
}
}
static void
color_select_update_blue (ColorSelectFill *csf)
{
guchar *p;
gint i, b;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
b = (csf->height - csf->y + 1) * 255 / csf->height;
if (b < 0)
b = 0;
if (b > 255)
b = 255;
for (i = 0; i < csf->width; i++)
{
*p++ = 0;
*p++ = 0;
*p++ = b;
}
}
static void
color_select_update_hue (ColorSelectFill *csf)
{
guchar *p;
gfloat h, f;
gint r, g, b;
gint i;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
h = csf->y * 360 / csf->height;
h = 360 - h;
if (h < 0)
h = 0;
if (h >= 360)
h = 0;
h /= 60;
f = (h - (int) h) * 255;
r = g = b = 0;
switch ((int) h)
{
case 0:
r = 255;
g = f;
b = 0;
break;
case 1:
r = 255 - f;
g = 255;
b = 0;
break;
case 2:
r = 0;
g = 255;
b = f;
break;
case 3:
r = 0;
g = 255 - f;
b = 255;
break;
case 4:
r = f;
g = 0;
b = 255;
break;
case 5:
r = 255;
g = 0;
b = 255 - f;
break;
}
for (i = 0; i < csf->width; i++)
{
*p++ = r;
*p++ = g;
*p++ = b;
}
}
static void
color_select_update_saturation (ColorSelectFill *csf)
{
guchar *p;
gint s;
gint i;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
s = csf->y * 255 / csf->height;
if (s < 0)
s = 0;
if (s > 255)
s = 255;
s = 255 - s;
for (i = 0; i < csf->width; i++)
{
*p++ = s;
*p++ = s;
*p++ = s;
}
}
static void
color_select_update_value (ColorSelectFill *csf)
{
guchar *p;
gint v;
gint i;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
v = csf->y * 255 / csf->height;
if (v < 0)
v = 0;
if (v > 255)
v = 255;
v = 255 - v;
for (i = 0; i < csf->width; i++)
{
*p++ = v;
*p++ = v;
*p++ = v;
}
}
static void
color_select_update_red_green (ColorSelectFill *csf)
{
guchar *p;
gint i, r, b;
gfloat g, dg;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
1999-10-28 23:05:49 +08:00
b = csf->values[COLOR_SELECT_BLUE];
1997-11-25 06:05:25 +08:00
r = (csf->height - csf->y + 1) * 255 / csf->height;
if (r < 0)
r = 0;
if (r > 255)
r = 255;
g = 0;
dg = 255.0 / csf->width;
for (i = 0; i < csf->width; i++)
{
*p++ = r;
*p++ = g;
*p++ = b;
g += dg;
}
}
static void
color_select_update_red_blue (ColorSelectFill *csf)
{
guchar *p;
gint i, r, g;
gfloat b, db;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
1999-10-28 23:05:49 +08:00
g = csf->values[COLOR_SELECT_GREEN];
1997-11-25 06:05:25 +08:00
r = (csf->height - csf->y + 1) * 255 / csf->height;
if (r < 0)
r = 0;
if (r > 255)
r = 255;
b = 0;
db = 255.0 / csf->width;
for (i = 0; i < csf->width; i++)
{
*p++ = r;
*p++ = g;
*p++ = b;
b += db;
}
}
static void
color_select_update_green_blue (ColorSelectFill *csf)
{
guchar *p;
gint i, g, r;
gfloat b, db;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
1999-10-28 23:05:49 +08:00
r = csf->values[COLOR_SELECT_RED];
1997-11-25 06:05:25 +08:00
g = (csf->height - csf->y + 1) * 255 / csf->height;
if (g < 0)
g = 0;
if (g > 255)
g = 255;
b = 0;
db = 255.0 / csf->width;
for (i = 0; i < csf->width; i++)
{
*p++ = r;
*p++ = g;
*p++ = b;
b += db;
}
}
static void
color_select_update_hue_saturation (ColorSelectFill *csf)
{
guchar *p;
gfloat h, v, s, ds;
gint f;
gint i;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
h = 360 - (csf->y * 360 / csf->height);
if (h < 0)
h = 0;
if (h > 359)
h = 359;
h /= 60;
f = (h - (int) h) * 255;
s = 0;
ds = 1.0 / csf->width;
1999-10-28 23:05:49 +08:00
v = csf->values[COLOR_SELECT_VALUE] / 100.0;
1997-11-25 06:05:25 +08:00
switch ((int) h)
{
case 0:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255;
*p++ = v * (255 - (s * (255 - f)));
*p++ = v * 255 * (1 - s);
s += ds;
}
break;
case 1:
for (i = 0; i < csf->width; i++)
{
*p++ = v * (255 - s * f);
*p++ = v * 255;
*p++ = v * 255 * (1 - s);
s += ds;
}
break;
case 2:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255 * (1 - s);
*p++ = v *255;
*p++ = v * (255 - (s * (255 - f)));
s += ds;
}
break;
case 3:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255 * (1 - s);
*p++ = v * (255 - s * f);
*p++ = v * 255;
s += ds;
}
break;
case 4:
for (i = 0; i < csf->width; i++)
{
*p++ = v * (255 - (s * (255 - f)));
*p++ = v * (255 * (1 - s));
*p++ = v * 255;
s += ds;
}
break;
case 5:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255;
*p++ = v * 255 * (1 - s);
*p++ = v * (255 - s * f);
s += ds;
}
break;
}
}
static void
color_select_update_hue_value (ColorSelectFill *csf)
{
guchar *p;
gfloat h, v, dv, s;
gint f;
gint i;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
h = 360 - (csf->y * 360 / csf->height);
if (h < 0)
h = 0;
if (h > 359)
h = 359;
h /= 60;
f = (h - (int) h) * 255;
v = 0;
dv = 1.0 / csf->width;
1999-10-28 23:05:49 +08:00
s = csf->values[COLOR_SELECT_SATURATION] / 100.0;
1997-11-25 06:05:25 +08:00
switch ((int) h)
{
case 0:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255;
*p++ = v * (255 - (s * (255 - f)));
*p++ = v * 255 * (1 - s);
v += dv;
}
break;
case 1:
for (i = 0; i < csf->width; i++)
{
*p++ = v * (255 - s * f);
*p++ = v * 255;
*p++ = v * 255 * (1 - s);
v += dv;
}
break;
case 2:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255 * (1 - s);
*p++ = v *255;
*p++ = v * (255 - (s * (255 - f)));
v += dv;
}
break;
case 3:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255 * (1 - s);
*p++ = v * (255 - s * f);
*p++ = v * 255;
v += dv;
}
break;
case 4:
for (i = 0; i < csf->width; i++)
{
*p++ = v * (255 - (s * (255 - f)));
*p++ = v * (255 * (1 - s));
*p++ = v * 255;
v += dv;
}
break;
case 5:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255;
*p++ = v * 255 * (1 - s);
*p++ = v * (255 - s * f);
v += dv;
}
break;
}
}
static void
color_select_update_saturation_value (ColorSelectFill *csf)
{
guchar *p;
gfloat h, v, dv, s;
gint f;
gint i;
1997-11-25 06:05:25 +08:00
p = csf->buffer;
csf->y += 1;
s = (float) csf->y / csf->height;
if (s < 0)
s = 0;
if (s > 1)
s = 1;
s = 1 - s;
1999-10-28 23:05:49 +08:00
h = (float) csf->values[COLOR_SELECT_HUE];
1997-11-25 06:05:25 +08:00
if (h >= 360)
h -= 360;
h /= 60;
f = (h - (int) h) * 255;
v = 0;
dv = 1.0 / csf->width;
switch ((int) h)
{
case 0:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255;
*p++ = v * (255 - (s * (255 - f)));
*p++ = v * 255 * (1 - s);
v += dv;
}
break;
case 1:
for (i = 0; i < csf->width; i++)
{
*p++ = v * (255 - s * f);
*p++ = v * 255;
*p++ = v * 255 * (1 - s);
v += dv;
}
break;
case 2:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255 * (1 - s);
*p++ = v *255;
*p++ = v * (255 - (s * (255 - f)));
v += dv;
}
break;
case 3:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255 * (1 - s);
*p++ = v * (255 - s * f);
*p++ = v * 255;
v += dv;
}
break;
case 4:
for (i = 0; i < csf->width; i++)
{
*p++ = v * (255 - (s * (255 - f)));
*p++ = v * (255 * (1 - s));
*p++ = v * 255;
v += dv;
}
break;
case 5:
for (i = 0; i < csf->width; i++)
{
*p++ = v * 255;
*p++ = v * 255 * (1 - s);
*p++ = v * (255 - s * f);
v += dv;
}
break;
}
}
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
/*****************************/
/* Colour notebook glue */
typedef struct
{
GimpColorSelector_Callback callback;
gpointer *client_data;
ColorSelect *csp;
GtkWidget *main_vbox;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
} notebook_glue;
static GtkWidget *
color_select_notebook_new (gint r,
gint g,
gint b,
GimpColorSelector_Callback callback,
gpointer data,
/* RETURNS: */
void **selector_data)
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
{
ColorSelect *csp;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
notebook_glue *glue;
glue = g_new (notebook_glue, 1);
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
csp = g_new (ColorSelect, 1);
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
glue->csp = csp;
glue->callback = callback;
glue->client_data = data;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
csp->callback = color_select_notebook_update_callback;
csp->client_data = glue;
1999-10-28 23:05:49 +08:00
csp->z_color_fill = COLOR_SELECT_HUE;
csp->xy_color_fill = COLOR_SELECT_SATURATION_VALUE;
csp->gc = NULL;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
csp->wants_updates = TRUE;
1999-10-28 23:05:49 +08:00
csp->values[COLOR_SELECT_RED] = csp->orig_values[0] = r;
csp->values[COLOR_SELECT_GREEN] = csp->orig_values[1] = g;
csp->values[COLOR_SELECT_BLUE] = csp->orig_values[2] = b;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
color_select_update_hsv_values (csp);
color_select_update_pos (csp);
glue->main_vbox = color_select_widget_new (csp, r, g, b);
color_select_image_fill (csp->z_color, csp->z_color_fill, csp->values);
color_select_image_fill (csp->xy_color, csp->xy_color_fill, csp->values);
(*selector_data) = glue;
return glue->main_vbox;
}
static void
color_select_notebook_free (void *data)
{
notebook_glue *glue = data;
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
gdk_gc_destroy (glue->csp->gc);
g_free (glue->csp);
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
/* don't need to destroy the widget, since it's done by the caller
* of this function */
g_free (glue);
}
static void
color_select_notebook_setcolor (void *data,
int r, int g, int b, int set_current)
{
notebook_glue *glue = data;
color_select_set_color (glue->csp, r, g, b, set_current);
}
static void
color_select_notebook_update_callback (gint r,
gint g,
gint b,
ColorSelectState state,
void *data)
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
{
notebook_glue *glue = data;
switch (state)
{
case COLOR_SELECT_UPDATE:
glue->callback (glue->client_data, r, g, b);
break;
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
default:
g_warning ("state %d can't happen!", state);
break;
}
Bit of a large checkin this - it's basically three things: 1 - GimpModules Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk> Bit of a large checkin this - it's basically three things: 1 - GimpModules using gmodules to dynamically load and initialise modules at gimp start of day. 2 - Color selectors now register themselves with a color notebook. 3 - progress bars have been cleaned up a bit, so now have progress indictations on all transform tool and gradient fill operations. Not done bucket fill, but that seems to be the next candidate. New directories: * modules/: new directory for dynamically loadable modules. New files: * modules/.cvsignore * modules/Makefile.am * modules/colorsel_gtk.c: GTK color selector wrapped up as a color selector the gimp can use. * app/gimpprogress.[ch]: progress bars within gimp core, either as popups, or in the status bar. This is mainly code moved out of plug-in.c * app/color_notebook.[ch]: color selector notebook, implementing very similar interface to color_select.h so it can be used as a drop-in replacement for it. * libgimp/color_selector.h: API color selectors need to implement to become a page in the color_notebook. * libgimp/gimpmodule.h: API gimp modules need to implement to be initialised by gimp at start of day. Modified files: * Makefile.am: add modules/ to SUBDIRS * libgimp/Makefile.am: install gimpmodule.h and color_selector.h * app/gimprc.[ch]: recognise module-path variable. * gimprc.in: set module-path variable to something sensible (currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules"). * app/Makefile.am: build color notebook and gimpprogress * app/app_procs.c: register internal GIMP color selector with color notebook. * app/asupsample.c: call progress function less frequently for better performance. * app/asupsample.h: progress_func_t typedef moved to gimpprogress.h * app/blend.c: make callbacks to a progress function * app/color_area.c: use a color notebook rather than a color selector * app/color_panel.c: ditto * app/color_select.c: export color selector interface for notebook * app/color_select.h: color_select_init() prototype * app/flip_tool.c: flip the image every time, rather than every second click. * app/interface.c: move progress bar stuff out to gimpprogress.c. Make the code actually work while we're at it. * app/interface.h: move prototypes for progress functions out to gimpprogress.h * app/plug_in.c: load and initialise modules (if possible). Move progress bar handling code out to gimpprogress.c * app/plug_in.h: keep only a gimp_progress * for each plugin, not a whole bunch of GtkWidgets. * app/scale_tool.c * app/rotate_tool.c * app/shear_tool.c * app/perspective_tool.c: progress bar during operation. De-sensitise the dialog to discourage the user from running two transforms in parallel. * app/transform_core.c: recalculate grid coords when bounding box changes. Only initialise the action area of the dialog once, to avoid multiple "ok" / "reset" buttons appearing. Undraw transform tool with correct matrix to get rid of handle remains on screen. Call a progress function as we apply the transform matrix. A few new i18n markups. Invalidate floating selection marching ants after applying matrix. * app/transform_core.h: transform_core_do() takes an optional progress callback argument (and data). * plug-ins/oilify/oilify.c: send progress bar updates after every pixel region, not only if they processed a multiple of 5 pixels (which was quite unlikely, and therefore gave a jerky progress indication).
1999-01-11 08:57:33 +08:00
}