Some formatting cleanup in the unified transform tool commits
This commit is contained in:
parent
2d2756688d
commit
b1acd93f5e
@ -470,27 +470,43 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
|
||||
{
|
||||
GdkModifierType shift = gimp_get_extend_selection_mask ();
|
||||
GdkModifierType ctrl = gimp_get_constrain_behavior_mask ();
|
||||
struct {
|
||||
|
||||
struct
|
||||
{
|
||||
GdkModifierType mod;
|
||||
gchar *name;
|
||||
gchar *desc;
|
||||
gchar *tip;
|
||||
} opt_list[] = {
|
||||
}
|
||||
opt_list[] =
|
||||
{
|
||||
{ shift, NULL, "Constrain (%s)" },
|
||||
{ shift, "constrain-move", "Move", "Constrain movement to 45 degree angles from center (%s)" },
|
||||
{ shift, "constrain-scale", "Scale", "Maintain aspect ratio when scaling (%s)" },
|
||||
{ shift, "constrain-rotate", "Rotate", "Constrain rotation to 15 degree increments (%s)" },
|
||||
{ shift, "constrain-shear", "Shear", "Shear along edge direction only (%s)" },
|
||||
{ shift, "constrain-perspective", "Perspective", "Constrain perspective handles to move along edges and diagonal (%s)" },
|
||||
{ shift, "constrain-move", "Move",
|
||||
"Constrain movement to 45 degree angles from center (%s)" },
|
||||
{ shift, "constrain-scale", "Scale",
|
||||
"Maintain aspect ratio when scaling (%s)" },
|
||||
{ shift, "constrain-rotate", "Rotate",
|
||||
"Constrain rotation to 15 degree increments (%s)" },
|
||||
{ shift, "constrain-shear", "Shear",
|
||||
"Shear along edge direction only (%s)" },
|
||||
{ shift, "constrain-perspective", "Perspective",
|
||||
"Constrain perspective handles to move along edges and diagonal (%s)" },
|
||||
|
||||
{ ctrl, NULL, "From pivot (%s)" },
|
||||
{ ctrl, "frompivot-scale", "Scale", "Scale from pivot point (%s)" },
|
||||
{ ctrl, "frompivot-shear", "Shear", "Shear opposite edge by same amount (%s)" },
|
||||
{ ctrl, "frompivot-perspective", "Perspective", "Maintain position of pivot while changing perspective (%s)" },
|
||||
{ ctrl, NULL,
|
||||
"From pivot (%s)" },
|
||||
{ ctrl, "frompivot-scale", "Scale",
|
||||
"Scale from pivot point (%s)" },
|
||||
{ ctrl, "frompivot-shear", "Shear",
|
||||
"Shear opposite edge by same amount (%s)" },
|
||||
{ ctrl, "frompivot-perspective", "Perspective",
|
||||
"Maintain position of pivot while changing perspective (%s)" },
|
||||
|
||||
{ 0, NULL, "Pivot" },
|
||||
{ shift, "cornersnap", "Snap (%s)", "Snap pivot to corners and center (%s)" },
|
||||
{ 0, "fixedpivot", "Lock", "Lock pivot position to canvas" },
|
||||
{ 0, NULL,
|
||||
"Pivot" },
|
||||
{ shift, "cornersnap", "Snap (%s)",
|
||||
"Snap pivot to corners and center (%s)" },
|
||||
{ 0, "fixedpivot", "Lock",
|
||||
"Lock pivot position to canvas" },
|
||||
};
|
||||
|
||||
GtkWidget *button;
|
||||
@ -512,9 +528,11 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
|
||||
|
||||
if (opt_list[i].name)
|
||||
{
|
||||
button = gimp_prop_check_button_new (config, opt_list[i].name, label);
|
||||
button = gimp_prop_check_button_new (config, opt_list[i].name,
|
||||
label);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (frame ? grid_box : vbox), button, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (frame ? grid_box : vbox),
|
||||
button, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
@ -150,6 +150,7 @@ static void gimp_transform_tool_handles_recalc (GimpTransformTool
|
||||
static void gimp_transform_tool_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
GimpTransformTool *tr_tool);
|
||||
|
||||
static void free_trans (gpointer data);
|
||||
static void update_sensitivity (GimpTransformTool *tr_tool);
|
||||
|
||||
@ -288,6 +289,7 @@ gimp_transform_tool_initialize (GimpTool *tool,
|
||||
tr_tool->old_trans_info = g_list_last (tr_tool->undo_list)->data;
|
||||
tr_tool->prev_trans_info = g_list_first (tr_tool->undo_list)->data;
|
||||
update_sensitivity (tr_tool);
|
||||
|
||||
/* Save the current transformation info */
|
||||
for (i = 0; i < TRANS_INFO_SIZE; i++)
|
||||
{
|
||||
@ -351,8 +353,9 @@ void gimp_transform_tool_push_internal_undo (GimpTransformTool *tr_tool)
|
||||
{
|
||||
gint i;
|
||||
|
||||
/* push current state on the undo list and set this
|
||||
* state as the current state, but avoid doing this if there were no changes */
|
||||
/* push current state on the undo list and set this state as the
|
||||
* current state, but avoid doing this if there were no changes
|
||||
*/
|
||||
for (i = 0; i < TRANS_INFO_SIZE; i++)
|
||||
if ((*tr_tool->prev_trans_info)[i] != tr_tool->trans_info[i])
|
||||
break;
|
||||
@ -362,10 +365,12 @@ void gimp_transform_tool_push_internal_undo (GimpTransformTool *tr_tool)
|
||||
tr_tool->prev_trans_info = g_slice_new (TransInfo);
|
||||
for (i = 0; i < TRANS_INFO_SIZE; i++)
|
||||
(*tr_tool->prev_trans_info)[i] = tr_tool->trans_info[i];
|
||||
tr_tool->undo_list = g_list_prepend (tr_tool->undo_list, tr_tool->prev_trans_info);
|
||||
tr_tool->undo_list = g_list_prepend (tr_tool->undo_list,
|
||||
tr_tool->prev_trans_info);
|
||||
|
||||
/* If we undid anything and started interacting, we have to discard
|
||||
* the redo history */
|
||||
/* If we undid anything and started interacting, we have to
|
||||
* discard the redo history
|
||||
*/
|
||||
g_list_free_full (tr_tool->redo_list, free_trans);
|
||||
tr_tool->redo_list = NULL;
|
||||
|
||||
@ -803,7 +808,8 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
|
||||
tr_tool->y1,
|
||||
tr_tool->x2,
|
||||
tr_tool->y2,
|
||||
GIMP_IS_PERSPECTIVE_TOOL (tr_tool) || GIMP_IS_UNIFIED_TRANSFORM_TOOL (tr_tool),
|
||||
GIMP_IS_PERSPECTIVE_TOOL (tr_tool) ||
|
||||
GIMP_IS_UNIFIED_TRANSFORM_TOOL (tr_tool),
|
||||
options->preview_opacity);
|
||||
}
|
||||
|
||||
@ -1560,24 +1566,32 @@ gimp_transform_tool_response (GtkWidget *widget,
|
||||
if (response_id == RESPONSE_UNDO)
|
||||
{
|
||||
/* Move prev_trans_info from undo_list to redo_list */
|
||||
tr_tool->redo_list = g_list_prepend (tr_tool->redo_list, tr_tool->prev_trans_info);
|
||||
tr_tool->undo_list = g_list_remove (tr_tool->undo_list, tr_tool->prev_trans_info);
|
||||
tr_tool->redo_list = g_list_prepend (tr_tool->redo_list,
|
||||
tr_tool->prev_trans_info);
|
||||
tr_tool->undo_list = g_list_remove (tr_tool->undo_list,
|
||||
tr_tool->prev_trans_info);
|
||||
tr_tool->prev_trans_info = it->data;
|
||||
}
|
||||
else if (response_id == RESPONSE_REDO)
|
||||
{
|
||||
/* And the opposite */
|
||||
tr_tool->prev_trans_info = it->data;
|
||||
tr_tool->undo_list = g_list_prepend (tr_tool->undo_list, tr_tool->prev_trans_info);
|
||||
tr_tool->redo_list = g_list_remove (tr_tool->redo_list, tr_tool->prev_trans_info);
|
||||
tr_tool->undo_list = g_list_prepend (tr_tool->undo_list,
|
||||
tr_tool->prev_trans_info);
|
||||
tr_tool->redo_list = g_list_remove (tr_tool->redo_list,
|
||||
tr_tool->prev_trans_info);
|
||||
}
|
||||
else if (response_id == RESPONSE_RESET)
|
||||
{
|
||||
/* Move all undo events to redo, and pop off the first one as that's the current one,
|
||||
* which always sits on the undo_list */
|
||||
tr_tool->redo_list = g_list_remove (g_list_concat (g_list_reverse (tr_tool->undo_list), tr_tool->redo_list), tr_tool->old_trans_info);
|
||||
tr_tool->redo_list =
|
||||
g_list_remove (g_list_concat (g_list_reverse (tr_tool->undo_list),
|
||||
tr_tool->redo_list),
|
||||
tr_tool->old_trans_info);
|
||||
tr_tool->prev_trans_info = tr_tool->old_trans_info;
|
||||
tr_tool->undo_list = g_list_prepend (NULL, tr_tool->prev_trans_info);
|
||||
tr_tool->undo_list = g_list_prepend (NULL,
|
||||
tr_tool->prev_trans_info);
|
||||
}
|
||||
update_sensitivity (tr_tool);
|
||||
|
||||
@ -1611,12 +1625,14 @@ gimp_transform_tool_response (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
static void free_trans (gpointer data)
|
||||
static void
|
||||
free_trans (gpointer data)
|
||||
{
|
||||
g_slice_free (TransInfo, data);
|
||||
}
|
||||
|
||||
static void update_sensitivity (GimpTransformTool *tr_tool)
|
||||
static void
|
||||
update_sensitivity (GimpTransformTool *tr_tool)
|
||||
{
|
||||
if (!tr_tool->dialog)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user