PIKApp/app/tools/pikatoolcontrol.h

280 lines
14 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-2002 Spencer Kimball, Peter Mattis and others
*
* 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_TOOL_CONTROL_H__
#define __PIKA_TOOL_CONTROL_H__
#include "core/pikaobject.h"
#define PIKA_TYPE_TOOL_CONTROL (pika_tool_control_get_type ())
#define PIKA_TOOL_CONTROL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_TOOL_CONTROL, PikaToolControl))
#define PIKA_TOOL_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_TOOL_CONTROL, PikaToolControlClass))
#define PIKA_IS_TOOL_CONTROL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_TOOL_CONTROL))
#define PIKA_IS_TOOL_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_TOOL_CONTROL))
#define PIKA_TOOL_CONTROL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_TOOL_CONTROL, PikaToolControlClass))
typedef struct _PikaToolControlClass PikaToolControlClass;
struct _PikaToolControl
{
PikaObject parent_instance;
gboolean active; /* state of tool activity */
gint paused_count; /* paused control count */
gboolean preserve; /* Preserve this tool across *
* drawable changes */
GSList *preserve_stack; /* for push/pop preserve */
gboolean scroll_lock; /* allow scrolling or not */
gboolean handle_empty_image; /* invoke the tool on images *
* without active drawable */
PikaDirtyMask dirty_mask; /* if preserve is FALSE, stop *
* the tool on these events */
PikaToolAction dirty_action; /* use this action to stop the *
* tool when one of the dirty *
* events occurs */
PikaMotionMode motion_mode; /* how to process motion events *
* before they go to the tool */
gboolean auto_snap_to; /* snap to guides automatically */
gint snap_offset_x;
gint snap_offset_y;
gint snap_width;
gint snap_height;
PikaCursorPrecision precision;
gboolean wants_click; /* wants click detection */
gboolean wants_double_click;
gboolean wants_triple_click;
gboolean wants_all_key_events;
PikaToolActiveModifiers active_modifiers;
gboolean toggled;
PikaCursorType cursor;
PikaToolCursorType tool_cursor;
PikaCursorModifier cursor_modifier;
PikaCursorType toggle_cursor;
PikaToolCursorType toggle_tool_cursor;
PikaCursorModifier toggle_cursor_modifier;
gchar *action_size;
gchar *action_aspect;
gchar *action_angle;
gchar *action_spacing;
gchar *action_opacity;
gchar *action_hardness;
gchar *action_force;
gchar *action_object_1;
gchar *action_object_2;
/* Enum actions have a +-/min/max values which are not necessarily so
* useful. They also have a variable value which works as a per mille
* between the min and max, so it's hard to use, especially for
* actions which have a huge max or which can have negative values.
* For instance, aspect and angle can be negative. As for size and
* spacing, their max value can be huge. Finally "size" can be
* negative for the MyPaint brush tool, which uses a logarithmic
* radius as base value.
* For this reason, we also register specialized actions with clear
* unit if needed.
*/
gchar *action_pixel_size;
};
struct _PikaToolControlClass
{
PikaObjectClass parent_class;
};
GType pika_tool_control_get_type (void) G_GNUC_CONST;
void pika_tool_control_activate (PikaToolControl *control);
void pika_tool_control_halt (PikaToolControl *control);
gboolean pika_tool_control_is_active (PikaToolControl *control);
void pika_tool_control_pause (PikaToolControl *control);
void pika_tool_control_resume (PikaToolControl *control);
gboolean pika_tool_control_is_paused (PikaToolControl *control);
void pika_tool_control_set_preserve (PikaToolControl *control,
gboolean preserve);
gboolean pika_tool_control_get_preserve (PikaToolControl *control);
void pika_tool_control_push_preserve (PikaToolControl *control,
gboolean preserve);
void pika_tool_control_pop_preserve (PikaToolControl *control);
void pika_tool_control_set_scroll_lock (PikaToolControl *control,
gboolean scroll_lock);
gboolean pika_tool_control_get_scroll_lock (PikaToolControl *control);
void pika_tool_control_set_handle_empty_image
(PikaToolControl *control,
gboolean handle_empty);
gboolean pika_tool_control_get_handle_empty_image
(PikaToolControl *control);
void pika_tool_control_set_dirty_mask (PikaToolControl *control,
PikaDirtyMask dirty_mask);
PikaDirtyMask pika_tool_control_get_dirty_mask (PikaToolControl *control);
void pika_tool_control_set_dirty_action (PikaToolControl *control,
PikaToolAction action);
PikaToolAction pika_tool_control_get_dirty_action (PikaToolControl *control);
void pika_tool_control_set_motion_mode (PikaToolControl *control,
PikaMotionMode motion_mode);
PikaMotionMode pika_tool_control_get_motion_mode (PikaToolControl *control);
void pika_tool_control_set_snap_to (PikaToolControl *control,
gboolean snap_to);
gboolean pika_tool_control_get_snap_to (PikaToolControl *control);
void pika_tool_control_set_wants_click (PikaToolControl *control,
gboolean wants_click);
gboolean pika_tool_control_get_wants_click (PikaToolControl *control);
void pika_tool_control_set_wants_double_click
(PikaToolControl *control,
gboolean wants_double_click);
gboolean pika_tool_control_get_wants_double_click
(PikaToolControl *control);
void pika_tool_control_set_wants_triple_click
(PikaToolControl *control,
gboolean wants_double_click);
gboolean pika_tool_control_get_wants_triple_click
(PikaToolControl *control);
void pika_tool_control_set_wants_all_key_events
(PikaToolControl *control,
gboolean wants_key_events);
gboolean pika_tool_control_get_wants_all_key_events
(PikaToolControl *control);
void pika_tool_control_set_active_modifiers
(PikaToolControl *control,
PikaToolActiveModifiers active_modifiers);
PikaToolActiveModifiers
pika_tool_control_get_active_modifiers
(PikaToolControl *control);
void pika_tool_control_set_snap_offsets (PikaToolControl *control,
gint offset_x,
gint offset_y,
gint width,
gint height);
void pika_tool_control_get_snap_offsets (PikaToolControl *control,
gint *offset_x,
gint *offset_y,
gint *width,
gint *height);
void pika_tool_control_set_precision (PikaToolControl *control,
PikaCursorPrecision precision);
PikaCursorPrecision
pika_tool_control_get_precision (PikaToolControl *control);
void pika_tool_control_set_toggled (PikaToolControl *control,
gboolean toggled);
gboolean pika_tool_control_get_toggled (PikaToolControl *control);
void pika_tool_control_set_cursor (PikaToolControl *control,
PikaCursorType cursor);
void pika_tool_control_set_tool_cursor (PikaToolControl *control,
PikaToolCursorType cursor);
void pika_tool_control_set_cursor_modifier
(PikaToolControl *control,
PikaCursorModifier modifier);
void pika_tool_control_set_toggle_cursor (PikaToolControl *control,
PikaCursorType cursor);
void pika_tool_control_set_toggle_tool_cursor
(PikaToolControl *control,
PikaToolCursorType cursor);
void pika_tool_control_set_toggle_cursor_modifier
(PikaToolControl *control,
PikaCursorModifier modifier);
PikaCursorType
pika_tool_control_get_cursor (PikaToolControl *control);
PikaToolCursorType
pika_tool_control_get_tool_cursor (PikaToolControl *control);
PikaCursorModifier
pika_tool_control_get_cursor_modifier (PikaToolControl *control);
void pika_tool_control_set_action_opacity (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_opacity (PikaToolControl *control);
void pika_tool_control_set_action_size (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_size (PikaToolControl *control);
void pika_tool_control_set_action_aspect (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_aspect (PikaToolControl *control);
void pika_tool_control_set_action_angle (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_angle (PikaToolControl *control);
void pika_tool_control_set_action_spacing (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_spacing (PikaToolControl *control);
void pika_tool_control_set_action_hardness (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_hardness (PikaToolControl *control);
void pika_tool_control_set_action_force (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_force (PikaToolControl *control);
void pika_tool_control_set_action_object_1 (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_object_1 (PikaToolControl *control);
void pika_tool_control_set_action_object_2 (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_object_2 (PikaToolControl *control);
void pika_tool_control_set_action_pixel_size (PikaToolControl *control,
const gchar *action);
const gchar * pika_tool_control_get_action_pixel_size (PikaToolControl *control);
#endif /* __PIKA_TOOL_CONTROL_H__ */