/* AdjustTool.c generated by valac 0.56.19, the Vala compiler
 * generated from AdjustTool.vala, do not modify */

/*
* Copyright (c) 2009-2013 Yorba Foundation
*               2016-2018 elementary LLC.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Felipe Escoto <felescoto95@hotmail.com>
*/

#include "io.elementary.photos.h"
#include <glib-object.h>
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <float.h>
#include <math.h>
#include <cairo-gobject.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

#define EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC ((guint) 100)
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW (editing_tools_adjust_tool_adjust_tool_window_get_type ())
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW, EditingToolsAdjustToolAdjustToolWindow))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW, EditingToolsAdjustToolAdjustToolWindowClass))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_TOOL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_TOOL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW, EditingToolsAdjustToolAdjustToolWindowClass))

typedef struct _EditingToolsAdjustToolAdjustToolWindow EditingToolsAdjustToolAdjustToolWindow;
typedef struct _EditingToolsAdjustToolAdjustToolWindowClass EditingToolsAdjustToolAdjustToolWindowClass;
enum  {
	EDITING_TOOLS_ADJUST_TOOL_0_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_NUM_PROPERTIES
};
static GParamSpec* editing_tools_adjust_tool_properties[EDITING_TOOLS_ADJUST_TOOL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _pixel_transformer_unref0(var) ((var == NULL) ? NULL : (var = (pixel_transformer_unref (var), NULL)))
#define _pixel_transformation_bundle_unref0(var) ((var == NULL) ? NULL : (var = (pixel_transformation_bundle_unref (var), NULL)))
#define _one_shot_scheduler_unref0(var) ((var == NULL) ? NULL : (var = (one_shot_scheduler_unref (var), NULL)))
typedef struct _EditingToolsAdjustToolAdjustToolWindowPrivate EditingToolsAdjustToolAdjustToolWindowPrivate;
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))
#define _pixel_transformation_unref0(var) ((var == NULL) ? NULL : (var = (pixel_transformation_unref (var), NULL)))

#define EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND (editing_tools_adjust_tool_adjust_tool_command_get_type ())
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommand))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommandClass))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_TOOL_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_TOOL_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommandClass))

typedef struct _EditingToolsAdjustToolAdjustToolCommand EditingToolsAdjustToolAdjustToolCommand;
typedef struct _EditingToolsAdjustToolAdjustToolCommandClass EditingToolsAdjustToolAdjustToolCommandClass;

#define EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND (editing_tools_adjust_tool_adjust_reset_command_get_type ())
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommand))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommandClass))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_RESET_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_RESET_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommandClass))

typedef struct _EditingToolsAdjustToolAdjustResetCommand EditingToolsAdjustToolAdjustResetCommand;
typedef struct _EditingToolsAdjustToolAdjustResetCommandClass EditingToolsAdjustToolAdjustResetCommandClass;
#define _command_manager_unref0(var) ((var == NULL) ? NULL : (var = (command_manager_unref (var), NULL)))

#define EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND (editing_tools_adjust_tool_slider_adjustment_command_get_type ())
#define EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommand))
#define EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommandClass))
#define EDITING_TOOLS_ADJUST_TOOL_IS_SLIDER_ADJUSTMENT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_IS_SLIDER_ADJUSTMENT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommandClass))

typedef struct _EditingToolsAdjustToolSliderAdjustmentCommand EditingToolsAdjustToolSliderAdjustmentCommand;
typedef struct _EditingToolsAdjustToolSliderAdjustmentCommandClass EditingToolsAdjustToolSliderAdjustmentCommandClass;

#define EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND (editing_tools_adjust_tool_adjust_enhance_command_get_type ())
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommand))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommandClass))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_ENHANCE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_ENHANCE_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND))
#define EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommandClass))

typedef struct _EditingToolsAdjustToolAdjustEnhanceCommand EditingToolsAdjustToolAdjustEnhanceCommand;
typedef struct _EditingToolsAdjustToolAdjustEnhanceCommandClass EditingToolsAdjustToolAdjustEnhanceCommandClass;
enum  {
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_WINDOW_0_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_WINDOW_NUM_PROPERTIES
};
static GParamSpec* editing_tools_adjust_tool_adjust_tool_window_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_WINDOW_NUM_PROPERTIES];
typedef struct _EditingToolsAdjustToolAdjustToolCommandPrivate EditingToolsAdjustToolAdjustToolCommandPrivate;
enum  {
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_0_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_OWNER_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_NUM_PROPERTIES
};
static GParamSpec* editing_tools_adjust_tool_adjust_tool_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_NUM_PROPERTIES];
typedef struct _EditingToolsAdjustToolAdjustResetCommandPrivate EditingToolsAdjustToolAdjustResetCommandPrivate;
enum  {
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_0_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_ORIGINAL_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_NUM_PROPERTIES
};
static GParamSpec* editing_tools_adjust_tool_adjust_reset_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_NUM_PROPERTIES];
typedef struct _EditingToolsAdjustToolSliderAdjustmentCommandPrivate EditingToolsAdjustToolSliderAdjustmentCommandPrivate;
enum  {
	EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_0_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NEW_TRANSFORMATION_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_OLD_TRANSFORMATION_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NUM_PROPERTIES
};
static GParamSpec* editing_tools_adjust_tool_slider_adjustment_command_properties[EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NUM_PROPERTIES];
typedef struct _EditingToolsAdjustToolAdjustEnhanceCommandPrivate EditingToolsAdjustToolAdjustEnhanceCommandPrivate;
enum  {
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_0_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_PHOTO_PROPERTY,
	EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_NUM_PROPERTIES
};
static GParamSpec* editing_tools_adjust_tool_adjust_enhance_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_NUM_PROPERTIES];
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _EditingToolsAdjustToolPrivate {
	EditingToolsAdjustToolAdjustToolWindow* adjust_tool_window;
	gboolean suppress_effect_redraw;
	GdkPixbuf* draw_to_pixbuf;
	GdkPixbuf* histogram_pixbuf;
	GdkPixbuf* virgin_histogram_pixbuf;
	PixelTransformer* transformer;
	PixelTransformer* histogram_transformer;
	PixelTransformationBundle* transformations;
	gfloat* fp_pixel_cache;
	gint fp_pixel_cache_length1;
	gint _fp_pixel_cache_size_;
	gboolean disable_histogram_refresh;
	OneShotScheduler* temperature_scheduler;
	OneShotScheduler* tint_scheduler;
	OneShotScheduler* saturation_scheduler;
	OneShotScheduler* exposure_scheduler;
	OneShotScheduler* shadows_scheduler;
	OneShotScheduler* highlights_scheduler;
};

struct _EditingToolsAdjustToolAdjustToolWindow {
	EditingToolsEditingToolWindow parent_instance;
	EditingToolsAdjustToolAdjustToolWindowPrivate * priv;
	GtkButton* ok_button;
	GtkButton* reset_button;
	GtkButton* cancel_button;
	GtkScale* exposure_slider;
	GtkScale* saturation_slider;
	GtkScale* tint_slider;
	GtkScale* temperature_slider;
	GtkScale* shadows_slider;
	GtkScale* highlights_slider;
	RGBHistogramManipulator* histogram_manipulator;
};

struct _EditingToolsAdjustToolAdjustToolWindowClass {
	EditingToolsEditingToolWindowClass parent_class;
};

struct _EditingToolsAdjustToolAdjustToolCommand {
	Command parent_instance;
	EditingToolsAdjustToolAdjustToolCommandPrivate * priv;
};

struct _EditingToolsAdjustToolAdjustToolCommandClass {
	CommandClass parent_class;
};

struct _EditingToolsAdjustToolAdjustToolCommandPrivate {
	EditingToolsAdjustTool* _owner;
};

struct _EditingToolsAdjustToolAdjustResetCommand {
	EditingToolsAdjustToolAdjustToolCommand parent_instance;
	EditingToolsAdjustToolAdjustResetCommandPrivate * priv;
};

struct _EditingToolsAdjustToolAdjustResetCommandClass {
	EditingToolsAdjustToolAdjustToolCommandClass parent_class;
};

struct _EditingToolsAdjustToolAdjustResetCommandPrivate {
	PixelTransformationBundle* _original;
	PixelTransformationBundle* reset;
};

struct _EditingToolsAdjustToolSliderAdjustmentCommand {
	EditingToolsAdjustToolAdjustToolCommand parent_instance;
	EditingToolsAdjustToolSliderAdjustmentCommandPrivate * priv;
};

struct _EditingToolsAdjustToolSliderAdjustmentCommandClass {
	EditingToolsAdjustToolAdjustToolCommandClass parent_class;
};

struct _EditingToolsAdjustToolSliderAdjustmentCommandPrivate {
	PixelTransformationType transformation_type;
	PixelTransformation* _new_transformation;
	PixelTransformation* _old_transformation;
};

struct _EditingToolsAdjustToolAdjustEnhanceCommand {
	EditingToolsAdjustToolAdjustToolCommand parent_instance;
	EditingToolsAdjustToolAdjustEnhanceCommandPrivate * priv;
};

struct _EditingToolsAdjustToolAdjustEnhanceCommandClass {
	EditingToolsAdjustToolAdjustToolCommandClass parent_class;
};

struct _EditingToolsAdjustToolAdjustEnhanceCommandPrivate {
	Photo* _photo;
	PixelTransformationBundle* original;
	PixelTransformationBundle* enhanced;
};

static gint EditingToolsAdjustTool_private_offset;
static gpointer editing_tools_adjust_tool_parent_class = NULL;
static gpointer editing_tools_adjust_tool_adjust_tool_window_parent_class = NULL;
static gint EditingToolsAdjustToolAdjustToolCommand_private_offset;
static gpointer editing_tools_adjust_tool_adjust_tool_command_parent_class = NULL;
static gint EditingToolsAdjustToolAdjustResetCommand_private_offset;
static gpointer editing_tools_adjust_tool_adjust_reset_command_parent_class = NULL;
static gint EditingToolsAdjustToolSliderAdjustmentCommand_private_offset;
static gpointer editing_tools_adjust_tool_slider_adjustment_command_parent_class = NULL;
static gint EditingToolsAdjustToolAdjustEnhanceCommand_private_offset;
static gpointer editing_tools_adjust_tool_adjust_enhance_command_parent_class = NULL;

static GType editing_tools_adjust_tool_adjust_tool_window_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static EditingToolsAdjustTool* editing_tools_adjust_tool_new (void);
static EditingToolsAdjustTool* editing_tools_adjust_tool_construct (GType object_type);
static void editing_tools_adjust_tool_real_activate (EditingToolsEditingTool* base,
                                              EditingToolsPhotoCanvas* canvas);
static EditingToolsAdjustToolAdjustToolWindow* editing_tools_adjust_tool_adjust_tool_window_new (GtkWindow* container);
static EditingToolsAdjustToolAdjustToolWindow* editing_tools_adjust_tool_adjust_tool_window_construct (GType object_type,
                                                                                                GtkWindow* container);
static void editing_tools_adjust_tool_bind_canvas_handlers (EditingToolsAdjustTool* self,
                                                     EditingToolsPhotoCanvas* canvas);
static void editing_tools_adjust_tool_bind_window_handlers (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_init_fp_pixel_cache (EditingToolsAdjustTool* self,
                                                    GdkPixbuf* source);
static void editing_tools_adjust_tool_on_photos_altered (EditingToolsAdjustTool* self,
                                                  GeeMap* map);
static void _editing_tools_adjust_tool_on_photos_altered_data_collection_items_altered (DataCollection* _sender,
                                                                                 GeeMap* items,
                                                                                 gpointer self);
static EditingToolsEditingToolWindow* editing_tools_adjust_tool_real_get_tool_window (EditingToolsEditingTool* base);
static void editing_tools_adjust_tool_real_deactivate (EditingToolsEditingTool* base);
static void editing_tools_adjust_tool_unbind_canvas_handlers (EditingToolsAdjustTool* self,
                                                       EditingToolsPhotoCanvas* canvas);
static void editing_tools_adjust_tool_unbind_window_handlers (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_real_paint (EditingToolsEditingTool* base,
                                           cairo_t* ctx);
static GdkPixbuf* editing_tools_adjust_tool_real_get_display_pixbuf (EditingToolsEditingTool* base,
                                                              Scaling* scaling,
                                                              Photo* photo,
                                                              Dimensions* max_dim,
                                                              GError** error);
static void editing_tools_adjust_tool_on_reset (EditingToolsAdjustTool* self);
static GType editing_tools_adjust_tool_adjust_tool_command_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GType editing_tools_adjust_tool_adjust_reset_command_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static EditingToolsAdjustToolAdjustResetCommand* editing_tools_adjust_tool_adjust_reset_command_new (EditingToolsAdjustTool* owner,
                                                                                              PixelTransformationBundle* current);
static EditingToolsAdjustToolAdjustResetCommand* editing_tools_adjust_tool_adjust_reset_command_construct (GType object_type,
                                                                                                    EditingToolsAdjustTool* owner,
                                                                                                    PixelTransformationBundle* current);
static void editing_tools_adjust_tool_on_ok (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_update_transformations (EditingToolsAdjustTool* self,
                                                       PixelTransformationBundle* new_transformations);
static void editing_tools_adjust_tool_update_transformation (EditingToolsAdjustTool* self,
                                                      PixelTransformation* new_transformation);
static void editing_tools_adjust_tool_slider_updated (EditingToolsAdjustTool* self,
                                               PixelTransformation* new_transformation,
                                               const gchar* name);
static GType editing_tools_adjust_tool_slider_adjustment_command_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static EditingToolsAdjustToolSliderAdjustmentCommand* editing_tools_adjust_tool_slider_adjustment_command_new (EditingToolsAdjustTool* owner,
                                                                                                        PixelTransformation* old_transformation,
                                                                                                        PixelTransformation* new_transformation,
                                                                                                        const gchar* name);
static EditingToolsAdjustToolSliderAdjustmentCommand* editing_tools_adjust_tool_slider_adjustment_command_construct (GType object_type,
                                                                                                              EditingToolsAdjustTool* owner,
                                                                                                              PixelTransformation* old_transformation,
                                                                                                              PixelTransformation* new_transformation,
                                                                                                              const gchar* name);
static void editing_tools_adjust_tool_on_temperature_adjustment (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_delayed_temperature_adjustment (EditingToolsAdjustTool* self);
static void _editing_tools_adjust_tool_on_delayed_temperature_adjustment_one_shot_callback (gpointer self);
static void editing_tools_adjust_tool_on_tint_adjustment (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_delayed_tint_adjustment (EditingToolsAdjustTool* self);
static void _editing_tools_adjust_tool_on_delayed_tint_adjustment_one_shot_callback (gpointer self);
static void editing_tools_adjust_tool_on_saturation_adjustment (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_delayed_saturation_adjustment (EditingToolsAdjustTool* self);
static void _editing_tools_adjust_tool_on_delayed_saturation_adjustment_one_shot_callback (gpointer self);
static void editing_tools_adjust_tool_on_exposure_adjustment (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_delayed_exposure_adjustment (EditingToolsAdjustTool* self);
static void _editing_tools_adjust_tool_on_delayed_exposure_adjustment_one_shot_callback (gpointer self);
static void editing_tools_adjust_tool_on_shadows_adjustment (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_delayed_shadows_adjustment (EditingToolsAdjustTool* self);
static void _editing_tools_adjust_tool_on_delayed_shadows_adjustment_one_shot_callback (gpointer self);
static void editing_tools_adjust_tool_on_highlights_adjustment (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_delayed_highlights_adjustment (EditingToolsAdjustTool* self);
static void _editing_tools_adjust_tool_on_delayed_highlights_adjustment_one_shot_callback (gpointer self);
static void editing_tools_adjust_tool_on_histogram_constraint (EditingToolsAdjustTool* self);
static void editing_tools_adjust_tool_on_canvas_resize (EditingToolsAdjustTool* self);
static gboolean editing_tools_adjust_tool_on_hscale_reset (EditingToolsAdjustTool* self,
                                                    GtkWidget* widget,
                                                    GdkEventButton* event);
static void _editing_tools_adjust_tool_on_canvas_resize_editing_tools_photo_canvas_resized_scaled_pixbuf (EditingToolsPhotoCanvas* _sender,
                                                                                                   Dimensions* old_dim,
                                                                                                   GdkPixbuf* scaled,
                                                                                                   GdkRectangle* scaled_position,
                                                                                                   gpointer self);
static void _editing_tools_adjust_tool_on_ok_gtk_button_clicked (GtkButton* _sender,
                                                          gpointer self);
static void _editing_tools_adjust_tool_on_reset_gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _editing_tools_editing_tool_notify_cancel_gtk_button_clicked (GtkButton* _sender,
                                                                   gpointer self);
static void _editing_tools_adjust_tool_on_exposure_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                                gpointer self);
static void _editing_tools_adjust_tool_on_saturation_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                                  gpointer self);
static void _editing_tools_adjust_tool_on_tint_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                            gpointer self);
static void _editing_tools_adjust_tool_on_temperature_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                                   gpointer self);
static void _editing_tools_adjust_tool_on_shadows_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                               gpointer self);
static void _editing_tools_adjust_tool_on_highlights_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                                  gpointer self);
static void _editing_tools_adjust_tool_on_histogram_constraint_rgb_histogram_manipulator_nub_position_changed (RGBHistogramManipulator* _sender,
                                                                                                        gpointer self);
static gboolean _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event (GtkWidget* _sender,
                                                                                   GdkEventButton* event,
                                                                                   gpointer self);
static GType editing_tools_adjust_tool_adjust_enhance_command_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static EditingToolsAdjustToolAdjustEnhanceCommand* editing_tools_adjust_tool_adjust_enhance_command_new (EditingToolsAdjustTool* owner,
                                                                                                  Photo* photo);
static EditingToolsAdjustToolAdjustEnhanceCommand* editing_tools_adjust_tool_adjust_enhance_command_construct (GType object_type,
                                                                                                        EditingToolsAdjustTool* owner,
                                                                                                        Photo* photo);
static void editing_tools_adjust_tool_set_adjustments (EditingToolsAdjustTool* self,
                                                PixelTransformationBundle* new_adjustments);
static void editing_tools_adjust_tool_update_slider (EditingToolsAdjustTool* self,
                                              PixelTransformation* transformation);
static gboolean editing_tools_adjust_tool_real_on_keypress (EditingToolsEditingTool* base,
                                                     GdkEventKey* event);
static GObject * editing_tools_adjust_tool_adjust_tool_window_constructor (GType type,
                                                                    guint n_construct_properties,
                                                                    GObjectConstructParam * construct_properties);
static void editing_tools_adjust_tool_adjust_tool_window_finalize (GObject * obj);
static GType editing_tools_adjust_tool_adjust_tool_window_get_type_once (void);
static EditingToolsAdjustTool* editing_tools_adjust_tool_adjust_tool_command_get_owner (EditingToolsAdjustToolAdjustToolCommand* self);
static void editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated (EditingToolsAdjustToolAdjustToolCommand* self);
static void _editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated_editing_tools_editing_tool_deactivated (EditingToolsEditingTool* _sender,
                                                                                                                 gpointer self);
static EditingToolsAdjustToolAdjustToolCommand* editing_tools_adjust_tool_adjust_tool_command_construct (GType object_type,
                                                                                                  EditingToolsAdjustTool* owner,
                                                                                                  const gchar* name,
                                                                                                  const gchar* explanation);
static void editing_tools_adjust_tool_adjust_tool_command_set_owner (EditingToolsAdjustToolAdjustToolCommand* self,
                                                              EditingToolsAdjustTool* value);
static GObject * editing_tools_adjust_tool_adjust_tool_command_constructor (GType type,
                                                                     guint n_construct_properties,
                                                                     GObjectConstructParam * construct_properties);
static void editing_tools_adjust_tool_adjust_tool_command_finalize (GObject * obj);
static GType editing_tools_adjust_tool_adjust_tool_command_get_type_once (void);
static void _vala_editing_tools_adjust_tool_adjust_tool_command_get_property (GObject * object,
                                                                       guint property_id,
                                                                       GValue * value,
                                                                       GParamSpec * pspec);
static void _vala_editing_tools_adjust_tool_adjust_tool_command_set_property (GObject * object,
                                                                       guint property_id,
                                                                       const GValue * value,
                                                                       GParamSpec * pspec);
static void editing_tools_adjust_tool_adjust_reset_command_real_execute (Command* base);
static void editing_tools_adjust_tool_adjust_reset_command_real_undo (Command* base);
static PixelTransformationBundle* editing_tools_adjust_tool_adjust_reset_command_get_original (EditingToolsAdjustToolAdjustResetCommand* self);
static gboolean editing_tools_adjust_tool_adjust_reset_command_real_compress (Command* base,
                                                                       Command* command);
static void editing_tools_adjust_tool_adjust_reset_command_set_original (EditingToolsAdjustToolAdjustResetCommand* self,
                                                                  PixelTransformationBundle* value);
static GObject * editing_tools_adjust_tool_adjust_reset_command_constructor (GType type,
                                                                      guint n_construct_properties,
                                                                      GObjectConstructParam * construct_properties);
static void editing_tools_adjust_tool_adjust_reset_command_finalize (GObject * obj);
static GType editing_tools_adjust_tool_adjust_reset_command_get_type_once (void);
static void _vala_editing_tools_adjust_tool_adjust_reset_command_get_property (GObject * object,
                                                                        guint property_id,
                                                                        GValue * value,
                                                                        GParamSpec * pspec);
static void _vala_editing_tools_adjust_tool_adjust_reset_command_set_property (GObject * object,
                                                                        guint property_id,
                                                                        const GValue * value,
                                                                        GParamSpec * pspec);
static void editing_tools_adjust_tool_slider_adjustment_command_real_execute (Command* base);
static PixelTransformation* editing_tools_adjust_tool_slider_adjustment_command_get_new_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self);
static void editing_tools_adjust_tool_slider_adjustment_command_real_undo (Command* base);
static PixelTransformation* editing_tools_adjust_tool_slider_adjustment_command_get_old_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self);
static void editing_tools_adjust_tool_slider_adjustment_command_real_redo (Command* base);
static gboolean editing_tools_adjust_tool_slider_adjustment_command_real_compress (Command* base,
                                                                            Command* command);
static void editing_tools_adjust_tool_slider_adjustment_command_set_new_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self,
                                                                                 PixelTransformation* value);
