2.5 MSVC projectfiles update
[blender.git] / source / blender / editors / space_file / file_draw.c
1 /**
2  * $Id:
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include <string.h>
30
31 #include "BLI_blenlib.h"
32 #include "BLI_dynstr.h"
33 #include "BLI_storage_types.h"
34 #ifdef WIN32
35 #include "BLI_winstuff.h"
36 #endif
37
38 #include "BIF_gl.h"
39 #include "BIF_glutil.h"
40
41 #include "BKE_colortools.h"
42 #include "BKE_context.h"
43 #include "BKE_screen.h"
44 #include "BKE_global.h"
45 #include "BKE_utildefines.h"
46
47 #include "BLF_api.h"
48
49 #include "DNA_space_types.h"
50 #include "DNA_scene_types.h"
51 #include "DNA_screen_types.h"
52 #include "DNA_userdef_types.h"
53 #include "DNA_windowmanager_types.h"
54
55 #include "ED_datafiles.h"
56
57 #include "IMB_imbuf_types.h"
58 #include "IMB_imbuf.h"
59  
60 #include "MEM_guardedalloc.h"
61
62 #include "PIL_time.h"
63
64 #include "RNA_access.h"
65
66 #include "ED_fileselect.h"
67 #include "ED_screen.h"
68
69 #include "UI_interface.h"
70 #include "UI_interface_icons.h"
71 #include "UI_resources.h"
72 #include "UI_view2d.h"
73
74 #include "WM_api.h"
75 #include "WM_types.h"
76
77 #include "fsmenu.h"
78 #include "filelist.h"
79
80 #include "file_intern.h"        // own include
81
82 /* ui geometry */
83 #define IMASEL_BUTTONS_HEIGHT 40
84 #define TILE_BORDER_X 8
85 #define TILE_BORDER_Y 8
86
87 /* button events */
88 enum {
89         B_REDR  = 0,
90         B_FS_EXEC,
91         B_FS_CANCEL,
92         B_FS_PARENT,
93 } eFile_ButEvents;
94
95
96 static void do_file_buttons(bContext *C, void *arg, int event)
97 {
98         switch(event) {
99                 case B_FS_EXEC:
100                         file_exec(C, NULL);     /* file_ops.c */
101                         break;
102                 case B_FS_CANCEL:
103                         file_cancel_exec(C, NULL); /* file_ops.c */
104                         break;
105                 case B_FS_PARENT:
106                         file_parent_exec(C, NULL); /* file_ops.c */
107                         break;
108         }
109 }
110
111 /* note; this function uses pixelspace (0, 0, winx, winy), not view2d */
112 void file_draw_buttons(const bContext *C, ARegion *ar)
113 {
114         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
115         FileSelectParams* params = ED_fileselect_get_params(sfile);
116         uiBlock *block;
117         int loadbutton;
118         char name[20];
119         float slen;
120         int filebuty1, filebuty2;
121
122         float xmin = 8;
123         float xmax = ar->winx - 10;
124
125         filebuty1= ar->winy - IMASEL_BUTTONS_HEIGHT - 12;
126         filebuty2= filebuty1 + IMASEL_BUTTONS_HEIGHT/2 + 4;
127
128         /* HEADER */
129         sprintf(name, "win %p", ar);
130         block = uiBeginBlock(C, ar, name, UI_EMBOSS);
131         uiBlockSetHandleFunc(block, do_file_buttons, NULL);
132
133         /* XXXX
134         uiSetButLock( filelist_gettype(simasel->files)==FILE_MAIN && simasel->returnfunc, NULL); 
135         */
136
137         /* space available for load/save buttons? */
138         slen = UI_GetStringWidth(sfile->params->title);
139         loadbutton= slen > 60 ? slen + 20 : MAX2(80, 20+UI_GetStringWidth(params->title));
140         if(ar->winx > loadbutton+20) {
141                 if(params->title[0]==0) {
142                         loadbutton= 0;
143                 }
144         }
145         else {
146                 loadbutton= 0;
147         }
148
149         uiDefBut(block, TEX, 0 /* XXX B_FS_FILENAME */,"",      xmin+2, filebuty1, xmax-xmin-loadbutton-4, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
150         uiDefBut(block, TEX, 0 /* XXX B_FS_DIRNAME */,"",       xmin+2, filebuty2, xmax-xmin-loadbutton-4, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
151         
152         if(loadbutton) {
153                 uiDefBut(block, BUT, B_FS_EXEC, params->title,  xmax-loadbutton, filebuty2, loadbutton, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
154                 uiDefBut(block, BUT, B_FS_CANCEL, "Cancel",             xmax-loadbutton, filebuty1, loadbutton, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
155         }
156
157         uiEndBlock(C, block);
158         uiDrawBlock(C, block);
159 }
160
161
162 static void draw_tile(short sx, short sy, short width, short height, int colorid, int shade)
163 {
164         /* TODO: BIF_ThemeColor seems to need this to show the color, not sure why? - elubie */
165         //glEnable(GL_BLEND);
166         //glColor4ub(0, 0, 0, 100);
167         //glDisable(GL_BLEND);
168         /* I think it was a missing glDisable() - ton */
169         
170         UI_ThemeColorShade(colorid, shade);
171         uiSetRoundBox(15);      
172         uiRoundBox(sx, sy - height, sx + width, sy, 6);
173 }
174
175 #define FILE_SHORTEN_END                                0
176 #define FILE_SHORTEN_FRONT                              1
177
178 static float shorten_string(char* string, float w, int flag)
179 {       
180         char temp[FILE_MAX];
181         short shortened = 0;
182         float sw = 0;
183         float pad = 0;
184
185         sw = file_string_width(string);
186         if (flag == FILE_SHORTEN_FRONT) {
187                 char *s = string;
188                 BLI_strncpy(temp, "...", 4);
189                 pad = file_string_width(temp);
190                 while (s && *s && (w > 0) && (sw+pad>w)) {
191                         s++;
192                         sw = file_string_width(s);
193                         shortened = 1;
194                 }
195                 if (shortened) {
196                         int slen = strlen(s);                   
197                         BLI_strncpy(temp+3, s, slen+1);
198                         temp[slen+4] = '\0';
199                         BLI_strncpy(string, temp, slen+4);
200                 }
201         } else {
202                 char *s = string;
203                 if (w>0) {
204                         while (sw>w) {
205                                 int slen = strlen(string);
206                                 string[slen-1] = '\0';
207                                 sw = file_string_width(s);
208                                 shortened = 1;
209                         }
210                 }
211                 if (shortened) {
212                         int slen = strlen(string);
213                         if (slen > 3) {
214                                 BLI_strncpy(string+slen-3, "...", 4);                           
215                         }
216                 }
217         }
218         
219         return sw;
220 }
221
222 static int get_file_icon(struct direntry *file)
223 {
224         if (file->type & S_IFDIR)
225                 return ICON_FILE_FOLDER;
226         else if (file->flags & BLENDERFILE)
227                 return ICON_FILE_BLEND;
228         else if (file->flags & IMAGEFILE)
229                 return ICON_FILE_IMAGE;
230         else if (file->flags & MOVIEFILE)
231                 return ICON_FILE_MOVIE;
232         else if (file->flags & PYSCRIPTFILE)
233                 return ICON_FILE_SCRIPT;
234         else if (file->flags & PYSCRIPTFILE)
235                 return ICON_FILE_SCRIPT;
236         else if (file->flags & SOUNDFILE) 
237                 return ICON_FILE_SOUND;
238         else if (file->flags & FTFONTFILE) 
239                 return ICON_FILE_FONT;
240         else
241                 return ICON_FILE_BLANK;
242 }
243
244 static void file_draw_icon(short sx, short sy, int icon, short width, short height)
245 {
246         float x,y;
247         int blend=0;
248         
249         x = (float)(sx);
250         y = (float)(sy-height);
251         
252         if (icon == ICON_FILE_BLANK) blend = -80;
253         
254         glEnable(GL_BLEND);
255         
256         UI_icon_draw_aspect_blended(x, y, icon, 1.f, blend);
257 }
258
259
260 static void file_draw_string(short sx, short sy, const char* string, float width, short height, int flag)
261 {
262         short soffs;
263         char fname[FILE_MAXFILE];
264         float sw;
265         float x,y;
266
267         BLI_strncpy(fname,string, FILE_MAXFILE);
268         sw = shorten_string(fname, width, flag );
269
270         soffs = (width - sw) / 2;
271         x = (float)(sx);
272         y = (float)(sy-height);
273
274         BLF_position(x, y, 0);
275         BLF_draw(fname);
276 }
277
278 void file_calc_previews(const bContext *C, ARegion *ar)
279 {
280         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
281         View2D *v2d= &ar->v2d;
282         
283         ED_fileselect_init_layout(sfile, ar);
284         UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height);
285 }
286
287 void file_draw_previews(const bContext *C, ARegion *ar)
288 {
289         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
290         FileSelectParams* params= ED_fileselect_get_params(sfile);
291         FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
292         View2D *v2d= &ar->v2d;
293         struct FileList* files = sfile->files;
294         int numfiles;
295         struct direntry *file;
296         short sx, sy;
297         ImBuf* imb=0;
298         int i;
299         int colorid = 0;
300         int offset;
301         int is_icon;
302
303         if (!files) return;
304
305         filelist_imgsize(files,sfile->layout->prv_w,sfile->layout->prv_h);
306         numfiles = filelist_numfiles(files);
307
308         sx = v2d->cur.xmin + layout->tile_border_x;
309         sy = v2d->cur.ymax - layout->tile_border_y;
310         
311         offset = ED_fileselect_layout_offset(layout, 0, 0);
312         if (offset<0) offset=0;
313         for (i=offset; (i < numfiles) && (i < (offset+(layout->rows+2)*layout->columns)); ++i)
314         {
315                 ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
316                 sx += v2d->tot.xmin+2;
317                 sy = v2d->tot.ymax - sy;
318                 file = filelist_file(files, i); 
319
320                 if (file->flags & ACTIVE) {
321                         colorid = TH_HILITE;
322                         draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
323                 } else if (params->active_file == i) {
324                         colorid = TH_ACTIVE;
325                         draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
326                 }
327                 
328                 if ( (file->flags & IMAGEFILE) /* || (file->flags & MOVIEFILE) */)
329                 {                       
330                         filelist_loadimage(files, i);
331                 }
332                 is_icon = 0;
333                 imb = filelist_getimage(files, i);
334                 if (!imb) {
335                         imb = filelist_geticon(files,i);
336                         is_icon = 1;
337                 }
338
339                 if (imb) {
340                         float fx, fy;
341                         float dx, dy;
342                         short xco, yco;
343                         float scaledx, scaledy;
344                         float scale;
345                         short ex, ey;
346
347                         if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
348                                 if (imb->x > imb->y) {
349                                         scaledx = (float)layout->prv_w;
350                                         scaledy =  ( (float)imb->y/(float)imb->x )*layout->prv_w;
351                                         scale = scaledx/imb->x;
352                                 }
353                                 else {
354                                         scaledy = (float)layout->prv_h;
355                                         scaledx =  ( (float)imb->x/(float)imb->y )*layout->prv_h;
356                                         scale = scaledy/imb->y;
357                                 }
358                         } else {
359                                 scaledx = (float)imb->x;
360                                 scaledy = (float)imb->y;
361                                 scale = 1.0;
362                         }
363                         ex = (short)scaledx;
364                         ey = (short)scaledy;
365                         fx = ((float)layout->prv_w - (float)ex)/2.0f;
366                         fy = ((float)layout->prv_h - (float)ey)/2.0f;
367                         dx = (fx + 0.5f + sfile->layout->prv_border_x);
368                         dy = (fy + 0.5f - sfile->layout->prv_border_y);
369                         xco = (float)sx + dx;
370                         yco = (float)sy - sfile->layout->prv_h + dy;
371
372                         glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);
373                         
374                         /* shadow */
375                         if (!is_icon && (file->flags & IMAGEFILE))
376                                 uiDrawBoxShadow(220, xco, yco, xco + ex, yco + ey);
377                         
378                         glEnable(GL_BLEND);
379                         
380                         /* the image */
381                         glColor4f(1.0, 1.0, 1.0, 1.0);
382                         glaDrawPixelsTexScaled(xco, yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale);
383                         
384                         /* border */
385                         if (!is_icon && (file->flags & IMAGEFILE)) {
386                                 glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
387                                 fdrawbox(xco, yco, xco + ex, yco + ey);
388                         }
389                         
390                         glDisable(GL_BLEND);
391                         imb = 0;
392                 }
393
394                 /* shadow */
395                 UI_ThemeColorShade(TH_BACK, -20);
396                 
397                 
398                 if (S_ISDIR(file->type)) {
399                         glColor4f(1.0f, 1.0f, 0.9f, 1.0f);
400                 }
401                 else if (file->flags & IMAGEFILE) {
402                         UI_ThemeColor(TH_SEQ_IMAGE);
403                 }
404                 else if (file->flags & MOVIEFILE) {
405                         UI_ThemeColor(TH_SEQ_MOVIE);
406                 }
407                 else if (file->flags & BLENDERFILE) {
408                         UI_ThemeColor(TH_SEQ_SCENE);
409                 }
410                 else {
411                         if (params->active_file == i) {
412                                 UI_ThemeColor(TH_GRID); /* grid used for active text */
413                         } else if (file->flags & ACTIVE) {
414                                 UI_ThemeColor(TH_TEXT_HI);                      
415                         } else {
416                                 UI_ThemeColor(TH_TEXT);
417                         }
418                 }
419
420                 file_draw_string(sx + layout->prv_border_x, sy+4, file->relname, layout->tile_w, layout->tile_h, FILE_SHORTEN_END);
421
422                 if (!sfile->loadimage_timer)
423                         sfile->loadimage_timer= WM_event_add_window_timer(CTX_wm_window(C), TIMER1, 1.0/30.0);  /* max 30 frames/sec. */
424
425         }
426
427         uiSetRoundBox(0);
428 }
429
430
431 void file_draw_list(const bContext *C, ARegion *ar)
432 {
433         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
434         FileSelectParams* params = ED_fileselect_get_params(sfile);
435         FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
436         View2D *v2d= &ar->v2d;
437         struct FileList* files = sfile->files;
438         struct direntry *file;
439         int numfiles;
440         int colorid = 0;
441         short sx, sy;
442         int offset;
443         short type;
444         int i;
445         float sw, spos;
446
447         numfiles = filelist_numfiles(files);
448         type = filelist_gettype(files); 
449
450         sx = ar->v2d.tot.xmin + layout->tile_border_x/2;
451         sy = ar->v2d.cur.ymax - layout->tile_border_y;
452
453         offset = ED_fileselect_layout_offset(layout, 0, 0);
454         if (offset<0) offset=0;
455
456         /* alternating flat shade background */
457         for (i=0; (i <= layout->rows); i+=2)
458         {
459                 sx = v2d->cur.xmin;
460                 sy = v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
461
462                 UI_ThemeColorShade(TH_BACK, -7);
463                 glRectf(v2d->cur.xmin, sy, v2d->cur.xmax, sy+layout->tile_h+2*layout->tile_border_y);
464                 
465         }
466         
467         /* vertical column dividers */
468         sx = v2d->tot.xmin;
469         while (sx < ar->v2d.cur.xmax) {
470                 sx += (sfile->layout->tile_w+2*sfile->layout->tile_border_x);
471                 
472                 UI_ThemeColorShade(TH_BACK, 30);
473                 sdrawline(sx+1,  ar->v2d.cur.ymax - layout->tile_border_y ,  sx+1,  ar->v2d.cur.ymin); 
474                 UI_ThemeColorShade(TH_BACK, -30);
475                 sdrawline(sx,  ar->v2d.cur.ymax - layout->tile_border_y ,  sx,  ar->v2d.cur.ymin); 
476         }
477
478         sx = ar->v2d.cur.xmin + layout->tile_border_x;
479         sy = ar->v2d.cur.ymax - layout->tile_border_y;
480
481         for (i=offset; (i < numfiles); ++i)
482         {
483                 ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
484                 sx += v2d->tot.xmin+2;
485                 sy = v2d->tot.ymax - sy;
486
487                 file = filelist_file(files, i); 
488
489                 if (params->active_file == i) {
490                         if (file->flags & ACTIVE) colorid= TH_HILITE;
491                         else colorid = TH_BACK;
492                         draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h+layout->tile_border_y, colorid,20);
493                 } else if (file->flags & ACTIVE) {
494                         colorid = TH_HILITE;
495                         draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h+layout->tile_border_y, colorid,0);
496                 } 
497
498                 spos = sx;
499                 file_draw_icon(spos, sy-3, get_file_icon(file), ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
500                 spos += ICON_DEFAULT_WIDTH + 4;
501                 
502                 UI_ThemeColor4(TH_TEXT);
503                 
504                 sw = file_string_width(file->relname);
505                 file_draw_string(spos, sy, file->relname, sw, layout->tile_h, FILE_SHORTEN_END);
506                 spos += layout->column_widths[COLUMN_NAME] + 12;
507                 if (params->display == FILE_SHOWSHORT) {
508                         if (!(file->type & S_IFDIR)) {
509                                 sw = file_string_width(file->size);
510                                 spos += layout->column_widths[COLUMN_SIZE] + 12 - sw;
511                                 file_draw_string(spos, sy, file->size, sw+1, layout->tile_h, FILE_SHORTEN_END); 
512                         }
513                 } else {
514 #if 0 // XXX TODO: add this for non-windows systems
515                         /* rwx rwx rwx */
516                         spos += 20;
517                         sw = UI_GetStringWidth(file->mode1);
518                         file_draw_string(spos, sy, file->mode1, sw, layout->tile_h); 
519                         
520                         spos += 30;
521                         sw = UI_GetStringWidth(file->mode2);
522                         file_draw_string(spos, sy, file->mode2, sw, layout->tile_h);
523
524                         spos += 30;
525                         sw = UI_GetStringWidth(file->mode3);
526                         file_draw_string(spos, sy, file->mode3, sw, layout->tile_h);
527                         
528                         spos += 30;
529                         sw = UI_GetStringWidth(file->owner);
530                         file_draw_string(spos, sy, file->owner, sw, layout->tile_h);
531 #endif
532
533                         
534                         sw = file_string_width(file->date);
535                         file_draw_string(spos, sy, file->date, sw, layout->tile_h, FILE_SHORTEN_END);
536                         spos += layout->column_widths[COLUMN_DATE] + 12;
537
538                         sw = file_string_width(file->time);
539                         file_draw_string(spos, sy, file->time, sw, layout->tile_h, FILE_SHORTEN_END); 
540                         spos += layout->column_widths[COLUMN_TIME] + 12;
541
542                         if (!(file->type & S_IFDIR)) {
543                                 sw = file_string_width(file->size);
544                                 spos += layout->column_widths[COLUMN_SIZE] + 12 - sw;
545                                 file_draw_string(spos, sy, file->size, sw, layout->tile_h, FILE_SHORTEN_END);
546                         }
547                 }
548         }
549 }
550
551 static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, const char* category_name, short *starty)
552 {
553         struct FSMenu* fsmenu = fsmenu_get();
554         char bookmark[FILE_MAX];
555         int nentries = fsmenu_get_nentries(fsmenu, category);
556         
557         short sx, sy, xpos, ypos;
558         int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X - ICON_DEFAULT_WIDTH - 4;
559         int fontsize = file_font_pointsize();
560         int cat_icon;
561         int i;
562
563         sx = ar->v2d.cur.xmin + TILE_BORDER_X;
564         sy = *starty;
565
566         UI_ThemeColor(TH_TEXT_HI);
567         file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END);
568         
569         sy -= fontsize*2.0f;
570
571         switch(category) {
572                 case FS_CATEGORY_SYSTEM:
573                         cat_icon = ICON_DISK_DRIVE; break;
574                 case FS_CATEGORY_BOOKMARKS:
575                         cat_icon = ICON_BOOKMARKS; break;
576                 case FS_CATEGORY_RECENT:
577                         cat_icon = ICON_FILE_FOLDER; break;
578         }
579
580         for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
581                 char *fname = fsmenu_get_entry(fsmenu, category, i);
582
583                 if (fname) {
584                         int sl;
585                         BLI_strncpy(bookmark, fname, FILE_MAX);
586                 
587                         sl = strlen(bookmark)-1;
588                         if (sl > 1) {
589                         while (bookmark[sl] == '\\' || bookmark[sl] == '/') {
590                                 bookmark[sl] = '\0';
591                                 sl--;
592                         }
593                         }
594                         
595                         if (fsmenu_is_selected(fsmenu, category, i) ) {
596                                 UI_ThemeColor(TH_HILITE);
597                                 uiRoundBox(sx, sy - fontsize*2.0f, ar->v2d.cur.xmax - TILE_BORDER_X, sy, 4.0f);
598                                 UI_ThemeColor(TH_TEXT);
599                         } else {
600                                 UI_ThemeColor(TH_TEXT_HI);
601                         }
602
603                         xpos = sx;
604                         ypos = sy - (TILE_BORDER_Y * 0.5);
605                         
606                         file_draw_icon(xpos, ypos, cat_icon, ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
607                         xpos += ICON_DEFAULT_WIDTH + 4;
608                         file_draw_string(xpos, ypos, bookmark, bmwidth, fontsize, FILE_SHORTEN_FRONT);
609                         sy -= fontsize*2.0;
610                         fsmenu_set_pos(fsmenu, category, i, xpos, ypos);
611                 }
612         }
613
614         *starty = sy;
615 }
616
617 void file_draw_fsmenu(const bContext *C, ARegion *ar)
618 {
619         int linestep = file_font_pointsize()*2.0f;
620         short sy= ar->v2d.cur.ymax-2*TILE_BORDER_Y;
621
622         file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, "SYSTEM", &sy);
623         sy -= linestep;
624         file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, "BOOKMARKS", &sy);
625         sy -= linestep;
626         file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, "RECENT", &sy);
627         
628 }