public void SetIndicatorMarginEnabled(VIEWPREFERENCES5 viewPrefs, bool bShow) { // Set the value viewPrefs.fWidgetMargin = (uint)(bShow ? 1 : 0); // Save the update to the viewPrefs SetViewPrefererences(viewPrefs); }
public void ExecToggleSelectionMargin(IWpfTextView textView) { // Get the view preferences VIEWPREFERENCES5 viewPrefs = GetViewPreferences(); bool enabled = IsSelectionMarginEnabled(viewPrefs); SetSelectionMarginEnabled(viewPrefs, !enabled); }
public void ExecToggleStructureGuideLines(IWpfTextView textView) { // Get the view preferences VIEWPREFERENCES5 viewPrefs = GetViewPreferences(); bool enabled = IsStructureGuideLinesEnabled(viewPrefs); SetStructureGuideLinesEnabled(viewPrefs, !enabled); }
private void HideAllEditorMargins(VIEWPREFERENCES5 viewPrefs, LANGPREFERENCES3 langPrefs) { // Mark all editor margins as hidden viewPrefs.fWidgetMargin = 0; langPrefs.fLineNumbers = 0; viewPrefs.fSelectionMargin = 0; SaveAllUserPreferences(viewPrefs, langPrefs); }
public void ExecToggleIndicatorMargin() { // Get the view preferences VIEWPREFERENCES5 viewPrefs = GetViewPreferences(); bool enabled = IsIndicatorMarginEnabled(viewPrefs); SetIndicatorMarginEnabled(!enabled); }
private void GetAllUserPreferences(Guid langServiceGuid, out VIEWPREFERENCES5 viewPrefs, out LANGPREFERENCES3 langPrefs) { LANGPREFERENCES3[] langPrefsArr = new LANGPREFERENCES3[] { new LANGPREFERENCES3() }; VIEWPREFERENCES5[] viewPrefsArr = new VIEWPREFERENCES5[] { new VIEWPREFERENCES5() }; langPrefsArr[0].guidLang = langServiceGuid; Marshal.ThrowExceptionForHR(TextManager.GetUserPreferences6(viewPrefsArr, langPrefsArr, null)); langPrefs = langPrefsArr[0]; viewPrefs = viewPrefsArr[0]; }
private void SaveCurrentViewAndLangPrefs(VIEWPREFERENCES5 viewPrefs, LANGPREFERENCES3 langPrefs) { // Create a Map of settings to restore to Dictionary <string, object> restoreSettings = new Dictionary <string, object> { // Save the viewPrefs and langPrefs ["ViewPrefs"] = viewPrefs, // Holds Breakpoint, SelectionMargin ["LangPrefs"] = langPrefs // Holds LineNumbers }; // Save the RestoreActions to the global map against the given language type RestoreSettingsMap[languageServiceGuid] = restoreSettings; }
public void QueryStatusToggleTrackChanges(OLECMD[] prgCmds) { //EnableAndCheckCommand(prgCmds, IsSelectionMarginEnabled()); prgCmds[0].cmdf |= (uint)OLECMDF.OLECMDF_SUPPORTED; VIEWPREFERENCES5 viewPrefs = GetViewPreferences(); if (IsSelectionMarginEnabled(viewPrefs)) { prgCmds[0].cmdf |= (uint)OLECMDF.OLECMDF_ENABLED; } if (IsTrackChangesEnabled(viewPrefs)) { prgCmds[0].cmdf |= (uint)OLECMDF.OLECMDF_LATCHED; } }
private bool AllMarginsAreHidden(VIEWPREFERENCES5 viewPrefs, LANGPREFERENCES3 langPrefs) { // Check for BreakPoint, LineNumbers, SelectionMargin, TrackChanges if (IsIndicatorMarginEnabled(viewPrefs)) { return(false); } if (IsLineNumbersEnabled(langPrefs)) { return(false); } if (IsSelectionMarginEnabled(viewPrefs)) { return(false); } return(true); }
private void RestoreMargins() { // Get old user settings RestoreSettingsMap.TryGetValue(languageServiceGuid, out Dictionary <string, object> restoreSettings); if (restoreSettings == null) { return; // No previous settings found. Exit out. } VIEWPREFERENCES5 oldViewPrefs = (VIEWPREFERENCES5)restoreSettings["ViewPrefs"]; LANGPREFERENCES3 oldLangPrefs = (LANGPREFERENCES3)restoreSettings["LangPrefs"]; // Fetch the latest settings GetAllUserPreferences(languageServiceGuid, out VIEWPREFERENCES5 viewPrefs, out LANGPREFERENCES3 langPrefs); // Update all the margins to be the same as the restore settings viewPrefs.fWidgetMargin = oldViewPrefs.fWidgetMargin; viewPrefs.fSelectionMargin = oldViewPrefs.fSelectionMargin; langPrefs.fLineNumbers = oldLangPrefs.fLineNumbers; // Save the new settings SaveAllUserPreferences(viewPrefs, langPrefs); }
private bool IsSelectionMarginEnabled(VIEWPREFERENCES5 viewPrefs) { return(viewPrefs.fSelectionMargin == 1); }
private void SetViewPrefererences(VIEWPREFERENCES5 viewPrefs) { Marshal.ThrowExceptionForHR(TextManager.SetUserPreferences6(new VIEWPREFERENCES5[] { viewPrefs }, null, null)); }
private VIEWPREFERENCES5 GetViewPreferences() { VIEWPREFERENCES5[] viewPrefs = new VIEWPREFERENCES5[] { new VIEWPREFERENCES5() }; Marshal.ThrowExceptionForHR(TextManager.GetUserPreferences6(viewPrefs, null, null)); return(viewPrefs[0]); }
private bool IsStructureGuideLinesEnabled(VIEWPREFERENCES5 viewPrefs) { return(viewPrefs.fShowBlockStructure == 1); }
private bool IsStructureGuideLinesEnabled() { VIEWPREFERENCES5 viewPrefs = GetViewPreferences(); return(IsStructureGuideLinesEnabled(viewPrefs)); }
private bool IsIndicatorMarginEnabled(VIEWPREFERENCES5 viewPrefs) { return(viewPrefs.fWidgetMargin == 1); }
private bool IsTrackChangesEnabled(VIEWPREFERENCES5 viewPrefs) { return(viewPrefs.fTrackChanges == 1); }
private void SetStructureGuideLinesEnabled(VIEWPREFERENCES5 viewPrefs, bool enabled) { viewPrefs.fShowBlockStructure = (uint)(enabled ? 1 : 0); // Save the update to the viewPrefs SetViewPrefererences(viewPrefs); }
private void SetTrackChangesEnabled(VIEWPREFERENCES5 viewPrefs, bool enabled) { viewPrefs.fTrackChanges = (uint)(enabled ? 1 : 0); // Save the update to the viewPrefs SetViewPrefererences(viewPrefs); }
private void SetSelectionMarginEnabled(VIEWPREFERENCES5 viewPrefs, bool enabled) { viewPrefs.fSelectionMargin = (uint)(enabled ? 1 : 0); // Save the update to the viewPrefs SetViewPrefererences(viewPrefs); }
private void SaveAllUserPreferences(VIEWPREFERENCES5 viewPrefs, LANGPREFERENCES3 langPrefs) { Marshal.ThrowExceptionForHR(TextManager.SetUserPreferences6(new VIEWPREFERENCES5[] { viewPrefs }, new LANGPREFERENCES3[] { langPrefs }, null)); }