├── MoeIDE
├── Resources
│ ├── MoeIDE.ico
│ ├── preview.png
│ └── preview2.png
├── VersionInfo.cs
├── zh-CN
│ └── Extension.vsixlangpack
├── PropertyChangedEventArgs.cs
├── Native.cs
├── SettingsPage.xaml.cs
├── LocalizedExtension.cs
├── Settings.cs
├── SettingsModel.cs
├── Themes
│ └── Generic.xaml
├── EnumComboBox.cs
├── Properties
│ └── AssemblyInfo.cs
├── EditorBackgroundTextViewCreationListener.cs
├── source.extension.vsixmanifest
├── SettingsManager.cs
├── WindowBackground.cs
├── MoeIDEPackage.cs
├── FilePicker.cs
├── SettingsPage.xaml
├── MoeIDE.csproj
├── VSPackage.zh-CN.resx
├── EditorBackground.cs
└── VSPackage.resx
├── LICENSE.txt
├── README.md
├── MoeIDE.sln
├── .gitattributes
└── .gitignore
/MoeIDE/Resources/MoeIDE.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Meowtrix/MoeIDE/HEAD/MoeIDE/Resources/MoeIDE.ico
--------------------------------------------------------------------------------
/MoeIDE/Resources/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Meowtrix/MoeIDE/HEAD/MoeIDE/Resources/preview.png
--------------------------------------------------------------------------------
/MoeIDE/Resources/preview2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Meowtrix/MoeIDE/HEAD/MoeIDE/Resources/preview2.png
--------------------------------------------------------------------------------
/MoeIDE/VersionInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Meowtrix.MoeIDE
2 | {
3 | public static class __Version
4 | {
5 | public const string Version = "1.4.1";
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/MoeIDE/zh-CN/Extension.vsixlangpack:
--------------------------------------------------------------------------------
1 |
2 |
3 | MoeIDE
4 | 为IDE提供背景图片,包含预定义的透明主题。
5 | https://github.com/Meowtrix/MoeIDE
6 |
7 |
--------------------------------------------------------------------------------
/MoeIDE/PropertyChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Meowtrix.MoeIDE
4 | {
5 | public class PropertyChangedEventArgs : EventArgs
6 | {
7 | public T OldValue { get; }
8 | public T NewValue { get; }
9 | public PropertyChangedEventArgs(T oldValue, T newValue)
10 | {
11 | OldValue = oldValue;
12 | NewValue = newValue;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MoeIDE/Native.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Meowtrix.MoeIDE
5 | {
6 | [StructLayout(LayoutKind.Sequential)]
7 | public struct RECT
8 | {
9 | public int Left;
10 | public int Top;
11 | public int Right;
12 | public int Bottom;
13 | public int Height => Bottom - Top;
14 | public int Width => Right - Left;
15 | }
16 | public static class NativeMethods
17 | {
18 | [DllImport("user32.dll", SetLastError = true)]
19 | [return: MarshalAs(UnmanagedType.Bool)]
20 | public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MoeIDE/SettingsPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace Meowtrix.MoeIDE
5 | {
6 | ///
7 | /// SettingsPage.xaml 的交互逻辑
8 | ///
9 | public partial class SettingsPage : UserControl
10 | {
11 | public SettingsPage()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | private void DefaultColor(object sender, RoutedEventArgs e)
17 | {
18 | var exp = textColor.GetBindingExpression(TextBox.TextProperty);
19 | textColor.Text = (sender as Control).Tag.ToString();
20 | exp.UpdateSource();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/MoeIDE/LocalizedExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Resources;
3 | using System.Windows.Markup;
4 |
5 | namespace Meowtrix.MoeIDE
6 | {
7 | internal class LocalizedExtension : MarkupExtension
8 | {
9 | public static ResourceManager resources;
10 | [ConstructorArgument("resourceKey")]
11 | public string ResourceKey { get; set; }
12 | public LocalizedExtension() { }
13 | public LocalizedExtension(string resourceKey)
14 | {
15 | ResourceKey = resourceKey;
16 | }
17 | public override object ProvideValue(IServiceProvider serviceProvider) => resources?.GetString(ResourceKey) ?? ResourceKey;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MoeIDE/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows;
4 | using Microsoft.VisualStudio.Shell;
5 |
6 | namespace Meowtrix.MoeIDE
7 | {
8 | public sealed class Settings : UIElementDialogPage
9 | {
10 | public SettingsModel Model { get; private set; }
11 | private readonly SettingsPage page = new SettingsPage();
12 | protected override UIElement Child => page;
13 | protected override void OnActivate(CancelEventArgs e)
14 | {
15 | if (Model == null)
16 | {
17 | Model = SettingsManager.CurrentSettings.Clone();
18 | page.DataContext = Model;
19 | }
20 | base.OnActivate(e);
21 | }
22 | protected override void OnClosed(EventArgs e)
23 | {
24 | Model = null;
25 | base.OnClosed(e);
26 | }
27 | protected override void OnApply(PageApplyEventArgs e)
28 | {
29 | page.Focus();
30 | if (e.ApplyBehavior == ApplyKind.Apply)
31 | SettingsManager.SaveSettings(Model);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Huo Yaoyuan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MoeIDE
2 |
3 | This extension allows you to pick a background image for the whole Visual Studio window.
4 |
5 | Available on [Visual Studio Gallery](https://marketplace.visualstudio.com/items?itemName=vs-publisher-593793.MoeIDE).
6 |
7 | Supported version: Visual Studio 2015 and above
8 | ## Preview
9 |
10 | 
11 | 
12 |
13 | ## Usage
14 |
15 | There are three color themes with transparence provided, so many parts of IDE can be transparent.
16 |
17 | To customize the image, see Options->MoeIDE.
18 |
19 | After installing the extension, go to Options->Environment->Color Theme, and select Light Transparent, Dark Transparent or Blue Transparent to apply the embedded theme.
20 |
21 | *To customize colors, see [Color Theme Editor](https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.VisualStudio2017ColorThemeEditor).*
22 |
23 | ## Develop
24 |
25 | Requires Visual Studio **2017** to build. (for the new project format)
26 |
27 | To debug a Visual Studio Extension, use `(VisualStudioPath)\Common7\IDE\devenv.exe` and `/rootSuffix Exp` in Debug page of project properties.
28 |
--------------------------------------------------------------------------------
/MoeIDE.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29215.179
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoeIDE", "MoeIDE\MoeIDE.csproj", "{BD08BC79-86F7-4EDB-B36E-97B992F65FFA}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {BD08BC79-86F7-4EDB-B36E-97B992F65FFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {BD08BC79-86F7-4EDB-B36E-97B992F65FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {BD08BC79-86F7-4EDB-B36E-97B992F65FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {BD08BC79-86F7-4EDB-B36E-97B992F65FFA}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {B2C3BF39-AA4F-469E-A9F4-551099C6E557}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/MoeIDE/SettingsModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Xml.Serialization;
5 |
6 | namespace Meowtrix.MoeIDE
7 | {
8 | [Serializable, XmlRoot("Settings")]
9 | public class SettingsModel
10 | {
11 | [Serializable]
12 | public class ImageInfo
13 | {
14 | public string Filename { get; set; }
15 | public Stretch Stretch { get; set; } = Stretch.UniformToFill;
16 | public HorizontalAlignment HorizontalAlignment { get; set; } = HorizontalAlignment.Center;
17 | public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Center;
18 | public Color BackColor { get; set; } = Colors.Transparent;
19 | public double Opacity { get; set; } = 1.0;
20 | public double Blur { get; set; } = 0.0;
21 | public ImageInfo Clone() => (ImageInfo)MemberwiseClone();
22 | }
23 | public ImageInfo MainBackground { get; set; } = new ImageInfo();
24 | public SettingsModel Clone() => new SettingsModel
25 | {
26 | MainBackground = this.MainBackground.Clone()
27 | };
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MoeIDE/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
4 |
24 |
25 |
--------------------------------------------------------------------------------
/MoeIDE/EnumComboBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Windows.Controls;
4 |
5 | namespace Meowtrix.MoeIDE
6 | {
7 | public class EnumComboBox : ComboBox
8 | {
9 | private Type _enumtype;
10 | public Type EnumType
11 | {
12 | get { return _enumtype; }
13 | set
14 | {
15 | if (!value.IsEnum) throw new ArgumentException(nameof(EnumType));
16 | _enumtype = value;
17 | BuildItemsSource(value);
18 | }
19 | }
20 |
21 | private class EnumComboBoxItem
22 | {
23 | public string Name { get; }
24 | public Enum Value { get; }
25 | public EnumComboBoxItem(Enum @enum)
26 | {
27 | Value = @enum;
28 | Name = @enum.ToString();
29 | }
30 | }
31 |
32 | private void BuildItemsSource(Type type)
33 | {
34 | ItemsSource = Enum.GetValues(type).Cast().Select(x => new EnumComboBoxItem(x)).ToArray();
35 | SelectedValuePath = nameof(EnumComboBoxItem.Value);
36 | DisplayMemberPath = nameof(EnumComboBoxItem.Name);
37 | SelectedIndex = 0;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/MoeIDE/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Meowtrix.MoeIDE;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("MoeIDE")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("Meowtrix")]
13 | [assembly: AssemblyProduct("MoeIDE")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // Version information for an assembly consists of the following four values:
24 | //
25 | // Major Version
26 | // Minor Version
27 | // Build Number
28 | // Revision
29 | //
30 | // You can specify all the values or you can default the Build and Revision Numbers
31 | // by using the '*' as shown below:
32 | // [assembly: AssemblyVersion("1.0.*")]
33 | [assembly: AssemblyVersion(__Version.Version)]
34 | [assembly: AssemblyFileVersion(__Version.Version)]
35 |
--------------------------------------------------------------------------------
/MoeIDE/EditorBackgroundTextViewCreationListener.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.Composition;
2 | using Microsoft.VisualStudio.Text.Editor;
3 | using Microsoft.VisualStudio.Utilities;
4 |
5 | namespace Meowtrix.MoeIDE
6 | {
7 | ///
8 | /// Establishes an to place the adornment on and exports the
9 | /// that instantiates the adornment on the event of a 's creation
10 | ///
11 | [Export(typeof(IWpfTextViewCreationListener))]
12 | [ContentType("text")]
13 | [TextViewRole(PredefinedTextViewRoles.Document)]
14 | internal sealed class EditorBackgroundTextViewCreationListener : IWpfTextViewCreationListener
15 | {
16 | // Disable "Field is never assigned to..." and "Field is never used" compiler's warnings. Justification: the field is used by MEF.
17 | #pragma warning disable 649, 169
18 |
19 | ///
20 | /// Defines the adornment layer for the scarlet adornment. This layer is ordered
21 | /// after the selection layer in the Z-order
22 | ///
23 | [Export(typeof(AdornmentLayerDefinition))]
24 | [Name("MoeIDEEditorBackground")]
25 | [Order(Before = PredefinedAdornmentLayers.Text)]
26 | private AdornmentLayerDefinition editorAdornmentLayer;
27 |
28 | #pragma warning restore 649, 169
29 |
30 | ///
31 | /// Instantiates a EditorBackground manager when a textView is created.
32 | ///
33 | /// The upon which the adornment should be placed
34 | public void TextViewCreated(IWpfTextView textView)
35 | {
36 | // The adorment will get wired to the text view events
37 | new EditorBackground(textView);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/MoeIDE/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | MoeIDE
6 | Provide a background image for the IDE, containing pre-defined transparent themes.
7 | https://github.com/Meowtrix/MoeIDE
8 | Resources\MoeIDE.ico
9 | Resources\preview.png
10 | background,image,transparent,痛IDE拡張
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/MoeIDE/SettingsManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Xml.Serialization;
4 |
5 | namespace Meowtrix.MoeIDE
6 | {
7 | internal delegate void SettingsUpdatedHandler(SettingsModel oldSettings, SettingsModel newSettings);
8 |
9 | internal static class SettingsManager
10 | {
11 | public static SettingsModel CurrentSettings { get; private set; } = new SettingsModel();
12 | public static event SettingsUpdatedHandler SettingsUpdated;
13 | private static readonly string configFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Meowtrix), nameof(MoeIDE));
14 | private static readonly FileSystemWatcher watcher;
15 | private const string filename = "userconfig.xml";
16 | static SettingsManager()
17 | {
18 | if (!File.Exists(Path.Combine(configFolder, filename)))
19 | SaveSettings(CurrentSettings);
20 | try
21 | {
22 | watcher = new FileSystemWatcher(configFolder, filename);
23 | watcher.Changed += Watcher_Changed;
24 | watcher.Renamed += Watcher_Changed;
25 | watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
26 | watcher.EnableRaisingEvents = true;
27 | }
28 | catch
29 | {
30 | //TODO:output
31 | }
32 | }
33 |
34 | private static void Watcher_Changed(object sender, FileSystemEventArgs e)
35 | {
36 | if (e.Name != filename) return;
37 | LoadSettings();
38 | }
39 |
40 | public static void LoadSettings()
41 | {
42 | SettingsModel settings;
43 | try
44 | {
45 | var serialzer = new XmlSerializer(typeof(SettingsModel));
46 | using (var stream = File.OpenRead(Path.Combine(configFolder, filename)))
47 | settings = (SettingsModel)serialzer.Deserialize(stream);
48 | SettingsUpdated?.Invoke(CurrentSettings, settings);
49 | CurrentSettings = settings;
50 | }
51 | catch
52 | {
53 | //TODO:output
54 | }
55 | }
56 |
57 | public static void SaveSettings(SettingsModel settings)
58 | {
59 | try
60 | {
61 | var serialzer = new XmlSerializer(typeof(SettingsModel));
62 | Directory.CreateDirectory(configFolder);
63 | using (var stream = File.Create(Path.Combine(configFolder, filename)))
64 | serialzer.Serialize(stream, settings);
65 | SettingsUpdated?.Invoke(CurrentSettings, settings);
66 | CurrentSettings = settings;
67 | }
68 | catch
69 | {
70 | //TODO:output
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/MoeIDE/WindowBackground.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Media;
5 | using System.Windows.Media.Effects;
6 | using System.Windows.Media.Imaging;
7 | using Microsoft.VisualStudio.Shell;
8 |
9 | namespace Meowtrix.MoeIDE
10 | {
11 | public class WindowBackground
12 | {
13 | private Border parentBorder;
14 | private Image imagecontrol;
15 | private SettingsModel settings;
16 | public WindowBackground(Window window)
17 | {
18 | if (window.IsLoaded) Window_Loaded(window, null);
19 | window.Loaded += Window_Loaded;
20 | SettingsManager.SettingsUpdated += SettingsUpdated;
21 | }
22 |
23 | #pragma warning disable VSTHRD100
24 | private async void SettingsUpdated(SettingsModel oldSettings, SettingsModel newSettings)
25 | #pragma warning restore
26 | {
27 | settings = newSettings;
28 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
29 | if (imagecontrol != null)
30 | ApplySettings();
31 | }
32 |
33 | private void ApplySettings()
34 | {
35 | try
36 | {
37 | var imagesource = BitmapFrame.Create(new Uri(settings.MainBackground.Filename), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
38 | imagesource.Freeze();
39 | imagecontrol.Source = imagesource;
40 | imagecontrol.Stretch = settings.MainBackground.Stretch;
41 | imagecontrol.HorizontalAlignment = settings.MainBackground.HorizontalAlignment;
42 | imagecontrol.VerticalAlignment = settings.MainBackground.VerticalAlignment;
43 | var br = new SolidColorBrush(settings.MainBackground.BackColor);
44 | br.Freeze();
45 | parentBorder.Background = br;
46 | imagecontrol.Opacity = settings.MainBackground.Opacity;
47 | double blur = settings.MainBackground.Blur;
48 | if (blur == 0.0)
49 | imagecontrol.Effect = null;
50 | else imagecontrol.Effect = new BlurEffect { Radius = blur };
51 | }
52 | catch
53 | {
54 | imagecontrol.Source = null;
55 | }
56 | }
57 |
58 | private void Window_Loaded(object sender, RoutedEventArgs e)
59 | {
60 | var mainwindow = (Window)sender;
61 |
62 | imagecontrol = new Image();
63 | parentBorder = new Border
64 | {
65 | Child = imagecontrol
66 | };
67 | var cache = new BitmapCache { SnapsToDevicePixels = true };
68 | cache.Freeze();
69 | parentBorder.CacheMode = cache;
70 | Grid.SetRowSpan(parentBorder, 4);
71 | var rootgrid = (Grid)mainwindow.Template.FindName("RootGrid", mainwindow);
72 | rootgrid.Children.Insert(0, parentBorder);
73 |
74 | ApplySettings();
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/MoeIDE/MoeIDEPackage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Resources;
3 | using System.Runtime.InteropServices;
4 | using System.Threading;
5 | using System.Windows;
6 | using Microsoft.VisualStudio.Shell;
7 | using Microsoft.VisualStudio.Shell.Interop;
8 |
9 | namespace Meowtrix.MoeIDE
10 | {
11 | ///
12 | /// This is the class that implements the package exposed by this assembly.
13 | ///
14 | ///
15 | ///
16 | /// The minimum requirement for a class to be considered a valid package for Visual Studio
17 | /// is to implement the IVsPackage interface and register itself with the shell.
18 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF)
19 | /// to do it: it derives from the Package class that provides the implementation of the
20 | /// IVsPackage interface and uses the registration attributes defined in the framework to
21 | /// register itself and its components with the shell. These attributes tell the pkgdef creation
22 | /// utility what data to put into .pkgdef file.
23 | ///
24 | ///
25 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file.
26 | ///
27 | ///
28 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
29 | [InstalledProductRegistration("#110", "#112", __Version.Version, IconResourceID = 400)] // Info on this package for Help/About
30 | [Guid(PackageGuidString)]
31 | [ProvideOptionPage(typeof(Settings), nameof(MoeIDE), "General", 0, 0, true)]
32 | [ProvideAutoLoad(UIContextGuids.NoSolution, PackageAutoLoadFlags.BackgroundLoad)]
33 | [ProvideAutoLoad(UIContextGuids.SolutionExists, PackageAutoLoadFlags.BackgroundLoad)]
34 | [ProvideBindingPath]
35 | public sealed class MoeIDEPackage : AsyncPackage
36 | {
37 | ///
38 | /// MoeIDEPackage GUID string.
39 | ///
40 | public const string PackageGuidString = "396fe64e-807b-43f4-a39b-0d7122c48f1a";
41 |
42 | static MoeIDEPackage()
43 | {
44 | var resman = new ResourceManager("Meowtrix.MoeIDE.VSPackage", typeof(MoeIDEPackage).Assembly);
45 | LocalizedExtension.resources = resman;
46 | }
47 |
48 | #region Package Members
49 |
50 | ///
51 | /// Initialization of the package; this method is called right after the package is sited, so this is the place
52 | /// where you can put all the initialization code that rely on services provided by VisualStudio.
53 | ///
54 | protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress progress)
55 | {
56 | await base.InitializeAsync(cancellationToken, progress);
57 | await JoinableTaskFactory.SwitchToMainThreadAsync();
58 | _ = new WindowBackground(Application.Current.MainWindow);
59 | SettingsManager.LoadSettings();
60 | }
61 |
62 | #endregion
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/MoeIDE/FilePicker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Controls.Primitives;
7 | using Microsoft.WindowsAPICodePack.Dialogs;
8 |
9 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
10 |
11 | namespace Meowtrix.MoeIDE
12 | {
13 | public enum FilePickerType { OpenFile, SaveFile, Folder }
14 |
15 | [TemplatePart(Name = nameof(PART_Button), Type = typeof(ButtonBase))]
16 | public class FilePicker : Control
17 | {
18 | static FilePicker() => DefaultStyleKeyProperty.OverrideMetadata(typeof(FilePicker), new FrameworkPropertyMetadata(typeof(FilePicker)));
19 |
20 | private ButtonBase PART_Button;
21 |
22 | public string Filename
23 | {
24 | get => (string)GetValue(FilenameProperty);
25 | set => SetValue(FilenameProperty, value);
26 | }
27 |
28 | // Using a DependencyProperty as the backing store for Filename. This enables animation, styling, binding, etc...
29 | public static readonly DependencyProperty FilenameProperty =
30 | DependencyProperty.Register(nameof(Filename), typeof(string), typeof(FilePicker), new PropertyMetadata(string.Empty));
31 |
32 | public event EventHandler> FilenameChanged;
33 |
34 | public FilePickerType PickerType
35 | {
36 | get => (FilePickerType)GetValue(PickerTypeProperty);
37 | set => SetValue(PickerTypeProperty, value);
38 | }
39 |
40 | // Using a DependencyProperty as the backing store for PickerType. This enables animation, styling, binding, etc...
41 | public static readonly DependencyProperty PickerTypeProperty =
42 | DependencyProperty.Register(nameof(PickerType), typeof(FilePickerType), typeof(FilePicker), new PropertyMetadata(FilePickerType.OpenFile));
43 |
44 | public IEnumerable Filters
45 | {
46 | get => (IEnumerable)GetValue(FiltersProperty);
47 | set => SetValue(FiltersProperty, value);
48 | }
49 |
50 | // Using a DependencyProperty as the backing store for Filters. This enables animation, styling, binding, etc...
51 | public static readonly DependencyProperty FiltersProperty =
52 | DependencyProperty.Register(nameof(Filters), typeof(IEnumerable), typeof(FilePicker), new PropertyMetadata(null));
53 |
54 | public override void OnApplyTemplate()
55 | {
56 | base.OnApplyTemplate();
57 | if (PART_Button != null)
58 | PART_Button.Click -= OnClick;
59 | PART_Button = GetTemplateChild(nameof(PART_Button)) as ButtonBase;
60 | if (PART_Button != null)
61 | PART_Button.Click += OnClick;
62 | }
63 |
64 | private void OnClick(object sender, RoutedEventArgs e)
65 | {
66 | CommonFileDialog dialog;
67 | if (PickerType == FilePickerType.OpenFile) dialog = new CommonOpenFileDialog();
68 | else if (PickerType == FilePickerType.SaveFile) dialog = new CommonSaveFileDialog();
69 | else dialog = new CommonOpenFileDialog { IsFolderPicker = true };
70 | if (Filters != null)
71 | foreach (var f in Filters)
72 | dialog.Filters.Add(new CommonFileDialogFilter(f, f));
73 | try
74 | {
75 | dialog.DefaultDirectory = Path.GetDirectoryName(Filename);
76 | }
77 | catch { }
78 | if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
79 | {
80 | var old = Filename;
81 | Filename = dialog.FileName;
82 | FilenameChanged?.Invoke(this, new PropertyChangedEventArgs(old, Filename));
83 | }
84 | dialog.Dispose();
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | [Xx]64/
19 | [Xx]86/
20 | [Bb]uild/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 |
85 | # Visual Studio profiler
86 | *.psess
87 | *.vsp
88 | *.vspx
89 | *.sap
90 |
91 | # TFS 2012 Local Workspace
92 | $tf/
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 | *.DotSettings.user
101 |
102 | # JustCode is a .NET coding add-in
103 | .JustCode
104 |
105 | # TeamCity is a build add-in
106 | _TeamCity*
107 |
108 | # DotCover is a Code Coverage Tool
109 | *.dotCover
110 |
111 | # NCrunch
112 | _NCrunch_*
113 | .*crunch*.local.xml
114 | nCrunchTemp_*
115 |
116 | # MightyMoose
117 | *.mm.*
118 | AutoTest.Net/
119 |
120 | # Web workbench (sass)
121 | .sass-cache/
122 |
123 | # Installshield output folder
124 | [Ee]xpress/
125 |
126 | # DocProject is a documentation generator add-in
127 | DocProject/buildhelp/
128 | DocProject/Help/*.HxT
129 | DocProject/Help/*.HxC
130 | DocProject/Help/*.hhc
131 | DocProject/Help/*.hhk
132 | DocProject/Help/*.hhp
133 | DocProject/Help/Html2
134 | DocProject/Help/html
135 |
136 | # Click-Once directory
137 | publish/
138 |
139 | # Publish Web Output
140 | *.[Pp]ublish.xml
141 | *.azurePubxml
142 |
143 | # TODO: Un-comment the next line if you do not want to checkin
144 | # your web deploy settings because they may include unencrypted
145 | # passwords
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # NuGet Packages
150 | *.nupkg
151 | # The packages folder can be ignored because of Package Restore
152 | **/packages/*
153 | # except build/, which is used as an MSBuild target.
154 | !**/packages/build/
155 | # Uncomment if necessary however generally it will be regenerated when needed
156 | #!**/packages/repositories.config
157 | # NuGet v3's project.json files produces more ignoreable files
158 | *.nuget.props
159 | *.nuget.targets
160 |
161 | # Microsoft Azure Build Output
162 | csx/
163 | *.build.csdef
164 |
165 | # Microsoft Azure Emulator
166 | ecf/
167 | rcf/
168 |
169 | # Microsoft Azure ApplicationInsights config file
170 | ApplicationInsights.config
171 |
172 | # Windows Store app package directory
173 | AppPackages/
174 | BundleArtifacts/
175 |
176 | # Visual Studio cache files
177 | # files ending in .cache can be ignored
178 | *.[Cc]ache
179 | # but keep track of directories ending in .cache
180 | !*.[Cc]ache/
181 |
182 | # Others
183 | ClientBin/
184 | [Ss]tyle[Cc]op.*
185 | ~$*
186 | *~
187 | *.dbmdl
188 | *.dbproj.schemaview
189 | *.pfx
190 | *.publishsettings
191 | node_modules/
192 | orleans.codegen.cs
193 |
194 | # RIA/Silverlight projects
195 | Generated_Code/
196 |
197 | # Backup & report files from converting an old project file
198 | # to a newer Visual Studio version. Backup files are not needed,
199 | # because we have git ;-)
200 | _UpgradeReport_Files/
201 | Backup*/
202 | UpgradeLog*.XML
203 | UpgradeLog*.htm
204 |
205 | # SQL Server files
206 | *.mdf
207 | *.ldf
208 |
209 | # Business Intelligence projects
210 | *.rdl.data
211 | *.bim.layout
212 | *.bim_*.settings
213 |
214 | # Microsoft Fakes
215 | FakesAssemblies/
216 |
217 | # GhostDoc plugin setting file
218 | *.GhostDoc.xml
219 |
220 | # Node.js Tools for Visual Studio
221 | .ntvs_analysis.dat
222 |
223 | # Visual Studio 6 build log
224 | *.plg
225 |
226 | # Visual Studio 6 workspace options file
227 | *.opt
228 |
229 | # Visual Studio LightSwitch build output
230 | **/*.HTMLClient/GeneratedArtifacts
231 | **/*.DesktopClient/GeneratedArtifacts
232 | **/*.DesktopClient/ModelManifest.xml
233 | **/*.Server/GeneratedArtifacts
234 | **/*.Server/ModelManifest.xml
235 | _Pvt_Extensions
236 |
237 | # LightSwitch generated files
238 | GeneratedArtifacts/
239 | ModelManifest.xml
240 |
241 | # Paket dependency manager
242 | .paket/paket.exe
243 |
244 | # FAKE - F# Make
245 | .fake/
--------------------------------------------------------------------------------
/MoeIDE/SettingsPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
42 |
43 |
46 |
47 |
50 |
51 |
54 |
55 |
59 |
62 |
65 |
68 |
71 |
72 |
73 |
76 |
77 |
78 |
79 |
80 |
81 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/MoeIDE/MoeIDE.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 15.0
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 |
7 |
8 |
9 | true
10 |
11 |
12 | false
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Debug
21 | AnyCPU
22 | 2.0
23 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
24 | {BD08BC79-86F7-4EDB-B36E-97B992F65FFA}
25 | Library
26 | Properties
27 | Meowtrix.MoeIDE
28 | Meowtrix.MoeIDE
29 | v4.7.2
30 | true
31 | true
32 | false
33 | true
34 | true
35 | true
36 |
37 |
38 | true
39 | full
40 | false
41 | bin\Debug\
42 | DEBUG;TRACE
43 | prompt
44 | 4
45 |
46 |
47 | pdbonly
48 | true
49 | bin\Release\
50 | TRACE
51 | prompt
52 | 4
53 | 7
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | Component
65 |
66 |
67 | SettingsPage.xaml
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | Designer
79 |
80 |
81 |
82 |
83 | true
84 |
85 |
86 | true
87 |
88 |
89 | true
90 |
91 |
92 | true
93 |
94 |
95 | true
96 |
97 |
98 | true
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 | true
119 |
120 |
121 |
122 | VSPackage.resx
123 |
124 |
125 |
126 |
127 | Designer
128 | MSBuild:Compile
129 |
130 |
131 | MSBuild:Compile
132 | Designer
133 |
134 |
135 |
136 |
137 |
144 |
--------------------------------------------------------------------------------
/MoeIDE/VSPackage.zh-CN.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | MoeIDE
122 |
123 |
124 | 为IDE提供背景图片。
125 |
126 |
127 | ※请在环境->常规->颜色主题中选择附带的一款Transparent主题以获得最佳效果。
128 |
129 |
130 | 主窗口背景
131 |
132 |
133 | 文件名
134 |
135 |
136 | 拉伸方式
137 |
138 |
139 | 水平对齐
140 |
141 |
142 | 垂直对齐
143 |
144 |
145 | 背景颜色
146 |
147 |
148 | 浓度
149 |
150 |
151 | 模糊半径
152 |
153 |
--------------------------------------------------------------------------------
/MoeIDE/EditorBackground.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Interop;
7 | using System.Windows.Media;
8 | using Microsoft.VisualStudio.PlatformUI;
9 | using Microsoft.VisualStudio.Shell;
10 | using Microsoft.VisualStudio.Shell.Interop;
11 | using Microsoft.VisualStudio.Text.Editor;
12 |
13 | namespace Meowtrix.MoeIDE
14 | {
15 | ///
16 | /// Adornment class that draws a square box in the top right hand corner of the viewport
17 | ///
18 | public sealed class EditorBackground
19 | {
20 | ///
21 | /// Text view to add the adornment on.
22 | ///
23 | private readonly IWpfTextView view;
24 |
25 | private readonly ContentControl control;
26 | private Panel parentGrid;
27 | private Canvas viewStack;
28 | private Grid leftMargin;
29 | private VisualBrush viewStackBrush;
30 |
31 | private RECT hostRect;
32 | private Panel hostRootVisual;
33 | private VisualBrush hostVisualBrush;
34 |
35 | ///
36 | /// Initializes a new instance of the class.
37 | ///
38 | /// The upon which the adornment will be drawn
39 | public EditorBackground(IWpfTextView view)
40 | {
41 | this.view = view;
42 | control = (ContentControl)view;
43 | control.Loaded += TextView_Loaded;
44 | view.BackgroundBrushChanged += TextView_BackgroundChanged;
45 | view.Closed += TextView_Closed;
46 | }
47 |
48 | private async void TextView_BackgroundChanged(object sender, BackgroundBrushChangedEventArgs e)
49 | {
50 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
51 | MakeBackgroundTransparent();
52 | }
53 |
54 | private static IEnumerable BFS(DependencyObject root)
55 | {
56 | if (root == null) yield break;
57 |
58 | Queue queue = new Queue();
59 | queue.Enqueue(root);
60 | while (queue.Count > 0)
61 | {
62 | var current = queue.Dequeue();
63 | int childrenCount = VisualTreeHelper.GetChildrenCount(current);
64 | yield return current;
65 | for (int i = 0; i < childrenCount; i++)
66 | queue.Enqueue(VisualTreeHelper.GetChild(current, i));
67 | }
68 | }
69 |
70 | private void TextView_Closed(object sender, EventArgs e)
71 | {
72 | VSColorTheme.ThemeChanged -= SetSolidBrush;
73 | Application.Current.MainWindow.SizeChanged -= SetVisualBrush;
74 | view.BackgroundBrushChanged -= TextView_BackgroundChanged;
75 | view.Closed -= TextView_Closed;
76 | }
77 |
78 | private void TextView_Loaded(object sender, RoutedEventArgs e)
79 | {
80 | ThreadHelper.ThrowIfNotOnUIThread();
81 |
82 | if (parentGrid == null) parentGrid = control.Parent as Panel;
83 | if (viewStack == null) viewStack = control.Content as Canvas;
84 | if (leftMargin == null) leftMargin = (BFS(parentGrid).FirstOrDefault(x => x.GetType().Name == "LeftMargin") as Panel)?.Children[0] as Grid;
85 |
86 | if (!control.IsDescendantOf(Application.Current.MainWindow))
87 | {
88 | var source = PresentationSource.FromVisual(control) as HwndSource;
89 | hostRootVisual = source.RootVisual as Panel;
90 | if (hostRootVisual?.GetType().Name == "WpfMultiViewHost")//xaml editor
91 | {
92 | source.AddHook(WndHook);
93 |
94 | var containerBorder = new Border();
95 | source.RootVisual = containerBorder;
96 | containerBorder.Child = hostRootVisual;
97 |
98 | VSColorTheme.ThemeChanged += SetSolidBrush;
99 | SetSolidBrush(null);
100 |
101 | var mainWindow = Application.Current.MainWindow;
102 | hostVisualBrush = new VisualBrush(((Grid)mainWindow.Template.FindName("RootGrid", mainWindow)).Children[0]);
103 | containerBorder.Background = hostVisualBrush;
104 | mainWindow.SizeChanged += SetVisualBrush;
105 | }
106 | else
107 | {
108 | view.BackgroundBrushChanged -= TextView_BackgroundChanged;
109 | return;
110 | }
111 | }
112 |
113 | viewStackBrush = new VisualBrush(parentGrid);
114 | MakeBackgroundTransparent();
115 | }
116 |
117 | private IntPtr WndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
118 | {
119 | NativeMethods.GetWindowRect(hwnd, out RECT rect);
120 | if (hostRect.Left != rect.Left ||
121 | hostRect.Right != rect.Right ||
122 | hostRect.Top != rect.Top ||
123 | hostRect.Bottom != rect.Bottom)
124 | {
125 | hostRect = rect;
126 | SetVisualBrush(null, null);
127 | }
128 | return IntPtr.Zero;
129 | }
130 |
131 | private void SetSolidBrush(ThemeChangedEventArgs e)
132 | {
133 | ThreadHelper.ThrowIfNotOnUIThread();
134 | var uiShell = Package.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell5;
135 | var color = uiShell.GetThemedWPFColor(EnvironmentColors.SystemWindowColorKey);
136 | var brush = new SolidColorBrush(color);
137 | brush.Freeze();
138 | hostRootVisual.Background = brush;
139 | }
140 |
141 | private void SetVisualBrush(object sender, SizeChangedEventArgs e)
142 | {
143 | NativeMethods.GetWindowRect(((HwndSource)PresentationSource.FromVisual(Application.Current.MainWindow)).Handle,
144 | out RECT mainRect);
145 | double x = (hostRect.Left - mainRect.Left) / (double)mainRect.Width,
146 | y = (hostRect.Top - mainRect.Top) / (double)mainRect.Height,
147 | width = hostRect.Width / (double)mainRect.Width,
148 | height = hostRect.Height / (double)mainRect.Height;
149 | if (x < 0 || y < 0 || width > 1 || height > 1) return;
150 | hostVisualBrush.Viewbox = new Rect(x, y, width, height);
151 | }
152 |
153 | private void MakeBackgroundTransparent()
154 | {
155 | try
156 | {
157 | if (parentGrid != null) parentGrid.ClearValue(Panel.BackgroundProperty);
158 | if (viewStack != null) viewStack.Background = viewStackBrush;
159 | if (leftMargin != null) leftMargin.ClearValue(Panel.BackgroundProperty);
160 | }
161 | catch
162 | {
163 | // Be defensive - view stack expects SolidColorBrush in VS16.3 and crashes
164 | }
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/MoeIDE/VSPackage.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | MoeIDE
123 |
124 |
125 | Provide a background image for the IDE.
126 |
127 |
128 | ※Please select a transparent theme in Environment->General->Color Theme to get best experience.
129 |
130 |
131 | Main Background
132 |
133 |
134 | File name
135 |
136 |
137 | Stretch
138 |
139 |
140 | HorizontalAlignment
141 |
142 |
143 | VerticalAlignment
144 |
145 |
146 | Background color
147 |
148 |
149 | Opacity
150 |
151 |
152 | Blur radius
153 |
154 |
155 | resources\moeide.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
156 |
157 |
--------------------------------------------------------------------------------