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

Compare commits

...

39 Commits
1.7.1 ... 1.7.3

Author SHA1 Message Date
0f6a93ae8f Update verified badge style to fix it getting cut off when zoomed in 2017-04-22 00:10:25 +02:00
25eae334b0 Fix usernames being a bit too low 2017-04-22 00:01:50 +02:00
74377d01ce Hide broken tooltips in the TweetDeck menu 2017-04-21 23:54:19 +02:00
6e78ba1e7b Add forward/back mouse button handling to notifications (skip/close function) 2017-04-21 23:21:02 +02:00
39e0dedf27 Make magic WndProc values constants in NativeMethods 2017-04-21 22:42:57 +02:00
bbe2c88802 Fix TweetDeck logo on certain zoom levels 2017-04-21 22:05:55 +02:00
586b31b63e Show notification duration tooltip on the trackbar control too 2017-04-21 22:02:17 +02:00
041abe6d7e Add an option to change the zoom level 2017-04-21 22:01:56 +02:00
a69b3cd05f Fix the NO_HIDE_SCREENSHOTS debug flag not moving screenshot window into view 2017-04-21 21:43:53 +02:00
b48213e79e Fix a weird border in the scrollbar area of the column container 2017-04-21 20:58:39 +02:00
5bbc14aca5 Fix trackbar heights and Display combo box location in Notifications tab 2017-04-21 20:28:11 +02:00
8ccbf502e8 Fix a recent TweetDuck bug with a white bar on the bottom 2017-04-21 20:05:14 +02:00
c426ca97e2 Fix label position in Notifications tab in Settings 2017-04-21 20:02:34 +02:00
d9eef86a8b Increase screenshot timeout interval 2017-04-21 17:48:58 +02:00
3fed921748 Add exception handling to SoundPlayerImplWMP.Play 2017-04-20 19:37:18 +02:00
02827d53a2 Add a reset prompt to Notifications tab if custom location is out of view 2017-04-18 19:05:18 +02:00
1ad5fde9ae Fix broken custom notification location in Settings
Closes #118
2017-04-18 18:29:44 +02:00
909d5ed99c Move the check if a Form is not visible anywhere to ControlExtensions 2017-04-18 18:06:09 +02:00
b9096df218 Release 1.7.2 2017-04-15 23:42:31 +02:00
1137485c55 Fix not remembering position and not closing into tray when moved/closed before browser loads 2017-04-15 16:02:27 +02:00
61b1155a03 Completely rewrite all image pasting code 2017-04-15 14:29:55 +02:00
35624bcb1c Add some comments to code.js 2017-04-14 18:18:36 +02:00
6e262334ed Refactor -1 in hook to NativeMethods.HOOK_HANDLED & include example.html in project file 2017-04-14 14:24:37 +02:00
829d69485a Add an option to skip current notification when clicking a link inside it 2017-04-13 19:42:07 +02:00
0d32c168eb Fix invalid links (such as account names a tweet replied to) being clickable in notifications 2017-04-13 19:31:55 +02:00
38d6d93f65 Fix recently introduced crash when opening dev tools in notification window 2017-04-13 19:10:14 +02:00
9a280492c2 Refactor PropertyBridge and remove empty BaseTabSettings designer file 2017-04-13 18:09:07 +02:00
d49ee79c90 Increase height of Settings window 2017-04-13 17:41:49 +02:00
73b83af6b1 Remove an unused class from notification body element 2017-04-12 14:26:26 +02:00
064673ef23 Rewrite notification handling (better URL and duration handling, remove hacky code) 2017-04-12 00:56:28 +02:00
81bf93e5ab Use custom ResourceHandler for notifications and tweak notification code 2017-04-12 00:08:01 +02:00
26d5a8ce08 Remove debug code 2017-04-11 21:02:25 +02:00
c6f5c8d91f Fix notification duration not counting length of quoted tweets 2017-04-11 20:10:21 +02:00
63a1928468 Update mouse hook to respect nCode value and also to stop further processing 2017-04-10 17:55:50 +02:00
27c2aee8b9 Add tweet queue trimming when it exceeds a set size 2017-04-09 14:59:02 +02:00
5219d29aca Tweak child form handling in FormBrowser 2017-04-09 13:30:25 +02:00
84955352dd Why do I even bother with these comments 2017-04-09 03:23:19 +02:00
8e05c30063 Optimize memory usage of the emoji keyboard plugin 2017-04-08 23:57:07 +02:00
6f98bcafec Remove empty designer files 2017-04-08 14:02:16 +02:00
36 changed files with 520 additions and 343 deletions

View File

@@ -14,7 +14,7 @@ namespace TweetDck.Configuration{
sealed class UserConfig{ sealed class UserConfig{
private static readonly IFormatter Formatter = new BinaryFormatter(); private static readonly IFormatter Formatter = new BinaryFormatter();
private const int CurrentFileVersion = 7; private const int CurrentFileVersion = 8;
// START OF CONFIGURATION // START OF CONFIGURATION
@@ -22,6 +22,7 @@ namespace TweetDck.Configuration{
public bool DisplayNotificationColumn { get; set; } public bool DisplayNotificationColumn { get; set; }
public bool DisplayNotificationTimer { get; set; } public bool DisplayNotificationTimer { get; set; }
public bool NotificationTimerCountDown { get; set; } public bool NotificationTimerCountDown { get; set; }
public bool NotificationSkipOnLinkClick { get; set; }
public bool NotificationNonIntrusiveMode { get; set; } public bool NotificationNonIntrusiveMode { get; set; }
public TweetNotification.Position NotificationPosition { get; set; } public TweetNotification.Position NotificationPosition { get; set; }
@@ -67,6 +68,28 @@ namespace TweetDck.Configuration{
} }
} }
public int ZoomLevel{
get{
return zoomLevel;
}
set{
if (zoomLevel == value)return;
zoomLevel = value;
if (ZoomLevelChanged != null){
ZoomLevelChanged(this, new EventArgs());
}
}
}
public double ZoomMultiplier{
get{
return zoomLevel/100.0;
}
}
public string NotificationSoundPath{ public string NotificationSoundPath{
get{ get{
return string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath; return string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
@@ -98,6 +121,9 @@ namespace TweetDck.Configuration{
[field:NonSerialized] [field:NonSerialized]
public event EventHandler MuteToggled; public event EventHandler MuteToggled;
[field:NonSerialized]
public event EventHandler ZoomLevelChanged;
[field:NonSerialized] [field:NonSerialized]
public event EventHandler TrayBehaviorChanged; public event EventHandler TrayBehaviorChanged;
@@ -106,6 +132,7 @@ namespace TweetDck.Configuration{
private int fileVersion; private int fileVersion;
private bool muteNotifications; private bool muteNotifications;
private int zoomLevel;
private string notificationSoundPath; private string notificationSoundPath;
private TrayIcon.Behavior trayBehavior; private TrayIcon.Behavior trayBehavior;
@@ -113,6 +140,7 @@ namespace TweetDck.Configuration{
this.file = file; this.file = file;
BrowserWindow = new WindowState(); BrowserWindow = new WindowState();
ZoomLevel = 100;
DisplayNotificationTimer = true; DisplayNotificationTimer = true;
NotificationNonIntrusiveMode = true; NotificationNonIntrusiveMode = true;
NotificationPosition = TweetNotification.Position.TopRight; NotificationPosition = TweetNotification.Position.TopRight;
@@ -174,6 +202,11 @@ namespace TweetDck.Configuration{
++fileVersion; ++fileVersion;
} }
if (fileVersion == 7){
ZoomLevel = 100;
++fileVersion;
}
// update the version // update the version
fileVersion = CurrentFileVersion; fileVersion = CurrentFileVersion;
Save(); Save();

View File

@@ -8,10 +8,12 @@ namespace TweetDck.Core.Bridge{
ExpandLinksOnHover = 1, ExpandLinksOnHover = 1,
MuteNotifications = 2, MuteNotifications = 2,
HasCustomNotificationSound = 4, HasCustomNotificationSound = 4,
All = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound SkipOnLinkClick = 8,
AllBrowser = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound,
AllNotification = ExpandLinksOnHover | SkipOnLinkClick
} }
public static string GenerateScript(Properties properties = Properties.All){ public static string GenerateScript(Properties properties){
StringBuilder build = new StringBuilder(); StringBuilder build = new StringBuilder();
build.Append("(function(c){"); build.Append("(function(c){");
@@ -27,6 +29,10 @@ namespace TweetDck.Core.Bridge{
build.Append("c.hasCustomNotificationSound=").Append(Program.UserConfig.NotificationSoundPath.Length > 0 ? "true;" : "false;"); build.Append("c.hasCustomNotificationSound=").Append(Program.UserConfig.NotificationSoundPath.Length > 0 ? "true;" : "false;");
} }
if (properties.HasFlag(Properties.SkipOnLinkClick)){
build.Append("c.skipOnLinkClick=").Append(Program.UserConfig.NotificationSkipOnLinkClick ? "true;" : "false;");
}
build.Append("})(window.$TDX=window.$TDX||{})"); build.Append("})(window.$TDX=window.$TDX||{})");
return build.ToString(); return build.ToString();
} }

View File

@@ -1,8 +1,4 @@
using System; using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Notification; using TweetDck.Core.Notification;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
@@ -12,10 +8,9 @@ namespace TweetDck.Core.Bridge{
public static string LastRightClickedLink = string.Empty; public static string LastRightClickedLink = string.Empty;
public static string LastHighlightedTweet = string.Empty; public static string LastHighlightedTweet = string.Empty;
public static string LastHighlightedQuotedTweet = string.Empty; public static string LastHighlightedQuotedTweet = string.Empty;
public static string ClipboardImagePath = string.Empty;
public static void ResetStaticProperties(){ public static void ResetStaticProperties(){
LastRightClickedLink = LastHighlightedTweet = LastHighlightedQuotedTweet = ClipboardImagePath = string.Empty; LastRightClickedLink = LastHighlightedTweet = LastHighlightedQuotedTweet = string.Empty;
} }
private readonly FormBrowser form; private readonly FormBrowser form;
@@ -49,18 +44,14 @@ namespace TweetDck.Core.Bridge{
}); });
} }
public void SetNotificationQuotedTweet(string link){
notification.InvokeAsyncSafe(() => notification.CurrentQuotedTweetUrl = link);
}
public void OpenContextMenu(){ public void OpenContextMenu(){
form.InvokeAsyncSafe(form.OpenContextMenu); form.InvokeAsyncSafe(form.OpenContextMenu);
} }
public void OnTweetPopup(string columnName, string tweetHtml, string tweetUrl, int tweetCharacters){ public void OnTweetPopup(string columnName, string tweetHtml, int tweetCharacters, string tweetUrl, string quoteUrl){
notification.InvokeAsyncSafe(() => { notification.InvokeAsyncSafe(() => {
form.OnTweetNotification(); form.OnTweetNotification();
notification.ShowNotification(new TweetNotification(columnName, tweetHtml, tweetUrl, tweetCharacters)); notification.ShowNotification(new TweetNotification(columnName, tweetHtml, tweetCharacters, tweetUrl, quoteUrl));
}); });
} }
@@ -84,30 +75,6 @@ namespace TweetDck.Core.Bridge{
notification.InvokeAsyncSafe(notification.FinishCurrentNotification); notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
} }
public void TryPasteImage(){
form.InvokeSafe(() => {
if (Clipboard.ContainsImage()){
Image img = Clipboard.GetImage();
if (img == null)return;
try{
Directory.CreateDirectory(Program.TemporaryPath);
ClipboardImagePath = Path.Combine(Program.TemporaryPath, "TD-Img-"+DateTime.Now.Ticks+".png");
img.Save(ClipboardImagePath, ImageFormat.Png);
form.OnImagePasted();
}catch(Exception e){
Program.Reporter.HandleException("Clipboard Image Error", "Could not paste image from clipboard.", true, e);
}
}
});
}
public void ClickUploadImage(int offsetX, int offsetY){
form.InvokeAsyncSafe(() => form.TriggerImageUpload(offsetX, offsetY));
}
public void ScreenshotTweet(string html, int width, int height){ public void ScreenshotTweet(string html, int width, int height){
form.InvokeAsyncSafe(() => form.OnTweetScreenshotReady(html, width, height)); form.InvokeAsyncSafe(() => form.OnTweetScreenshotReady(html, width, height));
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
@@ -20,6 +21,10 @@ namespace TweetDck.Core.Controls{
control.BeginInvoke(func); control.BeginInvoke(func);
} }
public static bool IsFullyOutsideView(this Form form){
return !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds));
}
public static void MoveToCenter(this Form targetForm, Form parentForm){ public static void MoveToCenter(this Form targetForm, Form parentForm){
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2); targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
} }

