[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45244] trunk/blender/source/blender/ editors: style cleanup

Campbell Barton ideasman42 at gmail.com
Wed Mar 28 13:53:19 CEST 2012


Revision: 45244
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45244
Author:   campbellbarton
Date:     2012-03-28 11:53:18 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
style cleanup

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_console/console_draw.c
    trunk/blender/source/blender/editors/space_console/console_ops.c
    trunk/blender/source/blender/editors/space_console/space_console.c
    trunk/blender/source/blender/editors/space_image/image_buttons.c
    trunk/blender/source/blender/editors/space_image/image_draw.c
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/editors/space_image/space_image.c
    trunk/blender/source/blender/editors/space_info/info_draw.c
    trunk/blender/source/blender/editors/space_info/info_ops.c
    trunk/blender/source/blender/editors/space_info/info_report.c
    trunk/blender/source/blender/editors/space_info/info_stats.c
    trunk/blender/source/blender/editors/space_info/space_info.c
    trunk/blender/source/blender/editors/space_info/textview.c

Modified: trunk/blender/source/blender/editors/space_console/console_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_console/console_draw.c	2012-03-28 11:48:16 UTC (rev 45243)
+++ trunk/blender/source/blender/editors/space_console/console_draw.c	2012-03-28 11:53:18 UTC (rev 45244)
@@ -59,19 +59,19 @@
 
 static void console_line_color(unsigned char fg[3], int type)
 {
-	switch(type) {
-	case CONSOLE_LINE_OUTPUT:
-		UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg);
-		break;
-	case CONSOLE_LINE_INPUT:
-		UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg);
-		break;
-	case CONSOLE_LINE_INFO:
-		UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg);
-		break;
-	case CONSOLE_LINE_ERROR:
-		UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg);
-		break;
+	switch (type) {
+		case CONSOLE_LINE_OUTPUT:
+			UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg);
+			break;
+		case CONSOLE_LINE_INPUT:
+			UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg);
+			break;
+		case CONSOLE_LINE_INFO:
+			UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg);
+			break;
+		case CONSOLE_LINE_ERROR:
+			UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg);
+			break;
 	}
 }
 
