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

Commit f9de892

Browse files
Merge pull request #1953 from livecode/merge-develop-9.0-28.03.2018
Merge develop 9.0 28.03.2018
2 parents 8f2dee9 + a98b6f6 commit f9de892

21 files changed

+156
-123
lines changed

Toolset/libraries/revdebuggerlibrary.livecodescript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,9 @@ command revDebuggerUpdateScriptEditor pObject, pHandler, pLine, pState, pError
20712071
revGoScriptEditor the name of stack tScriptEditor
20722072

20732073
if pError is not empty then
2074+
if the number of items of pError is 1 then
2075+
put comma & pLine after pError
2076+
end if
20742077
# OK-2008-07-10 : This needs to be sent in time so that it arrives after the script
20752078
# editor has finished initializing itself.
20762079
send "revSEDisplayExecutionError pError, pObject" to stack tScriptEditor in 0 milliseconds

Toolset/libraries/revidedeveloperextensionlibrary.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ on __revIDEDeveloperExtensionDoCreateTestStack pPath, tRectsA, pDetailsA
383383
create stack "LiveCode Extension Test Window"
384384
if tRectsA["rect"] is not empty then
385385
set the rect of stack "LiveCode Extension Test Window" to tRectsA["rect"]
386-
else
386+
else if tRectsA["loc"] is not empty then
387387
set the loc of stack "LiveCode Extension Test Window" to tRectsA["loc"]
388388
end if
389389
set the destroyStack of stack "LiveCode Extension Test Window" to true

Toolset/libraries/revideextensionlibrary.livecodescript

Lines changed: 17 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -362,59 +362,27 @@ private command __extensionDownloadVerify pCacheIndex
362362
set the itemdel to "."
363363
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'.")
364364

365-
# Get initial manifest data needed for loading
366-
local tManifestData, tManifestXMLTree
367-
put __extensionManifestData(pCacheIndex) into tManifestData
368-
put revXMLCreateTree(tManifestData,true,true,false) into tManifestXMLTree
369-
370-
# Check the manifest contains a name
371-
local tExtensionName
372-
put __extensionManifestValueFromTree(tManifestXMLTree, "name") into tExtensionName
365+
# Ensure the zip contains the things we expect
366+
local tManifestDataA
367+
extensionValidateLCEPackage tExtensionPath, tManifestDataA
373368
if the result is not empty then
374-
return __extensionError(pCacheIndex,"Could not install extension. The package manifest must contain a valid name (com.livecode.extensions.<developer_ID>.<extension_name>)")
375-
end if
376-
__extensionPropertySet pCacheIndex, "name", tExtensionName
377-
378-
# Check the manifest contains a version
379-
local tExtensionVersion
380-
put __extensionManifestValueFromTree(tManifestXMLTree, "version") into tExtensionVersion
381-
if the result is not empty then
382-
return __extensionError(pCacheIndex,"Could not install extension. The package manifest must contain a valid version number (1.2.3 - major,minor,maintenance)")
383-
end if
384-
__extensionPropertySet pCacheIndex, "version", tExtensionVersion
385-
386-
# Check the manifest contains an author
387-
local tExtensionAuthor
388-
put __extensionManifestValueFromTree(tManifestXMLTree, "author") into tExtensionAuthor
389-
if the result is not empty then
390-
return __extensionError(pCacheIndex,"Could not install extension. The package manifest must contain an author")
391-
end if
392-
__extensionPropertySet pCacheIndex, "author", tExtensionAuthor
393-
394-
# Check the manifest contains an type
395-
local tExtensionType
396-
put __extensionManifestValueFromTree(tManifestXMLTree, "type") into tExtensionType
397-
if the result is not empty then
398-
return __extensionError(pCacheIndex,"Could not install extension. The package manifest must contain a type")
399-
end if
400-
__extensionPropertySet pCacheIndex, "type", tExtensionType
401-
402-
# Check the manifest contains an title
403-
local tExtensionTitle
404-
put __extensionManifestValueFromTree(tManifestXMLTree, "title") into tExtensionTitle
405-
if the result is not empty then
406-
return __extensionError(pCacheIndex,"Could not install extension. The package manifest must contain a title")
369+
return the result
407370
end if
408-
__extensionPropertySet pCacheIndex, "title", tExtensionTitle
409371

