Stamp rotation: Show degrees as Tux tool tip

This commit is contained in:
Bill Kendrick 2023-02-18 14:01:21 -08:00
parent 6fd0517f1e
commit 1627e5a801
2 changed files with 14 additions and 7 deletions

View file

@ -23,8 +23,7 @@
bill@newbreedsoftware.com bill@newbreedsoftware.com
https://tuxpaint.org/ https://tuxpaint.org/
June 14, 2002 - December 11, 2022 June 14, 2002 - February 18, 2023
$Id$
*/ */
@ -198,7 +197,7 @@ const char *const tool_tips[NUM_TOOLS] = {
#define TIP_BRUSH_SPACING_MORE_FRAC gettext_noop("This brush's spacing is now about %1$d %2$d/%3$d times as big as the brush shape.") #define TIP_BRUSH_SPACING_MORE_FRAC gettext_noop("This brush's spacing is now about %1$d %2$d/%3$d times as big as the brush shape.")
// Instructions to show when rotating stamps // Instructions to show when rotating stamps
#define TIP_STAMPS_ROTATING gettext_noop("Drag the mouse to rotate the stamp. Click to draw it.") #define TIP_STAMPS_ROTATING gettext_noop("Drag the mouse to rotate the stamp. Click to draw it. (It is rotated %d degrees.)")
/* Tool icon filenames: */ /* Tool icon filenames: */

View file

@ -6243,7 +6243,9 @@ static void mainloop(void)
stamp_tool_mode = STAMP_TOOL_MODE_ROTATE; stamp_tool_mode = STAMP_TOOL_MODE_ROTATE;
stamp_place_x = old_x; stamp_place_x = old_x;
stamp_place_y = old_y; stamp_place_y = old_y;
draw_tux_text(TUX_GREAT, TIP_STAMPS_ROTATING, 1); snprintf(angle_tool_text, sizeof(angle_tool_text),
gettext(TIP_STAMPS_ROTATING), 0);
draw_tux_text(TUX_GREAT, angle_tool_text, 1);
} }
else else
{ {
@ -6968,11 +6970,13 @@ static void mainloop(void)
{ {
if (stamp_tool_mode == STAMP_TOOL_MODE_ROTATE) if (stamp_tool_mode == STAMP_TOOL_MODE_ROTATE)
{ {
int deg;
stamp_xor(stamp_place_x, stamp_place_y); stamp_xor(stamp_place_x, stamp_place_y);
update_stamp_xor((360 - deg = (360 - stamp_rotation(stamp_place_x, stamp_place_y, new_x, new_y)) % 360;
stamp_rotation(stamp_place_x, stamp_place_y,
new_x, new_y)) % 360); update_stamp_xor(deg);
stamp_xor(stamp_place_x, stamp_place_y); stamp_xor(stamp_place_x, stamp_place_y);
/* The half of maximum size the stamp could have when rotating. */ /* The half of maximum size the stamp could have when rotating. */
@ -6983,6 +6987,10 @@ static void mainloop(void)
stamp_place_y - half_bigbox + r_canvas.y, stamp_place_y - half_bigbox + r_canvas.y,
stamp_place_x + half_bigbox + r_canvas.x, stamp_place_x + half_bigbox + r_canvas.x,
stamp_place_y + half_bigbox + r_canvas.y); stamp_place_y + half_bigbox + r_canvas.y);
snprintf(angle_tool_text, sizeof(angle_tool_text),
gettext(TIP_STAMPS_ROTATING), deg);
draw_tux_text(TUX_GREAT, angle_tool_text, 1);
} }
else if (stamp_xored_rt) else if (stamp_xored_rt)
{ {