Exemple #1
0
        public SearchItemSet Clone()
        {
            SearchItemSet copy = (SearchItemSet)SerializationUtil.Copy(this);

            copy.OnDeserialization();
            return(copy);
        }
Exemple #2
0
        public void AddCopy(SearchItem item)
        {
            SearchItem copy = (SearchItem)SerializationUtil.Copy(item);

            copy.OnDeserialization();
            int insertPoint = items.IndexOf(item);

            copy.sortIndex = insertPoint; //HACK! This will get overridden, but right now we can use this var for the insertion point.

            // This has to be done later because this will most likely occur during a Draw()
            // operation.
            // items.Insert(insertPoint, item);

            itemsToAdd.Add(copy);
        }
Exemple #3
0
        public void drawAddRemoveButtons()
        {
            GUILayout.Space(2.0f);
            GUILayout.BeginHorizontal(); // 2
            if (searchDepth == 0)
            {
                if (GUILayout.Button(GUIContent.none, SRWindow.olPlusPlus))
                {
                    SRWindow.Instance.duplicateSearchItem(this);
                }
            }
            GUILayout.FlexibleSpace();
#if PSR_FULL
            if (canSubsearch())
            {
                int selectedIndex = EditorGUILayout.Popup("", 0, new string[] { "Add Subsearch", Keys.PropertyLabel, Keys.GlobalLabel });
                if (selectedIndex > 0)
                {
                    if (selectedIndex == 1)
                    {
                        if (this is SearchItemProperty)
                        {
                            subsearch = (SearchItemProperty)SerializationUtil.Copy(this);
                        }
                        else
                        {
                            subsearch = new SearchItemProperty();
                        }
                    }

                    if (selectedIndex == 2)
                    {
                        if (this is SearchItemGlobal)
                        {
                            subsearch = (SearchItemGlobal)SerializationUtil.Copy(this);
                        }
                        else
                        {
                            subsearch = new SearchItemGlobal();
                        }
                    }
                    OnDeserializeSubSearch();
                    SRWindow.Instance.PersistCurrentSearch();
                }
            }
            GUILayout.FlexibleSpace();
#endif
            bool showMinus = true;
            if (searchDepth == 0 && sortIndex == 0 && SRWindow.Instance.currentSearch.items.Count == 1)
            {
                showMinus = false;
            }
            if (showMinus)
            {
                if (GUILayout.Button(GUIContent.none, SRWindow.olMinusMinus))
                {
                    if (searchDepth == 0)
                    {
                        SRWindow.Instance.RemoveSearchItem(this);
                    }
                    else
                    {
                        parent.subsearch = null;
                        SRWindow.Instance.PersistCurrentSearch();
                    }
                }
            }
            GUILayout.EndHorizontal(); // 2
        }