410-
revXMLDeleteTree tManifestXMLTree
372+
repeat for each key tKey in tManifestDataA
373+
__extensionPropertySet pCacheIndex, tKey, tManifestDataA[tKey]
374+
end repeat
411375

412376
# Build the type ID from the name and version
413-
__extensionPropertySet pCacheIndex, "type_id", tExtensionName & "." & tExtensionVersion
377+
__extensionPropertySet pCacheIndex, "type_id", \
378+
tManifestDataA["name"] & "." & tManifestDataA["version"]
414379
end __extensionDownloadVerify
415380

416381
private command __extensionInstall pCacheIndex, pPackage, pFromStore
417382
__extensionDownloadVerify pCacheIndex
383+
if the result is not empty then
384+
throw "Error installing extension" && pPackage & return & the result
385+
end if
418386

419387
local tName, tTypeId, tInstallPath
420388
put __extensionPropertyGet(pCacheIndex, "name") into tName
@@ -497,6 +465,9 @@ end __extensionInstallCopyInterfaceFile
497465
private command __extensionInstallLoad pCacheIndex, pName, pInstallFolder, pProgress
498466
local tFolderData
499467
extensionFindInFolder pInstallFolder, true, false, tFolderData
468+
if tFolderData is empty then
469+
throw "extension missing from" && pInstallFolder
470+
end if
500471

501472
local tDataA
502473
put tFolderData[pName][pInstallFolder] into tDataA["copies"][1]
@@ -1095,7 +1066,8 @@ private command __revIDELCBExtensionLoad pID, pFolder, pVersion, pStatus, \
10951066
put pAdditionalInfoA["support_files"] into tSupportFiles
10961067
local tLoadOnStartup
10971068
if pError is empty then
1098-
put revIDEExtensionGetLoadOnStartup(pID) into tLoadOnStartup
1069+
put pAdditionalInfoA["_ide"] is true or \
1070+
revIDEExtensionGetLoadOnStartup(pID) into tLoadOnStartup
10991071
end if
11001072
if not pIsStartup or tLoadOnStartup is not false then
11011073
__LoadExtension tCacheIndex, "lcb", pSourceFile, pFolder, pStatus, pError
@@ -1346,34 +1318,6 @@ private function __extensionManifestValueFromTree pTreeID, pProperty
13461318
return tValue for value
13471319
end __extensionManifestValueFromTree
13481320

1349-
private function __extensionManifestData pCacheIndex
1350-
# Get the path to the package file
1351-
local tExtensionPackageFile
1352-
put __extensionPropertyGet(pCacheIndex, "download_package_path") into tExtensionPackageFile
1353-
1354-
if not there is a file tExtensionPackageFile then return __extensionError(pCacheIndex,"Could not extract manifest because package was not found in downloads folder")
1355-
1356-
# A zip can come compressed with a base folder or without. So work out what the
1357-
# root folder is before trying to extract files
1358-
revZipOpenArchive tExtensionPackageFile, "read"
1359-
1360-
local tZipItems, tZipRoot
1361-
put revZipEnumerateItems(tExtensionPackageFile) into tZipItems
1362-
1363-
if the last char of line 1 of tZipItems is "/" then
1364-
put line 1 of tZipItems into tZipRoot
1365-
else
1366-
put empty into tZipRoot
1367-
end if
1368-
1369-
# Extract the package manfiest to a variable to read key data
1370-
local tManifestData, tManifestXMLTree, tValue
1371-
revZipExtractItemToVariable tExtensionPackageFile, (tZipRoot & "manifest.xml"), "tManifestData"
1372-
1373-
revZipCloseArchive tExtensionPackageFile
1374-
return tManifestData
1375-
end __extensionManifestData
1376-
13771321
function __extensionSampleStacks pID, pFolder
13781322
local tSampleFolder, tSamples, tSampleArray
13791323

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11876,7 +11876,14 @@ function revIDELookupError pType, pError
1187611876
else if tCode is kExternalHandlerErrorCode then
1187711877
return "External handler execution error:" && item 4 to -1 of line 1 of pError
1187811878
end if
11879-
return line tCode of the scriptExecutionErrors
11879+
11880+
if tCode is an integer then
11881+
get line tCode of the scriptExecutionErrors
11882+
if it is not empty then
11883+
return it
11884+
end if
11885+
end if
11886+
return tCode
1188011887
else if pType is "warning" then
1188111888
return empty
1188211889
end if

