mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-24 23:34:05 +02:00
Refactor -32000 location to a static Point object
This commit is contained in:
parent
ae99fee440
commit
eb4ce18e31
@ -4,6 +4,7 @@
|
|||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using TweetDck.Core;
|
using TweetDck.Core;
|
||||||
|
using TweetDck.Core.Controls;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDck.Core.Handling;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDck.Plugins;
|
||||||
@ -45,7 +46,7 @@ sealed class UserConfig{
|
|||||||
|
|
||||||
public bool IsCustomNotificationPositionSet{
|
public bool IsCustomNotificationPositionSet{
|
||||||
get{
|
get{
|
||||||
return CustomNotificationPosition.X != -32000 && CustomNotificationPosition.X != 32000;
|
return CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ private UserConfig(string file){
|
|||||||
DisplayNotificationTimer = true;
|
DisplayNotificationTimer = true;
|
||||||
NotificationDuration = TweetNotification.Duration.Medium;
|
NotificationDuration = TweetNotification.Duration.Medium;
|
||||||
NotificationPosition = TweetNotification.Position.TopRight;
|
NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
CustomNotificationPosition = new Point(-32000, -32000);
|
CustomNotificationPosition = ControlExtensions.InvisibleLocation;
|
||||||
NotificationEdgeDistance = 8;
|
NotificationEdgeDistance = 8;
|
||||||
NotificationDurationValue = 25;
|
NotificationDurationValue = 25;
|
||||||
EnableUpdateCheck = true;
|
EnableUpdateCheck = true;
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDck.Core.Controls{
|
||||||
static class ControlExtensions{
|
static class ControlExtensions{
|
||||||
|
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
||||||
|
|
||||||
public static void InvokeSafe(this Control control, Action func){
|
public static void InvokeSafe(this Control control, Action func){
|
||||||
if (control.InvokeRequired){
|
if (control.InvokeRequired){
|
||||||
control.Invoke(func);
|
control.Invoke(func);
|
||||||
|
2
Core/FormBrowser.Designer.cs
generated
2
Core/FormBrowser.Designer.cs
generated
@ -38,7 +38,7 @@ private void InitializeComponent() {
|
|||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(324, 386);
|
this.ClientSize = new System.Drawing.Size(324, 386);
|
||||||
this.Icon = Properties.Resources.icon;
|
this.Icon = Properties.Resources.icon;
|
||||||
this.Location = new System.Drawing.Point(-32000, -32000);
|
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MinimumSize = new System.Drawing.Size(340, 424);
|
this.MinimumSize = new System.Drawing.Size(340, 424);
|
||||||
this.Name = "FormBrowser";
|
this.Name = "FormBrowser";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
|
@ -158,7 +158,7 @@ private void FormBrowser_Resize(object sender, EventArgs e){
|
|||||||
private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves
|
private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves
|
||||||
if (!isLoaded)return;
|
if (!isLoaded)return;
|
||||||
|
|
||||||
if (Location.X != -32000){
|
if (Location != ControlExtensions.InvisibleLocation){
|
||||||
Config.BrowserWindow.Save(this);
|
Config.BrowserWindow.Save(this);
|
||||||
Config.Save();
|
Config.Save();
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ public void OnTweetScreenshotReady(string html, int width, int height){
|
|||||||
prevNotificationLocation = notification.Location;
|
prevNotificationLocation = notification.Location;
|
||||||
prevFreezeTimer = notification.FreezeTimer;
|
prevFreezeTimer = notification.FreezeTimer;
|
||||||
|
|
||||||
notification.Location = new Point(-32000, -32000);
|
notification.Location = ControlExtensions.InvisibleLocation;
|
||||||
notification.FreezeTimer = true;
|
notification.FreezeTimer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
Core/FormNotification.Designer.cs
generated
2
Core/FormNotification.Designer.cs
generated
@ -70,7 +70,7 @@ private void InitializeComponent() {
|
|||||||
this.Controls.Add(this.progressBarTimer);
|
this.Controls.Add(this.progressBarTimer);
|
||||||
this.Controls.Add(this.panelBrowser);
|
this.Controls.Add(this.panelBrowser);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
this.Location = new System.Drawing.Point(-32000, -32000);
|
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormNotification";
|
this.Name = "FormNotification";
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
using TweetDck.Core.Utils.Notification;
|
using TweetDck.Core.Utils.Notification;
|
||||||
using TweetDck.Plugins;
|
using TweetDck.Plugins;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDck.Plugins.Enums;
|
||||||
|
using TweetDck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDck.Core{
|
||||||
sealed partial class FormNotification : Form{
|
sealed partial class FormNotification : Form{
|
||||||
@ -23,7 +24,7 @@ sealed partial class FormNotification : Form{
|
|||||||
|
|
||||||
public bool IsNotificationVisible{
|
public bool IsNotificationVisible{
|
||||||
get{
|
get{
|
||||||
return Location.X != -32000;
|
return Location != ControlExtensions.InvisibleLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +267,7 @@ public void ShowNotificationForScreenshot(TweetNotification tweet, int width, in
|
|||||||
|
|
||||||
browser.LoadHtml(tweet.GenerateHtml(false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
browser.LoadHtml(tweet.GenerateHtml(false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
||||||
|
|
||||||
Location = new Point(-32000, -32000);
|
Location = ControlExtensions.InvisibleLocation;
|
||||||
ClientSize = new Size(width, height);
|
ClientSize = new Size(width, height);
|
||||||
progressBarTimer.Visible = false;
|
progressBarTimer.Visible = false;
|
||||||
panelBrowser.Height = height;
|
panelBrowser.Height = height;
|
||||||
@ -285,7 +286,7 @@ public void HideNotification(bool loadBlank){
|
|||||||
browser.LoadHtml("", "about:blank");
|
browser.LoadHtml("", "about:blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
Location = new Point(-32000, -32000);
|
Location = ControlExtensions.InvisibleLocation;
|
||||||
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
||||||
timerProgress.Stop();
|
timerProgress.Stop();
|
||||||
totalTime = 0;
|
totalTime = 0;
|
||||||
@ -339,7 +340,7 @@ private void MoveToVisibleLocation(){
|
|||||||
screen = Screen.AllScreens[config.NotificationDisplay-1];
|
screen = Screen.AllScreens[config.NotificationDisplay-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needsReactivating = Location.X == -32000;
|
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
|
||||||
int edgeDist = config.NotificationEdgeDistance;
|
int edgeDist = config.NotificationEdgeDistance;
|
||||||
|
|
||||||
switch(config.NotificationPosition){
|
switch(config.NotificationPosition){
|
||||||
|
Loading…
Reference in New Issue
Block a user