internal static void CheckAnnotationWordWrap(Form1 form, ToolStripMenuItem wordWrapToolStripMenuItem) { CustomPanel annotationPanel = ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage); if (annotationPanel == null) { return; } CustomRichTextBoxBase annotationTextBox = (CustomRichTextBoxBase)annotationPanel.Controls["annotationTextBox"]; wordWrapToolStripMenuItem.Checked = !wordWrapToolStripMenuItem.Checked; annotationTextBox.WordWrap = wordWrapToolStripMenuItem.Checked; }
private static void CloseAnnotationPanel(Form1 form, bool suppressMessage = false) { ToolStripMenuItem annotationPanelToolStripMenuItem = form.annotationPanelToolStripMenuItem; XtraTabControl pagesTabControl = form.pagesTabControl; CustomPanel annotationPanel = ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage); if (annotationPanel != null) { CustomRichTextBoxBase annotationTextBox = (CustomRichTextBoxBase)annotationPanel.Controls["annotationTextBox"]; if (!String.IsNullOrEmpty(annotationTextBox.Text) && !suppressMessage) { if (WindowManager.ShowQuestionBox(form, LanguageUtil.GetCurrentLanguageString("WarningAnnotationPanelClose", className)) == DialogResult.No) { return; } } pagesTabControl.SelectedTabPage.Controls.Remove(annotationPanel); } ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage).Focus(); annotationPanelToolStripMenuItem.Checked = false; }
private static bool ClosePage(Form1 form, bool showMessages, bool moreTabs, out bool closeAll) { XtraTabControl pagesTabControl = form.pagesTabControl; closeAll = false; if (showMessages && TabUtil.IsTabPageModified(pagesTabControl.SelectedTabPage)) { if (moreTabs) { DialogResult dialogResult = WindowManager.ShowQuestionCancelNoAllBox(form, LanguageUtil.GetCurrentLanguageString("SaveUntitled", className)); if ((dialogResult == DialogResult.Cancel) || (dialogResult == DialogResult.Yes && !FileManager.SaveFile(form, false))) { return(false); } if (dialogResult == DialogResult.Retry) { closeAll = true; } } else { DialogResult dialogResult = WindowManager.ShowQuestionCancelBox(form, LanguageUtil.GetCurrentLanguageString("SaveUntitled", className)); if ((dialogResult == DialogResult.Cancel) || (dialogResult == DialogResult.Yes && !FileManager.SaveFile(form, false))) { return(false); } } } else if (!showMessages) { closeAll = true; } CustomPanel sectionsPanel = ProgramUtil.GetSectionsPanel(pagesTabControl.SelectedTabPage); CustomPanel annotationPanel = ProgramUtil.GetAnnotationPanel(pagesTabControl.SelectedTabPage); if (sectionsPanel != null) { pagesTabControl.SelectedTabPage.Controls.Remove(sectionsPanel); } if (annotationPanel != null) { pagesTabControl.SelectedTabPage.Controls.Remove(annotationPanel); } if (pagesTabControl.TabPages.Count > 1) { String selectedTabName = pagesTabControl.SelectedTabPage.Name; int selectedTabIndex = pagesTabControl.SelectedTabPageIndex; pagesTabControl.TabPages.Remove(pagesTabControl.SelectedTabPage); ExplorerManager.RemoveNodeToTabExplorer(form, selectedTabName); pagesTabControl.SelectedTabPage = selectedTabIndex < pagesTabControl.TabPages.Count ? pagesTabControl.TabPages[selectedTabIndex] : pagesTabControl.TabPages[pagesTabControl.TabPages.Count - 1]; if (String.IsNullOrEmpty(ProgramUtil.GetFilenameTabPage(pagesTabControl.SelectedTabPage))) { ToggleTabFileTools(form, false); } OtherManager.FocusOnEditor(form); } else { ResetTab(form); } return(true); }
internal static void SetAnnotationPanelText(Form1 form, String text) { ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage).Controls["annotationTextBox"].Text = text; }
internal static String GetAnnotationPanelText(Form1 form) { return(ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage).Controls["annotationTextBox"].Text); }
internal static void ResumeAnnotationPanel(Form1 form) { ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage).Width = annotationPanelWidth; }
private static void OpenAnnotationPanel(Form1 form) { ToolStripMenuItem annotationPanelToolStripMenuItem = form.annotationPanelToolStripMenuItem; XtraTabControl pagesTabControl = form.pagesTabControl; XtraTabPage selectedTabPage = pagesTabControl.SelectedTabPage; CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage); CustomPanel annotationPanelStart = ProgramUtil.GetAnnotationPanel(selectedTabPage); if (annotationPanelStart != null) { selectedTabPage.Controls.Remove(annotationPanelStart); } //ContextMenuStrip ToolStripMenuItem undoToolStripMenuItem = new ToolStripMenuItem { Enabled = false, Name = "undoToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("UndoPanel", className) }; ToolStripSeparator toolStripSeparator0 = new ToolStripSeparator { Name = "toolStripSeparator0" }; ToolStripMenuItem cutToolStripMenuItem = new ToolStripMenuItem { Image = ToolbarResource.cut, Name = "cutToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("CutPanel", className) }; ToolStripMenuItem copyToolStripMenuItem = new ToolStripMenuItem { Image = ToolbarResource.copy, Name = "copyToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("CopyPanel", className) }; ToolStripMenuItem pasteToolStripMenuItem = new ToolStripMenuItem { Image = ToolbarResource.paste, Name = "pasteToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("PastePanel", className) }; ToolStripMenuItem deleteToolStripMenuItem = new ToolStripMenuItem { Name = "deleteToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("DeletePanel", className) }; ToolStripSeparator toolStripSeparator1 = new ToolStripSeparator { Name = "toolStripSeparator1" }; ToolStripMenuItem selectAllToolStripMenuItem = new ToolStripMenuItem { Name = "selectAllToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("SelectAllPanel", className) }; ToolStripMenuItem wordWrapToolStripMenuItem = new ToolStripMenuItem { Checked = true, Name = "wordWrapToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("WordWrapPanel", className) }; ToolStripSeparator toolStripSeparator2 = new ToolStripSeparator { Name = "toolStripSeparator2" }; ToolStripMenuItem closeToolStripMenuItem = new ToolStripMenuItem { Image = ToolbarResource.minus, Name = "closeToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("ClosePanel", className) }; ToolStripMenuItem helpToolStripMenuItem = new ToolStripMenuItem { Image = ToolbarResource.question_blue, Name = "helpToolStripMenuItem", ShowShortcutKeys = false, Text = LanguageUtil.GetCurrentLanguageString("HelpPanel", className) }; undoToolStripMenuItem.Click += CustomEvents.undoToolStripMenuItem_Click; cutToolStripMenuItem.Click += CustomEvents.cutToolStripMenuItem_Click; copyToolStripMenuItem.Click += CustomEvents.copyToolStripMenuItem_Click; pasteToolStripMenuItem.Click += CustomEvents.pasteToolStripMenuItem_Click; deleteToolStripMenuItem.Click += CustomEvents.deleteToolStripMenuItem_Click; selectAllToolStripMenuItem.Click += CustomEvents.selectAllToolStripMenuItem_Click; wordWrapToolStripMenuItem.Click += form.wordWrapAnnotationToolStripMenuItem_Click; closeToolStripMenuItem.Click += form.annotationPanelToolStripMenuItem_Click; helpToolStripMenuItem.Click += form.helpAnnotationPanelToolStripMenuItem_Click; ToolStripRenderMode rendererMode = ConfigUtil.GetIntParameter("LookAndFeel") == 0 ? ToolStripRenderMode.ManagerRenderMode : ToolStripRenderMode.System; ContextMenuStrip annotationContextMenuStrip = new ContextMenuStrip { RenderMode = rendererMode }; annotationContextMenuStrip.Items.AddRange(new ToolStripItem[] { undoToolStripMenuItem, toolStripSeparator0, cutToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, deleteToolStripMenuItem, toolStripSeparator1, selectAllToolStripMenuItem, wordWrapToolStripMenuItem, toolStripSeparator2, closeToolStripMenuItem, helpToolStripMenuItem }); annotationContextMenuStrip.Opening += CustomEvents.annotationContextMenuStrip_Opening; //Panel CustomPanel annotationPanel = new CustomPanel { Dock = DockStyle.Right, Height = selectedTabPage.Height, Name = "annotationPanel", Width = annotationPanelWidth }; CustomRichTextBoxBase annotationTextBox = new CustomRichTextBoxBase { AutoWordSelection = false, BackColor = pageTextBox.BackColor, BorderStyle = BorderStyle.None, ContextMenuStrip = annotationContextMenuStrip, DetectUrls = false, Dock = DockStyle.Right, Font = pageTextBox.Font, ForeColor = pageTextBox.ForeColor, Height = selectedTabPage.Height, Multiline = true, Name = "annotationTextBox", WordWrap = true, Width = annotationPanelWidth - 6 }; annotationTextBox.KeyDown += CustomEvents.annotationTextBox_KeyDown; annotationPanel.Controls.Add(annotationTextBox); selectedTabPage.Controls.Add(annotationPanel); annotationPanelToolStripMenuItem.Checked = true; annotationTextBox.Focus(); }
internal static bool IsAnnotationPanelOpen(Form1 form) { return(ProgramUtil.GetAnnotationPanel(form.pagesTabControl.SelectedTabPage) != null); }