@@ -93,11 +93,11 @@
 void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
 {
 	/* fake the edit line being in the scroll buffer */
-	ConsoleLine *cl= sc->history.last;
-	cl_dummy->type= CONSOLE_LINE_INPUT;
-	cl_dummy->len= cl_dummy->len_alloc= strlen(sc->prompt) + cl->len;
-	cl_dummy->len_alloc= cl_dummy->len + 1;
-	cl_dummy->line= MEM_mallocN(cl_dummy->len_alloc, "cl_dummy");
+	ConsoleLine *cl = sc->history.last;
+	cl_dummy->type = CONSOLE_LINE_INPUT;
+	cl_dummy->len = cl_dummy->len_alloc = strlen(sc->prompt) + cl->len;
+	cl_dummy->len_alloc = cl_dummy->len + 1;
+	cl_dummy->line = MEM_mallocN(cl_dummy->len_alloc, "cl_dummy");
 	memcpy(cl_dummy->line, sc->prompt, (cl_dummy->len_alloc - cl->len));
 	memcpy(cl_dummy->line + ((cl_dummy->len_alloc - cl->len)) - 1, cl->line, cl->len + 1);
 	BLI_addtail(&sc->scrollback, cl_dummy);
@@ -116,73 +116,73 @@
 /* console textview callbacks */
 static int console_textview_begin(TextViewContext *tvc)
 {
-	SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
-	tvc->lheight= sc->lheight;
-	tvc->sel_start= sc->sel_start;
-	tvc->sel_end= sc->sel_end;
+	SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
+	tvc->lheight = sc->lheight;
+	tvc->sel_start = sc->sel_start;
+	tvc->sel_end = sc->sel_end;
 	
 	/* iterator */
-	tvc->iter= sc->scrollback.last;
+	tvc->iter = sc->scrollback.last;
 	
 	return (tvc->iter != NULL);
 }
 
 static void console_textview_end(TextViewContext *tvc)
 {
-	SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+	SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
 	(void)sc;
 	
 }
 
 static int console_textview_step(TextViewContext *tvc)
 {
-	return ((tvc->iter= (void *)((Link *)tvc->iter)->prev) != NULL);
+	return ((tvc->iter = (void *)((Link *)tvc->iter)->prev) != NULL);
 }
 
 static int console_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
 {
-	ConsoleLine *cl= (ConsoleLine *)tvc->iter;
-	*line= cl->line;
-	*len= cl->len;
+	ConsoleLine *cl = (ConsoleLine *)tvc->iter;
+	*line = cl->line;
+	*len = cl->len;
 
 	return 1;
 }
 
 static int console_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char UNUSED(bg[3]))
 {
-	ConsoleLine *cl_iter= (ConsoleLine *)tvc->iter;
+	ConsoleLine *cl_iter = (ConsoleLine *)tvc->iter;
 
 	/* annoying hack, to draw the prompt */
 	if (tvc->iter_index == 0) {
-		const SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
-		const ConsoleLine *cl= (ConsoleLine *)sc->history.last;
-		const int prompt_len= strlen(sc->prompt);
-		const int cursor_loc= cl->cursor + prompt_len;
+		const SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
+		const ConsoleLine *cl = (ConsoleLine *)sc->history.last;
+		const int prompt_len = strlen(sc->prompt);
+		const int cursor_loc = cl->cursor + prompt_len;
 		int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
 		int pen[2];
-		xy[1] += tvc->lheight/6;
+		xy[1] += tvc->lheight / 6;
 
 		/* account for wrapping */
 		if (cl->len < tvc->console_width) {
 			/* simple case, no wrapping */
-			pen[0]= tvc->cwidth * cursor_loc;
-			pen[1]= -2;
+			pen[0] = tvc->cwidth * cursor_loc;
+			pen[1] = -2;
 		}
 		else {
 			/* wrap */
-			pen[0]= tvc->cwidth * (cursor_loc % tvc->console_width);
-			pen[1]= -2 + (((cl->len / tvc->console_width) - (cursor_loc / tvc->console_width)) * tvc->lheight);
+			pen[0] = tvc->cwidth * (cursor_loc % tvc->console_width);
+			pen[1] = -2 + (((cl->len / tvc->console_width) - (cursor_loc / tvc->console_width)) * tvc->lheight);
 		}
 
 		/* cursor */
 		UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg);
 		glColor3ubv(fg);
 
-		glRecti(	(xy[0] + pen[0]) - 1,
-					(xy[1] + pen[1]),
-					(xy[0] + pen[0]) + 1,
-					(xy[1] + pen[1] + tvc->lheight)
-		);
+		glRecti((xy[0] + pen[0]) - 1,
+		        (xy[1] + pen[1]),
+		        (xy[0] + pen[0]) + 1,
+		        (xy[1] + pen[1] + tvc->lheight)
+		        );
 	}
 
 	console_line_color(fg, cl_iter->type);
@@ -193,33 +193,33 @@
 
 static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegion *ar, int draw, int mval[2], void **mouse_pick, int *pos_pick)
 {
-	ConsoleLine cl_dummy= {NULL};
-	int ret= 0;
+	ConsoleLine cl_dummy = {NULL};
+	int ret = 0;
 	
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 
-	TextViewContext tvc= {0};
+	TextViewContext tvc = {0};
 
-	tvc.begin= console_textview_begin;
-	tvc.end= console_textview_end;
+	tvc.begin = console_textview_begin;
+	tvc.end = console_textview_end;
 
-	tvc.step= console_textview_step;
-	tvc.line_get= console_textview_line_get;
-	tvc.line_color= console_textview_line_color;
+	tvc.step = console_textview_step;
+	tvc.line_get = console_textview_line_get;
+	tvc.line_color = console_textview_line_color;
 
-	tvc.arg1= sc;
-	tvc.arg2= NULL;
+	tvc.arg1 = sc;
+	tvc.arg2 = NULL;
 
 	/* view */
-	tvc.sel_start= sc->sel_start;
-	tvc.sel_end= sc->sel_end;
-	tvc.lheight= sc->lheight;
+	tvc.sel_start = sc->sel_start;
+	tvc.sel_end = sc->sel_end;
+	tvc.lheight = sc->lheight;
 	tvc.ymin = v2d->cur.ymin;
 	tvc.ymax = v2d->cur.ymax;
-	tvc.winx= ar->winx;
+	tvc.winx = ar->winx;
 
 	console_scrollback_prompt_begin(sc, &cl_dummy);
-	ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+	ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
 	console_scrollback_prompt_end(sc, &cl_dummy);
 
 	return ret;
@@ -240,12 +240,12 @@
 
 int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, int mval[2])
 {
-	int pos_pick= 0;
-	void *mouse_pick= NULL;
+	int pos_pick = 0;
+	void *mouse_pick = NULL;
 	int mval_clamp[2];
 
-	mval_clamp[0]= CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx-(CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
-	mval_clamp[1]= CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy-CONSOLE_DRAW_MARGIN);
+	mval_clamp[0] = CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
+	mval_clamp[1] = CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy - CONSOLE_DRAW_MARGIN);
 
 	console_textview_main__internal(sc, ar, 0, mval_clamp, &mouse_pick, &pos_pick);
 	return pos_pick;

