-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
165 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
{$DEFINE WL_INTERFACE_INCLUDED} | ||
{$IFNDEF WL_OSR} | ||
{$I WaspLib/osr.simba} | ||
{$ENDIF} | ||
|
||
type | ||
TRSDropDown = record | ||
Index: Int32; | ||
Bounds: TBox; | ||
Middle: TPoint; | ||
end; | ||
|
||
TRSDropDownArray = array of TRSDropDown; | ||
|
||
//overriden to be able to pick Scroll UI Close button | ||
function TRSInterface.FindButtons(Dimensions: TRSButtonDimensions): TRSButtonArray; override; | ||
var | ||
TPA: TPointArray; | ||
ATPA: T2DPointArray; | ||
I, W, H: Int32; | ||
B: TBox; | ||
Color: TCTS1Color; | ||
Boxes: TBoxArray; | ||
begin | ||
B := Self.Bounds(); | ||
|
||
for Color in Self.ButtonColors do | ||
if SRL.FindColors(TPA, Color, B) > 0 then | ||
ATPA += TPA; | ||
|
||
ATPA := ATPA.Merge().Cluster(1); | ||
|
||
for TPA in ATPA do | ||
begin | ||
if Length(TPA) < 50 then | ||
Continue; | ||
|
||
B := TPA.Bounds(); | ||
B.GetDimensions(W, H); | ||
|
||
for I := 0 to High(Dimensions) do | ||
begin | ||
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and | ||
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and | ||
(TPA.Frameness > 57) then | ||
Boxes += B; | ||
end; | ||
|
||
{$IFDEF SRL_DEBUG_FINDBUTTONS} | ||
Writeln(W, ', ', H); | ||
{$ENDIF} | ||
end; | ||
|
||
Boxes.SortByXY(10); | ||
|
||
SetLength(Result, Length(Boxes)); | ||
for I := 0 to High(Boxes) do | ||
begin | ||
Result[I].Index := I; | ||
Result[I].Bounds := Boxes[I]; | ||
Result[I].Middle := Boxes[I].Middle; | ||
Result[I].EnabledColors := Self.ButtonEnabledColors; | ||
end; | ||
end; | ||
|
||
function TRSInterface.FindDropDown(Dimensions: TRSButtonDimensions): TRSDropDownArray; | ||
function FindArrow(Bounds: TBox; Color: TCTS0Color; Dimensions: TRSButtonDimensions): TRSButtonArray; overload; | ||
var | ||
TPA: TPointArray; | ||
ATPA: T2DPointArray; | ||
I, W, H: Int32; | ||
B: TBox; | ||
Color: TCTS1Color; | ||
Boxes: TBoxArray; | ||
begin | ||
B := Bounds; | ||
|
||
if SRL.FindColors(TPA, Color, B) > 0 then | ||
ATPA += TPA; | ||
|
||
ATPA := ATPA.Merge().Cluster(1); | ||
|
||
for TPA in ATPA do | ||
begin | ||
if Length(TPA) < 50 then | ||
Continue; | ||
|
||
B := TPA.Bounds(); | ||
B.GetDimensions(W, H); | ||
|
||
for I := 0 to High(Dimensions) do | ||
begin | ||
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and | ||
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and | ||
(TPA.Frameness > 57) then | ||
Boxes += B; | ||
end; | ||
|
||
{$IFDEF SRL_DEBUG_FINDBUTTONS} | ||
Writeln(W, ', ', H); | ||
{$ENDIF} | ||
end; | ||
|
||
Boxes.SortByXY(10); | ||
|
||
SetLength(Result, Length(Boxes)); | ||
for I := 0 to High(Boxes) do | ||
begin | ||
Result[I].Index := I; | ||
Result[I].Bounds := Boxes[I]; | ||
Result[I].Middle := Boxes[I].Middle; | ||
Result[I].EnabledColors := Self.ButtonEnabledColors; | ||
end; | ||
end; | ||
|
||
|
||
var | ||
TPA: TPointArray; | ||
ATPA: T2DPointArray; | ||
I, W, H: Int32; | ||
B: TBox; | ||
Boxes: TBoxArray; | ||
begin | ||
B := Self.Bounds; | ||
|
||
if SRL.FindColors(TPA, CTS0(4474438, 5), B) > 0 then | ||
ATPA += TPA; | ||
|
||
ATPA := ATPA.Merge().Cluster(1); | ||
|
||
for TPA in ATPA do | ||
begin | ||
if Length(TPA) < 50 then | ||
Continue; | ||
|
||
B := TPA.Bounds(); | ||
B.GetDimensions(W, H); | ||
|
||
for I := 0 to High(Dimensions) do | ||
begin | ||
if ((W = Dimensions[I].Width) or (Dimensions[I].Width = 0)) and | ||
((H = Dimensions[I].Height) or (Dimensions[I].Height = 0)) and | ||
(TPA.Frameness > 100) and (Length(FindArrow(B, CTS0(65536, 1), [16, 16])) = 1) then | ||
Boxes += B; | ||
end; | ||
|
||
{$IFDEF SRL_DEBUG_FINDBUTTONS} | ||
Writeln(W, ', ', H); | ||
{$ENDIF} | ||
end; | ||
|
||
Boxes.SortByXY(10); | ||
|
||
SetLength(Result, Length(Boxes)); | ||
for I := 0 to High(Boxes) do | ||
begin | ||
Result[I].Index := I; | ||
Result[I].Bounds := Boxes[I]; | ||
Result[I].Middle := Boxes[I].Middle; | ||
end; | ||
end; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters