Browse Source

* editor mousewheel support patch from mantis #12081

git-svn-id: trunk@40832 -
marco 6 years ago
parent
commit
846c708df6
2 changed files with 19 additions and 3 deletions
  1. 6 3
      packages/fv/src/drivers.pas
  2. 13 0
      packages/ide/weditor.pas

+ 6 - 3
packages/fv/src/drivers.pas

@@ -229,9 +229,12 @@ CONST
 {                         MOUSE BUTTON STATE MASKS                          }
 {---------------------------------------------------------------------------}
 CONST
-   mbLeftButton   = $01;                              { Left mouse button }
-   mbRightButton  = $02;                              { Right mouse button }
-   mbMiddleButton = $04;                              { Middle mouse button }
+   mbLeftButton      = $01;                           { Left mouse button }
+   mbRightButton     = $02;                           { Right mouse button }
+   mbMiddleButton    = $04;                           { Middle mouse button }
+   mbScrollWheelDown = $08;                           { Scroll wheel down}
+   mbScrollWheelUp   = $10;                           { Scroll wheel up }
+
 
 {---------------------------------------------------------------------------}
 {                         SCREEN CRT MODE CONSTANTS                         }

+ 13 - 0
packages/ide/weditor.pas

@@ -3422,6 +3422,7 @@ var
   E: TEvent;
   OldEvent : PEvent;
   CCAction: TCCAction;
+  LinesScroll : sw_integer;
 begin
   CCAction:=ccClear;
   E:=Event;
@@ -3437,6 +3438,18 @@ begin
   case Event.What of
     evMouseDown :
       if MouseInView(Event.Where) then
+       if (Event.Buttons=mbScrollWheelUp) then { mouse scroll up}
+         begin
+           LinesScroll:=1;
+           if Event.Double then LinesScroll:=LinesScroll+4;
+           ScrollTo(Delta.X, Delta.Y + LinesScroll);
+         end else
+       if (Event.Buttons=mbScrollWheelDown) then  { mouse scroll down }
+         begin
+           LinesScroll:=-1;
+           if Event.Double then LinesScroll:=LinesScroll-4;
+           ScrollTo(Delta.X, Delta.Y + LinesScroll);
+         end else
        if (Event.Buttons=mbRightButton) then
          begin
            MakeLocal(Event.Where,P); Inc(P.X); Inc(P.Y);