Toolset/palettes/dictionary/behaviors/revdictionarybehavior.livecodescript

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
script "revDictionaryBehavior"
1+
script "revDictionaryBehavior" with behavior "revPaletteBehavior"
22
-- The dictionary starts to hide elements at lower than 992 pixels
33
-- *TODO* Tweak the CSS to rearrange things appropriately
44
constant kDictionaryMinWidth = 992
@@ -93,5 +93,11 @@ end showUpgradeOptions
9393

9494
# bug 17819 enable cmd+c in dictionary
9595
on commandKeyDown pWhich
96-
if pWhich is not "C" then pass commandKeyDown
96+
if pWhich is not "C" then
97+
if pWhich is "W" then
98+
close me
99+
else
100+
pass commandKeyDown
101+
end if
102+
end if
97103
end commandKeyDown

Toolset/palettes/extension manager/revideextensionmanagerrowbehavior.livecodescript

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ private function __MenuActionsForRow pDataA
124124
put tShow after tActions
125125
end if
126126

127-
local tLoadOnStartup
128-
put "Load on startup/|Toggle Load" & return into tLoadOnStartup
129-
if revIDEExtensionGetLoadOnStartup(pDataA["name"]) is not false then
130-
put "!c" before tLoadOnStartup
127+
if not pDataA["_ide"] then
128+
local tLoadOnStartup
129+
put "Load on startup/|Toggle Load" & return into tLoadOnStartup
130+
if revIDEExtensionGetLoadOnStartup(pDataA["name"]) is not false then
131+
put "!c" before tLoadOnStartup
132+
end if
133+
put tLoadOnStartup after tActions
131134
end if
132-
put tLoadOnStartup after tActions
133135

134136
local tSampleList
135137
if pDataA["samples"] is not empty then

Toolset/palettes/revdatagridlibrary/behaviorsdatagridbuttonbehavior.livecodescript

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3560,52 +3560,78 @@ end _table.ScrollColumnIntoView
35603560

35613561

35623562
private command _table.LayoutDataArea
3563-
local theViewRect, theRect, theRootGroup
3563+
local theViewRect, theRect
35643564
put _WorkingGroupRect(the long ID of me) into theViewRect
35653565
put theViewRect into theRect
3566-
put the long ID of group "dgHeaderComponents" of me into theRootGroup
35673566

3568-
## Shift all content
3569-
set the topLeft of theRootGroup to item 1 to 2 of theRect
3570-
3571-
## Reposition bottom element
3572-
local theSBWidth
3573-
if the visible of scrollbar "dgScrollbar" of me then put the width of scrollbar "dgScrollbar" of me into theSBWidth
3574-
else put the dgProps["scrollbar corner offset"] of me into theSBWidth
3575-
set the visible of graphic "dgCornerPiece" of group "dgHorizontalComponents" of me to the visible of scrollbar "dgScrollbar" of me
3567+
local tHeaderComponents, tHorizontalComponents
3568+
local tVScrollbar, tHScrollbar, tCornerPiece
3569+
put the long id of group "dgHeaderComponents" of me into tHeaderComponents
3570+
put the long id of group "dgHorizontalComponents" of me into tHorizontalComponents
3571+
put the long id of scrollbar "dgScrollbar" of me into tVScrollbar
3572+
put the long id of scrollbar "dgHScrollbar" of tHorizontalComponents into tHScrollbar
3573+
put the long id of graphic "dgCornerPiece" of tHorizontalComponents into tCornerPiece
35763574

3577-
set the rect of scrollbar "dgHScrollbar" of group "dgHorizontalComponents" of me to \
3578-
item 1 of theRect, item 4 of theRect - the height of scrollbar "dgHScrollbar" of group "dgHorizontalComponents" of me, \
3579-
item 3 of theRect - theSBWidth, item 4 of theRect
3580-
3581-
## Header mask
3582-
put the bottom of group "dgHeaderMask" of theRootGroup into item 4 of theRect
3583-
set the rect of group "dgHeaderMask" of theRootGroup to theRect
3575+
## Shift all content
3576+
set the topLeft of tHeaderComponents to item 1 to 2 of theRect
35843577

