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

Commit d8e9db9

Browse files
Merge pull request #1955 from livecode/merge-develop_9.0_09.04.18
Merge develop 9.0 09.04.18
2 parents f9de892 + 4f38428 commit d8e9db9

File tree

12 files changed

+153
-87
lines changed

12 files changed

+153
-87
lines changed

Toolset/libraries/revdebuggerlibrary.livecodescript

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ local sLastBreakInfo
2828
#
2929
################################################################################
3030

31+
constant kUndebuggableHandlers = "moveStack resizeStack resizeControl"
32+
3133
# Description
3234
# Initializes the debugger, should be called on IDE startup or when script debug mode is turned on.
3335
private command __Initialize
@@ -2362,12 +2364,12 @@ on traceError pHandler, pLine, pPosition, pError
23622364
pass traceError
23632365
end if
23642366

2365-
-- We can not flush moveStack and resizeStack messages so the IDE will lock up if we try and trace
2367+
-- The IDE will lock up if we try and trace messages repeatedly coming from OS
23662368
local tContexts
23672369
put the executionContexts into tContexts
23682370
local tLine
23692371
repeat for each line tLine in tContexts
2370-
if item -2 of tLine is among the words of "moveStack resizeStack" then
2372+
if item -2 of tLine is among the words of kUndebuggableHandlers then
23712373
pass traceError
23722374
end if
23732375
end repeat
@@ -2435,12 +2437,12 @@ on traceBreak pHandler, pLine
24352437
end if
24362438

24372439
if "development" is in the environment then
2438-
-- We can not flush moveStack and resizeStack messages so the IDE will lock up if we try and trace
2440+
-- The IDE will lock up if we try and trace messages repeatedly coming from OS
24392441
local tContexts
24402442
put the executionContexts into tContexts
24412443
local tLine
24422444
repeat for each line tLine in tContexts
2443-
if item -2 of tLine is among the words of "moveStack resizeStack" then
2445+
if item -2 of tLine is among the words of kUndebuggableHandlers then
24442446
pass traceBreak
24452447
end if
24462448
end repeat

Toolset/libraries/revideextensionlibrary.livecodescript

Lines changed: 78 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,55 @@ command revIDEExtensionDownloadAndInstall pExtensionPath, pType, pCallbackObject
7878
__extensionsChanged
7979
end revIDEExtensionDownloadAndInstall
8080

81-
command revIDEExtensionInstall pPackageLocation
81+
private function __extensionDependencyExists pExt
82+
return __extensionCacheID("name", pExt) is a number
83+
end __extensionDependencyExists
84+
85+
private command __extensionInstallPackage pPackageLocation
8286
if there is not a file pPackageLocation then
83-
answer error "No package found at" && pPackageLocation
84-
exit revIDEExtensionInstall
87+
throw "No package found at" && pPackageLocation
8588
end if
8689

87-
local tCacheIndex, tFromStore
90+
local tCacheIndex
8891
put __extensionCacheID("download_package_path", pPackageLocation) \
8992
into tCacheIndex
9093
if tCacheIndex is not a number then
91-
-- Direct install from package file
92-
put false into tFromStore
9394
put the number of elements of sExtensions + 1 into tCacheIndex
9495
__extensionPropertySet tCacheIndex, "download_package_path", pPackageLocation
95-
else
96-
put true into tFromStore
96+
__extensionUpdateUIWithPackage tCacheIndex, pPackageLocation
9797
end if
98+
__extensionPropertySet tCacheIndex, "status", "installing"
99+
100+
local tVerifyResult, tName
101+
__extensionDownloadVerify tCacheIndex
102+
put the result into tVerifyResult
103+
if tVerifyResult is not empty then
104+
__extensionCacheRemove tCacheIndex
105+
throw "Error installing extension" && pPackageLocation & return & the result
106+
end if
107+
108+
put __extensionPropertyGet(tCacheIndex, "name") into tName
98109

