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

Fix display timer setting that was broken in previous update and optimize notification resizing

This commit is contained in:
chylex 2016-07-04 17:23:52 +02:00
parent 511e5c483c
commit a7e222f2e7
2 changed files with 38 additions and 13 deletions

View File

@ -34,8 +34,7 @@ private void InitializeComponent() {
//
// panelBrowser
//
this.panelBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.panelBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelBrowser.BackColor = System.Drawing.Color.White;
this.panelBrowser.Location = new System.Drawing.Point(0, 0);

View File

@ -28,6 +28,26 @@ sealed partial class FormNotification : Form{
private readonly bool autoHide;
private int timeLeft, totalTime;
private bool? prevDisplayTimer;
private int? prevFontSize;
private bool RequiresResize{
get{
return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Program.UserConfig.DisplayNotificationTimer || prevFontSize != TweetNotification.FontSizeLevel;
}
set{
if (value){
prevDisplayTimer = null;
prevFontSize = null;
}
else{
prevDisplayTimer = Program.UserConfig.DisplayNotificationTimer;
prevFontSize = TweetNotification.FontSizeLevel;
}
}
}
private readonly string notificationJS;
private readonly string pluginJS;
@ -218,24 +238,30 @@ private void LoadTweet(TweetNotification tweet){
}
private void MoveToVisibleLocation(){
bool needsReactivating = Location.X == -32000;
UserConfig config = Program.UserConfig;
Screen screen = Screen.FromControl(owner);
if (config.DisplayNotificationTimer){
ClientSize = new Size(BaseClientWidth,BaseClientHeight+4);
progressBarTimer.Visible = true;
}
else{
ClientSize = new Size(BaseClientWidth,BaseClientHeight);
progressBarTimer.Visible = false;
if (RequiresResize){
RequiresResize = false;
if (config.DisplayNotificationTimer){
ClientSize = new Size(BaseClientWidth,BaseClientHeight+4);
progressBarTimer.Visible = true;
}
else{
ClientSize = new Size(BaseClientWidth,BaseClientHeight);
progressBarTimer.Visible = false;
}
panelBrowser.Height = BaseClientHeight;
}
Screen screen = Screen.FromControl(owner);
if (config.NotificationDisplay > 0 && config.NotificationDisplay <= Screen.AllScreens.Length){
screen = Screen.AllScreens[config.NotificationDisplay-1];
}
bool needsReactivating = Location.X == -32000;
int edgeDist = config.NotificationEdgeDistance;
switch(config.NotificationPosition){