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

Commit 563e9af

Browse files
committed
Merge branch 'develop-8.2' into merge-develop-8.1_03.08.17
Conflicts: - Toolset/libraries/revidelibrary.livecodescript - deleted - Toolset/palettes/revpreferencesgui.rev - reimplemented the changes described in #1699
2 parents af84421 + 518ffd4 commit 563e9af

File tree

51 files changed

+1611
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1611
-121
lines changed

Documentation/specs/tutorial-syntax.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ The possible actions are as follows:
6363
| "go" "to" "step" <Name: STRING>
6464
| "add" "guide" <Name: STRING> "with" "rect" <Rect: RECT> "to" <Target: Object>
6565
| “interlude”
66+
| "load" ("lesson" | "stack") <Source: STRING>
6667

6768
The highlight action causes the tutorial stack to point at the relevant
6869
object on the screen. If there is no highlight action, the tutorial stack
@@ -139,3 +140,13 @@ satisfied before continuing.
139140
| "the" <Property: PROPERTY> "of" <Target: Object> "is" "changed" "with" "default" <Value: STRING>
140141
| <Target: Object> "pops" "up" "answer" "dialog"
141142
| "this" "card" "is" <Card: STRING>
143+
144+
The load action causes tutorial state to be loaded. If the "lesson" Source
145+
is used, the tutorial runner will find the lesson with name Source in the
146+
same lessons folder as the current tutorial, and run it to completion. The
147+
resulting stack will then be available to use in the current tutorial.
148+
149+
If the "stack" Source is used, a stack will be loaded from the internal
150+
resources folder of the tutorial (_resources/). Any `cTutorialTag` custom
151+
property of objects on the stack will be converted to tags for objects
152+
which can subsequently be used in the current tutorial.

Toolset/home.livecodescript

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ private command revInternal__SetupPreferences
664664

665665
-- ensure the script of stack preferences is empty
666666
-- as setprops could be dangerous
667-
set the script of stack "revpreferences" to empty
667+
set the script of stack tPreferencesStackFile7 to empty
668668

669669
put the stackFiles of stack "Home" into tStackFiles
670670
put return & "revPreferences", tPreferencesStackFile7 after tStackFiles
@@ -762,7 +762,8 @@ command revInternal__ResetPreferences
762762
put "false" into tPropsArray["cShowRevolutionStacks"]
763763
put "22" into tPropsArray["cMenuHeight"]
764764
put "1067,251,1882,827" into tPropsArray["cRevDocsRect"]
765-
put "Black" into tPropsArray["cBackDropColor"]
765+
put "Gray88" into tPropsArray["cBackDropColor"]
766+
put "Gray88" into tPropsArray["cBackdrop"]
766767
put "false" into tPropsArray["cREVMsgShowUIFrontScripts"]
767768
put "false" into tPropsArray["revstack"]
768769
put "100" into tPropsArray["cMacOSProgressScrollbarWidth"]
@@ -820,7 +821,6 @@ command revInternal__ResetPreferences
820821
put "selectedObject" into tPropsArray["cREVMsgIntelligenceObject"]
821822
put "false" into tPropsArray["cSEHideErrors"]
822823
put "56" into tPropsArray["cFieldHeight"]
823-
put "none" into tPropsArray["cBackDrop"]
824824
put "300" into tPropsArray["cREVUnmaximizedScriptHeight"]
825825
put "13,125" into tPropsArray["cToolsTopLeft"]
826826
put "--" into tPropsArray["cCommentCharacter"]
@@ -1716,9 +1716,9 @@ command revInternal__InitialiseFinalSteps
17161716
revInternal__Log "Message", "Setting up verbose debugging"
17171717
send "revVerboseDebug" && the cVerboseDebug of stack "revPreferences" to stack "revFrontScriptLibrary"
17181718

1719-
if the cBackDrop of stack "revPreferences" is not "none" and the cBackDrop of stack "revPreferences" is not empty then
1719+
if the cBackDrop of stack "revPreferences" is not "none" then
17201720
revInternal__Log "Message", "Setting up backdrop"
1721-
set the backdrop to the cBackDrop of stack "revPreferences"
1721+
set the backdrop to the cBackDropColor of stack "revPreferences"
17221722
end if
17231723

