diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-28 15:53:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-28 15:53:18 +0400 |
commit | ed61bfc9a6580360805a3daae1003df43a7f2c11 (patch) | |
tree | 29ee3248e82a5109b241127b1c2397ca11bf7bcb /source/blender/editors/space_info/textview.c | |
parent | ca8d262e89c25d15368ec4eb2fe80111e732e1f7 (diff) |
style cleanup
Diffstat (limited to 'source/blender/editors/space_info/textview.c')
-rw-r--r-- | source/blender/editors/space_info/textview.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index c55ba069e11..4ba196276da 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -47,7 +47,7 @@ static void console_font_begin(TextViewContext *sc) { - BLF_size(blf_mono_font, sc->lheight-2, 72); + BLF_size(blf_mono_font, sc->lheight - 2, 72); } typedef struct ConsoleDrawContext { @@ -71,14 +71,14 @@ static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(stipple_halftone); - glEnable( GL_BLEND ); + glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4ub(255, 255, 255, 96); - glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2); + glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2); glDisable(GL_POLYGON_STIPPLE); - glDisable( GL_BLEND ); + glDisable(GL_BLEND); } } @@ -89,13 +89,13 @@ static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str_len, unsigned char *fg, unsigned char *bg) { #define STEP_SEL(value) cdc->sel[0] += (value); cdc->sel[1] += (value) - int rct_ofs= cdc->lheight/4; - int tot_lines = (str_len/cdc->console_width)+1; /* total number of lines for wrapping */ - int y_next = (str_len > cdc->console_width) ? cdc->xy[1]+cdc->lheight*tot_lines : cdc->xy[1]+cdc->lheight; - const int mono= blf_mono_font; + int rct_ofs = cdc->lheight / 4; + int tot_lines = (str_len / cdc->console_width) + 1; /* total number of lines for wrapping */ + int y_next = (str_len > cdc->console_width) ? cdc->xy[1] + cdc->lheight * tot_lines : cdc->xy[1] + cdc->lheight; + const int mono = blf_mono_font; /* just advance the height */ - if (cdc->draw==0) { + if (cdc->draw == 0) { if (cdc->pos_pick && (cdc->mval[1] != INT_MAX)) { if (cdc->xy[1] <= cdc->mval[1]) { if ((y_next >= cdc->mval[1])) { @@ -103,7 +103,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str /* wrap */ if (str_len > cdc->console_width) - ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines)))); + ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next - cdc->xy[1])) * tot_lines)))); CLAMP(ofs, 0, str_len); *cdc->pos_pick += str_len - ofs; @@ -113,12 +113,12 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } } - cdc->xy[1]= y_next; + cdc->xy[1] = y_next; return 1; } - else if (y_next-cdc->lheight < cdc->ymin) { + else if (y_next - cdc->lheight < cdc->ymin) { /* have not reached the drawable area so don't break */ - cdc->xy[1]= y_next; + cdc->xy[1] = y_next; /* adjust selection even if not drawing */ if (cdc->sel[0] != cdc->sel[1]) { @@ -129,8 +129,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str } if (str_len > cdc->console_width) { /* wrap? */ - const int initial_offset= ((tot_lines-1) * cdc->console_width); - const char *line_stride= str + initial_offset; /* advance to the last line and draw it first */ + const int initial_offset = ((tot_lines - 1) * cdc->console_width); + const char *line_stride = str + initial_offset; /* advance to the last line and draw it first */ int sel_orig[2]; copy_v2_v2_int(sel_orig, cdc->sel); @@ -141,7 +141,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { glColor3ubv(bg); - glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs); + glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, (cdc->xy[1] + (cdc->lheight * tot_lines)) + rct_ofs); } glColor3ubv(fg); @@ -187,7 +187,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { glColor3ubv(bg); - glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs); + glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, cdc->xy[1] + cdc->lheight - rct_ofs); } glColor3ubv(fg); @@ -198,8 +198,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (cdc->sel[0] != cdc->sel[1]) { int isel[2]; - isel[0]= str_len - cdc->sel[1]; - isel[1]= str_len - cdc->sel[0]; + isel[0] = str_len - cdc->sel[1]; + isel[1] = str_len - cdc->sel[0]; // glColor4ub(255, 255, 0, 96); // debug console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); @@ -221,17 +221,17 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick) { - ConsoleDrawContext cdc= {0}; + ConsoleDrawContext cdc = {0}; - int x_orig=CONSOLE_DRAW_MARGIN, y_orig=CONSOLE_DRAW_MARGIN + tvc->lheight/6; + int x_orig = CONSOLE_DRAW_MARGIN, y_orig = CONSOLE_DRAW_MARGIN + tvc->lheight / 6; int xy[2], y_prev; - int sel[2]= {-1, -1}; /* defaults disabled */ + int sel[2] = {-1, -1}; /* defaults disabled */ unsigned char fg[3], bg[3]; - const int mono= blf_mono_font; + const int mono = blf_mono_font; console_font_begin(tvc); - xy[0]= x_orig; xy[1]= y_orig; + xy[0] = x_orig; xy[1] = y_orig; if (mval[1] != INT_MAX) mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN); @@ -240,28 +240,28 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick *pos_pick = 0; /* constants for the sequencer context */ - cdc.cwidth= (int)BLF_fixed_width(mono); + cdc.cwidth = (int)BLF_fixed_width(mono); assert(cdc.cwidth > 0); - cdc.lheight= tvc->lheight; - cdc.console_width= (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) ) / cdc.cwidth; + cdc.lheight = tvc->lheight; + cdc.console_width = (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth; CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */ - cdc.winx= tvc->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL); + cdc.winx = tvc->winx - (CONSOLE_DRAW_MARGIN + CONSOLE_DRAW_SCROLL); cdc.ymin = tvc->ymin; cdc.ymax = tvc->ymax; - cdc.xy= xy; - cdc.sel= sel; - cdc.pos_pick= pos_pick; - cdc.mval= mval; - cdc.draw= draw; + cdc.xy = xy; + cdc.sel = sel; + cdc.pos_pick = pos_pick; + cdc.mval = mval; + cdc.draw = draw; /* shouldnt be needed */ - tvc->cwidth= cdc.cwidth; - tvc->console_width= cdc.console_width; - tvc->iter_index= 0; + tvc->cwidth = cdc.cwidth; + tvc->console_width = cdc.console_width; + tvc->iter_index = 0; if (tvc->sel_start != tvc->sel_end) { - sel[0]= tvc->sel_start; - sel[1]= tvc->sel_end; + sel[0] = tvc->sel_start; + sel[1] = tvc->sel_end; } if (tvc->begin(tvc)) { @@ -269,12 +269,12 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick do { const char *ext_line; int ext_len; - int color_flag= 0; + int color_flag = 0; - y_prev= xy[1]; + y_prev = xy[1]; if (draw) - color_flag= tvc->line_color(tvc, fg, bg); + color_flag = tvc->line_color(tvc, fg, bg); tvc->line_get(tvc, &ext_line, &ext_len); @@ -286,7 +286,7 @@ int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick } if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) { - *mouse_pick= (void *)tvc->iter; + *mouse_pick = (void *)tvc->iter; break; } |