Merge pull request #30 from Proopai/feature/7-Independent-preview-size-settings
#7 Ability for PerClientThumbnailSize added to configuration
This commit is contained in:
		
							
								
								
									
										18
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								README.md
									
									
									
									
									
								
							@@ -256,6 +256,24 @@ If a client does not appear in this list, then it will use the global highlight
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
**Hint** For a list of supported colors see: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color#properties
 | 
					**Hint** For a list of supported colors see: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color#properties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Per Client Thumbnail Size
 | 
				
			||||||
 | 
					Would you like to have different clients with different thumbnail sizes ?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EVE-O Preview doesn't provide any GUI to set the these per client overrides as yet. Though, It can be done via editing the configuration file directly. 
 | 
				
			||||||
 | 
					**Note** Don't forget to make a backup copy of the file before editing it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Open the file using any text editor. find the entry **PerClientThumbnailSize**. Most probably it will look like
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    "PerClientThumbnailSize": {
 | 
				
			||||||
 | 
					      "EVE - Example Toon 1": "240, 180",
 | 
				
			||||||
 | 
					      "EVE - Example Toon 2": "200, 100",
 | 
				
			||||||
 | 
					      "EVE": "320, 240"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You should modify this entry with a list of each of your clients replacing "Example Toon 1", etc with the name of your character. The values on the right represent the size of the thumbnail.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If a client does not appear in this list, then it will use the global thumbnail size by default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Compatibility Mode
 | 
					### Compatibility Mode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This setting allows to enable an alternate thumbnail render. This render doesn't use advanced DWM API to create live previews. Instead it is a screenshot-based render with the following pros and cons:
 | 
					This setting allows to enable an alternate thumbnail render. This render doesn't use advanced DWM API to create live previews. Instead it is a screenshot-based render with the following pros and cons:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,12 @@ namespace EveOPreview.Configuration.Implementation
 | 
				
			|||||||
				{"EVE - Example Toon 2", Color.Green}
 | 
									{"EVE - Example Toon 2", Color.Green}
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								this.PerClientThumbnailSize = new Dictionary<string, Size>
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									{"EVE - Example Toon 1", new Size(200, 200)},
 | 
				
			||||||
 | 
									{"EVE - Example Toon 2", new Size(200, 200)}
 | 
				
			||||||
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>();
 | 
								this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>();
 | 
				
			||||||
			this.FlatLayout = new Dictionary<string, Point>();
 | 
								this.FlatLayout = new Dictionary<string, Point>();
 | 
				
			||||||
			this.ClientLayout = new Dictionary<string, ClientLayout>();
 | 
								this.ClientLayout = new Dictionary<string, ClientLayout>();
 | 
				
			||||||
@@ -119,6 +125,9 @@ namespace EveOPreview.Configuration.Implementation
 | 
				
			|||||||
		[JsonProperty("PerClientActiveClientHighlightColor")]
 | 
							[JsonProperty("PerClientActiveClientHighlightColor")]
 | 
				
			||||||
		public Dictionary<string, Color> PerClientActiveClientHighlightColor { get; set; }
 | 
							public Dictionary<string, Color> PerClientActiveClientHighlightColor { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							[JsonProperty("PerClientThumbnailSize")]
 | 
				
			||||||
 | 
							public Dictionary<string, Size> PerClientThumbnailSize { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public bool MinimizeToTray { get; set; }
 | 
							public bool MinimizeToTray { get; set; }
 | 
				
			||||||
		public int ThumbnailRefreshPeriod { get; set; }
 | 
							public int ThumbnailRefreshPeriod { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -230,6 +239,12 @@ namespace EveOPreview.Configuration.Implementation
 | 
				
			|||||||
			return this.FlatLayout.TryGetValue(currentClient, out location) ? location : defaultLocation;
 | 
								return this.FlatLayout.TryGetValue(currentClient, out location) ? location : defaultLocation;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Size sizeOfThumbnail;
 | 
				
			||||||
 | 
								return this.PerClientThumbnailSize.TryGetValue(currentClient, out sizeOfThumbnail) ? sizeOfThumbnail : defaultSize;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void SetThumbnailLocation(string currentClient, string activeClient, Point location)
 | 
							public void SetThumbnailLocation(string currentClient, string activeClient, Point location)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Dictionary<string, Point> layoutSource;
 | 
								Dictionary<string, Point> layoutSource;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ namespace EveOPreview.Configuration
 | 
				
			|||||||
		Dictionary<string, int> CycleGroup2ClientsOrder { get; set; }
 | 
							Dictionary<string, int> CycleGroup2ClientsOrder { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Dictionary<string, Color> PerClientActiveClientHighlightColor { get; set; }
 | 
							Dictionary<string, Color> PerClientActiveClientHighlightColor { get; set; }
 | 
				
			||||||
 | 
							Dictionary<string, Size> PerClientThumbnailSize { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bool MinimizeToTray { get; set; }
 | 
							bool MinimizeToTray { get; set; }
 | 
				
			||||||
		int ThumbnailRefreshPeriod { get; set; }
 | 
							int ThumbnailRefreshPeriod { get; set; }
 | 
				
			||||||
@@ -60,6 +61,7 @@ namespace EveOPreview.Configuration
 | 
				
			|||||||
		Point LoginThumbnailLocation { get; set; }
 | 
							Point LoginThumbnailLocation { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation);
 | 
							Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation);
 | 
				
			||||||
 | 
							Size GetThumbnailSize(string currentClient, string activeClient, Size defaultSize);
 | 
				
			||||||
		void SetThumbnailLocation(string currentClient, string activeClient, Point location);
 | 
							void SetThumbnailLocation(string currentClient, string activeClient, Point location);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ClientLayout GetClientLayout(string currentClient);
 | 
							ClientLayout GetClientLayout(string currentClient);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
 | 
				
			|||||||
[assembly: AssemblyCulture("")]
 | 
					[assembly: AssemblyCulture("")]
 | 
				
			||||||
[assembly: ComVisible(false)]
 | 
					[assembly: ComVisible(false)]
 | 
				
			||||||
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
 | 
					[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
 | 
				
			||||||
[assembly: AssemblyVersion("8.0.1.1")]
 | 
					[assembly: AssemblyVersion("8.0.1.2")]
 | 
				
			||||||
[assembly: AssemblyFileVersion("8.0.1.1")]
 | 
					[assembly: AssemblyFileVersion("8.0.1.2")]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[assembly: CLSCompliant(false)]
 | 
					[assembly: CLSCompliant(false)]
 | 
				
			||||||
@@ -207,6 +207,12 @@ namespace EveOPreview.Services
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			foreach (IProcessInfo process in addedProcesses)
 | 
								foreach (IProcessInfo process in addedProcesses)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									Size initialSize = this._configuration.ThumbnailSize;
 | 
				
			||||||
 | 
									if (this._configuration.PerClientThumbnailSize.Any(x => x.Key == process.Title))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										initialSize = this._configuration.PerClientThumbnailSize[process.Title];
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				IThumbnailView view = this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize);
 | 
									IThumbnailView view = this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize);
 | 
				
			||||||
				view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
 | 
									view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
 | 
				
			||||||
				view.SetFrames(this._configuration.ShowThumbnailFrames);
 | 
									view.SetFrames(this._configuration.ShowThumbnailFrames);
 | 
				
			||||||
@@ -407,6 +413,7 @@ namespace EveOPreview.Services
 | 
				
			|||||||
					if (this.IsManageableThumbnail(view))
 | 
										if (this.IsManageableThumbnail(view))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation);
 | 
											view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation);
 | 
				
			||||||
 | 
											view.ThumbnailSize = this._configuration.GetThumbnailSize(view.Title, this._activeClient.Title, view.ThumbnailSize);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					view.SetOpacity(this._configuration.ThumbnailOpacity);
 | 
										view.SetOpacity(this._configuration.ThumbnailOpacity);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user