3585-
## Define new top/bottom
3586-
if the visible of theRootGroup then
3587-
put item 4 of theRect into item 2 of theRect
3578+
if the visible of tHeaderComponents then
3579+
# Set the rect of the header mask
3580+
local tHeaderMaskRect
3581+
put theRect into tHeaderMaskRect
3582+
put the bottom of group "dgHeaderMask" of tHeaderComponents into item 4 of tHeaderMaskRect
3583+
set the rect of group "dgHeaderMask" of tHeaderComponents to tHeaderMaskRect
3584+
## Define new top of content rect
3585+
put item 4 of tHeaderMaskRect into item 2 of theRect
35883586
end if
35893587

3590-
if the visible of group "dgHorizontalComponents" of me then
3591-
put the top of scrollbar "dgHScrollbar" of group "dgHorizontalComponents" of me into item 4 of theRect
3592-
else
3593-
put item 4 of theViewRect - the dgProps["scrollbar corner offset"] of me into item 4 of theRect
3588+
if the environment is not "mobile" then
3589+
## Reposition bottom element
3590+
local theSBWidth
3591+
if the visible of tVScrollbar then
3592+
put the width of tVScrollbar into theSBWidth
3593+
else
3594+
put the dgProps["scrollbar corner offset"] of me into theSBWidth
3595+
end if
3596+
# If the hscrollbar is not shown, then the horizontal components group
3597+
# containing it is invisible, so the corner piece is also invisible.
3598+
# So we can just set visibility of corner piece to the visible of the
3599+
# vscrollbar
3600+
set the visible of tCornerPiece to the visible of tVScrollbar
3601+
3602+
set the rect of tHScrollbar to \
3603+
item 1 of theRect, \
3604+
item 4 of theRect - the height of tHScrollbar, \
3605+
item 3 of theRect - theSBWidth, item 4 of theRect
3606+
3607+
if the visible of tHorizontalComponents then
3608+
put the top of tHScrollbar into item 4 of theRect
3609+
else
3610+
put item 4 of theViewRect - the dgProps["scrollbar corner offset"] of me \
3611+
into item 4 of theRect
3612+
end if
3613+
3614+
## V Scrollbar and corner piece
3615+
set the rect of tVScrollbar to \
3616+
item 3 of theRect - the width of tVScrollbar, \
3617+
item 2 of theRect, item 3 of theRect, \
3618+
item 4 of theRect
3619+
3620+
set the rect of tCornerPiece to \
3621+
item 3 of theRect - the width of tVScrollbar, \
3622+
the top of tHScrollbar, \
3623+
item 3 of theRect, \
3624+
the bottom of tHScrollbar
3625+
3626+
## Masks
3627+
## AL-2013-07-30 [[ Bug 10108 ]] Thumb and scrollbar appear over top of DataGrid
3628+
if the visible of tVScrollbar then
3629+
put item 3 of theRect - theSBWidth into item 3 of theRect
3630+
end if
3631+
else if __HasMobileScroller() then
3632+
mobileControlSet sScrollerId, "rect", theRect
35943633
end if
35953634

3596-
## V Scrollbar and corner piece
3597-
set the rect of scrollbar "dgScrollbar" of me to item 3 of theRect - the width of scrollbar "dgScrollbar" of me, \
3598-
item 2 of theRect, item 3 of theRect, \
3599-
item 4 of theRect
3600-
3601-
set the rect of graphic "dgCornerPiece" of group "dgHorizontalComponents" of me to \
3602-
item 3 of theRect - the width of scrollbar "dgScrollbar" of me, \
3603-
the top of scrollbar "dgHScrollbar" of group "dgHorizontalComponents" of me, item 3 of theRect, \
3604-
the bottom of scrollbar "dgHScrollbar" of group "dgHorizontalComponents" of me
3605-
3606-
## Masks
3607-
## AL-2013-07-30 [[ Bug 10108 ]] Thumb and scrollbar appear over top of DataGrid
3608-
if the visible of scrollbar "dgScrollbar" of me then put item 3 of theRect - theSBWidth into item 3 of theRect
36093635
set the topLeft of group "dgListMask" of me to item 1 to 2 of theRect
36103636
set the rect of group "dgListMask" of me to theRect
36113637
set the rect of group "dgAlternatingRowsMask" of me to theRect
@@ -10791,7 +10817,7 @@ function DG2_CustomisableControlsGetDefaultEditModeReorderControl
1079110817
if there is not a group "DG2 Default Edit Mode Reorder Control"of _TemplateControl() then
1079210818
local tMsgsAreLocked
1079310819
put the lockMessages into tMsgsAreLocked
10794-
lock messages
10820+
unlock messages
1079510821