static void editing_tools_adjust_tool_slider_adjustment_command_set_old_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self,
                                                                                 PixelTransformation* value);
static GObject * editing_tools_adjust_tool_slider_adjustment_command_constructor (GType type,
                                                                           guint n_construct_properties,
                                                                           GObjectConstructParam * construct_properties);
static void editing_tools_adjust_tool_slider_adjustment_command_finalize (GObject * obj);
static GType editing_tools_adjust_tool_slider_adjustment_command_get_type_once (void);
static void _vala_editing_tools_adjust_tool_slider_adjustment_command_get_property (GObject * object,
                                                                             guint property_id,
                                                                             GValue * value,
                                                                             GParamSpec * pspec);
static void _vala_editing_tools_adjust_tool_slider_adjustment_command_set_property (GObject * object,
                                                                             guint property_id,
                                                                             const GValue * value,
                                                                             GParamSpec * pspec);
static void editing_tools_adjust_tool_adjust_enhance_command_real_execute (Command* base);
static Photo* editing_tools_adjust_tool_adjust_enhance_command_get_photo (EditingToolsAdjustToolAdjustEnhanceCommand* self);
static void editing_tools_adjust_tool_adjust_enhance_command_real_undo (Command* base);
static gboolean editing_tools_adjust_tool_adjust_enhance_command_real_compress (Command* base,
                                                                         Command* command);
static void editing_tools_adjust_tool_adjust_enhance_command_set_photo (EditingToolsAdjustToolAdjustEnhanceCommand* self,
                                                                 Photo* value);
static GObject * editing_tools_adjust_tool_adjust_enhance_command_constructor (GType type,
                                                                        guint n_construct_properties,
                                                                        GObjectConstructParam * construct_properties);
static void editing_tools_adjust_tool_adjust_enhance_command_finalize (GObject * obj);
static GType editing_tools_adjust_tool_adjust_enhance_command_get_type_once (void);
static void _vala_editing_tools_adjust_tool_adjust_enhance_command_get_property (GObject * object,
                                                                          guint property_id,
                                                                          GValue * value,
                                                                          GParamSpec * pspec);
static void _vala_editing_tools_adjust_tool_adjust_enhance_command_set_property (GObject * object,
                                                                          guint property_id,
                                                                          const GValue * value,
                                                                          GParamSpec * pspec);
static void editing_tools_adjust_tool_finalize (GObject * obj);
static GType editing_tools_adjust_tool_get_type_once (void);

static inline gpointer
editing_tools_adjust_tool_get_instance_private (EditingToolsAdjustTool* self)
{
	return G_STRUCT_MEMBER_P (self, EditingToolsAdjustTool_private_offset);
}

static EditingToolsAdjustTool*
editing_tools_adjust_tool_construct (GType object_type)
{
	EditingToolsAdjustTool * self = NULL;
	self = (EditingToolsAdjustTool*) g_object_new (object_type, "name", "AdjustTool", NULL);
	return self;
}

static EditingToolsAdjustTool*
editing_tools_adjust_tool_new (void)
{
	return editing_tools_adjust_tool_construct (EDITING_TOOLS_TYPE_ADJUST_TOOL);
}

EditingToolsAdjustTool*
editing_tools_adjust_tool_factory (void)
{
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* result;
	_tmp0_ = editing_tools_adjust_tool_new ();
	result = _tmp0_;
	return result;
}

gboolean
editing_tools_adjust_tool_is_available (Photo* photo,
                                        Scaling* scaling)
{
	gboolean result;
	g_return_val_if_fail (photo != NULL, FALSE);
	g_return_val_if_fail (scaling != NULL, FALSE);
	result = TRUE;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
_editing_tools_adjust_tool_on_photos_altered_data_collection_items_altered (DataCollection* _sender,
                                                                            GeeMap* items,
                                                                            gpointer self)
{
	editing_tools_adjust_tool_on_photos_altered ((EditingToolsAdjustTool*) self, items);
}

static void
editing_tools_adjust_tool_real_activate (EditingToolsEditingTool* base,
                                         EditingToolsPhotoCanvas* canvas)
{
	EditingToolsAdjustTool * self;
	GtkWindow* _tmp0_;
	GtkWindow* _tmp1_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp2_;
	Photo* photo = NULL;
	Photo* _tmp3_;
	Photo* _tmp4_;
	Photo* _tmp5_;
	Photo* _tmp6_;
	PixelTransformationBundle* _tmp7_;
	PixelTransformationBundle* _tmp8_;
	PixelTransformer* _tmp9_;
	PixelTransformer* _tmp10_;
	ExpansionTransformation* expansion_trans = NULL;
	PixelTransformationBundle* _tmp11_;
	PixelTransformation* _tmp12_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp13_;
	RGBHistogramManipulator* _tmp14_;
	ExpansionTransformation* _tmp15_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp16_;
	RGBHistogramManipulator* _tmp17_;
	ExpansionTransformation* _tmp18_;
	ShadowDetailTransformation* shadows_trans = NULL;
	PixelTransformationBundle* _tmp19_;
	PixelTransformation* _tmp20_;
	PixelTransformer* _tmp21_;
	ShadowDetailTransformation* _tmp22_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp23_;
	GtkScale* _tmp24_;
	ShadowDetailTransformation* _tmp25_;
	HighlightDetailTransformation* highlights_trans = NULL;
	PixelTransformationBundle* _tmp26_;
	PixelTransformation* _tmp27_;
	PixelTransformer* _tmp28_;
	HighlightDetailTransformation* _tmp29_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp30_;
	GtkScale* _tmp31_;
	HighlightDetailTransformation* _tmp32_;
	TemperatureTransformation* temp_trans = NULL;
	PixelTransformationBundle* _tmp33_;
	PixelTransformation* _tmp34_;
	PixelTransformer* _tmp35_;
	TemperatureTransformation* _tmp36_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp37_;
	GtkScale* _tmp38_;
	TemperatureTransformation* _tmp39_;
	TintTransformation* tint_trans = NULL;
	PixelTransformationBundle* _tmp40_;
	PixelTransformation* _tmp41_;
	PixelTransformer* _tmp42_;
	TintTransformation* _tmp43_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp44_;
	GtkScale* _tmp45_;
	TintTransformation* _tmp46_;
	SaturationTransformation* sat_trans = NULL;
	PixelTransformationBundle* _tmp47_;
	PixelTransformation* _tmp48_;
	PixelTransformer* _tmp49_;
	SaturationTransformation* _tmp50_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp51_;
	GtkScale* _tmp52_;
	SaturationTransformation* _tmp53_;
	ExposureTransformation* exposure_trans = NULL;
	PixelTransformationBundle* _tmp54_;
	PixelTransformation* _tmp55_;
	PixelTransformer* _tmp56_;
	ExposureTransformation* _tmp57_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp58_;
	GtkScale* _tmp59_;
	ExposureTransformation* _tmp60_;
	GdkPixbuf* _tmp61_;
	GdkPixbuf* _tmp62_;
	GdkPixbuf* _tmp63_;
	GdkPixbuf* _tmp64_;
	GdkPixbuf* _tmp65_;
	gboolean _tmp66_ = FALSE;
	GdkPixbuf* _tmp67_;
	gint _tmp68_;
	gint _tmp69_;
	gboolean _tmp73_ = FALSE;
	gboolean _tmp74_ = FALSE;
	GdkPixbuf* _tmp75_;
	gint _tmp76_;
	gint _tmp77_;
	GdkPixbuf* _tmp78_;
	gint _tmp79_;
	gint _tmp80_;
	GdkPixbuf* _tmp97_;
	GdkPixbuf* _tmp98_;
	DataCollection* owner = NULL;
	Photo* _tmp99_;
	Photo* _tmp100_;
	DataCollection* _tmp101_;
	DataCollection* _tmp102_;
	self = (EditingToolsAdjustTool*) base;
	g_return_if_fail (canvas != NULL);
	_tmp0_ = editing_tools_photo_canvas_get_container (canvas);
	_tmp1_ = _tmp0_;
	_tmp2_ = editing_tools_adjust_tool_adjust_tool_window_new (_tmp1_);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->adjust_tool_window);
	self->priv->adjust_tool_window = _tmp2_;
	_tmp3_ = editing_tools_photo_canvas_get_photo (canvas);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	photo = _tmp5_;
	_tmp6_ = photo;
	_tmp7_ = photo_get_color_adjustments (_tmp6_);
	_pixel_transformation_bundle_unref0 (self->priv->transformations);
	self->priv->transformations = _tmp7_;
	_tmp8_ = self->priv->transformations;
	_tmp9_ = pixel_transformation_bundle_generate_transformer (_tmp8_);
	_pixel_transformer_unref0 (self->priv->transformer);
	self->priv->transformer = _tmp9_;
	_tmp10_ = pixel_transformer_new ();
	_pixel_transformer_unref0 (self->priv->histogram_transformer);
	self->priv->histogram_transformer = _tmp10_;
	_tmp11_ = self->priv->transformations;
	_tmp12_ = pixel_transformation_bundle_get_transformation (_tmp11_, PIXEL_TRANSFORMATION_TYPE_TONE_EXPANSION);
	expansion_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, TYPE_EXPANSION_TRANSFORMATION, ExpansionTransformation);
	_tmp13_ = self->priv->adjust_tool_window;
	_tmp14_ = _tmp13_->histogram_manipulator;
	_tmp15_ = expansion_trans;
	rgb_histogram_manipulator_set_left_nub_position (_tmp14_, expansion_transformation_get_black_point (_tmp15_));
	_tmp16_ = self->priv->adjust_tool_window;
	_tmp17_ = _tmp16_->histogram_manipulator;
	_tmp18_ = expansion_trans;
	rgb_histogram_manipulator_set_right_nub_position (_tmp17_, expansion_transformation_get_white_point (_tmp18_));
	_tmp19_ = self->priv->transformations;
	_tmp20_ = pixel_transformation_bundle_get_transformation (_tmp19_, PIXEL_TRANSFORMATION_TYPE_SHADOWS);
	shadows_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, TYPE_SHADOW_DETAIL_TRANSFORMATION, ShadowDetailTransformation);
	_tmp21_ = self->priv->histogram_transformer;
	_tmp22_ = shadows_trans;
	pixel_transformer_attach_transformation (_tmp21_, (PixelTransformation*) _tmp22_);
	_tmp23_ = self->priv->adjust_tool_window;
	_tmp24_ = _tmp23_->shadows_slider;
	_tmp25_ = shadows_trans;
	gtk_range_set_value ((GtkRange*) _tmp24_, (gdouble) shadow_detail_transformation_get_parameter (_tmp25_));
	_tmp26_ = self->priv->transformations;
	_tmp27_ = pixel_transformation_bundle_get_transformation (_tmp26_, PIXEL_TRANSFORMATION_TYPE_HIGHLIGHTS);
	highlights_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp27_, TYPE_HIGHLIGHT_DETAIL_TRANSFORMATION, HighlightDetailTransformation);
	_tmp28_ = self->priv->histogram_transformer;
	_tmp29_ = highlights_trans;
	pixel_transformer_attach_transformation (_tmp28_, (PixelTransformation*) _tmp29_);
	_tmp30_ = self->priv->adjust_tool_window;
	_tmp31_ = _tmp30_->highlights_slider;
	_tmp32_ = highlights_trans;
	gtk_range_set_value ((GtkRange*) _tmp31_, (gdouble) highlight_detail_transformation_get_parameter (_tmp32_));
	_tmp33_ = self->priv->transformations;
	_tmp34_ = pixel_transformation_bundle_get_transformation (_tmp33_, PIXEL_TRANSFORMATION_TYPE_TEMPERATURE);
	temp_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, TYPE_TEMPERATURE_TRANSFORMATION, TemperatureTransformation);
	_tmp35_ = self->priv->histogram_transformer;
	_tmp36_ = temp_trans;
	pixel_transformer_attach_transformation (_tmp35_, (PixelTransformation*) _tmp36_);
	_tmp37_ = self->priv->adjust_tool_window;
	_tmp38_ = _tmp37_->temperature_slider;
	_tmp39_ = temp_trans;
	gtk_range_set_value ((GtkRange*) _tmp38_, (gdouble) temperature_transformation_get_parameter (_tmp39_));
	_tmp40_ = self->priv->transformations;
	_tmp41_ = pixel_transformation_bundle_get_transformation (_tmp40_, PIXEL_TRANSFORMATION_TYPE_TINT);
	tint_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, TYPE_TINT_TRANSFORMATION, TintTransformation);
	_tmp42_ = self->priv->histogram_transformer;
	_tmp43_ = tint_trans;
	pixel_transformer_attach_transformation (_tmp42_, (PixelTransformation*) _tmp43_);
	_tmp44_ = self->priv->adjust_tool_window;
	_tmp45_ = _tmp44_->tint_slider;
	_tmp46_ = tint_trans;
	gtk_range_set_value ((GtkRange*) _tmp45_, (gdouble) tint_transformation_get_parameter (_tmp46_));
	_tmp47_ = self->priv->transformations;
	_tmp48_ = pixel_transformation_bundle_get_transformation (_tmp47_, PIXEL_TRANSFORMATION_TYPE_SATURATION);
	sat_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp48_, TYPE_SATURATION_TRANSFORMATION, SaturationTransformation);
	_tmp49_ = self->priv->histogram_transformer;
	_tmp50_ = sat_trans;
	pixel_transformer_attach_transformation (_tmp49_, (PixelTransformation*) _tmp50_);
	_tmp51_ = self->priv->adjust_tool_window;
	_tmp52_ = _tmp51_->saturation_slider;
	_tmp53_ = sat_trans;
	gtk_range_set_value ((GtkRange*) _tmp52_, (gdouble) saturation_transformation_get_parameter (_tmp53_));
	_tmp54_ = self->priv->transformations;
	_tmp55_ = pixel_transformation_bundle_get_transformation (_tmp54_, PIXEL_TRANSFORMATION_TYPE_EXPOSURE);
	exposure_trans = G_TYPE_CHECK_INSTANCE_CAST (_tmp55_, TYPE_EXPOSURE_TRANSFORMATION, ExposureTransformation);
	_tmp56_ = self->priv->histogram_transformer;
	_tmp57_ = exposure_trans;
	pixel_transformer_attach_transformation (_tmp56_, (PixelTransformation*) _tmp57_);
	_tmp58_ = self->priv->adjust_tool_window;
	_tmp59_ = _tmp58_->exposure_slider;
	_tmp60_ = exposure_trans;
	gtk_range_set_value ((GtkRange*) _tmp59_, (gdouble) exposure_transformation_get_parameter (_tmp60_));
	editing_tools_adjust_tool_bind_canvas_handlers (self, canvas);
	editing_tools_adjust_tool_bind_window_handlers (self);
	_tmp61_ = editing_tools_photo_canvas_get_scaled_pixbuf (canvas);
	_tmp62_ = _tmp61_;
	_tmp63_ = gdk_pixbuf_copy (_tmp62_);
	_g_object_unref0 (self->priv->draw_to_pixbuf);
	self->priv->draw_to_pixbuf = _tmp63_;
	_tmp64_ = editing_tools_photo_canvas_get_scaled_pixbuf (canvas);
	_tmp65_ = _tmp64_;
	editing_tools_adjust_tool_init_fp_pixel_cache (self, _tmp65_);
	_tmp67_ = self->priv->draw_to_pixbuf;
	_tmp68_ = gdk_pixbuf_get_width (_tmp67_);
	_tmp69_ = _tmp68_;
	if (_tmp69_ == 1) {
		GdkPixbuf* _tmp70_;
		gint _tmp71_;
		gint _tmp72_;
		_tmp70_ = self->priv->draw_to_pixbuf;
		_tmp71_ = gdk_pixbuf_get_height (_tmp70_);
		_tmp72_ = _tmp71_;
		_tmp66_ = _tmp72_ == 1;
	} else {
		_tmp66_ = FALSE;
	}
	if (_tmp66_) {
		self->priv->disable_histogram_refresh = TRUE;
	}
	_tmp75_ = self->priv->draw_to_pixbuf;
	_tmp76_ = gdk_pixbuf_get_width (_tmp75_);
	_tmp77_ = _tmp76_;
	_tmp78_ = self->priv->draw_to_pixbuf;
	_tmp79_ = gdk_pixbuf_get_height (_tmp78_);
	_tmp80_ = _tmp79_;
	if ((_tmp77_ * _tmp80_) > 8192) {
		GdkPixbuf* _tmp81_;
		gint _tmp82_;
		gint _tmp83_;
		_tmp81_ = self->priv->draw_to_pixbuf;
		_tmp82_ = gdk_pixbuf_get_width (_tmp81_);
		_tmp83_ = _tmp82_;
		_tmp74_ = _tmp83_ > 1;
	} else {
		_tmp74_ = FALSE;
	}
	if (_tmp74_) {
		GdkPixbuf* _tmp84_;
		gint _tmp85_;
		gint _tmp86_;
		_tmp84_ = self->priv->draw_to_pixbuf;
		_tmp85_ = gdk_pixbuf_get_height (_tmp84_);
		_tmp86_ = _tmp85_;
		_tmp73_ = _tmp86_ > 1;
	} else {
		_tmp73_ = FALSE;
	}
	if (_tmp73_) {
		GdkPixbuf* _tmp87_;
		GdkPixbuf* _tmp88_;
		gint _tmp89_;
		gint _tmp90_;
		GdkPixbuf* _tmp91_;
		gint _tmp92_;
		gint _tmp93_;
		GdkPixbuf* _tmp94_;
		_tmp87_ = self->priv->draw_to_pixbuf;
		_tmp88_ = self->priv->draw_to_pixbuf;
		_tmp89_ = gdk_pixbuf_get_width (_tmp88_);
		_tmp90_ = _tmp89_;
		_tmp91_ = self->priv->draw_to_pixbuf;
		_tmp92_ = gdk_pixbuf_get_height (_tmp91_);
		_tmp93_ = _tmp92_;
		_tmp94_ = gdk_pixbuf_scale_simple (_tmp87_, _tmp90_ / 2, _tmp93_ / 2, GDK_INTERP_HYPER);
		_g_object_unref0 (self->priv->histogram_pixbuf);
		self->priv->histogram_pixbuf = _tmp94_;
	} else {
		GdkPixbuf* _tmp95_;
		GdkPixbuf* _tmp96_;
		_tmp95_ = self->priv->draw_to_pixbuf;
		_tmp96_ = gdk_pixbuf_copy (_tmp95_);
		_g_object_unref0 (self->priv->histogram_pixbuf);
		self->priv->histogram_pixbuf = _tmp96_;
	}
	_tmp97_ = self->priv->histogram_pixbuf;
	_tmp98_ = gdk_pixbuf_copy (_tmp97_);
	_g_object_unref0 (self->priv->virgin_histogram_pixbuf);
	self->priv->virgin_histogram_pixbuf = _tmp98_;
	_tmp99_ = editing_tools_photo_canvas_get_photo (canvas);
	_tmp100_ = _tmp99_;
	_tmp101_ = data_object_get_membership ((DataObject*) _tmp100_);
	owner = _tmp101_;
	_tmp102_ = owner;
	if (_tmp102_ != NULL) {
		DataCollection* _tmp103_;
		_tmp103_ = owner;
		g_signal_connect_object (_tmp103_, "items-altered", (GCallback) _editing_tools_adjust_tool_on_photos_altered_data_collection_items_altered, self, 0);
	}
	EDITING_TOOLS_EDITING_TOOL_CLASS (editing_tools_adjust_tool_parent_class)->activate (G_TYPE_CHECK_INSTANCE_CAST (self, EDITING_TOOLS_TYPE_EDITING_TOOL, EditingToolsEditingTool), canvas);
	_data_collection_unref0 (owner);
	_pixel_transformation_unref0 (exposure_trans);
	_pixel_transformation_unref0 (sat_trans);
	_pixel_transformation_unref0 (tint_trans);
	_pixel_transformation_unref0 (temp_trans);
	_pixel_transformation_unref0 (highlights_trans);
	_pixel_transformation_unref0 (shadows_trans);
	_pixel_transformation_unref0 (expansion_trans);
	_g_object_unref0 (photo);
}

