diff --git a/uppsrc/Core/StringFind.cpp b/uppsrc/Core/StringFind.cpp index a376a89e3..ef5f25abf 100644 --- a/uppsrc/Core/StringFind.cpp +++ b/uppsrc/Core/StringFind.cpp @@ -41,7 +41,7 @@ int t_find(const char *ptr, int slen, const char *p, int len, int from) int32 p0 = Peek32le(p); int32 p1 = Peek32le(p + len); while(s <= e) { - if(Peek32le(s) == p0 && Peek32le(s + len) == p1) + if((int32)Peek32le(s) == p0 && (int32)Peek32le(s + len) == p1) return (int)(s - ptr); s += step; } @@ -50,7 +50,7 @@ int t_find(const char *ptr, int slen, const char *p, int len, int from) if(len == 4) { int32 p0 = Peek32le(p); while(s <= e) { - if(Peek32le(s) == p0) + if((int32)Peek32le(s) == p0) return (int)(s - ptr); s += step; } @@ -60,7 +60,7 @@ int t_find(const char *ptr, int slen, const char *p, int len, int from) int16 p0 = Peek16le(p); char p1 = p[2]; while(s <= e) { - if(Peek16le(s) == p0 && s[2] == p1) + if((int16)Peek16le(s) == p0 && s[2] == p1) return (int)(s - ptr); s += step; } @@ -69,7 +69,7 @@ int t_find(const char *ptr, int slen, const char *p, int len, int from) if(len == 2) { int16 p0 = Peek16le(p); while(s <= e) { - if(Peek16le(s) == p0) + if((int16)Peek16le(s) == p0) return (int)(s - ptr); s += step; } @@ -93,21 +93,21 @@ int t_find(const char *ptr, int slen, const char *p, int len, int from) len -= 8; int64 p1 = Peek64le(p + len); while(s <= e) { - if(Peek64le(s) == p0 && Peek64le(s + len) == p1) + if((int64)Peek64le(s) == p0 && (int64)Peek64le(s + len) == p1) return (int)(s - ptr); s += step; } } else while(s <= e) { - if(Peek64le(s) == p0 && equal_back_8(s, p, len)) + if((int64)Peek64le(s) == p0 && equal_back_8(s, p, len)) return (int)(s - ptr); s += step; } #else int32 p0 = Peek32le(p); while(s <= e) { - if(Peek32le(s) == p0 && equal_back_4(s, p, len)) + if((int32)Peek32le(s) == p0 && equal_back_4(s, p, len)) return (int)(s - ptr); s += step; } diff --git a/uppsrc/CtrlLib/EditCtrl.h b/uppsrc/CtrlLib/EditCtrl.h index a59cb27e1..9ac7fdd19 100644 --- a/uppsrc/CtrlLib/EditCtrl.h +++ b/uppsrc/CtrlLib/EditCtrl.h @@ -381,6 +381,8 @@ private: SpinButtons sb; IncType inc; bool roundfrommin; + bool mousewheel = true; + bool keys = true; typedef WithSpin CLASSNAME; public: @@ -395,6 +397,12 @@ public: bool IsSpinVisible() const { return sb.IsVisible(); } WithSpin& RoundFromMin(bool b = true) { roundfrommin = b; return *this; } + + WithSpin& MouseWheelSpin(bool b = true){ mousewheel = b; return *this; } + WithSpin& NoMouseWheelSpin() { return MouseWheelSpin(false); } + + WithSpin& KeySpin(bool b = true) { keys = b; return *this; } + WithSpin& NoKeySpin() { return KeySpin(false); } SpinButtons& SpinButtonsObject() { return sb; } const SpinButtons& SpinButtonsObject() const { return sb; } @@ -489,13 +497,15 @@ void WithSpin::Dec() template bool WithSpin::Key(dword key, int repcnt) { - if(key == K_UP) { - Inc(); - return true; - } - if(key == K_DOWN) { - Dec(); - return true; + if(keys) { + if(key == K_UP) { + Inc(); + return true; + } + if(key == K_DOWN) { + Dec(); + return true; + } } return Base::Key(key, repcnt); } @@ -503,10 +513,12 @@ bool WithSpin::Key(dword key, int repcnt) template void WithSpin::MouseWheel(Point, int zdelta, dword) { - if(zdelta < 0) - Dec(); - else - Inc(); + if(mousewheel) { + if(zdelta < 0) + Dec(); + else + Inc(); + } } typedef WithSpin EditIntSpin; diff --git a/uppsrc/CtrlLib/src.tpp/WithSpin_en-us.tpp b/uppsrc/CtrlLib/src.tpp/WithSpin_en-us.tpp index 78cfba755..a29d306b2 100644 --- a/uppsrc/CtrlLib/src.tpp/WithSpin_en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/WithSpin_en-us.tpp @@ -1,5 +1,4 @@ topic "WithSpin template and Value editors with spin buttons"; -[2 $$0,0#00000000000000000000000000000000:Default] [i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] [l288;2 $$2,2#27521748481378242620020725143825:desc] [0 $$3,0#96390100711032703541132217272105:end] @@ -9,6 +8,7 @@ topic "WithSpin template and Value editors with spin buttons"; [l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] +[2 $$0,0#00000000000000000000000000000000:Default] [{_}%EN-US [ {{10000@(113.42.0) [s0; [*@7;4 WithSpin]]}}&] [s3;%- &] @@ -61,7 +61,7 @@ ool]_[*@3 s]_`=_[@(0.0.255) true])&] [s4; &] [s5;:WithSpin`:`:IsSpinVisible`(`)const:%- [@(0.0.255) bool]_[* IsSpinVisible]()_[@(0.0.255) c onst]&] -[s2; Returns true if spin buttes are shown.&] +[s2; Returns true if spin buttons are shown.&] [s3; &] [s4;%- &] [s5;:Upp`:`:WithSpin`:`:RoundFromMin`(bool`):%- [_^Upp`:`:WithSpin^ WithSpin][@(0.0.255) `& @@ -72,6 +72,29 @@ value is 3, going up from the minimum goes through values 3, 5, 10, ..., which when RoundFromMin is active, it goes through 3, 8, 13, ...&] [s3; &] +[s4;%- &] +[s5;:Upp`:`:WithSpin`:`:MouseWheelSpin`(bool`):%- [_^Upp`:`:WithSpin^ WithSpin][@(0.0.255) `& +]_[* MouseWheelSpin]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&] +[s2; If active, the value can be altered by mouse wheel `- rolling +the wheel is equivalent to pushing up/down arrows. Default is +active.&] +[s3; &] +[s4;%- &] +[s5;:Upp`:`:WithSpin`:`:NoMouseWheelSpin`(`):%- [_^Upp`:`:WithSpin^ WithSpin][@(0.0.255) `& +]_[* NoMouseWheelSpin]()&] +[s2; Same as MouseWheelSpin(false).&] +[s3;%- &] +[s4;%- &] +[s5;:Upp`:`:WithSpin`:`:KeySpin`(bool`):%- [_^Upp`:`:WithSpin^ WithSpin][@(0.0.255) `&]_[* K +eySpin]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&] +[s2; If active, the value can be altered with Up and Down keys. Default +is active.&] +[s3; &] +[s4;%- &] +[s5;:Upp`:`:WithSpin`:`:NoKeySpin`(`):%- [_^Upp`:`:WithSpin^ WithSpin][@(0.0.255) `&]_[* No +KeySpin]()&] +[s2; Same as KeySpin(false).&] +[s3;%- &] [s4; &] [s5;:WithSpin`:`:SpinButtonsObject`(`):%- [_^SpinButtons^ SpinButtons][@(0.0.255) `&]_[* Sp inButtonsObject]()&]