[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19566] branches/blender2.5/blender/source /blender/editors/interface: 2.5

Ton Roosendaal ton at blender.org
Mon Apr 6 17:44:32 CEST 2009


Revision: 19566
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19566
Author:   ton
Date:     2009-04-06 17:44:30 +0200 (Mon, 06 Apr 2009)

Log Message:
-----------
2.5

- fixed pixel offset error for listview (outliner)
- removed a lot of old drawing code
- put back special widgets Normal, Curve, Colorband

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_intern.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c
    branches/blender2.5/blender/source/blender/editors/interface/view2d.c

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface.c	2009-04-06 15:35:53 UTC (rev 19565)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface.c	2009-04-06 15:44:30 UTC (rev 19566)
@@ -944,66 +944,7 @@
 
 /* *************************************************************** */
 
-/* XXX 2.50 no button editing */
 
-#if 0
-static void setup_file(uiBlock *block)
-{
-	uiBut *but;
-	FILE *fp;
-
-	fp= fopen("butsetup","w");
-	if(fp==NULL);
-	else {
-		but= block->buttons.first;
-		while(but) {
-			ui_check_but(but);
-			fprintf(fp,"%d,%d,%d,%d   %s %s\n", (int)but->x1, (int)but->y1, (int)( but->x2-but->x1), (int)(but->y2-but->y1), but->str, but->tip);
-			but= but->next;
-		}
-		fclose(fp);
-	}
-}
-
-
-static void edit_but(uiBlock *block, uiBut *but, uiEvent *uevent)
-{
-	short dx, dy, mval[2], mvalo[2], didit=0;
-	
-	getmouseco_sc(mvalo);
-	while(TRUE) {
-		if( !(get_mbut() & L_MOUSE) ) break;	
-	
-		getmouseco_sc(mval);
-		dx= (mval[0]-mvalo[0]);
-		dy= (mval[1]-mvalo[1]);
-		
-		if(dx!=0 || dy!=0) {
-			mvalo[0]= mval[0];
-			mvalo[1]= mval[1];
-			
-			cpack(0xc0c0c0);
-			glRectf(but->x1-2, but->y1-2, but->x2+2, but->y2+2); 
-			
-			if((uevent->qual & LR_SHIFTKEY)==0) {
-				but->x1 += dx;
-				but->y1 += dy;
-			}
-			but->x2 += dx;
-			but->y2 += dy;
-			
-			ui_draw_but(ar, but);
-			ui_block_flush_back(but->block);
-			didit= 1;
-
-		}
-		/* idle for this poor code */
-		else PIL_sleep_ms(30);
-	}
-	if(didit) setup_file(block);
-}
-#endif
-
 /* XXX 2.50 no links supported yet */
 #if 0
 static void ui_delete_active_linkline(uiBlock *block)
@@ -2430,8 +2371,6 @@
 	but->func_arg1= block->func_arg1;
 	but->func_arg2= block->func_arg2;
 	
-	ui_set_embossfunc(but, block->dt);
-	
 	but->pos= -1;	/* cursor invisible */
 
 	if(ELEM(but->type, NUM, NUMABS)) {	/* add a space to name */

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-04-06 15:35:53 UTC (rev 19565)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-04-06 15:44:30 UTC (rev 19566)
@@ -156,55 +156,9 @@
 	glColor3fv(col);
 }
 
-/* only for headers */
-static void gl_round_box_topshade(float minx, float miny, float maxx, float maxy, float rad)
-{
-	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}};
-	char col[7]= {140, 165, 195, 210, 230, 245, 255};
-	int a;
-	char alpha=255;
-	
-	if(roundboxtype & UI_RB_ALPHA) alpha= 128;
-	
-	/* mult */
-	for(a=0; a<7; a++) {
-		vec[a][0]*= rad; vec[a][1]*= rad;
-	}
 
-	/* shades from grey->white->grey */
-	glBegin(GL_LINE_STRIP);
-	
-	if(roundboxtype & 3) {
-		/* corner right-top */
-		glColor4ub(140, 140, 140, alpha);
-		glVertex2f( maxx, maxy-rad);
-		for(a=0; a<7; a++) {
-			glColor4ub(col[a], col[a], col[a], alpha);
-			glVertex2f( maxx-vec[a][1], maxy-rad+vec[a][0]);
-		}
-		glColor4ub(225, 225, 225, alpha);
-		glVertex2f( maxx-rad, maxy);
-	
-		
-		/* corner left-top */
-		glVertex2f( minx+rad, maxy);
-		for(a=0; a<7; a++) {
-			glColor4ub(col[6-a], col[6-a], col[6-a], alpha);
-			glVertex2f( minx+rad-vec[a][0], maxy-vec[a][1]);
-		}
-		glVertex2f( minx, maxy-rad);
-	}
-	else {
-		glColor4ub(225, 225, 225, alpha);
-		glVertex2f( minx, maxy);
-		glVertex2f( maxx, maxy);
-	}
-	
-	glEnd();
-}
-
 /* linear horizontal shade within button or in outline */