View File

@@ -1,3 +0,0 @@
namespace TweetDck.Core.Controls{
partial class FlatProgressBar{}
}

View File

@@ -2,7 +2,7 @@
using System.Windows.Forms; using System.Windows.Forms;
namespace TweetDck.Core.Controls{ namespace TweetDck.Core.Controls{
sealed partial class FlatProgressBar : ProgressBar{ sealed class FlatProgressBar : ProgressBar{
private readonly SolidBrush brush; private readonly SolidBrush brush;
public FlatProgressBar(){ public FlatProgressBar(){

View File

@@ -1,3 +0,0 @@
namespace TweetDck.Core.Controls{
partial class TabButton{}
}

View File

@@ -3,7 +3,7 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace TweetDck.Core.Controls{ namespace TweetDck.Core.Controls{
sealed partial class TabButton : FlatButton{ sealed class TabButton : FlatButton{
public Action Callback { get; private set; } public Action Callback { get; private set; }
public void SetupButton(int locationX, int sizeWidth, string title, Action callback){ public void SetupButton(int locationX, int sizeWidth, string title, Action callback){

View File

@@ -18,6 +18,7 @@ using TweetDck.Core.Notification;
using TweetDck.Core.Notification.Screenshot; using TweetDck.Core.Notification.Screenshot;
using TweetDck.Updates.Events; using TweetDck.Updates.Events;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using TweetDck.Core.Notification.Sound; using TweetDck.Core.Notification.Sound;
namespace TweetDck.Core{ namespace TweetDck.Core{
@@ -36,11 +37,8 @@ namespace TweetDck.Core{
private readonly FormNotificationTweet notification; private readonly FormNotificationTweet notification;
private readonly ContextMenu contextMenu; private readonly ContextMenu contextMenu;
private FormSettings currentFormSettings;
private FormAbout currentFormAbout;
private FormPlugins currentFormPlugins;
private bool isLoaded; private bool isLoaded;
private bool isBrowserReady;
private FormWindowState prevState; private FormWindowState prevState;
private TweetScreenshotManager notificationScreenshotManager; private TweetScreenshotManager notificationScreenshotManager;
@@ -69,7 +67,6 @@ namespace TweetDck.Core{
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){ this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
MenuHandler = new ContextMenuBrowser(this), MenuHandler = new ContextMenuBrowser(this),
DialogHandler = new FileDialogHandler(this),
JsDialogHandler = new JavaScriptDialogHandler(), JsDialogHandler = new JavaScriptDialogHandler(),
LifeSpanHandler = new LifeSpanHandler() LifeSpanHandler = new LifeSpanHandler()
}; };
@@ -112,6 +109,7 @@ namespace TweetDck.Core{
UpdateTrayIcon(); UpdateTrayIcon();
Config.MuteToggled += Config_MuteToggled; Config.MuteToggled += Config_MuteToggled;
Config.ZoomLevelChanged += Config_ZoomLevelChanged;
this.updates = new UpdateHandler(browser, this, updaterSettings); this.updates = new UpdateHandler(browser, this, updaterSettings);
this.updates.UpdateAccepted += updates_UpdateAccepted; this.updates.UpdateAccepted += updates_UpdateAccepted;
@@ -120,6 +118,16 @@ namespace TweetDck.Core{
RestoreWindow(); RestoreWindow();
} }
private bool TryBringToFront<T>() where T : Form{
T form = Application.OpenForms.OfType<T>().FirstOrDefault();
if (form != null){
form.BringToFront();
return true;
}
else return false;
}
private void ShowChildForm(Form form){ private void ShowChildForm(Form form){
form.VisibleChanged += (sender, args) => form.MoveToCenter(this); form.VisibleChanged += (sender, args) => form.MoveToCenter(this);
form.Show(this); form.Show(this);
@@ -135,13 +143,14 @@ namespace TweetDck.Core{
private void RestoreWindow(){ private void RestoreWindow(){
Config.BrowserWindow.Restore(this, true); Config.BrowserWindow.Restore(this, true);
prevState = WindowState; prevState = WindowState;
isLoaded = true;
} }
private void OnLoaded(){ private void OnBrowserReady(){
if (!isLoaded){ if (!isBrowserReady){
browser.Location = Point.Empty; browser.Location = Point.Empty;
browser.Dock = DockStyle.Fill; browser.Dock = DockStyle.Fill;
isLoaded = true; isBrowserReady = true;
} }
} }
@@ -157,14 +166,20 @@ namespace TweetDck.Core{
browser.AddWordToDictionary(word); browser.AddWordToDictionary(word);
} }
BeginInvoke(new Action(OnLoaded)); BeginInvoke(new Action(OnBrowserReady));
browser.LoadingStateChanged -= browser_LoadingStateChanged; browser.LoadingStateChanged -= browser_LoadingStateChanged;
} }
} }
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){ private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
if (e.Frame.IsMain && BrowserUtils.IsTwitterWebsite(e.Frame)){ if (e.Frame.IsMain){
ScriptLoader.ExecuteFile(e.Frame, "twitter.js"); if (Config.ZoomLevel != 100){
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
}
if (BrowserUtils.IsTwitterWebsite(e.Frame)){
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
}
} }
} }
@@ -172,7 +187,7 @@ namespace TweetDck.Core{
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){ if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
e.Frame.ExecuteJavaScriptAsync(BrowserUtils.BackgroundColorFix); e.Frame.ExecuteJavaScriptAsync(BrowserUtils.BackgroundColorFix);
UpdateProperties(); UpdateProperties(PropertyBridge.Properties.AllBrowser);
ScriptLoader.ExecuteFile(e.Frame, "code.js"); ScriptLoader.ExecuteFile(e.Frame, "code.js");
ReinjectCustomCSS(Config.CustomBrowserCSS); ReinjectCustomCSS(Config.CustomBrowserCSS);
@@ -245,6 +260,10 @@ namespace TweetDck.Core{
UpdateProperties(PropertyBridge.Properties.MuteNotifications); UpdateProperties(PropertyBridge.Properties.MuteNotifications);
} }
private void Config_ZoomLevelChanged(object sender, EventArgs e){
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
}
private void Config_TrayBehaviorChanged(object sender, EventArgs e){ private void Config_TrayBehaviorChanged(object sender, EventArgs e){
UpdateTrayIcon(); UpdateTrayIcon();
} }
@@ -321,7 +340,7 @@ namespace TweetDck.Core{
return; return;
} }
if (isLoaded && m.Msg == 0x210 && (m.WParam.ToInt32() & 0xFFFF) == 0x020B){ // WM_PARENTNOTIFY, WM_XBUTTONDOWN if (isBrowserReady && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN){
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF); browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
return; return;
} }
@@ -349,7 +368,7 @@ namespace TweetDck.Core{
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css == null ? string.Empty : css.Replace(Environment.NewLine, " ")); browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css == null ? string.Empty : css.Replace(Environment.NewLine, " "));
} }
public void UpdateProperties(PropertyBridge.Properties properties = PropertyBridge.Properties.All){ public void UpdateProperties(PropertyBridge.Properties properties){
browser.ExecuteScriptAsync(PropertyBridge.GenerateScript(properties)); browser.ExecuteScriptAsync(PropertyBridge.GenerateScript(properties));
} }
@@ -368,17 +387,12 @@ namespace TweetDck.Core{
} }
public void OpenSettings(int tabIndex){ public void OpenSettings(int tabIndex){
if (currentFormSettings != null){ if (!TryBringToFront<FormSettings>()){
currentFormSettings.BringToFront();
}
else{
bool prevEnableUpdateCheck = Config.EnableUpdateCheck; bool prevEnableUpdateCheck = Config.EnableUpdateCheck;
currentFormSettings = new FormSettings(this, plugins, updates, tabIndex); FormSettings form = new FormSettings(this, plugins, updates, tabIndex);
currentFormSettings.FormClosed += (sender, args) => {
currentFormSettings = null;
form.FormClosed += (sender, args) => {
if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){ if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){
updates.DismissUpdate(string.Empty); updates.DismissUpdate(string.Empty);
updates.Check(false); updates.Check(false);
@@ -389,31 +403,22 @@ namespace TweetDck.Core{
} }
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound); UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound);
form.Dispose();
}; };
ShowChildForm(currentFormSettings); ShowChildForm(form);
} }
} }
public void OpenAbout(){ public void OpenAbout(){
if (currentFormAbout != null){ if (!TryBringToFront<FormAbout>()){
currentFormAbout.BringToFront(); ShowChildForm(new FormAbout());
}
else{
currentFormAbout = new FormAbout();
currentFormAbout.FormClosed += (sender, args) => currentFormAbout = null;
ShowChildForm(currentFormAbout);
} }
} }
public void OpenPlugins(){ public void OpenPlugins(){
if (currentFormPlugins != null){ if (!TryBringToFront<FormPlugins>()){
currentFormPlugins.BringToFront(); ShowChildForm(new FormPlugins(plugins));
}
else{
currentFormPlugins = new FormPlugins(plugins);
currentFormPlugins.FormClosed += (sender, args) => currentFormPlugins = null;
ShowChildForm(currentFormPlugins);
} }
} }
@@ -455,16 +460,6 @@ namespace TweetDck.Core{
} }
} }
public void OnImagePasted(){
browser.ExecuteScriptAsync("TDGF_tryPasteImage()");
}
public void TriggerImageUpload(int offsetX, int offsetY){
IBrowserHost host = browser.GetBrowser().GetHost();
host.SendMouseClickEvent(offsetX, offsetY, MouseButtonType.Left, false, 1, CefEventFlags.None);
host.SendMouseClickEvent(offsetX, offsetY, MouseButtonType.Left, true, 1, CefEventFlags.None);
}
public void TriggerTweetScreenshot(){ public void TriggerTweetScreenshot(){
browser.ExecuteScriptAsync("TDGF_triggerScreenshot()"); browser.ExecuteScriptAsync("TDGF_triggerScreenshot()");
} }

View File

