Exemple #1
0
        void menuDocumentItem_Click(object sender, EventArgs e)
        {
            DocumentTab tab = GetDocument(((ToolStripItem)sender).Tag as string);

            if (tab != null)
            {
                tab.Activate();
            }
            else
            {
                SelectDockPane((string)((ToolStripMenuItem)sender).Tag);
            }
        }
Exemple #2
0
        private void MainDock_ActiveDocumentChanged(object sender, EventArgs e)
        {
            if (MainDock.ActiveDocument == null)
            {
                return;
            }
            DockContent content = MainDock.ActiveDocument as DockContent;

            if (content.Tag is DocumentTab)
            {
                if (_activeTab != null)
                {
                    _activeTab.Deactivate();
                }
                _activeTab = content.Tag as DocumentTab;
                _activeTab.Activate();
            }
            UpdateControls();
        }
Exemple #3
0
        private void IDEForm_Load(object sender, EventArgs e)
        {
            Location    = new Point(Ide.Properties.Settings.Default.WindowX, Ide.Properties.Settings.Default.WindowY);
            Size        = new Size(Ide.Properties.Settings.Default.WindowWidth, Ide.Properties.Settings.Default.WindowHeight);
            WindowState = Ide.Properties.Settings.Default.WindowMaxed ? FormWindowState.Maximized : FormWindowState.Normal;

            // this works around glitchy WeifenLuo behavior when messing with panel
            // visibility before the form loads.
            if (Core.Settings.AutoOpenLastProject && Core.Project != null)
            {
                StartVisible = !Core.Project.User.StartHidden;
                DocumentTab tab = GetDocument(Core.Project.User.ActiveDocument);
                if (tab != null)
                {
                    tab.Activate();
                }
            }
            else
            {
                StartVisible = Core.Settings.UseStartPage;
            }
        }
Exemple #4
0
        private void IDEForm_Shown(object sender, EventArgs e)
        {
            bool isFirstRun = !Core.Settings.GetBoolean("setupComplete", false);

            if (isFirstRun)
            {
                MessageBox.Show(@"Hello! It's your first time here! I would love to help you " +
                                @"set a few things up!", @"Welcome First Timer", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                Core.Settings.SetValue("setupComplete", true);
                menuConfigManager_Click(null, EventArgs.Empty);
            }

            if (!String.IsNullOrWhiteSpace(_defaultActiveName))
            {
                DocumentTab tab = GetDocument(_defaultActiveName);
                if (tab != null)
                {
                    tab.Activate();
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Loads a Sphere Studio project into the IDE.
        /// </summary>
        /// <param name="fileName">The filename of the project.</param>
        /// <param name="usePluginWarning">Whether to show a warning if required plugins are missing.</param>
        public void OpenProject(string fileName, bool usePluginWarning = true)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            Project   pj       = SphereStudio.Ide.Project.Open(fileName);
            IStarter  starter  = PluginManager.Get <IStarter>(pj.User.Engine);
            ICompiler compiler = PluginManager.Get <ICompiler>(pj.Compiler);

            if (usePluginWarning && (starter == null || compiler == null))
            {
                var answer = MessageBox.Show(
                    string.Format("One or more plugins required to work on '{0}' are either disabled or not installed.  Please open Configuration Manager and check your plugins.\n\nCompiler required:\n{1}\n\nIf you continue, data may be lost.  Open this project anyway?", pj.Name, pj.Compiler),
                    "Proceed with Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (answer == DialogResult.No)
                {
                    return;
                }
            }

            if (!CloseCurrentProject())
            {
                return;
            }
            Core.Project = pj;

            RefreshProject();

            if (LoadProject != null)
            {
                LoadProject(null, EventArgs.Empty);
            }

            HelpLabel.Text = @"Game project loaded successfully!";

            StartVisible = true;

            string[] docs = Core.Project.User.Documents;
            foreach (string s in docs)
            {
                if (string.IsNullOrWhiteSpace(s))
                {
                    continue;
                }
                try { OpenFile(s, true); }
                catch (Exception) { }
            }

            // if the form is not visible, don't try to mess with the panels.
            // it will be done in Form_Load.
            if (Visible)
            {
                if (Core.Project.User.StartHidden)
                {
                    StartVisible = false;
                }

                DocumentTab tab = GetDocument(Core.Project.User.ActiveDocument);
                if (tab != null)
                {
                    tab.Activate();
                }
            }

            Text = string.Format("{3} - {0} {1} {2}",
                                 Versioning.Name, Versioning.Version, Environment.Is64BitProcess ? "x64" : "x86",
                                 Project.Name);

            UpdateEngineList();
            UpdateControls();
        }