コード例 #1
0
ファイル: ObjectInspector.cs プロジェクト: ymoussaba/duality
        private void UpdateSelection(ObjectSelection sel, ObjectSelection.Category showCat)
        {
            this.selSchedMouse    = null;
            this.selSchedMouseCat = ObjectSelection.Category.None;
            this.displaySel       = sel;
            this.displayCat       = showCat;

            if (showCat == ObjectSelection.Category.None)
            {
                return;
            }
            this.gridExpandState.UpdateFrom(this.propertyGrid.MainEditor);

            if ((showCat & ObjectSelection.Category.GameObjCmp) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.GameObjects.Union(sel.Components.GameObject()));
                this.displayCat = ObjectSelection.Category.GameObjCmp;
                this.propertyGrid.SelectObjects(this.displaySel, false);
            }
            else if ((showCat & ObjectSelection.Category.Resource) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.Resources);
                this.displayCat = ObjectSelection.Category.Resource;
                this.propertyGrid.SelectObjects(this.displaySel, this.displaySel.Resources.Any(r => r.IsDefaultContent));
            }
            else if ((showCat & ObjectSelection.Category.Other) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.OtherObjects);
                this.displayCat = ObjectSelection.Category.Other;
                this.propertyGrid.SelectObjects(this.displaySel, false);
            }

            this.gridExpandState.ApplyTo(this.propertyGrid.MainEditor);
            this.buttonClone.Enabled = this.propertyGrid.Selection.Any();
        }
コード例 #2
0
ファイル: EventArgs.cs プロジェクト: KSLcom/duality
		public SelectionChangedEventArgs(ObjectSelection current, ObjectSelection previous, ObjectSelection.Category changedCategoryFallback)
		{
			this.current = current;
			this.previous = previous;

			this.diffCat = ObjectSelection.GetAffectedCategories(this.previous, this.current);
			if (this.diffCat == ObjectSelection.Category.None) this.diffCat = changedCategoryFallback;
			this.added = this.current - this.previous;
			this.removed = this.previous - this.current;
		}
コード例 #3
0
ファイル: EventArgs.cs プロジェクト: thecocce/duality
        public SelectionChangedEventArgs(ObjectSelection current, ObjectSelection previous, ObjectSelection.Category changedCategoryFallback)
        {
            this.current  = current;
            this.previous = previous;

            this.diffCat = ObjectSelection.GetAffectedCategories(this.previous, this.current);
            if (this.diffCat == ObjectSelection.Category.None)
            {
                this.diffCat = changedCategoryFallback;
            }
            this.added   = this.current - this.previous;
            this.removed = this.previous - this.current;
        }
コード例 #4
0
        private void UpdateSelection(ObjectSelection sel, ObjectSelection.Category showCat)
        {
            this.selSchedMouse    = null;
            this.selSchedMouseCat = ObjectSelection.Category.None;
            this.displaySel       = sel;
            this.displayCat       = showCat;

            if (showCat == ObjectSelection.Category.None)
            {
                return;
            }
            this.gridExpandState.UpdateFrom(this.propertyGrid.MainEditor);

            // Selection update may change MainEditor, unsubscribe from events
            if (this.propertyGrid.MainEditor is GroupedPropertyEditor)
            {
                GroupedPropertyEditor groupedMainEditor = this.propertyGrid.MainEditor as GroupedPropertyEditor;
                groupedMainEditor.EditorAdded -= this.MainEditor_EditorAdded;
            }

            if ((showCat & ObjectSelection.Category.GameObjCmp) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.GameObjects.Union(sel.Components.GameObject()));
                this.displayCat = ObjectSelection.Category.GameObjCmp;
                this.propertyGrid.SelectObjects(this.displaySel, false);
            }
            else if ((showCat & ObjectSelection.Category.Resource) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.Resources);
                this.displayCat = ObjectSelection.Category.Resource;
                this.propertyGrid.SelectObjects(this.displaySel, this.displaySel.Resources.Any(r => r.IsDefaultContent));
            }
            else if ((showCat & ObjectSelection.Category.Other) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.OtherObjects);
                this.displayCat = ObjectSelection.Category.Other;
                this.propertyGrid.SelectObjects(this.displaySel, false);
            }

            if (this.propertyGrid.MainEditor is GroupedPropertyEditor)
            {
                GroupedPropertyEditor groupedMainEditor = this.propertyGrid.MainEditor as GroupedPropertyEditor;
                groupedMainEditor.EditorAdded += this.MainEditor_EditorAdded;
            }

            this.gridExpandState.ApplyTo(this.propertyGrid.MainEditor);
            this.buttonClone.Enabled = this.propertyGrid.Selection.Any();
        }
コード例 #5
0
ファイル: ObjectInspector.cs プロジェクト: Naturaldoc/duality
        private void UpdateSelection(ObjectSelection sel, ObjectSelection.Category showCat)
        {
            this.selSchedMouse = null;
            this.selSchedMouseCat = ObjectSelection.Category.None;
            this.displaySel = sel;
            this.displayCat = showCat;

            if (showCat == ObjectSelection.Category.None) return;
            this.gridExpandState.UpdateFrom(this.propertyGrid.MainEditor);

            if ((showCat & ObjectSelection.Category.GameObjCmp) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.GameObjects.Union(sel.Components.GameObject()));
                this.displayCat = ObjectSelection.Category.GameObjCmp;
                this.propertyGrid.SelectObjects(this.displaySel, false);
            }
            else if ((showCat & ObjectSelection.Category.Resource) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.Resources);
                this.displayCat = ObjectSelection.Category.Resource;
                this.propertyGrid.SelectObjects(this.displaySel, this.displaySel.Resources.Any(r => r.IsDefaultContent));
            }
            else if ((showCat & ObjectSelection.Category.Other) != ObjectSelection.Category.None)
            {
                this.displaySel = new ObjectSelection(sel.OtherObjects);
                this.displayCat = ObjectSelection.Category.Other;
                this.propertyGrid.SelectObjects(this.displaySel, false);
            }

            this.gridExpandState.ApplyTo(this.propertyGrid.MainEditor);
            this.buttonClone.Enabled = this.propertyGrid.Selection.Any();
        }