diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-03-03 16:15:40 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-03-03 16:15:40 +0300 |
commit | 0f040e2f267dcec976bb088d653a56d4c6ed28ad (patch) | |
tree | 2f29114d5eb88077ba2ced32ecf685e1d308277f /source/blender/editors/space_file | |
parent | ead30e5bc122ba327165c752a694a0ee1abf9fbf (diff) |
2.5 filebrowser
- WIP commit
- bookmarks toggling (region collapsing needs to be done still)
- switching between display types in header (long filenames needs to be done still)
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 64 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_header.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 4 |
4 files changed, 47 insertions, 35 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 29faf660575..72da15ccd9d 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -262,7 +262,7 @@ void file_calc_previews(const bContext *C, ARegion *ar) int width=0, height=0; int rows, columns; - if (params->display) { + if (params->display == FILE_IMGDISPLAY) { sfile->prv_w = 96; sfile->prv_h = 96; sfile->tile_border_x = 4; @@ -531,39 +531,41 @@ void file_draw_fsmenu(const bContext *C, ARegion *ar) int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X; int fontsize = U.fontsize; - sx = ar->v2d.cur.xmin + TILE_BORDER_X; - sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y; - for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) { - char *fname = fsmenu_get_entry(i); + if (params->flag & FILE_BOOKMARKS) { + sx = ar->v2d.cur.xmin + TILE_BORDER_X; + sy = ar->v2d.cur.ymax-2*TILE_BORDER_Y; + for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) { + char *fname = fsmenu_get_entry(i); - if (fname) { - int sl; - BLI_strncpy(bookmark, fname, FILE_MAX); - - sl = strlen(bookmark)-1; - while (bookmark[sl] == '\\' || bookmark[sl] == '/') { - bookmark[sl] = '\0'; - sl--; - } - if (params->active_bookmark == i ) { - glColor4ub(0, 0, 0, 100); - UI_ThemeColor(TH_HILITE); - uiSetRoundBox(15); - uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 6); - // glRecti(sx, sy - linestep, sx + bmwidth, sy); - UI_ThemeColor(TH_TEXT_HI); + if (fname) { + int sl; + BLI_strncpy(bookmark, fname, FILE_MAX); + + sl = strlen(bookmark)-1; + while (bookmark[sl] == '\\' || bookmark[sl] == '/') { + bookmark[sl] = '\0'; + sl--; + } + if (params->active_bookmark == i ) { + glColor4ub(0, 0, 0, 100); + UI_ThemeColor(TH_HILITE); + uiSetRoundBox(15); + uiRoundBox(sx, sy - linestep, sx + bmwidth, sy, 6); + // glRecti(sx, sy - linestep, sx + bmwidth, sy); + UI_ThemeColor(TH_TEXT_HI); + } else { + UI_ThemeColor(TH_TEXT); + } + + file_draw_string(sx, sy, bookmark, bmwidth, fontsize); + sy -= linestep; } else { - UI_ThemeColor(TH_TEXT); + glColor4ub(0xB0,0xB0,0xB0, 0xFF); + sdrawline(sx, sy-1-fontsize/2 , sx + bmwidth, sy-1-fontsize/2); + glColor4ub(0x30,0x30,0x30, 0xFF); + sdrawline(sx, sy-fontsize/2 , sx + bmwidth, sy - fontsize/2); + sy -= linestep; } - - file_draw_string(sx, sy, bookmark, bmwidth, fontsize); - sy -= linestep; - } else { - glColor4ub(0xB0,0xB0,0xB0, 0xFF); - sdrawline(sx, sy-1-fontsize/2 , sx + bmwidth, sy-1-fontsize/2); - glColor4ub(0x30,0x30,0x30, 0xFF); - sdrawline(sx, sy-fontsize/2 , sx + bmwidth, sy - fontsize/2); - sy -= linestep; } } } diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c index ef86eb5b7f3..be734ec971d 100644 --- a/source/blender/editors/space_file/file_header.c +++ b/source/blender/editors/space_file/file_header.c @@ -141,6 +141,7 @@ void file_header_buttons(const bContext *C, ARegion *ar) } /* SORT TYPE */ + uiBlockSetEmboss(block, UI_EMBOSSX); xco+=XIC; uiBlockBeginAlign(block); uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA, xco+=XIC,0,XIC,YIC, ¶ms->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically"); @@ -151,7 +152,16 @@ void file_header_buttons(const bContext *C, ARegion *ar) xco+=XIC+10; if (sfile->params->type != FILE_MAIN) { - uiDefIconButBitS(block, TOG, 1, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, ¶ms->display, 0, 0, 0, 0, "Toggles Bookmarks on/off"); + uiDefIconButBitS(block, TOG, FILE_BOOKMARKS, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, ¶ms->flag, 0, 0, 0, 0, "Toggles Bookmarks on/off"); + xco+=XIC+10; + } + + if (sfile->params->type != FILE_MAIN) { + uiBlockBeginAlign(block); + uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC,0,XIC,YIC, ¶ms->display, 1.0, 1.0, 0, 0, "Displays short file description"); + uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY, xco+=XIC,0,XIC,YIC, ¶ms->display, 1.0, 2.0, 0, 0, "Displays long file description"); + uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMAGE_COL /* ICON_IMGDISPLAY */, xco+=XIC,0,XIC,YIC, ¶ms->display, 1.0, 3.0, 0, 0, "Displays files as thumbnails"); + uiBlockEndAlign(block); xco+=XIC+10; } xcotitle= xco; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 1cedc7b0282..ae989194527 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -417,7 +417,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) numfiles = filelist_numfiles(sfile->files); params = ED_fileselect_get_params(sfile); - if (params->display) { + if (params->display == FILE_IMGDISPLAY) { actfile = find_file_mouse_hor(sfile, ar, mx , my); } else { actfile = find_file_mouse_vert(sfile, ar, mx, my); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index dfa353cc6e4..70d7ad9cde5 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -209,7 +209,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* Allow dynamically sliders to be set, saves notifiers etc. */ - if (sfile->params && sfile->params->display) + if (sfile->params && (sfile->params->display == FILE_IMGDISPLAY) ) v2d->scroll = V2D_SCROLL_RIGHT; else v2d->scroll = V2D_SCROLL_BOTTOM; @@ -228,7 +228,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) file_hilight_set(sfile, ar, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin); } - if (params->display) { + if (params->display == FILE_IMGDISPLAY) { file_draw_previews(C, ar); } else { file_draw_list(C, ar); |