1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-04 17:34:07 +02:00

Increase notification timer height with higher DPI

This commit is contained in:
chylex 2017-10-31 23:10:08 +01:00
parent 1b92b112e2
commit d7e5f6876b
2 changed files with 10 additions and 11 deletions

View File

@ -89,14 +89,14 @@ protected virtual FormBorderStyle NotificationBorderStyle{
}
protected override bool ShowWithoutActivation => true;
protected double SizeScale => dpiScale*Program.UserConfig.ZoomMultiplier;
protected float DpiScale { get; }
protected double SizeScale => DpiScale*Program.UserConfig.ZoomMultiplier;
protected readonly FormBrowser owner;
protected readonly ChromiumWebBrowser browser;
private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
private readonly float dpiScale;
private TweetNotification currentNotification;
private int pauseCounter;
@ -132,7 +132,7 @@ protected FormNotificationBase(FormBrowser owner, bool enableContextMenu){
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
#endif
this.dpiScale = this.GetDPIScale();
DpiScale = this.GetDPIScale();
DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory;
handlerFactory.RegisterHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);

View File

@ -14,7 +14,7 @@
namespace TweetDuck.Core.Notification{
abstract partial class FormNotificationMain : FormNotificationBase{
private const string NotificationScriptFile = "notification.js";
private const int TimerBarHeight = 4;
private readonly int timerBarHeight;
private static readonly string NotificationScriptIdentifier = ScriptLoader.GetRootIdentifier(NotificationScriptFile);
private static readonly string NotificationJS = ScriptLoader.LoadResource(NotificationScriptFile);
@ -71,15 +71,14 @@ private int BaseClientHeight{
}
}
}
public Size BrowserSize => Program.UserConfig.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-timerBarHeight) : ClientSize;
public Size BrowserSize{
get => Program.UserConfig.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-TimerBarHeight) : ClientSize;
}
public FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
protected FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
InitializeComponent();
this.plugins = pluginManager;
this.timerBarHeight = BrowserUtils.Scale(4, DpiScale);
browser.KeyboardHandler = new KeyboardHandlerNotification(this);
@ -247,7 +246,7 @@ protected override void LoadTweet(TweetNotification tweet){
protected override void SetNotificationSize(int width, int height){
if (Program.UserConfig.DisplayNotificationTimer){
ClientSize = new Size(width, height+TimerBarHeight);
ClientSize = new Size(width, height+timerBarHeight);
progressBarTimer.Visible = true;
}
else{