Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-18 20:27:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-18 20:27:25 +0400
commit119844eb23718870df614a68a035573e9c5e4e11 (patch)
tree0bc4f587f970c88b5c60c948fdfa8e420f4920ea /source/blender/editors/space_console/console_draw.c
parent75b8badda5b044f56b512cd2874d80d7af1fd012 (diff)
fixes for errors on startup and compiler errors and draw speedup.
* Drawing the console text now skips all lines outside the view bounds. * Added dummy C operators for console.exec and console.autocomplete so blender wont complain at startup, its not really a problem but people testing reported it a few times. Eventually we should have some way python operators are initialized before the spaces operators are checked. * reordered the imports so the "ui" dir is imported before "io", for now this means bpy.ops is defined before exporters and importers need to use it, was causing a python error on startup. * fixed all compiler warnings for the console (gcc4.4) * stopped operators were printing out the return flag. * removed references to ACT_OT_test, TEXT_OT_console_exec and TEXT_OT_console_autocomplete
Diffstat (limited to 'source/blender/editors/space_console/console_draw.c')
-rw-r--r--source/blender/editors/space_console/console_draw.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 96641fd8fbd..65e18beabbc 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -109,23 +109,28 @@ static void console_report_color(unsigned char *fg, int type)
static int console_draw_string( char *str, int str_len,
int console_width, int lheight,
unsigned char *fg, unsigned char *bg,
- int winx, int winy,
+ int winx,
+ int ymin, int ymax,
int *x, int *y, int draw)
{
int rct_ofs= lheight/4;
- int tot_lines = (str_len/console_width)+1; /* total number of lines for wrapping */
+ int tot_lines = (str_len/console_width)+1; /* total number of lines for wrapping */
+ int y_next = (str_len > console_width) ? (*y)+lheight*tot_lines : (*y)+lheight;
/* just advance the height */
if(draw==0) {
- if(str_len > console_width) (*y) += tot_lines * lheight;
- else (*y) += lheight;
-
+ *y= y_next;
+ return 1;
+ }
+ else if (y_next-lheight < ymin) {
+ /* have not reached the drawable area so don't break */
+ *y= y_next;
return 1;
}
if(str_len > console_width) { /* wrap? */
char *line_stride= str + ((tot_lines-1) * console_width); /* advance to the last line and draw it first */
- char eol; /* baclup the end of wrapping */
+ char eol; /* baclup the end of wrapping */
if(bg) {
glColor3ub(bg[0], bg[1], bg[2]);
@@ -149,7 +154,7 @@ static int console_draw_string( char *str, int str_len,
line_stride[console_width] = eol; /* restore */
/* check if were out of view bounds */
- if(*y > winy)
+ if(*y > ymax)
return 0;
}
}
@@ -165,7 +170,7 @@ static int console_draw_string( char *str, int str_len,
BLF_position(*x, *y, 0); (*y) += lheight;
BLF_draw(str);
- if(*y > winy)
+ if(*y > ymax)
return 0;
}
@@ -230,7 +235,8 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
if(!console_draw_string( cl->line, cl->len,
console_width, sc->lheight,
fg, NULL,
- ar->winx-CONSOLE_DRAW_MARGIN, v2d->cur.ymax,
+ ar->winx-CONSOLE_DRAW_MARGIN,
+ v2d->cur.ymin, v2d->cur.ymax,
&x, &y, draw))
{
/* when drawing, if we pass v2d->cur.ymax, then quit */
@@ -268,7 +274,8 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
if(!console_draw_string( report->message, report->len,
console_width, sc->lheight,
fg, bool?bg:NULL,
- ar->winx-CONSOLE_DRAW_MARGIN, v2d->cur.ymax,
+ ar->winx-CONSOLE_DRAW_MARGIN,
+ v2d->cur.ymin, v2d->cur.ymax,
&x, &y, draw))
{
/* when drawing, if we pass v2d->cur.ymax, then quit */
@@ -279,7 +286,6 @@ static int console_text_main__internal(struct SpaceConsole *sc, struct ARegion *
bool = !(bool);
}
-
}
}
y += sc->lheight*2;