Esempio n. 1
0
        internal static void FontPages(Form1 form)
        {
            XtraTabControl pagesTabControl = form.pagesTabControl;

            DialogResult dialogResult = WindowManager.ShowFontSelect(form);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }

            foreach (XtraTabPage tabPage in pagesTabControl.TabPages)
            {
                CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(tabPage);

                pageTextBox.Font      = form.TextFont;
                pageTextBox.ForeColor = form.TextFontColor;
                ProgramUtil.GetCustomLineNumbers(tabPage).Font = form.TextFont;
            }

            TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font));

            ConfigUtil.UpdateParameter("FontInUse", tc.ConvertToString(form.TextFont));
            ConfigUtil.UpdateParameter("FontInUseColorARGB", FontManager.SetARGBString(form.TextFontColor));
        }
Esempio n. 2
0
        internal static void CheckLineNumbers(Form1 form, bool checkStatus, bool refreshConfig)
        {
            XtraTabControl    pagesTabControl = form.pagesTabControl;
            ToolStripMenuItem lineNumbersToolStripMenuItem = form.lineNumbersToolStripMenuItem;
            ToolStripButton   lineNumbersToolStripButton   = form.lineNumbersToolStripButton;

            foreach (XtraTabPage tabPage in pagesTabControl.TabPages)
            {
                CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(tabPage);
                customLineNumbers.Visible = checkStatus;

                ColumnRulerManager.UpdatePanelAppearance(tabPage, checkStatus);

                if (!checkStatus)
                {
                    continue;
                }

                customLineNumbers.Size = new Size(customLineNumbers.Size.Width + 1, customLineNumbers.Size.Height);
                customLineNumbers.Size = new Size(customLineNumbers.Size.Width - 1, customLineNumbers.Size.Height);
            }

            lineNumbersToolStripMenuItem.Checked = checkStatus;
            lineNumbersToolStripButton.Checked   = checkStatus;

            UpdateConfigParameter("LineNumbersVisible", checkStatus.ToString(), refreshConfig);
        }
Esempio n. 3
0
        private static void NoteModeOff(Form1 form)
        {
            MenuStrip           menuStrip               = form.menuStrip;
            ToolStrip           toolStrip               = form.toolStrip;
            XtraTabControl      pagesTabControl         = form.pagesTabControl;
            SplitContainer      verticalSplitContainer  = form.verticalSplitContainer;
            ToolStrip           sessionToolStrip        = form.sessionToolStrip;
            Panel               searchReplacePanel      = form.searchReplacePanel;
            StatusStrip         statusStrip             = form.statusStrip;
            PictureBox          zoomPictureBox          = form.zoomPictureBox;
            ZoomTrackBarControl zoomTrackBarControl     = form.zoomTrackBarControl;
            ToolStripMenuItem   closeToolStripMenuItem3 = form.closeToolStripMenuItem3;

            if (ConfigUtil.GetBoolParameter("NoteModeTabs"))
            {
                pagesTabControl.CustomHeaderButtons.AddRange(new[] { new CustomHeaderButton(ButtonPredefines.Ellipsis) });
            }

            menuStrip.Visible                     = true;
            toolStrip.Visible                     = !ConfigUtil.GetBoolParameter("ToolbarInvisible");
            pagesTabControl.ShowTabHeader         = DefaultBoolean.True;
            pagesTabControl.ContextMenuStrip      = form.pageContextMenuStrip;
            verticalSplitContainer.Panel1.Padding = new Padding(3, 0, 3, 0);
            sessionToolStrip.Visible              = closeToolStripMenuItem3.Enabled;
            searchReplacePanel.Visible            = !ConfigUtil.GetBoolParameter("SearchReplacePanelDisabled");
            statusStrip.Visible                   = !ConfigUtil.GetBoolParameter("StatusBarInvisible");
            zoomPictureBox.Visible                = true;
            zoomTrackBarControl.Visible           = true;
            form.TopMost         = !ConfigUtil.GetBoolParameter("StayOnTopDisabled");
            form.FormBorderStyle = FormBorderStyle.Sizable;

            #if Debug
            form.TopMost = false;
            #endif

            for (int i = 0; i < pagesTabControl.TabPages.Count; i++)
            {
                CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(pagesTabControl.TabPages[i]);
                CustomRichTextBox pageTextBox       = ProgramUtil.GetPageTextBox(pagesTabControl.TabPages[i]);

                customLineNumbers.Visible = ConfigUtil.GetBoolParameter("LineNumbersVisible");
                pageTextBox.WordWrap      = !ConfigUtil.GetBoolParameter("WordWrapDisabled");
            }

            if (CustomFilesManager.IsAnnotationPanelOpen(form))
            {
                CustomFilesManager.ResumeAnnotationPanel(form);
            }

            form.WindowState = ConfigUtil.GetStringParameter("WindowState") == "Maximized" ? FormWindowState.Maximized : FormWindowState.Normal;
            form.Size        = new Size(ConfigUtil.GetIntParameter("WindowSizeX"), ConfigUtil.GetIntParameter("WindowSizeY"));
            verticalSplitContainer.Panel2Collapsed = ConfigUtil.GetBoolParameter("InternalExplorerInvisible");
        }
