{ public static void Save() { TabData Data = TabManager.GetSelectedTabData(); Save(Data); State.RefreshSaves(); }
{ public static void SaveAs() { TabData Data = TabManager.GetSelectedTabData(); SaveFileDialog Dlg = new SaveFileDialog(); Dlg.Title = AppMain.AppName + " - Save As"; Dlg.Filter = "DESolver Files (*.DES) |*.DES| All Files (*.*) |*.*"; Dlg.FileName = Data.Filename; DialogResult Result = Dlg.ShowDialog(); if (Result != DialogResult.OK) { return; } IO_Writer.Write(Dlg.FileName, Data.Box.Text); TabManager.NewFilename(Data.Filename, Dlg.FileName); Data.Box.Modified = false; State.RefreshSaves(); FileTree.This.RefreshTree(); }
public static void Open(String Filename) { String Content = IO_Reader.Read(Filename); TabManager.Add(Filename, Content); State.FilesOpen(); }
public static void Paste() { if (TabManager.HasTabs()) { RichTextBox Box = TabManager.GetBox(); Box.Paste(); } }
public static void Copy() { if (TabManager.HasTabs()) { RichTextBox Box = TabManager.GetBox(); Box.Copy(); } }
public static void RefreshColorHighlighter() { if (TabManager.HasTabs()) { RichTextBox Box = TabManager.GetBox(); ColorHighlighter.Parse(Box); } }
public static void SelectAll() { if (TabManager.HasTabs()) { RichTextBox Box = TabManager.GetBox(); Box.SelectAll(); } }
public PanelRight(Form ParentArg) { Parent = ParentArg; This = this; Dock = DockStyle.Fill; TabManager.Attach(this); }
public static void PrintPreview() { DocumentName = TabManager.GetFilename(); Content = TabManager.GetText(); PrintDoc.DocumentName = DocumentName; Print_HeaderFooter_Manager.Init(); PreviewDlg.ShowDialog(); }
public static void HeaderFooter() { DocumentName = TabManager.GetFilename(); Content = TabManager.GetText(); PrintDoc.DocumentName = DocumentName; Print_HeaderFooter_Dialog Dlg = new Print_HeaderFooter_Dialog(); Dlg.ShowDialog(); }
{ public static void Insert(String Text) { if (TabManager.HasTabs()) { RichTextBox Box = TabManager.GetBox(); /* If text is selected, it is replaced. If * no text is selected, new text is inserted * at the insertion point or caret. */ Box.SelectedText = Text; } }
public static void RefreshSaves() { if (TabManager.SelectedDocHasChanges()) { SelectedDocHasChanges(); } else if (TabManager.SomeDocHasChanges()) { SomeDocHasChanges(); } else { NoDocHasChanges(); } }
public static void Call() { Index++; String Filename = "No Name " + Index.ToString(); String Content = ""; if (GeneralRegistry.GetUseTemplateFile()) { Content = IO_Reader.Read(GeneralRegistry.GetTemplateFile()); } TabManager.Add(Filename, Content); State.FilesOpen(); }
public static void Print() { DocumentName = TabManager.GetFilename(); Content = TabManager.GetText(); PrintDoc.DocumentName = DocumentName; Print_HeaderFooter_Manager.Init(); DialogResult OK = PrintDlg.ShowDialog(); if (OK == DialogResult.OK) { PrintDoc.Print(); } }
{ public static void CloseAll() { ArrayList Datas = TabManager.GetAllTabData(); foreach (TabData Data in Datas) { DialogResult OK = IO_Save.SaveAskIfChanged(Data); if (OK == DialogResult.Cancel) { return; } } TabManager.RemoveAll(); State.NoFilesOpen(); }
{ public static void SaveAll() { ArrayList Datas = TabManager.GetAllTabData(); foreach (TabData Data in Datas) { DialogResult OK = IO_Save.Save(Data); if (OK == DialogResult.Cancel) { State.RefreshSaves(); return; } } State.RefreshSaves(); }
{ public static void Close() { TabData Data = TabManager.GetSelectedTabData(); DialogResult OK = IO_Save.SaveAskIfChanged(Data); if (OK == DialogResult.Cancel) { return; } TabManager.Remove(); if (!TabManager.HasTabs()) { State.NoFilesOpen(); } }
public static void PageSetup() { DocumentName = TabManager.GetFilename(); Content = TabManager.GetText(); PrintDoc.DocumentName = DocumentName; PrintDoc.DefaultPageSettings.Margins = Print_Registry.GetMargins(); PrintDoc.DefaultPageSettings.Landscape = Print_Registry.GetLandscape(); DialogResult OK = SetupDlg.ShowDialog(); if (OK != DialogResult.OK) { return; } Print_Registry.SetMargins(PrintDoc.DefaultPageSettings.Margins); Print_Registry.SetLandscape(PrintDoc.DefaultPageSettings.Landscape); }
public static int Find(String Text, int Index, RichTextBoxFinds Flags) { if (TabManager.HasTabs()) { RichTextBox Box = TabManager.GetBox(); Index = Box.Find(Text, Index, Flags); if (Index != -1) { Box.SelectionStart = Index; Box.SelectionLength = Text.Length; Box.HideSelection = false; } } else { Index = -1; } return(Index); }
private static DialogResult NoName(TabData Data) { String Msg = ""; Msg += "Rename and save this document '"; Msg += Data.Filename; Msg += "'?"; DialogResult OK = MsgBox.YesNoCancel(Msg); if (OK == DialogResult.Cancel) { return(DialogResult.Cancel); } if (OK == DialogResult.Yes) { SaveFileDialog Dlg = new SaveFileDialog(); Dlg.Title = AppMain.AppName + " - Save As"; Dlg.Filter = "DESolver Files (*.DES) |*.DES| All Files (*.*) |*.*"; Dlg.FileName = Data.Filename; DialogResult Result = Dlg.ShowDialog(); if (Result != DialogResult.OK) { return(Result); } BasicSave(Data); TabManager.NewFilename(Data.Filename, Dlg.FileName); return(DialogResult.Yes); } return(DialogResult.No); }
protected override void OnClosing(CancelEventArgs CEA) { base.OnClosing(CEA); FileTree.This.Save(); PanelLeft.Closing(); if (TabManager.HasTabs()) { IO_SaveAll.SaveAll(); } if (Options_Registry.IsChecked) { RegistryManager.DeleteAccount(); return; } if (WindowState == FormWindowState.Normal) { WindowStateManager.SetState((int)FormWindowState.Normal); Rectangle Rect = new Rectangle(); Rect.Width = Size.Width; Rect.Height = Size.Height; Rect.X = Location.X; Rect.Y = Location.Y; WindowLocationManager.SetLocation(Rect); } else if (WindowState == FormWindowState.Maximized) { WindowStateManager.SetState((int)FormWindowState.Maximized); } }
public static void Init() { Filename = TabManager.GetFilename(); TimeStamp = DateTime.Now.ToString(); PageNumber = 0; }
private static void OnPrintPage(object Obj, PrintPageEventArgs EA) { Graphics Grfx = EA.Graphics; Font PrintFont = FontManager.GetPrinting(); Rectangle PrintArea = new Rectangle(); PrintArea = EA.MarginBounds; float FontHeight = PrintFont.GetHeight(Grfx); Print_HeaderFooter_Manager.Refresh(); if (Print_HeaderFooter_Manager.HasHeader()) { Rectangle Rect = new Rectangle(); Rect.X = PrintArea.X; Rect.Y = PrintArea.Y; Rect.Width = PrintArea.Width; Rect.Height = (int)(2 * FontHeight); PrintArea.Y = PrintArea.Y + Rect.Height; PrintArea.Height = PrintArea.Height - Rect.Height; StringFormat StrFmt = new StringFormat(); StrFmt.LineAlignment = StringAlignment.Near; StrFmt.Alignment = StringAlignment.Near; Grfx.DrawString(Print_HeaderFooter_Manager.Get_TopLeft(), PrintFont, Brushes.Black, Rect, StrFmt); StrFmt.Alignment = StringAlignment.Far; Grfx.DrawString(Print_HeaderFooter_Manager.Get_TopRight(), PrintFont, Brushes.Black, Rect, StrFmt); } if (Print_HeaderFooter_Manager.HasFooter()) { Rectangle Rect = new Rectangle(); Rect.Height = (int)(2 * FontHeight); Rect.X = PrintArea.X; Rect.Y = PrintArea.Bottom - Rect.Height; Rect.Width = PrintArea.Width; PrintArea.Height = PrintArea.Height - Rect.Height; StringFormat StrFmt = new StringFormat(); StrFmt.LineAlignment = StringAlignment.Far; StrFmt.Alignment = StringAlignment.Near; Grfx.DrawString(Print_HeaderFooter_Manager.Get_BottomLeft(), PrintFont, Brushes.Black, Rect, StrFmt); StrFmt.Alignment = StringAlignment.Far; Grfx.DrawString(Print_HeaderFooter_Manager.Get_BottomRight(), PrintFont, Brushes.Black, Rect, StrFmt); } int TotalLines = (int)Math.Floor(PrintArea.Height / FontHeight); PrintArea.Height = (int)(TotalLines * FontHeight); StringFormat PageFmt = new StringFormat(); PageFmt.Trimming = StringTrimming.EllipsisCharacter; PageFmt.FormatFlags |= StringFormatFlags.NoWrap; int Chars; int Lines; Grfx.MeasureString(Content, PrintFont, PrintArea.Size, PageFmt, out Chars, out Lines); Grfx.DrawString(Content, PrintFont, Brushes.Black, PrintArea, PageFmt); Content = Content.Substring(Chars); if (Content.Length == 0) { Content = TabManager.GetText(); } else { EA.HasMorePages = true; } }