// ----------------------------------------------------------------------
        // Removes the non needed fix ports.
        public bool CleanupExistingProposedPorts(iCS_EditorObject node, PortInfo[] neededPorts)
        {
            bool changed = false;
            var  currentProposedPorts = GetCurrentProposedPorts(node);

            foreach (var cp in currentProposedPorts)
            {
                bool found = false;
                foreach (var np in neededPorts)
                {
                    if (NameUtility.ToDisplayName(np.Name) == cp.DisplayName &&
                        np.PortType == cp.ObjectType &&
                        np.ValueType == cp.RuntimeType)
                    {
                        found = true;
                    }
                }
                if (!found)
                {
                    DestroyInstance(cp);
                    changed = true;
                }
            }
            return(changed);
        }
        // ----------------------------------------------------------------------
        internal override string GetNodeName()
        {
            var name = NameUtility.ToDisplayName(memberInfo.Name);

            if (isGeneric)
            {
                name += NameUtility.ToDisplayGenericArguments(genericArguments);
            }
            return(name);
        }
        static string GetTypeName(LibraryObject libraryObject)
        {
            var type = GetVariableType(libraryObject);

            if (type == null)
            {
                return(null);
            }
            return(NameUtility.ToDisplayName(iCS_Types.TypeName(type)));
        }
        // =================================================================================
        // Helpers
        // ---------------------------------------------------------------------------------
        static string GetVariableName(LibraryObject libraryObject)
        {
            var rawName = libraryObject.rawName;

            if (rawName.StartsWith("set_") || rawName.StartsWith("get_"))
            {
                rawName = rawName.Substring(4);
            }
            return(NameUtility.ToDisplayName(rawName));
        }
        internal override string GetNodeName()
        {
            var displayName = new StringBuilder(64);

            displayName.Append(NameUtility.ToDisplayName(memberInfo.Name));
            if (isGeneric)
            {
                displayName.Append(NameUtility.ToDisplayGenericArguments(genericArguments));
            }
            return(displayName.ToString());
        }
        // ======================================================================
        // INTERFACES
        // ----------------------------------------------------------------------
        internal override string GetDisplayString()
        {
            var result = new StringBuilder(64);

            result.Append(mainValueBegin);
            result.Append(GetNodeName());
            result.Append(mainValueEnd);
            result.Append(" <-- ");
            result.Append(firstPartBegin);
            result.Append(NameUtility.ToDisplayName(parameters[0].ParameterType));
            result.Append(firstPartEnd);
            return(result.ToString());
        }
        // ======================================================================
        // INTERFACES
        // ----------------------------------------------------------------------
        internal override string GetDisplayString()
        {
            var result = new StringBuilder(64);

            result.Append(mainValueBegin);
            result.Append(GetNodeName());
            result.Append(mainValueEnd);
            result.Append(" --> ");
            result.Append(secondPartBegin);
            result.Append(NameUtility.ToDisplayName(returnType));
            result.Append(secondPartEnd);
            return(result.ToString());
        }
Beispiel #8
0
        // ----------------------------------------------------------------------
        /// Builds a standard IsA type of node subtitle string.
        ///
        /// @param name The name to be used that _"is a"_.
        /// @param type The type of the _"is a"_.
        ///
        string BuildIsASubTitle(string name, Type type)
        {
            var result = new StringBuilder(name, 64);

            result.Append(" is a");
            var typeName = NameUtility.ToDisplayName(iCS_Types.TypeName(type));

            if (iCS_TextUtility.StartsWithAVowel(typeName))
            {
                result.Append('n');
            }
            result.Append(" ");
            result.Append(typeName);
            return(result.ToString());
        }
        // ---------------------------------------------------------------------------------
        void BuildViews()
        {
            var typeName = new GUIContent(NameUtility.ToDisplayName(iCS_Types.TypeName(myTarget.RuntimeType)));

            myVariablesController = new iCS_ClassVariablesController(myTarget.RuntimeType, myStorage, typeName, myTarget);

            // Build class wizard layout view.
            myLayoutView = new DSVerticalLayoutView(new RectOffset(0, 0, 0, 0), false);
            myLayoutView.AddSubview(myVariablesController.View, new RectOffset(0, 0, 0, kSpacer), DSView.AnchorEnum.Center);

            // Build class wizard title view.
            string     instanceTitle       = myTarget.DisplayName;
            GUIContent instanceEditorTitle = new GUIContent(instanceTitle);

            myMainView = new DSTitleView(new RectOffset(0, 0, 0, 0), false, instanceEditorTitle, DSView.AnchorEnum.Center, true);
            myMainView.SetSubview(myLayoutView);
        }
Beispiel #10
0
        // ----------------------------------------------------------------------
        public static void ChangeName(iCS_EditorObject obj, string name)
        {
            if (name == null)
            {
                return;
            }
            name.Trim();
            if (string.Compare(obj.DisplayName, name) == 0)
            {
                return;
            }
            var iStorage = obj.IStorage;

            if (obj.IsNode && string.IsNullOrEmpty(name))
            {
                name = NameUtility.ToDisplayName(obj.CodeName);
            }
            OpenTransaction(iStorage);
            try {
                iStorage.AnimateGraph(null,
                                      _ => {
                    obj.DisplayName = name;
                    if (obj.IsNode)
                    {
                        iStorage.ForcedRelayoutOfTree();
                    }
                    else if (obj.IsDataOrControlPort)
                    {
                        iStorage.ForcedRelayoutOfTree();
                    }
                }
                                      );
            }
            catch (System.Exception) {
                CancelTransaction(iStorage);
                return;
            }
            CloseTransaction(iStorage, "Change name => " + name, TransactionType.Field);
            iCS_EditorController.RepaintEditorsWithLabels();
            SystemEvents.AnnounceVisualScriptElementNameChanged(obj);
        }
        internal override string GetDisplayString()
        {
            var displayString = new StringBuilder(64);

            displayString.Append("<b><color=magenta>");
            displayString.Append("new ");
            displayString.Append("</color></b>");
            displayString.Append(mainValueBegin);
            displayString.Append(GetNodeName());
            displayString.Append(mainValueEnd);
            displayString.Append(firstPartBegin);
            displayString.Append(" (");
            displayString.Append(ToDisplayInputParameters);
            displayString.Append(")");
            displayString.Append(firstPartEnd);
            displayString.Append(" --> ");
            displayString.Append(secondPartBegin);
            displayString.Append(NameUtility.ToDisplayName(declaringType));
            displayString.Append(secondPartEnd);
            return(displayString.ToString());
        }
        internal override string GetDisplayString()
        {
            // -- Start with the base name --
            var displayName = new StringBuilder(mainValueBegin, 64);

            displayName.Append(NameUtility.ToDisplayNameNoGenericArguments(type));
            // -- Add generic arguments --
            if (isGeneric)
            {
                displayName.Append("<i>");
                displayName.Append(NameUtility.ToDisplayGenericArguments(type));
                displayName.Append("</i>");
            }
            displayName.Append(mainValueEnd);
            // -- Add inheritance information --
            if (baseType != null && baseType != typeof(void))
            {
                displayName.Append(firstPartBegin);
                displayName.Append(" : ");
                displayName.Append(NameUtility.ToDisplayName(baseType));
                displayName.Append(firstPartEnd);
            }
            return(displayName.ToString());
        }
 internal override string GetNodeName()
 {
     return(NameUtility.ToDisplayName(type));
 }
 // ----------------------------------------------------------------------
 internal override string GetNodeName()
 {
     return(NameUtility.ToDisplayName(memberInfo.Name));
 }