diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 91203541d..84eb2f493 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt) http://www.tuxpaint.org/ -2022.February.17 (0.9.28) +2022.February.22 (0.9.28) * Improvements to "Paint" and "Lines" tools: ------------------------------------------ * Brush spacing may now be altered within Tux Paint. @@ -70,16 +70,19 @@ http://www.tuxpaint.org/ (h/t Anat Caspi) Bill Kendrick - * WIP "Label" tool now offers a way to "apply" a label to the - canvas (as if it were 'painted' onto the drawing with the "Text" - tool). + * "Label" tool now offers a way to "apply" a label to the canvas + (as if it were 'painted' onto the drawing with the "Text" tool). Closes https://sourceforge.net/p/tuxpaint/feature-requests/213/ Bill Kendrick + & Pere Pujal i Carabantes * Bugfix: Onscreen keyboard repositions itself to the top if you use [Enter] to move the cursor down, and it begins overlapping the keyboard. + * Bugfix: Positioning and rendering of labels selected for editing + via [Tab] cycling & the [Enter] key now works as expected. + * More instructional text is shown (and sound effects play) when using the Label tool. Bill Kendrick diff --git a/docs/en/README.txt b/docs/en/README.txt index 954351b8c..5afc1a990 100644 --- a/docs/en/README.txt +++ b/docs/en/README.txt @@ -7,7 +7,7 @@ https://tuxpaint.org/ @TuxPaintTweets on Twitter - January 26, 2022 + February 21, 2022 ---------------------------------------------------------------------- @@ -406,9 +406,12 @@ Available Tools "Text" and "Label" Tools Choose a font (from the 'Letters' available on the right) - and a color (from the color palette near the bottom). Click - on the screen and a cursor will appear. Type text and it - will show up on the screen. + and a color (from the color palette near the bottom). You + may also apply a bold, and/or an italic styling effect to + the text. Click on the screen and a cursor will appear. Type + text and it will show up on the screen. (You can change the + font, color, and styling while entering the text, before it + is applied to the canvas.) Press [Enter] or [Return] and the text will be drawn onto the picture and the cursor will move down one line. @@ -441,6 +444,29 @@ Available Tools This allows the label to be repositioned or edited later. + To edit a label, click the label selection + button. All labels in the drawing will appear + highlighted. Click one — or use the [Tab] key + to cycle through all the labels, and the + [Enter] or [Return] key to select one — and you + may then edit the label. (Use they [Backspace] + key to erase characters, and other keys to add + text to the label; click in the canvas to + reposition the label; click in the palette to + change the color of the text in the label; + etc.) + + You may "apply" a label to the canvas, painting + the text into the picture as if it had been + added using the Text tool, by clicking the + label application button. (This feature was + added in Tux Paint version 0.9.28.) All labels + in the drawing will appear highlighted, and you + select one just as you do when selecting a + label to edit. The chosen label will be + removed, and the text will be added directly to + the canvas. + The Label tool can be disabled (e.g., by selecting "Disable 'Label' Tool" in Tux Paint Config. or running Tux Paint with the "nolabel" diff --git a/docs/en/html/README.html b/docs/en/html/README.html index 5305f1bd5..8b0bd0947 100644 --- a/docs/en/html/README.html +++ b/docs/en/html/README.html @@ -29,7 +29,7 @@

- January 26, 2022

+ February 21, 2022


- Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). Click on the screen and a cursor will appear. Type text and it will show up on the screen.

+ Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). You may also apply a bold, and/or an italic styling effect to the text. Click on the screen and a cursor will appear. Type text and it will show up on the screen. (You can change the font, color, and styling while entering the text, before it is applied to the canvas.)

Press [Enter] or [Return] and the text will be drawn onto the picture and the cursor will move down one line.

@@ -671,6 +671,12 @@

When using the Label tool (which was added to Tux Paint in version 0.9.22), the text 'floats' over the image, and the details of the label (the text, the position of the label, the font choice and the color) get stored separately. This allows the label to be repositioned or edited later.

+

