// This is made internal so that the PropertyGrid can raise this continually so that
        // window visiblity is purely reactive
        internal void IncludeAndExcludeAccordingToValue(PropertyGrid propertyGrid)
        {
            for (int i = 0; i < mMemberVisibleConditions.Count; i++)
            {
                MemberVisibleCondition mvc = mMemberVisibleConditions[i];

                // Update the SelectedObject
                mvc.MemberCondition.SelectedObjectAsObject = propertyGrid.GetSelectedObject();

                
                bool result = mvc.MemberCondition.Result;

                #region If the member condition is true

                if (result)
                {
                    if ((mvc.VisibilitySettings & VisibilitySetting.ExcludeOnTrue) ==
                        VisibilitySetting.ExcludeOnTrue)
                    {
                        propertyGrid.ExcludeMember(mvc.MemberToAffect);
                    }

                    if ((mvc.VisibilitySettings & VisibilitySetting.IncludeOnTrue) ==
                        VisibilitySetting.IncludeOnTrue)
                    {
                        if (string.IsNullOrEmpty(this.Category))
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect);
                        }
                        else
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect, Category);
                        }
                    }
                }

                #endregion

                #region Else if the member condition is false

                else // result == false
                {
                    if ((mvc.VisibilitySettings & VisibilitySetting.ExcludeOnFalse) ==
                        VisibilitySetting.ExcludeOnFalse)
                    {
                        propertyGrid.ExcludeMember(mvc.MemberToAffect);
                    }

                    if ((mvc.VisibilitySettings & VisibilitySetting.IncludeOnFalse) ==
                        VisibilitySetting.IncludeOnFalse)
                    {
                        if (string.IsNullOrEmpty(this.Category))
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect);
                        }
                        else
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect, Category);
                        }
                    }

                }

                #endregion
            }
        }
        public AnimationChainPropertyGrid(Cursor cursor) : base(cursor)
        {
            #region Set "this" properties
            Name = "AnimationChain Properties";

            Y = 22.8f;
            X = 82.75f;
            this.HasMoveBar = true;

            #endregion

            #region Create the "Name" UI

            TextDisplay nameDisplay = new TextDisplay(cursor);
            nameDisplay.Text = "Name:";
            this.AddWindow(nameDisplay);
            nameDisplay.SetPositionTL(1, 1.5f);

            mNameTextBox        = new TextBox(cursor);
            mNameTextBox.ScaleX = 10;
            this.AddWindow(mNameTextBox);
            mNameTextBox.X = 17;
            mNameTextBox.Y = nameDisplay.Y;

            mNameTextBox.TextChange += SetName;

            #endregion

            #region Create the PropertyGrid

            mPropertyGrid            = new PropertyGrid <AnimationChain>(cursor);
            mPropertyGrid.HasMoveBar = false;
            AddWindow(mPropertyGrid);
            this.mPropertyGrid.AfterUpdateDisplayedProperties += EveryFrameActivity;
            mPropertyGrid.DrawBorders = false;

            #endregion

            #region ExcludeMember calls

            // We'll handle this property in "this"
            mPropertyGrid.ExcludeMember("Name");

            mPropertyGrid.ExcludeMember("Capacity");
            mPropertyGrid.ExcludeMember("Item");
            mPropertyGrid.ExcludeMember("ColorKey");
            mPropertyGrid.ExcludeMember("ParentFileName");
            mPropertyGrid.ExcludeMember("LastFrame");

            mPropertyGrid.ExcludeMember("IndexInLoadedAchx");
            mPropertyGrid.ExcludeMember("ParentAchxFileName");
            mPropertyGrid.ExcludeMember("ParentGifFileName");

            #endregion

            #region mFlipHorizontally Creation

            mFlipHorizontally        = new Button(mCursor);
            mFlipHorizontally.Text   = "Flip All\nHorizontally";
            mFlipHorizontally.ScaleX = 6;
            mFlipHorizontally.ScaleY = 2.2f;
            mFlipHorizontally.Click += FlipHorizontallyClick;

            mPropertyGrid.AddWindow(mFlipHorizontally, "Actions");

            #endregion

            #region mFlipVertically Creation

            mFlipVertically        = new Button(mCursor);
            mFlipVertically.Text   = "Flip All\nVertically";
            mFlipVertically.ScaleX = 6;
            mFlipVertically.ScaleY = 2.2f;
            mFlipVertically.Click += FlipVerticallyClick;

            mPropertyGrid.AddWindow(mFlipVertically, "Actions");

            #endregion

            #region Categorize and modify Frames UI

            mPropertyGrid.IncludeMember("FrameTime", "Frames");

            ((UpDown)mPropertyGrid.GetUIElementForMember("FrameTime")).MinValue     = 0;
            ((UpDown)mPropertyGrid.GetUIElementForMember("FrameTime")).CurrentValue = .1f;

            mPropertyGrid.IncludeMember("TotalLength", "Frames");
            mPropertyGrid.IncludeMember("Count", "Frames");

            #endregion

            mPropertyGrid.RemoveCategory("Uncategorized");
            // mPropertyGrid.ResizeEnd += UpdateThisScale;
            CreateUpDowns();
            mPropertyGrid.SelectCategory("Actions");
            UpdateContainedWindowPositions(null);
        }
Esempio n. 3
0
        // This is made internal so that the PropertyGrid can raise this continually so that
        // window visiblity is purely reactive
        internal void IncludeAndExcludeAccordingToValue(PropertyGrid propertyGrid)
        {
            for (int i = 0; i < mMemberVisibleConditions.Count; i++)
            {
                MemberVisibleCondition mvc = mMemberVisibleConditions[i];

                // Update the SelectedObject
                mvc.MemberCondition.SelectedObjectAsObject = propertyGrid.GetSelectedObject();


                bool result = mvc.MemberCondition.Result;

                #region If the member condition is true

                if (result)
                {
                    if ((mvc.VisibilitySettings & VisibilitySetting.ExcludeOnTrue) ==
                        VisibilitySetting.ExcludeOnTrue)
                    {
                        propertyGrid.ExcludeMember(mvc.MemberToAffect);
                    }

                    if ((mvc.VisibilitySettings & VisibilitySetting.IncludeOnTrue) ==
                        VisibilitySetting.IncludeOnTrue)
                    {
                        if (string.IsNullOrEmpty(this.Category))
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect);
                        }
                        else
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect, Category);
                        }
                    }
                }

                #endregion

                #region Else if the member condition is false

                else // result == false
                {
                    if ((mvc.VisibilitySettings & VisibilitySetting.ExcludeOnFalse) ==
                        VisibilitySetting.ExcludeOnFalse)
                    {
                        propertyGrid.ExcludeMember(mvc.MemberToAffect);
                    }

                    if ((mvc.VisibilitySettings & VisibilitySetting.IncludeOnFalse) ==
                        VisibilitySetting.IncludeOnFalse)
                    {
                        if (string.IsNullOrEmpty(this.Category))
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect);
                        }
                        else
                        {
                            propertyGrid.IncludeMember(mvc.MemberToAffect, Category);
                        }
                    }
                }

                #endregion
            }
        }