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

Commit 7461dcd

Browse files
Merge pull request #1691 from livecode/bugfix-20133
[Bug 20133] Ensure cloning cards or stacks from the PB works correctly
2 parents 9e563d4 + 5821a1b commit 7461dcd

3 files changed

Lines changed: 21 additions & 24 deletions

File tree

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3474,30 +3474,22 @@ on revIDECreateObject pObjectTypeID, pTarget, pLoc
34743474
end revIDECreateObject
34753475

34763476
on revIDECloneObject pLongID
3477-
local tTarget, tLoc, tControlType
3478-
local tCreatedControlID
3479-
3480-
put the loc of pLongID into tLoc
3481-
add 20 to item 1 of tLoc
3482-
add 20 to item 2 of tLoc
3483-
3484-
put revIDECardOfObject(pLongID) into tTarget
3485-
if not exists(tTarget) then return __revIDEError("Cannot create object. Target does not exist:" && tTarget)
3486-
3487-
-- # Set the default stack to the target we're creating the object on
3488-
-- set the defaultstack to the owner of tTarget
3489-
3490-
-- # Create the object
3491-
-- lock screen
3492-
-- lock messages
3493-
--do "clone" && pLongID
3494-
clone pLongID
3495-
put the long ID of the last control into tCreatedControlID
3496-
set the loc of tCreatedControlID to tLoc
3497-
3498-
-- unlock messages
3499-
-- unlock screen
3500-
-- return tCreatedControlID
3477+
if not exists(pLongID) then return __revIDEError("Cannot create object. Target does not exist:" && pLongID)
3478+
3479+
if word 1 of pLongID is "card" or word 1 of pLongID is "stack" then
3480+
clone pLongID
3481+
else
3482+
local tTarget, tLoc, tControlType
3483+
local tCreatedControlID
3484+
3485+
put the loc of pLongID into tLoc
3486+
add 20 to item 1 of tLoc
3487+
add 20 to item 2 of tLoc
3488+
3489+
clone pLongID
3490+
put it into tCreatedControlID
3491+
set the loc of tCreatedControlID to tLoc
3492+
end if
35013493
end revIDECloneObject
35023494

35033495
on revIDECloneObjectWithDefaults pLongID

Toolset/palettes/project browser/revprojectbrowserbehavior.livecodescript

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,16 @@ on cloneControls
885885
put pbSelectedObjects() into tControlList
886886

887887
lock screen
888+
local tOldDefaultStack
889+
put the defaultStack into tOldDefaultStack
890+
set the defaultStack to revIDEStackOfObject(line 1 of tControlList)
888891
repeat for each line tControlID in tControlList
889892
revIDECloneObject tControlID
890893
put the result & return after tClonedIDs
891894
end repeat
892895

893896
selectObjects tClonedIDs
897+
set the defaultStack to tOldDefaultStack
894898
unlock screen
895899
end cloneControls
896900

notes/bugfix-20133.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Ensure cloning stacks or cards from the Project Browser works correctly

0 commit comments

Comments
 (0)