mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-21 15:17:40 +00:00
chore(windows): delete unused UnitDrawArrow.pas
This commit is contained in:
parent
99cc0f6360
commit
c6102eb75b
3 changed files with 0 additions and 79 deletions
|
|
@ -80,7 +80,6 @@ uses
|
|||
MessageIdentifiers in 'main\MessageIdentifiers.pas',
|
||||
kpsfile in '..\..\..\windows\src\global\delphi\general\kpsfile.pas',
|
||||
Keyman.UI.UframeCEFHost in '..\..\..\common\windows\delphi\chromium\Keyman.UI.UframeCEFHost.pas' {frameCEFHost},
|
||||
UnitDrawArrow in '..\..\..\windows\src\global\delphi\general\UnitDrawArrow.pas',
|
||||
klog in '..\..\..\windows\src\global\delphi\general\klog.pas',
|
||||
BitmapEditor in '..\common\delphi\components\BitmapEditor.pas',
|
||||
StringGridEditControlled in '..\common\delphi\components\StringGridEditControlled.pas',
|
||||
|
|
|
|||
|
|
@ -225,7 +225,6 @@
|
|||
<DCCReference Include="..\..\..\common\windows\delphi\chromium\Keyman.UI.UframeCEFHost.pas">
|
||||
<Form>frameCEFHost</Form>
|
||||
</DCCReference>
|
||||
<DCCReference Include="..\..\..\windows\src\global\delphi\general\UnitDrawArrow.pas"/>
|
||||
<DCCReference Include="..\..\..\windows\src\global\delphi\general\klog.pas"/>
|
||||
<DCCReference Include="..\common\delphi\components\BitmapEditor.pas"/>
|
||||
<DCCReference Include="..\common\delphi\components\StringGridEditControlled.pas"/>
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
unit UnitDrawArrow;
|
||||
|
||||
interface
|
||||
|
||||
uses Windows, Graphics;
|
||||
|
||||
procedure ArrowTo(Canvas: TCanvas; X, Y: Integer; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5); overload;
|
||||
procedure ArrowTo(Canvas: TCanvas; Point: TPoint; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5); overload;
|
||||
|
||||
implementation
|
||||
|
||||
uses Math, Classes, System.Types;
|
||||
|
||||
procedure ArrowTo(Canvas: TCanvas; X, Y: Integer; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5);
|
||||
begin
|
||||
ArrowTo(Canvas, Point(X,Y), bFill, nWidth, fTheta);
|
||||
end;
|
||||
|
||||
procedure ArrowTo(Canvas: TCanvas; Point: TPoint; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5);
|
||||
var
|
||||
pFrom, pBase: TPoint;
|
||||
aptPoly: array[0..2] of TPoint;
|
||||
vecLine, vecLeft: array[0..1] of Extended;
|
||||
fLength, th, ta: Extended;
|
||||
begin;
|
||||
// get from point
|
||||
MoveToEx(Canvas.Handle, 0, 0, @pFrom);
|
||||
|
||||
// set to point
|
||||
aptPoly[0].x := Point.x;
|
||||
aptPoly[0].y := Point.y;
|
||||
|
||||
// build the line vector
|
||||
vecLine[0] := aptPoly[0].x - pFrom.x;
|
||||
vecLine[1] := aptPoly[0].y - pFrom.y;
|
||||
|
||||
// build the arrow base vector - normal to the line
|
||||
vecLeft[0] := -vecLine[1];
|
||||
vecLeft[1] := vecLine[0];
|
||||
|
||||
// setup length parameters
|
||||
fLength := sqrt(vecLine[0] * vecLine[0] + vecLine[1] * vecLine[1]);
|
||||
th := nWidth / (2.0 * fLength);
|
||||
ta := nWidth / (2.0 * (tan(fTheta) / 2.0) * fLength);
|
||||
|
||||
// find the base of the arrow
|
||||
pBase.x := Trunc(aptPoly[0].x + -ta * vecLine[0]);
|
||||
pBase.y := Trunc(aptPoly[0].y + -ta * vecLine[1]);
|
||||
|
||||
// build the points on the sides of the arrow
|
||||
aptPoly[1].x := Trunc(pBase.x + th * vecLeft[0]);
|
||||
aptPoly[1].y := Trunc(pBase.y + th * vecLeft[1]);
|
||||
aptPoly[2].x := Trunc(pBase.x + -th * vecLeft[0]);
|
||||
aptPoly[2].y := Trunc(pBase.y + -th * vecLeft[1]);
|
||||
|
||||
MoveToEx(Canvas.Handle, pFrom.x, pFrom.y, nil);
|
||||
|
||||
if bFill then
|
||||
begin
|
||||
// draw we're fillin'...
|
||||
LineTo(Canvas.Handle, aptPoly[0].x, aptPoly[0].y);
|
||||
Polygon(Canvas.Handle, aptPoly, 3);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// ... or even jes chillin'...
|
||||
LineTo(Canvas.Handle, pBase.x, pBase.y);
|
||||
LineTo(Canvas.Handle, aptPoly[1].x, aptPoly[1].y);
|
||||
LineTo(Canvas.Handle, aptPoly[0].x, aptPoly[0].y);
|
||||
LineTo(Canvas.Handle, aptPoly[2].x, aptPoly[2].y);
|
||||
LineTo(Canvas.Handle, pBase.x, pBase.y);
|
||||
MoveToEx(Canvas.Handle, aptPoly[0].x, aptPoly[0].y, nil);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Add table
Reference in a new issue