Esempio n. 4
0
        internal static void CheckWordWrap(Form1 form, bool checkStatus, bool refreshConfig)
        {
            ToolStripMenuItem wordWrapToolStripMenuItem = form.wordWrapToolStripMenuItem;
            ToolStripButton   wordWrapToolStripButton   = form.wordWrapToolStripButton;
            XtraTabControl    pagesTabControl           = form.pagesTabControl;

            wordWrapToolStripMenuItem.Checked = !checkStatus;
            wordWrapToolStripButton.Checked   = !checkStatus;
            UpdateConfigParameter("WordWrapDisabled", checkStatus.ToString(), refreshConfig);

            foreach (XtraTabPage tabPage in pagesTabControl.TabPages)
            {
                CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(tabPage);
                pageTextBox.WordWrap = !checkStatus;
            }

            ProgramUtil.GetCustomLineNumbers(pagesTabControl.SelectedTabPage).Refresh();
        }
Esempio n. 5
0
        internal static void RestoreFormFromTray(Form1 form, FormWindowState previousWindowState)
        {
            NotifyIcon        notifyIcon        = form.notifyIcon;
            XtraTabControl    pagesTabControl   = form.pagesTabControl;
            CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(pagesTabControl.SelectedTabPage);

            if (form.Visible)
            {
                return;
            }

            form.Visible       = true;
            notifyIcon.Visible = false;
            form.WindowState   = previousWindowState;

            customLineNumbers.Refresh();

            form.BringToFront();
        }
Esempio n. 6
0
        internal static void UpdatePanelAppearance(XtraTabPage tabPage, bool customLineNumbersVisible)
        {
            CustomRichTextBox pageTextBox       = ProgramUtil.GetPageTextBox(tabPage);
            CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(tabPage);
            CustomPanel       columnRulerPanel  = (CustomPanel)tabPage.Controls["columnRulerPanel"];

            if (columnRulerPanel == null)
            {
                return;
            }

            pageTextBox.Size = new Size(pageTextBox.Size.Width + 1, pageTextBox.Size.Height);
            pageTextBox.Size = new Size(pageTextBox.Size.Width - 1, pageTextBox.Size.Height);
            RichTextBox columnRulerTextBox = (RichTextBox)columnRulerPanel.Controls["columnRulerTextBox"];

            columnRulerTextBox.Width = pageTextBox.Width + 1;
            columnRulerTextBox.Left  = customLineNumbersVisible ? customLineNumbers.Width : 0;
            //columnRulerPanel.MarginLeftHorizontalLine = tabPage.Width - columnRulerTextBox.Width - 5;
            columnRulerPanel.MarginLeftHorizontalLine = columnRulerTextBox.Left;
            columnRulerPanel.Refresh();
        }
Esempio n. 7
0
        internal static void ResetTab(Form1 form)
        {
            XtraTabControl    pagesTabControl   = form.pagesTabControl;
            CustomRichTextBox pageTextBox       = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage);
            CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(pagesTabControl.SelectedTabPage);

            if (ColumnRulerManager.IsPanelOpen(form))
            {
                ColumnRulerManager.TogglePanel(form);
            }

            String newTabTitle = LanguageUtil.GetCurrentLanguageString("tabPage1", form.Name);

            SetTabColor(pagesTabControl.SelectedTabPage, Color.Black); //pagesTabControl.SelectedTabPage.Appearance.Header.ForeColor = Color.Black;
            pagesTabControl.SelectedTabPage.Appearance.Header.Reset();
            pageTextBox.Text = String.Empty;
            pagesTabControl.SelectedTabPage.ImageIndex = 0;
            pagesTabControl.SelectedTabPage.Text       = newTabTitle;
            pagesTabControl.SelectedTabPage.Tooltip    = newTabTitle;
            form.Text = String.Format("DtPad - {0}", newTabTitle);
            ProgramUtil.SetFilenameTabPage(pagesTabControl.SelectedTabPage, String.Empty);
            pageTextBox.CustomZoom           = 100;
            pageTextBox.CustomModified       = false;
            pageTextBox.CustomOriginal       = String.Empty.GetHashCode().ToString();
            pageTextBox.CustomEncoding       = String.Empty;
            pageTextBox.CustomEncodingForced = false;
            customLineNumbers.Width          = customLineNumbers.MinimumSize.Width;
            ZoomSelect(form, 100);
            pageTextBox.ClearUndo();

            TextManager.RefreshUndoRedoExternal(form);

            if (String.IsNullOrEmpty(ProgramUtil.GetFilenameTabPage(pagesTabControl.SelectedTabPage)))
            {
                ToggleTabFileTools(form, false);
            }
            OtherManager.FocusOnEditor(form);
        }
