[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13280] branches/blender2.5/blender/source /blender/editors/screen: * clean up ^M

Nathan Letwory jesterking at letwory.net
Fri Jan 18 00:03:37 CET 2008


Revision: 13280
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13280
Author:   jesterking
Date:     2008-01-18 00:03:37 +0100 (Fri, 18 Jan 2008)

Log Message:
-----------
* clean up ^M
* make default size of action zones smaller (still draw them, but that could be also made optional).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
    branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c

Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c	2008-01-17 23:02:11 UTC (rev 13279)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c	2008-01-17 23:03:37 UTC (rev 13280)
@@ -40,7 +40,7 @@
 #include "BKE_utildefines.h"
 
 #include "ED_area.h"
-#include "ED_screen.h"
+#include "ED_screen.h"
 #include "ED_screen_types.h"
 
 #include "WM_api.h"
@@ -258,97 +258,98 @@
 	/* for speedup */
 	sa->winx= sa->totrct.xmax-sa->totrct.xmin+1;
 	sa->winy= sa->totrct.ymax-sa->totrct.ymin+1;
-}
-
-void area_azone_initialize(ScrArea *sa) {
-	AZone *az;
-	if(sa->actionzones.first==NULL) {
-		printf("area_azone_initialize\n");
-		/* set action zones - should these actually be ARegions? With these we can easier check area hotzones */
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&(sa->actionzones), az);
-		az->type= AZONE_TRI;
-		az->x1= sa->v1->vec.x+1;
-		az->y1= sa->v1->vec.y+1;
-		az->x2= sa->v1->vec.x+HEADERY;
-		az->y2= sa->v1->vec.y+HEADERY;
-		az->pos= AZONE_SW;
-		az->action= AZONE_SPLIT;
-		
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&(sa->actionzones), az);
-		az->type= AZONE_TRI;
-		az->x1= sa->v3->vec.x-1;
-		az->y1= sa->v3->vec.y-1;
-		az->x2= sa->v3->vec.x-HEADERY;
-		az->y2= sa->v3->vec.y-HEADERY;
-		az->pos= AZONE_NE;
-		az->action= AZONE_DRAG;
-		
-		/*az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&sa->azones, az);
-		az->type= AZONE_TRI;
-		az->x1= as->v1->vec.x;
-		az->y1= as->v1->vec.y;
-		az->x2= as->v1->vec.x+HEADERY;
-		az->y2= as->v1->vec.y+HEADERY;
-		
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&sa->azones, az);
-		az->type= AZONE_TRI;
-		az->x1= as->v1->vec.x;
-		az->y1= as->v1->vec.y;
-		az->x2= as->v1->vec.x+HEADERY;
-		az->y2= as->v1->vec.y+HEADERY;
-		
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&sa->azones, az);
-		az->type= AZONE_QUAD;
-		az->x1= as->v1->vec.x;
-		az->y1= as->v1->vec.y;
-		az->x2= as->v1->vec.x+HEADERY;
-		az->y2= as->v1->vec.y+HEADERY;
-		
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&sa->azones, az);
-		az->type= AZONE_QUAD;
-		az->x1= as->v1->vec.x;
-		az->y1= as->v1->vec.y;
-		az->x2= as->v1->vec.x+HEADERY;
-		az->y2= as->v1->vec.y+HEADERY;
-		
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&sa->azones, az);
-		az->type= AZONE_QUAD;
-		az->x1= as->v1->vec.x;
-		az->y1= as->v1->vec.y;
-		az->x2= as->v1->vec.x+HEADERY;
-		az->y2= as->v1->vec.y+HEADERY;
-		
-		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
-		BLI_addtail(&sa->azones, az);
-		az->type= AZONE_QUAD;
-		az->x1= as->v1->vec.x;
-		az->y1= as->v1->vec.y;
-		az->x2= as->v1->vec.x+HEADERY;
-		az->y2= as->v1->vec.y+HEADERY;*/
-	}
-	
-	for(az= sa->actionzones.first; az; az= az->next) {
-		if(az->pos==AZONE_SW) {
-			az->x1= sa->v1->vec.x+1;
-			az->y1= sa->v1->vec.y+1;
-			az->x2= sa->v1->vec.x+HEADERY;
-			az->y2= sa->v1->vec.y+HEADERY;
-		} else if (az->pos==AZONE_NE) {
-			az->x1= sa->v3->vec.x-1;
-			az->y1= sa->v3->vec.y-1;
-			az->x2= sa->v3->vec.x-HEADERY;
-			az->y2= sa->v3->vec.y-HEADERY;
-		}
-	}
 }
 
