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

Campbell Barton ideasman42 at gmail.com
Tue May 8 17:43:59 CEST 2012


Revision: 46426
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46426
Author:   campbellbarton
Date:     2012-05-08 15:43:59 +0000 (Tue, 08 May 2012)
Log Message:
-----------
style cleanup: screen

Modified Paths:
--------------
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/screen/glutil.c
    trunk/blender/source/blender/editors/screen/screen_context.c
    trunk/blender/source/blender/editors/screen/screen_edit.c
    trunk/blender/source/blender/editors/screen/screen_intern.h
    trunk/blender/source/blender/editors/screen/screendump.c

Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c	2012-05-08 15:30:00 UTC (rev 46425)
+++ trunk/blender/source/blender/editors/screen/area.c	2012-05-08 15:43:59 UTC (rev 46426)
@@ -104,10 +104,10 @@
 
 void ED_region_pixelspace(ARegion *ar)
 {
-	int width= ar->winrct.xmax-ar->winrct.xmin+1;
-	int height= ar->winrct.ymax-ar->winrct.ymin+1;
+	int width = ar->winrct.xmax - ar->winrct.xmin + 1;
+	int height = ar->winrct.ymax - ar->winrct.ymin + 1;
 	
-	wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f);
+	wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f);
 	glLoadIdentity();
 }
 
@@ -117,7 +117,7 @@
 	/* generic notes first */
 	switch (note->category) {
 		case NC_WM:
-			if (note->data==ND_FILEREAD)
+			if (note->data == ND_FILEREAD)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_WINDOW:
@@ -145,7 +145,7 @@
 	if (sa->type && sa->type->refresh) {
 		sa->type->refresh(C, sa);
 	}
-	sa->do_refresh= 0;
+	sa->do_refresh = 0;
 }
 
 /* based on screen region draw tags, set draw tags in azones, and future region tabs etc */