@@ -33,10 +33,10 @@ namespace TweetDck.Core.Handling{
model.SetChecked((CefMenuCommand)MenuFreeze, form.FreezeTimer); model.SetChecked((CefMenuCommand)MenuFreeze, form.FreezeTimer);
model.AddSeparator(); model.AddSeparator();
if (!string.IsNullOrEmpty(form.CurrentUrl)){ if (!string.IsNullOrEmpty(form.CurrentTweetUrl)){
model.AddItem((CefMenuCommand)MenuCopyTweetUrl, "Copy tweet address"); model.AddItem((CefMenuCommand)MenuCopyTweetUrl, "Copy tweet address");
if (!string.IsNullOrEmpty(form.CurrentQuotedTweetUrl)){ if (!string.IsNullOrEmpty(form.CurrentQuoteUrl)){
model.AddItem((CefMenuCommand)MenuCopyQuotedTweetUrl, "Copy quoted tweet address"); model.AddItem((CefMenuCommand)MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
} }
@@ -68,11 +68,11 @@ namespace TweetDck.Core.Handling{
return true; return true;
case MenuCopyTweetUrl: case MenuCopyTweetUrl:
SetClipboardText(form.CurrentUrl); SetClipboardText(form.CurrentTweetUrl);
return true; return true;
case MenuCopyQuotedTweetUrl: case MenuCopyQuotedTweetUrl:
SetClipboardText(form.CurrentQuotedTweetUrl); SetClipboardText(form.CurrentQuoteUrl);
return true; return true;
} }

View File

@@ -1,28 +0,0 @@
using CefSharp;
using System.Collections.Generic;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
namespace TweetDck.Core.Handling{
class FileDialogHandler : IDialogHandler{
private readonly FormBrowser form;
public FileDialogHandler(FormBrowser form){
this.form = form;
}
public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List<string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback){
if (!string.IsNullOrEmpty(TweetDeckBridge.ClipboardImagePath)){
callback.Continue(selectedAcceptFilter, new List<string>{ TweetDeckBridge.ClipboardImagePath });
form.InvokeSafe(() => {
TweetDeckBridge.ClipboardImagePath = string.Empty;
});
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,66 @@
using CefSharp;
using System.Collections.Specialized;
using System.IO;
using System.Text;
namespace TweetDck.Core.Handling{
class ResourceHandlerNotification : IResourceHandler{
private readonly NameValueCollection headers = new NameValueCollection(0);
private MemoryStream dataIn;
public void SetHTML(string html){
if (dataIn != null){
dataIn.Dispose();
}
dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8);
}
public void Dispose(){
if (dataIn != null){
dataIn.Dispose();
dataIn = null;
}
}
bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback){
callback.Continue();
return true;
}
void IResourceHandler.GetResponseHeaders(IResponse response, out long responseLength, out string redirectUrl){
redirectUrl = null;
response.MimeType = "text/html";
response.StatusCode = 200;
response.StatusText = "OK";
response.ResponseHeaders = headers;
responseLength = dataIn != null ? dataIn.Length : -1;
}
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){
callback.Dispose();
try{
int length = (int)dataIn.Length;
dataIn.CopyTo(dataOut, length);
bytesRead = length;
return true;
}catch{ // catch IOException, possibly NullReferenceException if dataIn is null
bytesRead = 0;
return false;
}
}
bool IResourceHandler.CanGetCookie(Cookie cookie){
return true;
}
bool IResourceHandler.CanSetCookie(Cookie cookie){
return true;
}
void IResourceHandler.Cancel(){}
}
}

View File

@@ -71,6 +71,8 @@ namespace TweetDck.Core.Notification{
protected readonly Form owner; protected readonly Form owner;
protected readonly ChromiumWebBrowser browser; protected readonly ChromiumWebBrowser browser;
private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
private string currentColumn; private string currentColumn;
private int pauseCounter; private int pauseCounter;
@@ -88,8 +90,8 @@ namespace TweetDck.Core.Notification{
public bool FreezeTimer { get; set; } public bool FreezeTimer { get; set; }
public bool ContextMenuOpen { get; set; } public bool ContextMenuOpen { get; set; }
public string CurrentUrl { get; private set; } public string CurrentTweetUrl { get; private set; }
public string CurrentQuotedTweetUrl { get; set; } public string CurrentQuoteUrl { get; private set; }
public event EventHandler Initialized; public event EventHandler Initialized;
@@ -106,12 +108,14 @@ namespace TweetDck.Core.Notification{
this.browser.Dock = DockStyle.None; this.browser.Dock = DockStyle.None;
this.browser.ClientSize = ClientSize; this.browser.ClientSize = ClientSize;
this.browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
#if DEBUG #if DEBUG
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage; this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
#endif #endif
this.browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged; DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory;
handlerFactory.RegisterHandler("https://tweetdeck.twitter.com", this.resourceHandler);
Controls.Add(browser); Controls.Add(browser);
@@ -148,7 +152,7 @@ namespace TweetDck.Core.Notification{
public virtual void HideNotification(bool loadBlank){ public virtual void HideNotification(bool loadBlank){
if (loadBlank){ if (loadBlank){
browser.LoadHtml("", "about:blank"); browser.Load("about:blank");
} }
Location = ControlExtensions.InvisibleLocation; Location = ControlExtensions.InvisibleLocation;
@@ -175,23 +179,16 @@ namespace TweetDck.Core.Notification{
} }
protected virtual void LoadTweet(TweetNotification tweet){ protected virtual void LoadTweet(TweetNotification tweet){
CurrentUrl = tweet.Url; CurrentTweetUrl = tweet.TweetUrl;
CurrentQuotedTweetUrl = string.Empty; // load from JS CurrentQuoteUrl = tweet.QuoteUrl;
currentColumn = tweet.Column; currentColumn = tweet.Column;
browser.LoadHtml(GetTweetHTML(tweet), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
resourceHandler.SetHTML(GetTweetHTML(tweet));
browser.Load("https://tweetdeck.twitter.com");
} }
protected virtual void SetNotificationSize(int width, int height){ protected virtual void SetNotificationSize(int width, int height){
browser.ClientSize = ClientSize = new Size(width, height); browser.ClientSize = ClientSize = new Size((int)Math.Round(width*Program.UserConfig.ZoomMultiplier), (int)Math.Round(height*Program.UserConfig.ZoomMultiplier));
}
protected void MoveToVisibleLocation(){
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
Location = PrimaryLocation;
if (needsReactivating){
NativeMethods.SetFormPos(this, NativeMethods.HWND_TOPMOST, NativeMethods.SWP_NOACTIVATE);
}
} }
protected virtual void OnNotificationReady(){ protected virtual void OnNotificationReady(){
@@ -202,6 +199,15 @@ namespace TweetDck.Core.Notification{
Text = string.IsNullOrEmpty(currentColumn) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumn; Text = string.IsNullOrEmpty(currentColumn) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumn;
} }
public void MoveToVisibleLocation(){
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
Location = PrimaryLocation;
if (needsReactivating){
NativeMethods.SetFormPos(this, NativeMethods.HWND_TOPMOST, NativeMethods.SWP_NOACTIVATE);
}
}
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

@@ -26,14 +26,16 @@ namespace TweetDck.Core.Notification{
private static int BaseClientWidth{ private static int BaseClientWidth{
get{ get{
int level = TweetNotification.FontSizeLevel; int level = TweetNotification.FontSizeLevel;
return level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level)); int width = level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level));
return (int)Math.Round(width*Program.UserConfig.ZoomMultiplier);
} }
} }
private static int BaseClientHeight{ private static int BaseClientHeight{
get{ get{
int level = TweetNotification.FontSizeLevel; int level = TweetNotification.FontSizeLevel;
return level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level)); int height = level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level));
return (int)Math.Round(height*Program.UserConfig.ZoomMultiplier);
} }
} }
@@ -44,6 +46,7 @@ namespace TweetDck.Core.Notification{
private readonly NativeMethods.HookProc mouseHookDelegate; private readonly NativeMethods.HookProc mouseHookDelegate;
private IntPtr mouseHook; private IntPtr mouseHook;
private bool blockXButtonUp;
private bool? prevDisplayTimer; private bool? prevDisplayTimer;
private int? prevFontSize; private int? prevFontSize;
@@ -77,7 +80,7 @@ namespace TweetDck.Core.Notification{
browser.FrameLoadEnd += Browser_FrameLoadEnd; browser.FrameLoadEnd += Browser_FrameLoadEnd;
mouseHookDelegate = MouseHookProc; mouseHookDelegate = MouseHookProc;
Disposed += (sender, args) => StopMouseHook(); Disposed += (sender, args) => StopMouseHook(true);
} }
// mouse wheel hook // mouse wheel hook
@@ -88,16 +91,44 @@ namespace TweetDck.Core.Notification{
} }
} }
private void StopMouseHook(){ private void StopMouseHook(bool force){
if (mouseHook != IntPtr.Zero){ if (mouseHook != IntPtr.Zero && (force || !blockXButtonUp)){
NativeMethods.UnhookWindowsHookEx(mouseHook); NativeMethods.UnhookWindowsHookEx(mouseHook);
mouseHook = IntPtr.Zero; mouseHook = IntPtr.Zero;
blockXButtonUp = false;
} }
} }
private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){ private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
if (wParam.ToInt32() == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position)) && !ContainsFocus && !owner.ContainsFocus){ if (nCode == 0){
browser.SendMouseWheelEvent(0, 0, 0, NativeMethods.GetHookWheelDelta(lParam), CefEventFlags.None); int eventType = wParam.ToInt32();
if (eventType == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position)) && !ContainsFocus && !owner.ContainsFocus){
browser.SendMouseWheelEvent(0, 0, 0, NativeMethods.GetMouseHookData(lParam), CefEventFlags.None);
return NativeMethods.HOOK_HANDLED;
}
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
int extraButton = NativeMethods.GetMouseHookData(lParam);
if (extraButton == 2){ // forward button
this.InvokeAsyncSafe(FinishCurrentNotification);
}
else if (extraButton == 1){ // back button
this.InvokeAsyncSafe(Close);
}
blockXButtonUp = true;
return NativeMethods.HOOK_HANDLED;
}
else if (eventType == NativeMethods.WM_XBUTTONUP && blockXButtonUp){
blockXButtonUp = false;
if (!Visible){
StopMouseHook(false);
}
return NativeMethods.HOOK_HANDLED;
}
} }
return NativeMethods.CallNextHookEx(mouseHook, nCode, wParam, lParam); return NativeMethods.CallNextHookEx(mouseHook, nCode, wParam, lParam);
@@ -107,7 +138,7 @@ namespace TweetDck.Core.Notification{
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){ private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
if (e.CloseReason == CloseReason.UserClosing){ if (e.CloseReason == CloseReason.UserClosing){
HideNotification(false); HideNotification(true);
e.Cancel = true; e.Cancel = true;
} }
} }
@@ -123,7 +154,7 @@ namespace TweetDck.Core.Notification{
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){ private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
if (e.Frame.IsMain && NotificationJS != null && browser.Address != "about:blank"){ if (e.Frame.IsMain && NotificationJS != null && browser.Address != "about:blank"){
e.Frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Properties.ExpandLinksOnHover)); e.Frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Properties.AllNotification));
ScriptLoader.ExecuteScript(e.Frame, NotificationJS, NotificationScriptIdentifier); ScriptLoader.ExecuteScript(e.Frame, NotificationJS, NotificationScriptIdentifier);
if (plugins.HasAnyPlugin(PluginEnvironment.Notification)){ if (plugins.HasAnyPlugin(PluginEnvironment.Notification)){
@@ -176,7 +207,7 @@ namespace TweetDck.Core.Notification{
timerProgress.Stop(); timerProgress.Stop();
totalTime = 0; totalTime = 0;
StopMouseHook(); StopMouseHook(false);
} }
public override void FinishCurrentNotification(){ public override void FinishCurrentNotification(){
@@ -187,7 +218,7 @@ namespace TweetDck.Core.Notification{
if (!IsPaused){ if (!IsPaused){
pausedDuringNotification = IsNotificationVisible; pausedDuringNotification = IsNotificationVisible;
timerProgress.Stop(); timerProgress.Stop();
StopMouseHook(); StopMouseHook(true);
} }
base.PauseNotification(); base.PauseNotification();

View File

@@ -8,6 +8,7 @@ using TweetDck.Core.Utils;
namespace TweetDck.Core.Notification{ namespace TweetDck.Core.Notification{
sealed partial class FormNotificationTweet : FormNotificationMain{ sealed partial class FormNotificationTweet : FormNotificationMain{
private const int NonIntrusiveIdleLimit = 30; private const int NonIntrusiveIdleLimit = 30;
private const int TrimMinimum = 32;
private bool IsCursorOverNotificationArea{ private bool IsCursorOverNotificationArea{
get{ get{
@@ -16,6 +17,7 @@ namespace TweetDck.Core.Notification{
} }
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4); private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
private bool needsTrim;
public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, true){ public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, true){
InitializeComponent(); InitializeComponent();
@@ -31,6 +33,14 @@ namespace TweetDck.Core.Notification{
private void FormNotificationTweet_FormClosing(object sender, FormClosingEventArgs e){ private void FormNotificationTweet_FormClosing(object sender, FormClosingEventArgs e){
if (e.CloseReason == CloseReason.UserClosing){ if (e.CloseReason == CloseReason.UserClosing){
tweetQueue.Clear(); // already canceled tweetQueue.Clear(); // already canceled
TrimQueue();
}
}
private void TrimQueue(){
if (needsTrim){
tweetQueue.TrimExcess();
needsTrim = false;
} }
} }
@@ -73,6 +83,8 @@ namespace TweetDck.Core.Notification{
LoadNextNotification(); LoadNextNotification();
} }
} }
needsTrim |= tweetQueue.Count >= TrimMinimum;
} }
public override void FinishCurrentNotification(){ public override void FinishCurrentNotification(){
@@ -81,6 +93,7 @@ namespace TweetDck.Core.Notification{
} }
else{ else{
HideNotification(true); HideNotification(true);
TrimQueue();
} }
} }

View File

@@ -1,8 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp;
using TweetDck.Core.Bridge; using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Resources; using TweetDck.Resources;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@@ -20,8 +18,12 @@ namespace TweetDck.Core.Notification.Screenshot{
}; };
} }
protected override string GetTweetHTML(TweetNotification tweet){
return tweet.GenerateHtml(enableCustomCSS: false);
}
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); LoadTweet(tweet);
SetNotificationSize(width, height); SetNotificationSize(width, height);
} }

