diff options
author | Ton Roosendaal <ton@blender.org> | 2009-02-10 20:53:10 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-02-10 20:53:10 +0300 |
commit | 149613622434f90f0deebe02dce04d44c95e2dda (patch) | |
tree | 55076923d79b5165ab71315ca2a40235454ad5e7 /source/blender/editors/space_file | |
parent | ca1b1e07d7684486f373ec81ddaf4e989c9ddc2f (diff) |
2.5
File Window:
- Added PKEY parent directory
- Made "P" button work
- Removed confused theme colors for text, it caused
selected text to print greyish.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 31 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 2 |
4 files changed, 40 insertions, 22 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index d3f30d47bcf..2c839adc451 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -85,6 +85,7 @@ enum { B_REDR = 0, B_FS_LOAD, B_FS_CANCEL, + B_FS_PARENT, } eFile_ButEvents; static void do_file_buttons(bContext *C, void *arg, int event) @@ -96,6 +97,9 @@ static void do_file_buttons(bContext *C, void *arg, int event) case B_FS_CANCEL: file_cancel_exec(C, NULL); /* file_ops.c */ break; + case B_FS_PARENT: + file_parent_exec(C, NULL); /* file_ops.c */ + break; } } @@ -168,7 +172,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) MEM_freeN(menu); - uiDefBut(block, BUT, 0 /* XXX B_FS_PARDIR */, "P", xmin, filebuty2, parentbut_width, 21, 0, 0, 0, 0, 0, "Move to the parent directory (PKEY)"); + uiDefBut(block, BUT, B_FS_PARENT, "P", xmin, filebuty2, parentbut_width, 21, 0, 0, 0, 0, 0, "Move to the parent directory (PKEY)"); uiEndBlock(C, block); uiDrawBlock(C, block); } @@ -502,27 +506,10 @@ void file_draw_list(const bContext *C, ARegion *ar) glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } else { - if (S_ISDIR(file->type)) { - glColor4f(1.0f, 1.0f, 0.9f, 1.0f); - } - else if (file->flags & IMAGEFILE) { - UI_ThemeColor(TH_SEQ_IMAGE); - } - else if (file->flags & MOVIEFILE) { - UI_ThemeColor(TH_SEQ_MOVIE); - } - else if (file->flags & BLENDERFILE) { - UI_ThemeColor(TH_SEQ_SCENE); - } - else { - if (params->active_file == i) { - UI_ThemeColor(TH_GRID); /* grid used for active text */ - } else if (file->flags & ACTIVE) { - UI_ThemeColor(TH_TEXT_HI); - } else { - UI_ThemeColor(TH_TEXT); - } - } + if (S_ISDIR(file->type)) + UI_ThemeColor4(TH_TEXT_HI); + else + UI_ThemeColor4(TH_TEXT); } sw = UI_GetStringWidth(G.font, file->size, 0); diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 4f9e6681e6d..d4cb80c1b39 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -57,9 +57,11 @@ void ED_FILE_OT_select_bookmark(struct wmOperatorType *ot); void ED_FILE_OT_loadimages(struct wmOperatorType *ot); void ED_FILE_OT_load(struct wmOperatorType *ot); void ED_FILE_OT_cancel(struct wmOperatorType *ot); +void ED_FILE_OT_parent(struct wmOperatorType *ot); int file_load_exec(bContext *C, struct wmOperator *unused); int file_cancel_exec(bContext *C, struct wmOperator *unused); +int file_parent_exec(bContext *C, struct wmOperator *unused); int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my); #endif /* ED_FILE_INTERN_H */ diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 8b8fcbe57fa..2a95a1e15a1 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -514,5 +514,32 @@ void ED_FILE_OT_load(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } +int file_parent_exec(bContext *C, wmOperator *unused) +{ + SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); + + if(sfile->params) { + BLI_parent_dir(sfile->params->dir); + 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 ED_FILE_OT_parent(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Parent File"; + ot->idname= "ED_FILE_OT_parent"; + + /* api callbacks */ + ot->exec= file_parent_exec; + ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ +} + diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index e32527ee420..fe681e246ce 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -259,6 +259,7 @@ void file_operatortypes(void) WM_operatortype_append(ED_FILE_OT_highlight); WM_operatortype_append(ED_FILE_OT_load); WM_operatortype_append(ED_FILE_OT_cancel); + WM_operatortype_append(ED_FILE_OT_parent); } /* NOTE: do not add .blend file reading on this level */ @@ -269,6 +270,7 @@ void file_keymap(struct wmWindowManager *wm) WM_keymap_add_item(keymap, "ED_FILE_OT_select_all", AKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ED_FILE_OT_border_select", BKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ED_FILE_OT_highlight", MOUSEMOVE, KM_ANY, 0, 0); + WM_keymap_add_item(keymap, "ED_FILE_OT_parent", PKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ED_FILE_OT_loadimages", TIMER1, KM_ANY, KM_ANY, 0); |