applied (modified) patch from Ari Pollak which enables controlling the

2004-08-06  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpsheartool.[ch]: applied (modified) patch from Ari
	Pollak which enables controlling the shear direction from the
	dialog and changing the shear direction without hitting "Reset".
	Fixes bug #149467.

	Also moved all static variables to the GimpShearTool struct and
	converted tabs to spaces.
This commit is contained in:
Michael Natterer 2004-08-06 13:56:34 +00:00 committed by Michael Natterer
parent 91cf50aefb
commit 42bc755ca7
3 changed files with 78 additions and 53 deletions

View file

@ -1,3 +1,13 @@
2004-08-06 Michael Natterer <mitch@gimp.org>
* app/tools/gimpsheartool.[ch]: applied (modified) patch from Ari
Pollak which enables controlling the shear direction from the
dialog and changing the shear direction without hitting "Reset".
Fixes bug #149467.
Also moved all static variables to the GimpShearTool struct and
converted tabs to spaces.
2004-08-06 DindinX <david@dindinx.org>
* plug-ins/common/nova.c: ported to GimpPreviewArea.

View file

@ -58,7 +58,7 @@
#define MIN_MOVE 5
/* forward function declarations */
/* local function prototypes */
static void gimp_shear_tool_class_init (GimpShearToolClass *klass);
static void gimp_shear_tool_init (GimpShearTool *shear_tool);
@ -79,14 +79,12 @@ static void shear_y_mag_changed (GtkWidget *widget,
GimpTransformTool *tr_tool);
/* variables local to this file */
static gdouble xshear_val;
static gdouble yshear_val;
/* private variables */
static GimpTransformToolClass *parent_class = NULL;
/* Public functions */
/* public functions */
void
gimp_shear_tool_register (GimpToolRegisterCallback callback,
@ -162,16 +160,18 @@ gimp_shear_tool_init (GimpShearTool *shear_tool)
static void
gimp_shear_tool_dialog (GimpTransformTool *tr_tool)
{
GimpShearTool *shear = GIMP_SHEAR_TOOL (tr_tool);
info_dialog_add_spinbutton (tr_tool->info_dialog,
_("Shear magnitude X:"),
&xshear_val,
&shear->xshear_val,
-65536, 65536, 1, 15, 1, 1, 0,
G_CALLBACK (shear_x_mag_changed),
tr_tool);
info_dialog_add_spinbutton (tr_tool->info_dialog,
_("Shear magnitude Y:"),
&yshear_val,
&shear->yshear_val,
-65536, 65536, 1, 15, 1, 1, 0,
G_CALLBACK (shear_y_mag_changed),
tr_tool);
@ -270,6 +270,10 @@ gimp_shear_tool_recalc (GimpTransformTool *tr_tool,
{
gdouble amount;
if (tr_tool->trans_info[XSHEAR] == 0.0 &&
tr_tool->trans_info[YSHEAR] == 0.0)
tr_tool->trans_info[HORZ_OR_VERT] = GIMP_ORIENTATION_UNKNOWN;
if (tr_tool->trans_info[HORZ_OR_VERT] == GIMP_ORIENTATION_HORIZONTAL)
amount = tr_tool->trans_info[XSHEAR];
else
@ -293,8 +297,10 @@ gimp_shear_tool_recalc (GimpTransformTool *tr_tool,
static void
shear_info_update (GimpTransformTool *tr_tool)
{
xshear_val = tr_tool->trans_info[XSHEAR];
yshear_val = tr_tool->trans_info[YSHEAR];
GimpShearTool *shear = GIMP_SHEAR_TOOL (tr_tool);
shear->xshear_val = tr_tool->trans_info[XSHEAR];
shear->yshear_val = tr_tool->trans_info[YSHEAR];
info_dialog_update (tr_tool->info_dialog);
info_dialog_show (tr_tool->info_dialog);
@ -312,6 +318,9 @@ shear_x_mag_changed (GtkWidget *widget,
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
if (tr_tool->trans_info[HORZ_OR_VERT] == GIMP_ORIENTATION_UNKNOWN)
tr_tool->trans_info[HORZ_OR_VERT] = GIMP_ORIENTATION_HORIZONTAL;
tr_tool->trans_info[XSHEAR] = value;
gimp_shear_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->gdisp);
@ -334,6 +343,9 @@ shear_y_mag_changed (GtkWidget *widget,
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
if (tr_tool->trans_info[HORZ_OR_VERT] == GIMP_ORIENTATION_UNKNOWN)
tr_tool->trans_info[HORZ_OR_VERT] = GIMP_ORIENTATION_VERTICAL;
tr_tool->trans_info[YSHEAR] = value;
gimp_shear_tool_recalc (tr_tool, GIMP_TOOL (tr_tool)->gdisp);

View file

@ -37,6 +37,9 @@ typedef struct _GimpShearToolClass GimpShearToolClass;
struct _GimpShearTool
{
GimpTransformTool parent_instance;
gdouble xshear_val;
gdouble yshear_val;
};
struct _GimpShearToolClass