void btnPreview_Click(object sender, EventArgs e) { ToolStripButton button = (ToolStripButton)sender; FireEditorTabItem tabItem = (FireEditorTabItem)button.Owner.Parent; if (button.Checked == true) { ((ToolStripButton)button.Owner.Items[0]).Checked = false; } if (!tabItem.CodeEditor.Saved) { MessageBox.Show("The file need to be saved before show a preview!"); ((ToolStripButton)button.Owner.Items[0]).Checked = true; ((ToolStripButton)button.Owner.Items[1]).Checked = false; return; } tabItem.Controls["preview"].Visible = true; tabItem.Controls["preview"].BringToFront(); tabItem.Controls["codeeditor"].Visible = false; ((WebBrowser)tabItem.Controls["preview"]).Navigate(tabItem.CodeEditor.FileName); }
string BuildPRG() { _Application.MainForm.OutputWindow.Show(_Application.MainForm.DockContainer, Fireball.Docking.DockState.DockBottom); _Application.MainForm.OutputWindow.Clear(); GemixCompiler compiler = new GemixCompiler(); compiler.OutputReceived += new EventHandler(compiler_OutputReceived); FireEditorTabItem editor = _Application.MainForm.CurrentEditorTabItem; _Application.MainForm.Save(); string prgFile = editor.CodeEditor.FileName; string gmxCompiler = _ConfigDocument.SelectSingleNode("gemix/compiler").InnerText; compiler.Start(gmxCompiler, prgFile); string exeFile = Path.GetFileNameWithoutExtension(prgFile) + ".exe"; return(File.Exists(exeFile) ? exeFile : null); }
void CheckForToolbarState(FireEditorTabItem tabItem) { if (tabItem.CodeEditor.Document.Parser.Language.Name == "PHP") { phpToolBar.Enabled = true; } else { phpToolBar.Enabled = false; } }
void NewMenuItems_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; FireEditorTabItem tabItem = AddDocument(); tabItem.CodeEditor.Document.Text = ""; tabItem.SetSyntaxLanguage((Language)item.Tag); tabItem.Activate(); }
public void OpenFile(string filename) { FireEditorTabItem tabItem = this.AddDocument(); tabItem.Open(filename); AddRecent(filename); SetAllFileNameLabel(); tabItem.Activate(); }
void FireEditorTabItem_LanguageChanged(object sender, LanguageChangedEventArgs e) { if (e.Language != null && e.Language.Name == "HTML") { FireEditorTabItem tabItem = (FireEditorTabItem)sender; ToolStrip myToolStrip = new ToolStrip(); myToolStrip.Name = "switchBar"; myToolStrip.Dock = DockStyle.Bottom; tabItem.Controls.Add(myToolStrip); tabItem.BringToFront(); ToolStripButton btnCode = new ToolStripButton(); btnCode.Checked = true; btnCode.Text = "Html Code"; btnCode.CheckOnClick = true; myToolStrip.Items.Add(btnCode); btnCode.Click += new EventHandler(btnCode_Click); ToolStripButton btnPreview = new ToolStripButton(); btnPreview.Text = "Html Preview"; btnPreview.CheckOnClick = true; myToolStrip.Items.Add(btnPreview); btnPreview.Click += new EventHandler(btnPreview_Click); WebBrowser browser = new WebBrowser(); browser.Name = "preview"; browser.Dock = DockStyle.Fill; browser.Visible = false; tabItem.Controls.Add(browser); } }
void btnCode_Click(object sender, EventArgs e) { ToolStripButton button = (ToolStripButton)sender; FireEditorTabItem tabItem = (FireEditorTabItem)button.Owner.Parent; if (button.Checked == true) { ((ToolStripButton)button.Owner.Items[1]).Checked = false; } tabItem.Controls["preview"].Visible = false; tabItem.Controls["codeeditor"].Visible = true; tabItem.Controls["codeeditor"].BringToFront(); }
void FireEditorTabItem_LanguageChanged(object sender, FireEdit.Docking.LanguageChangedEventArgs e) { FireEditorTabItem tabItem = (FireEditorTabItem)sender; if (e.Language.Name == "PHP") { tabItem.CodeEditor.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CodeEditor_KeyPress); tabItem.CodeEditor.KeyDown += new System.Windows.Forms.KeyEventHandler(CodeEditor_KeyDown); tabItem.CodeEditor.CaretChange += new EventHandler(CodeEditor_CaretChange); tabItem.CodeEditor.InfoTipSelectedIndexChanged += new EventHandler(CodeEditor_InfoTipSelectedIndexChanged); } if (sender is FireEditorTabItem) { this.CheckForToolbarState((FireEditorTabItem)sender); } }
void _DockContainer_ActiveDocumentChanged(object sender, EventArgs e) { this.CheckInsMode(); FireEditDockableWindow tabItem = (FireEditDockableWindow)_DockContainer.ActiveDocument; this.CheckForItemState(); if (tabItem is FireEditorTabItem) { FireEditorTabItem item = (FireEditorTabItem)tabItem; btnSave.Enabled = !item.CodeEditor.Saved; } else { DisableMainToolBarButtons(); } }
void DockContainer_ActiveDocumentChanged(object sender, EventArgs e) { if (_Application.MainForm.DockContainer.ActiveDocument is FireEditorTabItem) { FireEditorTabItem tab = (FireEditorTabItem)_Application.MainForm.DockContainer.ActiveDocument; if (tab.CodeEditor.Document.Parser.Language.Name == "Gemix") { _BuildMenuItem.Enabled = true; } else { _BuildMenuItem.Enabled = false; } } else { _BuildMenuItem.Enabled = false; } }
void tabItem_FormClosing(object sender, FormClosingEventArgs e) { if (sender is FireEditorTabItem) { FireEditorTabItem item = (FireEditorTabItem)sender; if (item.CodeEditor.Saved == false) { DialogResult rt = MessageBox.Show("File unsaved do you want to save it before close?", Application.ProductName, MessageBoxButtons.YesNoCancel); if (rt == DialogResult.Yes) { this.Save(); } else if (rt == DialogResult.Cancel) { e.Cancel = true; } } } }
public FireEditorTabItem AddDocument() { FireEditorTabItem tabItem = new FireEditorTabItem(); tabItem.Show(_DockContainer, DockState.Document); tabItem.Activate(); tabItem.FileSaved += new EventHandler(tabItem_FileSaved); tabItem.FormClosing += new FormClosingEventHandler(tabItem_FormClosing); if (NewCodeEditor != null) { NewCodeEditor(this, new NewCodeEditorEventArgs(ref tabItem)); } tabItem.CodeEditor.TextChanged += new EventHandler(editorControl_TextChanged); return(tabItem); }
internal NewCodeEditorEventArgs(ref FireEditorTabItem tabItem) { _FireEditorTabItem = tabItem; }