From f2473f952b7a6cba7efce24f8b1d0857a116d0a1 Mon Sep 17 00:00:00 2001 From: Pere Pujal i Carabantes Date: Tue, 6 Oct 2009 17:27:18 +0000 Subject: [PATCH] Deleting the label when typing enter or tab if in select mode and there are no text. Still has to be done for clicking on a different tool or unselecting the label button. --- src/tuxpaint.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index bf0ee5be8..f8b54c45a 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -2442,6 +2442,19 @@ static void mainloop(void) texttool_len = 0; cursor_textwidth = 0; } + else if (cur_tool == TOOL_LABEL && + cur_label == LABEL_SELECT && + cur_select == SELECT_ON) + { + cur_select = SELECT_OFF; + do_setcursor(cursor_arrow); + rec_undo_buffer(); + have_to_rec_label_node = TRUE; + add_label_node(0, 0, 0, 0, &label_node_to_edit, NULL); + derender_node(&label_node_to_edit); +// playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); // FIXME lack of specific sound + } + font_height = TuxPaint_Font_FontHeight(getfonthandle(cur_font)); cursor_x = cursor_left; @@ -2466,6 +2479,19 @@ static void mainloop(void) texttool_len = 0; cursor_textwidth = 0; } + else if (cur_tool == TOOL_LABEL && + cur_label == LABEL_SELECT && + cur_select == SELECT_ON) + { + cur_select = SELECT_OFF; + do_setcursor(cursor_arrow); + rec_undo_buffer(); + have_to_rec_label_node = TRUE; + add_label_node(0, 0, 0, 0, &label_node_to_edit, NULL); + derender_node(&label_node_to_edit); +// playsound(screen, 0, SND_DELETE_LABEL, 0, SNDPOS_CENTER); // FIXME lack of specific sound + } + #ifdef SPEECH #ifdef __APPLE__ if (use_sound) @@ -20570,7 +20596,7 @@ void delete_label_list(struct label_node** ref_head) { printf("%x current\n", current); //FIXAM fflush(stdout); - + next = current->next_to_up_label_node; free(current); current = next;