Example #1
0
        public void OpenLevel(Level level)
        {
            //Search to see if it's already open
            foreach (DockableFormInfo dfi in mLevelToolWindowInfos)
            {
                if (dfi.IsDisposed)
                {
                    continue;
                }

                LevelToolWindow window = dfi.DockableForm as LevelToolWindow;
                if (window == null)
                {
                    continue;
                }

                if (window.Level == level)
                {
                    dfi.IsSelected = true;
                    return;
                }
            }

            //Open it as it's not open currently
            AddLevelWindow(level);

            FinishTool();
        }
Example #2
0
        public LevelToolWindow[] GetAllOpenLevelToolWindows()
        {
            List <LevelToolWindow> ltws = new List <LevelToolWindow>();

            foreach (DockableFormInfo dfi in GetAllToolWindows())
            {
                LevelToolWindow ltw = dfi.DockableForm as LevelToolWindow;
                if (ltw != null)
                {
                    ltws.Add(ltw);
                }
            }

            return(ltws.ToArray());
        }
        private void mnuSetBackground_Click(object sender, EventArgs e)
        {
            Level          level  = SelectedNode.Tag as Level;
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Title  = "Import background image";
            dialog.Filter = "Supported Image Files|*.png;*.jpg|Portable Network Graphics (*.png)|*.png|Joint Photographic Experts Group (*.jpg)|*.jpg";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                level.Background = Image.FromFile(dialog.FileName);

                LevelToolWindow ltw = mParent.GetLevelToolWindow(level);
                if (ltw != null)
                {
                    ltw.LevelEditor.UpdateRedraw();
                }
            }
        }
        private void mnuLevelProperties_Click(object sender, EventArgs e)
        {
            Level            level = SelectedNode.Tag as Level;
            LevelDetailsForm form  = new LevelDetailsForm(level);

            if (form.ShowDialog() == DialogResult.OK)
            {
                //Level name may have changed
                SelectedNode.Text = level.Info.Name;

                LevelToolWindow ltw = mParent.GetLevelToolWindow(level);
                if (ltw != null)
                {
                    ltw.Text = level.Info.Name;
                    mParent.RefreshDockContainer();
                }
            }
        }
Example #5
0
        private void AddLevelWindow(Level level)
        {
            LevelToolWindow  ltw = new LevelToolWindow(this, level);
            DockableFormInfo dfi = AddToolWindow(ltw);

            DockableFormInfo oldfi = mDockContainer.GetFormInfo(mLastFocusedLevel);

            if (oldfi == null)
            {
                mDockContainer.DockForm(dfi, DockStyle.Fill, zDockMode.Inner);
            }
            else
            {
                mDockContainer.DockForm(dfi, oldfi, DockStyle.Fill, zDockMode.Inner);
            }

            mLevelToolWindowInfos.Add(dfi);
            mLastFocusedLevel = ltw;
        }
Example #6
0
        public void CloseLevel(Level level)
        {
            //Search to see if it's open
            foreach (DockableFormInfo dfi in mLevelToolWindowInfos)
            {
                if (dfi.IsDisposed)
                {
                    continue;
                }

                LevelToolWindow window = dfi.DockableForm as LevelToolWindow;
                if (window == null)
                {
                    continue;
                }

                if (window.Level == level)
                {
                    mDockContainer.Remove(dfi);
                    return;
                }
            }
        }
Example #7
0
 public void LevelWindowHasFocus(LevelToolWindow window)
 {
     mLastFocusedLevel = window;
 }
Example #8
0
		public void LevelWindowHasFocus(LevelToolWindow window)
		{
			mLastFocusedLevel = window;
		}
Example #9
0
		private void AddLevelWindow(Level level)
		{
			LevelToolWindow ltw = new LevelToolWindow(this, level);
			DockableFormInfo dfi = AddToolWindow(ltw);

			DockableFormInfo oldfi = mDockContainer.GetFormInfo(mLastFocusedLevel);
			if (oldfi == null) {
				mDockContainer.DockForm(dfi, DockStyle.Fill, zDockMode.Inner);
			} else {
				mDockContainer.DockForm(dfi, oldfi, DockStyle.Fill, zDockMode.Inner);
			}

			mLevelToolWindowInfos.Add(dfi);
			mLastFocusedLevel = ltw;
		}