internal static bool IsEncodingDefaultEnabled() { return(ConfigUtil.GetBoolParameter("DefaultEncoding")); }
internal static void SetForm1LookAndFeel(Form1 form, bool firstLoad = false) { switch (ConfigUtil.GetIntParameter("LookAndFeel")) { case 0: if (firstLoad) { return; } form.menuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.toolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.searchPanel.searchReplaceToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.statusStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.pageContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.trayContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.textBoxContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.notePanel.noteToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.notePanel.noteContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.internalExplorerContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.sessionToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.calendarPanel.calendarToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.calendarPanel.calendarContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.calculatorPanel.calculatorToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.clipboardPanel.clipboardContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.clipboardPanel.clipboardToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.tabPanel.tabToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.searchInFilesPanel.searchInFilesToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.searchInFilesPanel.searchInFilesContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.filePanel.fileContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.filePanel.directoryContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.filePanel.toolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; form.commonStandardContextMenuStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode; break; case 1: form.menuStrip.RenderMode = ToolStripRenderMode.System; form.toolStrip.RenderMode = ToolStripRenderMode.System; form.searchPanel.searchReplaceToolStrip.RenderMode = ToolStripRenderMode.System; form.statusStrip.RenderMode = ToolStripRenderMode.System; form.pageContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.trayContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.textBoxContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.notePanel.noteToolStrip.RenderMode = ToolStripRenderMode.System; form.notePanel.noteContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.internalExplorerContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.sessionToolStrip.RenderMode = ToolStripRenderMode.System; form.calendarPanel.calendarToolStrip.RenderMode = ToolStripRenderMode.System; form.calendarPanel.calendarContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.calculatorPanel.calculatorToolStrip.RenderMode = ToolStripRenderMode.System; form.clipboardPanel.clipboardContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.clipboardPanel.clipboardToolStrip.RenderMode = ToolStripRenderMode.System; form.tabPanel.tabToolStrip.RenderMode = ToolStripRenderMode.System; form.searchInFilesPanel.searchInFilesToolStrip.RenderMode = ToolStripRenderMode.System; form.searchInFilesPanel.searchInFilesContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.filePanel.fileContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.filePanel.directoryContextMenuStrip.RenderMode = ToolStripRenderMode.System; form.filePanel.toolStrip.RenderMode = ToolStripRenderMode.System; form.commonStandardContextMenuStrip.RenderMode = ToolStripRenderMode.System; break; } }
internal static void SetWindowsJumpList(Form1 form) { #if Debug return; #endif try { switch (GetOSInfo()) { case OS.Seven: { if (!ConfigUtil.GetBoolParameter("RecreateJumpList") || !ConfigUtil.GetBoolParameter("ActiveJumpList")) { return; } JumpList list = JumpList.CreateJumpListForIndividualWindow(ConstantUtil.jumpListApplicationId, form.Handle); JumpListSeparator separator = null; JumpListLink listLink = null; try { separator = new JumpListSeparator(); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("New", className)); listLink.Arguments = ConstantUtil.cmdLineJLNew; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\NewTab.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("NewAndPaste", className)); listLink.Arguments = ConstantUtil.cmdLineJLNewAndPaste; listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("OpenFile", className)); listLink.Arguments = ConstantUtil.cmdLineJLOpenFile; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\OpenFile.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("OpenSession", className)); listLink.Arguments = ConstantUtil.cmdLineJLOpenSession; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\OpenSession.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("SearchInFiles", className)); listLink.Arguments = ConstantUtil.cmdLineJLSearchInFiles; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\SearchInFiles.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); list.AddUserTasks(separator); listLink = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("CheckNewVersion", className)); listLink.Arguments = ConstantUtil.cmdLineJLCheckNewVersion; listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\CheckNewVersion.ico", ConstantUtil.ApplicationExecutionPath()), 0); listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath(); list.AddUserTasks(listLink); #if Release listLink = new JumpListLink(ConstantUtil.dtPadURL, LanguageUtil.GetCurrentLanguageString("WebSite", className)); listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\WebSite.ico", ConstantUtil.ApplicationExecutionPath()), 0); list.AddUserTasks(listLink); #endif list.Refresh(); } finally { if (separator != null) { separator.Dispose(); } if (listLink != null) { listLink.Dispose(); } } ConfigUtil.UpdateParameter("RecreateJumpList", false.ToString()); } break; } } catch (Exception exception) { WindowManager.ShowErrorBox(form, exception.Message, exception); } }
internal static int SearchCountOccurences(String text, String stringToSearch, Form1 form = null, CustomRichTextBox textBox = null, bool forceDisableHighlight = false, bool useRegularExpressions = false) { int counter = 0; bool highlights = false; if (!forceDisableHighlight) { highlights = ConfigUtil.GetBoolParameter("SearchHighlightsResults"); } RichTextBox tempRichTextBox = new RichTextBox(); //Temporary RichTextBox to avoid too much undo/redo into buffer try { if (textBox != null) //Research inside a textbox (usually the pageTextBox) { tempRichTextBox.Rtf = textBox.Rtf; tempRichTextBox.SelectAll(); tempRichTextBox.SelectionBackColor = textBox.BackColor; int positionSearchedText; int selectionLength; SearchReplaceUtil.FindStringPositionAndLength(text, stringToSearch, SearchReplaceUtil.SearchType.First, useRegularExpressions, tempRichTextBox, out positionSearchedText, out selectionLength); while (positionSearchedText != -1) { tempRichTextBox.Select(positionSearchedText, selectionLength); if (highlights) { tempRichTextBox.SelectionBackColor = (textBox.BackColor == Color.Yellow) ? Color.Red : Color.Yellow; } SearchReplaceUtil.FindStringPositionAndLength(text, stringToSearch, SearchReplaceUtil.SearchType.Next, useRegularExpressions, tempRichTextBox, out positionSearchedText, out selectionLength); counter++; } } else //Search inside a string { int i = 0; while ((i = text.IndexOf(stringToSearch, i)) != -1) { i += stringToSearch.Length; counter++; } } if (textBox != null && highlights) { textBox.IsHighlighting = true; RichTextBoxUtil.ReplaceRTFContent(textBox, tempRichTextBox); TextManager.RefreshUndoRedoExternal(form); } } finally { tempRichTextBox.Dispose(); } return(counter); }