Esempio n. 8
0
        private static void NoteModeOn(Form1 form)
        {
            MenuStrip           menuStrip              = form.menuStrip;
            ToolStrip           toolStrip              = form.toolStrip;
            XtraTabControl      pagesTabControl        = form.pagesTabControl;
            SplitContainer      verticalSplitContainer = form.verticalSplitContainer;
            ToolStrip           sessionToolStrip       = form.sessionToolStrip;
            Panel               searchReplacePanel     = form.searchReplacePanel;
            StatusStrip         statusStrip            = form.statusStrip;
            PictureBox          zoomPictureBox         = form.zoomPictureBox;
            ZoomTrackBarControl zoomTrackBarControl    = form.zoomTrackBarControl;

            if (ConfigUtil.GetBoolParameter("NoteModeTabs"))
            {
                ContextMenuStrip smallPageContextMenuStrip = new ContextMenuStrip();
                for (int i = 0; i < 2; i++)
                {
                    smallPageContextMenuStrip.Items.Add(
                        ((CustomToolStripMenuItem)form.pageContextMenuStrip.Items[i]).Clone());
                }
                pagesTabControl.ContextMenuStrip = smallPageContextMenuStrip;
                pagesTabControl.CustomHeaderButtons.Clear();
            }
            else
            {
                pagesTabControl.ContextMenuStrip = null;
                pagesTabControl.ShowTabHeader    = DefaultBoolean.False;
            }

            menuStrip.Visible = false;
            toolStrip.Visible = false;
            verticalSplitContainer.Panel1.Padding  = new Padding(0, 0, 0, 0);
            verticalSplitContainer.Panel2Collapsed = true;
            sessionToolStrip.Visible    = false;
            searchReplacePanel.Visible  = false;
            statusStrip.Visible         = false;
            zoomPictureBox.Visible      = false;
            zoomTrackBarControl.Visible = false;
            form.TopMost         = true;
            form.FormBorderStyle = FormBorderStyle.SizableToolWindow;

            #if Debug
            form.TopMost = false;
            #endif

            for (int i = 0; i < pagesTabControl.TabPages.Count; i++)
            {
                CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(pagesTabControl.TabPages[i]);
                CustomRichTextBox pageTextBox       = ProgramUtil.GetPageTextBox(pagesTabControl.TabPages[i]);

                if (ColumnRulerManager.IsPanelOpen(pagesTabControl.TabPages[i]))
                {
                    ColumnRulerManager.ClosePanel(pagesTabControl.TabPages[i]);
                }

                customLineNumbers.Visible = false;
                pageTextBox.WordWrap      = true;
            }

            form.WindowState = FormWindowState.Normal;
            form.Size        = new Size(ConfigUtil.GetIntParameter("NoteModeSizeX"), ConfigUtil.GetIntParameter("NoteModeSizeY"));
            if (CustomFilesManager.IsHostsSectionPanelOpen(form))
            {
                form.Width += ConstantUtil.hostsPanelWidth; //ProgramUtil.GetSectionsPanel(pagesTabControl.SelectedTabPage).Width;
            }
            if (CustomFilesManager.IsAnnotationPanelOpen(form))
            {
                CustomFilesManager.HideAnnotationPanel(form);
            }
        }
