Beispiel #1
0
        //private void control_TextChanged(object sender, EventArgs e)
        //{
        //}

        private void dockControl_Closing(object sender, CancelEventArgs e)
        {
            TD.SandDock.DockControl      dockControl = (TD.SandDock.DockControl)sender;
            System.Windows.Forms.Control control     = dockControl.Controls[0];
            if (control is bamboo.Controls.Editor.EditorControl)
            {
                bamboo.Controls.Editor.EditorControl editor = (bamboo.Controls.Editor.EditorControl)control;
                if (!editor.Close())
                {
                    e.Cancel = true;
                    return;
                }
            }
            else if (control is bamboo.Controls.ProjectExplorer.ProjectExplorerControl)
            {
                bamboo.Controls.ProjectExplorer.ProjectExplorerControl projectExplorer = (bamboo.Controls.ProjectExplorer.ProjectExplorerControl)control;
                if (!projectExplorer.Close())
                {
                    e.Cancel = true;
                    return;
                }
            }

            dockControl.Closing -= new CancelEventHandler(dockControl_Closing);
//			control.TextChanged -= new EventHandler(control_TextChanged);
        }
Beispiel #2
0
        private void SaveSettings()
        {
            if (Water.Environment.IsConstant("Window.CloseAllDocuments"))
            {
                Water.Evaluator.Apply("Window.CloseAllDocuments");
            }



            Water.Dictionary Settings = (Water.Dictionary)Water.Environment.Identify("Settings");

            Settings["WindowState"] = this.WindowState.ToString();
            if (this.WindowState == System.Windows.Forms.FormWindowState.Normal)
            {
                Settings["Left"]   = this.Left;
                Settings["Top"]    = this.Top;
                Settings["Width"]  = this.Width;
                Settings["Height"] = this.Height;
            }



            Water.List commands = new Water.List();
            Settings["Commands"] = commands;

            bool showStartPage = true;

            foreach (TD.SandDock.DockControl dockControl in this.documentContainer.Controls)
            {
                if (dockControl.Controls[0] is bamboo.Controls.Editor.EditorControl)
                {
                    bamboo.Controls.Editor.EditorControl editorControl = (bamboo.Controls.Editor.EditorControl)dockControl.Controls[0];

                    Water.List command = new Water.List();
                    command.Add(new Water.Identifier("File.Open"));
                    command.Add(editorControl.Filename);
                    commands.Add(command);
                    showStartPage = false;
                }
                else if (dockControl.Controls[0] is bamboo.Controls.AssemblyExplorer.AssemblyExplorerControl)
                {
                    bamboo.Controls.AssemblyExplorer.AssemblyExplorerControl assemblyExplorerControl = (bamboo.Controls.AssemblyExplorer.AssemblyExplorerControl)dockControl.Controls[0];

                    Water.List command = new Water.List();
                    command.Add(new Water.Identifier("File.Open"));
                    command.Add(assemblyExplorerControl.Filename);
                    commands.Add(command);
                    showStartPage = false;
                }
                else
                {
                    string tag = (string)dockControl.Controls[0].Tag;
                    if (tag != null)
                    {
                        Water.List command = new Water.List();
                        command.Add(new Water.Identifier(tag));
                        command.Add("Document");
                        commands.Add(command);
                        showStartPage = false;
                    }
                }
            }
            if (showStartPage)
            {
                Water.List command = new Water.List();
                command.Add(new Water.Identifier("View.StartPage"));
                commands.Add(command);
            }

            if (this.leftDockContainer.LayoutSystem.LayoutSystems.Count != 0)
            {
                TD.SandDock.ControlLayoutSystem controlLayoutSystem = (TD.SandDock.ControlLayoutSystem) this.leftDockContainer.LayoutSystem.LayoutSystems[0];
                foreach (TD.SandDock.DockControl dockControl in controlLayoutSystem.Controls)
                {
                    string tag = (string)dockControl.Controls[0].Tag;
                    if (tag != null)
                    {
                        Water.List command = new Water.List();
                        command.Add(new Water.Identifier(tag));
                        command.Add("Left");
                        commands.Add(command);
                    }
                }
            }

            if (this.bottomDockContainer.LayoutSystem.LayoutSystems.Count != 0)
            {
                TD.SandDock.ControlLayoutSystem controlLayoutSystem = (TD.SandDock.ControlLayoutSystem) this.bottomDockContainer.LayoutSystem.LayoutSystems[0];
                foreach (TD.SandDock.DockControl dockControl in controlLayoutSystem.Controls)
                {
                    string tag = (string)dockControl.Controls[0].Tag;
                    if (tag != null)
                    {
                        Water.List command = new Water.List();
                        command.Add(new Water.Identifier(tag));
                        command.Add("Bottom");
                        commands.Add(command);
                    }
                }
            }

            if (this.rightDockContainer.LayoutSystem.LayoutSystems.Count != 0)
            {
                TD.SandDock.ControlLayoutSystem controlLayoutSystem = (TD.SandDock.ControlLayoutSystem) this.rightDockContainer.LayoutSystem.LayoutSystems[0];
                foreach (TD.SandDock.DockControl dockControl in controlLayoutSystem.Controls)
                {
                    string tag = (string)dockControl.Controls[0].Tag;
                    if (tag != null)
                    {
                        Water.List command = new Water.List();
                        command.Add(new Water.Identifier(tag));
                        command.Add("Right");
                        commands.Add(command);
                    }
                }
            }
        }
Beispiel #3
0
        private void Application_Idle(object sender, EventArgs e)
        {
            foreach (System.Windows.Forms.ToolStripMenuItem menu in this.menuStrip.Items)
            {
                foreach (System.Windows.Forms.ToolStripItem menuItem in menu.DropDownItems)
                {
                    if (menuItem.Tag != null)
                    {
                        string command = (string)menuItem.Tag;
                        menuItem.Enabled = Water.Environment.IsConstant(command);
                    }
                }
            }
            foreach (System.Windows.Forms.ToolStripItem toolButton in this.toolStrip.Items)
            {
                if (toolButton.Tag != null)
                {
                    string command = (string)toolButton.Tag;
                    toolButton.Enabled = Water.Environment.IsConstant(command);
                }
            }



            string title = "";

            TD.SandDock.DockControl dockControl;
            bamboo.Controls.ProjectExplorer.ProjectExplorerControl projectExplorer = null;
            bamboo.Controls.Editor.EditorControl editorControl = null;

            dockControl = FindWindow("View.ProjectExplorer");
            if (dockControl != null)
            {
                projectExplorer = (bamboo.Controls.ProjectExplorer.ProjectExplorerControl)dockControl.Controls[0];
                if (projectExplorer.ProjectName != null && projectExplorer.ProjectName != "")
                {
                    title += projectExplorer.ProjectName;
                }
            }

            dockControl = this.ActiveDocument;
            if (dockControl != null && dockControl.Controls[0] is bamboo.Controls.Editor.EditorControl)
            {
                editorControl = (bamboo.Controls.Editor.EditorControl)dockControl.Controls[0];
                if (title.Length > 0)
                {
                    title += ", ";
                }
                title += editorControl.Text;
            }

            string text = "Bamboo";

            if (title.Length > 0)
            {
                text += " - " + title;
            }

            if (this.Text != text)
            {
                this.Text = text;
            }
        }