@@ -111,28 +111,33 @@ function revIDEExtensionProperties pTypeID
111111 return sExtensionProperties [pTypeID ]
112112end revIDEExtensionProperties
113113
114+ # organise the property info into the structure that the inspectors
115+ # expect, namely [<section>]["grouplist"][<group>]["proplist"][<prop>]
116+ private function __OrganiseInspectorMetadata pDataA
117+ local tExtensionPropsInfoA
118+ repeat for each key tProp in pDataA
119+ local tSection , tGroup , tOrder , tPropInfoA
120+ put pDataA [tProp ] into tPropInfoA
121+ put pDataA [tProp ]["order" ] into tOrder
122+ put pDataA [tProp ]["label" ] into tGroup
123+ put pDataA [tProp ]["section" ] into tSection
124+ put tPropInfoA into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["proplist" ][tProp ]
125+
126+ put true into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["widget_prop" ]
127+ put tOrder into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["order" ]
128+ end repeat
129+ return tExtensionPropsInfoA
130+ end __OrganiseInspectorMetadata
131+
114132function revIDEExtensionPropertiesInfo pTypeId, pOrganise
115133 local tPropsA , tExtensionPropsInfoA
116134 put revIDEExtensionProperties(pTypeId ) into tPropsA
117135
118136 if pOrganise then
119- # If pOrganise is true, organise the property info into the structure that the property
120- # inspector expects, namely [<section>]["grouplist"][<group>]["proplist"][<prop>]
121- repeat for each key tProp in tPropsA
122- local tSection , tGroup , tOrder , tPropInfoA
123- put tPropsA [tProp ] into tPropInfoA
124- put tPropsA [tProp ]["order" ] into tOrder
125- put tPropsA [tProp ]["label" ] into tGroup
126- put tPropsA [tProp ]["section" ] into tSection
127- put tPropInfoA into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["proplist" ][tProp ]
128-
129- put true into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["widget_prop" ]
130- put tOrder into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["order" ]
131- end repeat
137+ return __OrganiseInspectorMetadata(tPropsA )
132138 else
133- put tPropsA into tExtensionPropsInfoA
139+ return tPropsA
134140 end if
135- return tExtensionPropsInfoA
136141end revIDEExtensionPropertiesInfo
137142
138143function revIDEExtensionProperty pKind, pProperty
@@ -146,6 +151,25 @@ function revIDEExtensionProperty pKind, pProperty
146151 return __extensionPropertyGet(tExtensionID , pProperty )
147152end revIDEExtensionProperty
148153
154+ function revIDEExtensionStandaloneSettings pID
155+ # Get the internal cache index
156+ local tCacheIndex
157+ put __extensionCacheID("name" , pID ) into tCacheIndex
158+
159+ return __extensionPropertyGet(tCacheIndex , "standaloneSettings" )
160+ end revIDEExtensionStandaloneSettings
161+
162+ function revIDEExtensionStandaloneSettingsInfo pTypeId, pOrganise
163+ local tPropsA , tExtensionPropsInfoA
164+ put revIDEExtensionStandaloneSettings(pTypeId ) into tPropsA
165+
166+ if pOrganise then
167+ return __OrganiseInspectorMetadata(tPropsA )
168+ else
169+ return tPropsA
170+ end if
171+ end revIDEExtensionStandaloneSettingsInfo
172+
149173# #############################
150174# PRIVATE INSTALLATION PROCESS
151175# #############################
@@ -477,112 +501,95 @@ end __extensionUninstallComplete
477501# #############################
478502# PRIVATE SHARED
479503# #############################
504+ private command __ProcessInspectorMetadata @xMetadataA
505+ repeat for each key tKey in xMetadataA
506+ local tLabel , tSection
507+ if xMetadataA[tKey ]["section" ] is empty then
508+ put "Basic" into xMetadataA[tKey ]["section" ]
509+ end if
510+
511+ if xMetadataA[tKey ]["label" ] is empty then
512+ put tKey into xMetadataA[tKey ]["label" ]
513+ end if
514+
515+ # Process value options, default and delimiter
516+ replace comma with return in xMetadataA[tKey ]["options" ]
517+ replace "\n" with return in xMetadataA[tKey ]["delimiter" ]
518+ if xMetadataA[tKey ]["default" ] is not empty then
519+ replace "\n" with return in xMetadataA[tKey ]["default" ]
520+ end if
521+
522+ if xMetadataA[tKey ]["user_visible" ] is empty then
523+ put true into xMetadataA[tKey ]["user_visible" ]
524+ end if
525+
526+ end repeat
527+ end __ProcessInspectorMetadata
480528
481- function __extensionFetchPropertyMetadata pXMLTree, pProperty, pElement
482- local tNode
483- put revXMLMatchingNode (pXMLTree , "package" , "metadata" , "key" , pProperty & "." & pElement , 1 ) into tNode
484- if tNode is not empty then
485- return revXMLNodeContents (pXMLTree , tNode )
486- end if
487-
488- return empty
489- end __extensionFetchPropertyMetadata
490-
491- function __extensionPropertyInfoFromManifest pManifestPath
529+ private function __extensionPropertyInfoFromManifest pId, pManifestPath
492530 if not there is a file pManifestPath then return empty
493531 # Create the XML tree
494- local tXMLTree , tProperties , tExtensionData
532+ local tXMLTree , tProperties , tExtensionData , tPropertyNodes
495533 put revXMLCreateTreeFromFile(pManifestPath ,true ,true ,false ) into tXMLTree
496534
497- # Process the general property metadata into an array
498- local tMetadataNodes , tMetadataA , tKeys , tValue
499- put revXMLChildNames (tXMLTree , "package" ,return,"metadata" ,true ) into tMetadataNodes
500- set the itemdelimiter to "."
501- repeat for each line tMetadata in tMetadataNodes
502- put revXMLAttribute (tXMLTree ,"package" & "/" & tMetadata ,"key" ) into tKeys
503- put revXMLNodeContents (tXMLTree ,"package" & "/" & tMetadata ) into tValue
504- repeat with x = the number of items in tKeys down to 1
505- get tValue
506- put empty into tValue
507- put it into tValue [item x of tKeys ]
508- end repeat
509- union tMetadataA with tValue recursively
510- end repeat
535+ put revXMLChildNames (tXMLTree ,"package" ,return,"property" ,true ) into tPropertyNodes
511536
512- put revXMLChildNames ( tXMLTree , "package" ,return, "property" , true ) into tProperties
513- local tOrder , tPropertyDataA
537+ local tCacheID
538+ put __extensionCacheID( "name" , pID ) into tCacheId
514539
515- local tMetadataKeys
516- put the keys of tMetadataA into tMetadataKeys
517- sort tMetadataKeys
518- sort tMetadataKeys by tMetadataA [each ]["order" ]
519- repeat for each line tKey in tMetadataKeys
520- local tPropertyInfo
521- put revIDEPropertyInfo(tKey ) into tPropertyInfo
522- if tPropertyInfo is empty then
523- next repeat
524- end if
525- add 1 to tOrder
526- union tMetadataA [tKey ] with tPropertyInfo
527- put tMetadataA [tKey ] into tPropertyDataA [tKey ]
528- put tOrder into tPropertyDataA [tKey ]["order" ]
540+ local tPropertyNames , tPropertyXMLData
541+ repeat for each line tPropertyNode in tPropertyNodes
542+ local tName
543+ put revXMLAttribute (tXMLTree ,"package" & "/" & tPropertyNode ,"name" ) into tName
544+ put __extensionPropertyGet(tCacheId , tName ) into tPropertyXMLData [tName ]["data" ]
545+ put revXMLAttribute (tXMLTree ,"package" & "/" & tPropertyNode ,"set" ) into \
546+ tPropertyXMLData [tName ]["set" ]
547+ put revXMLAttribute (tXMLTree ,"package" & "/" & tPropertyNode ,"get" ) into \
548+ tPropertyXMLData [tName ]["get" ]
529549 end repeat
550+ put the keys of tPropertyXMLData into tPropertyNames
551+ sort tPropertyNames by tPropertyXMLData [each ]["data" ]["order" ]
530552
531- repeat for each line tProperty in tProperties
532- add 1 to tOrder
533- local tName
534- put revXMLAttribute (tXMLTree ,"package" & "/" & tProperty ,"name" ) into tName
535-
536- put tMetadataA [tName ] into tPropertyDataA [tName ]
553+ local tOrder , tPropertyDataA
554+ repeat for each line tProperty in tPropertyNames
555+ local tIDEPropertyInfo , tPropertyInfoA
556+ put tPropertyXMLData [tProperty ]["data" ] into tPropertyInfoA
557+ put revIDEPropertyInfo(tProperty ) into tIDEPropertyInfo
558+ if tIDEPropertyInfo is not empty then
559+ add 1 to tOrder
560+ union tPropertyInfoA with tIDEPropertyInfo
561+ put tPropertyInfoA into tPropertyDataA [tProperty ]
562+ put tOrder into tPropertyDataA [tProperty ]["order" ]
563+ else
564+ put tPropertyInfoA into tPropertyDataA [tProperty ]
565+ end if
537566
538- local tReadOnly
539- get revXMLAttribute ( tXMLTree , "package" & "/" & tProperty , "set" )
540- if it is empty or it begins with "xmlerr" then
567+ local tReadOnly , tSetter
568+ put tPropertyXMLData [ tProperty ][ "set" ] into tSetter
569+ if tSetter is empty or tSetter begins with "xmlerr" then
541570 put true into tReadOnly
542571 else
543572 put false into tReadOnly
544573 end if
545- put tReadOnly into tPropertyDataA [tName ]["read_only" ]
574+ put tReadOnly into tPropertyDataA [tProperty ]["read_only" ]
546575
547- if tPropertyDataA [tName ]["editor" ] is empty then
576+ if tPropertyDataA [tProperty ]["editor" ] is empty then
548577 local tType
549- put revXMLAttribute ( tXMLTree , "package" & "/" & tProperty , "get" ) into tType
578+ put tPropertyXMLData [ tProperty ][ "get" ] into tType
550579 if tType is "Integer" or tType is "Real" then
551- put "com.livecode.pi.number" into tPropertyDataA [tName ]["editor" ]
580+ put "com.livecode.pi.number" into tPropertyDataA [tProperty ]["editor" ]
552581 else
553- put "com.livecode.pi." & tolower (tType ) into tPropertyDataA [tName ]["editor" ]
582+ put "com.livecode.pi." & tolower (tType ) into tPropertyDataA [tProperty ]["editor" ]
554583 end if
555584 end if
556- put tOrder into tPropertyDataA [tName ]["order" ]
557- end repeat
558-
559- repeat for each key tName in tPropertyDataA
560- local tLabel , tSection
561-
562- if tPropertyDataA [tName ]["section" ] is empty then
563- put "Basic" into tPropertyDataA [tName ]["section" ]
564- end if
565-
566- if tPropertyDataA [tName ]["label" ] is empty then
567- put tName into tPropertyDataA [tName ]["label" ]
568- end if
569-
570- # Process value options, default and delimiter
571- replace comma with return in tPropertyDataA [tName ]["options" ]
572- replace "\n" with return in tPropertyDataA [tName ]["delimiter" ]
573- if tPropertyDataA [tName ]["default" ] is not empty then
574- replace "\n" with return in tPropertyDataA [tName ]["default" ]
575- end if
576-
585+ put tOrder into tPropertyDataA [tProperty ]["order" ]
577586 # Tag the property as a widget property, so we can order them
578587 # correctly after the built-in props for the given section
579- put true into tPropertyDataA [tName ]["widget_prop" ]
580-
581- if tPropertyDataA [tName ]["user_visible" ] is empty then
582- put true into tPropertyDataA [tName ]["user_visible" ]
583- end if
588+ put true into tPropertyDataA [tProperty ]["widget_prop" ]
584589 end repeat
585590
591+ __ProcessInspectorMetadata tPropertyDataA
592+
586593 revXMLDeleteTree tXMLTree
587594 return tPropertyDataA
588595end __extensionPropertyInfoFromManifest
@@ -628,9 +635,9 @@ private command __extensionSetExtensionInfoFromManifest pCacheIndex, pManifestPa
628635 end repeat
629636end __extensionSetExtensionInfoFromManifest
630637
631- command __extensionSetPropertyInfoFromManifest pID, pManifest
638+ private command __extensionSetPropertyInfoFromManifest pID, pManifest
632639 local tPropertyInfo
633- put __extensionPropertyInfoFromManifest(pManifest ) into tPropertyInfo
640+ put __extensionPropertyInfoFromManifest(pId , pManifest ) into tPropertyInfo
634641 put tPropertyInfo into sExtensionProperties [pID ]
635642end __extensionSetPropertyInfoFromManifest
636643
@@ -1340,6 +1347,11 @@ command revIDEExtensionMetadata pFolder, pFile, pType, @rDataA
13401347 return tResult
13411348end revIDEExtensionMetadata
13421349
1350+ private command __SetMetadata pKey, pValue, @xArray
1351+ split pKey by "."
1352+ put pValue into xArray[pKey ]
1353+ end __SetMetadata
1354+
13431355private command revIDEExtensionFetchMetadata pManifestPath, @rDataA
13441356 local tDataA
13451357
@@ -1399,7 +1411,7 @@ private command revIDEExtensionFetchMetadata pManifestPath, @rDataA
13991411 if tMetadataValue is empty or tMetadataValue begins with "xmlerr" then
14001412 put empty into tMetadataValue
14011413 end if
1402- put tMetadataValue into tDataA [ tMetadataKey ]
1414+ __SetMetadata tMetadataKey , tMetadataValue , tDataA
14031415 end repeat
14041416
14051417 # Fetch extension dependencies
@@ -1439,6 +1451,9 @@ private command revIDEExtensionFetchMetadata pManifestPath, @rDataA
14391451 put true into tDataA ["uservisible" ]
14401452 end if
14411453
1454+ # Make sure 'inspector' style metadata is processed
1455+ __ProcessInspectorMetadata tDataA ["standaloneSettings" ]
1456+
14421457 put tDataA into rDataA
14431458 return empty
14441459end revIDEExtensionFetchMetadata
0 commit comments