Merging r45936 through r46042 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / space_file / file_draw.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2008 Blender Foundation.
19  * All rights reserved.
20  *
21  * 
22  * Contributor(s): Blender Foundation
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/editors/space_file/file_draw.c
28  *  \ingroup spfile
29  */
30
31
32 #include <math.h>
33 #include <string.h>
34
35 #include "BLI_blenlib.h"
36 #include "BLI_utildefines.h"
37 #include "BLI_dynstr.h"
38
39 #ifdef WIN32
40 #  include "BLI_winstuff.h"
41 #endif
42
43 #include "BIF_gl.h"
44 #include "BIF_glutil.h"
45
46 #include "BKE_context.h"
47 #include "BKE_global.h"
48 #include "BKE_main.h"
49
50 #include "BLF_api.h"
51 #include "BLF_translation.h"
52
53 #include "IMB_imbuf_types.h"
54  
55 #include "MEM_guardedalloc.h"
56
57 #include "DNA_userdef_types.h"
58
59 #include "RNA_access.h"
60
61 #include "ED_fileselect.h"
62 #include "ED_screen.h"
63
64 #include "UI_interface.h"
65 #include "UI_interface_icons.h"
66 #include "UI_resources.h"
67 #include "UI_view2d.h"
68
69 #include "WM_types.h"
70
71 #include "fsmenu.h"
72 #include "filelist.h"
73
74 #include "file_intern.h"        // own include
75
76 /* button events */
77 enum {
78         B_FS_DIRNAME,
79         B_FS_FILENAME
80 } /*eFile_ButEvents*/;
81
82
83 static void do_file_buttons(bContext *C, void *UNUSED(arg), int event)
84 {
85         switch (event) {
86                 case B_FS_FILENAME:
87                         file_filename_exec(C, NULL);
88                         break;
89                 case B_FS_DIRNAME:
90                         file_directory_exec(C, NULL);
91                         break;
92         }
93 }
94
95 /* Note: This function uses pixelspace (0, 0, winx, winy), not view2d. 
96  * The controls are laid out as follows:
97  *
98  * -------------------------------------------
99  * | Directory input               | execute |
100  * -------------------------------------------
101  * | Filename input        | + | - | cancel  |
102  * -------------------------------------------
103  *
104  * The input widgets will stretch to fill any excess space.
105  * When there isn't enough space for all controls to be shown, they are
106  * hidden in this order: x/-, execute/cancel, input widgets.
107  */
108 void file_draw_buttons(const bContext *C, ARegion *ar)
109 {
110         /* Button layout. */
111         const int max_x      = ar->winx - 10;
112         const int line1_y    = ar->winy - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
113         const int line2_y    = line1_y - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
114         const int input_minw = 20;
115         const int btn_h      = UI_UNIT_Y;
116         const int btn_fn_w   = UI_UNIT_X;
117         const int btn_minw   = 80;
118         const int btn_margin = 20;
119         const int separator  = 4;
120
121         /* Additional locals. */
122         char uiblockstr[32];
123         int loadbutton;
124         int fnumbuttons;
125         int min_x       = 10;
126         int chan_offs   = 0;
127         int available_w = max_x - min_x;
128         int line1_w     = available_w;
129         int line2_w     = available_w;
130         
131         uiBut*            but;
132         uiBlock*          block;
133         SpaceFile*        sfile  = CTX_wm_space_file(C);
134         FileSelectParams* params = ED_fileselect_get_params(sfile);
135         ARegion*                  artmp;
136         
137         /* Initialize UI block. */
138         BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
139         block = uiBeginBlock(C, ar, uiblockstr, UI_EMBOSS);
140         uiBlockSetHandleFunc(block, do_file_buttons, NULL);
141
142         /* exception to make space for collapsed region icon */
143         for (artmp=CTX_wm_area(C)->regionbase.first; artmp; artmp=artmp->next) {
144                 if (artmp->regiontype == RGN_TYPE_CHANNELS && artmp->flag & RGN_FLAG_HIDDEN) {
145                         chan_offs = 16;
146                         min_x += chan_offs;
147                         available_w -= chan_offs;
148                 }
149         }
150         
151         /* Is there enough space for the execute / cancel buttons? */
152         loadbutton = UI_GetStringWidth(sfile->params->title) + btn_margin;
153         if (loadbutton < btn_minw) {
154                 loadbutton = MAX2(btn_minw, 
155                                                   btn_margin + UI_GetStringWidth(params->title));
156         }
157         
158         if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) {
159                 loadbutton = 0;
160         }
161         else {
162                 line1_w -= (loadbutton + separator);
163                 line2_w  = line1_w;
164         }
165
166         /* Is there enough space for file number increment/decrement buttons? */
167         fnumbuttons = 2 * btn_fn_w;
168         if (!loadbutton || line2_w <= fnumbuttons + separator + input_minw) {
169                 fnumbuttons = 0;
170         }
171         else {
172                 line2_w -= (fnumbuttons + separator);
173         }
174         
175         /* Text input fields for directory and file. */
176         if (available_w > 0) {
177                 int overwrite_alert= file_draw_check_exists(sfile);
178                 /* callbacks for operator check functions */
179                 uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
180
181                 but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
182                                     min_x, line1_y, line1_w-chan_offs, btn_h,
183                                     params->dir, 0.0, (float)FILE_MAX, 0, 0,
184                                     TIP_("File path"));
185                 uiButSetCompleteFunc(but, autocomplete_directory, NULL);
186                 uiButSetFlag(but, UI_BUT_NO_UTF8);
187
188                 if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
189                         but = uiDefBut(block, TEX, B_FS_FILENAME, "",
190                                        min_x, line2_y, line2_w-chan_offs, btn_h,
191                                        params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
192                                        TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
193                         uiButSetCompleteFunc(but, autocomplete_file, NULL);
194                         uiButSetFlag(but, UI_BUT_NO_UTF8);
195                         uiButClearFlag(but, UI_BUT_UNDO); /* operator button above does this automatic */
196
197                         /* check if this overrides a file and if the operator option is used */
198                         if (overwrite_alert) {
199                                 uiButSetFlag(but, UI_BUT_REDALERT);
200                         }
201                 }
202                 
203                 /* clear func */
204                 uiBlockSetFunc(block, NULL, NULL, NULL);
205         }
206         
207         /* Filename number increment / decrement buttons. */
208         if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) {
209                 uiBlockBeginAlign(block);
210                 but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT,
211                                     min_x + line2_w + separator - chan_offs, line2_y,
212                                     btn_fn_w, btn_h,
213                                     TIP_("Decrement the filename number"));
214                 RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1);
215
216                 but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN,
217                                     min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y,
218                                     btn_fn_w, btn_h,
219                                     TIP_("Increment the filename number"));
220                 RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1);
221                 uiBlockEndAlign(block);
222         }
223         
224         /* Execute / cancel buttons. */
225         if (loadbutton) {
226                 /* params->title is already translated! */
227                 uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title,
228                           max_x - loadbutton, line1_y, loadbutton, btn_h, "");
229                 uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"),
230                           max_x - loadbutton, line2_y, loadbutton, btn_h, "");
231         }
232         
233         uiEndBlock(C, block);
234         uiDrawBlock(C, block);
235 }
236
237
238 static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade)
239 {
240         UI_ThemeColorShade(colorid, shade);
241         uiSetRoundBox(UI_CNR_ALL);
242         uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f);
243 }
244
245
246 static int get_file_icon(struct direntry *file)
247 {
248         if (file->type & S_IFDIR) {
249                 if ( strcmp(file->relname, "..") == 0) {
250                                 return  ICON_FILE_PARENT;
251                 }
252                 if (file->flags & BLENDERFILE) {
253                         return ICON_FILE_BLEND;
254                 }
255                 return ICON_FILE_FOLDER;
256         }
257         else if (file->flags & BLENDERFILE)
258                 return ICON_FILE_BLEND;
259         else if (file->flags & BLENDERFILE_BACKUP)
260                 return ICON_FILE_BLEND;
261         else if (file->flags & IMAGEFILE)
262                 return ICON_FILE_IMAGE;
263         else if (file->flags & MOVIEFILE)
264                 return ICON_FILE_MOVIE;
265         else if (file->flags & PYSCRIPTFILE)
266                 return ICON_FILE_SCRIPT;
267         else if (file->flags & SOUNDFILE) 
268                 return ICON_FILE_SOUND;
269         else if (file->flags & FTFONTFILE) 
270                 return ICON_FILE_FONT;
271         else if (file->flags & BTXFILE) 
272                 return ICON_FILE_BLANK;
273         else if (file->flags & COLLADAFILE) 
274                 return ICON_FILE_BLANK;
275         else
276                 return ICON_FILE_BLANK;
277 }
278
279 static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height)
280 {
281         uiBut *but;
282         int x,y;
283         /*float alpha=1.0f;*/
284         
285         x = sx;
286         y = sy-height;
287         
288         /*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
289
290         but = uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
291         uiButSetDragPath(but, path);
292 }
293
294
295 static void file_draw_string(int sx, int sy, const char* string, float width, int height, short align)
296 {
297         uiStyle *style= UI_GetStyle();
298         uiFontStyle fs = style->widgetlabel;
299         rcti rect;
300         char fname[FILE_MAXFILE];
301
302         fs.align = align;
303
304         BLI_strncpy(fname,string, FILE_MAXFILE);
305         file_shorten_string(fname, width + 1.0f, 0);
306
307         /* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */
308         rect.xmin = sx;
309         rect.xmax = (int)(sx + ceil(width+4.0f));
310         rect.ymin = sy - height;
311         rect.ymax = sy;
312         
313         uiStyleFontDraw(&fs, &rect, fname);
314 }
315
316 void file_calc_previews(const bContext *C, ARegion *ar)
317 {
318         SpaceFile *sfile= CTX_wm_space_file(C);
319         View2D *v2d= &ar->v2d;
320         
321         ED_fileselect_init_layout(sfile, ar);
322         /* +SCROLL_HEIGHT is bad hack to work around issue in UI_view2d_totRect_set */
323         UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height+V2D_SCROLL_HEIGHT);
324 }
325
326 static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, short dropshadow)
327 {
328         if (imb) {
329                 uiBut *but;
330                 float fx, fy;
331                 float dx, dy;
332                 int xco, yco;
333                 float scaledx, scaledy;
334                 float scale;
335                 int ex, ey;
336                 
337                 if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
338                         if (imb->x > imb->y) {
339                                 scaledx = (float)layout->prv_w;
340                                 scaledy =  ( (float)imb->y/(float)imb->x )*layout->prv_w;
341                                 scale = scaledx/imb->x;
342                         }
343                         else {
344                                 scaledy = (float)layout->prv_h;
345                                 scaledx =  ( (float)imb->x/(float)imb->y )*layout->prv_h;
346                                 scale = scaledy/imb->y;
347                         }
348                 }
349                 else {
350                         scaledx = (float)imb->x;
351                         scaledy = (float)imb->y;
352                         scale = 1.0;
353                 }
354                 ex = (int)scaledx;
355                 ey = (int)scaledy;
356                 fx = ((float)layout->prv_w - (float)ex)/2.0f;
357                 fy = ((float)layout->prv_h - (float)ey)/2.0f;
358                 dx = (fx + 0.5f + layout->prv_border_x);
359                 dy = (fy + 0.5f - layout->prv_border_y);
360                 xco = sx + (int)dx;
361                 yco = sy - layout->prv_h + (int)dy;
362                 
363                 glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);
364                 
365                 /* shadow */
366                 if (dropshadow)
367                         uiDrawBoxShadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
368
369                 glEnable(GL_BLEND);
370                 
371                 /* the image */
372                 glColor4f(1.0, 1.0, 1.0, 1.0);
373                 glaDrawPixelsTexScaled((float)xco, (float)yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale);
374                 
375                 /* border */
376                 if (dropshadow) {
377                         glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
378                         fdrawbox((float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
379                 }
380                 
381                 /* dragregion */
382                 but = uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
383                 uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale);
384                 
385                 glDisable(GL_BLEND);
386                 imb = NULL;
387         }
388 }
389
390 static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
391 {
392         char newname[FILE_MAX+12];
393         char orgname[FILE_MAX+12];
394         char filename[FILE_MAX+12];
395         SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
396         ARegion* ar = CTX_wm_region(C);
397
398         BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
399         BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
400         BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
401
402         if ( strcmp(orgname, newname) != 0 ) {
403                 if (!BLI_exists(newname)) {
404                         BLI_rename(orgname, newname);
405                         /* to make sure we show what is on disk */
406                         ED_fileselect_clear(C, sfile);
407                 }
408
409                 ED_region_tag_redraw(ar);
410         }
411 }
412
413
414 static void draw_background(FileLayout *layout, View2D *v2d)
415 {
416         int i;
417         int sy;
418
419         /* alternating flat shade background */
420         for (i=0; (i <= layout->rows); i+=2) {
421                 sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
422
423                 UI_ThemeColorShade(TH_BACK, -7);
424                 glRectf(v2d->cur.xmin, (float)sy, v2d->cur.xmax, (float)(sy+layout->tile_h+2*layout->tile_border_y));
425                 
426         }
427 }
428
429 static void draw_dividers(FileLayout *layout, View2D *v2d)
430 {
431         int sx;
432
433         /* vertical column dividers */
434         sx = (int)v2d->tot.xmin;
435         while (sx < v2d->cur.xmax) {
436                 sx += (layout->tile_w+2*layout->tile_border_x);
437                 
438                 UI_ThemeColorShade(TH_BACK, 30);
439                 sdrawline(sx+1, (short)(v2d->cur.ymax - layout->tile_border_y),  sx+1,  (short)v2d->cur.ymin); 
440                 UI_ThemeColorShade(TH_BACK, -30);
441                 sdrawline(sx, (short)(v2d->cur.ymax - layout->tile_border_y),  sx,  (short)v2d->cur.ymin); 
442         }
443 }
444
445 void file_draw_list(const bContext *C, ARegion *ar)
446 {
447         SpaceFile *sfile= CTX_wm_space_file(C);
448         FileSelectParams* params = ED_fileselect_get_params(sfile);
449         FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
450         View2D *v2d= &ar->v2d;
451         struct FileList* files = sfile->files;
452         struct direntry *file;
453         ImBuf *imb;
454         uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
455         int numfiles;
456         int numfiles_layout;
457         int sx, sy;
458         int offset;
459         int textwidth, textheight;
460         int i;
461         short is_icon;
462         short align;
463
464
465         numfiles = filelist_numfiles(files);
466         
467         if (params->display != FILE_IMGDISPLAY) {
468
469                 draw_background(layout, v2d);
470         
471                 draw_dividers(layout, v2d);
472         }
473
474         offset = ED_fileselect_layout_offset(layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
475         if (offset<0) offset=0;
476
477         numfiles_layout = ED_fileselect_layout_numfiles(layout, ar);
478
479         /* adjust, so the next row is already drawn when scrolling */
480         if (layout->flag & FILE_LAYOUT_HOR) {
481                 numfiles_layout += layout->rows;
482         }
483         else {
484                 numfiles_layout += layout->columns;
485         }
486
487         textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : (int)layout->column_widths[COLUMN_NAME];
488         textheight = (int)(layout->textheight*3.0/2.0 + 0.5);
489
490         align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
491
492         for (i = offset; (i < numfiles) && (i<offset+numfiles_layout); i++) {
493                 ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
494                 sx += (int)(v2d->tot.xmin+2.0f);
495                 sy = (int)(v2d->tot.ymax - sy);
496
497                 file = filelist_file(files, i); 
498                 
499                 UI_ThemeColor4(TH_TEXT);
500
501
502                 if (!(file->selflag & EDITING_FILE)) {
503                         if ((params->active_file == i) || (file->selflag & HILITED_FILE) || (file->selflag & SELECTED_FILE)) {
504                                 int colorid = (file->selflag & SELECTED_FILE) ? TH_HILITE : TH_BACK;
505                                 int shade = (params->active_file == i) || (file->selflag & HILITED_FILE) ? 20 : 0;
506                                 draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade);
507                         }
508                 }
509                 uiSetRoundBox(UI_CNR_NONE);
510
511                 if ( FILE_IMGDISPLAY == params->display ) {
512                         is_icon = 0;
513                         imb = filelist_getimage(files, i);
514                         if (!imb) {
515                                 imb = filelist_geticon(files,i);
516                                 is_icon = 1;
517                         }
518                         
519                         file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
520                 }
521                 else {
522                         file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
523                         sx += ICON_DEFAULT_WIDTH_SCALE + 4;
524                 }
525
526                 UI_ThemeColor4(TH_TEXT);
527
528                 if (file->selflag & EDITING_FILE) {
529                         uiBut *but = uiDefBut(block, TEX, 1, "", sx , sy-layout->tile_h-3, 
530                                 textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
531                         uiButSetRenameFunc(but, renamebutton_cb, file);
532                         uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
533                         uiButClearFlag(but, UI_BUT_UNDO);
534                         if ( 0 == uiButActiveOnly(C, block, but)) {
535                                 file->selflag &= ~EDITING_FILE;
536                         }
537                 }
538
539                 if (!(file->selflag & EDITING_FILE)) {
540                         int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy;
541                         file_draw_string(sx+1, tpos, file->relname, (float)textwidth, textheight, align);
542                 }
543
544                 if (params->display == FILE_SHORTDISPLAY) {
545                         sx += (int)layout->column_widths[COLUMN_NAME] + 12;
546                         if (!(file->type & S_IFDIR)) {
547                                 file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);        
548                                 sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
549                         }
550                 }
551                 else if (params->display == FILE_LONGDISPLAY) {
552                         sx += (int)layout->column_widths[COLUMN_NAME] + 12;
553
554 #ifndef WIN32
555                         /* rwx rwx rwx */
556                         file_draw_string(sx, sy, file->mode1, layout->column_widths[COLUMN_MODE1], layout->tile_h, align); 
557                         sx += layout->column_widths[COLUMN_MODE1] + 12;
558
559                         file_draw_string(sx, sy, file->mode2, layout->column_widths[COLUMN_MODE2], layout->tile_h, align);
560                         sx += layout->column_widths[COLUMN_MODE2] + 12;
561
562                         file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
563                         sx += layout->column_widths[COLUMN_MODE3] + 12;
564
565                         file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER] , layout->tile_h, align);
566                         sx += layout->column_widths[COLUMN_OWNER] + 12;
567 #endif
568
569                         file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
570                         sx += (int)layout->column_widths[COLUMN_DATE] + 12;
571
572                         file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME] , layout->tile_h, align); 
573                         sx += (int)layout->column_widths[COLUMN_TIME] + 12;
574
575                         if (!(file->type & S_IFDIR)) {
576                                 file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
577                                 sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
578                         }
579                 }
580         }
581
582         uiEndBlock(C, block);
583         uiDrawBlock(C, block);
584
585 }