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

Commit d4b9f35

Browse files
committed
[[ PI ]] Allow editors to control multiple props delimited by ;
1 parent 2ab1250 commit d4b9f35

3 files changed

Lines changed: 39 additions & 5 deletions

File tree

Toolset/libraries/revideextensionlibrary.livecodescript

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,16 @@ private command __ProcessInspectorMetadata @xMetadataA
523523
put true into xMetadataA[tKey]["user_visible"]
524524
end if
525525

526+
if xMetadataA[tKey]["properties"] is not empty then
527+
-- If there is a 'properties' value, delete the key
528+
-- and replace it with that value
529+
local tInfo, tNewKey
530+
put xMetadataA[tKey] into tInfo
531+
put tInfo["properties"] into tNewKey
532+
delete variable xMetadataA[tKey]
533+
delete variable tInfo["properties"]
534+
put tInfo into xMetadataA[tNewKey]
535+
end if
526536
end repeat
527537
end __ProcessInspectorMetadata
528538

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,8 +1318,15 @@ on __readGroupedPropertiesOfControl pGroupsA, @pDataA
13181318
end repeat
13191319

13201320
local tDataA
1321+
set the itemdelimiter to ";"
13211322
repeat for each key tKey in tPropMappingA
1322-
__fetchPropertyOfControl tKey, tDataA
1323+
if the number of items in tKey > 1 then
1324+
repeat for each item tRealProp in tKey
1325+
__fetchPropertyOfControl tRealProp, tDataA[tRealProp]
1326+
end repeat
1327+
else
1328+
__fetchPropertyOfControl tKey, tDataA
1329+
end if
13231330
end repeat
13241331

13251332
local tValue, tEffective
@@ -1428,8 +1435,17 @@ end __fetchPropertyOfControl
14281435
# for each of the properties
14291436
function __readPropertiesOfControl pList, @pData
14301437
local tError
1438+
set the itemdelimiter to ";"
14311439
repeat for each line tProp in pList
1432-
__fetchPropertyOfControl tProp, pData
1440+
-- If this pseudo-property is actually multiple properties,
1441+
-- the value is an array with keys the real property names
1442+
if the number of items in tProp > 1 then
1443+
repeat for each item tRealProp in tProp
1444+
__fetchPropertyOfControl tRealProp, pData[tRealProp]
1445+
end repeat
1446+
else
1447+
__fetchPropertyOfControl tProp, pData
1448+
end if
14331449
end repeat
14341450
end __readPropertiesOfControl
14351451

Toolset/palettes/inspector/behaviors/revinspectoreditorbehavior.livecodescript

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,17 @@ getProp editorValue[pKey]
119119
end editorValue
120120

121121
on updateProperty pForce
122-
if pForce or (sAllowUpdate is true and not sPropertyInfo["read_only"]) then
123-
dispatch "editorValueChanged" with sPropertyInfo["property_name"], sValue, false
124-
put false into sAllowUpdate
122+
if pForce or (sAllowUpdate is true and not sPropertyInfo["read_only"]) then
123+
set the itemdelimiter to ";"
124+
-- Single editors can control multiple properties delimited by ;
125+
if the number of items in sPropertyInfo["property_name"] > 1 then
126+
repeat for each item tProp in sPropertyInfo["property_name"]
127+
dispatch "editorValueChanged" with tProp, sValue[tProp], false
128+
end repeat
129+
else
130+
dispatch "editorValueChanged" with sPropertyInfo["property_name"], sValue, false
131+
end if
132+
put false into sAllowUpdate
125133
end if
126134
end updateProperty
127135

0 commit comments

Comments
 (0)