static EditingToolsEditingToolWindow*
editing_tools_adjust_tool_real_get_tool_window (EditingToolsEditingTool* base)
{
	EditingToolsAdjustTool * self;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	EditingToolsEditingToolWindow* _tmp1_;
	EditingToolsEditingToolWindow* result;
	self = (EditingToolsAdjustTool*) base;
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _g_object_ref0 ((EditingToolsEditingToolWindow*) _tmp0_);
	result = _tmp1_;
	return result;
}

static void
editing_tools_adjust_tool_real_deactivate (EditingToolsEditingTool* base)
{
	EditingToolsAdjustTool * self;
	EditingToolsPhotoCanvas* _tmp0_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp9_;
	self = (EditingToolsAdjustTool*) base;
	_tmp0_ = ((EditingToolsEditingTool*) self)->canvas;
	if (_tmp0_ != NULL) {
		DataCollection* owner = NULL;
		EditingToolsPhotoCanvas* _tmp1_;
		Photo* _tmp2_;
		Photo* _tmp3_;
		DataCollection* _tmp4_;
		DataCollection* _tmp5_;
		EditingToolsPhotoCanvas* _tmp8_;
		_tmp1_ = ((EditingToolsEditingTool*) self)->canvas;
		_tmp2_ = editing_tools_photo_canvas_get_photo (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = data_object_get_membership ((DataObject*) _tmp3_);
		owner = _tmp4_;
		_tmp5_ = owner;
		if (_tmp5_ != NULL) {
			DataCollection* _tmp6_;
			guint _tmp7_;
			_tmp6_ = owner;
			g_signal_parse_name ("items-altered", TYPE_DATA_COLLECTION, &_tmp7_, NULL, FALSE);
			g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_photos_altered_data_collection_items_altered, self);
		}
		_tmp8_ = ((EditingToolsEditingTool*) self)->canvas;
		editing_tools_adjust_tool_unbind_canvas_handlers (self, _tmp8_);
		_data_collection_unref0 (owner);
	}
	_tmp9_ = self->priv->adjust_tool_window;
	if (_tmp9_ != NULL) {
		EditingToolsAdjustToolAdjustToolWindow* _tmp10_;
		EditingToolsAdjustToolAdjustToolWindow* _tmp11_;
		editing_tools_adjust_tool_unbind_window_handlers (self);
		_tmp10_ = self->priv->adjust_tool_window;
		gtk_widget_hide ((GtkWidget*) _tmp10_);
		_tmp11_ = self->priv->adjust_tool_window;
		gtk_widget_destroy ((GtkWidget*) _tmp11_);
		_g_object_unref0 (self->priv->adjust_tool_window);
		self->priv->adjust_tool_window = NULL;
	}
	_g_object_unref0 (self->priv->draw_to_pixbuf);
	self->priv->draw_to_pixbuf = NULL;
	self->priv->fp_pixel_cache = (g_free (self->priv->fp_pixel_cache), NULL);
	self->priv->fp_pixel_cache = NULL;
	self->priv->fp_pixel_cache_length1 = 0;
	self->priv->_fp_pixel_cache_size_ = self->priv->fp_pixel_cache_length1;
	EDITING_TOOLS_EDITING_TOOL_CLASS (editing_tools_adjust_tool_parent_class)->deactivate (G_TYPE_CHECK_INSTANCE_CAST (self, EDITING_TOOLS_TYPE_EDITING_TOOL, EditingToolsEditingTool));
}

static void
editing_tools_adjust_tool_real_paint (EditingToolsEditingTool* base,
                                      cairo_t* ctx)
{
	EditingToolsAdjustTool * self;
	EditingToolsPhotoCanvas* _tmp8_;
	GdkPixbuf* _tmp9_;
	self = (EditingToolsAdjustTool*) base;
	g_return_if_fail (ctx != NULL);
	if (!self->priv->suppress_effect_redraw) {
		PixelTransformer* _tmp0_;
		GdkPixbuf* _tmp1_;
		PixelTransformer* _tmp2_;
		GdkPixbuf* _tmp3_;
		GdkPixbuf* _tmp4_;
		_tmp0_ = self->priv->transformer;
		_tmp1_ = self->priv->draw_to_pixbuf;
		pixel_transformer_transform_from_fp (_tmp0_, &self->priv->fp_pixel_cache, (gint*) (&self->priv->fp_pixel_cache_length1), _tmp1_);
		self->priv->_fp_pixel_cache_size_ = self->priv->fp_pixel_cache_length1;
		_tmp2_ = self->priv->histogram_transformer;
		_tmp3_ = self->priv->virgin_histogram_pixbuf;
		_tmp4_ = self->priv->histogram_pixbuf;
		pixel_transformer_transform_to_other_pixbuf (_tmp2_, _tmp3_, _tmp4_, NULL);
		if (!self->priv->disable_histogram_refresh) {
			EditingToolsAdjustToolAdjustToolWindow* _tmp5_;
			RGBHistogramManipulator* _tmp6_;
			GdkPixbuf* _tmp7_;
			_tmp5_ = self->priv->adjust_tool_window;
			_tmp6_ = _tmp5_->histogram_manipulator;
			_tmp7_ = self->priv->histogram_pixbuf;
			rgb_histogram_manipulator_update_histogram (_tmp6_, _tmp7_);
		}
	}
	_tmp8_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp9_ = self->priv->draw_to_pixbuf;
	editing_tools_photo_canvas_paint_pixbuf (_tmp8_, _tmp9_);
}

static GdkPixbuf*
editing_tools_adjust_tool_real_get_display_pixbuf (EditingToolsEditingTool* base,
                                                   Scaling* scaling,
                                                   Photo* photo,
                                                   Dimensions* max_dim,
                                                   GError** error)
{
	EditingToolsAdjustTool * self;
	Dimensions _vala_max_dim = {0};
	Dimensions _tmp0_ = {0};
	GdkPixbuf* _tmp1_ = NULL;
	Scaling _tmp2_;
	GdkPixbuf* _tmp3_;
	GdkPixbuf* _tmp4_;
	GError* _inner_error0_ = NULL;
	GdkPixbuf* result;
	self = (EditingToolsAdjustTool*) base;
	g_return_val_if_fail (scaling != NULL, NULL);
	g_return_val_if_fail (photo != NULL, NULL);
	if (!photo_has_color_adjustments (photo)) {
		dimensions_init (&_vala_max_dim, 0, 0);
		result = NULL;
		if (max_dim) {
			*max_dim = _vala_max_dim;
		}
		return result;
	}
	media_source_get_dimensions ((MediaSource*) photo, PHOTO_EXCEPTION_NONE, &_tmp0_);
	_vala_max_dim = _tmp0_;
	_tmp2_ = *scaling;
	_tmp3_ = photo_get_pixbuf_with_options (photo, &_tmp2_, PHOTO_EXCEPTION_ADJUST, BACKING_FETCH_MODE_BASELINE, &_inner_error0_);
	_tmp1_ = _tmp3_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp4_ = _tmp1_;
	_tmp1_ = NULL;
	result = _tmp4_;
	_g_object_unref0 (_tmp1_);
	if (max_dim) {
		*max_dim = _vala_max_dim;
	}
	return result;
}

static void
editing_tools_adjust_tool_on_reset (EditingToolsAdjustTool* self)
{
	EditingToolsAdjustToolAdjustResetCommand* command = NULL;
	PixelTransformationBundle* _tmp0_;
	EditingToolsAdjustToolAdjustResetCommand* _tmp1_;
	CommandManager* _tmp2_;
	CommandManager* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->transformations;
	_tmp1_ = editing_tools_adjust_tool_adjust_reset_command_new (self, _tmp0_);
	command = _tmp1_;
	_tmp2_ = app_window_get_command_manager ();
	_tmp3_ = _tmp2_;
	command_manager_execute (_tmp3_, (Command*) command);
	_command_manager_unref0 (_tmp3_);
	_g_object_unref0 (command);
}

static void
editing_tools_adjust_tool_on_ok (EditingToolsAdjustTool* self)
{
	EditingToolsEditingToolWindow* _tmp0_;
	EditingToolsEditingToolWindow* _tmp1_;
	EditingToolsPhotoCanvas* _tmp2_;
	Photo* _tmp3_;
	Photo* _tmp4_;
	PixelTransformationBundle* _tmp5_;
	AdjustColorsSingleCommand* _tmp6_;
	AdjustColorsSingleCommand* _tmp7_;
	GdkPixbuf* _tmp8_;
	EditingToolsPhotoCanvas* _tmp9_;
	Photo* _tmp10_;
	Photo* _tmp11_;
	Dimensions _tmp12_ = {0};
	g_return_if_fail (self != NULL);
	self->priv->suppress_effect_redraw = TRUE;
	_tmp0_ = editing_tools_editing_tool_get_tool_window ((EditingToolsEditingTool*) self);
	_tmp1_ = _tmp0_;
	gtk_widget_hide ((GtkWidget*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp3_ = editing_tools_photo_canvas_get_photo (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->transformations;
	_tmp6_ = adjust_colors_single_command_new (_tmp4_, _tmp5_, RESOURCES_ADJUST_LABEL, RESOURCES_ADJUST_TOOLTIP);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->draw_to_pixbuf;
	_tmp9_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp10_ = editing_tools_photo_canvas_get_photo (_tmp9_);
	_tmp11_ = _tmp10_;
	media_source_get_dimensions ((MediaSource*) _tmp11_, PHOTO_EXCEPTION_NONE, &_tmp12_);
	g_signal_emit_by_name ((EditingToolsEditingTool*) self, "applied", (Command*) _tmp7_, _tmp8_, &_tmp12_, FALSE);
	_g_object_unref0 (_tmp7_);
}

static void
editing_tools_adjust_tool_update_transformations (EditingToolsAdjustTool* self,
                                                  PixelTransformationBundle* new_transformations)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_transformations != NULL);
	{
		GeeIterator* _transformation_it = NULL;
		GeeIterable* _tmp0_;
		GeeIterable* _tmp1_;
		GeeIterator* _tmp2_;
		GeeIterator* _tmp3_;
		_tmp0_ = pixel_transformation_bundle_get_transformations (new_transformations);
		_tmp1_ = _tmp0_;
		_tmp2_ = gee_iterable_iterator (_tmp1_);
		_tmp3_ = _tmp2_;
		_g_object_unref0 (_tmp1_);
		_transformation_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			PixelTransformation* transformation = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			PixelTransformation* _tmp7_;
			_tmp4_ = _transformation_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _transformation_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			transformation = (PixelTransformation*) _tmp6_;
			_tmp7_ = transformation;
			editing_tools_adjust_tool_update_transformation (self, _tmp7_);
			_pixel_transformation_unref0 (transformation);
		}
		_g_object_unref0 (_transformation_it);
	}
}

static void
editing_tools_adjust_tool_update_transformation (EditingToolsAdjustTool* self,
                                                 PixelTransformation* new_transformation)
{
	PixelTransformation* old_transformation = NULL;
	PixelTransformationBundle* _tmp0_;
	PixelTransformation* _tmp1_;
	PixelTransformer* _tmp2_;
	PixelTransformation* _tmp3_;
	PixelTransformationBundle* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_transformation != NULL);
	_tmp0_ = self->priv->transformations;
	_tmp1_ = pixel_transformation_bundle_get_transformation (_tmp0_, pixel_transformation_get_transformation_type (new_transformation));
	old_transformation = _tmp1_;
	_tmp2_ = self->priv->transformer;
	_tmp3_ = old_transformation;
	pixel_transformer_replace_transformation (_tmp2_, _tmp3_, new_transformation);
	if (pixel_transformation_get_transformation_type (new_transformation) != PIXEL_TRANSFORMATION_TYPE_TONE_EXPANSION) {
		PixelTransformer* _tmp4_;
		PixelTransformation* _tmp5_;
		_tmp4_ = self->priv->histogram_transformer;
		_tmp5_ = old_transformation;
		pixel_transformer_replace_transformation (_tmp4_, _tmp5_, new_transformation);
	}
	_tmp6_ = self->priv->transformations;
	pixel_transformation_bundle_set (_tmp6_, new_transformation);
	_pixel_transformation_unref0 (old_transformation);
}

static void
editing_tools_adjust_tool_slider_updated (EditingToolsAdjustTool* self,
                                          PixelTransformation* new_transformation,
                                          const gchar* name)
{
	PixelTransformation* old_transformation = NULL;
	PixelTransformationBundle* _tmp0_;
	PixelTransformation* _tmp1_;
	EditingToolsAdjustToolSliderAdjustmentCommand* command = NULL;
	EditingToolsAdjustToolSliderAdjustmentCommand* _tmp2_;
	CommandManager* _tmp3_;
	CommandManager* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_transformation != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = self->priv->transformations;
	_tmp1_ = pixel_transformation_bundle_get_transformation (_tmp0_, pixel_transformation_get_transformation_type (new_transformation));
	old_transformation = _tmp1_;
	_tmp2_ = editing_tools_adjust_tool_slider_adjustment_command_new (self, old_transformation, new_transformation, name);
	command = _tmp2_;
	_tmp3_ = app_window_get_command_manager ();
	_tmp4_ = _tmp3_;
	command_manager_execute (_tmp4_, (Command*) command);
	_command_manager_unref0 (_tmp4_);
	_g_object_unref0 (command);
	_pixel_transformation_unref0 (old_transformation);
}

static void
_editing_tools_adjust_tool_on_delayed_temperature_adjustment_one_shot_callback (gpointer self)
{
	editing_tools_adjust_tool_on_delayed_temperature_adjustment ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_on_temperature_adjustment (EditingToolsAdjustTool* self)
{
	OneShotScheduler* _tmp0_;
	OneShotScheduler* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->temperature_scheduler;
	if (_tmp0_ == NULL) {
		OneShotScheduler* _tmp1_;
		_tmp1_ = one_shot_scheduler_new ("temperature", _editing_tools_adjust_tool_on_delayed_temperature_adjustment_one_shot_callback, self);
		_one_shot_scheduler_unref0 (self->priv->temperature_scheduler);
		self->priv->temperature_scheduler = _tmp1_;
	}
	_tmp2_ = self->priv->temperature_scheduler;
	one_shot_scheduler_after_timeout (_tmp2_, EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC, TRUE);
}

static void
editing_tools_adjust_tool_on_delayed_temperature_adjustment (EditingToolsAdjustTool* self)
{
	TemperatureTransformation* new_temp_trans = NULL;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkScale* _tmp1_;
	TemperatureTransformation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->temperature_slider;
	_tmp2_ = temperature_transformation_new ((gfloat) gtk_range_get_value ((GtkRange*) _tmp1_));
	new_temp_trans = _tmp2_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_temp_trans, _ ("Temperature"));
	_pixel_transformation_unref0 (new_temp_trans);
}

static void
_editing_tools_adjust_tool_on_delayed_tint_adjustment_one_shot_callback (gpointer self)
{
	editing_tools_adjust_tool_on_delayed_tint_adjustment ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_on_tint_adjustment (EditingToolsAdjustTool* self)
{
	OneShotScheduler* _tmp0_;
	OneShotScheduler* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->tint_scheduler;
	if (_tmp0_ == NULL) {
		OneShotScheduler* _tmp1_;
		_tmp1_ = one_shot_scheduler_new ("tint", _editing_tools_adjust_tool_on_delayed_tint_adjustment_one_shot_callback, self);
		_one_shot_scheduler_unref0 (self->priv->tint_scheduler);
		self->priv->tint_scheduler = _tmp1_;
	}
	_tmp2_ = self->priv->tint_scheduler;
	one_shot_scheduler_after_timeout (_tmp2_, EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC, TRUE);
}

static void
editing_tools_adjust_tool_on_delayed_tint_adjustment (EditingToolsAdjustTool* self)
{
	TintTransformation* new_tint_trans = NULL;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkScale* _tmp1_;
	TintTransformation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->tint_slider;
	_tmp2_ = tint_transformation_new ((gfloat) gtk_range_get_value ((GtkRange*) _tmp1_));
	new_tint_trans = _tmp2_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_tint_trans, _ ("Tint"));
	_pixel_transformation_unref0 (new_tint_trans);
}

static void
_editing_tools_adjust_tool_on_delayed_saturation_adjustment_one_shot_callback (gpointer self)
{
	editing_tools_adjust_tool_on_delayed_saturation_adjustment ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_on_saturation_adjustment (EditingToolsAdjustTool* self)
{
	OneShotScheduler* _tmp0_;
	OneShotScheduler* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->saturation_scheduler;
	if (_tmp0_ == NULL) {
		OneShotScheduler* _tmp1_;
		_tmp1_ = one_shot_scheduler_new ("saturation", _editing_tools_adjust_tool_on_delayed_saturation_adjustment_one_shot_callback, self);
		_one_shot_scheduler_unref0 (self->priv->saturation_scheduler);
		self->priv->saturation_scheduler = _tmp1_;
	}
	_tmp2_ = self->priv->saturation_scheduler;
	one_shot_scheduler_after_timeout (_tmp2_, EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC, TRUE);
}

static void
editing_tools_adjust_tool_on_delayed_saturation_adjustment (EditingToolsAdjustTool* self)
{
	SaturationTransformation* new_sat_trans = NULL;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkScale* _tmp1_;
	SaturationTransformation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->saturation_slider;
	_tmp2_ = saturation_transformation_new ((gfloat) gtk_range_get_value ((GtkRange*) _tmp1_));
	new_sat_trans = _tmp2_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_sat_trans, _ ("Saturation"));
	_pixel_transformation_unref0 (new_sat_trans);
}

