Blender V2.61 - r43446

file_draw.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2008 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * 
00022  * Contributor(s): Blender Foundation
00023  *
00024  * ***** END GPL LICENSE BLOCK *****
00025  */
00026 
00032 #include <math.h>
00033 #include <string.h>
00034 
00035 #include "BLI_blenlib.h"
00036 #include "BLI_utildefines.h"
00037 #include "BLI_dynstr.h"
00038 #ifdef WIN32
00039 #include "BLI_winstuff.h"
00040 #endif
00041 
00042 #include "BIF_gl.h"
00043 #include "BIF_glutil.h"
00044 
00045 #include "BKE_context.h"
00046 #include "BKE_global.h"
00047 #include "BKE_main.h"
00048 
00049 #include "BLF_api.h"
00050 #include "BLF_translation.h"
00051 
00052 #include "IMB_imbuf_types.h"
00053  
00054 #include "MEM_guardedalloc.h"
00055 
00056 #include "DNA_userdef_types.h"
00057 
00058 #include "RNA_access.h"
00059 
00060 #include "ED_fileselect.h"
00061 #include "ED_screen.h"
00062 
00063 #include "UI_interface.h"
00064 #include "UI_interface_icons.h"
00065 #include "UI_resources.h"
00066 #include "UI_view2d.h"
00067 
00068 #include "WM_types.h"
00069 
00070 #include "fsmenu.h"
00071 #include "filelist.h"
00072 
00073 #include "file_intern.h"    // own include
00074 
00075 /* button events */
00076 enum {
00077     B_FS_DIRNAME,
00078     B_FS_FILENAME
00079 } /*eFile_ButEvents*/;
00080 
00081 
00082 static void do_file_buttons(bContext *C, void *UNUSED(arg), int event)
00083 {
00084     switch(event) {
00085         case B_FS_FILENAME:
00086             file_filename_exec(C, NULL);
00087             break;
00088         case B_FS_DIRNAME:
00089             file_directory_exec(C, NULL);
00090             break;
00091     }
00092 }
00093 
00094 /* Note: This function uses pixelspace (0, 0, winx, winy), not view2d. 
00095  * The controls are laid out as follows:
00096  *
00097  * -------------------------------------------
00098  * | Directory input               | execute |
00099  * -------------------------------------------
00100  * | Filename input        | + | - | cancel  |
00101  * -------------------------------------------
00102  *
00103  * The input widgets will stretch to fill any excess space.
00104  * When there isn't enough space for all controls to be shown, they are
00105  * hidden in this order: x/-, execute/cancel, input widgets.
00106  */
00107 void file_draw_buttons(const bContext *C, ARegion *ar)
00108 {
00109     /* Button layout. */
00110     const int max_x      = ar->winx - 10;
00111     const int line1_y    = ar->winy - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
00112     const int line2_y    = line1_y - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
00113     const int input_minw = 20;
00114     const int btn_h      = UI_UNIT_Y;
00115     const int btn_fn_w   = UI_UNIT_X;
00116     const int btn_minw   = 80;
00117     const int btn_margin = 20;
00118     const int separator  = 4;
00119 
00120     /* Additional locals. */
00121     char uiblockstr[32];
00122     int loadbutton;
00123     int fnumbuttons;
00124     int min_x       = 10;
00125     int chan_offs   = 0;
00126     int available_w = max_x - min_x;
00127     int line1_w     = available_w;
00128     int line2_w     = available_w;
00129     
00130     uiBut*            but;
00131     uiBlock*          block;
00132     SpaceFile*        sfile  = CTX_wm_space_file(C);
00133     FileSelectParams* params = ED_fileselect_get_params(sfile);
00134     ARegion*          artmp;
00135     
00136     /* Initialize UI block. */
00137     BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
00138     block = uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
00139     uiBlockSetHandleFunc(block, do_file_buttons, NULL);
00140 
00141     /* exception to make space for collapsed region icon */
00142     for (artmp=CTX_wm_area(C)->regionbase.first; artmp; artmp=artmp->next) {
00143         if (artmp->regiontype == RGN_TYPE_CHANNELS && artmp->flag & RGN_FLAG_HIDDEN) {
00144             chan_offs = 16;
00145             min_x += chan_offs;
00146             available_w -= chan_offs;
00147         }
00148     }
00149     
00150     /* Is there enough space for the execute / cancel buttons? */
00151     loadbutton = UI_GetStringWidth(sfile->params->title) + btn_margin;
00152     if (loadbutton < btn_minw) {
00153         loadbutton = MAX2(btn_minw, 
00154                           btn_margin + UI_GetStringWidth(params->title));
00155     }
00156     
00157     if (available_w <= loadbutton + separator + input_minw 
00158      || params->title[0] == 0) {
00159         loadbutton = 0;
00160     } else {
00161         line1_w -= (loadbutton + separator);
00162         line2_w  = line1_w;
00163     }
00164 
00165     /* Is there enough space for file number increment/decrement buttons? */
00166     fnumbuttons = 2 * btn_fn_w;
00167     if (!loadbutton || line2_w <= fnumbuttons + separator + input_minw) {
00168         fnumbuttons = 0;
00169     } else {
00170         line2_w -= (fnumbuttons + separator);
00171     }
00172     
00173     /* Text input fields for directory and file. */
00174     if (available_w > 0) {
00175         int overwrite_alert= file_draw_check_exists(sfile);
00176         /* callbacks for operator check functions */
00177         uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
00178 
00179         but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
00180                             min_x, line1_y, line1_w-chan_offs, btn_h,
00181                             params->dir, 0.0, (float)FILE_MAX, 0, 0,
00182                             TIP_("File path"));
00183         uiButSetCompleteFunc(but, autocomplete_directory, NULL);
00184         uiButSetFlag(but, UI_BUT_NO_UTF8);
00185 
00186         if((params->flag & FILE_DIRSEL_ONLY) == 0) {
00187             but = uiDefBut(block, TEX, B_FS_FILENAME, "",
00188                            min_x, line2_y, line2_w-chan_offs, btn_h,
00189                            params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
00190                            TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
00191             uiButSetCompleteFunc(but, autocomplete_file, NULL);
00192             uiButSetFlag(but, UI_BUT_NO_UTF8);
00193 
00194             /* check if this overrides a file and if the operator option is used */
00195             if(overwrite_alert) {
00196                 uiButSetFlag(but, UI_BUT_REDALERT);
00197             }
00198         }
00199         
00200         /* clear func */
00201         uiBlockSetFunc(block, NULL, NULL, NULL);
00202     }
00203     
00204     /* Filename number increment / decrement buttons. */
00205     if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) {
00206         uiBlockBeginAlign(block);
00207         but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT,
00208                             min_x + line2_w + separator - chan_offs, line2_y,
00209                             btn_fn_w, btn_h,
00210                             TIP_("Decrement the filename number"));
00211         RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1);
00212 
00213         but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN,
00214                             min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y,
00215                             btn_fn_w, btn_h,
00216                             TIP_("Increment the filename number"));
00217         RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1);
00218         uiBlockEndAlign(block);
00219     }
00220     
00221     /* Execute / cancel buttons. */
00222     if(loadbutton) {
00223         
00224         uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title,
00225             max_x - loadbutton, line1_y, loadbutton, btn_h, 
00226             params->title);
00227         uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"),
00228             max_x - loadbutton, line2_y, loadbutton, btn_h, 
00229             TIP_("Cancel"));
00230     }
00231     
00232     uiEndBlock(C, block);
00233     uiDrawBlock(C, block);
00234 }
00235 
00236 
00237 static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade)
00238 {
00239     UI_ThemeColorShade(colorid, shade);
00240     uiSetRoundBox(UI_CNR_ALL);
00241     uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f);
00242 }
00243 
00244 
00245 static int get_file_icon(struct direntry *file)
00246 {
00247     if (file->type & S_IFDIR) {
00248         if ( strcmp(file->relname, "..") == 0) {
00249                 return  ICON_FILE_PARENT;
00250         }
00251         if(file->flags & BLENDERFILE) {
00252             return ICON_FILE_BLEND;
00253         }
00254         return ICON_FILE_FOLDER;
00255     }
00256     else if (file->flags & BLENDERFILE)
00257         return ICON_FILE_BLEND;
00258     else if (file->flags & BLENDERFILE_BACKUP)
00259         return ICON_FILE_BLEND;
00260     else if (file->flags & IMAGEFILE)
00261         return ICON_FILE_IMAGE;
00262     else if (file->flags & MOVIEFILE)
00263         return ICON_FILE_MOVIE;
00264     else if (file->flags & PYSCRIPTFILE)
00265         return ICON_FILE_SCRIPT;
00266     else if (file->flags & SOUNDFILE) 
00267         return ICON_FILE_SOUND;
00268     else if (file->flags & FTFONTFILE) 
00269         return ICON_FILE_FONT;
00270     else if (file->flags & BTXFILE) 
00271         return ICON_FILE_BLANK;
00272     else if (file->flags & COLLADAFILE) 
00273         return ICON_FILE_BLANK;
00274     else
00275         return ICON_FILE_BLANK;
00276 }
00277 
00278 static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height)
00279 {
00280     uiBut *but;
00281     int x,y;
00282     /*float alpha=1.0f;*/
00283     
00284     x = sx;
00285     y = sy-height;
00286     
00287     /*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
00288 
00289     but= uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
00290     uiButSetDragPath(but, path);
00291 }
00292 
00293 
00294 static void file_draw_string(int sx, int sy, const char* string, float width, int height, short align)
00295 {
00296     uiStyle *style= UI_GetStyle();
00297     uiFontStyle fs = style->widgetlabel;
00298     rcti rect;
00299     char fname[FILE_MAXFILE];
00300 
00301     fs.align = align;
00302 
00303     BLI_strncpy(fname,string, FILE_MAXFILE);
00304     file_shorten_string(fname, width + 1.0f, 0);
00305 
00306     /* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */
00307     rect.xmin = sx;
00308     rect.xmax = (int)(sx + ceil(width+4.0f));
00309     rect.ymin = sy - height;
00310     rect.ymax = sy;
00311     
00312     uiStyleFontDraw(&fs, &rect, fname);
00313 }
00314 
00315 void file_calc_previews(const bContext *C, ARegion *ar)
00316 {
00317     SpaceFile *sfile= CTX_wm_space_file(C);
00318     View2D *v2d= &ar->v2d;
00319     
00320     ED_fileselect_init_layout(sfile, ar);
00321     /* +SCROLL_HEIGHT is bad hack to work around issue in UI_view2d_totRect_set */
00322     UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height+V2D_SCROLL_HEIGHT);
00323 }
00324 
00325 static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, short dropshadow)
00326 {
00327     if (imb) {
00328         uiBut *but;
00329         float fx, fy;
00330         float dx, dy;
00331         int xco, yco;
00332         float scaledx, scaledy;
00333         float scale;
00334         int ex, ey;
00335         
00336         if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
00337             if (imb->x > imb->y) {
00338                 scaledx = (float)layout->prv_w;
00339                 scaledy =  ( (float)imb->y/(float)imb->x )*layout->prv_w;
00340                 scale = scaledx/imb->x;
00341             }
00342             else {
00343                 scaledy = (float)layout->prv_h;
00344                 scaledx =  ( (float)imb->x/(float)imb->y )*layout->prv_h;
00345                 scale = scaledy/imb->y;
00346             }
00347         } else {
00348             scaledx = (float)imb->x;
00349             scaledy = (float)imb->y;
00350             scale = 1.0;
00351         }
00352         ex = (int)scaledx;
00353         ey = (int)scaledy;
00354         fx = ((float)layout->prv_w - (float)ex)/2.0f;
00355         fy = ((float)layout->prv_h - (float)ey)/2.0f;
00356         dx = (fx + 0.5f + layout->prv_border_x);
00357         dy = (fy + 0.5f - layout->prv_border_y);
00358         xco = sx + (int)dx;
00359         yco = sy - layout->prv_h + (int)dy;
00360         
00361         glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);
00362         
00363         /* shadow */
00364         if (dropshadow)
00365             uiDrawBoxShadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
00366 
00367         glEnable(GL_BLEND);
00368         
00369         /* the image */
00370         glColor4f(1.0, 1.0, 1.0, 1.0);
00371         glaDrawPixelsTexScaled((float)xco, (float)yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale);
00372         
00373         /* border */
00374         if (dropshadow) {
00375             glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
00376             fdrawbox((float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
00377         }
00378         
00379         /* dragregion */
00380         but= uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
00381         uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale);
00382         
00383         glDisable(GL_BLEND);
00384         imb = NULL;
00385     }
00386 }
00387 
00388 static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
00389 {
00390     char newname[FILE_MAX+12];
00391     char orgname[FILE_MAX+12];
00392     char filename[FILE_MAX+12];
00393     SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
00394     ARegion* ar = CTX_wm_region(C);
00395 
00396     BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
00397     BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
00398     BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
00399 
00400     if( strcmp(orgname, newname) != 0 ) {
00401         if (!BLI_exists(newname)) {
00402             BLI_rename(orgname, newname);
00403             /* to make sure we show what is on disk */
00404             ED_fileselect_clear(C, sfile);
00405         }
00406 
00407         ED_region_tag_redraw(ar);
00408     }
00409 }
00410 
00411 
00412 static void draw_background(FileLayout *layout, View2D *v2d)
00413 {
00414     int i;
00415     int sy;
00416 
00417     /* alternating flat shade background */
00418     for (i=0; (i <= layout->rows); i+=2)
00419     {
00420         sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
00421 
00422         UI_ThemeColorShade(TH_BACK, -7);
00423         glRectf(v2d->cur.xmin, (float)sy, v2d->cur.xmax, (float)(sy+layout->tile_h+2*layout->tile_border_y));
00424         
00425     }
00426 }
00427 
00428 static void draw_dividers(FileLayout *layout, View2D *v2d)
00429 {
00430     int sx;
00431 
00432     /* vertical column dividers */
00433     sx = (int)v2d->tot.xmin;
00434     while (sx < v2d->cur.xmax) {
00435         sx += (layout->tile_w+2*layout->tile_border_x);
00436         
00437         UI_ThemeColorShade(TH_BACK, 30);
00438         sdrawline(sx+1, (short)(v2d->cur.ymax - layout->tile_border_y),  sx+1,  (short)v2d->cur.ymin); 
00439         UI_ThemeColorShade(TH_BACK, -30);
00440         sdrawline(sx, (short)(v2d->cur.ymax - layout->tile_border_y),  sx,  (short)v2d->cur.ymin); 
00441     }
00442 }
00443 
00444 void file_draw_list(const bContext *C, ARegion *ar)
00445 {
00446     SpaceFile *sfile= CTX_wm_space_file(C);
00447     FileSelectParams* params = ED_fileselect_get_params(sfile);
00448     FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
00449     View2D *v2d= &ar->v2d;
00450     struct FileList* files = sfile->files;
00451     struct direntry *file;
00452     ImBuf *imb;
00453     uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
00454     int numfiles;
00455     int numfiles_layout;
00456     int sx, sy;
00457     int offset;
00458     int textwidth, textheight;
00459     int i;
00460     short is_icon;
00461     short align;
00462 
00463 
00464     numfiles = filelist_numfiles(files);
00465     
00466     if (params->display != FILE_IMGDISPLAY) {
00467 
00468         draw_background(layout, v2d);
00469     
00470         draw_dividers(layout, v2d);
00471     }
00472 
00473     offset = ED_fileselect_layout_offset(layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
00474     if (offset<0) offset=0;
00475 
00476     numfiles_layout = ED_fileselect_layout_numfiles(layout, ar);
00477 
00478     /* adjust, so the next row is already drawn when scrolling */
00479     if (layout->flag & FILE_LAYOUT_HOR) {
00480         numfiles_layout += layout->rows;
00481     } else {
00482         numfiles_layout += layout->columns;
00483     }
00484 
00485     textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : (int)layout->column_widths[COLUMN_NAME];
00486     textheight = (int)(layout->textheight*3.0/2.0 + 0.5);
00487 
00488     align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
00489 
00490     for (i=offset; (i < numfiles) && (i<offset+numfiles_layout); ++i)
00491     {
00492         ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
00493         sx += (int)(v2d->tot.xmin+2.0f);
00494         sy = (int)(v2d->tot.ymax - sy);
00495 
00496         file = filelist_file(files, i); 
00497         
00498         UI_ThemeColor4(TH_TEXT);
00499 
00500 
00501         if (!(file->selflag & EDITING_FILE)) {
00502             if  ((params->active_file == i) || (file->selflag & HILITED_FILE) || (file->selflag & SELECTED_FILE) ) {
00503                 int colorid = (file->selflag & SELECTED_FILE) ? TH_HILITE : TH_BACK;
00504                 int shade = (params->active_file == i) || (file->selflag & HILITED_FILE) ? 20 : 0;
00505                 draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade);
00506             }
00507         }
00508         uiSetRoundBox(UI_CNR_NONE);
00509 
00510         if ( FILE_IMGDISPLAY == params->display ) {
00511             is_icon = 0;
00512             imb = filelist_getimage(files, i);
00513             if (!imb) {
00514                 imb = filelist_geticon(files,i);
00515                 is_icon = 1;
00516             }
00517             
00518             file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
00519         } else {
00520             file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
00521             sx += ICON_DEFAULT_WIDTH_SCALE + 4;
00522         }
00523 
00524         UI_ThemeColor4(TH_TEXT);
00525 
00526         if (file->selflag & EDITING_FILE) {
00527             uiBut *but = uiDefBut(block, TEX, 1, "", sx , sy-layout->tile_h-3, 
00528                 textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
00529             uiButSetRenameFunc(but, renamebutton_cb, file);
00530             uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
00531             if ( 0 == uiButActiveOnly(C, block, but)) {
00532                 file->selflag &= ~EDITING_FILE;
00533             }
00534         }
00535 
00536         if (!(file->selflag & EDITING_FILE))  {
00537             int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy;
00538             file_draw_string(sx+1, tpos, file->relname, (float)textwidth, textheight, align);
00539         }
00540 
00541         if (params->display == FILE_SHORTDISPLAY) {
00542             sx += (int)layout->column_widths[COLUMN_NAME] + 12;
00543             if (!(file->type & S_IFDIR)) {
00544                 file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);    
00545                 sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
00546             }
00547         } else if (params->display == FILE_LONGDISPLAY) {
00548             sx += (int)layout->column_widths[COLUMN_NAME] + 12;
00549 
00550 #ifndef WIN32
00551             /* rwx rwx rwx */
00552             file_draw_string(sx, sy, file->mode1, layout->column_widths[COLUMN_MODE1], layout->tile_h, align); 
00553             sx += layout->column_widths[COLUMN_MODE1] + 12;
00554 
00555             file_draw_string(sx, sy, file->mode2, layout->column_widths[COLUMN_MODE2], layout->tile_h, align);
00556             sx += layout->column_widths[COLUMN_MODE2] + 12;
00557 
00558             file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
00559             sx += layout->column_widths[COLUMN_MODE3] + 12;
00560 
00561             file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER] , layout->tile_h, align);
00562             sx += layout->column_widths[COLUMN_OWNER] + 12;
00563 #endif
00564 
00565             file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
00566             sx += (int)layout->column_widths[COLUMN_DATE] + 12;
00567 
00568             file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME] , layout->tile_h, align); 
00569             sx += (int)layout->column_widths[COLUMN_TIME] + 12;
00570 
00571             if (!(file->type & S_IFDIR)) {
00572                 file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
00573                 sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
00574             }
00575         }
00576     }
00577 
00578     uiEndBlock(C, block);
00579     uiDrawBlock(C, block);
00580 
00581 }