diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-25 08:33:21 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-25 08:33:21 +0400 |
commit | a1c5c501a6b4b8bfdee6f60869c122fb6f321726 (patch) | |
tree | b2bd0a250560638b3f08627494eeb002e067a8c9 /source/blender/editors/space_file | |
parent | e5f6a41b1b7125a4c3bc7ef2554c04b768ac765c (diff) | |
parent | 7a357cba3994bee7d05c7a8bf5736eb94067d564 (diff) |
At last... this merge should finally do the trick!
21073 to 21145
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/Makefile | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 71 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 2 |
4 files changed, 64 insertions, 13 deletions
diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile index 8f48217473c..2f4180448e5 100644 --- a/source/blender/editors/space_file/Makefile +++ b/source/blender/editors/space_file/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # 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); + } } + diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0c6cadc05c1..ab02147d020 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -190,7 +190,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op) rect.xmax= RNA_int_get(op->ptr, "xmax"); rect.ymax= RNA_int_get(op->ptr, "ymax"); - BLI_isect_rctf(&(ar->v2d.mask), &rect, &rect); + BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect); file_select(sfile, ar, &rect, val ); WM_event_add_notifier(C, NC_WINDOW, NULL); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 4c2def72de0..9c0bcc6b991 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -162,7 +162,7 @@ float file_string_width(const char* str) { uiStyle *style= U.uistyles.first; uiStyleFontSet(&style->widget); - return BLF_width(str); + return BLF_width((char *)str); } float file_font_pointsize() |