static void
_editing_tools_adjust_tool_on_delayed_exposure_adjustment_one_shot_callback (gpointer self)
{
	editing_tools_adjust_tool_on_delayed_exposure_adjustment ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_on_exposure_adjustment (EditingToolsAdjustTool* self)
{
	OneShotScheduler* _tmp0_;
	OneShotScheduler* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->exposure_scheduler;
	if (_tmp0_ == NULL) {
		OneShotScheduler* _tmp1_;
		_tmp1_ = one_shot_scheduler_new ("exposure", _editing_tools_adjust_tool_on_delayed_exposure_adjustment_one_shot_callback, self);
		_one_shot_scheduler_unref0 (self->priv->exposure_scheduler);
		self->priv->exposure_scheduler = _tmp1_;
	}
	_tmp2_ = self->priv->exposure_scheduler;
	one_shot_scheduler_after_timeout (_tmp2_, EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC, TRUE);
}

static void
editing_tools_adjust_tool_on_delayed_exposure_adjustment (EditingToolsAdjustTool* self)
{
	ExposureTransformation* new_exp_trans = NULL;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkScale* _tmp1_;
	ExposureTransformation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->exposure_slider;
	_tmp2_ = exposure_transformation_new ((gfloat) gtk_range_get_value ((GtkRange*) _tmp1_));
	new_exp_trans = _tmp2_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_exp_trans, _ ("Exposure"));
	_pixel_transformation_unref0 (new_exp_trans);
}

static void
_editing_tools_adjust_tool_on_delayed_shadows_adjustment_one_shot_callback (gpointer self)
{
	editing_tools_adjust_tool_on_delayed_shadows_adjustment ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_on_shadows_adjustment (EditingToolsAdjustTool* self)
{
	OneShotScheduler* _tmp0_;
	OneShotScheduler* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->shadows_scheduler;
	if (_tmp0_ == NULL) {
		OneShotScheduler* _tmp1_;
		_tmp1_ = one_shot_scheduler_new ("shadows", _editing_tools_adjust_tool_on_delayed_shadows_adjustment_one_shot_callback, self);
		_one_shot_scheduler_unref0 (self->priv->shadows_scheduler);
		self->priv->shadows_scheduler = _tmp1_;
	}
	_tmp2_ = self->priv->shadows_scheduler;
	one_shot_scheduler_after_timeout (_tmp2_, EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC, TRUE);
}

static void
editing_tools_adjust_tool_on_delayed_shadows_adjustment (EditingToolsAdjustTool* self)
{
	ShadowDetailTransformation* new_shadows_trans = NULL;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkScale* _tmp1_;
	ShadowDetailTransformation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->shadows_slider;
	_tmp2_ = shadow_detail_transformation_new ((gfloat) gtk_range_get_value ((GtkRange*) _tmp1_));
	new_shadows_trans = _tmp2_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_shadows_trans, _ ("Shadows"));
	_pixel_transformation_unref0 (new_shadows_trans);
}

static void
_editing_tools_adjust_tool_on_delayed_highlights_adjustment_one_shot_callback (gpointer self)
{
	editing_tools_adjust_tool_on_delayed_highlights_adjustment ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_on_highlights_adjustment (EditingToolsAdjustTool* self)
{
	OneShotScheduler* _tmp0_;
	OneShotScheduler* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->highlights_scheduler;
	if (_tmp0_ == NULL) {
		OneShotScheduler* _tmp1_;
		_tmp1_ = one_shot_scheduler_new ("highlights", _editing_tools_adjust_tool_on_delayed_highlights_adjustment_one_shot_callback, self);
		_one_shot_scheduler_unref0 (self->priv->highlights_scheduler);
		self->priv->highlights_scheduler = _tmp1_;
	}
	_tmp2_ = self->priv->highlights_scheduler;
	one_shot_scheduler_after_timeout (_tmp2_, EDITING_TOOLS_ADJUST_TOOL_SLIDER_DELAY_MSEC, TRUE);
}

static void
editing_tools_adjust_tool_on_delayed_highlights_adjustment (EditingToolsAdjustTool* self)
{
	HighlightDetailTransformation* new_highlights_trans = NULL;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkScale* _tmp1_;
	HighlightDetailTransformation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->highlights_slider;
	_tmp2_ = highlight_detail_transformation_new ((gfloat) gtk_range_get_value ((GtkRange*) _tmp1_));
	new_highlights_trans = _tmp2_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_highlights_trans, _ ("Highlights"));
	_pixel_transformation_unref0 (new_highlights_trans);
}

static void
editing_tools_adjust_tool_on_histogram_constraint (EditingToolsAdjustTool* self)
{
	gint expansion_black_point = 0;
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	RGBHistogramManipulator* _tmp1_;
	gint expansion_white_point = 0;
	EditingToolsAdjustToolAdjustToolWindow* _tmp2_;
	RGBHistogramManipulator* _tmp3_;
	ExpansionTransformation* new_exp_trans = NULL;
	ExpansionTransformation* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->histogram_manipulator;
	expansion_black_point = rgb_histogram_manipulator_get_left_nub_position (_tmp1_);
	_tmp2_ = self->priv->adjust_tool_window;
	_tmp3_ = _tmp2_->histogram_manipulator;
	expansion_white_point = rgb_histogram_manipulator_get_right_nub_position (_tmp3_);
	_tmp4_ = expansion_transformation_new_from_extrema (expansion_black_point, expansion_white_point);
	new_exp_trans = _tmp4_;
	editing_tools_adjust_tool_slider_updated (self, (PixelTransformation*) new_exp_trans, _ ("Contrast Expansion"));
	_pixel_transformation_unref0 (new_exp_trans);
}

static void
editing_tools_adjust_tool_on_canvas_resize (EditingToolsAdjustTool* self)
{
	EditingToolsPhotoCanvas* _tmp0_;
	GdkPixbuf* _tmp1_;
	GdkPixbuf* _tmp2_;
	GdkPixbuf* _tmp3_;
	EditingToolsPhotoCanvas* _tmp4_;
	GdkPixbuf* _tmp5_;
	GdkPixbuf* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp1_ = editing_tools_photo_canvas_get_scaled_pixbuf (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = gdk_pixbuf_copy (_tmp2_);
	_g_object_unref0 (self->priv->draw_to_pixbuf);
	self->priv->draw_to_pixbuf = _tmp3_;
	_tmp4_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp5_ = editing_tools_photo_canvas_get_scaled_pixbuf (_tmp4_);
	_tmp6_ = _tmp5_;
	editing_tools_adjust_tool_init_fp_pixel_cache (self, _tmp6_);
}

static gboolean
editing_tools_adjust_tool_on_hscale_reset (EditingToolsAdjustTool* self,
                                           GtkWidget* widget,
                                           GdkEventButton* event)
{
	GtkScale* source = NULL;
	GtkScale* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (widget != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (widget, gtk_scale_get_type (), GtkScale));
	source = _tmp0_;
	if (event->button == ((guint) 1)) {
		_tmp2_ = event->type == GDK_BUTTON_PRESS;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = has_only_key_modifier (event->state, GDK_CONTROL_MASK);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GtkScale* _tmp3_;
		_tmp3_ = source;
		gtk_range_set_value ((GtkRange*) _tmp3_, (gdouble) 0);
		result = TRUE;
		_g_object_unref0 (source);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (source);
	return result;
}

static void
_editing_tools_adjust_tool_on_canvas_resize_editing_tools_photo_canvas_resized_scaled_pixbuf (EditingToolsPhotoCanvas* _sender,
                                                                                              Dimensions* old_dim,
                                                                                              GdkPixbuf* scaled,
                                                                                              GdkRectangle* scaled_position,
                                                                                              gpointer self)
{
	editing_tools_adjust_tool_on_canvas_resize ((EditingToolsAdjustTool*) self);
}

static void
editing_tools_adjust_tool_bind_canvas_handlers (EditingToolsAdjustTool* self,
                                                EditingToolsPhotoCanvas* canvas)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (canvas != NULL);
	g_signal_connect_object (canvas, "resized-scaled-pixbuf", (GCallback) _editing_tools_adjust_tool_on_canvas_resize_editing_tools_photo_canvas_resized_scaled_pixbuf, self, 0);
}

static void
editing_tools_adjust_tool_unbind_canvas_handlers (EditingToolsAdjustTool* self,
                                                  EditingToolsPhotoCanvas* canvas)
{
	guint _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (canvas != NULL);
	g_signal_parse_name ("resized-scaled-pixbuf", EDITING_TOOLS_TYPE_PHOTO_CANVAS, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (canvas, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_canvas_resize_editing_tools_photo_canvas_resized_scaled_pixbuf, self);
}

static void
_editing_tools_adjust_tool_on_ok_gtk_button_clicked (GtkButton* _sender,
                                                     gpointer self)
{
	editing_tools_adjust_tool_on_ok ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_reset_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	editing_tools_adjust_tool_on_reset ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_editing_tool_notify_cancel_gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self)
{
	editing_tools_editing_tool_notify_cancel ((EditingToolsEditingTool*) self);
}

static void
_editing_tools_adjust_tool_on_exposure_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                           gpointer self)
{
	editing_tools_adjust_tool_on_exposure_adjustment ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_saturation_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                             gpointer self)
{
	editing_tools_adjust_tool_on_saturation_adjustment ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_tint_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                       gpointer self)
{
	editing_tools_adjust_tool_on_tint_adjustment ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_temperature_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                              gpointer self)
{
	editing_tools_adjust_tool_on_temperature_adjustment ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_shadows_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                          gpointer self)
{
	editing_tools_adjust_tool_on_shadows_adjustment ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_highlights_adjustment_gtk_range_value_changed (GtkRange* _sender,
                                                                             gpointer self)
{
	editing_tools_adjust_tool_on_highlights_adjustment ((EditingToolsAdjustTool*) self);
}

static void
_editing_tools_adjust_tool_on_histogram_constraint_rgb_histogram_manipulator_nub_position_changed (RGBHistogramManipulator* _sender,
                                                                                                   gpointer self)
{
	editing_tools_adjust_tool_on_histogram_constraint ((EditingToolsAdjustTool*) self);
}

static gboolean
_editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event (GtkWidget* _sender,
                                                                          GdkEventButton* event,
                                                                          gpointer self)
{
	gboolean result;
	result = editing_tools_adjust_tool_on_hscale_reset ((EditingToolsAdjustTool*) self, _sender, event);
	return result;
}

static void
editing_tools_adjust_tool_bind_window_handlers (EditingToolsAdjustTool* self)
{
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkButton* _tmp1_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp2_;
	GtkButton* _tmp3_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp4_;
	GtkButton* _tmp5_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp6_;
	GtkScale* _tmp7_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp8_;
	GtkScale* _tmp9_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp10_;
	GtkScale* _tmp11_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp12_;
	GtkScale* _tmp13_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp14_;
	GtkScale* _tmp15_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp16_;
	GtkScale* _tmp17_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp18_;
	RGBHistogramManipulator* _tmp19_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp20_;
	GtkScale* _tmp21_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp22_;
	GtkScale* _tmp23_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp24_;
	GtkScale* _tmp25_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp26_;
	GtkScale* _tmp27_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp28_;
	GtkScale* _tmp29_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp30_;
	GtkScale* _tmp31_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->ok_button;
	g_signal_connect_object (_tmp1_, "clicked", (GCallback) _editing_tools_adjust_tool_on_ok_gtk_button_clicked, self, 0);
	_tmp2_ = self->priv->adjust_tool_window;
	_tmp3_ = _tmp2_->reset_button;
	g_signal_connect_object (_tmp3_, "clicked", (GCallback) _editing_tools_adjust_tool_on_reset_gtk_button_clicked, self, 0);
	_tmp4_ = self->priv->adjust_tool_window;
	_tmp5_ = _tmp4_->cancel_button;
	g_signal_connect_object (_tmp5_, "clicked", (GCallback) _editing_tools_editing_tool_notify_cancel_gtk_button_clicked, (EditingToolsEditingTool*) self, 0);
	_tmp6_ = self->priv->adjust_tool_window;
	_tmp7_ = _tmp6_->exposure_slider;
	g_signal_connect_object ((GtkRange*) _tmp7_, "value-changed", (GCallback) _editing_tools_adjust_tool_on_exposure_adjustment_gtk_range_value_changed, self, 0);
	_tmp8_ = self->priv->adjust_tool_window;
	_tmp9_ = _tmp8_->saturation_slider;
	g_signal_connect_object ((GtkRange*) _tmp9_, "value-changed", (GCallback) _editing_tools_adjust_tool_on_saturation_adjustment_gtk_range_value_changed, self, 0);
	_tmp10_ = self->priv->adjust_tool_window;
	_tmp11_ = _tmp10_->tint_slider;
	g_signal_connect_object ((GtkRange*) _tmp11_, "value-changed", (GCallback) _editing_tools_adjust_tool_on_tint_adjustment_gtk_range_value_changed, self, 0);
	_tmp12_ = self->priv->adjust_tool_window;
	_tmp13_ = _tmp12_->temperature_slider;
	g_signal_connect_object ((GtkRange*) _tmp13_, "value-changed", (GCallback) _editing_tools_adjust_tool_on_temperature_adjustment_gtk_range_value_changed, self, 0);
	_tmp14_ = self->priv->adjust_tool_window;
	_tmp15_ = _tmp14_->shadows_slider;
	g_signal_connect_object ((GtkRange*) _tmp15_, "value-changed", (GCallback) _editing_tools_adjust_tool_on_shadows_adjustment_gtk_range_value_changed, self, 0);
	_tmp16_ = self->priv->adjust_tool_window;
	_tmp17_ = _tmp16_->highlights_slider;
	g_signal_connect_object ((GtkRange*) _tmp17_, "value-changed", (GCallback) _editing_tools_adjust_tool_on_highlights_adjustment_gtk_range_value_changed, self, 0);
	_tmp18_ = self->priv->adjust_tool_window;
	_tmp19_ = _tmp18_->histogram_manipulator;
	g_signal_connect_object (_tmp19_, "nub-position-changed", (GCallback) _editing_tools_adjust_tool_on_histogram_constraint_rgb_histogram_manipulator_nub_position_changed, self, 0);
	_tmp20_ = self->priv->adjust_tool_window;
	_tmp21_ = _tmp20_->saturation_slider;
	g_signal_connect_object ((GtkWidget*) _tmp21_, "button-press-event", (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self, 0);
	_tmp22_ = self->priv->adjust_tool_window;
	_tmp23_ = _tmp22_->exposure_slider;
	g_signal_connect_object ((GtkWidget*) _tmp23_, "button-press-event", (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self, 0);
	_tmp24_ = self->priv->adjust_tool_window;
	_tmp25_ = _tmp24_->tint_slider;
	g_signal_connect_object ((GtkWidget*) _tmp25_, "button-press-event", (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self, 0);
	_tmp26_ = self->priv->adjust_tool_window;
	_tmp27_ = _tmp26_->temperature_slider;
	g_signal_connect_object ((GtkWidget*) _tmp27_, "button-press-event", (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self, 0);
	_tmp28_ = self->priv->adjust_tool_window;
	_tmp29_ = _tmp28_->shadows_slider;
	g_signal_connect_object ((GtkWidget*) _tmp29_, "button-press-event", (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self, 0);
	_tmp30_ = self->priv->adjust_tool_window;
	_tmp31_ = _tmp30_->highlights_slider;
	g_signal_connect_object ((GtkWidget*) _tmp31_, "button-press-event", (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self, 0);
}

static void
editing_tools_adjust_tool_unbind_window_handlers (EditingToolsAdjustTool* self)
{
	EditingToolsAdjustToolAdjustToolWindow* _tmp0_;
	GtkButton* _tmp1_;
	guint _tmp2_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp3_;
	GtkButton* _tmp4_;
	guint _tmp5_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp6_;
	GtkButton* _tmp7_;
	guint _tmp8_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp9_;
	GtkScale* _tmp10_;
	guint _tmp11_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp12_;
	GtkScale* _tmp13_;
	guint _tmp14_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp15_;
	GtkScale* _tmp16_;
	guint _tmp17_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp18_;
	GtkScale* _tmp19_;
	guint _tmp20_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp21_;
	GtkScale* _tmp22_;
	guint _tmp23_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp24_;
	GtkScale* _tmp25_;
	guint _tmp26_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp27_;
	RGBHistogramManipulator* _tmp28_;
	guint _tmp29_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp30_;
	GtkScale* _tmp31_;
	guint _tmp32_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp33_;
	GtkScale* _tmp34_;
	guint _tmp35_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp36_;
	GtkScale* _tmp37_;
	guint _tmp38_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp39_;
	GtkScale* _tmp40_;
	guint _tmp41_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp42_;
	GtkScale* _tmp43_;
	guint _tmp44_;
	EditingToolsAdjustToolAdjustToolWindow* _tmp45_;
	GtkScale* _tmp46_;
	guint _tmp47_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->adjust_tool_window;
	_tmp1_ = _tmp0_->ok_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp2_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_ok_gtk_button_clicked, self);
	_tmp3_ = self->priv->adjust_tool_window;
	_tmp4_ = _tmp3_->reset_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp5_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_reset_gtk_button_clicked, self);
	_tmp6_ = self->priv->adjust_tool_window;
	_tmp7_ = _tmp6_->cancel_button;
	g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp8_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp7_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp8_, 0, NULL, (GCallback) _editing_tools_editing_tool_notify_cancel_gtk_button_clicked, (EditingToolsEditingTool*) self);
	_tmp9_ = self->priv->adjust_tool_window;
	_tmp10_ = _tmp9_->exposure_slider;
	g_signal_parse_name ("value-changed", gtk_range_get_type (), &_tmp11_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkRange*) _tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_exposure_adjustment_gtk_range_value_changed, self);
	_tmp12_ = self->priv->adjust_tool_window;
	_tmp13_ = _tmp12_->saturation_slider;
	g_signal_parse_name ("value-changed", gtk_range_get_type (), &_tmp14_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkRange*) _tmp13_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_saturation_adjustment_gtk_range_value_changed, self);
	_tmp15_ = self->priv->adjust_tool_window;
	_tmp16_ = _tmp15_->tint_slider;
	g_signal_parse_name ("value-changed", gtk_range_get_type (), &_tmp17_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkRange*) _tmp16_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp17_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_tint_adjustment_gtk_range_value_changed, self);
	_tmp18_ = self->priv->adjust_tool_window;
	_tmp19_ = _tmp18_->temperature_slider;
	g_signal_parse_name ("value-changed", gtk_range_get_type (), &_tmp20_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkRange*) _tmp19_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp20_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_temperature_adjustment_gtk_range_value_changed, self);
	_tmp21_ = self->priv->adjust_tool_window;
	_tmp22_ = _tmp21_->shadows_slider;
	g_signal_parse_name ("value-changed", gtk_range_get_type (), &_tmp23_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkRange*) _tmp22_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp23_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_shadows_adjustment_gtk_range_value_changed, self);
	_tmp24_ = self->priv->adjust_tool_window;
	_tmp25_ = _tmp24_->highlights_slider;
	g_signal_parse_name ("value-changed", gtk_range_get_type (), &_tmp26_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkRange*) _tmp25_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp26_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_highlights_adjustment_gtk_range_value_changed, self);
	_tmp27_ = self->priv->adjust_tool_window;
	_tmp28_ = _tmp27_->histogram_manipulator;
	g_signal_parse_name ("nub-position-changed", TYPE_RGB_HISTOGRAM_MANIPULATOR, &_tmp29_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp28_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp29_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_histogram_constraint_rgb_histogram_manipulator_nub_position_changed, self);
	_tmp30_ = self->priv->adjust_tool_window;
	_tmp31_ = _tmp30_->saturation_slider;
	g_signal_parse_name ("button-press-event", gtk_widget_get_type (), &_tmp32_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp31_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp32_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self);
	_tmp33_ = self->priv->adjust_tool_window;
	_tmp34_ = _tmp33_->exposure_slider;
	g_signal_parse_name ("button-press-event", gtk_widget_get_type (), &_tmp35_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp34_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp35_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self);
	_tmp36_ = self->priv->adjust_tool_window;
	_tmp37_ = _tmp36_->tint_slider;
	g_signal_parse_name ("button-press-event", gtk_widget_get_type (), &_tmp38_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp37_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp38_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self);
	_tmp39_ = self->priv->adjust_tool_window;
	_tmp40_ = _tmp39_->temperature_slider;
	g_signal_parse_name ("button-press-event", gtk_widget_get_type (), &_tmp41_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp40_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp41_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self);
	_tmp42_ = self->priv->adjust_tool_window;
	_tmp43_ = _tmp42_->shadows_slider;
	g_signal_parse_name ("button-press-event", gtk_widget_get_type (), &_tmp44_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp43_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp44_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self);
	_tmp45_ = self->priv->adjust_tool_window;
	_tmp46_ = _tmp45_->highlights_slider;
	g_signal_parse_name ("button-press-event", gtk_widget_get_type (), &_tmp47_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp46_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp47_, 0, NULL, (GCallback) _editing_tools_adjust_tool_on_hscale_reset_gtk_widget_button_press_event, self);
}