Esempio n. 9
0
        private static void OpenPanel(Form1 form, XtraTabPage tabPage)
        {
            CustomRichTextBox pageTextBox       = ProgramUtil.GetPageTextBox(tabPage);
            CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(tabPage);

            bool wasHostsSectionOpen = false;

            if (CustomFilesManager.IsHostsSectionPanelOpen(form))
            {
                wasHostsSectionOpen = true;
                CustomFilesManager.ToggleHostsSectionPanel(form, true);
            }
            String annotationText = String.Empty;

            if (CustomFilesManager.IsAnnotationPanelOpen(form))
            {
                annotationText = CustomFilesManager.GetAnnotationPanelText(form);
                CustomFilesManager.ToggleAnnotationPanel(form, true);
            }

            int left = 0;

            if (ConfigUtil.GetBoolParameter("LineNumbersVisible"))
            {
                left = customLineNumbers.Width;
            }

            //Panel
            RichTextBox columnRulerTextBox = new RichTextBox
            {
                Anchor      = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left,
                BackColor   = pageTextBox.BackColor,
                BorderStyle = BorderStyle.None,
                Font        = pageTextBox.Font,
                //ForeColor = pageTextBox.ForeColor,
                ForeColor        = SystemColors.AppWorkspace,
                Height           = Convert.ToInt32(pageTextBox.Font.GetHeight() * 2 + 5),                            //35
                Left             = left,
                Multiline        = true,
                Name             = "columnRulerTextBox",
                ReadOnly         = true,
                ScrollBars       = RichTextBoxScrollBars.None,
                ShortcutsEnabled = false,
                Text             = ConstantUtil.columnsHeader,
                Width            = pageTextBox.Width + 1,
                WordWrap         = false
            };
            CustomPanel columnRulerPanel = new CustomPanel
            {
                Dock                     = DockStyle.Top,
                Height                   = columnRulerTextBox.Height + 1,
                Name                     = "columnRulerPanel",
                Width                    = tabPage.Width,
                HorizontalLine           = true,
                MarginLeftHorizontalLine = tabPage.Width - columnRulerTextBox.Width - 5
            };

            columnRulerPanel.Controls.Add(columnRulerTextBox);
            tabPage.Controls.Add(columnRulerPanel);

            if (wasHostsSectionOpen)
            {
                CustomFilesManager.ToggleHostsSectionPanel(form, true);
            }
            if (!String.IsNullOrEmpty(annotationText))
            {
                CustomFilesManager.ToggleAnnotationPanel(form);
                CustomFilesManager.SetAnnotationPanelText(form, annotationText);
            }

            pageTextBox.Focus();
        }
