Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 162cc6f
Showing
13 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Autosave files | ||
*~ | ||
|
||
# build | ||
[Oo]bj/ | ||
[Bb]in/ | ||
packages/ | ||
TestResults/ | ||
|
||
# globs | ||
Makefile.in | ||
*.DS_Store | ||
*.sln.cache | ||
*.suo | ||
*.cache | ||
*.pidb | ||
*.userprefs | ||
*.usertasks | ||
config.log | ||
config.make | ||
config.status | ||
aclocal.m4 | ||
install-sh | ||
autom4te.cache/ | ||
*.user | ||
*.tar.gz | ||
tarballs/ | ||
test-results/ | ||
Thumbs.db | ||
|
||
# Mac bundle stuff | ||
*.dmg | ||
*.app | ||
|
||
# resharper | ||
*_Resharper.* | ||
*.Resharper | ||
|
||
# dotCover | ||
*.dotCover | ||
.droidres/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
SolutionName extension for Visual Studio for Mac | ||
==== | ||
|
||
### Preview | ||
|
||
|
||
|
||
|
||
|
||
#### Other notes | ||
|
||
To update .mpack file, update version, compile in Release and then run: | ||
|
||
`mono /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/bin/vstool.exe setup pack SolutionName/bin/Release/DT.VS4Mac.SolutionName.dll` | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Reflection; | ||
using Mono.Addins; | ||
using Mono.Addins.Description; | ||
|
||
[assembly: Addin( | ||
"DT.VS4Mac.SolutionName", | ||
Namespace = "DT.VS4Mac.SolutionName", | ||
Version = "1.0" | ||
)] | ||
|
||
[assembly: AddinName("DT.VS4Mac.SolutionName")] | ||
[assembly: AddinCategory("IDE extensions")] | ||
[assembly: AddinDescription("Shows solution name in Mac app switcher and doc")] | ||
[assembly: AddinAuthor("DreamTeam Mobile, LLC")] | ||
|
||
[assembly: AssemblyTitle("DT.SolutionName")] | ||
[assembly: AssemblyDescription("Visual Studio for Mac Add-in to show current solution name")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("")] | ||
[assembly: AssemblyCopyright("DreamTeam Mobile, LLC")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
[assembly: AssemblyVersion("1.0.*")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ExtensionModel> | ||
<Runtime> | ||
<Import assembly="DT.VS4Mac.SolutionName.dll" /> | ||
</Runtime> | ||
<Extension path="/MonoDevelop/Ide/StartupHandlers"> | ||
<Class class="DT.VS4Mac.SolutionName.StartupHandler" /> | ||
</Extension> | ||
</ExtensionModel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using AppKit; | ||
using Foundation; | ||
using MonoDevelop.Ide; | ||
using MonoDevelop.Projects; | ||
|
||
namespace DT.VS4Mac.SolutionName | ||
{ | ||
public static class SolutionNameMonitor | ||
{ | ||
private static string _lastSolutionName = string.Empty; | ||
private static NSImage _defaultImage; | ||
|
||
static void CurrentSelectedSolution_NameChanged(object sender, WorkspaceItemRenamedEventArgs e) | ||
{ | ||
RefreshSolutionName(); | ||
} | ||
|
||
static void Workspace_SolutionUnloaded(object sender, SolutionEventArgs e) | ||
{ | ||
UnsubscribeFromNameChange(e.Solution); | ||
RefreshSolutionName(); | ||
} | ||
|
||
private static void Workspace_SolutionLoaded(object sender, SolutionEventArgs e) | ||
{ | ||
SubscribeForNameChange(e.Solution); | ||
RefreshSolutionName(e.Solution); | ||
} | ||
|
||
private static void SubscribeForNameChange(Solution solution) | ||
{ | ||
if (solution == null) | ||
return; | ||
solution.NameChanged += CurrentSelectedSolution_NameChanged; | ||
} | ||
|
||
private static void UnsubscribeFromNameChange(Solution solution) | ||
{ | ||
if (solution == null) | ||
return; | ||
solution.NameChanged -= CurrentSelectedSolution_NameChanged; | ||
} | ||
|
||
public static void Initialize() | ||
{ | ||
IdeApp.Workspace.SolutionLoaded += Workspace_SolutionLoaded; | ||
IdeApp.Workspace.SolutionUnloaded += Workspace_SolutionUnloaded; | ||
PreserveOriginalIcon(); | ||
RefreshSolutionName(); | ||
} | ||
|
||
private static void PreserveOriginalIcon() | ||
{ | ||
var original = NSApplication.SharedApplication.ApplicationIconImage; | ||
_defaultImage = new NSImage(original.AsTiff()); | ||
} | ||
|
||
private static void RefreshSolutionName(Solution solution = null) | ||
{ | ||
var currentSolution = solution ?? IdeApp.ProjectOperations.CurrentSelectedSolution; | ||
var solutionName = currentSolution == null ? string.Empty : currentSolution.Name; | ||
if (solutionName != _lastSolutionName) | ||
{ | ||
_lastSolutionName = solutionName; | ||
RenderSolutionNameIcon(solutionName); | ||
} | ||
} | ||
|
||
private static void RenderSolutionNameIcon(string name) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(name)) | ||
{ | ||
const float margin = 5; | ||
NSString text = (NSString)name; | ||
var attributes = new NSStringAttributes() | ||
{ | ||
Font = NSFont.SystemFontOfSize(16), | ||
ForegroundColor = NSColor.White, | ||
ParagraphStyle = NSParagraphStyle.DefaultParagraphStyle, | ||
}; | ||
var textRect = new CoreGraphics.CGSize(_defaultImage.Size.Width - margin * 2, _defaultImage.Size.Height - 2 * margin); | ||
var rect = text.BoundingRectWithSize(textRect, NSStringDrawingOptions.UsesLineFragmentOrigin, attributes.Dictionary); | ||
rect.Offset(margin, margin); | ||
var brandedImage = NSImage.ImageWithSize(_defaultImage.Size, false, (dstRect) => | ||
{ | ||
_defaultImage.Draw(dstRect); | ||
text.DrawInRect(rect, attributes); | ||
return true; | ||
}); | ||
NSApplication.SharedApplication.ApplicationIconImage = brandedImage; | ||
} | ||
else | ||
{ | ||
NSApplication.SharedApplication.ApplicationIconImage = _defaultImage; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\MonoDevelop.Addins.0.4.1\build\MonoDevelop.Addins.props" Condition="Exists('..\packages\MonoDevelop.Addins.0.4.1\build\MonoDevelop.Addins.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{896915E2-A5FE-4593-BA58-00C04F79EFBC}</ProjectGuid> | ||
<ProjectTypeGuids>{86F6BF2A-E449-4B3E-813B-9ACC37E5545F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>DT.VS4Mac.SolutionName</RootNamespace> | ||
<AssemblyName>DT.VS4Mac.SolutionName</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>false</DebugSymbols> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="MonoDevelop.Ide"> | ||
<HintPath>..\lib\MonoDevelop.Ide.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="MonoDevelop.Core"> | ||
<HintPath>..\lib\MonoDevelop.Core.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Mono.Addins"> | ||
<HintPath>..\lib\Mono.Addins.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AddinInfo.cs" /> | ||
<Compile Include="ShowSolutionName.cs" /> | ||
<Compile Include="StartupHandler.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Properties\Manifest.addin.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AddinReference Include="MonoDevelop.MacPlatform" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="..\packages\MonoDevelop.Addins.0.4.1\build\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.4.1\build\MonoDevelop.Addins.targets')" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using MonoDevelop.Components.Commands; | ||
using MonoDevelop.Core; | ||
|
||
namespace DT.VS4Mac.SolutionName | ||
{ | ||
public class StartupHandler : CommandHandler | ||
{ | ||
protected override void Run() | ||
{ | ||
try | ||
{ | ||
SolutionNameMonitor.Initialize(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
LoggingService.LogError("Error during ShowSolutionName startup", ex); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MonoDevelop.Addins" version="0.4.1" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "SolutionName\SolutionName.csproj", "{896915E2-A5FE-4593-BA58-00C04F79EFBC}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{24668DB3-61A7-4FEE-B558-173D9367BC70}" | ||
ProjectSection(SolutionItems) = preProject | ||
lib\MonoDevelop.Ide.dll = lib\MonoDevelop.Ide.dll | ||
lib\Mono.Addins.dll = lib\Mono.Addins.dll | ||
lib\MonoDevelop.Core.dll = lib\MonoDevelop.Core.dll | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{896915E2-A5FE-4593-BA58-00C04F79EFBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{896915E2-A5FE-4593-BA58-00C04F79EFBC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{896915E2-A5FE-4593-BA58-00C04F79EFBC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{896915E2-A5FE-4593-BA58-00C04F79EFBC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
Binary file not shown.
Binary file not shown.