Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_file/file_panels.c')
-rw-r--r--source/blender/editors/space_file/file_panels.c63
1 files changed, 27 insertions, 36 deletions
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 33d740e18a6..f9c467a039d 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -30,9 +30,11 @@
#include "BKE_screen.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h"
@@ -49,7 +51,7 @@
#include <string.h>
-static void file_panel_cb(bContext *C, void *arg_entry, void *arg_unused)
+static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v))
{
PointerRNA ptr;
char *entry= (char*)arg_entry;
@@ -67,7 +69,6 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
uiBut *but;
uiLayout *box, *col;
struct FSMenu* fsmenu = fsmenu_get();
- char *curdir= (sfile->params)? sfile->params->dir: "";
int i, i_iter, nentries = fsmenu_get_nentries(fsmenu, category);
/* reset each time */
@@ -94,8 +95,11 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
entry = fsmenu_get_entry(fsmenu, category, i);
/* set this list item as active if we have a match */
- if(strcmp(curdir, entry) == 0)
- *nr= i;
+ if(sfile->params) {
+ if(strcmp(sfile->params->dir, entry) == 0) {
+ *nr= i;
+ }
+ }
/* create nice bookmark name, shows last directory in the full path currently */
BLI_strncpy(temp, entry, FILE_MAX);
@@ -136,7 +140,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
if(sfile) {
row= uiLayoutRow(pa->layout, 0);
uiItemO(row, "Add", ICON_ZOOMIN, "file.bookmark_add");
- uiItemL(row, NULL, 0);
+ uiItemL(row, NULL, ICON_NULL);
file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0);
}
@@ -146,12 +150,15 @@ static void file_panel_recent(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
- if(sfile)
- file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
+ if(sfile) {
+ if ( !(U.uiflag & USER_HIDE_RECENT) ) {
+ file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
+ }
+ }
}
-static int file_panel_operator_poll(const bContext *C, PanelType *pt)
+static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceFile *sfile= CTX_wm_space_file(C);
return (sfile && sfile->op);
@@ -165,41 +172,25 @@ static void file_panel_operator_header(const bContext *C, Panel *pa)
BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
}
+static int file_panel_check_prop(PropertyRNA *prop)
+{
+ const char *prop_id= RNA_property_identifier(prop);
+ return !( strcmp(prop_id, "filepath") == 0 ||
+ strcmp(prop_id, "directory") == 0 ||
+ strcmp(prop_id, "filename") == 0
+ );
+}
+
static void file_panel_operator(const bContext *C, Panel *pa)
{
SpaceFile *sfile= CTX_wm_space_file(C);
wmOperator *op= sfile->op;
- int empty= 1, flag;
+ // int empty= 1, flag;
uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
-
- if(op->type->ui) {
- op->layout= pa->layout;
- op->type->ui((bContext*)C, op);
- op->layout= NULL;
- }
- else {
- RNA_STRUCT_BEGIN(op->ptr, prop) {
- flag= RNA_property_flag(prop);
-
- if(flag & PROP_HIDDEN)
- continue;
- if(strcmp(RNA_property_identifier(prop), "filepath") == 0)
- continue;
- if(strcmp(RNA_property_identifier(prop), "directory") == 0)
- continue;
- if(strcmp(RNA_property_identifier(prop), "filename") == 0)
- continue;
-
- uiItemFullR(pa->layout, op->ptr, prop, -1, 0, 0, NULL, 0);
- empty= 0;
- }
- RNA_STRUCT_END;
- if(empty)
- uiItemL(pa->layout, "No properties.", 0);
- }
-
+ uiLayoutOperatorButs(C, pa->layout, op, file_panel_check_prop, '\0', UI_LAYOUT_OP_SHOW_EMPTY);
+
uiBlockSetFunc(uiLayoutGetBlock(pa->layout), NULL, NULL, NULL);
}