Modified: trunk/blender/source/blender/editors/space_console/console_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_console/console_ops.c	2012-03-28 11:48:16 UTC (rev 45243)
+++ trunk/blender/source/blender/editors/space_console/console_ops.c	2012-03-28 11:53:18 UTC (rev 45244)
@@ -57,16 +57,16 @@
 /* so when we type - the view scrolls to the bottom */
 static void console_scroll_bottom(ARegion *ar)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 	v2d->cur.ymin = 0.0;
-	v2d->cur.ymax =(float)v2d->winy;
+	v2d->cur.ymax = (float)v2d->winy;
 }
 
 static void console_textview_update_rect(SpaceConsole *sc, ARegion *ar)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 
-	UI_view2d_totRect_set(v2d, ar->winx-1, console_textview_height(sc, ar));
+	UI_view2d_totRect_set(v2d, ar->winx - 1, console_textview_height(sc, ar));
 }
 
 static void console_select_offset(SpaceConsole *sc, const int offset)
@@ -92,21 +92,21 @@
 {
 	int tot;
 	
-	if (U.scrollback < 32) U.scrollback= 256; // XXX - save in user defaults
+	if (U.scrollback < 32) U.scrollback = 256;  // XXX - save in user defaults
 	
-	for (tot= BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--)
+	for (tot = BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--)
 		console_scrollback_free(sc, sc->scrollback.first);
 }
 
-static ConsoleLine * console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
+static ConsoleLine *console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
 {
 	ConsoleLine *cl;
 
-	for (cl= sc->history.last; cl; cl= cl->prev) {
-		if (cl==cl_ignore)
+	for (cl = sc->history.last; cl; cl = cl->prev) {
+		if (cl == cl_ignore)
 			continue;
 
-		if (strcmp(str, cl->line)==0)
+		if (strcmp(str, cl->line) == 0)
 			return cl;
 	}
 
@@ -118,9 +118,9 @@
 {
 	int cursor_new;
 
-	if      (cursor < 0)        cursor_new = 0;
-	else if (cursor > cl->len)  cursor_new = cl->len;
-	else                        cursor_new = cursor;
+	if      (cursor < 0) cursor_new = 0;
+	else if (cursor > cl->len) cursor_new = cl->len;
+	else cursor_new = cursor;
 	
 	if (cursor_new == cl->cursor) {
 		return FALSE;
@@ -136,7 +136,7 @@
 	ConsoleLine *cl;
 
 	printf("%d: ", BLI_countlist(lb));
-	for (cl= lb->first; cl; cl= cl->next)
+	for (cl = lb->first; cl; cl = cl->next)
 		printf("<%s> ", cl->line);
 	printf("\n");
 
@@ -144,7 +144,7 @@
 
 static void console_history_debug(const bContext *C)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
 
 	
 	console_lb_debug__internal(&sc->history);
@@ -153,20 +153,20 @@
 
 static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
 {
-	ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
+	ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
 	
 	if (from) {
-		ci->line= BLI_strdup(from->line);
-		ci->len= strlen(ci->line);
-		ci->len_alloc= ci->len;
+		ci->line = BLI_strdup(from->line);
+		ci->len = strlen(ci->line);
+		ci->len_alloc = ci->len;
 		
-		ci->cursor= from->cursor;
-		ci->type= from->type;
+		ci->cursor = from->cursor;
+		ci->type = from->type;
 	}
 	else {
-		ci->line= MEM_callocN(64, "console-in-line");
-		ci->len_alloc= 64;
-		ci->len= 0;
+		ci->line = MEM_callocN(64, "console-in-line");

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list