17241724
revInternal__Log "Message", "Closing Splash"

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,7 +3385,11 @@ on revIDECreateObject pObjectTypeID, pTarget, pLoc
33853385
if sClassicObjectProperties is empty then __objectPropertiesRead
33863386
# Set the default stack to the target we're creating the object on
33873387
set the defaultstack to revIDEStackOfObject(pTarget)
3388-
3388+
3389+
if pLoc is empty then
3390+
put the loc of this card of the defaultStack into pLoc
3391+
end if
3392+
33893393
# Create the object
33903394
lock screen
33913395
lock messages
@@ -3470,30 +3474,22 @@ on revIDECreateObject pObjectTypeID, pTarget, pLoc
34703474
end revIDECreateObject
34713475

34723476
on revIDECloneObject pLongID
3473-
local tTarget, tLoc, tControlType
3474-
local tCreatedControlID
3475-
3476-
put the loc of pLongID into tLoc
3477-
add 20 to item 1 of tLoc
3478-
add 20 to item 2 of tLoc
3479-
3480-
put revIDECardOfObject(pLongID) into tTarget
3481-
if not exists(tTarget) then return __revIDEError("Cannot create object. Target does not exist:" && tTarget)
3482-
3483-
-- # Set the default stack to the target we're creating the object on
3484-
-- set the defaultstack to the owner of tTarget
3485-
3486-
-- # Create the object
3487-
-- lock screen
3488-
-- lock messages
3489-
--do "clone" && pLongID
3490-
clone pLongID
3491-
put the long ID of the last control into tCreatedControlID
3492-
set the loc of tCreatedControlID to tLoc
3493-
3494-
-- unlock messages
3495-
-- unlock screen
3496-
-- return tCreatedControlID
3477+
if not exists(pLongID) then return __revIDEError("Cannot create object. Target does not exist:" && pLongID)
3478+
3479+
if word 1 of pLongID is "card" or word 1 of pLongID is "stack" then
3480+
clone pLongID
3481+
else
3482+
local tTarget, tLoc, tControlType
3483+
local tCreatedControlID
3484+
3485+
put the loc of pLongID into tLoc
3486+
add 20 to item 1 of tLoc
3487+
add 20 to item 2 of tLoc
3488+
3489+
clone pLongID
3490+
put it into tCreatedControlID
3491+
set the loc of tCreatedControlID to tLoc
3492+
end if
34973493
end revIDECloneObject
34983494

34993495
on revIDECloneObjectWithDefaults pLongID
@@ -8789,9 +8785,6 @@ on revIDEToggle pProperty
87898785
break
87908786
case "Backdrop"
87918787
if the backDrop is "none" then
8792-
if revIDEGetPreference("cBackDropColor") is empty then
8793-
revIDESetPreference "cBackDropColor", "black"
8794-
end if
87958788
set the backDrop to revIDEGetPreference("cBackDropColor")
87968789
revIDESetPreference "cBackDrop", the backDrop
87978790
else
@@ -10430,6 +10423,10 @@ private function __fetchAndRemoveControlTags pCard
1043010423
return tTags
1043110424
end __fetchAndRemoveControlTags
1043210425

10426+
command revIDETutorialUpdateAndRemoveTags pStackName, @xTags
10427+
union xTags with __fetchAndRemoveTags(pStackName)
10428+
end revIDETutorialUpdateAndRemoveTags
10429+
1043310430
on revIDETutorialLoad pCourse, pTutorial, pLesson
1043410431
local tLocation
1043510432
put __findTutorialLocation(pCourse, pTutorial, pLesson) into tLocation
@@ -10456,7 +10453,7 @@ on revIDETutorialLoad pCourse, pTutorial, pLesson
1045610453
put return & tStackName after tStackList
1045710454
end if
1045810455

10459-
union tTags with __fetchAndRemoveTags(tStackName)
10456+
revIDETutorialUpdateAndRemoveTags tStackName, tTags
1046010457
end repeat
1046110458

1046210459
dispatch "revTutorialResume" to stack "revTutorial" with tStackList, tTags, tLessonDataA["step"]
49 Bytes
Binary file not shown.

Toolset/palettes/project browser/revprojectbrowserbehavior.livecodescript

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,16 @@ on cloneControls
885885
put pbSelectedObjects() into tControlList
886886

887887
lock screen
888+
local tOldDefaultStack
889+
put the defaultStack into tOldDefaultStack
890+
set the defaultStack to revIDEStackOfObject(line 1 of tControlList)
888891
repeat for each line tControlID in tControlList
889892
revIDECloneObject tControlID
890893
put the result & return after tClonedIDs
891894
end repeat
892895

