diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-25 01:27:10 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-25 01:27:10 +0400 |
commit | 7a357cba3994bee7d05c7a8bf5736eb94067d564 (patch) | |
tree | 942d61fdd1138867710ed41604c4d2947565f7b1 /source/blender/editors/space_file/file_draw.c | |
parent | 169fdf9e9757a8c31d950f5902d7c4cfd1f96a88 (diff) |
2.5: File Selector: display operator properties in the side region,
check Save Image or Export PLY operator for example.
Also these code changes:
* Added some RNA collection iterator macros to simplify code.
* Fix bpy.props.BoolProperty not working correct.
* Merge uiDefAutoButsRNA/uiDefAutoButsRNA_single into one.
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 71 |
1 files changed, 61 insertions, 10 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 6ed8f87d987..bb47d3458fe 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -550,7 +550,24 @@ void file_draw_list(const bContext *C, ARegion *ar) } } -static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, const char* category_name, short *starty) +static void file_draw_fsmenu_category_name(ARegion *ar, const char *category_name, short *starty) +{ + short sx, sy; + int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X - ICON_DEFAULT_WIDTH - 4; + int fontsize = file_font_pointsize(); + + sx = ar->v2d.cur.xmin + TILE_BORDER_X; + sy = *starty; + + UI_ThemeColor(TH_TEXT_HI); + file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END); + + sy -= fontsize*2.0f; + + *starty= sy; +} + +static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, short *starty) { struct FSMenu* fsmenu = fsmenu_get(); char bookmark[FILE_MAX]; @@ -565,11 +582,6 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate sx = ar->v2d.cur.xmin + TILE_BORDER_X; sy = *starty; - UI_ThemeColor(TH_TEXT_HI); - file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END); - - sy -= fontsize*2.0f; - switch(category) { case FS_CATEGORY_SYSTEM: cat_icon = ICON_DISK_DRIVE; break; @@ -616,15 +628,54 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate *starty = sy; } +void file_draw_fsmenu_operator(const bContext *C, ARegion *ar, wmOperator *op, short *starty) +{ + uiStyle *style= U.uistyles.first; + uiBlock *block; + uiLayout *layout; + int sy; + + sy= *starty; + + block= uiBeginBlock(C, ar, "file_options", UI_EMBOSS); + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, TILE_BORDER_X, sy, ar->winx-2*TILE_BORDER_X, 20, style); + + RNA_STRUCT_BEGIN(op->ptr, prop) { + if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) + continue; + if(strcmp(RNA_property_identifier(prop), "filename") == 0) + continue; + + uiItemFullR(layout, NULL, 0, op->ptr, prop, -1, 0, 0, 0, 0); + } + RNA_STRUCT_END; + + uiBlockLayoutResolve(C, block, NULL, &sy); + uiEndBlock(C, block); + uiDrawBlock(C, block); + + *starty= sy; +} + void file_draw_fsmenu(const bContext *C, ARegion *ar) { + SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); int linestep = file_font_pointsize()*2.0f; short sy= ar->v2d.cur.ymax-2*TILE_BORDER_Y; - file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, "SYSTEM", &sy); + file_draw_fsmenu_category_name(ar, "SYSTEM", &sy); + file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, &sy); sy -= linestep; - file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, "BOOKMARKS", &sy); + file_draw_fsmenu_category_name(ar, "BOOKMARKS", &sy); + file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, &sy); sy -= linestep; - file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, "RECENT", &sy); - + file_draw_fsmenu_category_name(ar, "RECENT", &sy); + file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, &sy); + + if(sfile->op) { + sy -= linestep; + file_draw_fsmenu_category_name(ar, "OPTIONS", &sy); + file_draw_fsmenu_operator(C, ar, sfile->op, &sy); + } } + |