X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=Gesture.pas;h=75e7a52f3ba20cdd03ff9daeb1b22fb025369d15;hb=c9d418efda13d0e394ffa174957d77994188a183;hp=f2582695a54cfef5cf35020aa4bf3596aeddcdf2;hpb=f04512e7e97e47d1c90c5156ae8593ecbacf3f61;p=gikonavigoeson%2Fgikonavi.git diff --git a/Gesture.pas b/Gesture.pas index f258269..75e7a52 100644 --- a/Gesture.pas +++ b/Gesture.pas @@ -9,7 +9,7 @@ uses type TMouseGesture = class(TObject) private - FHook: Integer; + FHook: Cardinal; FHandle: THandle; FGestureItemList: TStringList; FBeginGesture: Boolean; @@ -25,7 +25,6 @@ type function CheckAction(Message: Integer; x, y: Integer): Boolean; procedure AddAction(sx, sy: Integer); function AddGesture(Item: string): Integer; - procedure ClearGesture; function Get(Index: integer): string; procedure Put(Index: integer; Item: string); public @@ -37,6 +36,7 @@ type property GestureCount: Integer read GetGestureCount; property Margin: Integer read FMargin write FMargin; function GetGestureStr: string; + procedure Clear; property OnGestureStart: TNotifyEvent read FOnGestureStart write FOnGestureStart; property OnGestureMove: TNotifyEvent read FOnGestureMove write FOnGestureMove; property OnGestureEnd: TNotifyEvent read FOnGestureEnd write FOnGestureEnd; @@ -49,6 +49,9 @@ var implementation +uses + GikoSystem; + constructor TMouseGesture.Create; begin inherited; @@ -62,7 +65,7 @@ end; destructor TMouseGesture.Destroy; begin UnHook; - ClearGesture; + Clear; FGestureItemList.Free; inherited; end; @@ -106,7 +109,6 @@ var dp: TPoint; sp: TPoint; hwnd: THandle; - r: LongBool; begin Result := False; case Message of @@ -117,8 +119,8 @@ begin //ƒ}ƒEƒXƒWƒFƒXƒ`ƒƒ[‚̑ΏۂƈႤ‚Æ‚«‚́AŠJ•ú‚·‚é if (hwnd <> 0) and (hwnd <> FHandle) then begin ReleaseCapture; + SetCapture(FHandle); end; - SetCapture(FHandle); dp := Point(x - FLastPoint.X, y - FLastPoint.Y); sp := Point(Sign(dp.X), Sign(dp.Y)); if (dp.X * dp.X + dp.Y * dp.Y) > (FMargin * FMargin) then begin @@ -131,11 +133,19 @@ begin FLastTime := GetTickCount; FLastPoint := Point(x, y); end; - Result := True; - end; + Result := True; + end; end; WM_RBUTTONDOWN: begin - if not FCancelMode then begin + if (not FCancelMode) then begin + if ( GikoSys.Setting.GestureIgnoreContext ) then begin + //¡ƒ}ƒEƒX‚ðƒLƒƒƒvƒ`ƒƒ[‚µ‚Ä‚¢‚é‚̂𓾂é + hwnd := GetCapture; + //ƒ}ƒEƒXƒWƒFƒXƒ`ƒƒ[‚̑ΏۂƈႤ‚Æ‚«‚́AŠJ•ú‚·‚é + if (hwnd <> 0) and (hwnd <> FHandle) then begin + Exit; + end; + end; FBeginGesture := True; FLastTime := 0; FLastPoint := Point(x, y); @@ -151,9 +161,11 @@ begin FBeginGesture := False; ReleaseCapture; if FGestureItemList.Count <> 0 then begin - if Assigned(FOnGestureEnd) then + if Assigned(FOnGestureEnd) then begin FOnGestureEnd(Self); - ClearGesture; + end else begin + Clear; + end; end else begin FCancelMode := True; //ƒWƒFƒXƒ`ƒƒ[‚¶‚á‚È‚©‚Á‚½ê‡Aƒ}ƒEƒXDOWN,UP‚ðƒGƒ~ƒ…ƒŒ[ƒg @@ -229,7 +241,7 @@ begin end; //ƒWƒFƒXƒ`ƒƒ[‚ðƒNƒŠƒA‚·‚é -procedure TMouseGesture.ClearGesture; +procedure TMouseGesture.Clear; begin FGestureItemList.Clear; end;