+#define AZONESPOT		6
+void area_azone_initialize(ScrArea *sa) {
+	AZone *az;
+	if(sa->actionzones.first==NULL) {
+		printf("area_azone_initialize\n");
+		/* set action zones - should these actually be ARegions? With these we can easier check area hotzones */
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&(sa->actionzones), az);
+		az->type= AZONE_TRI;
+		az->x1= sa->v1->vec.x+1;
+		az->y1= sa->v1->vec.y+1;
+		az->x2= sa->v1->vec.x+AZONESPOT;
+		az->y2= sa->v1->vec.y+AZONESPOT;
+		az->pos= AZONE_SW;
+		az->action= AZONE_SPLIT;
+		
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&(sa->actionzones), az);
+		az->type= AZONE_TRI;
+		az->x1= sa->v3->vec.x-1;
+		az->y1= sa->v3->vec.y-1;
+		az->x2= sa->v3->vec.x-AZONESPOT;
+		az->y2= sa->v3->vec.y-AZONESPOT;
+		az->pos= AZONE_NE;
+		az->action= AZONE_DRAG;
+		
+		/*az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&sa->azones, az);
+		az->type= AZONE_TRI;
+		az->x1= as->v1->vec.x;
+		az->y1= as->v1->vec.y;
+		az->x2= as->v1->vec.x+AZONESPOT;
+		az->y2= as->v1->vec.y+AZONESPOT;
+		
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&sa->azones, az);
+		az->type= AZONE_TRI;
+		az->x1= as->v1->vec.x;
+		az->y1= as->v1->vec.y;
+		az->x2= as->v1->vec.x+AZONESPOT;
+		az->y2= as->v1->vec.y+AZONESPOT;
+		
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&sa->azones, az);
+		az->type= AZONE_QUAD;
+		az->x1= as->v1->vec.x;
+		az->y1= as->v1->vec.y;
+		az->x2= as->v1->vec.x+AZONESPOT;
+		az->y2= as->v1->vec.y+AZONESPOT;
+		
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&sa->azones, az);
+		az->type= AZONE_QUAD;
+		az->x1= as->v1->vec.x;
+		az->y1= as->v1->vec.y;
+		az->x2= as->v1->vec.x+AZONESPOT;
+		az->y2= as->v1->vec.y+AZONESPOT;
+		
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&sa->azones, az);
+		az->type= AZONE_QUAD;
+		az->x1= as->v1->vec.x;
+		az->y1= as->v1->vec.y;
+		az->x2= as->v1->vec.x+AZONESPOT;
+		az->y2= as->v1->vec.y+AZONESPOT;
+		
+		az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
+		BLI_addtail(&sa->azones, az);
+		az->type= AZONE_QUAD;
+		az->x1= as->v1->vec.x;
+		az->y1= as->v1->vec.y;
+		az->x2= as->v1->vec.x+AZONESPOT;
+		az->y2= as->v1->vec.y+AZONESPOT;*/
+	}
+	
+	for(az= sa->actionzones.first; az; az= az->next) {
+		if(az->pos==AZONE_SW) {
+			az->x1= sa->v1->vec.x+1;
+			az->y1= sa->v1->vec.y+1;
+			az->x2= sa->v1->vec.x+AZONESPOT;
+			az->y2= sa->v1->vec.y+AZONESPOT;
+		} else if (az->pos==AZONE_NE) {
+			az->x1= sa->v3->vec.x-1;
+			az->y1= sa->v3->vec.y-1;
+			az->x2= sa->v3->vec.x-AZONESPOT;
+			az->y2= sa->v3->vec.y-AZONESPOT;
+		}
+	}
+}
+
 /* called in screen_refresh, or screens_init */
 void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
 {
@@ -383,8 +384,8 @@
 			ar->swinid= wm_subwindow_open(win, &ar->winrct);
 		else 
 			wm_subwindow_position(win, ar->swinid, &ar->winrct);
-	}
-	
+	}
+	
 	area_azone_initialize(sa);
 }
 
@@ -394,7 +395,7 @@
 void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
 {
 	Panel *pa1, *pa2, *patab;
-	ARegion *ar;
+	ARegion *ar;
 	AZone *az;
 	
 	sa1->headertype= sa2->headertype;
@@ -433,7 +434,7 @@
 	BLI_freelistN(&sa1->regionbase);
 	BLI_duplicatelist(&sa1->regionbase, &sa2->regionbase);
 	for(ar= sa1->regionbase.first; ar; ar= ar->next)
-		ar->swinid= 0;
+		ar->swinid= 0;
 		
 	/* scripts */
 	BPY_free_scriptlink(&sa1->scriptlink);

Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c	2008-01-17 23:02:11 UTC (rev 13279)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c	2008-01-17 23:03:37 UTC (rev 13280)
@@ -26,7 +26,7 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 
 #include "BKE_global.h"
@@ -140,25 +140,25 @@
 	}
 
 	return sa;