893896
selectObjects tClonedIDs
897+
set the defaultStack to tOldDefaultStack
894898
unlock screen
895899
end cloneControls
896900

-6 Bytes
Binary file not shown.

Toolset/palettes/script editor/behaviors/revseeditorbehavior.livecodescript

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,10 @@ private function findObjectList pTarget, pDirection, pCallback, pCallbackTarget,
14451445
combine tObjectList with return as set
14461446
end if
14471447

1448+
if tObjectList is an array then
1449+
combine tObjectList with return as set
1450+
end if
1451+
14481452
return tObjectList
14491453
end findObjectList
14501454

Toolset/palettes/script editor/behaviors/revsehandlerlistbehavior.livecodescript

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function handlerTypeSortCallback pItem
129129
end switch
130130
end handlerTypeSortCallback
131131

132+
constant kDefaultHandlerTextColor = "#777777"
132133

133134
# Description
134135
# Called when the group might need to be updated. Updates the handler list. Also resizes the group.
@@ -139,7 +140,9 @@ command update
139140
put the result into tHandlers
140141

141142
local tDefaultHandlers, tIndex
142-
put revSEDefaultHandlers() into tDefaultHandlers
143+
if sePrefGet("editor,showDefaultHandlers") then
144+
put revSEDefaultHandlers() into tDefaultHandlers
145+
end if
143146
set the wholematches to false
144147

145148
local tCanAdd
@@ -170,7 +173,7 @@ command update
170173
end if
171174

172175
if tHandlers is not empty then
173-
put return &return after tHandlers
176+
put return & return & return after tHandlers
174177
end if
175178
put tCanAdd after tHandlers
176179

@@ -183,13 +186,15 @@ command update
183186

184187
if the number of words in tHandler is 1 then
185188
put false into tHandlerExists
189+
-- Existing handler names have a space after the icon
190+
put " " before tParseHandler
186191
end if
187192

188193
put "<p>" after tText
189194

190195
local tIsPrivate
191196
put false into tIsPrivate
192-
if char 1 of tParseHandler is "P" then
197+
if tHandlerExists and char 1 of tParseHandler is "P" then
193198
put true into tIsPrivate
194199
delete char 1 of tParseHandler
195200
end if
@@ -207,6 +212,11 @@ command update
207212
put merge("<sup shift=2><img src=[[tICon]]></img></sup>") after tText
208213
end if
209214

215+
if not tHandlerExists then
216+
put merge("<font color='[[kDefaultHandlerTextColor]]'>[[tParseHandler]]</font>") \
217+
into tParseHandler
218+
end if
219+
210220
put tParseHandler & "</p>" after tText
211221
end repeat
212222

@@ -274,28 +284,30 @@ command jumpToHandler pHandler, pAdded
274284
hideGroup
275285
end jumpToHandler
276286

277-
command closeAccept
278-
lock screen
279-
local tHandler
280-
put line (the hilitedLine of field "Handlers" of me) of the cHandlers of field "Handlers" of me into tHandler
281-
287+
command handlerPicked pHandler
282288
local tAdded
283289
put false into tAdded
284-
if the number of words in tHandler is 1 then
290+
if the number of words in pHandler is 1 then
285291
put true into tAdded
286292
-- Adding a default handler
287-
revSEAddDefaultHandler tHandler
293+
revSEAddDefaultHandler pHandler
288294
update
289295
set the wholematches to false
290296
local tLine
291-
put lineOffset(tHandler, the cHandlers of field "Handlers" of me) into tLine
297+
put lineOffset(pHandler, the cHandlers of field "Handlers" of me) into tLine
292298
select line tLine of field "Handlers" of me
293-
put line tLine of the cHandlers of field "Handlers" of me into tHandler
299+
put line tLine of the cHandlers of field "Handlers" of me into pHandler
294300
end if
295301

296302
-- Select the (now) extant handler
297-
jumpToHandler tHandler, tAdded
298-
303+
jumpToHandler pHandler, tAdded
304+
end handlerPicked
305+
306+
command closeAccept
307+
lock screen
308+
local tHandler
309+
put line (the hilitedLine of field "Handlers" of me) of the cHandlers of field "Handlers" of me into tHandler
310+
handlerPicked tHandler
299311
unlock screen
300312
end closeAccept
301313

Toolset/palettes/script editor/behaviors/revsemenubarbehavior.livecodescript

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,41 @@ private command buildHandlerMenu pContext
275275

