internal static void ExcludeMoveBarMembersFrom(PropertyGrid propertyGrid)
 {
     propertyGrid.ExcludeMember("MoveBarTexture");
     propertyGrid.ExcludeMember("MoveBarSpriteBorderWidth");
     propertyGrid.ExcludeMember("MoveBarTextureBorderWidth");
     propertyGrid.ExcludeMember("MoveBarBorderSides");
 }
Exemplo n.º 2
0
        private static void CreatePositionedNodePropertyGrid(Window callingWindow)
        {
            PropertyGrid <PositionedNode> asPropertyGrid = callingWindow as PropertyGrid <PositionedNode>;

            asPropertyGrid.ExcludeMember("CostToGetHere");
            asPropertyGrid.ExcludeMember("Links");
            asPropertyGrid.ExcludeMember("X");
            asPropertyGrid.ExcludeMember("Y");
            asPropertyGrid.ExcludeMember("Z");

            asPropertyGrid.Name = "Positioned Node";
        }
        public EditorPropertiesGrid()
            : base(GuiManager.Cursor)
        {
            #region "this" properties

            GuiManager.AddWindow(this);
            SelectedObject = GameData.EditorProperties;
            HasCloseButton = true;

            #endregion

            #region Exclude members

            ExcludeMember("ConstrainDimensions");
            ExcludeMember("CullSpriteGrids");

            #endregion

            UpDown additionalFadeUpDown = GetUIElementForMember("AdditionalFade") as UpDown;
            additionalFadeUpDown.MaxValue    = 255;
            additionalFadeUpDown.MinValue    = 0;
            additionalFadeUpDown.Sensitivity = 1f;

            UpDown pixelSizeUpDown = GetUIElementForMember("PixelSize") as UpDown;
            pixelSizeUpDown.MinValue    = 0;
            pixelSizeUpDown.Sensitivity = .01f;

            Name = "Editor Properties";

            #region Axes

            IncludeMember("WorldAxesDisplayVisible", "Axes");
            SetMemberDisplayName("WorldAxesDisplayVisible", "Visible");

            IncludeMember("WorldAxesColor", "Axes");
            SetMemberDisplayName("WorldAxesColor", "Color");
            #endregion

            #region LineGrid  Properties

            PropertyGrid <LineGrid> lineGridPropertyGrid = new PropertyGrid <LineGrid>(mCursor);
            lineGridPropertyGrid.HasMoveBar     = false;
            lineGridPropertyGrid.HasCloseButton = false;
            lineGridPropertyGrid.ExcludeMember("Layer");

            ReplaceMemberUIElement("LineGrid", lineGridPropertyGrid);

            IncludeMember("LineGrid", "LineGrid");
            SetMemberDisplayName("LineGrid", "");

            #endregion
        }
        //public static void CreatePixelCoordinateUi(PropertyGrid propertyGrid,
        //    string topProperty, string bottomProperty, string leftProperty, string rightProperty)
        //{
        //    UpDown throwaway;

        //    CreatePixelCoordinateUi(propertyGrid, topProperty, bottomProperty, leftProperty, rightProperty,
        //        out throwaway, out throwaway, out throwaway, out throwaway);
        //}

        public static void CreatePixelCoordinateUi(PropertyGrid propertyGrid,
            string topProperty, string bottomProperty, string leftProperty, string rightProperty,
            string category,
            out UpDown topPixel, out UpDown leftPixel, out UpDown heightPixel, out UpDown widthPixel)
        {
            propertyGrid.ExcludeMember(topProperty);
            propertyGrid.ExcludeMember(bottomProperty);
            propertyGrid.ExcludeMember(leftProperty);
            propertyGrid.ExcludeMember(rightProperty);

            leftPixel = new UpDown(GuiManager.Cursor);
            leftPixel.ScaleX = 7;
            leftPixel.Precision = 0;
            propertyGrid.AddWindow(leftPixel, category);
            propertyGrid.SetLabelForWindow(leftPixel, "Left Pixel");

            topPixel = new UpDown(GuiManager.Cursor);
            topPixel.ScaleX = 7;
            topPixel.Precision = 0;
            propertyGrid.AddWindow(topPixel, category);
            propertyGrid.SetLabelForWindow(topPixel, "Top Pixel");


            widthPixel = new UpDown(GuiManager.Cursor);
            widthPixel.ScaleX = 7;
            widthPixel.Precision = 0;
            propertyGrid.AddWindow(widthPixel, category);
            propertyGrid.SetLabelForWindow(widthPixel, "Pixel Width");


            heightPixel = new UpDown(GuiManager.Cursor);
            heightPixel.ScaleX = 7;
            heightPixel.Precision = 0;
            propertyGrid.AddWindow(heightPixel, category);
            propertyGrid.SetLabelForWindow(heightPixel, "Pixel Height");
        }
        //public static void CreatePixelCoordinateUi(PropertyGrid propertyGrid,
        //    string topProperty, string bottomProperty, string leftProperty, string rightProperty)
        //{
        //    UpDown throwaway;

        //    CreatePixelCoordinateUi(propertyGrid, topProperty, bottomProperty, leftProperty, rightProperty,
        //        out throwaway, out throwaway, out throwaway, out throwaway);
        //}

        public static void CreatePixelCoordinateUi(PropertyGrid propertyGrid,
                                                   string topProperty, string bottomProperty, string leftProperty, string rightProperty,
                                                   string category,
                                                   out UpDown topPixel, out UpDown leftPixel, out UpDown heightPixel, out UpDown widthPixel)
        {
            propertyGrid.ExcludeMember(topProperty);
            propertyGrid.ExcludeMember(bottomProperty);
            propertyGrid.ExcludeMember(leftProperty);
            propertyGrid.ExcludeMember(rightProperty);

            leftPixel           = new UpDown(GuiManager.Cursor);
            leftPixel.ScaleX    = 7;
            leftPixel.Precision = 0;
            propertyGrid.AddWindow(leftPixel, category);
            propertyGrid.SetLabelForWindow(leftPixel, "Left Pixel");

            topPixel           = new UpDown(GuiManager.Cursor);
            topPixel.ScaleX    = 7;
            topPixel.Precision = 0;
            propertyGrid.AddWindow(topPixel, category);
            propertyGrid.SetLabelForWindow(topPixel, "Top Pixel");


            widthPixel           = new UpDown(GuiManager.Cursor);
            widthPixel.ScaleX    = 7;
            widthPixel.Precision = 0;
            propertyGrid.AddWindow(widthPixel, category);
            propertyGrid.SetLabelForWindow(widthPixel, "Pixel Width");


            heightPixel           = new UpDown(GuiManager.Cursor);
            heightPixel.ScaleX    = 7;
            heightPixel.Precision = 0;
            propertyGrid.AddWindow(heightPixel, category);
            propertyGrid.SetLabelForWindow(heightPixel, "Pixel Height");
        }
