[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37986] trunk/blender/source/blender/ editors: Todo item:

Ton Roosendaal ton at blender.org
Thu Jun 30 17:02:03 CEST 2011


Revision: 37986
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37986
Author:   ton
Date:     2011-06-30 15:02:03 +0000 (Thu, 30 Jun 2011)
Log Message:
-----------
Todo item:

Closed regions didn't always draw the (+) icon right place, confusing
for users.

Next to that, I think this icon is using a bad metaphor or visual language,
Illustrated best if you close a header in outliner or buttons. Icons are
UI widgets, for screen/editor layouts different controls can be stylized.

My preference is something that aligns visually to the seperators between
regions; for testing and hacking pleasure I've added two quick versions,
a small tabbish thing and a triangle. Enable these with debug menu,
ALT+CTRL+D, values 1 or 2.

This is simply drawn with opengl now. An image for it can be made as well.

Previews:
http://www.blender.org/bf/closed_regions1.png
http://www.blender.org/bf/closed_regions2.png
http://www.blender.org/bf/closed_regions3.png

There's other design ideas to explore as well, like making region deviders
8-10 pixels wide, with a 'drag me' dot on it or so. That takes some screen
estate though, and will require to add big editor-dividers too...
Fun stuff for the mockup-mafia to check on, we have time :)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_draw.c
    trunk/blender/source/blender/editors/interface/interface_widgets.c
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/screen/screen_edit.c

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c	2011-06-30 14:47:57 UTC (rev 37985)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c	2011-06-30 15:02:03 UTC (rev 37986)
@@ -142,13 +142,13 @@
 
 static void round_box_shade_col(float *col1, float *col2, float fac)
 {
-	float col[3];
+	float col[4];
 
 	col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]);
 	col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]);
 	col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]);
-	
-	glColor3fv(col);
+	col[3]= (fac*col1[3] + (1.0f-fac)*col2[3]);
+	glColor4fv(col);
 }
 
 
@@ -159,7 +159,7 @@
 	float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
 					  {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
 	float div= maxy-miny;
-	float coltop[3], coldown[3], color[4];
+	float coltop[4], coldown[4], color[4];
 	int a;
 	
 	/* mult */
@@ -173,9 +173,11 @@
 	coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f;
 	coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f;
 	coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f;
+	coltop[3]= color[3];
 	coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f;
 	coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f;
 	coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f;
+	coldown[3]= color[3];
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(mode);

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2011-06-30 14:47:57 UTC (rev 37985)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2011-06-30 15:02:03 UTC (rev 37986)
@@ -180,7 +180,7 @@
 	
 	glEnable(GL_BLEND);
 	glGetFloatv(GL_CURRENT_COLOR, color);
-	color[3]= 0.125;
+	color[3]*= 0.125;
 	glColor4fv(color);
 	
 	/* for each AA step */

Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c	2011-06-30 14:47:57 UTC (rev 37985)
+++ trunk/blender/source/blender/editors/screen/area.c	2011-06-30 15:02:03 UTC (rev 37986)
@@ -188,17 +188,12 @@
 }
 
 
-static void region_draw_azone(AZone *az)
+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;
-	
-	if(az->ar==NULL) return;
-	
-	/* only display action zone icons when the region is hidden */
-	if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
-	
+		
 	qobj = gluNewQuadric();
 	
 	glPushMatrix(); 	
@@ -227,7 +222,80 @@
 	sdrawline(midx-2, midy, midx+3, midy);
 }
 
+static void region_draw_azone_tab(AZone *az)
+{
+	float col[3];
+	
+	glEnable(GL_BLEND);
+	UI_GetThemeColor3fv(TH_HEADER, col);
+	glColor4f(col[0], col[1], col[2], 0.5f);
+	
+	/* add code to draw region hidden as 'too small' */
+	switch(az->edge) {
+		case AE_TOP_TO_BOTTOMRIGHT:
+			uiSetRoundBox(3 + 16);
+			
+			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);
+			break;
+		case AE_BOTTOM_TO_TOPLEFT:
+			uiSetRoundBox(12 + 16);
+			
+			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);
+			break;
+		case AE_LEFT_TO_TOPRIGHT:
+			uiSetRoundBox(9 + 16);
+			
+			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, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
+			break;
+		case AE_RIGHT_TO_TOPLEFT:
+			uiSetRoundBox(6 + 16);
+			
+			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, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
+			break;
+	}
+	
+	glDisable(GL_BLEND);
+}
 
+static void region_draw_azone_tria(AZone *az)
+{
+	extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */
+	
+	glEnable(GL_BLEND);
+	//UI_GetThemeColor3fv(TH_HEADER, col);
+	glColor4f(0.0f, 0.0f, 0.0f, 0.35f);
+	
+	/* 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);
+			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);
+			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);
+			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);
+			break;
+			
+	}
+	
+	glDisable(GL_BLEND);
+}
+
 /* only exported for WM */
 void ED_area_overdraw(bContext *C)
 {
@@ -248,7 +316,19 @@
 				if(az->type==AZONE_AREA) {
 					area_draw_azone(az->x1, az->y1, az->x2, az->y2);
 				} else if(az->type==AZONE_REGION) {
-					region_draw_azone(az);
+					
+					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==2)
+								region_draw_azone_tria(az);
+							else if(G.rt==1)
+								region_draw_azone_tab(az);
+							else
+								region_draw_azone_icon(az);
+						}
+					}
 				}
 				
 				az->do_draw= 0;
