2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-02-05 22:39:40 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2004-09-24 20:01:35 +08:00
|
|
|
* gimpmeasuretool.c
|
2003-02-05 22:39:40 +08:00
|
|
|
* Copyright (C) 1999 Sven Neumann <sven@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-02-05 22:39:40 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-02-05 22:39:40 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-02-05 22:39:40 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2012-03-30 01:19:01 +08:00
|
|
|
#include <gegl.h>
|
2003-02-05 22:39:40 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "tools-types.h"
|
|
|
|
|
|
|
|
#include "gimpmeasureoptions.h"
|
2003-06-30 04:40:45 +08:00
|
|
|
#include "gimptooloptions-gui.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
|
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_USE_INFO_WINDOW
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static void gimp_measure_options_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_measure_options_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2003-02-05 22:39:40 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
G_DEFINE_TYPE (GimpMeasureOptions, gimp_measure_options,
|
2018-06-10 04:35:46 +08:00
|
|
|
GIMP_TYPE_TRANSFORM_OPTIONS)
|
2003-02-08 01:12:21 +08:00
|
|
|
|
2003-02-05 22:39:40 +08:00
|
|
|
|
2004-09-24 20:01:35 +08:00
|
|
|
static void
|
2003-02-05 22:39:40 +08:00
|
|
|
gimp_measure_options_class_init (GimpMeasureOptionsClass *klass)
|
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
object_class->set_property = gimp_measure_options_set_property;
|
|
|
|
object_class->get_property = gimp_measure_options_get_property;
|
|
|
|
|
2016-02-12 06:44:07 +08:00
|
|
|
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_INFO_WINDOW,
|
|
|
|
"use-info-window",
|
|
|
|
_("Use info window"),
|
|
|
|
_("Open a floating dialog to view details "
|
|
|
|
"about measurements"),
|
|
|
|
FALSE,
|
|
|
|
GIMP_PARAM_STATIC_STRINGS);
|
2003-02-05 22:39:40 +08:00
|
|
|
}
|
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
static void
|
|
|
|
gimp_measure_options_init (GimpMeasureOptions *options)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
static void
|
|
|
|
gimp_measure_options_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-02-05 22:39:40 +08:00
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GimpMeasureOptions *options = GIMP_MEASURE_OPTIONS (object);
|
2003-02-05 22:39:40 +08:00
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_USE_INFO_WINDOW:
|
|
|
|
options->use_info_window = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2003-02-05 22:39:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-08 01:12:21 +08:00
|
|
|
gimp_measure_options_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-02-05 22:39:40 +08:00
|
|
|
{
|
2004-09-24 20:01:35 +08:00
|
|
|
GimpMeasureOptions *options = GIMP_MEASURE_OPTIONS (object);
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_USE_INFO_WINDOW:
|
|
|
|
g_value_set_boolean (value, options->use_info_window);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-10 01:32:52 +08:00
|
|
|
GtkWidget *
|
2003-02-08 01:12:21 +08:00
|
|
|
gimp_measure_options_gui (GimpToolOptions *tool_options)
|
|
|
|
{
|
2018-06-10 13:24:56 +08:00
|
|
|
GObject *config = G_OBJECT (tool_options);
|
|
|
|
GimpMeasureOptions *options = GIMP_MEASURE_OPTIONS (tool_options);
|
|
|
|
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *vbox2;
|
2003-02-08 01:12:21 +08:00
|
|
|
|
|
|
|
/* the use_info_window toggle button */
|
2016-02-12 06:44:07 +08:00
|
|
|
button = gimp_prop_check_button_new (config, "use-info-window", NULL);
|
2003-02-08 01:12:21 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
2003-02-10 01:32:52 +08:00
|
|
|
|
2018-06-10 04:35:46 +08:00
|
|
|
/* the straighten frame */
|
|
|
|
frame = gimp_frame_new (_("Straighten"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
/* the transform options */
|
|
|
|
vbox2 = gimp_transform_options_gui (tool_options, FALSE, TRUE, TRUE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
|
|
|
gtk_widget_show (vbox2);
|
|
|
|
|
|
|
|
/* the straighten button */
|
|
|
|
button = gtk_button_new_with_label (_("Straighten"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
2017-12-27 19:08:03 +08:00
|
|
|
gtk_widget_set_sensitive (button, FALSE);
|
2018-06-05 22:00:43 +08:00
|
|
|
gimp_help_set_help_data (button,
|
2018-06-10 04:35:46 +08:00
|
|
|
_("Rotate the active layer, selection or path "
|
|
|
|
"by the measured angle"),
|
2018-06-05 22:00:43 +08:00
|
|
|
NULL);
|
2017-12-27 19:08:03 +08:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2018-06-10 13:24:56 +08:00
|
|
|
options->straighten_button = button;
|
|
|
|
|
2003-02-10 01:32:52 +08:00
|
|
|
return vbox;
|
2003-02-05 22:39:40 +08:00
|
|
|
}
|