mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 23:56:17 +02:00
MG: improved Clipping, TextOut, Polygon functions
git-svn-id: trunk@3226 -
This commit is contained in:
parent
907efa7e6e
commit
10c89e7da7
@ -102,18 +102,27 @@ Procedure SplitBezier(Bezier : TBezier; var Left, Right : TBezier);
|
||||
Operator + (Addend1, Addend2 : TFloatPoint) : TFloatPoint;
|
||||
Operator + (Addend1 : TFloatPoint; Addend2 : Extended) : TFloatPoint;
|
||||
Operator + (Addend1 : Extended; Addend2 : TFloatPoint) : TFloatPoint;
|
||||
Operator + (Addend1 : TFloatPoint; Addend2 : TPoint) : TFloatPoint;
|
||||
Operator + (Addend1 : TPoint; Addend2 : TFloatPoint) : TFloatPoint;
|
||||
|
||||
Operator - (Minuend : TFloatPoint; Subtrahend : Extended) : TFloatPoint;
|
||||
Operator - (Minuend, Subtrahend : TFloatPoint) : TFloatPoint;
|
||||
Operator - (Minuend : TFloatPoint; Subtrahend : TPoint) : TFloatPoint;
|
||||
Operator - (Minuend : TPoint; Subtrahend : TFloatPoint) : TFloatPoint;
|
||||
|
||||
Operator * (Multiplicand, Multiplier : TFloatPoint) : TFloatPoint;
|
||||
Operator * (Multiplicand : TFloatPoint; Multiplier : Extended) :
|
||||
TFloatPoint;
|
||||
Operator * (Multiplicand : Extended; Multiplier : TFloatPoint) :
|
||||
TFloatPoint;
|
||||
Operator * (Multiplicand : TFloatPoint; Multiplier : Extended) : TFloatPoint;
|
||||
Operator * (Multiplicand : Extended; Multiplier : TFloatPoint) : TFloatPoint;
|
||||
Operator * (Multiplicand : TFloatPoint; Multiplier : TPoint) : TFloatPoint;
|
||||
Operator * (Multiplicand : TPoint; Multiplier : TFloatPoint) : TFloatPoint;
|
||||
|
||||
Operator / (Dividend, Divisor : TFloatPoint) : TFloatPoint;
|
||||
Operator / (Dividend : TFloatPoint; Divisor : Extended) : TFloatPoint;
|
||||
Operator / (Dividend : TFloatPoint; Divisor : TPoint) : TFloatPoint;
|
||||
Operator / (Dividend : TPoint; Divisor : TFloatPoint) : TFloatPoint;
|
||||
|
||||
Operator = (Compare1, Compare2 : TPoint) : Boolean;
|
||||
Operator = (Compare1, Compare2 : TFloatPoint) : Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -138,6 +147,19 @@ begin
|
||||
Result := Addend2 + Addend1;
|
||||
end;
|
||||
|
||||
Operator + (Addend1 : TFloatPoint; Addend2 : TPoint) : TFloatPoint;
|
||||
Begin
|
||||
With Result do begin
|
||||
X := Addend1.X + Addend2.X;
|
||||
Y := Addend1.Y + Addend2.Y;
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator + (Addend1 : TPoint; Addend2 : TFloatPoint) : TFloatPoint;
|
||||
begin
|
||||
Result := Addend2 + Addend1;
|
||||
end;
|
||||
|
||||
Operator - (Minuend, Subtrahend:TFloatPoint) : TFloatPoint;
|
||||
Begin
|
||||
With Result do begin
|
||||
@ -149,8 +171,24 @@ end;
|
||||
Operator - (Minuend : TFloatPoint; Subtrahend : Extended) : TFloatPoint;
|
||||
Begin
|
||||
With Result do begin
|
||||
X:= Minuend.X - Subtrahend;
|
||||
Y:= Minuend.Y - Subtrahend;
|
||||
X := Minuend.X - Subtrahend;
|
||||
Y := Minuend.Y - Subtrahend;
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator - (Minuend : TFloatPoint; Subtrahend : TPoint) : TFloatPoint;
|
||||
begin
|
||||
With Result do begin
|
||||
X := Minuend.X - Subtrahend.X;
|
||||
Y := Minuend.Y - Subtrahend.Y;
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator - (Minuend : TPoint; Subtrahend : TFloatPoint) : TFloatPoint;
|
||||
begin
|
||||
With Result do begin
|
||||
X := Minuend.X - Subtrahend.X;
|
||||
Y := Minuend.Y - Subtrahend.Y;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -162,8 +200,7 @@ Begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator * (Multiplicand : TFloatPoint; Multiplier : Extended) :
|
||||
TFloatPoint;
|
||||
Operator * (Multiplicand : TFloatPoint; Multiplier : Extended) : TFloatPoint;
|
||||
Begin
|
||||
With Result do begin
|
||||
X := Multiplicand.X * Multiplier;
|
||||
@ -171,12 +208,24 @@ Begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator * (Multiplicand : Extended; Multiplier : TFloatPoint) :
|
||||
TFloatPoint;
|
||||
Operator * (Multiplicand : Extended; Multiplier : TFloatPoint) : TFloatPoint;
|
||||
Begin
|
||||
Result := Multiplier*Multiplicand;
|
||||
end;
|
||||
|
||||
Operator * (Multiplicand : TFloatPoint; Multiplier : TPoint) : TFloatPoint;
|
||||
begin
|
||||
With Result do begin
|
||||
X := Multiplicand.X * Multiplier.X;
|
||||
Y := Multiplicand.Y * Multiplier.Y;
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator * (Multiplicand : TPoint; Multiplier : TFloatPoint) : TFloatPoint;
|
||||
begin
|
||||
Result := Multiplier*Multiplicand;
|
||||
end;
|
||||
|
||||
Operator / (Dividend, Divisor : TFloatPoint) : TFloatPoint;
|
||||
Begin
|
||||
With Result do begin
|
||||
@ -193,6 +242,32 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator / (Dividend : TFloatPoint; Divisor : TPoint) : TFloatPoint;
|
||||
begin
|
||||
With Result do begin
|
||||
X := Dividend.X / Divisor.X;
|
||||
Y := Dividend.Y / Divisor.Y;
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator / (Dividend : TPoint; Divisor : TFloatPoint) : TFloatPoint;
|
||||
begin
|
||||
With Result do begin
|
||||
X := Dividend.X / Divisor.X;
|
||||
Y := Dividend.Y / Divisor.Y;
|
||||
end;
|
||||
end;
|
||||
|
||||
Operator = (Compare1, Compare2 : TPoint) : Boolean;
|
||||
begin
|
||||
Result := (Compare1.X = Compare2.X) and (Compare1.Y = Compare2.Y);
|
||||
end;
|
||||
|
||||
Operator = (Compare1, Compare2 : TFloatPoint) : Boolean;
|
||||
begin
|
||||
Result := (Compare1.X = Compare2.X) and (Compare1.Y = Compare2.Y);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: Angles2Coords
|
||||
Params: x,y,width,height,angle1,angle2, sx, sy, ex, ey
|
||||
@ -258,11 +333,6 @@ Procedure Arc2Bezier(X, Y, Width, Height : Longint; Angle1, Angle2,
|
||||
Result.Y := Point.X*SinA - Point.Y*CosA;
|
||||
end;
|
||||
|
||||
Function Translate(Point : TFloatPoint; Translation : TPoint) : TFloatPoint;
|
||||
begin
|
||||
Result := Point + FloatPoint(Translation.X,Translation.Y);
|
||||
end;
|
||||
|
||||
Function Scale(Point : TFloatPoint; ScaleX, ScaleY : Extended) : TFloatPoint;
|
||||
begin
|
||||
Result := Point*FloatPoint(ScaleX,ScaleY);
|
||||
@ -296,7 +366,7 @@ begin
|
||||
ScaleY := Height / Width;
|
||||
B := A;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
Angle1 := DegToRad(Angle1/16);
|
||||
Angle2 := DegToRad(Angle2/16);
|
||||
@ -322,9 +392,9 @@ begin
|
||||
|
||||
For I := 0 to 3 do
|
||||
begin
|
||||
Points[I] := Scale(P[I],ScaleX, ScaleY);
|
||||
Points[I] := Rotate(Points[I], Rotation);
|
||||
Points[I] := Translate(Points[I], PT);
|
||||
Points[I] := Scale(P[I],ScaleX, ScaleY); //Scale to proper size
|
||||
Points[I] := Rotate(Points[I], Rotation); //Rotate Counter-Clockwise
|
||||
Points[I] := Points[I] + PT; //Translate to Center
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -974,4 +1044,14 @@ begin
|
||||
end;
|
||||
|
||||
end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.5 2002/08/19 20:34:47 lazarus
|
||||
MG: improved Clipping, TextOut, Polygon functions
|
||||
|
||||
|
||||
Revision 1.5 2002/08/15
|
||||
Andrew: Added more overloaded operations for use with TFloatPoint & TPoint
|
||||
|
||||
}
|
||||
|
@ -123,32 +123,43 @@ End;
|
||||
Procedure TStatusBar.WMPaint(var Msg: TLMPaint);
|
||||
var
|
||||
I : Integer;
|
||||
X,Y,X2 : Integer;
|
||||
Style : TTextStyle;
|
||||
R : TRect;
|
||||
Begin
|
||||
inherited;
|
||||
X2:=(Height-Canvas.TextHeight('L')) div 2;
|
||||
Style := Canvas.TextStyle;
|
||||
With Style do begin
|
||||
Layout := tlCenter;
|
||||
Alignment := taLeftJustify;
|
||||
WordBreak := False;
|
||||
SingleLine := True;
|
||||
Clipping := False;
|
||||
ShowPrefix := False;
|
||||
Opaque := False;
|
||||
end;
|
||||
R := Rect(Left, Top, Left + ClientWidth, Top + ClientHeight);
|
||||
if SimplePanel = False then
|
||||
Begin
|
||||
if Panels.Count = 0 then exit;
|
||||
Y := Top; //this shouldn't be needed but it is...
|
||||
X := Left;
|
||||
|
||||
For I := 0 to Panels.Count-1 do
|
||||
Begin
|
||||
if I = Panels.Count-1 then
|
||||
// this sets the last panel to the width of the statusbar
|
||||
Panels[I].Width := ClientWidth-X;
|
||||
DrawBevel(X,I);
|
||||
Canvas.TextOut(X+2,Y+X2,Panels[i].Text);
|
||||
Panels[I].Width := ClientWidth-R.Left;
|
||||
R.Right := R.Left + Panels[I].Width;
|
||||
DrawBevel(R.Left,I);
|
||||
InflateRect(R, -1, -1);
|
||||
Style.Alignment := Panels[I].Alignment;
|
||||
Canvas.TextRect(R, 1, 0, Panels[i].Text, Style);
|
||||
InflateRect(R, 1, 1);
|
||||
//draw divider
|
||||
if I < Panels.Count-1 then
|
||||
DrawDivider(X+Panels[i].Width);
|
||||
inc(X);
|
||||
X := X + Panels[i].Width+1;
|
||||
DrawDivider(R.Right);
|
||||
R.Left := R.Right;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Canvas.TextOut(Left+2,Top+X2,SimpleText);
|
||||
Canvas.TextRect(R, 2, 0, SimpleText, Style);
|
||||
End;
|
||||
// included by comctrls.pp
|
||||
|
||||
|
@ -717,6 +717,21 @@ Begin
|
||||
Assert(False, Format('trace:< [TWin32Object.DrawEdge] DC:0x%x, Rect = %d,%d,%d,%d', [DC, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom]));
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: DrawText
|
||||
Params: DC, Str, Count, Rect, Flags
|
||||
Returns: If the string was drawn, or CalcRect run
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32Object.DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer;
|
||||
begin
|
||||
Assert(False, Format('trace:> [TWin32Object.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
|
||||
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
|
||||
Result := Windows.DrawText(DC, Str, Count, @Rect, Flags);
|
||||
Assert(False, Format('trace:> [TWin32Object.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
|
||||
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: Ellipse
|
||||
Params:
|
||||
@ -1159,6 +1174,11 @@ Begin
|
||||
Assert(False, Format('Trace:[TWin32Object.GetSystemMetrics] %s --> 0x%S (%s)', [IntToStr(NIndex), IntToHex(Result, 8), IntToStr(Result)]));
|
||||
End;
|
||||
|
||||
Function TWin32Object.GetTextColor(DC: HDC): TColorRef;
|
||||
Begin
|
||||
Result := Windows.GetTextColor(DC);
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: GetTextExtentPoint
|
||||
Params: DC - handle of device context
|
||||
@ -1450,19 +1470,9 @@ End;
|
||||
------------------------------------------------------------------------------}
|
||||
Function TWin32Object.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
|
||||
Filled, Continuous: Boolean): Boolean;
|
||||
var
|
||||
APoints : PPoint;
|
||||
ACount : Longint;
|
||||
Begin
|
||||
If Filled or (not Continuous) then begin
|
||||
APoints := nil;
|
||||
PolyBezier2Polyline(Points,NumPts,APoints,ACount,Continuous);
|
||||
If Filled then
|
||||
Result := Polygon(DC,APoints,ACount, False)
|
||||
else
|
||||
Result := Polyline(DC,APoints,ACount);
|
||||
ReallocMem(APoints,0);
|
||||
end
|
||||
If Filled or (not Continuous) then
|
||||
Result := Inherited PolyBezier(DC,Points,NumPts, Filled, Continuous)
|
||||
else
|
||||
Result := Windows.PolyBezier(DC, LPPOINT(Points)^, NumPts);
|
||||
End;
|
||||
@ -1494,7 +1504,7 @@ var
|
||||
PFMode : Longint;
|
||||
Begin
|
||||
Assert(False, Format('Trace:TWin32Object.Polygon --> DC: 0x%X, Number of points: %D, Use winding fill: %S', [DC, NumPts, BOOL_RESULT[Winding]]));
|
||||
If not Winding then
|
||||
If Winding then
|
||||
PFMode := SetPolyFillMode(DC, Windows.WINDING)
|
||||
else
|
||||
PFMode := SetPolyFillMode(DC, Windows.ALTERNATE);
|
||||
@ -2159,6 +2169,90 @@ Begin
|
||||
Result := Windows.WindowFromPoint(Windows.POINT(Point));
|
||||
End;
|
||||
|
||||
Procedure TWin32Object.InitializeCriticalSection(var CritSection: TCriticalSection);
|
||||
var
|
||||
Crit : LPCRITICAL_SECTION;
|
||||
begin
|
||||
{ An OS Compatible TCriticalSection needs to be defined}
|
||||
If CritSection <> 0 then
|
||||
Try
|
||||
Crit := LPCRITICAL_SECTION(CritSection);
|
||||
Dispose(Crit);
|
||||
except
|
||||
CritSection := 0;
|
||||
end;
|
||||
New(Crit);
|
||||
Windows.InitializeCriticalSection(Crit^);
|
||||
CritSection := Longint(Crit);
|
||||
end;
|
||||
|
||||
Procedure TWin32Object.EnterCriticalSection(var CritSection: TCriticalSection);
|
||||
var
|
||||
Crit,
|
||||
tmp : LPCRITICAL_SECTION;
|
||||
begin
|
||||
{ An OS Compatible TCriticalSection needs to be defined}
|
||||
New(Crit);
|
||||
If CritSection <> 0 then
|
||||
Try
|
||||
Crit^ := LPCRITICAL_SECTION(CritSection)^;
|
||||
except
|
||||
begin
|
||||
CritSection := Longint(Crit);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
Windows.EnterCriticalSection(Crit^);
|
||||
tmp := LPCRITICAL_SECTION(CritSection);
|
||||
CritSection := Longint(Crit);
|
||||
Dispose(Tmp);
|
||||
end;
|
||||
|
||||
Procedure TWin32Object.LeaveCriticalSection(var CritSection: TCriticalSection);
|
||||
var
|
||||
Crit,
|
||||
tmp : LPCRITICAL_SECTION;
|
||||
begin
|
||||
{ An OS Compatible TCriticalSection needs to be defined}
|
||||
New(Crit);
|
||||
If CritSection <> 0 then
|
||||
Try
|
||||
Crit^ := LPCRITICAL_SECTION(CritSection)^;
|
||||
except
|
||||
begin
|
||||
CritSection := Longint(Crit);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
Windows.LeaveCriticalSection(Crit^);
|
||||
tmp := LPCRITICAL_SECTION(CritSection);
|
||||
CritSection := Longint(Crit);
|
||||
Dispose(Tmp);
|
||||
end;
|
||||
|
||||
Procedure TWin32Object.DeleteCriticalSection(var CritSection: TCriticalSection);
|
||||
var
|
||||
Crit,
|
||||
tmp : LPCRITICAL_SECTION;
|
||||
begin
|
||||
{ An OS Compatible TCriticalSection needs to be defined}
|
||||
New(Crit);
|
||||
If CritSection <> 0 then
|
||||
Try
|
||||
Crit^ := LPCRITICAL_SECTION(CritSection)^;
|
||||
except
|
||||
begin
|
||||
CritSection := Longint(Crit);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
Windows.DeleteCriticalSection(Crit^);
|
||||
Dispose(Crit);
|
||||
tmp := LPCRITICAL_SECTION(CritSection);
|
||||
CritSection := 0;
|
||||
Dispose(Tmp);
|
||||
end;
|
||||
|
||||
//##apiwiz##eps## // Do not remove
|
||||
|
||||
{$IFDEF ASSERT_IS_ON}
|
||||
@ -2169,6 +2263,9 @@ End;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.14 2002/08/19 20:34:48 lazarus
|
||||
MG: improved Clipping, TextOut, Polygon functions
|
||||
|
||||
Revision 1.13 2002/08/15 15:46:50 lazarus
|
||||
MG: added changes from Andrew (Clipping)
|
||||
|
||||
|
@ -58,6 +58,7 @@ Function DeleteObject(GDIObject: HGDIOBJ): Boolean; Override;
|
||||
Function DestroyCaret(Handle: HWND): Boolean; Override;
|
||||
Function DrawFrameControl(DC: HDC; Var Rect: TRect; UType, UState: Cardinal): Boolean; Override;
|
||||
Function DrawEdge(DC: HDC; Var Rect: TRect; Edge: Cardinal; GrfFlags: Cardinal): Boolean; Override;
|
||||
function DrawText(DC: HDC; Str: PChar; Count: Integer; var Rect: TRect; Flags: Cardinal): Integer; Override;
|
||||
|
||||
Function Ellipse(DC: HDC; X1, Y1, X2, Y2: Integer): Boolean; Override;
|
||||
Function EmptyClipBoard: Boolean;
|
||||
@ -89,6 +90,7 @@ Function GetScrollInfo(Handle: HWND; BarFlag: Integer; Var ScrollInfo: TScrollIn
|
||||
Function GetStockObject(Value: Integer): LongInt; Override;
|
||||
Function GetSysColor(NIndex: Integer): DWORD; Override;
|
||||
Function GetSystemMetrics(NIndex: Integer): Integer; Override;
|
||||
Function GetTextColor(DC: HDC): TColorRef; Override;
|
||||
Function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer; Var Size: TSize): Boolean; Override;
|
||||
Function GetTextMetrics(DC: HDC; Var TM: TTextMetric): Boolean; Override;
|
||||
Function GetWindowLong(Handle: HWND; Int: Integer): LongInt; Override;
|
||||
@ -160,10 +162,19 @@ Function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; X
|
||||
Function TextOut(DC: HDC; X, Y: Integer; Str: PChar; Count: Integer): Boolean; Override;
|
||||
|
||||
Function WindowFromPoint(Point: TPoint): HWND; Override;
|
||||
|
||||
Procedure InitializeCriticalSection(var CritSection: TCriticalSection); Override;
|
||||
Procedure EnterCriticalSection(var CritSection: TCriticalSection); Override;
|
||||
Procedure LeaveCriticalSection(var CritSection: TCriticalSection); Override;
|
||||
Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override;
|
||||
|
||||
//##apiwiz##eps## // Do not remove
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.11 2002/08/19 20:34:49 lazarus
|
||||
MG: improved Clipping, TextOut, Polygon functions
|
||||
|
||||
Revision 1.10 2002/08/15 15:46:50 lazarus
|
||||
MG: added changes from Andrew (Clipping)
|
||||
|
||||
|
@ -58,6 +58,10 @@ type
|
||||
PANSICHAR = ^AnsiChar;
|
||||
PWideChar = ^WideChar;
|
||||
UINT = LongWord;
|
||||
|
||||
TCriticalSection = longint;
|
||||
PCriticalSection = ^TCriticalSection;
|
||||
|
||||
{ Provided for compatibility with Windows registry ONLY }
|
||||
HKEY = Integer;
|
||||
PHKEY = ^HKEY;
|
||||
@ -130,6 +134,21 @@ const
|
||||
RGN_DIFF = 4;
|
||||
RGN_COPY = 5;
|
||||
|
||||
//------------
|
||||
// DrawText flags
|
||||
//------------
|
||||
DT_TOP = 0;
|
||||
DT_LEFT = 0;
|
||||
DT_CENTER = 1;
|
||||
DT_RIGHT = 2;
|
||||
DT_VCENTER = 4;
|
||||
DT_BOTTOM = 8;
|
||||
DT_WORDBREAK = $10;
|
||||
DT_SINGLELINE = $20;
|
||||
DT_NOCLIP = $100;
|
||||
DT_CALCRECT = $400;
|
||||
DT_NOPREFIX = $800;
|
||||
|
||||
//==============================================
|
||||
// Draw frame constants
|
||||
//==============================================
|
||||
@ -1442,6 +1461,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.11 2002/08/19 20:34:47 lazarus
|
||||
MG: improved Clipping, TextOut, Polygon functions
|
||||
|
||||
Revision 1.10 2002/08/16 20:13:09 lazarus
|
||||
MG: custom external tools are now shown in the menu
|
||||
|
||||
|
@ -519,7 +519,7 @@ type
|
||||
property OnStartDrag;
|
||||
end;
|
||||
|
||||
|
||||
Function DeleteAmpersands(var Str : String) : Longint;
|
||||
|
||||
implementation
|
||||
|
||||
@ -566,6 +566,39 @@ const
|
||||
|
||||
SScrollBarRange = 'ScrollBar property out of range';
|
||||
|
||||
Function DeleteAmpersands(var Str : String) : Longint;
|
||||
var
|
||||
I : Integer;
|
||||
Tmp : String;
|
||||
begin
|
||||
I := 1;
|
||||
Result := -1;
|
||||
SetLength(Tmp,0);
|
||||
While I <= Length(Str) do
|
||||
Case Str[I] of
|
||||
'&' :
|
||||
If I + 1 <= Length(Str) then begin
|
||||
If Str[I+1] = '&' then begin
|
||||
I += 2;
|
||||
Tmp := Tmp + '&';
|
||||
end
|
||||
else begin
|
||||
If Result < 0 then
|
||||
Result := Length(Tmp) + 1;
|
||||
I += 1;
|
||||
end;
|
||||
end
|
||||
else
|
||||
I += 1;
|
||||
else begin
|
||||
Tmp := Tmp + Str[I];
|
||||
I += 1;
|
||||
end;
|
||||
end;
|
||||
SetLength(Str,0);
|
||||
Str := Tmp;
|
||||
end;
|
||||
|
||||
{$I customgroupbox.inc}
|
||||
{$I customcombobox.inc}
|
||||
{$I customlistbox.inc}
|
||||
@ -589,6 +622,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.33 2002/08/19 20:34:47 lazarus
|
||||
MG: improved Clipping, TextOut, Polygon functions
|
||||
|
||||
Revision 1.32 2002/08/17 15:45:32 lazarus
|
||||
MG: removed ClientRectBugfix defines
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user