File Window:

- Added PKEY parent directory
- Made "P" button work
- Removed confused theme colors for text, it caused
  selected text to print greyish.
This commit is contained in:
2009-02-10 17:53:10 +00:00
parent ca1b1e07d7
commit 1496136224
4 changed files with 40 additions and 22 deletions

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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 */
}

View File

@@ -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);