@@ -154,15 +154,15 @@
 {
 	AZone *az;
 	
-	for (az= sa->actionzones.first; az; az= az->next) {
+	for (az = sa->actionzones.first; az; az = az->next) {
 		int xs, ys;
 		
-		xs= (az->x1+az->x2)/2;
-		ys= (az->y1+az->y2)/2;
+		xs = (az->x1 + az->x2) / 2;
+		ys = (az->y1 + az->y2) / 2;
 
 		/* test if inside */
 		if (BLI_in_rcti(&ar->winrct, xs, ys)) {
-			az->do_draw= 1;
+			az->do_draw = 1;
 		}
 	}
 }
@@ -181,16 +181,16 @@
 	glColor4ub(255, 255, 255, 180);
 	fdrawline(x1, y2, x2, y1);
 	glColor4ub(255, 255, 255, 130);
-	fdrawline(x1, y2-dy, x2-dx, y1);
+	fdrawline(x1, y2 - dy, x2 - dx, y1);
 	glColor4ub(255, 255, 255, 80);
-	fdrawline(x1, y2-2*dy, x2-2*dx, y1);
+	fdrawline(x1, y2 - 2 * dy, x2 - 2 * dx, y1);
 	
 	glColor4ub(0, 0, 0, 210);
-	fdrawline(x1, y2+1, x2+1, y1);
+	fdrawline(x1, y2 + 1, x2 + 1, y1);
 	glColor4ub(0, 0, 0, 180);
-	fdrawline(x1, y2-dy+1, x2-dx+1, y1);
+	fdrawline(x1, y2 - dy + 1, x2 - dx + 1, y1);
 	glColor4ub(0, 0, 0, 150);
-	fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
+	fdrawline(x1, y2 - 2 * dy + 1, x2 - 2 * dx + 1, y1);
 
 	glDisable(GL_LINE_SMOOTH);
 	glDisable(GL_BLEND);
@@ -199,8 +199,8 @@
 static void region_draw_azone_icon(AZone *az)
 {
 	GLUquadricObj *qobj = NULL; 
-	short midx = az->x1 + (az->x2 - az->x1)/2;
-	short midy = az->y1 + (az->y2 - az->y1)/2;
+	short midx = az->x1 + (az->x2 - az->x1) / 2;
+	short midy = az->y1 + (az->y2 - az->y1) / 2;
 		
 	qobj = gluNewQuadric();
 	
@@ -226,8 +226,8 @@
 	gluDeleteQuadric(qobj);
 	
 	/* + */
-	sdrawline(midx, midy-2, midx, midy+3);
-	sdrawline(midx-2, midy, midx+3, midy);
+	sdrawline(midx, midy - 2, midx, midy + 3);
+	sdrawline(midx - 2, midy, midx + 3, midy);
 }
 
 static void draw_azone_plus(float x1, float y1, float x2, float y2)
@@ -235,9 +235,9 @@
 	float width = 2.0f;
 	float pad = 4.0f;
 	
-	glRectf((x1 + x2 - width)*0.5f, y1 + pad, (x1 + x2 + width)*0.5f, y2 - pad);
-	glRectf(x1 + pad, (y1 + y2 - width)*0.5f, (x1 + x2 - width)*0.5f, (y1 + y2 + width)*0.5f);
-	glRectf((x1 + x2 + width)*0.5f, (y1 + y2 - width)*0.5f, x2 - pad, (y1 + y2 + width)*0.5f);
+	glRectf((x1 + x2 - width) * 0.5f, y1 + pad, (x1 + x2 + width) * 0.5f, y2 - pad);
+	glRectf(x1 + pad, (y1 + y2 - width) * 0.5f, (x1 + x2 - width) * 0.5f, (y1 + y2 + width) * 0.5f);
+	glRectf((x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f);
 }
 
 static void region_draw_azone_tab_plus(AZone *az)
@@ -288,14 +288,14 @@
 			
 			uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
 			glColor4ub(0, 0, 0, 255);
-			uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
+			uiRoundRect((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f);
 			break;
 		case AE_BOTTOM_TO_TOPLEFT:
 			uiSetRoundBox(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
 			
 			uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
 			glColor4ub(0, 0, 0, 255);
-			uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
+			uiRoundRect((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f);
 			break;
 		case AE_LEFT_TO_TOPRIGHT:
 			uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
@@ -327,19 +327,19 @@
 	/* add code to draw region hidden as 'too small' */
 	switch (az->edge) {
 		case AE_TOP_TO_BOTTOMRIGHT:
-			ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1+az->x2)/2, (float)az->y2);
+			ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1 + az->x2) / 2, (float)az->y2);
 			break;
 			
 		case AE_BOTTOM_TO_TOPLEFT:
-			ui_draw_anti_tria((float)az->x1, (float)az->y2, (float)az->x2, (float)az->y2, (float)(az->x1+az->x2)/2, (float)az->y1);
+			ui_draw_anti_tria((float)az->x1, (float)az->y2, (float)az->x2, (float)az->y2, (float)(az->x1 + az->x2) / 2, (float)az->y1);
 			break;
 
 		case AE_LEFT_TO_TOPRIGHT:
-			ui_draw_anti_tria((float)az->x2, (float)az->y1, (float)az->x2, (float)az->y2, (float)az->x1, (float)(az->y1+az->y2)/2);
+			ui_draw_anti_tria((float)az->x2, (float)az->y1, (float)az->x2, (float)az->y2, (float)az->x1, (float)(az->y1 + az->y2) / 2);
 			break;
 			
 		case AE_RIGHT_TO_TOPLEFT:
-			ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x1, (float)az->y2, (float)az->x2, (float)(az->y1+az->y2)/2);
+			ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x1, (float)az->y2, (float)az->x2, (float)(az->y1 + az->y2) / 2);
 			break;
 			
 	}
@@ -350,8 +350,8 @@
 /* only exported for WM */
 void ED_area_overdraw(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
-	bScreen *screen= CTX_wm_screen(C);
+	wmWindow *win = CTX_wm_window(C);
+	bScreen *screen = CTX_wm_screen(C);
 	ScrArea *sa;
 	
 	/* Draw AZones, in screenspace */
@@ -360,23 +360,23 @@
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	
-	for (sa= screen->areabase.first; sa; sa= sa->next) {
+	for (sa = screen->areabase.first; sa; sa = sa->next) {
 		AZone *az;
-		for (az= sa->actionzones.first; az; az= az->next) {
+		for (az = sa->actionzones.first; az; az = az->next) {
 			if (az->do_draw) {
-				if (az->type==AZONE_AREA) {
+				if (az->type == AZONE_AREA) {
 					area_draw_azone(az->x1, az->y1, az->x2, az->y2);
 				}
-				else if (az->type==AZONE_REGION) {
+				else if (az->type == AZONE_REGION) {
 					
 					if (az->ar) {
 						/* only display tab or icons when the region is hidden */
-						if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-							if (G.rt==3)
+						if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
+							if (G.rt == 3)
 								region_draw_azone_icon(az);
-							else if (G.rt==2)
+							else if (G.rt == 2)
 								region_draw_azone_tria(az);
-							else if (G.rt==1)
+							else if (G.rt == 1)
 								region_draw_azone_tab(az);
 							else
 								region_draw_azone_tab_plus(az);
@@ -384,7 +384,7 @@
 					}
 				}
 				
-				az->do_draw= 0;
+				az->do_draw = 0;
 			}
 		}
 	}	
@@ -395,21 +395,21 @@
 /* get scissor rect, checking overlapping regions */
 void region_scissor_winrct(ARegion *ar, rcti *winrct)
 {
-	*winrct= ar->winrct;
+	*winrct = ar->winrct;
 	
 	if (ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
 		return;
 
 	while (ar->prev) {
-		ar= ar->prev;
+		ar = ar->prev;
 		
 		if (BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
-			if (ar->flag & RGN_FLAG_HIDDEN);
-			else if (ar->alignment & RGN_SPLIT_PREV);
-			else if (ar->alignment==RGN_OVERLAP_LEFT) {
+			if (ar->flag & RGN_FLAG_HIDDEN) ;
+			else if (ar->alignment & RGN_SPLIT_PREV) ;
+			else if (ar->alignment == RGN_OVERLAP_LEFT) {
 				winrct->xmin = ar->winrct.xmax + 1;
 			}
-			else if (ar->alignment==RGN_OVERLAP_RIGHT) {
+			else if (ar->alignment == RGN_OVERLAP_RIGHT) {
 				winrct->xmax = ar->winrct.xmin - 1;
 			}
 			else break;
@@ -421,19 +421,19 @@
 /* makes region ready for drawing, sets pixelspace */
 void ED_region_set(const bContext *C, ARegion *ar)
 {
-	wmWindow *win= CTX_wm_window(C);
-	ScrArea *sa= CTX_wm_area(C);
+	wmWindow *win = CTX_wm_window(C);
+	ScrArea *sa = CTX_wm_area(C);
 	rcti winrct;
 	
 	/* checks other overlapping regions */
 	region_scissor_winrct(ar, &winrct);
 	
-	ar->drawrct= winrct;
+	ar->drawrct = winrct;
 	
 	/* note; this sets state, so we can use wmOrtho and friends */
 	wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
 	
-	UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
+	UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0);
 	
 	ED_region_pixelspace(ar);
 }
@@ -442,9 +442,9 @@
 /* only exported for WM */
 void ED_region_do_draw(bContext *C, ARegion *ar)
 {
-	wmWindow *win= CTX_wm_window(C);
-	ScrArea *sa= CTX_wm_area(C);
-	ARegionType *at= ar->type;
+	wmWindow *win = CTX_wm_window(C);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegionType *at = ar->type;
 	rcti winrct;
 	
 	/* see BKE_spacedata_draw_locks() */
@@ -456,7 +456,7 @@
 	
 	/* if no partial draw rect set, full rect */
 	if (ar->drawrct.xmin == ar->drawrct.xmax)
-		ar->drawrct= winrct;
+		ar->drawrct = winrct;
 	else {
 		/* extra clip for safety */
 		ar->drawrct.xmin = MAX2(winrct.xmin, ar->drawrct.xmin);
@@ -468,7 +468,7 @@
 	/* note; this sets state, so we can use wmOrtho and friends */
 	wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
 	
-	UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
+	UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0);
 	
 	/* optional header info instead? */
 	if (ar->headerstr) {
@@ -487,7 +487,7 @@
 
 	ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
 
-	ar->do_draw= 0;
+	ar->do_draw = 0;
 	memset(&ar->drawrct, 0, sizeof(ar->drawrct));
 	
 	uiFreeInactiveBlocks(C, &ar->uiblocks);
@@ -505,7 +505,7 @@
 {
 	if (ar) {
 		/* zero region means full region redraw */
-		ar->do_draw= RGN_DRAW;
+		ar->do_draw = RGN_DRAW;
 		memset(&ar->drawrct, 0, sizeof(ar->drawrct));
 	}
 }
@@ -513,7 +513,7 @@
 void ED_region_tag_redraw_overlay(ARegion *ar)
 {
 	if (ar)
-		ar->do_draw_overlay= RGN_DRAW;
+		ar->do_draw_overlay = RGN_DRAW;
 }
 
 void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
@@ -521,8 +521,8 @@
 	if (ar) {
 		if (!ar->do_draw) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list