gimpspinscale.c revision fd0c127e55f5c9c10cd46970bcaacd23d0718b83
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
* 2012 Øyvind Kolås <pippin@gimp.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <math.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include "gimpspinscale.h"
enum
{
};
typedef enum
{
#if WITH_GTKMM_3_0
#endif
typedef enum
{
APPEARANCE_COMPACT, /* Compact, suitable for desktops with mouse control */
typedef struct _GimpSpinScalePrivate GimpSpinScalePrivate;
struct _GimpSpinScalePrivate
{
};
GParamSpec *pspec);
GParamSpec *pspec);
#if WITH_GTKMM_3_0
#else
#endif
GdkEventKey *event);
static void
{
#if WITH_GTKMM_3_0
#else
#endif
NULL,
}
static void
{
}
static void
{
{
}
}
static void
{
{
}
}
static void
{
switch (property_id)
{
case PROP_LABEL:
{
}
break;
case PROP_FOCUS_WIDGET:
{
/* TODO unhook prior */
}
break;
default:
break;
}
}
static void
{
switch (property_id)
{
case PROP_LABEL:
break;
case PROP_FOCUS_WIDGET:
break;
default:
break;
}
}
void
{
/* TODO unhook prior */
}
void
{
}
}
static void
#if WITH_GTKMM_3_0
#else
#endif
{
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
} else {
}
#endif
{
#if WITH_GTKMM_3_0
#else
/* ~3 chars for the ellipses */
#endif
}
}
#if WITH_GTKMM_3_0
static void
{
//gint height;
//height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
// pango_font_metrics_get_descent (metrics));
*minimum_height += 1;
*natural_height += 1;
}
#endif
static void
{
{
}
}
static gboolean
#if WITH_GTKMM_3_0
#else
#endif
{
#if WITH_GTKMM_3_0
cairo_save (cr);
cairo_restore (cr);
#else
gint w;
cairo_clip (cr);
#else
#endif
#endif
#if WITH_GTKMM_3_0
{
#else
{
#endif
#if WITH_GTKMM_3_0
#else
#endif
{
}
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
else
layout_offset_x = 4;
layout_offset_x -= logical.x;
#if WITH_GTKMM_3_0
#else
#endif
}
#if WITH_GTKMM_3_0
#else
cairo_destroy (cr);
#endif
return FALSE;
}
#if WITH_GTKMM_3_0
/* Returns TRUE if a translation should be done */
static gboolean
int *x,
int *y)
{
GdkWindow *w, *widget_window;
if (!gtk_widget_get_has_window (widget))
{
*x = -allocation.x;
*y = -allocation.y;
}
else
{
*x = 0;
*y = 0;
}
{
*x += wx;
*y += wy;
}
if (w == NULL)
{
*x = 0;
*y = 0;
return FALSE;
}
return TRUE;
}
static void
{
{
}
}
#endif
static SpinScaleTarget
gdouble x,
gdouble y)
{
#if WITH_GTKMM_3_0
{
x -= text_area.x;
y -= text_area.y;
{
return TARGET_NUMBER;
}
{
return TARGET_LOWER;
}
return TARGET_UPPER;
}
return TARGET_NONE;
#else
{
return TARGET_NUMBER;
}
{
return TARGET_LOWER;
}
return TARGET_UPPER;
#endif
}
static void
{
if (private->scale_limits_set)
{
}
else
{
}
}
static void
gdouble x)
{
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#else
#endif
#endif
#if WITH_GTKMM_3_0
#else
x = width - x;
#endif
if (private->relative_change)
{
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
else
}
else
{
#if WITH_GTKMM_3_0
#else
#endif
if (fraction > 0.0)
}
}
static gboolean
{
#if WITH_GTKMM_3_0
gint x, y;
&x, &y);
switch (gimp_spin_scale_get_target (widget, x, y))
{
case TARGET_UPPER:
return TRUE;
case TARGET_LOWER:
private->start_value = gtk_adjustment_get_value (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)));
return TRUE;
default:
break;
}
#else
{
{
case TARGET_UPPER:
return TRUE;
case TARGET_LOWER:
private->start_value = gtk_adjustment_get_value (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)));
return TRUE;
default:
break;
}
}
#endif
}
static gboolean
{
#if WITH_GTKMM_3_0
gint x, y;
&x, &y);
#endif
if (private->changing_value)
{
#if WITH_GTKMM_3_0
#else
#endif
return TRUE;
}
}
static gboolean
{
#if WITH_GTKMM_3_0
gint x, y;
&x, &y);
#endif
if (private->changing_value)
{
#if WITH_GTKMM_3_0
#else
#endif
return TRUE;
}
#if WITH_GTKMM_3_0
#else
#endif
)
{
#if WITH_GTKMM_3_0
switch (gimp_spin_scale_get_target (widget, x, y))
#else
#endif
{
case TARGET_NUMBER:
break;
case TARGET_UPPER:
break;
case TARGET_LOWER:
break;
default:
break;
}
#if WITH_GTKMM_3_0
if (cursor)
{
}
#else
#endif
}
return FALSE;
}
static gboolean
{
}
{
0, &key, 0, 0, 0 );
switch ( key ) {
case GDK_KEY_Escape:
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
{
}
break;
}
}
static void
{
if ( private->transferFocus ) {
if ( private->focusWidget ) {
}
}
}
static void
{
// TODO - Allow scrollwheel to change value then return focus,
//if ( gtk_widget_has_focus( GTK_WIDGET(spin_button) ) ) {
// gimp_spin_scale_defocus( spin_button );
//}
}
/* public functions */
{
return g_object_new (GIMP_TYPE_SPIN_SCALE,
"adjustment", adjustment,
"label", label,
"digits", digits,
NULL);
}
void
{
}
void
{
}
{
}
void
{
}
{
if (lower)
if (upper)
return private->scale_limits_set;
}