Skip to content

Commit

Permalink
Merge pull request #1023 from picoe/hotfix/addin-dark-theme
Browse files Browse the repository at this point in the history
Hotfix/addin dark theme
  • Loading branch information
cwensley authored Feb 21, 2018
2 parents 992658b + 0aabbed commit 112e394
Show file tree
Hide file tree
Showing 49 changed files with 497 additions and 683 deletions.
9 changes: 6 additions & 3 deletions src/Addins/Eto.Addin.MonoDevelop/EtoInitializer.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
using System;
using System.Linq;
using Eto.Forms;
using Eto.Designer;

namespace Eto.Addin.MonoDevelop
{
public static class EtoInitializer
{
static readonly string AddinPlatform = Eto.Platforms.Gtk2;

public static void Initialize()
{
if (Platform.Instance == null)
{
try
{
new Eto.Forms.Application(AddinPlatform).Attach();
var platform = new Eto.GtkSharp.Platform();

platform.LoadAssembly(typeof(EtoInitializer).Assembly);

new Eto.Forms.Application(platform).Attach();
}
catch (Exception ex)
{
Expand Down
12 changes: 12 additions & 0 deletions src/Addins/Eto.Addin.MonoDevelop/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using Eto.Drawing;
namespace Eto.Addin.MonoDevelop
{
public static class Extensions
{
public static Color ToEto(this Xwt.Drawing.Color color)
{
return new Color((float)color.Red, (float)color.Green, (float)color.Blue, (float)color.Alpha);
}
}
}
Binary file modified src/Addins/Eto.Addin.MonoDevelop/Images/project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Addins/Eto.Addin.MonoDevelop/Images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/Addins/Eto.Addin.MonoDevelop/PlatformThemeHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using Eto;
using Eto.Addin.MonoDevelop;
using Eto.Designer;
using Eto.Drawing;
using MonoDevelop.Ide.Gui;

[assembly: ExportHandler(typeof(IPlatformTheme), typeof(PlatformThemeHandler))]

namespace Eto.Addin.MonoDevelop
{
public class PlatformThemeHandler : IPlatformTheme
{
public Color ProjectBackground => Styles.NewProjectDialog.ProjectConfigurationLeftHandBackgroundColor.ToEto();

public Color ProjectForeground => Styles.BaseForegroundColor.ToEto();

public Color ProjectDialogBackground => ProjectBackground; // not used on mac anyway..

public Color ErrorForeground => Styles.ErrorForegroundColor.ToEto();

public Color SummaryBackground => Styles.NewProjectDialog.ProjectConfigurationRightHandBackgroundColor.ToEto();

public Color SummaryForeground => Styles.NewProjectDialog.ProjectConfigurationPreviewLabelColor.ToEto();

public Color DesignerBackground => Styles.BaseBackgroundColor.ToEto();

public Color DesignerPanel => Styles.BackgroundColor.ToEto();

public IEnumerable<PlatformColor> AllColors => throw new NotImplementedException();
}
}
4 changes: 3 additions & 1 deletion src/Addins/Eto.Addin.Shared/BaseDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Eto.Drawing;
using Eto.Designer;
using Eto.Drawing;
using Eto.Forms;

namespace Eto.Addin.Shared
Expand All @@ -16,6 +17,7 @@ public BaseDialog()
{
//ClientSize = new Size(800, 400);
Resizable = true;
BackgroundColor = Global.Theme.ProjectDialogBackground;

content = new Panel();

Expand Down
7 changes: 4 additions & 3 deletions src/Addins/Eto.Addin.Shared/BasePageView.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Eto.Drawing;
using Eto.Drawing;
using Eto.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Eto.Designer;

namespace Eto.Addin.Shared
{
Expand All @@ -27,7 +28,7 @@ public Control Information

public BasePageView()
{
BackgroundColor = Color.FromArgb(225, 228, 232);
BackgroundColor = Global.Theme.ProjectBackground;

content.Padding = new Padding(50, 10, 20, 10);

Expand All @@ -38,7 +39,7 @@ public BasePageView()
Items =
{
new StackLayoutItem(content, VerticalAlignment.Center, expand: true),
new Panel { BackgroundColor = Colors.White, Size = new Size(280, 200), Content = information, Padding = new Padding(20) }
new Panel { BackgroundColor = Global.Theme.SummaryBackground, Size = new Size(280, 200), Content = information, Padding = new Padding(20) }
}
};
}
Expand Down
1 change: 1 addition & 0 deletions src/Addins/Eto.Addin.Shared/Eto.Addin.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Eto\Eto.csproj" />
<ProjectReference Include="..\Eto.Designer\Eto.Designer.csproj" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/Addins/Eto.Addin.Shared/ProjectWizardPageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public ProjectWizardPageModel(IParameterSource source, XElement optionsElement)
Separate = false;
Mode = "code";
IncludeSolution = false;
if (SupportsBase)
Base = "Panel";
}

public bool IsValid
Expand Down
20 changes: 15 additions & 5 deletions src/Addins/Eto.Addin.Shared/ProjectWizardPageView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Eto.Forms;
using Eto.Drawing;
using Eto.Designer;

namespace Eto.Addin.Shared
{
Expand All @@ -9,17 +10,20 @@ public class ProjectWizardPageView : BasePageView
{
public ProjectWizardPageView(ProjectWizardPageModel model)
{
var radioSpacing = Platform.IsGtk ? Size.Empty : new Size(2, 2);

var content = new DynamicLayout
{
Spacing = new Size(10, 10)
};

if (model.SupportsAppName)
{
var nameBox = new TextBox();
nameBox.TextBinding.BindDataContext((ProjectWizardPageModel m) => m.AppName);
Application.Instance.AsyncInvoke(nameBox.Focus);

var nameValid = new Label { TextColor = Colors.Red };
var nameValid = new Label { TextColor = Global.Theme.ErrorForeground };
nameValid.BindDataContext(c => c.Visible, (ProjectWizardPageModel m) => m.AppNameInvalid);
nameValid.BindDataContext(c => c.Text, (ProjectWizardPageModel m) => m.AppNameValidationText);

Expand All @@ -40,7 +44,7 @@ public ProjectWizardPageView(ProjectWizardPageModel model)
var platformTypeList = new RadioButtonList
{
Orientation = Orientation.Vertical,
Spacing = new Size(0, 0),
Spacing = radioSpacing,
Items =
{
new ListItem { Text = "Single Windows, Linux, and Mac desktop project", Key = "combined" },
Expand Down Expand Up @@ -89,7 +93,7 @@ public ProjectWizardPageView(ProjectWizardPageModel model)
var sharedCodeList = new RadioButtonList
{
Orientation = Orientation.Vertical,
Spacing = new Size(0, 0),
Spacing = radioSpacing,
};
if (model.SupportsPCL)
{
Expand Down Expand Up @@ -118,7 +122,7 @@ public ProjectWizardPageView(ProjectWizardPageModel model)
var panelTypeList = new RadioButtonList
{
Orientation = Orientation.Horizontal,
Spacing = new Size(0, 0),
Spacing = radioSpacing,
};

panelTypeList.Items.Add(new ListItem { Text = "Code", Key = "code" });
Expand All @@ -145,7 +149,7 @@ public ProjectWizardPageView(ProjectWizardPageModel model)
var baseTypeList = new RadioButtonList
{
Orientation = Orientation.Horizontal,
Spacing = new Size(0, 0),
Spacing = radioSpacing,
};

baseTypeList.Items.Add(new ListItem { Text = "Panel", Key = "Panel" });
Expand All @@ -156,6 +160,12 @@ public ProjectWizardPageView(ProjectWizardPageModel model)
content.AddRow(new Label { Text = "Base:", TextAlignment = TextAlignment.Right, VerticalAlignment = VerticalAlignment.Center }, baseTypeList);
}

#if DEBUG
var showColorsButton = new Button { Text = "Show all themed colors" };
showColorsButton.Click += (sender, e) => new ThemedColorsDialog().ShowModal(this);
content.AddRow(new Panel(), showColorsButton);
#endif

var informationLabel = new Label();
informationLabel.TextBinding.BindDataContext((ProjectWizardPageModel m) => m.Information);
Information = informationLabel;
Expand Down
65 changes: 65 additions & 0 deletions src/Addins/Eto.Addin.Shared/ThemedColorsDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using Eto.Forms;
using Eto.Drawing;
using Eto.Designer;
using System.Linq;

namespace Eto.Addin.Shared
{
public partial class ThemedColorsDialog : Dialog
{
public ThemedColorsDialog()
{
Title = "All themed colors";
Resizable = true;
ClientSize = new Size(400, 350);

var okButton = new Button { Text = "Ok" };
okButton.Click += (sender, e) => Close();

var colorsPanel = new GridView();
colorsPanel.Columns.Add(new GridColumn
{
HeaderText = "Name",
DataCell = new TextBoxCell { Binding = Binding.Property((PlatformColor m) => m.Name) }
});

colorsPanel.Columns.Add(new GridColumn
{
HeaderText = "Name",
Width = 40,
AutoSize = false,
DataCell = new CustomCell
{
CreateCell = e =>
{
var p = new Panel { Size = new Size(20, 20) };
p.BindDataContext(c => c.BackgroundColor, (PlatformColor m) => m.Color);
return p;
}
}
});
colorsPanel.DataStore = Global.Theme.AllColors.ToList();

Content = new StackLayout
{
Padding = 10,
Items =
{
new StackLayoutItem {
Expand = true,
HorizontalAlignment = HorizontalAlignment.Stretch,
Control = new Scrollable { Content = colorsPanel }
},

new StackLayoutItem
{
HorizontalAlignment = HorizontalAlignment.Right,
Control = okButton
}
}
};

}
}
}
16 changes: 15 additions & 1 deletion src/Addins/Eto.Addin.VisualStudio/Eto.Addin.VisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<Compile Include="Intellisense\XamlCompletionSource.cs" />
<Compile Include="Intellisense\XmlParser.cs" />
<Compile Include="IVsTextLinesExtensions.cs" />
<Compile Include="PlatformThemeHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services.cs" />
<Compile Include="TextViewListener.cs" />
Expand Down Expand Up @@ -114,7 +115,9 @@
<Resource Include="Templates\App-FSharp\App.ico" />
<Content Include="Templates\App-FSharp\App.vstemplate" />
<Content Include="Templates\File-CSharp\File.vstemplate" />
<None Include="Templates\App-CSharp\App.vstemplate" />
<None Include="Templates\App-CSharp\App.vstemplate">
<SubType>Designer</SubType>
</None>
<Resource Include="Templates\App-CSharp\App.ico" />
<None Include="Properties\wafflebuilder.targets">
<SubType>Designer</SubType>
Expand Down Expand Up @@ -259,6 +262,7 @@
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="ReachFramework" />
<Reference Include="System" />
<Reference Include="System.AddIn" />
<Reference Include="System.AddIn.Contract" />
Expand Down Expand Up @@ -290,13 +294,22 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core">
<Version>4.3.1</Version>
</PackageReference>
<PackageReference Include="Portable.Xaml">
<Version>0.21.0</Version>
</PackageReference>
<PackageReference Include="Extended.Wpf.Toolkit">
<Version>3.2.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Page Include="theme\WindowStyles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<PropertyGroup>
<UseCodebase>true</UseCodebase>
</PropertyGroup>
Expand All @@ -316,6 +329,7 @@
<!-- this updates our PackageReferences to be copy local -->
<ItemGroup>
<ReferencePath Update="%(ReferencePath.Identity)" Condition="%(Filename) == 'Portable.Xaml'" CopyLocal="True" />
<ReferencePath Update="%(ReferencePath.Identity)" Condition="%(Filename) == 'FSharp.Compiler.CodeDom'" CopyLocal="True" />
</ItemGroup>
<Message Text="CopyLocal: %(ReferencePath.Identity), %(Filename)" Condition="%(ReferencePath.CopyLocal) == 'True'" Importance="high" />
</Target>
Expand Down
Loading

0 comments on commit 112e394

Please sign in to comment.