gboolean
editing_tools_adjust_tool_enhance (EditingToolsAdjustTool* self)
{
	EditingToolsAdjustToolAdjustEnhanceCommand* command = NULL;
	EditingToolsPhotoCanvas* _tmp0_;
	Photo* _tmp1_;
	Photo* _tmp2_;
	EditingToolsAdjustToolAdjustEnhanceCommand* _tmp3_;
	CommandManager* _tmp4_;
	CommandManager* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp1_ = editing_tools_photo_canvas_get_photo (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = editing_tools_adjust_tool_adjust_enhance_command_new (self, _tmp2_);
	command = _tmp3_;
	_tmp4_ = app_window_get_command_manager ();
	_tmp5_ = _tmp4_;
	command_manager_execute (_tmp5_, (Command*) command);
	_command_manager_unref0 (_tmp5_);
	result = TRUE;
	_g_object_unref0 (command);
	return result;
}

static void
editing_tools_adjust_tool_on_photos_altered (EditingToolsAdjustTool* self,
                                             GeeMap* map)
{
	EditingToolsPhotoCanvas* _tmp0_;
	Photo* _tmp1_;
	Photo* _tmp2_;
	PixelTransformationBundle* adjustments = NULL;
	EditingToolsPhotoCanvas* _tmp3_;
	Photo* _tmp4_;
	Photo* _tmp5_;
	PixelTransformationBundle* _tmp6_;
	PixelTransformationBundle* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (map != NULL);
	_tmp0_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp1_ = editing_tools_photo_canvas_get_photo (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!gee_map_has_key (map, (DataObject*) _tmp2_)) {
		return;
	}
	_tmp3_ = ((EditingToolsEditingTool*) self)->canvas;
	_tmp4_ = editing_tools_photo_canvas_get_photo (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = photo_get_color_adjustments (_tmp5_);
	adjustments = _tmp6_;
	_tmp7_ = adjustments;
	editing_tools_adjust_tool_set_adjustments (self, _tmp7_);
	_pixel_transformation_bundle_unref0 (adjustments);
}

static void
editing_tools_adjust_tool_set_adjustments (EditingToolsAdjustTool* self,
                                           PixelTransformationBundle* new_adjustments)
{
	EditingToolsPhotoCanvas* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_adjustments != NULL);
	editing_tools_adjust_tool_unbind_window_handlers (self);
	editing_tools_adjust_tool_update_transformations (self, new_adjustments);
	{
		GeeIterator* _adjustment_it = NULL;
		GeeIterable* _tmp0_;
		GeeIterable* _tmp1_;
		GeeIterator* _tmp2_;
		GeeIterator* _tmp3_;
		_tmp0_ = pixel_transformation_bundle_get_transformations (new_adjustments);
		_tmp1_ = _tmp0_;
		_tmp2_ = gee_iterable_iterator (_tmp1_);
		_tmp3_ = _tmp2_;
		_g_object_unref0 (_tmp1_);
		_adjustment_it = _tmp3_;
		while (TRUE) {
			GeeIterator* _tmp4_;
			PixelTransformation* adjustment = NULL;
			GeeIterator* _tmp5_;
			gpointer _tmp6_;
			PixelTransformation* _tmp7_;
			_tmp4_ = _adjustment_it;
			if (!gee_iterator_next (_tmp4_)) {
				break;
			}
			_tmp5_ = _adjustment_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			adjustment = (PixelTransformation*) _tmp6_;
			_tmp7_ = adjustment;
			editing_tools_adjust_tool_update_slider (self, _tmp7_);
			_pixel_transformation_unref0 (adjustment);
		}
		_g_object_unref0 (_adjustment_it);
	}
	editing_tools_adjust_tool_bind_window_handlers (self);
	_tmp8_ = ((EditingToolsEditingTool*) self)->canvas;
	editing_tools_photo_canvas_repaint (_tmp8_);
}

static gpointer
_pixel_transformation_ref0 (gpointer self)
{
	return self ? pixel_transformation_ref (self) : NULL;
}

static void
editing_tools_adjust_tool_update_slider (EditingToolsAdjustTool* self,
                                         PixelTransformation* transformation)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (transformation != NULL);
	switch (pixel_transformation_get_transformation_type (transformation)) {
		case PIXEL_TRANSFORMATION_TYPE_TONE_EXPANSION:
		{
			ExpansionTransformation* expansion = NULL;
			ExpansionTransformation* _tmp0_;
			_tmp0_ = _pixel_transformation_ref0 (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_EXPANSION_TRANSFORMATION, ExpansionTransformation));
			expansion = _tmp0_;
			if (!self->priv->disable_histogram_refresh) {
				EditingToolsAdjustToolAdjustToolWindow* _tmp1_;
				RGBHistogramManipulator* _tmp2_;
				ExpansionTransformation* _tmp3_;
				EditingToolsAdjustToolAdjustToolWindow* _tmp4_;
				RGBHistogramManipulator* _tmp5_;
				ExpansionTransformation* _tmp6_;
				_tmp1_ = self->priv->adjust_tool_window;
				_tmp2_ = _tmp1_->histogram_manipulator;
				_tmp3_ = expansion;
				rgb_histogram_manipulator_set_left_nub_position (_tmp2_, expansion_transformation_get_black_point (_tmp3_));
				_tmp4_ = self->priv->adjust_tool_window;
				_tmp5_ = _tmp4_->histogram_manipulator;
				_tmp6_ = expansion;
				rgb_histogram_manipulator_set_right_nub_position (_tmp5_, expansion_transformation_get_white_point (_tmp6_));
			}
			_pixel_transformation_unref0 (expansion);
			break;
		}
		case PIXEL_TRANSFORMATION_TYPE_SHADOWS:
		{
			EditingToolsAdjustToolAdjustToolWindow* _tmp7_;
			GtkScale* _tmp8_;
			_tmp7_ = self->priv->adjust_tool_window;
			_tmp8_ = _tmp7_->shadows_slider;
			gtk_range_set_value ((GtkRange*) _tmp8_, (gdouble) shadow_detail_transformation_get_parameter (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_SHADOW_DETAIL_TRANSFORMATION, ShadowDetailTransformation)));
			break;
		}
		case PIXEL_TRANSFORMATION_TYPE_HIGHLIGHTS:
		{
			EditingToolsAdjustToolAdjustToolWindow* _tmp9_;
			GtkScale* _tmp10_;
			_tmp9_ = self->priv->adjust_tool_window;
			_tmp10_ = _tmp9_->highlights_slider;
			gtk_range_set_value ((GtkRange*) _tmp10_, (gdouble) highlight_detail_transformation_get_parameter (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_HIGHLIGHT_DETAIL_TRANSFORMATION, HighlightDetailTransformation)));
			break;
		}
		case PIXEL_TRANSFORMATION_TYPE_EXPOSURE:
		{
			EditingToolsAdjustToolAdjustToolWindow* _tmp11_;
			GtkScale* _tmp12_;
			_tmp11_ = self->priv->adjust_tool_window;
			_tmp12_ = _tmp11_->exposure_slider;
			gtk_range_set_value ((GtkRange*) _tmp12_, (gdouble) exposure_transformation_get_parameter (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_EXPOSURE_TRANSFORMATION, ExposureTransformation)));
			break;
		}
		case PIXEL_TRANSFORMATION_TYPE_SATURATION:
		{
			EditingToolsAdjustToolAdjustToolWindow* _tmp13_;
			GtkScale* _tmp14_;
			_tmp13_ = self->priv->adjust_tool_window;
			_tmp14_ = _tmp13_->saturation_slider;
			gtk_range_set_value ((GtkRange*) _tmp14_, (gdouble) saturation_transformation_get_parameter (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_SATURATION_TRANSFORMATION, SaturationTransformation)));
			break;
		}
		case PIXEL_TRANSFORMATION_TYPE_TINT:
		{
			EditingToolsAdjustToolAdjustToolWindow* _tmp15_;
			GtkScale* _tmp16_;
			_tmp15_ = self->priv->adjust_tool_window;
			_tmp16_ = _tmp15_->tint_slider;
			gtk_range_set_value ((GtkRange*) _tmp16_, (gdouble) tint_transformation_get_parameter (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_TINT_TRANSFORMATION, TintTransformation)));
			break;
		}
		case PIXEL_TRANSFORMATION_TYPE_TEMPERATURE:
		{
			EditingToolsAdjustToolAdjustToolWindow* _tmp17_;
			GtkScale* _tmp18_;
			_tmp17_ = self->priv->adjust_tool_window;
			_tmp18_ = _tmp17_->temperature_slider;
			gtk_range_set_value ((GtkRange*) _tmp18_, (gdouble) temperature_transformation_get_parameter (G_TYPE_CHECK_INSTANCE_CAST (transformation, TYPE_TEMPERATURE_TRANSFORMATION, TemperatureTransformation)));
			break;
		}
		default:
		{
			g_error ("AdjustTool.vala:812: Unknown adjustment: %d", (gint) pixel_transformation_get_transformation_type (transformation));
		}
	}
}

static void
editing_tools_adjust_tool_init_fp_pixel_cache (EditingToolsAdjustTool* self,
                                               GdkPixbuf* source)
{
	gint source_width = 0;
	gint source_height = 0;
	gint source_num_channels = 0;
	gint source_rowstride = 0;
	guchar* source_pixels = NULL;
	guint8* _tmp0_;
	gint source_pixels_length1;
	gint _source_pixels_size_;
	gfloat* _tmp1_;
	gint cache_pixel_index = 0;
	gfloat inv_255 = 0.0F;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	source_width = gdk_pixbuf_get_width (source);
	source_height = gdk_pixbuf_get_height (source);
	source_num_channels = gdk_pixbuf_get_n_channels (source);
	source_rowstride = gdk_pixbuf_get_rowstride (source);
	_tmp0_ = gdk_pixbuf_get_pixels (source);
	source_pixels = _tmp0_;
	source_pixels_length1 = -1;
	_source_pixels_size_ = source_pixels_length1;
	_tmp1_ = g_new0 (gfloat, (3 * source_width) * source_height);
	self->priv->fp_pixel_cache = (g_free (self->priv->fp_pixel_cache), NULL);
	self->priv->fp_pixel_cache = _tmp1_;
	self->priv->fp_pixel_cache_length1 = (3 * source_width) * source_height;
	self->priv->_fp_pixel_cache_size_ = self->priv->fp_pixel_cache_length1;
	cache_pixel_index = 0;
	inv_255 = 1.0f / 255.0f;
	{
		gint j = 0;
		j = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gint row_start_index = 0;
				gint row_end_index = 0;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = j;
					j = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(j < source_height)) {
					break;
				}
				row_start_index = j * source_rowstride;
				row_end_index = row_start_index + (source_width * source_num_channels);
				{
					gint i = 0;
					i = row_start_index;
					{
						gboolean _tmp4_ = FALSE;
						_tmp4_ = TRUE;
						while (TRUE) {
							gfloat* _tmp5_;
							gint _tmp5__length1;
							gint _tmp6_;
							guchar* _tmp7_;
							gint _tmp7__length1;
							guchar _tmp8_;
							gfloat _tmp9_;
							gfloat* _tmp10_;
							gint _tmp10__length1;
							gint _tmp11_;
							guchar* _tmp12_;
							gint _tmp12__length1;
							gint _tmp13_;
							guchar _tmp14_;
							gfloat _tmp15_;
							gfloat* _tmp16_;
							gint _tmp16__length1;
							gint _tmp17_;
							guchar* _tmp18_;
							gint _tmp18__length1;
							gint _tmp19_;
							guchar _tmp20_;
							gfloat _tmp21_;
							if (!_tmp4_) {
								i += source_num_channels;
							}
							_tmp4_ = FALSE;
							if (!(i < row_end_index)) {
								break;
							}
							_tmp5_ = self->priv->fp_pixel_cache;
							_tmp5__length1 = self->priv->fp_pixel_cache_length1;
							_tmp6_ = cache_pixel_index;
							cache_pixel_index = _tmp6_ + 1;
							_tmp7_ = source_pixels;
							_tmp7__length1 = source_pixels_length1;
							_tmp8_ = _tmp7_[i];
							_tmp9_ = inv_255;
							_tmp5_[_tmp6_] = ((gfloat) _tmp8_) * _tmp9_;
							_tmp10_ = self->priv->fp_pixel_cache;
							_tmp10__length1 = self->priv->fp_pixel_cache_length1;
							_tmp11_ = cache_pixel_index;
							cache_pixel_index = _tmp11_ + 1;
							_tmp12_ = source_pixels;
							_tmp12__length1 = source_pixels_length1;
							_tmp13_ = i;
							_tmp14_ = _tmp12_[_tmp13_ + 1];
							_tmp15_ = inv_255;
							_tmp10_[_tmp11_] = ((gfloat) _tmp14_) * _tmp15_;
							_tmp16_ = self->priv->fp_pixel_cache;
							_tmp16__length1 = self->priv->fp_pixel_cache_length1;
							_tmp17_ = cache_pixel_index;
							cache_pixel_index = _tmp17_ + 1;
							_tmp18_ = source_pixels;
							_tmp18__length1 = source_pixels_length1;
							_tmp19_ = i;
							_tmp20_ = _tmp18_[_tmp19_ + 2];
							_tmp21_ = inv_255;
							_tmp16_[_tmp17_] = ((gfloat) _tmp20_) * _tmp21_;
						}
					}
				}
			}
		}
	}
}

static gboolean
editing_tools_adjust_tool_real_on_keypress (EditingToolsEditingTool* base,
                                            GdkEventKey* event)
{
	EditingToolsAdjustTool * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gboolean result;
	self = (EditingToolsAdjustTool*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp2_ = gdk_keyval_name (event->keyval);
	if (g_strcmp0 (_tmp2_, "KP_Enter") == 0) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = gdk_keyval_name (event->keyval);
		_tmp1_ = g_strcmp0 (_tmp3_, "Enter") == 0;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = gdk_keyval_name (event->keyval);
		_tmp0_ = g_strcmp0 (_tmp4_, "Return") == 0;
	}
	if (_tmp0_) {
		editing_tools_adjust_tool_on_ok (self);
		result = TRUE;
		return result;
	}
	result = EDITING_TOOLS_EDITING_TOOL_CLASS (editing_tools_adjust_tool_parent_class)->on_keypress (G_TYPE_CHECK_INSTANCE_CAST (self, EDITING_TOOLS_TYPE_EDITING_TOOL, EditingToolsEditingTool), event);
	return result;
}

static EditingToolsAdjustToolAdjustToolWindow*
editing_tools_adjust_tool_adjust_tool_window_construct (GType object_type,
                                                        GtkWindow* container)
{
	EditingToolsAdjustToolAdjustToolWindow * self = NULL;
	g_return_val_if_fail (container != NULL, NULL);
	self = (EditingToolsAdjustToolAdjustToolWindow*) g_object_new (object_type, "transient-for", container, NULL);
	return self;
}

static EditingToolsAdjustToolAdjustToolWindow*
editing_tools_adjust_tool_adjust_tool_window_new (GtkWindow* container)
{
	return editing_tools_adjust_tool_adjust_tool_window_construct (EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW, container);
}