276276
local tFormattedHandlers
277277
repeat for each line tHandler in tHandlers
278-
put word 2 of tHandler & return after tFormattedHandlers
278+
put tab & word 2 of tHandler & return after tFormattedHandlers
279279
end repeat
280280
delete the last char of tFormattedHandlers
281281

282-
if the number of lines of tHandlers = 0 then
283-
put "(No Handlers" into tFormattedHandlers
284-
set the cHandlers of me to empty
282+
local tDefaultHandlers
283+
put revSEDefaultHandlers() into tDefaultHandlers
284+
285+
local tFormattedDefaultHandlers
286+
repeat for each line tHandler in tDefaultHandlers
287+
put tab & tHandler & return after tFormattedDefaultHandlers
288+
end repeat
289+
delete the last char of tFormattedDefaultHandlers
290+
291+
local tShowDefaultHandlers
292+
dispatch function "sePrefGet" to me with "editor,showDefaultHandlers"
293+
put the result into tShowDefaultHandlers
294+
295+
local tMenu
296+
if tHandlers is not empty then
297+
put enableMenuItem("Go to handler...", true) into tMenu
298+
put return & tFormattedHandlers after tMenu
299+
else
300+
put enableMenuItem("Go to handler...", false) into tMenu
301+
end if
302+
if tDefaultHandlers is not empty then
303+
put return & enableMenuItem("Add default handler...", true) after tMenu
304+
put return & tFormattedDefaultHandlers after tMenu
285305
else
286-
set the cHandlers of me to tHandlers
306+
put return & enableMenuItem("Add default handler...", false) after tMenu
287307
end if
308+
put return & toggleMenuItem("Show default handlers", tShowDefaultHandlers) after tMenu
309+
310+
set the cHandlers of me to tHandlers
288311

289-
set the text of button "Handler" of me to modifyMenu("Handler", tFormattedHandlers)
312+
set the text of button "Handler" of me to modifyMenu("Handler", tMenu)
290313
end buildHandlerMenu
291314

292315
on menuPick pItemName
@@ -321,15 +344,31 @@ private command handleHandlerMenuPick pItemName
321344
exit handleHandlerMenuPick
322345
end if
323346

324-
local tLineNumber
325-
put the menuHistory of button "Handler" of me into tLineNumber
326-
327-
local tHandler
328-
put line tLineNumber of the cHandlers of me into tHandler
347+
set the itemdelimiter to "|"
348+
switch item 1 of pItemName
349+
case "Go to handler..."
350+
local tPick, tHandlerInfo
351+
put item 2 of pItemName into tPick
352+
if not matchText(the cHandlers of me, "(.* " & tPick & " .*)", \
353+
tHandlerInfo) then
354+
exit handleHandlerMenuPick
355+
end if
356+
357+
dispatch "handlerPicked" to group "Left Handler List" \
358+
with tHandlerInfo
359+
break
360+
case "Add default handler..."
361+
dispatch "handlerPicked" to group "Left Handler List" \
362+
with item 2 of pItemName
363+
break
364+
case "Show default handlers"
365+
local tShowDefaultHandlers
366+
dispatch function "sePrefGet" to me with "editor,showDefaultHandlers"
367+
put the result into tShowDefaultHandlers
368+
dispatch "sePrefSet" to me with "editor,showDefaultHandlers", not tShowDefaultHandlers
369+
break
370+
end switch
329371

330-
local tScriptLineNumber
331-
put word 3 of tHandler into tScriptLineNumber
332-
send "goLine tScriptLineNumber, true" to group "Editor"
333372
seUpdateLeftBar
334373
seUpdateToolbar
335374
end handleHandlerMenuPick
@@ -500,6 +539,7 @@ private command handleHelpMenuPick pItemName
500539
case "Resource Center"
501540
case "Start Center"
502541
revIDEOpenPalette pItemName
542+
break
503543
case "User Guide"
504544
revIDELaunchResource pItemName
505545
break
@@ -511,6 +551,20 @@ end handleHelpMenuPick
511551

512552
#########
513553

554+
private function toggleMenuItem pItem, pHilited
555+
if pHilited then
556+
return "!c" & pItem
557+
end if
558+
return "!n" & pItem
559+
end toggleMenuItem
560+
561+
private function enableMenuItem pItem, pEnabled
562+
if pEnabled then
563+
return pItem
564+
end if
565+
return "(" & pItem
566+
end enableMenuItem
567+
514568
private function modifyMenu pMenuName, pMenu
515569
if the last char of pMenu is not return then
516570
put return after pMenu

0 commit comments

Comments
 (0)