Exemplo n.º 6
0
        private void CreatePropertyGrid()
        {
            mRecordingDataPropertyGrid = new PropertyGrid <RecordingData>(mCursor);

            mRecordingDataPropertyGrid.ExcludeMember("LastBeatTime");

            mRecordingDataPropertyGrid.GetUIElementForMember("ClosestFitBeatFrequency").ScaleX = 10;
            mRecordingDataPropertyGrid.SetMemberDisplayName("ClosestFitBeatFrequency", "Frequency");

            mRecordingDataPropertyGrid.GetUIElementForMember("ClosestFitOffset").ScaleX = 10;
            mRecordingDataPropertyGrid.SetMemberDisplayName("ClosestFitOffset", "Offset");



            this.AddWindow(mRecordingDataPropertyGrid);
            mRecordingDataPropertyGrid.X = mRecordingDataPropertyGrid.ScaleX + .5f;
            mRecordingDataPropertyGrid.Y = 23f;

            mRecordingDataPropertyGrid.SelectedObject = new RecordingData();
            mRecordingDataPropertyGrid.HasMoveBar     = false;
        }
        internal IObjectDisplayer CreateObjectDisplayer(object displayedObject, Window requestingWindow, string memberName)
        {
            IObjectDisplayer objectToReturn = null;


            PropertyGrid      newGrid = null;
            ListDisplayWindow newListDisplayWindow = null;

            Type objectType = displayedObject.GetType();
            Type propertyGridType;

            ListDisplayWindow requestingListDisplayWindow = requestingWindow as ListDisplayWindow;
            PropertyGrid      requestingPropertyGrid      = requestingWindow as PropertyGrid;

            #region Get the cursor to use for the new Window

            Cursor cursor = GuiManager.Cursor;

            if (requestingWindow != null)
            {
                cursor = requestingWindow.mCursor;
            }

            #endregion


            #region Create the IDisplayWindow depending on the type of object passed

            #region If object is enum

            if (objectType.IsEnum)
            {
#if SILVERLIGHT
                throw new NotImplementedException();
#else
                propertyGridType = typeof(EnumPropertyGrid <>).MakeGenericType(objectType);

#if XBOX360
                throw new NotImplementedException("No PropertyGrid support in ObjectDisplayManager on 360 currently");
#else
                // handle enums specially
                newGrid = Activator.CreateInstance(propertyGridType, cursor, requestingWindow,
                                                   requestingListDisplayWindow.Items.IndexOf(requestingListDisplayWindow.GetFirstHighlightedItem())) as PropertyGrid;
#endif
#endif
            }

            #endregion

            #region Else if the object has an associated GUI element

            else if (PropertyGrid.sPropertyGridTypesForObjectType.ContainsKey(objectType))
            {
#if XBOX360
                throw new NotImplementedException("PropertyGrid creation not supported on 360.");
#else
                if (objectType.IsValueType || objectType == typeof(string))
                {
                    newGrid = Activator.CreateInstance(
                        PropertyGrid.sPropertyGridTypesForObjectType[objectType], cursor, requestingWindow,
                        requestingListDisplayWindow.Items.IndexOf(requestingListDisplayWindow.GetFirstHighlightedItem())) as PropertyGrid;
                }
                else
                {
                    Type objectDisplayerType = PropertyGrid.sPropertyGridTypesForObjectType[objectType];

                    ConstructorInfo ci = objectDisplayerType.GetConstructor(System.Type.EmptyTypes);

                    if (ci != null)
                    {
                        // The IObjectDisplayer has a no-argument constructor
                        objectToReturn = Activator.CreateInstance(objectDisplayerType) as IObjectDisplayer;
                    }
                    else
                    {
                        // The constructor requires arguments, meaning it's probabaly a Window, so let's pass a cursor
                        objectToReturn = Activator.CreateInstance(objectDisplayerType, cursor) as IObjectDisplayer;
                    }



                    if (objectToReturn is PropertyGrid)
                    {
                        newGrid = objectToReturn as PropertyGrid;
                    }
                    else if (objectToReturn is ListDisplayWindow)
                    {
                        newListDisplayWindow = objectToReturn as ListDisplayWindow;
                    }
                }
#endif
            }

            #endregion

            #region Else if the object is an IEnumerable

            else if (IsIEnumerable(objectType))
            {
                ListDisplayWindow listDisplayWindow = CreateListDisplayWindowForObject(displayedObject, cursor);

                newListDisplayWindow = listDisplayWindow;
            }

            #endregion

            #region Else if the object is a value type

            else if (objectType.IsValueType)
            {
#if SILVERLIGHT
                throw new NotImplementedException();
#else
                propertyGridType = typeof(StructReferencePropertyGrid <>).MakeGenericType(objectType);

#if XBOX360
                throw new NotImplementedException("No PropertyGrid support on 360");
#else
                if (requestingListDisplayWindow != null)
                {
                    newGrid = Activator.CreateInstance(propertyGridType, cursor, requestingListDisplayWindow,
                                                       requestingListDisplayWindow.Items.IndexOf(requestingListDisplayWindow.GetFirstHighlightedItem())) as PropertyGrid;
                }
                else
                {
                    newGrid = Activator.CreateInstance(
                        propertyGridType,
                        cursor,
                        requestingPropertyGrid,
                        memberName) as PropertyGrid;
                }
#endif
                newGrid.ExcludeStaticMembers();
#endif
            }

            #endregion

            #region Else, just create a regular PropertyGrid

            else
            {
#if SILVERLIGHT
                throw new NotImplementedException();
#else
                propertyGridType = typeof(PropertyGrid <>).MakeGenericType(objectType);

#if XBOX360
                throw new NotImplementedException("No PropertyGrid support on 360");
#else
                newGrid = Activator.CreateInstance(propertyGridType, cursor) as PropertyGrid;
#endif
#endif
            }

            #endregion

            #endregion


            #region Modify the new object based off of settings set at the user level

#if !SILVERLIGHT
            if (PropertyGrid.sPropertyGridMemberSettings.ContainsKey(objectType))
            {
                PropertyGridMemberSettings memberSettings =
                    PropertyGrid.sPropertyGridMemberSettings[objectType];

                foreach (string member in memberSettings)
                {
                    newGrid.ExcludeMember(member);
                }
            }
#endif

            Window newWindow = null;

            if (newGrid != null)
            {
                newWindow = newGrid;
            }
            else if (newListDisplayWindow != null)
            {
                newWindow = newListDisplayWindow;
            }
            else if (objectToReturn is Window)
            {
                newWindow = objectToReturn as Window;
            }

#if !SILVERLIGHT
            if (PropertyGrid.sNewWindowCallbacks.ContainsKey(objectType))
            {
                PropertyGrid.sNewWindowCallbacks[objectType](newWindow);
            }
            if (PropertyGrid.sNewWindowCallbacksByTypeAsString.ContainsKey(objectType.FullName))
            {
                PropertyGrid.sNewWindowCallbacksByTypeAsString[objectType.FullName](newWindow);
            }
#endif

            if (AnyNewWindowCreated != null)
            {
                ObjectDisplayManager.AnyNewWindowCreated(newWindow);
            }

            #endregion


            if (newGrid != null)
            {
#if SILVERLIGHT
                throw new NotImplementedException();
#else
                newGrid.ContentManagerName = ContentManagerName;
                return(newGrid);
#endif
            }
            else if (newListDisplayWindow != null)
            {
#if SILVERLIGHT
                throw new NotImplementedException();
#else
                newListDisplayWindow.ContentManagerName = ContentManagerName;
                return(newListDisplayWindow);
#endif
            }
            else
            {
                // This is probably a custom UI element created by the user, so we'll let it slide :)
                return(objectToReturn);
            }
        }
Exemplo n.º 8
0
        private void CreatePropertyGrid()
        {
            mRecordingDataPropertyGrid = new PropertyGrid<RecordingData>(mCursor);

            mRecordingDataPropertyGrid.ExcludeMember("LastBeatTime");

            mRecordingDataPropertyGrid.GetUIElementForMember("ClosestFitBeatFrequency").ScaleX = 10;
            mRecordingDataPropertyGrid.SetMemberDisplayName("ClosestFitBeatFrequency", "Frequency");
            
            mRecordingDataPropertyGrid.GetUIElementForMember("ClosestFitOffset").ScaleX = 10;
            mRecordingDataPropertyGrid.SetMemberDisplayName("ClosestFitOffset", "Offset");



            this.AddWindow(mRecordingDataPropertyGrid);
            mRecordingDataPropertyGrid.X = mRecordingDataPropertyGrid.ScaleX + .5f;
            mRecordingDataPropertyGrid.Y = 23f;

            mRecordingDataPropertyGrid.SelectedObject = new RecordingData();
            mRecordingDataPropertyGrid.HasMoveBar = false;


        }
        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);
        }
        // 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
            }
        }
Exemplo n.º 11
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
            }
        }