+ To edit a label, click the label selection button. All labels in the drawing will appear highlighted. Click one — or use the [Tab] key to cycle through all the labels, and the [Enter] or [Return] key to select one — and you may then edit the label. (Use they [Backspace] key to erase characters, and other keys to add text to the label; click in the canvas to reposition the label; click in the palette to change the color of the text in the label; etc.)

+ +

+ You may "apply" a label to the canvas, painting the text into the picture as if it had been added using the Text tool, by clicking the label application button. (This feature was added in Tux Paint version 0.9.28.) All labels in the drawing will appear highlighted, and you select one just as you do when selecting a label to edit. The chosen label will be removed, and the text will be added directly to the canvas.

+

The Label tool can be disabled (e.g., by selecting "Disable 'Label' Tool" in Tux Paint Config. or running Tux Paint with the "nolabel" option).

diff --git a/docs/es_ES.UTF-8/README.txt b/docs/es_ES.UTF-8/README.txt index 7028ec5de..45991da08 100644 --- a/docs/es_ES.UTF-8/README.txt +++ b/docs/es_ES.UTF-8/README.txt @@ -7,7 +7,7 @@ https://tuxpaint.org/ @TuxPaintTweets on Twitter - enero 26, 2022 + febrero 21, 2022 ---------------------------------------------------------------------- @@ -406,9 +406,12 @@ Available Tools "Text" and "Label" Tools Choose a font (from the 'Letters' available on the right) - and a color (from the color palette near the bottom). Click - on the screen and a cursor will appear. Type text and it - will show up on the screen. + and a color (from the color palette near the bottom). You + may also apply a bold, and/or an italic styling effect to + the text. Click on the screen and a cursor will appear. Type + text and it will show up on the screen. (You can change the + font, color, and styling while entering the text, before it + is applied to the canvas.) Press [Enter] or [Return] and the text will be drawn onto the picture and the cursor will move down one line. @@ -441,6 +444,29 @@ Available Tools This allows the label to be repositioned or edited later. + To edit a label, click the label selection + button. All labels in the drawing will appear + highlighted. Click one — or use the [Tab] key + to cycle through all the labels, and the + [Enter] or [Return] key to select one — and you + may then edit the label. (Use they [Backspace] + key to erase characters, and other keys to add + text to the label; click in the canvas to + reposition the label; click in the palette to + change the color of the text in the label; + etc.) + + You may "apply" a label to the canvas, painting + the text into the picture as if it had been + added using the Text tool, by clicking the + label application button. (This feature was + added in Tux Paint version 0.9.28.) All labels + in the drawing will appear highlighted, and you + select one just as you do when selecting a + label to edit. The chosen label will be + removed, and the text will be added directly to + the canvas. + The Label tool can be disabled (e.g., by selecting "Disable 'Label' Tool" in Tux Paint Config. or running Tux Paint with the "nolabel" diff --git a/docs/es_ES.UTF-8/html/README.html b/docs/es_ES.UTF-8/html/README.html index 7603c8688..561cc7354 100644 --- a/docs/es_ES.UTF-8/html/README.html +++ b/docs/es_ES.UTF-8/html/README.html @@ -29,7 +29,7 @@

- enero 26, 2022

+ febrero 21, 2022


- Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). Click on the screen and a cursor will appear. Type text and it will show up on the screen.

+ Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). You may also apply a bold, and/or an italic styling effect to the text. Click on the screen and a cursor will appear. Type text and it will show up on the screen. (You can change the font, color, and styling while entering the text, before it is applied to the canvas.)

Press [Enter] or [Return] and the text will be drawn onto the picture and the cursor will move down one line.

@@ -671,6 +671,12 @@

When using the Label tool (which was added to Tux Paint in version 0.9.22), the text 'floats' over the image, and the details of the label (the text, the position of the label, the font choice and the color) get stored separately. This allows the label to be repositioned or edited later.

+

+ To edit a label, click the label selection button. All labels in the drawing will appear highlighted. Click one — or use the [Tab] key to cycle through all the labels, and the [Enter] or [Return] key to select one — and you may then edit the label. (Use they [Backspace] key to erase characters, and other keys to add text to the label; click in the canvas to reposition the label; click in the palette to change the color of the text in the label; etc.)

