Revision: 16076 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16076 Author: quorn Date: 2008-08-13 14:20:49 +0200 (Wed, 13 Aug 2008)
Log Message: ----------- PageUp/Down now moves the mouse cursor instead of just the view. Also added some other pops for when the cursor went off screen (click after horizontal scroll, undo, redo, etc.) Modified Paths: -------------- branches/soc-2008-quorn/source/blender/src/drawtext.c branches/soc-2008-quorn/source/blender/src/header_text.c Modified: branches/soc-2008-quorn/source/blender/src/drawtext.c =================================================================== --- branches/soc-2008-quorn/source/blender/src/drawtext.c 2008-08-13 10:19:47 UTC (rev 16075) +++ branches/soc-2008-quorn/source/blender/src/drawtext.c 2008-08-13 12:20:49 UTC (rev 16076) @@ -1064,6 +1064,38 @@ if (st->top<0) st->top= 0; } +static void cursor_skip(SpaceText *st, int lines, int sel) +{ + Text *text; + TextLine **linep; + int oldl, oldc, *charp; + + if (!st) return; + if (st->spacetype != SPACE_TEXT) return; + if (!st->text) return; + + text= st->text; + + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; + oldl= txt_get_span(text->lines.first, *linep); + oldc= *charp; + + while (lines>0 && (*linep)->next) { + *linep= (*linep)->next; + lines--; + } + while (lines<0 && (*linep)->prev) { + *linep= (*linep)->prev; + lines++; + } + + if (*charp > (*linep)->len) *charp= (*linep)->len; + + if (!sel) txt_pop_sel(st->text); + txt_undo_add_toop(st->text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, txt_get_span(text->lines.first, *linep), *charp); +} + /* * mode 1 == view scroll * mode 2 == scrollbar @@ -1194,6 +1226,8 @@ if (sell!=linep2 || selc!=charp2) txt_undo_add_toop(st->text, UNDO_STO, sell, selc, linep2, charp2); + + pop_space_text(st); } static int do_suggest_select(SpaceText *st) @@ -2947,11 +2981,13 @@ //txt_print_undo(text); //debug buffer in console if (G.qual == (LR_ALTKEY|LR_SHIFTKEY)) { txt_do_redo(text); + pop_space_text(st); do_draw= 1; } if (G.qual == LR_ALTKEY) { txt_do_undo(text); if (st->showsyntax) txt_format_text(st); + pop_space_text(st); do_draw= 1; } break; /* BREAK U */ @@ -3014,6 +3050,7 @@ txt_do_undo(text); } if (st->showsyntax) txt_format_text(st); + pop_space_text(st); do_draw= 1; } break; @@ -3140,11 +3177,13 @@ pop_space_text(st); break; case PAGEDOWNKEY: - screen_skip(st, st->viewlines); + cursor_skip(st, st->viewlines, G.qual & LR_SHIFTKEY); + pop_space_text(st); do_draw= 1; break; case PAGEUPKEY: - screen_skip(st, -st->viewlines); + cursor_skip(st, -st->viewlines, G.qual & LR_SHIFTKEY); + pop_space_text(st); do_draw= 1; break; case HOMEKEY: Modified: branches/soc-2008-quorn/source/blender/src/header_text.c =================================================================== --- branches/soc-2008-quorn/source/blender/src/header_text.c 2008-08-13 10:19:47 UTC (rev 16075) +++ branches/soc-2008-quorn/source/blender/src/header_text.c 2008-08-13 12:20:49 UTC (rev 16076) @@ -378,9 +378,11 @@ switch(event) { case 1: txt_do_undo(text); + pop_space_text(st); break; case 2: txt_do_redo(text); + pop_space_text(st); break; case 3: if (text && text->id.lib) { _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs