[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23163] trunk/blender/source/blender/ editors: * Removed the grey overlapping 'region manipulation' triangles.

Matt Ebb matt at mke3.net
Sun Sep 13 01:56:31 CEST 2009


Revision: 23163
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23163
Author:   broken
Date:     2009-09-13 01:56:30 +0200 (Sun, 13 Sep 2009)

Log Message:
-----------
* Removed the grey overlapping 'region manipulation' triangles.

- They were causing unnecessary visual noise, breaking up the lines of the region edges
- Now you can just drag anywhere on a region edge to resize it, like existing area edges
- To minimise a region, click once on the region edge, or resize it down to nothing. For minimised regions, a (+) icon will appear, which you can click to restore it to the size it was before it was minimised.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_screen_types.h
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c

Modified: trunk/blender/source/blender/editors/include/ED_screen_types.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen_types.h	2009-09-12 21:39:50 UTC (rev 23162)
+++ trunk/blender/source/blender/editors/include/ED_screen_types.h	2009-09-12 23:56:30 UTC (rev 23163)
@@ -59,7 +59,7 @@
 	/* internal */
 	short do_draw;
 	/* for draw */
-	short x1, y1, x2, y2, x3, y3;
+	short x1, y1, x2, y2;
 	/* for clip */
 	rcti rect;	
 } AZone;

Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c	2009-09-12 21:39:50 UTC (rev 23162)
+++ trunk/blender/source/blender/editors/screen/area.c	2009-09-12 23:56:30 UTC (rev 23163)
@@ -159,14 +159,8 @@
 	for(az= sa->actionzones.first; az; az= az->next) {
 		int xs, ys;
 		
-		if(az->type==AZONE_AREA) {
-			xs= (az->x1+az->x2)/2;
-			ys= (az->y1+az->y2)/2;
-		}
-		else {
-			xs= az->x3;
-			ys= az->y3;
-		}
+		xs= (az->x1+az->x2)/2;
+		ys= (az->y1+az->y2)/2;
 
 		/* test if inside */
 		if(BLI_in_rcti(&ar->winrct, xs, ys)) {
@@ -196,25 +190,44 @@
 	fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
 }
 
+
 static void region_draw_azone(ScrArea *sa, AZone *az)
 {
+	GLUquadricObj *qobj = gluNewQuadric(); 
+	short midx = az->x1 + (az->x2 - az->x1)/2;
+	short midy = az->y1 + (az->y2 - az->y1)/2;
+	
 	if(az->ar==NULL) return;
 	
-	UI_SetTheme(sa->spacetype, az->ar->type->regionid);
+	/* only display action zone icons when the region is hidden */
+	if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
 	
-	UI_ThemeColor(TH_BACK);
-	glBegin(GL_TRIANGLES);
-	glVertex2s(az->x1, az->y1);
-	glVertex2s(az->x2, az->y2);
-	glVertex2s(az->x3, az->y3);
-	glEnd();
+	glPushMatrix(); 	
+	glTranslatef(midx, midy, 0.); 
 	
-	UI_ThemeColorShade(TH_BACK, 50);
-	sdrawline(az->x1, az->y1, az->x3, az->y3);
+	/* outlined circle */
+	glEnable(GL_BLEND);
+	glEnable(GL_LINE_SMOOTH);
+
+	glColor4f(1.f, 1.f, 1.f, 0.8f);
+
+	gluQuadricDrawStyle(qobj, GLU_FILL); 
+	gluDisk( qobj, 0.0,  4.25f, 16, 1); 
+
+	glColor4f(0.2f, 0.2f, 0.2f, 0.9f);
 	
-	UI_ThemeColorShade(TH_BACK, -50);
-	sdrawline(az->x2, az->y2, az->x3, az->y3);
-
+	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); 
+	gluDisk( qobj, 0.0,  4.25f, 16, 1); 
+	
+	glDisable(GL_LINE_SMOOTH);
+	glDisable(GL_BLEND);
+	
+	glPopMatrix();
+	gluDeleteQuadric(qobj);
+	
+	/* + */
+	sdrawline(midx, midy-2, midx, midy+3);
+	sdrawline(midx-2, midy, midx+3, midy);
 }
 
 
@@ -235,10 +248,11 @@
 		AZone *az;
 		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) {
 					region_draw_azone(sa, az);
+				}
 				
 				az->do_draw= 0;
 			}
@@ -449,73 +463,104 @@
 	BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
 }
 
-static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge) 
+#define AZONEPAD_EDGE	4
+#define AZONEPAD_ICON	6
+static void region_azone_edge(AZone *az, ARegion *ar)
 {
-	AZone *az, *azt;
-	
-	az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-	BLI_addtail(&(sa->actionzones), az);
-	az->type= AZONE_REGION;
-	az->ar= ar;
-	az->edge= edge;
-	
-	if(edge=='t') {
-		az->x1= ar->winrct.xmin+AZONESPOT;
-		az->y1= ar->winrct.ymax;
-		az->x2= ar->winrct.xmin+2*AZONESPOT;
+	if(az->edge=='t') {
+		az->x1= ar->winrct.xmin;
+		az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
+		az->x2= ar->winrct.xmax;
 		az->y2= ar->winrct.ymax;
-		az->x3= (az->x1+az->x2)/2;
-		az->y3= az->y2+AZONESPOT/2;
-		BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y3);
 	}
-	else if(edge=='b') {
-		az->x1= ar->winrct.xmin+AZONESPOT;
-		az->y1= ar->winrct.ymin;
-		az->x2= ar->winrct.xmin+2*AZONESPOT;
+	else if(az->edge=='b') {
+		az->x1= ar->winrct.xmin;
+		az->y1= ar->winrct.ymin + AZONEPAD_EDGE;
+		az->x2= ar->winrct.xmax;
 		az->y2= ar->winrct.ymin;
-		az->x3= (az->x1+az->x2)/2;
-		az->y3= az->y2-AZONESPOT/2;
-		BLI_init_rcti(&az->rect, az->x1, az->x2, az->y3, az->y1);
 	}
-	else if(edge=='l') {
+	else if(az->edge=='l') {
 		az->x1= ar->winrct.xmin;
-		az->y1= ar->winrct.ymax-AZONESPOT;
-		az->x2= ar->winrct.xmin;
-		az->y2= ar->winrct.ymax-2*AZONESPOT;
-		az->x3= az->x2-AZONESPOT/2;
-		az->y3= (az->y1+az->y2)/2;
-		BLI_init_rcti(&az->rect, az->x3, az->x1, az->y1, az->y2);
+		az->y1= ar->winrct.ymin;
+		az->x2= ar->winrct.xmin + AZONEPAD_EDGE;
+		az->y2= ar->winrct.ymax;
 	}
-	else { // if(edge=='r') {
+	else { // if(az->edge=='r') {
 		az->x1= ar->winrct.xmax;
-		az->y1= ar->winrct.ymax-AZONESPOT;
-		az->x2= ar->winrct.xmax;
-		az->y2= ar->winrct.ymax-2*AZONESPOT;
-		az->x3= az->x2+AZONESPOT/2;
-		az->y3= (az->y1+az->y2)/2;
-		BLI_init_rcti(&az->rect, az->x1, az->x3, az->y1, az->y2);
+		az->y1= ar->winrct.ymin;
+		az->x2= ar->winrct.xmax - AZONEPAD_EDGE;
+		az->y2= ar->winrct.ymax;
 	}
+
+	BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}
+
+static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
+{
+	AZone *azt;
 	
+	if(az->edge=='t') {
+		az->x1= ar->winrct.xmax - AZONEPAD_ICON;
+		az->y1= ar->winrct.ymax + AZONEPAD_ICON;
+		az->x2= ar->winrct.xmax - 2*AZONEPAD_ICON;
+		az->y2= ar->winrct.ymax + 2*AZONEPAD_ICON;
+	}
+	else if(az->edge=='b') {
+		az->x1= ar->winrct.xmin + AZONEPAD_ICON;
+		az->y1= ar->winrct.ymin - AZONEPAD_ICON;
+		az->x2= ar->winrct.xmin + 2*AZONEPAD_ICON;
+		az->y2= ar->winrct.ymin - 2*AZONEPAD_ICON;
+	}
+	else if(az->edge=='l') {
+		az->x1= ar->winrct.xmin - 2*AZONEPAD_ICON;
+		az->y1= ar->winrct.ymax - 3*AZONEPAD_ICON;
+		az->x2= ar->winrct.xmin - AZONEPAD_ICON;
+		az->y2= ar->winrct.ymax - 2*AZONEPAD_ICON;
+	}
+	else { // if(az->edge=='r') {
+		az->x1= ar->winrct.xmax + AZONEPAD_ICON;
+		az->y1= ar->winrct.ymax - 3*AZONEPAD_ICON;
+		az->x2= ar->winrct.xmax + 2*AZONEPAD_ICON;
+		az->y2= ar->winrct.ymax - 2*AZONEPAD_ICON;
+	}
+
+	BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+	
 	/* if more azones on 1 spot, set offset */
 	for(azt= sa->actionzones.first; azt; azt= azt->next) {
 		if(az!=azt) {
 			if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
-				if(edge=='t' || edge=='b') {
+				if(az->edge=='t' || az->edge=='b') {
 					az->x1+= AZONESPOT;
 					az->x2+= AZONESPOT;
-					az->x3+= AZONESPOT;
-					BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y3);
+					BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
 				}
 				else {
 					az->y1-= AZONESPOT;
 					az->y2-= AZONESPOT;
-					az->y3-= AZONESPOT;
-					BLI_init_rcti(&az->rect, az->x1, az->x3, az->y1, az->y2);
+					BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
 				}
 			}
 		}
 	}
+}
+
+static void region_azone_initialize(ScrArea *sa, ARegion *ar, char edge) 
+{
+	AZone *az;
 	
+	az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+	BLI_addtail(&(sa->actionzones), az);
+	az->type= AZONE_REGION;
+	az->ar= ar;
+	az->edge= edge;
+	
+	if (ar->flag & RGN_FLAG_HIDDEN) {
+		region_azone_icon(sa, az, ar);
+	} else {
+		region_azone_edge(az, ar);
+	}
+	
 }
 
 

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2009-09-12 21:39:50 UTC (rev 23162)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2009-09-12 23:56:30 UTC (rev 23163)
@@ -396,15 +396,7 @@
 					break;
 			}
 			else if(az->type == AZONE_REGION) {
-				float v1[2], v2[2], v3[2], pt[2];
-				
-				v1[0]= az->x1; v1[1]= az->y1;
-				v2[0]= az->x2; v2[1]= az->y2;
-				v3[0]= az->x3; v3[1]= az->y3;
-				pt[0]= x; pt[1]=y;
-
-				if(IsPointInTri2D(v1, v2, v3, pt)) 
-					break;
+				break;
 			}
 		}
 	}
