// ----------------------------------------------------------------------
        void ProcessPicking(iCS_PickInfo pickInfo)
        {
            if (myClickCount < 2)
            {
                return;
            }
            iCS_EditorObject pickedObject = pickInfo.PickedObject;

            switch (pickInfo.PickedPart)
            {
            case iCS_PickPartEnum.Name:
            case iCS_PickPartEnum.Value:
            case iCS_PickPartEnum.EditorObject: {
                if (pickedObject.IsPort)
                {
                    CloseSubEditor();
                    mySubEditor = PortEditor.Create(pickedObject, new Vector2(100, 100));
                }
                else
                {
                    CloseSubEditor();
                    if (pickedObject.IsIconizedInLayout)
                    {
                        iCS_UserCommands.Unfold(pickedObject);
                    }
                    else
                    {
                        mySubEditor = NodeEditor.Create(pickedObject, new Vector2(100, 100));
                    }
                }
                myClickCount = 0;
                break;
            }
            }
        }
Exemplo n.º 2
0
        // ===================================================================
        // BUILDER
        // -------------------------------------------------------------------
        /// Creates a port editor window at the given screen position.
        ///
        /// @param screenPosition The screen position where the editor
        ///                       should be displayed.
        ///
        public static EditorWindow Create(iCS_EditorObject port, Vector2 screenPosition)
        {
            if (port == null)
            {
                return(null);
            }
            // Create the specific port editors.
            var parent = port.ParentNode;

            if (parent.IsEventHandler)
            {
                return(EventHandlerPortEditor.Create(port, screenPosition));
            }
            if (parent.IsFunctionDefinition)
            {
                return(FunctionDefinitionPortEditor.Create(port, screenPosition));
            }
            if (parent.IsPackage)
            {
                return(PackagePortEditor.Create(port, screenPosition));
            }
            if (parent.IsKindOfFunction)
            {
                return(FunctionCallPortEditor.Create(port, screenPosition));
            }
            // Create a generic port editor.
            var self = PortEditor.CreateInstance <PortEditor>();

            self.vsObject = port;
            Texture2D iCanScriptLogo = null;

            TextureCache.GetTexture(iCS_EditorStrings.TitleLogoIcon, out iCanScriptLogo);
            self.titleContent = new GUIContent("Port Editor", iCanScriptLogo);
            self.ShowUtility();
            return(self);
        }