[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27585] trunk/blender/source/blender/ editors: Fix [#20908] Box Select On File/Append Selects Too Many Files
Matt Ebb
matt at mke3.net
Thu Mar 18 05:10:00 CET 2010
Revision: 27585
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27585
Author: broken
Date: 2010-03-18 05:09:59 +0100 (Thu, 18 Mar 2010)
Log Message:
-----------
Fix [#20908] Box Select On File/Append Selects Too Many Files
Modified Paths:
--------------
trunk/blender/source/blender/editors/include/ED_fileselect.h
trunk/blender/source/blender/editors/space_file/file_draw.c
trunk/blender/source/blender/editors/space_file/file_ops.c
trunk/blender/source/blender/editors/space_file/filesel.c
Modified: trunk/blender/source/blender/editors/include/ED_fileselect.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_fileselect.h 2010-03-18 01:26:56 UTC (rev 27584)
+++ trunk/blender/source/blender/editors/include/ED_fileselect.h 2010-03-18 04:09:59 UTC (rev 27585)
@@ -83,7 +83,7 @@
FileLayout* ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar);
int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar);
-int ED_fileselect_layout_offset(FileLayout* layout, int x, int y);
+int ED_fileselect_layout_offset(FileLayout* layout, int clamp_bounds, int x, int y);
void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y);
Modified: trunk/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_draw.c 2010-03-18 01:26:56 UTC (rev 27584)
+++ trunk/blender/source/blender/editors/space_file/file_draw.c 2010-03-18 04:09:59 UTC (rev 27585)
@@ -518,7 +518,7 @@
draw_dividers(layout, v2d);
}
- offset = ED_fileselect_layout_offset(layout, ar->v2d.cur.xmin, -ar->v2d.cur.ymax);
+ offset = ED_fileselect_layout_offset(layout, 0, ar->v2d.cur.xmin, -ar->v2d.cur.ymax);
if (offset<0) offset=0;
numfiles_layout = ED_fileselect_layout_numfiles(layout, ar);
Modified: trunk/blender/source/blender/editors/space_file/file_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_ops.c 2010-03-18 01:26:56 UTC (rev 27584)
+++ trunk/blender/source/blender/editors/space_file/file_ops.c 2010-03-18 04:09:59 UTC (rev 27585)
@@ -69,7 +69,7 @@
/* ---------- FILE SELECTION ------------ */
-static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, int x, int y)
+static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, int clamp_bounds, int x, int y)
{
float fx,fy;
int active_file = -1;
@@ -77,7 +77,7 @@
UI_view2d_region_to_view(v2d, x, y, &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, clamp_bounds, v2d->tot.xmin + fx, v2d->tot.ymax - fy);
return active_file;
}
@@ -138,10 +138,10 @@
// FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
int numfiles = filelist_numfiles(sfile->files);
-
+
params->selstate = NOTACTIVE;
- first_file = find_file_mouse(sfile, ar, rect->xmin, rect->ymax);
- last_file = find_file_mouse(sfile, ar, rect->xmax, rect->ymin);
+ first_file = find_file_mouse(sfile, ar, 1, rect->xmin, rect->ymax);
+ last_file = find_file_mouse(sfile, ar, 1, rect->xmax, rect->ymin);
clamp_to_filelist(numfiles, &first_file, &last_file);
@@ -206,10 +206,9 @@
static int file_border_select_exec(bContext *C, wmOperator *op)
{
ARegion *ar= CTX_wm_region(C);
- SpaceFile *sfile= CTX_wm_space_file(C);
short selecting;
rcti rect;
-
+
selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
rect.xmin= RNA_int_get(op->ptr, "xmin");
rect.ymin= RNA_int_get(op->ptr, "ymin");
@@ -452,7 +451,7 @@
my -= ar->winrct.ymin;
if(BLI_in_rcti(&ar->v2d.mask, mx, my)) {
- actfile = find_file_mouse(sfile, ar, mx , my);
+ actfile = find_file_mouse(sfile, ar, 0, mx , my);
if((actfile >= 0) && (actfile < numfiles))
params->active_file=actfile;
@@ -662,8 +661,6 @@
int file_refresh_exec(bContext *C, wmOperator *unused)
{
- SpaceFile *sfile= CTX_wm_space_file(C);
-
file_change_dir(C, 1);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
Modified: trunk/blender/source/blender/editors/space_file/filesel.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filesel.c 2010-03-18 01:26:56 UTC (rev 27584)
+++ trunk/blender/source/blender/editors/space_file/filesel.c 2010-03-18 04:09:59 UTC (rev 27585)
@@ -220,7 +220,7 @@
}
}
-int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
+int ED_fileselect_layout_offset(FileLayout* layout, int clamp_bounds, int x, int y)
{
int offsetx, offsety;
int active_file;
@@ -231,9 +231,14 @@
offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
- if (offsetx > layout->columns-1) return -1 ;
- if (offsety > layout->rows-1) return -1 ;
-
+ if (clamp_bounds) {
+ CLAMP(offsetx, 0, layout->columns-1);
+ CLAMP(offsety, 0, layout->rows-1);
+ } else {
+ if (offsetx > layout->columns-1) return -1 ;
+ if (offsety > layout->rows-1) return -1 ;
+ }
+
if (layout->flag & FILE_LAYOUT_HOR)
active_file = layout->rows*offsetx + offsety;
else
More information about the Bf-blender-cvs
mailing list