1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1999-06-07 10:21:31 +08:00
|
|
|
#include "config.h"
|
1999-06-26 19:16:47 +08:00
|
|
|
|
2002-01-30 22:54:27 +08:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#warning GTK_DISABLE_DEPRECATED
|
|
|
|
#endif
|
|
|
|
#undef GTK_DISABLE_DEPRECATED
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
#include "base/gimphistogram.h"
|
|
|
|
#include "base/pixel-region.h"
|
|
|
|
|
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
|
2002-03-18 00:35:05 +08:00
|
|
|
#include "widgets/gimpenummenu.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
#include "widgets/gimphistogramview.h"
|
2002-08-31 05:00:42 +08:00
|
|
|
#include "widgets/gimpviewabledialog.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
#include "gimphistogramtool.h"
|
|
|
|
#include "tool_manager.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
#include "app_procs.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
|
|
|
|
1999-11-05 03:50:14 +08:00
|
|
|
#define TEXT_WIDTH 45
|
|
|
|
#define GRADIENT_HEIGHT 15
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
typedef struct _HistogramToolDialog HistogramToolDialog;
|
|
|
|
|
|
|
|
struct _HistogramToolDialog
|
|
|
|
{
|
2002-08-29 03:47:07 +08:00
|
|
|
GtkWidget *shell;
|
|
|
|
|
|
|
|
GtkWidget *info_labels[7];
|
|
|
|
GtkWidget *channel_menu;
|
|
|
|
GimpHistogramView *histogram;
|
|
|
|
GimpHistogram *hist;
|
|
|
|
GtkWidget *gradient;
|
|
|
|
|
|
|
|
gdouble mean;
|
|
|
|
gdouble std_dev;
|
|
|
|
gdouble median;
|
|
|
|
gdouble pixels;
|
|
|
|
gdouble count;
|
|
|
|
gdouble percentile;
|
|
|
|
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpHistogramChannel channel;
|
|
|
|
gboolean color;
|
2001-10-17 19:33:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
/* local function prototypes */
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void gimp_histogram_tool_class_init (GimpHistogramToolClass *klass);
|
2002-06-17 01:13:39 +08:00
|
|
|
static void gimp_histogram_tool_init (GimpHistogramTool *hist_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
static void gimp_histogram_tool_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_histogram_tool_control (GimpTool *tool,
|
2002-02-19 01:00:09 +08:00
|
|
|
GimpToolAction action,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
static HistogramToolDialog * histogram_tool_dialog_new (void);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
static void histogram_tool_close_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2002-03-18 00:35:05 +08:00
|
|
|
static gboolean histogram_set_sensitive_callback
|
2002-08-29 03:47:07 +08:00
|
|
|
(gpointer item_data,
|
|
|
|
HistogramToolDialog *htd);
|
|
|
|
static void histogram_tool_channel_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void histogram_tool_gradient_draw (GtkWidget *gradient,
|
|
|
|
GimpHistogramChannel channel);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
static void histogram_tool_dialog_update (HistogramToolDialog *htd,
|
|
|
|
gint start,
|
|
|
|
gint end);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
static void histogram_tool_histogram_range (GimpHistogramView *view,
|
|
|
|
gint start,
|
|
|
|
gint end,
|
|
|
|
gpointer data);
|
2001-10-17 19:33:43 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static HistogramToolDialog * histogram_dialog = NULL;
|
|
|
|
|
|
|
|
static GimpToolClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
/* public functions */
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_histogram_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_HISTOGRAM_TOOL,
|
2001-11-21 07:00:47 +08:00
|
|
|
NULL,
|
|
|
|
FALSE,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-histogram-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Histogram"),
|
|
|
|
_("View image histogram"),
|
2001-12-04 01:59:48 +08:00
|
|
|
N_("/Layer/Colors/Histogram..."), NULL,
|
2001-11-21 07:00:47 +08:00
|
|
|
NULL, "tools/histogram.html",
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_HISTOGRAM,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-05-25 07:57:08 +08:00
|
|
|
gimp_histogram_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpHistogramToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_histogram_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpHistogramTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_histogram_tool_init,
|
2001-05-25 07:57:08 +08:00
|
|
|
};
|
|
|
|
|
2002-06-17 01:13:39 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL,
|
2001-08-14 22:53:55 +08:00
|
|
|
"GimpHistogramTool",
|
|
|
|
&tool_info, 0);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_histogram_tool_class_init (GimpHistogramToolClass *klass)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
GimpToolClass *tool_class;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
tool_class->initialize = gimp_histogram_tool_initialize;
|
|
|
|
tool_class->control = gimp_histogram_tool_control;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-06-17 01:13:39 +08:00
|
|
|
gimp_histogram_tool_init (GimpHistogramTool *hist_tool)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-10-29 19:47:11 +08:00
|
|
|
gimp_histogram_tool_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2002-08-31 05:00:42 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
PixelRegion PR;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
|
|
|
|
{
|
|
|
|
g_message (_("Histogram does not operate on indexed drawables."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The histogram_tool dialog */
|
|
|
|
if (! histogram_dialog)
|
|
|
|
histogram_dialog = histogram_tool_dialog_new ();
|
2002-08-29 03:47:07 +08:00
|
|
|
|
2002-08-31 05:00:42 +08:00
|
|
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
|
|
|
|
|
|
|
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (histogram_dialog->shell),
|
|
|
|
GIMP_VIEWABLE (drawable));
|
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_widget_show (histogram_dialog->shell);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-31 05:00:42 +08:00
|
|
|
histogram_dialog->drawable = drawable;
|
|
|
|
histogram_dialog->color = gimp_drawable_is_rgb (drawable);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-03-18 00:35:05 +08:00
|
|
|
gimp_option_menu_set_sensitive (GTK_OPTION_MENU (histogram_dialog->channel_menu),
|
|
|
|
(GimpOptionMenuSensitivityCallback) histogram_set_sensitive_callback,
|
|
|
|
histogram_dialog);
|
|
|
|
gimp_option_menu_set_history (GTK_OPTION_MENU (histogram_dialog->channel_menu),
|
|
|
|
GINT_TO_POINTER (histogram_dialog->channel));
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
/* calculate the histogram */
|
2002-08-31 05:00:42 +08:00
|
|
|
pixel_region_init (&PR, gimp_drawable_data (drawable),
|
2001-05-25 07:57:08 +08:00
|
|
|
0, 0,
|
2002-08-31 05:00:42 +08:00
|
|
|
gimp_drawable_width (drawable),
|
|
|
|
gimp_drawable_height (drawable),
|
2001-05-25 07:57:08 +08:00
|
|
|
FALSE);
|
|
|
|
gimp_histogram_calculate (histogram_dialog->hist, &PR, NULL);
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
gimp_histogram_view_update (histogram_dialog->histogram,
|
|
|
|
histogram_dialog->hist);
|
|
|
|
gimp_histogram_view_range (histogram_dialog->histogram, 0, 255);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-19 01:00:09 +08:00
|
|
|
gimp_histogram_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *gdisp)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case PAUSE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RESUME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HALT:
|
2001-10-17 19:33:43 +08:00
|
|
|
if (histogram_dialog)
|
|
|
|
histogram_tool_close_callback (NULL, (gpointer) histogram_dialog);
|
2001-05-25 07:57:08 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-02-19 01:00:09 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* histogram_tool machinery */
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
static void
|
|
|
|
histogram_tool_histogram_range (GimpHistogramView *widget,
|
|
|
|
gint start,
|
|
|
|
gint end,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
HistogramToolDialog *htd;
|
2000-12-31 12:07:42 +08:00
|
|
|
gdouble pixels;
|
|
|
|
gdouble count;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
htd = (HistogramToolDialog *) data;
|
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
|
|
|
if (htd == NULL || htd->hist == NULL ||
|
2000-12-31 12:07:42 +08:00
|
|
|
gimp_histogram_nchannels (htd->hist) <= 0)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-19 22:43:54 +08:00
|
|
|
pixels = gimp_histogram_get_count (htd->hist, 0, 255);
|
|
|
|
count = gimp_histogram_get_count (htd->hist, start, end);
|
|
|
|
|
|
|
|
htd->mean = gimp_histogram_get_mean (htd->hist, htd->channel,
|
|
|
|
start, end);
|
|
|
|
htd->std_dev = gimp_histogram_get_std_dev (htd->hist, htd->channel,
|
|
|
|
start, end);
|
|
|
|
htd->median = gimp_histogram_get_median (htd->hist, htd->channel,
|
|
|
|
start, end);
|
|
|
|
htd->pixels = pixels;
|
|
|
|
htd->count = count;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
htd->percentile = count / pixels;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (htd->shell)
|
|
|
|
histogram_tool_dialog_update (htd, start, end);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
histogram_tool_dialog_update (HistogramToolDialog *htd,
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gint start,
|
|
|
|
gint end)
|
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
|
|
|
gchar text[12];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* mean */
|
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 (text, sizeof (text), "%3.1f", htd->mean);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[0]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* std dev */
|
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 (text, sizeof (text), "%3.1f", htd->std_dev);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[1]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* median */
|
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 (text, sizeof (text), "%3.1f", htd->median);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[2]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* pixels */
|
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 (text, sizeof (text), "%8.1f", htd->pixels);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[3]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* intensity */
|
|
|
|
if (start == end)
|
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 (text, sizeof (text), "%d", start);
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
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 (text, sizeof (text), "%d..%d", start, end);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[4]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* count */
|
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 (text, sizeof (text), "%8.1f", htd->count);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[5]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* percentile */
|
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 (text, sizeof (text), "%2.2f", htd->percentile * 100);
|
1999-01-11 05:54:02 +08:00
|
|
|
gtk_label_set_text (GTK_LABEL (htd->info_labels[6]), text);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1998-04-14 05:59:28 +08:00
|
|
|
/***************************/
|
|
|
|
/* Histogram Tool dialog */
|
|
|
|
/***************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static HistogramToolDialog *
|
1999-11-22 19:14:29 +08:00
|
|
|
histogram_tool_dialog_new (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
HistogramToolDialog *htd;
|
1999-11-22 19:14:29 +08:00
|
|
|
GtkWidget *hbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
2002-08-29 03:47:07 +08:00
|
|
|
gint i;
|
|
|
|
gint x, y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
static const gchar *histogram_info_names[] =
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
|
|
|
N_("Mean:"),
|
|
|
|
N_("Std Dev:"),
|
|
|
|
N_("Median:"),
|
|
|
|
N_("Pixels:"),
|
|
|
|
N_("Intensity:"),
|
|
|
|
N_("Count:"),
|
|
|
|
N_("Percentile:")
|
|
|
|
};
|
1999-06-23 23:24:46 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
htd = g_new0 (HistogramToolDialog, 1);
|
2000-12-19 22:43:54 +08:00
|
|
|
htd->channel = GIMP_HISTOGRAM_VALUE;
|
2000-02-14 06:26:41 +08:00
|
|
|
htd->hist = gimp_histogram_new ();
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The shell and main vbox */
|
2002-08-31 05:00:42 +08:00
|
|
|
htd->shell =
|
|
|
|
gimp_viewable_dialog_new (NULL,
|
|
|
|
_("Histogram"),
|
|
|
|
"histogram",
|
|
|
|
GIMP_STOCK_TOOL_HISTOGRAM,
|
|
|
|
_("View Image Histogram"),
|
|
|
|
tool_manager_help_func, NULL,
|
|
|
|
|
|
|
|
GTK_STOCK_CLOSE, histogram_tool_close_callback,
|
|
|
|
htd, NULL, NULL, TRUE, TRUE,
|
|
|
|
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
hbox = gtk_hbox_new (TRUE, 0);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (htd->shell)->vbox), hbox);
|
2002-03-18 00:35:05 +08:00
|
|
|
gtk_widget_show (hbox);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);;
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, FALSE, 0);
|
2002-03-18 00:35:05 +08:00
|
|
|
gtk_widget_show (vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The option menu for selecting channels */
|
2002-03-18 00:35:05 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-06-07 10:21:31 +08:00
|
|
|
label = gtk_label_new (_("Information on Channel:"));
|
2002-03-18 00:35:05 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
2000-02-14 06:26:41 +08:00
|
|
|
gtk_widget_show (label);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-03-18 00:35:05 +08:00
|
|
|
htd->channel_menu =
|
|
|
|
gimp_enum_option_menu_new (GIMP_TYPE_HISTOGRAM_CHANNEL,
|
|
|
|
G_CALLBACK (histogram_tool_channel_callback),
|
|
|
|
htd);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), htd->channel_menu, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (htd->channel_menu);
|
|
|
|
|
|
|
|
/* The histogram tool histogram */
|
|
|
|
frame = gtk_frame_new (NULL);
|
2002-08-26 19:35:56 +08:00
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_widget_show (frame);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
htd->histogram = gimp_histogram_view_new (HISTOGRAM_WIDTH, HISTOGRAM_HEIGHT);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (htd->histogram));
|
|
|
|
gtk_widget_show (GTK_WIDGET (htd->histogram));
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2001-08-01 10:57:58 +08:00
|
|
|
g_signal_connect (G_OBJECT (htd->histogram), "range_changed",
|
|
|
|
G_CALLBACK (histogram_tool_histogram_range),
|
|
|
|
htd);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
1999-11-05 03:50:14 +08:00
|
|
|
/* The gradient below the histogram */
|
1999-11-26 08:34:39 +08:00
|
|
|
frame = gtk_frame_new (NULL);
|
2002-08-26 19:35:56 +08:00
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1999-11-26 08:34:39 +08:00
|
|
|
|
1999-11-05 03:50:14 +08:00
|
|
|
htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR);
|
|
|
|
gtk_preview_size (GTK_PREVIEW (htd->gradient),
|
|
|
|
HISTOGRAM_WIDTH, GRADIENT_HEIGHT);
|
1999-11-26 08:34:39 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->gradient));
|
1999-11-05 03:50:14 +08:00
|
|
|
gtk_widget_show (htd->gradient);
|
2002-08-29 03:47:07 +08:00
|
|
|
|
2000-12-19 22:43:54 +08:00
|
|
|
histogram_tool_gradient_draw (htd->gradient, GIMP_HISTOGRAM_VALUE);
|
1999-11-05 03:50:14 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* The table containing histogram information */
|
|
|
|
table = gtk_table_new (4, 4, TRUE);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* the labels for histogram information */
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
{
|
|
|
|
y = (i % 4);
|
|
|
|
x = (i / 4) * 2;
|
|
|
|
|
1998-12-16 08:37:09 +08:00
|
|
|
label = gtk_label_new (gettext(histogram_info_names[i]));
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), label, x, x + 1, y, y + 1,
|
|
|
|
GTK_FILL, GTK_FILL, 2, 2);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
htd->info_labels[i] = gtk_label_new ("0");
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (htd->info_labels[i]), 0.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), htd->info_labels[i],
|
|
|
|
x + 1, x + 2, y, y + 1,
|
1997-11-25 06:05:25 +08:00
|
|
|
GTK_FILL, GTK_FILL, 2, 2);
|
|
|
|
gtk_widget_show (htd->info_labels[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return htd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-04-14 05:59:28 +08:00
|
|
|
histogram_tool_close_callback (GtkWidget *widget,
|
1999-11-22 19:14:29 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
HistogramToolDialog *htd;
|
2001-07-08 01:36:00 +08:00
|
|
|
GimpTool *active_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
htd = (HistogramToolDialog *) data;
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
gtk_widget_hide (htd->shell);
|
2001-07-08 01:36:00 +08:00
|
|
|
|
|
|
|
active_tool = tool_manager_get_active (the_gimp);
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
active_tool->gdisp = NULL;
|
1999-11-22 19:14:29 +08:00
|
|
|
active_tool->drawable = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-02-14 06:26:41 +08:00
|
|
|
histogram_tool_channel_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
HistogramToolDialog *htd;
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
htd = (HistogramToolDialog *) data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-02-14 06:26:41 +08:00
|
|
|
gimp_menu_item_update (widget, &htd->channel);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
gimp_histogram_view_channel (htd->histogram, htd->channel);
|
2000-02-14 06:26:41 +08:00
|
|
|
histogram_tool_gradient_draw (htd->gradient, htd->channel);
|
1999-11-05 03:50:14 +08:00
|
|
|
}
|
|
|
|
|
2002-03-18 00:35:05 +08:00
|
|
|
static gboolean
|
|
|
|
histogram_set_sensitive_callback (gpointer item_data,
|
|
|
|
HistogramToolDialog *htd)
|
|
|
|
{
|
|
|
|
GimpHistogramChannel channel = GPOINTER_TO_INT (item_data);
|
|
|
|
|
|
|
|
switch (channel)
|
|
|
|
{
|
|
|
|
case GIMP_HISTOGRAM_VALUE:
|
|
|
|
return TRUE;
|
|
|
|
case GIMP_HISTOGRAM_RED:
|
|
|
|
case GIMP_HISTOGRAM_GREEN:
|
|
|
|
case GIMP_HISTOGRAM_BLUE:
|
|
|
|
return htd->color;
|
|
|
|
case GIMP_HISTOGRAM_ALPHA:
|
|
|
|
return gimp_drawable_has_alpha (htd->drawable);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-11-05 03:50:14 +08:00
|
|
|
static void
|
2002-08-29 03:47:07 +08:00
|
|
|
histogram_tool_gradient_draw (GtkWidget *gradient,
|
|
|
|
GimpHistogramChannel channel)
|
1999-11-05 03:50:14 +08:00
|
|
|
{
|
|
|
|
guchar buf[HISTOGRAM_WIDTH * 3];
|
|
|
|
guchar r, g, b;
|
2000-12-31 12:07:42 +08:00
|
|
|
gint i;
|
1999-11-05 03:50:14 +08:00
|
|
|
|
|
|
|
r = g = b = 0;
|
2000-12-19 22:43:54 +08:00
|
|
|
switch (channel)
|
1999-11-05 03:50:14 +08:00
|
|
|
{
|
2000-12-19 22:43:54 +08:00
|
|
|
case GIMP_HISTOGRAM_VALUE:
|
|
|
|
case GIMP_HISTOGRAM_ALPHA: r = g = b = 1;
|
1999-11-05 03:50:14 +08:00
|
|
|
break;
|
2000-12-19 22:43:54 +08:00
|
|
|
case GIMP_HISTOGRAM_RED: r = 1;
|
1999-11-05 03:50:14 +08:00
|
|
|
break;
|
2000-12-19 22:43:54 +08:00
|
|
|
case GIMP_HISTOGRAM_GREEN: g = 1;
|
1999-11-05 03:50:14 +08:00
|
|
|
break;
|
2000-12-19 22:43:54 +08:00
|
|
|
case GIMP_HISTOGRAM_BLUE: b = 1;
|
1999-11-05 03:50:14 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_warning ("unknown channel type, can't happen\n");
|
|
|
|
break;
|
|
|
|
}
|
2002-08-29 03:47:07 +08:00
|
|
|
|
1999-11-05 03:50:14 +08:00
|
|
|
for (i = 0; i < HISTOGRAM_WIDTH; i++)
|
|
|
|
{
|
2002-08-29 03:47:07 +08:00
|
|
|
buf[3 * i + 0] = i * r;
|
|
|
|
buf[3 * i + 1] = i * g;
|
|
|
|
buf[3 * i + 2] = i * b;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-11-05 03:50:14 +08:00
|
|
|
|
|
|
|
for (i = 0; i < GRADIENT_HEIGHT; i++)
|
|
|
|
gtk_preview_draw_row (GTK_PREVIEW (gradient),
|
|
|
|
buf, 0, i, HISTOGRAM_WIDTH);
|
2002-08-29 03:47:07 +08:00
|
|
|
|
1999-11-05 03:50:14 +08:00
|
|
|
gtk_widget_queue_draw (gradient);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|