Esempio n. 10
0
        internal static void RefreshOwner(Options form, bool closeOptionsAfterSave, Font previousFont, Font font, Color previousFontColor, Color fontColor, Color previousBackgroundColor, Color backgroundColor, bool previousHighlightURL, String previousLanguage, bool previousJumpListActivated)
        {
            Form1 form1 = (Form1)form.Owner;

            XtraTabControl    pagesTabControl             = form1.pagesTabControl;
            CheckBox          caseCheckBox                = form1.searchPanel.caseCheckBox;
            CheckBox          loopCheckBox                = form1.searchPanel.loopCheckBox;
            ToolStrip         sessionToolStrip            = form1.sessionToolStrip;
            ToolStripMenuItem useDefaultToolStripMenuItem = form1.useDefaultToolStripMenuItem;

            CheckBox          showSearchPanelCheckBox    = form.showSearchPanelCheckBox;
            CheckBox          wordWrapCheckBox           = form.wordWrapCheckBox;
            CheckBox          stayOnTopCheckBox          = form.stayOnTopCheckBox;
            CheckBox          toolbarCheckBox            = form.toolbarCheckBox;
            CheckBox          statusBarCheckBox          = form.statusBarCheckBox;
            CheckBox          minimizeOnTrayIconCheckBox = form.minimizeOnTrayIconCheckBox;
            CheckBox          caseSensitiveCheckBox      = form.caseSensitiveCheckBox;
            CheckBox          loopAtEOFCheckBox          = form.loopAtEOFCheckBox;
            CheckBox          urlsCheckBox                      = form.urlsCheckBox;
            ImageComboBoxEdit languageComboBox                  = form.languageComboBox;
            CheckBox          internalExplorerCheckBox          = form.internalExplorerCheckBox;
            ComboBox          tabCloseButtonOnComboBox          = form.tabCloseButtonOnComboBox;
            ComboBox          tabPositionComboBox               = form.tabPositionComboBox;
            ComboBox          tabOrientationComboBox            = form.tabOrientationComboBox;
            CheckBox          tabMultilineCheckBox              = form.tabMultilineCheckBox;
            CheckBox          useExistingCheckBox               = form.useExistingCheckBox;
            ComboBox          defaultComboBox                   = form.defaultComboBox;
            CheckBox          lineNumbersCheckBox               = form.lineNumbersCheckBox;
            CheckBox          keepInitialSpacesOnReturnCheckBox = form.keepInitialSpacesOnReturnCheckBox;
            CheckBox          keepBulletListOnReturnCheckBox    = form.keepBulletListOnReturnCheckBox;
            CheckBox          jumpListCheckBox                  = form.jumpListCheckBox;

            WindowManager.CheckSearchReplacePanel(form1, showSearchPanelCheckBox.Checked, true); //form1.searchPanel.Visible
            WindowManager.CheckWordWrap(form1, !wordWrapCheckBox.Checked, false);

            if (form1.WindowMode == CustomForm.WindowModeEnum.Fullscreen)
            {
                WindowManager.CheckStayOnTop(form1, !stayOnTopCheckBox.Checked, false);
            }
            WindowManager.CheckToolbar(form1, !toolbarCheckBox.Checked, true, false);
            WindowManager.CheckStatusBar(form1, !statusBarCheckBox.Checked, true, false);
            WindowManager.CheckTrayIcon(form1, !minimizeOnTrayIconCheckBox.Checked, false);
            WindowManager.CheckSearchCaseSensitive(caseSensitiveCheckBox.Checked, caseCheckBox, false);
            WindowManager.CheckSearchLoop(loopAtEOFCheckBox.Checked, loopCheckBox, false);
            WindowManager.CheckInternalExplorer(form1, internalExplorerCheckBox.Checked, false);
            WindowManager.CheckDefaultEncoding(form1, useExistingCheckBox.Checked, false);
            WindowManager.CheckEncoding(form1, defaultComboBox.SelectedIndex, false);
            WindowManager.CheckLineNumbers(form1, lineNumbersCheckBox.Checked, false);
            FileListManager.RefreshRecentFiles(form1);
            FileListManager.RefreshSearchHistory(form1);

            if ((previousJumpListActivated != jumpListCheckBox.Checked) && !jumpListCheckBox.Checked)
            {
                SystemUtil.ClearWindowsJumpList(form1);
            }
            else if ((previousJumpListActivated != jumpListCheckBox.Checked) && jumpListCheckBox.Checked)
            {
                SystemUtil.SetWindowsJumpList(form1);
            }

            //If session is open and don't use default aspect, it will do nothing
            if (!sessionToolStrip.Visible || (sessionToolStrip.Visible && useDefaultToolStripMenuItem.Checked))
            {
                CheckTabCloseButton(form1, tabCloseButtonOnComboBox.SelectedIndex);
                CheckTabPosition(form1, tabPositionComboBox.SelectedIndex);
                CheckTabOrientation(form1, tabOrientationComboBox.SelectedIndex);
            }

            CheckTabMultiline(form1, tabMultilineCheckBox.Checked);
            form1.KeepInitialSpacesOnReturn = keepInitialSpacesOnReturnCheckBox.Checked;
            form1.KeepBulletListOnReturn    = keepBulletListOnReturnCheckBox.Checked;

            if (!previousFont.Equals(font) || previousFontColor != fontColor || previousBackgroundColor != backgroundColor || previousHighlightURL != urlsCheckBox.Checked)
            {
                foreach (XtraTabPage tabPage in pagesTabControl.TabPages)
                {
                    CustomRichTextBox pageTextBox       = ProgramUtil.GetPageTextBox(tabPage);
                    CustomLineNumbers customLineNumbers = ProgramUtil.GetCustomLineNumbers(tabPage);

                    pageTextBox.Font            = font;
                    customLineNumbers.Font      = font;
                    pageTextBox.ForeColor       = fontColor;
                    pageTextBox.BackColor       = backgroundColor;
                    customLineNumbers.BackColor = backgroundColor;
                    pageTextBox.DetectUrls      = urlsCheckBox.Checked;
                }

                form1.SetMainFont(font);
                form1.TextFontColor       = fontColor;
                form1.TextBackgroundColor = backgroundColor;
            }

            LookFeelUtil.SetForm1LookAndFeel(form1);
            //if (!closeOptionsAfterSave)
            //{
            //    LookFeelUtil.SetOptionsLookAndFeel(form);
            //}

            if (previousLanguage == languageComboBox.SelectedItem.ToString())
            {
                return;
            }

            ConfigUtil.UpdateParameter("RecreateJumpList", true.ToString());
            if (!closeOptionsAfterSave)
            {
                form.SetLanguage();
            }
            form1.SetLanguage(true);
        }