Skip to content

Commit

Permalink
Added Browser Link options page
Browse files Browse the repository at this point in the history
  • Loading branch information
madskristensen committed Jan 5, 2014
1 parent fa9617f commit f65b967
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 27 deletions.
4 changes: 2 additions & 2 deletions EditorExtensions/BrowserLink/UnusedCss/UnusedCssExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public UnusedCssExtension(BrowserLinkConnection connection)
_uploadHelper = new UploadHelper();
_connection = connection;

UnusedCssOptions.SettingsUpdated += InstallIgnorePatterns;
BrowserLinkOptions.SettingsUpdated += InstallIgnorePatterns;
}

private void ToggleRecordingModeAction(BrowserLinkAction obj)
Expand Down Expand Up @@ -177,7 +177,7 @@ public override void OnDisconnecting(BrowserLinkConnection connection)

ExtensionByConnection.TryRemove(connection, out extension);

UnusedCssOptions.SettingsUpdated -= InstallIgnorePatterns;
BrowserLinkOptions.SettingsUpdated -= InstallIgnorePatterns;
}

[BrowserLinkCallback]
Expand Down
2 changes: 1 addition & 1 deletion EditorExtensions/EditorExtensionsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace MadsKristensen.EditorExtensions
[ProvideOptionPage(typeof(LessOptions), "Web Essentials", "LESS", 101, 105, true)]
[ProvideOptionPage(typeof(CoffeeScriptOptions), "Web Essentials", "CoffeeScript", 101, 106, true, new[] { "Iced", "JavaScript", "JS", "JScript" })]
[ProvideOptionPage(typeof(JavaScriptOptions), "Web Essentials", "JavaScript", 101, 107, true, new[] { "JScript", "JS", "Minify", "Minification", "EcmaScript" })]
[ProvideOptionPage(typeof(UnusedCssOptions), "Web Essentials", "Unused CSS", 101, 108, true, new[] { "Ignore", "Filter" })]
[ProvideOptionPage(typeof(BrowserLinkOptions), "Web Essentials", "Browser Link", 101, 108, true, new[] { "HTML menu", "BrowserLink" })]
[ProvideOptionPage(typeof(MarkdownOptions), "Web Essentials", "Markdown", 101, 109, true, new[] { "markdown", "Markdown", "md" })]
[ProvideOptionPage(typeof(CodeGenerationOptions), "Web Essentials", "Code Generation", 101, 210, true, new[] { "CodeGeneration", "codeGeneration" })]
[ProvideOptionPage(typeof(TypeScriptOptions), "Web Essentials", "TypeScript", 101, 210, true, new[] { "TypeScript", "TS" })]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,36 @@

namespace MadsKristensen.EditorExtensions
{
class UnusedCssOptions : DialogPage
class BrowserLinkOptions : DialogPage
{
[LocDisplayName("File patterns to ignore")]
[Description("A semicolon-separated list of file patterns to ignore.")]
[Category("CSS")]
public string IgnorePatterns { get; set; }

//[LocDisplayName("Ignore remote files")]
//[Description("Ignore files that are not part of the project")]
//[Category("CSS")]
//public bool IgnoreRemoteFiles { get; set; }
public BrowserLinkOptions()
{
Settings.Updated += delegate { LoadSettingsFromStorage(); };
}

public override void SaveSettingsToStorage()
{
Settings.SetValue(WESettings.Keys.UnusedCss_IgnorePatterns, IgnorePatterns);
//Settings.SetValue(WESettings.Keys.UnusedCss_IgnoreRemoteFiles, IgnoreRemoteFiles);
Settings.SetValue(WESettings.Keys.EnableBrowserLinkMenu, EnableBrowserLinkMenu);

Settings.Save();
}

public override void LoadSettingsFromStorage()
{
IgnorePatterns = WESettings.GetString(WESettings.Keys.UnusedCss_IgnorePatterns);
//IgnoreRemoteFiles = WESettings.GetBoolean(WESettings.Keys.UnusedCss_IgnoreRemoteFiles);
EnableBrowserLinkMenu = WESettings.GetBoolean(WESettings.Keys.EnableBrowserLinkMenu);
}

[LocDisplayName("CSS usage files to ignore")]
[Description("A semicolon-separated list of file patterns to ignore.")]
[Category("Browser Link")]
public string IgnorePatterns { get; set; }

[LocDisplayName("Enable Browser Link menu")]
[Description("Enable the menu that shows up in the browser. Requires restart.")]
[Category("Browser Link")]
public bool EnableBrowserLinkMenu { get; set; }

protected override void OnApply(DialogPage.PageApplyEventArgs e)
{
Expand Down
7 changes: 0 additions & 7 deletions EditorExtensions/Options/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public GeneralOptions()
public override void SaveSettingsToStorage()
{
Settings.SetValue(WESettings.Keys.KeepImportantComments, KeepImportantComments);
Settings.SetValue(WESettings.Keys.EnableBrowserLinkMenu, EnableBrowserLinkMenu);
Settings.SetValue(WESettings.Keys.AllMessagesToOutputWindow, AllMessagesToOutputWindow);
Settings.SetValue(WESettings.Keys.SvgShowPreviewWindow, SvgShowPreviewWindow);

Expand All @@ -23,7 +22,6 @@ public override void SaveSettingsToStorage()
public override void LoadSettingsFromStorage()
{
KeepImportantComments = WESettings.GetBoolean(WESettings.Keys.KeepImportantComments);
EnableBrowserLinkMenu = WESettings.GetBoolean(WESettings.Keys.EnableBrowserLinkMenu);
AllMessagesToOutputWindow = WESettings.GetBoolean(WESettings.Keys.AllMessagesToOutputWindow);
SvgShowPreviewWindow = WESettings.GetBoolean(WESettings.Keys.SvgShowPreviewWindow);
}
Expand All @@ -34,11 +32,6 @@ public override void LoadSettingsFromStorage()
[Category("Minification")]
public bool KeepImportantComments { get; set; }

[LocDisplayName("Enable Browser Link menu")]
[Description("Enable the menu that shows up in the browser. Requires restart.")]
[Category("Browser Link")]
public bool EnableBrowserLinkMenu { get; set; }

[LocDisplayName("Redirect Messages to Output Window")]
[Description("Redirect messages/notifications to output window.")]
[Category("Messages")]
Expand Down
7 changes: 3 additions & 4 deletions EditorExtensions/Options/WebEssentialsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ public static class Keys
public const string JavaScriptCamelCasePropertyNames = "JavaScriptCamelCasePropertyNames";
public const string JavaScriptCamelCaseClassNames = "JavaScriptCamelCaseClassNames";
// General
public const string KeepImportantComments = "KeepImportantComments";
public const string EnableBrowserLinkMenu = "EnableBrowserLinkMenu";
public const string KeepImportantComments = "KeepImportantComments";
public const string AllMessagesToOutputWindow = "AllMessagesToOutputWindow";

// HTML
Expand Down Expand Up @@ -140,9 +139,9 @@ public static class Keys
public const string JsHint_worker = "JsHint_worker";
public const string JsHint_wsh = "JsHint_wsh";

//Unused Css
// Browser Link
public const string UnusedCss_IgnorePatterns = "UnusedCss_IgnorePatterns";
public const string UnusedCss_IgnoreRemoteFiles = "UnusedCss_IgnoreRemoteFiles";
public const string EnableBrowserLinkMenu = "EnableBrowserLinkMenu";

//Pixel Pushing mode
public const string PixelPushing_OnByDefault = "PixelPushing_OnByDefault";
Expand Down
2 changes: 1 addition & 1 deletion EditorExtensions/WebEssentials2013.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@
<Compile Include="Options\TypeScript.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Options\UnusedCssOptions.cs">
<Compile Include="Options\BrowserLinkOptions.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Classifications\IconRegistration.cs" />
Expand Down

0 comments on commit f65b967

Please sign in to comment.