Ver código fonte

Update Textmode IDE to new mouse wheel event.

Margers 5 meses atrás
pai
commit
12599706e5

+ 1 - 1
packages/ide/fpdebug.pas

@@ -3257,7 +3257,7 @@ var DontClear: boolean;
 begin
   case Event.What of
     evMouseDown :
-      if Event.Double and ((Event.Buttons and (mbScrollUp or mbScrollDown))=0) {not scroll} then
+      if Event.Double then
         begin
           Message(@Self,evCommand,cmEdit,nil);
           ClearEvent(Event);

+ 2 - 4
packages/ide/fpsymbol.pas

@@ -749,7 +749,7 @@ begin
       end;
     evMouseDown :
       begin
-        if ((Event.buttons and (mbScrollUp or mbScrollDown))=0) and Event.double then
+        if Event.double then
           begin
             Browse;
             ClearEvent(Event);
@@ -1386,7 +1386,6 @@ begin
         if DontClear=false then ClearEvent(Event);
       end;
     evMouseDown :
-      if ((Event.buttons and (mbScrollUp or mbScrollDown))=0) then
       begin
 {$ifndef HASOUTLINE}
         MakeLocal(Event.Where,P);
@@ -1775,8 +1774,7 @@ end;
 begin
   case Event.What of
     evMouseDown :
-      if MouseInView(Event.Where)
-        and ((Event.buttons and (mbScrollUp or mbScrollDown))=0) then
+      if MouseInView(Event.Where) then
         begin
           repeat
             MakeLocal(Event.Where,P);

+ 6 - 6
packages/ide/fpviews.pas

@@ -3399,13 +3399,13 @@ procedure TMessageListBox.HandleEvent(var Event: TEvent);
 var DontClear: boolean;
 begin
   case Event.What of
-    evMouseDown: Begin                                 { Mouse down event }
-        if (Event.Buttons=mbScrollUp) then             { mouse scroll up}
+    evMouseWheel: Begin                                 { Mouse wheel event }
+        if (Event.Wheel=mwDown) then                    { Mouse scroll down }
           begin
             if Event.Double then ScrollTo(TopItem+7) else ScrollTo(TopItem+1);
             ClearEvent(Event);                         { Event was handled }
           end else
-        if (Event.Buttons=mbScrollDown) then           { mouse scroll down }
+        if (Event.Wheel=mwUp) then                     { Mouse scroll up }
           begin
             if Event.Double then ScrollTo(TopItem-7) else ScrollTo(TopItem-1);
             ClearEvent(Event);                         { Event was handled }
@@ -5008,8 +5008,8 @@ begin
         end;
         if not DontClear then ClearEvent(Event);
       end;
-    evMouseDown:
-      if (Event.Buttons=mbScrollUp) then { mouse scroll up}
+    evMouseWheel:
+      if (Event.Wheel=mwDown) then { Mouse scroll down }
         begin
           LinesScroll:=1;
           if Event.Double then LinesScroll:=LinesScroll+4;
@@ -5017,7 +5017,7 @@ begin
           ScrollTo(Delta.X,Min(Max(0,LineCount-Size.Y),Delta.Y+LinesScroll));
           ClearEvent(Event);
         end else
-      if (Event.Buttons=mbScrollDown) then  { mouse scroll down }
+      if (Event.Wheel=mwUp) then  { Mouse scroll up }
         begin
           LinesScroll:=-1;
           if Event.Double then LinesScroll:=LinesScroll-4;

+ 8 - 6
packages/ide/wviews.pas

@@ -1244,7 +1244,7 @@ begin
       begin
         eEvent:=Event; {save for later use after inherited call}
         inherited HandleEvent(Event);
-        if (eEvent.Double) and ((eEvent.Buttons and (mbScrollUp or mbScrollDown))=0) then
+        if eEvent.Double then
           if Range>Focused then
             SelectItem(Focused);
       end;
@@ -2391,7 +2391,7 @@ var Y : sw_word;
 begin
   inherited init (Bounds, AStrings);
   VScrollBar:=aVScrollBar;
-  EventMask := evMouseDown + evKeyDown + evCommand + evBroadcast;
+  EventMask := evMouseWheel + evMouseDown + evKeyDown + evCommand + evBroadcast;
   Y:=Strings.count;
   if (VScrollBar<> nil) and (Y>=size.Y) and (Size.Y>0) then
     VScrollBar^.SetParams(0, 0,Y-Size.Y, Size.Y-1, VScrollBar^.ArStep);       { Set vert scrollbar }
@@ -2403,21 +2403,23 @@ VAR I: Sw_Integer; Mouse: TPoint;
 begin
    If ((Options AND ofSelectable) <> 0) Then
    begin
-     If (Event.What = evMouseDown) Then Begin             { MOUSE EVENT }
-      if (Event.Buttons=mbScrollUp) then                  { mouse scroll up}
+     If (Event.What = evMouseWheel) Then Begin            { Mouse wheel event }
+       if (Event.Wheel=mwDown) then                       { Mouse scroll down }
          begin
            LinesScroll:=1;
            if Event.Double then LinesScroll:=LinesScroll+4;
            ScrollTo(Delta.X, Delta.Y + LinesScroll);
            ClearEvent(Event);                             { Event was handled }
          end else
-       if (Event.Buttons=mbScrollDown) then               { mouse scroll down }
+       if (Event.Wheel=mwUp) then                         { Mouse scroll up }
          begin
            LinesScroll:=-1;
            if Event.Double then LinesScroll:=LinesScroll-4;
            ScrollTo(Delta.X, Delta.Y + LinesScroll);
            ClearEvent(Event);                             { Event was handled }
-         end else
+         end;
+     end else
+     if (Event.What = evMouseDown) Then Begin             { Mouse down event }
        if (VScrollBar<>nil) then begin       { mouse click if we have scrollbar}
          MakeLocal(Event.Where, Mouse);                   { Make point local }
          I := FindSel(Mouse);                             { Find selected item }