+ +

+ You may "apply" a label to the canvas, painting the text into the picture as if it had been added using the Text tool, by clicking the label application button. (This feature was added in Tux Paint version 0.9.28.) All labels in the drawing will appear highlighted, and you select one just as you do when selecting a label to edit. The chosen label will be removed, and the text will be added directly to the canvas.

+

The Label tool can be disabled (e.g., by selecting "Disable 'Label' Tool" in Tux Paint Config. or running Tux Paint with the "nolabel" option).

diff --git a/docs/fr_FR.UTF-8/README.txt b/docs/fr_FR.UTF-8/README.txt index c7768fa24..ef11fe8ca 100644 --- a/docs/fr_FR.UTF-8/README.txt +++ b/docs/fr_FR.UTF-8/README.txt @@ -7,7 +7,7 @@ https://tuxpaint.org/ @TuxPaintTweets on Twitter - janvier 26, 2022 + février 21, 2022 ---------------------------------------------------------------------- @@ -433,10 +433,13 @@ Outils disponibles Outils "Texte" et "Étiquette" - Choisissez une police (parmi les «Lettres» disponibles sur - la droite) et une couleur (dans la palette de couleurs en - bas). Cliquez sur l'écran et un curseur apparaîtra. Tapez un - texte et il apparaîtra à l'écran. + Choose a font (from the 'Letters' available on the right) + and a color (from the color palette near the bottom). You + may also apply a bold, and/or an italic styling effect to + the text. Click on the screen and a cursor will appear. Type + text and it will show up on the screen. (You can change the + font, color, and styling while entering the text, before it + is applied to the canvas.) Appuyez sur [Entrée] ou [Retour] et le texte sera inclus dans l'image et le curseur se déplacera d'une ligne vers le @@ -473,6 +476,29 @@ Outils disponibles permet à l'étiquette d'être repositionnée ou modifiée ultérieurement. + To edit a label, click the label selection + button. All labels in the drawing will appear + highlighted. Click one — or use the [Tab] key + to cycle through all the labels, and the + [Entrée] or [Retour] key to select one — and + you may then edit the label. (Use they + [Backspace] key to erase characters, and other + keys to add text to the label; click in the + canvas to reposition the label; click in the + palette to change the color of the text in the + label; etc.) + + You may "apply" a label to the canvas, painting + the text into the picture as if it had been + added using the Text tool, by clicking the + label application button. (This feature was + added in Tux Paint version 0.9.28.) All labels + in the drawing will appear highlighted, and you + select one just as you do when selecting a + label to edit. The chosen label will be + removed, and the text will be added directly to + the canvas. + L' outil Étiquette peut être désactivé (par exemple, en sélectionnant "Désactiver l'outil 'Label'" dans Tux Paint Config ou bien en diff --git a/docs/fr_FR.UTF-8/html/README.html b/docs/fr_FR.UTF-8/html/README.html index 7b2b9ac41..c62bf6452 100644 --- a/docs/fr_FR.UTF-8/html/README.html +++ b/docs/fr_FR.UTF-8/html/README.html @@ -29,7 +29,7 @@

- janvier 26, 2022

+ février 21, 2022


- Choisissez une police (parmi les «Lettres» disponibles sur la droite) et une couleur (dans la palette de couleurs en bas). Cliquez sur l'écran et un curseur apparaîtra. Tapez un texte et il apparaîtra à l'écran.

+ Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). You may also apply a bold, and/or an italic styling effect to the text. Click on the screen and a cursor will appear. Type text and it will show up on the screen. (You can change the font, color, and styling while entering the text, before it is applied to the canvas.)

Appuyez sur [Entrée] ou [Retour] et le texte sera inclus dans l'image et le curseur se déplacera d'une ligne vers le bas.

@@ -671,6 +671,12 @@

