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

Commit 6b98e43

Browse files
Merge pull request #1905 from livecode/bugfix-20857
[[ Bug 20857 ]] Fix widget property ordering in inspector
2 parents 80c2964 + f818100 commit 6b98e43

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

Toolset/libraries/revideextensionlibrary.livecodescript

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
655655
local tCacheID
656656
put __extensionCacheID("name", pID) into tCacheId
657657

658-
local tPropertyNames, tPropertyXMLData
658+
local tPropertyNames, tPropertyXMLData, tPropNameList, tMaxOrder
659659
repeat for each line tPropertyNode in tPropertyNodes
660660
local tName
661661
put revXMLAttribute(tXMLTree,"package" & "/" & tPropertyNode,"name") into tName
@@ -664,20 +664,30 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
664664
tPropertyXMLData[tName]["set"]
665665
put revXMLAttribute(tXMLTree,"package" & "/" & tPropertyNode,"get") into \
666666
tPropertyXMLData[tName]["get"]
667+
put tName into tPropNameList[tPropertyNode]
668+
put max(tMaxOrder, tPropertyXMLData[tName]["data"]["order"]) into tMaxOrder
667669
end repeat
670+
671+
-- Sort by ordered props, then by order of appearance
672+
repeat for each line tPropertyNode in tPropertyNodes
673+
if tPropertyXMLData[tPropNameList[tPropertyNode]]["data"]["order"] \
674+
is empty then
675+
add 1 to tMaxOrder
676+
put tMaxOrder into tPropertyXMLData[tPropNameList[tPropertyNode]]["data"]["order"]
677+
end if
678+
end repeat
679+
668680
put the keys of tPropertyXMLData into tPropertyNames
669681
sort tPropertyNames by tPropertyXMLData[each]["data"]["order"]
670682

671-
local tOrder, tPropertyDataA
683+
local tPropertyDataA
672684
repeat for each line tProperty in tPropertyNames
673685
local tIDEPropertyInfo, tPropertyInfoA
674686
put tPropertyXMLData[tProperty]["data"] into tPropertyInfoA
675687
put revIDEPropertyInfo(tProperty) into tIDEPropertyInfo
676688
if tIDEPropertyInfo is not empty then
677-
add 1 to tOrder
678689
union tPropertyInfoA with tIDEPropertyInfo
679690
put tPropertyInfoA into tPropertyDataA[tProperty]
680-
put tOrder into tPropertyDataA[tProperty]["order"]
681691
else
682692
put tPropertyInfoA into tPropertyDataA[tProperty]
683693
end if
@@ -700,7 +710,6 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
700710
put "com.livecode.pi." & tolower(tType) into tPropertyDataA[tProperty]["editor"]
701711
end if
702712
end if
703-
put tOrder into tPropertyDataA[tProperty]["order"]
704713
# Tag the property as a widget property, so we can order them
705714
# correctly after the built-in props for the given section
706715
put true into tPropertyDataA[tProperty]["widget_prop"]
@@ -719,10 +728,21 @@ private function __extensionPropertyInfoFromManifest pId, pManifestPath
719728
__SetMetadata tMetadataKey, tMetadataValue, tDataA
720729
end repeat
721730

722-
repeat for each line tProperty in idePropertyNames()
723-
if tDataA[tProperty] is not empty then
724-
union tDataA[tProperty] with revIDEPropertyInfo(tProperty)
725-
put tDataA[tProperty] into tPropertyDataA[tProperty]
731+
repeat for each key tProperty in tDataA
732+
if tPropertyXMLData[tProperty] is not empty then
733+
next repeat
734+
end if
735+
local tIDEPropInfoA
736+
put revIDEPropertyInfo(tProperty) into tIDEPropInfoA
737+
if tIDEPropInfoA is not empty then
738+
# if this is a control property that we are overriding,
739+
# tData might be non-empty for the property even though
740+
# there was no property node in the XML
741+
union tPropertyDataA[tProperty] with tDataA[tProperty]
742+
743+
# Now take any default property info that was not specified
744+
# in the manifest
745+
union tPropertyDataA[tProperty] with tIDEPropInfoA
726746
end if
727747
end repeat
728748

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)