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

Andrea Weikert elubie at gmx.net
Tue Mar 3 14:15:41 CET 2009


Revision: 19181
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19181
Author:   elubie
Date:     2009-03-03 14:15:40 +0100 (Tue, 03 Mar 2009)

Log Message:
-----------
2.5 filebrowser
- WIP commit
- bookmarks toggling (region collapsing needs to be done still)
- switching between display types in header (long filenames needs to be done still)

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/ED_fileselect.h
    branches/blender2.5/blender/source/blender/editors/include/UI_resources.h
    branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c
    branches/blender2.5/blender/source/blender/editors/space_file/space_file.c

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_fileselect.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_fileselect.h	2009-03-03 10:24:06 UTC (rev 19180)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_fileselect.h	2009-03-03 13:15:40 UTC (rev 19181)
@@ -30,6 +30,10 @@
 
 struct SpaceFile;
 
+#define FILE_SHORTDISPLAY	1
+#define FILE_LONGDISPLAY	2
+#define FILE_IMGDISPLAY		3
+
 typedef struct FileSelectParams {
 	int type; /* the mode of the filebrowser, FILE_BLENDER, FILE_SPECIAL, FILE_MAIN or FILE_LOADLIB */
 	char title[24]; /* title, also used for the text of the execute button */

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_resources.h	2009-03-03 10:24:06 UTC (rev 19180)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_resources.h	2009-03-03 13:15:40 UTC (rev 19181)
@@ -606,7 +606,7 @@
 	ICON_LONGDISPLAY,
 	ICON_SHORTDISPLAY,
 	ICON_GHOST,
-	ICON_BLANK283,
+	ICON_IMGDISPLAY,
 	ICON_BLANK284,
 	ICON_BLANK285,
 	ICON_FOLDER_DEHLT,

Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c	2009-03-03 10:24:06 UTC (rev 19180)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c	2009-03-03 13:15:40 UTC (rev 19181)
@@ -262,7 +262,7 @@
 	int width=0, height=0;
 	int rows, columns;
 
-	if (params->display) {
+	if (params->display == FILE_IMGDISPLAY) {
 		sfile->prv_w = 96;
 		sfile->prv_h = 96;
 		sfile->tile_border_x = 4;
@@ -531,39 +531,41 @@
 	int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X;
 	int fontsize = U.fontsize;
 
-	sx = ar->v2d.cur.xmin + TILE_BORDER_X;
-	sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y;
-	for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
-		char *fname = fsmenu_get_entry(i);
+	if (params->flag & FILE_BOOKMARKS) {
+		sx = ar->v2d.cur.xmin + TILE_BORDER_X;
+		sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y;
+		for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
+			char *fname = fsmenu_get_entry(i);
 
-		if (fname) {
-			int sl;
-			BLI_strncpy(bookmark, fname, FILE_MAX);
-		
-			sl = strlen(bookmark)-1;
-			while (bookmark[sl] == '\\' || bookmark[sl] == '/') {
-				bookmark[sl] = '\0';
-				sl--;
-			}
-			if (params->active_bookmark == i ) {
-				glColor4ub(0, 0, 0, 100);
-				UI_ThemeColor(TH_HILITE);
-				uiSetRoundBox(15);	
-				uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 6);
-				// glRecti(sx, sy - linestep, sx + bmwidth, sy);
-				UI_ThemeColor(TH_TEXT_HI);
+			if (fname) {
+				int sl;
+				BLI_strncpy(bookmark, fname, FILE_MAX);
+			
+				sl = strlen(bookmark)-1;
+				while (bookmark[sl] == '\\' || bookmark[sl] == '/') {
+					bookmark[sl] = '\0';
+					sl--;
+				}
+				if (params->active_bookmark == i ) {
+					glColor4ub(0, 0, 0, 100);
+					UI_ThemeColor(TH_HILITE);
+					uiSetRoundBox(15);	
+					uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 6);
+					// glRecti(sx, sy - linestep, sx + bmwidth, sy);
+					UI_ThemeColor(TH_TEXT_HI);
+				} else {
+					UI_ThemeColor(TH_TEXT);
+				}
+
+				file_draw_string(sx, sy, bookmark, bmwidth, fontsize);
+				sy -= linestep;
 			} else {
-				UI_ThemeColor(TH_TEXT);
+				glColor4ub(0xB0,0xB0,0xB0, 0xFF);
+				sdrawline(sx,  sy-1-fontsize/2 ,  sx + bmwidth,  sy-1-fontsize/2); 
+				glColor4ub(0x30,0x30,0x30, 0xFF);
+				sdrawline(sx,  sy-fontsize/2 ,  sx + bmwidth,  sy - fontsize/2);
+				sy -= linestep;
 			}
-
-			file_draw_string(sx, sy, bookmark, bmwidth, fontsize);
-			sy -= linestep;
-		} else {
-			glColor4ub(0xB0,0xB0,0xB0, 0xFF);
-			sdrawline(sx,  sy-1-fontsize/2 ,  sx + bmwidth,  sy-1-fontsize/2); 
-			glColor4ub(0x30,0x30,0x30, 0xFF);
-			sdrawline(sx,  sy-fontsize/2 ,  sx + bmwidth,  sy - fontsize/2);
-			sy -= linestep;
 		}
 	}
 }

Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_header.c	2009-03-03 10:24:06 UTC (rev 19180)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_header.c	2009-03-03 13:15:40 UTC (rev 19181)
@@ -141,6 +141,7 @@
 	}
 	
 	/* SORT TYPE */