@@ -579,6 +659,96 @@
 	}
 }
 
+#define AZONEPAD_TABW	18
+#define AZONEPAD_TABH	7
+
+/* region already made zero sized, in shape of edge */
+static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
+{
+	AZone *azt;
+	int tot= 0, add;
+	
+	for(azt= sa->actionzones.first; azt; azt= azt->next) {
+		if(azt->edge == az->edge) tot++;
+	}
+	
+	switch(az->edge) {
+		case AE_TOP_TO_BOTTOMRIGHT:
+			if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+			az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
+			az->y1= ar->winrct.ymax - add;
+			az->x2= ar->winrct.xmax - AZONEPAD_TABW;
+			az->y2= ar->winrct.ymax - add + AZONEPAD_TABH;
+			break;
+		case AE_BOTTOM_TO_TOPLEFT:
+			az->x1= ar->winrct.xmin + AZONEPAD_TABW;
+			az->y1= ar->winrct.ymin - AZONEPAD_TABH;
+			az->x2= ar->winrct.xmin + 2*AZONEPAD_TABW;
+			az->y2= ar->winrct.ymin;
+			break;
+		case AE_LEFT_TO_TOPRIGHT:
+			az->x1= ar->winrct.xmin + 1 - AZONEPAD_TABH;
+			az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
+			az->x2= ar->winrct.xmin + 1;
+			az->y2= ar->winrct.ymax - AZONEPAD_TABW;
+			break;
+		case AE_RIGHT_TO_TOPLEFT:
+			az->x1= ar->winrct.xmax - 1;
+			az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
+			az->x2= ar->winrct.xmax - 1 + AZONEPAD_TABH;
+			az->y2= ar->winrct.ymax - AZONEPAD_TABW;
+			break;
+	}
+	/* rect needed for mouse pointer test */
+	BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}	
+
+#define AZONEPAD_TRIAW	16
+#define AZONEPAD_TRIAH	9
+
+
+/* region already made zero sized, in shape of edge */
+static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
+{
+	AZone *azt;
+	int tot= 0, add;
+	
+	for(azt= sa->actionzones.first; azt; azt= azt->next) {
+		if(azt->edge == az->edge) tot++;
+	}
+	
+	switch(az->edge) {
+		case AE_TOP_TO_BOTTOMRIGHT:
+			if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+			az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
+			az->y1= ar->winrct.ymax - add;
+			az->x2= ar->winrct.xmax - AZONEPAD_TRIAW;
+			az->y2= ar->winrct.ymax - add + AZONEPAD_TRIAH;
+			break;
+			case AE_BOTTOM_TO_TOPLEFT:
+			az->x1= ar->winrct.xmin + AZONEPAD_TRIAW;
+			az->y1= ar->winrct.ymin - AZONEPAD_TRIAH;
+			az->x2= ar->winrct.xmin + 2*AZONEPAD_TRIAW;
+			az->y2= ar->winrct.ymin;
+			break;
+			case AE_LEFT_TO_TOPRIGHT:
+			az->x1= ar->winrct.xmin + 1 - AZONEPAD_TRIAH;
+			az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
+			az->x2= ar->winrct.xmin + 1;
+			az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
+			break;
+			case AE_RIGHT_TO_TOPLEFT:
+			az->x1= ar->winrct.xmax - 1;
+			az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
+			az->x2= ar->winrct.xmax - 1 + AZONEPAD_TRIAH;
+			az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
+			break;
+	}
+	/* rect needed for mouse pointer test */
+	BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}	
+
+
 static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge) 
 {
 	AZone *az;
@@ -589,8 +759,13 @@
 	az->ar= ar;
 	az->edge= edge;
 	
-	if (ar->flag & RGN_FLAG_HIDDEN) {
-		region_azone_icon(sa, az, ar);
+	if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+		if(G.rt==2)
+			region_azone_tria(sa, az, ar);
+		else if(G.rt==1)
+			region_azone_tab(sa, az, ar);
+		else
+			region_azone_icon(sa, az, ar);
 	} else {
 		region_azone_edge(az, ar);
 	}
@@ -790,15 +965,6 @@
 	ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
 	ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
 	
-	/* restore test exception */
-	if(ar->alignment & RGN_SPLIT_PREV) {
-		if(ar->prev) {
-			remainder= remainder_prev;
-			ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
-			ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
-		}
-	}
-
 	/* set winrect for azones */
 	if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
 		ar->winrct= *remainder;
@@ -814,12 +980,22 @@
 		else /* prevent winrct to be valid */
 			ar->winrct.xmax= ar->winrct.xmin;
 	}
+
+	/* restore prev-split exception */
+	if(ar->alignment & RGN_SPLIT_PREV) {
+		if(ar->prev) {
+			remainder= remainder_prev;
+			ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
+			ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
+		}
+	}
+	
 	/* in end, add azones, where appropriate */
 	if(ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
 		/* The logic for this is: when the header takes up the full area,
 		 * disallow hiding it to view the main window.
 		 *
-		 * Without this, uou can drag down the file selectors header and hide it

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list