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

Compare commits

...

66 Commits
1.7 ... 1.7.4

Author SHA1 Message Date
a7229a0677 Merge branch 'master' of https://github.com/chylex/TweetDuck 2017-05-08 22:38:31 +02:00
d0dd112b98 Update README.md 2017-05-08 22:38:34 +02:00
1e07120eb5 Update CefSharp to 57 2017-05-08 22:21:49 +02:00
fcd1f76cff Fix background color in example notification when not logged in 2017-04-29 01:58:56 +02:00
e400d86d75 Add an option to toggle Shift key switch in account selectors
Closes #119
2017-04-28 20:06:53 +02:00
dca3410a5b Change border style on Windows 8/10 2017-04-28 19:08:10 +02:00
9b314e2953 Make sure the edit-design plugin creates a config file on startup
This prevents an issue when importing a profile where the file was
missing.
2017-04-28 18:35:24 +02:00
5635daf66d Update 'Restore Defaults' button dialog 2017-04-28 18:26:31 +02:00
7e2e1645e9 Move plugin config into a separate file
Closes #121
2017-04-28 17:29:08 +02:00
4990afcdbb Remove plugin.CanRun call from PluginConfig.IsEnabled 2017-04-28 16:18:46 +02:00
c11f36dfef Remove and sort usings in the whole project 2017-04-28 13:51:06 +02:00
abddf61c88 Update TweetDuck codebase to C# 7.0 2017-04-28 13:29:45 +02:00
37fec7e952 Release 1.7.3 2017-04-22 14:27:23 +02:00
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
4afac91bce Release 1.7.1 2017-04-07 00:32:27 +02:00
6e6312f6d7 Fix occasional twitter.js crash due to it loading too early 2017-04-07 00:18:59 +02:00
df4c4e443d Customize login and logout pages 2017-04-06 23:16:58 +02:00
ff40474f92 Fix DM reply input not getting focused after opening a conversation 2017-04-06 18:39:47 +02:00
aca06ee805 Add an option to display column name in the notification title 2017-04-06 18:11:52 +02:00
ba8e29a9f8 Make emoji keyboard bring focus into the input when closed 2017-04-06 18:03:44 +02:00
583da2bd9f Remove an empty designer file for PluginListFlowLayout 2017-04-06 15:21:07 +02:00
0ea07016b4 Fix TabIndex, Margin, and Location of controls in forms and dialogs 2017-04-06 14:57:27 +02:00
616421db9a Remove the 'Include Border In Screenshots' option 2017-04-06 14:29:22 +02:00
293ddacd19 Disable broken TweetDeck metrics 2017-04-06 14:07:48 +02:00
13945ec937 Minor code refactoring (remove TD_APP_READY, remove a TODO, fix formatting) 2017-04-06 13:40:26 +02:00
4ea6f336f8 Fix debug plugin to simulate notifications more reliably 2017-04-05 23:19:49 +02:00
58296aa266 Fix emoji keyboard to append emoji at caret instead of the end 2017-04-05 23:08:52 +02:00
742df9dff3 Make the default theme/column/font settings hidden if edit-design plugin is enabled 2017-04-05 01:06:52 +02:00
87 changed files with 1145 additions and 1001 deletions

View File

@@ -14,13 +14,15 @@ 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 = 9;
// START OF CONFIGURATION // START OF CONFIGURATION
public WindowState BrowserWindow { get; set; } public WindowState BrowserWindow { 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; }
@@ -32,63 +34,57 @@ namespace TweetDck.Configuration{
public bool EnableSpellCheck { get; set; } public bool EnableSpellCheck { get; set; }
public bool ExpandLinksOnHover { get; set; } public bool ExpandLinksOnHover { get; set; }
public bool ShowScreenshotBorder { get; set; } public bool SwitchAccountSelectors { get; set; }
public bool EnableTrayHighlight { get; set; } public bool EnableTrayHighlight { get; set; }
public bool EnableUpdateCheck { get; set; } public bool EnableUpdateCheck { get; set; }
public string DismissedUpdate { get; set; } public string DismissedUpdate { get; set; }
public PluginConfig Plugins { get; private set; } [Obsolete] public PluginConfig Plugins { get; set; } // TODO remove eventually
public WindowState PluginsWindow { get; set; } public WindowState PluginsWindow { get; set; }
public string CustomCefArgs { get; set; } public string CustomCefArgs { get; set; }
public string CustomBrowserCSS { get; set; } public string CustomBrowserCSS { get; set; }
public string CustomNotificationCSS { get; set; } public string CustomNotificationCSS { get; set; }
public bool IsCustomNotificationPositionSet{ public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
get{
return CustomNotificationPosition != ControlExtensions.InvisibleLocation; public string NotificationSoundPath{
} get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
set => notificationSoundPath = value;
} }
public bool MuteNotifications{ public bool MuteNotifications{
get{ get => muteNotifications;
return muteNotifications;
}
set{ set{
if (muteNotifications == value)return; if (muteNotifications != value){
muteNotifications = value;
muteNotifications = value; MuteToggled?.Invoke(this, new EventArgs());
if (MuteToggled != null){
MuteToggled(this, new EventArgs());
} }
} }
} }
public string NotificationSoundPath{ public int ZoomLevel{
get{ get => zoomLevel;
return string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
}
set{ set{
notificationSoundPath = value; if (zoomLevel != value){
zoomLevel = value;
ZoomLevelChanged?.Invoke(this, new EventArgs());
}
} }
} }
public double ZoomMultiplier => zoomLevel/100.0;
public TrayIcon.Behavior TrayBehavior{ public TrayIcon.Behavior TrayBehavior{
get{ get => trayBehavior;
return trayBehavior;
}
set{ set{
if (trayBehavior == value)return; if (trayBehavior != value){
trayBehavior = value;
trayBehavior = value; TrayBehaviorChanged?.Invoke(this, new EventArgs());
if (TrayBehaviorChanged != null){
TrayBehaviorChanged(this, new EventArgs());
} }
} }
} }
@@ -98,6 +94,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 +105,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 +113,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;
@@ -121,12 +122,9 @@ namespace TweetDck.Configuration{
NotificationDurationValue = 25; NotificationDurationValue = 25;
EnableUpdateCheck = true; EnableUpdateCheck = true;
ExpandLinksOnHover = true; ExpandLinksOnHover = true;
SwitchAccountSelectors = true;
EnableTrayHighlight = true; EnableTrayHighlight = true;
Plugins = new PluginConfig();
PluginsWindow = new WindowState(); PluginsWindow = new WindowState();
Plugins.DisableOfficialFromConfig("clear-columns");
Plugins.DisableOfficialFromConfig("reply-account");
} }
private void UpgradeFile(){ private void UpgradeFile(){
@@ -148,7 +146,6 @@ namespace TweetDck.Configuration{
if (fileVersion == 2){ if (fileVersion == 2){
BrowserWindow = new WindowState(); BrowserWindow = new WindowState();
Plugins = new PluginConfig();
PluginsWindow = new WindowState(); PluginsWindow = new WindowState();
++fileVersion; ++fileVersion;
} }
@@ -160,8 +157,6 @@ namespace TweetDck.Configuration{
} }
if (fileVersion == 4){ if (fileVersion == 4){
Plugins.DisableOfficialFromConfig("clear-columns");
Plugins.DisableOfficialFromConfig("reply-account");
++fileVersion; ++fileVersion;
} }
@@ -174,6 +169,16 @@ namespace TweetDck.Configuration{
++fileVersion; ++fileVersion;
} }
if (fileVersion == 7){
ZoomLevel = 100;
++fileVersion;
}
if (fileVersion == 8){
SwitchAccountSelectors = true;
++fileVersion;
}
// update the version // update the version
fileVersion = CurrentFileVersion; fileVersion = CurrentFileVersion;
Save(); Save();
@@ -215,10 +220,7 @@ namespace TweetDck.Configuration{
} }
} }
if (config != null){ config?.UpgradeFile();
config.UpgradeFile();
}
break; break;
}catch(FileNotFoundException){ }catch(FileNotFoundException){
}catch(DirectoryNotFoundException){ }catch(DirectoryNotFoundException){

View File

@@ -8,10 +8,13 @@ namespace TweetDck.Core.Bridge{
ExpandLinksOnHover = 1, ExpandLinksOnHover = 1,
MuteNotifications = 2, MuteNotifications = 2,
HasCustomNotificationSound = 4, HasCustomNotificationSound = 4,
All = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound SkipOnLinkClick = 8,
SwitchAccountSelectors = 16,
AllBrowser = ExpandLinksOnHover | SwitchAccountSelectors | 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){");
@@ -19,6 +22,10 @@ namespace TweetDck.Core.Bridge{
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;"); build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
} }
if (properties.HasFlag(Properties.SwitchAccountSelectors)){
build.Append("c.switchAccountSelectors=").Append(Program.UserConfig.SwitchAccountSelectors ? "true;" : "false;");
}
if (properties.HasFlag(Properties.MuteNotifications)){ if (properties.HasFlag(Properties.MuteNotifications)){
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;"); build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
} }
@@ -27,6 +34,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 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(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

@@ -3,11 +3,7 @@ using System.Windows.Forms;
namespace TweetDck.Core.Controls{ namespace TweetDck.Core.Controls{
class FlatButton : Button{ class FlatButton : Button{
protected override bool ShowFocusCues{ protected override bool ShowFocusCues => false;
get{
return false;
}
}
public FlatButton(){ public FlatButton(){
GotFocus += FlatButton_GotFocus; GotFocus += FlatButton_GotFocus;

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

@@ -6,21 +6,11 @@ using System.Windows.Forms;
namespace TweetDck.Core.Controls{ namespace TweetDck.Core.Controls{
sealed partial class TabPanel : UserControl{ sealed partial class TabPanel : UserControl{
public IEnumerable<TabButton> Buttons{ public Panel Content => panelContent;
get{ public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
return panelButtons.Controls.Cast<TabButton>();
}
}
public TabButton ActiveButton { get; private set; } public TabButton ActiveButton { get; private set; }
// ReSharper disable once ConvertToAutoPropertyWithPrivateSetter
public Panel Content{
get{
return panelContent;
}
}
private int btnWidth; private int btnWidth;
public TabPanel(){ public TabPanel(){

View File

@@ -1,32 +1,29 @@
using System; using CefSharp;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms; using CefSharp.WinForms;
using TweetDck.Configuration; using System;
using TweetDck.Core.Handling; using System.Diagnostics;
using TweetDck.Core.Other;
using TweetDck.Resources;
using TweetDck.Core.Controls;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Core.Handling;
using TweetDck.Core.Notification;
using TweetDck.Core.Notification.Screenshot;
using TweetDck.Core.Notification.Sound;
using TweetDck.Core.Other;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
using TweetDck.Updates;
using TweetDck.Plugins; using TweetDck.Plugins;
using TweetDck.Plugins.Enums; using TweetDck.Plugins.Enums;
using TweetDck.Plugins.Events; using TweetDck.Plugins.Events;
using TweetDck.Core.Bridge; using TweetDck.Resources;
using TweetDck.Core.Notification; using TweetDck.Updates;
using TweetDck.Core.Notification.Screenshot;
using TweetDck.Updates.Events; using TweetDck.Updates.Events;
using System.Diagnostics;
using TweetDck.Core.Notification.Sound;
namespace TweetDck.Core{ namespace TweetDck.Core{
sealed partial class FormBrowser : Form{ sealed partial class FormBrowser : Form{
private static UserConfig Config{ private static UserConfig Config => Program.UserConfig;
get{
return Program.UserConfig;
}
}
public string UpdateInstallerPath { get; private set; } public string UpdateInstallerPath { get; private set; }
@@ -36,11 +33,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 +63,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()
}; };
@@ -79,6 +72,7 @@ namespace TweetDck.Core{
#endif #endif
this.browser.LoadingStateChanged += browser_LoadingStateChanged; this.browser.LoadingStateChanged += browser_LoadingStateChanged;
this.browser.FrameLoadStart += browser_FrameLoadStart;
this.browser.FrameLoadEnd += browser_FrameLoadEnd; this.browser.FrameLoadEnd += browser_FrameLoadEnd;
this.browser.LoadError += browser_LoadError; this.browser.LoadError += browser_LoadError;
this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification)); this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
@@ -95,13 +89,8 @@ namespace TweetDck.Core{
browser.Dispose(); browser.Dispose();
contextMenu.Dispose(); contextMenu.Dispose();
if (notificationScreenshotManager != null){ notificationScreenshotManager?.Dispose();
notificationScreenshotManager.Dispose(); soundNotification?.Dispose();
}
if (soundNotification != null){
soundNotification.Dispose();
}
}; };
this.trayIcon.ClickRestore += trayIcon_ClickRestore; this.trayIcon.ClickRestore += trayIcon_ClickRestore;
@@ -111,6 +100,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;
@@ -119,6 +109,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);
@@ -134,13 +134,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;
} }
} }
@@ -156,16 +157,28 @@ 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){
if (e.Frame.IsMain){
if (Config.ZoomLevel != 100){
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
}
if (BrowserUtils.IsTwitterWebsite(e.Frame)){
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
}
}
}
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){ private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
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);
@@ -238,6 +251,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();
} }
@@ -259,7 +276,6 @@ namespace TweetDck.Core{
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){ private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled); browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled);
Config.Save();
} }
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){ private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
@@ -314,7 +330,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;
} }
@@ -339,10 +355,10 @@ namespace TweetDck.Core{
// javascript calls // javascript calls
public void ReinjectCustomCSS(string css){ public void ReinjectCustomCSS(string css){
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css == null ? string.Empty : css.Replace(Environment.NewLine, " ")); browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css?.Replace(Environment.NewLine, " ") ?? string.Empty);
} }
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));
} }
@@ -361,17 +377,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);
@@ -381,32 +392,23 @@ namespace TweetDck.Core{
trayIcon.HasNotifications = false; trayIcon.HasNotifications = false;
} }
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound); UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | 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);
} }
} }
@@ -448,16 +450,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

@@ -5,8 +5,7 @@ namespace TweetDck.Core.Handling{
class BrowserProcessHandler : IBrowserProcessHandler{ class BrowserProcessHandler : IBrowserProcessHandler{
void IBrowserProcessHandler.OnContextInitialized(){ void IBrowserProcessHandler.OnContextInitialized(){
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){ using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
string err; ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out string _);
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out err);
} }
} }

View File

@@ -1,5 +1,5 @@
using System.Windows.Forms; using CefSharp;
using CefSharp; using System.Windows.Forms;
using TweetDck.Core.Bridge; using TweetDck.Core.Bridge;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;

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,63 @@
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){
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?.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

@@ -1,8 +1,8 @@
using System; using CefSharp;
using CefSharp.WinForms;
using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
using TweetDck.Configuration; using TweetDck.Configuration;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Handling; using TweetDck.Core.Handling;
@@ -50,45 +50,30 @@ namespace TweetDck.Core.Notification{
} }
} }
public bool IsNotificationVisible{ public bool IsNotificationVisible => Location != ControlExtensions.InvisibleLocation;
get{
return Location != ControlExtensions.InvisibleLocation;
}
}
public new Point Location{ public new Point Location{
get{ get => base.Location;
return base.Location; set => Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
}
set{
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
}
} }
public Func<bool> CanMoveWindow = () => true; public Func<bool> CanMoveWindow = () => true;
protected override bool ShowWithoutActivation => true;
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 int pauseCounter; private int pauseCounter;
public bool IsPaused{ public bool IsPaused => pauseCounter > 0;
get{
return pauseCounter > 0;
}
}
protected override bool ShowWithoutActivation{
get{
return true;
}
}
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;
@@ -105,12 +90,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);
@@ -119,6 +106,10 @@ namespace TweetDck.Core.Notification{
this.owner.FormClosed -= owner_FormClosed; this.owner.FormClosed -= owner_FormClosed;
}; };
if (WindowsUtils.ShouldAvoidToolWindow){
FormBorderStyle = FormBorderStyle.FixedSingle;
}
// ReSharper disable once VirtualMemberCallInContructor // ReSharper disable once VirtualMemberCallInContructor
UpdateTitle(); UpdateTitle();
} }
@@ -138,8 +129,8 @@ namespace TweetDck.Core.Notification{
} }
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){ private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
if (e.IsBrowserInitialized && Initialized != null){ if (e.IsBrowserInitialized){
Initialized(this, new EventArgs()); Initialized?.Invoke(this, new EventArgs());
} }
} }
@@ -147,10 +138,11 @@ 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;
currentColumn = null;
} }
public virtual void FinishCurrentNotification(){} public virtual void FinishCurrentNotification(){}
@@ -173,22 +165,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;
browser.LoadHtml(GetTweetHTML(tweet), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks); currentColumn = tweet.Column;
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(){
@@ -196,7 +182,16 @@ namespace TweetDck.Core.Notification{
} }
protected virtual void UpdateTitle(){ protected virtual void UpdateTitle(){
Text = Program.BrandName; 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){
@@ -206,7 +201,7 @@ namespace TweetDck.Core.Notification{
else{ else{
Point position = PointToClient(Cursor.Position); Point position = PointToClient(Cursor.Position);
position.Offset(20, 5); position.Offset(20, 5);
toolTip.Show(text, this, position); // TODO figure out flickering when moving the mouse toolTip.Show(text, this, position);
} }
} }
} }

View File

