@@ -128,28 +128,33 @@ function revIDEExtensionProperties pTypeID
128128 return sExtensionProperties [pTypeID ]
129129end revIDEExtensionProperties
130130
131+ # organise the property info into the structure that the inspectors
132+ # expect, namely [<section>]["grouplist"][<group>]["proplist"][<prop>]
133+ private function __OrganiseInspectorMetadata pDataA
134+ local tExtensionPropsInfoA
135+ repeat for each key tProp in pDataA
136+ local tSection , tGroup , tOrder , tPropInfoA
137+ put pDataA [tProp ] into tPropInfoA
138+ put pDataA [tProp ]["order" ] into tOrder
139+ put pDataA [tProp ]["label" ] into tGroup
140+ put pDataA [tProp ]["section" ] into tSection
141+ put tPropInfoA into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["proplist" ][tProp ]
142+
143+ put true into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["widget_prop" ]
144+ put tOrder into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["order" ]
145+ end repeat
146+ return tExtensionPropsInfoA
147+ end __OrganiseInspectorMetadata
148+
131149function revIDEExtensionPropertiesInfo pTypeId, pOrganise
132150 local tPropsA , tExtensionPropsInfoA
133151 put revIDEExtensionProperties(pTypeId ) into tPropsA
134152
135153 if pOrganise then
136- # If pOrganise is true, organise the property info into the structure that the property
137- # inspector expects, namely [<section>]["grouplist"][<group>]["proplist"][<prop>]
138- repeat for each key tProp in tPropsA
139- local tSection , tGroup , tOrder , tPropInfoA
140- put tPropsA [tProp ] into tPropInfoA
141- put tPropsA [tProp ]["order" ] into tOrder
142- put tPropsA [tProp ]["label" ] into tGroup
143- put tPropsA [tProp ]["section" ] into tSection
144- put tPropInfoA into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["proplist" ][tProp ]
145-
146- put true into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["widget_prop" ]
147- put tOrder into tExtensionPropsInfoA [tSection ]["grouplist" ][tGroup ]["order" ]
148- end repeat
154+ return __OrganiseInspectorMetadata(tPropsA )
149155 else
150- put tPropsA into tExtensionPropsInfoA
156+ return tPropsA
151157 end if
152- return tExtensionPropsInfoA
153158end revIDEExtensionPropertiesInfo
154159
155160function revIDEExtensionProperty pKind, pProperty
@@ -191,6 +196,25 @@ function revIDEExtensionGetLoadOnStartup pKind
191196 return revIDEGetPreferenceOfSet(pKind , "loadOnStartup" ) is not false
192197end revIDEExtensionGetLoadOnStartup
193198
199+ function revIDEExtensionStandaloneSettings pID
200+ # Get the internal cache index
201+ local tCacheIndex
202+ put __extensionCacheID("name" , pID ) into tCacheIndex
203+
204+ return __extensionPropertyGet(tCacheIndex , "standaloneSettings" )
205+ end revIDEExtensionStandaloneSettings
206+
207+ function revIDEExtensionStandaloneSettingsInfo pTypeId, pOrganise
208+ local tPropsA , tExtensionPropsInfoA
209+ put revIDEExtensionStandaloneSettings(pTypeId ) into tPropsA
210+
211+ if pOrganise then
212+ return __OrganiseInspectorMetadata(tPropsA )
213+ else
214+ return tPropsA
215+ end if
216+ end revIDEExtensionStandaloneSettingsInfo
217+
194218# #############################
195219# PRIVATE INSTALLATION PROCESS
196220# #############################
@@ -539,112 +563,105 @@ end __extensionUninstallComplete
539563# #############################
540564# PRIVATE SHARED
541565# #############################
566+ private command __ProcessInspectorMetadata @xMetadataA
567+ repeat for each key tKey in xMetadataA
568+ local tLabel , tSection
569+ if xMetadataA[tKey ]["section" ] is empty then
570+ put "Basic" into xMetadataA[tKey ]["section" ]
571+ end if
572+
573+ if xMetadataA[tKey ]["label" ] is empty then
574+ put tKey into xMetadataA[tKey ]["label" ]
575+ end if
576+
577+ # Process value options, default and delimiter
578+ replace comma with return in xMetadataA[tKey ]["options" ]
579+ replace "\n" with return in xMetadataA[tKey ]["delimiter" ]
580+ if xMetadataA[tKey ]["default" ] is not empty then
581+ replace "\n" with return in xMetadataA[tKey ]["default" ]
582+ end if
583+
584+ if xMetadataA[tKey ]["user_visible" ] is empty then
585+ put true into xMetadataA[tKey ]["user_visible" ]
586+ end if
587+
588+ if xMetadataA[tKey ]["properties" ] is not empty then
589+ -- If there is a 'properties' value, delete the key
590+ -- and replace it with that value
591+ local tInfo , tNewKey
592+ put xMetadataA[tKey ] into tInfo
593+ put tInfo ["properties" ] into tNewKey
594+ delete variable xMetadataA[tKey ]
595+ delete variable tInfo ["properties" ]
596+ put tInfo into xMetadataA[tNewKey ]
597+ end if
598+ end repeat
599+ end __ProcessInspectorMetadata
542600
543- function __extensionFetchPropertyMetadata pXMLTree, pProperty, pElement
544- local tNode
545- put revXMLMatchingNode (pXMLTree , "package" , "metadata" , "key" , pProperty & "." & pElement , 1 ) into tNode
546- if tNode is not empty then
547- return revXMLNodeContents (pXMLTree , tNode )
548- end if
549-
550- return empty
551- end __extensionFetchPropertyMetadata
552-
553- function __extensionPropertyInfoFromManifest pManifestPath
601+ private function __extensionPropertyInfoFromManifest pId, pManifestPath
554602 if not there is a file pManifestPath then return empty
555603 # Create the XML tree
556- local tXMLTree , tProperties , tExtensionData
604+ local tXMLTree , tProperties , tExtensionData , tPropertyNodes
557605 put revXMLCreateTreeFromFile(pManifestPath ,true ,true ,false ) into tXMLTree
558606
559- # Process the general property metadata into an array
560- local tMetadataNodes , tMetadataA , tKeys , tValue
561- put revXMLChildNames (tXMLTree , "package" ,return,"metadata" ,true ) into tMetadataNodes
562- set the itemdelimiter to "."
563- repeat for each line tMetadata in tMetadataNodes
564- put revXMLAttribute (tXMLTree ,"package" & "/" & tMetadata ,"key" ) into tKeys
565- put revXMLNodeContents (tXMLTree ,"package" & "/" & tMetadata ) into tValue
566- repeat with x = the number of items in tKeys down to 1
567- get tValue
568- put empty into tValue
569- put it into tValue [item x of tKeys ]
570- end repeat
571- union tMetadataA with tValue recursively
572- end repeat
607+ put revXMLChildNames (tXMLTree ,"package" ,return,"property" ,true ) into tPropertyNodes
573608
574- put revXMLChildNames ( tXMLTree , "package" ,return, "property" , true ) into tProperties
575- local tOrder , tPropertyDataA
609+ local tCacheID
610+ put __extensionCacheID( "name" , pID ) into tCacheId
576611
577- local tMetadataKeys
578- put the keys of tMetadataA into tMetadataKeys
579- sort tMetadataKeys
580- sort tMetadataKeys by tMetadataA [each ]["order" ]
581- repeat for each line tKey in tMetadataKeys
582- local tPropertyInfo
583- put revIDEPropertyInfo(tKey ) into tPropertyInfo
584- if tPropertyInfo is empty then
585- next repeat
586- end if
587- add 1 to tOrder
588- union tMetadataA [tKey ] with tPropertyInfo
589- put tMetadataA [tKey ] into tPropertyDataA [tKey ]
590- put tOrder into tPropertyDataA [tKey ]["order" ]
612+ local tPropertyNames , tPropertyXMLData
613+ repeat for each line tPropertyNode in tPropertyNodes
614+ local tName
615+ put revXMLAttribute (tXMLTree ,"package" & "/" & tPropertyNode ,"name" ) into tName
616+ put __extensionPropertyGet(tCacheId , tName ) into tPropertyXMLData [tName ]["data" ]
617+ put revXMLAttribute (tXMLTree ,"package" & "/" & tPropertyNode ,"set" ) into \
618+ tPropertyXMLData [tName ]["set" ]
619+ put revXMLAttribute (tXMLTree ,"package" & "/" & tPropertyNode ,"get" ) into \
620+ tPropertyXMLData [tName ]["get" ]
591621 end repeat
622+ put the keys of tPropertyXMLData into tPropertyNames
623+ sort tPropertyNames by tPropertyXMLData [each ]["data" ]["order" ]
592624
593- repeat for each line tProperty in tProperties
594- add 1 to tOrder
595- local tName
596- put revXMLAttribute (tXMLTree ,"package" & "/" & tProperty ,"name" ) into tName
597-
598- put tMetadataA [tName ] into tPropertyDataA [tName ]
625+ local tOrder , tPropertyDataA
626+ repeat for each line tProperty in tPropertyNames
627+ local tIDEPropertyInfo , tPropertyInfoA
628+ put tPropertyXMLData [tProperty ]["data" ] into tPropertyInfoA
629+ put revIDEPropertyInfo(tProperty ) into tIDEPropertyInfo
630+ if tIDEPropertyInfo is not empty then
631+ add 1 to tOrder
632+ union tPropertyInfoA with tIDEPropertyInfo
633+ put tPropertyInfoA into tPropertyDataA [tProperty ]
634+ put tOrder into tPropertyDataA [tProperty ]["order" ]
635+ else
636+ put tPropertyInfoA into tPropertyDataA [tProperty ]
637+ end if
599638
600- local tReadOnly
601- get revXMLAttribute ( tXMLTree , "package" & "/" & tProperty , "set" )
602- if it is empty or it begins with "xmlerr" then
639+ local tReadOnly , tSetter
640+ put tPropertyXMLData [ tProperty ][ "set" ] into tSetter
641+ if tSetter is empty or tSetter begins with "xmlerr" then
603642 put true into tReadOnly
604643 else
605644 put false into tReadOnly
606645 end if
607- put tReadOnly into tPropertyDataA [tName ]["read_only" ]
646+ put tReadOnly into tPropertyDataA [tProperty ]["read_only" ]
608647
609- if tPropertyDataA [tName ]["editor" ] is empty then
648+ if tPropertyDataA [tProperty ]["editor" ] is empty then
610649 local tType
611- put revXMLAttribute ( tXMLTree , "package" & "/" & tProperty , "get" ) into tType
650+ put tPropertyXMLData [ tProperty ][ "get" ] into tType
612651 if tType is "Integer" or tType is "Real" then
613- put "com.livecode.pi.number" into tPropertyDataA [tName ]["editor" ]
652+ put "com.livecode.pi.number" into tPropertyDataA [tProperty ]["editor" ]
614653 else
615- put "com.livecode.pi." & tolower (tType ) into tPropertyDataA [tName ]["editor" ]
654+ put "com.livecode.pi." & tolower (tType ) into tPropertyDataA [tProperty ]["editor" ]
616655 end if
617656 end if
618- put tOrder into tPropertyDataA [tName ]["order" ]
619- end repeat
620-
621- repeat for each key tName in tPropertyDataA
622- local tLabel , tSection
623-
624- if tPropertyDataA [tName ]["section" ] is empty then
625- put "Basic" into tPropertyDataA [tName ]["section" ]
626- end if
627-
628- if tPropertyDataA [tName ]["label" ] is empty then
629- put tName into tPropertyDataA [tName ]["label" ]
630- end if
631-
632- # Process value options, default and delimiter
633- replace comma with return in tPropertyDataA [tName ]["options" ]
634- replace "\n" with return in tPropertyDataA [tName ]["delimiter" ]
635- if tPropertyDataA [tName ]["default" ] is not empty then
636- replace "\n" with return in tPropertyDataA [tName ]["default" ]
637- end if
638-
657+ put tOrder into tPropertyDataA [tProperty ]["order" ]
639658 # Tag the property as a widget property, so we can order them
640659 # correctly after the built-in props for the given section
641- put true into tPropertyDataA [tName ]["widget_prop" ]
642-
643- if tPropertyDataA [tName ]["user_visible" ] is empty then
644- put true into tPropertyDataA [tName ]["user_visible" ]
645- end if
660+ put true into tPropertyDataA [tProperty ]["widget_prop" ]
646661 end repeat
647662
663+ __ProcessInspectorMetadata tPropertyDataA
664+
648665 revXMLDeleteTree tXMLTree
649666 return tPropertyDataA
650667end __extensionPropertyInfoFromManifest
@@ -692,7 +709,7 @@ end __extensionSetExtensionInfoFromManifest
692709
693710private command __extensionSetPropertyInfoFromManifest pID, pManifest
694711 local tPropertyInfo
695- put __extensionPropertyInfoFromManifest(pManifest ) into tPropertyInfo
712+ put __extensionPropertyInfoFromManifest(pId , pManifest ) into tPropertyInfo
696713 put tPropertyInfo into sExtensionProperties [pID ]
697714end __extensionSetPropertyInfoFromManifest
698715
@@ -1524,6 +1541,11 @@ command revIDEExtensionMetadata pFolder, pFile, pType, @rDataA
15241541 return tResult
15251542end revIDEExtensionMetadata
15261543
1544+ private command __SetMetadata pKey, pValue, @xArray
1545+ split pKey by "."
1546+ put pValue into xArray[pKey ]
1547+ end __SetMetadata
1548+
15271549private command revIDEExtensionFetchMetadata pManifestPath, @rDataA
15281550 local tDataA
15291551
@@ -1583,7 +1605,7 @@ private command revIDEExtensionFetchMetadata pManifestPath, @rDataA
15831605 if tMetadataValue is empty or tMetadataValue begins with "xmlerr" then
15841606 put empty into tMetadataValue
15851607 end if
1586- put tMetadataValue into tDataA [ tMetadataKey ]
1608+ __SetMetadata tMetadataKey , tMetadataValue , tDataA
15871609 end repeat
15881610
15891611 # Fetch extension dependencies
@@ -1623,6 +1645,9 @@ private command revIDEExtensionFetchMetadata pManifestPath, @rDataA
16231645 put true into tDataA ["uservisible" ]
16241646 end if
16251647
1648+ # Make sure 'inspector' style metadata is processed
1649+ __ProcessInspectorMetadata tDataA ["standaloneSettings" ]
1650+
16261651 put tDataA into rDataA
16271652 return empty
16281653end revIDEExtensionFetchMetadata
0 commit comments