Lors de l'utilisation de l' outil Étiquette (qui a été ajouté à Tux Paint dans la version 0.9.22), le texte `` flotte '' sur l'image, et les détails de l'étiquette (le texte, la position de l'étiquette, le choix de la police et la couleur ) sont stockés séparément. Cela permet à l'étiquette d'être repositionnée ou modifiée ultérieurement.

+

+ To edit a label, click the label selection button. All labels in the drawing will appear highlighted. Click one — or use the [Tab] key to cycle through all the labels, and the [Entrée] or [Retour] key to select one — and you may then edit the label. (Use they [Backspace] key to erase characters, and other keys to add text to the label; click in the canvas to reposition the label; click in the palette to change the color of the text in the label; etc.)

+ +

+ You may "apply" a label to the canvas, painting the text into the picture as if it had been added using the Text tool, by clicking the label application button. (This feature was added in Tux Paint version 0.9.28.) All labels in the drawing will appear highlighted, and you select one just as you do when selecting a label to edit. The chosen label will be removed, and the text will be added directly to the canvas.

+

L' outil Étiquette peut être désactivé (par exemple, en sélectionnant "Désactiver l'outil 'Label'" dans Tux Paint Config ou bien en exécutant Tux Paint en ligne de commande avec l'option "nolabel").

diff --git a/docs/gl_ES.UTF-8/README.txt b/docs/gl_ES.UTF-8/README.txt index f8fcea689..130aa0c14 100644 --- a/docs/gl_ES.UTF-8/README.txt +++ b/docs/gl_ES.UTF-8/README.txt @@ -7,7 +7,7 @@ https://tuxpaint.org/ @TuxPaintTweets on Twitter - 26 de Xaneiro de 2022 + 21 de Febreiro de 2022 ---------------------------------------------------------------------- @@ -414,10 +414,13 @@ Ferramentas dispoñíbeis Ferramentas «Texto» e «Etiquetas» - Escolla un tipo de letra (entre as «Letras» dispoñíbeis á - dereita) e unha cor (na paleta de cores preto da parte - inferior). prema na pantalla e aparecerá un cursor. Escriba - un texto e aparecerá na pantalla. + Choose a font (from the 'Letters' available on the right) + and a color (from the color palette near the bottom). You + may also apply a bold, and/or an italic styling effect to + the text. Click on the screen and a cursor will appear. Type + text and it will show up on the screen. (You can change the + font, color, and styling while entering the text, before it + is applied to the canvas.) Prema [Intro] ou [Retorno] e o texto será debuxado na imaxe e o cursor moverase cara abaixo unha liña. @@ -452,6 +455,29 @@ Ferramentas dispoñíbeis permite recolocar ou editar a etiqueta máis adiante. + To edit a label, click the label selection + button. All labels in the drawing will appear + highlighted. Click one — or use the [Tab] key + to cycle through all the labels, and the + [Intro] or [Retorno] key to select one — and + you may then edit the label. (Use they + [Backspace] key to erase characters, and other + keys to add text to the label; click in the + canvas to reposition the label; click in the + palette to change the color of the text in the + label; etc.) + + You may "apply" a label to the canvas, painting + the text into the picture as if it had been + added using the Text tool, by clicking the + label application button. (This feature was + added in Tux Paint version 0.9.28.) All labels + in the drawing will appear highlighted, and you + select one just as you do when selecting a + label to edit. The chosen label will be + removed, and the text will be added directly to + the canvas. + A ferramenta Etiqueta pódese desactivar (p. ex.: seleccionando «Desactivar a ferramenta "Etiqueta"» en Tux Paint Config. ou executando diff --git a/docs/gl_ES.UTF-8/html/README.html b/docs/gl_ES.UTF-8/html/README.html index dfe2d77ac..8a0ced32e 100644 --- a/docs/gl_ES.UTF-8/html/README.html +++ b/docs/gl_ES.UTF-8/html/README.html @@ -29,7 +29,7 @@

- 26 de Xaneiro de 2022

+ 21 de Febreiro de 2022


- Escolla un tipo de letra (entre as «Letras» dispoñíbeis á dereita) e unha cor (na paleta de cores preto da parte inferior). prema na pantalla e aparecerá un cursor. Escriba un texto e aparecerá na pantalla.

+ Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). You may also apply a bold, and/or an italic styling effect to the text. Click on the screen and a cursor will appear. Type text and it will show up on the screen. (You can change the font, color, and styling while entering the text, before it is applied to the canvas.)

