[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56653] trunk/blender/source/blender/ editors/space_file/file_draw.c: Fix #35261: double clicking the up arrow in the file browser to go up multiple
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri May 10 14:16:12 CEST 2013
Revision: 56653
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56653
Author: blendix
Date: 2013-05-10 12:16:12 +0000 (Fri, 10 May 2013)
Log Message:
-----------
Fix #35261: double clicking the up arrow in the file browser to go up multiple
directories fast would start drag and drop. Disabled drag on those items now.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_file/file_draw.c
Modified: trunk/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_draw.c 2013-05-10 12:06:40 UTC (rev 56652)
+++ trunk/blender/source/blender/editors/space_file/file_draw.c 2013-05-10 12:16:12 UTC (rev 56653)
@@ -280,7 +280,7 @@
return ICON_FILE_BLANK;
}
-static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height)
+static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height, bool drag)
{
uiBut *but;
int x, y;
@@ -292,7 +292,9 @@
/*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
but = uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
- uiButSetDragPath(but, path);
+
+ if (drag)
+ uiButSetDragPath(but, path);
}
@@ -326,7 +328,7 @@
UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height);
}
-static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, short dropshadow)
+static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, bool dropshadow, bool drag)
{
if (imb) {
uiBut *but;
@@ -385,8 +387,10 @@
}
/* dragregion */
- but = uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
- uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale);
+ if (drag) {
+ but = uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
+ uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale);
+ }
glDisable(GL_BLEND);
}
@@ -466,6 +470,7 @@
int i;
short is_icon;
short align;
+ bool do_drag;
int column_space = 0.6f * UI_UNIT_X;
numfiles = filelist_numfiles(files);
@@ -514,6 +519,9 @@
}
uiSetRoundBox(UI_CNR_NONE);
+ /* don't drag parent or refresh items */
+ do_drag = !(STREQ(file->relname, "..") || STREQ(file->relname, "."));
+
if (FILE_IMGDISPLAY == params->display) {
is_icon = 0;
imb = filelist_getimage(files, i);
@@ -522,10 +530,10 @@
is_icon = 1;
}
- file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
+ file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE), do_drag);
}
else {
- file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
+ file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE, do_drag);
sx += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X;
}
More information about the Bf-blender-cvs
mailing list