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

Ensure "ideNewControl" msg is sent when importing an image from the IDE #2017

Open
wants to merge 2 commits into
base: develop-9.0
Choose a base branch
from

Conversation

livecodepanos
Copy link
Contributor

No description provided.

@livecodepanos livecodepanos added this to the 9.0.3-rc-1 milestone Dec 5, 2018
@@ -7221,6 +7221,9 @@ on revIDEImportControl pType, pFileName, pReferenced
set the name of tCreatedControlID to the last item of pFileName
unlock messages
unlock screen
if not (pReferenced is true) then
ideMessageSend "ideNewControl", tCreatedControlID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@livecodepanos There's a few things I'm noticing here:

  1. I'm not sure why with the image creation we are doing:
put the long id of the last control into tCreatedControlID

after revIDECreateObject Instead of:

put the result into tCreatedControlID
  1. There are cases where pReferenced is true and ideNewControl will be sent by revIDECreateObject (referenced video) and cases where pReferenced is not true and ideNewControl will not be sent (audio).

  2. revIDECreateObject does this so we probably need to do that in cases where it is sent here:

   ## Prevent passing of ideNewControl message for objects created on IDE stacks
   if revIDEObjectIsOnIDEStack(tCreatedControlID) is false then
      // AL-2015-04-08: [[ Bug 14822 ]] Ensure 'edited' status of stack is set
      revIDESetEdited the short name of this stack
      ideMessageSend "ideNewControl", tCreatedControlID
   end if

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... one other thing... in the case of imported images I think we could use revIDECreateObject then:

set the text of tCreatedControlID to url ("binfile:" & pFilename)

But if we need to send the message for other imported things here then maybe no need to change that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@livecodepanos thinking about this a little bit more I can't help wondering if we should move the import cases into revIDECreateObject... say by adding an optional pFilename parameter. I think that might simplify maintenance as all object creation is done in one handler and only setting of extra properties due to it being an import operation happens here. Then the image case for example just becomes:

          if pReferenced is true then
              revIDECreateObject "com.livecode.interface.classic.image", tTargetStack, tCreatedControlLocation
          else
              revIDECreateObject "com.livecode.interface.classic.image", tTargetStack, tCreatedControlLocation, pFilename
          end if
          put the result into tCreatedControlID
         if pFileName ends with ".svg" then
             -- SVG files can't be referenced
             set the text of tCreatedControlID to drawingSvgCompileFile(pFileName)
          else if pReferenced is true then
              set the filename of tCreatedControlID to pFileName
          end if
          set the borderWidth of tCreatedControlID to 0
          select tCreatedControlID

@livecodepanos livecodepanos removed this from the 9.0.3-rc-1 milestone Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants