diff --git a/src/DownloadDialog.Designer.cs b/src/DownloadDialog.Designer.cs
index 9bb04f7..cff6bd6 100644
--- a/src/DownloadDialog.Designer.cs
+++ b/src/DownloadDialog.Designer.cs
@@ -66,7 +66,7 @@ private void InitializeComponent()
this.fileTransferSpeedLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.fileTransferSpeedLabel.AutoSize = true;
- this.fileTransferSpeedLabel.Location = new System.Drawing.Point(225, 67);
+ this.fileTransferSpeedLabel.Location = new System.Drawing.Point(217, 67);
this.fileTransferSpeedLabel.Name = "fileTransferSpeedLabel";
this.fileTransferSpeedLabel.Size = new System.Drawing.Size(42, 13);
this.fileTransferSpeedLabel.TabIndex = 4;
diff --git a/src/Properties/Resources.Designer.cs b/src/Properties/Resources.Designer.cs
index fd27bb0..72b01ee 100644
--- a/src/Properties/Resources.Designer.cs
+++ b/src/Properties/Resources.Designer.cs
@@ -70,6 +70,26 @@ internal static System.Drawing.Icon AppIcon {
}
}
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ internal static byte[] Catalina_json {
+ get {
+ object obj = ResourceManager.GetObject("Catalina_json", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Catalina_thumbnail {
+ get {
+ object obj = ResourceManager.GetObject("Catalina_thumbnail", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Byte[].
///
diff --git a/src/Properties/Resources.resx b/src/Properties/Resources.resx
index 75f6f04..8791726 100644
--- a/src/Properties/Resources.resx
+++ b/src/Properties/Resources.resx
@@ -142,12 +142,6 @@
..\themes\Solar_Gradients.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\themes\Mojave_Desert_thumbnail.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\themes\Solar_Gradients_thumbnail.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\locale\cs_CZ.mo;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
@@ -157,4 +151,16 @@
..\locale\pl_PL.mo;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\themes\Catalina.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\themes\Catalina_thumbnail.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\themes\Mojave_Desert_thumbnail.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\themes\Solar_Gradients_thumbnail.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/src/ThemeDialog.Designer.cs b/src/ThemeDialog.Designer.cs
index 9cff744..dd237c7 100644
--- a/src/ThemeDialog.Designer.cs
+++ b/src/ThemeDialog.Designer.cs
@@ -30,7 +30,7 @@ private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.previewBox = new System.Windows.Forms.GroupBox();
- this.downloadButton = new System.Windows.Forms.Button();
+ this.downloadLabel = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.firstButton = new System.Windows.Forms.Button();
this.previousButton = new System.Windows.Forms.Button();
@@ -54,7 +54,7 @@ private void InitializeComponent()
// previewBox
//
this.previewBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.previewBox.Controls.Add(this.downloadButton);
+ this.previewBox.Controls.Add(this.downloadLabel);
this.previewBox.Controls.Add(this.pictureBox1);
this.previewBox.Controls.Add(this.firstButton);
this.previewBox.Controls.Add(this.previousButton);
@@ -68,15 +68,16 @@ private void InitializeComponent()
this.previewBox.TabStop = false;
this.previewBox.Text = "Preview";
//
- // downloadButton
+ // downloadLabel
//
- this.downloadButton.Location = new System.Drawing.Point(115, 100);
- this.downloadButton.Name = "downloadButton";
- this.downloadButton.Size = new System.Drawing.Size(124, 23);
- this.downloadButton.TabIndex = 11;
- this.downloadButton.Text = "Download Theme";
- this.downloadButton.UseVisualStyleBackColor = true;
- this.downloadButton.Click += new System.EventHandler(this.downloadButton_Click);
+ this.downloadLabel.ForeColor = System.Drawing.Color.DarkGreen;
+ this.downloadLabel.Location = new System.Drawing.Point(9, 223);
+ this.downloadLabel.Name = "downloadLabel";
+ this.downloadLabel.Size = new System.Drawing.Size(329, 13);
+ this.downloadLabel.TabIndex = 16;
+ this.downloadLabel.Text = "Theme will be downloaded when you click Apply";
+ this.downloadLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.downloadLabel.Visible = false;
//
// pictureBox1
//
@@ -274,6 +275,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
private System.Windows.Forms.Label creditsLabel;
private Manina.Windows.Forms.ImageListView imageListView1;
- private System.Windows.Forms.Button downloadButton;
+ private System.Windows.Forms.Label downloadLabel;
}
}
\ No newline at end of file
diff --git a/src/ThemeDialog.cs b/src/ThemeDialog.cs
index 2267e6c..80cb5e6 100644
--- a/src/ThemeDialog.cs
+++ b/src/ThemeDialog.cs
@@ -50,6 +50,7 @@ public void ImportThemes(List themePaths)
ImportDialog importDialog = new ImportDialog() { Owner = this };
importDialog.FormClosing += OnImportDialogClosing;
importDialog.Show();
+ this.Enabled = false;
importDialog.InitImport(themePaths);
}
@@ -85,7 +86,7 @@ private int GetMaxImageNumber()
return max;
}
- private void LoadPreviewImage(int imageNumber)
+ private void LoadPreviewImage(Image image)
{
int width = pictureBox1.Size.Width;
int height = pictureBox1.Size.Height;
@@ -100,18 +101,22 @@ private void LoadPreviewImage(int imageNumber)
width = height * 16 / 9;
}
+ pictureBox1.Image = ThemeThumbLoader.ScaleImage(image, new Size(width, height));
+ }
+
+ private void LoadPreviewImage(int imageNumber)
+ {
if (selectedIndex == 0)
{
- pictureBox1.Image = ThemeThumbLoader.ScaleImage(windowsWallpaper,
- new Size(width, height));
+ LoadPreviewImage(Image.FromFile(windowsWallpaper));
}
else
{
ThemeConfig theme = ThemeManager.themeSettings[selectedIndex - 1];
int imageId = ThemeManager.GetThemeImageList(theme)[imageNumber - 1];
string imageFilename = theme.imageFilename.Replace("*", imageId.ToString());
- pictureBox1.Image = ThemeThumbLoader.ScaleImage(Path.Combine("themes",
- theme.themeId, imageFilename), new Size(width, height));
+ LoadPreviewImage(Image.FromFile(Path.Combine("themes", theme.themeId,
+ imageFilename)));
}
imageNumberLabel.Text = string.Format(_("Image {0} of {1}"), imageNumber,
@@ -184,13 +189,12 @@ private void LoadImportedThemes(List themes, ImportDialog importDia
private void SetThemeDownloaded(bool themeDownloaded)
{
- pictureBox1.Visible = themeDownloaded;
firstButton.Visible = themeDownloaded;
previousButton.Visible = themeDownloaded;
imageNumberLabel.Visible = themeDownloaded;
nextButton.Visible = themeDownloaded;
lastButton.Visible = themeDownloaded;
- downloadButton.Visible = !themeDownloaded;
+ downloadLabel.Visible = !themeDownloaded;
}
private void UpdateSelectedItem()
@@ -215,6 +219,11 @@ private void UpdateSelectedItem()
imageNumber = ThemeManager.GetThemeImageList(theme).IndexOf(
AppContext.wpEngine.GetImageData(solarData, theme).Item1) + 1;
}
+ else
+ {
+ LoadPreviewImage((Image)Properties.Resources.ResourceManager.GetObject(
+ themeId + "_thumbnail"));
+ }
}
SetThemeDownloaded(themeDownloaded);
@@ -226,7 +235,7 @@ private void UpdateSelectedItem()
LoadPreviewImage(imageNumber);
}
- applyButton.Enabled = themeDownloaded;
+ applyButton.Enabled = true;
}
else
{
@@ -293,6 +302,29 @@ private void ThemeDialog_Load(object sender, EventArgs e)
}));
}
+ private void ApplySelectedTheme()
+ {
+ if (selectedIndex > 0)
+ {
+ ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
+ }
+ else
+ {
+ ThemeManager.currentTheme = null;
+ }
+
+ JsonConfig.settings.themeName = ThemeManager.currentTheme?.themeId;
+
+ if (selectedIndex == 0)
+ {
+ WallpaperApi.SetWallpaper(windowsWallpaper);
+ }
+ else
+ {
+ AppContext.wpEngine.RunScheduler();
+ }
+ }
+
private void imageListView1_SelectionChanged(object sender, EventArgs e)
{
UpdateSelectedItem();
@@ -318,15 +350,6 @@ private void lastButton_Click(object sender, EventArgs e)
LoadPreviewImage(maxImageNumber);
}
- private void downloadButton_Click(object sender, EventArgs e)
- {
- DownloadDialog downloadDialog = new DownloadDialog() { Owner = this };
- downloadDialog.FormClosed += OnDownloadDialogClosed;
- downloadDialog.Show();
- this.Enabled = false;
- downloadDialog.InitDownload(ThemeManager.themeSettings[selectedIndex - 1]);
- }
-
private void importButton_Click(object sender, EventArgs e)
{
DialogResult result = openFileDialog1.ShowDialog();
@@ -350,25 +373,25 @@ private void themeLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEvent
private void applyButton_Click(object sender, EventArgs e)
{
applyButton.Enabled = false;
+ bool themeDownloaded = true;
if (selectedIndex > 0)
{
- ThemeManager.currentTheme = ThemeManager.themeSettings[selectedIndex - 1];
- }
- else
- {
- ThemeManager.currentTheme = null;
+ themeDownloaded = ThemeManager.IsThemeDownloaded(
+ ThemeManager.themeSettings[selectedIndex - 1]);
}
- JsonConfig.settings.themeName = ThemeManager.currentTheme?.themeId;
-
- if (selectedIndex == 0)
+ if (!themeDownloaded)
{
- WallpaperApi.SetWallpaper(windowsWallpaper);
+ DownloadDialog downloadDialog = new DownloadDialog() { Owner = this };
+ downloadDialog.FormClosed += OnDownloadDialogClosed;
+ downloadDialog.Show();
+ this.Enabled = false;
+ downloadDialog.InitDownload(ThemeManager.themeSettings[selectedIndex - 1]);
}
else
{
- AppContext.wpEngine.RunScheduler();
+ ApplySelectedTheme();
}
applyButton.Enabled = true;
@@ -416,6 +439,7 @@ private void OnDownloadDialogClosed(object sender, FormClosedEventArgs e)
{
if (ThemeManager.IsThemeDownloaded(ThemeManager.themeSettings[selectedIndex - 1]))
{
+ ApplySelectedTheme();
UpdateSelectedItem();
}
diff --git a/src/ThemeManager.cs b/src/ThemeManager.cs
index c5cecf9..a93abb0 100644
--- a/src/ThemeManager.cs
+++ b/src/ThemeManager.cs
@@ -14,7 +14,8 @@ namespace WinDynamicDesktop
class ThemeManager
{
private static readonly Func _ = Localization.GetTranslation;
- public static string[] defaultThemes = new string[] { "Mojave_Desert", "Solar_Gradients" };
+ public static string[] defaultThemes = new string[] { "Catalina", "Mojave_Desert",
+ "Solar_Gradients" };
public static List themeSettings = new List();
public static bool downloadMode = false;
@@ -80,9 +81,19 @@ public static bool IsThemeDownloaded(ThemeConfig theme)
public static List GetThemeImageList(ThemeConfig theme)
{
List imageList = new List();
- imageList.AddRange(theme.sunriseImageList);
+
+ if (!theme.sunriseImageList.SequenceEqual(theme.dayImageList))
+ {
+ imageList.AddRange(theme.sunriseImageList);
+ }
+
imageList.AddRange(theme.dayImageList);
- imageList.AddRange(theme.sunsetImageList);
+
+ if (!theme.sunsetImageList.SequenceEqual(theme.dayImageList))
+ {
+ imageList.AddRange(theme.sunsetImageList);
+ }
+
imageList.AddRange(theme.nightImageList);
return imageList;
}
diff --git a/src/ThemeThumbLoader.cs b/src/ThemeThumbLoader.cs
index c3d5d6d..4d87a54 100644
--- a/src/ThemeThumbLoader.cs
+++ b/src/ThemeThumbLoader.cs
@@ -26,7 +26,7 @@ public static Size GetThumbnailSize(System.Windows.Forms.Control control)
return new Size(scaledWidth, scaledWidth * 9 / 16);
}
- private static Image ScaleImage(Image tempImage, Size size)
+ public static Image ScaleImage(Image tempImage, Size size)
{
if (tempImage.Size == size)
{
diff --git a/src/WinDynamicDesktop.csproj b/src/WinDynamicDesktop.csproj
index f6a0e8a..2c8024f 100644
--- a/src/WinDynamicDesktop.csproj
+++ b/src/WinDynamicDesktop.csproj
@@ -105,6 +105,11 @@
+
+ True
+ True
+ Resources.resx
+
Form
@@ -175,14 +180,9 @@
ResXFileCodeGenerator
- Resources.Designer.cs
Designer
+ Resources.Designer.cs
-
- True
- Resources.resx
- True
-
ThemeDialog.cs
@@ -210,15 +210,19 @@
+
-
+
+
+
+
-
+
diff --git a/src/themes/Catalina.json b/src/themes/Catalina.json
new file mode 100644
index 0000000..e5a3783
--- /dev/null
+++ b/src/themes/Catalina.json
@@ -0,0 +1,20 @@
+{
+ "imageUrls": [
+ "https://onedrive.live.com/download?cid=CC2E3BD0360C1775&resid=CC2E3BD0360C1775%216170&authkey=AIMgqOpAsERVe0c",
+ "https://bitbucket.org/t1m0thyj/wdd-themes/downloads/Catalina_images.zip"
+ ],
+ "imageFilename": "catalina_*.jpg",
+ "imageCredits": "Apple",
+ "sunriseImageList": [
+ 1
+ ],
+ "dayImageList": [
+ 1
+ ],
+ "sunsetImageList": [
+ 1
+ ],
+ "nightImageList": [
+ 2
+ ]
+}
diff --git a/src/themes/Catalina_thumbnail.jpg b/src/themes/Catalina_thumbnail.jpg
new file mode 100644
index 0000000..a8ce884
Binary files /dev/null and b/src/themes/Catalina_thumbnail.jpg differ
diff --git a/src/themes/Mojave_Desert.json b/src/themes/Mojave_Desert.json
index 8cd7c56..9cae15c 100644
--- a/src/themes/Mojave_Desert.json
+++ b/src/themes/Mojave_Desert.json
@@ -1,7 +1,7 @@
{
"imageUrls": [
"https://onedrive.live.com/download?cid=CC2E3BD0360C1775&resid=CC2E3BD0360C1775%216110&authkey=AOBrcljXRqwNSZo",
- "https://bitbucket.org/t1m0thyj/wdd-themes/downloads/Mojave_Desert_images.zip"
+ "https://bitbucket.org/t1m0thyj/wdd-themes/downloads/Mojave_Desert_images.zip"
],
"imageFilename": "mojave_dynamic_*.jpeg",
"imageCredits": "Apple",
diff --git a/src/themes/Mojave_Desert_thumbnail.jpg b/src/themes/Mojave_Desert_thumbnail.jpg
new file mode 100644
index 0000000..4bddf4e
Binary files /dev/null and b/src/themes/Mojave_Desert_thumbnail.jpg differ
diff --git a/src/themes/Mojave_Desert_thumbnail.png b/src/themes/Mojave_Desert_thumbnail.png
deleted file mode 100644
index 061871c..0000000
Binary files a/src/themes/Mojave_Desert_thumbnail.png and /dev/null differ
diff --git a/src/themes/Solar_Gradients.json b/src/themes/Solar_Gradients.json
index 8d14807..8bc8f4e 100644
--- a/src/themes/Solar_Gradients.json
+++ b/src/themes/Solar_Gradients.json
@@ -1,7 +1,7 @@
{
"imageUrls": [
"https://onedrive.live.com/download?cid=CC2E3BD0360C1775&resid=CC2E3BD0360C1775%21721&authkey=AK4kktXlvN1KJzQ",
- "https://bitbucket.org/t1m0thyj/wdd-themes/downloads/Solar_Gradients_images.zip"
+ "https://bitbucket.org/t1m0thyj/wdd-themes/downloads/Solar_Gradients_images.zip"
],
"imageFilename": "solar_gradients_*.jpeg",
"imageCredits": "Apple",
diff --git a/src/themes/Solar_Gradients_thumbnail.jpg b/src/themes/Solar_Gradients_thumbnail.jpg
new file mode 100644
index 0000000..fbb9360
Binary files /dev/null and b/src/themes/Solar_Gradients_thumbnail.jpg differ
diff --git a/src/themes/Solar_Gradients_thumbnail.png b/src/themes/Solar_Gradients_thumbnail.png
deleted file mode 100644
index 618fac0..0000000
Binary files a/src/themes/Solar_Gradients_thumbnail.png and /dev/null differ