Made it so when a text block is removed (using the cross button in the header), the previous text block becomes active, to be consistant with scene and screen delete operations. Also makes removing all the text's within a blend a lot less tedious - (Something I do for bug report Blend's)

change to drawtext was just to comment on what pop_space_text does, names not obvious.
This commit is contained in:
Campbell Barton
2006-05-16 22:54:55 +00:00
parent bb69543fa9
commit 456396fc3e
2 changed files with 14 additions and 1 deletions

View File

@@ -999,6 +999,8 @@ void drawtextspace(ScrArea *sa, void *spacedata)
curarea->win_swap= WIN_BACK_OK;
}
/* Moves the view to the cursor location,
also used to make sure the view isnt outside the file */
void pop_space_text (SpaceText *st)
{
int i, x;

View File

@@ -132,18 +132,29 @@ void do_text_buttons(unsigned short event)
}
}
break;
case B_TEXTDELETE:
text= st->text;
if (!text) return;
/* make the previous text active, if its not there make the next text active */
if (st->text->id.prev) {
st->text = st->text->id.prev;
pop_space_text(st);
} else if (st->text->id.next) {
st->text = st->text->id.next;
pop_space_text(st);
}
BPY_clear_bad_scriptlinks(text);
free_text_controllers(text);
unlink_text(text);
free_libblock(&G.main->text, text);
allqueue(REDRAWTEXT, 0);
allqueue(REDRAWHEADERS, 0);
break;
/*