PIKApp/app/tools/pikarectangleoptions.h

186 lines
7.2 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __PIKA_RECTANGLE_OPTIONS_H__
#define __PIKA_RECTANGLE_OPTIONS_H__
typedef enum
{
PIKA_RECTANGLE_OPTIONS_PROP_0,
PIKA_RECTANGLE_OPTIONS_PROP_AUTO_SHRINK,
PIKA_RECTANGLE_OPTIONS_PROP_SHRINK_MERGED,
PIKA_RECTANGLE_OPTIONS_PROP_HIGHLIGHT,
PIKA_RECTANGLE_OPTIONS_PROP_HIGHLIGHT_OPACITY,
PIKA_RECTANGLE_OPTIONS_PROP_GUIDE,
PIKA_RECTANGLE_OPTIONS_PROP_X,
PIKA_RECTANGLE_OPTIONS_PROP_Y,
PIKA_RECTANGLE_OPTIONS_PROP_WIDTH,
PIKA_RECTANGLE_OPTIONS_PROP_HEIGHT,
PIKA_RECTANGLE_OPTIONS_PROP_POSITION_UNIT,
PIKA_RECTANGLE_OPTIONS_PROP_SIZE_UNIT,
PIKA_RECTANGLE_OPTIONS_PROP_FIXED_RULE_ACTIVE,
PIKA_RECTANGLE_OPTIONS_PROP_FIXED_RULE,
PIKA_RECTANGLE_OPTIONS_PROP_DESIRED_FIXED_WIDTH,
PIKA_RECTANGLE_OPTIONS_PROP_DESIRED_FIXED_HEIGHT,
PIKA_RECTANGLE_OPTIONS_PROP_DESIRED_FIXED_SIZE_WIDTH,
PIKA_RECTANGLE_OPTIONS_PROP_DESIRED_FIXED_SIZE_HEIGHT,
PIKA_RECTANGLE_OPTIONS_PROP_DEFAULT_FIXED_SIZE_WIDTH,
PIKA_RECTANGLE_OPTIONS_PROP_DEFAULT_FIXED_SIZE_HEIGHT,
PIKA_RECTANGLE_OPTIONS_PROP_OVERRIDDEN_FIXED_SIZE,
PIKA_RECTANGLE_OPTIONS_PROP_ASPECT_NUMERATOR,
PIKA_RECTANGLE_OPTIONS_PROP_ASPECT_DENOMINATOR,
PIKA_RECTANGLE_OPTIONS_PROP_DEFAULT_ASPECT_NUMERATOR,
PIKA_RECTANGLE_OPTIONS_PROP_DEFAULT_ASPECT_DENOMINATOR,
PIKA_RECTANGLE_OPTIONS_PROP_OVERRIDDEN_FIXED_ASPECT,
PIKA_RECTANGLE_OPTIONS_PROP_USE_STRING_CURRENT,
PIKA_RECTANGLE_OPTIONS_PROP_FIXED_UNIT,
PIKA_RECTANGLE_OPTIONS_PROP_FIXED_CENTER,
PIKA_RECTANGLE_OPTIONS_PROP_LAST = PIKA_RECTANGLE_OPTIONS_PROP_FIXED_CENTER
} PikaRectangleOptionsProp;
#define PIKA_TYPE_RECTANGLE_OPTIONS (pika_rectangle_options_get_type ())
#define PIKA_IS_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_RECTANGLE_OPTIONS))
#define PIKA_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_RECTANGLE_OPTIONS, PikaRectangleOptions))
#define PIKA_RECTANGLE_OPTIONS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PIKA_TYPE_RECTANGLE_OPTIONS, PikaRectangleOptionsInterface))
#define PIKA_RECTANGLE_OPTIONS_GET_PRIVATE(obj) (pika_rectangle_options_get_private (PIKA_RECTANGLE_OPTIONS (obj)))
typedef struct _PikaRectangleOptions PikaRectangleOptions;
typedef struct _PikaRectangleOptionsInterface PikaRectangleOptionsInterface;
typedef struct _PikaRectangleOptionsPrivate PikaRectangleOptionsPrivate;
struct _PikaRectangleOptionsInterface
{
GTypeInterface base_iface;
};
struct _PikaRectangleOptionsPrivate
{
gboolean auto_shrink;
gboolean shrink_merged;
gboolean highlight;
gdouble highlight_opacity;
PikaGuidesType guide;
gdouble x;
gdouble y;
gdouble width;
gdouble height;
PikaUnit position_unit;
PikaUnit size_unit;
gboolean fixed_rule_active;
PikaRectangleFixedRule fixed_rule;
gdouble desired_fixed_width;
gdouble desired_fixed_height;
gdouble desired_fixed_size_width;
gdouble desired_fixed_size_height;
gdouble default_fixed_size_width;
gdouble default_fixed_size_height;
gboolean overridden_fixed_size;
gdouble aspect_numerator;
gdouble aspect_denominator;
gdouble default_aspect_numerator;
gdouble default_aspect_denominator;
gboolean overridden_fixed_aspect;
gboolean fixed_center;
/* This gboolean is not part of the actual rectangle tool options,
* and should be refactored out along with the pointers to widgets.
*/
gboolean use_string_current;
PikaUnit fixed_unit;
/* options gui */
GtkWidget *auto_shrink_button;
GtkWidget *fixed_width_entry;
GtkWidget *fixed_height_entry;
GtkWidget *fixed_aspect_hbox;
GtkWidget *aspect_button_box;
GtkListStore *aspect_history;
GtkWidget *fixed_size_hbox;
GtkWidget *size_button_box;
GtkListStore *size_history;
GtkWidget *position_entry;
GtkWidget *size_entry;
};
GType pika_rectangle_options_get_type (void) G_GNUC_CONST;
GtkWidget * pika_rectangle_options_gui (PikaToolOptions *tool_options);
void pika_rectangle_options_connect (PikaRectangleOptions *options,
PikaImage *image,
GCallback shrink_callback,
gpointer shrink_object);
void pika_rectangle_options_disconnect (PikaRectangleOptions *options,
GCallback shrink_callback,
gpointer shrink_object);
gboolean pika_rectangle_options_fixed_rule_active (PikaRectangleOptions *rectangle_options,
PikaRectangleFixedRule fixed_rule);
PikaRectangleOptionsPrivate *
pika_rectangle_options_get_private (PikaRectangleOptions *options);
/* convenience functions */
void pika_rectangle_options_install_properties (GObjectClass *klass);
void pika_rectangle_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
void pika_rectangle_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
/* testing helper functions */
GtkWidget * pika_rectangle_options_get_size_entry (PikaRectangleOptions *rectangle_options);
#endif /* __PIKA_RECTANGLE_OPTIONS_H__ */