diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-10 13:37:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-10 13:37:04 +0400 |
commit | 1c6956a4d6b15ddca3588f1838d3b9903e7239af (patch) | |
tree | c8aee4e95b584f4c6f5a46a8a44d1ebcd491ab6b /source/blender/editors/space_file | |
parent | 2d677efb3b52814d5b96f1aa496d75083187b3fe (diff) |
quiet msvc/mingw compiler warnings.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 63 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 34 |
3 files changed, 50 insertions, 51 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 22bf99053e8..bf7501ae5ce 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -243,8 +243,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar) static void draw_tile(int sx, int sy, int width, int height, int colorid, int shade) { UI_ThemeColorShade(colorid, shade); - uiSetRoundBox(15); - uiRoundBox(sx, sy - height, sx + width, sy, 5); + uiSetRoundBox(15); + uiRoundBox((float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f); } @@ -286,15 +286,15 @@ static int get_file_icon(struct direntry *file) static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height) { uiBut *but; - float x,y; + int x,y; /*float alpha=1.0f;*/ - x = (float)(sx); - y = (float)(sy-height); + x = sx; + y = sy-height; /*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/ - - but= uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0, 0.0, 0, 0, ""); + + but= uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, ""); uiButSetDragPath(but, path); } @@ -313,7 +313,7 @@ static void file_draw_string(int sx, int sy, const char* string, float width, in /* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */ rect.xmin = sx; - rect.xmax = sx + ceil(width+4.0f); + rect.xmax = (int)(sx + ceil(width+4.0f)); rect.ymin = sy - height; rect.ymax = sy; @@ -363,25 +363,25 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int fy = ((float)layout->prv_h - (float)ey)/2.0f; dx = (fx + 0.5f + layout->prv_border_x); dy = (fy + 0.5f - layout->prv_border_y); - xco = (float)sx + dx; - yco = (float)sy - layout->prv_h + dy; + xco = sx + (int)dx; + yco = sy - layout->prv_h + (int)dy; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* shadow */ if (dropshadow) - uiDrawBoxShadow(220, xco, yco, xco + ex, yco + ey); - + uiDrawBoxShadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey)); + glEnable(GL_BLEND); /* the image */ glColor4f(1.0, 1.0, 1.0, 1.0); - glaDrawPixelsTexScaled(xco, yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale); + glaDrawPixelsTexScaled((float)xco, (float)yco, imb->x, imb->y, GL_UNSIGNED_BYTE, imb->rect, scale, scale); /* border */ if (dropshadow) { glColor4f(0.0f, 0.0f, 0.0f, 0.4f); - fdrawbox(xco, yco, xco + ex, yco + ey); + fdrawbox((float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey)); } /* dragregion */ @@ -425,10 +425,10 @@ static void draw_background(FileLayout *layout, View2D *v2d) /* alternating flat shade background */ for (i=0; (i <= layout->rows); i+=2) { - sy = v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y; + sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y; UI_ThemeColorShade(TH_BACK, -7); - glRectf(v2d->cur.xmin, sy, v2d->cur.xmax, sy+layout->tile_h+2*layout->tile_border_y); + glRectf(v2d->cur.xmin, (float)sy, v2d->cur.xmax, (float)(sy+layout->tile_h+2*layout->tile_border_y)); } } @@ -438,14 +438,14 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) int sx; /* vertical column dividers */ - sx = v2d->tot.xmin; + sx = (int)v2d->tot.xmin; while (sx < v2d->cur.xmax) { sx += (layout->tile_w+2*layout->tile_border_x); UI_ThemeColorShade(TH_BACK, 30); - sdrawline(sx+1, v2d->cur.ymax - layout->tile_border_y , sx+1, v2d->cur.ymin); + sdrawline(sx+1, (short)(v2d->cur.ymax - layout->tile_border_y), sx+1, (short)v2d->cur.ymin); UI_ThemeColorShade(TH_BACK, -30); - sdrawline(sx, v2d->cur.ymax - layout->tile_border_y , sx, v2d->cur.ymin); + sdrawline(sx, (short)(v2d->cur.ymax - layout->tile_border_y), sx, (short)v2d->cur.ymin); } } @@ -478,7 +478,7 @@ void file_draw_list(const bContext *C, ARegion *ar) draw_dividers(layout, v2d); } - offset = ED_fileselect_layout_offset(layout, ar->v2d.cur.xmin, -ar->v2d.cur.ymax); + offset = ED_fileselect_layout_offset(layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax); if (offset<0) offset=0; numfiles_layout = ED_fileselect_layout_numfiles(layout, ar); @@ -490,16 +490,16 @@ void file_draw_list(const bContext *C, ARegion *ar) numfiles_layout += layout->columns; } - textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : layout->column_widths[COLUMN_NAME]; - textheight = layout->textheight*3.0/2.0 + 0.5; + textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : (int)layout->column_widths[COLUMN_NAME]; + textheight = (int)(layout->textheight*3.0/2.0 + 0.5); align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT; for (i=offset; (i < numfiles) && (i<offset+numfiles_layout); ++i) { ED_fileselect_layout_tilepos(layout, i, &sx, &sy); - sx += v2d->tot.xmin+2; - sy = v2d->tot.ymax - sy; + sx += (int)(v2d->tot.xmin+2.0f); + sy = (int)(v2d->tot.ymax - sy); file = filelist_file(files, i); @@ -543,17 +543,17 @@ void file_draw_list(const bContext *C, ARegion *ar) if (!(file->selflag & EDITING_FILE)) { int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy; - file_draw_string(sx+1, tpos, file->relname, textwidth, textheight, align); + file_draw_string(sx+1, tpos, file->relname, (float)textwidth, textheight, align); } if (params->display == FILE_SHORTDISPLAY) { - sx += layout->column_widths[COLUMN_NAME] + 12; + sx += (int)layout->column_widths[COLUMN_NAME] + 12; if (!(file->type & S_IFDIR)) { file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align); - sx += layout->column_widths[COLUMN_SIZE] + 12; + sx += (int)layout->column_widths[COLUMN_SIZE] + 12; } } else if (params->display == FILE_LONGDISPLAY) { - sx += layout->column_widths[COLUMN_NAME] + 12; + sx += (int)layout->column_widths[COLUMN_NAME] + 12; #ifndef WIN32 /* rwx rwx rwx */ @@ -571,14 +571,14 @@ void file_draw_list(const bContext *C, ARegion *ar) #endif file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align); - sx += layout->column_widths[COLUMN_DATE] + 12; + sx += (int)layout->column_widths[COLUMN_DATE] + 12; file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME] , layout->tile_h, align); - sx += layout->column_widths[COLUMN_TIME] + 12; + sx += (int)layout->column_widths[COLUMN_TIME] + 12; if (!(file->type & S_IFDIR)) { file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align); - sx += layout->column_widths[COLUMN_SIZE] + 12; + sx += (int)layout->column_widths[COLUMN_SIZE] + 12; } } } @@ -587,4 +587,3 @@ void file_draw_list(const bContext *C, ARegion *ar) uiDrawBlock(C, block); } - diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 36738e42d0e..775f06ea7a4 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -523,7 +523,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) UI_view2d_region_to_view(v2d, mx, my, &fx, &fy); - active_file = ED_fileselect_layout_offset(sfile->layout, v2d->tot.xmin + fx, v2d->tot.ymax - fy); + active_file = ED_fileselect_layout_offset(sfile->layout, (int)(v2d->tot.xmin + fx), (int)(v2d->tot.ymax - fy)); if((active_file >= 0) && (active_file < numfiles)) params->active_file=active_file; @@ -906,7 +906,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent return OPERATOR_PASS_THROUGH; } - offset = ED_fileselect_layout_offset(sfile->layout, ar->v2d.cur.xmin, -ar->v2d.cur.ymax); + offset = ED_fileselect_layout_offset(sfile->layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax); if (offset<0) offset=0; /* scroll offset is the first file in the row/column we are editing in */ diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index d0cae134ef9..ea3512b456d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -248,11 +248,11 @@ int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar) if (layout->flag & FILE_LAYOUT_HOR) { int width = (int)(ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*layout->tile_border_x); - numfiles = (float)width/(float)layout->tile_w + 0.5f; + numfiles = (int)((float)width / (float)layout->tile_w + 0.5f); return numfiles*layout->rows; } else { - int height = ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2*layout->tile_border_y; - numfiles = (float)height/(float)layout->tile_h + 0.5f; + int height = (int)(ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2*layout->tile_border_y); + numfiles = (int)((float)height/(float)layout->tile_h + 0.5f); return numfiles*layout->columns; } } @@ -423,7 +423,7 @@ static void column_widths(struct FileList* files, struct FileLayout* layout) { struct direntry* file = filelist_file(files, i); if (file) { - int len; + float len; len = file_string_width(file->relname); if (len > layout->column_widths[COLUMN_NAME]) layout->column_widths[COLUMN_NAME] = len; len = file_string_width(file->date); @@ -460,7 +460,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) if (!sfile->layout->dirty) return; numfiles = filelist_numfiles(sfile->files); - textheight = file_font_pointsize(); + textheight = (int)file_font_pointsize(); layout = sfile->layout; layout->textheight = textheight; @@ -473,7 +473,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) layout->prv_border_y = 6; layout->tile_w = layout->prv_w + 2*layout->prv_border_x; layout->tile_h = layout->prv_h + 2*layout->prv_border_y + textheight; - layout->width= (v2d->cur.xmax - v2d->cur.xmin - 2*layout->tile_border_x); + layout->width= (int)(v2d->cur.xmax - v2d->cur.xmin - 2*layout->tile_border_x); layout->columns= layout->width / (layout->tile_w + 2*layout->tile_border_x); if(layout->columns > 0) layout->rows= numfiles/layout->columns + 1; // XXX dirty, modulo is zero @@ -491,27 +491,27 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar) layout->prv_border_x = 0; layout->prv_border_y = 0; layout->tile_h = textheight*3/2; - layout->height= v2d->cur.ymax - v2d->cur.ymin - 2*layout->tile_border_y; + layout->height= (int)(v2d->cur.ymax - v2d->cur.ymin - 2*layout->tile_border_y); layout->rows = layout->height / (layout->tile_h + 2*layout->tile_border_y); column_widths(sfile->files, layout); if (params->display == FILE_SHORTDISPLAY) { maxlen = ICON_DEFAULT_WIDTH + 4 + - layout->column_widths[COLUMN_NAME] + 12 + - layout->column_widths[COLUMN_SIZE] + 12; + (int)layout->column_widths[COLUMN_NAME] + 12 + + (int)layout->column_widths[COLUMN_SIZE] + 12; } else { maxlen = ICON_DEFAULT_WIDTH + 4 + - layout->column_widths[COLUMN_NAME] + 12 + + (int)layout->column_widths[COLUMN_NAME] + 12 + #ifndef WIN32 - layout->column_widths[COLUMN_MODE1] + 12 + - layout->column_widths[COLUMN_MODE2] + 12 + - layout->column_widths[COLUMN_MODE3] + 12 + - layout->column_widths[COLUMN_OWNER] + 12 + + (int)layout->column_widths[COLUMN_MODE1] + 12 + + (int)layout->column_widths[COLUMN_MODE2] + 12 + + (int)layout->column_widths[COLUMN_MODE3] + 12 + + (int)layout->column_widths[COLUMN_OWNER] + 12 + #endif - layout->column_widths[COLUMN_DATE] + 12 + - layout->column_widths[COLUMN_TIME] + 12 + - layout->column_widths[COLUMN_SIZE] + 12; + (int)layout->column_widths[COLUMN_DATE] + 12 + + (int)layout->column_widths[COLUMN_TIME] + 12 + + (int)layout->column_widths[COLUMN_SIZE] + 12; } layout->tile_w = maxlen; |