// Reviewed . To be changed after next version. private void toolBox_ItemClicked(object sender, NETXP.Controls.Bars.ItemClickedEventArgs e) { try { SyntaxEdit syntaxEdit=tabNode.TabControl.SelectedTab.Control as SyntaxEdit; syntaxEdit.Source.NewLine(); syntaxEdit.Source.Insert(" "+e.Item.Caption+"("); syntaxEdit.Focus(); syntaxEdit.ParameterInfo(); } catch{} }
// Reviewed . To be changed after next version. private void toolBox_GroupClicked(object sender, NETXP.Controls.Bars.GroupClickedEventArgs e) { this.propertyGrid.SelectedObject=ProjectManagerClass.ProjectManager.GetSelectedObject(toolBox.Groups.IndexOf(e.Group)); this.propertiesComboBox.SelectedIndex=toolBox.Groups.IndexOf(e.Group); }
/// <summary> /// Shows the Save file As dialog before saving the file opened by the specified tab page. /// </summary> /// <param name="selectedTabPage"> /// Tabpage selected. /// </param> private void SaveFileAs(NETXP.Controls.Docking.TabPage selectedTabPage) { if(tabbedGroups.RootSequence.Count != 0) { SyntaxEdit syntaxEdit=selectedTabPage.Control as SyntaxEdit; string currentFileName=syntaxEdit.Source.FileName; string saveFilter=""; string fileExtension=Path.GetExtension(syntaxEdit.Source.FileName); if(fileExtension.Equals(".c")) saveFilter="C Files (*.c)|*.c|"; else if(fileExtension.Equals(".h")) saveFilter="Header Files (*.h)|*.h|"; else if(fileExtension.Equals(".txt")) saveFilter="Text Files (*.txt)|*.txt|"; saveDialog.Filter=saveFilter+"All Files (*.*)|*.*"; saveDialog.Title="Save "+Path.GetFileName(syntaxEdit.Source.FileName)+" As"; if(saveDialog.ShowDialog()==DialogResult.OK) { if(System.IO.File.Exists(saveDialog.FileName)) if((((byte)System.IO.File.GetAttributes(saveDialog.FileName))&7)>0) { MessageBox.Show("Cannot overwrite a system , hidden or read-only file !","MegaIDE",MessageBoxButtons.OK,MessageBoxIcon.Hand); return; } if(syntaxEdit.Source.FileName != saveDialog.FileName) { RecentDocuments.AddToRecentFiles(saveDialog.FileName); UpdateRecentDocumentsList(); } syntaxEdit.Source.SaveFile(saveDialog.FileName); selectedTabPage.Title=Path.GetFileName(saveDialog.FileName); syntaxEdit.Source.FileName=saveDialog.FileName; selectedTabPage.ToolTipText=saveDialog.FileName; selectedTabPage.Tag=false; } } }
private void tabbedGroups_PageCloseRequest(NETXP.Controls.Docking.TabbedGroups tg, NETXP.Controls.Docking.CloseRequestEventArgs e) { if(this.tabbedGroups.RootSequence.Count != 0) { if((bool)tabNode.TabControl.SelectedTab.Tag) { DialogResult response=MessageBox.Show("Save Changes to "+Path.GetFileName(((SyntaxEdit)(tabNode.TabControl.SelectedTab.Control)).Source.FileName)+" ?","MegaIDE",System.Windows.Forms.MessageBoxButtons.YesNoCancel, System.Windows.Forms.MessageBoxIcon.Question); if(response==DialogResult.Yes) this.SaveFile(tabNode.TabControl.SelectedTab); else if(response==DialogResult.Cancel) e.Cancel=true; } } }
/// <summary> /// Saves the file opened by a specified tab page. /// </summary> /// <param name="selectedTabPage"> /// Tabpage selected. /// </param> private void SaveFile(NETXP.Controls.Docking.TabPage selectedTabPage) { try { if((bool)selectedTabPage.Tag) { SyntaxEdit syntaxEdit=selectedTabPage.Control as SyntaxEdit; if(syntaxEdit.Source.ReadOnly) { MessageBox.Show("Cannot overwrite a system , hidden or read-only file !","MegaIDE",MessageBoxButtons.OK,MessageBoxIcon.Hand); return; } syntaxEdit.Source.SaveFile(syntaxEdit.Source.FileName); selectedTabPage.Title=Path.GetFileName(syntaxEdit.Source.FileName); selectedTabPage.Tag=false; } } catch{} }