@@ -1273,7 +1265,9 @@
 /* ************** scale region edge operator *********************************** */
 
 typedef struct RegionMoveData {
+	AZone *az;
 	ARegion *ar;
+	ScrArea *sa;
 	int bigger, smaller, origval;
 	int origx, origy;
 	char edge;
@@ -1290,7 +1284,9 @@
 		
 		op->customdata= rmd;
 		
+		rmd->az = az;
 		rmd->ar= az->ar;
+		rmd->sa = sad->sa1;
 		rmd->edge= az->edge;
 		rmd->origx= event->x;
 		rmd->origy= event->y;
@@ -1322,8 +1318,8 @@
 				if(rmd->edge=='l') delta= -delta;
 				rmd->ar->type->minsizex= rmd->origval + delta;
 				CLAMP(rmd->ar->type->minsizex, 0, 1000);
-				if(rmd->ar->type->minsizex < 10) {
-					rmd->ar->type->minsizex= 10;
+				if(rmd->ar->type->minsizex < 24) {
+					rmd->ar->type->minsizex= rmd->origval;
 					rmd->ar->flag |= RGN_FLAG_HIDDEN;
 				}
 				else
@@ -1334,8 +1330,8 @@
 				if(rmd->edge=='b') delta= -delta;
 				rmd->ar->type->minsizey= rmd->origval + delta;
 				CLAMP(rmd->ar->type->minsizey, 0, 1000);
-				if(rmd->ar->type->minsizey < 10) {
-					rmd->ar->type->minsizey= 10;
+				if(rmd->ar->type->minsizey < 24) {
+					rmd->ar->type->minsizey= rmd->origval;
 					rmd->ar->flag |= RGN_FLAG_HIDDEN;
 				}
 				else

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2009-09-12 21:39:50 UTC (rev 23162)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2009-09-12 23:56:30 UTC (rev 23163)
@@ -742,7 +742,7 @@
 
 	if (printable) {
 		UI_ThemeColor(TH_TEXT_HI);
-		BLF_draw_default(10,  ar->winy-20, 0.0f, printable);
+		BLF_draw_default(20,  ar->winy-20, 0.0f, printable);
 	}
 
 	if (v3d->localview) {





More information about the Bf-blender-cvs mailing list