private void initializeSolutionBrowser() { //create the solution browser control p_SolutionExplorer = new SolutionBrowserControl() { Dock = DockStyle.Fill }; //create the dockable window to hold the solution explorer DockableControl dock = new DockableControl() { Dock = DockStyle.Fill, Title = "Solution Explorer" }; dock.WorkingArea.Controls.Add(p_SolutionExplorer); //add the control to the control skeleton p_MainBodyContainer.Panel2.Controls.Add(dock); #region Dock events /*When the dock control is docked, adjust the skeleton to make it visible*/ dock.DockClicked += delegate(object sender, EventArgs e) { p_MainBodyContainer.Panel2Collapsed = false; }; /*When the dock control is undocked, adjust the skeleton to make it invisible*/ dock.UndockClicked += delegate(object sender, EventArgs e) { p_MainBodyContainer.Panel2Collapsed = true; }; /*When the dock is closed, just make it invisible but DON'T dispose it*/ dock.CloseClicked += delegate(object sender, EventArgs e) { p_MainBodyContainer.Panel2Collapsed = true; }; #endregion #region Solution events p_SolutionExplorer.FileOpened += delegate(SolutionBrowserControl sender, ProjectFile file) { AddTab(file.PhysicalLocation); }; p_SolutionExplorer.FileDelete += delegate(SolutionBrowserControl sender, ProjectFile file) { RemoveTab(file.PhysicalLocation); }; p_SolutionExplorer.SolutionChanged += delegate(SolutionBrowserControl sender, Solution solution) { saveState(); p_Title = solution.SolutionName + " - " + p_BaseTitle; Text = p_Title; }; #endregion //load the solution that was loaded in a previous //instance of the IDE if (RuntimeState.ObjectExists("mainIDE.openedSolution")) { string solutionFilename = RuntimeState.GetObjectString("mainIDE.openedSolution"); if (!File.Exists(solutionFilename)) { return; } p_SolutionExplorer.Solution = new Solution(solutionFilename); } //restore the state of the solution control p_SolutionExplorer.LoadTreeExpandState("mainIDE.solutionBrowserState"); }
public MainIDE(Splash splash) { BackColor = Color.FromArgb(255, 200, 200, 200); Icon = Icons.GetIcon("icons.logo", 32); Text = "OS Development Studio"; //once the form has loaded, send a signal to the //splash screen to close. Load += delegate(object sender, EventArgs e) { splash.Ready(); Focus(); }; //set the minimum size of the window to 75% of the current screen Size screenSize = Screen.FromPoint(Cursor.Position).WorkingArea.Size; MinimumSize = new Size( (int)(screenSize.Width * 0.75), (int)(screenSize.Height * 0.75)); //create the initial panels StatusStrip status = new StatusStrip(); p_WorkingArea = new Panel { Dock = DockStyle.Fill }; ToolStrip menu = new ToolStrip { GripStyle = ToolStripGripStyle.Hidden, Renderer = new ToolStripProfessionalRenderer() { RoundedEdges = false } }; //add the controls Controls.Add(menu); Controls.Add(status); Controls.Add(p_WorkingArea); p_WorkingArea.BringToFront(); /*Build the main menu items*/ ToolStripItem fileMenu = menu.Items.Add("File"); fileMenu.Click += delegate(object sender, EventArgs e) { buildSplitContainer( null, new Control() { BackColor = Color.Red }, p_SolutionExplorer); }; ToolStripItem editMenu = menu.Items.Add("Edit"); ToolStripItem buildMenu = menu.Items.Add("Build"); ToolStripItem helpMenu = menu.Items.Add("Help"); menu.Items.Add(new ToolStripSeparator()); ToolStripItem run = menu.Items.Add(Icons.GetBitmap("tools.run", 16)); run.ToolTipText = "Run"; /*Test code*/ Solution solution = new Solution("./testsolution/solution.ossln"); //initialize the components p_SolutionExplorer = new SolutionBrowserControl(); p_TextEditor = new TextEditor(); p_SolutionExplorer.AddSolution(solution); //create the components to seperate the different working area //components. buildSplitContainer(null, null, p_SolutionExplorer); }