Bug 703692 - Unable to Resize Large Left Dock Area
Merge all color-selector-wheel changes from master, which turns the thing into a properly reqizable widget and fixes the issues with left dock resizability.
This commit is contained in:
parent
3632680049
commit
616e8f2d82
4 changed files with 1595 additions and 40 deletions
|
|
@ -70,7 +70,7 @@ libcolor_selector_water_la_SOURCES = color-selector-water.c
|
|||
libcolor_selector_water_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
||||
libcolor_selector_water_la_LIBADD = $(color_selector_libadd)
|
||||
|
||||
libcolor_selector_wheel_la_SOURCES = color-selector-wheel.c
|
||||
libcolor_selector_wheel_la_SOURCES = color-selector-wheel.c gimpcolorwheel.c gimpcolorwheel.h
|
||||
libcolor_selector_wheel_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
||||
libcolor_selector_wheel_la_LIBADD = $(color_selector_libadd)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
#include "libgimpmodule/gimpmodule.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gimpcolorwheel.h"
|
||||
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
|
||||
|
|
@ -53,16 +55,12 @@ struct _ColorselWheelClass
|
|||
};
|
||||
|
||||
|
||||
GType colorsel_wheel_get_type (void);
|
||||
static GType colorsel_wheel_get_type (void);
|
||||
|
||||
static void colorsel_wheel_set_color (GimpColorSelector *selector,
|
||||
const GimpRGB *rgb,
|
||||
const GimpHSV *hsv);
|
||||
|
||||
static void colorsel_wheel_size_allocate (GtkWidget *frame,
|
||||
GtkAllocation *allocation,
|
||||
ColorselWheel *wheel);
|
||||
static void colorsel_wheel_changed (GtkHSV *hsv,
|
||||
static void colorsel_wheel_changed (GimpColorWheel *hsv,
|
||||
GimpColorSelector *selector);
|
||||
|
||||
static const GimpModuleInfo colorsel_wheel_info =
|
||||
|
|
@ -89,6 +87,7 @@ gimp_module_query (GTypeModule *module)
|
|||
G_MODULE_EXPORT gboolean
|
||||
gimp_module_register (GTypeModule *module)
|
||||
{
|
||||
color_wheel_register_type (module);
|
||||
colorsel_wheel_register_type (module);
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -120,11 +119,7 @@ colorsel_wheel_init (ColorselWheel *wheel)
|
|||
gtk_box_pack_start (GTK_BOX (wheel), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
g_signal_connect (frame, "size-allocate",
|
||||
G_CALLBACK (colorsel_wheel_size_allocate),
|
||||
wheel);
|
||||
|
||||
wheel->hsv = gtk_hsv_new ();
|
||||
wheel->hsv = gimp_color_wheel_new ();
|
||||
gtk_container_add (GTK_CONTAINER (frame), wheel->hsv);
|
||||
gtk_widget_show (wheel->hsv);
|
||||
|
||||
|
|
@ -140,39 +135,18 @@ colorsel_wheel_set_color (GimpColorSelector *selector,
|
|||
{
|
||||
ColorselWheel *wheel = COLORSEL_WHEEL (selector);
|
||||
|
||||
gtk_hsv_set_color (GTK_HSV (wheel->hsv), hsv->h, hsv->s, hsv->v);
|
||||
gimp_color_wheel_set_color (GIMP_COLOR_WHEEL (wheel->hsv),
|
||||
hsv->h, hsv->s, hsv->v);
|
||||
}
|
||||
|
||||
static void
|
||||
colorsel_wheel_size_allocate (GtkWidget *frame,
|
||||
GtkAllocation *allocation,
|
||||
ColorselWheel *wheel)
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (frame);
|
||||
gint focus_width;
|
||||
gint focus_padding;
|
||||
gint size;
|
||||
|
||||
gtk_widget_style_get (frame,
|
||||
"focus-line-width", &focus_width,
|
||||
"focus-padding", &focus_padding,
|
||||
NULL);
|
||||
|
||||
size = (MIN (allocation->width, allocation->height) -
|
||||
2 * MAX (style->xthickness, style->ythickness) -
|
||||
2 * (focus_width + focus_padding));
|
||||
|
||||
gtk_hsv_set_metrics (GTK_HSV (wheel->hsv), size, size / 10);
|
||||
}
|
||||
|
||||
static void
|
||||
colorsel_wheel_changed (GtkHSV *hsv,
|
||||
colorsel_wheel_changed (GimpColorWheel *hsv,
|
||||
GimpColorSelector *selector)
|
||||
{
|
||||
gtk_hsv_get_color (hsv,
|
||||
&selector->hsv.h,
|
||||
&selector->hsv.s,
|
||||
&selector->hsv.v);
|
||||
gimp_color_wheel_get_color (hsv,
|
||||
&selector->hsv.h,
|
||||
&selector->hsv.s,
|
||||
&selector->hsv.v);
|
||||
gimp_hsv_to_rgb (&selector->hsv, &selector->rgb);
|
||||
|
||||
gimp_color_selector_color_changed (selector);
|
||||
|
|
|
|||
1484
modules/gimpcolorwheel.c
Normal file
1484
modules/gimpcolorwheel.c
Normal file
File diff suppressed because it is too large
Load diff
97
modules/gimpcolorwheel.h
Normal file
97
modules/gimpcolorwheel.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/* HSV color selector for GTK+
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
|
||||
* Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
|
||||
* Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_COLOR_WHEEL_H__
|
||||
#define __GIMP_COLOR_WHEEL_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GIMP_TYPE_COLOR_WHEEL (gimp_color_wheel_get_type ())
|
||||
#define GIMP_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheel))
|
||||
#define GIMP_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass))
|
||||
#define GIMP_IS_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_WHEEL))
|
||||
#define GIMP_IS_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_WHEEL))
|
||||
#define GIMP_COLOR_WHEEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorWheel GimpColorWheel;
|
||||
typedef struct _GimpColorWheelClass GimpColorWheelClass;
|
||||
|
||||
struct _GimpColorWheel
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _GimpColorWheelClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
/* Notification signals */
|
||||
void (* changed) (GimpColorWheel *wheel);
|
||||
|
||||
/* Keybindings */
|
||||
void (* move) (GimpColorWheel *wheel,
|
||||
GtkDirectionType type);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gimp_reserved1) (void);
|
||||
void (*_gimp_reserved2) (void);
|
||||
void (*_gimp_reserved3) (void);
|
||||
void (*_gimp_reserved4) (void);
|
||||
};
|
||||
|
||||
|
||||
void color_wheel_register_type (GTypeModule *module);
|
||||
|
||||
GType gimp_color_wheel_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gimp_color_wheel_new (void);
|
||||
|
||||
void gimp_color_wheel_set_color (GimpColorWheel *wheel,
|
||||
double h,
|
||||
double s,
|
||||
double v);
|
||||
void gimp_color_wheel_get_color (GimpColorWheel *wheel,
|
||||
gdouble *h,
|
||||
gdouble *s,
|
||||
gdouble *v);
|
||||
|
||||
void gimp_color_wheel_set_ring_fraction (GimpColorWheel *wheel,
|
||||
gdouble fraction);
|
||||
gdouble gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel);
|
||||
|
||||
gboolean gimp_color_wheel_is_adjusting (GimpColorWheel *wheel);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_COLOR_WHEEL_H__ */
|
||||
Loading…
Reference in a new issue