-}
-
-static AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
-{
-	AZone *az= NULL;
-	int i= 0;
-	
-	for(az= sa->actionzones.first, i= 0; az; az= az->next, i++) {
-		if(az && az->type == AZONE_TRI) {
-			if(IsPointInTri2DInts(az->x1, az->y1, az->x2, az->y2, x, y)) break;
-		}
-		if(az->type == AZONE_QUAD) {
-			if(az->x1 < x && x < az->x2 && az->y1 < y && y < az->y2) break;
-		}
-	}
-	
-	return az;
 }
 
+static AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
+{
+	AZone *az= NULL;
+	int i= 0;
+	
+	for(az= sa->actionzones.first, i= 0; az; az= az->next, i++) {
+		if(az && az->type == AZONE_TRI) {
+			if(IsPointInTri2DInts(az->x1, az->y1, az->x2, az->y2, x, y)) break;
+		}
+		if(az->type == AZONE_QUAD) {
+			if(az->x1 < x && x < az->x2 && az->y1 < y && y < az->y2) break;
+		}
+	}
+	
+	return az;
+}
+
 static void removedouble_scrverts(bScreen *sc)
 {
 	ScrVert *v1, *verg;
@@ -370,7 +370,7 @@
 }
 
 static ScrArea *screen_addarea(bScreen *sc, ScrVert *v1, ScrVert *v2, ScrVert *v3, ScrVert *v4, short headertype, short spacetype)
-{
+{
 	AZone *az= NULL;
 	ScrArea *sa= MEM_callocN(sizeof(ScrArea), "addscrarea");
 	sa->v1= v1;
@@ -718,16 +718,16 @@
 #define SCR_ROUND 12
 
 static void drawscredge_area(ScrArea *sa)
-{
+{
 	AZone *az;
-	short x1= sa->v1->vec.x;
+	short x1= sa->v1->vec.x;
 	short xa1= x1+HEADERY;
-	short y1= sa->v1->vec.y;
+	short y1= sa->v1->vec.y;
 	short ya1= y1+HEADERY;
-	short x2= sa->v3->vec.x;
+	short x2= sa->v3->vec.x;
 	short xb2= x2-HEADERY;
-	short y2= sa->v3->vec.y;
-	short yb2= y2-HEADERY;
+	short y2= sa->v3->vec.y;
+	short yb2= y2-HEADERY;
 	
 	cpack(0x0);
 	
@@ -737,17 +737,18 @@
 	/* left border area */
 	if(x1>0) { /* otherwise it draws the emboss of window over */
 		sdrawline(x1, y1, x1, y2);
-	}
+	}
 	
 	/* top border area */
 	sdrawline(x1, y2, x2, y2);
 	
 	/* bottom border area */
-	sdrawline(x1, y1, x2, y1);
-	
-	/* temporary viz for 'action corner' */
-	for(az= sa->actionzones.first; az; az= az->next) {
-		if(az->type==AZONE_TRI) sdrawtrifill(az->x1, az->y1, az->x2, az->y2, .2, .2, .2);
+	sdrawline(x1, y1, x2, y1);
+	
+	/* temporary viz for 'action corner' */
+	for(az= sa->actionzones.first; az; az= az->next) {
+		if(az->type==AZONE_TRI) sdrawtrifill(az->x1, az->y1, az->x2, az->y2, .2, .2, .2);
+		//if(az->type==AZONE_TRI) sdrawtri(az->x1, az->y1, az->x2, az->y2);
 	}
 }
 
@@ -761,13 +762,13 @@
 			break;
 		case WM_NOTE_SCREEN_CHANGED:
 			screen->do_draw= screen->do_refresh= 1;
-			break;
-		case WM_NOTE_AREA_SPLIT:
-			printf("WM_NOTE_AREA_SPLIT\n");
-			break;
-		case WM_NOTE_AREA_DRAG:
-			printf("WM_NOTE_AREA_DRAG\n");
 			break;
+		case WM_NOTE_AREA_SPLIT:
+			printf("WM_NOTE_AREA_SPLIT\n");
+			break;
+		case WM_NOTE_AREA_DRAG:
+			printf("WM_NOTE_AREA_DRAG\n");
+			break;
 	}
 }
 
@@ -778,7 +779,7 @@
 	
 	wm_subwindow_set(win, win->screen->mainwin);
 	
-	for(sa= win->screen->areabase.first; sa; sa= sa->next)
+	for(sa= win->screen->areabase.first; sa; sa= sa->next)
 		drawscredge_area(sa);
 
 	printf("draw screen\n");
@@ -868,19 +869,19 @@
 		} else {
 			WM_set_cursor(C, CURSOR_X_MOVE);
 		}
-	} else {
-		ScrArea *sa= NULL;
-		AZone *az= NULL;
-		for(sa= C->screen->areabase.first; sa; sa= sa->next) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list