More work on Label apply feature

h/t Pere for adding the missing pieces.

WIP b/c there's one minor side effect that needs addressing
(final label, highlighted red, does not lose its highlight)
This commit is contained in:
Bill Kendrick 2022-02-21 23:23:32 -08:00
parent b62a5f1094
commit 3e385f6a68
2 changed files with 15 additions and 5 deletions

View file

@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt)
http://www.tuxpaint.org/ http://www.tuxpaint.org/
2022.February.17 (0.9.28) 2022.February.22 (0.9.28)
* Improvements to "Paint" and "Lines" tools: * Improvements to "Paint" and "Lines" tools:
------------------------------------------ ------------------------------------------
* Brush spacing may now be altered within Tux Paint. * Brush spacing may now be altered within Tux Paint.
@ -70,11 +70,11 @@ http://www.tuxpaint.org/
(h/t Anat Caspi) (h/t Anat Caspi)
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
* WIP "Label" tool now offers a way to "apply" a label to the * WIP "Label" tool now offers a way to "apply" a label to the canvas
canvas (as if it were 'painted' onto the drawing with the "Text" (as if it were 'painted' onto the drawing with the "Text" tool).
tool).
Closes https://sourceforge.net/p/tuxpaint/feature-requests/213/ Closes https://sourceforge.net/p/tuxpaint/feature-requests/213/
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
& Pere Pujal i Carabantes <perepujal@gmail.com>
* Bugfix: Onscreen keyboard repositions itself to the top if you * Bugfix: Onscreen keyboard repositions itself to the top if you
use [Enter] to move the cursor down, and it begins overlapping use [Enter] to move the cursor down, and it begins overlapping

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - February 17, 2022 June 14, 2002 - February 21, 2022
*/ */
#include "platform.h" #include "platform.h"
@ -28441,6 +28441,7 @@ static void apply_label_node(int old_x, int old_y) {
cursor_x = old_x; cursor_x = old_x;
cursor_y = old_y; cursor_y = old_y;
cursor_left = old_x; cursor_left = old_x;
SDL_Rect rect;
rec_undo_buffer(); rec_undo_buffer();
do_render_cur_text(1); do_render_cur_text(1);
@ -28453,6 +28454,15 @@ static void apply_label_node(int old_x, int old_y) {
draw_fonts(); draw_fonts();
have_to_rec_label_node = TRUE; have_to_rec_label_node = TRUE;
rect.x = label_node_to_edit->save_x;
rect.y = label_node_to_edit->save_y;
rect.w = label_node_to_edit->save_width;
rect.w = label_node_to_edit->save_height;
SDL_BlitSurface( label_node_to_edit->label_node_surface, NULL, canvas, &rect);
label_node_to_edit->is_enabled = FALSE;
add_label_node(0, 0, 0, 0, NULL); add_label_node(0, 0, 0, 0, NULL);
derender_node(&label_node_to_edit); derender_node(&label_node_to_edit);
label_node_to_edit = NULL; label_node_to_edit = NULL;