static GObject *
editing_tools_adjust_tool_adjust_tool_window_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EditingToolsAdjustToolAdjustToolWindow * self;
	RGBHistogramManipulator* _tmp0_;
	GtkLabel* exposure_label = NULL;
	GtkLabel* _tmp1_ = NULL;
	GtkScale* _tmp2_ = NULL;
	GtkLabel* saturation_label = NULL;
	GtkLabel* _tmp3_ = NULL;
	GtkScale* _tmp4_ = NULL;
	GtkLabel* tint_label = NULL;
	GtkLabel* _tmp5_ = NULL;
	GtkScale* _tmp6_ = NULL;
	GtkScale* _tmp7_;
	GtkStyleContext* _tmp8_;
	GtkLabel* temperature_label = NULL;
	GtkLabel* _tmp9_ = NULL;
	GtkScale* _tmp10_ = NULL;
	GtkScale* _tmp11_;
	GtkStyleContext* _tmp12_;
	GtkLabel* shadows_label = NULL;
	GtkLabel* _tmp13_ = NULL;
	GtkScale* _tmp14_ = NULL;
	GtkLabel* highlights_label = NULL;
	GtkLabel* _tmp15_ = NULL;
	GtkScale* _tmp16_ = NULL;
	GtkButton* _tmp17_;
	GtkButton* _tmp18_;
	GtkButton* _tmp19_;
	GtkButtonBox* button_box = NULL;
	GtkButtonBox* _tmp20_ = NULL;
	GtkButtonBox* _tmp21_;
	GtkButton* _tmp22_;
	GtkButtonBox* _tmp23_;
	GtkButton* _tmp24_;
	GtkButtonBox* _tmp25_;
	GtkButton* _tmp26_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp27_ = NULL;
	GtkGrid* _tmp28_;
	RGBHistogramManipulator* _tmp29_;
	GtkGrid* _tmp30_;
	GtkLabel* _tmp31_;
	GtkGrid* _tmp32_;
	GtkScale* _tmp33_;
	GtkGrid* _tmp34_;
	GtkLabel* _tmp35_;
	GtkGrid* _tmp36_;
	GtkScale* _tmp37_;
	GtkGrid* _tmp38_;
	GtkLabel* _tmp39_;
	GtkGrid* _tmp40_;
	GtkScale* _tmp41_;
	GtkGrid* _tmp42_;
	GtkLabel* _tmp43_;
	GtkGrid* _tmp44_;
	GtkScale* _tmp45_;
	GtkGrid* _tmp46_;
	GtkLabel* _tmp47_;
	GtkGrid* _tmp48_;
	GtkScale* _tmp49_;
	GtkGrid* _tmp50_;
	GtkLabel* _tmp51_;
	GtkGrid* _tmp52_;
	GtkScale* _tmp53_;
	GtkGrid* _tmp54_;
	GtkButtonBox* _tmp55_;
	GtkGrid* _tmp56_;
	GtkGrid* _tmp57_;
	GtkGrid* _tmp58_;
	parent_class = G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_tool_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW, EditingToolsAdjustToolAdjustToolWindow);
	_tmp0_ = rgb_histogram_manipulator_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->histogram_manipulator);
	self->histogram_manipulator = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (_ ("Exposure:"));
	gtk_widget_set_halign ((GtkWidget*) _tmp1_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp1_);
	exposure_label = _tmp1_;
	_tmp2_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) EXPOSURE_TRANSFORMATION_MIN_PARAMETER, (gdouble) EXPOSURE_TRANSFORMATION_MAX_PARAMETER, 1.0);
	gtk_scale_set_draw_value (_tmp2_, FALSE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->exposure_slider);
	self->exposure_slider = _tmp2_;
	_tmp3_ = (GtkLabel*) gtk_label_new (_ ("Saturation:"));
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp3_);
	saturation_label = _tmp3_;
	_tmp4_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) SATURATION_TRANSFORMATION_MIN_PARAMETER, (gdouble) SATURATION_TRANSFORMATION_MAX_PARAMETER, 1.0);
	gtk_scale_set_draw_value (_tmp4_, FALSE);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->saturation_slider);
	self->saturation_slider = _tmp4_;
	_tmp5_ = (GtkLabel*) gtk_label_new (_ ("Tint:"));
	gtk_widget_set_halign ((GtkWidget*) _tmp5_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp5_);
	tint_label = _tmp5_;
	_tmp6_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) TINT_TRANSFORMATION_MIN_PARAMETER, (gdouble) TINT_TRANSFORMATION_MAX_PARAMETER, 1.0);
	gtk_scale_set_draw_value (_tmp6_, FALSE);
	gtk_scale_set_has_origin (_tmp6_, FALSE);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->tint_slider);
	self->tint_slider = _tmp6_;
	_tmp7_ = self->tint_slider;
	_tmp8_ = gtk_widget_get_style_context ((GtkWidget*) _tmp7_);
	gtk_style_context_add_class (_tmp8_, "tint");
	_tmp9_ = (GtkLabel*) gtk_label_new (_ ("Temperature:"));
	gtk_widget_set_halign ((GtkWidget*) _tmp9_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp9_);
	temperature_label = _tmp9_;
	_tmp10_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) TEMPERATURE_TRANSFORMATION_MIN_PARAMETER, (gdouble) TEMPERATURE_TRANSFORMATION_MAX_PARAMETER, 1.0);
	gtk_scale_set_draw_value (_tmp10_, FALSE);
	gtk_scale_set_has_origin (_tmp10_, FALSE);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->temperature_slider);
	self->temperature_slider = _tmp10_;
	_tmp11_ = self->temperature_slider;
	_tmp12_ = gtk_widget_get_style_context ((GtkWidget*) _tmp11_);
	gtk_style_context_add_class (_tmp12_, "temperature");
	_tmp13_ = (GtkLabel*) gtk_label_new (_ ("Shadows:"));
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp13_);
	shadows_label = _tmp13_;
	_tmp14_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) SHADOW_DETAIL_TRANSFORMATION_MIN_PARAMETER, (gdouble) SHADOW_DETAIL_TRANSFORMATION_MAX_PARAMETER, 1.0);
	gtk_scale_set_draw_value (_tmp14_, FALSE);
	g_object_ref_sink (_tmp14_);
	_g_object_unref0 (self->shadows_slider);
	self->shadows_slider = _tmp14_;
	_tmp15_ = (GtkLabel*) gtk_label_new (_ ("Highlights:"));
	gtk_widget_set_halign ((GtkWidget*) _tmp15_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp15_);
	highlights_label = _tmp15_;
	_tmp16_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) HIGHLIGHT_DETAIL_TRANSFORMATION_MIN_PARAMETER, (gdouble) HIGHLIGHT_DETAIL_TRANSFORMATION_MAX_PARAMETER, 1.0);
	gtk_scale_set_draw_value (_tmp16_, FALSE);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->highlights_slider);
	self->highlights_slider = _tmp16_;
	_tmp17_ = (GtkButton*) gtk_button_new_with_mnemonic (_ ("_Apply"));
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->ok_button);
	self->ok_button = _tmp17_;
	_tmp18_ = (GtkButton*) gtk_button_new_with_mnemonic (_ ("_Reset"));
	g_object_ref_sink (_tmp18_);
	_g_object_unref0 (self->reset_button);
	self->reset_button = _tmp18_;
	_tmp19_ = (GtkButton*) gtk_button_new_with_mnemonic (_ ("_Cancel"));
	g_object_ref_sink (_tmp19_);
	_g_object_unref0 (self->cancel_button);
	self->cancel_button = _tmp19_;
	_tmp20_ = (GtkButtonBox*) gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp20_, 12);
	g_object_ref_sink (_tmp20_);
	button_box = _tmp20_;
	_tmp21_ = button_box;
	_tmp22_ = self->reset_button;
	gtk_container_add ((GtkContainer*) _tmp21_, (GtkWidget*) _tmp22_);
	_tmp23_ = button_box;
	_tmp24_ = self->cancel_button;
	gtk_container_add ((GtkContainer*) _tmp23_, (GtkWidget*) _tmp24_);
	_tmp25_ = button_box;
	_tmp26_ = self->ok_button;
	gtk_container_add ((GtkContainer*) _tmp25_, (GtkWidget*) _tmp26_);
	_tmp27_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp27_, 12);
	gtk_grid_set_row_spacing (_tmp27_, 12);
	g_object_ref_sink (_tmp27_);
	grid = _tmp27_;
	_tmp28_ = grid;
	_tmp29_ = self->histogram_manipulator;
	gtk_grid_attach (_tmp28_, (GtkWidget*) _tmp29_, 0, 0, 2, 1);
	_tmp30_ = grid;
	_tmp31_ = exposure_label;
	gtk_grid_attach (_tmp30_, (GtkWidget*) _tmp31_, 0, 1, 1, 1);
	_tmp32_ = grid;
	_tmp33_ = self->exposure_slider;
	gtk_grid_attach (_tmp32_, (GtkWidget*) _tmp33_, 1, 1, 1, 1);
	_tmp34_ = grid;
	_tmp35_ = saturation_label;
	gtk_grid_attach (_tmp34_, (GtkWidget*) _tmp35_, 0, 2, 1, 1);
	_tmp36_ = grid;
	_tmp37_ = self->saturation_slider;
	gtk_grid_attach (_tmp36_, (GtkWidget*) _tmp37_, 1, 2, 1, 1);
	_tmp38_ = grid;
	_tmp39_ = tint_label;
	gtk_grid_attach (_tmp38_, (GtkWidget*) _tmp39_, 0, 3, 1, 1);
	_tmp40_ = grid;
	_tmp41_ = self->tint_slider;
	gtk_grid_attach (_tmp40_, (GtkWidget*) _tmp41_, 1, 3, 1, 1);
	_tmp42_ = grid;
	_tmp43_ = temperature_label;
	gtk_grid_attach (_tmp42_, (GtkWidget*) _tmp43_, 0, 4, 1, 1);
	_tmp44_ = grid;
	_tmp45_ = self->temperature_slider;
	gtk_grid_attach (_tmp44_, (GtkWidget*) _tmp45_, 1, 4, 1, 1);
	_tmp46_ = grid;
	_tmp47_ = shadows_label;
	gtk_grid_attach (_tmp46_, (GtkWidget*) _tmp47_, 0, 5, 1, 1);
	_tmp48_ = grid;
	_tmp49_ = self->shadows_slider;
	gtk_grid_attach (_tmp48_, (GtkWidget*) _tmp49_, 1, 5, 1, 1);
	_tmp50_ = grid;
	_tmp51_ = highlights_label;
	gtk_grid_attach (_tmp50_, (GtkWidget*) _tmp51_, 0, 6, 1, 1);
	_tmp52_ = grid;
	_tmp53_ = self->highlights_slider;
	gtk_grid_attach (_tmp52_, (GtkWidget*) _tmp53_, 1, 6, 1, 1);
	_tmp54_ = grid;
	_tmp55_ = button_box;
	gtk_grid_attach (_tmp54_, (GtkWidget*) _tmp55_, 0, 7, 2, 1);
	_tmp56_ = editing_tools_editing_tool_window_get_content_area ((EditingToolsEditingToolWindow*) self);
	_tmp57_ = _tmp56_;
	_tmp58_ = grid;
	gtk_container_add ((GtkContainer*) _tmp57_, (GtkWidget*) _tmp58_);
	_g_object_unref0 (grid);
	_g_object_unref0 (button_box);
	_g_object_unref0 (highlights_label);
	_g_object_unref0 (shadows_label);
	_g_object_unref0 (temperature_label);
	_g_object_unref0 (tint_label);
	_g_object_unref0 (saturation_label);
	_g_object_unref0 (exposure_label);
	return obj;
}

static void
editing_tools_adjust_tool_adjust_tool_window_class_init (EditingToolsAdjustToolAdjustToolWindowClass * klass,
                                                         gpointer klass_data)
{
	editing_tools_adjust_tool_adjust_tool_window_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = editing_tools_adjust_tool_adjust_tool_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_adjust_tool_adjust_tool_window_finalize;
}

static void
editing_tools_adjust_tool_adjust_tool_window_instance_init (EditingToolsAdjustToolAdjustToolWindow * self,
                                                            gpointer klass)
{
}

static void
editing_tools_adjust_tool_adjust_tool_window_finalize (GObject * obj)
{
	EditingToolsAdjustToolAdjustToolWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_WINDOW, EditingToolsAdjustToolAdjustToolWindow);
	_g_object_unref0 (self->ok_button);
	_g_object_unref0 (self->reset_button);
	_g_object_unref0 (self->cancel_button);
	_g_object_unref0 (self->exposure_slider);
	_g_object_unref0 (self->saturation_slider);
	_g_object_unref0 (self->tint_slider);
	_g_object_unref0 (self->temperature_slider);
	_g_object_unref0 (self->shadows_slider);
	_g_object_unref0 (self->highlights_slider);
	_g_object_unref0 (self->histogram_manipulator);
	G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_tool_window_parent_class)->finalize (obj);
}

static GType
editing_tools_adjust_tool_adjust_tool_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsAdjustToolAdjustToolWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_adjust_tool_adjust_tool_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsAdjustToolAdjustToolWindow), 0, (GInstanceInitFunc) editing_tools_adjust_tool_adjust_tool_window_instance_init, NULL };
	GType editing_tools_adjust_tool_adjust_tool_window_type_id;
	editing_tools_adjust_tool_adjust_tool_window_type_id = g_type_register_static (EDITING_TOOLS_TYPE_EDITING_TOOL_WINDOW, "EditingToolsAdjustToolAdjustToolWindow", &g_define_type_info, 0);
	return editing_tools_adjust_tool_adjust_tool_window_type_id;
}

static GType
editing_tools_adjust_tool_adjust_tool_window_get_type (void)
{
	static volatile gsize editing_tools_adjust_tool_adjust_tool_window_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_adjust_tool_adjust_tool_window_type_id__once)) {
		GType editing_tools_adjust_tool_adjust_tool_window_type_id;
		editing_tools_adjust_tool_adjust_tool_window_type_id = editing_tools_adjust_tool_adjust_tool_window_get_type_once ();
		g_once_init_leave (&editing_tools_adjust_tool_adjust_tool_window_type_id__once, editing_tools_adjust_tool_adjust_tool_window_type_id);
	}
	return editing_tools_adjust_tool_adjust_tool_window_type_id__once;
}

static inline gpointer
editing_tools_adjust_tool_adjust_tool_command_get_instance_private (EditingToolsAdjustToolAdjustToolCommand* self)
{
	return G_STRUCT_MEMBER_P (self, EditingToolsAdjustToolAdjustToolCommand_private_offset);
}

static void
_editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated_editing_tools_editing_tool_deactivated (EditingToolsEditingTool* _sender,
                                                                                                            gpointer self)
{
	editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated ((EditingToolsAdjustToolAdjustToolCommand*) self);
}

static EditingToolsAdjustToolAdjustToolCommand*
editing_tools_adjust_tool_adjust_tool_command_construct (GType object_type,
                                                         EditingToolsAdjustTool* owner,
                                                         const gchar* name,
                                                         const gchar* explanation)
{
	EditingToolsAdjustToolAdjustToolCommand * self = NULL;
	g_return_val_if_fail (owner != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (explanation != NULL, NULL);
	self = (EditingToolsAdjustToolAdjustToolCommand*) g_object_new (object_type, "name", name, "explanation", explanation, "owner", owner, NULL);
	return self;
}

static void
editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated (EditingToolsAdjustToolAdjustToolCommand* self)
{
	CommandManager* _tmp0_;
	CommandManager* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = app_window_get_command_manager ();
	_tmp1_ = _tmp0_;
	command_manager_reset (_tmp1_);
	_command_manager_unref0 (_tmp1_);
}

static EditingToolsAdjustTool*
editing_tools_adjust_tool_adjust_tool_command_get_owner (EditingToolsAdjustToolAdjustToolCommand* self)
{
	EditingToolsAdjustTool* result;
	EditingToolsAdjustTool* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_owner;
	result = _tmp0_;
	return result;
}

static void
editing_tools_adjust_tool_adjust_tool_command_set_owner (EditingToolsAdjustToolAdjustToolCommand* self,
                                                         EditingToolsAdjustTool* value)
{
	EditingToolsAdjustTool* old_value;
	g_return_if_fail (self != NULL);
	old_value = editing_tools_adjust_tool_adjust_tool_command_get_owner (self);
	if (old_value != value) {
		self->priv->_owner = value;
		g_object_notify_by_pspec ((GObject *) self, editing_tools_adjust_tool_adjust_tool_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_OWNER_PROPERTY]);
	}
}

static GObject *
editing_tools_adjust_tool_adjust_tool_command_constructor (GType type,
                                                           guint n_construct_properties,
                                                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EditingToolsAdjustToolAdjustToolCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	parent_class = G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_tool_command_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommand);
	_tmp0_ = self->priv->_owner;
	g_signal_connect_object ((EditingToolsEditingTool*) _tmp0_, "deactivated", (GCallback) _editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated_editing_tools_editing_tool_deactivated, self, 0);
	return obj;
}

static void
editing_tools_adjust_tool_adjust_tool_command_class_init (EditingToolsAdjustToolAdjustToolCommandClass * klass,
                                                          gpointer klass_data)
{
	editing_tools_adjust_tool_adjust_tool_command_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EditingToolsAdjustToolAdjustToolCommand_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_editing_tools_adjust_tool_adjust_tool_command_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_editing_tools_adjust_tool_adjust_tool_command_set_property;
	G_OBJECT_CLASS (klass)->constructor = editing_tools_adjust_tool_adjust_tool_command_constructor;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_adjust_tool_adjust_tool_command_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_OWNER_PROPERTY, editing_tools_adjust_tool_adjust_tool_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_OWNER_PROPERTY] = g_param_spec_object ("owner", "owner", "owner", EDITING_TOOLS_TYPE_ADJUST_TOOL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
editing_tools_adjust_tool_adjust_tool_command_instance_init (EditingToolsAdjustToolAdjustToolCommand * self,
                                                             gpointer klass)
{
	self->priv = editing_tools_adjust_tool_adjust_tool_command_get_instance_private (self);
}

static void
editing_tools_adjust_tool_adjust_tool_command_finalize (GObject * obj)
{
	EditingToolsAdjustToolAdjustToolCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommand);
	_tmp0_ = self->priv->_owner;
	if (_tmp0_ != NULL) {
		EditingToolsAdjustTool* _tmp1_;
		guint _tmp2_;
		_tmp1_ = self->priv->_owner;
		g_signal_parse_name ("deactivated", EDITING_TOOLS_TYPE_EDITING_TOOL, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched ((EditingToolsEditingTool*) _tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _editing_tools_adjust_tool_adjust_tool_command_on_owner_deactivated_editing_tools_editing_tool_deactivated, self);
	}
	G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_tool_command_parent_class)->finalize (obj);
}

static GType
editing_tools_adjust_tool_adjust_tool_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsAdjustToolAdjustToolCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_adjust_tool_adjust_tool_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsAdjustToolAdjustToolCommand), 0, (GInstanceInitFunc) editing_tools_adjust_tool_adjust_tool_command_instance_init, NULL };
	GType editing_tools_adjust_tool_adjust_tool_command_type_id;
	editing_tools_adjust_tool_adjust_tool_command_type_id = g_type_register_static (TYPE_COMMAND, "EditingToolsAdjustToolAdjustToolCommand", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	EditingToolsAdjustToolAdjustToolCommand_private_offset = g_type_add_instance_private (editing_tools_adjust_tool_adjust_tool_command_type_id, sizeof (EditingToolsAdjustToolAdjustToolCommandPrivate));
	return editing_tools_adjust_tool_adjust_tool_command_type_id;
}

static GType
editing_tools_adjust_tool_adjust_tool_command_get_type (void)
{
	static volatile gsize editing_tools_adjust_tool_adjust_tool_command_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_adjust_tool_adjust_tool_command_type_id__once)) {
		GType editing_tools_adjust_tool_adjust_tool_command_type_id;
		editing_tools_adjust_tool_adjust_tool_command_type_id = editing_tools_adjust_tool_adjust_tool_command_get_type_once ();
		g_once_init_leave (&editing_tools_adjust_tool_adjust_tool_command_type_id__once, editing_tools_adjust_tool_adjust_tool_command_type_id);
	}
	return editing_tools_adjust_tool_adjust_tool_command_type_id__once;
}

