Пример #1
0
        public ListBoxWindow() :
            base(GuiManager.Cursor)
        {
            #region Set "this" properties.
            GuiManager.AddWindow(this);
            SetPositionTL(97.3f, 25.2f);
            ScaleX   = 13.1f;
            ScaleY   = 19.505f;
            mName    = "Keyframes";
            mMoveBar = true;

            MinimumScaleX = ScaleX;
            MinimumScaleY = 7;

            this.Resizable = true;

            this.Resizing += AdjustPositionsAndScales;


            #endregion

            #region List Box

            mInstructionSetListBox            = AddCollapseListBox();
            mInstructionSetListBox.Highlight += new GuiMessage(UpdateAddButtonVisibility);
            mInstructionSetListBox.Highlight += HighlightInstructionSetListBox;

            mInstructionSetListBox.FocusUpdate += InstructionListHotkeyUpdate;
            #endregion

            #region AnimationSequence ListDisplayWindow

            mAnimationSequenceListBox = new ListDisplayWindow(mCursor);
            this.AddWindow(mAnimationSequenceListBox);
            mAnimationSequenceListBox.ListBox.Highlight    += HighlightAnimationSequenceListBox;
            mAnimationSequenceListBox.ListBox.StrongSelect += DoubleClickAnimationSequenceListBox;
            mAnimationSequenceListBox.ListBox.FocusUpdate  += new FocusUpdateDelegate(AnimationSequenceFocusUpdate);
            ListDisplayWindow.SetStringRepresentationMethod(typeof(TimedKeyframeList), GetTimedKeyframeListStringRepresentation);

            #endregion

            #region Add Keyframe List Button

            mAddKeyframeListButton        = AddButton();
            mAddKeyframeListButton.Text   = "Add Animation";
            mAddKeyframeListButton.Click += AddKeyframeListClick; // this will call UpdateVisibleWindows

            #endregion

            #region Add Keyframe Button

            mAddKeyframeButton        = AddButton();
            mAddKeyframeButton.Text   = "Add Keyframe";
            mAddKeyframeButton.Click += AddKeyframe;

            #endregion

            AdjustPositionsAndScales(null);
        }
Пример #2
0
        private static void SelectNodeInListBox(Window callingWindow)
        {
            CollapseListBox asListBox = callingWindow as CollapseListBox;

            PositionedNode node = asListBox.GetFirstHighlightedObject() as PositionedNode;

            EditorData.EditingLogic.SelectNode(node);
        }
Пример #3
0
        private static void CreateObjectOfSelectedType(Window callingWindow)
        {
            CollapseListBox collapseListBox = callingWindow as CollapseListBox;

            Type type = collapseListBox.GetFirstHighlightedObject() as Type;

            mObjectToSerialize       = Activator.CreateInstance(type);
            mTypeOfObjectToSerialize = type;

            if (PropertyGrid.IsIEnumerable(type))
            {
                mObjectListDisplayWindow = CreateListDisplayWindowForObject(mObjectToSerialize);
            }
            else
            {
                mObjectPropertyGrid = CreatePropertyGridForObject(mObjectToSerialize);
            }
        }
