示例#1
0
        private static PropertyGrid CreatePropertyGridForObject(object objectToCreateGridFor)
        {
            object[] arguments = new object[] {
                GuiManager.Cursor,
                objectToCreateGridFor
            };

            Type   t   = typeof(PropertyGrid <>).MakeGenericType(mTypeOfObjectToSerialize);
            object obj = Activator.CreateInstance(t, arguments);

            PropertyGrid propertyGrid = obj as PropertyGrid;

            GuiManager.AddWindow(propertyGrid);
            propertyGrid.HasCloseButton = true;
            propertyGrid.Closing       += GuiManager.RemoveWindow;

            Button saveButton = new Button(GuiManager.Cursor);

            saveButton.Text   = "Save Object as XML";
            saveButton.ScaleX = 9f;
            saveButton.Click += XmlSeralizeObject;
            propertyGrid.AddWindow(saveButton);

            Button loadButton = new Button(GuiManager.Cursor);

            loadButton.Text   = "Load Object from XML";
            loadButton.ScaleX = 9f;
            loadButton.Click += XmlDeserializeObject;
            propertyGrid.AddWindow(loadButton);

            return(propertyGrid);
        }
        private void CreateUpDowns()
        {
            mSetRelativeX = new UpDown(mCursor);
            mSetRelativeX.ValueChanged += SetRelativeX;
            mSetRelativeX.ScaleX        = 6;
            mSetRelativeX.Sensitivity   = .07f;
            mPropertyGrid.AddWindow(mSetRelativeX, "Actions");
            mPropertyGrid.SetLabelForWindow(mSetRelativeX, "Set all Relative X");


            mSetRelativeY = new UpDown(mCursor);
            mSetRelativeY.ValueChanged += SetRelativeY;
            mSetRelativeY.ScaleX        = 6;
            mSetRelativeY.Sensitivity   = .07f;
            mPropertyGrid.AddWindow(mSetRelativeY, "Actions");
            mPropertyGrid.SetLabelForWindow(mSetRelativeY, "Set all Relative Y");
        }
示例#3
0
        private static void ShowAssemblyPropertyGrid(Window callingWindow)
        {
            PropertyGrid <Assembly> propertyGrid = callingWindow as PropertyGrid <Assembly>;

            //EditorData.EditorLogic.CurrentAssembly = propertyGrid.SelectedObject;

            Button showTypes = new Button(GuiManager.Cursor);

            showTypes.Text   = "Show Types";
            showTypes.ScaleX = 5;
            showTypes.Click += ClickShowAssemblyTypes;

            propertyGrid.AddWindow(showTypes);
        }
        //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");
        }
示例#6
0
        void SaveNodeNetworkOk(Window callingWindow)
        {
            mNameOfNodeNetwork = ((FileWindow)callingWindow).Results[0];

            PropertyGrid <AxisFlippingSettings> axisFlippingSettings = new PropertyGrid <AxisFlippingSettings>(GuiManager.Cursor);

            axisFlippingSettings.HasCloseButton = false;
            axisFlippingSettings.Name           = "Save Options:";
            GuiManager.AddDominantWindow(axisFlippingSettings);
            axisFlippingSettings.HasCloseButton = true;
            axisFlippingSettings.SelectedObject = new AxisFlippingSettings();

            Button okButton = new Button(GuiManager.Cursor);

            okButton.Text   = "Save";
            okButton.ScaleX = 3f;
            okButton.ScaleY = 2;
            okButton.Click += SaveNodeNetworkSettingsOk;
            okButton.Click += RemoveParentWindow;

            axisFlippingSettings.Closing += GuiManager.RemoveWindow;
            axisFlippingSettings.AddWindow(okButton);
        }
示例#7
0
        void LoadNodeNetworkOk(Window callingWindow)
        {
            mNameOfNodeNetwork = ((FileWindow)callingWindow).Results[0];

            PropertyGrid <AxisFlippingSettings> axisFlippingSettings = GuiManager.AddPropertyGrid <AxisFlippingSettings>();

            axisFlippingSettings.HasCloseButton = true;
            axisFlippingSettings.SelectedObject = new AxisFlippingSettings();

            // when loading change the members
            axisFlippingSettings.SetMemberDisplayName("CopyYToZ", "CopyZToY");
            axisFlippingSettings.SetMemberDisplayName("FlipY", "Flip Y");
            axisFlippingSettings.SetMemberDisplayName("MakeYZero", "Set Z = 0");

            Button okButton = new Button(GuiManager.Cursor);

            okButton.Text   = "Ok";
            okButton.ScaleX = 1.5f;
            okButton.Click += LoadNodeNetworkSettingsOk;
            okButton.Click += RemoveParentWindow;

            axisFlippingSettings.Closing += GuiManager.RemoveWindow;
            axisFlippingSettings.AddWindow(okButton);
        }
示例#8
0
        void SaveNodeNetworkOk(Window callingWindow)
        {
            mNameOfNodeNetwork = ((FileWindow)callingWindow).Results[0];

            PropertyGrid<AxisFlippingSettings> axisFlippingSettings = new PropertyGrid<AxisFlippingSettings>(GuiManager.Cursor);
            axisFlippingSettings.HasCloseButton = false;
            axisFlippingSettings.Name = "Save Options:";
            GuiManager.AddDominantWindow(axisFlippingSettings);
            axisFlippingSettings.HasCloseButton = true;
            axisFlippingSettings.SelectedObject = new AxisFlippingSettings();

            Button okButton = new Button(GuiManager.Cursor);
            okButton.Text = "Save";
            okButton.ScaleX = 3f;
            okButton.ScaleY = 2;
            okButton.Click += SaveNodeNetworkSettingsOk;
            okButton.Click += RemoveParentWindow;

            axisFlippingSettings.Closing += GuiManager.RemoveWindow;
            axisFlippingSettings.AddWindow(okButton);

        }
        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);
        }