public MainControl() { mSelf = this; InitializeComponent(); mScrollBarControlLogic = new ScrollBarControlLogic(PreviewSplitContainer.Panel1); ApplicationEvents.Self.WireframePanning += delegate { mScrollBarControlLogic.UpdateScrollBars(); }; ApplicationEvents.Self.WireframeTextureChange += ScrollBarHandleTextureChange; ApplicationEvents.Self.AfterZoomChange += delegate { mScrollBarControlLogic.ZoomPercentage = (float)ApplicationState.Self.WireframeZoomValue; mScrollBarControlLogic.UpdateScrollBars(); }; this.imageRegionSelectionControl1 = new FlatRedBall.SpecializedXnaControls.ImageRegionSelectionControl(); imageRegionSelectionControl1.Click += new EventHandler(HandleImageRegionSelectionControlClick); this.PreviewSplitContainer.Panel1.Controls.Add(this.imageRegionSelectionControl1); // // imageRegionSelectionControl1 // // Winforms has issues with controls that contain custom controls // and if this control was in custom code, it caused all kinds of // issues. So we'll just instantiate it here as a workaround. this.imageRegionSelectionControl1.CurrentTexture = null; this.imageRegionSelectionControl1.DesiredFramesPerSecond = 30F; this.imageRegionSelectionControl1.Dock = System.Windows.Forms.DockStyle.Fill; //this.imageRegionSelectionControl1.Width = 100; //this.imageRegionSelectionControl1.Height = 100; this.imageRegionSelectionControl1.Location = new System.Drawing.Point(0, 23); this.imageRegionSelectionControl1.Name = "imageRegionSelectionControl1"; this.imageRegionSelectionControl1.Size = new System.Drawing.Size(296, 264); this.imageRegionSelectionControl1.TabIndex = 0; this.imageRegionSelectionControl1.Text = "imageRegionSelectionControl1"; this.imageRegionSelectionControl1.BringToFront(); SelectedState.Self.Initialize(this.AnimationTreeView); if (this.DesignMode == false) { HandleRegionXnaInitialize(); this.imageRegionSelectionControl1.XnaUpdate += new Action(HandleXnaUpdate); } PropertyGridManager.Self.Initialize(SelectedItemPropertyGrid, this.tileMapInfoWindow1); PropertyGridManager.Self.AnimationChainChange += RaiseAnimationChainChanges; PropertyGridManager.Self.AnimationFrameChange += HandleAnimationFrameChanges; TreeViewManager.Self.Initialize(AnimationTreeView); TreeViewManager.Self.AnimationChainsChange += RaiseAnimationChainChanges; StatusBarManager.Self.Initialize(statusStrip1, CursorStatusLabel); WireframeManager.Self.AnimationFrameChange += HandleAnimationFrameChanges; PopulateUnitTypeComboBox(); PreviewManager.Self.Initialize(PreviewGraphicsControl, previewControls1); }
public Form1() { InitializeComponent(); mMainControl = new FlatRedBall.AnimationEditorForms.MainControl(); // We want to make sure to always have a good animation chain: this.Controls.Add(mMainControl); mMainControl.Dock = DockStyle.Fill; CreateToolStripMenuItems(); mMainControl.XnaInitialize += new Action(HandleXnaInitialize); }
public MainControl() { mSelf = this; InitializeComponent(); mScrollBarControlLogic = new ScrollBarControlLogic(PreviewSplitContainer.Panel1); ApplicationEvents.Self.WireframePanning += delegate { mScrollBarControlLogic.UpdateScrollBars(); }; ApplicationEvents.Self.WireframeTextureChange += ScrollBarHandleTextureChange; ApplicationEvents.Self.AfterZoomChange += delegate { mScrollBarControlLogic.ZoomPercentage = (float)ApplicationState.Self.WireframeZoomValue; mScrollBarControlLogic.UpdateScrollBars(); }; this.imageRegionSelectionControl1 = new FlatRedBall.SpecializedXnaControls.ImageRegionSelectionControl(); imageRegionSelectionControl1.Click += new EventHandler(HandleImageRegionSelectionControlClick); this.PreviewSplitContainer.Panel1.Controls.Add(this.imageRegionSelectionControl1); // // imageRegionSelectionControl1 // // Winforms has issues with controls that contain custom controls // and if this control was in custom code, it caused all kinds of // issues. So we'll just instantiate it here as a workaround. this.imageRegionSelectionControl1.CurrentTexture = null; this.imageRegionSelectionControl1.DesiredFramesPerSecond = 30F; this.imageRegionSelectionControl1.Dock = System.Windows.Forms.DockStyle.Fill; //this.imageRegionSelectionControl1.Width = 100; //this.imageRegionSelectionControl1.Height = 100; this.imageRegionSelectionControl1.Location = new System.Drawing.Point(0, 23); this.imageRegionSelectionControl1.Name = "imageRegionSelectionControl1"; this.imageRegionSelectionControl1.Size = new System.Drawing.Size(296, 264); this.imageRegionSelectionControl1.TabIndex = 0; this.imageRegionSelectionControl1.Text = "imageRegionSelectionControl1"; this.imageRegionSelectionControl1.BringToFront(); this.zoomControl1.PropertyChanged += HandleEditorControlsPropertyChanged; SelectedState.Self.Initialize(this.AnimationTreeView); if (this.DesignMode == false) { HandleRegionXnaInitialize(); this.imageRegionSelectionControl1.XnaUpdate += new Action(HandleXnaUpdate); } PropertyGridManager.Self.Initialize(SelectedItemPropertyGrid, this.tileMapInfoWindow1); PropertyGridManager.Self.AnimationChainChange += RaiseAnimationChainChanges; PropertyGridManager.Self.AnimationFrameChange += HandleAnimationFrameChanges; TreeViewManager.Self.Initialize(AnimationTreeView); TreeViewManager.Self.AnimationChainsChange += RaiseAnimationChainChanges; StatusBarManager.Self.Initialize(statusStrip1, CursorStatusLabel); WireframeManager.Self.AnimationFrameChange += HandleAnimationFrameChanges; PopulateUnitTypeComboBox(); PreviewManager.Self.Initialize(PreviewGraphicsControl, previewControls1); }
private void HandleIfAchx(TreeNode selectedTreeNode) { ReferencedFileSave rfs = selectedTreeNode?.Tag as ReferencedFileSave; bool shouldShowAnimationChainUi = rfs != null && rfs.Name != null && FileManager.GetExtension(rfs.Name) == "achx"; if (shouldShowAnimationChainUi) { if (!mContainer.Controls.Contains(mTab)) { mContainer.Controls.Add(mTab); mContainer.SelectTab(mContainer.Controls.Count - 1); } if (mAchxControl == null) { mAchxControl = new MainControl(); ToolStripMenuItem saveToolStripItem = new ToolStripMenuItem("Force Save", null, HandleSaveClick); mAchxControl.AddToolStripMenuItem(saveToolStripItem, "File"); ToolStripMenuItem forceSaveAllItem = new ToolStripMenuItem("Re-Save all .achx files in this Glue project", null, HandleForceSaveAll); mAchxControl.AddToolStripMenuItem(forceSaveAllItem, "File"); mAchxControl.AnimationChainChange += new EventHandler(HandleAnimationChainChange); mAchxControl.Dock = DockStyle.Fill; } mTab.Text = " Animation"; // add spaces to make room for the X to close the plugin if(!mTab.Controls.Contains(mAchxControl)) { mTab.Controls.Add(mAchxControl); } if(mTab.Controls.Contains(mTextureCoordinateControl)) { mTab.Controls.Remove(mTextureCoordinateControl); } string fullFileName = FlatRedBall.Glue.ProjectManager.MakeAbsolute(rfs.Name); mLastFile = fullFileName; if (System.IO.File.Exists(fullFileName)) { mAchxControl.LoadAnimationChain(fullFileName); } } else if (mContainer.Controls.Contains(mTab)) { mContainer.Controls.Remove(mTab); } }
public override bool ShutDown(PluginShutDownReason reason) { // Do anything your plugin needs to do to shut down // or don't shut down and return false if (mTab != null) { mContainer.Controls.Remove(mTab); } mContainer = null; mTab = null; mAchxControl = null; mTextureCoordinateControl = null; return true; }