View File

@@ -16,7 +16,7 @@ namespace TweetDck.Core.Notification.Screenshot{
public TweetScreenshotManager(Form owner){ public TweetScreenshotManager(Form owner){
this.owner = owner; this.owner = owner;
this.timeout = new Timer{ Interval = 5000 }; this.timeout = new Timer{ Interval = 8000 };
this.timeout.Tick += timeout_Tick; this.timeout.Tick += timeout_Tick;
this.disposer = new Timer{ Interval = 1 }; this.disposer = new Timer{ Interval = 1 };
@@ -44,7 +44,7 @@ namespace TweetDck.Core.Notification.Screenshot{
CanMoveWindow = () => false CanMoveWindow = () => false
}; };
screenshot.LoadNotificationForScreenshot(new TweetNotification(string.Empty, html, string.Empty, 0), width, height); screenshot.LoadNotificationForScreenshot(new TweetNotification(string.Empty, html, 0, string.Empty, string.Empty), width, height);
screenshot.Show(); screenshot.Show();
timeout.Start(); timeout.Start();
} }
@@ -61,6 +61,7 @@ namespace TweetDck.Core.Notification.Screenshot{
screenshot.Location = ControlExtensions.InvisibleLocation; screenshot.Location = ControlExtensions.InvisibleLocation;
disposer.Start(); disposer.Start();
#else #else
screenshot.MoveToVisibleLocation();
screenshot.FormClosed += (sender, args) => disposer.Start(); screenshot.FormClosed += (sender, args) => disposer.Start();
#endif #endif
} }

View File

@@ -36,20 +36,28 @@ namespace TweetDck.Core.Notification.Sound{
void ISoundNotificationPlayer.Play(string file){ void ISoundNotificationPlayer.Play(string file){
wasTryingToPlay = true; wasTryingToPlay = true;
if (player.URL != file){ try{
player.close(); if (player.URL != file){
player.URL = file; player.close();
ignorePlaybackError = false; player.URL = file;
} ignorePlaybackError = false;
else{ }
player.controls.stop(); else{
} player.controls.stop();
}
player.controls.play(); player.controls.play();
}catch(Exception e){
OnNotificationSoundError("An error occurred in Windows Media Player: "+e.Message);
}
} }
void ISoundNotificationPlayer.Stop(){ void ISoundNotificationPlayer.Stop(){
player.controls.stop(); try{
player.controls.stop();
}catch{
// ignore
}
} }
void IDisposable.Dispose(){ void IDisposable.Dispose(){

View File

@@ -35,7 +35,7 @@ namespace TweetDck.Core.Notification{
#endif #endif
} }
return new TweetNotification("Home", ExampleTweetHTML, "", 95, true); return new TweetNotification("Home", ExampleTweetHTML, 95, string.Empty, string.Empty, true);
} }
} }
@@ -57,24 +57,32 @@ namespace TweetDck.Core.Notification{
} }
} }
public string Url{ public string TweetUrl{
get{ get{
return url; return tweetUrl;
}
}
public string QuoteUrl{
get{
return quoteUrl;
} }
} }
private readonly string column; private readonly string column;
private readonly string html; private readonly string html;
private readonly string url;
private readonly int characters; private readonly int characters;
private readonly string tweetUrl;
private readonly string quoteUrl;
private readonly bool isExample; private readonly bool isExample;
public TweetNotification(string column, string html, string url, int characters) : this(column, html, url, characters, false){} public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
private TweetNotification(string column, string html, string url, int characters, bool isExample){ private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
this.column = column; this.column = column;
this.html = html; this.html = html;
this.url = url; this.tweetUrl = tweetUrl;
this.quoteUrl = quoteUrl;
this.characters = characters; this.characters = characters;
this.isExample = isExample; this.isExample = isExample;
} }
@@ -98,7 +106,7 @@ namespace TweetDck.Core.Notification{
} }
build.Append("</head>"); build.Append("</head>");
build.Append("<body class='hearty scroll-styled-v"); build.Append("<body class='scroll-styled-v");
if (!string.IsNullOrEmpty(bodyClasses)){ if (!string.IsNullOrEmpty(bodyClasses)){
build.Append(' ').Append(bodyClasses); build.Append(' ').Append(bodyClasses);

View File

@@ -32,7 +32,7 @@
// //
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.AutoSize = true; this.btnClose.AutoSize = true;
this.btnClose.Location = new System.Drawing.Point(443, 331); this.btnClose.Location = new System.Drawing.Point(443, 349);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnClose.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnClose.Size = new System.Drawing.Size(49, 23); this.btnClose.Size = new System.Drawing.Size(49, 23);
@@ -43,8 +43,9 @@
// //
// labelTip // labelTip
// //
this.labelTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelTip.AutoSize = true; this.labelTip.AutoSize = true;
this.labelTip.Location = new System.Drawing.Point(12, 333); this.labelTip.Location = new System.Drawing.Point(12, 351);
this.labelTip.Name = "labelTip"; this.labelTip.Name = "labelTip";
this.labelTip.Size = new System.Drawing.Size(310, 13); this.labelTip.Size = new System.Drawing.Size(310, 13);
this.labelTip.TabIndex = 5; this.labelTip.TabIndex = 5;
@@ -57,19 +58,19 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tabPanel.Location = new System.Drawing.Point(12, 12); this.tabPanel.Location = new System.Drawing.Point(12, 12);
this.tabPanel.Name = "tabPanel"; this.tabPanel.Name = "tabPanel";
this.tabPanel.Size = new System.Drawing.Size(480, 313); this.tabPanel.Size = new System.Drawing.Size(480, 331);
this.tabPanel.TabIndex = 3; this.tabPanel.TabIndex = 3;
// //
// FormSettings // FormSettings
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(504, 366); this.ClientSize = new System.Drawing.Size(504, 384);
this.Controls.Add(this.labelTip); this.Controls.Add(this.labelTip);
this.Controls.Add(this.btnClose); this.Controls.Add(this.btnClose);
this.Controls.Add(this.tabPanel); this.Controls.Add(this.tabPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = Properties.Resources.icon; this.Icon = global::TweetDck.Properties.Resources.icon;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "FormSettings"; this.Name = "FormSettings";

View File

@@ -1,3 +0,0 @@
namespace TweetDck.Core.Other.Settings{
partial class BaseTabSettings{}
}

View File

@@ -2,7 +2,7 @@
using TweetDck.Configuration; using TweetDck.Configuration;
namespace TweetDck.Core.Other.Settings{ namespace TweetDck.Core.Other.Settings{
partial class BaseTabSettings : UserControl{ class BaseTabSettings : UserControl{
protected static UserConfig Config{ protected static UserConfig Config{
get{ get{
return Program.UserConfig; return Program.UserConfig;

View File

@@ -133,7 +133,7 @@
// //
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnReset.AutoSize = true; this.btnReset.AutoSize = true;
this.btnReset.Location = new System.Drawing.Point(190, 250); this.btnReset.Location = new System.Drawing.Point(190, 268);
this.btnReset.Name = "btnReset"; this.btnReset.Name = "btnReset";
this.btnReset.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnReset.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnReset.Size = new System.Drawing.Size(102, 23); this.btnReset.Size = new System.Drawing.Size(102, 23);
@@ -145,7 +145,7 @@
// //
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnImport.AutoSize = true; this.btnImport.AutoSize = true;
this.btnImport.Location = new System.Drawing.Point(100, 250); this.btnImport.Location = new System.Drawing.Point(100, 268);
this.btnImport.Name = "btnImport"; this.btnImport.Name = "btnImport";
this.btnImport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnImport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnImport.Size = new System.Drawing.Size(84, 23); this.btnImport.Size = new System.Drawing.Size(84, 23);
@@ -158,7 +158,7 @@
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnExport.AutoSize = true; this.btnExport.AutoSize = true;
this.btnExport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.btnExport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnExport.Location = new System.Drawing.Point(9, 250); this.btnExport.Location = new System.Drawing.Point(9, 268);
this.btnExport.Name = "btnExport"; this.btnExport.Name = "btnExport";
this.btnExport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnExport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnExport.Size = new System.Drawing.Size(85, 23); this.btnExport.Size = new System.Drawing.Size(85, 23);
@@ -212,7 +212,7 @@
this.Controls.Add(this.btnImport); this.Controls.Add(this.btnImport);
this.Controls.Add(this.btnExport); this.Controls.Add(this.btnExport);
this.Name = "TabSettingsAdvanced"; this.Name = "TabSettingsAdvanced";
this.Size = new System.Drawing.Size(478, 282); this.Size = new System.Drawing.Size(478, 300);
this.groupPerformance.ResumeLayout(false); this.groupPerformance.ResumeLayout(false);
this.groupPerformance.PerformLayout(); this.groupPerformance.PerformLayout();
this.groupConfiguration.ResumeLayout(false); this.groupConfiguration.ResumeLayout(false);

View File

@@ -34,9 +34,14 @@
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();
this.labelZoomValue = new System.Windows.Forms.Label();
this.trackBarZoom = new System.Windows.Forms.TrackBar();
this.labelZoom = new System.Windows.Forms.Label();
this.groupUpdates = new System.Windows.Forms.GroupBox(); this.groupUpdates = new System.Windows.Forms.GroupBox();
this.zoomUpdateTimer = new System.Windows.Forms.Timer(this.components);
this.groupTray.SuspendLayout(); this.groupTray.SuspendLayout();
this.groupInterface.SuspendLayout(); this.groupInterface.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).BeginInit();
this.groupUpdates.SuspendLayout(); this.groupUpdates.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -116,7 +121,7 @@
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, 82); this.groupTray.Location = new System.Drawing.Point(9, 145);
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 = 1; this.groupTray.TabIndex = 1;
@@ -135,15 +140,57 @@
// //
// groupInterface // groupInterface
// //
this.groupInterface.Controls.Add(this.labelZoomValue);
this.groupInterface.Controls.Add(this.trackBarZoom);
this.groupInterface.Controls.Add(this.labelZoom);
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, 67); this.groupInterface.Size = new System.Drawing.Size(183, 130);
this.groupInterface.TabIndex = 0; this.groupInterface.TabIndex = 0;
this.groupInterface.TabStop = false; this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface"; this.groupInterface.Text = "User Interface";
// //
// labelZoomValue
//
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
this.labelZoomValue.Location = new System.Drawing.Point(139, 93);
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelZoomValue.Name = "labelZoomValue";
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
this.labelZoomValue.TabIndex = 4;
this.labelZoomValue.Text = "100%";
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
//
// trackBarZoom
//
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.trackBarZoom.AutoSize = false;
this.trackBarZoom.LargeChange = 25;
this.trackBarZoom.Location = new System.Drawing.Point(6, 92);
this.trackBarZoom.Maximum = 200;
this.trackBarZoom.Minimum = 50;
this.trackBarZoom.Name = "trackBarZoom";
this.trackBarZoom.Size = new System.Drawing.Size(141, 30);
this.trackBarZoom.SmallChange = 5;
this.trackBarZoom.TabIndex = 3;
this.trackBarZoom.TickFrequency = 25;
this.trackBarZoom.Value = 100;
//
// labelZoom
//
this.labelZoom.AutoSize = true;
this.labelZoom.Location = new System.Drawing.Point(5, 76);
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelZoom.Name = "labelZoom";
this.labelZoom.Size = new System.Drawing.Size(34, 13);
this.labelZoom.TabIndex = 2;
this.labelZoom.Text = "Zoom";
//
// groupUpdates // groupUpdates
// //
this.groupUpdates.Controls.Add(this.checkUpdateNotifications); this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
@@ -155,6 +202,11 @@
this.groupUpdates.TabStop = false; this.groupUpdates.TabStop = false;
this.groupUpdates.Text = "Updates"; this.groupUpdates.Text = "Updates";
// //
// zoomUpdateTimer
//
this.zoomUpdateTimer.Interval = 250;
this.zoomUpdateTimer.Tick += new System.EventHandler(this.zoomUpdateTimer_Tick);
//
// TabSettingsGeneral // TabSettingsGeneral
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -163,11 +215,12 @@
this.Controls.Add(this.groupInterface); this.Controls.Add(this.groupInterface);
this.Controls.Add(this.groupTray); this.Controls.Add(this.groupTray);
this.Name = "TabSettingsGeneral"; this.Name = "TabSettingsGeneral";
this.Size = new System.Drawing.Size(478, 282); this.Size = new System.Drawing.Size(478, 300);
this.groupTray.ResumeLayout(false); this.groupTray.ResumeLayout(false);
this.groupTray.PerformLayout(); this.groupTray.PerformLayout();
this.groupInterface.ResumeLayout(false); this.groupInterface.ResumeLayout(false);
this.groupInterface.PerformLayout(); this.groupInterface.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).EndInit();
this.groupUpdates.ResumeLayout(false); this.groupUpdates.ResumeLayout(false);
this.groupUpdates.PerformLayout(); this.groupUpdates.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -187,5 +240,9 @@
private System.Windows.Forms.GroupBox groupUpdates; private System.Windows.Forms.GroupBox groupUpdates;
private System.Windows.Forms.CheckBox checkUpdateNotifications; private System.Windows.Forms.CheckBox checkUpdateNotifications;
private System.Windows.Forms.Button btnCheckUpdates; private System.Windows.Forms.Button btnCheckUpdates;
private System.Windows.Forms.Label labelZoom;
private System.Windows.Forms.Label labelZoomValue;
private System.Windows.Forms.TrackBar trackBarZoom;
private System.Windows.Forms.Timer zoomUpdateTimer;
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Updates; using TweetDck.Updates;
using TweetDck.Updates.Events; using TweetDck.Updates.Events;
@@ -21,6 +22,10 @@ namespace TweetDck.Core.Other.Settings{
comboBoxTrayType.Items.Add("Close to Tray"); comboBoxTrayType.Items.Add("Close to Tray");
comboBoxTrayType.Items.Add("Combined"); comboBoxTrayType.Items.Add("Combined");
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1); comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
toolTip.SetToolTip(trackBarZoom, toolTip.GetToolTip(labelZoomValue));
trackBarZoom.SetValueSafe(Config.ZoomLevel);
labelZoomValue.Text = trackBarZoom.Value+"%";
checkExpandLinks.Checked = Config.ExpandLinksOnHover; checkExpandLinks.Checked = Config.ExpandLinksOnHover;
checkSpellCheck.Checked = Config.EnableSpellCheck; checkSpellCheck.Checked = Config.EnableSpellCheck;
@@ -32,6 +37,7 @@ namespace TweetDck.Core.Other.Settings{
public override void OnReady(){ public override void OnReady(){
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged; checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged; checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged; comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged; checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
@@ -40,6 +46,10 @@ namespace TweetDck.Core.Other.Settings{
btnCheckUpdates.Click += btnCheckUpdates_Click; btnCheckUpdates.Click += btnCheckUpdates_Click;
} }
public override void OnClosing(){
Config.ZoomLevel = trackBarZoom.Value;
}
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){ private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
Config.ExpandLinksOnHover = checkExpandLinks.Checked; Config.ExpandLinksOnHover = checkExpandLinks.Checked;
} }
@@ -49,6 +59,17 @@ namespace TweetDck.Core.Other.Settings{
PromptRestart(); PromptRestart();
} }
private void trackBarZoom_ValueChanged(object sender, EventArgs e){
if (trackBarZoom.Value % trackBarZoom.SmallChange != 0){
trackBarZoom.Value = trackBarZoom.SmallChange*(int)Math.Floor(((double)trackBarZoom.Value/trackBarZoom.SmallChange)+0.5);
}
else{
zoomUpdateTimer.Stop();
zoomUpdateTimer.Start();
labelZoomValue.Text = trackBarZoom.Value+"%";
}
}
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){ private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex; Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
} }
@@ -82,5 +103,10 @@ namespace TweetDck.Core.Other.Settings{
} }
} }
} }
private void zoomUpdateTimer_Tick(object sender, EventArgs e){
Config.ZoomLevel = trackBarZoom.Value;
zoomUpdateTimer.Stop();
}
} }
} }