static void
_vala_editing_tools_adjust_tool_adjust_tool_command_get_property (GObject * object,
                                                                  guint property_id,
                                                                  GValue * value,
                                                                  GParamSpec * pspec)
{
	EditingToolsAdjustToolAdjustToolCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_OWNER_PROPERTY:
		g_value_set_object (value, editing_tools_adjust_tool_adjust_tool_command_get_owner (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_editing_tools_adjust_tool_adjust_tool_command_set_property (GObject * object,
                                                                  guint property_id,
                                                                  const GValue * value,
                                                                  GParamSpec * pspec)
{
	EditingToolsAdjustToolAdjustToolCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, EditingToolsAdjustToolAdjustToolCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_ADJUST_TOOL_COMMAND_OWNER_PROPERTY:
		editing_tools_adjust_tool_adjust_tool_command_set_owner (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
editing_tools_adjust_tool_adjust_reset_command_get_instance_private (EditingToolsAdjustToolAdjustResetCommand* self)
{
	return G_STRUCT_MEMBER_P (self, EditingToolsAdjustToolAdjustResetCommand_private_offset);
}

static EditingToolsAdjustToolAdjustResetCommand*
editing_tools_adjust_tool_adjust_reset_command_construct (GType object_type,
                                                          EditingToolsAdjustTool* owner,
                                                          PixelTransformationBundle* current)
{
	EditingToolsAdjustToolAdjustResetCommand * self = NULL;
	PixelTransformationBundle* _tmp0_;
	PixelTransformationBundle* _tmp1_;
	g_return_val_if_fail (owner != NULL, NULL);
	g_return_val_if_fail (current != NULL, NULL);
	_tmp0_ = pixel_transformation_bundle_copy (current);
	_tmp1_ = _tmp0_;
	self = (EditingToolsAdjustToolAdjustResetCommand*) g_object_new (object_type, "name", _ ("Reset Colors"), "explanation", _ ("Reset all color adjustments to original"), "owner", owner, "original", _tmp1_, NULL);
	_pixel_transformation_bundle_unref0 (_tmp1_);
	return self;
}

static EditingToolsAdjustToolAdjustResetCommand*
editing_tools_adjust_tool_adjust_reset_command_new (EditingToolsAdjustTool* owner,
                                                    PixelTransformationBundle* current)
{
	return editing_tools_adjust_tool_adjust_reset_command_construct (EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, owner, current);
}

static void
editing_tools_adjust_tool_adjust_reset_command_real_execute (Command* base)
{
	EditingToolsAdjustToolAdjustResetCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* _tmp1_;
	PixelTransformationBundle* _tmp2_;
	self = (EditingToolsAdjustToolAdjustResetCommand*) base;
	_tmp0_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->reset;
	editing_tools_adjust_tool_set_adjustments (_tmp1_, _tmp2_);
}

static void
editing_tools_adjust_tool_adjust_reset_command_real_undo (Command* base)
{
	EditingToolsAdjustToolAdjustResetCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* _tmp1_;
	PixelTransformationBundle* _tmp2_;
	self = (EditingToolsAdjustToolAdjustResetCommand*) base;
	_tmp0_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_original;
	editing_tools_adjust_tool_set_adjustments (_tmp1_, _tmp2_);
}

static gboolean
editing_tools_adjust_tool_adjust_reset_command_real_compress (Command* base,
                                                              Command* command)
{
	EditingToolsAdjustToolAdjustResetCommand * self;
	gboolean result;
	self = (EditingToolsAdjustToolAdjustResetCommand*) base;
	g_return_val_if_fail (command != NULL, FALSE);
	if (EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_RESET_COMMAND (command)) {
		EditingToolsAdjustToolAdjustResetCommand* reset_command = NULL;
		EditingToolsAdjustToolAdjustResetCommand* _tmp0_;
		EditingToolsAdjustToolAdjustResetCommand* _tmp1_;
		EditingToolsAdjustTool* _tmp2_;
		EditingToolsAdjustTool* _tmp3_;
		EditingToolsAdjustTool* _tmp4_;
		EditingToolsAdjustTool* _tmp5_;
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (command, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommand));
		reset_command = _tmp0_;
		_tmp1_ = reset_command;
		_tmp2_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
		_tmp5_ = _tmp4_;
		if (_tmp3_ != _tmp5_) {
			result = FALSE;
			_g_object_unref0 (reset_command);
			return result;
		}
		result = TRUE;
		_g_object_unref0 (reset_command);
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static PixelTransformationBundle*
editing_tools_adjust_tool_adjust_reset_command_get_original (EditingToolsAdjustToolAdjustResetCommand* self)
{
	PixelTransformationBundle* result;
	PixelTransformationBundle* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_original;
	result = _tmp0_;
	return result;
}

static gpointer
_pixel_transformation_bundle_ref0 (gpointer self)
{
	return self ? pixel_transformation_bundle_ref (self) : NULL;
}

static void
editing_tools_adjust_tool_adjust_reset_command_set_original (EditingToolsAdjustToolAdjustResetCommand* self,
                                                             PixelTransformationBundle* value)
{
	PixelTransformationBundle* old_value;
	g_return_if_fail (self != NULL);
	old_value = editing_tools_adjust_tool_adjust_reset_command_get_original (self);
	if (old_value != value) {
		PixelTransformationBundle* _tmp0_;
		_tmp0_ = _pixel_transformation_bundle_ref0 (value);
		_pixel_transformation_bundle_unref0 (self->priv->_original);
		self->priv->_original = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, editing_tools_adjust_tool_adjust_reset_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_ORIGINAL_PROPERTY]);
	}
}

static GObject *
editing_tools_adjust_tool_adjust_reset_command_constructor (GType type,
                                                            guint n_construct_properties,
                                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EditingToolsAdjustToolAdjustResetCommand * self;
	PixelTransformationBundle* _tmp0_;
	PixelTransformationBundle* _tmp1_;
	parent_class = G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_reset_command_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommand);
	_tmp0_ = pixel_transformation_bundle_new ();
	_pixel_transformation_bundle_unref0 (self->priv->reset);
	self->priv->reset = _tmp0_;
	_tmp1_ = self->priv->reset;
	pixel_transformation_bundle_set_to_identity (_tmp1_);
	return obj;
}

static void
editing_tools_adjust_tool_adjust_reset_command_class_init (EditingToolsAdjustToolAdjustResetCommandClass * klass,
                                                           gpointer klass_data)
{
	editing_tools_adjust_tool_adjust_reset_command_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EditingToolsAdjustToolAdjustResetCommand_private_offset);
	((CommandClass *) klass)->execute = (void (*) (Command*)) editing_tools_adjust_tool_adjust_reset_command_real_execute;
	((CommandClass *) klass)->undo = (void (*) (Command*)) editing_tools_adjust_tool_adjust_reset_command_real_undo;
	((CommandClass *) klass)->compress = (gboolean (*) (Command*, Command*)) editing_tools_adjust_tool_adjust_reset_command_real_compress;
	G_OBJECT_CLASS (klass)->get_property = _vala_editing_tools_adjust_tool_adjust_reset_command_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_editing_tools_adjust_tool_adjust_reset_command_set_property;
	G_OBJECT_CLASS (klass)->constructor = editing_tools_adjust_tool_adjust_reset_command_constructor;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_adjust_tool_adjust_reset_command_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_ORIGINAL_PROPERTY, editing_tools_adjust_tool_adjust_reset_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_ORIGINAL_PROPERTY] = param_spec_pixel_transformation_bundle ("original", "original", "original", TYPE_PIXEL_TRANSFORMATION_BUNDLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
editing_tools_adjust_tool_adjust_reset_command_instance_init (EditingToolsAdjustToolAdjustResetCommand * self,
                                                              gpointer klass)
{
	self->priv = editing_tools_adjust_tool_adjust_reset_command_get_instance_private (self);
}

static void
editing_tools_adjust_tool_adjust_reset_command_finalize (GObject * obj)
{
	EditingToolsAdjustToolAdjustResetCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommand);
	_pixel_transformation_bundle_unref0 (self->priv->_original);
	_pixel_transformation_bundle_unref0 (self->priv->reset);
	G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_reset_command_parent_class)->finalize (obj);
}

static GType
editing_tools_adjust_tool_adjust_reset_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsAdjustToolAdjustResetCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_adjust_tool_adjust_reset_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsAdjustToolAdjustResetCommand), 0, (GInstanceInitFunc) editing_tools_adjust_tool_adjust_reset_command_instance_init, NULL };
	GType editing_tools_adjust_tool_adjust_reset_command_type_id;
	editing_tools_adjust_tool_adjust_reset_command_type_id = g_type_register_static (EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, "EditingToolsAdjustToolAdjustResetCommand", &g_define_type_info, 0);
	EditingToolsAdjustToolAdjustResetCommand_private_offset = g_type_add_instance_private (editing_tools_adjust_tool_adjust_reset_command_type_id, sizeof (EditingToolsAdjustToolAdjustResetCommandPrivate));
	return editing_tools_adjust_tool_adjust_reset_command_type_id;
}

static GType
editing_tools_adjust_tool_adjust_reset_command_get_type (void)
{
	static volatile gsize editing_tools_adjust_tool_adjust_reset_command_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_adjust_tool_adjust_reset_command_type_id__once)) {
		GType editing_tools_adjust_tool_adjust_reset_command_type_id;
		editing_tools_adjust_tool_adjust_reset_command_type_id = editing_tools_adjust_tool_adjust_reset_command_get_type_once ();
		g_once_init_leave (&editing_tools_adjust_tool_adjust_reset_command_type_id__once, editing_tools_adjust_tool_adjust_reset_command_type_id);
	}
	return editing_tools_adjust_tool_adjust_reset_command_type_id__once;
}

static void
_vala_editing_tools_adjust_tool_adjust_reset_command_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec)
{
	EditingToolsAdjustToolAdjustResetCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_ORIGINAL_PROPERTY:
		value_set_pixel_transformation_bundle (value, editing_tools_adjust_tool_adjust_reset_command_get_original (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_editing_tools_adjust_tool_adjust_reset_command_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec)
{
	EditingToolsAdjustToolAdjustResetCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_RESET_COMMAND, EditingToolsAdjustToolAdjustResetCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_ADJUST_RESET_COMMAND_ORIGINAL_PROPERTY:
		editing_tools_adjust_tool_adjust_reset_command_set_original (self, value_get_pixel_transformation_bundle (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
editing_tools_adjust_tool_slider_adjustment_command_get_instance_private (EditingToolsAdjustToolSliderAdjustmentCommand* self)
{
	return G_STRUCT_MEMBER_P (self, EditingToolsAdjustToolSliderAdjustmentCommand_private_offset);
}

static EditingToolsAdjustToolSliderAdjustmentCommand*
editing_tools_adjust_tool_slider_adjustment_command_construct (GType object_type,
                                                               EditingToolsAdjustTool* owner,
                                                               PixelTransformation* old_transformation,
                                                               PixelTransformation* new_transformation,
                                                               const gchar* name)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self = NULL;
	g_return_val_if_fail (owner != NULL, NULL);
	g_return_val_if_fail (old_transformation != NULL, NULL);
	g_return_val_if_fail (new_transformation != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	self = (EditingToolsAdjustToolSliderAdjustmentCommand*) g_object_new (object_type, "name", name, "explanation", name, "owner", owner, "old-transformation", old_transformation, "new-transformation", new_transformation, NULL);
	return self;
}

static EditingToolsAdjustToolSliderAdjustmentCommand*
editing_tools_adjust_tool_slider_adjustment_command_new (EditingToolsAdjustTool* owner,
                                                         PixelTransformation* old_transformation,
                                                         PixelTransformation* new_transformation,
                                                         const gchar* name)
{
	return editing_tools_adjust_tool_slider_adjustment_command_construct (EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, owner, old_transformation, new_transformation, name);
}

static void
editing_tools_adjust_tool_slider_adjustment_command_real_execute (Command* base)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* _tmp1_;
	PixelTransformation* _tmp2_;
	EditingToolsAdjustTool* _tmp3_;
	EditingToolsAdjustTool* _tmp4_;
	EditingToolsPhotoCanvas* _tmp5_;
	self = (EditingToolsAdjustToolSliderAdjustmentCommand*) base;
	_tmp0_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_new_transformation;
	editing_tools_adjust_tool_update_transformation (_tmp1_, _tmp2_);
	_tmp3_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = ((EditingToolsEditingTool*) _tmp4_)->canvas;
	editing_tools_photo_canvas_repaint (_tmp5_);
}

static void
editing_tools_adjust_tool_slider_adjustment_command_real_undo (Command* base)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* _tmp1_;
	PixelTransformation* _tmp2_;
	EditingToolsAdjustTool* _tmp3_;
	EditingToolsAdjustTool* _tmp4_;
	EditingToolsAdjustTool* _tmp5_;
	EditingToolsAdjustTool* _tmp6_;
	PixelTransformation* _tmp7_;
	EditingToolsAdjustTool* _tmp8_;
	EditingToolsAdjustTool* _tmp9_;
	EditingToolsAdjustTool* _tmp10_;
	EditingToolsAdjustTool* _tmp11_;
	EditingToolsPhotoCanvas* _tmp12_;
	self = (EditingToolsAdjustToolSliderAdjustmentCommand*) base;
	_tmp0_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_old_transformation;
	editing_tools_adjust_tool_update_transformation (_tmp1_, _tmp2_);
	_tmp3_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp4_ = _tmp3_;
	editing_tools_adjust_tool_unbind_window_handlers (_tmp4_);
	_tmp5_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->_old_transformation;
	editing_tools_adjust_tool_update_slider (_tmp6_, _tmp7_);
	_tmp8_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp9_ = _tmp8_;
	editing_tools_adjust_tool_bind_window_handlers (_tmp9_);
	_tmp10_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp11_ = _tmp10_;
	_tmp12_ = ((EditingToolsEditingTool*) _tmp11_)->canvas;
	editing_tools_photo_canvas_repaint (_tmp12_);
}

static void
editing_tools_adjust_tool_slider_adjustment_command_real_redo (Command* base)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* _tmp1_;
	PixelTransformation* _tmp2_;
	EditingToolsAdjustTool* _tmp3_;
	EditingToolsAdjustTool* _tmp4_;
	EditingToolsAdjustTool* _tmp5_;
	EditingToolsAdjustTool* _tmp6_;
	PixelTransformation* _tmp7_;
	EditingToolsAdjustTool* _tmp8_;
	EditingToolsAdjustTool* _tmp9_;
	EditingToolsAdjustTool* _tmp10_;
	EditingToolsAdjustTool* _tmp11_;
	EditingToolsPhotoCanvas* _tmp12_;
	self = (EditingToolsAdjustToolSliderAdjustmentCommand*) base;
	_tmp0_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_new_transformation;
	editing_tools_adjust_tool_update_transformation (_tmp1_, _tmp2_);
	_tmp3_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp4_ = _tmp3_;
	editing_tools_adjust_tool_unbind_window_handlers (_tmp4_);
	_tmp5_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->_new_transformation;
	editing_tools_adjust_tool_update_slider (_tmp6_, _tmp7_);
	_tmp8_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp9_ = _tmp8_;
	editing_tools_adjust_tool_bind_window_handlers (_tmp9_);
	_tmp10_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp11_ = _tmp10_;
	_tmp12_ = ((EditingToolsEditingTool*) _tmp11_)->canvas;
	editing_tools_photo_canvas_repaint (_tmp12_);
}

static gboolean
editing_tools_adjust_tool_slider_adjustment_command_real_compress (Command* base,
                                                                   Command* command)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	gboolean result;
	self = (EditingToolsAdjustToolSliderAdjustmentCommand*) base;
	g_return_val_if_fail (command != NULL, FALSE);
	if (EDITING_TOOLS_ADJUST_TOOL_IS_SLIDER_ADJUSTMENT_COMMAND (command)) {
		EditingToolsAdjustToolSliderAdjustmentCommand* slider_adjustment = NULL;
		EditingToolsAdjustToolSliderAdjustmentCommand* _tmp0_;
		EditingToolsAdjustToolSliderAdjustmentCommand* _tmp1_;
		EditingToolsAdjustTool* _tmp2_;
		EditingToolsAdjustTool* _tmp3_;
		EditingToolsAdjustTool* _tmp4_;
		EditingToolsAdjustTool* _tmp5_;
		EditingToolsAdjustToolSliderAdjustmentCommand* _tmp6_;
		EditingToolsAdjustToolSliderAdjustmentCommand* _tmp7_;
		EditingToolsAdjustToolSliderAdjustmentCommand* _tmp8_;
		PixelTransformation* _tmp9_;
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (command, EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommand));
		slider_adjustment = _tmp0_;
		_tmp1_ = slider_adjustment;
		_tmp2_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
		_tmp5_ = _tmp4_;
		if (_tmp3_ != _tmp5_) {
			result = FALSE;
			_g_object_unref0 (slider_adjustment);
			return result;
		}
		_tmp6_ = slider_adjustment;
		if (_tmp6_->priv->transformation_type != self->priv->transformation_type) {
			result = FALSE;
			_g_object_unref0 (slider_adjustment);
			return result;
		}
		_tmp7_ = slider_adjustment;
		command_execute ((Command*) _tmp7_);
		_tmp8_ = slider_adjustment;
		_tmp9_ = _tmp8_->priv->_new_transformation;
		editing_tools_adjust_tool_slider_adjustment_command_set_new_transformation (self, _tmp9_);
		result = TRUE;
		_g_object_unref0 (slider_adjustment);
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static PixelTransformation*
editing_tools_adjust_tool_slider_adjustment_command_get_new_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self)
{
	PixelTransformation* result;
	PixelTransformation* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_new_transformation;
	result = _tmp0_;
	return result;
}

static void
editing_tools_adjust_tool_slider_adjustment_command_set_new_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self,
                                                                            PixelTransformation* value)
{
	PixelTransformation* old_value;
	g_return_if_fail (self != NULL);
	old_value = editing_tools_adjust_tool_slider_adjustment_command_get_new_transformation (self);
	if (old_value != value) {
		PixelTransformation* _tmp0_;
		_tmp0_ = _pixel_transformation_ref0 (value);
		_pixel_transformation_unref0 (self->priv->_new_transformation);
		self->priv->_new_transformation = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, editing_tools_adjust_tool_slider_adjustment_command_properties[EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NEW_TRANSFORMATION_PROPERTY]);
	}
}

static PixelTransformation*
editing_tools_adjust_tool_slider_adjustment_command_get_old_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self)
{
	PixelTransformation* result;
	PixelTransformation* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_old_transformation;
	result = _tmp0_;
	return result;
}

static void
editing_tools_adjust_tool_slider_adjustment_command_set_old_transformation (EditingToolsAdjustToolSliderAdjustmentCommand* self,
                                                                            PixelTransformation* value)
{
	PixelTransformation* old_value;
	g_return_if_fail (self != NULL);
	old_value = editing_tools_adjust_tool_slider_adjustment_command_get_old_transformation (self);
	if (old_value != value) {
		PixelTransformation* _tmp0_;
		_tmp0_ = _pixel_transformation_ref0 (value);
		_pixel_transformation_unref0 (self->priv->_old_transformation);
		self->priv->_old_transformation = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, editing_tools_adjust_tool_slider_adjustment_command_properties[EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_OLD_TRANSFORMATION_PROPERTY]);
	}
}

static GObject *
editing_tools_adjust_tool_slider_adjustment_command_constructor (GType type,
                                                                 guint n_construct_properties,
                                                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	PixelTransformation* _tmp0_;
	PixelTransformation* _tmp1_;
	parent_class = G_OBJECT_CLASS (editing_tools_adjust_tool_slider_adjustment_command_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommand);
	_tmp0_ = self->priv->_old_transformation;
	self->priv->transformation_type = pixel_transformation_get_transformation_type (_tmp0_);
	_tmp1_ = self->priv->_new_transformation;
	_vala_assert (pixel_transformation_get_transformation_type (_tmp1_) == self->priv->transformation_type, "new_transformation.get_transformation_type () == transformation_type");
	return obj;
}

static void
editing_tools_adjust_tool_slider_adjustment_command_class_init (EditingToolsAdjustToolSliderAdjustmentCommandClass * klass,
                                                                gpointer klass_data)
{
	editing_tools_adjust_tool_slider_adjustment_command_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EditingToolsAdjustToolSliderAdjustmentCommand_private_offset);
	((CommandClass *) klass)->execute = (void (*) (Command*)) editing_tools_adjust_tool_slider_adjustment_command_real_execute;
	((CommandClass *) klass)->undo = (void (*) (Command*)) editing_tools_adjust_tool_slider_adjustment_command_real_undo;
	((CommandClass *) klass)->redo = (void (*) (Command*)) editing_tools_adjust_tool_slider_adjustment_command_real_redo;
	((CommandClass *) klass)->compress = (gboolean (*) (Command*, Command*)) editing_tools_adjust_tool_slider_adjustment_command_real_compress;
	G_OBJECT_CLASS (klass)->get_property = _vala_editing_tools_adjust_tool_slider_adjustment_command_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_editing_tools_adjust_tool_slider_adjustment_command_set_property;
	G_OBJECT_CLASS (klass)->constructor = editing_tools_adjust_tool_slider_adjustment_command_constructor;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_adjust_tool_slider_adjustment_command_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NEW_TRANSFORMATION_PROPERTY, editing_tools_adjust_tool_slider_adjustment_command_properties[EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NEW_TRANSFORMATION_PROPERTY] = param_spec_pixel_transformation ("new-transformation", "new-transformation", "new-transformation", TYPE_PIXEL_TRANSFORMATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_OLD_TRANSFORMATION_PROPERTY, editing_tools_adjust_tool_slider_adjustment_command_properties[EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_OLD_TRANSFORMATION_PROPERTY] = param_spec_pixel_transformation ("old-transformation", "old-transformation", "old-transformation", TYPE_PIXEL_TRANSFORMATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
editing_tools_adjust_tool_slider_adjustment_command_instance_init (EditingToolsAdjustToolSliderAdjustmentCommand * self,
                                                                   gpointer klass)
{
	self->priv = editing_tools_adjust_tool_slider_adjustment_command_get_instance_private (self);
}

static void
editing_tools_adjust_tool_slider_adjustment_command_finalize (GObject * obj)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommand);
	_pixel_transformation_unref0 (self->priv->_new_transformation);
	_pixel_transformation_unref0 (self->priv->_old_transformation);
	G_OBJECT_CLASS (editing_tools_adjust_tool_slider_adjustment_command_parent_class)->finalize (obj);
}

