Commit c31defcb authored by William Skaggs's avatar William Skaggs
Browse files

Bill Skaggs <weskaggs@primate.ucdavis.edu>

	* app/tools/gimprectangletool.c
	* app/tools/gimprectangletool.h
	* app/tools/gimprectangleoptions.c
	* app/tools/gimprectangleoptions.h: new code for base
	class for rectangle tools.

	* app/tools/gimpnewrectselecttool.[ch]: modified to
	derive from GimpRectangleTool.

	* app/tools/Makefile.am: modified accordingly

	* app/tools/gimpselectionoptions.[ch]: remove stuff
	no longer needed by new rect select tool.

	This is work in progress.
parent d8457740
2005-03-02 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* gimp/app/widgets/gimpgradienteditor.c: allow dnd of colors
* app/tools/gimprectangletool.c
* app/tools/gimprectangletool.h
* app/tools/gimprectangleoptions.c
* app/tools/gimprectangleoptions.h: new code for base
class for rectangle tools.
* app/tools/gimpnewrectselecttool.[ch]: modified to
derive from GimpRectangleTool.
* app/tools/Makefile.am: modified accordingly
* app/tools/gimpselectionoptions.[ch]: remove stuff
no longer needed by new rect select tool.
This is work in progress.
2005-03-02 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/widgets/gimpgradienteditor.c: allow dnd of colors
into preview and control areas, as described in
bug #119470.
......
......@@ -108,6 +108,10 @@ libapptools_a_sources = \
gimpposterizetool.h \
gimpnewrectselecttool.c \
gimpnewrectselecttool.h \
gimprectangletool.c \
gimprectangletool.h \
gimprectangleoptions.c \
gimprectangleoptions.h \
gimprectselecttool.c \
gimprectselecttool.h \
gimprotatetool.c \
......
This diff is collapsed.
......@@ -25,7 +25,7 @@
#endif
#include "gui/gui-types.h"
#include "gimpselectiontool.h"
#include "gimprectangletool.h"
#define GIMP_TYPE_NEW_RECT_SELECT_TOOL (gimp_new_rect_select_tool_get_type ())
......@@ -41,51 +41,12 @@ typedef struct _GimpNewRectSelectToolClass GimpNewRectSelectToolClass;
struct _GimpNewRectSelectTool
{
GimpSelectionTool parent_instance;
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
guint function; /* moving or resizing */
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of corners */
/* the dialog */
InfoDialog *rect_select_info;
gdouble orig_vals[2];
gdouble size_vals[2];
gdouble aspect_ratio;
gboolean change_aspect_ratio; /* Boolean for the new_rect_select_info_update function */
/* aspect_ratio should not be chaget whith */
/* new_rect_select_info_update when is called from */
/* new_rect_select_aspect_changed, due to the innacurate*/
/* decimal precision */
GtkWidget *origin_sizeentry;
GtkWidget *size_sizeentry;
GimpRectangleTool parent_instance;
};
struct _GimpNewRectSelectToolClass
{
GimpSelectionToolClass parent_class;
/* virtual function */
void (* rect_select) (GimpNewRectSelectTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
GimpRectangleToolClass parent_class;
};
......
/* The GIMP -- an image manipulation program
* 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimprectangleoptions.h"
#include "gimptooloptions-gui.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_HIGHLIGHT
};
static void gimp_rectangle_options_class_init (GimpRectangleOptionsClass *options_class);
static void gimp_rectangle_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_rectangle_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static GimpToolOptionsClass *parent_class = NULL;
GType
gimp_rectangle_options_get_type (void)
{
static GType type = 0;
if (! type)
{
static const GTypeInfo info =
{
sizeof (GimpRectangleOptionsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_rectangle_options_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpRectangleOptions),
0, /* n_preallocs */
(GInstanceInitFunc) NULL
};
type = g_type_register_static (GIMP_TYPE_SELECTION_OPTIONS,
"GimpRectangleOptions",
&info, 0);
}
return type;
}
static void
gimp_rectangle_options_class_init (GimpRectangleOptionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gimp_rectangle_options_set_property;
object_class->get_property = gimp_rectangle_options_get_property;
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HIGHLIGHT,
"highlight",
N_("Highlight rectangle"),
TRUE,
0);
}
static void
gimp_rectangle_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpRectangleOptions *options = GIMP_RECTANGLE_OPTIONS (object);
switch (property_id)
{
case PROP_HIGHLIGHT:
options->highlight = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_rectangle_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpRectangleOptions *options = GIMP_RECTANGLE_OPTIONS (object);
switch (property_id)
{
case PROP_HIGHLIGHT:
g_value_set_boolean (value, options->highlight);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
GtkWidget *
gimp_rectangle_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *button;
vbox = gimp_selection_options_gui (tool_options);
/* the highlight toggle button */
button = gimp_prop_check_button_new (config, "highlight",
_("Highlight"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
return vbox;
}
/* The GIMP -- an image manipulation program
* 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_RECTANGLE_OPTIONS_H__
#define __GIMP_RECTANGLE_OPTIONS_H__
#include "gimpselectionoptions.h"
#define GIMP_TYPE_RECTANGLE_OPTIONS (gimp_rectangle_options_get_type ())
#define GIMP_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptions))
#define GIMP_RECTANGLE_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptionsClass))
#define GIMP_IS_RECTANGLE_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_OPTIONS))
#define GIMP_IS_RECTANGLE_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RECTANGLE_OPTIONS))
#define GIMP_RECTANGLE_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECTANGLE_OPTIONS, GimpRectangleOptionsClass))
typedef struct _GimpRectangleOptions GimpRectangleOptions;
typedef struct _GimpToolOptionsClass GimpRectangleOptionsClass;
struct _GimpRectangleOptions
{
GimpSelectionOptions parent_instance;
gboolean highlight;
};
GType gimp_rectangle_options_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_rectangle_options_gui (GimpToolOptions *tool_options);
#endif /* __GIMP_SELCTION_OPTIONS_H__ */
This diff is collapsed.
......@@ -25,7 +25,7 @@
#endif
#include "gui/gui-types.h"
#include "gimpselectiontool.h"
#include "gimprectangletool.h"
#define GIMP_TYPE_NEW_RECT_SELECT_TOOL (gimp_new_rect_select_tool_get_type ())
......@@ -41,51 +41,12 @@ typedef struct _GimpNewRectSelectToolClass GimpNewRectSelectToolClass;
struct _GimpNewRectSelectTool
{
GimpSelectionTool parent_instance;
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
guint function; /* moving or resizing */
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of corners */
/* the dialog */
InfoDialog *rect_select_info;
gdouble orig_vals[2];
gdouble size_vals[2];
gdouble aspect_ratio;
gboolean change_aspect_ratio; /* Boolean for the new_rect_select_info_update function */
/* aspect_ratio should not be chaget whith */
/* new_rect_select_info_update when is called from */
/* new_rect_select_aspect_changed, due to the innacurate*/
/* decimal precision */
GtkWidget *origin_sizeentry;
GtkWidget *size_sizeentry;
GimpRectangleTool parent_instance;
};
struct _GimpNewRectSelectToolClass
{
GimpSelectionToolClass parent_class;
/* virtual function */
void (* rect_select) (GimpNewRectSelectTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
GimpRectangleToolClass parent_class;
};
......
This diff is collapsed.
/* The GIMP -- an image manipulation program
* 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_RECTANGLE_TOOL_H__
#define __GIMP_RECTANGLE_TOOL_H__
#ifdef __GNUC__
#warning FIXME #include "gui/gui-types.h"
#endif
#include "gui/gui-types.h"
#include "gimpselectiontool.h"
#define GIMP_TYPE_RECTANGLE_TOOL (gimp_rectangle_tool_get_type ())
#define GIMP_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleTool))
#define GIMP_RECTANGLE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolClass))
#define GIMP_IS_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_TOOL))
#define GIMP_RECTANGLE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolClass))
#define GIMP_RECTANGLE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolClass))
/* possible functions */
enum
{
RECT_CREATING,
RECT_MOVING,
RECT_RESIZING_LEFT,
RECT_RESIZING_RIGHT,
RECT_EXECUTING
};
typedef struct _GimpRectangleTool GimpRectangleTool;
typedef struct _GimpRectangleToolClass GimpRectangleToolClass;
struct _GimpRectangleTool
{
GimpSelectionTool parent_instance;
gint startx; /* starting x coord */
gint starty; /* starting y coord */
gint lastx; /* previous x coord */
gint lasty; /* previous y coord */
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
guint function; /* moving or resizing */
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of corners */
gdouble orig_vals[2];
gdouble size_vals[2];
gdouble aspect_ratio;
gboolean change_aspect_ratio; /* Boolean for the rectangle_info_update function */
/* aspect_ratio should not be changed whith */
/* rectangle_info_update when it is called from */
/* rectangle_aspect_changed, due to the inaccurate*/
/* decimal precision */
};
struct _GimpRectangleToolClass
{
GimpSelectionToolClass parent_class;
/* virtual function */
void (* execute) (GimpRectangleTool *rect_tool,
gint x,
gint y,
gint w,
gint h);
};
GType gimp_rectangle_tool_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_RECTANGLE_TOOL_H__ */
......@@ -60,8 +60,6 @@ enum
PROP_FIXED_WIDTH,
PROP_FIXED_HEIGHT,
PROP_FIXED_UNIT,
PROP_ADJUSTABLE,
PROP_SHOW_DIALOG,
PROP_INTERACTIVE
};
......@@ -193,17 +191,6 @@ gimp_selection_options_class_init (GimpSelectionOptionsClass *klass)
TRUE, TRUE, GIMP_UNIT_PIXEL,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ADJUSTABLE,
"adjustable",
N_("Adjustable"),
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_DIALOG,
"show-dialog",
N_("Show dialog"),
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INTERACTIVE,
"interactive", NULL,
FALSE,
......@@ -263,13 +250,6 @@ gimp_selection_options_set_property (GObject *object,
options->fixed_unit = g_value_get_int (value);
break;
case PROP_ADJUSTABLE:
options->adjustable = g_value_get_boolean (value);
break;
case PROP_SHOW_DIALOG:
options->show_dialog = g_value_get_boolean (value);
break;
case PROP_INTERACTIVE:
options->interactive = g_value_get_boolean (value);
break;
......@@ -333,13 +313,6 @@ gimp_selection_options_get_property (GObject *object,
g_value_set_int (value, options->fixed_unit);
break;
case PROP_ADJUSTABLE:
g_value_set_boolean (value, options->adjustable);
break;
case PROP_SHOW_DIALOG:
g_value_set_boolean (value, options->show_dialog);
break;
case PROP_INTERACTIVE:
g_value_set_boolean (value, options->interactive);
break;
......@@ -577,29 +550,6 @@ gimp_selection_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (table);
}
if (tool_options->tool_info->tool_type == GIMP_TYPE_NEW_RECT_SELECT_TOOL)
{
GtkWidget *frame;
frame = gimp_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
button = gimp_prop_check_button_new (config, "adjustable",
_("Adjustable"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
frame = gimp_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
button = gimp_prop_check_button_new (config, "show-dialog",
_("Show dialog"));
gtk_frame_set_label_widget (GTK_FRAME (frame), button);
gtk_widget_show (button);
}
return vbox;
}
......
......@@ -58,9 +58,6 @@ struct _GimpSelectionOptions
gdouble fixed_height;
GimpUnit fixed_unit;
gboolean adjustable;
gboolean show_dialog;
/* used by iscissors */
gboolean interactive;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment