[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27324] trunk/blender/source/blender/ editors/interface/interface_handlers.c: Fix [#21469] long paths can' t be scrolled with the mouse
Matt Ebb
matt at mke3.net
Mon Mar 8 13:35:59 CET 2010
Revision: 27324
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27324
Author: broken
Date: 2010-03-08 13:35:59 +0100 (Mon, 08 Mar 2010)
Log Message:
-----------
Fix [#21469] long paths can't be scrolled with the mouse
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface_handlers.c
Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 2010-03-08 12:29:58 UTC (rev 27323)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2010-03-08 12:35:59 UTC (rev 27324)
@@ -1155,7 +1155,6 @@
origstr= MEM_callocN(sizeof(char)*data->maxlen, "ui_textedit origstr");
BLI_strncpy(origstr, but->drawstr, data->maxlen);
- but->pos= strlen(origstr)-but->ofs;
/* XXX solve generic */
if(but->type==NUM || but->type==NUMSLI)
@@ -1166,16 +1165,33 @@
startx += 16;
}
- /* XXX does not take zoom level into account */
- while((BLF_width(origstr+but->ofs) + startx) > x) {
- if (but->pos <= 0) break;
- but->pos--;
- origstr[but->pos+but->ofs] = 0;
+ /* mouse dragged outside the widget to the left */
+ if (x < startx && but->ofs > 0) {
+ int i= but->ofs;
+
+ origstr[but->ofs] = 0;
+
+ while (i > 0) {
+ i--;
+ if (BLF_width(origstr+i) > (startx - x)*0.25) break; // 0.25 == scale factor for less sensitivity
+ }
+ but->ofs = i;
+ but->pos = but->ofs;
}
+ /* mouse inside the widget */
+ else if (x >= startx) {
+ but->pos= strlen(origstr)-but->ofs;
+
+ /* XXX does not take zoom level into account */
+ while (startx + BLF_width(origstr+but->ofs) > x) {
+ if (but->pos <= 0) break;
+ but->pos--;
+ origstr[but->pos+but->ofs] = 0;
+ }
+ but->pos += but->ofs;
+ if(but->pos<0) but->pos= 0;
+ }
- but->pos += but->ofs;
- if(but->pos<0) but->pos= 0;
-
MEM_freeN(origstr);
}
More information about the Bf-blender-cvs
mailing list