PIKApp/app/tools/pikainkoptions-gui.c

165 lines
5.9 KiB
C
Raw Permalink Normal View History

2023-09-26 00:35:21 +02:00
/* 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 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/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libpikawidgets/pikawidgets.h"
#include "tools-types.h"
#include "config/pikaconfig-utils.h"
#include "paint/pikainkoptions.h"
#include "widgets/pikablobeditor.h"
#include "widgets/pikapropwidgets.h"
#include "pikainkoptions-gui.h"
#include "pikapaintoptions-gui.h"
#include "pika-intl.h"
GtkWidget *
pika_ink_options_gui (PikaToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
PikaInkOptions *ink_options = PIKA_INK_OPTIONS (tool_options);
GtkWidget *vbox = pika_paint_options_gui (tool_options);
GtkWidget *frame;
GtkWidget *vbox2;
GtkWidget *scale;
2023-12-02 20:03:24 +01:00
GtkWidget *combo_box;
2023-09-26 00:35:21 +02:00
GtkWidget *blob_box;
GtkWidget *hbox;
GtkWidget *editor;
GtkSizeGroup *size_group;
/* adjust sliders */
frame = pika_frame_new (_("Adjustment"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
gtk_widget_show (frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
/* size slider */
scale = pika_prop_spin_scale_new (config, "size",
1.0, 2.0, 1);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
/* angle adjust slider */
scale = pika_prop_spin_scale_new (config, "tilt-angle",
1.0, 10.0, 1);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
/* sens sliders */
frame = pika_frame_new (_("Sensitivity"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
gtk_widget_show (frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
/* size sens slider */
scale = pika_prop_spin_scale_new (config, "size-sensitivity",
0.01, 0.1, 2);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
/* tilt sens slider */
scale = pika_prop_spin_scale_new (config, "tilt-sensitivity",
0.01, 0.1, 2);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
/* velocity sens slider */
scale = pika_prop_spin_scale_new (config, "vel-sensitivity",
0.01, 0.1, 2);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
/* Blob shape widgets */
frame = pika_frame_new (_("Shape"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
/* Blob type radiobuttons */
blob_box = pika_prop_enum_icon_box_new (config, "blob-type",
"pika-shape", 0, 0);
gtk_orientable_set_orientation (GTK_ORIENTABLE (blob_box),
GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (hbox), blob_box, FALSE, FALSE, 0);
gtk_size_group_add_widget (size_group, blob_box);
g_object_unref (size_group);
/* Blob editor */
frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
gtk_size_group_add_widget (size_group, frame);
editor = pika_blob_editor_new (ink_options->blob_type,
ink_options->blob_aspect,
ink_options->blob_angle);
gtk_container_add (GTK_CONTAINER (frame), editor);
gtk_widget_show (editor);
2023-12-02 20:03:24 +01:00
/* Expand layer options */
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
scale = pika_prop_spin_scale_new (config, "expand-amount",
1, 10, 2);
pika_spin_scale_set_constrain_drag (PIKA_SPIN_SCALE (scale), TRUE);
pika_spin_scale_set_scale_limits (PIKA_SPIN_SCALE (scale), 1.0, 1000.0);
pika_spin_scale_set_gamma (PIKA_SPIN_SCALE (scale), 1.0);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
combo_box = pika_prop_enum_combo_box_new (config, "expand-fill-type", 0, 0);
gtk_box_pack_start (GTK_BOX (vbox2), combo_box, FALSE, FALSE, 0);
frame = pika_prop_enum_radio_frame_new (config, "expand-mask-fill-type",
"Fill Layer Mask With", 0, 1);
gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 0);
frame = pika_prop_expanding_frame_new (config, "expand-use", NULL,
vbox2, NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
2023-09-26 00:35:21 +02:00
pika_config_connect (config, G_OBJECT (editor), "blob-type");
pika_config_connect (config, G_OBJECT (editor), "blob-aspect");
pika_config_connect (config, G_OBJECT (editor), "blob-angle");
return vbox;
}