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

Commit 077850d

Browse files
Merge pull request #1829 from bwmilby/bwm-bugfix-20666-PiGmClearBtn
[[Bug 20666]] Property Inspector / Geometry: Remove All button
2 parents b676ccb + 12c321c commit 077850d

4 files changed

Lines changed: 45 additions & 1 deletion

File tree

Toolset/libraries/revgeometrylibrary.livecodescript

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ on revCalculateGeometryDistances pWhichNumber
825825
if lOrigWidth is empty then put the width of this stack into lOrigWidth
826826
if lOrigHeight is empty then put the height of this stack into lOrigHeight
827827
repeat for each item tEdge in "left,right,top,bottom"
828+
if revGetGeometry("scale" & tEdge) is not true then next repeat
828829
if revGetGeometry("scale" & tEdge & "Absolute") is false then
829830
--we need to calculate the distance as it stands as a percentage of card width or height
830831
get revCalculateScaleDistance(tEdge)
@@ -844,6 +845,7 @@ on revCalculateGeometryDistances pWhichNumber
844845
end if
845846
end repeat
846847
repeat for each item tDimension in "h,v"
848+
if revGetGeometry("move" & tDimension) is not true then next repeat
847849
if revGetGeometry("move" & tDimension & "Absolute") is false then
848850
--we need to calculate the distance as it stands as a percentage of card width or height
849851
get revCalculateMoveDistance(tDimension)
@@ -1101,3 +1103,40 @@ function revUniqueIDToName pWhich
11011103
end if
11021104
end repeat
11031105
end revUniqueIDToName
1106+
1107+
# Clears any extra keys from the current profile's geometry settings. If no settings
1108+
# are found, removes the key for the profile.
1109+
command revClearExtraGeometrySettings
1110+
local tProfileName
1111+
put the cREVGeneral["profile"] of lGeometryObject into tProfileName
1112+
if tProfileName is empty or tProfileName is the cREVGeneral["masterName"] of lGeometryObject \
1113+
then put "Master" into tProfileName
1114+
1115+
local tGeometry, tKeys, tSettingsUsed
1116+
put the customProperties["cRevGeometry"] of lGeometryObject into tGeometry
1117+
put the keys of tGeometry into tKeys
1118+
put 0 into tSettingsUsed
1119+
1120+
local tExtraKeys
1121+
repeat for each item tSetting in "moveH,moveV,scaleLeft,scaleRight,scaleTop,scaleBottom"
1122+
--check to see if each geometry setting is used
1123+
if tGeometry[tProfileName & "," & tSetting] then
1124+
add 1 to tSettingsUsed
1125+
next repeat
1126+
end if
1127+
--since the setting is not used, clear associated keys
1128+
filter tKeys with (tProfileName & "," & tSetting & "*") into tExtraKeys
1129+
repeat for each line tKey in tExtraKeys
1130+
delete variable tGeometry[tKey]
1131+
end repeat
1132+
end repeat
1133+
if tSettingsUsed is 0 then
1134+
--no geometry settings are used, clear everything else
1135+
delete variable tGeometry[tProfileName]
1136+
filter tKeys with (tProfileName & ",*") into tExtraKeys
1137+
repeat for each line tKey in tExtraKeys
1138+
delete variable tGeometry[tKey]
1139+
end repeat
1140+
end if
1141+
set the customProperties["cRevGeometry"] of lGeometryObject to tGeometry
1142+
end revClearExtraGeometrySettings

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11266,6 +11266,7 @@ on revIDESetGeometry pObject, pProperty, pGeometryArray
1126611266
repeat for each key tKey in pGeometryArray["geometry"]
1126711267
revSetGeometry tKey, pGeometryArray["geometry"][tKey]
1126811268
end repeat
11269+
revClearExtraGeometrySettings
1126911270
end revIDESetGeometry
1127011271

1127111272
function revIDEGetGeometry pObject, pProperty

Toolset/palettes/inspector/editors/com.livecode.pi.geometry.behavior.livecodescript

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ on mouseUp pButton
220220
answer warning "Really remove all Geometry from the selected object?" with "No" or "Yes"
221221
if it is "Yes" then
222222
put empty into tValue
223-
setValue tValue
223+
setValue tValue, "all"
224224
end if
225225
break
226226
default
@@ -459,6 +459,9 @@ on setValue pValue, pKey
459459
case "moveV"
460460
put "scaleTop,scaleBottom" into tTurnOffGeometries
461461
break
462+
case "all"
463+
put "moveH,moveV,scaleLeft,scaleRight,scaleTop,scaleBottom" into tTurnOffGeometries
464+
break
462465
end switch
463466
repeat for each item tItem in tTurnOffGeometries
464467
put false into pValue[tItem]

notes/bugfix-20666.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Property Inspector / Geometry: Remove All button does not work

0 commit comments

Comments
 (0)