1079610822
reset the templateGroup
1079710823
create invisible group "DG2 Default Edit Mode Reorder Control" in _TemplateControl()
@@ -10812,7 +10838,7 @@ function DG2_CustomisableControlsGetDefaultEditModeActionSelectControl
1081210838
if there is not a group "DG2 Default Edit Mode Action Select Control" of _TemplateControl() then
1081310839
local tMsgsAreLocked
1081410840
put the lockMessages into tMsgsAreLocked
10815-
lock messages
10841+
unlock messages
1081610842

1081710843
reset the templateGroup
1081810844
create invisible group "DG2 Default Edit Mode Action Select Control" in _TemplateControl()
@@ -10836,7 +10862,7 @@ function DG2_CustomisableControlsGetDefaultEditModeActionControl
1083610862

1083710863
local tMsgsAreLocked
1083810864
put the lockMessages into tMsgsAreLocked
10839-
lock messages
10865+
unlock messages
1084010866

1084110867
reset the templateGroup
1084210868
create invisible group "DG2 Default Action Control" in _TemplateControl()
@@ -10866,7 +10892,7 @@ private function DG2_CustomisableControlsGetDefaultSwipeControl pName
1086610892

1086710893
local tMsgsAreLocked
1086810894
put the lockMessages into tMsgsAreLocked
10869-
lock messages
10895+
unlock messages
1087010896

1087110897
local tGroup
1087210898
reset the templateGroup

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,11 +2992,41 @@ command scriptFormat pScope, pDontGroup
29922992
local tOldText
29932993
put the text of field "Script" of me into tOldText
29942994

2995+
local tFirstLine, tLastLine, tCharsAboveFirstLineOld, tCharsAboveLastLineOld
2996+
get the selectedLine
2997+
put word 2 of it into tFirstLine
2998+
if word 4 of it is a number then put word 4 of it into tLastLine else put tFirstLine into tLastLine
2999+
3000+
put the number of chars of line 1 to tFirstLine of tOldText into tCharsAboveFirstLineOld
3001+
if tFirstLine is tLastLine then
3002+
put tCharsAboveFirstLineOld into tCharsAboveLastLineOld
3003+
else
3004+
put the number of chars of line 1 to tLastLine of tOldText into tCharsAboveLastLineOld
3005+
end if
3006+
29953007
local tNewText
29963008
put textFormatSelection(tOldText) into tNewText
3009+
3010+
local tCharsAboveFirstLineNew, tCharsAboveLastLineNew, tDiffFirstLine, tDiffLastLine
3011+
put the number of chars of line 1 to tFirstLine of tNewText into tCharsAboveFirstLineNew
3012+
if tFirstLine is tLastLine then
3013+
put tCharsAboveFirstLineNew into tCharsAboveLastLineNew
3014+
else
3015+
put the number of chars of line 1 to tLastLine of tNewText into tCharsAboveLastLineNew
3016+
end if
3017+
3018+
put tCharsAboveFirstLineOld - tCharsAboveFirstLineNew into tDiffFirstLine
3019+
put tCharsAboveLastLineOld - tCharsAboveLastLineNew into tDiffLastLine
3020+
3021+
local tFirstLineChar
3022+
put (the number of chars of line 1 to tFirstLine - 1 of tNewText) + 1 into tFirstLineChar
3023+
29973024
textReplace tStartChar, tOldText, tNewText, empty, pDontGroup
29983025

29993026
if tStart is not empty then
3027+
subtract tDiffFirstLine from tStart
3028+
put max(tStart, tFirstLineChar) into tStart # dont let selection go into previous line
3029+
subtract tDiffLastLine from tEnd
30003030
select char tStart to tEnd of field "Script" of me
30013031
end if
30023032

0 commit comments

Comments
 (0)