@@ -1,7 +1,7 @@
using System; using CefSharp;
using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp;
using TweetDck.Core.Bridge; using TweetDck.Core.Bridge;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
@@ -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)){
@@ -165,6 +196,8 @@ namespace TweetDck.Core.Notification{
else{ else{
PrepareAndDisplayWindow(); PrepareAndDisplayWindow();
} }
UpdateTitle();
} }
public override void HideNotification(bool loadBlank){ public override void HideNotification(bool loadBlank){
@@ -174,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(){
@@ -185,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

@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TweetDck.Core.Notification { namespace TweetDck.Core.Notification {
partial class FormNotificationTweet { partial class FormNotificationTweet {
/// <summary> /// <summary>

View File

@@ -8,14 +8,12 @@ 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 => new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
get{
return new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
}
}
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 +29,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 +79,8 @@ namespace TweetDck.Core.Notification{
LoadNextNotification(); LoadNextNotification();
} }
} }
needsTrim |= tweetQueue.Count >= TrimMinimum;
} }
public override void FinishCurrentNotification(){ public override void FinishCurrentNotification(){
@@ -81,6 +89,7 @@ namespace TweetDck.Core.Notification{
} }
else{ else{
HideNotification(true); HideNotification(true);
TrimQueue();
} }
} }
@@ -117,7 +126,11 @@ namespace TweetDck.Core.Notification{
} }
protected override void UpdateTitle(){ protected override void UpdateTitle(){
Text = tweetQueue.Count > 0 ? Program.BrandName+" ("+tweetQueue.Count+" more left)" : Program.BrandName; base.UpdateTitle();
if (tweetQueue.Count > 0){
Text = Text+" ("+tweetQueue.Count+" more left)";
}
} }
protected override void OnNotificationReady(){ protected override void OnNotificationReady(){

View File

@@ -1,12 +1,10 @@
using System; using System;
using System.Windows.Forms;
using CefSharp;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Resources;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Windows.Forms;
using TweetDck.Core.Bridge;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
using TweetDck.Resources;
namespace TweetDck.Core.Notification.Screenshot{ namespace TweetDck.Core.Notification.Screenshot{
sealed class FormNotificationScreenshotable : FormNotificationBase{ sealed class FormNotificationScreenshotable : FormNotificationBase{
@@ -20,28 +18,27 @@ namespace TweetDck.Core.Notification.Screenshot{
}; };
} }
public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){ protected override string GetTweetHTML(TweetNotification tweet){
browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks); return tweet.GenerateHtml(enableCustomCSS: false);
}
Location = ControlExtensions.InvisibleLocation; public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){
LoadTweet(tweet);
SetNotificationSize(width, height); SetNotificationSize(width, height);
} }
public void TakeScreenshot(){ public void TakeScreenshot(){
MoveToVisibleLocation(); IntPtr context = NativeMethods.GetDC(this.Handle);
bool border = Program.UserConfig.ShowScreenshotBorder;
IntPtr context = NativeMethods.GetDeviceContext(this, border);
if (context == IntPtr.Zero){ if (context == IntPtr.Zero){
MessageBox.Show("Could not retrieve a graphics context handle for the notification window to take the screenshot.", "Screenshot Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Could not retrieve a graphics context handle for the notification window to take the screenshot.", "Screenshot Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
else{ else{
using(Bitmap bmp = new Bitmap(border ? Width : ClientSize.Width, border ? Height : ClientSize.Height, PixelFormat.Format32bppRgb)){ using(Bitmap bmp = new Bitmap(ClientSize.Width, ClientSize.Height, PixelFormat.Format32bppRgb)){
try{ try{
NativeMethods.RenderSourceIntoBitmap(context, bmp); NativeMethods.RenderSourceIntoBitmap(context, bmp);
}finally{ }finally{
NativeMethods.ReleaseDeviceContext(this, context); NativeMethods.ReleaseDC(this.Handle, context);
} }
Clipboard.SetImage(bmp); Clipboard.SetImage(bmp);

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(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
} }
@@ -68,10 +69,7 @@ namespace TweetDck.Core.Notification.Screenshot{
public void Dispose(){ public void Dispose(){
timeout.Dispose(); timeout.Dispose();
disposer.Dispose(); disposer.Dispose();
screenshot?.Dispose();
if (screenshot != null){
screenshot.Dispose();
}
} }
} }
} }

View File

@@ -2,7 +2,7 @@ using System;
namespace TweetDck.Core.Notification.Sound{ namespace TweetDck.Core.Notification.Sound{
sealed class PlaybackErrorEventArgs : EventArgs{ sealed class PlaybackErrorEventArgs : EventArgs{
public string Message { get; private set; } public string Message { get; }
public bool Ignore { get; set; } public bool Ignore { get; set; }
public PlaybackErrorEventArgs(string message){ public PlaybackErrorEventArgs(string message){

View File

@@ -4,11 +4,7 @@ using System.Media;
namespace TweetDck.Core.Notification.Sound{ namespace TweetDck.Core.Notification.Sound{
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{ sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
string ISoundNotificationPlayer.SupportedFormats{ string ISoundNotificationPlayer.SupportedFormats => "*.wav";
get{
return "*.wav";
}
}
public event EventHandler<PlaybackErrorEventArgs> PlaybackError; public event EventHandler<PlaybackErrorEventArgs> PlaybackError;

View File

@@ -5,11 +5,7 @@ using WMPLib;
namespace TweetDck.Core.Notification.Sound{ namespace TweetDck.Core.Notification.Sound{
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{ sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
string ISoundNotificationPlayer.SupportedFormats{ string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
get{
return "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
}
}
public event EventHandler<PlaybackErrorEventArgs> PlaybackError; public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
@@ -36,20 +32,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

@@ -8,7 +8,7 @@ namespace TweetDck.Core.Notification{
private static string HeadTag { get; set; } private static string HeadTag { get; set; }
private const string DefaultFontSizeClass = "medium"; private const string DefaultFontSizeClass = "medium";
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'>"; private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'><style type='text/css'>body{background:#222426}</style>";
private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}"; private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
public static int FontSizeLevel{ public static int FontSizeLevel{
@@ -35,7 +35,7 @@ namespace TweetDck.Core.Notification{
#endif #endif
} }
return new TweetNotification(ExampleTweetHTML, "", 95, true); return new TweetNotification("Home", ExampleTweetHTML, 95, string.Empty, string.Empty, true);
} }
} }
@@ -51,22 +51,24 @@ namespace TweetDck.Core.Notification{
TopLeft, TopRight, BottomLeft, BottomRight, Custom TopLeft, TopRight, BottomLeft, BottomRight, Custom
} }
public string Url{ public string Column => column;
get{ public string TweetUrl => tweetUrl;
return url; public string QuoteUrl => quoteUrl;
}
}
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 html, string url, int characters) : this(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 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.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;
} }
@@ -90,7 +92,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

@@ -1,5 +1,3 @@
using TweetDck.Core.Controls;
namespace TweetDck.Core.Other { namespace TweetDck.Core.Other {
sealed partial class FormAbout { sealed partial class FormAbout {
/// <summary> /// <summary>
@@ -57,7 +55,7 @@ namespace TweetDck.Core.Other {
this.labelDescription.Location = new System.Drawing.Point(114, 12); this.labelDescription.Location = new System.Drawing.Point(114, 12);
this.labelDescription.Name = "labelDescription"; this.labelDescription.Name = "labelDescription";
this.labelDescription.Size = new System.Drawing.Size(232, 109); this.labelDescription.Size = new System.Drawing.Size(232, 109);
this.labelDescription.TabIndex = 1; this.labelDescription.TabIndex = 0;
// //
// labelTips // labelTips
// //
@@ -68,7 +66,8 @@ namespace TweetDck.Core.Other {
this.labelTips.Margin = new System.Windows.Forms.Padding(0); this.labelTips.Margin = new System.Windows.Forms.Padding(0);
this.labelTips.Name = "labelTips"; this.labelTips.Name = "labelTips";
this.labelTips.Size = new System.Drawing.Size(99, 16); this.labelTips.Size = new System.Drawing.Size(99, 16);
this.labelTips.TabIndex = 3; this.labelTips.TabIndex = 1;
this.labelTips.TabStop = true;
this.labelTips.Text = "Tips && Tricks"; this.labelTips.Text = "Tips && Tricks";
this.labelTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.labelTips.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked); this.labelTips.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
@@ -83,7 +82,8 @@ namespace TweetDck.Core.Other {
this.labelWebsite.Margin = new System.Windows.Forms.Padding(0); this.labelWebsite.Margin = new System.Windows.Forms.Padding(0);
this.labelWebsite.Name = "labelWebsite"; this.labelWebsite.Name = "labelWebsite";
this.labelWebsite.Size = new System.Drawing.Size(117, 16); this.labelWebsite.Size = new System.Drawing.Size(117, 16);
this.labelWebsite.TabIndex = 2; this.labelWebsite.TabIndex = 0;
this.labelWebsite.TabStop = true;
this.labelWebsite.Text = "Official Website"; this.labelWebsite.Text = "Official Website";
this.labelWebsite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.labelWebsite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.labelWebsite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked); this.labelWebsite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
@@ -104,7 +104,7 @@ namespace TweetDck.Core.Other {
this.tablePanelLinks.RowCount = 1; this.tablePanelLinks.RowCount = 1;
this.tablePanelLinks.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tablePanelLinks.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tablePanelLinks.Size = new System.Drawing.Size(334, 16); this.tablePanelLinks.Size = new System.Drawing.Size(334, 16);
this.tablePanelLinks.TabIndex = 4; this.tablePanelLinks.TabIndex = 1;
// //
// labelIssues // labelIssues
// //
@@ -115,7 +115,8 @@ namespace TweetDck.Core.Other {
this.labelIssues.Margin = new System.Windows.Forms.Padding(0); this.labelIssues.Margin = new System.Windows.Forms.Padding(0);
this.labelIssues.Name = "labelIssues"; this.labelIssues.Name = "labelIssues";
this.labelIssues.Size = new System.Drawing.Size(118, 16); this.labelIssues.Size = new System.Drawing.Size(118, 16);
this.labelIssues.TabIndex = 4; this.labelIssues.TabIndex = 2;
this.labelIssues.TabStop = true;
this.labelIssues.Text = "Report an Issue"; this.labelIssues.Text = "Report an Issue";
this.labelIssues.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.labelIssues.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.labelIssues.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked); this.labelIssues.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);

View File

@@ -6,20 +6,11 @@ namespace TweetDck.Core.Other{
sealed partial class FormMessage : Form{ sealed partial class FormMessage : Form{
public Button ClickedButton { get; private set; } public Button ClickedButton { get; private set; }
public int ActionPanelY{ public int ActionPanelY => panelActions.Location.Y;
get{
return panelActions.Location.Y;
}
}
private int ClientWidth{ private int ClientWidth{
get{ get => ClientSize.Width;
return ClientSize.Width; set => ClientSize = new Size(value, ClientSize.Height);
}
set{
ClientSize = new Size(value, ClientSize.Height);
}
} }
private readonly Icon icon; private readonly Icon icon;

View File

@@ -76,7 +76,7 @@
this.tabPanelPlugins.Location = new System.Drawing.Point(12, 12); this.tabPanelPlugins.Location = new System.Drawing.Point(12, 12);
this.tabPanelPlugins.Name = "tabPanelPlugins"; this.tabPanelPlugins.Name = "tabPanelPlugins";
this.tabPanelPlugins.Size = new System.Drawing.Size(680, 421); this.tabPanelPlugins.Size = new System.Drawing.Size(680, 421);
this.tabPanelPlugins.TabIndex = 4; this.tabPanelPlugins.TabIndex = 0;
// //
// FormPlugins // FormPlugins
// //

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

@@ -31,9 +31,7 @@ namespace TweetDck.Core.Other{
} }
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{ private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
BaseTabSettings control; if (tabs.TryGetValue(typeof(T), out BaseTabSettings control)){
if (tabs.TryGetValue(typeof(T), out control)){
tabPanel.ReplaceContent(control); tabPanel.ReplaceContent(control);
} }
else{ else{

View File

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

View File

@@ -2,12 +2,8 @@
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 => Program.UserConfig;
get{
return Program.UserConfig;
}
}
public BaseTabSettings(){ public BaseTabSettings(){
Padding = new Padding(6); Padding = new Padding(6);

View File

@@ -52,7 +52,7 @@
this.textBoxBrowserCSS.Name = "textBoxBrowserCSS"; this.textBoxBrowserCSS.Name = "textBoxBrowserCSS";
this.textBoxBrowserCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxBrowserCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxBrowserCSS.Size = new System.Drawing.Size(373, 253); this.textBoxBrowserCSS.Size = new System.Drawing.Size(373, 253);
this.textBoxBrowserCSS.TabIndex = 0; this.textBoxBrowserCSS.TabIndex = 1;
this.textBoxBrowserCSS.WordWrap = false; this.textBoxBrowserCSS.WordWrap = false;
this.textBoxBrowserCSS.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxBrowserCSS_KeyUp); this.textBoxBrowserCSS.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxBrowserCSS_KeyUp);
// //
@@ -63,7 +63,7 @@
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnCancel.Size = new System.Drawing.Size(56, 23); this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 1; this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -75,7 +75,7 @@
this.btnApply.Name = "btnApply"; this.btnApply.Name = "btnApply";
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnApply.Size = new System.Drawing.Size(56, 23); this.btnApply.Size = new System.Drawing.Size(56, 23);
this.btnApply.TabIndex = 2; this.btnApply.TabIndex = 1;
this.btnApply.Text = "Apply"; this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true; this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click); this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
@@ -102,7 +102,7 @@
this.splitContainer.Size = new System.Drawing.Size(760, 269); this.splitContainer.Size = new System.Drawing.Size(760, 269);
this.splitContainer.SplitterDistance = 373; this.splitContainer.SplitterDistance = 373;
this.splitContainer.SplitterWidth = 5; this.splitContainer.SplitterWidth = 5;
this.splitContainer.TabIndex = 5; this.splitContainer.TabIndex = 0;
// //
// labelBrowser // labelBrowser
// //
@@ -111,7 +111,7 @@
this.labelBrowser.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.labelBrowser.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelBrowser.Name = "labelBrowser"; this.labelBrowser.Name = "labelBrowser";
this.labelBrowser.Size = new System.Drawing.Size(45, 13); this.labelBrowser.Size = new System.Drawing.Size(45, 13);
this.labelBrowser.TabIndex = 1; this.labelBrowser.TabIndex = 0;
this.labelBrowser.Text = "Browser"; this.labelBrowser.Text = "Browser";
// //
// labelNotification // labelNotification
@@ -121,7 +121,7 @@
this.labelNotification.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.labelNotification.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelNotification.Name = "labelNotification"; this.labelNotification.Name = "labelNotification";
this.labelNotification.Size = new System.Drawing.Size(60, 13); this.labelNotification.Size = new System.Drawing.Size(60, 13);
this.labelNotification.TabIndex = 2; this.labelNotification.TabIndex = 0;
this.labelNotification.Text = "Notification"; this.labelNotification.Text = "Notification";
// //
// textBoxNotificationCSS // textBoxNotificationCSS
@@ -135,7 +135,7 @@
this.textBoxNotificationCSS.Multiline = true; this.textBoxNotificationCSS.Multiline = true;
this.textBoxNotificationCSS.Name = "textBoxNotificationCSS"; this.textBoxNotificationCSS.Name = "textBoxNotificationCSS";
this.textBoxNotificationCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxNotificationCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxNotificationCSS.Size = new System.Drawing.Size(373, 253); this.textBoxNotificationCSS.Size = new System.Drawing.Size(372, 253);
this.textBoxNotificationCSS.TabIndex = 1; this.textBoxNotificationCSS.TabIndex = 1;
this.textBoxNotificationCSS.WordWrap = false; this.textBoxNotificationCSS.WordWrap = false;
// //
@@ -146,7 +146,7 @@
this.labelWarning.Location = new System.Drawing.Point(91, 292); this.labelWarning.Location = new System.Drawing.Point(91, 292);
this.labelWarning.Name = "labelWarning"; this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(341, 13); this.labelWarning.Size = new System.Drawing.Size(341, 13);
this.labelWarning.TabIndex = 6; this.labelWarning.TabIndex = 3;
this.labelWarning.Text = "The code is not validated, please make sure there are no syntax errors."; this.labelWarning.Text = "The code is not validated, please make sure there are no syntax errors.";
// //
// btnOpenWiki // btnOpenWiki
@@ -157,7 +157,7 @@
this.btnOpenWiki.Name = "btnOpenWiki"; this.btnOpenWiki.Name = "btnOpenWiki";
this.btnOpenWiki.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnOpenWiki.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnOpenWiki.Size = new System.Drawing.Size(73, 23); this.btnOpenWiki.Size = new System.Drawing.Size(73, 23);
this.btnOpenWiki.TabIndex = 7; this.btnOpenWiki.TabIndex = 4;
this.btnOpenWiki.Text = "Open Wiki"; this.btnOpenWiki.Text = "Open Wiki";
this.btnOpenWiki.UseVisualStyleBackColor = true; this.btnOpenWiki.UseVisualStyleBackColor = true;
this.btnOpenWiki.Click += new System.EventHandler(this.btnOpenWiki_Click); this.btnOpenWiki.Click += new System.EventHandler(this.btnOpenWiki_Click);

View File

@@ -5,17 +5,8 @@ using TweetDck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{ namespace TweetDck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCSS : Form{ sealed partial class DialogSettingsCSS : Form{
public string BrowserCSS{ public string BrowserCSS => textBoxBrowserCSS.Text;
get{ public string NotificationCSS => textBoxNotificationCSS.Text;
return textBoxBrowserCSS.Text;
}
}
public string NotificationCSS{
get{
return textBoxNotificationCSS.Text;
}
}
private readonly Action<string> reinjectBrowserCSS; private readonly Action<string> reinjectBrowserCSS;

View File

@@ -40,7 +40,7 @@
this.textBoxArgs.Multiline = true; this.textBoxArgs.Multiline = true;
this.textBoxArgs.Name = "textBoxArgs"; this.textBoxArgs.Name = "textBoxArgs";
this.textBoxArgs.Size = new System.Drawing.Size(460, 193); this.textBoxArgs.Size = new System.Drawing.Size(460, 193);
this.textBoxArgs.TabIndex = 0; this.textBoxArgs.TabIndex = 1;
// //
// btnCancel // btnCancel
// //
@@ -49,7 +49,7 @@
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnCancel.Size = new System.Drawing.Size(56, 23); this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 1; this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -74,7 +74,7 @@
this.btnHelp.Name = "btnHelp"; this.btnHelp.Name = "btnHelp";
this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnHelp.Size = new System.Drawing.Size(124, 23); this.btnHelp.Size = new System.Drawing.Size(124, 23);
this.btnHelp.TabIndex = 3; this.btnHelp.TabIndex = 4;
this.btnHelp.Text = "List of Chromium Args"; this.btnHelp.Text = "List of Chromium Args";
this.btnHelp.UseVisualStyleBackColor = true; this.btnHelp.UseVisualStyleBackColor = true;
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click); this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
@@ -86,7 +86,7 @@
this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
this.labelWarning.Name = "labelWarning"; this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(423, 13); this.labelWarning.Size = new System.Drawing.Size(423, 13);
this.labelWarning.TabIndex = 4; this.labelWarning.TabIndex = 0;
this.labelWarning.Text = "Warning: Some arguments may cause the program to stop working, edit at your own r" + this.labelWarning.Text = "Warning: Some arguments may cause the program to stop working, edit at your own r" +
"isk."; "isk.";
// //

View File

@@ -5,11 +5,7 @@ using TweetDck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{ namespace TweetDck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCefArgs : Form{ sealed partial class DialogSettingsCefArgs : Form{
public string CefArgs{ public string CefArgs => textBoxArgs.Text;
get{
return textBoxArgs.Text;
}
}
public DialogSettingsCefArgs(){ public DialogSettingsCefArgs(){
InitializeComponent(); InitializeComponent();

View File

@@ -40,7 +40,7 @@
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnCancel.Size = new System.Drawing.Size(56, 23); this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 0; this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -54,7 +54,7 @@
this.btnApply.Name = "btnApply"; this.btnApply.Name = "btnApply";
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnApply.Size = new System.Drawing.Size(26, 23); this.btnApply.Size = new System.Drawing.Size(26, 23);
this.btnApply.TabIndex = 1; this.btnApply.TabIndex = 3;
this.btnApply.Text = " "; this.btnApply.Text = " ";
this.btnApply.UseVisualStyleBackColor = true; this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click); this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
@@ -65,7 +65,7 @@
this.cbConfig.Location = new System.Drawing.Point(13, 13); this.cbConfig.Location = new System.Drawing.Point(13, 13);
this.cbConfig.Name = "cbConfig"; this.cbConfig.Name = "cbConfig";
this.cbConfig.Size = new System.Drawing.Size(106, 17); this.cbConfig.Size = new System.Drawing.Size(106, 17);
this.cbConfig.TabIndex = 2; this.cbConfig.TabIndex = 0;
this.cbConfig.Text = "Program Settings"; this.cbConfig.Text = "Program Settings";
this.toolTip.SetToolTip(this.cbConfig, "Interface, notification, and update settings.\r\nIncludes a list of disabled plugin" + this.toolTip.SetToolTip(this.cbConfig, "Interface, notification, and update settings.\r\nIncludes a list of disabled plugin" +
"s."); "s.");
@@ -78,7 +78,7 @@
this.cbSession.Location = new System.Drawing.Point(13, 37); this.cbSession.Location = new System.Drawing.Point(13, 37);
this.cbSession.Name = "cbSession"; this.cbSession.Name = "cbSession";
this.cbSession.Size = new System.Drawing.Size(92, 17); this.cbSession.Size = new System.Drawing.Size(92, 17);
this.cbSession.TabIndex = 3; this.cbSession.TabIndex = 1;
this.cbSession.Text = "Login Session"; this.cbSession.Text = "Login Session";
this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account."); this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account.");
this.cbSession.UseVisualStyleBackColor = true; this.cbSession.UseVisualStyleBackColor = true;
@@ -90,7 +90,7 @@
this.cbPluginData.Location = new System.Drawing.Point(13, 61); this.cbPluginData.Location = new System.Drawing.Point(13, 61);
this.cbPluginData.Name = "cbPluginData"; this.cbPluginData.Name = "cbPluginData";
this.cbPluginData.Size = new System.Drawing.Size(81, 17); this.cbPluginData.Size = new System.Drawing.Size(81, 17);
this.cbPluginData.TabIndex = 4; this.cbPluginData.TabIndex = 2;
this.cbPluginData.Text = "Plugin Data"; this.cbPluginData.Text = "Plugin Data";
this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves."); this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves.");
this.cbPluginData.UseVisualStyleBackColor = true; this.cbPluginData.UseVisualStyleBackColor = true;

View File

@@ -13,9 +13,7 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
} }
public ExportFileFlags Flags{ public ExportFileFlags Flags{
get{ get => selectedFlags;
return selectedFlags;
}
set{ set{
// this will call events and SetFlag, which also updates the UI // this will call events and SetFlag, which also updates the UI

View File

@@ -43,7 +43,7 @@
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnCancel.Size = new System.Drawing.Size(56, 23); this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 1; this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
@@ -56,7 +56,7 @@
this.btnRestart.Name = "btnRestart"; this.btnRestart.Name = "btnRestart";
this.btnRestart.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnRestart.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnRestart.Size = new System.Drawing.Size(57, 23); this.btnRestart.Size = new System.Drawing.Size(57, 23);
this.btnRestart.TabIndex = 2; this.btnRestart.TabIndex = 6;
this.btnRestart.Text = "Restart"; this.btnRestart.Text = "Restart";
this.btnRestart.UseVisualStyleBackColor = true; this.btnRestart.UseVisualStyleBackColor = true;
this.btnRestart.Click += new System.EventHandler(this.btnRestart_Click); this.btnRestart.Click += new System.EventHandler(this.btnRestart_Click);
@@ -67,7 +67,7 @@
this.cbLogging.Location = new System.Drawing.Point(12, 12); this.cbLogging.Location = new System.Drawing.Point(12, 12);
this.cbLogging.Name = "cbLogging"; this.cbLogging.Name = "cbLogging";
this.cbLogging.Size = new System.Drawing.Size(64, 17); this.cbLogging.Size = new System.Drawing.Size(64, 17);
this.cbLogging.TabIndex = 3; this.cbLogging.TabIndex = 0;
this.cbLogging.Text = "Logging"; this.cbLogging.Text = "Logging";
this.toolTip.SetToolTip(this.cbLogging, "Logging JavaScript output into a\r\ndebug.txt file in the data folder."); this.toolTip.SetToolTip(this.cbLogging, "Logging JavaScript output into a\r\ndebug.txt file in the data folder.");
this.cbLogging.UseVisualStyleBackColor = true; this.cbLogging.UseVisualStyleBackColor = true;
@@ -78,7 +78,7 @@
this.cbDebugUpdates.Location = new System.Drawing.Point(12, 35); this.cbDebugUpdates.Location = new System.Drawing.Point(12, 35);
this.cbDebugUpdates.Name = "cbDebugUpdates"; this.cbDebugUpdates.Name = "cbDebugUpdates";
this.cbDebugUpdates.Size = new System.Drawing.Size(127, 17); this.cbDebugUpdates.Size = new System.Drawing.Size(127, 17);
this.cbDebugUpdates.TabIndex = 4; this.cbDebugUpdates.TabIndex = 1;
this.cbDebugUpdates.Text = "Pre-Release Updates"; this.cbDebugUpdates.Text = "Pre-Release Updates";
this.toolTip.SetToolTip(this.cbDebugUpdates, "Allows updating to pre-releases."); this.toolTip.SetToolTip(this.cbDebugUpdates, "Allows updating to pre-releases.");
this.cbDebugUpdates.UseVisualStyleBackColor = true; this.cbDebugUpdates.UseVisualStyleBackColor = true;
@@ -90,7 +90,7 @@
this.labelLocale.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelLocale.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelLocale.Name = "labelLocale"; this.labelLocale.Name = "labelLocale";
this.labelLocale.Size = new System.Drawing.Size(39, 13); this.labelLocale.Size = new System.Drawing.Size(39, 13);
this.labelLocale.TabIndex = 5; this.labelLocale.TabIndex = 2;
this.labelLocale.Text = "Locale"; this.labelLocale.Text = "Locale";
// //
// comboLocale // comboLocale
@@ -101,7 +101,7 @@
this.comboLocale.Location = new System.Drawing.Point(15, 83); this.comboLocale.Location = new System.Drawing.Point(15, 83);
this.comboLocale.Name = "comboLocale"; this.comboLocale.Name = "comboLocale";
this.comboLocale.Size = new System.Drawing.Size(201, 21); this.comboLocale.Size = new System.Drawing.Size(201, 21);
this.comboLocale.TabIndex = 6; this.comboLocale.TabIndex = 3;
// //
// labelDataFolder // labelDataFolder
// //
@@ -110,7 +110,7 @@
this.labelDataFolder.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelDataFolder.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelDataFolder.Name = "labelDataFolder"; this.labelDataFolder.Name = "labelDataFolder";
this.labelDataFolder.Size = new System.Drawing.Size(62, 13); this.labelDataFolder.Size = new System.Drawing.Size(62, 13);
this.labelDataFolder.TabIndex = 7; this.labelDataFolder.TabIndex = 4;
this.labelDataFolder.Text = "Data Folder"; this.labelDataFolder.Text = "Data Folder";
// //
// tbDataFolder // tbDataFolder
@@ -120,7 +120,7 @@
this.tbDataFolder.Location = new System.Drawing.Point(15, 135); this.tbDataFolder.Location = new System.Drawing.Point(15, 135);
this.tbDataFolder.Name = "tbDataFolder"; this.tbDataFolder.Name = "tbDataFolder";
this.tbDataFolder.Size = new System.Drawing.Size(201, 20); this.tbDataFolder.Size = new System.Drawing.Size(201, 20);
this.tbDataFolder.TabIndex = 8; this.tbDataFolder.TabIndex = 5;
// //
// DialogSettingsRestart // DialogSettingsRestart
// //

View File

@@ -92,7 +92,7 @@ namespace TweetDck.Core.Other.Settings.Export{
} }
public class Entry{ public class Entry{
public string Identifier { get; private set; } public string Identifier { get; }
public string KeyName{ public string KeyName{
get{ get{

View File

@@ -31,6 +31,8 @@ namespace TweetDck.Core.Other.Settings.Export{
} }
if (flags.HasFlag(ExportFileFlags.PluginData)){ if (flags.HasFlag(ExportFileFlags.PluginData)){
stream.WriteFile("plugin.config", Program.PluginConfigFilePath);
foreach(Plugin plugin in plugins.Plugins){ foreach(Plugin plugin in plugins.Plugins){
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){ foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
try{ try{
@@ -69,6 +71,7 @@ namespace TweetDck.Core.Other.Settings.Export{
flags |= ExportFileFlags.Config; flags |= ExportFileFlags.Config;
break; break;
case "plugin.config":
case "plugin.data": case "plugin.data":
flags |= ExportFileFlags.PluginData; flags |= ExportFileFlags.PluginData;
break; break;
@@ -103,6 +106,13 @@ namespace TweetDck.Core.Other.Settings.Export{
break; break;
case "plugin.config":
if (flags.HasFlag(ExportFileFlags.PluginData)){
entry.WriteToFile(Program.PluginConfigFilePath);
}
break;
case "plugin.data": case "plugin.data":
if (flags.HasFlag(ExportFileFlags.PluginData)){ if (flags.HasFlag(ExportFileFlags.PluginData)){
string[] value = entry.KeyValue; string[] value = entry.KeyValue;

View File

@@ -49,7 +49,7 @@
this.btnClearCache.Location = new System.Drawing.Point(6, 44); this.btnClearCache.Location = new System.Drawing.Point(6, 44);
this.btnClearCache.Name = "btnClearCache"; this.btnClearCache.Name = "btnClearCache";
this.btnClearCache.Size = new System.Drawing.Size(171, 23); this.btnClearCache.Size = new System.Drawing.Size(171, 23);
this.btnClearCache.TabIndex = 14; this.btnClearCache.TabIndex = 1;
this.btnClearCache.Text = "Clear Cache (calculating)"; this.btnClearCache.Text = "Clear Cache (calculating)";
this.toolTip.SetToolTip(this.btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources." + this.toolTip.SetToolTip(this.btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources." +
""); "");
@@ -58,11 +58,11 @@
// checkHardwareAcceleration // checkHardwareAcceleration
// //
this.checkHardwareAcceleration.AutoSize = true; this.checkHardwareAcceleration.AutoSize = true;
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 21); this.checkHardwareAcceleration.Location = new System.Drawing.Point(9, 21);
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration"; this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
this.checkHardwareAcceleration.Size = new System.Drawing.Size(134, 17); this.checkHardwareAcceleration.Size = new System.Drawing.Size(134, 17);
this.checkHardwareAcceleration.TabIndex = 12; this.checkHardwareAcceleration.TabIndex = 0;
this.checkHardwareAcceleration.Text = "Hardware Acceleration"; this.checkHardwareAcceleration.Text = "Hardware Acceleration";
this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" + this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" +
" with rendering."); " with rendering.");
@@ -73,7 +73,7 @@
this.btnEditCefArgs.Location = new System.Drawing.Point(6, 19); this.btnEditCefArgs.Location = new System.Drawing.Point(6, 19);
this.btnEditCefArgs.Name = "btnEditCefArgs"; this.btnEditCefArgs.Name = "btnEditCefArgs";
this.btnEditCefArgs.Size = new System.Drawing.Size(171, 23); this.btnEditCefArgs.Size = new System.Drawing.Size(171, 23);
this.btnEditCefArgs.TabIndex = 15; this.btnEditCefArgs.TabIndex = 0;
this.btnEditCefArgs.Text = "Edit CEF Arguments"; this.btnEditCefArgs.Text = "Edit CEF Arguments";
this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework."); this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
this.btnEditCefArgs.UseVisualStyleBackColor = true; this.btnEditCefArgs.UseVisualStyleBackColor = true;
@@ -83,7 +83,7 @@
this.btnEditCSS.Location = new System.Drawing.Point(6, 48); this.btnEditCSS.Location = new System.Drawing.Point(6, 48);
this.btnEditCSS.Name = "btnEditCSS"; this.btnEditCSS.Name = "btnEditCSS";
this.btnEditCSS.Size = new System.Drawing.Size(171, 23); this.btnEditCSS.Size = new System.Drawing.Size(171, 23);
this.btnEditCSS.TabIndex = 16; this.btnEditCSS.TabIndex = 1;
this.btnEditCSS.Text = "Edit CSS"; this.btnEditCSS.Text = "Edit CSS";
this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows."); this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows.");
this.btnEditCSS.UseVisualStyleBackColor = true; this.btnEditCSS.UseVisualStyleBackColor = true;
@@ -93,7 +93,7 @@
this.btnRestartArgs.Location = new System.Drawing.Point(6, 106); this.btnRestartArgs.Location = new System.Drawing.Point(6, 106);
this.btnRestartArgs.Name = "btnRestartArgs"; this.btnRestartArgs.Name = "btnRestartArgs";
this.btnRestartArgs.Size = new System.Drawing.Size(171, 23); this.btnRestartArgs.Size = new System.Drawing.Size(171, 23);
this.btnRestartArgs.TabIndex = 18; this.btnRestartArgs.TabIndex = 3;
this.btnRestartArgs.Text = "Restart with Arguments"; this.btnRestartArgs.Text = "Restart with Arguments";
this.toolTip.SetToolTip(this.btnRestartArgs, "Restarts the program with customizable\r\ncommand line arguments."); this.toolTip.SetToolTip(this.btnRestartArgs, "Restarts the program with customizable\r\ncommand line arguments.");
this.btnRestartArgs.UseVisualStyleBackColor = true; this.btnRestartArgs.UseVisualStyleBackColor = true;
@@ -103,7 +103,7 @@
this.btnRestart.Location = new System.Drawing.Point(6, 77); this.btnRestart.Location = new System.Drawing.Point(6, 77);
this.btnRestart.Name = "btnRestart"; this.btnRestart.Name = "btnRestart";
this.btnRestart.Size = new System.Drawing.Size(171, 23); this.btnRestart.Size = new System.Drawing.Size(171, 23);
this.btnRestart.TabIndex = 17; this.btnRestart.TabIndex = 2;
this.btnRestart.Text = "Restart the Program"; this.btnRestart.Text = "Restart the Program";
this.toolTip.SetToolTip(this.btnRestart, "Restarts the program using the same command\r\nline arguments that were used at lau" + this.toolTip.SetToolTip(this.btnRestart, "Restarts the program using the same command\r\nline arguments that were used at lau" +
"nch."); "nch.");
@@ -114,7 +114,7 @@
this.btnOpenAppFolder.Location = new System.Drawing.Point(6, 19); this.btnOpenAppFolder.Location = new System.Drawing.Point(6, 19);
this.btnOpenAppFolder.Name = "btnOpenAppFolder"; this.btnOpenAppFolder.Name = "btnOpenAppFolder";
this.btnOpenAppFolder.Size = new System.Drawing.Size(171, 23); this.btnOpenAppFolder.Size = new System.Drawing.Size(171, 23);
this.btnOpenAppFolder.TabIndex = 16; this.btnOpenAppFolder.TabIndex = 0;
this.btnOpenAppFolder.Text = "Open Program Folder"; this.btnOpenAppFolder.Text = "Open Program Folder";
this.toolTip.SetToolTip(this.btnOpenAppFolder, "Opens the folder where the app is located."); this.toolTip.SetToolTip(this.btnOpenAppFolder, "Opens the folder where the app is located.");
this.btnOpenAppFolder.UseVisualStyleBackColor = true; this.btnOpenAppFolder.UseVisualStyleBackColor = true;
@@ -124,7 +124,7 @@
this.btnOpenDataFolder.Location = new System.Drawing.Point(6, 48); this.btnOpenDataFolder.Location = new System.Drawing.Point(6, 48);
this.btnOpenDataFolder.Name = "btnOpenDataFolder"; this.btnOpenDataFolder.Name = "btnOpenDataFolder";
this.btnOpenDataFolder.Size = new System.Drawing.Size(171, 23); this.btnOpenDataFolder.Size = new System.Drawing.Size(171, 23);
this.btnOpenDataFolder.TabIndex = 19; this.btnOpenDataFolder.TabIndex = 1;
this.btnOpenDataFolder.Text = "Open Data Folder"; this.btnOpenDataFolder.Text = "Open Data Folder";
this.toolTip.SetToolTip(this.btnOpenDataFolder, "Opens the folder where your profile data is located."); this.toolTip.SetToolTip(this.btnOpenDataFolder, "Opens the folder where your profile data is located.");
this.btnOpenDataFolder.UseVisualStyleBackColor = true; this.btnOpenDataFolder.UseVisualStyleBackColor = true;
@@ -133,11 +133,11 @@
// //
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);
this.btnReset.TabIndex = 17; this.btnReset.TabIndex = 5;
this.btnReset.Text = "Restore Defaults"; this.btnReset.Text = "Restore Defaults";
this.btnReset.UseVisualStyleBackColor = true; this.btnReset.UseVisualStyleBackColor = true;
// //
@@ -145,11 +145,11 @@
// //
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);
this.btnImport.TabIndex = 16; this.btnImport.TabIndex = 4;
this.btnImport.Text = "Import Profile"; this.btnImport.Text = "Import Profile";
this.btnImport.UseVisualStyleBackColor = true; this.btnImport.UseVisualStyleBackColor = true;
// //
@@ -158,11 +158,11 @@
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);
this.btnExport.TabIndex = 15; this.btnExport.TabIndex = 3;
this.btnExport.Text = "Export Profile"; this.btnExport.Text = "Export Profile";
this.btnExport.UseVisualStyleBackColor = true; this.btnExport.UseVisualStyleBackColor = true;
// //
@@ -173,7 +173,7 @@
this.groupPerformance.Location = new System.Drawing.Point(9, 9); this.groupPerformance.Location = new System.Drawing.Point(9, 9);
this.groupPerformance.Name = "groupPerformance"; this.groupPerformance.Name = "groupPerformance";
this.groupPerformance.Size = new System.Drawing.Size(183, 74); this.groupPerformance.Size = new System.Drawing.Size(183, 74);
this.groupPerformance.TabIndex = 18; this.groupPerformance.TabIndex = 0;
this.groupPerformance.TabStop = false; this.groupPerformance.TabStop = false;
this.groupPerformance.Text = "Performance"; this.groupPerformance.Text = "Performance";
// //
@@ -184,7 +184,7 @@
this.groupConfiguration.Location = new System.Drawing.Point(9, 89); this.groupConfiguration.Location = new System.Drawing.Point(9, 89);
this.groupConfiguration.Name = "groupConfiguration"; this.groupConfiguration.Name = "groupConfiguration";
this.groupConfiguration.Size = new System.Drawing.Size(183, 77); this.groupConfiguration.Size = new System.Drawing.Size(183, 77);
this.groupConfiguration.TabIndex = 19; this.groupConfiguration.TabIndex = 1;
this.groupConfiguration.TabStop = false; this.groupConfiguration.TabStop = false;
this.groupConfiguration.Text = "Configuration"; this.groupConfiguration.Text = "Configuration";
// //
@@ -197,7 +197,7 @@
this.groupApp.Location = new System.Drawing.Point(198, 9); this.groupApp.Location = new System.Drawing.Point(198, 9);
this.groupApp.Name = "groupApp"; this.groupApp.Name = "groupApp";
this.groupApp.Size = new System.Drawing.Size(183, 135); this.groupApp.Size = new System.Drawing.Size(183, 135);
this.groupApp.TabIndex = 20; this.groupApp.TabIndex = 2;
this.groupApp.TabStop = false; this.groupApp.TabStop = false;
this.groupApp.Text = "App"; this.groupApp.Text = "App";
// //
@@ -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

@@ -180,7 +180,7 @@ namespace TweetDck.Core.Other.Settings{
} }
private void btnReset_Click(object sender, EventArgs e){ private void btnReset_Click(object sender, EventArgs e){
if (MessageBox.Show("This will reset all of your settings, including disabled plugins. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){ if (MessageBox.Show("This will reset all of your program settings. Plugins will not be affected. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
Program.ResetConfig(); Program.ResetConfig();
((FormSettings)ParentForm).ReloadUI(); ((FormSettings)ParentForm).ReloadUI();
} }

View File

@@ -29,15 +29,20 @@
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.checkTrayHighlight = new System.Windows.Forms.CheckBox(); this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
this.checkSpellCheck = new System.Windows.Forms.CheckBox(); this.checkSpellCheck = new System.Windows.Forms.CheckBox();
this.checkScreenshotBorder = new System.Windows.Forms.CheckBox(); this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
this.btnCheckUpdates = new System.Windows.Forms.Button();
this.labelZoomValue = new System.Windows.Forms.Label();
this.checkSwitchAccountSelectors = new System.Windows.Forms.CheckBox();
this.groupTray = new System.Windows.Forms.GroupBox(); this.groupTray = new System.Windows.Forms.GroupBox();
this.labelTrayIcon = new System.Windows.Forms.Label(); this.labelTrayIcon = new System.Windows.Forms.Label();
this.groupInterface = new System.Windows.Forms.GroupBox(); this.groupInterface = new System.Windows.Forms.GroupBox();
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.checkUpdateNotifications = new System.Windows.Forms.CheckBox(); this.zoomUpdateTimer = new System.Windows.Forms.Timer(this.components);
this.btnCheckUpdates = new System.Windows.Forms.Button();
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();
// //
@@ -45,10 +50,10 @@
// //
this.checkExpandLinks.AutoSize = true; this.checkExpandLinks.AutoSize = true;
this.checkExpandLinks.Location = new System.Drawing.Point(9, 21); this.checkExpandLinks.Location = new System.Drawing.Point(9, 21);
this.checkExpandLinks.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.checkExpandLinks.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
this.checkExpandLinks.Name = "checkExpandLinks"; this.checkExpandLinks.Name = "checkExpandLinks";
this.checkExpandLinks.Size = new System.Drawing.Size(166, 17); this.checkExpandLinks.Size = new System.Drawing.Size(166, 17);
this.checkExpandLinks.TabIndex = 14; this.checkExpandLinks.TabIndex = 0;
this.checkExpandLinks.Text = "Expand Links When Hovered"; this.checkExpandLinks.Text = "Expand Links When Hovered";
this.toolTip.SetToolTip(this.checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a toolti" + this.toolTip.SetToolTip(this.checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a toolti" +
"p instead."); "p instead.");
@@ -61,17 +66,17 @@
this.comboBoxTrayType.Location = new System.Drawing.Point(6, 19); this.comboBoxTrayType.Location = new System.Drawing.Point(6, 19);
this.comboBoxTrayType.Name = "comboBoxTrayType"; this.comboBoxTrayType.Name = "comboBoxTrayType";
this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21); this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21);
this.comboBoxTrayType.TabIndex = 13; this.comboBoxTrayType.TabIndex = 0;
this.toolTip.SetToolTip(this.comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu."); this.toolTip.SetToolTip(this.comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
// //
// checkTrayHighlight // checkTrayHighlight
// //
this.checkTrayHighlight.AutoSize = true; this.checkTrayHighlight.AutoSize = true;
this.checkTrayHighlight.Location = new System.Drawing.Point(9, 70); this.checkTrayHighlight.Location = new System.Drawing.Point(9, 70);
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
this.checkTrayHighlight.Name = "checkTrayHighlight"; this.checkTrayHighlight.Name = "checkTrayHighlight";
this.checkTrayHighlight.Size = new System.Drawing.Size(103, 17); this.checkTrayHighlight.Size = new System.Drawing.Size(103, 17);
this.checkTrayHighlight.TabIndex = 15; this.checkTrayHighlight.TabIndex = 2;
this.checkTrayHighlight.Text = "Enable Highlight"; this.checkTrayHighlight.Text = "Enable Highlight";
this.toolTip.SetToolTip(this.checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with po" + this.toolTip.SetToolTip(this.checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with po" +
"pup or audio notifications.\r\nThe icon resets when the main window is restored."); "pup or audio notifications.\r\nThe icon resets when the main window is restored.");
@@ -80,79 +85,23 @@
// checkSpellCheck // checkSpellCheck
// //
this.checkSpellCheck.AutoSize = true; this.checkSpellCheck.AutoSize = true;
this.checkSpellCheck.Location = new System.Drawing.Point(9, 44); this.checkSpellCheck.Location = new System.Drawing.Point(9, 67);
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkSpellCheck.Name = "checkSpellCheck"; this.checkSpellCheck.Name = "checkSpellCheck";
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17); this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
this.checkSpellCheck.TabIndex = 15; this.checkSpellCheck.TabIndex = 2;
this.checkSpellCheck.Text = "Enable Spell Check"; this.checkSpellCheck.Text = "Enable Spell Check";
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly."); this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
this.checkSpellCheck.UseVisualStyleBackColor = true; this.checkSpellCheck.UseVisualStyleBackColor = true;
// //
// checkScreenshotBorder
//
this.checkScreenshotBorder.AutoSize = true;
this.checkScreenshotBorder.Location = new System.Drawing.Point(9, 67);
this.checkScreenshotBorder.Name = "checkScreenshotBorder";
this.checkScreenshotBorder.Size = new System.Drawing.Size(169, 17);
this.checkScreenshotBorder.TabIndex = 16;
this.checkScreenshotBorder.Text = "Include Border In Screenshots";
this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots.\r\nMay be glitchy in some cases, espe" +
"cially on Windows 10.");
this.checkScreenshotBorder.UseVisualStyleBackColor = true;
//
// groupTray
//
this.groupTray.Controls.Add(this.checkTrayHighlight);
this.groupTray.Controls.Add(this.labelTrayIcon);
this.groupTray.Controls.Add(this.comboBoxTrayType);
this.groupTray.Location = new System.Drawing.Point(9, 109);
this.groupTray.Name = "groupTray";
this.groupTray.Size = new System.Drawing.Size(183, 93);
this.groupTray.TabIndex = 15;
this.groupTray.TabStop = false;
this.groupTray.Text = "System Tray";
//
// labelTrayIcon
//
this.labelTrayIcon.AutoSize = true;
this.labelTrayIcon.Location = new System.Drawing.Point(6, 52);
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
this.labelTrayIcon.Name = "labelTrayIcon";
this.labelTrayIcon.Size = new System.Drawing.Size(52, 13);
this.labelTrayIcon.TabIndex = 14;
this.labelTrayIcon.Text = "Tray Icon";
//
// groupInterface
//
this.groupInterface.Controls.Add(this.checkScreenshotBorder);
this.groupInterface.Controls.Add(this.checkSpellCheck);
this.groupInterface.Controls.Add(this.checkExpandLinks);
this.groupInterface.Location = new System.Drawing.Point(9, 9);
this.groupInterface.Name = "groupInterface";
this.groupInterface.Size = new System.Drawing.Size(183, 90);
this.groupInterface.TabIndex = 16;
this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface";
//
// groupUpdates
//
this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
this.groupUpdates.Controls.Add(this.btnCheckUpdates);
this.groupUpdates.Location = new System.Drawing.Point(198, 9);
this.groupUpdates.Name = "groupUpdates";
this.groupUpdates.Size = new System.Drawing.Size(183, 75);
this.groupUpdates.TabIndex = 17;
this.groupUpdates.TabStop = false;
this.groupUpdates.Text = "Updates";
//
// checkUpdateNotifications // checkUpdateNotifications
// //
this.checkUpdateNotifications.AutoSize = true; this.checkUpdateNotifications.AutoSize = true;
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 21); this.checkUpdateNotifications.Location = new System.Drawing.Point(9, 21);
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
this.checkUpdateNotifications.Name = "checkUpdateNotifications"; this.checkUpdateNotifications.Name = "checkUpdateNotifications";
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17); this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
this.checkUpdateNotifications.TabIndex = 14; this.checkUpdateNotifications.TabIndex = 0;
this.checkUpdateNotifications.Text = "Check Updates Automatically"; this.checkUpdateNotifications.Text = "Check Updates Automatically";
this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" + this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" +
"in."); "in.");
@@ -163,11 +112,118 @@
this.btnCheckUpdates.Location = new System.Drawing.Point(6, 44); this.btnCheckUpdates.Location = new System.Drawing.Point(6, 44);
this.btnCheckUpdates.Name = "btnCheckUpdates"; this.btnCheckUpdates.Name = "btnCheckUpdates";
this.btnCheckUpdates.Size = new System.Drawing.Size(171, 23); this.btnCheckUpdates.Size = new System.Drawing.Size(171, 23);
this.btnCheckUpdates.TabIndex = 15; this.btnCheckUpdates.TabIndex = 1;
this.btnCheckUpdates.Text = "Check Updates Now"; this.btnCheckUpdates.Text = "Check Updates Now";
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed."); this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
this.btnCheckUpdates.UseVisualStyleBackColor = true; this.btnCheckUpdates.UseVisualStyleBackColor = true;
// //
// labelZoomValue
//
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
this.labelZoomValue.Location = new System.Drawing.Point(139, 116);
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 = 5;
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.");
//
// checkSwitchAccountSelectors
//
this.checkSwitchAccountSelectors.AutoSize = true;
this.checkSwitchAccountSelectors.Location = new System.Drawing.Point(9, 44);
this.checkSwitchAccountSelectors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkSwitchAccountSelectors.Name = "checkSwitchAccountSelectors";
this.checkSwitchAccountSelectors.Size = new System.Drawing.Size(172, 17);
this.checkSwitchAccountSelectors.TabIndex = 1;
this.checkSwitchAccountSelectors.Text = "Shift Selects Multiple Accounts";
this.toolTip.SetToolTip(this.checkSwitchAccountSelectors, "When (re)tweeting, click to select a single account or hold Shift to\r\nselect mult" +
"iple accounts, instead of TweetDeck\'s default behavior.");
this.checkSwitchAccountSelectors.UseVisualStyleBackColor = true;
//
// groupTray
//
this.groupTray.Controls.Add(this.checkTrayHighlight);
this.groupTray.Controls.Add(this.labelTrayIcon);
this.groupTray.Controls.Add(this.comboBoxTrayType);
this.groupTray.Location = new System.Drawing.Point(9, 168);
this.groupTray.Name = "groupTray";
this.groupTray.Size = new System.Drawing.Size(183, 93);
this.groupTray.TabIndex = 1;
this.groupTray.TabStop = false;
this.groupTray.Text = "System Tray";
//
// labelTrayIcon
//
this.labelTrayIcon.AutoSize = true;
this.labelTrayIcon.Location = new System.Drawing.Point(6, 52);
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
this.labelTrayIcon.Name = "labelTrayIcon";
this.labelTrayIcon.Size = new System.Drawing.Size(52, 13);
this.labelTrayIcon.TabIndex = 1;
this.labelTrayIcon.Text = "Tray Icon";
//
// groupInterface
//
this.groupInterface.Controls.Add(this.checkSwitchAccountSelectors);
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.checkExpandLinks);
this.groupInterface.Location = new System.Drawing.Point(9, 9);
this.groupInterface.Name = "groupInterface";
this.groupInterface.Size = new System.Drawing.Size(183, 153);
this.groupInterface.TabIndex = 0;
this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface";
//
// trackBarZoom
//
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | 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, 115);
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 = 4;
this.trackBarZoom.TickFrequency = 25;
this.trackBarZoom.Value = 100;
//
// labelZoom
//
this.labelZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelZoom.AutoSize = true;
this.labelZoom.Location = new System.Drawing.Point(5, 99);
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 = 3;
this.labelZoom.Text = "Zoom";
//
// groupUpdates
//
this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
this.groupUpdates.Controls.Add(this.btnCheckUpdates);
this.groupUpdates.Location = new System.Drawing.Point(198, 9);
this.groupUpdates.Name = "groupUpdates";
this.groupUpdates.Size = new System.Drawing.Size(183, 75);
this.groupUpdates.TabIndex = 2;
this.groupUpdates.TabStop = false;
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);
@@ -176,11 +232,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);
@@ -197,9 +254,13 @@
private System.Windows.Forms.Label labelTrayIcon; private System.Windows.Forms.Label labelTrayIcon;
private System.Windows.Forms.CheckBox checkTrayHighlight; private System.Windows.Forms.CheckBox checkTrayHighlight;
private System.Windows.Forms.CheckBox checkSpellCheck; private System.Windows.Forms.CheckBox checkSpellCheck;
private System.Windows.Forms.CheckBox checkScreenshotBorder;
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;
private System.Windows.Forms.CheckBox checkSwitchAccountSelectors;
} }
} }

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;
@@ -22,9 +23,13 @@ namespace TweetDck.Core.Other.Settings{
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;
checkSwitchAccountSelectors.Checked = Config.SwitchAccountSelectors;
checkSpellCheck.Checked = Config.EnableSpellCheck; checkSpellCheck.Checked = Config.EnableSpellCheck;
checkScreenshotBorder.Checked = Config.ShowScreenshotBorder;
checkTrayHighlight.Checked = Config.EnableTrayHighlight; checkTrayHighlight.Checked = Config.EnableTrayHighlight;
checkUpdateNotifications.Checked = Config.EnableUpdateCheck; checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
@@ -32,8 +37,9 @@ namespace TweetDck.Core.Other.Settings{
public override void OnReady(){ public override void OnReady(){
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged; checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
checkSwitchAccountSelectors.CheckedChanged += checkSwitchAccountSelectors_CheckedChanged;
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged; checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
checkScreenshotBorder.CheckedChanged += checkScreenshotBorder_CheckedChanged; trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged; comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged; checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
@@ -42,17 +48,32 @@ 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;
} }
private void checkSwitchAccountSelectors_CheckedChanged(object sender, EventArgs e){
Config.SwitchAccountSelectors = checkSwitchAccountSelectors.Checked;
}
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){ private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
Config.EnableSpellCheck = checkSpellCheck.Checked; Config.EnableSpellCheck = checkSpellCheck.Checked;
PromptRestart(); PromptRestart();
} }
private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){ private void trackBarZoom_ValueChanged(object sender, EventArgs e){
Config.ShowScreenshotBorder = checkScreenshotBorder.Checked; 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){
@@ -88,5 +109,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,8 @@
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.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();
this.checkNonIntrusive = new System.Windows.Forms.CheckBox(); this.checkNonIntrusive = new System.Windows.Forms.CheckBox();
@@ -71,30 +73,30 @@
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 = 1; this.groupNotificationLocation.TabIndex = 2;
this.groupNotificationLocation.TabStop = false; this.groupNotificationLocation.TabStop = false;
this.groupNotificationLocation.Text = "Location"; this.groupNotificationLocation.Text = "Location";
// //
// 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);
this.labelEdgeDistanceValue.TabIndex = 11; this.labelEdgeDistanceValue.TabIndex = 9;
this.labelEdgeDistanceValue.Text = "0 px"; this.labelEdgeDistanceValue.Text = "0 px";
this.labelEdgeDistanceValue.TextAlign = System.Drawing.ContentAlignment.TopRight; this.labelEdgeDistanceValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// labelDisplay // labelDisplay
// //
this.labelDisplay.AutoSize = true; this.labelDisplay.AutoSize = true;
this.labelDisplay.Location = new System.Drawing.Point(3, 148); this.labelDisplay.Location = new System.Drawing.Point(5, 144);
this.labelDisplay.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelDisplay.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelDisplay.Name = "labelDisplay"; this.labelDisplay.Name = "labelDisplay";
this.labelDisplay.Size = new System.Drawing.Size(41, 13); this.labelDisplay.Size = new System.Drawing.Size(41, 13);
this.labelDisplay.TabIndex = 8; this.labelDisplay.TabIndex = 5;
this.labelDisplay.Text = "Display"; this.labelDisplay.Text = "Display";
// //
// comboBoxDisplay // comboBoxDisplay
@@ -103,25 +105,26 @@
| 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(6, 164); 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 = 7; this.comboBoxDisplay.TabIndex = 6;
// //
// labelEdgeDistance // labelEdgeDistance
// //
this.labelEdgeDistance.AutoSize = true; this.labelEdgeDistance.AutoSize = true;
this.labelEdgeDistance.Location = new System.Drawing.Point(3, 197); 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 = 6; this.labelEdgeDistance.TabIndex = 7;
this.labelEdgeDistance.Text = "Distance From Edge"; this.labelEdgeDistance.Text = "Distance From Edge";
// //
// radioLocCustom // radioLocCustom
// //
this.radioLocCustom.AutoSize = true; this.radioLocCustom.AutoSize = true;
this.radioLocCustom.Location = new System.Drawing.Point(7, 116); this.radioLocCustom.Location = new System.Drawing.Point(8, 112);
this.radioLocCustom.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
this.radioLocCustom.Name = "radioLocCustom"; this.radioLocCustom.Name = "radioLocCustom";
this.radioLocCustom.Size = new System.Drawing.Size(60, 17); this.radioLocCustom.Size = new System.Drawing.Size(60, 17);
this.radioLocCustom.TabIndex = 4; this.radioLocCustom.TabIndex = 4;
@@ -133,7 +136,8 @@
// radioLocBR // radioLocBR
// //
this.radioLocBR.AutoSize = true; this.radioLocBR.AutoSize = true;
this.radioLocBR.Location = new System.Drawing.Point(7, 92); this.radioLocBR.Location = new System.Drawing.Point(8, 89);
this.radioLocBR.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
this.radioLocBR.Name = "radioLocBR"; this.radioLocBR.Name = "radioLocBR";
this.radioLocBR.Size = new System.Drawing.Size(86, 17); this.radioLocBR.Size = new System.Drawing.Size(86, 17);
this.radioLocBR.TabIndex = 3; this.radioLocBR.TabIndex = 3;
@@ -144,7 +148,8 @@
// radioLocBL // radioLocBL
// //
this.radioLocBL.AutoSize = true; this.radioLocBL.AutoSize = true;
this.radioLocBL.Location = new System.Drawing.Point(7, 68); this.radioLocBL.Location = new System.Drawing.Point(8, 66);
this.radioLocBL.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
this.radioLocBL.Name = "radioLocBL"; this.radioLocBL.Name = "radioLocBL";
this.radioLocBL.Size = new System.Drawing.Size(79, 17); this.radioLocBL.Size = new System.Drawing.Size(79, 17);
this.radioLocBL.TabIndex = 2; this.radioLocBL.TabIndex = 2;
@@ -155,7 +160,8 @@
// radioLocTR // radioLocTR
// //
this.radioLocTR.AutoSize = true; this.radioLocTR.AutoSize = true;
this.radioLocTR.Location = new System.Drawing.Point(7, 44); this.radioLocTR.Location = new System.Drawing.Point(8, 43);
this.radioLocTR.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
this.radioLocTR.Name = "radioLocTR"; this.radioLocTR.Name = "radioLocTR";
this.radioLocTR.Size = new System.Drawing.Size(72, 17); this.radioLocTR.Size = new System.Drawing.Size(72, 17);
this.radioLocTR.TabIndex = 1; this.radioLocTR.TabIndex = 1;
@@ -166,7 +172,8 @@
// radioLocTL // radioLocTL
// //
this.radioLocTL.AutoSize = true; this.radioLocTL.AutoSize = true;
this.radioLocTL.Location = new System.Drawing.Point(7, 20); this.radioLocTL.Location = new System.Drawing.Point(8, 20);
this.radioLocTL.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
this.radioLocTL.Name = "radioLocTL"; this.radioLocTL.Name = "radioLocTL";
this.radioLocTL.Size = new System.Drawing.Size(65, 17); this.radioLocTL.Size = new System.Drawing.Size(65, 17);
this.radioLocTL.TabIndex = 0; this.radioLocTL.TabIndex = 0;
@@ -178,14 +185,15 @@
// //
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(6, 213); 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 = 5; this.trackBarEdgeDistance.TabIndex = 8;
this.trackBarEdgeDistance.TickFrequency = 4; this.trackBarEdgeDistance.TickFrequency = 4;
this.trackBarEdgeDistance.Value = 8; this.trackBarEdgeDistance.Value = 8;
// //
@@ -194,10 +202,10 @@
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, 160); 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 = 9; this.groupNotificationDuration.TabIndex = 1;
this.groupNotificationDuration.TabStop = false; this.groupNotificationDuration.TabStop = false;
this.groupNotificationDuration.Text = "Duration"; this.groupNotificationDuration.Text = "Duration";
// //
@@ -217,7 +225,7 @@
this.tableLayoutDurationButtons.RowCount = 1; this.tableLayoutDurationButtons.RowCount = 1;
this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutDurationButtons.Size = new System.Drawing.Size(171, 27); this.tableLayoutDurationButtons.Size = new System.Drawing.Size(171, 27);
this.tableLayoutDurationButtons.TabIndex = 5; this.tableLayoutDurationButtons.TabIndex = 2;
// //
// btnDurationMedium // btnDurationMedium
// //
@@ -230,7 +238,7 @@
this.btnDurationMedium.Margin = new System.Windows.Forms.Padding(1); this.btnDurationMedium.Margin = new System.Windows.Forms.Padding(1);
this.btnDurationMedium.Name = "btnDurationMedium"; this.btnDurationMedium.Name = "btnDurationMedium";
this.btnDurationMedium.Size = new System.Drawing.Size(59, 25); this.btnDurationMedium.Size = new System.Drawing.Size(59, 25);
this.btnDurationMedium.TabIndex = 2; this.btnDurationMedium.TabIndex = 1;
this.btnDurationMedium.Text = "Medium"; this.btnDurationMedium.Text = "Medium";
this.btnDurationMedium.UseVisualStyleBackColor = true; this.btnDurationMedium.UseVisualStyleBackColor = true;
// //
@@ -245,7 +253,7 @@
this.btnDurationLong.Margin = new System.Windows.Forms.Padding(1); this.btnDurationLong.Margin = new System.Windows.Forms.Padding(1);
this.btnDurationLong.Name = "btnDurationLong"; this.btnDurationLong.Name = "btnDurationLong";
this.btnDurationLong.Size = new System.Drawing.Size(54, 25); this.btnDurationLong.Size = new System.Drawing.Size(54, 25);
this.btnDurationLong.TabIndex = 1; this.btnDurationLong.TabIndex = 2;
this.btnDurationLong.Text = "Long"; this.btnDurationLong.Text = "Long";
this.btnDurationLong.UseVisualStyleBackColor = true; this.btnDurationLong.UseVisualStyleBackColor = true;
// //
@@ -272,7 +280,7 @@
this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelDurationValue.Name = "labelDurationValue"; this.labelDurationValue.Name = "labelDurationValue";
this.labelDurationValue.Size = new System.Drawing.Size(48, 13); this.labelDurationValue.Size = new System.Drawing.Size(48, 13);
this.labelDurationValue.TabIndex = 13; this.labelDurationValue.TabIndex = 1;
this.labelDurationValue.Text = "0 ms/c"; this.labelDurationValue.Text = "0 ms/c";
this.labelDurationValue.TextAlign = System.Drawing.ContentAlignment.TopRight; this.labelDurationValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.toolTip.SetToolTip(this.labelDurationValue, "Milliseconds per character."); this.toolTip.SetToolTip(this.labelDurationValue, "Milliseconds per character.");
@@ -281,17 +289,20 @@
// //
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 = 12; 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.labelIdlePause); this.groupUserInterface.Controls.Add(this.labelIdlePause);
this.groupUserInterface.Controls.Add(this.comboBoxIdlePause); this.groupUserInterface.Controls.Add(this.comboBoxIdlePause);
this.groupUserInterface.Controls.Add(this.checkNonIntrusive); this.groupUserInterface.Controls.Add(this.checkNonIntrusive);
@@ -299,40 +310,67 @@
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, 145); this.groupUserInterface.Size = new System.Drawing.Size(183, 187);
this.groupUserInterface.TabIndex = 10; 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
//
this.checkColumnName.AutoSize = true;
this.checkColumnName.Location = new System.Drawing.Point(9, 21);
this.checkColumnName.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
this.checkColumnName.Name = "checkColumnName";
this.checkColumnName.Size = new System.Drawing.Size(129, 17);
this.checkColumnName.TabIndex = 0;
this.checkColumnName.Text = "Display Column Name";
this.toolTip.SetToolTip(this.checkColumnName, "Shows column name each notification originated\r\nfrom in the notification window t" +
"itle.");
this.checkColumnName.UseVisualStyleBackColor = true;
//
// labelIdlePause // labelIdlePause
// //
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, 99); 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);
this.labelIdlePause.TabIndex = 10; this.labelIdlePause.TabIndex = 3;
this.labelIdlePause.Text = "Pause When Idle"; this.labelIdlePause.Text = "Pause When Idle";
// //
// comboBoxIdlePause // comboBoxIdlePause
// //
this.comboBoxIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.comboBoxIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| 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, 115); 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 = 9; this.comboBoxIdlePause.TabIndex = 4;
this.toolTip.SetToolTip(this.comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time."); this.toolTip.SetToolTip(this.comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time.");
// //
// checkNonIntrusive // checkNonIntrusive
// //
this.checkNonIntrusive.AutoSize = true; this.checkNonIntrusive.AutoSize = true;
this.checkNonIntrusive.Location = new System.Drawing.Point(6, 67); this.checkNonIntrusive.Location = new System.Drawing.Point(9, 113);
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 = 7; 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.");
@@ -341,10 +379,11 @@
// checkTimerCountDown // checkTimerCountDown
// //
this.checkTimerCountDown.AutoSize = true; this.checkTimerCountDown.AutoSize = true;
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 44); this.checkTimerCountDown.Location = new System.Drawing.Point(9, 67);
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 = 6; 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;
@@ -352,13 +391,12 @@
// checkNotificationTimer // checkNotificationTimer
// //
this.checkNotificationTimer.AutoSize = true; this.checkNotificationTimer.AutoSize = true;
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 21); this.checkNotificationTimer.Location = new System.Drawing.Point(9, 44);
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(3, 5, 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 = 4; 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
@@ -369,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);
@@ -398,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;
@@ -411,5 +446,9 @@
private System.Windows.Forms.CheckBox checkNonIntrusive; private System.Windows.Forms.CheckBox checkNonIntrusive;
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 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";
@@ -55,9 +58,11 @@ namespace TweetDck.Core.Other.Settings{
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1, Config.NotificationDisplay); comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1, Config.NotificationDisplay);
checkColumnName.Checked = Config.DisplayNotificationColumn;
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);
@@ -71,15 +76,17 @@ 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;
btnDurationMedium.Click += btnDurationMedium_Click; btnDurationMedium.Click += btnDurationMedium_Click;
btnDurationLong.Click += btnDurationLong_Click; btnDurationLong.Click += btnDurationLong_Click;
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;
@@ -107,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){
@@ -138,6 +159,11 @@ namespace TweetDck.Core.Other.Settings{
trackBarDuration.Value = 35; trackBarDuration.Value = 35;
} }
private void checkColumnName_CheckedChanged(object sender, EventArgs e){
Config.DisplayNotificationColumn = checkColumnName.Checked;
notification.ShowNotificationForSettings(false);
}
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){ private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
Config.DisplayNotificationTimer = checkNotificationTimer.Checked; Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
checkTimerCountDown.Enabled = checkNotificationTimer.Checked; checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
@@ -149,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

@@ -42,7 +42,7 @@
this.groupCustomSound.Location = new System.Drawing.Point(9, 9); this.groupCustomSound.Location = new System.Drawing.Point(9, 9);
this.groupCustomSound.Name = "groupCustomSound"; this.groupCustomSound.Name = "groupCustomSound";
this.groupCustomSound.Size = new System.Drawing.Size(372, 75); this.groupCustomSound.Size = new System.Drawing.Size(372, 75);
this.groupCustomSound.TabIndex = 11; this.groupCustomSound.TabIndex = 0;
this.groupCustomSound.TabStop = false; this.groupCustomSound.TabStop = false;
this.groupCustomSound.Text = "Custom Sound Notification"; this.groupCustomSound.Text = "Custom Sound Notification";
// //
@@ -53,7 +53,7 @@
this.btnPlaySound.Name = "btnPlaySound"; this.btnPlaySound.Name = "btnPlaySound";
this.btnPlaySound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnPlaySound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnPlaySound.Size = new System.Drawing.Size(43, 23); this.btnPlaySound.Size = new System.Drawing.Size(43, 23);
this.btnPlaySound.TabIndex = 3; this.btnPlaySound.TabIndex = 2;
this.btnPlaySound.Text = "Play"; this.btnPlaySound.Text = "Play";
this.btnPlaySound.UseVisualStyleBackColor = true; this.btnPlaySound.UseVisualStyleBackColor = true;
// //
@@ -64,7 +64,7 @@
this.btnResetSound.Name = "btnResetSound"; this.btnResetSound.Name = "btnResetSound";
this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnResetSound.Size = new System.Drawing.Size(51, 23); this.btnResetSound.Size = new System.Drawing.Size(51, 23);
this.btnResetSound.TabIndex = 2; this.btnResetSound.TabIndex = 3;
this.btnResetSound.Text = "Reset"; this.btnResetSound.Text = "Reset";
this.btnResetSound.UseVisualStyleBackColor = true; this.btnResetSound.UseVisualStyleBackColor = true;
// //
@@ -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

@@ -12,9 +12,7 @@ namespace TweetDck.Core{
public event EventHandler ClickClose; public event EventHandler ClickClose;
public bool Visible{ public bool Visible{
get{ get => notifyIcon.Visible;
return notifyIcon.Visible;
}
set{ set{
if (value){ if (value){
@@ -72,9 +70,7 @@ namespace TweetDck.Core{
} }
private void menuItemRestore_Click(object sender, EventArgs e){ private void menuItemRestore_Click(object sender, EventArgs e){
if (ClickRestore != null){ ClickRestore?.Invoke(this, e);
ClickRestore(this, e);
}
} }
private void menuItemMuteNotifications_Click(object sender, EventArgs e){ private void menuItemMuteNotifications_Click(object sender, EventArgs e){
@@ -83,9 +79,7 @@ namespace TweetDck.Core{
} }
private void menuItemClose_Click(object sender, EventArgs e){ private void menuItemClose_Click(object sender, EventArgs e){
if (ClickClose != null){ ClickClose?.Invoke(this, e);
ClickClose(this, e);
}
} }
} }

View File

@@ -1,12 +1,12 @@
using System; using CefSharp;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Windows.Forms;
using CefSharp;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Drawing; using System.Windows.Forms;
namespace TweetDck.Core.Utils{ namespace TweetDck.Core.Utils{
static class BrowserUtils{ static class BrowserUtils{
@@ -23,11 +23,7 @@ namespace TweetDck.Core.Utils{
} }
} }
public static string HeaderUserAgent{ public static string HeaderUserAgent => Program.BrandName+" "+Application.ProductVersion;
get{
return Program.BrandName+" "+Application.ProductVersion;
}
}
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153); public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'"; public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
@@ -37,9 +33,7 @@ namespace TweetDck.Core.Utils{
}; };
public static bool IsValidUrl(string url){ public static bool IsValidUrl(string url){
Uri uri; if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
if (Uri.TryCreate(url, UriKind.Absolute, out uri)){
string scheme = uri.Scheme; string scheme = uri.Scheme;
return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto; return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto;
} }
@@ -88,10 +82,18 @@ 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/");
} }
public static bool IsTwitterWebsite(IFrame frame){
return frame.Url.Contains("//twitter.com/");
}
#if DEBUG #if DEBUG
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){ public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line); Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);

View File

@@ -35,11 +35,7 @@ namespace TweetDck.Core.Utils{
private readonly HashSet<string> flags = new HashSet<string>(); private readonly HashSet<string> flags = new HashSet<string>();
private readonly Dictionary<string, string> values = new Dictionary<string, string>(); private readonly Dictionary<string, string> values = new Dictionary<string, string>();
public int Count{ public int Count => flags.Count+values.Count;
get{
return flags.Count+values.Count;
}
}
public void AddFlag(string flag){ public void AddFlag(string flag){
flags.Add(flag.ToLowerInvariant()); flags.Add(flag.ToLowerInvariant());
@@ -62,8 +58,7 @@ namespace TweetDck.Core.Utils{
} }
public string GetValue(string key, string defaultValue){ public string GetValue(string key, string defaultValue){
string val; return values.TryGetValue(key.ToLowerInvariant(), out string val) ? val : defaultValue;
return values.TryGetValue(key.ToLowerInvariant(), out val) ? val : defaultValue;
} }
public void RemoveValue(string key){ public void RemoveValue(string key){

View File

@@ -4,11 +4,7 @@ namespace TweetDck.Core.Utils{
static class CommandLineArgsParser{ static class CommandLineArgsParser{
private static Regex splitRegex; private static Regex splitRegex;
private static Regex SplitRegex{ private static Regex SplitRegex => splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
get{
return splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
}
}
public static CommandLineArgs ReadCefArguments(string argumentString){ public static CommandLineArgs ReadCefArguments(string argumentString){
CommandLineArgs args = new CommandLineArgs(); CommandLineArgs args = new CommandLineArgs();

View File

@@ -9,17 +9,8 @@ namespace TweetDck.Core.Utils{
private static readonly string DisabledLibEGL = LibEGL+".bak"; private static readonly string DisabledLibEGL = LibEGL+".bak";
private static readonly string DisabledLibGLES = LibGLES+".bak"; private static readonly string DisabledLibGLES = LibGLES+".bak";
public static bool IsEnabled{ public static bool IsEnabled => File.Exists(LibEGL) && File.Exists(LibGLES);
get{ public static bool CanEnable => File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
return File.Exists(LibEGL) && File.Exists(LibGLES);
}
}
public static bool CanEnable{
get{
return File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
}
}
public static bool Enable(){ public static bool Enable(){
if (IsEnabled)return false; if (IsEnabled)return false;

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{
@@ -51,13 +55,10 @@ namespace TweetDck.Core.Utils{
private static extern bool GetLastInputInfo(ref LASTINPUTINFO info); private static extern bool GetLastInputInfo(ref LASTINPUTINFO info);
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd); public static extern IntPtr GetDC(IntPtr hWnd);
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern IntPtr GetDC(IntPtr hWnd); public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("user32.dll")]
private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("gdi32.dll")] [DllImport("gdi32.dll")]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
@@ -86,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;
} }
@@ -108,10 +109,6 @@ namespace TweetDck.Core.Utils{
return Math.Max(0, seconds); // ignore rollover after several weeks of uptime return Math.Max(0, seconds); // ignore rollover after several weeks of uptime
} }
public static IntPtr GetDeviceContext(Form form, bool includeBorder){
return includeBorder ? GetWindowDC(form.Handle) : GetDC(form.Handle);
}
public static void RenderSourceIntoBitmap(IntPtr source, Bitmap target){ public static void RenderSourceIntoBitmap(IntPtr source, Bitmap target){
using(Graphics graphics = Graphics.FromImage(target)){ using(Graphics graphics = Graphics.FromImage(target)){
IntPtr graphicsHandle = graphics.GetHdc(); IntPtr graphicsHandle = graphics.GetHdc();
@@ -123,9 +120,5 @@ namespace TweetDck.Core.Utils{
} }
} }
} }
public static void ReleaseDeviceContext(Form form, IntPtr ctx){
ReleaseDC(form.Handle, ctx);
}
} }
} }

View File

@@ -21,9 +21,7 @@ namespace TweetDck.Core.Utils{
} }
set{ set{
Dictionary<K2, V> innerDict; if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
if (!dict.TryGetValue(outerKey, out innerDict)){
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity)); dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
} }
@@ -44,9 +42,7 @@ namespace TweetDck.Core.Utils{
// Members // Members
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
Dictionary<K2, V> innerDict; if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
if (!dict.TryGetValue(outerKey, out innerDict)){
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity)); dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
} }
@@ -54,7 +50,7 @@ namespace TweetDck.Core.Utils{
} }
public void Clear(){ public void Clear(){
this.dict.Clear(); dict.Clear();
} }
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1) public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
@@ -83,10 +79,8 @@ namespace TweetDck.Core.Utils{
} }
public bool Remove(K1 outerKey, K2 innerKey){ public bool Remove(K1 outerKey, K2 innerKey){
Dictionary<K2, V> innerDict; if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict) && innerDict.Remove(innerKey)){
if (innerDict.Count == 0) {
if (dict.TryGetValue(outerKey, out innerDict) && innerDict.Remove(innerKey)){
if (innerDict.Count == 0){
dict.Remove(outerKey); dict.Remove(outerKey);
} }
@@ -96,9 +90,7 @@ namespace TweetDck.Core.Utils{
} }
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){ public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
Dictionary<K2, V> innerDict; if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
if (dict.TryGetValue(outerKey, out innerDict)){
return innerDict.TryGetValue(innerKey, out value); return innerDict.TryGetValue(innerKey, out value);
} }
else{ else{

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

@@ -8,6 +8,13 @@ using System.Windows.Forms;
namespace TweetDck.Core.Utils{ namespace TweetDck.Core.Utils{
static class WindowsUtils{ static class WindowsUtils{
public static bool ShouldAvoidToolWindow { get; }
static WindowsUtils(){
Version ver = Environment.OSVersion.Version;
ShouldAvoidToolWindow = ver.Major == 6 && ver.Minor == 2; // windows 8/10
}
public static bool CheckFolderWritePermission(string path){ public static bool CheckFolderWritePermission(string path){
string testFile = Path.Combine(path, ".test"); string testFile = Path.Combine(path, ".test");

View File

@@ -42,7 +42,7 @@
this.btnToggleState.Location = new System.Drawing.Point(459, 80); this.btnToggleState.Location = new System.Drawing.Point(459, 80);
this.btnToggleState.Name = "btnToggleState"; this.btnToggleState.Name = "btnToggleState";
this.btnToggleState.Size = new System.Drawing.Size(65, 23); this.btnToggleState.Size = new System.Drawing.Size(65, 23);
this.btnToggleState.TabIndex = 0; this.btnToggleState.TabIndex = 5;
this.btnToggleState.Text = "Disable"; this.btnToggleState.Text = "Disable";
this.btnToggleState.UseVisualStyleBackColor = true; this.btnToggleState.UseVisualStyleBackColor = true;
this.btnToggleState.Click += new System.EventHandler(this.btnToggleState_Click); this.btnToggleState.Click += new System.EventHandler(this.btnToggleState_Click);
@@ -54,7 +54,7 @@
this.labelName.Location = new System.Drawing.Point(7, 7); this.labelName.Location = new System.Drawing.Point(7, 7);
this.labelName.Name = "labelName"; this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(61, 24); this.labelName.Size = new System.Drawing.Size(61, 24);
this.labelName.TabIndex = 1; this.labelName.TabIndex = 0;
this.labelName.Text = "Name"; this.labelName.Text = "Name";
this.labelName.UseMnemonic = false; this.labelName.UseMnemonic = false;
// //
@@ -80,7 +80,7 @@
this.labelDescription.Margin = new System.Windows.Forms.Padding(0); this.labelDescription.Margin = new System.Windows.Forms.Padding(0);
this.labelDescription.Name = "labelDescription"; this.labelDescription.Name = "labelDescription";
this.labelDescription.Size = new System.Drawing.Size(13, 39); this.labelDescription.Size = new System.Drawing.Size(13, 39);
this.labelDescription.TabIndex = 3; this.labelDescription.TabIndex = 0;
this.labelDescription.Text = "a\r\nb\r\nc"; this.labelDescription.Text = "a\r\nb\r\nc";
this.labelDescription.UseMnemonic = false; this.labelDescription.UseMnemonic = false;
// //
@@ -91,7 +91,7 @@
this.labelAuthor.Margin = new System.Windows.Forms.Padding(3, 0, 32, 0); this.labelAuthor.Margin = new System.Windows.Forms.Padding(3, 0, 32, 0);
this.labelAuthor.Name = "labelAuthor"; this.labelAuthor.Name = "labelAuthor";
this.labelAuthor.Size = new System.Drawing.Size(38, 13); this.labelAuthor.Size = new System.Drawing.Size(38, 13);
this.labelAuthor.TabIndex = 3; this.labelAuthor.TabIndex = 0;
this.labelAuthor.Text = "Author"; this.labelAuthor.Text = "Author";
this.labelAuthor.UseMnemonic = false; this.labelAuthor.UseMnemonic = false;
// //
@@ -104,7 +104,7 @@
this.flowLayoutInfo.Location = new System.Drawing.Point(11, 85); this.flowLayoutInfo.Location = new System.Drawing.Point(11, 85);
this.flowLayoutInfo.Name = "flowLayoutInfo"; this.flowLayoutInfo.Name = "flowLayoutInfo";
this.flowLayoutInfo.Size = new System.Drawing.Size(368, 18); this.flowLayoutInfo.Size = new System.Drawing.Size(368, 18);
this.flowLayoutInfo.TabIndex = 4; this.flowLayoutInfo.TabIndex = 3;
this.flowLayoutInfo.WrapContents = false; this.flowLayoutInfo.WrapContents = false;
// //
// labelWebsite // labelWebsite
@@ -116,7 +116,7 @@
this.labelWebsite.Location = new System.Drawing.Point(76, 0); this.labelWebsite.Location = new System.Drawing.Point(76, 0);
this.labelWebsite.Name = "labelWebsite"; this.labelWebsite.Name = "labelWebsite";
this.labelWebsite.Size = new System.Drawing.Size(46, 13); this.labelWebsite.Size = new System.Drawing.Size(46, 13);
this.labelWebsite.TabIndex = 5; this.labelWebsite.TabIndex = 1;
this.labelWebsite.Text = "Website"; this.labelWebsite.Text = "Website";
this.labelWebsite.UseMnemonic = false; this.labelWebsite.UseMnemonic = false;
this.labelWebsite.Click += new System.EventHandler(this.labelWebsite_Click); this.labelWebsite.Click += new System.EventHandler(this.labelWebsite_Click);
@@ -129,7 +129,7 @@
this.labelVersion.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0); this.labelVersion.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
this.labelVersion.Name = "labelVersion"; this.labelVersion.Name = "labelVersion";
this.labelVersion.Size = new System.Drawing.Size(513, 13); this.labelVersion.Size = new System.Drawing.Size(513, 13);
this.labelVersion.TabIndex = 5; this.labelVersion.TabIndex = 1;
this.labelVersion.Text = "Version"; this.labelVersion.Text = "Version";
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight; this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.labelVersion.UseMnemonic = false; this.labelVersion.UseMnemonic = false;
@@ -140,7 +140,7 @@
this.btnOpenConfig.Location = new System.Drawing.Point(385, 80); this.btnOpenConfig.Location = new System.Drawing.Point(385, 80);
this.btnOpenConfig.Name = "btnOpenConfig"; this.btnOpenConfig.Name = "btnOpenConfig";
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23); this.btnOpenConfig.Size = new System.Drawing.Size(68, 23);
this.btnOpenConfig.TabIndex = 6; this.btnOpenConfig.TabIndex = 4;
this.btnOpenConfig.Text = "Configure"; this.btnOpenConfig.Text = "Configure";
this.btnOpenConfig.UseVisualStyleBackColor = true; this.btnOpenConfig.UseVisualStyleBackColor = true;
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click); this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click);

View File

@@ -61,7 +61,7 @@ namespace TweetDck.Plugins.Controls{
} }
private void UpdatePluginState(){ private void UpdatePluginState(){
bool isEnabled = plugin.CanRun && pluginManager.Config.IsEnabled(plugin); bool isEnabled = pluginManager.Config.IsEnabled(plugin) && plugin.CanRun;
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90); Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
labelVersion.ForeColor = textColor; labelVersion.ForeColor = textColor;

View File

@@ -1,3 +0,0 @@
namespace TweetDck.Plugins.Controls{
partial class PluginListFlowLayout{}
}

View File

@@ -2,7 +2,7 @@
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
namespace TweetDck.Plugins.Controls{ namespace TweetDck.Plugins.Controls{
sealed partial class PluginListFlowLayout : FlowLayoutPanel{ sealed class PluginListFlowLayout : FlowLayoutPanel{
public PluginListFlowLayout(){ public PluginListFlowLayout(){
FlowDirection = FlowDirection.TopDown; FlowDirection = FlowDirection.TopDown;
WrapContents = false; WrapContents = false;

View File

@@ -2,8 +2,8 @@
namespace TweetDck.Plugins.Events{ namespace TweetDck.Plugins.Events{
class PluginChangedStateEventArgs : EventArgs{ class PluginChangedStateEventArgs : EventArgs{
public Plugin Plugin { get; private set; } public Plugin Plugin { get; }
public bool IsEnabled { get; private set; } public bool IsEnabled { get; }
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){ public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
this.Plugin = plugin; this.Plugin = plugin;

View File

@@ -3,11 +3,7 @@ using System.Collections.Generic;
namespace TweetDck.Plugins.Events{ namespace TweetDck.Plugins.Events{
class PluginErrorEventArgs : EventArgs{ class PluginErrorEventArgs : EventArgs{
public bool HasErrors{ public bool HasErrors => Errors.Count > 0;
get{
return Errors.Count > 0;
}
}
public IList<string> Errors; public IList<string> Errors;

View File

@@ -7,51 +7,41 @@ using TweetDck.Plugins.Enums;
namespace TweetDck.Plugins{ namespace TweetDck.Plugins{
class Plugin{ class Plugin{
public string Identifier { get { return identifier; } } public string Identifier { get; }
public string Name { get { return metadata["NAME"]; } } public PluginGroup Group { get; }
public string Description { get { return metadata["DESCRIPTION"]; } }
public string Author { get { return metadata["AUTHOR"]; } }
public string Version { get { return metadata["VERSION"]; } }
public string Website { get { return metadata["WEBSITE"]; } }
public string ConfigFile { get { return metadata["CONFIGFILE"]; } }
public string ConfigDefault { get { return metadata["CONFIGDEFAULT"]; } }
public string RequiredVersion { get { return metadata["REQUIRES"]; } }
public PluginGroup Group { get; private set; }
public PluginEnvironment Environments { get; private set; } public PluginEnvironment Environments { get; private set; }
public string Name => metadata["NAME"];
public string Description => metadata["DESCRIPTION"];
public string Author => metadata["AUTHOR"];
public string Version => metadata["VERSION"];
public string Website => metadata["WEBSITE"];
public string ConfigFile => metadata["CONFIGFILE"];
public string ConfigDefault => metadata["CONFIGDEFAULT"];
public string RequiredVersion => metadata["REQUIRES"];
public bool CanRun{ public bool CanRun{
get{ get => canRun ?? (canRun = CheckRequiredVersion(RequiredVersion)).Value;
return canRun ?? (canRun = CheckRequiredVersion(RequiredVersion)).Value;
}
} }
public bool HasConfig{ public bool HasConfig{
get{ get => ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
return ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
}
} }
public string ConfigPath{ public string ConfigPath{
get{ get => HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
return HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
}
} }
public bool HasDefaultConfig{ public bool HasDefaultConfig{
get{ get => ConfigDefault.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigDefault).Length > 0;
return ConfigDefault.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigDefault).Length > 0;
}
} }
public string DefaultConfigPath{ public string DefaultConfigPath{
get{ get => HasDefaultConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigDefault) : string.Empty;
return HasDefaultConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigDefault) : string.Empty;
}
} }
private readonly string pathRoot; private readonly string pathRoot;
private readonly string pathData; private readonly string pathData;
private readonly string identifier;
private readonly Dictionary<string, string> metadata = new Dictionary<string, string>(4){ private readonly Dictionary<string, string> metadata = new Dictionary<string, string>(4){
{ "NAME", "" }, { "NAME", "" },
{ "DESCRIPTION", "" }, { "DESCRIPTION", "" },
@@ -72,7 +62,7 @@ namespace TweetDck.Plugins{
this.pathRoot = path; this.pathRoot = path;
this.pathData = Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name); this.pathData = Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name);
this.identifier = group.GetIdentifierPrefix()+name; this.Identifier = group.GetIdentifierPrefix()+name;
this.Group = group; this.Group = group;
this.Environments = PluginEnvironment.None; this.Environments = PluginEnvironment.None;
} }
@@ -103,7 +93,7 @@ namespace TweetDck.Plugins{
Directory.CreateDirectory(dataFolder); Directory.CreateDirectory(dataFolder);
File.Copy(defaultConfigPath, configPath, false); File.Copy(defaultConfigPath, configPath, false);
}catch(Exception e){ }catch(Exception e){
Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+identifier+"' plugin.", true, e); Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+Identifier+"' plugin.", true, e);
} }
} }
} }
@@ -154,12 +144,12 @@ namespace TweetDck.Plugins{
} }
public override int GetHashCode(){ public override int GetHashCode(){
return identifier.GetHashCode(); return Identifier.GetHashCode();
} }
public override bool Equals(object obj){ public override bool Equals(object obj){
Plugin plugin = obj as Plugin; Plugin plugin = obj as Plugin;
return plugin != null && plugin.identifier.Equals(identifier); return plugin != null && plugin.Identifier.Equals(Identifier);
} }
public static Plugin CreateFromFolder(string path, PluginGroup group, out string error){ public static Plugin CreateFromFolder(string path, PluginGroup group, out string error){
@@ -236,9 +226,7 @@ namespace TweetDck.Plugins{
return false; return false;
} }
Version ver; if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out Version _))){
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out ver))){
error = "Plugin contains invalid version: "+plugin.RequiredVersion; error = "Plugin contains invalid version: "+plugin.RequiredVersion;
return false; return false;
} }

View File

@@ -16,11 +16,7 @@ namespace TweetDck.Plugins{
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2); private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2);
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1); private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1);
public IEnumerable<InjectedHTML> NotificationInjections{ public IEnumerable<InjectedHTML> NotificationInjections => notificationInjections.InnerValues;
get{
return notificationInjections.InnerValues;
}
}
public PluginBridge(PluginManager manager){ public PluginBridge(PluginManager manager){
this.manager = manager; this.manager = manager;
@@ -64,9 +60,7 @@ namespace TweetDck.Plugins{
private string ReadFileUnsafe(int token, string cacheKey, string fullPath, bool readCached){ private string ReadFileUnsafe(int token, string cacheKey, string fullPath, bool readCached){
cacheKey = SanitizeCacheKey(cacheKey); cacheKey = SanitizeCacheKey(cacheKey);
string cachedContents; if (readCached && fileCache.TryGetValue(token, cacheKey, out string cachedContents)){
if (readCached && fileCache.TryGetValue(token, cacheKey, out cachedContents)){
return cachedContents; return cachedContents;
} }

View File

@@ -1,5 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Text;
using TweetDck.Plugins.Events; using TweetDck.Plugins.Events;
namespace TweetDck.Plugins{ namespace TweetDck.Plugins{
@@ -8,34 +10,66 @@ namespace TweetDck.Plugins{
[field:NonSerialized] [field:NonSerialized]
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
public IEnumerable<string> DisabledPlugins{ public IEnumerable<string> DisabledPlugins => Disabled;
get{ public bool AnyDisabled => Disabled.Count > 0;
return Disabled;
private readonly HashSet<string> Disabled = new HashSet<string>{
"official/clear-columns",
"official/reply-account"
};
public void ImportLegacy(PluginConfig config){
Disabled.Clear();
foreach(string plugin in config.Disabled){
Disabled.Add(plugin);
} }
} }
public bool AnyDisabled{
get{
return Disabled.Count > 0;
}
}
private readonly HashSet<string> Disabled = new HashSet<string>();
public void SetEnabled(Plugin plugin, bool enabled){ public void SetEnabled(Plugin plugin, bool enabled){
if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){ if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){
if (InternalPluginChangedState != null){ InternalPluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
InternalPluginChangedState(this, new PluginChangedStateEventArgs(plugin, enabled));
}
} }
} }
public bool IsEnabled(Plugin plugin){ public bool IsEnabled(Plugin plugin){
return !Disabled.Contains(plugin.Identifier) && plugin.CanRun; return !Disabled.Contains(plugin.Identifier);
} }
public void DisableOfficialFromConfig(string pluginName){ public void Load(string file){
Disabled.Add("official/"+pluginName); try{
using(FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
using(StreamReader reader = new StreamReader(stream, Encoding.UTF8)){
string line = reader.ReadLine();
if (line == "#Disabled"){
Disabled.Clear();
while((line = reader.ReadLine()) != null){
Disabled.Add(line);
}
}
}
}catch(FileNotFoundException){
}catch(DirectoryNotFoundException){
}catch(Exception e){
Program.Reporter.HandleException("Plugin Configuration Error", "Could not read the plugin configuration file. If you continue, the list of disabled plugins will be reset to default.", true, e);
}
}
public void Save(string file){
try{
using(FileStream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
using(StreamWriter writer = new StreamWriter(stream, Encoding.UTF8)){
writer.WriteLine("#Disabled");
foreach(string disabled in Disabled){
writer.WriteLine(disabled);
}
}
}catch(Exception e){
Program.Reporter.HandleException("Plugin Configuration Error", "Could not save the plugin configuration file.", true, e);
}
} }
} }
} }

View File

@@ -1,8 +1,8 @@
using System; using CefSharp;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using CefSharp;
using TweetDck.Plugins.Enums; using TweetDck.Plugins.Enums;
using TweetDck.Plugins.Events; using TweetDck.Plugins.Events;
using TweetDck.Resources; using TweetDck.Resources;
@@ -15,50 +15,62 @@ namespace TweetDck.Plugins{
private const int InvalidToken = 0; private const int InvalidToken = 0;
public string PathOfficialPlugins { get { return Path.Combine(rootPath, "official"); } } public string PathOfficialPlugins => Path.Combine(rootPath, "official");
public string PathCustomPlugins { get { return Path.Combine(rootPath, "user"); } } public string PathCustomPlugins => Path.Combine(rootPath, "user");
public IEnumerable<Plugin> Plugins { get { return plugins; } } public IEnumerable<Plugin> Plugins => plugins;
public PluginConfig Config { get; private set; } public PluginConfig Config { get; }
public PluginBridge Bridge { get; private set; } public PluginBridge Bridge { get; }
public event EventHandler<PluginErrorEventArgs> Reloaded; public event EventHandler<PluginErrorEventArgs> Reloaded;
public event EventHandler<PluginErrorEventArgs> Executed; public event EventHandler<PluginErrorEventArgs> Executed;
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState; public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
private readonly string rootPath; private readonly string rootPath;
private readonly string configPath;
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>(); private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>(); private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
private readonly Random rand = new Random(); private readonly Random rand = new Random();
private List<string> loadErrors; private List<string> loadErrors;
public PluginManager(string path, PluginConfig config){ public PluginManager(string rootPath, string configPath){
this.rootPath = path; this.rootPath = rootPath;
this.SetConfig(config); this.configPath = configPath;
this.Config = new PluginConfig();
this.Bridge = new PluginBridge(this); this.Bridge = new PluginBridge(this);
LoadConfig();
Config.InternalPluginChangedState += Config_InternalPluginChangedState;
Program.UserConfigReplaced += Program_UserConfigReplaced; Program.UserConfigReplaced += Program_UserConfigReplaced;
} }
private void LoadConfig(){
#pragma warning disable 612
if (Program.UserConfig.Plugins != null){
Config.ImportLegacy(Program.UserConfig.Plugins);
Config.Save(configPath);
Program.UserConfig.Plugins = null;
Program.UserConfig.Save();
}
#pragma warning restore 612
else{
Config.Load(configPath);
}
}
private void Program_UserConfigReplaced(object sender, EventArgs e){ private void Program_UserConfigReplaced(object sender, EventArgs e){
SetConfig(Program.UserConfig.Plugins); LoadConfig();
Reload(); Reload();
} }
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){ private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){
if (PluginChangedState != null){ PluginChangedState?.Invoke(this, e);
PluginChangedState(this, e); Config.Save(configPath);
}
}
private void SetConfig(PluginConfig config){
if (this.Config != null){
this.Config.InternalPluginChangedState -= Config_InternalPluginChangedState;
}
this.Config = config;
this.Config.InternalPluginChangedState += Config_InternalPluginChangedState;
} }
public bool IsPluginInstalled(string identifier){ public bool IsPluginInstalled(string identifier){
@@ -88,8 +100,7 @@ namespace TweetDck.Plugins{
} }
public Plugin GetPluginFromToken(int token){ public Plugin GetPluginFromToken(int token){
Plugin plugin; return tokens.TryGetValue(token, out Plugin plugin) ? plugin : null;
return tokens.TryGetValue(token, out plugin) ? plugin : null;
} }
public void Reload(){ public void Reload(){
@@ -106,9 +117,7 @@ namespace TweetDck.Plugins{
plugins.Add(plugin); plugins.Add(plugin);
} }
if (Reloaded != null){ Reloaded?.Invoke(this, new PluginErrorEventArgs(loadErrors));
Reloaded(this, new PluginErrorEventArgs(loadErrors));
}
} }
public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled){ public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled){
@@ -120,7 +129,7 @@ namespace TweetDck.Plugins{
foreach(Plugin plugin in Plugins){ foreach(Plugin plugin in Plugins){
string path = plugin.GetScriptPath(environment); string path = plugin.GetScriptPath(environment);
if (string.IsNullOrEmpty(path) || !plugin.CanRun || (!includeDisabled && !Config.IsEnabled(plugin)))continue; if (string.IsNullOrEmpty(path) || (!includeDisabled && !Config.IsEnabled(plugin)) || !plugin.CanRun)continue;
string script; string script;
@@ -144,9 +153,7 @@ namespace TweetDck.Plugins{
ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:"+plugin); ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:"+plugin);
} }
if (Executed != null){ Executed?.Invoke(this, new PluginErrorEventArgs(failedPlugins));
Executed(this, new PluginErrorEventArgs(failedPlugins));
}
} }
private IEnumerable<Plugin> LoadPluginsFrom(string path, PluginGroup group){ private IEnumerable<Plugin> LoadPluginsFrom(string path, PluginGroup group){
@@ -155,8 +162,7 @@ namespace TweetDck.Plugins{
} }
foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){ foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){
string error; Plugin plugin = Plugin.CreateFromFolder(fullDir, group, out string error);
Plugin plugin = Plugin.CreateFromFolder(fullDir, group, out error);
if (plugin == null){ if (plugin == null){
loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+error); loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+error);

View File

@@ -1,18 +1,18 @@
using System; using CefSharp;
using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows.Forms;
using CefSharp;
using TweetDck.Configuration;
using TweetDck.Core;
using TweetDck.Core.Utils;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using TweetDck.Plugins; using System.Windows.Forms;
using TweetDck.Plugins.Events; using TweetDck.Configuration;
using TweetDck.Core.Other.Settings.Export; using TweetDck.Core;
using TweetDck.Core.Handling; using TweetDck.Core.Handling;
using TweetDck.Core.Other; using TweetDck.Core.Other;
using TweetDck.Core.Other.Settings.Export;
using TweetDck.Core.Utils;
using TweetDck.Plugins;
using TweetDck.Plugins.Events;
using TweetDck.Updates; using TweetDck.Updates;
namespace TweetDck{ namespace TweetDck{
@@ -20,18 +20,18 @@ 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"; public const string VersionTag = "1.7.3";
public const string VersionFull = "1.7.0.0"; public const string VersionFull = "1.7.3.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 ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg"); public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
public static readonly string PluginConfigFilePath = Path.Combine(StoragePath, "TD_PluginConfig.cfg");
private static readonly string ErrorLogFilePath = Path.Combine(StoragePath, "TD_Log.txt"); private static readonly string ErrorLogFilePath = Path.Combine(StoragePath, "TD_Log.txt");
private static readonly string ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt"); private static readonly string ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt");
@@ -156,7 +156,7 @@ namespace TweetDck{
Application.ApplicationExit += (sender, args) => ExitCleanup(); Application.ApplicationExit += (sender, args) => ExitCleanup();
PluginManager plugins = new PluginManager(PluginPath, UserConfig.Plugins); PluginManager plugins = new PluginManager(PluginPath, PluginConfigFilePath);
plugins.Reloaded += plugins_Reloaded; plugins.Reloaded += plugins_Reloaded;
plugins.Executed += plugins_Executed; plugins.Executed += plugins_Executed;
plugins.Reload(); plugins.Reload();
@@ -214,10 +214,7 @@ namespace TweetDck{
public static void ReloadConfig(){ public static void ReloadConfig(){
UserConfig = UserConfig.Load(ConfigFilePath); UserConfig = UserConfig.Load(ConfigFilePath);
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
if (UserConfigReplaced != null){
UserConfigReplaced(UserConfig, new EventArgs());
}
} }
public static void ResetConfig(){ public static void ResetConfig(){
@@ -260,14 +257,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

@@ -1,7 +1,7 @@
using System; using System;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources; using System.Resources;
using System.Runtime.InteropServices;
using TweetDck; using TweetDck;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace TweetDck.Properties { namespace TweetDck.Properties {
using System;
/// <summary> /// <summary>

View File

@@ -1,8 +1,8 @@
# Build Instructions # Build Instructions
The program was build using Visual Studio 2013. After opening the solution, make sure you have **CefSharp.WinForms** and **Microsoft.VC120.CRT.JetBrains** included - if not, download them using NuGet. The program was built using Visual Studio 2017. After opening the solution, make sure you have **CefSharp.WinForms** and **Microsoft.VC120.CRT.JetBrains** included - if not, download them using NuGet.
``` ```
PM> Install-Package CefSharp.WinForms -Version 57.0.0-pre01 PM> Install-Package CefSharp.WinForms -Version 57.0.0
PM> Install-Package Microsoft.VC120.CRT.JetBrains PM> Install-Package Microsoft.VC120.CRT.JetBrains
``` ```

View File

@@ -18,30 +18,29 @@ enabled(){
// =================================== // ===================================
// N key - simulate popup notification // N key - simulate popup notification
// S key - simulate sound notification
// =================================== // ===================================
if (e.keyCode === 78){ if (e.keyCode === 78 || e.keyCode === 83){
var col = TD.controller.columnManager.getAllOrdered()[0]; var col = TD.controller.columnManager.getAllOrdered()[0];
var prevPopup = col.model.getHasNotification();
var prevSound = col.model.getHasSound();
col.model.setHasNotification(e.keyCode === 78);
col.model.setHasSound(e.keyCode === 83);
$.publish("/notifications/new",[{ $.publish("/notifications/new",[{
column: col, column: col,
items: [ items: [
col.updateArray[Math.floor(Math.random()*col.updateArray.length)] col.updateArray[Math.floor(Math.random()*col.updateArray.length)]
] ]
}]); }]);
}
// =================================== setTimeout(function(){
// S key - simulate sound notification col.model.setHasNotification(prevPopup);
// =================================== col.model.setHasSound(prevSound);
}, 1);
else if (e.keyCode === 83){
if ($TDX.hasCustomNotificationSound){
$TD.onTweetSound();
}
else{
document.getElementById("update-sound").play();
}
} }
} }
}; };

View File

@@ -36,7 +36,7 @@ enabled(){
var loadConfigObject = obj => { var loadConfigObject = obj => {
this.tmpConfig = obj || {}; this.tmpConfig = obj || {};
if (window.TD_APP_READY){ if (TD.ready){
this.onAppReady(); this.onAppReady();
} }
@@ -54,6 +54,7 @@ enabled(){
$TDP.checkFileExists(this.$token, configFile).then(exists => { $TDP.checkFileExists(this.$token, configFile).then(exists => {
if (!exists){ if (!exists){
loadConfigObject(null); loadConfigObject(null);
$TDP.writeFile(this.$token, configFile, JSON.stringify(this.defaultConfig));
} }
else{ else{
$TDP.readFile(this.$token, configFile, true).then(contents => { $TDP.readFile(this.$token, configFile, true).then(contents => {
@@ -239,6 +240,9 @@ enabled(){
this.reinjectAll = () => { this.reinjectAll = () => {
this.resetDesign(); this.resetDesign();
this.css.insert("#general_settings .cf { display: none !important }");
this.css.insert("#general_settings .divider-bar::after { display: inline-block; padding-top: 10px; line-height: 17px; content: 'Use the new | Edit layout & design | option in the Settings to modify TweetDeck theme, column width, font size, and other features.' }");
this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }"); this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }");
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }"); this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");

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 }");
@@ -58,10 +60,11 @@ enabled(){
this.currentKeyboard = null; this.currentKeyboard = null;
$(".emoji-keyboard-popup-btn").removeClass("is-selected"); $(".emoji-keyboard-popup-btn").removeClass("is-selected");
$(".js-compose-text").first().focus();
}; };
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 => {
@@ -84,9 +87,17 @@ enabled(){
keyboard.addEventListener("click", function(e){ keyboard.addEventListener("click", function(e){
if (e.target.tagName === "IMG"){ if (e.target.tagName === "IMG"){
input.val(input.val()+e.target.getAttribute("alt")); var val = input.val();
var inserted = e.target.getAttribute("alt");
var posStart = input[0].selectionStart;
var posEnd = input[0].selectionEnd;
input.val(val.slice(0, posStart)+inserted+val.slice(posStart));
input.trigger("change"); input.trigger("change");
input.focus(); input.focus();
input[0].selectionStart = posStart+inserted.length;
input[0].selectionEnd = posEnd+inserted.length;
} }
e.stopPropagation(); e.stopPropagation();
@@ -256,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

@@ -1,9 +1,9 @@
using System; using CefSharp;
using CefSharp.WinForms;
using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
namespace TweetDck.Resources{ namespace TweetDck.Resources{
static class ScriptLoader{ static class ScriptLoader{

View File

@@ -19,6 +19,29 @@
// //
var app = $(document.body).children(".js-app"); var app = $(document.body).children(".js-app");
//
// Constant: Column types mapped to their titles.
//
const columnTypes = {
"col_home": "Home",
"col_timeline" : "Home",
"col_mentions": "Mentions",
"col_me": "Mentions",
"col_inbox": "Messages",
"col_messages": "Messages",
"col_interactions": "Notifications",
"col_followers": "Followers",
"col_activity": "Activity",
"col_favorites": "Likes",
"col_usertweets": "User",
"col_search": "Search",
"col_list": "List",
"col_customtimeline": "Timeline",
"col_dataminr": "Dataminr",
"col_livevideo": "Live video",
"col_scheduled": "Scheduled"
};
// //
// Function: Prepends code at the beginning of a function. If the prepended function returns true, execution of the original function is cancelled. // Function: Prepends code at the beginning of a function. If the prepended function returns true, execution of the original function is cancelled.
// //
@@ -59,7 +82,7 @@
// //
var onNewTweet = function(column, tweet){ var onNewTweet = function(column, tweet){
if (column.model.getHasNotification()){ if (column.model.getHasNotification()){
var html = $(tweet.render({ let html = $(tweet.render({
withFooter: false, withFooter: false,
withTweetActions: false, withTweetActions: false,
withMediaPreview: true, withMediaPreview: true,
@@ -71,11 +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
var 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)
this.outerHTML = this.innerHTML;
});
$TD.onTweetPopup(html.html(), url, tweet.text.length); // TODO column 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()){
@@ -94,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: "+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("");
@@ -320,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");
@@ -364,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);
@@ -375,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.
@@ -536,17 +513,18 @@
// Block: Swap shift key functionality for selecting accounts. // Block: Swap shift key functionality for selecting accounts.
// //
onAppReady.push(function(){ onAppReady.push(function(){
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", function(e){ var toggleEventShiftKey = function(e){
e.shiftKey = !e.shiftKey; if ($TDX.switchAccountSelectors){
}); e.shiftKey = !e.shiftKey;
}
};
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey);
TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){ TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){
if (!this.$node.attr("td-account-selector-hook")){ if (!this.$node.attr("td-account-selector-hook")){
this.$node.attr("td-account-selector-hook", "1"); this.$node.attr("td-account-selector-hook", "1");
this.$node.delegate(".js-account-item", "click", toggleEventShiftKey);
this.$node.delegate(".js-account-item", "click", function(e){
e.shiftKey = !e.shiftKey;
});
} }
}); });
}); });
@@ -567,8 +545,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
@@ -626,9 +611,35 @@
TD.services.TwitterMedia.SERVICES["youtube"] = TD.services.TwitterMedia.YOUTUBE_RE; TD.services.TwitterMedia.SERVICES["youtube"] = TD.services.TwitterMedia.YOUTUBE_RE;
// //
// Block: Finish initialization and load plugins. // Block: Fix DM reply input box not getting focused after opening a conversation.
// //
TD.components.ConversationDetailView.prototype.showChirp = appendToFunction(TD.components.ConversationDetailView.prototype.showChirp, function(){
setTimeout(function(){
$(".js-reply-tweetbox").first().focus();
}, 100);
});
//
// Block: Disable TweetDeck metrics.
//
TD.metrics.inflate = function(){};
TD.metrics.inflateMetricTriple = function(){};
TD.metrics.log = function(){};
TD.metrics.makeKey = function(){};
TD.metrics.send = function(){};
onAppReady.push(function(){ onAppReady.push(function(){
let data = $._data(window);
delete data.events["metric"];
delete data.events["metricsFlush"];
});
//
// Block: Register the TD.ready event, finish initialization, and load plugins.
//
$(document).one("TD.ready", function(){
onAppReady.forEach(func => func());
$TD.loadFontSizeClass(TD.settings.getFontSize()); $TD.loadFontSizeClass(TD.settings.getFontSize());
$TD.loadNotificationHeadContents(getNotificationHeadContents()); $TD.loadNotificationHeadContents(getNotificationHeadContents());
@@ -638,18 +649,9 @@
}); });
// //
// Block: Observe the main app element and call the ready event whenever the contents are loaded. // Block: Skip the initial pre-login page.
// //
new MutationObserver(function(){ $(document).on("uiLoginFormImpression", function(){
if (window.TD_APP_READY && app.hasClass("is-hidden")){ location.href = $("a.btn", ".js-login-form").first().attr("href");
window.TD_APP_READY = false;
}
else if (!window.TD_APP_READY && !app.hasClass("is-hidden")){
onAppReady.forEach(func => func());
window.TD_APP_READY = true;
}
}).observe(app[0], {
attributes: true,
attributeFilter: [ "class" ]
}); });
})($, $TD, $TDX, TD); })($, $TD, $TDX, TD);

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

@@ -40,7 +40,7 @@
} }
runWhenReady(plugin){ runWhenReady(plugin){
if (window.TD_APP_READY){ if (TD.ready){
plugin.obj.ready(); plugin.obj.ready();
} }
else{ else{

View File

@@ -0,0 +1,34 @@
(function(){
//
// Function: Inject custom CSS into the page.
//
var injectCSS = function(){
if (!document.head){
setTimeout(injectCSS, 25);
return;
}
var style = document.createElement("style");
document.head.appendChild(style);
style.sheet.insertRule("body { overflow: hidden !important; }", 0); // remove scrollbar
style.sheet.insertRule(".topbar { display: none !important; }", 0); // hide top bar
style.sheet.insertRule(".page-canvas, .buttons, .btn, input { border-radius: 0 !important; }", 0); // sharpen borders
style.sheet.insertRule("input { padding: 5px 8px 4px !important; }", 0); // tweak input padding
style.sheet.insertRule("#doc { width: 100%; height: 100%; margin: 0; position: absolute; display: table; }", 0); // center everything
style.sheet.insertRule("#page-outer { display: table-cell; vertical-align: middle; }", 0); // center everything
style.sheet.insertRule("#page-container { padding: 0 20px !important; width: 100% !important; box-sizing: border-box !important; }", 0); // center everything
style.sheet.insertRule(".page-canvas { margin: 0 auto !important; }", 0); // center everything
if (location.pathname === "/logout"){
style.sheet.insertRule(".page-canvas { width: auto !important; max-width: 888px; }", 0); // fix min width
style.sheet.insertRule(".signout-wrapper { width: auto !important; }", 0); // fix min width
style.sheet.insertRule(".btn { margin: 0 4px !important; }", 0); // add margin around buttons
style.sheet.insertRule(".btn.cancel { border: 1px solid #bbc1c5 !important; }", 0); // add border to cancel button
style.sheet.insertRule(".aside p { display: none; }", 0); // hide text below the logout dialog
}
};
setTimeout(injectCSS, 1);
})();

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props')" /> <Import Project="packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props')" />
<Import Project="packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props')" /> <Import Project="packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -13,7 +13,8 @@
<AssemblyName>TweetDuck</AssemblyName> <AssemblyName>TweetDuck</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>9e936308</NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
@@ -42,6 +43,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>7</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Resources\icon.ico</ApplicationIcon> <ApplicationIcon>Resources\icon.ico</ApplicationIcon>
@@ -77,15 +79,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 +97,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 +111,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 +179,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>
@@ -232,9 +225,6 @@
<Compile Include="Plugins\Controls\PluginListFlowLayout.cs"> <Compile Include="Plugins\Controls\PluginListFlowLayout.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Plugins\Controls\PluginListFlowLayout.Designer.cs">
<DependentUpon>PluginListFlowLayout.cs</DependentUpon>
</Compile>
<Compile Include="Plugins\Enums\PluginFolder.cs" /> <Compile Include="Plugins\Enums\PluginFolder.cs" />
<Compile Include="Plugins\Plugin.cs" /> <Compile Include="Plugins\Plugin.cs" />
<Compile Include="Plugins\Events\PluginChangedStateEventArgs.cs" /> <Compile Include="Plugins\Events\PluginChangedStateEventArgs.cs" />
@@ -339,9 +329,11 @@
<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" />
<Content Include="Resources\Scripts\twitter.js" />
<Content Include="Resources\Scripts\update.js" /> <Content Include="Resources\Scripts\update.js" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -383,21 +375,21 @@ if $(ConfigurationName) == Debug (
xcopy "$(ProjectDir)Resources\Plugins\.debug\*" "$(TargetDir)plugins\user\.debug\" /E /Y xcopy "$(ProjectDir)Resources\Plugins\.debug\*" "$(TargetDir)plugins\user\.debug\" /E /Y
)</PostBuildEvent> )</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<Import Project="packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets" Condition="Exists('packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets')" /> <Import Project="packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets" Condition="Exists('packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets'))" /> <Error Condition="!Exists('packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets'))" />
<Error Condition="!Exists('packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets'))" /> <Error Condition="!Exists('packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets'))" />
<Error Condition="!Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props'))" /> <Error Condition="!Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props'))" />
<Error Condition="!Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets'))" /> <Error Condition="!Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets'))" />
<Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props'))" /> <Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props'))" />
<Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets'))" /> <Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets'))" />
</Target> </Target>
<Import Project="packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets" Condition="Exists('packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets')" /> <Import Project="packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets" Condition="Exists('packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets')" />
<Import Project="packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets')" /> <Import Project="packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets')" />
<Import Project="packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets')" /> <Import Project="packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -2,9 +2,9 @@ using System;
namespace TweetDck.Updates.Events{ namespace TweetDck.Updates.Events{
class UpdateCheckEventArgs : EventArgs{ class UpdateCheckEventArgs : EventArgs{
public int EventId { get; private set; } public int EventId { get; }
public bool UpdateAvailable { get; private set; } public bool UpdateAvailable { get; }
public string LatestVersion { get; private set; } public string LatestVersion { get; }
public UpdateCheckEventArgs(int eventId, bool updateAvailable, string latestVersion){ public UpdateCheckEventArgs(int eventId, bool updateAvailable, string latestVersion){
EventId = eventId; EventId = eventId;

View File

@@ -10,11 +10,7 @@ namespace TweetDck.Updates{
sealed partial class FormUpdateDownload : Form{ sealed partial class FormUpdateDownload : Form{
private const double BytesToKB = 1024.0; private const double BytesToKB = 1024.0;
public string InstallerPath{ public string InstallerPath => Path.Combine(Path.GetTempPath(), updateInfo.FileName);
get{
return Path.Combine(Path.GetTempPath(), updateInfo.FileName);
}
}
public enum Status{ public enum Status{
Waiting, Failed, Cancelled, Manual, Succeeded Waiting, Failed, Cancelled, Manual, Succeeded

View File

@@ -1,6 +1,6 @@
using System; using CefSharp;
using CefSharp;
using CefSharp.WinForms; using CefSharp.WinForms;
using System;
using TweetDck.Core; using TweetDck.Core;
using TweetDck.Core.Controls; using TweetDck.Core.Controls;
using TweetDck.Core.Utils; using TweetDck.Core.Utils;
@@ -9,11 +9,7 @@ using TweetDck.Updates.Events;
namespace TweetDck.Updates{ namespace TweetDck.Updates{
sealed class UpdateHandler{ sealed class UpdateHandler{
private static bool IsSystemSupported{ private static bool IsSystemSupported => true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
get{
return true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
}
}
private readonly ChromiumWebBrowser browser; private readonly ChromiumWebBrowser browser;
private readonly FormBrowser form; private readonly FormBrowser form;
@@ -61,10 +57,7 @@ namespace TweetDck.Updates{
public void DismissUpdate(string tag){ public void DismissUpdate(string tag){
settings.DismissedUpdate = tag; settings.DismissedUpdate = tag;
UpdateDismissed?.Invoke(this, new UpdateDismissedEventArgs(tag));
if (UpdateDismissed != null){
UpdateDismissed(this, new UpdateDismissedEventArgs(tag));
}
} }
private void TriggerUpdateAcceptedEvent(UpdateAcceptedEventArgs args){ private void TriggerUpdateAcceptedEvent(UpdateAcceptedEventArgs args){
@@ -76,10 +69,7 @@ namespace TweetDck.Updates{
private void TriggerUpdateDismissedEvent(UpdateDismissedEventArgs args){ private void TriggerUpdateDismissedEvent(UpdateDismissedEventArgs args){
form.InvokeAsyncSafe(() => { form.InvokeAsyncSafe(() => {
settings.DismissedUpdate = args.VersionTag; settings.DismissedUpdate = args.VersionTag;
UpdateDismissed?.Invoke(this, args);
if (UpdateDismissed != null){
UpdateDismissed(this, args);
}
}); });
} }

View File

@@ -5,11 +5,7 @@ namespace TweetDck.Updates{
public readonly string VersionTag; public readonly string VersionTag;
public readonly string DownloadUrl; public readonly string DownloadUrl;
public string FileName{ public string FileName => BrowserUtils.GetFileNameFromUrl(DownloadUrl) ?? Program.BrandName+".Update.exe";
get{
return BrowserUtils.GetFileNameFromUrl(DownloadUrl) ?? Program.BrandName+".Update.exe";
}
}
public UpdateInfo(string versionTag, string downloadUrl){ public UpdateInfo(string versionTag, string downloadUrl){
this.VersionTag = versionTag; this.VersionTag = versionTag;

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <packages>
<package id="cef.redist.x64" version="3.2987.1597" targetFramework="net452" xmlns="" /> <package id="cef.redist.x64" version="3.2987.1601" targetFramework="net452" xmlns="" />
<package id="cef.redist.x86" version="3.2987.1597" targetFramework="net452" xmlns="" /> <package id="cef.redist.x86" version="3.2987.1601" targetFramework="net452" xmlns="" />
<package id="CefSharp.Common" version="57.0.0-pre01" targetFramework="net452" xmlns="" /> <package id="CefSharp.Common" version="57.0.0" targetFramework="net452" xmlns="" />
<package id="CefSharp.WinForms" version="57.0.0-pre01" targetFramework="net452" xmlns="" /> <package id="CefSharp.WinForms" version="57.0.0" targetFramework="net452" xmlns="" />
<package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" /> <package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" />
</packages> </packages>

View File

@@ -7,11 +7,7 @@ using TweetDck.Core.Utils;
namespace UnitTests.Core.Utils{ namespace UnitTests.Core.Utils{
[TestClass] [TestClass]
public class TestInjectedHTML{ public class TestInjectedHTML{
private static IEnumerable<InjectedHTML.Position> Positions{ private static IEnumerable<InjectedHTML.Position> Positions => Enum.GetValues(typeof(InjectedHTML.Position)).Cast<InjectedHTML.Position>();
get{
return Enum.GetValues(typeof(InjectedHTML.Position)).Cast<InjectedHTML.Position>();
}
}
[TestMethod] [TestMethod]
public void TestFailedMatches(){ public void TestFailedMatches(){