110+
# Fetch the dependency list (minus builtin modules) and ensure all
111+
# are loaded
112+
local tDeps
113+
put revIDEExtensionsOrderByDependency(tName) into tDeps
114+
repeat for each line tExtension in tDeps
115+
# Skip the one we're installing
116+
if tExtension is tName then
117+
next repeat
118+
end if
119+
# Ensure dependency exists
120+
if not __extensionDependencyExists(tExtension) then
121+
throw "Dependency" && tExtension && "not available. Please install before proceeding"
122+
end if
123+
end repeat
124+
__extensionInstall tCacheIndex, pPackageLocation
125+
end __extensionInstallPackage
126+
127+
command revIDEExtensionInstall pPackageLocation
99128
try
100-
__extensionInstall tCacheIndex, pPackageLocation, tFromStore
129+
__extensionInstallPackage pPackageLocation
101130
catch tError
102131
answer error tError
103132
end try
@@ -288,14 +317,32 @@ private command __extensionDownloadBegin pExtensionUrl, pType, pCallbackObject,
288317
return tCacheIndex for value
289318
end __extensionDownloadBegin
290319

320+
private command __extensionUpdateUIWithPackage pCacheIndex, pPath
321+
# Get initial name from file
322+
set the itemdel to "."
323+
local tName
324+
put pPath into tName
325+
delete the last item of tName
326+
repeat while the last item of tName is a number
327+
delete the last item of tName
328+
end repeat
329+
__extensionPropertySet pCacheIndex, "name", tName
330+
331+
# Send update to refresh UI with new package installation
332+
doExtensionsChanged
333+
end __extensionUpdateUIWithPackage
334+
291335
# Download the extension
292336
private command __extensionDownload pCacheIndex
293337
# Check the file extension is correct
294338
local tURL
295339
put __extensionPropertyGet(pCacheIndex,"package_url") into tURL
296340

297341
set the itemdel to "."
298-
if the last item of tURL is not "lce" then return __extensionError(pCacheIndex,"Could not download extension. The package must have the file extension 'lce':" && tURL)
342+
if the last item of tURL is not "lce" then
343+
return __extensionError(pCacheIndex, \
344+
"The package must have the file extension 'lce':" && tURL)
345+
end if
299346

300347
local tPackageFilePath
301348
set the itemdel to "/"
@@ -306,19 +353,9 @@ private command __extensionDownload pCacheIndex
306353
__extensionPropertySet pCacheIndex, "progress_message", "Downloading"
307354
__extensionPropertySet pCacheIndex, "progress", 0
308355
__extensionPropertySet pCacheIndex, "label", tPackageFilePath
356+
__extensionPropertySet pCacheIndex, "downloaded_from_store", true
309357

310-
# Put is a first stab at the name
311-
set the itemdel to "."
312-
local tName
313-
put tPackageFilePath into tName
314-
delete the last item of tName
315-
repeat while the last item of tName is a number
316-
delete the last item of tName
317-
end repeat
318-
__extensionPropertySet pCacheIndex, "name", tName
319-
320-
# Send update to refresh UI with new package installation
321-
__extensionsChanged
358+
__extensionUpdateUIWithPackage pCacheIndex, tPackageFilePath
322359

323360
# Update progress
324361
__extensionSendProgressUpdate pCacheIndex, "Downloading", 0
@@ -356,11 +393,18 @@ private command __extensionDownloadVerify pCacheIndex
356393
put __extensionPropertyGet(pCacheIndex, "download_package_path") into tExtensionPath
357394

358395
# Check the package exists
359-
if there is not a file tExtensionPath then return __extensionError(pCacheIndex,"Could not install extension. Package does not exists: " && tExtensionPath)
396+
if there is not a file tExtensionPath then
397+
return __extensionError(pCacheIndex, \
398+
"Package does not exist: " && tExtensionPath)
399+
end if
360400

361401
# Check the file extension is valid
362402
set the itemdel to "."
363-
if the last item of tExtensionPath is not "lce" then return __extensionError(pCacheIndex,"Could not install extension. The package extension '"&the last item of tExtensionPath&"' Is not valid. Must be 'lce'.")
403+
if the last item of tExtensionPath is not "lce" then
404+
return __extensionError(pCacheIndex, "The package extension '" & \
405+
the last item of tExtensionPath&"' is not valid." && \
406+
" Must be 'lce'.")
407+
end if
364408

365409
# Ensure the zip contains the things we expect
366410
local tManifestDataA
@@ -378,12 +422,7 @@ private command __extensionDownloadVerify pCacheIndex
378422
tManifestDataA["name"] & "." & tManifestDataA["version"]
379423
end __extensionDownloadVerify
380424

