[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19267] branches/blender2.5/blender/source /blender/editors/space_file: 2.5 filebrowser
Andrea Weikert
elubie at gmx.net
Thu Mar 12 07:40:03 CET 2009
Revision: 19267
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19267
Author: elubie
Date: 2009-03-12 07:40:03 +0100 (Thu, 12 Mar 2009)
Log Message:
-----------
2.5 filebrowser
- add refresh filelist operator and button in header
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h
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/space_file/file_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_header.c 2009-03-12 05:56:02 UTC (rev 19266)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_header.c 2009-03-12 06:40:03 UTC (rev 19267)
@@ -143,11 +143,14 @@
uiBlockSetEmboss(block, UI_EMBOSSX);
xco += 5;
+
+ uiBlockBeginAlign(block);
+ uiDefIconButO(block, BUT, "FILE_OT_parent", WM_OP_INVOKE_DEFAULT, ICON_FILE_PARENT, xco+=XIC, yco, 20, 20, "Navigate to Parent Folder");
+ uiDefIconButO(block, BUT, "FILE_OT_refresh", WM_OP_INVOKE_DEFAULT, ICON_FILE_REFRESH, xco+=XIC, yco, 20, 20, "Refresh List of Files");
+ uiBlockEndAlign(block);
+
+ xco += 5;
- uiDefIconButO(block, BUT, "FILE_OT_parent", WM_OP_INVOKE_DEFAULT, ICON_FILE_PARENT, xco, yco, 20, 20, "Navigate to Parent Folder");
-
- xco+=XIC;
-
if (sfile->params->type != FILE_MAIN) {
uiBlockBeginAlign(block);
uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC, yco, XIC,YIC, ¶ms->display, 1.0, FILE_SHORTDISPLAY, 0, 0, "Displays short file description");
Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h 2009-03-12 05:56:02 UTC (rev 19266)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h 2009-03-12 06:40:03 UTC (rev 19267)
@@ -60,6 +60,7 @@
void FILE_OT_exec(struct wmOperatorType *ot);
void FILE_OT_cancel(struct wmOperatorType *ot);
void FILE_OT_parent(struct wmOperatorType *ot);
+void FILE_OT_refresh(struct wmOperatorType *ot);
void FILE_OT_bookmark_toggle(struct wmOperatorType *ot);
int file_exec(bContext *C, struct wmOperator *unused);
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-12 05:56:02 UTC (rev 19266)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c 2009-03-12 06:40:03 UTC (rev 19267)
@@ -569,6 +569,34 @@
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
}
+
+int file_refresh_exec(bContext *C, wmOperator *unused)
+{
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+
+ if(sfile->params) {
+ filelist_setdir(sfile->files, sfile->params->dir);
+ filelist_free(sfile->files);
+ sfile->params->active_file = -1;
+ }
+ ED_area_tag_redraw(CTX_wm_area(C));
+
+ return OPERATOR_FINISHED;
+
+}
+
+
+void FILE_OT_refresh(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Refresh Filelist";
+ ot->idname= "FILE_OT_refresh";
+
+ /* api callbacks */
+ ot->exec= file_refresh_exec;
+ ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+}
+
struct ARegion *file_buttons_region(struct ScrArea *sa)
{
ARegion *ar;
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-12 05:56:02 UTC (rev 19266)
+++ branches/blender2.5/blender/source/blender/editors/space_file/space_file.c 2009-03-12 06:40:03 UTC (rev 19267)
@@ -270,6 +270,7 @@
WM_operatortype_append(FILE_OT_exec);
WM_operatortype_append(FILE_OT_cancel);
WM_operatortype_append(FILE_OT_parent);
+ WM_operatortype_append(FILE_OT_refresh);
WM_operatortype_append(FILE_OT_bookmark_toggle);
}
More information about the Bf-blender-cvs
mailing list