Skip to content

Commit fe45bca

Browse files
author
Monte Goulding
authored
Merge pull request livecode#5599 from montegoulding/scriptifyenv
[[ Scriptify ]] Scriptify environment stack
2 parents 46e1b52 + 6ec599b commit fe45bca

20 files changed

Lines changed: 1664 additions & 70 deletions

builder/engine_builder.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private command engineBuilderBuildEnvironment pEdition, pVersion
189189
local tKeyFile
190190
put the tempName into tKeyFile
191191
put tPubKey into URL ("binfile:" & tKeyFile)
192-
get shell(builderSystemFolder() & "/public_key_setter -ui" && builderCommercialFolder() & "/src/Environment.rev" && tKeyFile)
192+
get shell(builderSystemFolder() & "/public_key_setter -ui" && builderCommercialFolder() & "/src/environment.livecode" && tKeyFile)
193193
builderLog "message", it
194194
delete file tKeyFile
195195

engine/engine.gyp

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'targets':
2323
[
2424
{
25-
'target_name': 'update_liburl_script',
25+
'target_name': 'descriptify_environment_stack',
2626
'type': 'none',
2727

2828
'variables':
@@ -50,6 +50,25 @@
5050
],
5151
},
5252

53+
'sources':
54+
[
55+
'src/environment.livecode',
56+
'../ide-support/revliburl.livecodescript',
57+
'src/environment/accountsignupcardbehavior.livecodescript',
58+
'src/environment/automaticactivationactivationgroupbehavior.livecodescript',
59+
'src/environment/automaticactivationactivationinputpassfieldbehavior.livecodescript',
60+
'src/environment/automaticactivationbackgroundgroupbehavior.livecodescript',
61+
'src/environment/automaticactivationcardbehavior.livecodescript',
62+
'src/environment/automaticactivationprocessinggroupbehavior.livecodescript',
63+
'src/environment/getstartedgetstartedstatusgroupbehavior.livecodescript',
64+
'src/environment/resourcesresourcesloadergroupbehavior.livecodescript',
65+
'src/environment/resourcesresourcespushbuttonbehaviorbuttonbehavior.livecodescript',
66+
'src/environment/stackbehavior.livecodescript',
67+
'src/environment/unlicensedactivatefieldbehavior.livecodescript',
68+
'src/environment/unlicensedbkgndbehavior.livecodescript',
69+
'src/environment/unlicensedbuynowbuttonbehavior.livecodescript',
70+
],
71+
5372
'dependencies':
5473
[
5574
# Requires a working LiveCode engine
@@ -59,28 +78,27 @@
5978
'actions':
6079
[
6180
{
62-
'action_name': 'update_liburl',
63-
'message': 'Updating environment stack liburl script',
81+
'action_name': 'descriptify_environment_stack',
82+
'message': 'De-scriptifying the environment stack',
6483

6584
'inputs':
6685
[
67-
'src/Environment.rev',
68-
'../ide-support/revliburl.livecodescript',
69-
'../util/update-liburl.livecodescript',
86+
'../util/descriptify_stack.livecodescript',
87+
'<@(_sources)',
7088
],
7189

7290
'outputs':
7391
[
74-
'<(SHARED_INTERMEDIATE_DIR)/src/Environment_LibURL.rev',
92+
'<(SHARED_INTERMEDIATE_DIR)/src/environment_descriptified.livecode',
7593
],
7694

7795
'action':
7896
[
7997
'<(engine)',
80-
'../util/update-liburl.livecodescript',
81-
'src/Environment.rev',
82-
'../ide-support/revliburl.livecodescript',
83-
'<(SHARED_INTERMEDIATE_DIR)/src/Environment_LibURL.rev',
98+
'../util/descriptify_stack.livecodescript',
99+
'<(SHARED_INTERMEDIATE_DIR)/src/environment_descriptified.livecode',
100+
'<@(_sources)',
101+
84102
],
85103
},
86104
],
@@ -92,7 +110,7 @@
92110

93111
'dependencies':
94112
[
95-
'update_liburl_script',
113+
'descriptify_environment_stack',
96114
],
97115

98116
'actions':
@@ -102,7 +120,7 @@
102120
'inputs':
103121
[
104122
'../util/compress_data.pl',
105-
'<(SHARED_INTERMEDIATE_DIR)/src/Environment_LibURL.rev',
123+
'<(SHARED_INTERMEDIATE_DIR)/src/environment_descriptified.livecode',
106124
],
107125
'outputs':
108126
[
@@ -113,7 +131,7 @@
113131
[
114132
'<@(perl)',
115133
'../util/compress_data.pl',
116-
'src/Environment.rev',
134+
'<(SHARED_INTERMEDIATE_DIR)/src/environment_descriptified.livecode',
117135
'<@(_outputs)',
118136
# Really nasty hack to prevent this from being treated as a path
119137
'$(this_is_an_undefined_variable)MCstartupstack',

engine/src/Environment.rev

-281 KB
Binary file not shown.

engine/src/environment.livecode

91.2 KB
Binary file not shown.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
script "EnvironmentAccountSignupCardBehavior"
2+
on preOpenCard
3+
put empty into field "name"
4+
put empty into field "email"
5+
put empty into field "password"
6+
set the cPassword of field "password" to empty
7+
put empty into field "retype password"
8+
set the cPassword of field "retype password" to empty
9+
put empty into field "signup_message"
10+
hide field "signup_message"
11+
hide image "loader"
12+
selectIndicator "account"
13+
end preOpenCard
14+
15+
on accountSignup
16+
// Verify information
17+
local tName, tEmail, tPassword,tReType
18+
19+
put field "name" into tName
20+
put field "email" into tEmail
21+
put the cPassword of field "password" into tPassword
22+
put the cPassword of field "retype password" into tReType
23+
24+
if tName is empty then
25+
accountSignUpMessage "Please enter your name."
26+
exit accountSignup
27+
end if
28+
29+
if tEmail is empty then
30+
accountSignUpMessage "Please enter your email address."
31+
exit accountSignup
32+
end if
33+
34+
if tPassword is empty then
35+
accountSignUpMessage "Please enter a password."
36+
exit accountSignup
37+
end if
38+
39+
if tReType is empty then
40+
accountSignUpMessage "Please retype the password."
41+
exit accountSignup
42+
end if
43+
44+
if tPassword is not tReType then
45+
accountSignUpMessage "Please ensure your password and retyped password match."
46+
exit accountSignup
47+
end if
48+
49+
accountCreate tName, tEmail, tPassword
50+
end accountSignup
51+
52+
on openField
53+
accountSignupMessageClose
54+
end openField
55+
56+
on focusIn
57+
accountSignupMessageClose
58+
end focusIn
59+
60+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
script "EnvironmentAccountSignupPasswordFieldBehaviorButtonBehavior"
2+
on keydown tKey
3+
local tSChar,tEChar, tPasswd, tBulletCode
4+
put word 2 of the selectedChunk of me into tSChar
5+
put word 4 of the selectedChunk of me into tEChar
6+
put the cPassword of me into tPasswd
7+
if tEChar > tSChar then -- some text is selected
8+
delete char tSChar to tEChar of me
9+
delete char tSChar to tEChar of tPasswd
10+
end if
11+
put word 2 of the selectedChunk of me into tSChar
12+
put word 4 of the selectedChunk of me into tEChar
13+
put tKey after char tEChar of tPasswd
14+
set the cPassword of me to tPasswd
15+
--put tPasswd # debugging
16+
if the platform is "MacOS" then
17+
put 165 into tBulletCode
18+
else
19+
put 149 into tBulletCode
20+
end if
21+
22+
put numtochar(tBulletCode) after char tEChar of the target
23+
end keyDown
24+
25+
on backspaceKey
26+
local tSChar,tEChar, tPasswd
27+
put word 2 of the selectedChunk of me into tSChar
28+
put word 4 of the selectedChunk of me into tEChar
29+
put the cPassword of me into tPasswd
30+
if tEChar > tSChar then -- text is selected
31+
delete char tSChar to tEChar of me
32+
delete char tSChar to tEChar of tPasswd
33+
else
34+
delete char tEChar of me
35+
delete char tEChar of tPasswd
36+
end if
37+
set the cPassword of me to tPasswd
38+
39+
--put tPasswd # debugging
40+
end backspaceKey
41+
42+
on deleteKey
43+
local tSChar,tEChar, tPasswd
44+
put word 2 of the selectedChunk of me into tSChar
45+
put word 4 of the selectedChunk of me into tEChar
46+
put the cPassword of me into tPasswd
47+
if tEChar > tSChar then -- text is selected
48+
delete char tSChar to tEChar of me
49+
delete char tSChar to tEChar of tPasswd
50+
else
51+
delete char tSChar of me
52+
delete char tSChar of tPasswd
53+
end if
54+
set the cPassword of me to tPasswd
55+
56+
--put tPasswd # debugging
57+
end deleteKey
58+
59+
on openField
60+
--put the cPassword of me # for debugging
61+
put bulletize(the cPassword of me) into me
62+
accountSignupMessageClose
63+
end openField
64+
65+
function bulletize pText
66+
local tBulletCode, tBullets, tChar
67+
if the platform is "MacOS" then
68+
put 165 into tBulletCode
69+
else
70+
put 149 into tBulletCode
71+
end if
72+
put empty into tBullets
73+
repeat for each char tChar in pText
74+
put numToChar(tBulletCode) after tBullets
75+
end repeat
76+
return tBullets
77+
end bulletize
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
script "EnvironmentAutomaticActivationActivationGroupBehavior"
2+
local sPasswordIsHash
3+
local sPassword
4+
5+
on preOpenBackground
6+
set the textFont of field "Error Message" to messageFont()
7+
set the textSize of field "Error Message" to messageFontSize()
8+
9+
set the textColor of field "Pass Label" to headingColor()
10+
set the textColor of field "Pass" to subtitleColor()
11+
set the textColor of field "Login" to subtitleColor()
12+
set the textColor of field "Login Label" to headingColor()
13+
set the textColor of field "Error Message" to primaryErrorColor()
14+
15+
repeat for each item tControl in "Login Label,Login,Pass Label,Pass"
16+
set the textFont of control tControl to entryFont()
17+
set the textSize of control tControl to entryFontSize()
18+
set the textStyle of control tControl to "bold"
19+
end repeat
20+
21+
set the uLabel of control "Quit" to "Quit"
22+
set the uDefault of control "Quit" to false
23+
set the uEnabled of control "Quit" to true
24+
25+
set the uLabel of control "Activate" to "Activate"
26+
set the uDefault of control "Activate" to true
27+
28+
pass preOpenBackground
29+
end preOpenBackground
30+
31+
################################################################################
32+
33+
command setLogin pEmail
34+
put pEmail into field "Login"
35+
updateActivateEnablement
36+
end setLogin
37+
38+
command attemptActivation
39+
if field "Login" is empty or field "Pass" is empty then
40+
exit attemptActivation
41+
end if
42+
43+
if sPasswordIsHash then
44+
performAutomaticActivation word 1 to -1 of field "Login", empty, word 1 to -1 of sPassword
45+
else
46+
performAutomaticActivation word 1 to -1 of field "Login", word 1 to -1 of sPassword, the md5Digest of word 1 to -1 of sPassword
47+
end if
48+
if the result is "error" then
49+
show group "Input"
50+
updateErrorMessage
51+
end if
52+
end attemptActivation
53+
54+
command updateActivateEnablement
55+
set the uEnabled of control "Activate" to (word 1 to -1 of field "Login" is not empty and word 1 to -1 of field "Pass" is not empty)
56+
end updateActivateEnablement
57+
58+
################################################################################
59+
60+
command updateErrorMessage
61+
local tMessage
62+
put activationError() into tMessage
63+
if tMessage is empty then
64+
put activationReason() into tMessage
65+
end if
66+
if tMessage is empty then
67+
hide group "Error"
68+
exit updateErrorMessage
69+
end if
70+
71+
lock screen
72+
set the width of field "Error Message" to 1024
73+
74+
put tMessage into field "Error Message"
75+
set the width of field "Error Message" to min(the formattedWidth of field "Error Message", the width of group "Error" - 20)
76+
set the height of field "Error Message" to the formattedHeight of field "Error Message"
77+
set the left of field "Error Message" to the left of group "Error" + (the width of group "Error" - the width of field "Error Message") div 2 + 20
78+
set the loc of button "Error Symbol" to the loc of group "Error"
79+
set the left of button "Error Symbol" to the left of field "Error Message" - 20
80+
81+
show group "Error"
82+
unlock screen
83+
end updateErrorMessage
84+
85+
################################################################################
86+
87+
command setPassword pHash, pValue
88+
put pHash into sPasswordIsHash
89+
put pValue into sPassword
90+
updatePassword
91+
end setPassword
92+
93+
command updatePassword
94+
lock screen
95+
if sPasswordIsHash then
96+
put "********" into field "Pass"
97+
else
98+
put sPassword into field "Pass"
99+
end if
100+
repeat with x = 1 to the number of chars of field "Pass"
101+
set the imageSource of char x of field "Pass" to 10025
102+
end repeat
103+
unlock screen
104+
end updatePassword
105+
106+
on keyDown
107+
if the short name of the target is "Pass" then
108+
selectionChanged
109+
end if
110+
pass keyDown
111+
end keyDown
112+
113+
on rawKeyUp
114+
if the short name of the target is "Pass" then
115+
selectionChanged
116+
end if
117+
updateActivateEnablement
118+
end rawKeyUp
119+
120+
on selectionChanged
121+
if the short name of the target is "Pass" then
122+
if sPasswordIsHash and the text of field "Pass" is "********" then
123+
select char 1 to -1 of field "Pass"
124+
else
125+
get the selectedChunk
126+
put false into sPasswordIsHash
127+
put the text of field "Pass" into sPassword
128+
updatePassword
129+
select it
130+
end if
131+
end if
132+
updateActivateEnablement
133+
end selectionChanged
134+
135+
################################################################################
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
script "EnvironmentAutomaticActivationActivationInputPassFieldBehavior"
2+
on returnInField
3+
click at the loc of control "Activate"
4+
--attemptActivation
5+
end returnInField

0 commit comments

Comments
 (0)