Ejemplo n.º 1
0
        void MDIParent_Shown(object sender, EventArgs e)
        {
            try
            {
                SetDockDefault(DockFiles, "Files");
                DockFiles.Show(dockPanel, DockState.Document);

                SetDockDefault(DockEditors, "Editors");
                DockEditors.Show(DockFiles.Pane, DockAlignment.Right, 0.7);

                SetDockDefault(DockRenderer, "Renderer");
                DockRenderer.Show(dockPanel, DockState.DockRight);

                SetDockDefault(DockImage, "Image");
                DockImage.Show(dockPanel, DockState.DockRight);
                DockRenderer.Activate();

                SetDockDefault(DockLog, "Log");
                DockLog.Show(dockPanel, DockState.DockBottom);

                SetDockDefault(DockScript, "Script");
                DockScript.Show(DockLog.Pane, DockAlignment.Right, 0.5);

                defaultDocks = new Tuple <DockContent, ToolStripMenuItem>[] {
                    new Tuple <DockContent, ToolStripMenuItem>(DockFiles, viewFilesToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockEditors, viewEditorsToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockImage, viewImageToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockRenderer, viewRendererToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockLog, viewLogToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockScript, viewScriptToolStripMenuItem)
                };

                viewFilesToolStripMenuItem.Checked    = true;
                viewEditorsToolStripMenuItem.Checked  = true;
                viewRendererToolStripMenuItem.Checked = true;
                viewImageToolStripMenuItem.Checked    = true;
                viewLogToolStripMenuItem.Checked      = true;
                viewScriptToolStripMenuItem.Checked   = true;

                viewFilesToolStripMenuItem.CheckedChanged    += new EventHandler(viewFilesToolStripMenuItem_CheckedChanged);
                viewEditorsToolStripMenuItem.CheckedChanged  += new EventHandler(viewEditorsToolStripMenuItem_CheckedChanged);
                viewRendererToolStripMenuItem.CheckedChanged += new EventHandler(viewRendererToolStripMenuItem_CheckedChanged);
                viewImageToolStripMenuItem.CheckedChanged    += new EventHandler(viewImageToolStripMenuItem_CheckedChanged);
                viewLogToolStripMenuItem.CheckedChanged      += new EventHandler(viewLogToolStripMenuItem_CheckedChanged);
                viewScriptToolStripMenuItem.CheckedChanged   += new EventHandler(viewScriptToolStripMenuItem_CheckedChanged);

                KeysConverter conv = new KeysConverter();
                foreach (var tool in PluginManager.Tools)
                {
                    ToolStripMenuItem item = new ToolStripMenuItem(tool[1], null, new EventHandler(OpenTool));
                    item.Tag          = tool[0];
                    item.ShortcutKeys = (Keys)conv.ConvertFromString(tool[2]);
                    toolsToolStripMenuItem.DropDownItems.Add(item);
                }
#if DEBUG
                Test();
#endif
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Ejemplo n.º 2
0
        void MDIParent_Shown(object sender, EventArgs e)
        {
            try
            {
                SetDockDefault(DockFiles, "Files");
                DockFiles.ToolTipText = "Drag 'n drop supported files here!";
                Label info = new Label();
                info.Text     = DockFiles.ToolTipText;
                info.Left     = 20;
                info.Top      = 20;
                info.AutoSize = true;
                DockFiles.Controls.Add(info);
                DockFiles.Show(dockPanel, DockState.Document);
                DockFiles.PanelPane.Layout += PanelPane_Layout;

                SetDockDefault(DockEditors, "Editors");
                DockEditors.Show(DockFiles.Pane, DockAlignment.Right, 0.7);
                DockEditors.PanelPane.Layout += PanelPane_Layout;

                SetDockDefault(DockQuickAccess, "Quick Access");
                DockQuickAccess.Show(DockFiles.Pane, DockAlignment.Top, 0.3);

                try
                {
                    SetDockDefault(DockRenderer, "Renderer");
                    DockRenderer.Show(dockPanel, DockState.DockRight);
                    viewRendererToolStripMenuItem.Checked = true;
                }
                catch
                {
                    viewRendererToolStripMenuItem.Checked = false;
                    viewRendererToolStripMenuItem.Enabled = false;
                }

                try
                {
                    SetDockDefault(DockImage, "Image");
                    DockImage.Show(dockPanel, DockState.DockRight);
                    DockRenderer.Activate();
                    viewImageToolStripMenuItem.Checked = true;
                }
                catch
                {
                    viewImageToolStripMenuItem.Checked = false;
                    viewImageToolStripMenuItem.Enabled = false;
                }

                SetDockDefault(DockLog, "Log");
                DockLog.Show(dockPanel, DockState.DockBottom);

                SetDockDefault(DockScript, "Script");
                DockScript.Show(DockLog.Pane, DockAlignment.Right, 0.5);

                viewQuickAccessToolStripMenuItem.Checked = true;
                viewFilesToolStripMenuItem.Checked       = true;
                viewEditorsToolStripMenuItem.Checked     = true;
                viewLogToolStripMenuItem.Checked         = true;
                viewScriptToolStripMenuItem.Checked      = true;

                defaultDocks = new Tuple <DockContent, ToolStripMenuItem>[] {
                    new Tuple <DockContent, ToolStripMenuItem>(DockFiles, viewFilesToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockEditors, viewEditorsToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockImage, viewImageToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockRenderer, viewRendererToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockLog, viewLogToolStripMenuItem),
                    new Tuple <DockContent, ToolStripMenuItem>(DockScript, viewScriptToolStripMenuItem)
                };

                viewQuickAccessToolStripMenuItem.CheckedChanged += viewQuickAccessToolStripMenuItem_CheckedChanged;
                viewFilesToolStripMenuItem.CheckedChanged       += new EventHandler(viewFilesToolStripMenuItem_CheckedChanged);
                viewEditorsToolStripMenuItem.CheckedChanged     += new EventHandler(viewEditorsToolStripMenuItem_CheckedChanged);
                viewImageToolStripMenuItem.CheckedChanged       += viewImageToolStripMenuItem_CheckedChanged;
                viewRendererToolStripMenuItem.CheckedChanged    += viewRendererToolStripMenuItem_CheckedChanged;
                viewLogToolStripMenuItem.CheckedChanged         += new EventHandler(viewLogToolStripMenuItem_CheckedChanged);
                viewScriptToolStripMenuItem.CheckedChanged      += new EventHandler(viewScriptToolStripMenuItem_CheckedChanged);

                viewQuickAccessToolStripMenuItem.Checked = (bool)Gui.Config["QuickAccess"];
                viewImageToolStripMenuItem.Checked       = (bool)Gui.Config["Image"];
                viewRendererToolStripMenuItem.Checked    = (bool)Gui.Config["Renderer"];
                viewLogToolStripMenuItem.Checked         = (bool)Gui.Config["Log"];
                viewScriptToolStripMenuItem.Checked      = (bool)Gui.Config["Script"];

                dockingToolStripMenuItem_CheckedChanged(null, null);

                InstallStatusLineHandler(menuStrip.Items);

                KeysConverter conv = new KeysConverter();
                foreach (var tool in PluginManager.Tools)
                {
                    ToolStripMenuItem item = new ToolStripMenuItem(tool[1], null, new EventHandler(OpenTool));
                    item.Tag = tool[0];
                    if (tool[2] != null)
                    {
                        try
                        {
                            item.ShortcutKeys = (Keys)conv.ConvertFromString(tool[2]);
                        }
                        catch { }
                    }
                    toolsToolStripMenuItem.DropDownItems.Add(item);
                }

                if (CommandLineArgumentHandler.SB3UtilityIsServer())
                {
                    CommandLineArgumentHandler.ReadyToServe();
                }
#if DEBUG
                Test();
#endif
            }
            catch (Exception ex)
            {
                Report.ReportLog("MDIParent_Shown crashed: " + ex.InnerException);
            }
        }