2.5 compile errors.
[blender-staging.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 && (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                 while (sw>w) {
204                         int slen = strlen(string);
205                         string[slen-1] = '\0';
206                         sw = file_string_width(s);
207                         shortened = 1;
208                 }
209                 if (shortened) {
210                         int slen = strlen(string);
211                         if (slen > 3) {
212                                 BLI_strncpy(string+slen-3, "...", 4);                           
213                         }
214                 }
215         }
216         
217         return sw;
218 }
219
220 static int get_file_icon(struct direntry *file)
221 {
222         if (file->type & S_IFDIR)
223                 return ICON_FILE_FOLDER;
224         else if (file->flags & BLENDERFILE)
225                 return ICON_FILE_BLEND;
226         else if (file->flags & IMAGEFILE)
227                 return ICON_FILE_IMAGE;
228         else if (file->flags & MOVIEFILE)
229                 return ICON_FILE_MOVIE;
230         else if (file->flags & PYSCRIPTFILE)
231                 return ICON_FILE_SCRIPT;
232         else if (file->flags & PYSCRIPTFILE)
233                 return ICON_FILE_SCRIPT;
234         else if (file->flags & SOUNDFILE) 
235                 return ICON_FILE_SOUND;
236         else if (file->flags & FTFONTFILE) 
237                 return ICON_FILE_FONT;
238         else
239                 return ICON_FILE_BLANK;
240 }
241
242 static void file_draw_icon(short sx, short sy, int icon, short width, short height)
243 {
244         float x,y;
245         int blend=0;
246         
247         x = (float)(sx);
248         y = (float)(sy-height);
249         
250         if (icon == ICON_FILE_BLANK) blend = -80;
251         
252         glEnable(GL_BLEND);
253         
254         UI_icon_draw_aspect_blended(x, y, icon, 1.f, blend);
255 }
256
257
258 static void file_draw_string(short sx, short sy, const char* string, float width, short height, int flag)
259 {
260         short soffs;
261         char fname[FILE_MAXFILE];
262         float sw;
263         float x,y;
264
265         BLI_strncpy(fname,string, FILE_MAXFILE);
266         sw = shorten_string(fname, width, flag );
267
268         soffs = (width - sw) / 2;
269         x = (float)(sx);
270         y = (float)(sy-height);
271
272         BLF_position(x, y, 0);
273         BLF_draw(fname);
274 }
275
276 void file_calc_previews(const bContext *C, ARegion *ar)
277 {
278         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
279         View2D *v2d= &ar->v2d;
280         
281         ED_fileselect_init_layout(sfile, ar);
282         UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height);
283 }
284
285 void file_draw_previews(const bContext *C, ARegion *ar)
286 {
287         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
288         FileSelectParams* params= ED_fileselect_get_params(sfile);
289         FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
290         View2D *v2d= &ar->v2d;
291         struct FileList* files = sfile->files;
292         int numfiles;
293         struct direntry *file;
294         short sx, sy;
295         ImBuf* imb=0;
296         int i;
297         int colorid = 0;
298         int offset;
299         int is_icon;
300
301         if (!files) return;
302
303         filelist_imgsize(files,sfile->layout->prv_w,sfile->layout->prv_h);
304         numfiles = filelist_numfiles(files);
305
306         sx = v2d->cur.xmin + layout->tile_border_x;
307         sy = v2d->cur.ymax - layout->tile_border_y;
308         
309         offset = ED_fileselect_layout_offset(layout, 0, 0);
310         if (offset<0) offset=0;
311         for (i=offset; (i < numfiles) && (i < (offset+(layout->rows+2)*layout->columns)); ++i)
312         {
313                 ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
314                 sx += v2d->tot.xmin+2;
315                 sy = v2d->tot.ymax - sy;
316                 file = filelist_file(files, i); 
317
318                 if (file->flags & ACTIVE) {
319                         colorid = TH_HILITE;
320                         draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
321                 } else if (params->active_file == i) {
322                         colorid = TH_ACTIVE;
323                         draw_tile(sx - 1, sy, sfile->layout->tile_w + 1, sfile->layout->tile_h, colorid,0);
324                 }
325                 
326                 if ( (file->flags & IMAGEFILE) /* || (file->flags & MOVIEFILE) */)
327                 {                       
328                         filelist_loadimage(files, i);
329                 }
330                 is_icon = 0;
331                 imb = filelist_getimage(files, i);
332                 if (!imb) {
333                         imb = filelist_geticon(files,i);
334                         is_icon = 1;
335                 }
336
337                 if (imb) {
338                         float fx, fy;
339                         float dx, dy;
340                         short xco, yco;
341                         float scaledx, scaledy;
342                         float scale;
343                         short ex, ey;
344
345                         if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
346                                 if (imb->x > imb->y) {
347                                         scaledx = (float)layout->prv_w;
348                                         scaledy =  ( (float)imb->y/(float)imb->x )*layout->prv_w;
349                                         scale = scaledx/imb->x;
350                                 }
351                                 else {
352                                         scaledy = (float)layout->prv_h;
353                                         scaledx =  ( (float)imb->x/(float)imb->y )*layout->prv_h;
354                                         scale = scaledy/imb->y;
355                                 }
356                         } else {
357                                 scaledx = (float)imb->x;
358                                 scaledy = (float)imb->y;
359                                 scale = 1.0;
360                         }
361                         ex = (short)scaledx;
362                         ey = (short)scaledy;
363                         fx = ((float)layout->prv_w - (float)ex)/2.0f;
364                         fy = ((float)layout->prv_h - (float)ey)/2.0f;
365                         dx = (fx + 0.5f + sfile->layout->prv_border_x);
366                         dy = (fy + 0.5f - sfile->layout->prv_border_y);
367                         xco = (float)sx + dx;
368                         yco = (float)sy - sfile->layout->prv_h + dy;
369
370                         glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);
371                         
372                         /* shadow */
373                         if (!is_icon && (file->flags & IMAGEFILE))
374                                 uiDrawBoxShadow(220, xco, yco, xco + ex, yco + ey);
375                         
376                         glEnable(GL_BLEND);
377                         
378                         /* the image */
379                         glColor4f(1.0, 1.0, 1.0, 1.0);
380                         glaDrawPixelsTexScaled(xco, yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale);
381                         
382                         /* border */
383                         if (!is_icon && (file->flags & IMAGEFILE)) {
384                                 glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
385                                 fdrawbox(xco, yco, xco + ex, yco + ey);
386                         }
387                         
388                         glDisable(GL_BLEND);
389                         imb = 0;
390                 }
391
392                 /* shadow */
393                 UI_ThemeColorShade(TH_BACK, -20);
394                 
395                 
396                 if (S_ISDIR(file->type)) {
397                         glColor4f(1.0f, 1.0f, 0.9f, 1.0f);
398                 }
399                 else if (file->flags & IMAGEFILE) {
400                         UI_ThemeColor(TH_SEQ_IMAGE);
401                 }
402                 else if (file->flags & MOVIEFILE) {
403                         UI_ThemeColor(TH_SEQ_MOVIE);
404                 }
405                 else if (file->flags & BLENDERFILE) {
406                         UI_ThemeColor(TH_SEQ_SCENE);
407                 }
408                 else {
409                         if (params->active_file == i) {
410                                 UI_ThemeColor(TH_GRID); /* grid used for active text */
411                         } else if (file->flags & ACTIVE) {
412                                 UI_ThemeColor(TH_TEXT_HI);                      
413                         } else {
414                                 UI_ThemeColor(TH_TEXT);
415                         }
416                 }
417
418                 file_draw_string(sx + layout->prv_border_x, sy+4, file->relname, layout->tile_w, layout->tile_h, FILE_SHORTEN_END);
419
420                 if (!sfile->loadimage_timer)
421                         sfile->loadimage_timer= WM_event_add_window_timer(CTX_wm_window(C), TIMER1, 1.0/30.0);  /* max 30 frames/sec. */
422
423         }
424
425         uiSetRoundBox(0);
426 }
427
428
429 void file_draw_list(const bContext *C, ARegion *ar)
430 {
431         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
432         FileSelectParams* params = ED_fileselect_get_params(sfile);
433         FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
434         View2D *v2d= &ar->v2d;
435         struct FileList* files = sfile->files;
436         struct direntry *file;
437         int numfiles;
438         int colorid = 0;
439         short sx, sy;
440         int offset;
441         short type;
442         int i;
443         float sw, spos;
444
445         numfiles = filelist_numfiles(files);
446         type = filelist_gettype(files); 
447
448         sx = ar->v2d.tot.xmin + layout->tile_border_x/2;
449         sy = ar->v2d.cur.ymax - layout->tile_border_y;
450
451         offset = ED_fileselect_layout_offset(layout, 0, 0);
452         if (offset<0) offset=0;
453
454         /* alternating flat shade background */
455         for (i=0; (i <= layout->rows); i+=2)
456         {
457                 sx = v2d->cur.xmin;
458                 sy = v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
459
460                 UI_ThemeColorShade(TH_BACK, -7);
461                 glRectf(v2d->cur.xmin, sy, v2d->cur.xmax, sy+layout->tile_h+2*layout->tile_border_y);
462                 
463         }
464         
465         /* vertical column dividers */
466         sx = v2d->tot.xmin;
467         while (sx < ar->v2d.cur.xmax) {
468                 sx += (sfile->layout->tile_w+2*sfile->layout->tile_border_x);
469                 
470                 UI_ThemeColorShade(TH_BACK, 30);
471                 sdrawline(sx+1,  ar->v2d.cur.ymax - layout->tile_border_y ,  sx+1,  ar->v2d.cur.ymin); 
472                 UI_ThemeColorShade(TH_BACK, -30);
473                 sdrawline(sx,  ar->v2d.cur.ymax - layout->tile_border_y ,  sx,  ar->v2d.cur.ymin); 
474         }
475
476         sx = ar->v2d.cur.xmin + layout->tile_border_x;
477         sy = ar->v2d.cur.ymax - layout->tile_border_y;
478
479         for (i=offset; (i < numfiles); ++i)
480         {
481                 ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
482                 sx += v2d->tot.xmin+2;
483                 sy = v2d->tot.ymax - sy;
484
485                 file = filelist_file(files, i); 
486
487                 if (params->active_file == i) {
488                         if (file->flags & ACTIVE) colorid= TH_HILITE;
489                         else colorid = TH_BACK;
490                         draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h+layout->tile_border_y, colorid,20);
491                 } else if (file->flags & ACTIVE) {
492                         colorid = TH_HILITE;
493                         draw_tile(sx-2, sy-3, layout->tile_w+2, sfile->layout->tile_h+layout->tile_border_y, colorid,0);
494                 } 
495
496                 spos = sx;
497                 file_draw_icon(spos, sy-3, get_file_icon(file), ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
498                 spos += ICON_DEFAULT_WIDTH + 4;
499                 
500                 UI_ThemeColor4(TH_TEXT);
501                 
502                 sw = file_string_width(file->relname);
503                 file_draw_string(spos, sy, file->relname, sw, layout->tile_h, FILE_SHORTEN_END);
504                 spos += layout->column_widths[COLUMN_NAME] + 12;
505                 if (params->display == FILE_SHOWSHORT) {
506                         if (!(file->type & S_IFDIR)) {
507                                 sw = file_string_width(file->size);
508                                 spos += layout->column_widths[COLUMN_SIZE] + 12 - sw;
509                                 file_draw_string(spos, sy, file->size, sw+1, layout->tile_h, FILE_SHORTEN_END); 
510                         }
511                 } else {
512 #if 0 // XXX TODO: add this for non-windows systems
513                         /* rwx rwx rwx */
514                         spos += 20;
515                         sw = UI_GetStringWidth(file->mode1);
516                         file_draw_string(spos, sy, file->mode1, sw, layout->tile_h); 
517                         
518                         spos += 30;
519                         sw = UI_GetStringWidth(file->mode2);
520                         file_draw_string(spos, sy, file->mode2, sw, layout->tile_h);
521
522                         spos += 30;
523                         sw = UI_GetStringWidth(file->mode3);
524                         file_draw_string(spos, sy, file->mode3, sw, layout->tile_h);
525                         
526                         spos += 30;
527                         sw = UI_GetStringWidth(file->owner);
528                         file_draw_string(spos, sy, file->owner, sw, layout->tile_h);
529 #endif
530
531                         
532                         sw = file_string_width(file->date);
533                         file_draw_string(spos, sy, file->date, sw, layout->tile_h, FILE_SHORTEN_END);
534                         spos += layout->column_widths[COLUMN_DATE] + 12;
535
536                         sw = file_string_width(file->time);
537                         file_draw_string(spos, sy, file->time, sw, layout->tile_h, FILE_SHORTEN_END); 
538                         spos += layout->column_widths[COLUMN_TIME] + 12;
539
540                         if (!(file->type & S_IFDIR)) {
541                                 sw = file_string_width(file->size);
542                                 spos += layout->column_widths[COLUMN_SIZE] + 12 - sw;
543                                 file_draw_string(spos, sy, file->size, sw, layout->tile_h, FILE_SHORTEN_END);
544                         }
545                 }
546         }
547 }
548
549 static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, const char* category_name, short *starty)
550 {
551         struct FSMenu* fsmenu = fsmenu_get();
552         char bookmark[FILE_MAX];
553         int nentries = fsmenu_get_nentries(fsmenu, category);
554         
555         short sx, sy, xpos, ypos;
556         int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X - ICON_DEFAULT_WIDTH - 4;
557         int fontsize = file_font_pointsize();
558         int cat_icon;
559         int i;
560
561         sx = ar->v2d.cur.xmin + TILE_BORDER_X;
562         sy = *starty;
563
564         UI_ThemeColor(TH_TEXT_HI);
565         file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END);
566         
567         sy -= fontsize*2.0f;
568
569         switch(category) {
570                 case FS_CATEGORY_SYSTEM:
571                         cat_icon = ICON_DISK_DRIVE; break;
572                 case FS_CATEGORY_BOOKMARKS:
573                         cat_icon = ICON_BOOKMARKS; break;
574                 case FS_CATEGORY_RECENT:
575                         cat_icon = ICON_FILE_FOLDER; break;
576         }
577
578         for (i=0; i< nentries && (sy > ar->v2d.cur.ymin) ;++i) {
579                 char *fname = fsmenu_get_entry(fsmenu, category, i);
580
581                 if (fname) {
582                         int sl;
583                         BLI_strncpy(bookmark, fname, FILE_MAX);
584                 
585                         sl = strlen(bookmark)-1;
586                         if (sl > 1) {
587                         while (bookmark[sl] == '\\' || bookmark[sl] == '/') {
588                                 bookmark[sl] = '\0';
589                                 sl--;
590                         }
591                         }
592                         
593                         if (fsmenu_is_selected(fsmenu, category, i) ) {
594                                 UI_ThemeColor(TH_HILITE);
595                                 uiRoundBox(sx, sy - fontsize*2.0f, ar->v2d.cur.xmax - TILE_BORDER_X, sy, 4.0f);
596                                 UI_ThemeColor(TH_TEXT);
597                         } else {
598                                 UI_ThemeColor(TH_TEXT_HI);
599                         }
600
601                         xpos = sx;
602                         ypos = sy - (TILE_BORDER_Y * 0.5);
603                         
604                         file_draw_icon(xpos, ypos, cat_icon, ICON_DEFAULT_WIDTH, ICON_DEFAULT_WIDTH);
605                         xpos += ICON_DEFAULT_WIDTH + 4;
606                         file_draw_string(xpos, ypos, bookmark, bmwidth, fontsize, FILE_SHORTEN_FRONT);
607                         sy -= fontsize*2.0;
608                         fsmenu_set_pos(fsmenu, category, i, xpos, ypos);
609                 }
610         }
611
612         *starty = sy;
613 }
614
615 void file_draw_fsmenu(const bContext *C, ARegion *ar)
616 {
617         int linestep = file_font_pointsize()*2.0f;
618         short sy= ar->v2d.cur.ymax-2*TILE_BORDER_Y;
619
620         file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, "SYSTEM", &sy);
621         sy -= linestep;
622         file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, "BOOKMARKS", &sy);
623         sy -= linestep;
624         file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, "RECENT", &sy);
625         
626 }