1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-14 10:32:10 +02:00

Compare commits

..

8 Commits
1.6 ... 1.6.1

16 changed files with 134 additions and 109 deletions

View File

@@ -12,9 +12,9 @@ using TweetDck.Plugins;
namespace TweetDck.Configuration{ namespace TweetDck.Configuration{
[Serializable] [Serializable]
sealed class UserConfig{ sealed class UserConfig{
private static readonly IFormatter Formatter = new BinaryFormatter(); private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new CustomBinder() };
private const int CurrentFileVersion = 5; private const int CurrentFileVersion = 6;
// START OF CONFIGURATION // START OF CONFIGURATION
@@ -22,16 +22,15 @@ namespace TweetDck.Configuration{
public bool DisplayNotificationTimer { get; set; } public bool DisplayNotificationTimer { get; set; }
public bool NotificationTimerCountDown { get; set; } public bool NotificationTimerCountDown { get; set; }
public TweetNotification.Duration NotificationDuration { get; set; }
public TweetNotification.Position NotificationPosition { get; set; } public TweetNotification.Position NotificationPosition { get; set; }
public Point CustomNotificationPosition { get; set; } public Point CustomNotificationPosition { get; set; }
public int NotificationEdgeDistance { get; set; } public int NotificationEdgeDistance { get; set; }
public int NotificationDisplay { get; set; } public int NotificationDisplay { get; set; }
public int NotificationDurationValue { get; set; } public int NotificationDurationValue { get; set; }
public bool NotificationLegacyLoad { get; set; }
public bool EnableSpellCheck { get; set; } public bool EnableSpellCheck { get; set; }
public bool ExpandLinksOnHover { get; set; } public bool ExpandLinksOnHover { get; set; }
public bool ShowScreenshotBorder { get; set; }
public bool EnableTrayHighlight { get; set; } public bool EnableTrayHighlight { get; set; }
public bool EnableUpdateCheck { get; set; } public bool EnableUpdateCheck { get; set; }
@@ -113,13 +112,13 @@ namespace TweetDck.Configuration{
BrowserWindow = new WindowState(); BrowserWindow = new WindowState();
DisplayNotificationTimer = true; DisplayNotificationTimer = true;
NotificationDuration = TweetNotification.Duration.Medium;
NotificationPosition = TweetNotification.Position.TopRight; NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = ControlExtensions.InvisibleLocation; CustomNotificationPosition = ControlExtensions.InvisibleLocation;
NotificationEdgeDistance = 8; NotificationEdgeDistance = 8;
NotificationDurationValue = 25; NotificationDurationValue = 25;
EnableUpdateCheck = true; EnableUpdateCheck = true;
ExpandLinksOnHover = true; ExpandLinksOnHover = true;
ShowScreenshotBorder = true;
EnableTrayHighlight = true; EnableTrayHighlight = true;
Plugins = new PluginConfig(); Plugins = new PluginConfig();
PluginsWindow = new WindowState(); PluginsWindow = new WindowState();
@@ -154,14 +153,7 @@ namespace TweetDck.Configuration{
if (fileVersion == 3){ if (fileVersion == 3){
EnableTrayHighlight = true; EnableTrayHighlight = true;
NotificationDurationValue = 25;
switch(NotificationDuration){
case TweetNotification.Duration.Short: NotificationDurationValue = 15; break;
case TweetNotification.Duration.Medium: NotificationDurationValue = 25; break;
case TweetNotification.Duration.Long: NotificationDurationValue = 35; break;
case TweetNotification.Duration.VeryLong: NotificationDurationValue = 45; break;
}
++fileVersion; ++fileVersion;
} }
@@ -171,6 +163,11 @@ namespace TweetDck.Configuration{
++fileVersion; ++fileVersion;
} }
if (fileVersion == 5){
ShowScreenshotBorder = true;
++fileVersion;
}
// update the version // update the version
fileVersion = CurrentFileVersion; fileVersion = CurrentFileVersion;
Save(); Save();
@@ -241,5 +238,15 @@ namespace TweetDck.Configuration{
public static string GetBackupFile(string file){ public static string GetBackupFile(string file){
return file+".bak"; return file+".bak";
} }
private sealed class CustomBinder : SerializationBinder{
public override Type BindToType(string assemblyName, string typeName){
if (typeName == "TweetDck.Core.Handling.TweetNotification+Position"){
return typeof(TweetNotification.Position);
}
return null;
}
}
} }
} }

View File

@@ -117,12 +117,6 @@ namespace TweetDck.Core.Bridge{
}); });
} }
public void OnNotificationReady(){
if (!Program.UserConfig.NotificationLegacyLoad){
notification.InvokeSafe(notification.OnNotificationReady);
}
}
public void DisplayTooltip(string text, bool showInNotification){ public void DisplayTooltip(string text, bool showInNotification){
if (showInNotification){ if (showInNotification){
notification.InvokeSafe(() => notification.DisplayTooltip(text)); notification.InvokeSafe(() => notification.DisplayTooltip(text));
@@ -172,6 +166,10 @@ namespace TweetDck.Core.Bridge{
form.InvokeSafe(() => form.OnTweetScreenshotReady(html, width, height)); form.InvokeSafe(() => form.OnTweetScreenshotReady(html, width, height));
} }
public void FixClipboard(){
form.InvokeSafe(WindowsUtils.ClipboardStripHtmlStyles);
}
public void OpenBrowser(string url){ public void OpenBrowser(string url){
BrowserUtils.OpenExternalBrowser(url); BrowserUtils.OpenExternalBrowser(url);
} }

View File

@@ -30,6 +30,7 @@ namespace TweetDck.Core {
this.timerProgress = new System.Windows.Forms.Timer(this.components); this.timerProgress = new System.Windows.Forms.Timer(this.components);
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar(); this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout(); this.SuspendLayout();
// //
// panelBrowser // panelBrowser
@@ -61,6 +62,11 @@ namespace TweetDck.Core {
this.progressBarTimer.Size = new System.Drawing.Size(284, 4); this.progressBarTimer.Size = new System.Drawing.Size(284, 4);
this.progressBarTimer.TabIndex = 1; this.progressBarTimer.TabIndex = 1;
// //
// timerDisplayDelay
//
this.timerDisplayDelay.Interval = 17;
this.timerDisplayDelay.Tick += new System.EventHandler(this.timerDisplayDelay_Tick);
//
// FormNotification // FormNotification
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -88,5 +94,6 @@ namespace TweetDck.Core {
private Controls.FlatProgressBar progressBarTimer; private Controls.FlatProgressBar progressBarTimer;
private System.Windows.Forms.Timer timerProgress; private System.Windows.Forms.Timer timerProgress;
private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Timer timerDisplayDelay;
} }
} }

View File

@@ -85,7 +85,6 @@ namespace TweetDck.Core{
public string CurrentQuotedTweetUrl { get; set; } public string CurrentQuotedTweetUrl { get; set; }
public EventHandler Initialized; public EventHandler Initialized;
private bool isInitialized;
private int pauseCounter; private int pauseCounter;
private bool pausedDuringNotification; private bool pausedDuringNotification;
@@ -129,6 +128,7 @@ namespace TweetDck.Core{
#endif #endif
browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged; browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
browser.LoadingStateChanged += Browser_LoadingStateChanged;
browser.FrameLoadEnd += Browser_FrameLoadEnd; browser.FrameLoadEnd += Browser_FrameLoadEnd;
if (!flags.HasFlag(NotificationFlags.DisableScripts)){ if (!flags.HasFlag(NotificationFlags.DisableScripts)){
@@ -194,6 +194,11 @@ namespace TweetDck.Core{
// event handlers // event handlers
private void timerDisplayDelay_Tick(object sender, EventArgs e){
OnNotificationReady();
timerDisplayDelay.Stop();
}
private void timerHideProgress_Tick(object sender, EventArgs e){ private void timerHideProgress_Tick(object sender, EventArgs e){
if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen)return; if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen)return;
@@ -222,17 +227,17 @@ namespace TweetDck.Core{
} }
} }
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){ private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
if (!e.Frame.IsMain)return; if (!e.IsLoading && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.ManualDisplay)){
this.InvokeSafe(() => {
if (!isInitialized && !Program.UserConfig.NotificationLegacyLoad){ Visible = true; // ensures repaint before moving the window to a visible location
isInitialized = true; timerDisplayDelay.Start();
});
if (Initialized != null){
Initialized(this, new EventArgs());
}
} }
else if (notificationJS != null && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.DisableScripts)){ }
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
if (e.Frame.IsMain && notificationJS != null && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.DisableScripts)){
ScriptLoader.ExecuteScript(e.Frame, notificationJS, NotificationScriptIdentifier); ScriptLoader.ExecuteScript(e.Frame, notificationJS, NotificationScriptIdentifier);
if (plugins != null && plugins.HasAnyPlugin(PluginEnvironment.Notification)){ if (plugins != null && plugins.HasAnyPlugin(PluginEnvironment.Notification)){
@@ -282,7 +287,7 @@ namespace TweetDck.Core{
} }
public void HideNotification(bool loadBlank){ public void HideNotification(bool loadBlank){
if (loadBlank || Program.UserConfig.NotificationLegacyLoad){ if (loadBlank){
browser.LoadHtml("", "about:blank"); browser.LoadHtml("", "about:blank");
} }
@@ -294,12 +299,6 @@ namespace TweetDck.Core{
StopMouseHook(); StopMouseHook();
} }
public void OnNotificationReady(){
UpdateTitle();
PrepareAndDisplayWindow();
timerProgress.Start();
}
public void FinishCurrentTweet(){ public void FinishCurrentTweet(){
if (tweetQueue.Count > 0){ if (tweetQueue.Count > 0){
LoadNextNotification(); LoadNextNotification();
@@ -350,10 +349,6 @@ namespace TweetDck.Core{
string bodyClasses = browser.Bounds.Contains(PointToClient(Cursor.Position)) ? "td-hover" : string.Empty; string bodyClasses = browser.Bounds.Contains(PointToClient(Cursor.Position)) ? "td-hover" : string.Empty;
browser.LoadHtml(tweet.GenerateHtml(bodyClasses), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks); browser.LoadHtml(tweet.GenerateHtml(bodyClasses), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
if (Program.UserConfig.NotificationLegacyLoad){
OnNotificationReady();
}
} }
private void PrepareAndDisplayWindow(){ private void PrepareAndDisplayWindow(){
@@ -427,6 +422,12 @@ namespace TweetDck.Core{
Text = tweetQueue.Count > 0 ? Program.BrandName+" ("+tweetQueue.Count+" more left)" : Program.BrandName; Text = tweetQueue.Count > 0 ? Program.BrandName+" ("+tweetQueue.Count+" more left)" : Program.BrandName;
} }
protected void OnNotificationReady(){
UpdateTitle();
PrepareAndDisplayWindow();
timerProgress.Start();
}
public void DisplayTooltip(string text){ public void DisplayTooltip(string text){
if (string.IsNullOrEmpty(text)){ if (string.IsNullOrEmpty(text)){
toolTip.Hide(this); toolTip.Hide(this);

View File

@@ -7,6 +7,7 @@ namespace TweetDck.Core.Notification{
AutoHide = 1, AutoHide = 1,
DisableScripts = 2, DisableScripts = 2,
DisableContextMenu = 4, DisableContextMenu = 4,
TopMost = 8 TopMost = 8,
ManualDisplay = 16
} }
} }

View File

@@ -7,11 +7,7 @@ using TweetDck.Resources;
namespace TweetDck.Core.Notification.Screenshot{ namespace TweetDck.Core.Notification.Screenshot{
sealed class FormNotificationScreenshotable : FormNotification{ sealed class FormNotificationScreenshotable : FormNotification{
public FormNotificationScreenshotable(FormBrowser owner, NotificationFlags flags) : base(owner, null, flags){ public FormNotificationScreenshotable(Action callback, FormBrowser owner, NotificationFlags flags) : base(owner, null, flags){
UpdateTitle();
}
public void PrepareNotificationForScreenshot(Action callback){
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback)); browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
browser.FrameLoadEnd += (sender, args) => { browser.FrameLoadEnd += (sender, args) => {
@@ -19,12 +15,16 @@ namespace TweetDck.Core.Notification.Screenshot{
ScriptLoader.ExecuteScript(args.Frame, "window.setTimeout(() => $TD_NotificationScreenshot.trigger(), 25)", "gen:screenshot"); ScriptLoader.ExecuteScript(args.Frame, "window.setTimeout(() => $TD_NotificationScreenshot.trigger(), 25)", "gen:screenshot");
} }
}; };
UpdateTitle();
} }
public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){ public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){
browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks); browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
Location = ControlExtensions.InvisibleLocation; Location = ControlExtensions.InvisibleLocation;
FormBorderStyle = Program.UserConfig.ShowScreenshotBorder ? FormBorderStyle.FixedToolWindow : FormBorderStyle.None;
SetNotificationSize(width, height, false); SetNotificationSize(width, height, false);
} }

View File

@@ -1,7 +1,5 @@
using System; using System;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
namespace TweetDck.Core.Notification.Screenshot{ namespace TweetDck.Core.Notification.Screenshot{
@@ -13,12 +11,10 @@ namespace TweetDck.Core.Notification.Screenshot{
public TweetScreenshotManager(FormBrowser browser){ public TweetScreenshotManager(FormBrowser browser){
this.browser = browser; this.browser = browser;
this.screenshot = new FormNotificationScreenshotable(browser, NotificationFlags.DisableScripts | NotificationFlags.DisableContextMenu | NotificationFlags.TopMost){ this.screenshot = new FormNotificationScreenshotable(Callback, browser, NotificationFlags.DisableScripts | NotificationFlags.DisableContextMenu | NotificationFlags.TopMost | NotificationFlags.ManualDisplay){
CanMoveWindow = () => false CanMoveWindow = () => false
}; };
this.screenshot.PrepareNotificationForScreenshot(Callback);
this.timeout = WindowsUtils.CreateSingleTickTimer(10000); this.timeout = WindowsUtils.CreateSingleTickTimer(10000);
this.timeout.Tick += (sender, args) => screenshot.Reset(); this.timeout.Tick += (sender, args) => screenshot.Reset();
} }

View File

@@ -59,10 +59,6 @@ namespace TweetDck.Core.Notification{
TopLeft, TopRight, BottomLeft, BottomRight, Custom TopLeft, TopRight, BottomLeft, BottomRight, Custom
} }
public enum Duration{
Short, Medium, Long, VeryLong
}
public string Url{ public string Url{
get{ get{
return url; return url;

View File

@@ -29,6 +29,7 @@
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.checkTrayHighlight = new System.Windows.Forms.CheckBox(); this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
this.checkSpellCheck = new System.Windows.Forms.CheckBox(); this.checkSpellCheck = new System.Windows.Forms.CheckBox();
this.checkScreenshotBorder = new System.Windows.Forms.CheckBox();
this.groupTray = new System.Windows.Forms.GroupBox(); this.groupTray = new System.Windows.Forms.GroupBox();
this.labelTrayIcon = new System.Windows.Forms.Label(); this.labelTrayIcon = new System.Windows.Forms.Label();
this.groupInterface = new System.Windows.Forms.GroupBox(); this.groupInterface = new System.Windows.Forms.GroupBox();
@@ -87,12 +88,24 @@
this.checkSpellCheck.UseVisualStyleBackColor = true; this.checkSpellCheck.UseVisualStyleBackColor = true;
this.checkSpellCheck.CheckedChanged += new System.EventHandler(this.checkSpellCheck_CheckedChanged); this.checkSpellCheck.CheckedChanged += new System.EventHandler(this.checkSpellCheck_CheckedChanged);
// //
// checkScreenshotBorder
//
this.checkScreenshotBorder.AutoSize = true;
this.checkScreenshotBorder.Location = new System.Drawing.Point(9, 67);
this.checkScreenshotBorder.Name = "checkScreenshotBorder";
this.checkScreenshotBorder.Size = new System.Drawing.Size(169, 17);
this.checkScreenshotBorder.TabIndex = 16;
this.checkScreenshotBorder.Text = "Include Border In Screenshots";
this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots.");
this.checkScreenshotBorder.UseVisualStyleBackColor = true;
this.checkScreenshotBorder.CheckedChanged += new System.EventHandler(this.checkScreenshotBorder_CheckedChanged);
//
// groupTray // groupTray
// //
this.groupTray.Controls.Add(this.checkTrayHighlight); this.groupTray.Controls.Add(this.checkTrayHighlight);
this.groupTray.Controls.Add(this.labelTrayIcon); this.groupTray.Controls.Add(this.labelTrayIcon);
this.groupTray.Controls.Add(this.comboBoxTrayType); this.groupTray.Controls.Add(this.comboBoxTrayType);
this.groupTray.Location = new System.Drawing.Point(9, 86); this.groupTray.Location = new System.Drawing.Point(9, 109);
this.groupTray.Name = "groupTray"; this.groupTray.Name = "groupTray";
this.groupTray.Size = new System.Drawing.Size(183, 93); this.groupTray.Size = new System.Drawing.Size(183, 93);
this.groupTray.TabIndex = 15; this.groupTray.TabIndex = 15;
@@ -111,11 +124,12 @@
// //
// groupInterface // groupInterface
// //
this.groupInterface.Controls.Add(this.checkScreenshotBorder);
this.groupInterface.Controls.Add(this.checkSpellCheck); this.groupInterface.Controls.Add(this.checkSpellCheck);
this.groupInterface.Controls.Add(this.checkExpandLinks); this.groupInterface.Controls.Add(this.checkExpandLinks);
this.groupInterface.Location = new System.Drawing.Point(9, 9); this.groupInterface.Location = new System.Drawing.Point(9, 9);
this.groupInterface.Name = "groupInterface"; this.groupInterface.Name = "groupInterface";
this.groupInterface.Size = new System.Drawing.Size(183, 71); this.groupInterface.Size = new System.Drawing.Size(183, 90);
this.groupInterface.TabIndex = 16; this.groupInterface.TabIndex = 16;
this.groupInterface.TabStop = false; this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface"; this.groupInterface.Text = "User Interface";
@@ -146,5 +160,6 @@
private System.Windows.Forms.Label labelTrayIcon; private System.Windows.Forms.Label labelTrayIcon;
private System.Windows.Forms.CheckBox checkTrayHighlight; private System.Windows.Forms.CheckBox checkTrayHighlight;
private System.Windows.Forms.CheckBox checkSpellCheck; private System.Windows.Forms.CheckBox checkSpellCheck;
private System.Windows.Forms.CheckBox checkScreenshotBorder;
} }
} }

View File

@@ -14,6 +14,7 @@ namespace TweetDck.Core.Other.Settings{
checkExpandLinks.Checked = Config.ExpandLinksOnHover; checkExpandLinks.Checked = Config.ExpandLinksOnHover;
checkSpellCheck.Checked = Config.EnableSpellCheck; checkSpellCheck.Checked = Config.EnableSpellCheck;
checkScreenshotBorder.Checked = Config.ShowScreenshotBorder;
checkTrayHighlight.Checked = Config.EnableTrayHighlight; checkTrayHighlight.Checked = Config.EnableTrayHighlight;
} }
@@ -30,6 +31,12 @@ namespace TweetDck.Core.Other.Settings{
PromptRestart(); PromptRestart();
} }
private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.ShowScreenshotBorder = checkScreenshotBorder.Checked;
}
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){ private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
if (!Ready)return; if (!Ready)return;

View File

@@ -44,13 +44,12 @@
this.trackBarDuration = new System.Windows.Forms.TrackBar(); this.trackBarDuration = new System.Windows.Forms.TrackBar();
this.groupUserInterface = new System.Windows.Forms.GroupBox(); this.groupUserInterface = new System.Windows.Forms.GroupBox();
this.checkTimerCountDown = new System.Windows.Forms.CheckBox(); this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
this.checkLegacyLoad = new System.Windows.Forms.CheckBox();
this.checkNotificationTimer = new System.Windows.Forms.CheckBox(); this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.groupCustomSound = new System.Windows.Forms.GroupBox(); this.groupCustomSound = new System.Windows.Forms.GroupBox();
this.tbCustomSound = new System.Windows.Forms.TextBox();
this.btnBrowseSound = new System.Windows.Forms.Button();
this.btnResetSound = new System.Windows.Forms.Button(); this.btnResetSound = new System.Windows.Forms.Button();
this.btnBrowseSound = new System.Windows.Forms.Button();
this.tbCustomSound = new System.Windows.Forms.TextBox();
this.groupNotificationLocation.SuspendLayout(); this.groupNotificationLocation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
this.groupNotificationDuration.SuspendLayout(); this.groupNotificationDuration.SuspendLayout();
@@ -204,7 +203,7 @@
this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons); this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons);
this.groupNotificationDuration.Controls.Add(this.labelDurationValue); this.groupNotificationDuration.Controls.Add(this.labelDurationValue);
this.groupNotificationDuration.Controls.Add(this.trackBarDuration); this.groupNotificationDuration.Controls.Add(this.trackBarDuration);
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 106); this.groupNotificationDuration.Location = new System.Drawing.Point(9, 83);
this.groupNotificationDuration.Name = "groupNotificationDuration"; this.groupNotificationDuration.Name = "groupNotificationDuration";
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89); this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89);
this.groupNotificationDuration.TabIndex = 9; this.groupNotificationDuration.TabIndex = 9;
@@ -307,11 +306,10 @@
// groupUserInterface // groupUserInterface
// //
this.groupUserInterface.Controls.Add(this.checkTimerCountDown); this.groupUserInterface.Controls.Add(this.checkTimerCountDown);
this.groupUserInterface.Controls.Add(this.checkLegacyLoad);
this.groupUserInterface.Controls.Add(this.checkNotificationTimer); this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
this.groupUserInterface.Location = new System.Drawing.Point(9, 9); this.groupUserInterface.Location = new System.Drawing.Point(9, 9);
this.groupUserInterface.Name = "groupUserInterface"; this.groupUserInterface.Name = "groupUserInterface";
this.groupUserInterface.Size = new System.Drawing.Size(183, 91); this.groupUserInterface.Size = new System.Drawing.Size(183, 68);
this.groupUserInterface.TabIndex = 10; this.groupUserInterface.TabIndex = 10;
this.groupUserInterface.TabStop = false; this.groupUserInterface.TabStop = false;
this.groupUserInterface.Text = "General"; this.groupUserInterface.Text = "General";
@@ -328,19 +326,6 @@
this.checkTimerCountDown.UseVisualStyleBackColor = true; this.checkTimerCountDown.UseVisualStyleBackColor = true;
this.checkTimerCountDown.CheckedChanged += new System.EventHandler(this.checkTimerCountDown_CheckedChanged); this.checkTimerCountDown.CheckedChanged += new System.EventHandler(this.checkTimerCountDown_CheckedChanged);
// //
// checkLegacyLoad
//
this.checkLegacyLoad.AutoSize = true;
this.checkLegacyLoad.Location = new System.Drawing.Point(6, 67);
this.checkLegacyLoad.Name = "checkLegacyLoad";
this.checkLegacyLoad.Size = new System.Drawing.Size(139, 17);
this.checkLegacyLoad.TabIndex = 5;
this.checkLegacyLoad.Text = "Legacy Loading System";
this.toolTip.SetToolTip(this.checkLegacyLoad, "Try enabling if notifications do not display.\r\nMight cause delays and visual arti" +
"facts.");
this.checkLegacyLoad.UseVisualStyleBackColor = true;
this.checkLegacyLoad.CheckedChanged += new System.EventHandler(this.checkLegacyLoad_CheckedChanged);
//
// checkNotificationTimer // checkNotificationTimer
// //
this.checkNotificationTimer.AutoSize = true; this.checkNotificationTimer.AutoSize = true;
@@ -359,19 +344,24 @@
this.groupCustomSound.Controls.Add(this.btnResetSound); this.groupCustomSound.Controls.Add(this.btnResetSound);
this.groupCustomSound.Controls.Add(this.btnBrowseSound); this.groupCustomSound.Controls.Add(this.btnBrowseSound);
this.groupCustomSound.Controls.Add(this.tbCustomSound); this.groupCustomSound.Controls.Add(this.tbCustomSound);
this.groupCustomSound.Location = new System.Drawing.Point(9, 201); this.groupCustomSound.Location = new System.Drawing.Point(9, 178);
this.groupCustomSound.Name = "groupCustomSound"; this.groupCustomSound.Name = "groupCustomSound";
this.groupCustomSound.Size = new System.Drawing.Size(183, 72); this.groupCustomSound.Size = new System.Drawing.Size(183, 72);
this.groupCustomSound.TabIndex = 11; this.groupCustomSound.TabIndex = 11;
this.groupCustomSound.TabStop = false; this.groupCustomSound.TabStop = false;
this.groupCustomSound.Text = "Custom Sound"; this.groupCustomSound.Text = "Custom Sound";
// //
// tbCustomSound // btnResetSound
// //
this.tbCustomSound.Location = new System.Drawing.Point(6, 19); this.btnResetSound.AutoSize = true;
this.tbCustomSound.Name = "tbCustomSound"; this.btnResetSound.Location = new System.Drawing.Point(126, 43);
this.tbCustomSound.Size = new System.Drawing.Size(170, 20); this.btnResetSound.Name = "btnResetSound";
this.tbCustomSound.TabIndex = 0; this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnResetSound.Size = new System.Drawing.Size(51, 23);
this.btnResetSound.TabIndex = 2;
this.btnResetSound.Text = "Reset";
this.btnResetSound.UseVisualStyleBackColor = true;
this.btnResetSound.Click += new System.EventHandler(this.btnResetSound_Click);
// //
// btnBrowseSound // btnBrowseSound
// //
@@ -385,17 +375,12 @@
this.btnBrowseSound.UseVisualStyleBackColor = true; this.btnBrowseSound.UseVisualStyleBackColor = true;
this.btnBrowseSound.Click += new System.EventHandler(this.btnBrowseSound_Click); this.btnBrowseSound.Click += new System.EventHandler(this.btnBrowseSound_Click);
// //
// btnResetSound // tbCustomSound
// //
this.btnResetSound.AutoSize = true; this.tbCustomSound.Location = new System.Drawing.Point(6, 19);
this.btnResetSound.Location = new System.Drawing.Point(126, 43); this.tbCustomSound.Name = "tbCustomSound";
this.btnResetSound.Name = "btnResetSound"; this.tbCustomSound.Size = new System.Drawing.Size(170, 20);
this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.tbCustomSound.TabIndex = 0;
this.btnResetSound.Size = new System.Drawing.Size(51, 23);
this.btnResetSound.TabIndex = 2;
this.btnResetSound.Text = "Reset";
this.btnResetSound.UseVisualStyleBackColor = true;
this.btnResetSound.Click += new System.EventHandler(this.btnResetSound_Click);
// //
// TabSettingsNotifications // TabSettingsNotifications
// //
@@ -440,7 +425,6 @@
private System.Windows.Forms.CheckBox checkNotificationTimer; private System.Windows.Forms.CheckBox checkNotificationTimer;
private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Label labelEdgeDistanceValue; private System.Windows.Forms.Label labelEdgeDistanceValue;
private System.Windows.Forms.CheckBox checkLegacyLoad;
private System.Windows.Forms.CheckBox checkTimerCountDown; private System.Windows.Forms.CheckBox checkTimerCountDown;
private System.Windows.Forms.Label labelDurationValue; private System.Windows.Forms.Label labelDurationValue;
private System.Windows.Forms.TrackBar trackBarDuration; private System.Windows.Forms.TrackBar trackBarDuration;

View File

@@ -54,7 +54,6 @@ namespace TweetDck.Core.Other.Settings{
checkNotificationTimer.Checked = Config.DisplayNotificationTimer; checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
checkTimerCountDown.Enabled = checkNotificationTimer.Checked; checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
checkTimerCountDown.Checked = Config.NotificationTimerCountDown; checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
checkLegacyLoad.Checked = Config.NotificationLegacyLoad;
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance); trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px"; labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
@@ -153,12 +152,6 @@ namespace TweetDck.Core.Other.Settings{
notification.ShowNotificationForSettings(true); notification.ShowNotificationForSettings(true);
} }
private void checkLegacyLoad_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationLegacyLoad = checkLegacyLoad.Checked;
}
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){ private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
if (!Ready)return; if (!Ready)return;

View File

@@ -1,9 +1,13 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
namespace TweetDck.Core.Utils{ namespace TweetDck.Core.Utils{
static class WindowsUtils{ static class WindowsUtils{
private static readonly Regex RegexStripHtmlStyles = new Regex(@"\s?(?:style|class)="".*?""");
private static readonly Regex RegexOffsetClipboardHtml = new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)");
public static bool CheckFolderWritePermission(string path){ public static bool CheckFolderWritePermission(string path){
string testFile = Path.Combine(path, ".test"); string testFile = Path.Combine(path, ".test");
@@ -39,5 +43,19 @@ namespace TweetDck.Core.Utils{
timer.Tick += (sender, args) => timer.Stop(); timer.Tick += (sender, args) => timer.Stop();
return timer; return timer;
} }
public static void ClipboardStripHtmlStyles(){
if (!Clipboard.ContainsText(TextDataFormat.Html)){
return;
}
string original = Clipboard.GetText(TextDataFormat.Html);
string updated = RegexStripHtmlStyles.Replace(original, string.Empty);
int removed = original.Length-updated.Length;
updated = RegexOffsetClipboardHtml.Replace(updated, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
Clipboard.SetText(updated, TextDataFormat.Html);
}
} }
} }

View File

@@ -21,8 +21,8 @@ namespace TweetDck{
public const string BrandName = "TweetDuck"; public const string BrandName = "TweetDuck";
public const string Website = "https://tweetduck.chylex.com"; public const string Website = "https://tweetduck.chylex.com";
public const string VersionTag = "1.5.1"; public const string VersionTag = "1.6.1";
public const string VersionFull = "1.5.1.0"; public const string VersionFull = "1.6.1.0";
public static readonly Version Version = new Version(VersionTag); public static readonly Version Version = new Version(VersionTag);

View File

@@ -524,6 +524,13 @@
}); });
})(); })();
//
// Block: Work around clipboard HTML formatting.
//
$(document).on("copy", function(e){
window.setTimeout($TD.fixClipboard, 0);
});
// //
// Block: Inject custom CSS and layout into the page. // Block: Inject custom CSS and layout into the page.
// //

View File

@@ -146,9 +146,4 @@
document.body.addEventListener("mouseleave", function(){ document.body.addEventListener("mouseleave", function(){
document.body.classList.remove("td-hover"); document.body.classList.remove("td-hover");
}); });
})($TD);
//
// Block: Page fully loaded.
//
$TD.onNotificationReady();
})($TD);