update the original width and height when the chain-button is changed to
2007-05-26 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpwidgets.c (gimp_coordinates_new): update the original width and height when the chain-button is changed to the active state. svn path=/trunk/; revision=22631
This commit is contained in:

committed by
Sven Neumann

parent
1dd7562dcd
commit
e601d3e704
@ -1,3 +1,9 @@
|
|||||||
|
2007-05-26 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/gimpwidgets.c (gimp_coordinates_new): update the
|
||||||
|
original width and height when the chain-button is changed to the
|
||||||
|
active state.
|
||||||
|
|
||||||
2007-05-26 Sven Neumann <sven@gimp.org>
|
2007-05-26 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpsizebox.c (GimpSizeBoxPrivate): removed unused
|
* app/widgets/gimpsizebox.c (GimpSizeBoxPrivate): removed unused
|
||||||
|
@ -1063,12 +1063,6 @@ typedef struct
|
|||||||
gdouble last_y;
|
gdouble last_y;
|
||||||
} GimpCoordinatesData;
|
} GimpCoordinatesData;
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_coordinates_data_free (GimpCoordinatesData *data)
|
|
||||||
{
|
|
||||||
g_slice_free (GimpCoordinatesData, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_coordinates_callback (GtkWidget *widget,
|
gimp_coordinates_callback (GtkWidget *widget,
|
||||||
GimpCoordinatesData *data)
|
GimpCoordinatesData *data)
|
||||||
@ -1090,7 +1084,6 @@ gimp_coordinates_callback (GtkWidget *widget,
|
|||||||
data->last_x = new_x;
|
data->last_x = new_x;
|
||||||
new_y = (new_x * data->orig_y) / data->orig_x;
|
new_y = (new_x * data->orig_y) / data->orig_x;
|
||||||
|
|
||||||
/* g_signal_stop_emission_by_name (widget, "value-changed"); */
|
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1,
|
||||||
new_y);
|
new_y);
|
||||||
data->last_y
|
data->last_y
|
||||||
@ -1101,7 +1094,6 @@ gimp_coordinates_callback (GtkWidget *widget,
|
|||||||
data->last_y = new_y;
|
data->last_y = new_y;
|
||||||
new_x = (new_y * data->orig_x) / data->orig_y;
|
new_x = (new_y * data->orig_x) / data->orig_y;
|
||||||
|
|
||||||
/* g_signal_stop_emission_by_name (widget, "value-changed"); */
|
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0,
|
||||||
new_x);
|
new_x);
|
||||||
data->last_x
|
data->last_x
|
||||||
@ -1115,7 +1107,6 @@ gimp_coordinates_callback (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
new_y = new_x;
|
new_y = new_x;
|
||||||
|
|
||||||
/* g_signal_stop_emission_by_name (widget, "value-changed"); */
|
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x);
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, new_x);
|
||||||
data->last_y = data->last_x
|
data->last_y = data->last_x
|
||||||
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||||
@ -1124,7 +1115,6 @@ gimp_coordinates_callback (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
new_x = new_y;
|
new_x = new_y;
|
||||||
|
|
||||||
/* g_signal_stop_emission_by_name (widget, "value-changed"); */
|
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y);
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, new_y);
|
||||||
data->last_x = data->last_y
|
data->last_x = data->last_y
|
||||||
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
= gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||||
@ -1140,6 +1130,27 @@ gimp_coordinates_callback (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_coordinates_data_free (GimpCoordinatesData *data)
|
||||||
|
{
|
||||||
|
g_slice_free (GimpCoordinatesData, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_coordinates_chainbutton_toggled (GimpChainButton *button,
|
||||||
|
GimpSizeEntry *entry)
|
||||||
|
{
|
||||||
|
if (gimp_chain_button_get_active (button))
|
||||||
|
{
|
||||||
|
GimpCoordinatesData *data;
|
||||||
|
|
||||||
|
data = g_object_get_data (G_OBJECT (entry), "coordinates-data");
|
||||||
|
|
||||||
|
data->orig_x = gimp_size_entry_get_refval (entry, 0);
|
||||||
|
data->orig_y = gimp_size_entry_get_refval (entry, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_coordinates_new:
|
* gimp_coordinates_new:
|
||||||
* @unit: The initial unit of the #GimpUnitMenu.
|
* @unit: The initial unit of the #GimpUnitMenu.
|
||||||
@ -1263,8 +1274,10 @@ gimp_coordinates_new (GimpUnit unit,
|
|||||||
ylabel, 1, 0, 0.0);
|
ylabel, 1, 0, 0.0);
|
||||||
|
|
||||||
chainbutton = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
chainbutton = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
||||||
|
|
||||||
if (chainbutton_active)
|
if (chainbutton_active)
|
||||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
|
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2,
|
gtk_table_attach (GTK_TABLE (sizeentry), chainbutton, 2, 3, 0, 2,
|
||||||
GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (chainbutton);
|
gtk_widget_show (chainbutton);
|
||||||
@ -1278,9 +1291,9 @@ gimp_coordinates_new (GimpUnit unit,
|
|||||||
data->last_x = x;
|
data->last_x = x;
|
||||||
data->last_y = y;
|
data->last_y = y;
|
||||||
|
|
||||||
g_signal_connect_swapped (sizeentry, "destroy",
|
g_object_set_data_full (G_OBJECT (sizeentry), "coordinates-data",
|
||||||
G_CALLBACK (gimp_coordinates_data_free),
|
data,
|
||||||
data);
|
(GDestroyNotify) gimp_coordinates_data_free);
|
||||||
|
|
||||||
g_signal_connect (sizeentry, "value-changed",
|
g_signal_connect (sizeentry, "value-changed",
|
||||||
G_CALLBACK (gimp_coordinates_callback),
|
G_CALLBACK (gimp_coordinates_callback),
|
||||||
@ -1288,6 +1301,10 @@ gimp_coordinates_new (GimpUnit unit,
|
|||||||
|
|
||||||
g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton);
|
g_object_set_data (G_OBJECT (sizeentry), "chainbutton", chainbutton);
|
||||||
|
|
||||||
|
g_signal_connect (chainbutton, "toggled",
|
||||||
|
G_CALLBACK (gimp_coordinates_chainbutton_toggled),
|
||||||
|
sizeentry);
|
||||||
|
|
||||||
return sizeentry;
|
return sizeentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user