View File

@@ -43,6 +43,7 @@
this.labelDurationValue = new System.Windows.Forms.Label(); this.labelDurationValue = new System.Windows.Forms.Label();
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.checkSkipOnLinkClick = new System.Windows.Forms.CheckBox();
this.checkColumnName = new System.Windows.Forms.CheckBox(); this.checkColumnName = new System.Windows.Forms.CheckBox();
this.labelIdlePause = new System.Windows.Forms.Label(); this.labelIdlePause = new System.Windows.Forms.Label();
this.comboBoxIdlePause = new System.Windows.Forms.ComboBox(); this.comboBoxIdlePause = new System.Windows.Forms.ComboBox();
@@ -72,7 +73,7 @@
this.groupNotificationLocation.Controls.Add(this.trackBarEdgeDistance); this.groupNotificationLocation.Controls.Add(this.trackBarEdgeDistance);
this.groupNotificationLocation.Location = new System.Drawing.Point(198, 9); this.groupNotificationLocation.Location = new System.Drawing.Point(198, 9);
this.groupNotificationLocation.Name = "groupNotificationLocation"; this.groupNotificationLocation.Name = "groupNotificationLocation";
this.groupNotificationLocation.Size = new System.Drawing.Size(183, 264); this.groupNotificationLocation.Size = new System.Drawing.Size(183, 282);
this.groupNotificationLocation.TabIndex = 2; this.groupNotificationLocation.TabIndex = 2;
this.groupNotificationLocation.TabStop = false; this.groupNotificationLocation.TabStop = false;
this.groupNotificationLocation.Text = "Location"; this.groupNotificationLocation.Text = "Location";
@@ -80,7 +81,7 @@
// labelEdgeDistanceValue // labelEdgeDistanceValue
// //
this.labelEdgeDistanceValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.labelEdgeDistanceValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelEdgeDistanceValue.Location = new System.Drawing.Point(143, 214); this.labelEdgeDistanceValue.Location = new System.Drawing.Point(143, 217);
this.labelEdgeDistanceValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.labelEdgeDistanceValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue"; this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue";
this.labelEdgeDistanceValue.Size = new System.Drawing.Size(34, 13); this.labelEdgeDistanceValue.Size = new System.Drawing.Size(34, 13);
@@ -104,7 +105,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDisplay.FormattingEnabled = true; this.comboBoxDisplay.FormattingEnabled = true;
this.comboBoxDisplay.Location = new System.Drawing.Point(8, 160); this.comboBoxDisplay.Location = new System.Drawing.Point(6, 160);
this.comboBoxDisplay.Name = "comboBoxDisplay"; this.comboBoxDisplay.Name = "comboBoxDisplay";
this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21); this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21);
this.comboBoxDisplay.TabIndex = 6; this.comboBoxDisplay.TabIndex = 6;
@@ -112,8 +113,8 @@
// labelEdgeDistance // labelEdgeDistance
// //
this.labelEdgeDistance.AutoSize = true; this.labelEdgeDistance.AutoSize = true;
this.labelEdgeDistance.Location = new System.Drawing.Point(5, 193); this.labelEdgeDistance.Location = new System.Drawing.Point(5, 196);
this.labelEdgeDistance.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0); this.labelEdgeDistance.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelEdgeDistance.Name = "labelEdgeDistance"; this.labelEdgeDistance.Name = "labelEdgeDistance";
this.labelEdgeDistance.Size = new System.Drawing.Size(103, 13); this.labelEdgeDistance.Size = new System.Drawing.Size(103, 13);
this.labelEdgeDistance.TabIndex = 7; this.labelEdgeDistance.TabIndex = 7;
@@ -184,12 +185,13 @@
// //
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.trackBarEdgeDistance.AutoSize = false;
this.trackBarEdgeDistance.LargeChange = 8; this.trackBarEdgeDistance.LargeChange = 8;
this.trackBarEdgeDistance.Location = new System.Drawing.Point(8, 209); this.trackBarEdgeDistance.Location = new System.Drawing.Point(8, 212);
this.trackBarEdgeDistance.Maximum = 40; this.trackBarEdgeDistance.Maximum = 40;
this.trackBarEdgeDistance.Minimum = 8; this.trackBarEdgeDistance.Minimum = 8;
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance"; this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 45); this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 30);
this.trackBarEdgeDistance.SmallChange = 2; this.trackBarEdgeDistance.SmallChange = 2;
this.trackBarEdgeDistance.TabIndex = 8; this.trackBarEdgeDistance.TabIndex = 8;
this.trackBarEdgeDistance.TickFrequency = 4; this.trackBarEdgeDistance.TickFrequency = 4;
@@ -200,7 +202,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, 184); this.groupNotificationDuration.Location = new System.Drawing.Point(9, 202);
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 = 1; this.groupNotificationDuration.TabIndex = 1;
@@ -287,17 +289,19 @@
// //
this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.trackBarDuration.AutoSize = false;
this.trackBarDuration.Location = new System.Drawing.Point(6, 19); this.trackBarDuration.Location = new System.Drawing.Point(6, 19);
this.trackBarDuration.Maximum = 60; this.trackBarDuration.Maximum = 60;
this.trackBarDuration.Minimum = 10; this.trackBarDuration.Minimum = 10;
this.trackBarDuration.Name = "trackBarDuration"; this.trackBarDuration.Name = "trackBarDuration";
this.trackBarDuration.Size = new System.Drawing.Size(128, 45); this.trackBarDuration.Size = new System.Drawing.Size(128, 30);
this.trackBarDuration.TabIndex = 0; this.trackBarDuration.TabIndex = 0;
this.trackBarDuration.TickFrequency = 5; this.trackBarDuration.TickFrequency = 5;
this.trackBarDuration.Value = 25; this.trackBarDuration.Value = 25;
// //
// groupUserInterface // groupUserInterface
// //
this.groupUserInterface.Controls.Add(this.checkSkipOnLinkClick);
this.groupUserInterface.Controls.Add(this.checkColumnName); this.groupUserInterface.Controls.Add(this.checkColumnName);
this.groupUserInterface.Controls.Add(this.labelIdlePause); this.groupUserInterface.Controls.Add(this.labelIdlePause);
this.groupUserInterface.Controls.Add(this.comboBoxIdlePause); this.groupUserInterface.Controls.Add(this.comboBoxIdlePause);
@@ -306,11 +310,23 @@
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, 169); this.groupUserInterface.Size = new System.Drawing.Size(183, 187);
this.groupUserInterface.TabIndex = 0; this.groupUserInterface.TabIndex = 0;
this.groupUserInterface.TabStop = false; this.groupUserInterface.TabStop = false;
this.groupUserInterface.Text = "General"; this.groupUserInterface.Text = "General";
// //
// checkSkipOnLinkClick
//
this.checkSkipOnLinkClick.AutoSize = true;
this.checkSkipOnLinkClick.Location = new System.Drawing.Point(9, 90);
this.checkSkipOnLinkClick.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkSkipOnLinkClick.Name = "checkSkipOnLinkClick";
this.checkSkipOnLinkClick.Size = new System.Drawing.Size(113, 17);
this.checkSkipOnLinkClick.TabIndex = 3;
this.checkSkipOnLinkClick.Text = "Skip On Link Click";
this.toolTip.SetToolTip(this.checkSkipOnLinkClick, "Skips current notification when a link\r\ninside the notification is clicked.");
this.checkSkipOnLinkClick.UseVisualStyleBackColor = true;
//
// checkColumnName // checkColumnName
// //
this.checkColumnName.AutoSize = true; this.checkColumnName.AutoSize = true;
@@ -318,7 +334,7 @@
this.checkColumnName.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3); this.checkColumnName.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
this.checkColumnName.Name = "checkColumnName"; this.checkColumnName.Name = "checkColumnName";
this.checkColumnName.Size = new System.Drawing.Size(129, 17); this.checkColumnName.Size = new System.Drawing.Size(129, 17);
this.checkColumnName.TabIndex = 5; this.checkColumnName.TabIndex = 0;
this.checkColumnName.Text = "Display Column Name"; this.checkColumnName.Text = "Display Column Name";
this.toolTip.SetToolTip(this.checkColumnName, "Shows column name each notification originated\r\nfrom in the notification window t" + this.toolTip.SetToolTip(this.checkColumnName, "Shows column name each notification originated\r\nfrom in the notification window t" +
"itle."); "itle.");
@@ -328,7 +344,7 @@
// //
this.labelIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelIdlePause.AutoSize = true; this.labelIdlePause.AutoSize = true;
this.labelIdlePause.Location = new System.Drawing.Point(3, 123); this.labelIdlePause.Location = new System.Drawing.Point(5, 141);
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelIdlePause.Name = "labelIdlePause"; this.labelIdlePause.Name = "labelIdlePause";
this.labelIdlePause.Size = new System.Drawing.Size(89, 13); this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
@@ -341,7 +357,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxIdlePause.FormattingEnabled = true; this.comboBoxIdlePause.FormattingEnabled = true;
this.comboBoxIdlePause.Location = new System.Drawing.Point(6, 139); this.comboBoxIdlePause.Location = new System.Drawing.Point(6, 157);
this.comboBoxIdlePause.Name = "comboBoxIdlePause"; this.comboBoxIdlePause.Name = "comboBoxIdlePause";
this.comboBoxIdlePause.Size = new System.Drawing.Size(171, 21); this.comboBoxIdlePause.Size = new System.Drawing.Size(171, 21);
this.comboBoxIdlePause.TabIndex = 4; this.comboBoxIdlePause.TabIndex = 4;
@@ -350,11 +366,11 @@
// checkNonIntrusive // checkNonIntrusive
// //
this.checkNonIntrusive.AutoSize = true; this.checkNonIntrusive.AutoSize = true;
this.checkNonIntrusive.Location = new System.Drawing.Point(9, 90); this.checkNonIntrusive.Location = new System.Drawing.Point(9, 113);
this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkNonIntrusive.Name = "checkNonIntrusive"; this.checkNonIntrusive.Name = "checkNonIntrusive";
this.checkNonIntrusive.Size = new System.Drawing.Size(128, 17); this.checkNonIntrusive.Size = new System.Drawing.Size(128, 17);
this.checkNonIntrusive.TabIndex = 2; this.checkNonIntrusive.TabIndex = 4;
this.checkNonIntrusive.Text = "Non-Intrusive Popups"; this.checkNonIntrusive.Text = "Non-Intrusive Popups";
this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " + this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " +
"delayed until the cursor moves away to prevent accidental clicks."); "delayed until the cursor moves away to prevent accidental clicks.");
@@ -367,7 +383,7 @@
this.checkTimerCountDown.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.checkTimerCountDown.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkTimerCountDown.Name = "checkTimerCountDown"; this.checkTimerCountDown.Name = "checkTimerCountDown";
this.checkTimerCountDown.Size = new System.Drawing.Size(119, 17); this.checkTimerCountDown.Size = new System.Drawing.Size(119, 17);
this.checkTimerCountDown.TabIndex = 1; this.checkTimerCountDown.TabIndex = 2;
this.checkTimerCountDown.Text = "Timer Counts Down"; this.checkTimerCountDown.Text = "Timer Counts Down";
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up."); this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
this.checkTimerCountDown.UseVisualStyleBackColor = true; this.checkTimerCountDown.UseVisualStyleBackColor = true;
@@ -379,9 +395,8 @@
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkNotificationTimer.Name = "checkNotificationTimer"; this.checkNotificationTimer.Name = "checkNotificationTimer";
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17); this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
this.checkNotificationTimer.TabIndex = 0; this.checkNotificationTimer.TabIndex = 1;
this.checkNotificationTimer.Text = "Display Notification Timer"; this.checkNotificationTimer.Text = "Display Notification Timer";
this.toolTip.SetToolTip(this.checkNotificationTimer, "Shows how much time is left before the current notification disappears.");
this.checkNotificationTimer.UseVisualStyleBackColor = true; this.checkNotificationTimer.UseVisualStyleBackColor = true;
// //
// TabSettingsNotifications // TabSettingsNotifications
@@ -392,13 +407,12 @@
this.Controls.Add(this.groupNotificationDuration); this.Controls.Add(this.groupNotificationDuration);
this.Controls.Add(this.groupNotificationLocation); this.Controls.Add(this.groupNotificationLocation);
this.Name = "TabSettingsNotifications"; this.Name = "TabSettingsNotifications";
this.Size = new System.Drawing.Size(478, 282); this.Size = new System.Drawing.Size(478, 300);
this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged); this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged);
this.groupNotificationLocation.ResumeLayout(false); this.groupNotificationLocation.ResumeLayout(false);
this.groupNotificationLocation.PerformLayout(); this.groupNotificationLocation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
this.groupNotificationDuration.ResumeLayout(false); this.groupNotificationDuration.ResumeLayout(false);
this.groupNotificationDuration.PerformLayout();
this.tableLayoutDurationButtons.ResumeLayout(false); this.tableLayoutDurationButtons.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit();
this.groupUserInterface.ResumeLayout(false); this.groupUserInterface.ResumeLayout(false);
@@ -421,10 +435,8 @@
private System.Windows.Forms.RadioButton radioLocTL; private System.Windows.Forms.RadioButton radioLocTL;
private System.Windows.Forms.GroupBox groupNotificationDuration; private System.Windows.Forms.GroupBox groupNotificationDuration;
private System.Windows.Forms.GroupBox groupUserInterface; private System.Windows.Forms.GroupBox groupUserInterface;
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 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;
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons; private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
@@ -435,5 +447,8 @@
private System.Windows.Forms.Label labelIdlePause; private System.Windows.Forms.Label labelIdlePause;
private System.Windows.Forms.ComboBox comboBoxIdlePause; private System.Windows.Forms.ComboBox comboBoxIdlePause;
private System.Windows.Forms.CheckBox checkColumnName; private System.Windows.Forms.CheckBox checkColumnName;
private System.Windows.Forms.CheckBox checkSkipOnLinkClick;
private System.Windows.Forms.CheckBox checkTimerCountDown;
private System.Windows.Forms.CheckBox checkNotificationTimer;
} }
} }