Пример #4
0
        public ListWindow(ToolsWindow toolsWindow)
            : base(GuiManager.Cursor)
        {
            #region Set engine and common SpriteEditor references

            this.messages     = GuiData.messages;
            this.mToolsWindow = toolsWindow;

            #endregion

            #region Set "this" properties

            GuiManager.AddWindow(this);
            this.ScaleX = 13f;
            this.ScaleY = 20f;
            base.SetPositionTL(this.ScaleX, 25.7f);
            base.HasMoveBar     = true;
            base.HasCloseButton = true;
            base.mName          = "Object List";
            base.Resizing      += new GuiMessage(this.PositionContainedElements);
            base.Resizable      = true;
            base.MinimumScaleX  = 10f;
            base.MinimumScaleY  = 5f;

            #endregion

            #region spriteListBox

            SpriteListBox                           = new ListDisplayWindow(GuiManager.Cursor);
            SpriteListBox.DrawBorders               = false;
            SpriteListBox.ListBox.TakingInput       = false; // allows input like delete, keyboard camera movement to fall through
            SpriteListBox.ListBox.ShiftClickOn      = true;
            SpriteListBox.ListBox.CtrlClickOn       = true;
            this.SpriteListBox.ListBox.Push        += new GuiMessage(spriteListBoxClick);
            this.SpriteListBox.ListBox.DoubleClick += new GuiMessage(spriteListBoxDoubleClick);
            this.SpriteListBox.Lined                = true;
            this.AddWindow(SpriteListBox);
            SpriteListBox.ListBox.FocusUpdate += SpriteListFocusUpdate;

            SpriteListBox.ConsiderAttachments = true;

            #endregion

            #region gridListBox property setting

            SpriteGridListBox                           = new ListDisplayWindow(GuiManager.Cursor);
            SpriteGridListBox.DrawBorders               = false;
            this.SpriteGridListBox.Visible              = false;
            this.SpriteGridListBox.ListBox.Push        += new GuiMessage(this.GridListBoxClick);
            this.SpriteGridListBox.ListBox.DoubleClick += new GuiMessage(this.messages.GridListBoxDoubleClick);
            SpriteGridListBox.ListBox.FocusUpdate      += SpriteGridListFocusUpdate;
            AddWindow(SpriteGridListBox);
            #endregion

            #region SpriteFrameListBox

            SpriteFrameListBox                     = new ListDisplayWindow(GuiManager.Cursor);
            SpriteFrameListBox.DrawBorders         = false;
            SpriteFrameListBox.ListBox.TakingInput = false;             // allows input like delete, keyboard camera movement to fall through

            this.SpriteFrameListBox.Visible       = false;
            this.SpriteFrameListBox.ListBox.Push += new GuiMessage(this.FrameListBoxClick);
            AddWindow(SpriteFrameListBox);
            SpriteFrameListBox.ConsiderAttachments = true;

            #endregion

            #region ModelListBox
            mModelListBox                    = new ListDisplayWindow(GuiManager.Cursor);
            mModelListBox.DrawBorders        = false;
            this.mModelListBox.Visible       = false;
            this.mModelListBox.ListBox.Push += new GuiMessage(this.ModelListBoxClick);
            this.AddWindow(ModelListBox);
            mModelListBox.ConsiderAttachments = true;
            #endregion

            #region TextListBox

            mTextListBox               = new ListDisplayWindow(GuiManager.Cursor);
            mTextListBox.DrawBorders   = false;
            mTextListBox.Visible       = false;
            mTextListBox.ListBox.Push += TextListBoxClick;
            this.AddWindow(mTextListBox);
            mTextListBox.ConsiderAttachments = true;


            #endregion

            #region TextureListBox
            this.textureListBox = new CollapseListBox(mCursor);
            AddWindow(textureListBox);
            this.textureListBox.Visible      = false;
            this.textureListBox.Highlight   += new GuiMessage(TextureListBoxClick);
            this.textureListBox.FocusUpdate += TextureListBoxFocusUpdate;
            #endregion

            #region AnimationChain List Box

            mAnimationChainListWindow                    = new ListDisplayWindow(GuiManager.Cursor);
            mAnimationChainListWindow.DrawBorders        = false;
            mAnimationChainListWindow.Visible            = false;
            mAnimationChainListWindow.ListBox.Highlight += AnimationChainListBoxClick;
            this.AddWindow(mAnimationChainListWindow);

            #endregion

            this.PositionContainedElements(this);

            float buttonScale = 1.3f;

            #region Create the EditSprites ToggleButton

            this.editSprites = new ToggleButton(mCursor);
            AddWindow(editSprites);
            this.editSprites.ScaleX = this.editSprites.ScaleY = buttonScale;
            this.editSprites.SetPositionTL(buttonScale + .4f, 1.5f);
            this.editSprites.Text = "Edit Sprites";
            this.editSprites.SetOverlayTextures(3, 1);
            this.editSprites.Press();
            this.editSprites.Click += new GuiMessage(this.EditSpritesClick);

            #endregion

            #region Edit SpriteGrids

            this.editGrids = new ToggleButton(mCursor);
            AddWindow(editGrids);
            this.editGrids.ScaleX = this.editGrids.ScaleY = buttonScale;
            this.editGrids.SetPositionTL(3 * buttonScale + .4f, 1.5f);
            this.editGrids.Text = "Edit Grids";
            this.editGrids.SetOverlayTextures(4, 1);
            this.editSprites.AddToRadioGroup(this.editGrids);
            this.editGrids.Click += new GuiMessage(this.EditGridsClick);
            this.editGrids.SetOneAlwaysDown(true);

            #endregion

            #region Edit SpriteFrames toggle button

            this.editSpriteFrames = new ToggleButton(mCursor);
            AddWindow(editSpriteFrames);
            this.editSpriteFrames.ScaleX = this.editSpriteFrames.ScaleY = buttonScale;
            this.editSpriteFrames.SetPositionTL(5 * buttonScale + .4f, 1.5f);
            this.editSpriteFrames.Text = "Edit SpriteFrames";
            this.editSpriteFrames.SetOverlayTextures(0, 3);
            this.editSprites.AddToRadioGroup(this.editSpriteFrames);
            this.editSpriteFrames.Click += new GuiMessage(this.EditFramesClick);
            this.editSpriteFrames.SetOneAlwaysDown(true);

            #endregion

            #region editModels
            this.editModels = new ToggleButton(mCursor);
            AddWindow(editModels);
            this.editModels.ScaleX = this.editModels.ScaleY = buttonScale;
            this.editModels.SetPositionTL(7 * buttonScale + .4f, 1.5f);
            this.editModels.Text = "Edit Models";
            this.editModels.SetOverlayTextures(4, 3);
            this.editSprites.AddToRadioGroup(this.editModels);
            this.editModels.Click += new GuiMessage(this.EditModelsClick);
            this.editModels.SetOneAlwaysDown(true);
            #endregion

            #region EditTexts
            this.mEditTexts = new ToggleButton(mCursor);
            AddWindow(mEditTexts);
            this.mEditTexts.ScaleX = this.mEditTexts.ScaleY = buttonScale;
            this.mEditTexts.SetPositionTL(9 * buttonScale + .4f, 1.5f);
            this.mEditTexts.Text = "Edit Texts";
            this.mEditTexts.SetOverlayTextures(6, 3);
            this.editSprites.AddToRadioGroup(this.mEditTexts);
            this.mEditTexts.Click += new GuiMessage(this.EditTextsClick);
            this.mEditTexts.SetOneAlwaysDown(true);

            #endregion

            #region View Textures icon
            this.mViewTexturesButton = new Button(mCursor);
            AddWindow(mViewTexturesButton);
            this.mViewTexturesButton.ScaleX = this.mViewTexturesButton.ScaleY = buttonScale;
            this.mViewTexturesButton.SetPositionTL(11 * buttonScale + .4f + .7f, 1.5f);
            this.mViewTexturesButton.Text = "View Textures";
            this.mViewTexturesButton.SetOverlayTextures(2, 3);
            // no longer a ToggleButton and it shouldn't be part of the group
            //this.editSprites.AddToRadioGroup(this.editTextures);
            //this.editTextures.SetOneAlwaysDown(true);
            this.mViewTexturesButton.Click += new GuiMessage(this.EditTexturesClick);
            #endregion

            #region Vew AnimationChains icon
            this.mViewAnimationChainsButton = new Button(mCursor);
            AddWindow(mViewAnimationChainsButton);
            this.mViewAnimationChainsButton.ScaleX = this.mViewAnimationChainsButton.ScaleY = buttonScale;
            this.mViewAnimationChainsButton.SetPositionTL(13 * buttonScale + .4f + .7f, 1.5f);
            this.mViewAnimationChainsButton.Text = "View AnimationChains";
            this.mViewAnimationChainsButton.SetOverlayTextures(7, 3);
            // no longer a ToggleButton and it shouldn't be part of the group
            //this.editSprites.AddToRadioGroup(this.editTextures);
            //this.editTextures.SetOneAlwaysDown(true);
            this.mViewAnimationChainsButton.Click += new GuiMessage(this.ViewAnimationChainsClick);

            #endregion

            RefreshListsShown();
        }