-
Notifications
You must be signed in to change notification settings - Fork 35
/
LanguagePreferences.cs
84 lines (71 loc) · 2.53 KB
/
LanguagePreferences.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
namespace MarkdownMode
{
using System;
using System.Linq;
using Microsoft.VisualStudio;
using FONTCOLORPREFERENCES2 = Microsoft.VisualStudio.TextManager.Interop.FONTCOLORPREFERENCES2;
using FRAMEPREFERENCES2 = Microsoft.VisualStudio.TextManager.Interop.FRAMEPREFERENCES2;
using IVsTextManagerEvents2 = Microsoft.VisualStudio.TextManager.Interop.IVsTextManagerEvents2;
using IVsTextView = Microsoft.VisualStudio.TextManager.Interop.IVsTextView;
using LANGPREFERENCES2 = Microsoft.VisualStudio.TextManager.Interop.LANGPREFERENCES2;
using VIEWPREFERENCES2 = Microsoft.VisualStudio.TextManager.Interop.VIEWPREFERENCES2;
public class LanguagePreferences : IVsTextManagerEvents2
{
LANGPREFERENCES2 _preferences;
public LanguagePreferences(LANGPREFERENCES2 preferences)
{
_preferences = preferences;
}
public event EventHandler PreferencesChanged;
public LANGPREFERENCES2 RawPreferences
{
get
{
return _preferences;
}
}
public bool ShowDropdownBar
{
get
{
return _preferences.fDropdownBar != 0;
}
}
int IVsTextManagerEvents2.OnRegisterMarkerType(int iMarkerType)
{
return VSConstants.S_OK;
}
int IVsTextManagerEvents2.OnRegisterView(IVsTextView pView)
{
return VSConstants.S_OK;
}
int IVsTextManagerEvents2.OnReplaceAllInFilesBegin()
{
return VSConstants.S_OK;
}
int IVsTextManagerEvents2.OnReplaceAllInFilesEnd()
{
return VSConstants.S_OK;
}
int IVsTextManagerEvents2.OnUnregisterView(IVsTextView pView)
{
return VSConstants.S_OK;
}
int IVsTextManagerEvents2.OnUserPreferencesChanged2(VIEWPREFERENCES2[] pViewPrefs, FRAMEPREFERENCES2[] pFramePrefs, LANGPREFERENCES2[] pLangPrefs, FONTCOLORPREFERENCES2[] pColorPrefs)
{
if (pLangPrefs != null)
{
LANGPREFERENCES2[] preferences = pLangPrefs.Where(i => i.guidLang == _preferences.guidLang).ToArray();
if (preferences.Length > 0)
_preferences = preferences[0];
}
return VSConstants.S_OK;
}
protected virtual void OnPreferencesChanged(EventArgs e)
{
var t = PreferencesChanged;
if (t != null)
t(this, e);
}
}
}