View File

@@ -17,7 +17,7 @@ namespace TweetDck.Core.Other.Settings{
this.notification.CanMoveWindow = () => radioLocCustom.Checked; this.notification.CanMoveWindow = () => radioLocCustom.Checked;
this.notification.Move += (sender, args) => { this.notification.Move += (sender, args) => {
if (radioLocCustom.Checked){ if (radioLocCustom.Checked && this.notification.Location != ControlExtensions.InvisibleLocation){
Config.CustomNotificationPosition = this.notification.Location; Config.CustomNotificationPosition = this.notification.Location;
} }
}; };
@@ -37,6 +37,9 @@ namespace TweetDck.Core.Other.Settings{
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break; case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
} }
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue));
trackBarDuration.SetValueSafe(Config.NotificationDurationValue); trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c"; labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
@@ -59,6 +62,7 @@ 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;
checkSkipOnLinkClick.Checked = Config.NotificationSkipOnLinkClick;
checkNonIntrusive.Checked = Config.NotificationNonIntrusiveMode; checkNonIntrusive.Checked = Config.NotificationNonIntrusiveMode;
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance); trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
@@ -72,7 +76,7 @@ namespace TweetDck.Core.Other.Settings{
radioLocTR.CheckedChanged += radioLoc_CheckedChanged; radioLocTR.CheckedChanged += radioLoc_CheckedChanged;
radioLocBL.CheckedChanged += radioLoc_CheckedChanged; radioLocBL.CheckedChanged += radioLoc_CheckedChanged;
radioLocBR.CheckedChanged += radioLoc_CheckedChanged; radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
radioLocCustom.CheckedChanged += radioLoc_CheckedChanged; radioLocCustom.Click += radioLocCustom_Click;
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged; trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
btnDurationShort.Click += btnDurationShort_Click; btnDurationShort.Click += btnDurationShort_Click;
@@ -82,6 +86,7 @@ namespace TweetDck.Core.Other.Settings{
checkColumnName.CheckedChanged += checkColumnName_CheckedChanged; checkColumnName.CheckedChanged += checkColumnName_CheckedChanged;
checkNotificationTimer.CheckedChanged += checkNotificationTimer_CheckedChanged; checkNotificationTimer.CheckedChanged += checkNotificationTimer_CheckedChanged;
checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged; checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged;
checkSkipOnLinkClick.CheckedChanged += checkSkipOnLinkClick_CheckedChanged;
checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged; checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged;
comboBoxIdlePause.SelectedValueChanged += comboBoxIdlePause_SelectedValueChanged; comboBoxIdlePause.SelectedValueChanged += comboBoxIdlePause_SelectedValueChanged;
@@ -109,16 +114,30 @@ namespace TweetDck.Core.Other.Settings{
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight; else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft; else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight; else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight;
else if (radioLocCustom.Checked){
if (!Config.IsCustomNotificationPositionSet){
Config.CustomNotificationPosition = notification.Location;
}
Config.NotificationPosition = TweetNotification.Position.Custom; comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = true;
notification.ShowNotificationForSettings(false);
}
private void radioLocCustom_Click(object sender, EventArgs e){
if (!Config.IsCustomNotificationPositionSet){
Config.CustomNotificationPosition = notification.Location;
} }
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked; Config.NotificationPosition = TweetNotification.Position.Custom;
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = false;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);
if (notification.IsFullyOutsideView() && MessageBox.Show("The notification seems to be outside of view, would you like to reset its position?", "Notification is outside view", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
Config.NotificationPosition = TweetNotification.Position.TopRight;
notification.MoveToVisibleLocation();
Config.CustomNotificationPosition = notification.Location;
Config.NotificationPosition = TweetNotification.Position.Custom;
notification.MoveToVisibleLocation();
}
} }
private void trackBarDuration_ValueChanged(object sender, EventArgs e){ private void trackBarDuration_ValueChanged(object sender, EventArgs e){
@@ -156,6 +175,10 @@ namespace TweetDck.Core.Other.Settings{
notification.ShowNotificationForSettings(true); notification.ShowNotificationForSettings(true);
} }
private void checkSkipOnLinkClick_CheckedChanged(object sender, EventArgs e){
Config.NotificationSkipOnLinkClick = checkSkipOnLinkClick.Checked;
}
private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){ private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){
Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked; Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked;
} }

View File

@@ -92,7 +92,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupCustomSound); this.Controls.Add(this.groupCustomSound);
this.Name = "TabSettingsSounds"; this.Name = "TabSettingsSounds";
this.Size = new System.Drawing.Size(478, 282); this.Size = new System.Drawing.Size(478, 300);
this.groupCustomSound.ResumeLayout(false); this.groupCustomSound.ResumeLayout(false);
this.groupCustomSound.PerformLayout(); this.groupCustomSound.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@@ -88,6 +88,10 @@ namespace TweetDck.Core.Utils{
client.DownloadFileAsync(new Uri(url), target); client.DownloadFileAsync(new Uri(url), target);
} }
public static void SetZoomLevel(IBrowser browser, int percentage){
browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2));
}
public static bool IsTweetDeckWebsite(IFrame frame){ public static bool IsTweetDeckWebsite(IFrame frame){
return frame.Url.Contains("//tweetdeck.twitter.com/"); return frame.Url.Contains("//tweetdeck.twitter.com/");
} }

View File

@@ -9,6 +9,7 @@ namespace TweetDck.Core.Utils{
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")] [SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
static class NativeMethods{ static class NativeMethods{
public static readonly IntPtr HWND_BROADCAST = new IntPtr(0xFFFF); public static readonly IntPtr HWND_BROADCAST = new IntPtr(0xFFFF);
public static readonly IntPtr HOOK_HANDLED = new IntPtr(-1);
public const int HWND_TOPMOST = -1; public const int HWND_TOPMOST = -1;
public const uint SWP_NOACTIVATE = 0x0010; public const uint SWP_NOACTIVATE = 0x0010;
@@ -18,6 +19,9 @@ namespace TweetDck.Core.Utils{
public const int WM_MOUSE_LL = 14; public const int WM_MOUSE_LL = 14;
public const int WM_MOUSEWHEEL = 0x020A; public const int WM_MOUSEWHEEL = 0x020A;
public const int WM_XBUTTONDOWN = 0x020B;
public const int WM_XBUTTONUP = 0x020C;
public const int WM_PARENTNOTIFY = 0x0210;
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
private struct LASTINPUTINFO{ private struct LASTINPUTINFO{
@@ -83,7 +87,7 @@ namespace TweetDck.Core.Utils{
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags); SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
} }
public static int GetHookWheelDelta(IntPtr ptr){ public static int GetMouseHookData(IntPtr ptr){
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16; return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
} }

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDck.Core.Controls;
namespace TweetDck.Core.Utils{ namespace TweetDck.Core.Utils{
[Serializable] [Serializable]
@@ -20,7 +20,7 @@ namespace TweetDck.Core.Utils{
form.WindowState = isMaximized ? FormWindowState.Maximized : FormWindowState.Normal; form.WindowState = isMaximized ? FormWindowState.Maximized : FormWindowState.Normal;
} }
if ((rect == Rectangle.Empty && firstTimeFullscreen) || !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds))){ if ((rect == Rectangle.Empty && firstTimeFullscreen) || form.IsFullyOutsideView()){
form.DesktopBounds = Screen.PrimaryScreen.WorkingArea; form.DesktopBounds = Screen.PrimaryScreen.WorkingArea;
form.WindowState = FormWindowState.Maximized; form.WindowState = FormWindowState.Maximized;
Save(form); Save(form);

View File

@@ -20,15 +20,14 @@ 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.7.1"; public const string VersionTag = "1.7.2";
public const string VersionFull = "1.7.1.0"; public const string VersionFull = "1.7.2.0";
public static readonly Version Version = new Version(VersionTag); public static readonly Version Version = new Version(VersionTag);
public static readonly bool IsPortable = File.Exists("makeportable"); public static readonly bool IsPortable = File.Exists("makeportable");
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory; public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath(); public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath();
public static readonly string TemporaryPath = IsPortable ? Path.Combine(ProgramPath, "portable", "tmp") : Path.Combine(Path.GetTempPath(), BrandName+'_'+Path.GetRandomFileName().Substring(0, 6));
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins"); public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg"); public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
@@ -260,14 +259,6 @@ namespace TweetDck{
UserConfig.Save(); UserConfig.Save();
try{
Directory.Delete(TemporaryPath, true);
}catch(DirectoryNotFoundException){
}catch(Exception e){
// welp, too bad
Debug.WriteLine(e.ToString());
}
Cef.Shutdown(); Cef.Shutdown();
BrowserCache.Exit(); BrowserCache.Exit();

View File

@@ -18,6 +18,8 @@ enabled(){
[ "1F3FF", "#8A6859" ], [ "1F3FF", "#8A6859" ],
]; ];
this.emojiURL = "https://ton.twimg.com/tweetdeck-web/web/assets/emoji/";
this.emojiHTML1 = ""; // no skin tones, prepended this.emojiHTML1 = ""; // no skin tones, prepended
this.emojiHTML2 = {}; // contains emojis with skin tones this.emojiHTML2 = {}; // contains emojis with skin tones
this.emojiHTML3 = ""; // no skin tones, appended this.emojiHTML3 = ""; // no skin tones, appended
@@ -30,7 +32,7 @@ enabled(){
this.css.insert(".emoji-keyboard { position: absolute; width: 15.35em; background-color: white; border-radius: 2px 2px 3px 3px; font-size: 24px; z-index: 9999 }"); this.css.insert(".emoji-keyboard { position: absolute; width: 15.35em; background-color: white; border-radius: 2px 2px 3px 3px; font-size: 24px; z-index: 9999 }");
this.css.insert(".emoji-keyboard-list { height: 10.14em; padding: 0.1em; box-sizing: border-box; overflow-y: auto }"); this.css.insert(".emoji-keyboard-list { height: 10.14em; padding: 0.1em; box-sizing: border-box; overflow-y: auto }");
this.css.insert(".emoji-keyboard-list .separator { height: 26px }"); this.css.insert(".emoji-keyboard-list .separator { height: 26px }");
this.css.insert(".emoji-keyboard-list .emoji { padding: 0.1em !important; cursor: pointer }"); this.css.insert(".emoji-keyboard-list img { padding: 0.1em !important; width: 1em; height: 1em; vertical-align: -0.1em; cursor: pointer }");
this.css.insert(".emoji-keyboard-skintones { height: 1.3em; text-align: center; background-color: #292f33; border-radius: 0 0 2px 2px }"); this.css.insert(".emoji-keyboard-skintones { height: 1.3em; text-align: center; background-color: #292f33; border-radius: 0 0 2px 2px }");
this.css.insert(".emoji-keyboard-skintones div { width: 0.8em; height: 0.8em; margin: 0.25em 0.1em; border-radius: 50%; display: inline-block; box-sizing: border-box; cursor: pointer }"); this.css.insert(".emoji-keyboard-skintones div { width: 0.8em; height: 0.8em; margin: 0.25em 0.1em; border-radius: 50%; display: inline-block; box-sizing: border-box; cursor: pointer }");
this.css.insert(".emoji-keyboard-skintones .sel { border: 2px solid rgba(0, 0, 0, 0.35); box-shadow: 0 0 2px 0 rgba(255, 255, 255, 0.65), 0 0 1px 0 rgba(255, 255, 255, 0.4) inset }"); this.css.insert(".emoji-keyboard-skintones .sel { border: 2px solid rgba(0, 0, 0, 0.35); box-shadow: 0 0 2px 0 rgba(255, 255, 255, 0.65), 0 0 1px 0 rgba(255, 255, 255, 0.4) inset }");
@@ -62,7 +64,7 @@ enabled(){
}; };
var generateEmojiHTML = skinTone => { var generateEmojiHTML = skinTone => {
return this.emojiHTML1+this.emojiHTML2[skinTone]+this.emojiHTML3; return (this.emojiHTML1+this.emojiHTML2[skinTone]+this.emojiHTML3).replace(/u#/g, this.emojiURL);
}; };
var selectSkinTone = skinTone => { var selectSkinTone = skinTone => {
@@ -265,16 +267,17 @@ ready(){
// final processing // final processing
let replaceSeparators = str => str.replace(/___/g, "<div class='separator'></div>"); let urlRegex = new RegExp(this.emojiURL.replace(/\./g, "\\."), "g");
let process = str => TD.util.cleanWithEmoji(str).replace(/ class=\"emoji\" draggable=\"false\"/g, "").replace(urlRegex, "u#").replace(/___/g, "<div class='separator'></div>");
let start = "<p style='font-size:13px;color:#444;margin:4px;text-align:center'>Please, note that most emoji will not show up properly in the text box above, but they will display in the tweet.</p>"; let start = "<p style='font-size:13px;color:#444;margin:4px;text-align:center'>Please, note that most emoji will not show up properly in the text box above, but they will display in the tweet.</p>";
this.emojiHTML1 = start+replaceSeparators(TD.util.cleanWithEmoji(generated1.join(""))); this.emojiHTML1 = start+process(generated1.join(""));
for(let skinTone of this.skinToneList){ for(let skinTone of this.skinToneList){
this.emojiHTML2[skinTone] = replaceSeparators(TD.util.cleanWithEmoji(generated2[skinTone].join(""))); this.emojiHTML2[skinTone] = process(generated2[skinTone].join(""));
} }
this.emojiHTML3 = replaceSeparators(TD.util.cleanWithEmoji(generated3.join(""))); this.emojiHTML3 = process(generated3.join(""));
}).catch(err => { }).catch(err => {
$TD.alert("error", "Problem loading emoji keyboard: "+err.message); $TD.alert("error", "Problem loading emoji keyboard: "+err.message);
}); });

View File

@@ -94,10 +94,18 @@
html.css("border", "0"); html.css("border", "0");
html.find("footer").last().remove(); // apparently withTweetActions breaks for certain tweets, nice html.find("footer").last().remove(); // apparently withTweetActions breaks for certain tweets, nice
html.find(".js-media").last().remove(); // and quoted tweets still show media previews, nice nice html.find(".js-media").last().remove(); // and quoted tweets still show media previews, nice nice
html.find(".js-quote-detail").removeClass("is-actionable"); html.find(".js-quote-detail").removeClass("is-actionable"); // prevent quoted tweets from changing the cursor
let url = html.find("time").first().children("a").first().attr("href") || ""; html.find("a[href='#']").each(function(){ // remove <a> tags around links that don't lead anywhere (such as account names the tweet replied to)
$TD.onTweetPopup(columnTypes[column.getColumnType()] || "", html.html(), url, tweet.text.length); this.outerHTML = this.innerHTML;
});
let source = tweet.getRelatedTweet();
let duration = source ? source.text.length+(source.quotedTweet ? source.quotedTweet.text.length : 0) : tweet.text.length;
let tweetUrl = source ? source.getChirpURL() : "";
let quoteUrl = source && source.quotedTweet ? source.quotedTweet.getChirpURL() : "";
$TD.onTweetPopup(columnTypes[column.getColumnType()] || "", html.html(), duration, tweetUrl, quoteUrl);
} }
if (column.model.getHasSound()){ if (column.model.getHasSound()){
@@ -116,9 +124,9 @@
}); });
tags.push("<style type='text/css'>"); tags.push("<style type='text/css'>");
tags.push("body { background-color: "+getClassStyleProperty("column", "background-color")+" }"); tags.push("body { background-color: "+getClassStyleProperty("column", "background-color")+" }"); // set background color
tags.push("a[data-full-url] { word-break: break-all }"); tags.push("a[data-full-url] { word-break: break-all }"); // break long urls
tags.push(".txt-base-smallest .badge-verified:before { height: 13px !important }"); tags.push(".txt-base-smallest .badge-verified:before { height: 13px !important }"); // fix cut off badge icon
tags.push("</style>"); tags.push("</style>");
return tags.join(""); return tags.join("");
@@ -342,7 +350,7 @@
window.TDGF_triggerScreenshot = function(){ window.TDGF_triggerScreenshot = function(){
if (selectedTweet){ if (selectedTweet){
var tweetWidth = selectedTweet.width(); var tweetWidth = Math.floor(selectedTweet.width());
var parent = selectedTweet.parent(); var parent = selectedTweet.parent();
var isDetail = parent.hasClass("js-tweet-detail"); var isDetail = parent.hasClass("js-tweet-detail");
@@ -386,7 +394,7 @@
width: tweetWidth+"px" width: tweetWidth+"px"
}).appendTo(document.body); }).appendTo(document.body);
var realHeight = testTweet.height(); var realHeight = Math.floor(testTweet.height());
testTweet.remove(); testTweet.remove();
$TD.screenshotTweet(selectedTweet.html(), tweetWidth, realHeight); $TD.screenshotTweet(selectedTweet.html(), tweetWidth, realHeight);
@@ -397,72 +405,19 @@
// //
// Block: Paste images when tweeting. // Block: Paste images when tweeting.
// //
(function(){ onAppReady.push(function(){
var lastPasteElement; var uploader = $._data(document, "events")["uiComposeAddImageClick"][0].handler.context;
var prevScrollTop;
var getScroller = function(){ app.delegate(".js-compose-text,.js-reply-tweetbox", "paste", function(e){
return $(".js-drawer").find(".js-compose-scroller").first().children().first(); for(let item of e.originalEvent.clipboardData.items){
}; if (item.type.startsWith("image/")){
$(this).closest(".rpl").find(".js-reply-popout").click(); // popout direct messages
var clickUpload = function(){ uploader.addFilesToUpload([ item.getAsFile() ]);
$(document).one("uiFilesAdded", function(){ break;
getScroller().scrollTop(prevScrollTop);
$(".js-drawer").find(".js-compose-text").first()[0].focus();
});
var button = $(".js-add-image-button").first();
var scroller = getScroller();
prevScrollTop = scroller.scrollTop();
scroller.scrollTop(0);
scroller.scrollTop(button.offset().top); // scrolls the button into view
var buttonPos = button.children().first().offset(); // finds the camera icon offset
$TD.clickUploadImage(Math.floor(buttonPos.left), Math.floor(buttonPos.top));
};
app.delegate(".js-compose-text,.js-reply-tweetbox", "paste", function(){
lastPasteElement = $(this);
$TD.tryPasteImage();
});
window.TDGF_tryPasteImage = function(){
if (lastPasteElement){
var parent = lastPasteElement.parent();
if (parent.siblings(".js-add-image-button").length === 0){
var pop = parent.closest(".js-inline-reply,.rpl").find(".js-inline-compose-pop,.js-reply-popout");
if (pop.length === 0){
lastPasteElement = null;
return;
}
pop.click();
var drawer = $(".js-drawer");
var counter = 0;
var interval = setInterval(function(){
if (drawer.offset().left >= 195){
clickUpload();
clearInterval(interval);
}
else if (++counter >= 10){
clearInterval(interval);
}
}, 51);
} }
else{
clickUpload();
}
lastPasteElement = null;
} }
}; });
})(); });
// //
// Block: Support for extra mouse buttons. // Block: Support for extra mouse buttons.
@@ -589,8 +544,15 @@
styleOfficial.sheet.insertRule("a[data-full-url] { word-break: break-all; }", 0); // break long urls styleOfficial.sheet.insertRule("a[data-full-url] { word-break: break-all; }", 0); // break long urls
styleOfficial.sheet.insertRule(".column-nav-link .attribution { position: absolute; }", 0); // fix cut off account names styleOfficial.sheet.insertRule(".column-nav-link .attribution { position: absolute; }", 0); // fix cut off account names
styleOfficial.sheet.insertRule(".txt-base-smallest .badge-verified:before { height: 13px !important; }", 0); // fix cut off badge icon styleOfficial.sheet.insertRule(".txt-base-smallest .sprite-verified-mini { width: 13px !important; height: 13px !important; background-position: -223px -99px !important; }", 0); // fix cut off badge icon when zoomed in
styleOfficial.sheet.insertRule(".keyboard-shortcut-list { vertical-align: top; }", 0); // fix keyboard navigation alignment styleOfficial.sheet.insertRule(".keyboard-shortcut-list { vertical-align: top; }", 0); // fix keyboard navigation alignment
styleOfficial.sheet.insertRule(".sprite-logo { background-position: -5px -46px !important; }", 0); // fix TweetDeck logo on certain zoom levels
styleOfficial.sheet.insertRule(".app-columns-container::-webkit-scrollbar-track { border-left: 0 }", 0); // remove weird border in the column container scrollbar
styleOfficial.sheet.insertRule(".app-navigator .tooltip { display: none !important }", 0); // hide broken tooltips in the menu
styleOfficial.sheet.insertRule(".account-inline .username { vertical-align: 10% }", 0); // move usernames a bit higher
styleOfficial.sheet.insertRule(".js-accounts-column-holder { bottom: 4px; }", 0); // fix white bar on the bottom
styleOfficial.sheet.insertRule(".drawer[data-drawer='accountSettings'] { background-color: #ccd6dd; }", 0); // fix white bar on the bottom
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']), .is-gif .js-media-gif-container { cursor: alias; }", 0); // change cursor on unsupported videos styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']), .is-gif .js-media-gif-container { cursor: alias; }", 0); // change cursor on unsupported videos
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #bd3d37; }", 0); // change play icon color on unsupported videos styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #bd3d37; }", 0); // change play icon color on unsupported videos
@@ -685,6 +647,9 @@
} }
}); });
//
// Block: Skip the initial pre-login page.
//
$(document).on("uiLoginFormImpression", function(){ $(document).on("uiLoginFormImpression", function(){
location.href = $("a.btn", ".js-login-form").first().attr("href"); location.href = $("a.btn", ".js-login-form").first().attr("href");
}); });

