Files
gimp/app/widgets/gimpspinscale.h
Jehan bff3903f37 app: new gimp_spin_scale_set_constrain_drag() and use it on paint...
... tools' brush options.
After discussions, it turned out that many people disliked that the spin
scale for brush size (and some other options) get you fractional values.
How often do you actually need to get a 4.32 pixel-size brush? And even
how meaningful is it? On the other hand, you usually want a 4 or a 5
pixel size brush and it's nearly impossible to get (exactly) by dragging
the scale widget.
It is so annoying that some even resort to edit the value with keyboard!
So I am adding an optional "constrain" feature to GimpSpinScale. It will
still be possible to get fractional values when constraining is on, for
instance with keyboard edit (the arrow incrementation also will keep any
fractional part). So the interaction for such scales is simply reversed
so that you get integers easily, and fractional parts with a bit more
effort.

It is not turned on by default (some feature actually need precision and
we don't want to break the sliders for these) and for the time being, I
only applied it to all the brush settings in paint tools. Now that it
exist, we may want to apply this to more scales in various parts of
GIMP.
2019-01-25 18:21:05 +01:00

74 lines
3.2 KiB
C

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpspinscale.h
* Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_SPIN_SCALE_H__
#define __GIMP_SPIN_SCALE_H__
#define GIMP_TYPE_SPIN_SCALE (gimp_spin_scale_get_type ())
#define GIMP_SPIN_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SPIN_SCALE, GimpSpinScale))
#define GIMP_SPIN_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SPIN_SCALE, GimpSpinScaleClass))
#define GIMP_IS_SPIN_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SPIN_SCALE))
#define GIMP_IS_SPIN_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SPIN_SCALE))
#define GIMP_SPIN_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SPIN_SCALE, GimpSpinScaleClass))
typedef struct _GimpSpinScale GimpSpinScale;
typedef struct _GimpSpinScaleClass GimpSpinScaleClass;
struct _GimpSpinScale
{
GtkSpinButton parent_instance;
};
struct _GimpSpinScaleClass
{
GtkSpinButtonClass parent_class;
};
GType gimp_spin_scale_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment,
const gchar *label,
gint digits);
void gimp_spin_scale_set_label (GimpSpinScale *scale,
const gchar *label);
const gchar * gimp_spin_scale_get_label (GimpSpinScale *scale);
void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale,
gdouble lower,
gdouble upper);
void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale);
gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale,
gdouble *lower,
gdouble *upper);
void gimp_spin_scale_set_gamma (GimpSpinScale *scale,
gdouble gamma);
gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale);
void gimp_spin_scale_set_constrain_drag (GimpSpinScale *scale,
gboolean constrain);
gboolean gimp_spin_scale_get_constrain_drag (GimpSpinScale *scale);
#endif /* __GIMP_SPIN_SCALE_H__ */