381-
private command __extensionInstall pCacheIndex, pPackage, pFromStore
382-
__extensionDownloadVerify pCacheIndex
383-
if the result is not empty then
384-
throw "Error installing extension" && pPackage & return & the result
385-
end if
386-
425+
private command __extensionInstall pCacheIndex, pPackage
387426
local tName, tTypeId, tInstallPath
388427
put __extensionPropertyGet(pCacheIndex, "name") into tName
389428
put __extensionPropertyGet(pCacheIndex, "type_id") into tTypeId
@@ -394,7 +433,7 @@ private command __extensionInstall pCacheIndex, pPackage, pFromStore
394433
__extensionInstallExtract pCacheIndex, tInstallPath, tTypeID, pPackage, 30
395434
__extensionInstallCopyInterfaceFile pCacheIndex, tName, tInstallPath, 50
396435
__extensionInstallLoad pCacheIndex, tName, tInstallPath, 80
397-
__extensionInstallFinalise pCacheIndex, tTypeID, pFromStore
436+
__extensionInstallFinalise pCacheIndex, tTypeID
398437
end __extensionInstall
399438

400439
on __extensionInstallRemoveOlderVersions pCacheIndex, pName, pProgress
@@ -491,9 +530,9 @@ private command __extensionInstallLoad pCacheIndex, pName, pInstallFolder, pProg
491530
end __extensionInstallLoad
492531

493532
# Delete installation files and original package
494-
on __extensionInstallFinalise pCacheIndex, pTypeId, pDeletePackage
533+
on __extensionInstallFinalise pCacheIndex, pTypeId
495534
# Delete temp package file
496-
if pDeletePackage then
535+
if __extensionPropertyGet(pCacheIndex, "downloaded_from_store") then
497536
# Update progress
498537
__extensionSendProgressUpdate pCacheIndex, "Removing temp files", 90
499538
local tTempInstallPackage
@@ -763,10 +802,9 @@ private command __extensionSetPropertyInfoFromManifest pID, pManifest
763802
put tPropertyInfo into sExtensionProperties[pID]
764803
end __extensionSetPropertyInfoFromManifest
765804

766-
private command __extensionError pCacheIndex, pErrorMessage
805+
private function __extensionError pCacheIndex, pErrorMessage
767806
__extensionSendProgressUpdate pCacheIndex, "Error:" && pErrorMessage, 100
768-
throw pErrorMessage
769-
return empty
807+
return pErrorMessage
770808
end __extensionError
771809

772810
# Send notication that widget has been added/removed
@@ -901,6 +939,10 @@ private function __extensionCacheID pPropertyToSearch, pValue
901939
end repeat
902940
end __extensionCacheID
903941

942+
private command __extensionCacheRemove pIndex
943+
delete variable sExtensions[pIndex]
944+
end __extensionCacheRemove
945+
904946
# Gets a property from the internal extension cache
905947
function __extensionPropertyGet pCacheIndex, pProperty
906948
return sExtensions[pCacheIndex][pProperty]
@@ -1285,39 +1327,6 @@ function revIDEExtensionFetchDefaultScript pFolder, pCacheIndex, pValidate
12851327
return tScript
12861328
end revIDEExtensionFetchDefaultScript
12871329

1288-
private function __extensionManifestValueFromTree pTreeID, pProperty
1289-
local tValue
1290-
switch pProperty
1291-
case "requires"
1292-
# Fetch extension dependencies
1293-
local tRequires, tCount
1294-
put 0 into tCount
1295-
put revXMLChildNames(pTreeID,"package",return,"requires",true) into tRequires
1296-
if tRequires begins with "xmlerr" then
1297-
put tRequires into tValue
1298-
break
1299-
end if
1300-
repeat for each line tDependency in tRequires
1301-
add 1 to tCount
1302-
local tName
1303-
put revXMLAttribute(pTreeID,"package" & "/" & tDependency,"name") into tName
1304-
if tName begins with "xmlerr" then
1305-
put tName into tValue
1306-
break
1307-
end if
1308-
put tName into tValue[tCount]
1309-
end repeat
1310-
default
1311-
put revXMLNodeContents(pTreeID,"/package/" & pProperty) into tValue
1312-
break
1313-
end switch
1314-
1315-
if tValue begins with "xmlerr" then
1316-
return tValue for error
1317-
end if
1318-
return tValue for value
1319-
end __extensionManifestValueFromTree
1320-
13211330
function __extensionSampleStacks pID, pFolder
13221331
local tSampleFolder, tSamples, tSampleArray
13231332

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,7 @@ on revIDEInitialiseIDELibrary
13491349
revIDEPropertyLibraryInitialise
13501350