View File

@@ -19,6 +19,14 @@
addEventListener(links, "click", function(e){ addEventListener(links, "click", function(e){
$TD.openBrowser(e.currentTarget.getAttribute("href")); $TD.openBrowser(e.currentTarget.getAttribute("href"));
e.preventDefault(); e.preventDefault();
if ($TDX.skipOnLinkClick){
let parentClasses = e.currentTarget.parentNode.classList;
if (parentClasses.contains("js-tweet-text") || parentClasses.contains("js-quoted-tweet-text") || parentClasses.contains("js-timestamp")){
$TD.loadNextNotification();
}
}
}); });
// //
@@ -101,22 +109,6 @@
}); });
})(); })();
//
// Block: Setup embedded tweet address for context menu.
//
(function(){
var embedded = document.getElementsByClassName("quoted-tweet");
if (embedded.length === 0)return;
var tweetId = embedded[0].getAttribute("data-tweet-id");
if (!tweetId)return;
var account = embedded[0].getElementsByClassName("account-link");
if (account.length === 0)return;
$TD.setNotificationQuotedTweet(account[0].getAttribute("href")+"/status/"+tweetId);
})();
// //
// Block: Setup a skip button. // Block: Setup a skip button.
// //

View File

@@ -77,15 +77,9 @@
<Compile Include="Core\Controls\FlatProgressBar.cs"> <Compile Include="Core\Controls\FlatProgressBar.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Core\Controls\FlatProgressBar.Designer.cs">
<DependentUpon>FlatProgressBar.cs</DependentUpon>
</Compile>
<Compile Include="Core\Controls\TabButton.cs"> <Compile Include="Core\Controls\TabButton.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Core\Controls\TabButton.Designer.cs">
<DependentUpon>TabButton.cs</DependentUpon>
</Compile>
<Compile Include="Core\Controls\TabPanel.cs"> <Compile Include="Core\Controls\TabPanel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@@ -101,6 +95,7 @@
<Compile Include="Core\FormBrowser.Designer.cs"> <Compile Include="Core\FormBrowser.Designer.cs">
<DependentUpon>FormBrowser.cs</DependentUpon> <DependentUpon>FormBrowser.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Core\Handling\ResourceHandlerNotification.cs" />
<Compile Include="Core\Notification\FormNotificationMain.cs"> <Compile Include="Core\Notification\FormNotificationMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -114,7 +109,6 @@
<DependentUpon>FormNotificationBase.cs</DependentUpon> <DependentUpon>FormNotificationBase.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Core\Handling\ContextMenuNotification.cs" /> <Compile Include="Core\Handling\ContextMenuNotification.cs" />
<Compile Include="Core\Handling\FileDialogHandler.cs" />
<Compile Include="Core\Handling\JavaScriptDialogHandler.cs" /> <Compile Include="Core\Handling\JavaScriptDialogHandler.cs" />
<Compile Include="Core\Handling\LifeSpanHandler.cs" /> <Compile Include="Core\Handling\LifeSpanHandler.cs" />
<Compile Include="Core\Notification\FormNotificationTweet.cs"> <Compile Include="Core\Notification\FormNotificationTweet.cs">
@@ -183,9 +177,6 @@
<Compile Include="Core\Other\Settings\BaseTabSettings.cs"> <Compile Include="Core\Other\Settings\BaseTabSettings.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Core\Other\Settings\BaseTabSettings.Designer.cs">
<DependentUpon>BaseTabSettings.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\TabSettingsGeneral.cs"> <Compile Include="Core\Other\Settings\TabSettingsGeneral.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@@ -336,6 +327,7 @@
<Content Include="Resources\Scripts\code.js" /> <Content Include="Resources\Scripts\code.js" />
<Content Include="Resources\Scripts\notification.js" /> <Content Include="Resources\Scripts\notification.js" />
<Content Include="Resources\Scripts\pages\error.html" /> <Content Include="Resources\Scripts\pages\error.html" />
<Content Include="Resources\Scripts\pages\example.html" />
<Content Include="Resources\Scripts\plugins.browser.js" /> <Content Include="Resources\Scripts\plugins.browser.js" />
<Content Include="Resources\Scripts\plugins.js" /> <Content Include="Resources\Scripts\plugins.js" />
<Content Include="Resources\Scripts\plugins.notification.js" /> <Content Include="Resources\Scripts\plugins.notification.js" />