Prema [Intro] ou [Retorno] e o texto será debuxado na imaxe e o cursor moverase cara abaixo unha liña.

@@ -671,6 +671,12 @@

Ao usar a ferramenta Etiqueta (que foi engadida a Tux Paint na versión 0.9.22), o texto «flota» sobre a imaxe e os detalles da etiqueta (o texto, a posición da etiqueta , a opción de letra e a cor) almacénanse por separado. Isto permite recolocar ou editar a etiqueta máis adiante.

+

+ To edit a label, click the label selection button. All labels in the drawing will appear highlighted. Click one — or use the [Tab] key to cycle through all the labels, and the [Intro] or [Retorno] key to select one — and you may then edit the label. (Use they [Backspace] key to erase characters, and other keys to add text to the label; click in the canvas to reposition the label; click in the palette to change the color of the text in the label; etc.)

+ +

+ You may "apply" a label to the canvas, painting the text into the picture as if it had been added using the Text tool, by clicking the label application button. (This feature was added in Tux Paint version 0.9.28.) All labels in the drawing will appear highlighted, and you select one just as you do when selecting a label to edit. The chosen label will be removed, and the text will be added directly to the canvas.

+

A ferramenta Etiqueta pódese desactivar (p. ex.: seleccionando «Desactivar a ferramenta "Etiqueta"» en Tux Paint Config. ou executando Tux Paint coa opción «nolabel»).

diff --git a/docs/ja_JP.UTF-8/README.txt b/docs/ja_JP.UTF-8/README.txt index ac61576c9..280287434 100644 --- a/docs/ja_JP.UTF-8/README.txt +++ b/docs/ja_JP.UTF-8/README.txt @@ -7,7 +7,7 @@ https://tuxpaint.org/ @TuxPaintTweets on Twitter - 2022年1月26日 + 2022年2月21日 ---------------------------------------------------------------------- @@ -299,7 +299,13 @@ Tux Paint の起動 「もじ」ツール、「ラベル」ツール - まず、右側のセレクタからフォントを、下部のパレットから色を選択します。画面をクリックするとカーソルが表示され、文字を入力することができます。 + Choose a font (from the 'Letters' available on the right) + and a color (from the color palette near the bottom). You + may also apply a bold, and/or an italic styling effect to + the text. Click on the screen and a cursor will appear. Type + text and it will show up on the screen. (You can change the + font, color, and styling while entering the text, before it + is applied to the canvas.) [Enter]キー、または[Return]キーを押すと文字が描画され、カーソルが次の行に下がります。 @@ -315,6 +321,29 @@ Tux Paint の起動 Tux Paint バージョン 0.9.22 で追加された「ラベル」ツールでは、文字は絵から「浮いて」おり、文字列の内容、位置、フォント、色などの情報は個別に記録されます。これにより、「ラベル」は後から移動や編集が可能です。 + To edit a label, click the label selection + button. All labels in the drawing will appear + highlighted. Click one — or use the [Tab] key + to cycle through all the labels, and the + [Enter] or [Return] key to select one — and you + may then edit the label. (Use they [Backspace] + key to erase characters, and other keys to add + text to the label; click in the canvas to + reposition the label; click in the palette to + change the color of the text in the label; + etc.) + + You may "apply" a label to the canvas, painting + the text into the picture as if it had been + added using the Text tool, by clicking the + label application button. (This feature was + added in Tux Paint version 0.9.28.) All labels + in the drawing will appear highlighted, and you + select one just as you do when selecting a + label to edit. The chosen label will be + removed, and the text will be added directly to + the canvas. + 「ラベル」ツールは、Tux Paint 設定ツールや、"nolabel"オプションにより、無効にすることができます。 diff --git a/docs/ja_JP.UTF-8/html/README.html b/docs/ja_JP.UTF-8/html/README.html index 3c1be9702..3eaa8ddd3 100644 --- a/docs/ja_JP.UTF-8/html/README.html +++ b/docs/ja_JP.UTF-8/html/README.html @@ -29,7 +29,7 @@

- 2022年1月26日

+ 2022年2月21日