13511351
ideSubscribe "ideExtensionsChanged"
1352+
ideSubscribe "ideDesktopChanged"
13521353
end revIDEInitialiseIDELibrary
13531354

13541355
on ideExtensionsChanged
@@ -9678,8 +9679,9 @@ command revIDESuspendDevelopmentTools
96789679
put tClosedStacksList into gREVRestore["stacks"]
96799680

96809681
-- Reset the windowBoundingRect
9681-
put the windowBoundingRect into gREVRestore["windowBoundingRect"]
9682-
set the windowBoundingRect to 0,0,item 3 to 4 of the windowBoundingRect
9682+
local tWindowRect
9683+
put revIDEStackScreenRect(the short name of the topStack, true) into tWindowRect
9684+
set the windowBoundingRect to tWindowRect
96839685

96849686
-- Show the restore dialog
96859687
lock recent
@@ -9746,7 +9748,7 @@ command revIDERestoreDevelopmentTools
97469748
set the defaultMenuBar to the long id of group "revMenuBar" of stack revIDEPaletteToStackName("menubar")
97479749
set the width of stack "revMenuBar" to the width of stack "revMenuBar" + 1 -- bug 1806
97489750
set the width of stack "revMenuBar" to the width of stack "revMenuBar" - 1
9749-
set the windowBoundingRect to gREVRestore["windowBoundingRect"]
9751+
ideSetWindowBoundingRect
97509752
choose gREVRestore["tool"]
97519753

97529754
-- Restore the script debug mode
@@ -12222,3 +12224,42 @@ end ideShouldShowUpgradeOptions
1222212224
private function hasConnection
1222312225
return url("http://google.com/") is not empty
1222412226
end hasConnection
12227+
12228+
on ideDesktopChanged
12229+
ideSetWindowBoundingRect
12230+
end ideDesktopChanged
12231+
12232+
/**
12233+
12234+
Update the window bounding rect for the current IDE palette layout
12235+
12236+
*/
12237+
12238+
command ideSetWindowBoundingRect
12239+
local tMenuBar
12240+
put revIDEPaletteToStackName("menubar") into tMenuBar
12241+
12242+
local tTools
12243+
put revIDEPaletteToStackName("tools") into tTools
12244+
12245+
local tToolsSlop
12246+
put the width of stack tTools + 50 into tToolsSlop
12247+
12248+
local tWindowRect
12249+
put revIDEStackScreenRect(tMenuBar, true) into tWindowRect
12250+
if tWindowRect is not empty then
12251+
if the screen of stack tTools is the screen of stack tMenubar then
12252+
if the right of stack tTools < (item 1 of tWindowRect + tToolsSlop) then
12253+
put the right of stack tTools + 5 into item 1 of tWindowRect
12254+
else if the left of stack tTools > (item 3 of tWindowRect - tToolsSlop) then
12255+
put the left of stack tTools - 5 into item 3 of tWindowRect
12256+
end if
12257+
end if
12258+
12259+
-- revMenubar may not be visible on macOS with text and icons off
12260+
if the visible of stack tMenubar then
12261+
put the bottom of stack tMenuBar + 5 into item 2 of tWindowRect
12262+
end if
12263+
set the windowBoundingRect to tWindowRect
12264+
end if
12265+
end ideSetWindowBoundingRect

Toolset/palettes/inspector/editors/com.livecode.pi.text.behavior.livecodescript

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ on editorInitialize
66

77
set the itemdelimiter to "."
88
put item -1 of the editorProperty["editor"] of me into sTextType
9+
10+
local tText, tOptions
11+
put the editorOptions of me into tOptions
12+
set the itemdelimiter to "|"
13+
repeat for each line tLine in tOptions
14+
local tProperty,tValue
15+
put item 1 of tLine into tProperty
16+
put item 2 of tLine into tValue
17+
set the tProperty of field 1 of me to tValue
18+
end repeat
919
end editorInitialize
1020

1121
on editorUpdate

0 commit comments

Comments
 (0)