static GType
editing_tools_adjust_tool_slider_adjustment_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsAdjustToolSliderAdjustmentCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_adjust_tool_slider_adjustment_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsAdjustToolSliderAdjustmentCommand), 0, (GInstanceInitFunc) editing_tools_adjust_tool_slider_adjustment_command_instance_init, NULL };
	GType editing_tools_adjust_tool_slider_adjustment_command_type_id;
	editing_tools_adjust_tool_slider_adjustment_command_type_id = g_type_register_static (EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, "EditingToolsAdjustToolSliderAdjustmentCommand", &g_define_type_info, 0);
	EditingToolsAdjustToolSliderAdjustmentCommand_private_offset = g_type_add_instance_private (editing_tools_adjust_tool_slider_adjustment_command_type_id, sizeof (EditingToolsAdjustToolSliderAdjustmentCommandPrivate));
	return editing_tools_adjust_tool_slider_adjustment_command_type_id;
}

static GType
editing_tools_adjust_tool_slider_adjustment_command_get_type (void)
{
	static volatile gsize editing_tools_adjust_tool_slider_adjustment_command_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_adjust_tool_slider_adjustment_command_type_id__once)) {
		GType editing_tools_adjust_tool_slider_adjustment_command_type_id;
		editing_tools_adjust_tool_slider_adjustment_command_type_id = editing_tools_adjust_tool_slider_adjustment_command_get_type_once ();
		g_once_init_leave (&editing_tools_adjust_tool_slider_adjustment_command_type_id__once, editing_tools_adjust_tool_slider_adjustment_command_type_id);
	}
	return editing_tools_adjust_tool_slider_adjustment_command_type_id__once;
}

static void
_vala_editing_tools_adjust_tool_slider_adjustment_command_get_property (GObject * object,
                                                                        guint property_id,
                                                                        GValue * value,
                                                                        GParamSpec * pspec)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NEW_TRANSFORMATION_PROPERTY:
		value_set_pixel_transformation (value, editing_tools_adjust_tool_slider_adjustment_command_get_new_transformation (self));
		break;
		case EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_OLD_TRANSFORMATION_PROPERTY:
		value_set_pixel_transformation (value, editing_tools_adjust_tool_slider_adjustment_command_get_old_transformation (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_editing_tools_adjust_tool_slider_adjustment_command_set_property (GObject * object,
                                                                        guint property_id,
                                                                        const GValue * value,
                                                                        GParamSpec * pspec)
{
	EditingToolsAdjustToolSliderAdjustmentCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_SLIDER_ADJUSTMENT_COMMAND, EditingToolsAdjustToolSliderAdjustmentCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_NEW_TRANSFORMATION_PROPERTY:
		editing_tools_adjust_tool_slider_adjustment_command_set_new_transformation (self, value_get_pixel_transformation (value));
		break;
		case EDITING_TOOLS_ADJUST_TOOL_SLIDER_ADJUSTMENT_COMMAND_OLD_TRANSFORMATION_PROPERTY:
		editing_tools_adjust_tool_slider_adjustment_command_set_old_transformation (self, value_get_pixel_transformation (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
editing_tools_adjust_tool_adjust_enhance_command_get_instance_private (EditingToolsAdjustToolAdjustEnhanceCommand* self)
{
	return G_STRUCT_MEMBER_P (self, EditingToolsAdjustToolAdjustEnhanceCommand_private_offset);
}

static EditingToolsAdjustToolAdjustEnhanceCommand*
editing_tools_adjust_tool_adjust_enhance_command_construct (GType object_type,
                                                            EditingToolsAdjustTool* owner,
                                                            Photo* photo)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self = NULL;
	g_return_val_if_fail (owner != NULL, NULL);
	g_return_val_if_fail (photo != NULL, NULL);
	self = (EditingToolsAdjustToolAdjustEnhanceCommand*) g_object_new (object_type, "name", RESOURCES_ENHANCE_LABEL, "explanation", RESOURCES_ENHANCE_TOOLTIP, "owner", owner, "photo", photo, NULL);
	return self;
}

static EditingToolsAdjustToolAdjustEnhanceCommand*
editing_tools_adjust_tool_adjust_enhance_command_new (EditingToolsAdjustTool* owner,
                                                      Photo* photo)
{
	return editing_tools_adjust_tool_adjust_enhance_command_construct (EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, owner, photo);
}

static void
editing_tools_adjust_tool_adjust_enhance_command_real_execute (Command* base)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	PixelTransformationBundle* _tmp0_;
	EditingToolsAdjustTool* _tmp3_;
	EditingToolsAdjustTool* _tmp4_;
	PixelTransformationBundle* _tmp5_;
	self = (EditingToolsAdjustToolAdjustEnhanceCommand*) base;
	_tmp0_ = self->priv->enhanced;
	if (_tmp0_ == NULL) {
		Photo* _tmp1_;
		PixelTransformationBundle* _tmp2_;
		_tmp1_ = self->priv->_photo;
		_tmp2_ = photo_get_enhance_transformations (_tmp1_);
		_pixel_transformation_bundle_unref0 (self->priv->enhanced);
		self->priv->enhanced = _tmp2_;
	}
	_tmp3_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->enhanced;
	editing_tools_adjust_tool_set_adjustments (_tmp4_, _tmp5_);
}

static void
editing_tools_adjust_tool_adjust_enhance_command_real_undo (Command* base)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	EditingToolsAdjustTool* _tmp0_;
	EditingToolsAdjustTool* _tmp1_;
	PixelTransformationBundle* _tmp2_;
	self = (EditingToolsAdjustToolAdjustEnhanceCommand*) base;
	_tmp0_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->original;
	editing_tools_adjust_tool_set_adjustments (_tmp1_, _tmp2_);
}

static gboolean
editing_tools_adjust_tool_adjust_enhance_command_real_compress (Command* base,
                                                                Command* command)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	gboolean result;
	self = (EditingToolsAdjustToolAdjustEnhanceCommand*) base;
	g_return_val_if_fail (command != NULL, FALSE);
	if (IS_ENHANCE_SINGLE_COMMAND (command)) {
		EnhanceSingleCommand* enhance_single = NULL;
		EnhanceSingleCommand* _tmp0_;
		Photo* photo = NULL;
		EnhanceSingleCommand* _tmp1_;
		DataSource* _tmp2_;
		Photo* _tmp3_;
		EditingToolsAdjustTool* _tmp4_;
		EditingToolsAdjustTool* _tmp5_;
		EditingToolsPhotoCanvas* _tmp6_;
		Photo* _tmp7_;
		Photo* _tmp8_;
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (command, TYPE_ENHANCE_SINGLE_COMMAND, EnhanceSingleCommand));
		enhance_single = _tmp0_;
		_tmp1_ = enhance_single;
		_tmp2_ = single_data_source_command_get_source ((SingleDataSourceCommand*) _tmp1_);
		photo = G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_PHOTO, Photo);
		_tmp3_ = photo;
		_tmp4_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = ((EditingToolsEditingTool*) _tmp5_)->canvas;
		_tmp7_ = editing_tools_photo_canvas_get_photo (_tmp6_);
		_tmp8_ = _tmp7_;
		result = data_source_equals ((DataSource*) _tmp3_, (DataSource*) _tmp8_);
		_g_object_unref0 (photo);
		_g_object_unref0 (enhance_single);
		return result;
	}
	if (EDITING_TOOLS_ADJUST_TOOL_IS_ADJUST_ENHANCE_COMMAND (command)) {
		EditingToolsAdjustToolAdjustEnhanceCommand* enhance_command = NULL;
		EditingToolsAdjustToolAdjustEnhanceCommand* _tmp9_;
		EditingToolsAdjustToolAdjustEnhanceCommand* _tmp10_;
		EditingToolsAdjustTool* _tmp11_;
		EditingToolsAdjustTool* _tmp12_;
		EditingToolsAdjustTool* _tmp13_;
		EditingToolsAdjustTool* _tmp14_;
		_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (command, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommand));
		enhance_command = _tmp9_;
		_tmp10_ = enhance_command;
		_tmp11_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) _tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = editing_tools_adjust_tool_adjust_tool_command_get_owner ((EditingToolsAdjustToolAdjustToolCommand*) self);
		_tmp14_ = _tmp13_;
		if (_tmp12_ != _tmp14_) {
			result = FALSE;
			_g_object_unref0 (enhance_command);
			return result;
		}
		result = TRUE;
		_g_object_unref0 (enhance_command);
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static Photo*
editing_tools_adjust_tool_adjust_enhance_command_get_photo (EditingToolsAdjustToolAdjustEnhanceCommand* self)
{
	Photo* result;
	Photo* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_photo;
	result = _tmp0_;
	return result;
}

static void
editing_tools_adjust_tool_adjust_enhance_command_set_photo (EditingToolsAdjustToolAdjustEnhanceCommand* self,
                                                            Photo* value)
{
	Photo* old_value;
	g_return_if_fail (self != NULL);
	old_value = editing_tools_adjust_tool_adjust_enhance_command_get_photo (self);
	if (old_value != value) {
		Photo* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_photo);
		self->priv->_photo = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, editing_tools_adjust_tool_adjust_enhance_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_PHOTO_PROPERTY]);
	}
}

static GObject *
editing_tools_adjust_tool_adjust_enhance_command_constructor (GType type,
                                                              guint n_construct_properties,
                                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	Photo* _tmp0_;
	PixelTransformationBundle* _tmp1_;
	parent_class = G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_enhance_command_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommand);
	_tmp0_ = self->priv->_photo;
	_tmp1_ = photo_get_color_adjustments (_tmp0_);
	_pixel_transformation_bundle_unref0 (self->priv->original);
	self->priv->original = _tmp1_;
	return obj;
}

static void
editing_tools_adjust_tool_adjust_enhance_command_class_init (EditingToolsAdjustToolAdjustEnhanceCommandClass * klass,
                                                             gpointer klass_data)
{
	editing_tools_adjust_tool_adjust_enhance_command_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EditingToolsAdjustToolAdjustEnhanceCommand_private_offset);
	((CommandClass *) klass)->execute = (void (*) (Command*)) editing_tools_adjust_tool_adjust_enhance_command_real_execute;
	((CommandClass *) klass)->undo = (void (*) (Command*)) editing_tools_adjust_tool_adjust_enhance_command_real_undo;
	((CommandClass *) klass)->compress = (gboolean (*) (Command*, Command*)) editing_tools_adjust_tool_adjust_enhance_command_real_compress;
	G_OBJECT_CLASS (klass)->get_property = _vala_editing_tools_adjust_tool_adjust_enhance_command_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_editing_tools_adjust_tool_adjust_enhance_command_set_property;
	G_OBJECT_CLASS (klass)->constructor = editing_tools_adjust_tool_adjust_enhance_command_constructor;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_adjust_tool_adjust_enhance_command_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_PHOTO_PROPERTY, editing_tools_adjust_tool_adjust_enhance_command_properties[EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_PHOTO_PROPERTY] = g_param_spec_object ("photo", "photo", "photo", TYPE_PHOTO, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
editing_tools_adjust_tool_adjust_enhance_command_instance_init (EditingToolsAdjustToolAdjustEnhanceCommand * self,
                                                                gpointer klass)
{
	self->priv = editing_tools_adjust_tool_adjust_enhance_command_get_instance_private (self);
	self->priv->enhanced = NULL;
}

static void
editing_tools_adjust_tool_adjust_enhance_command_finalize (GObject * obj)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommand);
	_g_object_unref0 (self->priv->_photo);
	_pixel_transformation_bundle_unref0 (self->priv->original);
	_pixel_transformation_bundle_unref0 (self->priv->enhanced);
	G_OBJECT_CLASS (editing_tools_adjust_tool_adjust_enhance_command_parent_class)->finalize (obj);
}

static GType
editing_tools_adjust_tool_adjust_enhance_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsAdjustToolAdjustEnhanceCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_adjust_tool_adjust_enhance_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsAdjustToolAdjustEnhanceCommand), 0, (GInstanceInitFunc) editing_tools_adjust_tool_adjust_enhance_command_instance_init, NULL };
	GType editing_tools_adjust_tool_adjust_enhance_command_type_id;
	editing_tools_adjust_tool_adjust_enhance_command_type_id = g_type_register_static (EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_TOOL_COMMAND, "EditingToolsAdjustToolAdjustEnhanceCommand", &g_define_type_info, 0);
	EditingToolsAdjustToolAdjustEnhanceCommand_private_offset = g_type_add_instance_private (editing_tools_adjust_tool_adjust_enhance_command_type_id, sizeof (EditingToolsAdjustToolAdjustEnhanceCommandPrivate));
	return editing_tools_adjust_tool_adjust_enhance_command_type_id;
}

static GType
editing_tools_adjust_tool_adjust_enhance_command_get_type (void)
{
	static volatile gsize editing_tools_adjust_tool_adjust_enhance_command_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_adjust_tool_adjust_enhance_command_type_id__once)) {
		GType editing_tools_adjust_tool_adjust_enhance_command_type_id;
		editing_tools_adjust_tool_adjust_enhance_command_type_id = editing_tools_adjust_tool_adjust_enhance_command_get_type_once ();
		g_once_init_leave (&editing_tools_adjust_tool_adjust_enhance_command_type_id__once, editing_tools_adjust_tool_adjust_enhance_command_type_id);
	}
	return editing_tools_adjust_tool_adjust_enhance_command_type_id__once;
}

static void
_vala_editing_tools_adjust_tool_adjust_enhance_command_get_property (GObject * object,
                                                                     guint property_id,
                                                                     GValue * value,
                                                                     GParamSpec * pspec)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_PHOTO_PROPERTY:
		g_value_set_object (value, editing_tools_adjust_tool_adjust_enhance_command_get_photo (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_editing_tools_adjust_tool_adjust_enhance_command_set_property (GObject * object,
                                                                     guint property_id,
                                                                     const GValue * value,
                                                                     GParamSpec * pspec)
{
	EditingToolsAdjustToolAdjustEnhanceCommand * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_ADJUST_TOOL_TYPE_ADJUST_ENHANCE_COMMAND, EditingToolsAdjustToolAdjustEnhanceCommand);
	switch (property_id) {
		case EDITING_TOOLS_ADJUST_TOOL_ADJUST_ENHANCE_COMMAND_PHOTO_PROPERTY:
		editing_tools_adjust_tool_adjust_enhance_command_set_photo (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
editing_tools_adjust_tool_class_init (EditingToolsAdjustToolClass * klass,
                                      gpointer klass_data)
{
	editing_tools_adjust_tool_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EditingToolsAdjustTool_private_offset);
	((EditingToolsEditingToolClass *) klass)->activate = (void (*) (EditingToolsEditingTool*, EditingToolsPhotoCanvas*)) editing_tools_adjust_tool_real_activate;
	((EditingToolsEditingToolClass *) klass)->get_tool_window = (EditingToolsEditingToolWindow* (*) (EditingToolsEditingTool*)) editing_tools_adjust_tool_real_get_tool_window;
	((EditingToolsEditingToolClass *) klass)->deactivate = (void (*) (EditingToolsEditingTool*)) editing_tools_adjust_tool_real_deactivate;
	((EditingToolsEditingToolClass *) klass)->paint = (void (*) (EditingToolsEditingTool*, cairo_t*)) editing_tools_adjust_tool_real_paint;
	((EditingToolsEditingToolClass *) klass)->get_display_pixbuf = (GdkPixbuf* (*) (EditingToolsEditingTool*, Scaling*, Photo*, Dimensions*, GError**)) editing_tools_adjust_tool_real_get_display_pixbuf;
	((EditingToolsEditingToolClass *) klass)->on_keypress = (gboolean (*) (EditingToolsEditingTool*, GdkEventKey*)) editing_tools_adjust_tool_real_on_keypress;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_adjust_tool_finalize;
}

static void
editing_tools_adjust_tool_instance_init (EditingToolsAdjustTool * self,
                                         gpointer klass)
{
	self->priv = editing_tools_adjust_tool_get_instance_private (self);
	self->priv->adjust_tool_window = NULL;
	self->priv->suppress_effect_redraw = FALSE;
	self->priv->draw_to_pixbuf = NULL;
	self->priv->histogram_pixbuf = NULL;
	self->priv->virgin_histogram_pixbuf = NULL;
	self->priv->transformer = NULL;
	self->priv->histogram_transformer = NULL;
	self->priv->transformations = NULL;
	self->priv->fp_pixel_cache = NULL;
	self->priv->fp_pixel_cache_length1 = 0;
	self->priv->_fp_pixel_cache_size_ = self->priv->fp_pixel_cache_length1;
	self->priv->disable_histogram_refresh = FALSE;
	self->priv->temperature_scheduler = NULL;
	self->priv->tint_scheduler = NULL;
	self->priv->saturation_scheduler = NULL;
	self->priv->exposure_scheduler = NULL;
	self->priv->shadows_scheduler = NULL;
	self->priv->highlights_scheduler = NULL;
}

static void
editing_tools_adjust_tool_finalize (GObject * obj)
{
	EditingToolsAdjustTool * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_TYPE_ADJUST_TOOL, EditingToolsAdjustTool);
	_g_object_unref0 (self->priv->adjust_tool_window);
	_g_object_unref0 (self->priv->draw_to_pixbuf);
	_g_object_unref0 (self->priv->histogram_pixbuf);
	_g_object_unref0 (self->priv->virgin_histogram_pixbuf);
	_pixel_transformer_unref0 (self->priv->transformer);
	_pixel_transformer_unref0 (self->priv->histogram_transformer);
	_pixel_transformation_bundle_unref0 (self->priv->transformations);
	self->priv->fp_pixel_cache = (g_free (self->priv->fp_pixel_cache), NULL);
	_one_shot_scheduler_unref0 (self->priv->temperature_scheduler);
	_one_shot_scheduler_unref0 (self->priv->tint_scheduler);
	_one_shot_scheduler_unref0 (self->priv->saturation_scheduler);
	_one_shot_scheduler_unref0 (self->priv->exposure_scheduler);
	_one_shot_scheduler_unref0 (self->priv->shadows_scheduler);
	_one_shot_scheduler_unref0 (self->priv->highlights_scheduler);
	G_OBJECT_CLASS (editing_tools_adjust_tool_parent_class)->finalize (obj);
}

static GType
editing_tools_adjust_tool_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsAdjustToolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_adjust_tool_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsAdjustTool), 0, (GInstanceInitFunc) editing_tools_adjust_tool_instance_init, NULL };
	GType editing_tools_adjust_tool_type_id;
	editing_tools_adjust_tool_type_id = g_type_register_static (EDITING_TOOLS_TYPE_EDITING_TOOL, "EditingToolsAdjustTool", &g_define_type_info, 0);
	EditingToolsAdjustTool_private_offset = g_type_add_instance_private (editing_tools_adjust_tool_type_id, sizeof (EditingToolsAdjustToolPrivate));
	return editing_tools_adjust_tool_type_id;
}

GType
editing_tools_adjust_tool_get_type (void)
{
	static volatile gsize editing_tools_adjust_tool_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_adjust_tool_type_id__once)) {
		GType editing_tools_adjust_tool_type_id;
		editing_tools_adjust_tool_type_id = editing_tools_adjust_tool_get_type_once ();
		g_once_init_leave (&editing_tools_adjust_tool_type_id__once, editing_tools_adjust_tool_type_id);
	}
	return editing_tools_adjust_tool_type_id__once;
}

