Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 9e6ab57

Browse files
committed
[[ StandaloneSettings ]] Scriptify inclusions row behavior
1 parent eb9890f commit 9e6ab57

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

32.7 KB
Binary file not shown.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
script "revStandaloneSettingsInclusionsRowBehavior"
2+
constant kPlatforms = "emscripten,android,ios,linux,windows,macosx"
3+
on FillInData pDataA, pRow
4+
# Map pDataA values to physical controls...
5+
local tVersion
6+
7+
set the cTypeID of me to pDataA["id"]
8+
9+
local tLabel, tAuthor
10+
if pDataA["title"] is not empty then put pDataA["title"] into tLabel
11+
else if pDataA["label"] is not empty then put pDataA["label"] into tLabel
12+
if tLabel is empty then put "Extension Title" into tLabel
13+
14+
if pDataA["author"] is not empty then put pDataA["author"] into tAuthor
15+
if tAuthor is empty then put "Unknown Author" into tAuthor
16+
17+
put tLabel into field "description" of me
18+
19+
local tIconName, tIconPath
20+
revSBInclusionIconFromType pDataA["type"], pDataA["id"], tIconName, tIconPath
21+
22+
if tIconPath is not empty then
23+
set the iconPath of widget "icon" of me to tIconPath
24+
else
25+
set the iconPresetName of widget "icon" of me to tIconName
26+
end if
27+
28+
repeat for each item tItem in kPlatforms
29+
if tItem is among the items of pDataA["platforms"] then
30+
show image tItem of me
31+
else
32+
hide image tItem of me
33+
end if
34+
end repeat
35+
36+
set the cRow of me to pRow
37+
end FillInData
38+
39+
on LayoutControl pControlRect
40+
41+
local tMargin, tPadding, tIconLoc
42+
43+
# Resize controls/row
44+
put 6 into tMargin
45+
put 6 into tPadding
46+
47+
set the rect of graphic "background" of me to pControlRect
48+
set the width of graphic "border" of me to (item 3 of pControlRect - item 1 of pControlRect)
49+
set the bottomLeft of graphic "border" of me to item 1 of pControlRect, item 4 of pControlRect
50+
put the loc of me into tIconLoc
51+
put item 1 of pControlRect + (17 + tMargin) into item 1 of tIconLoc
52+
set the loc of widget "icon" of me to tIconLoc
53+
54+
--set the width of field "description" of me to (item 3 of pControlRect - item 1 of pControlRect) - the width of image "icon" of me - the width of button "uninstall" of me
55+
set the width of field "description" of me to the formattedWidth of field "description" of me
56+
set the height of field "description" of me to the formattedHeight of field "description" of me
57+
set the loc of field "description" of me to the loc of me
58+
set the left of field "description" of me to the right of widget "icon" of me + tPadding
59+
60+
set the textColor of line 1 of field "description" of me to revIDEColor("text_1")
61+
set the textColor of line 2 of field "description" of me to revIDEColor("text_2")
62+
63+
local tRight
64+
put the right of me into tRight
65+
subtract tMargin from tRight
66+
set the loc of button "Check" of me to the loc of me
67+
set the right of button "Check" of me to tRight
68+
put the left of button "Check" of me into tRight
69+
subtract tPadding from tRight
70+
71+
repeat for each item tItem in kPlatforms
72+
subtract tPadding from tRight
73+
set the loc of image tItem of me to the loc of me
74+
set the right of image tItem of me to tRight
75+
put the left of image tItem of me into tRight
76+
end repeat
77+
78+
end LayoutControl
79+
80+
on mouseUp
81+
dispatch "rowClicked" to card "inclusions" of this stack with the cRow of me
82+
end mouseUp
83+
84+
on mouseDown
85+
86+
end mouseDown
87+
88+
getProp dvRowControl
89+
return the long id of me
90+
end dvRowControl
91+
92+
setProp dvHilite[pHiliteColor] pBoolean
93+
set the hilite of button "check" of me to pBoolean
94+
end dvHilite

0 commit comments

Comments
 (0)