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

Commit c9c8889

Browse files
committed
[[ Bug 20857 ]] Fix widget property ordering in inspector
Iterate over the widget's properties giving them all an order reflecting their position in the manifest. Additionally, don't iterate through all property names when merging in IDE property info.
1 parent c81ae01 commit c9c8889

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

Toolset/libraries/revideextensionlibrary.livecodescript

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
609609
local tCacheID
610610
put __extensionCacheID("name", pID) into tCacheId
611611

612-
local tPropertyNames, tPropertyXMLData
612+
local tPropertyNames, tPropertyXMLData, tPropNameList, tMaxOrder
613613
repeat for each line tPropertyNode in tPropertyNodes
614614
local tName
615615
put revXMLAttribute(tXMLTree,"package" & "/" & tPropertyNode,"name") into tName
@@ -618,20 +618,30 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
618618
tPropertyXMLData[tName]["set"]
619619
put revXMLAttribute(tXMLTree,"package" & "/" & tPropertyNode,"get") into \
620620
tPropertyXMLData[tName]["get"]
621+
put tName into tPropNameList[tPropertyNode]
622+
put max(tMaxOrder, tPropertyXMLData[tName]["data"]["order"]) into tMaxOrder
621623
end repeat
624+
625+
-- Sort by ordered props, then by order of appearance
626+
repeat for each line tPropertyNode in tPropertyNodes
627+
if tPropertyXMLData[tPropNameList[tPropertyNode]]["data"]["order"] \
628+
is empty then
629+
add 1 to tMaxOrder
630+
put tMaxOrder into tPropertyXMLData[tPropNameList[tPropertyNode]]["data"]["order"]
631+
end if
632+
end repeat
633+
622634
put the keys of tPropertyXMLData into tPropertyNames
623635
sort tPropertyNames by tPropertyXMLData[each]["data"]["order"]
624636

625-
local tOrder, tPropertyDataA
637+
local tPropertyDataA
626638
repeat for each line tProperty in tPropertyNames
627639
local tIDEPropertyInfo, tPropertyInfoA
628640
put tPropertyXMLData[tProperty]["data"] into tPropertyInfoA
629641
put revIDEPropertyInfo(tProperty) into tIDEPropertyInfo
630642
if tIDEPropertyInfo is not empty then
631-
add 1 to tOrder
632643
union tPropertyInfoA with tIDEPropertyInfo
633644
put tPropertyInfoA into tPropertyDataA[tProperty]
634-
put tOrder into tPropertyDataA[tProperty]["order"]
635645
else
636646
put tPropertyInfoA into tPropertyDataA[tProperty]
637647
end if
@@ -654,7 +664,6 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
654664
put "com.livecode.pi." & tolower(tType) into tPropertyDataA[tProperty]["editor"]
655665
end if
656666
end if
657-
put tOrder into tPropertyDataA[tProperty]["order"]
658667
# Tag the property as a widget property, so we can order them
659668
# correctly after the built-in props for the given section
660669
put true into tPropertyDataA[tProperty]["widget_prop"]
@@ -673,10 +682,18 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
673682
__SetMetadata tMetadataKey, tMetadataValue, tDataA
674683
end repeat
675684

676-
repeat for each line tProperty in idePropertyNames()
677-
if tDataA[tProperty] is not empty then
678-
union tDataA[tProperty] with revIDEPropertyInfo(tProperty)
679-
put tDataA[tProperty] into tPropertyDataA[tProperty]
685+
repeat for each key tProperty in tDataA
686+
local tIDEPropInfoA
687+
put revIDEPropertyInfo(tProperty) into tIDEPropInfoA
688+
if tIDEPropInfoA is not empty then
689+
# if this is a control property that we are overriding,
690+
# tData might be non-empty for the property even though
691+
# there was no property node in the XML
692+
union tPropertyDataA[tProperty] with tDataA[tProperty]
693+
694+
# Now take any default roperty info that was not specified
695+
# in the manifest
696+
union tPropertyDataA[tProperty] with tIDEPropInfoA
680697
end if
681698
end repeat
682699

notes/bugfix-20857.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix widget property ordering

0 commit comments

Comments
 (0)