- まず、右側のセレクタからフォントを、下部のパレットから色を選択します。画面をクリックするとカーソルが表示され、文字を入力することができます。

+ Choose a font (from the 'Letters' available on the right) and a color (from the color palette near the bottom). You may also apply a bold, and/or an italic styling effect to the text. Click on the screen and a cursor will appear. Type text and it will show up on the screen. (You can change the font, color, and styling while entering the text, before it is applied to the canvas.)

[Enter]キー、または[Return]キーを押すと文字が描画され、カーソルが次の行に下がります。

@@ -671,6 +671,12 @@

Tux Paint バージョン 0.9.22 で追加された「ラベル」ツールでは、文字は絵から「浮いて」おり、文字列の内容、位置、フォント、色などの情報は個別に記録されます。これにより、「ラベル」は後から移動や編集が可能です。

+

+ To edit a label, click the label selection button. All labels in the drawing will appear highlighted. Click one — or use the [Tab] key to cycle through all the labels, and the [Enter] or [Return] key to select one — and you may then edit the label. (Use they [Backspace] key to erase characters, and other keys to add text to the label; click in the canvas to reposition the label; click in the palette to change the color of the text in the label; etc.)

+ +

+ You may "apply" a label to the canvas, painting the text into the picture as if it had been added using the Text tool, by clicking the label application button. (This feature was added in Tux Paint version 0.9.28.) All labels in the drawing will appear highlighted, and you select one just as you do when selecting a label to edit. The chosen label will be removed, and the text will be added directly to the canvas.

+

「ラベル」ツールは、Tux Paint 設定ツールや、"nolabel"オプションにより、無効にすることができます。

diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 9bfb3d762..e357c082d 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - February 17, 2022 + June 14, 2002 - February 22, 2022 */ #include "platform.h" @@ -3120,12 +3120,28 @@ static void mainloop(void) { /* [Enter] to select a node to edit */ + DEBUG_PRINTF("Searching for label @ (%d+3,%d+3)\n", + highlighted_label_node->save_x, + highlighted_label_node->save_y); + label_node_to_edit = search_label_list(&highlighted_label_node, highlighted_label_node->save_x + 3, highlighted_label_node->save_y + 3, 0); if (label_node_to_edit) - select_label_node(&old_x, &old_y); + { + select_label_node(&old_x, &old_y); + DEBUG_PRINTF("Got a label: \"%ls\" @ (%d,%d)\n", + label_node_to_edit->save_texttool_str, old_x, old_y); + DEBUG_PRINTF("Cursor now @ (%d,%d); width = %d\n", + cursor_x, cursor_y, cursor_textwidth); + cursor_x = label_node_to_edit->save_x; + cursor_y = label_node_to_edit->save_y; + cursor_left = cursor_x; + DEBUG_PRINTF("Cursor now @ (%d,%d)\n", cursor_x, cursor_y); + } + + do_render_cur_text(0); } else if (cur_tool == TOOL_LABEL && cur_label == LABEL_APPLY) @@ -3140,6 +3156,7 @@ static void mainloop(void) { apply_label_node(old_x, old_y); reposition_onscreen_keyboard(old_y); + apply_label_node(highlighted_label_node->save_x, highlighted_label_node->save_y); } } else @@ -3196,6 +3213,8 @@ static void mainloop(void) draw_toolbar(); update_screen_rect(&r_tools); } + + playsound(screen, 0, SND_CLICK, 1, SNDPOS_RIGHT, SNDDIST_NEAR); } else if (cur_tool == TOOL_LABEL && label_node_to_edit) { @@ -4397,7 +4416,6 @@ static void mainloop(void) have_to_rec_label_node = TRUE; add_label_node(0, 0, 0, 0, NULL); label_node_to_edit = NULL; - } cur_label = LABEL_SELECT; @@ -4448,7 +4466,6 @@ static void mainloop(void) have_to_rec_label_node = TRUE; add_label_node(0, 0, 0, 0, NULL); label_node_to_edit = NULL; - } cur_label = LABEL_APPLY; @@ -5230,10 +5247,18 @@ static void mainloop(void) { /* Click to select a node to edit */ + DEBUG_PRINTF("Searching for label @ (%d,%d)\n", old_x, old_y); + label_node_to_edit = search_label_list(&highlighted_label_node, old_x, old_y, 0); if (label_node_to_edit) - select_label_node(&old_x, &old_y); + { + DEBUG_PRINTF("Got a label: \"%ls\" @ (%d,%d)\n", + label_node_to_edit->save_texttool_str, old_x, old_y); + DEBUG_PRINTF("Cursor now @ (%d,%d); width = %d\n", + cursor_x, cursor_y, cursor_textwidth); + select_label_node(&old_x, &old_y); + } } else if (cur_tool == TOOL_LABEL && cur_label == LABEL_APPLY) { @@ -24849,20 +24874,26 @@ static void cycle_highlighted_label_node() { aux_node = highlighted_label_node->next_to_down_label_node; if (aux_node == NULL) - aux_node = current_label_node; - if (aux_node->is_enabled) - highlighted_label_node = aux_node; - else - while (aux_node->is_enabled == FALSE && aux_node != highlighted_label_node) - { - aux_node = aux_node->next_to_down_label_node; - if (aux_node == NULL) - aux_node = current_label_node; - if (aux_node->is_enabled) - highlighted_label_node = aux_node; - } - } + { + aux_node = current_label_node; + } + if (aux_node->is_enabled) + { + highlighted_label_node = aux_node; + } + else + { + while (aux_node->is_enabled == FALSE && aux_node != highlighted_label_node) + { + aux_node = aux_node->next_to_down_label_node; + if (aux_node == NULL) + aux_node = current_label_node; + if (aux_node->is_enabled) + highlighted_label_node = aux_node; + } + } + } } /** @@ -29197,7 +29228,7 @@ static void sloppy_frac(float f, int * numer, int * denom) { /** * Selet a chosen Label node. * - * @param int * old_x, old_y -- Pointers to feed the osition of the chosen label + * @param int * old_x, old_y -- Pointers to feed the position of the chosen label */ static void select_label_node(int * old_x, int * old_y) { unsigned int i; @@ -29253,6 +29284,8 @@ static void select_label_node(int * old_x, int * old_y) { /* Set mouse pointer (cursor) shape to the text insertion bar */ do_setcursor(cursor_insertion); + update_canvas_ex_r(0, 0, canvas->w, canvas->h, 1); + /* We have chosen a label; show some instructional text (Tux tip) and play a success sound */ draw_tux_text(TUX_GREAT, TIP_LABEL_SELECTOR_LABEL_CHOSEN, 1); @@ -29282,25 +29315,42 @@ static void apply_label_node(int old_x, int old_y) { cursor_x = old_x; cursor_y = old_y; cursor_left = old_x; + SDL_Rect rect; + /* Capture into Undo buffer */ rec_undo_buffer(); + + /* Apply the text the canvas */ do_render_cur_text(1); - draw_fonts(); - update_screen_rect(&r_toolopt); - + /* Switch to normal label adding mode; + Update label control buttons */ cur_label = LABEL_LABEL; draw_colors(COLORSEL_REFRESH); draw_fonts(); + update_screen_rect(&r_toolopt); have_to_rec_label_node = TRUE; + + /* [Best way to explain this?] */ + 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.h = 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; + + /* [Best way to explain this?] */ add_label_node(0, 0, 0, 0, NULL); derender_node(&label_node_to_edit); label_node_to_edit = NULL; + /* [Best way to explain this?] */ texttool_len = 0; cursor_textwidth = 0; + /* Make "Save" button available after this change (if appropriate) */ if (been_saved) { been_saved = 0; @@ -29312,6 +29362,9 @@ static void apply_label_node(int old_x, int old_y) { update_screen_rect(&r_tools); } + /* Back to normal "how to use Label tool" tip; play sound */ + update_canvas_ex_r(rect.x, rect.y, rect.w, rect.h, 1); + draw_tux_text(TUX_GREAT, tool_tips[TOOL_LABEL], 1); playsound(screen, 1, SND_RETURN, 1, cursor_x, SNDDIST_NEAR); }