+	uiBlockSetEmboss(block, UI_EMBOSSX);
 	xco+=XIC;
 	uiBlockBeginAlign(block);
 	uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA,	xco+=XIC,0,XIC,YIC, &params->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
@@ -151,9 +152,18 @@
 	xco+=XIC+10;
 
 	if (sfile->params->type != FILE_MAIN) {
-		uiDefIconButBitS(block, TOG, 1, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, &params->display, 0, 0, 0, 0, "Toggles Bookmarks on/off");
+		uiDefIconButBitS(block, TOG, FILE_BOOKMARKS, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, &params->flag, 0, 0, 0, 0, "Toggles Bookmarks on/off");
 		xco+=XIC+10;
 	} 
+
+	if (sfile->params->type != FILE_MAIN) {
+		uiBlockBeginAlign(block);
+		uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY,	xco+=XIC,0,XIC,YIC, &params->display, 1.0, 1.0, 0, 0, "Displays short file description");
+		uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY,	xco+=XIC,0,XIC,YIC, &params->display, 1.0, 2.0, 0, 0, "Displays long file description");
+		uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMAGE_COL /* ICON_IMGDISPLAY */,	xco+=XIC,0,XIC,YIC, &params->display, 1.0, 3.0, 0, 0, "Displays files as thumbnails");
+		uiBlockEndAlign(block);
+		xco+=XIC+10;
+	} 
 	xcotitle= xco;
 	xco+= UI_GetStringWidth(G.font, params->title, 0);
 

Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c	2009-03-03 10:24:06 UTC (rev 19180)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c	2009-03-03 13:15:40 UTC (rev 19181)
@@ -417,7 +417,7 @@
 	numfiles = filelist_numfiles(sfile->files);
 	params = ED_fileselect_get_params(sfile);
 	
-	if (params->display) {
+	if (params->display == FILE_IMGDISPLAY) {
 		actfile = find_file_mouse_hor(sfile, ar, mx , my);
 	} else {
 		actfile = find_file_mouse_vert(sfile, ar, mx, my);

Modified: branches/blender2.5/blender/source/blender/editors/space_file/space_file.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/space_file.c	2009-03-03 10:24:06 UTC (rev 19180)
+++ branches/blender2.5/blender/source/blender/editors/space_file/space_file.c	2009-03-03 13:15:40 UTC (rev 19181)
@@ -209,7 +209,7 @@
 	glClear(GL_COLOR_BUFFER_BIT);
 	
 	/* Allow dynamically sliders to be set, saves notifiers etc. */
-	if (sfile->params && sfile->params->display)
+	if (sfile->params && (sfile->params->display == FILE_IMGDISPLAY) )
 		v2d->scroll = V2D_SCROLL_RIGHT;
 	else
 		v2d->scroll = V2D_SCROLL_BOTTOM;
@@ -228,7 +228,7 @@
 		file_hilight_set(sfile, ar, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin);
 	}
 	
-	if (params->display) {
+	if (params->display == FILE_IMGDISPLAY) {
 		file_draw_previews(C, ar);
 	} else {
 		file_draw_list(C, ar);




More information about the Bf-blender-cvs mailing list