mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: Convert more gimpwidgets to derivable type
Continuation of work from 74e7e16e
This commit is contained in:
parent
9b6e6effeb
commit
afce1c1f02
|
@ -50,7 +50,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpBrowserPrivate
|
||||
typedef struct _GimpBrowserPrivate
|
||||
{
|
||||
GtkWidget *left_vbox;
|
||||
|
||||
|
@ -64,9 +64,7 @@ struct _GimpBrowserPrivate
|
|||
|
||||
GtkWidget *right_vbox;
|
||||
GtkWidget *right_widget;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpBrowser *) (obj))->priv)
|
||||
} GimpBrowserPrivate;
|
||||
|
||||
|
||||
static void gimp_browser_dispose (GObject *object);
|
||||
|
@ -119,9 +117,7 @@ gimp_browser_init (GimpBrowser *browser)
|
|||
GtkWidget *scrolled_window;
|
||||
GtkWidget *viewport;
|
||||
|
||||
browser->priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (browser),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
|
@ -198,7 +194,8 @@ gimp_browser_init (GimpBrowser *browser)
|
|||
static void
|
||||
gimp_browser_dispose (GObject *object)
|
||||
{
|
||||
GimpBrowserPrivate *priv = GET_PRIVATE (object);
|
||||
GimpBrowser *browser = GIMP_BROWSER (object);
|
||||
GimpBrowserPrivate *priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
if (priv->search_timeout_id)
|
||||
{
|
||||
|
@ -250,7 +247,7 @@ gimp_browser_add_search_types (GimpBrowser *browser,
|
|||
g_return_if_fail (GIMP_IS_BROWSER (browser));
|
||||
g_return_if_fail (first_type_label != NULL);
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
if (! priv->search_type_combo)
|
||||
{
|
||||
|
@ -304,7 +301,7 @@ gimp_browser_get_left_vbox (GimpBrowser *browser)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_BROWSER (browser), NULL);
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
return priv->left_vbox;
|
||||
}
|
||||
|
@ -324,7 +321,7 @@ gimp_browser_get_right_vbox (GimpBrowser *browser)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_BROWSER (browser), NULL);
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
return priv->right_vbox;
|
||||
}
|
||||
|
@ -347,7 +344,7 @@ gimp_browser_set_search_summary (GimpBrowser *browser,
|
|||
g_return_if_fail (GIMP_IS_BROWSER (browser));
|
||||
g_return_if_fail (summary != NULL);
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (priv->count_label), summary);
|
||||
}
|
||||
|
@ -370,7 +367,7 @@ gimp_browser_set_widget (GimpBrowser *browser,
|
|||
g_return_if_fail (GIMP_IS_BROWSER (browser));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
if (widget == priv->right_widget)
|
||||
return;
|
||||
|
@ -409,7 +406,7 @@ gimp_browser_show_message (GimpBrowser *browser,
|
|||
g_return_if_fail (GIMP_IS_BROWSER (browser));
|
||||
g_return_if_fail (message != NULL);
|
||||
|
||||
priv = GET_PRIVATE (browser);
|
||||
priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
if (GTK_IS_LABEL (priv->right_widget))
|
||||
{
|
||||
|
@ -435,7 +432,7 @@ gimp_browser_show_message (GimpBrowser *browser,
|
|||
static void
|
||||
gimp_browser_queue_search (GimpBrowser *browser)
|
||||
{
|
||||
GimpBrowserPrivate *priv = GET_PRIVATE (browser);
|
||||
GimpBrowserPrivate *priv = gimp_browser_get_instance_private (browser);
|
||||
|
||||
if (priv->search_timeout_id)
|
||||
g_source_remove (priv->search_timeout_id);
|
||||
|
@ -479,7 +476,8 @@ gimp_browser_entry_icon_press (GtkEntry *entry,
|
|||
static gboolean
|
||||
gimp_browser_search_timeout (gpointer data)
|
||||
{
|
||||
GimpBrowserPrivate *priv = GET_PRIVATE (data);
|
||||
GimpBrowser *browser = GIMP_BROWSER (data);
|
||||
GimpBrowserPrivate *priv = gimp_browser_get_instance_private (browser);
|
||||
const gchar *search_string;
|
||||
|
||||
search_string = gtk_entry_get_text (GTK_ENTRY (priv->search_entry));
|
||||
|
|
|
@ -31,23 +31,8 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_BROWSER (gimp_browser_get_type ())
|
||||
#define GIMP_BROWSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BROWSER, GimpBrowser))
|
||||
#define GIMP_BROWSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BROWSER, GimpBrowserClass))
|
||||
#define GIMP_IS_BROWSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BROWSER))
|
||||
#define GIMP_IS_BROWSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BROWSER))
|
||||
#define GIMP_BROWSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BROWSER, GimpBrowserClass))
|
||||
|
||||
|
||||
typedef struct _GimpBrowserPrivate GimpBrowserPrivate;
|
||||
typedef struct _GimpBrowserClass GimpBrowserClass;
|
||||
|
||||
struct _GimpBrowser
|
||||
{
|
||||
GtkPaned parent_instance;
|
||||
|
||||
GimpBrowserPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_BROWSER (gimp_browser_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpBrowser, gimp_browser, GIMP, BROWSER, GtkPaned)
|
||||
|
||||
struct _GimpBrowserClass
|
||||
{
|
||||
|
@ -69,8 +54,6 @@ struct _GimpBrowserClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_browser_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_browser_new (void);
|
||||
|
||||
void gimp_browser_add_search_types (GimpBrowser *browser,
|
||||
|
|
|
@ -59,16 +59,14 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpCellRendererTogglePrivate
|
||||
typedef struct _GimpCellRendererTogglePrivate
|
||||
{
|
||||
gchar *icon_name;
|
||||
gint icon_size;
|
||||
gboolean override_background;
|
||||
|
||||
GdkPixbuf *pixbuf;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpCellRendererToggle *) (obj))->priv)
|
||||
} GimpCellRendererTogglePrivate;
|
||||
|
||||
|
||||
static void gimp_cell_renderer_toggle_finalize (GObject *object);
|
||||
|
@ -166,13 +164,13 @@ gimp_cell_renderer_toggle_class_init (GimpCellRendererToggleClass *klass)
|
|||
static void
|
||||
gimp_cell_renderer_toggle_init (GimpCellRendererToggle *toggle)
|
||||
{
|
||||
toggle->priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_cell_renderer_toggle_finalize (GObject *object)
|
||||
{
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (object);
|
||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
|
||||
GimpCellRendererTogglePrivate *priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
|
||||
g_clear_pointer (&priv->icon_name, g_free);
|
||||
g_clear_object (&priv->pixbuf);
|
||||
|
@ -186,7 +184,8 @@ gimp_cell_renderer_toggle_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (object);
|
||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
|
||||
GimpCellRendererTogglePrivate *priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
|
@ -214,7 +213,8 @@ gimp_cell_renderer_toggle_set_property (GObject *object,
|
|||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (object);
|
||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
|
||||
GimpCellRendererTogglePrivate *priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|||
gint *height)
|
||||
{
|
||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (cell);
|
||||
GimpCellRendererTogglePrivate *priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
GtkBorder border;
|
||||
gint scale_factor;
|
||||
|
@ -330,7 +330,8 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (cell);
|
||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
|
||||
GimpCellRendererTogglePrivate *priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
GdkRectangle toggle_rect;
|
||||
GtkStateFlags state;
|
||||
|
@ -468,7 +469,7 @@ gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
|||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
||||
GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
||||
|
||||
if (gtk_cell_renderer_toggle_get_activatable (toggle))
|
||||
{
|
||||
|
@ -490,7 +491,7 @@ static void
|
|||
gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GimpCellRendererTogglePrivate *priv = GET_PRIVATE (toggle);
|
||||
GimpCellRendererTogglePrivate *priv = gimp_cell_renderer_toggle_get_instance_private (toggle);
|
||||
|
||||
g_clear_object (&priv->pixbuf);
|
||||
|
||||
|
|
|
@ -29,23 +29,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_CELL_RENDERER_TOGGLE (gimp_cell_renderer_toggle_get_type ())
|
||||
#define GIMP_CELL_RENDERER_TOGGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CELL_RENDERER_TOGGLE, GimpCellRendererToggle))
|
||||
#define GIMP_CELL_RENDERER_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CELL_RENDERER_TOGGLE, GimpCellRendererToggleClass))
|
||||
#define GIMP_IS_CELL_RENDERER_TOGGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CELL_RENDERER_TOGGLE))
|
||||
#define GIMP_IS_CELL_RENDERER_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CELL_RENDERER_TOGGLE))
|
||||
#define GIMP_CELL_RENDERER_TOGGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CELL_RENDERER_TOGGLE, GimpCellRendererToggleClass))
|
||||
|
||||
|
||||
typedef struct _GimpCellRendererTogglePrivate GimpCellRendererTogglePrivate;
|
||||
typedef struct _GimpCellRendererToggleClass GimpCellRendererToggleClass;
|
||||
|
||||
struct _GimpCellRendererToggle
|
||||
{
|
||||
GtkCellRendererToggle parent_instance;
|
||||
|
||||
GimpCellRendererTogglePrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_CELL_RENDERER_TOGGLE (gimp_cell_renderer_toggle_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpCellRendererToggle, gimp_cell_renderer_toggle, GIMP, CELL_RENDERER_TOGGLE, GtkCellRendererToggle)
|
||||
|
||||
struct _GimpCellRendererToggleClass
|
||||
{
|
||||
|
@ -67,8 +52,6 @@ struct _GimpCellRendererToggleClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_cell_renderer_toggle_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkCellRenderer * gimp_cell_renderer_toggle_new (const gchar *icon_name);
|
||||
|
||||
void gimp_cell_renderer_toggle_clicked (GimpCellRendererToggle *cell,
|
||||
|
|
|
@ -68,7 +68,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpChainButtonPrivate
|
||||
typedef struct _GimpChainButtonPrivate
|
||||
{
|
||||
GimpChainPosition position;
|
||||
gboolean active;
|
||||
|
@ -77,9 +77,7 @@ struct _GimpChainButtonPrivate
|
|||
GtkWidget *line1;
|
||||
GtkWidget *line2;
|
||||
GtkWidget *image;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpChainButton *) (obj))->priv)
|
||||
} GimpChainButtonPrivate;
|
||||
|
||||
|
||||
static void gimp_chain_button_constructed (GObject *object);
|
||||
|
@ -193,10 +191,8 @@ static void
|
|||
gimp_chain_button_init (GimpChainButton *button)
|
||||
{
|
||||
GimpChainButtonPrivate *private;
|
||||
private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
button->priv = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
private = GET_PRIVATE (button);
|
||||
private->position = GIMP_CHAIN_TOP;
|
||||
private->active = FALSE;
|
||||
private->image = gtk_image_new ();
|
||||
|
@ -215,7 +211,7 @@ static void
|
|||
gimp_chain_button_constructed (GObject *object)
|
||||
{
|
||||
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
GimpChainButtonPrivate *private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
|
@ -255,7 +251,7 @@ gimp_chain_button_set_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
GimpChainButtonPrivate *private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -284,7 +280,7 @@ gimp_chain_button_get_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
GimpChainButtonPrivate *private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -402,7 +398,7 @@ gimp_chain_button_set_active (GimpChainButton *button,
|
|||
|
||||
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button));
|
||||
|
||||
private = GET_PRIVATE (button);
|
||||
private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
if (private->active != active)
|
||||
{
|
||||
|
@ -431,7 +427,7 @@ gimp_chain_button_get_active (GimpChainButton *button)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (button), FALSE);
|
||||
|
||||
private = GET_PRIVATE (button);
|
||||
private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
return private->active;
|
||||
}
|
||||
|
@ -451,7 +447,7 @@ gimp_chain_button_get_button (GimpChainButton *button)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (button), FALSE);
|
||||
|
||||
private = GET_PRIVATE (button);
|
||||
private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
return private->button;
|
||||
}
|
||||
|
@ -463,7 +459,7 @@ static void
|
|||
gimp_chain_button_clicked_callback (GtkWidget *widget,
|
||||
GimpChainButton *button)
|
||||
{
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
GimpChainButtonPrivate *private = gimp_chain_button_get_instance_private (button);
|
||||
|
||||
gimp_chain_button_set_active (button, ! private->active);
|
||||
}
|
||||
|
@ -471,7 +467,7 @@ gimp_chain_button_clicked_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_chain_button_update_image (GimpChainButton *button)
|
||||
{
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
GimpChainButtonPrivate *private = gimp_chain_button_get_instance_private (button);
|
||||
guint i;
|
||||
|
||||
i = ((private->position & GIMP_CHAIN_LEFT) << 1) + (private->active ? 0 : 1);
|
||||
|
|
|
@ -37,23 +37,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_CHAIN_BUTTON (gimp_chain_button_get_type ())
|
||||
#define GIMP_CHAIN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHAIN_BUTTON, GimpChainButton))
|
||||
#define GIMP_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHAIN_BUTTON, GimpChainButtonClass))
|
||||
#define GIMP_IS_CHAIN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHAIN_BUTTON))
|
||||
#define GIMP_IS_CHAIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHAIN_BUTTON))
|
||||
#define GIMP_CHAIN_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CHAIN_BUTTON, GimpChainButtonClass))
|
||||
|
||||
|
||||
typedef struct _GimpChainButtonPrivate GimpChainButtonPrivate;
|
||||
typedef struct _GimpChainButtonClass GimpChainButtonClass;
|
||||
|
||||
struct _GimpChainButton
|
||||
{
|
||||
GtkGrid parent_instance;
|
||||
|
||||
GimpChainButtonPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_CHAIN_BUTTON (gimp_chain_button_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpChainButton, gimp_chain_button, GIMP, CHAIN_BUTTON, GtkGrid)
|
||||
|
||||
struct _GimpChainButtonClass
|
||||
{
|
||||
|
@ -73,8 +58,6 @@ struct _GimpChainButtonClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_chain_button_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_chain_button_new (GimpChainPosition position);
|
||||
|
||||
void gimp_chain_button_set_icon_size (GimpChainButton *button,
|
||||
|
|
|
@ -66,7 +66,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpColorAreaPrivate
|
||||
typedef struct _GimpColorAreaPrivate
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
GimpColorTransform *transform;
|
||||
|
@ -82,9 +82,7 @@ struct _GimpColorAreaPrivate
|
|||
guint needs_render : 1;
|
||||
|
||||
gboolean out_of_gamut;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpColorArea *) (obj))->priv)
|
||||
} GimpColorAreaPrivate;
|
||||
|
||||
|
||||
static void gimp_color_area_dispose (GObject *object);
|
||||
|
@ -236,9 +234,7 @@ gimp_color_area_init (GimpColorArea *area)
|
|||
{
|
||||
GimpColorAreaPrivate *priv;
|
||||
|
||||
area->priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
priv->buf = NULL;
|
||||
priv->width = 0;
|
||||
|
@ -272,7 +268,8 @@ gimp_color_area_dispose (GObject *object)
|
|||
static void
|
||||
gimp_color_area_finalize (GObject *object)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (object);
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (object);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
g_clear_pointer (&priv->buf, g_free);
|
||||
g_clear_object (&priv->color);
|
||||
|
@ -286,7 +283,8 @@ gimp_color_area_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (object);
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (object);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -354,7 +352,8 @@ static void
|
|||
gimp_color_area_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (widget);
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
|
@ -378,7 +377,7 @@ gimp_color_area_draw (GtkWidget *widget,
|
|||
cairo_t *cr)
|
||||
{
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
cairo_surface_t *buffer;
|
||||
gboolean oog = priv->out_of_gamut;
|
||||
|
@ -540,7 +539,7 @@ gimp_color_area_set_color (GimpColorArea *area,
|
|||
g_return_if_fail (GIMP_IS_COLOR_AREA (area));
|
||||
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
if (gimp_color_is_perceptually_identical (priv->color, color))
|
||||
return;
|
||||
|
@ -573,7 +572,7 @@ gimp_color_area_get_color (GimpColorArea *area)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_AREA (area), NULL);
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
return gegl_color_duplicate (priv->color);
|
||||
}
|
||||
|
@ -594,7 +593,7 @@ gimp_color_area_has_alpha (GimpColorArea *area)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_AREA (area), FALSE);
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
return priv->type != GIMP_COLOR_AREA_FLAT;
|
||||
}
|
||||
|
@ -616,7 +615,7 @@ gimp_color_area_set_type (GimpColorArea *area,
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_AREA (area));
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
if (priv->type != type)
|
||||
{
|
||||
|
@ -667,7 +666,7 @@ gimp_color_area_set_draw_border (GimpColorArea *area,
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_AREA (area));
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
draw_border = draw_border ? TRUE : FALSE;
|
||||
|
||||
|
@ -705,7 +704,7 @@ gimp_color_area_set_out_of_gamut (GimpColorArea *area,
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_AREA (area));
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
if (priv->out_of_gamut != out_of_gamut)
|
||||
{
|
||||
priv->out_of_gamut = out_of_gamut;
|
||||
|
@ -731,7 +730,7 @@ gimp_color_area_set_color_config (GimpColorArea *area,
|
|||
g_return_if_fail (GIMP_IS_COLOR_AREA (area));
|
||||
g_return_if_fail (config == NULL || GIMP_IS_COLOR_CONFIG (config));
|
||||
|
||||
priv = GET_PRIVATE (area);
|
||||
priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
if (config != priv->config)
|
||||
{
|
||||
|
@ -767,7 +766,8 @@ gimp_color_area_render_buf (GtkWidget *widget,
|
|||
guint rowstride,
|
||||
GeglColor *color)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (widget);
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
const Babl *render_space;
|
||||
guint x, y;
|
||||
guint check_size = 0;
|
||||
|
@ -902,7 +902,7 @@ gimp_color_area_render_buf (GtkWidget *widget,
|
|||
static void
|
||||
gimp_color_area_render (GimpColorArea *area)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
if (! priv->buf)
|
||||
return;
|
||||
|
@ -920,7 +920,8 @@ static void
|
|||
gimp_color_area_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (widget);
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
GeglColor *color;
|
||||
GtkWidget *window;
|
||||
GtkWidget *frame;
|
||||
|
@ -1064,7 +1065,8 @@ gimp_color_area_drag_data_get (GtkWidget *widget,
|
|||
guint info,
|
||||
guint time)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (widget);
|
||||
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
const Babl *format;
|
||||
const gchar *encoding;
|
||||
gint encoding_length;
|
||||
|
@ -1103,7 +1105,7 @@ gimp_color_area_drag_data_get (GtkWidget *widget,
|
|||
static void
|
||||
gimp_color_area_create_transform (GimpColorArea *area)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
if (priv->config)
|
||||
{
|
||||
|
@ -1128,7 +1130,7 @@ gimp_color_area_create_transform (GimpColorArea *area)
|
|||
static void
|
||||
gimp_color_area_destroy_transform (GimpColorArea *area)
|
||||
{
|
||||
GimpColorAreaPrivate *priv = GET_PRIVATE (area);
|
||||
GimpColorAreaPrivate *priv = gimp_color_area_get_instance_private (area);
|
||||
|
||||
g_clear_object (&priv->transform);
|
||||
|
||||
|
|
|
@ -34,23 +34,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_AREA (gimp_color_area_get_type ())
|
||||
#define GIMP_COLOR_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_AREA, GimpColorArea))
|
||||
#define GIMP_COLOR_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_AREA, GimpColorAreaClass))
|
||||
#define GIMP_IS_COLOR_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_AREA))
|
||||
#define GIMP_IS_COLOR_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_AREA))
|
||||
#define GIMP_COLOR_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_AREA, GimpColorAreaClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorAreaPrivate GimpColorAreaPrivate;
|
||||
typedef struct _GimpColorAreaClass GimpColorAreaClass;
|
||||
|
||||
struct _GimpColorArea
|
||||
{
|
||||
GtkDrawingArea parent_instance;
|
||||
|
||||
GimpColorAreaPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_COLOR_AREA (gimp_color_area_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpColorArea, gimp_color_area, GIMP, COLOR_AREA, GtkDrawingArea)
|
||||
|
||||
struct _GimpColorAreaClass
|
||||
{
|
||||
|
@ -70,8 +55,6 @@ struct _GimpColorAreaClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_color_area_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_color_area_new (GeglColor *color,
|
||||
GimpColorAreaType type,
|
||||
GdkModifierType drag_mask);
|
||||
|
|
|
@ -53,12 +53,10 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpColorDisplayStackPrivate
|
||||
typedef struct _GimpColorDisplayStackPrivate
|
||||
{
|
||||
GList *filters;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpColorDisplayStack *) (obj))->priv)
|
||||
} GimpColorDisplayStackPrivate;
|
||||
|
||||
|
||||
static void gimp_color_display_stack_dispose (GObject *object);
|
||||
|
@ -135,14 +133,13 @@ gimp_color_display_stack_class_init (GimpColorDisplayStackClass *klass)
|
|||
static void
|
||||
gimp_color_display_stack_init (GimpColorDisplayStack *stack)
|
||||
{
|
||||
stack->priv = gimp_color_display_stack_get_instance_private (stack);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_display_stack_dispose (GObject *object)
|
||||
{
|
||||
GimpColorDisplayStack *stack = GIMP_COLOR_DISPLAY_STACK (object);
|
||||
GimpColorDisplayStackPrivate *private = GET_PRIVATE (object);
|
||||
GimpColorDisplayStackPrivate *private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
if (private->filters)
|
||||
{
|
||||
|
@ -201,7 +198,7 @@ gimp_color_display_stack_clone (GimpColorDisplayStack *stack)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
|
||||
|
||||
private = GET_PRIVATE (stack);
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
clone = g_object_new (GIMP_TYPE_COLOR_DISPLAY_STACK, NULL);
|
||||
|
||||
|
@ -248,9 +245,13 @@ gimp_color_display_stack_changed (GimpColorDisplayStack *stack)
|
|||
GList *
|
||||
gimp_color_display_stack_get_filters (GimpColorDisplayStack *stack)
|
||||
{
|
||||
GimpColorDisplayStackPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
|
||||
|
||||
return GET_PRIVATE (stack)->filters;
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
return private->filters;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,7 +272,7 @@ gimp_color_display_stack_add (GimpColorDisplayStack *stack,
|
|||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
private = GET_PRIVATE (stack);
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
g_return_if_fail (g_list_find (private->filters, display) == NULL);
|
||||
|
||||
|
@ -308,7 +309,7 @@ gimp_color_display_stack_remove (GimpColorDisplayStack *stack,
|
|||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
private = GET_PRIVATE (stack);
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
g_return_if_fail (g_list_find (private->filters, display) != NULL);
|
||||
|
||||
|
@ -342,7 +343,7 @@ gimp_color_display_stack_reorder_up (GimpColorDisplayStack *stack,
|
|||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
private = GET_PRIVATE (stack);
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
list = g_list_find (private->filters, display);
|
||||
|
||||
|
@ -379,7 +380,7 @@ gimp_color_display_stack_reorder_down (GimpColorDisplayStack *stack,
|
|||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
||||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY (display));
|
||||
|
||||
private = GET_PRIVATE (stack);
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
list = g_list_find (private->filters, display);
|
||||
|
||||
|
@ -418,7 +419,7 @@ gimp_color_display_stack_convert_buffer (GimpColorDisplayStack *stack,
|
|||
g_return_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack));
|
||||
g_return_if_fail (GEGL_IS_BUFFER (buffer));
|
||||
|
||||
private = GET_PRIVATE (stack);
|
||||
private = gimp_color_display_stack_get_instance_private (stack);
|
||||
|
||||
for (list = private->filters; list; list = g_list_next (list))
|
||||
{
|
||||
|
|
|
@ -31,23 +31,8 @@ G_BEGIN_DECLS
|
|||
/* For information look at the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_DISPLAY_STACK (gimp_color_display_stack_get_type ())
|
||||
#define GIMP_COLOR_DISPLAY_STACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_DISPLAY_STACK, GimpColorDisplayStack))
|
||||
#define GIMP_COLOR_DISPLAY_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_DISPLAY_STACK, GimpColorDisplayStackClass))
|
||||
#define GIMP_IS_COLOR_DISPLAY_STACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_DISPLAY_STACK))
|
||||
#define GIMP_IS_COLOR_DISPLAY_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_DISPLAY_STACK))
|
||||
#define GIMP_COLOR_DISPLAY_STACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_DISPLAY_STACK, GimpColorDisplayStackClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorDisplayStackPrivate GimpColorDisplayStackPrivate;
|
||||
typedef struct _GimpColorDisplayStackClass GimpColorDisplayStackClass;
|
||||
|
||||
struct _GimpColorDisplayStack
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GimpColorDisplayStackPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_COLOR_DISPLAY_STACK (gimp_color_display_stack_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpColorDisplayStack, gimp_color_display_stack, GIMP, COLOR_DISPLAY_STACK, GObject)
|
||||
|
||||
struct _GimpColorDisplayStackClass
|
||||
{
|
||||
|
@ -76,7 +61,6 @@ struct _GimpColorDisplayStackClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_color_display_stack_get_type (void) G_GNUC_CONST;
|
||||
GimpColorDisplayStack * gimp_color_display_stack_new (void);
|
||||
GimpColorDisplayStack * gimp_color_display_stack_clone (GimpColorDisplayStack *stack);
|
||||
|
||||
|
|
|
@ -62,12 +62,10 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpColorHexEntryPrivate
|
||||
typedef struct _GimpColorHexEntryPrivate
|
||||
{
|
||||
GeglColor *color;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpColorHexEntry *) (obj))->priv)
|
||||
} GimpColorHexEntryPrivate;
|
||||
|
||||
|
||||
static void gimp_color_hex_entry_constructed (GObject *object);
|
||||
|
@ -120,9 +118,7 @@ gimp_color_hex_entry_init (GimpColorHexEntry *entry)
|
|||
const gchar **names;
|
||||
gint i;
|
||||
|
||||
entry->priv = gimp_color_hex_entry_get_instance_private (entry);
|
||||
|
||||
private = GET_PRIVATE (entry);
|
||||
private = gimp_color_hex_entry_get_instance_private (entry);
|
||||
|
||||
/* GtkEntry's minimum size is way too large, set a reasonable one
|
||||
* for our use case
|
||||
|
@ -194,7 +190,8 @@ gimp_color_hex_entry_constructed (GObject *object)
|
|||
static void
|
||||
gimp_color_hex_entry_finalize (GObject *object)
|
||||
{
|
||||
GimpColorHexEntryPrivate *private = GET_PRIVATE (object);
|
||||
GimpColorHexEntry *entry = GIMP_COLOR_HEX_ENTRY (object);
|
||||
GimpColorHexEntryPrivate *private = gimp_color_hex_entry_get_instance_private (entry);
|
||||
|
||||
g_object_unref (private->color);
|
||||
|
||||
|
@ -234,7 +231,7 @@ gimp_color_hex_entry_set_color (GimpColorHexEntry *entry,
|
|||
g_return_if_fail (GIMP_IS_COLOR_HEX_ENTRY (entry));
|
||||
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||
|
||||
private = GET_PRIVATE (entry);
|
||||
private = gimp_color_hex_entry_get_instance_private (entry);
|
||||
|
||||
if (! gimp_color_is_perceptually_identical (private->color, color))
|
||||
{
|
||||
|
@ -273,7 +270,7 @@ gimp_color_hex_entry_get_color (GimpColorHexEntry *entry)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_HEX_ENTRY (entry), NULL);
|
||||
|
||||
private = GET_PRIVATE (entry);
|
||||
private = gimp_color_hex_entry_get_instance_private (entry);
|
||||
|
||||
return gegl_color_duplicate (private->color);
|
||||
}
|
||||
|
@ -283,7 +280,7 @@ gimp_color_hex_entry_events (GtkWidget *widget,
|
|||
GdkEvent *event)
|
||||
{
|
||||
GimpColorHexEntry *entry = GIMP_COLOR_HEX_ENTRY (widget);
|
||||
GimpColorHexEntryPrivate *private = GET_PRIVATE (entry);
|
||||
GimpColorHexEntryPrivate *private = gimp_color_hex_entry_get_instance_private (entry);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
|
|
@ -29,23 +29,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_HEX_ENTRY (gimp_color_hex_entry_get_type ())
|
||||
#define GIMP_COLOR_HEX_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_HEX_ENTRY, GimpColorHexEntry))
|
||||
#define GIMP_COLOR_HEX_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_HEX_ENTRY, GimpColorHexEntryClass))
|
||||
#define GIMP_IS_COLOR_HEX_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_HEX_ENTRY))
|
||||
#define GIMP_IS_COLOR_HEX_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_HEX_ENTRY))
|
||||
#define GIMP_COLOR_HEX_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_HEX_AREA, GimpColorHexEntryClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorHexEntryPrivate GimpColorHexEntryPrivate;
|
||||
typedef struct _GimpColorHexEntryClass GimpColorHexEntryClass;
|
||||
|
||||
struct _GimpColorHexEntry
|
||||
{
|
||||
GtkEntry parent_instance;
|
||||
|
||||
GimpColorHexEntryPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_COLOR_HEX_ENTRY (gimp_color_hex_entry_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpColorHexEntry, gimp_color_hex_entry, GIMP, COLOR_HEX_ENTRY, GtkEntry)
|
||||
|
||||
struct _GimpColorHexEntryClass
|
||||
{
|
||||
|
@ -65,8 +50,6 @@ struct _GimpColorHexEntryClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_color_hex_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_color_hex_entry_new (void);
|
||||
|
||||
void gimp_color_hex_entry_set_color (GimpColorHexEntry *entry,
|
||||
|
|
|
@ -80,7 +80,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpColorSelectionPrivate
|
||||
typedef struct _GimpColorSelectionPrivate
|
||||
{
|
||||
gboolean show_alpha;
|
||||
|
||||
|
@ -95,9 +95,7 @@ struct _GimpColorSelectionPrivate
|
|||
|
||||
GtkWidget *new_color;
|
||||
GtkWidget *old_color;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpColorSelection *) (obj))->priv)
|
||||
} GimpColorSelectionPrivate;
|
||||
|
||||
|
||||
static void gimp_color_selection_finalize (GObject *object);
|
||||
|
@ -181,9 +179,7 @@ gimp_color_selection_init (GimpColorSelection *selection)
|
|||
GtkSizeGroup *new_group;
|
||||
GtkSizeGroup *old_group;
|
||||
|
||||
selection->priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
priv = selection->priv;
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
priv->show_alpha = TRUE;
|
||||
|
||||
|
@ -347,7 +343,10 @@ gimp_color_selection_init (GimpColorSelection *selection)
|
|||
static void
|
||||
gimp_color_selection_finalize (GObject *object)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (object);
|
||||
GimpColorSelection *selection = GIMP_COLOR_SELECTION (object);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
g_object_unref (priv->color);
|
||||
|
||||
|
@ -403,7 +402,7 @@ gimp_color_selection_set_show_alpha (GimpColorSelection *selection,
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
|
||||
priv = GET_PRIVATE (selection);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
if (show_alpha != priv->show_alpha)
|
||||
{
|
||||
|
@ -436,9 +435,13 @@ gimp_color_selection_set_show_alpha (GimpColorSelection *selection,
|
|||
gboolean
|
||||
gimp_color_selection_get_show_alpha (GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTION (selection), FALSE);
|
||||
|
||||
return GET_PRIVATE (selection)->show_alpha;
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
return priv->show_alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -458,7 +461,7 @@ gimp_color_selection_set_color (GimpColorSelection *selection,
|
|||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||
|
||||
priv = GET_PRIVATE (selection);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
old_color = priv->color;
|
||||
priv->color = gegl_color_duplicate (color);
|
||||
|
@ -483,9 +486,13 @@ gimp_color_selection_set_color (GimpColorSelection *selection,
|
|||
GeglColor *
|
||||
gimp_color_selection_get_color (GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTION (selection), NULL);
|
||||
|
||||
return gegl_color_duplicate (GET_PRIVATE (selection)->color);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
return gegl_color_duplicate (priv->color);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -504,7 +511,7 @@ gimp_color_selection_set_old_color (GimpColorSelection *selection,
|
|||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||
|
||||
priv = GET_PRIVATE (selection);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (priv->old_color), color);
|
||||
}
|
||||
|
@ -522,7 +529,7 @@ gimp_color_selection_get_old_color (GimpColorSelection *selection)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTION (selection), NULL);
|
||||
|
||||
priv = GET_PRIVATE (selection);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
return gimp_color_area_get_color (GIMP_COLOR_AREA (priv->old_color));
|
||||
}
|
||||
|
@ -541,7 +548,7 @@ gimp_color_selection_reset (GimpColorSelection *selection)
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
|
||||
priv = GET_PRIVATE (selection);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
color = gimp_color_area_get_color (GIMP_COLOR_AREA (priv->old_color));
|
||||
gimp_color_selection_set_color (selection, color);
|
||||
|
@ -574,13 +581,17 @@ gimp_color_selection_color_changed (GimpColorSelection *selection)
|
|||
*/
|
||||
void
|
||||
gimp_color_selection_set_format (GimpColorSelection *selection,
|
||||
const Babl *format)
|
||||
const Babl *format)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
|
||||
gimp_color_notebook_set_format (GIMP_COLOR_NOTEBOOK (selection->priv->notebook),
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
gimp_color_notebook_set_format (GIMP_COLOR_NOTEBOOK (priv->notebook),
|
||||
format);
|
||||
gimp_color_selector_set_format (GIMP_COLOR_SELECTOR (selection->priv->scales),
|
||||
gimp_color_selector_set_format (GIMP_COLOR_SELECTOR (priv->scales),
|
||||
format);
|
||||
|
||||
g_signal_emit (selection, selection_signals[COLOR_CHANGED], 0);
|
||||
|
@ -603,9 +614,13 @@ gimp_color_selection_set_simulation (GimpColorSelection *selection,
|
|||
GimpColorRenderingIntent intent,
|
||||
gboolean bpc)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
|
||||
gimp_color_notebook_set_simulation (GIMP_COLOR_NOTEBOOK (selection->priv->notebook),
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
gimp_color_notebook_set_simulation (GIMP_COLOR_NOTEBOOK (priv->notebook),
|
||||
profile,
|
||||
intent,
|
||||
bpc);
|
||||
|
@ -631,7 +646,7 @@ gimp_color_selection_set_config (GimpColorSelection *selection,
|
|||
g_return_if_fail (GIMP_IS_COLOR_SELECTION (selection));
|
||||
g_return_if_fail (config == NULL || GIMP_IS_COLOR_CONFIG (config));
|
||||
|
||||
priv = GET_PRIVATE (selection);
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
gimp_color_selector_set_config (GIMP_COLOR_SELECTOR (priv->notebook),
|
||||
config);
|
||||
|
@ -654,9 +669,13 @@ gimp_color_selection_set_config (GimpColorSelection *selection,
|
|||
GtkWidget *
|
||||
gimp_color_selection_get_notebook (GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTION (selection), NULL);
|
||||
|
||||
return GET_PRIVATE (selection)->notebook;
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
return priv->notebook;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -671,9 +690,13 @@ gimp_color_selection_get_notebook (GimpColorSelection *selection)
|
|||
GtkWidget *
|
||||
gimp_color_selection_get_right_vbox (GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTION (selection), NULL);
|
||||
|
||||
return GET_PRIVATE (selection)->right_vbox;
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
return priv->right_vbox;
|
||||
}
|
||||
|
||||
|
||||
|
@ -685,11 +708,14 @@ gimp_color_selection_switch_page (GtkWidget *widget,
|
|||
guint page_num,
|
||||
GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorNotebook *notebook = GIMP_COLOR_NOTEBOOK (priv->notebook);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
GimpColorNotebook *notebook;
|
||||
GimpColorSelector *current;
|
||||
gboolean sensitive;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
notebook = GIMP_COLOR_NOTEBOOK (priv->notebook);
|
||||
|
||||
current = gimp_color_notebook_get_current_selector (notebook);
|
||||
|
||||
sensitive = (GIMP_COLOR_SELECTOR_GET_CLASS (current)->set_channel != NULL);
|
||||
|
@ -703,9 +729,11 @@ gimp_color_selection_notebook_changed (GimpColorSelector *selector,
|
|||
GeglColor *color,
|
||||
GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
GeglColor *old_color;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
old_color = priv->color;
|
||||
priv->color = gegl_color_duplicate (color);
|
||||
|
||||
|
@ -724,9 +752,11 @@ gimp_color_selection_scales_changed (GimpColorSelector *selector,
|
|||
GeglColor *color,
|
||||
GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
GeglColor *old_color;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
old_color = priv->color;
|
||||
priv->color = gegl_color_duplicate (color);
|
||||
|
||||
|
@ -753,7 +783,9 @@ static void
|
|||
gimp_color_selection_entry_changed (GimpColorHexEntry *entry,
|
||||
GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
g_object_unref (priv->color);
|
||||
priv->color = gimp_color_hex_entry_get_color (entry);
|
||||
|
@ -768,7 +800,9 @@ gimp_color_selection_channel_changed (GimpColorSelector *selector,
|
|||
GimpColorSelectorChannel channel,
|
||||
GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
priv->channel = channel;
|
||||
|
||||
|
@ -780,7 +814,9 @@ static void
|
|||
gimp_color_selection_new_color_changed (GtkWidget *widget,
|
||||
GimpColorSelection *selection)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
g_object_unref (priv->color);
|
||||
priv->color = gimp_color_area_get_color (GIMP_COLOR_AREA (widget));
|
||||
|
@ -794,7 +830,9 @@ static void
|
|||
gimp_color_selection_update (GimpColorSelection *selection,
|
||||
UpdateType update)
|
||||
{
|
||||
GimpColorSelectionPrivate *priv = GET_PRIVATE (selection);
|
||||
GimpColorSelectionPrivate *priv;
|
||||
|
||||
priv = gimp_color_selection_get_instance_private (selection);
|
||||
|
||||
if (update & UPDATE_NOTEBOOK)
|
||||
{
|
||||
|
|
|
@ -31,23 +31,8 @@ G_BEGIN_DECLS
|
|||
/* For information look at the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_SELECTION (gimp_color_selection_get_type ())
|
||||
#define GIMP_COLOR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_SELECTION, GimpColorSelection))
|
||||
#define GIMP_COLOR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_SELECTION, GimpColorSelectionClass))
|
||||
#define GIMP_IS_COLOR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_SELECTION))
|
||||
#define GIMP_IS_COLOR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_SELECTION))
|
||||
#define GIMP_COLOR_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_SELECTION, GimpColorSelectionClass))
|
||||
|
||||
|
||||
typedef struct _GimpColorSelectionPrivate GimpColorSelectionPrivate;
|
||||
typedef struct _GimpColorSelectionClass GimpColorSelectionClass;
|
||||
|
||||
struct _GimpColorSelection
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
|
||||
GimpColorSelectionPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_COLOR_SELECTION (gimp_color_selection_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpColorSelection, gimp_color_selection, GIMP, COLOR_SELECTION, GtkBox)
|
||||
|
||||
struct _GimpColorSelectionClass
|
||||
{
|
||||
|
@ -67,8 +52,6 @@ struct _GimpColorSelectionClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_color_selection_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_color_selection_new (void);
|
||||
|
||||
void gimp_color_selection_set_show_alpha (GimpColorSelection *selection,
|
||||
|
|
|
@ -59,7 +59,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpColorSelectorPrivate
|
||||
typedef struct _GimpColorSelectorPrivate
|
||||
{
|
||||
gboolean toggles_visible;
|
||||
gboolean toggles_sensitive;
|
||||
|
@ -74,9 +74,7 @@ struct _GimpColorSelectorPrivate
|
|||
GimpColorProfile *simulation_profile;
|
||||
GimpColorRenderingIntent simulation_intent;
|
||||
gboolean simulation_bpc;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpColorSelector *) (obj))->priv)
|
||||
} GimpColorSelectorPrivate;
|
||||
|
||||
|
||||
static void gimp_color_selector_dispose (GObject *object);
|
||||
|
@ -161,9 +159,7 @@ gimp_color_selector_init (GimpColorSelector *selector)
|
|||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
selector->priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
priv->toggles_visible = TRUE;
|
||||
priv->toggles_sensitive = TRUE;
|
||||
|
@ -188,11 +184,14 @@ gimp_color_selector_init (GimpColorSelector *selector)
|
|||
static void
|
||||
gimp_color_selector_dispose (GObject *object)
|
||||
{
|
||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (object);
|
||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (object);
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
gimp_color_selector_set_config (selector, NULL);
|
||||
g_clear_object (&selector->priv->color);
|
||||
g_clear_object (&selector->priv->simulation_profile);
|
||||
g_clear_object (&priv->color);
|
||||
g_clear_object (&priv->simulation_profile);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
@ -247,13 +246,17 @@ void
|
|||
gimp_color_selector_set_toggles_visible (GimpColorSelector *selector,
|
||||
gboolean visible)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
if (selector->priv->toggles_visible != visible)
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if (priv->toggles_visible != visible)
|
||||
{
|
||||
GimpColorSelectorClass *selector_class;
|
||||
|
||||
selector->priv->toggles_visible = visible ? TRUE : FALSE;
|
||||
priv->toggles_visible = visible ? TRUE : FALSE;
|
||||
|
||||
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
|
||||
|
||||
|
@ -275,9 +278,13 @@ gimp_color_selector_set_toggles_visible (GimpColorSelector *selector,
|
|||
gboolean
|
||||
gimp_color_selector_get_toggles_visible (GimpColorSelector *selector)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
|
||||
|
||||
return selector->priv->toggles_visible;
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
return priv->toggles_visible;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,13 +301,17 @@ void
|
|||
gimp_color_selector_set_toggles_sensitive (GimpColorSelector *selector,
|
||||
gboolean sensitive)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
if (selector->priv->toggles_sensitive != sensitive)
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if (priv->toggles_sensitive != sensitive)
|
||||
{
|
||||
GimpColorSelectorClass *selector_class;
|
||||
|
||||
selector->priv->toggles_sensitive = sensitive ? TRUE : FALSE;
|
||||
priv->toggles_sensitive = sensitive ? TRUE : FALSE;
|
||||
|
||||
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
|
||||
|
||||
|
@ -322,9 +333,13 @@ gimp_color_selector_set_toggles_sensitive (GimpColorSelector *selector,
|
|||
gboolean
|
||||
gimp_color_selector_get_toggles_sensitive (GimpColorSelector *selector)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
|
||||
|
||||
return selector->priv->toggles_sensitive;
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
return priv->toggles_sensitive;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,13 +353,17 @@ void
|
|||
gimp_color_selector_set_show_alpha (GimpColorSelector *selector,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
if (show_alpha != selector->priv->show_alpha)
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if (show_alpha != priv->show_alpha)
|
||||
{
|
||||
GimpColorSelectorClass *selector_class;
|
||||
|
||||
selector->priv->show_alpha = show_alpha ? TRUE : FALSE;
|
||||
priv->show_alpha = show_alpha ? TRUE : FALSE;
|
||||
|
||||
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
|
||||
|
||||
|
@ -366,9 +385,13 @@ gimp_color_selector_set_show_alpha (GimpColorSelector *selector,
|
|||
gboolean
|
||||
gimp_color_selector_get_show_alpha (GimpColorSelector *selector)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
|
||||
|
||||
return selector->priv->show_alpha;
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
return priv->show_alpha;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,7 +417,7 @@ gimp_color_selector_set_color (GimpColorSelector *selector,
|
|||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if (! gimp_color_is_perceptually_identical (priv->color, color))
|
||||
{
|
||||
|
@ -433,7 +456,7 @@ gimp_color_selector_get_color (GimpColorSelector *selector)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), NULL);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
return gegl_color_duplicate (priv->color);
|
||||
}
|
||||
|
@ -453,14 +476,18 @@ void
|
|||
gimp_color_selector_set_channel (GimpColorSelector *selector,
|
||||
GimpColorSelectorChannel channel)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
if (channel != selector->priv->channel)
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if (channel != priv->channel)
|
||||
{
|
||||
GimpColorSelectorClass *selector_class;
|
||||
GimpColorSelectorModel model = -1;
|
||||
|
||||
selector->priv->channel = channel;
|
||||
priv->channel = channel;
|
||||
|
||||
switch (channel)
|
||||
{
|
||||
|
@ -534,10 +561,14 @@ gimp_color_selector_set_channel (GimpColorSelector *selector,
|
|||
GimpColorSelectorChannel
|
||||
gimp_color_selector_get_channel (GimpColorSelector *selector)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector),
|
||||
GIMP_COLOR_SELECTOR_RED);
|
||||
|
||||
return selector->priv->channel;
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
return priv->channel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -562,7 +593,7 @@ gimp_color_selector_set_model_visible (GimpColorSelector *selector,
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
visible = visible ? TRUE : FALSE;
|
||||
|
||||
|
@ -598,7 +629,7 @@ gimp_color_selector_get_model_visible (GimpColorSelector *selector,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
return priv->model_visible[model];
|
||||
}
|
||||
|
@ -676,7 +707,7 @@ gimp_color_selector_set_simulation (GimpColorSelector *selector,
|
|||
g_return_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile));
|
||||
|
||||
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if ((profile && ! priv->simulation_profile) ||
|
||||
(! profile && priv->simulation_profile) ||
|
||||
|
@ -703,7 +734,7 @@ gimp_color_selector_get_simulation (GimpColorSelector *selector,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
if (profile)
|
||||
*profile = priv->simulation_profile;
|
||||
|
@ -723,7 +754,7 @@ gimp_color_selector_enable_simulation (GimpColorSelector *selector,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
if (priv->simulation != enabled)
|
||||
{
|
||||
if (! enabled || priv->simulation_profile)
|
||||
|
@ -752,7 +783,7 @@ gimp_color_selector_emit_color_changed (GimpColorSelector *selector)
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
g_signal_emit (selector, selector_signals[COLOR_CHANGED], 0, priv->color);
|
||||
}
|
||||
|
@ -766,10 +797,14 @@ gimp_color_selector_emit_color_changed (GimpColorSelector *selector)
|
|||
static void
|
||||
gimp_color_selector_emit_channel_changed (GimpColorSelector *selector)
|
||||
{
|
||||
GimpColorSelectorPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
g_signal_emit (selector, selector_signals[CHANNEL_CHANGED], 0,
|
||||
selector->priv->channel);
|
||||
priv->channel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -789,7 +824,7 @@ gimp_color_selector_emit_model_visible_changed (GimpColorSelector *selector
|
|||
|
||||
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_color_selector_get_instance_private (selector);
|
||||
|
||||
g_signal_emit (selector, selector_signals[MODEL_VISIBLE_CHANGED], 0,
|
||||
model, priv->model_visible[model]);
|
||||
|
|
|
@ -52,22 +52,8 @@ G_BEGIN_DECLS
|
|||
#define GIMP_COLOR_SELECTOR_BAR_SIZE 15
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_SELECTOR (gimp_color_selector_get_type ())
|
||||
#define GIMP_COLOR_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_SELECTOR, GimpColorSelector))
|
||||
#define GIMP_COLOR_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_SELECTOR, GimpColorSelectorClass))
|
||||
#define GIMP_IS_COLOR_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_SELECTOR))
|
||||
#define GIMP_IS_COLOR_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_SELECTOR))
|
||||
#define GIMP_COLOR_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_SELECTOR, GimpColorSelectorClass))
|
||||
|
||||
typedef struct _GimpColorSelectorPrivate GimpColorSelectorPrivate;
|
||||
typedef struct _GimpColorSelectorClass GimpColorSelectorClass;
|
||||
|
||||
struct _GimpColorSelector
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
|
||||
GimpColorSelectorPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_COLOR_SELECTOR (gimp_color_selector_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpColorSelector, gimp_color_selector, GIMP, COLOR_SELECTOR, GtkBox)
|
||||
|
||||
struct _GimpColorSelectorClass
|
||||
{
|
||||
|
@ -124,7 +110,6 @@ struct _GimpColorSelectorClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_color_selector_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gimp_color_selector_new (GType selector_type,
|
||||
GeglColor *color,
|
||||
GimpColorSelectorChannel channel);
|
||||
|
|
|
@ -70,7 +70,7 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
struct _GimpFileEntryPrivate
|
||||
typedef struct _GimpFileEntryPrivate
|
||||
{
|
||||
GtkWidget *file_exists;
|
||||
GtkWidget *entry;
|
||||
|
@ -81,7 +81,7 @@ struct _GimpFileEntryPrivate
|
|||
gchar *title;
|
||||
gboolean dir_only;
|
||||
gboolean check_valid;
|
||||
};
|
||||
} GimpFileEntryPrivate;
|
||||
|
||||
|
||||
static void gimp_file_entry_dispose (GObject *object);
|
||||
|
@ -133,14 +133,15 @@ gimp_file_entry_class_init (GimpFileEntryClass *klass)
|
|||
static void
|
||||
gimp_file_entry_init (GimpFileEntry *entry)
|
||||
{
|
||||
GtkWidget *image;
|
||||
GtkWidget *button;
|
||||
GimpFileEntryPrivate *priv;
|
||||
GtkWidget *image;
|
||||
GtkWidget *button;
|
||||
|
||||
entry->priv = gimp_file_entry_get_instance_private (entry);
|
||||
entry->priv->title = NULL;
|
||||
entry->priv->file_dialog = NULL;
|
||||
entry->priv->check_valid = FALSE;
|
||||
entry->priv->file_exists = NULL;
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
priv->title = NULL;
|
||||
priv->file_dialog = NULL;
|
||||
priv->check_valid = FALSE;
|
||||
priv->file_exists = NULL;
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (entry),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
|
@ -167,30 +168,30 @@ gimp_file_entry_init (GimpFileEntry *entry)
|
|||
_("Show file location in the file manager"),
|
||||
NULL);
|
||||
|
||||
entry->priv->browse_button = gtk_button_new ();
|
||||
gtk_box_pack_end (GTK_BOX (entry), entry->priv->browse_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (entry->priv->browse_button);
|
||||
priv->browse_button = gtk_button_new ();
|
||||
gtk_box_pack_end (GTK_BOX (entry), priv->browse_button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (priv->browse_button);
|
||||
|
||||
image = gtk_image_new_from_icon_name (GIMP_ICON_DOCUMENT_OPEN,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_container_add (GTK_CONTAINER (entry->priv->browse_button), image);
|
||||
gtk_container_add (GTK_CONTAINER (priv->browse_button), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
g_signal_connect (entry->priv->browse_button, "clicked",
|
||||
g_signal_connect (priv->browse_button, "clicked",
|
||||
G_CALLBACK (gimp_file_entry_browse_clicked),
|
||||
entry);
|
||||
|
||||
entry->priv->entry = gtk_entry_new ();
|
||||
gtk_box_pack_end (GTK_BOX (entry), entry->priv->entry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (entry->priv->entry);
|
||||
priv->entry = gtk_entry_new ();
|
||||
gtk_box_pack_end (GTK_BOX (entry), priv->entry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (priv->entry);
|
||||
|
||||
g_signal_connect (entry->priv->entry, "changed",
|
||||
g_signal_connect (priv->entry, "changed",
|
||||
G_CALLBACK (gimp_file_entry_entry_changed),
|
||||
button);
|
||||
g_signal_connect (entry->priv->entry, "activate",
|
||||
g_signal_connect (priv->entry, "activate",
|
||||
G_CALLBACK (gimp_file_entry_entry_activate),
|
||||
entry);
|
||||
g_signal_connect (entry->priv->entry, "focus-out-event",
|
||||
g_signal_connect (priv->entry, "focus-out-event",
|
||||
G_CALLBACK (gimp_file_entry_entry_focus_out),
|
||||
entry);
|
||||
}
|
||||
|
@ -198,11 +199,14 @@ gimp_file_entry_init (GimpFileEntry *entry)
|
|||
static void
|
||||
gimp_file_entry_dispose (GObject *object)
|
||||
{
|
||||
GimpFileEntry *entry = GIMP_FILE_ENTRY (object);
|
||||
GimpFileEntry *entry = GIMP_FILE_ENTRY (object);
|
||||
GimpFileEntryPrivate *priv;
|
||||
|
||||
g_clear_pointer (&entry->priv->file_dialog, gtk_widget_destroy);
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
g_clear_pointer (&entry->priv->title, g_free);
|
||||
g_clear_pointer (&priv->file_dialog, gtk_widget_destroy);
|
||||
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
@ -225,29 +229,32 @@ gimp_file_entry_new (const gchar *title,
|
|||
gboolean dir_only,
|
||||
gboolean check_valid)
|
||||
{
|
||||
GimpFileEntry *entry;
|
||||
GimpFileEntry *entry;
|
||||
GimpFileEntryPrivate *priv;
|
||||
|
||||
entry = g_object_new (GIMP_TYPE_FILE_ENTRY, NULL);
|
||||
|
||||
entry->priv->title = g_strdup (title);
|
||||
entry->priv->dir_only = dir_only;
|
||||
entry->priv->check_valid = check_valid;
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
gimp_help_set_help_data (entry->priv->browse_button,
|
||||
entry->priv->dir_only ?
|
||||
priv->title = g_strdup (title);
|
||||
priv->dir_only = dir_only;
|
||||
priv->check_valid = check_valid;
|
||||
|
||||
gimp_help_set_help_data (priv->browse_button,
|
||||
priv->dir_only ?
|
||||
_("Open a file selector to browse your folders") :
|
||||
_("Open a file selector to browse your files"),
|
||||
NULL);
|
||||
|
||||
if (check_valid)
|
||||
{
|
||||
entry->priv->file_exists = gtk_image_new_from_icon_name ("gtk-no",
|
||||
priv->file_exists = gtk_image_new_from_icon_name ("gtk-no",
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_box_pack_start (GTK_BOX (entry), entry->priv->file_exists, FALSE, FALSE, 0);
|
||||
gtk_widget_show (entry->priv->file_exists);
|
||||
gtk_box_pack_start (GTK_BOX (entry), priv->file_exists, FALSE, FALSE, 0);
|
||||
gtk_widget_show (priv->file_exists);
|
||||
|
||||
gimp_help_set_help_data (entry->priv->file_exists,
|
||||
entry->priv->dir_only ?
|
||||
gimp_help_set_help_data (priv->file_exists,
|
||||
priv->dir_only ?
|
||||
_("Indicates whether or not the folder exists") :
|
||||
_("Indicates whether or not the file exists"),
|
||||
NULL);
|
||||
|
@ -269,12 +276,15 @@ gimp_file_entry_new (const gchar *title,
|
|||
gchar *
|
||||
gimp_file_entry_get_filename (GimpFileEntry *entry)
|
||||
{
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
GimpFileEntryPrivate *priv;
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_FILE_ENTRY (entry), NULL);
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (entry->priv->entry), 0, -1);
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
|
||||
|
||||
filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
|
||||
|
@ -296,21 +306,24 @@ void
|
|||
gimp_file_entry_set_filename (GimpFileEntry *entry,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *utf8;
|
||||
GimpFileEntryPrivate *priv;
|
||||
gchar *utf8;
|
||||
|
||||
g_return_if_fail (GIMP_IS_FILE_ENTRY (entry));
|
||||
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
if (filename)
|
||||
utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
|
||||
else
|
||||
utf8 = g_strdup ("");
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (entry->priv->entry), utf8);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->entry), utf8);
|
||||
g_free (utf8);
|
||||
|
||||
/* update everything
|
||||
*/
|
||||
gimp_file_entry_entry_activate (entry->priv->entry, entry);
|
||||
gimp_file_entry_entry_activate (priv->entry, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,7 +337,11 @@ gimp_file_entry_set_filename (GimpFileEntry *entry,
|
|||
GtkWidget *
|
||||
gimp_file_entry_get_entry (GimpFileEntry *entry)
|
||||
{
|
||||
return entry->priv->entry;
|
||||
GimpFileEntryPrivate *priv;
|
||||
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
return priv->entry;
|
||||
}
|
||||
|
||||
/* Private Functions */
|
||||
|
@ -345,9 +362,12 @@ static void
|
|||
gimp_file_entry_entry_activate (GtkWidget *widget,
|
||||
GimpFileEntry *entry)
|
||||
{
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
gint len;
|
||||
GimpFileEntryPrivate *priv;
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
gint len;
|
||||
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
/* filenames still need more sanity checking
|
||||
* (erase double G_DIR_SEPARATORS, ...)
|
||||
|
@ -361,16 +381,16 @@ gimp_file_entry_entry_activate (GtkWidget *widget,
|
|||
|
||||
filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (entry->priv->entry,
|
||||
g_signal_handlers_block_by_func (priv->entry,
|
||||
gimp_file_entry_entry_activate,
|
||||
entry);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry->priv->entry), utf8);
|
||||
g_signal_handlers_unblock_by_func (entry->priv->entry,
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->entry), utf8);
|
||||
g_signal_handlers_unblock_by_func (priv->entry,
|
||||
gimp_file_entry_entry_activate,
|
||||
entry);
|
||||
|
||||
if (entry->priv->file_dialog)
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (entry->priv->file_dialog),
|
||||
if (priv->file_dialog)
|
||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (priv->file_dialog),
|
||||
filename);
|
||||
|
||||
g_free (filename);
|
||||
|
@ -378,7 +398,7 @@ gimp_file_entry_entry_activate (GtkWidget *widget,
|
|||
|
||||
gimp_file_entry_check_filename (entry);
|
||||
|
||||
gtk_editable_set_position (GTK_EDITABLE (entry->priv->entry), -1);
|
||||
gtk_editable_set_position (GTK_EDITABLE (priv->entry), -1);
|
||||
|
||||
g_signal_emit (entry, gimp_file_entry_signals[FILENAME_CHANGED], 0);
|
||||
}
|
||||
|
@ -415,11 +435,14 @@ static void
|
|||
gimp_file_entry_file_manager_clicked (GtkWidget *widget,
|
||||
GimpFileEntry *entry)
|
||||
{
|
||||
gchar *utf8;
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
GimpFileEntryPrivate *priv;
|
||||
gchar *utf8;
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (entry->priv->entry), 0, -1);
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
|
||||
file = g_file_parse_name (utf8);
|
||||
g_free (utf8);
|
||||
|
||||
|
@ -437,29 +460,32 @@ static void
|
|||
gimp_file_entry_browse_clicked (GtkWidget *widget,
|
||||
GimpFileEntry *entry)
|
||||
{
|
||||
GtkFileChooser *chooser;
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
GimpFileEntryPrivate *priv;
|
||||
GtkFileChooser *chooser;
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (entry->priv->entry), 0, -1);
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
|
||||
filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
g_free (utf8);
|
||||
|
||||
if (! entry->priv->file_dialog)
|
||||
if (! priv->file_dialog)
|
||||
{
|
||||
const gchar *title = entry->priv->title;
|
||||
const gchar *title = priv->title;
|
||||
|
||||
if (! title)
|
||||
{
|
||||
if (entry->priv->dir_only)
|
||||
if (priv->dir_only)
|
||||
title = _("Select Folder");
|
||||
else
|
||||
title = _("Select File");
|
||||
}
|
||||
|
||||
entry->priv->file_dialog =
|
||||
priv->file_dialog =
|
||||
gtk_file_chooser_dialog_new (title, NULL,
|
||||
entry->priv->dir_only ?
|
||||
priv->dir_only ?
|
||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER :
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
|
||||
|
@ -468,12 +494,12 @@ gimp_file_entry_browse_clicked (GtkWidget *widget,
|
|||
|
||||
NULL);
|
||||
|
||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (entry->priv->file_dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
gimp_dialog_set_alternative_button_order (GTK_DIALOG (priv->file_dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
|
||||
chooser = GTK_FILE_CHOOSER (entry->priv->file_dialog);
|
||||
chooser = GTK_FILE_CHOOSER (priv->file_dialog);
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
|
||||
gtk_window_set_role (GTK_WINDOW (chooser),
|
||||
|
@ -492,7 +518,7 @@ gimp_file_entry_browse_clicked (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
chooser = GTK_FILE_CHOOSER (entry->priv->file_dialog);
|
||||
chooser = GTK_FILE_CHOOSER (priv->file_dialog);
|
||||
}
|
||||
|
||||
gtk_file_chooser_set_filename (chooser, filename);
|
||||
|
@ -506,25 +532,28 @@ gimp_file_entry_browse_clicked (GtkWidget *widget,
|
|||
static void
|
||||
gimp_file_entry_check_filename (GimpFileEntry *entry)
|
||||
{
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
gboolean exists;
|
||||
GimpFileEntryPrivate *priv;
|
||||
gchar *utf8;
|
||||
gchar *filename;
|
||||
gboolean exists;
|
||||
|
||||
if (! entry->priv->check_valid || ! entry->priv->file_exists)
|
||||
priv = gimp_file_entry_get_instance_private (entry);
|
||||
|
||||
if (! priv->check_valid || ! priv->file_exists)
|
||||
return;
|
||||
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (entry->priv->entry), 0, -1);
|
||||
utf8 = gtk_editable_get_chars (GTK_EDITABLE (priv->entry), 0, -1);
|
||||
filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
g_free (utf8);
|
||||
|
||||
if (entry->priv->dir_only)
|
||||
if (priv->dir_only)
|
||||
exists = g_file_test (filename, G_FILE_TEST_IS_DIR);
|
||||
else
|
||||
exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (entry->priv->file_exists),
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (priv->file_exists),
|
||||
exists ? "gtk-yes" : "gtk-no",
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
|
|
|
@ -33,23 +33,8 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_FILE_ENTRY (gimp_file_entry_get_type ())
|
||||
#define GIMP_FILE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FILE_ENTRY, GimpFileEntry))
|
||||
#define GIMP_FILE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FILE_ENTRY, GimpFileEntryClass))
|
||||
#define GIMP_IS_FILE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_FILE_ENTRY))
|
||||
#define GIMP_IS_FILE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FILE_ENTRY))
|
||||
#define GIMP_FILE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FILE_ENTRY, GimpFileEntryClass))
|
||||
|
||||
|
||||
typedef struct _GimpFileEntryPrivate GimpFileEntryPrivate;
|
||||
typedef struct _GimpFileEntryClass GimpFileEntryClass;
|
||||
|
||||
struct _GimpFileEntry
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
|
||||
GimpFileEntryPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_FILE_ENTRY (gimp_file_entry_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpFileEntry, gimp_file_entry, GIMP, FILE_ENTRY, GtkBox)
|
||||
|
||||
struct _GimpFileEntryClass
|
||||
{
|
||||
|
@ -68,9 +53,6 @@ struct _GimpFileEntryClass
|
|||
void (* _gimp_reserved8) (void);
|
||||
};
|
||||
|
||||
|
||||
GType gimp_file_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_file_entry_new (const gchar *title,
|
||||
const gchar *filename,
|
||||
gboolean dir_only,
|
||||
|
|
|
@ -51,7 +51,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpMemsizeEntryPrivate
|
||||
typedef struct _GimpMemsizeEntryPrivate
|
||||
{
|
||||
guint64 value;
|
||||
guint64 lower;
|
||||
|
@ -63,9 +63,7 @@ struct _GimpMemsizeEntryPrivate
|
|||
GtkAdjustment *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *menu;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpMemsizeEntry *) (obj))->priv)
|
||||
} GimpMemsizeEntryPrivate;
|
||||
|
||||
|
||||
static void gimp_memsize_entry_adj_callback (GtkAdjustment *adj,
|
||||
|
@ -100,8 +98,6 @@ gimp_memsize_entry_class_init (GimpMemsizeEntryClass *klass)
|
|||
static void
|
||||
gimp_memsize_entry_init (GimpMemsizeEntry *entry)
|
||||
{
|
||||
entry->priv = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (entry),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
|
@ -112,9 +108,11 @@ static void
|
|||
gimp_memsize_entry_adj_callback (GtkAdjustment *adj,
|
||||
GimpMemsizeEntry *entry)
|
||||
{
|
||||
GimpMemsizeEntryPrivate *private = GET_PRIVATE (entry);
|
||||
GimpMemsizeEntryPrivate *private;
|
||||
guint64 size = gtk_adjustment_get_value (adj);
|
||||
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
if (gimp_memsize_entry_get_rounded_value (entry, private->value) != size)
|
||||
/* Do not allow losing accuracy if the converted/displayed value
|
||||
* stays the same.
|
||||
|
@ -128,9 +126,11 @@ static void
|
|||
gimp_memsize_entry_unit_callback (GtkWidget *widget,
|
||||
GimpMemsizeEntry *entry)
|
||||
{
|
||||
GimpMemsizeEntryPrivate *private = GET_PRIVATE (entry);
|
||||
GimpMemsizeEntryPrivate *private;
|
||||
guint shift;
|
||||
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), (gint *) &shift);
|
||||
|
||||
#if _MSC_VER < 1300
|
||||
|
@ -168,9 +168,11 @@ static guint64
|
|||
gimp_memsize_entry_get_rounded_value (GimpMemsizeEntry *entry,
|
||||
guint64 value)
|
||||
{
|
||||
GimpMemsizeEntryPrivate *private = GET_PRIVATE (entry);
|
||||
GimpMemsizeEntryPrivate *private;
|
||||
guint64 converted;
|
||||
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
#if _MSC_VER < 1300
|
||||
# define CAST (gint64)
|
||||
#else
|
||||
|
@ -216,7 +218,7 @@ gimp_memsize_entry_new (guint64 value,
|
|||
|
||||
entry = g_object_new (GIMP_TYPE_MEMSIZE_ENTRY, NULL);
|
||||
|
||||
private = GET_PRIVATE (entry);
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
for (shift = 30; shift > 10; shift -= 10)
|
||||
{
|
||||
|
@ -283,7 +285,7 @@ gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_MEMSIZE_ENTRY (entry));
|
||||
|
||||
private = GET_PRIVATE (entry);
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (value >= private->lower && value <= private->upper);
|
||||
|
||||
|
@ -314,9 +316,13 @@ gimp_memsize_entry_set_value (GimpMemsizeEntry *entry,
|
|||
guint64
|
||||
gimp_memsize_entry_get_value (GimpMemsizeEntry *entry)
|
||||
{
|
||||
GimpMemsizeEntryPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_MEMSIZE_ENTRY (entry), 0);
|
||||
|
||||
return GET_PRIVATE (entry)->value;
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
return private->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,7 +336,11 @@ gimp_memsize_entry_get_value (GimpMemsizeEntry *entry)
|
|||
GtkWidget *
|
||||
gimp_memsize_entry_get_spinbutton (GimpMemsizeEntry *entry)
|
||||
{
|
||||
GimpMemsizeEntryPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_MEMSIZE_ENTRY (entry), 0);
|
||||
|
||||
return GET_PRIVATE (entry)->spinbutton;
|
||||
private = gimp_memsize_entry_get_instance_private (entry);
|
||||
|
||||
return private->spinbutton;
|
||||
}
|
||||
|
|
|
@ -29,23 +29,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_MEMSIZE_ENTRY (gimp_memsize_entry_get_type ())
|
||||
#define GIMP_MEMSIZE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MEMSIZE_ENTRY, GimpMemsizeEntry))
|
||||
#define GIMP_MEMSIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MEMSIZE_ENTRY, GimpMemsizeEntryClass))
|
||||
#define GIMP_IS_MEMSIZE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MEMSIZE_ENTRY))
|
||||
#define GIMP_IS_MEMSIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MEMSIZE_ENTRY))
|
||||
#define GIMP_MEMSIZE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MEMSIZE_ENTRY, GimpMemsizeEntryClass))
|
||||
|
||||
|
||||
typedef struct _GimpMemsizeEntryPrivate GimpMemsizeEntryPrivate;
|
||||
typedef struct _GimpMemsizeEntryClass GimpMemsizeEntryClass;
|
||||
|
||||
struct _GimpMemsizeEntry
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
|
||||
GimpMemsizeEntryPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_MEMSIZE_ENTRY (gimp_memsize_entry_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpMemsizeEntry, gimp_memsize_entry, GIMP, MEMSIZE_ENTRY, GtkBox)
|
||||
|
||||
struct _GimpMemsizeEntryClass
|
||||
{
|
||||
|
@ -65,8 +50,6 @@ struct _GimpMemsizeEntryClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_memsize_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_memsize_entry_new (guint64 value,
|
||||
guint64 lower,
|
||||
guint64 upper);
|
||||
|
|
|
@ -82,7 +82,7 @@ typedef enum
|
|||
} ParseResult;
|
||||
|
||||
|
||||
struct _GimpNumberPairEntryPrivate
|
||||
typedef struct _GimpNumberPairEntryPrivate
|
||||
{
|
||||
/* The current number pair displayed in the widget. */
|
||||
gdouble left_number;
|
||||
|
@ -119,9 +119,7 @@ struct _GimpNumberPairEntryPrivate
|
|||
/* What range of values considered valid. */
|
||||
gdouble min_valid_value;
|
||||
gdouble max_valid_value;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpNumberPairEntry *) (obj))->priv)
|
||||
} GimpNumberPairEntryPrivate;
|
||||
|
||||
|
||||
static void gimp_number_pair_entry_finalize (GObject *entry);
|
||||
|
@ -304,9 +302,7 @@ gimp_number_pair_entry_init (GimpNumberPairEntry *entry)
|
|||
{
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
|
||||
entry->priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
priv->left_number = 1.0;
|
||||
priv->right_number = 1.0;
|
||||
|
@ -344,7 +340,10 @@ gimp_number_pair_entry_init (GimpNumberPairEntry *entry)
|
|||
static void
|
||||
gimp_number_pair_entry_finalize (GObject *object)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (object);
|
||||
GimpNumberPairEntry *entry = GIMP_NUMBER_PAIR_ENTRY (object);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
g_clear_pointer (&priv->separators, g_free);
|
||||
priv->num_separators = 0;
|
||||
|
@ -492,7 +491,7 @@ gimp_number_pair_entry_get_ratio (GimpNumberPairEntry *entry)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry), 1.0);
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
return priv->left_number / priv->right_number;
|
||||
}
|
||||
|
@ -524,7 +523,7 @@ gimp_number_pair_entry_set_values (GimpNumberPairEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry));
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
/* Store current values */
|
||||
|
||||
|
@ -602,7 +601,7 @@ gimp_number_pair_entry_get_values (GimpNumberPairEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry));
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (left != NULL)
|
||||
*left = priv->left_number;
|
||||
|
@ -634,7 +633,7 @@ gimp_number_pair_entry_set_default_text (GimpNumberPairEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry));
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
g_free (priv->default_text);
|
||||
priv->default_text = g_strdup (string);
|
||||
|
@ -660,7 +659,7 @@ gimp_number_pair_entry_get_default_text (GimpNumberPairEntry *entry)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry), NULL);
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
return priv->default_text;
|
||||
}
|
||||
|
@ -687,7 +686,7 @@ gimp_number_pair_entry_set_aspect (GimpNumberPairEntry *entry,
|
|||
if (gimp_number_pair_entry_get_aspect (entry) == aspect)
|
||||
return;
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
switch (aspect)
|
||||
{
|
||||
|
@ -723,7 +722,7 @@ gimp_number_pair_entry_get_aspect (GimpNumberPairEntry *entry)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry), GIMP_ASPECT_SQUARE);
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (priv->left_number > priv->right_number)
|
||||
{
|
||||
|
@ -743,9 +742,11 @@ static void
|
|||
gimp_number_pair_entry_modify_font (GimpNumberPairEntry *entry,
|
||||
gboolean italic)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
GtkStyleContext *style;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (priv->font_italic == italic)
|
||||
return;
|
||||
|
||||
|
@ -784,7 +785,7 @@ gimp_number_pair_entry_set_user_override (GimpNumberPairEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry));
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
priv->user_override = user_override;
|
||||
|
||||
|
@ -815,7 +816,7 @@ gimp_number_pair_entry_get_user_override (GimpNumberPairEntry *entry)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry), FALSE);
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
return priv->user_override;
|
||||
}
|
||||
|
@ -839,9 +840,10 @@ gimp_number_pair_entry_events (GtkWidget *widget,
|
|||
GdkEvent *event)
|
||||
{
|
||||
GimpNumberPairEntry *entry = GIMP_NUMBER_PAIR_ENTRY (widget);
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
gboolean force_user_override;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
force_user_override = FALSE;
|
||||
|
||||
switch (event->type)
|
||||
|
@ -929,10 +931,12 @@ gimp_number_pair_entry_strdup_number_pair_string (GimpNumberPairEntry *entry,
|
|||
gdouble left_number,
|
||||
gdouble right_number)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
gchar sep[8];
|
||||
gint len;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (priv->num_separators > 0)
|
||||
len = g_unichar_to_utf8 (priv->separators[0], sep);
|
||||
else
|
||||
|
@ -946,9 +950,11 @@ gimp_number_pair_entry_strdup_number_pair_string (GimpNumberPairEntry *entry,
|
|||
static void
|
||||
gimp_number_pair_entry_update_text (GimpNumberPairEntry *entry)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
gchar *buffer;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (! priv->user_override &&
|
||||
priv->default_text != NULL)
|
||||
{
|
||||
|
@ -980,7 +986,9 @@ static gboolean
|
|||
gimp_number_pair_entry_valid_separator (GimpNumberPairEntry *entry,
|
||||
gunichar candidate)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (priv->num_separators > 0)
|
||||
{
|
||||
|
@ -1004,12 +1012,13 @@ gimp_number_pair_entry_parse_text (GimpNumberPairEntry *entry,
|
|||
gdouble *left_value,
|
||||
gdouble *right_value)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
|
||||
gdouble new_left_number;
|
||||
gdouble new_right_number;
|
||||
gboolean simplify = FALSE;
|
||||
gchar *end;
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
gdouble new_left_number;
|
||||
gdouble new_right_number;
|
||||
gboolean simplify = FALSE;
|
||||
gchar *end;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
/* skip over whitespace */
|
||||
while (g_unichar_isspace (g_utf8_get_char (text)))
|
||||
|
@ -1092,7 +1101,9 @@ gimp_number_pair_entry_set_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
GimpNumberPairEntry *entry = GIMP_NUMBER_PAIR_ENTRY (object);
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -1161,7 +1172,9 @@ gimp_number_pair_entry_get_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
GimpNumberPairEntry *entry = GIMP_NUMBER_PAIR_ENTRY (object);
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -1227,7 +1240,7 @@ gimp_number_pair_entry_set_default_values (GimpNumberPairEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry));
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
priv->default_left_number = left;
|
||||
priv->default_right_number = right;
|
||||
|
@ -1257,7 +1270,7 @@ gimp_number_pair_entry_get_default_values (GimpNumberPairEntry *entry,
|
|||
|
||||
g_return_if_fail (GIMP_IS_NUMBER_PAIR_ENTRY (entry));
|
||||
|
||||
priv = GET_PRIVATE (entry);
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
if (left != NULL)
|
||||
*left = priv->default_left_number;
|
||||
|
@ -1271,7 +1284,9 @@ gimp_number_pair_entry_numbers_in_range (GimpNumberPairEntry *entry,
|
|||
gdouble left_number,
|
||||
gdouble right_number)
|
||||
{
|
||||
GimpNumberPairEntryPrivate *priv = GET_PRIVATE (entry);
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
|
||||
priv = gimp_number_pair_entry_get_instance_private (entry);
|
||||
|
||||
return (left_number >= priv->min_valid_value &&
|
||||
left_number <= priv->max_valid_value &&
|
||||
|
|
|
@ -31,24 +31,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_NUMBER_PAIR_ENTRY (gimp_number_pair_entry_get_type ())
|
||||
#define GIMP_NUMBER_PAIR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_NUMBER_PAIR_ENTRY, GimpNumberPairEntry))
|
||||
#define GIMP_NUMBER_PAIR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_NUMBER_PAIR_ENTRY, GimpNumberPairEntryClass))
|
||||
#define GIMP_IS_NUMBER_PAIR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_NUMBER_PAIR_ENTRY))
|
||||
#define GIMP_IS_NUMBER_PAIR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_NUMBER_PAIR_ENTRY))
|
||||
#define GIMP_NUMBER_PAIR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_NUMBER_PAIR_AREA, GimpNumberPairEntryClass))
|
||||
|
||||
|
||||
typedef struct _GimpNumberPairEntryPrivate GimpNumberPairEntryPrivate;
|
||||
typedef struct _GimpNumberPairEntryClass GimpNumberPairEntryClass;
|
||||
|
||||
|
||||
struct _GimpNumberPairEntry
|
||||
{
|
||||
GtkEntry parent_instance;
|
||||
|
||||
GimpNumberPairEntryPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_NUMBER_PAIR_ENTRY (gimp_number_pair_entry_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpNumberPairEntry, gimp_number_pair_entry, GIMP, NUMBER_PAIR_ENTRY, GtkEntry)
|
||||
|
||||
struct _GimpNumberPairEntryClass
|
||||
{
|
||||
|
@ -69,7 +53,6 @@ struct _GimpNumberPairEntryClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_number_pair_entry_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gimp_number_pair_entry_new (const gchar *separators,
|
||||
gboolean allow_simplification,
|
||||
gdouble min_valid_value,
|
||||
|
|
|
@ -48,7 +48,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpOffsetAreaPrivate
|
||||
typedef struct _GimpOffsetAreaPrivate
|
||||
{
|
||||
gint orig_width;
|
||||
gint orig_height;
|
||||
|
@ -58,9 +58,7 @@ struct _GimpOffsetAreaPrivate
|
|||
gint offset_y;
|
||||
gdouble display_ratio_x;
|
||||
gdouble display_ratio_y;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpOffsetArea *) (obj))->priv)
|
||||
} GimpOffsetAreaPrivate;
|
||||
|
||||
|
||||
static void gimp_offset_area_resize (GimpOffsetArea *area);
|
||||
|
@ -109,9 +107,7 @@ gimp_offset_area_init (GimpOffsetArea *area)
|
|||
{
|
||||
GimpOffsetAreaPrivate *private;
|
||||
|
||||
area->priv = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
private = GET_PRIVATE (area);
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
private->display_ratio_x = 1.0;
|
||||
private->display_ratio_y = 1.0;
|
||||
|
@ -145,7 +141,7 @@ gimp_offset_area_new (gint orig_width,
|
|||
|
||||
area = g_object_new (GIMP_TYPE_OFFSET_AREA, NULL);
|
||||
|
||||
private = GET_PRIVATE (area);
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
private->orig_width = private->width = orig_width;
|
||||
private->orig_height = private->height = orig_height;
|
||||
|
@ -199,7 +195,7 @@ gimp_offset_area_set_size (GimpOffsetArea *area,
|
|||
g_return_if_fail (GIMP_IS_OFFSET_AREA (area));
|
||||
g_return_if_fail (width > 0 && height > 0);
|
||||
|
||||
private = GET_PRIVATE (area);
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
if (private->width != width || private->height != height)
|
||||
{
|
||||
|
@ -255,7 +251,7 @@ gimp_offset_area_set_offsets (GimpOffsetArea *area,
|
|||
|
||||
g_return_if_fail (GIMP_IS_OFFSET_AREA (area));
|
||||
|
||||
private = GET_PRIVATE (area);
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
if (private->offset_x != offset_x || private->offset_y != offset_y)
|
||||
{
|
||||
|
@ -280,11 +276,13 @@ gimp_offset_area_set_offsets (GimpOffsetArea *area,
|
|||
static void
|
||||
gimp_offset_area_resize (GimpOffsetArea *area)
|
||||
{
|
||||
GimpOffsetAreaPrivate *private = GET_PRIVATE (area);
|
||||
GimpOffsetAreaPrivate *private;
|
||||
gint width;
|
||||
gint height;
|
||||
gdouble ratio;
|
||||
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
if (private->orig_width == 0 || private->orig_height == 0)
|
||||
return;
|
||||
|
||||
|
@ -312,11 +310,13 @@ gimp_offset_area_size_allocate (GtkWidget *widget,
|
|||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
|
||||
GimpOffsetAreaPrivate *private = GET_PRIVATE (area);
|
||||
GimpOffsetAreaPrivate *private;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
private->display_ratio_x = ((gdouble) allocation->width /
|
||||
((private->orig_width <= private->width) ?
|
||||
private->width :
|
||||
|
@ -384,10 +384,12 @@ gimp_offset_area_event (GtkWidget *widget,
|
|||
static gint start_y = 0;
|
||||
|
||||
GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
|
||||
GimpOffsetAreaPrivate *private = GET_PRIVATE (area);
|
||||
GimpOffsetAreaPrivate *private;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
if (private->orig_width == 0 || private->orig_height == 0)
|
||||
return FALSE;
|
||||
|
||||
|
@ -442,13 +444,15 @@ gimp_offset_area_draw (GtkWidget *widget,
|
|||
cairo_t *cr)
|
||||
{
|
||||
GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
|
||||
GimpOffsetAreaPrivate *private = GET_PRIVATE (area);
|
||||
GimpOffsetAreaPrivate *private;
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
GtkAllocation allocation;
|
||||
GdkPixbuf *pixbuf;
|
||||
gint w, h;
|
||||
gint x, y;
|
||||
|
||||
private = gimp_offset_area_get_instance_private (area);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
x = (private->display_ratio_x *
|
||||
|
|
|
@ -31,23 +31,8 @@ G_BEGIN_DECLS
|
|||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
#define GIMP_TYPE_OFFSET_AREA (gimp_offset_area_get_type ())
|
||||
#define GIMP_OFFSET_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OFFSET_AREA, GimpOffsetArea))
|
||||
#define GIMP_OFFSET_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OFFSET_AREA, GimpOffsetAreaClass))
|
||||
#define GIMP_IS_OFFSET_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OFFSET_AREA))
|
||||
#define GIMP_IS_OFFSET_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OFFSET_AREA))
|
||||
#define GIMP_OFFSET_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OFFSET_AREA, GimpOffsetAreaClass))
|
||||
|
||||
|
||||
typedef struct _GimpOffsetAreaPrivate GimpOffsetAreaPrivate;
|
||||
typedef struct _GimpOffsetAreaClass GimpOffsetAreaClass;
|
||||
|
||||
struct _GimpOffsetArea
|
||||
{
|
||||
GtkDrawingArea parent_instance;
|
||||
|
||||
GimpOffsetAreaPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_OFFSET_AREA (gimp_offset_area_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpOffsetArea, gimp_offset_area, GIMP, OFFSET_AREA, GtkDrawingArea)
|
||||
|
||||
struct _GimpOffsetAreaClass
|
||||
{
|
||||
|
@ -69,8 +54,6 @@ struct _GimpOffsetAreaClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_offset_area_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_offset_area_new (gint orig_width,
|
||||
gint orig_height);
|
||||
void gimp_offset_area_set_pixbuf (GimpOffsetArea *offset_area,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#/* LIBGIMP - The GIMP Library
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimppageselector.c
|
||||
|
@ -72,7 +72,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpPageSelectorPrivate
|
||||
typedef struct _GimpPageSelectorPrivate
|
||||
{
|
||||
gint n_pages;
|
||||
GimpPageSelectorTarget target;
|
||||
|
@ -84,9 +84,7 @@ struct _GimpPageSelectorPrivate
|
|||
GtkWidget *range_entry;
|
||||
|
||||
GdkPixbuf *default_thumbnail;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpPageSelector *) (obj))->priv)
|
||||
} GimpPageSelectorPrivate;
|
||||
|
||||
|
||||
static void gimp_page_selector_finalize (GObject *object);
|
||||
|
@ -216,9 +214,7 @@ gimp_page_selector_init (GimpPageSelector *selector)
|
|||
GtkWidget *combo;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
selector->priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
priv->n_pages = 0;
|
||||
priv->target = GIMP_PAGE_SELECTOR_TARGET_LAYERS;
|
||||
|
@ -348,7 +344,10 @@ gimp_page_selector_init (GimpPageSelector *selector)
|
|||
static void
|
||||
gimp_page_selector_finalize (GObject *object)
|
||||
{
|
||||
GimpPageSelectorPrivate *priv = GET_PRIVATE (object);
|
||||
GimpPageSelector *selector = GIMP_PAGE_SELECTOR (object);
|
||||
GimpPageSelectorPrivate *priv;
|
||||
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_clear_object (&priv->default_thumbnail);
|
||||
|
||||
|
@ -361,7 +360,10 @@ gimp_page_selector_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpPageSelectorPrivate *priv = GET_PRIVATE (object);
|
||||
GimpPageSelector *selector = GIMP_PAGE_SELECTOR (object);
|
||||
GimpPageSelectorPrivate *priv;
|
||||
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -384,7 +386,9 @@ gimp_page_selector_set_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
GimpPageSelector *selector = GIMP_PAGE_SELECTOR (object);
|
||||
GimpPageSelectorPrivate *priv = GET_PRIVATE (object);
|
||||
GimpPageSelectorPrivate *priv;
|
||||
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -436,7 +440,7 @@ gimp_page_selector_set_n_pages (GimpPageSelector *selector,
|
|||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
g_return_if_fail (n_pages >= 0);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
if (n_pages != priv->n_pages)
|
||||
{
|
||||
|
@ -493,7 +497,7 @@ gimp_page_selector_get_n_pages (GimpPageSelector *selector)
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_PAGE_SELECTOR (selector), 0);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
return priv->n_pages;
|
||||
}
|
||||
|
@ -514,7 +518,7 @@ gimp_page_selector_set_target (GimpPageSelector *selector,
|
|||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
g_return_if_fail (target <= GIMP_PAGE_SELECTOR_TARGET_IMAGES);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
if (target != priv->target)
|
||||
{
|
||||
|
@ -540,7 +544,7 @@ gimp_page_selector_get_target (GimpPageSelector *selector)
|
|||
g_return_val_if_fail (GIMP_IS_PAGE_SELECTOR (selector),
|
||||
GIMP_PAGE_SELECTOR_TARGET_LAYERS);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
return priv->target;
|
||||
}
|
||||
|
@ -567,7 +571,7 @@ gimp_page_selector_set_page_thumbnail (GimpPageSelector *selector,
|
|||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
g_return_if_fail (thumbnail == NULL || GDK_IS_PIXBUF (thumbnail));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_if_fail (page_no >= 0 && page_no < priv->n_pages);
|
||||
|
||||
|
@ -611,7 +615,7 @@ gimp_page_selector_get_page_thumbnail (GimpPageSelector *selector,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_PAGE_SELECTOR (selector), NULL);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_val_if_fail (page_no >= 0 && page_no < priv->n_pages, NULL);
|
||||
|
||||
|
@ -651,7 +655,7 @@ gimp_page_selector_set_page_label (GimpPageSelector *selector,
|
|||
|
||||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_if_fail (page_no >= 0 && page_no < priv->n_pages);
|
||||
|
||||
|
@ -693,7 +697,7 @@ gimp_page_selector_get_page_label (GimpPageSelector *selector,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_PAGE_SELECTOR (selector), NULL);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_val_if_fail (page_no >= 0 && page_no < priv->n_pages, NULL);
|
||||
|
||||
|
@ -728,7 +732,7 @@ gimp_page_selector_select_all (GimpPageSelector *selector)
|
|||
|
||||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
gtk_icon_view_select_all (GTK_ICON_VIEW (priv->view));
|
||||
}
|
||||
|
@ -748,7 +752,7 @@ gimp_page_selector_unselect_all (GimpPageSelector *selector)
|
|||
|
||||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
gtk_icon_view_unselect_all (GTK_ICON_VIEW (priv->view));
|
||||
}
|
||||
|
@ -772,7 +776,7 @@ gimp_page_selector_select_page (GimpPageSelector *selector,
|
|||
|
||||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_if_fail (page_no >= 0 && page_no < priv->n_pages);
|
||||
|
||||
|
@ -804,7 +808,7 @@ gimp_page_selector_unselect_page (GimpPageSelector *selector,
|
|||
|
||||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_if_fail (page_no >= 0 && page_no < priv->n_pages);
|
||||
|
||||
|
@ -837,7 +841,7 @@ gimp_page_selector_page_is_selected (GimpPageSelector *selector,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_PAGE_SELECTOR (selector), FALSE);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
g_return_val_if_fail (page_no >= 0 && page_no < priv->n_pages, FALSE);
|
||||
|
||||
|
@ -876,7 +880,7 @@ gimp_page_selector_get_selected_pages (GimpPageSelector *selector,
|
|||
g_return_val_if_fail (GIMP_IS_PAGE_SELECTOR (selector), NULL);
|
||||
g_return_val_if_fail (n_selected_pages != NULL, NULL);
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
selected = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (priv->view));
|
||||
|
||||
|
@ -922,7 +926,7 @@ gimp_page_selector_select_range (GimpPageSelector *selector,
|
|||
|
||||
g_return_if_fail (GIMP_IS_PAGE_SELECTOR (selector));
|
||||
|
||||
priv = GET_PRIVATE (selector);
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
if (! range)
|
||||
range = "";
|
||||
|
@ -1064,11 +1068,13 @@ static void
|
|||
gimp_page_selector_selection_changed (GtkIconView *icon_view,
|
||||
GimpPageSelector *selector)
|
||||
{
|
||||
GimpPageSelectorPrivate *priv = GET_PRIVATE (selector);
|
||||
GimpPageSelectorPrivate *priv;
|
||||
GList *selected;
|
||||
gint n_selected;
|
||||
gchar *range;
|
||||
|
||||
priv = gimp_page_selector_get_instance_private (selector);
|
||||
|
||||
selected = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (priv->view));
|
||||
n_selected = g_list_length (selected);
|
||||
g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
|
||||
|
|
|
@ -28,23 +28,8 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GIMP_TYPE_PAGE_SELECTOR (gimp_page_selector_get_type ())
|
||||
#define GIMP_PAGE_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAGE_SELECTOR, GimpPageSelector))
|
||||
#define GIMP_PAGE_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAGE_SELECTOR, GimpPageSelectorClass))
|
||||
#define GIMP_IS_PAGE_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PAGE_SELECTOR))
|
||||
#define GIMP_IS_PAGE_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAGE_SELECTOR))
|
||||
#define GIMP_PAGE_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PAGE_SELECTOR, GimpPageSelectorClass))
|
||||
|
||||
|
||||
typedef struct _GimpPageSelectorPrivate GimpPageSelectorPrivate;
|
||||
typedef struct _GimpPageSelectorClass GimpPageSelectorClass;
|
||||
|
||||
struct _GimpPageSelector
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
|
||||
GimpPageSelectorPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_PAGE_SELECTOR (gimp_page_selector_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpPageSelector, gimp_page_selector, GIMP, PAGE_SELECTOR, GtkBox)
|
||||
|
||||
struct _GimpPageSelectorClass
|
||||
{
|
||||
|
@ -65,8 +50,6 @@ struct _GimpPageSelectorClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_page_selector_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_page_selector_new (void);
|
||||
|
||||
void gimp_page_selector_set_n_pages (GimpPageSelector *selector,
|
||||
|
|
|
@ -78,7 +78,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpSizeEntryField
|
||||
typedef struct _GimpSizeEntryField
|
||||
{
|
||||
GimpSizeEntry *gse;
|
||||
|
||||
|
@ -100,10 +100,10 @@ struct _GimpSizeEntryField
|
|||
gint refval_digits;
|
||||
|
||||
gint stop_recursion;
|
||||
};
|
||||
} GimpSizeEntryField;
|
||||
|
||||
|
||||
struct _GimpSizeEntryPrivate
|
||||
typedef struct _GimpSizeEntryPrivate
|
||||
{
|
||||
GSList *fields;
|
||||
gint number_of_fields;
|
||||
|
@ -115,9 +115,7 @@ struct _GimpSizeEntryPrivate
|
|||
|
||||
gboolean show_refval;
|
||||
GimpSizeEntryUpdatePolicy update_policy;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpSizeEntry *) (obj))->priv)
|
||||
} GimpSizeEntryPrivate;
|
||||
|
||||
|
||||
static void gimp_size_entry_finalize (GObject *object);
|
||||
|
@ -192,9 +190,7 @@ gimp_size_entry_init (GimpSizeEntry *gse)
|
|||
{
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
gse->priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
priv = gse->priv;
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
priv->unit = GIMP_UNIT_PIXEL;
|
||||
priv->menu_show_pixels = TRUE;
|
||||
|
@ -206,7 +202,10 @@ gimp_size_entry_init (GimpSizeEntry *gse)
|
|||
static void
|
||||
gimp_size_entry_finalize (GObject *object)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv = GET_PRIVATE (object);
|
||||
GimpSizeEntry *gse = GIMP_SIZE_ENTRY (object);
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
if (priv->fields)
|
||||
{
|
||||
|
@ -288,7 +287,7 @@ gimp_size_entry_new (gint number_of_fields,
|
|||
|
||||
gse = g_object_new (GIMP_TYPE_SIZE_ENTRY, NULL);
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
priv->number_of_fields = number_of_fields;
|
||||
priv->unit = unit;
|
||||
|
@ -464,7 +463,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
|
|||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
g_return_if_fail (GTK_IS_SPIN_BUTTON (value_spinbutton));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
if (priv->show_refval)
|
||||
{
|
||||
|
@ -526,17 +525,25 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
|
|||
GimpSizeEntryUpdatePolicy
|
||||
gimp_size_entry_get_update_policy (GimpSizeEntry *gse)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
|
||||
return GET_PRIVATE (gse)->update_policy;
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
return priv->update_policy;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_size_entry_get_n_fields (GimpSizeEntry *gse)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), 0);
|
||||
|
||||
return GET_PRIVATE (gse)->number_of_fields;
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
return priv->number_of_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -548,9 +555,13 @@ gimp_size_entry_get_n_fields (GimpSizeEntry *gse)
|
|||
GtkWidget *
|
||||
gimp_size_entry_get_unit_combo (GimpSizeEntry *gse)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), NULL);
|
||||
|
||||
return GET_PRIVATE (gse)->unit_combo;
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
return priv->unit_combo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -644,7 +655,7 @@ gimp_size_entry_set_resolution (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
|
||||
|
@ -692,7 +703,7 @@ gimp_size_entry_set_size (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
g_return_if_fail (lower <= upper);
|
||||
|
@ -735,7 +746,7 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
g_return_if_fail (lower <= upper);
|
||||
|
@ -834,7 +845,7 @@ gimp_size_entry_get_value (GimpSizeEntry *gse,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), 0);
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_val_if_fail ((field >= 0) && (field < priv->number_of_fields), 0);
|
||||
|
||||
|
@ -847,7 +858,7 @@ static void
|
|||
gimp_size_entry_update_value (GimpSizeEntryField *gsef,
|
||||
gdouble value)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv = gsef->gse->priv;
|
||||
GimpSizeEntryPrivate *priv = gimp_size_entry_get_instance_private (gsef->gse);
|
||||
|
||||
if (gsef->stop_recursion > 1)
|
||||
return;
|
||||
|
@ -922,7 +933,7 @@ gimp_size_entry_set_value (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
|
||||
|
@ -975,7 +986,7 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
g_return_if_fail (lower <= upper);
|
||||
|
@ -1078,7 +1089,7 @@ gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
g_return_if_fail ((digits >= 0) && (digits <= 6));
|
||||
|
@ -1120,7 +1131,7 @@ gimp_size_entry_get_refval (GimpSizeEntry *gse,
|
|||
/* return 1.0 to avoid division by zero */
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), 1.0);
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_val_if_fail ((field >= 0) && (field < priv->number_of_fields), 1.0);
|
||||
|
||||
|
@ -1133,7 +1144,7 @@ static void
|
|||
gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
|
||||
gdouble refval)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv = GET_PRIVATE (gsef->gse);
|
||||
GimpSizeEntryPrivate *priv = gimp_size_entry_get_instance_private (gsef->gse);
|
||||
|
||||
if (gsef->stop_recursion > 1)
|
||||
return;
|
||||
|
@ -1202,7 +1213,7 @@ gimp_size_entry_set_refval (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail ((field >= 0) && (field < priv->number_of_fields));
|
||||
|
||||
|
@ -1244,16 +1255,20 @@ gimp_size_entry_refval_callback (GtkAdjustment *adjustment,
|
|||
GimpUnit
|
||||
gimp_size_entry_get_unit (GimpSizeEntry *gse)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), GIMP_UNIT_INCH);
|
||||
|
||||
return GET_PRIVATE (gse)->unit;
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
return priv->unit;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_size_entry_update_unit (GimpSizeEntry *gse,
|
||||
GimpUnit unit)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv = GET_PRIVATE (gse);
|
||||
GimpSizeEntryPrivate *priv = gimp_size_entry_get_instance_private (gse);
|
||||
GimpSizeEntryField *gsef;
|
||||
gint i;
|
||||
gint digits;
|
||||
|
@ -1316,7 +1331,7 @@ gimp_size_entry_set_unit (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_if_fail (priv->menu_show_pixels || (unit != GIMP_UNIT_PIXEL));
|
||||
g_return_if_fail (priv->menu_show_percent || (unit != GIMP_UNIT_PERCENT));
|
||||
|
@ -1329,11 +1344,14 @@ static void
|
|||
gimp_size_entry_unit_callback (GtkWidget *widget,
|
||||
GimpSizeEntry *gse)
|
||||
{
|
||||
GimpUnit new_unit;
|
||||
GimpSizeEntryPrivate *priv;
|
||||
GimpUnit new_unit;
|
||||
|
||||
new_unit = gimp_unit_combo_box_get_active (GIMP_UNIT_COMBO_BOX (widget));
|
||||
|
||||
if (GET_PRIVATE (gse)->unit != new_unit)
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
if (priv->unit != new_unit)
|
||||
gimp_size_entry_update_unit (gse, new_unit);
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1381,7 @@ gimp_size_entry_eevl_input_callback (GtkSpinButton *spinner,
|
|||
gpointer *data)
|
||||
{
|
||||
GimpSizeEntryField *gsef = (GimpSizeEntryField *) data;
|
||||
GimpSizeEntryPrivate *priv = GET_PRIVATE (gsef->gse);
|
||||
GimpSizeEntryPrivate *priv;
|
||||
GimpEevlOptions options = GIMP_EEVL_OPTIONS_INIT;
|
||||
gboolean success = FALSE;
|
||||
const gchar *error_pos = NULL;
|
||||
|
@ -1373,6 +1391,8 @@ gimp_size_entry_eevl_input_callback (GtkSpinButton *spinner,
|
|||
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spinner), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gsef->gse), FALSE);
|
||||
|
||||
priv = gimp_size_entry_get_instance_private (gsef->gse);
|
||||
|
||||
options.unit_resolver_proc = gimp_size_entry_eevl_unit_resolver;
|
||||
options.data = data;
|
||||
|
||||
|
@ -1495,7 +1515,7 @@ gimp_size_entry_eevl_unit_resolver (const gchar *identifier,
|
|||
gpointer data)
|
||||
{
|
||||
GimpSizeEntryField *gsef = (GimpSizeEntryField *) data;
|
||||
GimpSizeEntryPrivate *priv = GET_PRIVATE (gsef->gse);
|
||||
GimpSizeEntryPrivate *priv;
|
||||
gboolean resolve_default_unit = (identifier == NULL);
|
||||
GimpUnit unit;
|
||||
|
||||
|
@ -1504,6 +1524,8 @@ gimp_size_entry_eevl_unit_resolver (const gchar *identifier,
|
|||
g_return_val_if_fail (offset != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gsef->gse), FALSE);
|
||||
|
||||
priv = gimp_size_entry_get_instance_private (gsef->gse);
|
||||
|
||||
*offset = 0.0;
|
||||
|
||||
for (unit = 0;
|
||||
|
@ -1578,9 +1600,13 @@ void
|
|||
gimp_size_entry_show_unit_menu (GimpSizeEntry *gse,
|
||||
gboolean show)
|
||||
{
|
||||
GimpSizeEntryPrivate *priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
gtk_widget_set_visible (GET_PRIVATE (gse)->unit_combo, show);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
gtk_widget_set_visible (priv->unit_combo, show);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1596,11 +1622,13 @@ void
|
|||
gimp_size_entry_set_pixel_digits (GimpSizeEntry *gse,
|
||||
gint digits)
|
||||
{
|
||||
GimpUnitComboBox *combo;
|
||||
GimpSizeEntryPrivate *priv;
|
||||
GimpUnitComboBox *combo;
|
||||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
combo = GIMP_UNIT_COMBO_BOX (GET_PRIVATE (gse)->unit_combo);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
combo = GIMP_UNIT_COMBO_BOX (priv->unit_combo);
|
||||
|
||||
g_object_set_data (G_OBJECT (gse), "gimp-pixel-digits",
|
||||
GINT_TO_POINTER (digits));
|
||||
|
@ -1623,7 +1651,7 @@ gimp_size_entry_grab_focus (GimpSizeEntry *gse)
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
gsef = priv->fields->data;
|
||||
if (gsef)
|
||||
|
@ -1650,7 +1678,7 @@ gimp_size_entry_set_activates_default (GimpSizeEntry *gse,
|
|||
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
for (list = priv->fields; list; list = g_slist_next (list))
|
||||
{
|
||||
|
@ -1686,7 +1714,7 @@ gimp_size_entry_get_help_widget (GimpSizeEntry *gse,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), NULL);
|
||||
|
||||
priv = GET_PRIVATE (gse);
|
||||
priv = gimp_size_entry_get_instance_private (gse);
|
||||
|
||||
g_return_val_if_fail ((field >= 0) && (field < priv->number_of_fields), NULL);
|
||||
|
||||
|
|
|
@ -32,25 +32,8 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_SIZE_ENTRY (gimp_size_entry_get_type ())
|
||||
#define GIMP_SIZE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntry))
|
||||
#define GIMP_SIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntryClass))
|
||||
#define GIMP_IS_SIZE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_SIZE_ENTRY))
|
||||
#define GIMP_IS_SIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SIZE_ENTRY))
|
||||
#define GIMP_SIZE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntryClass))
|
||||
|
||||
|
||||
typedef struct _GimpSizeEntryPrivate GimpSizeEntryPrivate;
|
||||
typedef struct _GimpSizeEntryClass GimpSizeEntryClass;
|
||||
|
||||
typedef struct _GimpSizeEntryField GimpSizeEntryField;
|
||||
|
||||
struct _GimpSizeEntry
|
||||
{
|
||||
GtkGrid parent_instance;
|
||||
|
||||
GimpSizeEntryPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_SIZE_ENTRY (gimp_size_entry_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpSizeEntry, gimp_size_entry, GIMP, SIZE_ENTRY, GtkGrid)
|
||||
|
||||
struct _GimpSizeEntryClass
|
||||
{
|
||||
|
@ -74,8 +57,6 @@ struct _GimpSizeEntryClass
|
|||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
GType gimp_size_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_size_entry_new (gint number_of_fields,
|
||||
GimpUnit unit,
|
||||
const gchar *unit_format,
|
||||
|
|
|
@ -63,14 +63,12 @@ enum
|
|||
};
|
||||
|
||||
|
||||
struct _GimpZoomModelPrivate
|
||||
typedef struct _GimpZoomModelPrivate
|
||||
{
|
||||
gdouble value;
|
||||
gdouble minimum;
|
||||
gdouble maximum;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpZoomModel *) (obj))->priv)
|
||||
} GimpZoomModelPrivate;
|
||||
|
||||
|
||||
static void gimp_zoom_model_set_property (GObject *object,
|
||||
|
@ -181,9 +179,7 @@ gimp_zoom_model_init (GimpZoomModel *model)
|
|||
{
|
||||
GimpZoomModelPrivate *priv;
|
||||
|
||||
model->priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
priv = GET_PRIVATE (model);
|
||||
priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
priv->value = 1.0;
|
||||
priv->minimum = ZOOM_MIN;
|
||||
|
@ -196,7 +192,8 @@ gimp_zoom_model_set_property (GObject *object,
|
|||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpZoomModelPrivate *priv = GET_PRIVATE (object);
|
||||
GimpZoomModel *model = GIMP_ZOOM_MODEL (object);
|
||||
GimpZoomModelPrivate *priv = gimp_zoom_model_get_instance_private (model);
|
||||
gdouble previous_value;
|
||||
|
||||
previous_value = priv->value;
|
||||
|
@ -249,7 +246,8 @@ gimp_zoom_model_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpZoomModelPrivate *priv = GET_PRIVATE (object);
|
||||
GimpZoomModel *model = GIMP_ZOOM_MODEL (object);
|
||||
GimpZoomModelPrivate *priv = gimp_zoom_model_get_instance_private (model);
|
||||
gchar *tmp;
|
||||
|
||||
switch (property_id)
|
||||
|
@ -296,7 +294,7 @@ gimp_zoom_model_get_property (GObject *object,
|
|||
static void
|
||||
gimp_zoom_model_zoom_in (GimpZoomModel *model)
|
||||
{
|
||||
GimpZoomModelPrivate *priv = GET_PRIVATE (model);
|
||||
GimpZoomModelPrivate *priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
if (priv->value < priv->maximum)
|
||||
gimp_zoom_model_zoom (model, GIMP_ZOOM_IN, 0.0);
|
||||
|
@ -305,7 +303,7 @@ gimp_zoom_model_zoom_in (GimpZoomModel *model)
|
|||
static void
|
||||
gimp_zoom_model_zoom_out (GimpZoomModel *model)
|
||||
{
|
||||
GimpZoomModelPrivate *priv = GET_PRIVATE (model);
|
||||
GimpZoomModelPrivate *priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
if (priv->value > priv->minimum)
|
||||
gimp_zoom_model_zoom (model, GIMP_ZOOM_OUT, 0.0);
|
||||
|
@ -394,9 +392,13 @@ gimp_zoom_model_zoom (GimpZoomModel *model,
|
|||
gdouble
|
||||
gimp_zoom_model_get_factor (GimpZoomModel *model)
|
||||
{
|
||||
GimpZoomModelPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_ZOOM_MODEL (model), 1.0);
|
||||
|
||||
return GET_PRIVATE (model)->value;
|
||||
priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
return priv->value;
|
||||
}
|
||||
|
||||
|
||||
|
@ -517,7 +519,7 @@ zoom_in_button_callback (GimpZoomModel *model,
|
|||
gdouble new,
|
||||
GtkWidget *button)
|
||||
{
|
||||
GimpZoomModelPrivate *priv = GET_PRIVATE (model);
|
||||
GimpZoomModelPrivate *priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
gtk_widget_set_sensitive (button, priv->value != priv->maximum);
|
||||
}
|
||||
|
@ -528,7 +530,7 @@ zoom_out_button_callback (GimpZoomModel *model,
|
|||
gdouble new,
|
||||
GtkWidget *button)
|
||||
{
|
||||
GimpZoomModelPrivate *priv = GET_PRIVATE (model);
|
||||
GimpZoomModelPrivate *priv = gimp_zoom_model_get_instance_private (model);
|
||||
|
||||
gtk_widget_set_sensitive (button, priv->value != priv->minimum);
|
||||
}
|
||||
|
|
|
@ -29,23 +29,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GIMP_TYPE_ZOOM_MODEL (gimp_zoom_model_get_type ())
|
||||
#define GIMP_ZOOM_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ZOOM_MODEL, GimpZoomModel))
|
||||
#define GIMP_ZOOM_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ZOOM_MODEL, GimpZoomModelClass))
|
||||
#define GIMP_IS_ZOOM_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ZOOM_MODEL))
|
||||
#define GIMP_IS_ZOOM_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ZOOM_MODEL))
|
||||
#define GIMP_ZOOM_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ZOOM_MODEL, GimpZoomModel))
|
||||
|
||||
|
||||
typedef struct _GimpZoomModelPrivate GimpZoomModelPrivate;
|
||||
typedef struct _GimpZoomModelClass GimpZoomModelClass;
|
||||
|
||||
struct _GimpZoomModel
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GimpZoomModelPrivate *priv;
|
||||
};
|
||||
#define GIMP_TYPE_ZOOM_MODEL (gimp_zoom_model_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (GimpZoomModel, gimp_zoom_model, GIMP, ZOOM_MODEL, GtkGrid)
|
||||
|
||||
struct _GimpZoomModelClass
|
||||
{
|
||||
|
@ -67,8 +52,6 @@ struct _GimpZoomModelClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_zoom_model_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpZoomModel * gimp_zoom_model_new (void);
|
||||
void gimp_zoom_model_set_range (GimpZoomModel *model,
|
||||
gdouble min,
|
||||
|
|
Loading…
Reference in New Issue