+/* view2d scrollers use it */
 void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown)
 {
 	float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
@@ -313,6 +267,7 @@
 }
 
 /* linear vertical shade within button or in outline */
+/* view2d scrollers use it */
 void gl_round_box_vertical_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight)
 {
 	float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
@@ -497,82 +452,7 @@
 	glDisable( GL_LINE_SMOOTH );
 }
 
-void uiTriangleFakeAA(float x1, float y1, float x2, float y2, float x3, float y3, float asp)
-{
-	float color[4], alpha;
-	float jitter;
-	int i, passes=4;
-	
-	/* get the colour and divide up the alpha */
-	glGetFloatv(GL_CURRENT_COLOR, color);
-	alpha = color[3];
-	color[3]= alpha/(float)passes;
-	glColor4fv(color);
-	
-	/* set the 'jitter amount' */
-	jitter = 0.65/(float)passes * asp;
-	
-	glEnable( GL_BLEND );
-	
-	/* draw lots of lines on top of each other */
-	for (i=passes; i>=(-passes); i--) {
-		glBegin(GL_TRIANGLES);
-		
-		/* 'point' first, then two base vertices */
-		glVertex2f(x1, y1+(i*jitter));
-		glVertex2f(x2, y2+(i*jitter));
-		glVertex2f(x3, y3+(i*jitter));
-		glEnd();
-	}
-	
-	glDisable( GL_BLEND );
-	
-	color[3] = alpha;
-	glColor4fv(color);
-}
 
-/* for headers and floating panels */
-void uiRoundBoxEmboss(float minx, float miny, float maxx, float maxy, float rad, int active)
-{
-	float color[4];
-	
-	if(roundboxtype & UI_RB_ALPHA) {
-		glGetFloatv(GL_CURRENT_COLOR, color);
-		color[3]= 0.5;
-		glColor4fv(color);
-		glEnable( GL_BLEND );
-	}
-	
-	/* solid part */
-	//if(active)
-	//	gl_round_box_shade(GL_POLYGON, minx, miny, maxx, maxy, rad, 0.10, -0.05);
-	// else
-	/* shading doesnt work for certain buttons yet (pulldown) need smarter buffer caching (ton) */
-	gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
-	
-	/* set antialias line */
-	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
-		glEnable( GL_LINE_SMOOTH );
-		glEnable( GL_BLEND );
-	}
-
-	/* top shade */
-	gl_round_box_topshade(minx+1, miny+1, maxx-1, maxy-1, rad);
-
-	/* total outline */
-	if(roundboxtype & UI_RB_ALPHA) glColor4ub(0,0,0, 128); else glColor4ub(0,0,0, 200);
-	gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
-   
-	glDisable( GL_LINE_SMOOTH );
-
-	/* bottom shade for header down */
-	if((roundboxtype & 12)==12) {
-		glColor4ub(0,0,0, 80);
-		fdrawline(minx+rad-1.0, miny+1.0, maxx-rad+1.0, miny+1.0);
-	}
-	glDisable( GL_BLEND );
-}
-
 /* ************** safe rasterpos for pixmap alignment with pixels ************* */
 
 void ui_rasterpos_safe(float x, float y, float aspect)
@@ -604,6 +484,8 @@
 
 /* ************** generic embossed rect, for window sliders etc ************* */
 
+
+/* text_draw.c uses this */
 void uiEmboss(float x1, float y1, float x2, float y2, int sel)
 {
 	
@@ -696,1510 +578,8 @@
 }
 
 
