[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48034] trunk/blender/source/blender/ editors/space_file: style cleanup
Campbell Barton
ideasman42 at gmail.com
Mon Jun 18 15:01:31 CEST 2012
Revision: 48034
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48034
Author: campbellbarton
Date: 2012-06-18 13:01:24 +0000 (Mon, 18 Jun 2012)
Log Message:
-----------
style cleanup
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_file/file_draw.c
trunk/blender/source/blender/editors/space_file/file_intern.h
trunk/blender/source/blender/editors/space_file/file_ops.c
trunk/blender/source/blender/editors/space_file/file_panels.c
trunk/blender/source/blender/editors/space_file/filelist.c
trunk/blender/source/blender/editors/space_file/filelist.h
trunk/blender/source/blender/editors/space_file/filesel.c
trunk/blender/source/blender/editors/space_file/fsmenu.c
trunk/blender/source/blender/editors/space_file/fsmenu.h
trunk/blender/source/blender/editors/space_file/space_file.c
Modified: trunk/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_draw.c 2012-06-18 12:49:05 UTC (rev 48033)
+++ trunk/blender/source/blender/editors/space_file/file_draw.c 2012-06-18 13:01:24 UTC (rev 48034)
@@ -71,7 +71,7 @@
#include "fsmenu.h"
#include "filelist.h"
-#include "file_intern.h" // own include
+#include "file_intern.h" // own include
/* button events */
enum {
@@ -109,8 +109,8 @@
{
/* Button layout. */
const int max_x = ar->winx - 10;
- const int line1_y = ar->winy - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
- const int line2_y = line1_y - (IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN);
+ const int line1_y = ar->winy - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
+ const int line2_y = line1_y - (IMASEL_BUTTONS_HEIGHT / 2 + IMASEL_BUTTONS_MARGIN);
const int input_minw = 20;
const int btn_h = UI_UNIT_Y;
const int btn_fn_w = UI_UNIT_X;
@@ -123,16 +123,16 @@
int loadbutton;
int fnumbuttons;
int min_x = 10;
- int chan_offs = 0;
+ int chan_offs = 0;
int available_w = max_x - min_x;
int line1_w = available_w;
int line2_w = available_w;
- uiBut* but;
- uiBlock* block;
- SpaceFile* sfile = CTX_wm_space_file(C);
- FileSelectParams* params = ED_fileselect_get_params(sfile);
- ARegion* artmp;
+ uiBut *but;
+ uiBlock *block;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ FileSelectParams *params = ED_fileselect_get_params(sfile);
+ ARegion *artmp;
/* Initialize UI block. */
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "win %p", (void *)ar);
@@ -140,7 +140,7 @@
uiBlockSetHandleFunc(block, do_file_buttons, NULL);
/* exception to make space for collapsed region icon */
- for (artmp=CTX_wm_area(C)->regionbase.first; artmp; artmp=artmp->next) {
+ for (artmp = CTX_wm_area(C)->regionbase.first; artmp; artmp = artmp->next) {
if (artmp->regiontype == RGN_TYPE_CHANNELS && artmp->flag & RGN_FLAG_HIDDEN) {
chan_offs = 16;
min_x += chan_offs;
@@ -152,7 +152,7 @@
loadbutton = UI_GetStringWidth(sfile->params->title) + btn_margin;
if (loadbutton < btn_minw) {
loadbutton = MAX2(btn_minw,
- btn_margin + UI_GetStringWidth(params->title));
+ btn_margin + UI_GetStringWidth(params->title));
}
if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) {
@@ -174,12 +174,12 @@
/* Text input fields for directory and file. */
if (available_w > 0) {
- int overwrite_alert= file_draw_check_exists(sfile);
+ int overwrite_alert = file_draw_check_exists(sfile);
/* callbacks for operator check functions */
uiBlockSetFunc(block, file_draw_check_cb, NULL, NULL);
but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "",
- min_x, line1_y, line1_w-chan_offs, btn_h,
+ min_x, line1_y, line1_w - chan_offs, btn_h,
params->dir, 0.0, (float)FILE_MAX, 0, 0,
TIP_("File path"));
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
@@ -187,9 +187,9 @@
if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
- min_x, line2_y, line2_w-chan_offs, btn_h,
+ min_x, line2_y, line2_w - chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
- TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
+ TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name")));
uiButSetCompleteFunc(but, autocomplete_file, NULL);
uiButSetFlag(but, UI_BUT_NO_UTF8);
uiButClearFlag(but, UI_BUT_UNDO); /* operator button above does this automatic */
@@ -246,8 +246,8 @@
static int get_file_icon(struct direntry *file)
{
if (file->type & S_IFDIR) {
- if ( strcmp(file->relname, "..") == 0) {
- return ICON_FILE_PARENT;
+ if (strcmp(file->relname, "..") == 0) {
+ return ICON_FILE_PARENT;
}
if (file->flags & BLENDERFILE) {
return ICON_FILE_BLEND;
@@ -283,7 +283,7 @@
/*float alpha=1.0f;*/
x = sx;
- y = sy-height;
+ y = sy - height;
/*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
@@ -292,9 +292,9 @@
}
-static void file_draw_string(int sx, int sy, const char* string, float width, int height, short align)
+static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align)
{
- uiStyle *style= UI_GetStyle();
+ uiStyle *style = UI_GetStyle();
uiFontStyle fs = style->widgetlabel;
rcti rect;
char fname[FILE_MAXFILE];
@@ -306,7 +306,7 @@
/* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */
rect.xmin = sx;
- rect.xmax = (int)(sx + ceil(width+4.0f));
+ rect.xmax = (int)(sx + ceil(width + 4.0f));
rect.ymin = sy - height;
rect.ymax = sy;
@@ -315,12 +315,12 @@
void file_calc_previews(const bContext *C, ARegion *ar)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- View2D *v2d= &ar->v2d;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ View2D *v2d = &ar->v2d;
ED_fileselect_init_layout(sfile, ar);
/* +SCROLL_HEIGHT is bad hack to work around issue in UI_view2d_totRect_set */
- UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height+V2D_SCROLL_HEIGHT);
+ UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height + V2D_SCROLL_HEIGHT);
}
static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, short dropshadow)
@@ -337,13 +337,13 @@
if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
if (imb->x > imb->y) {
scaledx = (float)layout->prv_w;
- scaledy = ( (float)imb->y/(float)imb->x )*layout->prv_w;
- scale = scaledx/imb->x;
+ scaledy = ( (float)imb->y / (float)imb->x) * layout->prv_w;
+ scale = scaledx / imb->x;
}
else {
scaledy = (float)layout->prv_h;
- scaledx = ( (float)imb->x/(float)imb->y )*layout->prv_h;
- scale = scaledy/imb->y;
+ scaledx = ( (float)imb->x / (float)imb->y) * layout->prv_h;
+ scale = scaledy / imb->y;
}
}
else {
@@ -353,8 +353,8 @@
}
ex = (int)scaledx;
ey = (int)scaledy;
- fx = ((float)layout->prv_w - (float)ex)/2.0f;
- fy = ((float)layout->prv_h - (float)ey)/2.0f;
+ fx = ((float)layout->prv_w - (float)ex) / 2.0f;
+ 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 = sx + (int)dx;
@@ -389,17 +389,17 @@
static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
{
- char newname[FILE_MAX+12];
- char orgname[FILE_MAX+12];
- char filename[FILE_MAX+12];
- SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
- ARegion* ar = CTX_wm_region(C);
+ char newname[FILE_MAX + 12];
+ char orgname[FILE_MAX + 12];
+ char filename[FILE_MAX + 12];
+ SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C);
+ ARegion *ar = CTX_wm_region(C);
BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname);
BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
- if ( strcmp(orgname, newname) != 0 ) {
+ if (strcmp(orgname, newname) != 0) {
if (!BLI_exists(newname)) {
BLI_rename(orgname, newname);
/* to make sure we show what is on disk */
@@ -417,11 +417,11 @@
int sy;
/* alternating flat shade background */
- for (i=0; (i <= layout->rows); i+=2) {
- sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
+ for (i = 0; (i <= layout->rows); i += 2) {
+ 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, (float)sy, v2d->cur.xmax, (float)(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));
}
}
@@ -433,10 +433,10 @@
/* vertical column dividers */
sx = (int)v2d->tot.xmin;
while (sx < v2d->cur.xmax) {
- sx += (layout->tile_w+2*layout->tile_border_x);
+ sx += (layout->tile_w + 2 * layout->tile_border_x);
UI_ThemeColorShade(TH_BACK, 30);
- sdrawline(sx+1, (short)(v2d->cur.ymax - layout->tile_border_y), sx+1, (short)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, (short)(v2d->cur.ymax - layout->tile_border_y), sx, (short)v2d->cur.ymin);
}
@@ -444,11 +444,11 @@
void file_draw_list(const bContext *C, ARegion *ar)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
- FileSelectParams* params = ED_fileselect_get_params(sfile);
- FileLayout* layout= ED_fileselect_get_layout(sfile, ar);
- View2D *v2d= &ar->v2d;
- struct FileList* files = sfile->files;
+ SpaceFile *sfile = CTX_wm_space_file(C);
+ FileSelectParams *params = ED_fileselect_get_params(sfile);
+ FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
+ View2D *v2d = &ar->v2d;
+ struct FileList *files = sfile->files;
struct direntry *file;
ImBuf *imb;
uiBlock *block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
@@ -472,7 +472,7 @@
}
offset = ED_fileselect_layout_offset(layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
- if (offset<0) offset=0;
+ if (offset < 0) offset = 0;
numfiles_layout = ED_fileselect_layout_numfiles(layout, ar);
@@ -484,14 +484,14 @@
numfiles_layout += layout->columns;
}
- textwidth =( FILE_IMGDISPLAY == params->display) ? layout->tile_w : (int)layout->column_widths[COLUMN_NAME];
- textheight = (int)(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;
+ align = (FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
- for (i = offset; (i < numfiles) && (i<offset+numfiles_layout); i++) {
+ for (i = offset; (i < numfiles) && (i < offset + numfiles_layout); i++) {
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
- sx += (int)(v2d->tot.xmin+2.0f);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list