示例#1
0
        public void requestCloseFile( )
        {
            FileTabPage ftp = SelectedFileTab;

            if (ftp == null)
            {
                return;
            }
            if (ftp.scintillaControl.IsModified)
            {
                if (MessageBox.Show("The file has been modified. Do you wish to save it?", "Save File", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    ftp.save();
                }
            }

            container.Controls.Remove(ftp);
            ftp.scintillaControl.Dispose();
            ftp.scintillaControl = null;
            ftp.Dispose();
            if (SelectedFileTab != null)
            {
                SelectedFileTab.Focus();
            }
            else
            {
                container.Focus();
            }
        }
示例#2
0
        public void addFile(String filename)
        {
            //either a full-path or a relative path.
            FileTabPage tabPage = new FileTabPage(makeFullPath(filename), this);

            tabPage.SuspendLayout();

            container.Controls.AddRange(new System.Windows.Forms.Control[] { tabPage });

            tabPage.Location = new System.Drawing.Point(0, 0);
            tabPage.Text     = "Untitled";
            tabPage.Size     = container.Size;
            tabPage.TabIndex = 0;

            tabPages.Add(tabPage);

            tabPage.ResumeLayout(false);
            tabPage.fullpath = makeFullPath(filename);
            tabPage.Init();
            if (config != null)
            {
                config.ApplyConfiguration(tabPage.scintillaControl, "javascript");
            }
            container.SelectedTab = tabPage;

            if (SelectedFileTab != null)
            {
                SelectedFileTab.Focus();
            }
            else
            {
                container.Focus();
            }
        }