-/* ************** DEFAULT THEME, SHADED BUTTONS ************* */
 
 
-#define M_WHITE		UI_ThemeColorShade(colorid, 80)
-
-#define M_ACT_LIGHT	UI_ThemeColorShade(colorid, 55)
-#define M_LIGHT		UI_ThemeColorShade(colorid, 45)
-#define M_HILITE	UI_ThemeColorShade(colorid, 25)
-#define M_LMEDIUM	UI_ThemeColorShade(colorid, 10)
-#define M_MEDIUM	UI_ThemeColor(colorid)
-#define M_LGREY		UI_ThemeColorShade(colorid, -20)
-#define M_GREY		UI_ThemeColorShade(colorid, -45)
-#define M_DARK		UI_ThemeColorShade(colorid, -80)
-
-#define M_NUMTEXT				UI_ThemeColorShade(colorid, 25)
-#define M_NUMTEXT_ACT_LIGHT		UI_ThemeColorShade(colorid, 35)
-
-#define MM_WHITE	UI_ThemeColorShade(TH_BUT_NEUTRAL, 120)
-
-/* Used for the subtle sunken effect around buttons.
- * One option is to hardcode to white, with alpha, however it causes a 
- * weird 'building up' efect, so it's commented out for now.
- */
-
-#define MM_WHITE_OP	UI_ThemeColorShadeAlpha(TH_BACK, 55, -100)
-#define MM_WHITE_TR	UI_ThemeColorShadeAlpha(TH_BACK, 55, -255)
-
-#define MM_LIGHT	UI_ThemeColorShade(TH_BUT_OUTLINE, 45)
-#define MM_MEDIUM	UI_ThemeColor(TH_BUT_OUTLINE)
-#define MM_GREY		UI_ThemeColorShade(TH_BUT_OUTLINE, -45)
-#define MM_DARK		UI_ThemeColorShade(TH_BUT_OUTLINE, -80)
-
-/* base shaded button */
-static void shaded_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid)
-{
-	/* 'mid' arg determines whether the button is in the middle of
-	 * an alignment group or not. 0 = not middle, 1 = is in the middle.
-	 * Done to allow cleaner drawing
-	 */
-	 
-	/* *** SHADED BUTTON BASE *** */
-	glShadeModel(GL_SMOOTH);
-	glBegin(GL_QUADS);
-	
-	if(flag & UI_SELECT) {
-		if(flag & UI_ACTIVE) M_MEDIUM;
-		else M_LGREY;
-	} else {
-		if(flag & UI_ACTIVE) M_LIGHT;
-		else M_HILITE;
-	}
-
-	glVertex2f(x1,y1);
-	glVertex2f(x2,y1);
-
-	if(flag & UI_SELECT) {
-		if(flag & UI_ACTIVE) M_LGREY;
-		else M_GREY;
-	} else {
-		if(flag & UI_ACTIVE) M_ACT_LIGHT;
-		else M_LIGHT;
-	}
-
-	glVertex2f(x2,(y2-(y2-y1)/3));
-	glVertex2f(x1,(y2-(y2-y1)/3));
-	glEnd();
-	
-
-	glShadeModel(GL_FLAT);
-	glBegin(GL_QUADS);
-	
-	if(flag & UI_SELECT) {
-		if(flag & UI_ACTIVE) M_LGREY;
-		else M_GREY;
-	} else {
-		if(flag & UI_ACTIVE) M_ACT_LIGHT;
-		else M_LIGHT;
-	}
-	
-	glVertex2f(x1,(y2-(y2-y1)/3));
-	glVertex2f(x2,(y2-(y2-y1)/3));
-	glVertex2f(x2,y2);
-	glVertex2f(x1,y2);
-
-	glEnd();
-	/* *** END SHADED BUTTON BASE *** */
-	
-	/* *** INNER OUTLINE *** */
-	/* left */
-	if(!(flag & UI_SELECT)) {
-		glShadeModel(GL_SMOOTH);
-		glBegin(GL_LINES);
-		M_MEDIUM;
-		glVertex2f(x1+1,y1+2);
-		M_WHITE;
-		glVertex2f(x1+1,y2);
-		glEnd();
-	}
-	
-	/* right */
-		if(!(flag & UI_SELECT)) {
-		glShadeModel(GL_SMOOTH);
-		glBegin(GL_LINES);
-		M_MEDIUM;
-		glVertex2f(x2-1,y1+2);
-		M_WHITE;
-		glVertex2f(x2-1,y2);
-		glEnd();
-	}
-	
-	glShadeModel(GL_FLAT);
-	
-	/* top */
-	if(flag & UI_SELECT) {
-		if(flag & UI_ACTIVE) M_LGREY;
-		else M_GREY;
-	} else {
-		if(flag & UI_ACTIVE) M_WHITE;
-		else M_WHITE;
-	}
-
-	fdrawline(x1, (y2-1), x2, (y2-1));
-	
-	/* bottom */
-	if(flag & UI_SELECT) {
-		if(flag & UI_ACTIVE) M_MEDIUM;
-		else M_LGREY;
-	} else {
-		if(flag & UI_ACTIVE) M_LMEDIUM;
-		else M_MEDIUM;
-	}
-	fdrawline(x1, (y1+1), x2, (y1+1));
-	/* *** END INNER OUTLINE *** */
-	
-	/* *** OUTER OUTLINE *** */
-	if (mid) {
-		// we draw full outline, its not AA, and it works better button mouse-over hilite
-		MM_DARK;
-		
-		// left right
-		fdrawline(x1, y1, x1, y2);
-		fdrawline(x2, y1, x2, y2);
-	
-		// top down
-		fdrawline(x1, y2, x2, y2);
-		fdrawline(x1, y1, x2, y1); 
-	} else {
-		MM_DARK;
-		gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5);
-	}
-	/* END OUTER OUTLINE */
-}
-
-/* base flat button */
-static void flat_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid)
-{
-	/* 'mid' arg determines whether the button is in the middle of

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list