mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
117 Commits
Author | SHA1 | Date | |
---|---|---|---|
1c16187346 | |||
2fe058d9cb | |||
cefdadd53a | |||
c21c10df63 | |||
b4d359d30c | |||
1e8c62ac25 | |||
c578f36644 | |||
c973d0cff4 | |||
0c3d9ae46a | |||
a834e8b6a2 | |||
9f5580d983 | |||
e94e3cecf8 | |||
1991f7f50f | |||
9eb4e623e7 | |||
ad28d2279f | |||
1e3de31fc3 | |||
f85bd41b96 | |||
563124b68c | |||
63de08c635 | |||
8a0a215443 | |||
f1b7cd633e | |||
458eeeccda | |||
464e758b94 | |||
4c61047e9b | |||
1bf9e7fb56 | |||
ca69554f37 | |||
cf7029037e | |||
418388b0ab | |||
a0f8689d4f | |||
95007bdd26 | |||
ab91540deb | |||
b2ebb984f8 | |||
f7e9ad74d1 | |||
d48da3d51c | |||
76d22554c5 | |||
6eaafd883b | |||
5961a80b23 | |||
f41c6fe533 | |||
65b8efe13c | |||
89529f9c96 | |||
e90f6ebc63 | |||
5888d540a6 | |||
ae8b740600 | |||
ab4e2f5bda | |||
1091b6d232 | |||
fc89744238 | |||
34e049a002 | |||
980bf2c307 | |||
762aea1e20 | |||
c1aefc7163 | |||
9480ba26e0 | |||
c2c9160ed9 | |||
175b067a17 | |||
9d8656ca20 | |||
0863001c80 | |||
0ee22a30ad | |||
447697ba45 | |||
aea77ff909 | |||
af5da76f72 | |||
a369c65451 | |||
318f65f187 | |||
1cd60e831c | |||
b988959eaa | |||
1eb1f9848a | |||
7f6cc0da01 | |||
19fcb69525 | |||
22cef0a44c | |||
2459d31bff | |||
19f104239a | |||
bd0be65038 | |||
bbb7907e54 | |||
a6963a18d4 | |||
92716ea3e0 | |||
aec4c1feea | |||
d505b3305b | |||
a34a02e14d | |||
26d2d7a51e | |||
c2f7e52d13 | |||
de68d8934d | |||
4fdf7fc958 | |||
42a5e72f19 | |||
f7359ebc8a | |||
f395ac53dc | |||
1113e0b559 | |||
5e3bd31862 | |||
11d978dad1 | |||
f7961024d7 | |||
72973a8707 | |||
68254f48d5 | |||
eac4f30c50 | |||
25680fa980 | |||
ff5e1da14d | |||
95afff7879 | |||
50bd526025 | |||
108a0fefc3 | |||
dd8c5d27be | |||
b2937bc776 | |||
4d8e764211 | |||
544b8664fd | |||
d0610865bd | |||
ebc0b51590 | |||
4487f1169e | |||
85559b6083 | |||
1056273c57 | |||
61af2ebc8b | |||
9121c86656 | |||
1ccefe853a | |||
aca438b837 | |||
7210c29cd8 | |||
26d90c0c9b | |||
a03b222a95 | |||
7944a24d3c | |||
cc8459c759 | |||
10074ff92c | |||
173f25bebc | |||
31680fc4ae | |||
e937d43614 |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
github: chylex
|
||||
patreon: chylex
|
||||
ko_fi: chylex
|
58
Application/LockHandler.cs
Normal file
58
Application/LockHandler.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Application;
|
||||
|
||||
namespace TweetDuck.Application{
|
||||
class LockHandler : IAppLockHandler{
|
||||
private const int WaitRetryDelay = 250;
|
||||
private const int RestoreFailTimeout = 2000;
|
||||
private const int CloseNaturallyTimeout = 10000;
|
||||
private const int CloseKillTimeout = 5000;
|
||||
|
||||
bool IAppLockHandler.RestoreProcess(Process process){
|
||||
if (process.MainWindowHandle == IntPtr.Zero){ // restore if the original process is in tray
|
||||
NativeMethods.BroadcastMessage(Program.WindowRestoreMessage, (uint)process.Id, 0);
|
||||
|
||||
if (WindowsUtils.TrySleepUntil(() => CheckProcessExited(process) || (process.MainWindowHandle != IntPtr.Zero && process.Responding), RestoreFailTimeout, WaitRetryDelay)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IAppLockHandler.CloseProcess(Process process){
|
||||
try{
|
||||
if (process.CloseMainWindow()){
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
WindowsUtils.TrySleepUntil(() => CheckProcessExited(process), CloseNaturallyTimeout, WaitRetryDelay);
|
||||
}
|
||||
|
||||
if (!process.HasExited){
|
||||
process.Kill();
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
WindowsUtils.TrySleepUntil(() => CheckProcessExited(process), CloseKillTimeout, WaitRetryDelay);
|
||||
}
|
||||
|
||||
if (process.HasExited){
|
||||
process.Dispose();
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}catch(Exception ex) when (ex is InvalidOperationException || ex is Win32Exception){
|
||||
bool hasExited = CheckProcessExited(process);
|
||||
process.Dispose();
|
||||
return hasExited;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool CheckProcessExited(Process process){
|
||||
process.Refresh();
|
||||
return process.HasExited;
|
||||
}
|
||||
}
|
||||
}
|
28
Application/SystemHandler.cs
Normal file
28
Application/SystemHandler.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using TweetLib.Core.Application;
|
||||
|
||||
namespace TweetDuck.Application{
|
||||
class SystemHandler : IAppSystemHandler{
|
||||
void IAppSystemHandler.OpenAssociatedProgram(string path){
|
||||
try{
|
||||
using(Process.Start(new ProcessStartInfo{
|
||||
FileName = path,
|
||||
ErrorDialog = true
|
||||
})){}
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Error Opening Program", "Could not open the associated program for " + path, true, e);
|
||||
}
|
||||
}
|
||||
|
||||
void IAppSystemHandler.OpenFileExplorer(string path){
|
||||
if (File.Exists(path)){
|
||||
using(Process.Start("explorer.exe", "/select,\"" + path.Replace('/', '\\') + "\"")){}
|
||||
}
|
||||
else if (Directory.Exists(path)){
|
||||
using(Process.Start("explorer.exe", '"' + path.Replace('/', '\\') + '"')){}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
41
Browser/Adapters/CefScriptExecutor.cs
Normal file
41
Browser/Adapters/CefScriptExecutor.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.IO;
|
||||
using CefSharp;
|
||||
using TweetLib.Core.Browser;
|
||||
|
||||
namespace TweetDuck.Browser.Adapters{
|
||||
sealed class CefScriptExecutor : IScriptExecutor{
|
||||
private readonly IWebBrowser browser;
|
||||
|
||||
public CefScriptExecutor(IWebBrowser browser){
|
||||
this.browser = browser;
|
||||
}
|
||||
|
||||
public void RunFunction(string name, params object[] args){
|
||||
browser.ExecuteScriptAsync(name, args);
|
||||
}
|
||||
|
||||
public void RunScript(string identifier, string script){
|
||||
using IFrame frame = browser.GetMainFrame();
|
||||
RunScript(frame, script, identifier);
|
||||
}
|
||||
|
||||
public bool RunFile(string file){
|
||||
using IFrame frame = browser.GetMainFrame();
|
||||
return RunFile(frame, file);
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
||||
public static void RunScript(IFrame frame, string script, string identifier){
|
||||
if (script != null){
|
||||
frame.ExecuteJavaScriptAsync(script, identifier, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool RunFile(IFrame frame, string file){
|
||||
string script = Program.Resources.Load(file);
|
||||
RunScript(frame, script, "root:" + Path.GetFileNameWithoutExtension(file));
|
||||
return script != null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,34 +1,38 @@
|
||||
using System.Text;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
namespace TweetDuck.Browser.Bridge{
|
||||
static class PropertyBridge{
|
||||
public enum Environment{
|
||||
Browser, Notification
|
||||
}
|
||||
|
||||
public static string GenerateScript(Environment environment){
|
||||
string Bool(bool value) => value ? "true;" : "false;";
|
||||
string Str(string value) => '"'+value+"\";";
|
||||
static string Bool(bool value) => value ? "true;" : "false;";
|
||||
static string Str(string value) => $"\"{value}\";";
|
||||
|
||||
UserConfig config = Program.Config.User;
|
||||
StringBuilder build = new StringBuilder(128).Append("(function(x){");
|
||||
StringBuilder build = new StringBuilder(384).Append("(function(x){");
|
||||
|
||||
build.Append("x.expandLinksOnHover=").Append(Bool(config.ExpandLinksOnHover));
|
||||
|
||||
if (environment == Environment.Browser){
|
||||
build.Append("x.focusDmInput=").Append(Bool(config.FocusDmInput));
|
||||
build.Append("x.openSearchInFirstColumn=").Append(Bool(config.OpenSearchInFirstColumn));
|
||||
build.Append("x.keepLikeFollowDialogsOpen=").Append(Bool(config.KeepLikeFollowDialogsOpen));
|
||||
build.Append("x.muteNotifications=").Append(Bool(config.MuteNotifications));
|
||||
build.Append("x.notificationMediaPreviews=").Append(Bool(config.NotificationMediaPreviews));
|
||||
build.Append("x.translationTarget=").Append(Str(config.TranslationTarget));
|
||||
build.Append("x.firstDayOfWeek=").Append(config.CalendarFirstDay == -1 ? LocaleUtils.GetJQueryDayOfWeek(Lib.Culture.DateTimeFormat.FirstDayOfWeek) : config.CalendarFirstDay);
|
||||
}
|
||||
|
||||
if (environment == Environment.Notification){
|
||||
build.Append("x.skipOnLinkClick=").Append(Bool(config.NotificationSkipOnLinkClick));
|
||||
}
|
||||
|
||||
return build.Append("})(window.$TDX=window.$TDX||{})").ToString();
|
||||
return build.Append("})(window.$TDX=window.$TDX||{});if(window.TDGF_onPropertiesUpdated)window.TDGF_onPropertiesUpdated()").ToString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,18 +1,23 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Handling;
|
||||
using TweetDuck.Browser.Notification;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
namespace TweetDuck.Browser.Bridge{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
class TweetDeckBridge{
|
||||
public static string FontSize { get; private set; }
|
||||
public static string NotificationHeadLayout { get; private set; }
|
||||
public static readonly ContextInfo ContextInfo = new ContextInfo();
|
||||
|
||||
public static void ResetStaticProperties(){
|
||||
FontSize = NotificationHeadLayout = null;
|
||||
FormNotificationBase.FontSize = null;
|
||||
FormNotificationBase.HeadLayout = null;
|
||||
}
|
||||
|
||||
private readonly FormBrowser form;
|
||||
@@ -37,24 +42,22 @@ namespace TweetDuck.Core.Bridge{
|
||||
}
|
||||
|
||||
public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
|
||||
form.InvokeAsyncSafe(() => {
|
||||
form.OnIntroductionClosed(showGuide, allowDataCollection);
|
||||
});
|
||||
form.InvokeAsyncSafe(() => form.OnIntroductionClosed(showGuide, allowDataCollection));
|
||||
}
|
||||
|
||||
public void LoadNotificationLayout(string fontSize, string headLayout){
|
||||
form.InvokeAsyncSafe(() => {
|
||||
FontSize = fontSize;
|
||||
NotificationHeadLayout = headLayout;
|
||||
FormNotificationBase.FontSize = fontSize;
|
||||
FormNotificationBase.HeadLayout = headLayout;
|
||||
});
|
||||
}
|
||||
|
||||
public void SetRightClickedLink(string type, string url){
|
||||
ContextInfo.SetLink(type, url);
|
||||
ContextMenuBase.CurrentInfo.SetLink(type, url);
|
||||
}
|
||||
|
||||
public void SetRightClickedChirp(string tweetUrl, string quoteUrl, string chirpAuthors, string chirpImages){
|
||||
ContextInfo.SetChirp(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
|
||||
ContextMenuBase.CurrentInfo.SetChirp(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
|
||||
}
|
||||
|
||||
public void DisplayTooltip(string text){
|
||||
@@ -85,7 +88,7 @@ namespace TweetDuck.Core.Bridge{
|
||||
public void OnTweetPopup(string columnId, string chirpId, string columnName, string tweetHtml, int tweetCharacters, string tweetUrl, string quoteUrl){
|
||||
notification.InvokeAsyncSafe(() => {
|
||||
form.OnTweetNotification();
|
||||
notification.ShowNotification(new TweetNotification(columnId, chirpId, columnName, tweetHtml, tweetCharacters, tweetUrl, quoteUrl));
|
||||
notification.ShowNotification(new DesktopNotification(columnId, chirpId, columnName, tweetHtml, tweetCharacters, tweetUrl, quoteUrl));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,31 +103,50 @@ namespace TweetDuck.Core.Bridge{
|
||||
form.InvokeAsyncSafe(() => form.OnTweetScreenshotReady(html, width));
|
||||
}
|
||||
|
||||
public void PlayVideo(string url, string username){
|
||||
form.InvokeAsyncSafe(() => form.PlayVideo(url, username));
|
||||
public void PlayVideo(string videoUrl, string tweetUrl, string username, IJavascriptCallback callShowOverlay){
|
||||
form.InvokeAsyncSafe(() => form.PlayVideo(videoUrl, tweetUrl, username, callShowOverlay));
|
||||
}
|
||||
|
||||
public void StopVideo(){
|
||||
form.InvokeAsyncSafe(form.StopVideo);
|
||||
}
|
||||
|
||||
public void FixClipboard(){
|
||||
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
||||
form.InvokeAsyncSafe(ClipboardManager.StripHtmlStyles);
|
||||
}
|
||||
|
||||
public void OpenBrowser(string url){
|
||||
form.InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(url));
|
||||
}
|
||||
|
||||
public void MakeGetRequest(string url, IJavascriptCallback onSuccess, IJavascriptCallback onError){
|
||||
Task.Run(async () => {
|
||||
var client = WebUtils.NewClient(BrowserUtils.UserAgentVanilla);
|
||||
|
||||
try{
|
||||
var result = await client.DownloadStringTaskAsync(url);
|
||||
await onSuccess.ExecuteAsync(result);
|
||||
}catch(Exception e){
|
||||
await onError.ExecuteAsync(e.Message);
|
||||
}finally{
|
||||
onSuccess.Dispose();
|
||||
onError.Dispose();
|
||||
client.Dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int GetIdleSeconds(){
|
||||
return NativeMethods.GetIdleSeconds();
|
||||
}
|
||||
|
||||
public void Alert(string type, string contents){
|
||||
MessageBoxIcon icon;
|
||||
|
||||
switch(type){
|
||||
case "error": icon = MessageBoxIcon.Error; break;
|
||||
case "warning": icon = MessageBoxIcon.Warning; break;
|
||||
case "info": icon = MessageBoxIcon.Information; break;
|
||||
default: icon = MessageBoxIcon.None; break;
|
||||
}
|
||||
MessageBoxIcon icon = type switch{
|
||||
"error" => MessageBoxIcon.Error,
|
||||
"warning" => MessageBoxIcon.Warning,
|
||||
"info" => MessageBoxIcon.Information,
|
||||
_ => MessageBoxIcon.None
|
||||
};
|
||||
|
||||
FormMessage.Show("TweetDuck Browser Message", contents, icon, FormMessage.OK);
|
||||
}
|
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Updates;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
namespace TweetDuck.Browser.Bridge{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
class UpdateBridge{
|
||||
private readonly UpdateHandler updates;
|
||||
private readonly Control sync;
|
||||
@@ -11,7 +13,6 @@ namespace TweetDuck.Core.Bridge{
|
||||
private UpdateInfo nextUpdate = null;
|
||||
|
||||
public event EventHandler<UpdateInfo> UpdateAccepted;
|
||||
public event EventHandler<UpdateInfo> UpdateDelayed;
|
||||
public event EventHandler<UpdateInfo> UpdateDismissed;
|
||||
|
||||
public UpdateBridge(UpdateHandler updates, Control sync){
|
||||
@@ -54,10 +55,6 @@ namespace TweetDuck.Core.Bridge{
|
||||
HandleInteractionEvent(UpdateAccepted);
|
||||
}
|
||||
|
||||
public void OnUpdateDelayed(){
|
||||
HandleInteractionEvent(UpdateDelayed);
|
||||
}
|
||||
|
||||
public void OnUpdateDismissed(){
|
||||
HandleInteractionEvent(UpdateDismissed);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Management{
|
||||
namespace TweetDuck.Browser.Data{
|
||||
sealed class ContextInfo{
|
||||
private LinkInfo link;
|
||||
private ChirpInfo? chirp;
|
||||
@@ -107,7 +107,7 @@ namespace TweetDuck.Core.Management{
|
||||
private string unsafeLinkUrl = string.Empty;
|
||||
private string mediaUrl = string.Empty;
|
||||
|
||||
private ChirpInfo chirp = default(ChirpInfo);
|
||||
private ChirpInfo chirp = default;
|
||||
|
||||
public void AddContext(IContextMenuParams parameters){
|
||||
ContextMenuType flags = parameters.TypeFlags;
|
38
Browser/Data/ResourceHandlers.cs
Normal file
38
Browser/Data/ResourceHandlers.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Browser.Data{
|
||||
sealed class ResourceHandlers{
|
||||
private readonly ConcurrentDictionary<string, IResourceHandler> handlers = new ConcurrentDictionary<string, IResourceHandler>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public bool HasHandler(IRequest request){
|
||||
return handlers.ContainsKey(request.Url);
|
||||
}
|
||||
|
||||
public IResourceHandler GetHandler(IRequest request){
|
||||
return handlers.TryGetValue(request.Url, out var handler) ? handler : null;
|
||||
}
|
||||
|
||||
public bool Register(string url, IResourceHandler handler){
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||
handlers.AddOrUpdate(uri.AbsoluteUri, handler, (key, prev) => handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Register(ResourceLink link){
|
||||
return Register(link.Url, link.Handler);
|
||||
}
|
||||
|
||||
public bool Unregister(string url){
|
||||
return handlers.TryRemove(url, out IResourceHandler _);
|
||||
}
|
||||
|
||||
public bool Unregister(ResourceLink link){
|
||||
return Unregister(link.Url);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Data{
|
||||
namespace TweetDuck.Browser.Data{
|
||||
sealed class ResourceLink{
|
||||
public string Url { get; }
|
||||
public IResourceHandler Handler { get; }
|
@@ -1,10 +1,10 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data.Serialization;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Serialization.Converters;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Data{
|
||||
namespace TweetDuck.Browser.Data{
|
||||
sealed class WindowState{
|
||||
private Rectangle rect;
|
||||
private bool isMaximized;
|
@@ -1,21 +1,10 @@
|
||||
namespace TweetDuck.Core {
|
||||
namespace TweetDuck.Browser {
|
||||
sealed partial class FormBrowser {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
@@ -24,7 +13,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.trayIcon = new TweetDuck.Core.Other.TrayIcon(this.components);
|
||||
this.trayIcon = new TrayIcon(this.components);
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.timerResize = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
@@ -38,10 +27,10 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = TweetDuck.Core.Utils.TwitterUtils.BackgroundColor;
|
||||
this.BackColor = TweetDuck.Utils.TwitterUtils.BackgroundColor;
|
||||
this.ClientSize = new System.Drawing.Size(1008, 730);
|
||||
this.Icon = Properties.Resources.icon;
|
||||
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.Location = TweetDuck.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.MinimumSize = new System.Drawing.Size(348, 424);
|
||||
this.Name = "FormBrowser";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
@@ -57,7 +46,7 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private TweetDuck.Core.Other.TrayIcon trayIcon;
|
||||
private TrayIcon trayIcon;
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.Timer timerResize;
|
||||
}
|
@@ -1,24 +1,29 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Bridge;
|
||||
using TweetDuck.Browser.Handling;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Browser.Notification;
|
||||
using TweetDuck.Browser.Notification.Screenshot;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Notification.Screenshot;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Dialogs.Settings;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Management.Analytics;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Updates;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
namespace TweetDuck.Browser{
|
||||
sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
@@ -39,15 +44,18 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
}
|
||||
|
||||
public string UpdateInstallerPath { get; private set; }
|
||||
public UpdateInstaller UpdateInstaller { get; private set; }
|
||||
private bool ignoreUpdateCheckError;
|
||||
|
||||
public AnalyticsFile AnalyticsFile => analytics?.File ?? AnalyticsFile.Dummy;
|
||||
|
||||
#pragma warning disable IDE0069 // Disposable fields should be disposed
|
||||
private readonly TweetDeckBrowser browser;
|
||||
private readonly FormNotificationTweet notification;
|
||||
#pragma warning restore IDE0069 // Disposable fields should be disposed
|
||||
|
||||
private readonly PluginManager plugins;
|
||||
private readonly UpdateHandler updates;
|
||||
private readonly FormNotificationTweet notification;
|
||||
private readonly ContextMenu contextMenu;
|
||||
private readonly UpdateBridge updateBridge;
|
||||
|
||||
@@ -58,25 +66,25 @@ namespace TweetDuck.Core{
|
||||
private VideoPlayer videoPlayer;
|
||||
private AnalyticsManager analytics;
|
||||
|
||||
public FormBrowser(){
|
||||
public FormBrowser(PluginSchemeFactory pluginScheme){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName;
|
||||
|
||||
this.plugins = new PluginManager(Program.Config.Plugins, Program.PluginPath);
|
||||
this.plugins = new PluginManager(Program.Config.Plugins, Program.PluginPath, Program.PluginDataPath);
|
||||
this.plugins.Reloaded += plugins_Reloaded;
|
||||
this.plugins.Executed += plugins_Executed;
|
||||
this.plugins.Reload();
|
||||
pluginScheme.Setup(plugins);
|
||||
|
||||
this.notification = new FormNotificationTweet(this, plugins);
|
||||
this.notification.Show();
|
||||
|
||||
this.updates = new UpdateHandler(Program.InstallerPath);
|
||||
this.updates = new UpdateHandler(new UpdateCheckClient(Program.InstallerPath), TaskScheduler.FromCurrentSynchronizationContext());
|
||||
this.updates.CheckFinished += updates_CheckFinished;
|
||||
|
||||
this.updateBridge = new UpdateBridge(updates, this);
|
||||
this.updateBridge.UpdateAccepted += updateBridge_UpdateAccepted;
|
||||
this.updateBridge.UpdateDelayed += updateBridge_UpdateDelayed;
|
||||
this.updateBridge.UpdateDismissed += updateBridge_UpdateDismissed;
|
||||
|
||||
this.browser = new TweetDeckBrowser(this, plugins, new TweetDeckBridge.Browser(this, notification), updateBridge);
|
||||
@@ -87,14 +95,7 @@ namespace TweetDuck.Core{
|
||||
Disposed += (sender, args) => {
|
||||
Config.MuteToggled -= Config_MuteToggled;
|
||||
Config.TrayBehaviorChanged -= Config_TrayBehaviorChanged;
|
||||
|
||||
browser.Dispose();
|
||||
updates.Dispose();
|
||||
contextMenu.Dispose();
|
||||
|
||||
notificationScreenshotManager?.Dispose();
|
||||
videoPlayer?.Dispose();
|
||||
analytics?.Dispose();
|
||||
};
|
||||
|
||||
Config.MuteToggled += Config_MuteToggled;
|
||||
@@ -116,6 +117,21 @@ namespace TweetDuck.Core{
|
||||
RestoreWindow();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing){
|
||||
if (disposing){
|
||||
components?.Dispose();
|
||||
|
||||
updates.Dispose();
|
||||
contextMenu.Dispose();
|
||||
|
||||
notificationScreenshotManager?.Dispose();
|
||||
videoPlayer?.Dispose();
|
||||
analytics?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void ShowChildForm(Form form){
|
||||
form.VisibleChanged += (sender, args) => form.MoveToCenter(this);
|
||||
form.Show(this);
|
||||
@@ -130,6 +146,8 @@ namespace TweetDuck.Core{
|
||||
|
||||
private void RestoreWindow(){
|
||||
Config.BrowserWindow.Restore(this, true);
|
||||
browser.PrepareSize(ClientSize);
|
||||
|
||||
prevState = WindowState;
|
||||
isLoaded = true;
|
||||
}
|
||||
@@ -149,7 +167,9 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void FormBrowser_Activated(object sender, EventArgs e){
|
||||
if (!isLoaded)return;
|
||||
if (!isLoaded){
|
||||
return;
|
||||
}
|
||||
|
||||
trayIcon.HasNotifications = false;
|
||||
|
||||
@@ -159,14 +179,18 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void FormBrowser_LocationChanged(object sender, EventArgs e){
|
||||
if (!isLoaded)return;
|
||||
if (!isLoaded){
|
||||
return;
|
||||
}
|
||||
|
||||
timerResize.Stop();
|
||||
timerResize.Start();
|
||||
}
|
||||
|
||||
private void FormBrowser_Resize(object sender, EventArgs e){
|
||||
if (!isLoaded)return;
|
||||
if (!isLoaded){
|
||||
return;
|
||||
}
|
||||
|
||||
if (WindowState != prevState){
|
||||
prevState = WindowState;
|
||||
@@ -187,9 +211,12 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves
|
||||
if (!isLoaded)return;
|
||||
if (!isLoaded){
|
||||
return;
|
||||
}
|
||||
|
||||
timerResize.Stop();
|
||||
browser.PrepareSize(ClientSize); // needed to pre-size browser control when launched in maximized state
|
||||
|
||||
if (Location != ControlExtensions.InvisibleLocation){
|
||||
Config.BrowserWindow.Save(this);
|
||||
@@ -198,7 +225,9 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void FormBrowser_FormClosing(object sender, FormClosingEventArgs e){
|
||||
if (!isLoaded)return;
|
||||
if (!isLoaded){
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.TrayBehavior.ShouldHideOnClose() && trayIcon.Visible && e.CloseReason == CloseReason.UserClosing){
|
||||
Hide(); // hides taskbar too?! welp that works I guess
|
||||
@@ -207,7 +236,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void FormBrowser_FormClosed(object sender, FormClosedEventArgs e){
|
||||
if (isLoaded && UpdateInstallerPath == null){
|
||||
if (isLoaded && UpdateInstaller == null){
|
||||
updateBridge.Cleanup();
|
||||
}
|
||||
}
|
||||
@@ -234,7 +263,7 @@ namespace TweetDuck.Core{
|
||||
|
||||
private void plugins_Reloaded(object sender, PluginErrorEventArgs e){
|
||||
if (e.HasErrors){
|
||||
FormMessage.Error("Error Loading Plugins", "The following plugins will not be available until the issues are resolved:\n\n"+string.Join("\n\n", e.Errors), FormMessage.OK);
|
||||
FormMessage.Error("Error Loading Plugins", "The following plugins will not be available until the issues are resolved:\n\n" + string.Join("\n\n", e.Errors), FormMessage.OK);
|
||||
}
|
||||
|
||||
if (isLoaded){
|
||||
@@ -242,9 +271,11 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
}
|
||||
|
||||
private static void plugins_Executed(object sender, PluginErrorEventArgs e){
|
||||
private void plugins_Executed(object sender, PluginErrorEventArgs e){
|
||||
if (e.HasErrors){
|
||||
FormMessage.Error("Error Executing Plugins", "Failed to execute the following plugins:\n\n"+string.Join("\n\n", e.Errors), FormMessage.OK);
|
||||
this.InvokeAsyncSafe(() => {
|
||||
FormMessage.Error("Error Executing Plugins", "Failed to execute the following plugins:\n\n" + string.Join("\n\n", e.Errors), FormMessage.OK);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,10 +312,10 @@ namespace TweetDuck.Core{
|
||||
UpdateDownloadStatus status = update.DownloadStatus;
|
||||
|
||||
if (status == UpdateDownloadStatus.Done){
|
||||
UpdateInstallerPath = update.InstallerPath;
|
||||
UpdateInstaller = new UpdateInstaller(update.InstallerPath);
|
||||
ForceClose();
|
||||
}
|
||||
else if (status != UpdateDownloadStatus.Canceled && FormMessage.Error("Update Has Failed", "Could not automatically download the update: "+(update.DownloadError?.Message ?? "unknown error")+"\n\nWould you like to open the website and try downloading the update manually?", FormMessage.Yes, FormMessage.No)){
|
||||
else if (status != UpdateDownloadStatus.Canceled && FormMessage.Error("Update Has Failed", "Could not automatically download the update: " + (update.DownloadError?.Message ?? "unknown error") + "\n\nWould you like to open the website and try downloading the update manually?", FormMessage.Yes, FormMessage.No)){
|
||||
BrowserUtils.OpenExternalBrowser(Program.Website);
|
||||
ForceClose();
|
||||
}
|
||||
@@ -317,10 +348,6 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBridge_UpdateDelayed(object sender, UpdateInfo update){
|
||||
// stops the timer
|
||||
}
|
||||
|
||||
private void updateBridge_UpdateDismissed(object sender, UpdateInfo update){
|
||||
Config.DismissedUpdate = update.VersionTag;
|
||||
Config.Save();
|
||||
@@ -328,7 +355,9 @@ namespace TweetDuck.Core{
|
||||
|
||||
protected override void WndProc(ref Message m){
|
||||
if (isLoaded && m.Msg == Program.WindowRestoreMessage){
|
||||
if (WindowsUtils.CurrentProcessID == m.WParam.ToInt32()){
|
||||
using Process me = Process.GetCurrentProcess();
|
||||
|
||||
if (me.Id == m.WParam.ToInt32()){
|
||||
trayIcon_ClickRestore(trayIcon, EventArgs.Empty);
|
||||
}
|
||||
|
||||
@@ -365,14 +394,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
public void ReloadToTweetDeck(){
|
||||
#if DEBUG
|
||||
ScriptLoader.HotSwap();
|
||||
#else
|
||||
if (ModifierKeys.HasFlag(Keys.Shift)){
|
||||
ScriptLoader.ClearCache();
|
||||
}
|
||||
#endif
|
||||
|
||||
Program.Resources.OnReloadTriggered();
|
||||
ignoreUpdateCheckError = false;
|
||||
browser.ReloadToTweetDeck();
|
||||
AnalyticsFile.BrowserReloads.Trigger();
|
||||
@@ -493,14 +515,14 @@ namespace TweetDuck.Core{
|
||||
public void OpenProfileImport(){
|
||||
FormManager.TryFind<FormSettings>()?.Close();
|
||||
|
||||
using(DialogSettingsManage dialog = new DialogSettingsManage(plugins, true)){
|
||||
using DialogSettingsManage dialog = new DialogSettingsManage(plugins, true);
|
||||
|
||||
if (!dialog.IsDisposed && dialog.ShowDialog() == DialogResult.OK && !dialog.IsRestarting){ // needs disposal check because the dialog may be closed in constructor
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
FormManager.TryFind<FormPlugins>()?.Close();
|
||||
plugins.Reload(); // also reloads the browser
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTweetNotification(){ // may be called multiple times, once for each type of notification
|
||||
if (Config.EnableTrayHighlight && !ContainsFocus){
|
||||
@@ -512,24 +534,40 @@ namespace TweetDuck.Core{
|
||||
AnalyticsFile.SoundNotifications.Trigger();
|
||||
}
|
||||
|
||||
public void PlayVideo(string url, string username){
|
||||
if (string.IsNullOrEmpty(url)){
|
||||
videoPlayer?.Close();
|
||||
return;
|
||||
}
|
||||
public void PlayVideo(string videoUrl, string tweetUrl, string username, IJavascriptCallback callShowOverlay){
|
||||
string playerPath = Config.VideoPlayerPath;
|
||||
|
||||
if (playerPath == null || !File.Exists(playerPath)){
|
||||
if (videoPlayer == null){
|
||||
videoPlayer = new VideoPlayer(this);
|
||||
|
||||
videoPlayer.ProcessExited += (sender, args) => {
|
||||
browser.HideVideoOverlay(true);
|
||||
};
|
||||
videoPlayer.ProcessExited += (sender, args) => browser.HideVideoOverlay(true);
|
||||
}
|
||||
|
||||
callShowOverlay.ExecuteAsync();
|
||||
callShowOverlay.Dispose();
|
||||
|
||||
videoPlayer.Launch(videoUrl, tweetUrl, username);
|
||||
}
|
||||
else{
|
||||
callShowOverlay.Dispose();
|
||||
|
||||
string quotedUrl = '"' + videoUrl + '"';
|
||||
string playerArgs = Config.VideoPlayerPathArgs == null ? quotedUrl : Config.VideoPlayerPathArgs + ' ' + quotedUrl;
|
||||
|
||||
try{
|
||||
using(Process.Start(playerPath, playerArgs)){}
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Error Opening Video Player", "Could not open the video player.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
videoPlayer.Launch(url, username);
|
||||
AnalyticsFile.VideoPlays.Trigger();
|
||||
}
|
||||
|
||||
public void StopVideo(){
|
||||
videoPlayer?.Close();
|
||||
}
|
||||
|
||||
public bool ProcessBrowserKey(Keys key){
|
||||
if (videoPlayer != null && videoPlayer.Running){
|
||||
videoPlayer.SendKeyEvent(key);
|
@@ -1,23 +1,26 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System.Linq;
|
||||
using TweetDuck.Browser.Adapters;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Browser.Notification;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Management.Analytics;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
abstract class ContextMenuBase : IContextMenuHandler{
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
public static ContextInfo CurrentInfo { get; } = new ContextInfo();
|
||||
|
||||
private static TwitterUtils.ImageQuality ImageQuality => Config.TwitterImageQuality;
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
private static ImageQuality ImageQuality => Config.TwitterImageQuality;
|
||||
|
||||
private const CefMenuCommand MenuOpenLinkUrl = (CefMenuCommand)26500;
|
||||
private const CefMenuCommand MenuCopyLinkUrl = (CefMenuCommand)26501;
|
||||
@@ -25,10 +28,11 @@ namespace TweetDuck.Core.Handling{
|
||||
private const CefMenuCommand MenuViewImage = (CefMenuCommand)26503;
|
||||
private const CefMenuCommand MenuOpenMediaUrl = (CefMenuCommand)26504;
|
||||
private const CefMenuCommand MenuCopyMediaUrl = (CefMenuCommand)26505;
|
||||
private const CefMenuCommand MenuSaveMedia = (CefMenuCommand)26506;
|
||||
private const CefMenuCommand MenuSaveTweetImages = (CefMenuCommand)26507;
|
||||
private const CefMenuCommand MenuSearchInBrowser = (CefMenuCommand)26508;
|
||||
private const CefMenuCommand MenuReadApplyROT13 = (CefMenuCommand)26509;
|
||||
private const CefMenuCommand MenuCopyImage = (CefMenuCommand)26506;
|
||||
private const CefMenuCommand MenuSaveMedia = (CefMenuCommand)26507;
|
||||
private const CefMenuCommand MenuSaveTweetImages = (CefMenuCommand)26508;
|
||||
private const CefMenuCommand MenuSearchInBrowser = (CefMenuCommand)26509;
|
||||
private const CefMenuCommand MenuReadApplyROT13 = (CefMenuCommand)26510;
|
||||
private const CefMenuCommand MenuOpenDevTools = (CefMenuCommand)26599;
|
||||
|
||||
protected ContextInfo.ContextData Context { get; private set; }
|
||||
@@ -40,11 +44,11 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
|
||||
Context = TweetDeckBridge.ContextInfo.Reset();
|
||||
if (!TwitterUrls.IsTweetDeck(frame.Url) || browser.IsLoading){
|
||||
Context = CurrentInfo.Reset();
|
||||
}
|
||||
else{
|
||||
Context = TweetDeckBridge.ContextInfo.Create(parameters);
|
||||
Context = CurrentInfo.Create(parameters);
|
||||
}
|
||||
|
||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection) && !parameters.TypeFlags.HasFlag(ContextMenuType.Editable)){
|
||||
@@ -54,12 +58,12 @@ namespace TweetDuck.Core.Handling{
|
||||
model.AddSeparator();
|
||||
}
|
||||
|
||||
string TextOpen(string name) => "Open "+name+" in browser";
|
||||
string TextCopy(string name) => "Copy "+name+" address";
|
||||
string TextSave(string name) => "Save "+name+" as...";
|
||||
static string TextOpen(string name) => "Open " + name + " in browser";
|
||||
static string TextCopy(string name) => "Copy " + name + " address";
|
||||
static string TextSave(string name) => "Save " + name + " as...";
|
||||
|
||||
if (Context.Types.HasFlag(ContextInfo.ContextType.Link) && !Context.UnsafeLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||
if (TwitterUtils.RegexAccount.IsMatch(Context.UnsafeLinkUrl)){
|
||||
if (TwitterUrls.RegexAccount.IsMatch(Context.UnsafeLinkUrl)){
|
||||
model.AddItem(MenuOpenLinkUrl, TextOpen("account"));
|
||||
model.AddItem(MenuCopyLinkUrl, TextCopy("account"));
|
||||
model.AddItem(MenuCopyUsername, "Copy account username");
|
||||
@@ -78,10 +82,11 @@ namespace TweetDuck.Core.Handling{
|
||||
model.AddItem(MenuSaveMedia, TextSave("video"));
|
||||
model.AddSeparator();
|
||||
}
|
||||
else if (Context.Types.HasFlag(ContextInfo.ContextType.Image) && Context.MediaUrl != TweetNotification.AppLogo.Url){
|
||||
else if (Context.Types.HasFlag(ContextInfo.ContextType.Image) && Context.MediaUrl != FormNotificationBase.AppLogo.Url){
|
||||
model.AddItem(MenuViewImage, "View image in photo viewer");
|
||||
model.AddItem(MenuOpenMediaUrl, TextOpen("image"));
|
||||
model.AddItem(MenuCopyMediaUrl, TextCopy("image"));
|
||||
model.AddItem(MenuCopyImage, "Copy image");
|
||||
model.AddItem(MenuSaveMedia, TextSave("image"));
|
||||
|
||||
if (Context.Chirp.Images.Length > 1){
|
||||
@@ -106,7 +111,7 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
case MenuCopyUsername: {
|
||||
string url = Context.UnsafeLinkUrl;
|
||||
Match match = TwitterUtils.RegexAccount.Match(url);
|
||||
Match match = TwitterUrls.RegexAccount.Match(url);
|
||||
|
||||
SetClipboardText(control, match.Success ? match.Groups[1].Value : url);
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.CopiedUsernames.Trigger);
|
||||
@@ -114,13 +119,23 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
case MenuOpenMediaUrl:
|
||||
OpenBrowser(control, TwitterUtils.GetMediaLink(Context.MediaUrl, ImageQuality));
|
||||
OpenBrowser(control, TwitterUrls.GetMediaLink(Context.MediaUrl, ImageQuality));
|
||||
break;
|
||||
|
||||
case MenuCopyMediaUrl:
|
||||
SetClipboardText(control, TwitterUtils.GetMediaLink(Context.MediaUrl, ImageQuality));
|
||||
SetClipboardText(control, TwitterUrls.GetMediaLink(Context.MediaUrl, ImageQuality));
|
||||
break;
|
||||
|
||||
case MenuCopyImage: {
|
||||
string url = Context.MediaUrl;
|
||||
|
||||
control.InvokeAsyncSafe(() => {
|
||||
TwitterUtils.CopyImage(url, ImageQuality);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuViewImage: {
|
||||
string url = Context.MediaUrl;
|
||||
|
||||
@@ -176,7 +191,7 @@ namespace TweetDuck.Core.Handling{
|
||||
break;
|
||||
|
||||
case MenuOpenDevTools:
|
||||
browserControl.ShowDevTools();
|
||||
browserControl.OpenDevToolsCustom();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -184,7 +199,7 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
public virtual void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame){
|
||||
Context = TweetDeckBridge.ContextInfo.Reset();
|
||||
Context = CurrentInfo.Reset();
|
||||
}
|
||||
|
||||
public virtual bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback){
|
||||
@@ -192,7 +207,7 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
protected static void DeselectAll(IFrame frame){
|
||||
ScriptLoader.ExecuteScript(frame, "window.getSelection().removeAllRanges()", "gen:deselect");
|
||||
CefScriptExecutor.RunScript(frame, "window.getSelection().removeAllRanges()", "gen:deselect");
|
||||
}
|
||||
|
||||
protected static void OpenBrowser(Control control, string url){
|
||||
@@ -200,11 +215,11 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
protected static void SetClipboardText(Control control, string text){
|
||||
control.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
||||
control.InvokeAsyncSafe(() => ClipboardManager.SetText(text, TextDataFormat.UnicodeText));
|
||||
}
|
||||
|
||||
protected static void InsertSelectionSearchItem(IMenuModel model, CefMenuCommand insertCommand, string insertLabel){
|
||||
model.InsertItemAt(model.GetIndexOf(MenuSearchInBrowser)+1, insertCommand, insertLabel);
|
||||
model.InsertItemAt(model.GetIndexOf(MenuSearchInBrowser) + 1, insertCommand, insertLabel);
|
||||
}
|
||||
|
||||
protected static void AddDebugMenuItems(IMenuModel model){
|
||||
@@ -215,13 +230,13 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
||||
model.RemoveAt(model.Count-1);
|
||||
if (model.Count > 0 && model.GetTypeAt(model.Count - 1) == MenuItemType.Separator){
|
||||
model.RemoveAt(model.Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void AddSeparator(IMenuModel model){
|
||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) != MenuItemType.Separator){ // do not add separators if there is nothing to separate
|
||||
if (model.Count > 0 && model.GetTypeAt(model.Count - 1) != MenuItemType.Separator){ // do not add separators if there is nothing to separate
|
||||
model.AddSeparator();
|
||||
}
|
||||
}
|
@@ -1,10 +1,10 @@
|
||||
using CefSharp;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class ContextMenuBrowser : ContextMenuBase{
|
||||
private const CefMenuCommand MenuGlobal = (CefMenuCommand)26600;
|
||||
private const CefMenuCommand MenuMute = (CefMenuCommand)26601;
|
||||
@@ -24,7 +24,7 @@ namespace TweetDuck.Core.Handling{
|
||||
private const string TitleMuteNotifications = "Mute notifications";
|
||||
private const string TitleSettings = "Options";
|
||||
private const string TitlePlugins = "Plugins";
|
||||
private const string TitleAboutProgram = "About "+Program.BrandName;
|
||||
private const string TitleAboutProgram = "About " + Program.BrandName;
|
||||
|
||||
private readonly FormBrowser form;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);
|
||||
|
||||
if (isSelecting && !isEditing && TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
if (isSelecting && !isEditing && TwitterUrls.IsTweetDeck(frame.Url)){
|
||||
InsertSelectionSearchItem(model, MenuSearchInColumn, "Search in a column");
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Management.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class ContextMenuGuide : ContextMenuBase{
|
||||
public ContextMenuGuide(AnalyticsFile.IProvider analytics) : base(analytics){}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Browser.Notification;
|
||||
using TweetDuck.Controls;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class ContextMenuNotification : ContextMenuBase{
|
||||
private const CefMenuCommand MenuViewDetail = (CefMenuCommand)26600;
|
||||
private const CefMenuCommand MenuSkipTweet = (CefMenuCommand)26601;
|
@@ -2,7 +2,7 @@
|
||||
using CefSharp;
|
||||
using CefSharp.Enums;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class DragHandlerBrowser : IDragHandler{
|
||||
private readonly RequestHandlerBrowser requestHandler;
|
||||
|
||||
@@ -30,6 +30,6 @@ namespace TweetDuck.Core.Handling{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnDraggableRegionsChanged(IWebBrowser browserControl, IBrowser browser, IList<DraggableRegion> regions){}
|
||||
public void OnDraggableRegionsChanged(IWebBrowser browserControl, IBrowser browser, IFrame frame, IList<DraggableRegion> regions){}
|
||||
}
|
||||
}
|
@@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Handling.Filters{
|
||||
namespace TweetDuck.Browser.Handling.Filters{
|
||||
abstract class ResponseFilterBase : IResponseFilter{
|
||||
private enum State{
|
||||
Reading, Writing, Done
|
||||
@@ -25,7 +25,7 @@ namespace TweetDuck.Core.Handling.Filters{
|
||||
int responseLength = responseData.Length;
|
||||
|
||||
if (state == State.Reading){
|
||||
int bytesToRead = Math.Min(responseLength-offset, (int)Math.Min(dataIn?.Length ?? 0, int.MaxValue));
|
||||
int bytesToRead = Math.Min(responseLength - offset, (int)Math.Min(dataIn?.Length ?? 0, int.MaxValue));
|
||||
|
||||
dataIn?.Read(responseData, offset, bytesToRead);
|
||||
offset += bytesToRead;
|
||||
@@ -42,7 +42,7 @@ namespace TweetDuck.Core.Handling.Filters{
|
||||
return FilterStatus.NeedMoreData;
|
||||
}
|
||||
else if (state == State.Writing){
|
||||
int bytesToWrite = Math.Min(responseLength-offset, (int)Math.Min(dataOut.Length, int.MaxValue));
|
||||
int bytesToWrite = Math.Min(responseLength - offset, (int)Math.Min(dataOut.Length, int.MaxValue));
|
||||
|
||||
if (bytesToWrite > 0){
|
||||
dataOut.Write(responseData, offset, bytesToWrite);
|
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace TweetDuck.Core.Handling.Filters{
|
||||
namespace TweetDuck.Browser.Handling.Filters{
|
||||
sealed class ResponseFilterVendor : ResponseFilterBase{
|
||||
private static readonly Regex RegexRestoreJQuery = new Regex(@"(\w+)\.fn=\1\.prototype", RegexOptions.Compiled);
|
||||
|
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
|
||||
using CefSharp;
|
||||
using TweetDuck.Configuration;
|
||||
|
||||
namespace TweetDuck.Core.Handling.General{
|
||||
namespace TweetDuck.Browser.Handling.General{
|
||||
sealed class BrowserProcessHandler : IBrowserProcessHandler{
|
||||
public static Task UpdatePrefs(){
|
||||
return Cef.UIThreadTaskFactory.StartNew(UpdatePrefsInternal);
|
||||
@@ -11,13 +11,12 @@ namespace TweetDuck.Core.Handling.General{
|
||||
|
||||
private static void UpdatePrefsInternal(){
|
||||
UserConfig config = Program.Config.User;
|
||||
using IRequestContext ctx = Cef.GetGlobalRequestContext();
|
||||
|
||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||
ctx.SetPreference("browser.enable_spellchecking", config.EnableSpellCheck, out string _);
|
||||
ctx.SetPreference("spellcheck.dictionary", config.SpellCheckLanguage, out string _);
|
||||
ctx.SetPreference("settings.a11y.animation_policy", config.EnableAnimatedImages ? "allowed" : "none", out string _);
|
||||
}
|
||||
}
|
||||
|
||||
void IBrowserProcessHandler.OnContextInitialized(){
|
||||
UpdatePrefsInternal();
|
@@ -1,15 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Handling.General{
|
||||
namespace TweetDuck.Browser.Handling.General{
|
||||
sealed class FileDialogHandler : IDialogHandler{
|
||||
public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, CefFileDialogFlags flags, string title, string defaultFilePath, List<string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback){
|
||||
if (mode == CefFileDialogMode.Open || mode == CefFileDialogMode.OpenMultiple){
|
||||
string allFilters = string.Join(";", acceptFilters.Select(filter => "*"+filter));
|
||||
string allFilters = string.Join(";", acceptFilters.SelectMany(ParseFileType).Where(filter => !string.IsNullOrEmpty(filter)).Select(filter => "*" + filter));
|
||||
|
||||
using(OpenFileDialog dialog = new OpenFileDialog{
|
||||
AutoUpgradeEnabled = true,
|
||||
@@ -19,8 +18,8 @@ namespace TweetDuck.Core.Handling.General{
|
||||
Filter = $"All Supported Formats ({allFilters})|{allFilters}|All Files (*.*)|*.*"
|
||||
}){
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
string ext = Path.GetExtension(dialog.FileName);
|
||||
callback.Continue(acceptFilters.FindIndex(filter => filter.Equals(ext, StringComparison.OrdinalIgnoreCase)), dialog.FileNames.ToList());
|
||||
string ext = Path.GetExtension(dialog.FileName)?.ToLower();
|
||||
callback.Continue(acceptFilters.FindIndex(filter => ParseFileType(filter).Contains(ext)), dialog.FileNames.ToList());
|
||||
}
|
||||
else{
|
||||
callback.Cancel();
|
||||
@@ -36,5 +35,27 @@ namespace TweetDuck.Core.Handling.General{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<string> ParseFileType(string type){
|
||||
if (string.IsNullOrEmpty(type)){
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
if (type[0] == '.'){
|
||||
return new string[]{ type };
|
||||
}
|
||||
|
||||
switch(type){
|
||||
case "image/jpeg": return new string[]{ ".jpg", ".jpeg" };
|
||||
case "image/png": return new string[]{ ".png" };
|
||||
case "image/gif": return new string[]{ ".gif" };
|
||||
case "image/webp": return new string[]{ ".webp" };
|
||||
case "video/mp4": return new string[]{ ".mp4" };
|
||||
case "video/quicktime": return new string[]{ ".mov", ".qt" };
|
||||
}
|
||||
|
||||
System.Diagnostics.Debugger.Break();
|
||||
return new string[0];
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,26 +1,28 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling.General{
|
||||
namespace TweetDuck.Browser.Handling.General{
|
||||
sealed class JavaScriptDialogHandler : IJsDialogHandler{
|
||||
private static FormMessage CreateMessageForm(string caption, string text){
|
||||
MessageBoxIcon icon = MessageBoxIcon.None;
|
||||
int pipe = text.IndexOf('|');
|
||||
|
||||
if (pipe != -1){
|
||||
switch(text.Substring(0, pipe)){
|
||||
case "error": icon = MessageBoxIcon.Error; break;
|
||||
case "warning": icon = MessageBoxIcon.Warning; break;
|
||||
case "info": icon = MessageBoxIcon.Information; break;
|
||||
case "question": icon = MessageBoxIcon.Question; break;
|
||||
default: return new FormMessage(caption, text, icon);
|
||||
}
|
||||
icon = text.Substring(0, pipe) switch{
|
||||
"error" => MessageBoxIcon.Error,
|
||||
"warning" => MessageBoxIcon.Warning,
|
||||
"info" => MessageBoxIcon.Information,
|
||||
"question" => MessageBoxIcon.Question,
|
||||
_ => MessageBoxIcon.None
|
||||
};
|
||||
|
||||
text = text.Substring(pipe+1);
|
||||
if (icon != MessageBoxIcon.None){
|
||||
text = text.Substring(pipe + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return new FormMessage(caption, text, icon);
|
||||
@@ -51,13 +53,13 @@ namespace TweetDuck.Core.Handling.General{
|
||||
input = new TextBox{
|
||||
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||
Font = SystemFonts.MessageBoxFont,
|
||||
Location = new Point(BrowserUtils.Scale(22+inputPad, dpiScale), form.ActionPanelY-BrowserUtils.Scale(46, dpiScale)),
|
||||
Size = new Size(form.ClientSize.Width-BrowserUtils.Scale(44+inputPad, dpiScale), BrowserUtils.Scale(23, dpiScale))
|
||||
Location = new Point(BrowserUtils.Scale(22 + inputPad, dpiScale), form.ActionPanelY - BrowserUtils.Scale(46, dpiScale)),
|
||||
Size = new Size(form.ClientSize.Width - BrowserUtils.Scale(44 + inputPad, dpiScale), BrowserUtils.Scale(23, dpiScale))
|
||||
};
|
||||
|
||||
form.Controls.Add(input);
|
||||
form.ActiveControl = input;
|
||||
form.Height += input.Size.Height+input.Margin.Vertical;
|
||||
form.Height += input.Size.Height + input.Margin.Vertical;
|
||||
}
|
||||
else{
|
||||
callback.Continue(false);
|
||||
@@ -80,7 +82,8 @@ namespace TweetDuck.Core.Handling.General{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IJsDialogHandler.OnJSBeforeUnload(IWebBrowser browserControl, IBrowser browser, string message, bool isReload, IJsDialogCallback callback){
|
||||
bool IJsDialogHandler.OnBeforeUnloadDialog(IWebBrowser browserControl, IBrowser browser, string messageText, bool isReload, IJsDialogCallback callback){
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,14 +1,18 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling.General{
|
||||
namespace TweetDuck.Browser.Handling.General{
|
||||
sealed class LifeSpanHandler : ILifeSpanHandler{
|
||||
private static bool IsPopupAllowed(string url){
|
||||
return url.StartsWith("https://twitter.com/teams/authorize?");
|
||||
}
|
||||
|
||||
public static bool HandleLinkClick(IWebBrowser browserControl, WindowOpenDisposition targetDisposition, string targetUrl){
|
||||
switch(targetDisposition){
|
||||
case WindowOpenDisposition.NewBackgroundTab:
|
||||
case WindowOpenDisposition.NewForegroundTab:
|
||||
case WindowOpenDisposition.NewPopup:
|
||||
case WindowOpenDisposition.NewPopup when !IsPopupAllowed(targetUrl):
|
||||
case WindowOpenDisposition.NewWindow:
|
||||
browserControl.AsControl().InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(targetUrl));
|
||||
return true;
|
@@ -1,15 +1,15 @@
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
class KeyboardHandlerBase : IKeyboardHandler{
|
||||
protected virtual bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||
if (modifiers == (CefEventFlags.ControlDown | CefEventFlags.ShiftDown) && key == Keys.I){
|
||||
if (BrowserUtils.HasDevTools){
|
||||
browser.ShowDevTools();
|
||||
browserControl.OpenDevToolsCustom();
|
||||
}
|
||||
else{
|
||||
browserControl.AsControl().InvokeSafe(() => {
|
||||
@@ -22,7 +22,7 @@ namespace TweetDuck.Core.Handling{
|
||||
extraMessage = "Please download the installer, and tick 'Install dev tools' during the installation process. The installer will automatically find and update your current installation of TweetDuck.";
|
||||
}
|
||||
|
||||
FormMessage.Information("Dev Tools", "You do not have dev tools installed. "+extraMessage, FormMessage.OK);
|
||||
FormMessage.Information("Dev Tools", "You do not have dev tools installed. " + extraMessage, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
||||
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("chrome-devtools://")){
|
||||
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("devtools://")){
|
||||
return HandleRawKey(browserControl, browser, (Keys)windowsKeyCode, modifiers);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class KeyboardHandlerBrowser : KeyboardHandlerBase{
|
||||
private readonly FormBrowser form;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
using CefSharp;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Notification;
|
||||
using TweetDuck.Controls;
|
||||
|
||||
namespace TweetDuck.Core.Handling {
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class KeyboardHandlerNotification : KeyboardHandlerBase{
|
||||
private readonly FormNotificationBase notification;
|
||||
|
23
Browser/Handling/RequestHandlerBase.cs
Normal file
23
Browser/Handling/RequestHandlerBase.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
class RequestHandlerBase : RequestHandler{
|
||||
private readonly bool autoReload;
|
||||
|
||||
public RequestHandlerBase(bool autoReload){
|
||||
this.autoReload = autoReload;
|
||||
}
|
||||
|
||||
protected override bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||
return LifeSpanHandler.HandleLinkClick(browserControl, targetDisposition, targetUrl);
|
||||
}
|
||||
|
||||
protected override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||
if (autoReload){
|
||||
browser.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
Browser/Handling/RequestHandlerBrowser.cs
Normal file
23
Browser/Handling/RequestHandlerBrowser.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using CefSharp;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class RequestHandlerBrowser : RequestHandlerBase{
|
||||
public string BlockNextUserNavUrl { get; set; }
|
||||
|
||||
public RequestHandlerBrowser() : base(true){}
|
||||
|
||||
protected override bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect){
|
||||
if (userGesture && request.TransitionType == TransitionType.LinkClicked){
|
||||
bool block = request.Url == BlockNextUserNavUrl;
|
||||
BlockNextUserNavUrl = string.Empty;
|
||||
return block;
|
||||
}
|
||||
else if (request.TransitionType.HasFlag(TransitionType.ForwardBack) && TwitterUrls.IsTweetDeck(frame.Url)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnBeforeBrowse(browserControl, browser, frame, request, userGesture, isRedirect);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,9 +1,11 @@
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using CefSharp;
|
||||
using CefSharp.Callback;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
sealed class ResourceHandlerNotification : IResourceHandler{
|
||||
private readonly NameValueCollection headers = new NameValueCollection(0);
|
||||
private MemoryStream dataIn;
|
||||
@@ -20,8 +22,14 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
}
|
||||
|
||||
bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback){
|
||||
callback.Continue();
|
||||
bool IResourceHandler.Open(IRequest request, out bool handleRequest, ICallback callback){
|
||||
callback.Dispose();
|
||||
handleRequest = true;
|
||||
|
||||
if (dataIn != null){
|
||||
dataIn.Position = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,31 +39,39 @@ namespace TweetDuck.Core.Handling{
|
||||
response.MimeType = "text/html";
|
||||
response.StatusCode = 200;
|
||||
response.StatusText = "OK";
|
||||
response.ResponseHeaders = headers;
|
||||
responseLength = dataIn?.Length ?? -1;
|
||||
response.Headers = headers;
|
||||
responseLength = dataIn?.Length ?? 0;
|
||||
}
|
||||
|
||||
bool IResourceHandler.Read(Stream dataOut, out int bytesRead, IResourceReadCallback callback){
|
||||
callback?.Dispose(); // TODO unnecessary null check once ReadResponse is removed
|
||||
|
||||
try{
|
||||
byte[] buffer = new byte[Math.Min(dataIn.Length - dataIn.Position, dataOut.Length)];
|
||||
int length = buffer.Length;
|
||||
|
||||
dataIn.Read(buffer, 0, length);
|
||||
dataOut.Write(buffer, 0, length);
|
||||
bytesRead = length;
|
||||
}catch{ // catch IOException, possibly NullReferenceException if dataIn is null
|
||||
bytesRead = 0;
|
||||
}
|
||||
|
||||
return bytesRead > 0;
|
||||
}
|
||||
|
||||
bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback){
|
||||
bytesSkipped = -2; // ERR_FAILED
|
||||
callback.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback){
|
||||
return ((IResourceHandler)this).Open(request, out bool _, callback);
|
||||
}
|
||||
|
||||
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;
|
||||
return ((IResourceHandler)this).Read(dataOut, out bytesRead, null);
|
||||
}
|
||||
|
||||
void IResourceHandler.Cancel(){}
|
35
Browser/Handling/ResourceRequestHandler.cs
Normal file
35
Browser/Handling/ResourceRequestHandler.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Data;
|
||||
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
abstract class ResourceRequestHandler : CefSharp.Handler.ResourceRequestHandler{
|
||||
private class SelfFactoryImpl : IResourceRequestHandlerFactory{
|
||||
private readonly ResourceRequestHandler me;
|
||||
|
||||
public SelfFactoryImpl(ResourceRequestHandler me){
|
||||
this.me = me;
|
||||
}
|
||||
|
||||
bool IResourceRequestHandlerFactory.HasHandlers { get; } = true;
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantAssignment")]
|
||||
IResourceRequestHandler IResourceRequestHandlerFactory.GetResourceRequestHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling){
|
||||
disableDefaultHandling = me.ResourceHandlers.HasHandler(request);
|
||||
return me;
|
||||
}
|
||||
}
|
||||
|
||||
public IResourceRequestHandlerFactory SelfFactory { get; }
|
||||
public ResourceHandlers ResourceHandlers { get; }
|
||||
|
||||
protected ResourceRequestHandler(){
|
||||
this.SelfFactory = new SelfFactoryImpl(this);
|
||||
this.ResourceHandlers = new ResourceHandlers();
|
||||
}
|
||||
|
||||
protected override IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request){
|
||||
return ResourceHandlers.GetHandler(request);
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,13 +4,12 @@ using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class RequestHandlerBase : DefaultRequestHandler{
|
||||
private static readonly Regex TweetDeckResourceUrl = new Regex(@"/dist/(.*?)\.(.*?)\.(css|js)$", RegexOptions.Compiled);
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
class ResourceRequestHandlerBase : ResourceRequestHandler{
|
||||
private static readonly Regex TweetDeckResourceUrl = new Regex(@"/dist/(.*?)\.(.*?)\.(css|js)$");
|
||||
private static readonly SortedList<string, string> TweetDeckHashes = new SortedList<string, string>(4);
|
||||
|
||||
public static void LoadResourceRewriteRules(string rules){
|
||||
@@ -21,36 +20,23 @@ namespace TweetDuck.Core.Handling{
|
||||
TweetDeckHashes.Clear();
|
||||
|
||||
foreach(string rule in rules.Replace(" ", "").ToLower().Split(',')){
|
||||
string[] split = rule.Split('=');
|
||||
|
||||
if (split.Length == 2){
|
||||
string key = split[0];
|
||||
string hash = split[1];
|
||||
var (key, hash) = StringUtils.SplitInTwo(rule, '=') ?? throw new ArgumentException("A rule must have one '=' character: " + rule);
|
||||
|
||||
if (hash.All(chr => char.IsDigit(chr) || (chr >= 'a' && chr <= 'f'))){
|
||||
TweetDeckHashes.Add(key, hash);
|
||||
}
|
||||
else{
|
||||
throw new ArgumentException("Invalid hash characters: "+rule);
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw new ArgumentException("A rule must have exactly one '=' character: "+rule);
|
||||
throw new ArgumentException("Invalid hash characters: " + rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly bool autoReload;
|
||||
|
||||
public RequestHandlerBase(bool autoReload){
|
||||
this.autoReload = autoReload;
|
||||
protected override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (request.ResourceType == ResourceType.CspReport){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
}
|
||||
|
||||
public override bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||
return LifeSpanHandler.HandleLinkClick(browserControl, targetDisposition, targetUrl);
|
||||
}
|
||||
|
||||
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (BrowserUtils.HasDevTools){
|
||||
NameValueCollection headers = request.Headers;
|
||||
headers.Remove("x-devtools-emulate-network-conditions-client-id");
|
||||
@@ -60,7 +46,7 @@ namespace TweetDuck.Core.Handling{
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
}
|
||||
|
||||
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
protected override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if ((request.ResourceType == ResourceType.Script || request.ResourceType == ResourceType.Stylesheet) && TweetDeckHashes.Count > 0){
|
||||
string url = request.Url;
|
||||
Match match = TweetDeckResourceUrl.Match(url);
|
||||
@@ -79,11 +65,5 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||
}
|
||||
|
||||
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||
if (autoReload){
|
||||
browser.Reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
Browser/Handling/ResourceRequestHandlerBrowser.cs
Normal file
52
Browser/Handling/ResourceRequestHandlerBrowser.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Handling.Filters;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
|
||||
namespace TweetDuck.Browser.Handling{
|
||||
class ResourceRequestHandlerBrowser : ResourceRequestHandlerBase{
|
||||
private const string UrlVendorResource = "/dist/vendor";
|
||||
private const string UrlLoadingSpinner = "/backgrounds/spinner_blue";
|
||||
private const string UrlVersionCheck = "/web/dist/version.json";
|
||||
|
||||
protected override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (request.ResourceType == ResourceType.MainFrame){
|
||||
if (request.Url.EndsWith("//twitter.com/")){
|
||||
request.Url = TwitterUrls.TweetDeck; // redirect plain twitter.com requests, fixes bugs with login 2FA
|
||||
}
|
||||
}
|
||||
else if (request.ResourceType == ResourceType.Image){
|
||||
if (request.Url.Contains(UrlLoadingSpinner)){
|
||||
request.Url = TwitterUtils.LoadingSpinner.Url;
|
||||
}
|
||||
}
|
||||
else if (request.ResourceType == ResourceType.Script){
|
||||
string url = request.Url;
|
||||
|
||||
if (url.Contains("analytics.")){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
}
|
||||
else if (url.Contains(UrlVendorResource)){
|
||||
request.SetHeaderByName("Accept-Encoding", "identity", overwrite: true);
|
||||
}
|
||||
}
|
||||
else if (request.ResourceType == ResourceType.Xhr){
|
||||
if (request.Url.Contains(UrlVersionCheck)){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
}
|
||||
|
||||
protected override IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if (request.ResourceType == ResourceType.Script && request.Url.Contains(UrlVendorResource) && int.TryParse(response.Headers["Content-Length"], out int totalBytes)){
|
||||
return new ResponseFilterVendor(totalBytes);
|
||||
}
|
||||
|
||||
return base.GetResourceResponseFilter(browserControl, browser, frame, request, response);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Notification.Example{
|
||||
namespace TweetDuck.Browser.Notification.Example{
|
||||
sealed class FormNotificationExample : FormNotificationMain{
|
||||
public override bool RequiresResize => true;
|
||||
protected override bool CanDragWindow => Config.NotificationPosition == TweetNotification.Position.Custom;
|
||||
protected override bool CanDragWindow => Config.NotificationPosition == DesktopNotification.Position.Custom;
|
||||
|
||||
protected override FormBorderStyle NotificationBorderStyle{
|
||||
get{
|
||||
if (Config.NotificationSize == TweetNotification.Size.Custom){
|
||||
if (Config.NotificationSize == DesktopNotification.Size.Custom){
|
||||
switch(base.NotificationBorderStyle){
|
||||
case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable;
|
||||
case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow;
|
||||
@@ -23,22 +23,22 @@ namespace TweetDuck.Core.Notification.Example{
|
||||
}
|
||||
}
|
||||
|
||||
protected override string BodyClasses => base.BodyClasses+" td-example";
|
||||
protected override string BodyClasses => base.BodyClasses + " td-example";
|
||||
|
||||
public event EventHandler Ready;
|
||||
|
||||
private readonly TweetNotification exampleNotification;
|
||||
private readonly DesktopNotification exampleNotification;
|
||||
|
||||
public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){
|
||||
browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||
|
||||
string exampleTweetHTML = ScriptLoader.LoadResourceSilent("pages/example.html")?.Replace("{avatar}", TweetNotification.AppLogo.Url) ?? string.Empty;
|
||||
string exampleTweetHTML = Program.Resources.LoadSilent("pages/example.html")?.Replace("{avatar}", AppLogo.Url) ?? string.Empty;
|
||||
|
||||
#if DEBUG
|
||||
exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>");
|
||||
#endif
|
||||
|
||||
exampleNotification = new TweetNotification(string.Empty, string.Empty, "Home", exampleTweetHTML, 176, string.Empty, string.Empty);
|
||||
exampleNotification = new DesktopNotification(string.Empty, string.Empty, "Home", exampleTweetHTML, 176, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
@@ -1,21 +1,10 @@
|
||||
namespace TweetDuck.Core.Notification {
|
||||
namespace TweetDuck.Browser.Notification {
|
||||
partial class FormNotificationBase {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +23,7 @@
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ClientSize = new System.Drawing.Size(284, 122);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.Location = TweetDuck.Controls.ControlExtensions.InvisibleLocation;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FormNotification";
|
@@ -1,28 +1,36 @@
|
||||
using CefSharp.WinForms;
|
||||
using System.Drawing;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Browser.Handling;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Management.Analytics;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
namespace TweetDuck.Browser.Notification{
|
||||
abstract partial class FormNotificationBase : Form, AnalyticsFile.IProvider{
|
||||
public static readonly ResourceLink AppLogo = new ResourceLink("https://ton.twimg.com/tduck/avatar", ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png"));
|
||||
|
||||
protected const string BlankURL = TwitterUrls.TweetDeck + "/?blank";
|
||||
|
||||
public static string FontSize = null;
|
||||
public static string HeadLayout = null;
|
||||
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
|
||||
protected static int FontSizeLevel{
|
||||
get{
|
||||
switch(TweetDeckBridge.FontSize){
|
||||
case "largest": return 4;
|
||||
case "large": return 3;
|
||||
case "small": return 1;
|
||||
case "smallest": return 0;
|
||||
default: return 2;
|
||||
}
|
||||
}
|
||||
get => FontSize switch{
|
||||
"largest" => 4,
|
||||
"large" => 3,
|
||||
"small" => 1,
|
||||
"smallest" => 0,
|
||||
_ => 2
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual Point PrimaryLocation{
|
||||
@@ -30,7 +38,7 @@ namespace TweetDuck.Core.Notification{
|
||||
Screen screen;
|
||||
|
||||
if (Config.NotificationDisplay > 0 && Config.NotificationDisplay <= Screen.AllScreens.Length){
|
||||
screen = Screen.AllScreens[Config.NotificationDisplay-1];
|
||||
screen = Screen.AllScreens[Config.NotificationDisplay - 1];
|
||||
}
|
||||
else{
|
||||
screen = Screen.FromControl(owner);
|
||||
@@ -39,21 +47,21 @@ namespace TweetDuck.Core.Notification{
|
||||
int edgeDist = Config.NotificationEdgeDistance;
|
||||
|
||||
switch(Config.NotificationPosition){
|
||||
case TweetNotification.Position.TopLeft:
|
||||
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+edgeDist);
|
||||
case DesktopNotification.Position.TopLeft:
|
||||
return new Point(screen.WorkingArea.X + edgeDist, screen.WorkingArea.Y + edgeDist);
|
||||
|
||||
case TweetNotification.Position.TopRight:
|
||||
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
|
||||
case DesktopNotification.Position.TopRight:
|
||||
return new Point(screen.WorkingArea.X + screen.WorkingArea.Width - edgeDist - Width, screen.WorkingArea.Y + edgeDist);
|
||||
|
||||
case TweetNotification.Position.BottomLeft:
|
||||
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
||||
case DesktopNotification.Position.BottomLeft:
|
||||
return new Point(screen.WorkingArea.X + edgeDist, screen.WorkingArea.Y + screen.WorkingArea.Height - edgeDist - Height);
|
||||
|
||||
case TweetNotification.Position.BottomRight:
|
||||
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
||||
case DesktopNotification.Position.BottomRight:
|
||||
return new Point(screen.WorkingArea.X + screen.WorkingArea.Width - edgeDist - Width, screen.WorkingArea.Y + screen.WorkingArea.Height - edgeDist - Height);
|
||||
|
||||
case TweetNotification.Position.Custom:
|
||||
case DesktopNotification.Position.Custom:
|
||||
if (!Config.IsCustomNotificationPositionSet){
|
||||
Config.CustomNotificationPosition = new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
|
||||
Config.CustomNotificationPosition = new Point(screen.WorkingArea.X + screen.WorkingArea.Width - edgeDist - Width, screen.WorkingArea.Y + edgeDist);
|
||||
Config.Save();
|
||||
}
|
||||
|
||||
@@ -94,14 +102,17 @@ namespace TweetDuck.Core.Notification{
|
||||
protected override bool ShowWithoutActivation => true;
|
||||
|
||||
protected float DpiScale { get; }
|
||||
protected double SizeScale => DpiScale*Config.ZoomLevel/100.0;
|
||||
protected double SizeScale => DpiScale * Config.ZoomLevel / 100.0;
|
||||
|
||||
protected readonly FormBrowser owner;
|
||||
|
||||
#pragma warning disable IDE0069 // Disposable fields should be disposed
|
||||
protected readonly ChromiumWebBrowser browser;
|
||||
#pragma warning restore IDE0069 // Disposable fields should be disposed
|
||||
|
||||
private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
|
||||
|
||||
private TweetNotification currentNotification;
|
||||
private DesktopNotification currentNotification;
|
||||
private int pauseCounter;
|
||||
|
||||
public string CurrentTweetUrl => currentNotification?.TweetUrl;
|
||||
@@ -121,16 +132,19 @@ namespace TweetDuck.Core.Notification{
|
||||
this.owner = owner;
|
||||
this.owner.FormClosed += owner_FormClosed;
|
||||
|
||||
ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();
|
||||
resourceHandlerFactory.RegisterHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
|
||||
resourceHandlerFactory.RegisterHandler(TweetNotification.AppLogo);
|
||||
var resourceRequestHandler = new ResourceRequestHandlerBase();
|
||||
var resourceHandlers = resourceRequestHandler.ResourceHandlers;
|
||||
|
||||
this.browser = new ChromiumWebBrowser("about:blank"){
|
||||
resourceHandlers.Register(BlankURL, ResourceHandler.FromString(string.Empty));
|
||||
resourceHandlers.Register(TwitterUrls.TweetDeck, this.resourceHandler);
|
||||
resourceHandlers.Register(AppLogo);
|
||||
|
||||
this.browser = new ChromiumWebBrowser(BlankURL){
|
||||
MenuHandler = new ContextMenuNotification(this, enableContextMenu),
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = new RequestHandlerBase(false),
|
||||
ResourceHandlerFactory = resourceHandlerFactory
|
||||
ResourceRequestHandlerFactory = resourceRequestHandler.SelfFactory
|
||||
};
|
||||
|
||||
this.browser.Dock = DockStyle.None;
|
||||
@@ -140,8 +154,8 @@ namespace TweetDuck.Core.Notification{
|
||||
Controls.Add(browser);
|
||||
|
||||
Disposed += (sender, args) => {
|
||||
this.browser.Dispose();
|
||||
this.owner.FormClosed -= owner_FormClosed;
|
||||
this.browser.Dispose();
|
||||
};
|
||||
|
||||
DpiScale = this.GetDPIScale();
|
||||
@@ -150,6 +164,15 @@ namespace TweetDuck.Core.Notification{
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing){
|
||||
if (disposing){
|
||||
components?.Dispose();
|
||||
resourceHandler.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m){
|
||||
if (m.Msg == 0x0112 && (m.WParam.ToInt32() & 0xFFF0) == 0xF010 && !CanDragWindow){ // WM_SYSCOMMAND, SC_MOVE
|
||||
return;
|
||||
@@ -167,7 +190,7 @@ namespace TweetDuck.Core.Notification{
|
||||
// notification methods
|
||||
|
||||
public virtual void HideNotification(){
|
||||
browser.Load("about:blank");
|
||||
browser.Load(BlankURL);
|
||||
DisplayTooltip(null);
|
||||
|
||||
Location = ControlExtensions.InvisibleLocation;
|
||||
@@ -188,13 +211,13 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract string GetTweetHTML(TweetNotification tweet);
|
||||
protected abstract string GetTweetHTML(DesktopNotification tweet);
|
||||
|
||||
protected virtual void LoadTweet(TweetNotification tweet){
|
||||
protected virtual void LoadTweet(DesktopNotification tweet){
|
||||
currentNotification = tweet;
|
||||
resourceHandler.SetHTML(GetTweetHTML(tweet));
|
||||
|
||||
browser.Load(TwitterUtils.TweetDeckURL);
|
||||
browser.Load(TwitterUrls.TweetDeck);
|
||||
DisplayTooltip(null);
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Notification {
|
||||
namespace TweetDuck.Browser.Notification {
|
||||
partial class FormNotificationMain {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -26,7 +26,7 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||
this.progressBarTimer = new TweetDuck.Core.Controls.FlatProgressBar();
|
||||
this.progressBarTimer = new TweetDuck.Controls.FlatProgressBar();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// timerDisplayDelay
|
@@ -1,17 +1,20 @@
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using CefSharp;
|
||||
using TweetDuck.Browser.Adapters;
|
||||
using TweetDuck.Browser.Bridge;
|
||||
using TweetDuck.Browser.Handling;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Data;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
namespace TweetDuck.Browser.Notification{
|
||||
abstract partial class FormNotificationMain : FormNotificationBase{
|
||||
private readonly PluginManager plugins;
|
||||
private readonly int timerBarHeight;
|
||||
@@ -23,6 +26,8 @@ namespace TweetDuck.Core.Notification{
|
||||
private IntPtr mouseHook;
|
||||
private bool blockXButtonUp;
|
||||
|
||||
private int currentOpacity;
|
||||
|
||||
private bool? prevDisplayTimer;
|
||||
private int? prevFontSize;
|
||||
|
||||
@@ -44,32 +49,22 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
private int BaseClientWidth{
|
||||
get{
|
||||
switch(Config.NotificationSize){
|
||||
default:
|
||||
return BrowserUtils.Scale(284, SizeScale*(1.0+0.05*FontSizeLevel));
|
||||
|
||||
case TweetNotification.Size.Custom:
|
||||
return Config.CustomNotificationSize.Width;
|
||||
}
|
||||
}
|
||||
get => Config.NotificationSize switch{
|
||||
DesktopNotification.Size.Custom => Config.CustomNotificationSize.Width,
|
||||
_ => BrowserUtils.Scale(284, SizeScale * (1.0 + 0.05 * FontSizeLevel))
|
||||
};
|
||||
}
|
||||
|
||||
private int BaseClientHeight{
|
||||
get{
|
||||
switch(Config.NotificationSize){
|
||||
default:
|
||||
return BrowserUtils.Scale(122, SizeScale*(1.0+0.08*FontSizeLevel));
|
||||
|
||||
case TweetNotification.Size.Custom:
|
||||
return Config.CustomNotificationSize.Height;
|
||||
}
|
||||
}
|
||||
get => Config.NotificationSize switch{
|
||||
DesktopNotification.Size.Custom => Config.CustomNotificationSize.Height,
|
||||
_ => BrowserUtils.Scale(122, SizeScale * (1.0 + 0.08 * FontSizeLevel))
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual string BodyClasses => IsCursorOverBrowser ? "td-notification td-hover" : "td-notification";
|
||||
|
||||
public Size BrowserSize => Config.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-timerBarHeight) : ClientSize;
|
||||
public Size BrowserSize => Config.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height - timerBarHeight) : ClientSize;
|
||||
|
||||
protected FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
|
||||
InitializeComponent();
|
||||
@@ -78,17 +73,26 @@ namespace TweetDuck.Core.Notification{
|
||||
this.timerBarHeight = BrowserUtils.Scale(4, DpiScale);
|
||||
|
||||
browser.KeyboardHandler = new KeyboardHandlerNotification(this);
|
||||
browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge.Notification(owner, this));
|
||||
browser.RegisterJsBridge("$TD", new TweetDeckBridge.Notification(owner, this));
|
||||
|
||||
browser.LoadingStateChanged += Browser_LoadingStateChanged;
|
||||
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
||||
|
||||
plugins.Register(browser, PluginEnvironment.Notification, this);
|
||||
plugins.Register(PluginEnvironment.Notification, new PluginDispatcher(browser, url => TwitterUrls.IsTweetDeck(url) && url != BlankURL));
|
||||
|
||||
mouseHookDelegate = MouseHookProc;
|
||||
Disposed += (sender, args) => StopMouseHook(true);
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
private void SetOpacity(int opacity){
|
||||
if (currentOpacity != opacity){
|
||||
currentOpacity = opacity;
|
||||
Opacity = opacity / 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
// mouse wheel hook
|
||||
|
||||
private void StartMouseHook(){
|
||||
@@ -110,7 +114,15 @@ namespace TweetDuck.Core.Notification{
|
||||
int eventType = wParam.ToInt32();
|
||||
|
||||
if (eventType == NativeMethods.WM_MOUSEWHEEL && IsCursorOverBrowser){
|
||||
browser.SendMouseWheelEvent(0, 0, 0, BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Config.NotificationScrollSpeed*0.01), CefEventFlags.None);
|
||||
int delta = BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Config.NotificationScrollSpeed * 0.01);
|
||||
|
||||
if (Config.EnableSmoothScrolling){
|
||||
browser.ExecuteScriptAsync("window.TDGF_scrollSmoothly", (int)Math.Round(-delta / 0.6));
|
||||
}
|
||||
else{
|
||||
browser.SendMouseWheelEvent(0, 0, 0, delta, CefEventFlags.None);
|
||||
}
|
||||
|
||||
return NativeMethods.HOOK_HANDLED;
|
||||
}
|
||||
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
|
||||
@@ -151,7 +163,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||
if (!e.IsLoading && browser.Address != "about:blank"){
|
||||
if (!e.IsLoading && browser.Address != BlankURL){
|
||||
this.InvokeSafe(() => {
|
||||
Visible = true; // ensures repaint before moving the window to a visible location
|
||||
timerDisplayDelay.Start();
|
||||
@@ -162,9 +174,9 @@ namespace TweetDuck.Core.Notification{
|
||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
IFrame frame = e.Frame;
|
||||
|
||||
if (frame.IsMain && browser.Address != "about:blank"){
|
||||
if (frame.IsMain && browser.Address != BlankURL){
|
||||
frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Environment.Notification));
|
||||
ScriptLoader.ExecuteFile(frame, "notification.js", this);
|
||||
CefScriptExecutor.RunFile(frame, "notification.js");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,14 +186,25 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
private void timerHideProgress_Tick(object sender, EventArgs e){
|
||||
if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen){
|
||||
bool isCursorInside = Bounds.Contains(Cursor.Position);
|
||||
|
||||
if (isCursorInside){
|
||||
StartMouseHook();
|
||||
SetOpacity(100);
|
||||
}
|
||||
else{
|
||||
StopMouseHook(false);
|
||||
SetOpacity(Config.NotificationWindowOpacity);
|
||||
}
|
||||
|
||||
if (isCursorInside || FreezeTimer || ContextMenuOpen){
|
||||
return;
|
||||
}
|
||||
|
||||
timeLeft -= timerProgress.Interval;
|
||||
|
||||
int value = BrowserUtils.Scale(progressBarTimer.Maximum+25, (totalTime-timeLeft)/(double)totalTime);
|
||||
progressBarTimer.SetValueInstant(Config.NotificationTimerCountDown ? progressBarTimer.Maximum-value : value);
|
||||
int value = BrowserUtils.Scale(progressBarTimer.Maximum + 25, (totalTime - timeLeft) / (double)totalTime);
|
||||
progressBarTimer.SetValueInstant(Config.NotificationTimerCountDown ? progressBarTimer.Maximum - value : value);
|
||||
|
||||
if (timeLeft <= 0){
|
||||
FinishCurrentNotification();
|
||||
@@ -190,7 +213,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
// notification methods
|
||||
|
||||
public virtual void ShowNotification(TweetNotification notification){
|
||||
public virtual void ShowNotification(DesktopNotification notification){
|
||||
LoadTweet(notification);
|
||||
}
|
||||
|
||||
@@ -227,8 +250,8 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GetTweetHTML(TweetNotification tweet){
|
||||
string html = tweet.GenerateHtml(BodyClasses, this);
|
||||
protected override string GetTweetHTML(DesktopNotification tweet){
|
||||
string html = tweet.GenerateHtml(BodyClasses, HeadLayout, Config.CustomNotificationCSS);
|
||||
|
||||
foreach(InjectedHTML injection in plugins.NotificationInjections){
|
||||
html = injection.InjectInto(html);
|
||||
@@ -237,7 +260,7 @@ namespace TweetDuck.Core.Notification{
|
||||
return html;
|
||||
}
|
||||
|
||||
protected override void LoadTweet(TweetNotification tweet){
|
||||
protected override void LoadTweet(DesktopNotification tweet){
|
||||
timerProgress.Stop();
|
||||
totalTime = timeLeft = tweet.GetDisplayDuration(Config.NotificationDurationValue);
|
||||
progressBarTimer.Value = Config.NotificationTimerCountDown ? progressBarTimer.Maximum : progressBarTimer.Minimum;
|
||||
@@ -247,7 +270,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
protected override void SetNotificationSize(int width, int height){
|
||||
if (Config.DisplayNotificationTimer){
|
||||
ClientSize = new Size(width, height+timerBarHeight);
|
||||
ClientSize = new Size(width, height + timerBarHeight);
|
||||
progressBarTimer.Visible = true;
|
||||
}
|
||||
else{
|
||||
@@ -264,8 +287,8 @@ namespace TweetDuck.Core.Notification{
|
||||
SetNotificationSize(BaseClientWidth, BaseClientHeight);
|
||||
}
|
||||
|
||||
SetOpacity(IsCursorOverBrowser ? 100 : Config.NotificationWindowOpacity);
|
||||
MoveToVisibleLocation();
|
||||
StartMouseHook();
|
||||
}
|
||||
|
||||
protected virtual void OnNotificationReady(){
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Notification {
|
||||
namespace TweetDuck.Browser.Notification {
|
||||
partial class FormNotificationTweet {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using TweetDuck.Plugins;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
namespace TweetDuck.Browser.Notification{
|
||||
sealed partial class FormNotificationTweet : FormNotificationMain{
|
||||
private const int NonIntrusiveIdleLimit = 30;
|
||||
private const int TrimMinimum = 32;
|
||||
@@ -25,7 +26,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
||||
private readonly Queue<DesktopNotification> tweetQueue = new Queue<DesktopNotification>(4);
|
||||
private bool needsTrim;
|
||||
private bool hasTemporarilyMoved;
|
||||
|
||||
@@ -81,7 +82,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
// notification methods
|
||||
|
||||
public override void ShowNotification(TweetNotification notification){
|
||||
public override void ShowNotification(DesktopNotification notification){
|
||||
tweetQueue.Enqueue(notification);
|
||||
|
||||
if (!IsPaused){
|
||||
@@ -153,7 +154,7 @@ namespace TweetDuck.Core.Notification{
|
||||
base.UpdateTitle();
|
||||
|
||||
if (tweetQueue.Count > 0){
|
||||
Text = Text+" ("+tweetQueue.Count+" more left)";
|
||||
Text = Text + " (" + tweetQueue.Count + " more left)";
|
||||
}
|
||||
}
|
||||
|
@@ -3,14 +3,15 @@ using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Browser.Adapters;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Data;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
namespace TweetDuck.Browser.Notification.Screenshot{
|
||||
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||
protected override bool CanDragWindow => false;
|
||||
|
||||
@@ -22,31 +23,30 @@ namespace TweetDuck.Core.Notification.Screenshot{
|
||||
|
||||
int realWidth = BrowserUtils.Scale(width, DpiScale);
|
||||
|
||||
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new ScreenshotBridge(this, SetScreenshotHeight, callback));
|
||||
browser.RegisterJsBridge("$TD_NotificationScreenshot", new ScreenshotBridge(this, SetScreenshotHeight, callback));
|
||||
|
||||
browser.LoadingStateChanged += (sender, args) => {
|
||||
if (args.IsLoading){
|
||||
return;
|
||||
}
|
||||
|
||||
string script = ScriptLoader.LoadResourceSilent("screenshot.js");
|
||||
string script = Program.Resources.LoadSilent("screenshot.js");
|
||||
|
||||
if (script == null){
|
||||
this.InvokeAsyncSafe(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
using(IFrame frame = args.Browser.MainFrame){
|
||||
ScriptLoader.ExecuteScript(frame, script.Replace("{width}", realWidth.ToString()).Replace("{frames}", TweetScreenshotManager.WaitFrames.ToString()), "gen:screenshot");
|
||||
}
|
||||
using IFrame frame = args.Browser.MainFrame;
|
||||
CefScriptExecutor.RunScript(frame, script.Replace("{width}", realWidth.ToString()).Replace("{frames}", TweetScreenshotManager.WaitFrames.ToString()), "gen:screenshot");
|
||||
};
|
||||
|
||||
SetNotificationSize(realWidth, 1024);
|
||||
LoadTweet(new TweetNotification(string.Empty, string.Empty, string.Empty, html, 0, string.Empty, string.Empty));
|
||||
LoadTweet(new DesktopNotification(string.Empty, string.Empty, string.Empty, html, 0, string.Empty, string.Empty));
|
||||
}
|
||||
|
||||
protected override string GetTweetHTML(TweetNotification tweet){
|
||||
string html = tweet.GenerateHtml("td-screenshot", this);
|
||||
protected override string GetTweetHTML(DesktopNotification tweet){
|
||||
string html = tweet.GenerateHtml("td-screenshot", HeadLayout, Config.CustomNotificationCSS);
|
||||
|
||||
foreach(InjectedHTML injection in plugins.NotificationInjections){
|
||||
html = injection.InjectInto(html);
|
||||
@@ -82,7 +82,8 @@ namespace TweetDuck.Core.Notification.Screenshot{
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
using(Bitmap bmp = new Bitmap(ClientSize.Width, Math.Max(1, height), PixelFormat.Format32bppRgb)){
|
||||
using Bitmap bmp = new Bitmap(ClientSize.Width, Math.Max(1, height), PixelFormat.Format32bppRgb);
|
||||
|
||||
try{
|
||||
NativeMethods.RenderSourceIntoBitmap(context, bmp);
|
||||
}finally{
|
||||
@@ -94,5 +95,4 @@ namespace TweetDuck.Core.Notification.Screenshot{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Controls;
|
||||
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
namespace TweetDuck.Browser.Notification.Screenshot{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
sealed class ScreenshotBridge{
|
||||
private readonly Control owner;
|
||||
|
@@ -8,8 +8,8 @@
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
#if GEN_SCREENSHOT_FRAMES
|
||||
using System.Drawing.Imaging;
|
||||
@@ -17,7 +17,7 @@ using System.IO;
|
||||
using TweetDuck.Core.Utils;
|
||||
#endif
|
||||
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
namespace TweetDuck.Browser.Notification.Screenshot{
|
||||
sealed class TweetScreenshotManager : IDisposable{
|
||||
private readonly FormBrowser owner;
|
||||
private readonly PluginManager plugins;
|
||||
@@ -134,9 +134,9 @@ namespace TweetDuck.Core.Notification.Screenshot{
|
||||
private void debugger_Tick(object sender, EventArgs e){
|
||||
if (frameCounter < 63 && screenshot.TakeScreenshot(true)){
|
||||
try{
|
||||
Clipboard.GetImage()?.Save(Path.Combine(DebugScreenshotPath, "frame_"+(++frameCounter)+".png"), ImageFormat.Png);
|
||||
Clipboard.GetImage()?.Save(Path.Combine(DebugScreenshotPath, "frame_" + (++frameCounter) + ".png"), ImageFormat.Png);
|
||||
}catch{
|
||||
System.Diagnostics.Debug.WriteLine("Failed generating frame "+frameCounter);
|
||||
System.Diagnostics.Debug.WriteLine("Failed generating frame " + frameCounter);
|
||||
}
|
||||
}
|
||||
else{
|
48
Browser/Notification/SoundNotification.cs
Normal file
48
Browser/Notification/SoundNotification.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs;
|
||||
using TweetDuck.Dialogs.Settings;
|
||||
using TweetDuck.Management;
|
||||
|
||||
namespace TweetDuck.Browser.Notification{
|
||||
static class SoundNotification{
|
||||
public const string SupportedFormats = "*.wav;*.ogg;*.mp3;*.flac;*.opus;*.weba;*.webm";
|
||||
|
||||
public static IResourceHandler CreateFileHandler(string path){
|
||||
string mimeType = Path.GetExtension(path) switch{
|
||||
".weba" => "audio/webm",
|
||||
".webm" => "audio/webm",
|
||||
".wav" => "audio/wav",
|
||||
".ogg" => "audio/ogg",
|
||||
".mp3" => "audio/mp3",
|
||||
".flac" => "audio/flac",
|
||||
".opus" => "audio/ogg; codecs=opus",
|
||||
_ => null
|
||||
};
|
||||
|
||||
try{
|
||||
return ResourceHandler.FromFilePath(path, mimeType);
|
||||
}catch{
|
||||
FormBrowser browser = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
browser?.InvokeAsyncSafe(() => {
|
||||
using FormMessage form = new FormMessage("Sound Notification Error", "Could not find custom notification sound file:\n" + path, MessageBoxIcon.Error);
|
||||
form.AddButton(FormMessage.Ignore, ControlType.Cancel | ControlType.Focused);
|
||||
|
||||
Button btnViewOptions = form.AddButton("View Options");
|
||||
btnViewOptions.Width += 16;
|
||||
btnViewOptions.Location = new Point(btnViewOptions.Location.X - 16, btnViewOptions.Location.Y);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnViewOptions){
|
||||
browser.OpenSettings(typeof(TabSettingsSounds));
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,21 +1,10 @@
|
||||
namespace TweetDuck.Core.Other {
|
||||
namespace TweetDuck.Browser {
|
||||
partial class TrayIcon {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
@@ -4,7 +4,7 @@ using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using Res = TweetDuck.Properties.Resources;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
namespace TweetDuck.Browser{
|
||||
sealed partial class TrayIcon : Component{
|
||||
public enum Behavior{ // keep order
|
||||
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
||||
@@ -63,6 +63,15 @@ namespace TweetDuck.Core.Other{
|
||||
container.Add(this);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing){
|
||||
if (disposing){
|
||||
components?.Dispose();
|
||||
contextMenu.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void UpdateIcon(){
|
||||
if (Visible){
|
||||
notifyIcon.Icon = hasNotifications ? Res.icon_tray_new : Config.MuteNotifications ? Res.icon_tray_muted : Res.icon_tray;
|
@@ -4,18 +4,22 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using TweetDuck.Browser.Adapters;
|
||||
using TweetDuck.Browser.Bridge;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Browser.Handling;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Browser.Notification;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
namespace TweetDuck.Browser{
|
||||
sealed class TweetDeckBrowser : IDisposable{
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
@@ -35,24 +39,26 @@ namespace TweetDuck.Core{
|
||||
return false;
|
||||
}
|
||||
|
||||
using(IFrame frame = browser.GetBrowser().MainFrame){
|
||||
return TwitterUtils.IsTweetDeckWebsite(frame);
|
||||
}
|
||||
using IFrame frame = browser.GetBrowser().MainFrame;
|
||||
return TwitterUrls.IsTweetDeck(frame.Url);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
private readonly ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();
|
||||
private readonly ResourceHandlers resourceHandlers;
|
||||
|
||||
private string prevSoundNotificationPath = null;
|
||||
|
||||
public TweetDeckBrowser(FormBrowser owner, PluginManager plugins, TweetDeckBridge tdBridge, UpdateBridge updateBridge){
|
||||
resourceHandlerFactory.RegisterHandler(TweetNotification.AppLogo);
|
||||
resourceHandlerFactory.RegisterHandler(TwitterUtils.LoadingSpinner);
|
||||
var resourceRequestHandler = new ResourceRequestHandlerBrowser();
|
||||
resourceHandlers = resourceRequestHandler.ResourceHandlers;
|
||||
|
||||
resourceHandlers.Register(FormNotificationBase.AppLogo);
|
||||
resourceHandlers.Register(TwitterUtils.LoadingSpinner);
|
||||
|
||||
RequestHandlerBrowser requestHandler = new RequestHandlerBrowser();
|
||||
|
||||
this.browser = new ChromiumWebBrowser(TwitterUtils.TweetDeckURL){
|
||||
this.browser = new ChromiumWebBrowser(TwitterUrls.TweetDeck){
|
||||
DialogHandler = new FileDialogHandler(),
|
||||
DragHandler = new DragHandlerBrowser(requestHandler),
|
||||
MenuHandler = new ContextMenuBrowser(owner),
|
||||
@@ -60,7 +66,7 @@ namespace TweetDuck.Core{
|
||||
KeyboardHandler = new KeyboardHandlerBrowser(owner),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = requestHandler,
|
||||
ResourceHandlerFactory = resourceHandlerFactory
|
||||
ResourceRequestHandlerFactory = resourceRequestHandler.SelfFactory
|
||||
};
|
||||
|
||||
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||
@@ -68,8 +74,8 @@ namespace TweetDuck.Core{
|
||||
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
|
||||
this.browser.LoadError += browser_LoadError;
|
||||
|
||||
this.browser.RegisterAsyncJsObject("$TD", tdBridge);
|
||||
this.browser.RegisterAsyncJsObject("$TDU", updateBridge);
|
||||
this.browser.RegisterJsBridge("$TD", tdBridge);
|
||||
this.browser.RegisterJsBridge("$TDU", updateBridge);
|
||||
|
||||
this.browser.BrowserSettings.BackgroundColor = (uint)TwitterUtils.BackgroundColor.ToArgb();
|
||||
this.browser.Dock = DockStyle.None;
|
||||
@@ -77,7 +83,7 @@ namespace TweetDuck.Core{
|
||||
this.browser.SetupZoomEvents();
|
||||
|
||||
owner.Controls.Add(browser);
|
||||
plugins.Register(browser, PluginEnvironment.Browser, owner, true);
|
||||
plugins.Register(PluginEnvironment.Browser, new PluginDispatcher(browser, TwitterUrls.IsTweetDeck));
|
||||
|
||||
Config.MuteToggled += Config_MuteToggled;
|
||||
Config.SoundNotificationChanged += Config_SoundNotificationInfoChanged;
|
||||
@@ -85,6 +91,12 @@ namespace TweetDuck.Core{
|
||||
|
||||
// setup and management
|
||||
|
||||
public void PrepareSize(Size size){
|
||||
if (!Ready){
|
||||
browser.Size = size;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBrowserReady(){
|
||||
if (!Ready){
|
||||
browser.Location = Point.Empty;
|
||||
@@ -121,14 +133,16 @@ namespace TweetDuck.Core{
|
||||
IFrame frame = e.Frame;
|
||||
|
||||
if (frame.IsMain){
|
||||
if (TwitterUtils.IsTwitterWebsite(frame)){
|
||||
string css = ScriptLoader.LoadResource("styles/twitter.css", browser);
|
||||
resourceHandlerFactory.RegisterHandler(TwitterStyleUrl, ResourceHandler.FromString(css, mimeType: "text/css"));
|
||||
string url = frame.Url;
|
||||
|
||||
ScriptLoader.ExecuteFile(frame, "twitter.js", browser);
|
||||
if (TwitterUrls.IsTwitter(url)){
|
||||
string css = Program.Resources.Load("styles/twitter.css");
|
||||
resourceHandlers.Register(TwitterStyleUrl, ResourceHandler.FromString(css, mimeType: "text/css"));
|
||||
|
||||
CefScriptExecutor.RunFile(frame, "twitter.js");
|
||||
}
|
||||
|
||||
if (!TwitterUtils.IsTwitterLogin2FactorWebsite(frame)){
|
||||
if (!TwitterUrls.IsTwitterLogin2Factor(url)){
|
||||
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
|
||||
}
|
||||
}
|
||||
@@ -136,11 +150,12 @@ namespace TweetDuck.Core{
|
||||
|
||||
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
IFrame frame = e.Frame;
|
||||
string url = frame.Url;
|
||||
|
||||
if (frame.IsMain){
|
||||
if (TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
if (TwitterUrls.IsTweetDeck(url)){
|
||||
UpdateProperties();
|
||||
ScriptLoader.ExecuteFile(frame, "code.js", browser);
|
||||
CefScriptExecutor.RunFile(frame, "code.js");
|
||||
|
||||
InjectBrowserCSS();
|
||||
ReinjectCustomCSS(Config.CustomBrowserCSS);
|
||||
@@ -149,19 +164,19 @@ namespace TweetDuck.Core{
|
||||
TweetDeckBridge.ResetStaticProperties();
|
||||
|
||||
if (Arguments.HasFlag(Arguments.ArgIgnoreGDPR)){
|
||||
ScriptLoader.ExecuteScript(frame, "TD.storage.Account.prototype.requiresConsent = function(){ return false; }", "gen:gdpr");
|
||||
CefScriptExecutor.RunScript(frame, "TD.storage.Account.prototype.requiresConsent = function(){ return false; }", "gen:gdpr");
|
||||
}
|
||||
|
||||
if (Config.FirstRun){
|
||||
ScriptLoader.ExecuteFile(frame, "introduction.js", browser);
|
||||
CefScriptExecutor.RunFile(frame, "introduction.js");
|
||||
}
|
||||
}
|
||||
|
||||
ScriptLoader.ExecuteFile(frame, "update.js", browser);
|
||||
CefScriptExecutor.RunFile(frame, "update.js");
|
||||
}
|
||||
|
||||
if (frame.Url == ErrorUrl){
|
||||
resourceHandlerFactory.UnregisterHandler(ErrorUrl);
|
||||
if (url == ErrorUrl){
|
||||
resourceHandlers.Unregister(ErrorUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,10 +186,13 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
if (!e.FailedUrl.StartsWith("http://td/", StringComparison.Ordinal)){
|
||||
string errorPage = ScriptLoader.LoadResourceSilent("pages/error.html");
|
||||
string errorPage = Program.Resources.LoadSilent("pages/error.html");
|
||||
|
||||
if (errorPage != null){
|
||||
resourceHandlerFactory.RegisterHandler(ErrorUrl, ResourceHandler.FromString(errorPage.Replace("{err}", BrowserUtils.GetErrorName(e.ErrorCode))));
|
||||
string errorName = Enum.GetName(typeof(CefErrorCode), e.ErrorCode);
|
||||
string errorTitle = StringUtils.ConvertPascalCaseToScreamingSnakeCase(errorName ?? string.Empty);
|
||||
|
||||
resourceHandlers.Register(ErrorUrl, ResourceHandler.FromString(errorPage.Replace("{err}", errorTitle)));
|
||||
browser.Load(ErrorUrl);
|
||||
}
|
||||
}
|
||||
@@ -194,10 +212,10 @@ namespace TweetDuck.Core{
|
||||
prevSoundNotificationPath = newNotificationPath;
|
||||
|
||||
if (hasCustomSound){
|
||||
resourceHandlerFactory.RegisterHandler(soundUrl, SoundNotification.CreateFileHandler(newNotificationPath));
|
||||
resourceHandlers.Register(soundUrl, SoundNotification.CreateFileHandler(newNotificationPath));
|
||||
}
|
||||
else{
|
||||
resourceHandlerFactory.UnregisterHandler(soundUrl);
|
||||
resourceHandlers.Unregister(soundUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +235,7 @@ namespace TweetDuck.Core{
|
||||
// javascript calls
|
||||
|
||||
public void ReloadToTweetDeck(){
|
||||
browser.ExecuteScriptAsync($"if(window.TDGF_reload)window.TDGF_reload();else window.location.href='{TwitterUtils.TweetDeckURL}'");
|
||||
browser.ExecuteScriptAsync($"if(window.TDGF_reload)window.TDGF_reload();else window.location.href='{TwitterUrls.TweetDeck}'");
|
||||
}
|
||||
|
||||
public void UpdateProperties(){
|
||||
@@ -225,7 +243,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
public void InjectBrowserCSS(){
|
||||
browser.ExecuteScriptAsync("TDGF_injectBrowserCSS", ScriptLoader.LoadResource("styles/browser.css", browser)?.TrimEnd() ?? string.Empty);
|
||||
browser.ExecuteScriptAsync("TDGF_injectBrowserCSS", Program.Resources.Load("styles/browser.css")?.TrimEnd() ?? string.Empty);
|
||||
}
|
||||
|
||||
public void ReinjectCustomCSS(string css){
|
||||
@@ -265,7 +283,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
public void OpenDevTools(){
|
||||
browser.ShowDevTools();
|
||||
browser.OpenDevToolsCustom();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Collections;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
static class Arguments{
|
||||
@@ -22,8 +22,8 @@ namespace TweetDuck.Configuration{
|
||||
return Current.HasFlag(flag);
|
||||
}
|
||||
|
||||
public static string GetValue(string key, string defaultValue){
|
||||
return Current.GetValue(key, defaultValue);
|
||||
public static string GetValue(string key){
|
||||
return Current.GetValue(key);
|
||||
}
|
||||
|
||||
public static CommandLineArgs GetCurrentClean(){
|
||||
|
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using TweetDuck.Configuration.Instance;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Data.Serialization;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Serialization.Converters;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class ConfigManager{
|
||||
sealed class ConfigManager : IConfigManager{
|
||||
public UserConfig User { get; }
|
||||
public SystemConfig System { get; }
|
||||
public PluginConfig Plugins { get; }
|
||||
@@ -16,7 +16,7 @@ namespace TweetDuck.Configuration{
|
||||
|
||||
private readonly FileConfigInstance<UserConfig> infoUser;
|
||||
private readonly FileConfigInstance<SystemConfig> infoSystem;
|
||||
private readonly PluginConfigInstance infoPlugins;
|
||||
private readonly PluginConfigInstance<PluginConfig> infoPlugins;
|
||||
|
||||
private readonly IConfigInstance<BaseConfig>[] infoList;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace TweetDuck.Configuration{
|
||||
infoList = new IConfigInstance<BaseConfig>[]{
|
||||
infoUser = new FileConfigInstance<UserConfig>(Program.UserConfigFilePath, User, "program options"),
|
||||
infoSystem = new FileConfigInstance<SystemConfig>(Program.SystemConfigFilePath, System, "system options"),
|
||||
infoPlugins = new PluginConfigInstance(Program.PluginConfigFilePath, Plugins)
|
||||
infoPlugins = new PluginConfigInstance<PluginConfig>(Program.PluginConfigFilePath, Plugins)
|
||||
};
|
||||
|
||||
// TODO refactor further
|
||||
@@ -70,59 +70,13 @@ namespace TweetDuck.Configuration{
|
||||
infoPlugins.Reload();
|
||||
}
|
||||
|
||||
private void TriggerProgramRestartRequested(){
|
||||
void IConfigManager.TriggerProgramRestartRequested(){
|
||||
ProgramRestartRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private IConfigInstance<BaseConfig> GetInstanceInfo(BaseConfig instance){
|
||||
IConfigInstance<BaseConfig> IConfigManager.GetInstanceInfo(BaseConfig instance){
|
||||
Type instanceType = instance.GetType();
|
||||
return Array.Find(infoList, info => info.Instance.GetType() == instanceType); // TODO handle null
|
||||
}
|
||||
|
||||
public abstract class BaseConfig{
|
||||
private readonly ConfigManager configManager;
|
||||
|
||||
protected BaseConfig(ConfigManager configManager){
|
||||
this.configManager = configManager;
|
||||
}
|
||||
|
||||
// Management
|
||||
|
||||
public void Save(){
|
||||
configManager.GetInstanceInfo(this).Save();
|
||||
}
|
||||
|
||||
public void Reload(){
|
||||
configManager.GetInstanceInfo(this).Reload();
|
||||
}
|
||||
|
||||
public void Reset(){
|
||||
configManager.GetInstanceInfo(this).Reset();
|
||||
}
|
||||
|
||||
// Construction methods
|
||||
|
||||
public T ConstructWithDefaults<T>() where T : BaseConfig{
|
||||
return ConstructWithDefaults(configManager) as T;
|
||||
}
|
||||
|
||||
protected abstract BaseConfig ConstructWithDefaults(ConfigManager configManager);
|
||||
|
||||
// Utility methods
|
||||
|
||||
protected void UpdatePropertyWithEvent<T>(ref T field, T value, EventHandler eventHandler){
|
||||
if (!EqualityComparer<T>.Default.Equals(field, value)){
|
||||
field = value;
|
||||
eventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdatePropertyWithRestartRequest<T>(ref T field, T value){
|
||||
if (!EqualityComparer<T>.Default.Equals(field, value)){
|
||||
field = value;
|
||||
configManager.TriggerProgramRestartRequested();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,69 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace TweetDuck.Configuration.Instance{
|
||||
class PluginConfigInstance : IConfigInstance<PluginConfig>{
|
||||
public PluginConfig Instance { get; }
|
||||
|
||||
private readonly string filename;
|
||||
|
||||
public PluginConfigInstance(string filename, PluginConfig instance){
|
||||
this.filename = filename;
|
||||
this.Instance = instance;
|
||||
}
|
||||
|
||||
public void Load(){
|
||||
try{
|
||||
using(StreamReader reader = new StreamReader(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read), Encoding.UTF8)){
|
||||
string line = reader.ReadLine();
|
||||
|
||||
if (line == "#Disabled"){
|
||||
HashSet<string> newDisabled = new HashSet<string>();
|
||||
|
||||
while((line = reader.ReadLine()) != null){
|
||||
newDisabled.Add(line);
|
||||
}
|
||||
|
||||
Instance.ReloadSilently(newDisabled);
|
||||
}
|
||||
}
|
||||
}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(){
|
||||
try{
|
||||
using(StreamWriter writer = new StreamWriter(new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None), Encoding.UTF8)){
|
||||
writer.WriteLine("#Disabled");
|
||||
|
||||
foreach(string identifier in Instance.DisabledPlugins){
|
||||
writer.WriteLine(identifier);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Plugin Configuration Error", "Could not save the plugin configuration file.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reload(){
|
||||
Load();
|
||||
}
|
||||
|
||||
public void Reset(){
|
||||
try{
|
||||
File.Delete(filename);
|
||||
Instance.ReloadSilently(Instance.ConstructWithDefaults<PluginConfig>().DisabledPlugins);
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Plugin Configuration Error", "Could not delete the plugin configuration file.", true, e);
|
||||
return;
|
||||
}
|
||||
|
||||
Reload();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,21 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class PluginConfig : ConfigManager.BaseConfig, IPluginConfig{
|
||||
sealed class PluginConfig : BaseConfig, IPluginConfig{
|
||||
private static readonly string[] DefaultDisabled = {
|
||||
"official/clear-columns",
|
||||
"official/reply-account"
|
||||
};
|
||||
|
||||
// CONFIGURATION
|
||||
// CONFIGURATION DATA
|
||||
|
||||
public IEnumerable<string> DisabledPlugins => disabled;
|
||||
private readonly HashSet<string> disabled = new HashSet<string>(DefaultDisabled);
|
||||
|
||||
// EVENTS
|
||||
|
||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
public PluginConfig(IConfigManager configManager) : base(configManager){}
|
||||
|
||||
protected override BaseConfig ConstructWithDefaults(IConfigManager configManager){
|
||||
return new PluginConfig(configManager);
|
||||
}
|
||||
|
||||
// INTERFACE IMPLEMENTATION
|
||||
|
||||
IEnumerable<string> IPluginConfig.DisabledPlugins => disabled;
|
||||
|
||||
void IPluginConfig.Reset(IEnumerable<string> newDisabledPlugins){
|
||||
disabled.Clear();
|
||||
disabled.UnionWith(newDisabledPlugins);
|
||||
}
|
||||
|
||||
public void SetEnabled(Plugin plugin, bool enabled){
|
||||
if ((enabled && disabled.Remove(plugin.Identifier)) || (!enabled && disabled.Add(plugin.Identifier))){
|
||||
PluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||
@@ -26,20 +47,5 @@ namespace TweetDuck.Configuration{
|
||||
public bool IsEnabled(Plugin plugin){
|
||||
return !disabled.Contains(plugin.Identifier);
|
||||
}
|
||||
|
||||
public void ReloadSilently(IEnumerable<string> newDisabled){
|
||||
disabled.Clear();
|
||||
disabled.UnionWith(newDisabled);
|
||||
}
|
||||
|
||||
private readonly HashSet<string> disabled = new HashSet<string>(DefaultDisabled);
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
public PluginConfig(ConfigManager configManager) : base(configManager){}
|
||||
|
||||
protected override ConfigManager.BaseConfig ConstructWithDefaults(ConfigManager configManager){
|
||||
return new PluginConfig(configManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class SystemConfig : ConfigManager.BaseConfig{
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class SystemConfig : BaseConfig{
|
||||
|
||||
// CONFIGURATION DATA
|
||||
|
||||
@@ -17,9 +19,9 @@
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
public SystemConfig(ConfigManager configManager) : base(configManager){}
|
||||
public SystemConfig(IConfigManager configManager) : base(configManager){}
|
||||
|
||||
protected override ConfigManager.BaseConfig ConstructWithDefaults(ConfigManager configManager){
|
||||
protected override BaseConfig ConstructWithDefaults(IConfigManager configManager){
|
||||
return new SystemConfig(configManager);
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Browser;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
using TweetLib.Core.Features.Twitter;
|
||||
using TweetLib.Core.Systems.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class UserConfig : ConfigManager.BaseConfig{
|
||||
sealed class UserConfig : BaseConfig{
|
||||
|
||||
// CONFIGURATION DATA
|
||||
|
||||
@@ -18,6 +19,7 @@ namespace TweetDuck.Configuration{
|
||||
public Size PluginsWindowSize { get; set; } = Size.Empty;
|
||||
|
||||
public bool ExpandLinksOnHover { get; set; } = true;
|
||||
public bool FocusDmInput { get; set; } = true;
|
||||
public bool OpenSearchInFirstColumn { get; set; } = true;
|
||||
public bool KeepLikeFollowDialogsOpen { get; set; } = true;
|
||||
public bool BestImageQuality { get; set; } = true;
|
||||
@@ -28,16 +30,20 @@ namespace TweetDuck.Configuration{
|
||||
private string _customCefArgs = null;
|
||||
|
||||
public string BrowserPath { get; set; } = null;
|
||||
public string BrowserPathArgs { get; set; } = null;
|
||||
public bool IgnoreTrackingUrlWarning { get; set; } = false;
|
||||
public string SearchEngineUrl { get; set; } = null;
|
||||
private int _zoomLevel = 100;
|
||||
|
||||
public string VideoPlayerPath { get; set; } = null;
|
||||
public string VideoPlayerPathArgs { get; set; } = null;
|
||||
public int VideoPlayerVolume { get; set; } = 50;
|
||||
|
||||
public bool EnableSpellCheck { get; set; } = false;
|
||||
private string _spellCheckLanguage = "en-US";
|
||||
|
||||
public string TranslationTarget { get; set; } = "en";
|
||||
public int CalendarFirstDay { get; set; } = -1;
|
||||
|
||||
private TrayIcon.Behavior _trayBehavior = TrayIcon.Behavior.Disabled;
|
||||
public bool EnableTrayHighlight { get; set; } = true;
|
||||
@@ -55,12 +61,13 @@ namespace TweetDuck.Configuration{
|
||||
public bool NotificationTimerCountDown { get; set; } = false;
|
||||
public int NotificationDurationValue { get; set; } = 25;
|
||||
|
||||
public TweetNotification.Position NotificationPosition { get; set; } = TweetNotification.Position.TopRight;
|
||||
public DesktopNotification.Position NotificationPosition { get; set; } = DesktopNotification.Position.TopRight;
|
||||
public Point CustomNotificationPosition { get; set; } = ControlExtensions.InvisibleLocation;
|
||||
public int NotificationDisplay { get; set; } = 0;
|
||||
public int NotificationEdgeDistance { get; set; } = 8;
|
||||
public int NotificationWindowOpacity { get; set; } = 100;
|
||||
|
||||
public TweetNotification.Size NotificationSize { get; set; } = TweetNotification.Size.Auto;
|
||||
public DesktopNotification.Size NotificationSize { get; set; } = DesktopNotification.Size.Auto;
|
||||
public Size CustomNotificationSize { get; set; } = Size.Empty;
|
||||
public int NotificationScrollSpeed { get; set; } = 100;
|
||||
|
||||
@@ -72,13 +79,15 @@ namespace TweetDuck.Configuration{
|
||||
public string CustomBrowserCSS { get; set; } = null;
|
||||
public string CustomNotificationCSS { get; set; } = null;
|
||||
|
||||
public bool DevToolsWindowOnTop { get; set; } = true;
|
||||
|
||||
// SPECIAL PROPERTIES
|
||||
|
||||
public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
||||
public bool IsCustomNotificationSizeSet => CustomNotificationSize != Size.Empty;
|
||||
public bool IsCustomSoundNotificationSet => NotificationSoundPath != string.Empty;
|
||||
|
||||
public TwitterUtils.ImageQuality TwitterImageQuality => BestImageQuality ? TwitterUtils.ImageQuality.Orig : TwitterUtils.ImageQuality.Default;
|
||||
public ImageQuality TwitterImageQuality => BestImageQuality ? ImageQuality.Best : ImageQuality.Default;
|
||||
|
||||
public string NotificationSoundPath{
|
||||
get => _notificationSoundPath ?? string.Empty;
|
||||
@@ -134,9 +143,9 @@ namespace TweetDuck.Configuration{
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
public UserConfig(ConfigManager configManager) : base(configManager){}
|
||||
public UserConfig(IConfigManager configManager) : base(configManager){}
|
||||
|
||||
protected override ConfigManager.BaseConfig ConstructWithDefaults(ConfigManager configManager){
|
||||
protected override BaseConfig ConstructWithDefaults(IConfigManager configManager){
|
||||
return new UserConfig(configManager);
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
namespace TweetDuck.Controls{
|
||||
static class ControlExtensions{
|
||||
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
||||
|
||||
@@ -21,9 +21,8 @@ namespace TweetDuck.Core.Controls{
|
||||
}
|
||||
|
||||
public static float GetDPIScale(this Control control){
|
||||
using(Graphics graphics = control.CreateGraphics()){
|
||||
return graphics.DpiY/96F;
|
||||
}
|
||||
using Graphics graphics = control.CreateGraphics();
|
||||
return graphics.DpiY / 96F;
|
||||
}
|
||||
|
||||
public static bool IsFullyOutsideView(this Form form){
|
||||
@@ -31,17 +30,17 @@ namespace TweetDuck.Core.Controls{
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public static void SetValueInstant(this ProgressBar bar, int value){
|
||||
if (value == bar.Maximum){
|
||||
bar.Value = value;
|
||||
bar.Value = value-1;
|
||||
bar.Value = value - 1;
|
||||
bar.Value = value;
|
||||
}
|
||||
else{
|
||||
bar.Value = value+1;
|
||||
bar.Value = value + 1;
|
||||
bar.Value = value;
|
||||
}
|
||||
}
|
||||
@@ -60,10 +59,11 @@ namespace TweetDuck.Core.Controls{
|
||||
|
||||
public static bool AlignValueToTick(this TrackBar trackBar){
|
||||
if (trackBar.Value % trackBar.SmallChange != 0){
|
||||
trackBar.Value = trackBar.SmallChange*(int)Math.Floor(((double)trackBar.Value/trackBar.SmallChange)+0.5);
|
||||
trackBar.Value = trackBar.SmallChange * (int)Math.Floor(((double)trackBar.Value / trackBar.SmallChange) + 0.5);
|
||||
return false;
|
||||
}
|
||||
else return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void EnableMultilineShortcuts(this TextBox textBox){
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
namespace TweetDuck.Controls{
|
||||
sealed class FlatButton : Button{
|
||||
protected override bool ShowFocusCues => false;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
namespace TweetDuck.Controls{
|
||||
sealed class FlatProgressBar : ProgressBar{
|
||||
private readonly SolidBrush brush;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace TweetDuck.Core.Controls{
|
||||
}
|
||||
|
||||
Rectangle rect = e.ClipRectangle;
|
||||
rect.Width = (int)(rect.Width*((double)Value/Maximum));
|
||||
rect.Width = (int)(rect.Width * ((double)Value / Maximum));
|
||||
e.Graphics.FillRectangle(brush, rect);
|
||||
}
|
||||
|
@@ -1,13 +1,8 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Plugins.Controls{
|
||||
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
||||
public PluginListFlowLayout(){
|
||||
FlowDirection = FlowDirection.TopDown;
|
||||
WrapContents = false;
|
||||
}
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Controls{
|
||||
sealed class FlowLayoutPanelNoHScroll : FlowLayoutPanel{
|
||||
protected override void WndProc(ref Message m){
|
||||
if (m.Msg == 0x85){ // WM_NCPAINT
|
||||
NativeMethods.ShowScrollBar(Handle, NativeMethods.SB_HORZ, false); // basically fuck the horizontal scrollbar very much
|
22
Controls/LabelVertical.cs
Normal file
22
Controls/LabelVertical.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Controls{
|
||||
sealed class LabelVertical : Label{
|
||||
public int LineHeight { get; set; }
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e){
|
||||
int y = (int)Math.Floor((ClientRectangle.Height - Text.Length * LineHeight) / 2F) - 1;
|
||||
using Brush brush = new SolidBrush(ForeColor);
|
||||
|
||||
foreach(char chr in Text){
|
||||
string str = chr.ToString();
|
||||
float x = (ClientRectangle.Width - e.Graphics.MeasureString(str, Font).Width) / 2F;
|
||||
|
||||
e.Graphics.DrawString(str, Font, brush, x, y);
|
||||
y += LineHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
namespace TweetDuck.Controls{
|
||||
sealed class NumericUpDownEx : NumericUpDown{
|
||||
public string TextSuffix { get; set ; }
|
||||
|
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
sealed class LabelVertical : Label{
|
||||
public int LineHeight { get; set; }
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e){
|
||||
int y = (int)Math.Floor((ClientRectangle.Height-Text.Length*LineHeight)/2F)-1;
|
||||
|
||||
using(Brush brush = new SolidBrush(ForeColor)){
|
||||
foreach(char chr in Text){
|
||||
string str = chr.ToString();
|
||||
float x = (ClientRectangle.Width-e.Graphics.MeasureString(str, Font).Width)/2F;
|
||||
|
||||
e.Graphics.DrawString(str, Font, brush, x, y);
|
||||
y += LineHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
using System.Collections.Specialized;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Handling.Filters;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class RequestHandlerBrowser : RequestHandlerBase{
|
||||
private const string UrlVendorResource = "/dist/vendor";
|
||||
private const string UrlLoadingSpinner = "/backgrounds/spinner_blue";
|
||||
|
||||
public string BlockNextUserNavUrl { get; set; }
|
||||
|
||||
public RequestHandlerBrowser() : base(true){}
|
||||
|
||||
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (request.ResourceType == ResourceType.MainFrame){
|
||||
if (request.Url.EndsWith("//twitter.com/")){
|
||||
request.Url = TwitterUtils.TweetDeckURL; // redirect plain twitter.com requests, fixes bugs with login 2FA
|
||||
}
|
||||
}
|
||||
else if (request.ResourceType == ResourceType.Script){
|
||||
string url = request.Url;
|
||||
|
||||
if (url.Contains("analytics.")){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
}
|
||||
else if (url.Contains(UrlVendorResource)){
|
||||
NameValueCollection headers = request.Headers;
|
||||
headers["Accept-Encoding"] = "identity";
|
||||
request.Headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
}
|
||||
|
||||
public override bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect){
|
||||
if (userGesture && request.TransitionType == TransitionType.LinkClicked){
|
||||
bool block = request.Url == BlockNextUserNavUrl;
|
||||
BlockNextUserNavUrl = string.Empty;
|
||||
return block;
|
||||
}
|
||||
|
||||
return base.OnBeforeBrowse(browserControl, browser, frame, request, userGesture, isRedirect);
|
||||
}
|
||||
|
||||
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if (request.ResourceType == ResourceType.Image && request.Url.Contains(UrlLoadingSpinner)){
|
||||
request.Url = TwitterUtils.LoadingSpinner.Url;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||
}
|
||||
|
||||
public override IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if (request.ResourceType == ResourceType.Script && request.Url.Contains(UrlVendorResource) && int.TryParse(response.ResponseHeaders["Content-Length"], out int totalBytes)){
|
||||
return new ResponseFilterVendor(totalBytes);
|
||||
}
|
||||
|
||||
return base.GetResourceResponseFilter(browserControl, browser, frame, request, response);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using CefSharp;
|
||||
using TweetDuck.Data;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class ResourceHandlerFactory : IResourceHandlerFactory{
|
||||
public bool HasHandlers => !handlers.IsEmpty;
|
||||
|
||||
private readonly ConcurrentDictionary<string, IResourceHandler> handlers = new ConcurrentDictionary<string, IResourceHandler>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request){
|
||||
try{
|
||||
return handlers.TryGetValue(request.Url, out IResourceHandler handler) ? handler : null;
|
||||
}finally{
|
||||
request.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// registration
|
||||
|
||||
public bool RegisterHandler(string url, IResourceHandler handler){
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||
handlers.AddOrUpdate(uri.AbsoluteUri, handler, (key, prev) => handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool RegisterHandler(ResourceLink link){
|
||||
return RegisterHandler(link.Url, link.Handler);
|
||||
}
|
||||
|
||||
public bool UnregisterHandler(string url){
|
||||
return handlers.TryRemove(url, out IResourceHandler _);
|
||||
}
|
||||
|
||||
public bool UnregisterHandler(ResourceLink link){
|
||||
return UnregisterHandler(link.Url);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Other.Settings;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
static class SoundNotification{
|
||||
public const string SupportedFormats = "*.wav;*.ogg;*.mp3;*.flac;*.opus;*.weba;*.webm";
|
||||
|
||||
public static IResourceHandler CreateFileHandler(string path){
|
||||
string mimeType;
|
||||
|
||||
switch(Path.GetExtension(path)){
|
||||
case ".weba":
|
||||
case ".webm": mimeType = "audio/webm"; break;
|
||||
case ".wav": mimeType = "audio/wav"; break;
|
||||
case ".ogg": mimeType = "audio/ogg"; break;
|
||||
case ".mp3": mimeType = "audio/mp3"; break;
|
||||
case ".flac": mimeType = "audio/flac"; break;
|
||||
case ".opus": mimeType = "audio/ogg; codecs=opus"; break;
|
||||
default: mimeType = null; break;
|
||||
}
|
||||
|
||||
try{
|
||||
return ResourceHandler.FromFilePath(path, mimeType);
|
||||
}catch{
|
||||
FormBrowser browser = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
browser?.InvokeAsyncSafe(() => {
|
||||
using(FormMessage form = new FormMessage("Sound Notification Error", "Could not find custom notification sound file:\n"+path, MessageBoxIcon.Error)){
|
||||
form.AddButton(FormMessage.Ignore, ControlType.Cancel | ControlType.Focused);
|
||||
|
||||
Button btnViewOptions = form.AddButton("View Options");
|
||||
btnViewOptions.Width += 16;
|
||||
btnViewOptions.Location = new Point(btnViewOptions.Location.X-16, btnViewOptions.Location.Y);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnViewOptions){
|
||||
browser.OpenSettings(typeof(TabSettingsSounds));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
class BaseTabSettings : UserControl{
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
protected static SystemConfig SysConfig => Program.Config.System;
|
||||
|
||||
public IEnumerable<Control> InteractiveControls{
|
||||
get{
|
||||
IEnumerable<Control> FindInteractiveControls(Control parent){
|
||||
foreach(Control control in parent.Controls){
|
||||
if (control is Panel subPanel){
|
||||
foreach(Control subControl in FindInteractiveControls(subPanel)){
|
||||
yield return subControl;
|
||||
}
|
||||
}
|
||||
else{
|
||||
yield return control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FindInteractiveControls(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected BaseTabSettings(){
|
||||
Padding = new Padding(6);
|
||||
}
|
||||
|
||||
public virtual void OnReady(){}
|
||||
public virtual void OnClosing(){}
|
||||
}
|
||||
}
|
@@ -1,186 +0,0 @@
|
||||
using System;
|
||||
using CefSharp;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Cookie = CefSharp.Cookie;
|
||||
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class TwitterUtils{
|
||||
public const string TweetDeckURL = "https://tweetdeck.twitter.com";
|
||||
|
||||
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||
public const string BackgroundColorOverride = "setTimeout(function f(){let h=document.head;if(!h){setTimeout(f,5);return;}let e=document.createElement('style');e.innerHTML='body,body::before{background:#1c6399!important;margin:0}';h.appendChild(e);},1)";
|
||||
|
||||
public static readonly ResourceLink LoadingSpinner = new ResourceLink("https://ton.twimg.com/tduck/spinner", ResourceHandler.FromByteArray(Properties.Resources.spinner, "image/apng"));
|
||||
|
||||
private static readonly Lazy<Regex> RegexAccountLazy = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/(?!signup$|tos$|privacy$|search$|search-)([^/?]+)/?$", RegexOptions.Compiled), false);
|
||||
public static Regex RegexAccount => RegexAccountLazy.Value;
|
||||
|
||||
public static readonly string[] DictionaryWords = {
|
||||
"tweetdeck", "TweetDeck", "tweetduck", "TweetDuck", "TD"
|
||||
};
|
||||
|
||||
public static readonly string[] ValidImageExtensions = {
|
||||
".jpg", ".jpeg", ".png", ".gif"
|
||||
};
|
||||
|
||||
public enum ImageQuality{
|
||||
Default, Orig
|
||||
}
|
||||
|
||||
public static bool IsTweetDeckWebsite(IFrame frame){
|
||||
return frame.Url.Contains("//tweetdeck.twitter.com/");
|
||||
}
|
||||
|
||||
public static bool IsTwitterWebsite(IFrame frame){
|
||||
return frame.Url.Contains("//twitter.com/");
|
||||
}
|
||||
|
||||
public static bool IsTwitterLogin2FactorWebsite(IFrame frame){
|
||||
return frame.Url.Contains("//twitter.com/account/login_verification");
|
||||
}
|
||||
|
||||
private static string ExtractMediaBaseLink(string url){
|
||||
int slash = url.LastIndexOf('/');
|
||||
return slash == -1 ? url : StringUtils.ExtractBefore(url, ':', slash);
|
||||
}
|
||||
|
||||
public static string GetMediaLink(string url, ImageQuality quality){
|
||||
if (quality == ImageQuality.Orig){
|
||||
string result = ExtractMediaBaseLink(url);
|
||||
|
||||
if (url.Contains("//ton.twitter.com/") && url.Contains("/ton/data/dm/")){
|
||||
result += ":large";
|
||||
}
|
||||
else if (result != url || url.Contains("//pbs.twimg.com/media/")){
|
||||
result += ":orig";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else{
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetImageFileName(string url){
|
||||
return BrowserUtils.GetFileNameFromUrl(ExtractMediaBaseLink(url));
|
||||
}
|
||||
|
||||
public static void ViewImage(string url, ImageQuality quality){
|
||||
void ViewImageInternal(string path){
|
||||
string ext = Path.GetExtension(path);
|
||||
|
||||
if (ValidImageExtensions.Contains(ext)){
|
||||
WindowsUtils.OpenAssociatedProgram(path);
|
||||
}
|
||||
else{
|
||||
FormMessage.Error("Image Download", "Invalid file extension "+ext, FormMessage.OK);
|
||||
}
|
||||
}
|
||||
|
||||
string file = Path.Combine(BrowserCache.CacheFolder, GetImageFileName(url) ?? Path.GetRandomFileName());
|
||||
|
||||
if (WindowsUtils.FileExistsAndNotEmpty(file)){
|
||||
ViewImageInternal(file);
|
||||
}
|
||||
else{
|
||||
DownloadFileAuth(GetMediaLink(url, quality), file, () => {
|
||||
ViewImageInternal(file);
|
||||
}, ex => {
|
||||
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void DownloadImage(string url, string username, ImageQuality quality){
|
||||
DownloadImages(new string[]{ url }, username, quality);
|
||||
}
|
||||
|
||||
public static void DownloadImages(string[] urls, string username, ImageQuality quality){
|
||||
if (urls.Length == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
string firstImageLink = GetMediaLink(urls[0], quality);
|
||||
int qualityIndex = firstImageLink.IndexOf(':', firstImageLink.LastIndexOf('/'));
|
||||
|
||||
string filename = GetImageFileName(firstImageLink);
|
||||
string ext = Path.GetExtension(filename); // includes dot
|
||||
|
||||
using(SaveFileDialog dialog = new SaveFileDialog{
|
||||
AutoUpgradeEnabled = true,
|
||||
OverwritePrompt = urls.Length == 1,
|
||||
Title = "Save Image",
|
||||
FileName = qualityIndex == -1 ? filename : $"{username} {Path.ChangeExtension(filename, null)} {firstImageLink.Substring(qualityIndex+1)}".Trim()+ext,
|
||||
Filter = (urls.Length == 1 ? "Image" : "Images")+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
|
||||
}){
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
void OnFailure(Exception ex){
|
||||
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
||||
}
|
||||
|
||||
if (urls.Length == 1){
|
||||
DownloadFileAuth(firstImageLink, dialog.FileName, null, OnFailure);
|
||||
}
|
||||
else{
|
||||
string pathBase = Path.ChangeExtension(dialog.FileName, null);
|
||||
string pathExt = Path.GetExtension(dialog.FileName);
|
||||
|
||||
for(int index = 0; index < urls.Length; index++){
|
||||
DownloadFileAuth(GetMediaLink(urls[index], quality), $"{pathBase} {index+1}{pathExt}", null, OnFailure);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DownloadVideo(string url, string username){
|
||||
string filename = BrowserUtils.GetFileNameFromUrl(url);
|
||||
string ext = Path.GetExtension(filename);
|
||||
|
||||
using(SaveFileDialog dialog = new SaveFileDialog{
|
||||
AutoUpgradeEnabled = true,
|
||||
OverwritePrompt = true,
|
||||
Title = "Save Video",
|
||||
FileName = string.IsNullOrEmpty(username) ? filename : $"{username} {filename}".TrimStart(),
|
||||
Filter = "Video"+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
|
||||
}){
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
DownloadFileAuth(url, dialog.FileName, null, ex => {
|
||||
FormMessage.Error("Video Download", "An error occurred while downloading the video: "+ex.Message, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DownloadFileAuth(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||
const string AuthCookieName = "auth_token";
|
||||
|
||||
TaskScheduler scheduler = TaskScheduler.FromCurrentSynchronizationContext();
|
||||
|
||||
using(ICookieManager cookies = Cef.GetGlobalCookieManager()){
|
||||
cookies.VisitUrlCookiesAsync(url, true).ContinueWith(task => {
|
||||
string cookieStr = null;
|
||||
|
||||
if (task.Status == TaskStatus.RanToCompletion){
|
||||
Cookie found = task.Result?.Find(cookie => cookie.Name == AuthCookieName); // the list may be null
|
||||
|
||||
if (found != null){
|
||||
cookieStr = $"{found.Name}={found.Value}";
|
||||
}
|
||||
}
|
||||
|
||||
BrowserUtils.DownloadFileAsync(url, target, cookieStr, onSuccess, onFailure);
|
||||
}, scheduler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,217 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class WindowsUtils{
|
||||
private static readonly Lazy<Regex> RegexStripHtmlStyles = new Lazy<Regex>(() => new Regex(@"\s?(?:style|class)="".*?"""), false);
|
||||
private static readonly Lazy<Regex> RegexOffsetClipboardHtml = new Lazy<Regex>(() => new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)"), false);
|
||||
|
||||
private static readonly bool IsWindows8OrNewer;
|
||||
private static bool HasMicrosoftBeenBroughtTo2008Yet;
|
||||
|
||||
public static int CurrentProcessID { get; }
|
||||
public static bool ShouldAvoidToolWindow { get; }
|
||||
public static bool IsAeroEnabled => IsWindows8OrNewer || (NativeMethods.DwmIsCompositionEnabled(out bool isCompositionEnabled) == 0 && isCompositionEnabled);
|
||||
|
||||
static WindowsUtils(){
|
||||
using(Process me = Process.GetCurrentProcess()){
|
||||
CurrentProcessID = me.Id;
|
||||
}
|
||||
|
||||
Version ver = Environment.OSVersion.Version;
|
||||
IsWindows8OrNewer = ver.Major == 6 && ver.Minor == 2; // windows 8/10
|
||||
|
||||
ShouldAvoidToolWindow = IsWindows8OrNewer;
|
||||
}
|
||||
|
||||
public static void EnsureTLS12(){
|
||||
if (!HasMicrosoftBeenBroughtTo2008Yet){
|
||||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
|
||||
ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);
|
||||
HasMicrosoftBeenBroughtTo2008Yet = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateDirectoryForFile(string file){
|
||||
string dir = Path.GetDirectoryName(file);
|
||||
|
||||
if (dir == null){
|
||||
throw new ArgumentException("Invalid file path: "+file);
|
||||
}
|
||||
else if (dir.Length > 0){
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckFolderWritePermission(string path){
|
||||
string testFile = Path.Combine(path, ".test");
|
||||
|
||||
try{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
using(File.Create(testFile)){}
|
||||
File.Delete(testFile);
|
||||
return true;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool FileExistsAndNotEmpty(string path){
|
||||
try{
|
||||
return new FileInfo(path).Length > 0;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool OpenAssociatedProgram(string file, string arguments = "", bool runElevated = false){
|
||||
try{
|
||||
using(Process.Start(new ProcessStartInfo{
|
||||
FileName = file,
|
||||
Arguments = arguments,
|
||||
Verb = runElevated ? "runas" : string.Empty,
|
||||
ErrorDialog = true
|
||||
})){
|
||||
return true;
|
||||
}
|
||||
}catch(Win32Exception e) when (e.NativeErrorCode == 0x000004C7){ // operation canceled by the user
|
||||
return false;
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Error Opening Program", "Could not open the associated program for "+file, true, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TrySleepUntil(Func<bool> test, int timeoutMillis, int timeStepMillis){
|
||||
for(int waited = 0; waited < timeoutMillis; waited += timeStepMillis){
|
||||
if (test()){
|
||||
return true;
|
||||
}
|
||||
|
||||
Thread.Sleep(timeStepMillis);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void TryDeleteFolderWhenAble(string path, int timeout){
|
||||
new Thread(() => {
|
||||
TrySleepUntil(() => {
|
||||
try{
|
||||
Directory.Delete(path, true);
|
||||
return true;
|
||||
}catch(DirectoryNotFoundException){
|
||||
return true;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}, timeout, 500);
|
||||
}).Start();
|
||||
}
|
||||
|
||||
public static void ClipboardStripHtmlStyles(){
|
||||
if (!Clipboard.ContainsText(TextDataFormat.Html) || !Clipboard.ContainsText(TextDataFormat.UnicodeText)){
|
||||
return;
|
||||
}
|
||||
|
||||
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
||||
|
||||
string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty);
|
||||
|
||||
int removed = originalHtml.Length-updatedHtml.Length;
|
||||
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||
|
||||
DataObject obj = new DataObject();
|
||||
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
||||
obj.SetText(updatedHtml, TextDataFormat.Html);
|
||||
SetClipboardData(obj);
|
||||
}
|
||||
|
||||
public static void SetClipboard(string text, TextDataFormat format){
|
||||
if (string.IsNullOrEmpty(text)){
|
||||
return;
|
||||
}
|
||||
|
||||
DataObject obj = new DataObject();
|
||||
obj.SetText(text, format);
|
||||
SetClipboardData(obj);
|
||||
}
|
||||
|
||||
private static void SetClipboardData(DataObject obj){
|
||||
try{
|
||||
Clipboard.SetDataObject(obj);
|
||||
}catch(ExternalException e){
|
||||
Program.Reporter.HandleException("Clipboard Error", "TweetDuck could not access the clipboard as it is currently used by another process.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<Browser> FindInstalledBrowsers(){
|
||||
IEnumerable<Browser> ReadBrowsersFromKey(RegistryHive hive){
|
||||
using(RegistryKey root = RegistryKey.OpenBaseKey(hive, RegistryView.Default))
|
||||
using(RegistryKey browserList = root.OpenSubKey(@"SOFTWARE\Clients\StartMenuInternet", false)){
|
||||
if (browserList == null){
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach(string sub in browserList.GetSubKeyNames()){
|
||||
using(RegistryKey browserKey = browserList.OpenSubKey(sub, false))
|
||||
using(RegistryKey shellKey = browserKey?.OpenSubKey(@"shell\open\command")){
|
||||
if (shellKey == null){
|
||||
continue;
|
||||
}
|
||||
|
||||
string browserName = browserKey.GetValue(null) as string;
|
||||
string browserPath = shellKey.GetValue(null) as string;
|
||||
|
||||
if (string.IsNullOrEmpty(browserName) || string.IsNullOrEmpty(browserPath)){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (browserPath[0] == '"' && browserPath[browserPath.Length-1] == '"'){
|
||||
browserPath = browserPath.Substring(1, browserPath.Length-2);
|
||||
}
|
||||
|
||||
yield return new Browser(browserName, browserPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<Browser> browsers = new HashSet<Browser>();
|
||||
|
||||
try{
|
||||
browsers.UnionWith(ReadBrowsersFromKey(RegistryHive.CurrentUser));
|
||||
browsers.UnionWith(ReadBrowsersFromKey(RegistryHive.LocalMachine));
|
||||
}catch{
|
||||
// oops I guess
|
||||
}
|
||||
|
||||
return browsers;
|
||||
}
|
||||
|
||||
public sealed class Browser{
|
||||
public string Name { get; }
|
||||
public string Path { get; }
|
||||
|
||||
public Browser(string name, string path){
|
||||
this.Name = name;
|
||||
this.Path = path;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => Name.GetHashCode();
|
||||
public override bool Equals(object obj) => obj is Browser other && Name == other.Name;
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDuck.Data.Serialization{
|
||||
interface ITypeConverter{
|
||||
bool TryWriteType(Type type, object value, out string converted);
|
||||
bool TryReadType(Type type, string value, out object converted);
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other {
|
||||
namespace TweetDuck.Dialogs {
|
||||
sealed partial class FormAbout {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -2,9 +2,10 @@
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
namespace TweetDuck.Dialogs{
|
||||
sealed partial class FormAbout : Form, FormManager.IAppDialog{
|
||||
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
||||
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
||||
@@ -12,7 +13,7 @@ namespace TweetDuck.Core.Other{
|
||||
public FormAbout(){
|
||||
InitializeComponent();
|
||||
|
||||
Text = "About "+Program.BrandName+" "+Program.VersionTag;
|
||||
Text = "About " + Program.BrandName + " " + Program.VersionTag;
|
||||
|
||||
labelDescription.Text = "TweetDuck was created by chylex as a replacement to the discontinued official TweetDeck client for Windows.\n\nThe program is available for free under the open source MIT license.";
|
||||
|
@@ -1,21 +1,10 @@
|
||||
namespace TweetDuck.Core.Other {
|
||||
namespace TweetDuck.Dialogs {
|
||||
partial class FormGuide {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
@@ -1,16 +1,18 @@
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System.Text.RegularExpressions;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Browser;
|
||||
using TweetDuck.Browser.Adapters;
|
||||
using TweetDuck.Browser.Data;
|
||||
using TweetDuck.Browser.Handling;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
namespace TweetDuck.Dialogs{
|
||||
sealed partial class FormGuide : Form, FormManager.IAppDialog{
|
||||
private const string GuideUrl = "https://tweetduck.chylex.com/guide/v2/";
|
||||
private const string GuidePathRegex = @"^guide(?:/v\d+)?(?:/(#.*))?";
|
||||
@@ -37,7 +39,7 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
|
||||
public static void Show(string hash = null){
|
||||
string url = GuideUrl+(hash ?? string.Empty);
|
||||
string url = GuideUrl + (hash ?? string.Empty);
|
||||
FormGuide guide = FormManager.TryFind<FormGuide>();
|
||||
|
||||
if (guide == null){
|
||||
@@ -54,18 +56,21 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0069 // Disposable fields should be disposed
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
#pragma warning restore IDE0069 // Disposable fields should be disposed
|
||||
|
||||
private string nextUrl;
|
||||
|
||||
private FormGuide(string url, FormBrowser owner){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Guide";
|
||||
Size = new Size(owner.Size.Width*3/4, owner.Size.Height*3/4);
|
||||
Text = Program.BrandName + " Guide";
|
||||
Size = new Size(owner.Size.Width * 3 / 4, owner.Size.Height * 3 / 4);
|
||||
VisibleChanged += (sender, args) => this.MoveToCenter(owner);
|
||||
|
||||
ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();
|
||||
resourceHandlerFactory.RegisterHandler(DummyPage);
|
||||
var resourceRequestHandler = new ResourceRequestHandlerBase();
|
||||
resourceRequestHandler.ResourceHandlers.Register(DummyPage);
|
||||
|
||||
this.browser = new ChromiumWebBrowser(url){
|
||||
MenuHandler = new ContextMenuGuide(owner),
|
||||
@@ -73,7 +78,7 @@ namespace TweetDuck.Core.Other{
|
||||
KeyboardHandler = new KeyboardHandlerBase(),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = new RequestHandlerBase(true),
|
||||
ResourceHandlerFactory = resourceHandlerFactory
|
||||
ResourceRequestHandlerFactory = resourceRequestHandler.SelfFactory
|
||||
};
|
||||
|
||||
browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||
@@ -85,10 +90,15 @@ namespace TweetDuck.Core.Other{
|
||||
browser.SetupZoomEvents();
|
||||
|
||||
Controls.Add(browser);
|
||||
Disposed += (sender, args) => browser.Dispose();
|
||||
}
|
||||
|
||||
Disposed += (sender, args) => {
|
||||
browser.Dispose();
|
||||
};
|
||||
protected override void Dispose(bool disposing){
|
||||
if (disposing){
|
||||
components?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void Reload(string url){
|
||||
@@ -116,7 +126,7 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
|
||||
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
ScriptLoader.ExecuteScript(e.Frame, "Array.prototype.forEach.call(document.getElementsByTagName('A'), ele => ele.addEventListener('click', e => { e.preventDefault(); window.open(ele.getAttribute('href')); }))", "gen:links");
|
||||
CefScriptExecutor.RunScript(e.Frame, "Array.prototype.forEach.call(document.getElementsByTagName('A'), ele => ele.addEventListener('click', e => { e.preventDefault(); window.open(ele.getAttribute('href')); }))", "gen:links");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other {
|
||||
namespace TweetDuck.Dialogs {
|
||||
partial class FormMessage {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
namespace TweetDuck.Dialogs{
|
||||
[Flags]
|
||||
enum ControlType{
|
||||
None = 0,
|
||||
@@ -43,7 +43,8 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
|
||||
public static bool Show(string caption, string text, MessageBoxIcon icon, string buttonAccept, string buttonCancel){
|
||||
using(FormMessage message = new FormMessage(caption, text, icon)){
|
||||
using FormMessage message = new FormMessage(caption, text, icon);
|
||||
|
||||
if (buttonCancel == null){
|
||||
message.AddButton(buttonAccept, DialogResult.OK, ControlType.Cancel | ControlType.Focused);
|
||||
}
|
||||
@@ -54,7 +55,6 @@ namespace TweetDuck.Core.Other{
|
||||
|
||||
return message.ShowDialog() == DialogResult.OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Instance
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace TweetDuck.Core.Other{
|
||||
Font = SystemFonts.MessageBoxFont,
|
||||
Location = new Point(0, 12),
|
||||
Size = new Size(BrowserUtils.Scale(88, dpiScale), BrowserUtils.Scale(26, dpiScale)),
|
||||
TabIndex = 256-buttonCount,
|
||||
TabIndex = 256 - buttonCount,
|
||||
Text = title,
|
||||
UseVisualStyleBackColor = true
|
||||
};
|
||||
@@ -171,17 +171,17 @@ namespace TweetDuck.Core.Other{
|
||||
|
||||
control.Size = new Size(BrowserUtils.Scale(control.Width, dpiScale), BrowserUtils.Scale(control.Height, dpiScale));
|
||||
|
||||
minFormWidth += control.Width+control.Margin.Horizontal;
|
||||
minFormWidth += control.Width + control.Margin.Horizontal;
|
||||
ClientWidth = Math.Max(realFormWidth, minFormWidth);
|
||||
}
|
||||
|
||||
private void RecalculateButtonLocation(){
|
||||
int dist = ButtonDistance;
|
||||
int start = ClientWidth-dist;
|
||||
int start = ClientWidth - dist;
|
||||
|
||||
for(int index = 0; index < buttonCount; index++){
|
||||
Control control = panelActions.Controls[index];
|
||||
control.Location = new Point(start-index*dist, control.Location.Y);
|
||||
control.Location = new Point(start - index * dist, control.Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,17 +194,17 @@ namespace TweetDuck.Core.Other{
|
||||
int labelOffset = BrowserUtils.Scale(8, dpiScale);
|
||||
|
||||
if (isMultiline && !wasLabelMultiline){
|
||||
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y-labelOffset);
|
||||
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y - labelOffset);
|
||||
prevLabelHeight += labelOffset;
|
||||
}
|
||||
else if (!isMultiline && wasLabelMultiline){
|
||||
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y+labelOffset);
|
||||
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y + labelOffset);
|
||||
prevLabelHeight -= labelOffset;
|
||||
}
|
||||
|
||||
realFormWidth = ClientWidth-(icon == null ? BrowserUtils.Scale(50, dpiScale) : 0)+labelMessage.Width-prevLabelWidth;
|
||||
realFormWidth = ClientWidth - (icon == null ? BrowserUtils.Scale(50, dpiScale) : 0) + labelMessage.Width - prevLabelWidth;
|
||||
ClientWidth = Math.Max(realFormWidth, minFormWidth);
|
||||
Height += labelMessage.Height-prevLabelHeight;
|
||||
Height += labelMessage.Height - prevLabelHeight;
|
||||
|
||||
prevLabelWidth = labelMessage.Width;
|
||||
prevLabelHeight = labelMessage.Height;
|
||||
@@ -213,7 +213,7 @@ namespace TweetDuck.Core.Other{
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e){
|
||||
if (icon != null){
|
||||
e.Graphics.DrawIcon(icon, BrowserUtils.Scale(25, dpiScale), 1+BrowserUtils.Scale(25, dpiScale));
|
||||
e.Graphics.DrawIcon(icon, BrowserUtils.Scale(25, dpiScale), 1 + BrowserUtils.Scale(25, dpiScale));
|
||||
}
|
||||
|
||||
base.OnPaint(e);
|
@@ -1,4 +1,6 @@
|
||||
namespace TweetDuck.Core.Other {
|
||||
using TweetDuck.Controls;
|
||||
|
||||
namespace TweetDuck.Dialogs {
|
||||
partial class FormPlugins {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -27,7 +29,7 @@
|
||||
this.btnClose = new System.Windows.Forms.Button();
|
||||
this.btnReload = new System.Windows.Forms.Button();
|
||||
this.btnOpenFolder = new System.Windows.Forms.Button();
|
||||
this.flowLayoutPlugins = new TweetDuck.Plugins.Controls.PluginListFlowLayout();
|
||||
this.flowLayoutPlugins = new FlowLayoutPanelNoHScroll();
|
||||
this.timerLayout = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -117,7 +119,7 @@
|
||||
private System.Windows.Forms.Button btnClose;
|
||||
private System.Windows.Forms.Button btnReload;
|
||||
private System.Windows.Forms.Button btnOpenFolder;
|
||||
private Plugins.Controls.PluginListFlowLayout flowLayoutPlugins;
|
||||
private FlowLayoutPanelNoHScroll flowLayoutPlugins;
|
||||
private System.Windows.Forms.Timer timerLayout;
|
||||
}
|
||||
}
|
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Controls;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
namespace TweetDuck.Dialogs{
|
||||
sealed partial class FormPlugins : Form, FormManager.IAppDialog{
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
@@ -16,7 +17,7 @@ namespace TweetDuck.Core.Other{
|
||||
public FormPlugins(){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Plugins";
|
||||
Text = Program.BrandName + " Plugins";
|
||||
}
|
||||
|
||||
public FormPlugins(PluginManager pluginManager) : this(){
|
||||
@@ -69,8 +70,8 @@ namespace TweetDuck.Core.Other{
|
||||
timerLayout.Stop();
|
||||
|
||||
// stupid WinForms scrollbars and panels
|
||||
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right+1, Padding.Bottom+1);
|
||||
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right-1, Padding.Bottom-1);
|
||||
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right + 1, Padding.Bottom + 1);
|
||||
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right - 1, Padding.Bottom - 1);
|
||||
}
|
||||
|
||||
public void flowLayoutPlugins_Resize(object sender, EventArgs e){
|
||||
@@ -80,22 +81,22 @@ namespace TweetDuck.Core.Other{
|
||||
return;
|
||||
}
|
||||
|
||||
bool showScrollBar = lastPlugin.Location.Y+lastPlugin.Height+1 >= flowLayoutPlugins.Height;
|
||||
bool showScrollBar = lastPlugin.Location.Y + lastPlugin.Height + 1 >= flowLayoutPlugins.Height;
|
||||
int horizontalOffset = showScrollBar ? SystemInformation.VerticalScrollBarWidth : 0;
|
||||
|
||||
flowLayoutPlugins.AutoScroll = showScrollBar;
|
||||
flowLayoutPlugins.VerticalScroll.Visible = showScrollBar;
|
||||
|
||||
foreach(Control control in flowLayoutPlugins.Controls){
|
||||
control.Width = flowLayoutPlugins.Width-control.Margin.Horizontal-horizontalOffset;
|
||||
control.Width = flowLayoutPlugins.Width - control.Margin.Horizontal - horizontalOffset;
|
||||
}
|
||||
|
||||
flowLayoutPlugins.Controls[flowLayoutPlugins.Controls.Count-1].Visible = !showScrollBar;
|
||||
flowLayoutPlugins.Controls[flowLayoutPlugins.Controls.Count - 1].Visible = !showScrollBar;
|
||||
flowLayoutPlugins.Focus();
|
||||
}
|
||||
|
||||
private void btnOpenFolder_Click(object sender, EventArgs e){
|
||||
using(Process.Start("explorer.exe", '"'+pluginManager.PathCustomPlugins+'"')){}
|
||||
App.SystemHandler.OpenFileExplorer(pluginManager.PathCustomPlugins);
|
||||
}
|
||||
|
||||
private void btnReload_Click(object sender, EventArgs e){
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other {
|
||||
namespace TweetDuck.Dialogs {
|
||||
sealed partial class FormSettings {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -2,17 +2,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Notification.Example;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Other.Settings;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Updates;
|
||||
using TweetDuck.Browser;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Browser.Notification.Example;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Dialogs.Settings;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Management.Analytics;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
namespace TweetDuck.Dialogs{
|
||||
sealed partial class FormSettings : Form, FormManager.IAppDialog{
|
||||
public bool ShouldReloadBrowser { get; private set; }
|
||||
|
||||
@@ -27,7 +29,7 @@ namespace TweetDuck.Core.Other{
|
||||
public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler updates, AnalyticsManager analytics, Type startTab){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options";
|
||||
Text = Program.BrandName + " Options";
|
||||
|
||||
this.browser = browser;
|
||||
this.browser.PauseNotification();
|
||||
@@ -41,6 +43,7 @@ namespace TweetDuck.Core.Other{
|
||||
AddButton("General", () => new TabSettingsGeneral(this.browser.ReloadColumns, updates));
|
||||
AddButton("Notifications", () => new TabSettingsNotifications(new FormNotificationExample(this.browser, this.plugins)));
|
||||
AddButton("Sounds", () => new TabSettingsSounds(this.browser.PlaySoundNotification));
|
||||
AddButton("Tray", () => new TabSettingsTray());
|
||||
AddButton("Feedback", () => new TabSettingsFeedback(analytics, AnalyticsReportGenerator.ExternalInfo.From(this.browser), this.plugins));
|
||||
AddButton("Advanced", () => new TabSettingsAdvanced(this.browser.ReinjectCustomCSS, this.browser.OpenDevTools));
|
||||
|
||||
@@ -79,7 +82,7 @@ namespace TweetDuck.Core.Other{
|
||||
private void btnManageOptions_Click(object sender, EventArgs e){
|
||||
PrepareUnload();
|
||||
|
||||
using(DialogSettingsManage dialog = new DialogSettingsManage(plugins)){
|
||||
using DialogSettingsManage dialog = new DialogSettingsManage(plugins);
|
||||
FormClosing -= FormSettings_FormClosing;
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
@@ -99,18 +102,17 @@ namespace TweetDuck.Core.Other{
|
||||
PrepareLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e){
|
||||
Close();
|
||||
}
|
||||
|
||||
private void AddButton<T>(string title, Func<T> constructor) where T : BaseTabSettings{
|
||||
private void AddButton<T>(string title, Func<T> constructor) where T : BaseTab{
|
||||
FlatButton btn = new FlatButton{
|
||||
BackColor = SystemColors.Control,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Font = SystemFonts.MessageBoxFont,
|
||||
Location = new Point(0, (buttonHeight+1)*(panelButtons.Controls.Count/2)),
|
||||
Location = new Point(0, (buttonHeight + 1) * (panelButtons.Controls.Count / 2)),
|
||||
Margin = new Padding(0),
|
||||
Size = new Size(panelButtons.Width, buttonHeight),
|
||||
Text = title,
|
||||
@@ -125,7 +127,7 @@ namespace TweetDuck.Core.Other{
|
||||
|
||||
panelButtons.Controls.Add(new Panel{
|
||||
BackColor = Color.DimGray,
|
||||
Location = new Point(0, panelButtons.Controls[panelButtons.Controls.Count-1].Location.Y+buttonHeight),
|
||||
Location = new Point(0, panelButtons.Controls[panelButtons.Controls.Count - 1].Location.Y + buttonHeight),
|
||||
Margin = new Padding(0),
|
||||
Size = new Size(panelButtons.Width, 1)
|
||||
});
|
||||
@@ -135,7 +137,7 @@ namespace TweetDuck.Core.Other{
|
||||
btn.Click += (sender, args) => SelectTab<T>();
|
||||
}
|
||||
|
||||
private void SelectTab<T>() where T : BaseTabSettings{
|
||||
private void SelectTab<T>() where T : BaseTab{
|
||||
SelectTab(tabs[typeof(T)]);
|
||||
}
|
||||
|
||||
@@ -157,8 +159,8 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
}
|
||||
|
||||
if (tab.Control.Height < panelContents.Height-2){
|
||||
tab.Control.Height = panelContents.Height-2; // fixes off-by-pixel error on high DPI
|
||||
if (tab.Control.Height < panelContents.Height - 2){
|
||||
tab.Control.Height = panelContents.Height - 2; // fixes off-by-pixel error on high DPI
|
||||
}
|
||||
|
||||
tab.Control.OnReady();
|
||||
@@ -195,16 +197,47 @@ namespace TweetDuck.Core.Other{
|
||||
private sealed class SettingsTab{
|
||||
public Button Button { get; }
|
||||
|
||||
public BaseTabSettings Control => control ?? (control = constructor());
|
||||
public BaseTab Control => control ??= constructor();
|
||||
public bool IsInitialized => control != null;
|
||||
|
||||
private readonly Func<BaseTabSettings> constructor;
|
||||
private BaseTabSettings control;
|
||||
private readonly Func<BaseTab> constructor;
|
||||
private BaseTab control;
|
||||
|
||||
public SettingsTab(Button button, Func<BaseTabSettings> constructor){
|
||||
public SettingsTab(Button button, Func<BaseTab> constructor){
|
||||
this.Button = button;
|
||||
this.constructor = constructor;
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class BaseTab : UserControl{
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
protected static SystemConfig SysConfig => Program.Config.System;
|
||||
|
||||
public IEnumerable<Control> InteractiveControls{
|
||||
get{
|
||||
static IEnumerable<Control> FindInteractiveControls(Control parent){
|
||||
foreach(Control control in parent.Controls){
|
||||
if (control is Panel subPanel){
|
||||
foreach(Control subControl in FindInteractiveControls(subPanel)){
|
||||
yield return subControl;
|
||||
}
|
||||
}
|
||||
else{
|
||||
yield return control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FindInteractiveControls(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected BaseTab(){
|
||||
Padding = new Padding(6);
|
||||
}
|
||||
|
||||
public virtual void OnReady(){}
|
||||
public virtual void OnClosing(){}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsAnalytics {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,16 +1,14 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Management.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsAnalytics : Form{
|
||||
public string CefArgs => textBoxReport.Text;
|
||||
|
||||
public DialogSettingsAnalytics(AnalyticsReport report){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options - Analytics Report";
|
||||
Text = Program.BrandName + " Options - Analytics Report";
|
||||
|
||||
textBoxReport.EnableMultilineShortcuts();
|
||||
textBoxReport.Text = report.ToString().TrimEnd();
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsCSS {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -2,10 +2,10 @@
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsCSS : Form{
|
||||
public string BrowserCSS => textBoxBrowserCSS.Text;
|
||||
public string NotificationCSS => textBoxNotificationCSS.Text;
|
||||
@@ -16,7 +16,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
public DialogSettingsCSS(string browserCSS, string notificationCSS, Action<string> reinjectBrowserCSS, Action openDevTools){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options - CSS";
|
||||
Text = Program.BrandName + " Options - CSS";
|
||||
|
||||
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
||||
this.openDevTools = openDevTools;
|
||||
@@ -64,21 +64,21 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
}
|
||||
}
|
||||
|
||||
if (!(deleteTo < text.Length-1 && text[deleteTo] == '\r' && text[deleteTo+1] == '\n')){
|
||||
if (!(deleteTo < text.Length - 1 && text[deleteTo] == '\r' && text[deleteTo + 1] == '\n')){
|
||||
++deleteTo;
|
||||
}
|
||||
|
||||
tb.Select(deleteTo, tb.SelectionLength+tb.SelectionStart-deleteTo);
|
||||
tb.Select(deleteTo, tb.SelectionLength + tb.SelectionStart - deleteTo);
|
||||
tb.SelectedText = string.Empty;
|
||||
}
|
||||
}
|
||||
else if (e.KeyCode == Keys.Back && e.Modifiers == Keys.None){
|
||||
int deleteTo = tb.SelectionStart;
|
||||
|
||||
if (deleteTo > 1 && text[deleteTo-1] == ' ' && text[deleteTo-2] == ' '){
|
||||
if (deleteTo > 1 && text[deleteTo - 1] == ' ' && text[deleteTo - 2] == ' '){
|
||||
e.SuppressKeyPress = true;
|
||||
|
||||
tb.Select(deleteTo-2, 2);
|
||||
tb.Select(deleteTo - 2, 2);
|
||||
tb.SelectedText = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -89,28 +89,28 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
if (insertAt == 0){
|
||||
return;
|
||||
}
|
||||
else if (text[insertAt-1] == '{'){
|
||||
insertText = Environment.NewLine+" ";
|
||||
else if (text[insertAt - 1] == '{'){
|
||||
insertText = Environment.NewLine + " ";
|
||||
|
||||
int nextBracket = insertAt < text.Length ? text.IndexOfAny(new char[]{ '{', '}' }, insertAt+1) : -1;
|
||||
int nextBracket = insertAt < text.Length ? text.IndexOfAny(new char[]{ '{', '}' }, insertAt + 1) : -1;
|
||||
|
||||
if (nextBracket == -1 || text[nextBracket] == '{'){
|
||||
string insertExtra = Environment.NewLine+"}";
|
||||
string insertExtra = Environment.NewLine + "}";
|
||||
insertText += insertExtra;
|
||||
cursorOffset -= insertExtra.Length;
|
||||
}
|
||||
}
|
||||
else{
|
||||
int lineStart = text.LastIndexOf('\n', tb.SelectionStart-1);
|
||||
int lineStart = text.LastIndexOf('\n', tb.SelectionStart - 1);
|
||||
|
||||
Match match = Regex.Match(text.Substring(lineStart == -1 ? 0 : lineStart+1), "^([ \t]+)");
|
||||
insertText = match.Success ? Environment.NewLine+match.Groups[1].Value : null;
|
||||
Match match = Regex.Match(text.Substring(lineStart == -1 ? 0 : lineStart + 1), "^([ \t]+)");
|
||||
insertText = match.Success ? Environment.NewLine + match.Groups[1].Value : null;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(insertText)){
|
||||
e.SuppressKeyPress = true;
|
||||
tb.Text = text.Insert(insertAt, insertText);
|
||||
tb.SelectionStart = insertAt+cursorOffset+insertText.Length;
|
||||
tb.SelectionStart = insertAt + cursorOffset + insertText.Length;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsCefArgs {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Collections;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsCefArgs : Form{
|
||||
public string CefArgs => textBoxArgs.Text;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
public DialogSettingsCefArgs(string args){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options - CEF Arguments";
|
||||
Text = Program.BrandName + " Options - CEF Arguments";
|
||||
|
||||
textBoxArgs.EnableMultilineShortcuts();
|
||||
textBoxArgs.Text = initialArgs = args ?? "";
|
||||
@@ -32,7 +32,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
}
|
||||
|
||||
int count = CommandLineArgs.ReadCefArguments(CefArgs).Count;
|
||||
string prompt = count == 0 && !string.IsNullOrWhiteSpace(initialArgs) ? "All current arguments will be removed. Continue?" : count+(count == 1 ? " argument was" : " arguments were")+" detected. Continue?";
|
||||
string prompt = count == 0 && !string.IsNullOrWhiteSpace(initialArgs) ? "All current arguments will be removed. Continue?" : count + (count == 1 ? " argument was" : " arguments were") + " detected. Continue?";
|
||||
|
||||
if (FormMessage.Question("Confirm CEF Arguments", prompt, FormMessage.OK, FormMessage.Cancel)){
|
||||
DialogResult = DialogResult.OK;
|
154
Dialogs/Settings/DialogSettingsExternalProgram.Designer.cs
generated
Normal file
154
Dialogs/Settings/DialogSettingsExternalProgram.Designer.cs
generated
Normal file
@@ -0,0 +1,154 @@
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsExternalProgram {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.textBoxPath = new System.Windows.Forms.TextBox();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnApply = new System.Windows.Forms.Button();
|
||||
this.labelPath = new System.Windows.Forms.Label();
|
||||
this.labelArgs = new System.Windows.Forms.Label();
|
||||
this.textBoxArgs = new System.Windows.Forms.TextBox();
|
||||
this.btnBrowse = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBoxPath
|
||||
//
|
||||
this.textBoxPath.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxPath.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.textBoxPath.Location = new System.Drawing.Point(12, 30);
|
||||
this.textBoxPath.Name = "textBoxPath";
|
||||
this.textBoxPath.Size = new System.Drawing.Size(336, 23);
|
||||
this.textBoxPath.TabIndex = 1;
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnCancel.Location = new System.Drawing.Point(307, 118);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnCancel.Size = new System.Drawing.Size(57, 25);
|
||||
this.btnCancel.TabIndex = 6;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// btnApply
|
||||
//
|
||||
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnApply.AutoSize = true;
|
||||
this.btnApply.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnApply.Location = new System.Drawing.Point(370, 118);
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnApply.Size = new System.Drawing.Size(52, 25);
|
||||
this.btnApply.TabIndex = 5;
|
||||
this.btnApply.Text = "Apply";
|
||||
this.btnApply.UseVisualStyleBackColor = true;
|
||||
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
||||
//
|
||||
// labelPath
|
||||
//
|
||||
this.labelPath.AutoSize = true;
|
||||
this.labelPath.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelPath.Location = new System.Drawing.Point(12, 9);
|
||||
this.labelPath.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
||||
this.labelPath.Name = "labelPath";
|
||||
this.labelPath.Size = new System.Drawing.Size(109, 15);
|
||||
this.labelPath.TabIndex = 0;
|
||||
this.labelPath.Text = "Path to Application";
|
||||
//
|
||||
// labelArgs
|
||||
//
|
||||
this.labelArgs.AutoSize = true;
|
||||
this.labelArgs.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelArgs.Location = new System.Drawing.Point(12, 68);
|
||||
this.labelArgs.Margin = new System.Windows.Forms.Padding(3, 12, 3, 3);
|
||||
this.labelArgs.Name = "labelArgs";
|
||||
this.labelArgs.Size = new System.Drawing.Size(124, 15);
|
||||
this.labelArgs.TabIndex = 3;
|
||||
this.labelArgs.Text = "Additional Arguments";
|
||||
//
|
||||
// textBoxArgs
|
||||
//
|
||||
this.textBoxArgs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxArgs.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.textBoxArgs.Location = new System.Drawing.Point(12, 89);
|
||||
this.textBoxArgs.Name = "textBoxArgs";
|
||||
this.textBoxArgs.Size = new System.Drawing.Size(410, 23);
|
||||
this.textBoxArgs.TabIndex = 4;
|
||||
//
|
||||
// btnBrowse
|
||||
//
|
||||
this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBrowse.AutoSize = true;
|
||||
this.btnBrowse.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnBrowse.Location = new System.Drawing.Point(354, 28);
|
||||
this.btnBrowse.Name = "btnBrowse";
|
||||
this.btnBrowse.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnBrowse.Size = new System.Drawing.Size(68, 25);
|
||||
this.btnBrowse.TabIndex = 2;
|
||||
this.btnBrowse.Text = "Browse...";
|
||||
this.btnBrowse.UseVisualStyleBackColor = true;
|
||||
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
|
||||
//
|
||||
// DialogSettingsExternalProgram
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(434, 155);
|
||||
this.Controls.Add(this.btnBrowse);
|
||||
this.Controls.Add(this.textBoxArgs);
|
||||
this.Controls.Add(this.labelArgs);
|
||||
this.Controls.Add(this.labelPath);
|
||||
this.Controls.Add(this.btnApply);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.textBoxPath);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "DialogSettingsExternalProgram";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBoxPath;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnApply;
|
||||
private System.Windows.Forms.Label labelPath;
|
||||
private System.Windows.Forms.Label labelArgs;
|
||||
private System.Windows.Forms.TextBox textBoxArgs;
|
||||
private System.Windows.Forms.Button btnBrowse;
|
||||
}
|
||||
}
|
55
Dialogs/Settings/DialogSettingsExternalProgram.cs
Normal file
55
Dialogs/Settings/DialogSettingsExternalProgram.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetLib.Core.Utils;
|
||||
using IOPath = System.IO.Path;
|
||||
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsExternalProgram : Form{
|
||||
public string Path{
|
||||
get => StringUtils.NullIfEmpty(textBoxPath.Text);
|
||||
set => textBoxPath.Text = value ?? string.Empty;
|
||||
}
|
||||
|
||||
public string Args{
|
||||
get => StringUtils.NullIfEmpty(textBoxArgs.Text);
|
||||
set => textBoxArgs.Text = value ?? string.Empty;
|
||||
}
|
||||
|
||||
private readonly string fileDialogTitle;
|
||||
|
||||
public DialogSettingsExternalProgram(string windowTitle, string fileDialogTitle){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName + " Options - " + windowTitle;
|
||||
AcceptButton = btnApply;
|
||||
CancelButton = btnCancel;
|
||||
|
||||
this.fileDialogTitle = fileDialogTitle;
|
||||
}
|
||||
|
||||
private void btnBrowse_Click(object sender, EventArgs e){
|
||||
using OpenFileDialog dialog = new OpenFileDialog{
|
||||
AutoUpgradeEnabled = true,
|
||||
DereferenceLinks = true,
|
||||
InitialDirectory = IOPath.GetDirectoryName(Path), // returns null if argument is null
|
||||
Title = fileDialogTitle,
|
||||
Filter = "Executables (*.exe;*.bat;*.cmd)|*.exe;*.bat;*.cmd|All Files (*.*)|*.*"
|
||||
};
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK && Path != dialog.FileName){
|
||||
Path = dialog.FileName;
|
||||
Args = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnApply_Click(object sender, EventArgs e){
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e){
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsManage {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Management;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsManage : Form{
|
||||
private enum State{
|
||||
Deciding, Reset, Import, Export
|
||||
@@ -124,7 +124,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
// Continue...
|
||||
panelDecision.Visible = false;
|
||||
panelSelection.Visible = true;
|
||||
Height += panelSelection.Height-panelDecision.Height;
|
||||
Height += panelSelection.Height - panelDecision.Height;
|
||||
break;
|
||||
|
||||
case State.Reset:
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsRestart {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Collections;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsRestart : Form{
|
||||
public CommandLineArgs Args { get; private set; }
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
tbDataFolder.Enabled = false;
|
||||
}
|
||||
else{
|
||||
tbDataFolder.Text = currentArgs.GetValue(Arguments.ArgDataFolder, string.Empty);
|
||||
tbDataFolder.Text = currentArgs.GetValue(Arguments.ArgDataFolder) ?? string.Empty;
|
||||
tbDataFolder.TextChanged += control_Change;
|
||||
}
|
||||
|
||||
control_Change(this, EventArgs.Empty);
|
||||
|
||||
Text = Program.BrandName+" Arguments";
|
||||
Text = Program.BrandName + " Arguments";
|
||||
}
|
||||
|
||||
private void control_Change(object sender, EventArgs e){
|
||||
@@ -38,7 +38,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
Args.SetValue(Arguments.ArgDataFolder, tbDataFolder.Text);
|
||||
}
|
||||
|
||||
tbShortcutTarget.Text = $@"""{Application.ExecutablePath}""{(Args.Count > 0 ? " " : "")}{Args}";
|
||||
tbShortcutTarget.Text = $@"""{Program.ExecutablePath}""{(Args.Count > 0 ? " " : "")}{Args}";
|
||||
tbShortcutTarget.Select(tbShortcutTarget.Text.Length, 0);
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class DialogSettingsSearchEngine {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,14 +1,14 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class DialogSettingsSearchEngine : Form{
|
||||
public string Url => textBoxUrl.Text;
|
||||
|
||||
public DialogSettingsSearchEngine(){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options - Custom Search Engine";
|
||||
Text = Program.BrandName + " Options - Custom Search Engine";
|
||||
|
||||
textBoxUrl.Text = Program.Config.User.SearchEngineUrl ?? "";
|
||||
textBoxUrl.Select(textBoxUrl.Text.Length, 0);
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class TabSettingsAdvanced {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -32,7 +32,7 @@
|
||||
this.btnRestart = new System.Windows.Forms.Button();
|
||||
this.btnOpenAppFolder = new System.Windows.Forms.Button();
|
||||
this.btnOpenDataFolder = new System.Windows.Forms.Button();
|
||||
this.numClearCacheThreshold = new TweetDuck.Core.Controls.NumericUpDownEx();
|
||||
this.numClearCacheThreshold = new TweetDuck.Controls.NumericUpDownEx();
|
||||
this.checkClearCacheAuto = new System.Windows.Forms.CheckBox();
|
||||
this.labelApp = new System.Windows.Forms.Label();
|
||||
this.panelAppButtons = new System.Windows.Forms.Panel();
|
||||
@@ -41,6 +41,8 @@
|
||||
this.panelConfiguration = new System.Windows.Forms.Panel();
|
||||
this.labelConfiguration = new System.Windows.Forms.Label();
|
||||
this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.labelDevTools = new System.Windows.Forms.Label();
|
||||
this.checkDevToolsWindowOnTop = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numClearCacheThreshold)).BeginInit();
|
||||
this.panelAppButtons.SuspendLayout();
|
||||
this.panelClearCacheAuto.SuspendLayout();
|
||||
@@ -240,6 +242,8 @@
|
||||
this.flowPanel.Controls.Add(this.panelClearCacheAuto);
|
||||
this.flowPanel.Controls.Add(this.labelConfiguration);
|
||||
this.flowPanel.Controls.Add(this.panelConfiguration);
|
||||
this.flowPanel.Controls.Add(this.labelDevTools);
|
||||
this.flowPanel.Controls.Add(this.checkDevToolsWindowOnTop);
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
@@ -247,6 +251,29 @@
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
//
|
||||
// labelDevTools
|
||||
//
|
||||
this.labelDevTools.AutoSize = true;
|
||||
this.labelDevTools.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelDevTools.Location = new System.Drawing.Point(0, 302);
|
||||
this.labelDevTools.Margin = new System.Windows.Forms.Padding(0, 30, 0, 1);
|
||||
this.labelDevTools.Name = "labelDevTools";
|
||||
this.labelDevTools.Size = new System.Drawing.Size(156, 19);
|
||||
this.labelDevTools.TabIndex = 7;
|
||||
this.labelDevTools.Text = "DEVELOPMENT TOOLS";
|
||||
//
|
||||
// checkDevToolsWindowOnTop
|
||||
//
|
||||
this.checkDevToolsWindowOnTop.AutoSize = true;
|
||||
this.checkDevToolsWindowOnTop.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkDevToolsWindowOnTop.Location = new System.Drawing.Point(6, 328);
|
||||
this.checkDevToolsWindowOnTop.Margin = new System.Windows.Forms.Padding(6, 6, 0, 2);
|
||||
this.checkDevToolsWindowOnTop.Name = "checkDevToolsWindowOnTop";
|
||||
this.checkDevToolsWindowOnTop.Size = new System.Drawing.Size(168, 19);
|
||||
this.checkDevToolsWindowOnTop.TabIndex = 8;
|
||||
this.checkDevToolsWindowOnTop.Text = "Dev Tools Window On Top";
|
||||
this.checkDevToolsWindowOnTop.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// TabSettingsAdvanced
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -284,5 +311,7 @@
|
||||
private Controls.NumericUpDownEx numClearCacheThreshold;
|
||||
private System.Windows.Forms.CheckBox checkClearCacheAuto;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanel;
|
||||
private System.Windows.Forms.Label labelDevTools;
|
||||
private System.Windows.Forms.CheckBox checkDevToolsWindowOnTop;
|
||||
}
|
||||
}
|
@@ -1,15 +1,14 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsAdvanced : BaseTabSettings{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class TabSettingsAdvanced : FormSettings.BaseTab{
|
||||
private readonly Action<string> reinjectBrowserCSS;
|
||||
private readonly Action openDevTools;
|
||||
|
||||
@@ -36,7 +35,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
numClearCacheThreshold.SetValueSafe(SysConfig.ClearCacheThreshold);
|
||||
|
||||
BrowserCache.GetCacheSize(task => {
|
||||
string text = task.Status == TaskStatus.RanToCompletion ? (int)Math.Ceiling(task.Result/(1024.0*1024.0))+" MB" : "unknown";
|
||||
string text = task.Status == TaskStatus.RanToCompletion ? (int)Math.Ceiling(task.Result / (1024.0 * 1024.0)) + " MB" : "unknown";
|
||||
this.InvokeSafe(() => btnClearCache.Text = $"Clear Cache ({text})");
|
||||
});
|
||||
|
||||
@@ -44,6 +43,16 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
toolTip.SetToolTip(btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
|
||||
toolTip.SetToolTip(btnEditCSS, "Set custom CSS for browser and notification windows.");
|
||||
|
||||
// development tools
|
||||
|
||||
toolTip.SetToolTip(checkDevToolsWindowOnTop, "Sets whether dev tool windows appears on top of other windows.");
|
||||
|
||||
checkDevToolsWindowOnTop.Checked = Config.DevToolsWindowOnTop;
|
||||
|
||||
if (!BrowserUtils.HasDevTools){
|
||||
checkDevToolsWindowOnTop.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
@@ -57,6 +66,8 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
btnEditCefArgs.Click += btnEditCefArgs_Click;
|
||||
btnEditCSS.Click += btnEditCSS_Click;
|
||||
|
||||
checkDevToolsWindowOnTop.CheckedChanged += checkDevToolsWindowOnTop_CheckedChanged;
|
||||
}
|
||||
|
||||
public override void OnClosing(){
|
||||
@@ -67,11 +78,11 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
#region Application
|
||||
|
||||
private void btnOpenAppFolder_Click(object sender, EventArgs e){
|
||||
using(Process.Start("explorer.exe", "\""+Program.ProgramPath+"\"")){}
|
||||
App.SystemHandler.OpenFileExplorer(Program.ProgramPath);
|
||||
}
|
||||
|
||||
private void btnOpenDataFolder_Click(object sender, EventArgs e){
|
||||
using(Process.Start("explorer.exe", "\""+Program.StoragePath+"\"")){}
|
||||
App.SystemHandler.OpenFileExplorer(Program.StoragePath);
|
||||
}
|
||||
|
||||
private void btnRestart_Click(object sender, EventArgs e){
|
||||
@@ -79,12 +90,12 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
|
||||
private void btnRestartArgs_Click(object sender, EventArgs e){
|
||||
using(DialogSettingsRestart dialog = new DialogSettingsRestart(Arguments.GetCurrentClean())){
|
||||
using DialogSettingsRestart dialog = new DialogSettingsRestart(Arguments.GetCurrentClean());
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
Program.RestartWithArgs(dialog.Args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Browser Cache
|
||||
@@ -152,6 +163,13 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Development Tools
|
||||
|
||||
private void checkDevToolsWindowOnTop_CheckedChanged(object sender, EventArgs e){
|
||||
Config.DevToolsWindowOnTop = checkDevToolsWindowOnTop.Checked;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class TabSettingsFeedback {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Management.Analytics;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsFeedback : BaseTabSettings{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class TabSettingsFeedback : FormSettings.BaseTab{
|
||||
private readonly AnalyticsFile analyticsFile;
|
||||
private readonly AnalyticsReportGenerator.ExternalInfo analyticsInfo;
|
||||
private readonly PluginManager plugins;
|
||||
@@ -24,7 +23,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
if (analytics != null){
|
||||
string collectionTime = analyticsFile.LastCollectionMessage;
|
||||
labelDataCollectionMessage.Text = string.IsNullOrEmpty(collectionTime) ? "No collection yet" : "Last collection: "+collectionTime;
|
||||
labelDataCollectionMessage.Text = string.IsNullOrEmpty(collectionTime) ? "No collection yet" : "Last collection: " + collectionTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +49,9 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
|
||||
private void btnViewReport_Click(object sender, EventArgs e){
|
||||
using(DialogSettingsAnalytics dialog = new DialogSettingsAnalytics(AnalyticsReportGenerator.Create(analyticsFile, analyticsInfo, plugins))){
|
||||
using DialogSettingsAnalytics dialog = new DialogSettingsAnalytics(AnalyticsReportGenerator.Create(analyticsFile, analyticsInfo, plugins));
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class TabSettingsGeneral {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -39,31 +39,39 @@
|
||||
this.checkAnimatedAvatars = new System.Windows.Forms.CheckBox();
|
||||
this.labelUpdates = new System.Windows.Forms.Label();
|
||||
this.flowPanelLeft = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.checkFocusDmInput = new System.Windows.Forms.CheckBox();
|
||||
this.checkKeepLikeFollowDialogsOpen = new System.Windows.Forms.CheckBox();
|
||||
this.labelTray = new System.Windows.Forms.Label();
|
||||
this.comboBoxTrayType = new System.Windows.Forms.ComboBox();
|
||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
||||
this.labelBrowserSettings = new System.Windows.Forms.Label();
|
||||
this.checkSmoothScrolling = new System.Windows.Forms.CheckBox();
|
||||
this.checkTouchAdjustment = new System.Windows.Forms.CheckBox();
|
||||
this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox();
|
||||
this.labelBrowserPath = new System.Windows.Forms.Label();
|
||||
this.comboBoxBrowserPath = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxCustomBrowser = new System.Windows.Forms.ComboBox();
|
||||
this.labelSearchEngine = new System.Windows.Forms.Label();
|
||||
this.comboBoxSearchEngine = new System.Windows.Forms.ComboBox();
|
||||
this.flowPanelRight = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox();
|
||||
this.labelLocales = new System.Windows.Forms.Label();
|
||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||
this.labelSpellCheckLanguage = new System.Windows.Forms.Label();
|
||||
this.comboBoxSpellCheckLanguage = new System.Windows.Forms.ComboBox();
|
||||
this.labelTranslationTarget = new System.Windows.Forms.Label();
|
||||
this.comboBoxTranslationTarget = new System.Windows.Forms.ComboBox();
|
||||
this.labelFirstDayOfWeek = new System.Windows.Forms.Label();
|
||||
this.comboBoxFirstDayOfWeek = new System.Windows.Forms.ComboBox();
|
||||
this.labelExternalApplications = new System.Windows.Forms.Label();
|
||||
this.panelCustomBrowser = new System.Windows.Forms.Panel();
|
||||
this.btnCustomBrowserChange = new System.Windows.Forms.Button();
|
||||
this.labelVideoPlayerPath = new System.Windows.Forms.Label();
|
||||
this.panelCustomVideoPlayer = new System.Windows.Forms.Panel();
|
||||
this.comboBoxCustomVideoPlayer = new System.Windows.Forms.ComboBox();
|
||||
this.btnCustomVideoPlayerChange = new System.Windows.Forms.Button();
|
||||
this.panelSeparator = new System.Windows.Forms.Panel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).BeginInit();
|
||||
this.panelZoom.SuspendLayout();
|
||||
this.flowPanelLeft.SuspendLayout();
|
||||
this.flowPanelRight.SuspendLayout();
|
||||
this.panelCustomBrowser.SuspendLayout();
|
||||
this.panelCustomVideoPlayer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkExpandLinks
|
||||
@@ -82,11 +90,11 @@
|
||||
//
|
||||
this.checkUpdateNotifications.AutoSize = true;
|
||||
this.checkUpdateNotifications.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 393);
|
||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 403);
|
||||
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
||||
this.checkUpdateNotifications.Size = new System.Drawing.Size(182, 19);
|
||||
this.checkUpdateNotifications.TabIndex = 13;
|
||||
this.checkUpdateNotifications.TabIndex = 14;
|
||||
this.checkUpdateNotifications.Text = "Check Updates Automatically";
|
||||
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -94,12 +102,12 @@
|
||||
//
|
||||
this.btnCheckUpdates.AutoSize = true;
|
||||
this.btnCheckUpdates.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnCheckUpdates.Location = new System.Drawing.Point(5, 417);
|
||||
this.btnCheckUpdates.Location = new System.Drawing.Point(5, 427);
|
||||
this.btnCheckUpdates.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnCheckUpdates.Name = "btnCheckUpdates";
|
||||
this.btnCheckUpdates.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnCheckUpdates.Size = new System.Drawing.Size(128, 25);
|
||||
this.btnCheckUpdates.TabIndex = 14;
|
||||
this.btnCheckUpdates.TabIndex = 15;
|
||||
this.btnCheckUpdates.Text = "Check Updates Now";
|
||||
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -107,7 +115,7 @@
|
||||
//
|
||||
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelZoomValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelZoomValue.Location = new System.Drawing.Point(147, 4);
|
||||
this.labelZoomValue.Location = new System.Drawing.Point(176, 4);
|
||||
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);
|
||||
@@ -119,11 +127,11 @@
|
||||
//
|
||||
this.checkBestImageQuality.AutoSize = true;
|
||||
this.checkBestImageQuality.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkBestImageQuality.Location = new System.Drawing.Point(6, 98);
|
||||
this.checkBestImageQuality.Location = new System.Drawing.Point(6, 122);
|
||||
this.checkBestImageQuality.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkBestImageQuality.Name = "checkBestImageQuality";
|
||||
this.checkBestImageQuality.Size = new System.Drawing.Size(125, 19);
|
||||
this.checkBestImageQuality.TabIndex = 4;
|
||||
this.checkBestImageQuality.TabIndex = 5;
|
||||
this.checkBestImageQuality.Text = "Best Image Quality";
|
||||
this.checkBestImageQuality.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -131,11 +139,11 @@
|
||||
//
|
||||
this.checkOpenSearchInFirstColumn.AutoSize = true;
|
||||
this.checkOpenSearchInFirstColumn.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkOpenSearchInFirstColumn.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkOpenSearchInFirstColumn.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkOpenSearchInFirstColumn.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkOpenSearchInFirstColumn.Name = "checkOpenSearchInFirstColumn";
|
||||
this.checkOpenSearchInFirstColumn.Size = new System.Drawing.Size(245, 19);
|
||||
this.checkOpenSearchInFirstColumn.TabIndex = 2;
|
||||
this.checkOpenSearchInFirstColumn.TabIndex = 3;
|
||||
this.checkOpenSearchInFirstColumn.Text = "Add Search Columns Before First Column";
|
||||
this.checkOpenSearchInFirstColumn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -148,7 +156,7 @@
|
||||
this.trackBarZoom.Maximum = 200;
|
||||
this.trackBarZoom.Minimum = 50;
|
||||
this.trackBarZoom.Name = "trackBarZoom";
|
||||
this.trackBarZoom.Size = new System.Drawing.Size(148, 30);
|
||||
this.trackBarZoom.Size = new System.Drawing.Size(177, 30);
|
||||
this.trackBarZoom.SmallChange = 5;
|
||||
this.trackBarZoom.TabIndex = 0;
|
||||
this.trackBarZoom.TickFrequency = 25;
|
||||
@@ -158,11 +166,11 @@
|
||||
//
|
||||
this.labelZoom.AutoSize = true;
|
||||
this.labelZoom.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelZoom.Location = new System.Drawing.Point(3, 155);
|
||||
this.labelZoom.Location = new System.Drawing.Point(3, 299);
|
||||
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelZoom.Name = "labelZoom";
|
||||
this.labelZoom.Size = new System.Drawing.Size(39, 15);
|
||||
this.labelZoom.TabIndex = 6;
|
||||
this.labelZoom.TabIndex = 11;
|
||||
this.labelZoom.Text = "Zoom";
|
||||
//
|
||||
// zoomUpdateTimer
|
||||
@@ -185,21 +193,21 @@
|
||||
//
|
||||
this.panelZoom.Controls.Add(this.trackBarZoom);
|
||||
this.panelZoom.Controls.Add(this.labelZoomValue);
|
||||
this.panelZoom.Location = new System.Drawing.Point(0, 171);
|
||||
this.panelZoom.Location = new System.Drawing.Point(0, 315);
|
||||
this.panelZoom.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelZoom.Name = "panelZoom";
|
||||
this.panelZoom.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelZoom.TabIndex = 7;
|
||||
this.panelZoom.TabIndex = 12;
|
||||
//
|
||||
// checkAnimatedAvatars
|
||||
//
|
||||
this.checkAnimatedAvatars.AutoSize = true;
|
||||
this.checkAnimatedAvatars.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkAnimatedAvatars.Location = new System.Drawing.Point(6, 122);
|
||||
this.checkAnimatedAvatars.Location = new System.Drawing.Point(6, 146);
|
||||
this.checkAnimatedAvatars.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkAnimatedAvatars.Name = "checkAnimatedAvatars";
|
||||
this.checkAnimatedAvatars.Size = new System.Drawing.Size(158, 19);
|
||||
this.checkAnimatedAvatars.TabIndex = 5;
|
||||
this.checkAnimatedAvatars.TabIndex = 6;
|
||||
this.checkAnimatedAvatars.Text = "Enable Animated Avatars";
|
||||
this.checkAnimatedAvatars.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -207,11 +215,11 @@
|
||||
//
|
||||
this.labelUpdates.AutoSize = true;
|
||||
this.labelUpdates.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelUpdates.Location = new System.Drawing.Point(0, 367);
|
||||
this.labelUpdates.Margin = new System.Windows.Forms.Padding(0, 30, 0, 1);
|
||||
this.labelUpdates.Location = new System.Drawing.Point(0, 377);
|
||||
this.labelUpdates.Margin = new System.Windows.Forms.Padding(0, 27, 0, 1);
|
||||
this.labelUpdates.Name = "labelUpdates";
|
||||
this.labelUpdates.Size = new System.Drawing.Size(69, 19);
|
||||
this.labelUpdates.TabIndex = 12;
|
||||
this.labelUpdates.TabIndex = 13;
|
||||
this.labelUpdates.Text = "UPDATES";
|
||||
//
|
||||
// flowPanelLeft
|
||||
@@ -220,16 +228,17 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanelLeft.Controls.Add(this.labelUI);
|
||||
this.flowPanelLeft.Controls.Add(this.checkExpandLinks);
|
||||
this.flowPanelLeft.Controls.Add(this.checkFocusDmInput);
|
||||
this.flowPanelLeft.Controls.Add(this.checkOpenSearchInFirstColumn);
|
||||
this.flowPanelLeft.Controls.Add(this.checkKeepLikeFollowDialogsOpen);
|
||||
this.flowPanelLeft.Controls.Add(this.checkBestImageQuality);
|
||||
this.flowPanelLeft.Controls.Add(this.checkAnimatedAvatars);
|
||||
this.flowPanelLeft.Controls.Add(this.labelBrowserSettings);
|
||||
this.flowPanelLeft.Controls.Add(this.checkSmoothScrolling);
|
||||
this.flowPanelLeft.Controls.Add(this.checkTouchAdjustment);
|
||||
this.flowPanelLeft.Controls.Add(this.checkHardwareAcceleration);
|
||||
this.flowPanelLeft.Controls.Add(this.labelZoom);
|
||||
this.flowPanelLeft.Controls.Add(this.panelZoom);
|
||||
this.flowPanelLeft.Controls.Add(this.labelTray);
|
||||
this.flowPanelLeft.Controls.Add(this.comboBoxTrayType);
|
||||
this.flowPanelLeft.Controls.Add(this.labelTrayIcon);
|
||||
this.flowPanelLeft.Controls.Add(this.checkTrayHighlight);
|
||||
this.flowPanelLeft.Controls.Add(this.labelUpdates);
|
||||
this.flowPanelLeft.Controls.Add(this.checkUpdateNotifications);
|
||||
this.flowPanelLeft.Controls.Add(this.btnCheckUpdates);
|
||||
@@ -240,83 +249,50 @@
|
||||
this.flowPanelLeft.TabIndex = 0;
|
||||
this.flowPanelLeft.WrapContents = false;
|
||||
//
|
||||
// checkFocusDmInput
|
||||
//
|
||||
this.checkFocusDmInput.AutoSize = true;
|
||||
this.checkFocusDmInput.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkFocusDmInput.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkFocusDmInput.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkFocusDmInput.Name = "checkFocusDmInput";
|
||||
this.checkFocusDmInput.Size = new System.Drawing.Size(282, 19);
|
||||
this.checkFocusDmInput.TabIndex = 2;
|
||||
this.checkFocusDmInput.Text = "Focus Input Field When Opening Direct Message";
|
||||
this.checkFocusDmInput.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkKeepLikeFollowDialogsOpen
|
||||
//
|
||||
this.checkKeepLikeFollowDialogsOpen.AutoSize = true;
|
||||
this.checkKeepLikeFollowDialogsOpen.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkKeepLikeFollowDialogsOpen.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkKeepLikeFollowDialogsOpen.Location = new System.Drawing.Point(6, 98);
|
||||
this.checkKeepLikeFollowDialogsOpen.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkKeepLikeFollowDialogsOpen.Name = "checkKeepLikeFollowDialogsOpen";
|
||||
this.checkKeepLikeFollowDialogsOpen.Size = new System.Drawing.Size(190, 19);
|
||||
this.checkKeepLikeFollowDialogsOpen.TabIndex = 3;
|
||||
this.checkKeepLikeFollowDialogsOpen.TabIndex = 4;
|
||||
this.checkKeepLikeFollowDialogsOpen.Text = "Keep Like/Follow Dialogs Open";
|
||||
this.checkKeepLikeFollowDialogsOpen.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelTray
|
||||
//
|
||||
this.labelTray.AutoSize = true;
|
||||
this.labelTray.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTray.Location = new System.Drawing.Point(0, 236);
|
||||
this.labelTray.Margin = new System.Windows.Forms.Padding(0, 30, 0, 1);
|
||||
this.labelTray.Name = "labelTray";
|
||||
this.labelTray.Size = new System.Drawing.Size(99, 19);
|
||||
this.labelTray.TabIndex = 8;
|
||||
this.labelTray.Text = "SYSTEM TRAY";
|
||||
//
|
||||
// comboBoxTrayType
|
||||
//
|
||||
this.comboBoxTrayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxTrayType.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxTrayType.FormattingEnabled = true;
|
||||
this.comboBoxTrayType.Location = new System.Drawing.Point(5, 260);
|
||||
this.comboBoxTrayType.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxTrayType.Name = "comboBoxTrayType";
|
||||
this.comboBoxTrayType.Size = new System.Drawing.Size(144, 23);
|
||||
this.comboBoxTrayType.TabIndex = 9;
|
||||
//
|
||||
// labelTrayIcon
|
||||
//
|
||||
this.labelTrayIcon.AutoSize = true;
|
||||
this.labelTrayIcon.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTrayIcon.Location = new System.Drawing.Point(3, 295);
|
||||
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||
this.labelTrayIcon.Name = "labelTrayIcon";
|
||||
this.labelTrayIcon.Size = new System.Drawing.Size(56, 15);
|
||||
this.labelTrayIcon.TabIndex = 10;
|
||||
this.labelTrayIcon.Text = "Tray Icon";
|
||||
//
|
||||
// checkTrayHighlight
|
||||
//
|
||||
this.checkTrayHighlight.AutoSize = true;
|
||||
this.checkTrayHighlight.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkTrayHighlight.Location = new System.Drawing.Point(6, 316);
|
||||
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkTrayHighlight.Name = "checkTrayHighlight";
|
||||
this.checkTrayHighlight.Size = new System.Drawing.Size(114, 19);
|
||||
this.checkTrayHighlight.TabIndex = 11;
|
||||
this.checkTrayHighlight.Text = "Enable Highlight";
|
||||
this.checkTrayHighlight.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBrowserSettings
|
||||
//
|
||||
this.labelBrowserSettings.AutoSize = true;
|
||||
this.labelBrowserSettings.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelBrowserSettings.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelBrowserSettings.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelBrowserSettings.Location = new System.Drawing.Point(0, 192);
|
||||
this.labelBrowserSettings.Margin = new System.Windows.Forms.Padding(0, 25, 0, 1);
|
||||
this.labelBrowserSettings.Name = "labelBrowserSettings";
|
||||
this.labelBrowserSettings.Size = new System.Drawing.Size(143, 19);
|
||||
this.labelBrowserSettings.TabIndex = 0;
|
||||
this.labelBrowserSettings.TabIndex = 7;
|
||||
this.labelBrowserSettings.Text = "BROWSER SETTINGS";
|
||||
//
|
||||
// checkSmoothScrolling
|
||||
//
|
||||
this.checkSmoothScrolling.AutoSize = true;
|
||||
this.checkSmoothScrolling.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkSmoothScrolling.Location = new System.Drawing.Point(6, 26);
|
||||
this.checkSmoothScrolling.Location = new System.Drawing.Point(6, 218);
|
||||
this.checkSmoothScrolling.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkSmoothScrolling.Name = "checkSmoothScrolling";
|
||||
this.checkSmoothScrolling.Size = new System.Drawing.Size(117, 19);
|
||||
this.checkSmoothScrolling.TabIndex = 1;
|
||||
this.checkSmoothScrolling.TabIndex = 8;
|
||||
this.checkSmoothScrolling.Text = "Smooth Scrolling";
|
||||
this.checkSmoothScrolling.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -324,45 +300,57 @@
|
||||
//
|
||||
this.checkTouchAdjustment.AutoSize = true;
|
||||
this.checkTouchAdjustment.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkTouchAdjustment.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkTouchAdjustment.Location = new System.Drawing.Point(6, 242);
|
||||
this.checkTouchAdjustment.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkTouchAdjustment.Name = "checkTouchAdjustment";
|
||||
this.checkTouchAdjustment.Size = new System.Drawing.Size(163, 19);
|
||||
this.checkTouchAdjustment.TabIndex = 2;
|
||||
this.checkTouchAdjustment.TabIndex = 9;
|
||||
this.checkTouchAdjustment.Text = "Touch Screen Adjustment";
|
||||
this.checkTouchAdjustment.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkHardwareAcceleration
|
||||
//
|
||||
this.checkHardwareAcceleration.AutoSize = true;
|
||||
this.checkHardwareAcceleration.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 266);
|
||||
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
|
||||
this.checkHardwareAcceleration.Size = new System.Drawing.Size(146, 19);
|
||||
this.checkHardwareAcceleration.TabIndex = 10;
|
||||
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
|
||||
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBrowserPath
|
||||
//
|
||||
this.labelBrowserPath.AutoSize = true;
|
||||
this.labelBrowserPath.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelBrowserPath.Location = new System.Drawing.Point(3, 107);
|
||||
this.labelBrowserPath.Location = new System.Drawing.Point(3, 275);
|
||||
this.labelBrowserPath.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelBrowserPath.Name = "labelBrowserPath";
|
||||
this.labelBrowserPath.Size = new System.Drawing.Size(104, 15);
|
||||
this.labelBrowserPath.TabIndex = 4;
|
||||
this.labelBrowserPath.TabIndex = 9;
|
||||
this.labelBrowserPath.Text = "Open Links With...";
|
||||
//
|
||||
// comboBoxBrowserPath
|
||||
// comboBoxCustomBrowser
|
||||
//
|
||||
this.comboBoxBrowserPath.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxBrowserPath.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxBrowserPath.FormattingEnabled = true;
|
||||
this.comboBoxBrowserPath.Location = new System.Drawing.Point(5, 126);
|
||||
this.comboBoxBrowserPath.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxBrowserPath.Name = "comboBoxBrowserPath";
|
||||
this.comboBoxBrowserPath.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxBrowserPath.TabIndex = 5;
|
||||
this.comboBoxCustomBrowser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxCustomBrowser.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxCustomBrowser.FormattingEnabled = true;
|
||||
this.comboBoxCustomBrowser.Location = new System.Drawing.Point(5, 1);
|
||||
this.comboBoxCustomBrowser.Margin = new System.Windows.Forms.Padding(5, 1, 3, 0);
|
||||
this.comboBoxCustomBrowser.Name = "comboBoxCustomBrowser";
|
||||
this.comboBoxCustomBrowser.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxCustomBrowser.TabIndex = 0;
|
||||
//
|
||||
// labelSearchEngine
|
||||
//
|
||||
this.labelSearchEngine.AutoSize = true;
|
||||
this.labelSearchEngine.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelSearchEngine.Location = new System.Drawing.Point(3, 164);
|
||||
this.labelSearchEngine.Location = new System.Drawing.Point(3, 389);
|
||||
this.labelSearchEngine.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelSearchEngine.Name = "labelSearchEngine";
|
||||
this.labelSearchEngine.Size = new System.Drawing.Size(82, 15);
|
||||
this.labelSearchEngine.TabIndex = 6;
|
||||
this.labelSearchEngine.TabIndex = 13;
|
||||
this.labelSearchEngine.Text = "Search Engine";
|
||||
//
|
||||
// comboBoxSearchEngine
|
||||
@@ -370,30 +358,31 @@
|
||||
this.comboBoxSearchEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSearchEngine.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxSearchEngine.FormattingEnabled = true;
|
||||
this.comboBoxSearchEngine.Location = new System.Drawing.Point(5, 183);
|
||||
this.comboBoxSearchEngine.Location = new System.Drawing.Point(5, 408);
|
||||
this.comboBoxSearchEngine.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxSearchEngine.Name = "comboBoxSearchEngine";
|
||||
this.comboBoxSearchEngine.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxSearchEngine.TabIndex = 7;
|
||||
this.comboBoxSearchEngine.TabIndex = 14;
|
||||
//
|
||||
// flowPanelRight
|
||||
//
|
||||
this.flowPanelRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanelRight.Controls.Add(this.labelBrowserSettings);
|
||||
this.flowPanelRight.Controls.Add(this.checkSmoothScrolling);
|
||||
this.flowPanelRight.Controls.Add(this.checkTouchAdjustment);
|
||||
this.flowPanelRight.Controls.Add(this.checkHardwareAcceleration);
|
||||
this.flowPanelRight.Controls.Add(this.labelBrowserPath);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxBrowserPath);
|
||||
this.flowPanelRight.Controls.Add(this.labelSearchEngine);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxSearchEngine);
|
||||
this.flowPanelRight.Controls.Add(this.labelLocales);
|
||||
this.flowPanelRight.Controls.Add(this.checkSpellCheck);
|
||||
this.flowPanelRight.Controls.Add(this.labelSpellCheckLanguage);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxSpellCheckLanguage);
|
||||
this.flowPanelRight.Controls.Add(this.labelTranslationTarget);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxTranslationTarget);
|
||||
this.flowPanelRight.Controls.Add(this.labelFirstDayOfWeek);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxFirstDayOfWeek);
|
||||
this.flowPanelRight.Controls.Add(this.labelExternalApplications);
|
||||
this.flowPanelRight.Controls.Add(this.labelBrowserPath);
|
||||
this.flowPanelRight.Controls.Add(this.panelCustomBrowser);
|
||||
this.flowPanelRight.Controls.Add(this.labelVideoPlayerPath);
|
||||
this.flowPanelRight.Controls.Add(this.panelCustomVideoPlayer);
|
||||
this.flowPanelRight.Controls.Add(this.labelSearchEngine);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxSearchEngine);
|
||||
this.flowPanelRight.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanelRight.Location = new System.Drawing.Point(322, 9);
|
||||
this.flowPanelRight.Name = "flowPanelRight";
|
||||
@@ -401,38 +390,26 @@
|
||||
this.flowPanelRight.TabIndex = 1;
|
||||
this.flowPanelRight.WrapContents = false;
|
||||
//
|
||||
// checkHardwareAcceleration
|
||||
//
|
||||
this.checkHardwareAcceleration.AutoSize = true;
|
||||
this.checkHardwareAcceleration.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
|
||||
this.checkHardwareAcceleration.Size = new System.Drawing.Size(146, 19);
|
||||
this.checkHardwareAcceleration.TabIndex = 3;
|
||||
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
|
||||
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelLocales
|
||||
//
|
||||
this.labelLocales.AutoSize = true;
|
||||
this.labelLocales.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelLocales.Location = new System.Drawing.Point(0, 236);
|
||||
this.labelLocales.Margin = new System.Windows.Forms.Padding(0, 27, 0, 1);
|
||||
this.labelLocales.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelLocales.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelLocales.Name = "labelLocales";
|
||||
this.labelLocales.Size = new System.Drawing.Size(67, 19);
|
||||
this.labelLocales.TabIndex = 8;
|
||||
this.labelLocales.TabIndex = 0;
|
||||
this.labelLocales.Text = "LOCALES";
|
||||
//
|
||||
// checkSpellCheck
|
||||
//
|
||||
this.checkSpellCheck.AutoSize = true;
|
||||
this.checkSpellCheck.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkSpellCheck.Location = new System.Drawing.Point(6, 262);
|
||||
this.checkSpellCheck.Location = new System.Drawing.Point(6, 26);
|
||||
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkSpellCheck.Name = "checkSpellCheck";
|
||||
this.checkSpellCheck.Size = new System.Drawing.Size(125, 19);
|
||||
this.checkSpellCheck.TabIndex = 9;
|
||||
this.checkSpellCheck.TabIndex = 1;
|
||||
this.checkSpellCheck.Text = "Enable Spell Check";
|
||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -440,11 +417,11 @@
|
||||
//
|
||||
this.labelSpellCheckLanguage.AutoSize = true;
|
||||
this.labelSpellCheckLanguage.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelSpellCheckLanguage.Location = new System.Drawing.Point(3, 295);
|
||||
this.labelSpellCheckLanguage.Location = new System.Drawing.Point(3, 59);
|
||||
this.labelSpellCheckLanguage.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelSpellCheckLanguage.Name = "labelSpellCheckLanguage";
|
||||
this.labelSpellCheckLanguage.Size = new System.Drawing.Size(123, 15);
|
||||
this.labelSpellCheckLanguage.TabIndex = 10;
|
||||
this.labelSpellCheckLanguage.TabIndex = 2;
|
||||
this.labelSpellCheckLanguage.Text = "Spell Check Language";
|
||||
//
|
||||
// comboBoxSpellCheckLanguage
|
||||
@@ -452,21 +429,21 @@
|
||||
this.comboBoxSpellCheckLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSpellCheckLanguage.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxSpellCheckLanguage.FormattingEnabled = true;
|
||||
this.comboBoxSpellCheckLanguage.Location = new System.Drawing.Point(5, 314);
|
||||
this.comboBoxSpellCheckLanguage.Location = new System.Drawing.Point(5, 78);
|
||||
this.comboBoxSpellCheckLanguage.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxSpellCheckLanguage.Name = "comboBoxSpellCheckLanguage";
|
||||
this.comboBoxSpellCheckLanguage.Size = new System.Drawing.Size(290, 23);
|
||||
this.comboBoxSpellCheckLanguage.TabIndex = 11;
|
||||
this.comboBoxSpellCheckLanguage.TabIndex = 3;
|
||||
//
|
||||
// labelTranslationTarget
|
||||
//
|
||||
this.labelTranslationTarget.AutoSize = true;
|
||||
this.labelTranslationTarget.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTranslationTarget.Location = new System.Drawing.Point(3, 352);
|
||||
this.labelTranslationTarget.Location = new System.Drawing.Point(3, 116);
|
||||
this.labelTranslationTarget.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelTranslationTarget.Name = "labelTranslationTarget";
|
||||
this.labelTranslationTarget.Size = new System.Drawing.Size(142, 15);
|
||||
this.labelTranslationTarget.TabIndex = 12;
|
||||
this.labelTranslationTarget.TabIndex = 4;
|
||||
this.labelTranslationTarget.Text = "Bing Translator Language";
|
||||
//
|
||||
// comboBoxTranslationTarget
|
||||
@@ -474,11 +451,114 @@
|
||||
this.comboBoxTranslationTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxTranslationTarget.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxTranslationTarget.FormattingEnabled = true;
|
||||
this.comboBoxTranslationTarget.Location = new System.Drawing.Point(5, 371);
|
||||
this.comboBoxTranslationTarget.Location = new System.Drawing.Point(5, 135);
|
||||
this.comboBoxTranslationTarget.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxTranslationTarget.Name = "comboBoxTranslationTarget";
|
||||
this.comboBoxTranslationTarget.Size = new System.Drawing.Size(290, 23);
|
||||
this.comboBoxTranslationTarget.TabIndex = 13;
|
||||
this.comboBoxTranslationTarget.TabIndex = 5;
|
||||
//
|
||||
// labelFirstDayOfWeek
|
||||
//
|
||||
this.labelFirstDayOfWeek.AutoSize = true;
|
||||
this.labelFirstDayOfWeek.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelFirstDayOfWeek.Location = new System.Drawing.Point(3, 173);
|
||||
this.labelFirstDayOfWeek.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelFirstDayOfWeek.Name = "labelFirstDayOfWeek";
|
||||
this.labelFirstDayOfWeek.Size = new System.Drawing.Size(125, 15);
|
||||
this.labelFirstDayOfWeek.TabIndex = 6;
|
||||
this.labelFirstDayOfWeek.Text = "First Day Of The Week";
|
||||
//
|
||||
// comboBoxFirstDayOfWeek
|
||||
//
|
||||
this.comboBoxFirstDayOfWeek.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxFirstDayOfWeek.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxFirstDayOfWeek.FormattingEnabled = true;
|
||||
this.comboBoxFirstDayOfWeek.Location = new System.Drawing.Point(5, 192);
|
||||
this.comboBoxFirstDayOfWeek.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxFirstDayOfWeek.Name = "comboBoxFirstDayOfWeek";
|
||||
this.comboBoxFirstDayOfWeek.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxFirstDayOfWeek.TabIndex = 7;
|
||||
//
|
||||
// labelExternalApplications
|
||||
//
|
||||
this.labelExternalApplications.AutoSize = true;
|
||||
this.labelExternalApplications.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelExternalApplications.Location = new System.Drawing.Point(0, 243);
|
||||
this.labelExternalApplications.Margin = new System.Windows.Forms.Padding(0, 25, 0, 1);
|
||||
this.labelExternalApplications.Name = "labelExternalApplications";
|
||||
this.labelExternalApplications.Size = new System.Drawing.Size(176, 19);
|
||||
this.labelExternalApplications.TabIndex = 8;
|
||||
this.labelExternalApplications.Text = "EXTERNAL APPLICATIONS";
|
||||
//
|
||||
// panelCustomBrowser
|
||||
//
|
||||
this.panelCustomBrowser.Controls.Add(this.comboBoxCustomBrowser);
|
||||
this.panelCustomBrowser.Controls.Add(this.btnCustomBrowserChange);
|
||||
this.panelCustomBrowser.Location = new System.Drawing.Point(0, 293);
|
||||
this.panelCustomBrowser.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
||||
this.panelCustomBrowser.Name = "panelCustomBrowser";
|
||||
this.panelCustomBrowser.Size = new System.Drawing.Size(300, 24);
|
||||
this.panelCustomBrowser.TabIndex = 10;
|
||||
//
|
||||
// btnCustomBrowserChange
|
||||
//
|
||||
this.btnCustomBrowserChange.AutoSize = true;
|
||||
this.btnCustomBrowserChange.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnCustomBrowserChange.Location = new System.Drawing.Point(186, 0);
|
||||
this.btnCustomBrowserChange.Margin = new System.Windows.Forms.Padding(5, 0, 3, 0);
|
||||
this.btnCustomBrowserChange.Name = "btnCustomBrowserChange";
|
||||
this.btnCustomBrowserChange.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnCustomBrowserChange.Size = new System.Drawing.Size(71, 25);
|
||||
this.btnCustomBrowserChange.TabIndex = 1;
|
||||
this.btnCustomBrowserChange.Text = "Change...";
|
||||
this.btnCustomBrowserChange.UseVisualStyleBackColor = true;
|
||||
this.btnCustomBrowserChange.Visible = false;
|
||||
//
|
||||
// labelVideoPlayerPath
|
||||
//
|
||||
this.labelVideoPlayerPath.AutoSize = true;
|
||||
this.labelVideoPlayerPath.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelVideoPlayerPath.Location = new System.Drawing.Point(3, 332);
|
||||
this.labelVideoPlayerPath.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelVideoPlayerPath.Name = "labelVideoPlayerPath";
|
||||
this.labelVideoPlayerPath.Size = new System.Drawing.Size(106, 15);
|
||||
this.labelVideoPlayerPath.TabIndex = 11;
|
||||
this.labelVideoPlayerPath.Text = "Play Videos With...";
|
||||
//
|
||||
// panelCustomVideoPlayer
|
||||
//
|
||||
this.panelCustomVideoPlayer.Controls.Add(this.comboBoxCustomVideoPlayer);
|
||||
this.panelCustomVideoPlayer.Controls.Add(this.btnCustomVideoPlayerChange);
|
||||
this.panelCustomVideoPlayer.Location = new System.Drawing.Point(0, 350);
|
||||
this.panelCustomVideoPlayer.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
||||
this.panelCustomVideoPlayer.Name = "panelCustomVideoPlayer";
|
||||
this.panelCustomVideoPlayer.Size = new System.Drawing.Size(300, 24);
|
||||
this.panelCustomVideoPlayer.TabIndex = 12;
|
||||
//
|
||||
// comboBoxCustomVideoPlayer
|
||||
//
|
||||
this.comboBoxCustomVideoPlayer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxCustomVideoPlayer.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxCustomVideoPlayer.FormattingEnabled = true;
|
||||
this.comboBoxCustomVideoPlayer.Location = new System.Drawing.Point(5, 1);
|
||||
this.comboBoxCustomVideoPlayer.Margin = new System.Windows.Forms.Padding(5, 1, 3, 0);
|
||||
this.comboBoxCustomVideoPlayer.Name = "comboBoxCustomVideoPlayer";
|
||||
this.comboBoxCustomVideoPlayer.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxCustomVideoPlayer.TabIndex = 0;
|
||||
//
|
||||
// btnCustomVideoPlayerChange
|
||||
//
|
||||
this.btnCustomVideoPlayerChange.AutoSize = true;
|
||||
this.btnCustomVideoPlayerChange.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnCustomVideoPlayerChange.Location = new System.Drawing.Point(186, 0);
|
||||
this.btnCustomVideoPlayerChange.Margin = new System.Windows.Forms.Padding(5, 0, 3, 0);
|
||||
this.btnCustomVideoPlayerChange.Name = "btnCustomVideoPlayerChange";
|
||||
this.btnCustomVideoPlayerChange.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnCustomVideoPlayerChange.Size = new System.Drawing.Size(71, 25);
|
||||
this.btnCustomVideoPlayerChange.TabIndex = 1;
|
||||
this.btnCustomVideoPlayerChange.Text = "Change...";
|
||||
this.btnCustomVideoPlayerChange.UseVisualStyleBackColor = true;
|
||||
this.btnCustomVideoPlayerChange.Visible = false;
|
||||
//
|
||||
// panelSeparator
|
||||
//
|
||||
@@ -506,6 +586,10 @@
|
||||
this.flowPanelLeft.PerformLayout();
|
||||
this.flowPanelRight.ResumeLayout(false);
|
||||
this.flowPanelRight.PerformLayout();
|
||||
this.panelCustomBrowser.ResumeLayout(false);
|
||||
this.panelCustomBrowser.PerformLayout();
|
||||
this.panelCustomVideoPlayer.ResumeLayout(false);
|
||||
this.panelCustomVideoPlayer.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -529,7 +613,7 @@
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelLeft;
|
||||
private System.Windows.Forms.CheckBox checkKeepLikeFollowDialogsOpen;
|
||||
private System.Windows.Forms.Label labelBrowserPath;
|
||||
private System.Windows.Forms.ComboBox comboBoxBrowserPath;
|
||||
private System.Windows.Forms.ComboBox comboBoxCustomBrowser;
|
||||
private System.Windows.Forms.Label labelBrowserSettings;
|
||||
private System.Windows.Forms.CheckBox checkSmoothScrolling;
|
||||
private System.Windows.Forms.Label labelSearchEngine;
|
||||
@@ -537,10 +621,6 @@
|
||||
private System.Windows.Forms.CheckBox checkTouchAdjustment;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelRight;
|
||||
private System.Windows.Forms.Panel panelSeparator;
|
||||
private System.Windows.Forms.Label labelTray;
|
||||
private System.Windows.Forms.ComboBox comboBoxTrayType;
|
||||
private System.Windows.Forms.Label labelTrayIcon;
|
||||
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
||||
private System.Windows.Forms.Label labelLocales;
|
||||
private System.Windows.Forms.CheckBox checkSpellCheck;
|
||||
private System.Windows.Forms.Label labelSpellCheckLanguage;
|
||||
@@ -548,5 +628,15 @@
|
||||
private System.Windows.Forms.Label labelTranslationTarget;
|
||||
private System.Windows.Forms.ComboBox comboBoxTranslationTarget;
|
||||
private System.Windows.Forms.CheckBox checkHardwareAcceleration;
|
||||
private System.Windows.Forms.CheckBox checkFocusDmInput;
|
||||
private System.Windows.Forms.Panel panelCustomBrowser;
|
||||
private System.Windows.Forms.Button btnCustomBrowserChange;
|
||||
private System.Windows.Forms.Label labelVideoPlayerPath;
|
||||
private System.Windows.Forms.Panel panelCustomVideoPlayer;
|
||||
private System.Windows.Forms.ComboBox comboBoxCustomVideoPlayer;
|
||||
private System.Windows.Forms.Button btnCustomVideoPlayerChange;
|
||||
private System.Windows.Forms.Label labelExternalApplications;
|
||||
private System.Windows.Forms.Label labelFirstDayOfWeek;
|
||||
private System.Windows.Forms.ComboBox comboBoxFirstDayOfWeek;
|
||||
}
|
||||
}
|
@@ -2,14 +2,14 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Updates;
|
||||
using TweetDuck.Browser.Handling.General;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Core.Systems.Updates;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsGeneral : BaseTabSettings{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class TabSettingsGeneral : FormSettings.BaseTab{
|
||||
private readonly Action reloadColumns;
|
||||
|
||||
private readonly UpdateHandler updates;
|
||||
@@ -18,6 +18,9 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
private readonly int browserListIndexDefault;
|
||||
private readonly int browserListIndexCustom;
|
||||
|
||||
private readonly int videoPlayerListIndexDefault;
|
||||
private readonly int videoPlayerListIndexCustom;
|
||||
|
||||
private readonly int searchEngineIndexDefault;
|
||||
private readonly int searchEngineIndexCustom;
|
||||
|
||||
@@ -34,6 +37,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
// user interface
|
||||
|
||||
toolTip.SetToolTip(checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a tooltip instead.");
|
||||
toolTip.SetToolTip(checkFocusDmInput, "Places cursor into Direct Message input\r\nfield when opening a conversation.");
|
||||
toolTip.SetToolTip(checkOpenSearchInFirstColumn, "By default, TweetDeck adds Search columns at the end.\r\nThis option makes them appear before the first column instead.");
|
||||
toolTip.SetToolTip(checkKeepLikeFollowDialogsOpen, "Allows liking and following from multiple accounts at once,\r\ninstead of automatically closing the dialog after taking an action.");
|
||||
toolTip.SetToolTip(checkBestImageQuality, "When right-clicking a tweet image, the context menu options\r\nwill use links to the original image size (:orig in the URL).");
|
||||
@@ -42,28 +46,14 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
toolTip.SetToolTip(trackBarZoom, toolTip.GetToolTip(labelZoomValue));
|
||||
|
||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||
checkFocusDmInput.Checked = Config.FocusDmInput;
|
||||
checkOpenSearchInFirstColumn.Checked = Config.OpenSearchInFirstColumn;
|
||||
checkKeepLikeFollowDialogsOpen.Checked = Config.KeepLikeFollowDialogsOpen;
|
||||
checkBestImageQuality.Checked = Config.BestImageQuality;
|
||||
checkAnimatedAvatars.Checked = Config.EnableAnimatedImages;
|
||||
|
||||
trackBarZoom.SetValueSafe(Config.ZoomLevel);
|
||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||
|
||||
// system tray
|
||||
|
||||
toolTip.SetToolTip(comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
|
||||
toolTip.SetToolTip(checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with popup or audio notifications.\r\nThe icon resets when the main window is restored.");
|
||||
|
||||
comboBoxTrayType.Items.Add("Disabled");
|
||||
comboBoxTrayType.Items.Add("Display Icon Only");
|
||||
comboBoxTrayType.Items.Add("Minimize to Tray");
|
||||
comboBoxTrayType.Items.Add("Close to Tray");
|
||||
comboBoxTrayType.Items.Add("Combined");
|
||||
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
||||
|
||||
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
|
||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||
labelZoomValue.Text = trackBarZoom.Value + "%";
|
||||
|
||||
// updates
|
||||
|
||||
@@ -77,7 +67,8 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
toolTip.SetToolTip(checkSmoothScrolling, "Toggles smooth mouse wheel scrolling.");
|
||||
toolTip.SetToolTip(checkTouchAdjustment, "Toggles Chromium touch screen adjustment.\r\nDisabled by default, because it is very imprecise with TweetDeck.");
|
||||
toolTip.SetToolTip(checkHardwareAcceleration, "Uses graphics card to improve performance.\r\nDisable if you experience visual glitches, or to save a small amount of RAM.");
|
||||
toolTip.SetToolTip(comboBoxBrowserPath, "Sets the default browser for opening links.");
|
||||
toolTip.SetToolTip(comboBoxCustomBrowser, "Sets the default browser for opening links.");
|
||||
toolTip.SetToolTip(comboBoxCustomVideoPlayer, "Sets the default application for playing videos.");
|
||||
toolTip.SetToolTip(comboBoxSearchEngine, "Sets the default website for opening searches.");
|
||||
|
||||
checkSmoothScrolling.Checked = Config.EnableSmoothScrolling;
|
||||
@@ -85,13 +76,17 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
checkHardwareAcceleration.Checked = SysConfig.HardwareAcceleration;
|
||||
|
||||
foreach(WindowsUtils.Browser browserInfo in WindowsUtils.FindInstalledBrowsers()){
|
||||
comboBoxBrowserPath.Items.Add(browserInfo);
|
||||
comboBoxCustomBrowser.Items.Add(browserInfo);
|
||||
}
|
||||
|
||||
browserListIndexDefault = comboBoxBrowserPath.Items.Add("(default browser)");
|
||||
browserListIndexCustom = comboBoxBrowserPath.Items.Add("(custom program...)");
|
||||
browserListIndexDefault = comboBoxCustomBrowser.Items.Add("(default browser)");
|
||||
browserListIndexCustom = comboBoxCustomBrowser.Items.Add("(custom program...)");
|
||||
UpdateBrowserPathSelection();
|
||||
|
||||
videoPlayerListIndexDefault = comboBoxCustomVideoPlayer.Items.Add("(default TweetDuck player)");
|
||||
videoPlayerListIndexCustom = comboBoxCustomVideoPlayer.Items.Add("(custom program...)");
|
||||
UpdateVideoPlayerPathSelection();
|
||||
|
||||
comboBoxSearchEngine.Items.Add(new SearchEngine("DuckDuckGo", "https://duckduckgo.com/?q="));
|
||||
comboBoxSearchEngine.Items.Add(new SearchEngine("Google", "https://www.google.com/search?q="));
|
||||
comboBoxSearchEngine.Items.Add(new SearchEngine("Bing", "https://www.bing.com/search?q="));
|
||||
@@ -105,6 +100,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
toolTip.SetToolTip(checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||
toolTip.SetToolTip(comboBoxSpellCheckLanguage, "Language used for spell check.");
|
||||
toolTip.SetToolTip(comboBoxTranslationTarget, "Language tweets are translated into.");
|
||||
toolTip.SetToolTip(comboBoxFirstDayOfWeek, "First day of week used in the date picker.");
|
||||
|
||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||
|
||||
@@ -123,31 +119,44 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
|
||||
comboBoxTranslationTarget.SelectedItem = new LocaleUtils.Item(Config.TranslationTarget);
|
||||
|
||||
var daysOfWeek = comboBoxFirstDayOfWeek.Items;
|
||||
daysOfWeek.Add("(based on system locale)");
|
||||
daysOfWeek.Add(new DayOfWeekItem("Monday", DayOfWeek.Monday));
|
||||
daysOfWeek.Add(new DayOfWeekItem("Tuesday", DayOfWeek.Tuesday));
|
||||
daysOfWeek.Add(new DayOfWeekItem("Wednesday", DayOfWeek.Wednesday));
|
||||
daysOfWeek.Add(new DayOfWeekItem("Thursday", DayOfWeek.Thursday));
|
||||
daysOfWeek.Add(new DayOfWeekItem("Friday", DayOfWeek.Friday));
|
||||
daysOfWeek.Add(new DayOfWeekItem("Saturday", DayOfWeek.Saturday));
|
||||
daysOfWeek.Add(new DayOfWeekItem("Sunday", DayOfWeek.Sunday));
|
||||
comboBoxFirstDayOfWeek.SelectedItem = daysOfWeek.OfType<DayOfWeekItem>().FirstOrDefault(dow => dow.Id == Config.CalendarFirstDay) ?? daysOfWeek[0];
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||
checkFocusDmInput.CheckedChanged += checkFocusDmInput_CheckedChanged;
|
||||
checkOpenSearchInFirstColumn.CheckedChanged += checkOpenSearchInFirstColumn_CheckedChanged;
|
||||
checkKeepLikeFollowDialogsOpen.CheckedChanged += checkKeepLikeFollowDialogsOpen_CheckedChanged;
|
||||
checkBestImageQuality.CheckedChanged += checkBestImageQuality_CheckedChanged;
|
||||
checkAnimatedAvatars.CheckedChanged += checkAnimatedAvatars_CheckedChanged;
|
||||
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
|
||||
|
||||
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
||||
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
||||
|
||||
checkUpdateNotifications.CheckedChanged += checkUpdateNotifications_CheckedChanged;
|
||||
btnCheckUpdates.Click += btnCheckUpdates_Click;
|
||||
|
||||
checkSmoothScrolling.CheckedChanged += checkSmoothScrolling_CheckedChanged;
|
||||
checkTouchAdjustment.CheckedChanged += checkTouchAdjustment_CheckedChanged;
|
||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
||||
comboBoxBrowserPath.SelectedIndexChanged += comboBoxBrowserPath_SelectedIndexChanged;
|
||||
comboBoxCustomBrowser.SelectedIndexChanged += comboBoxCustomBrowser_SelectedIndexChanged;
|
||||
btnCustomBrowserChange.Click += btnCustomBrowserChange_Click;
|
||||
comboBoxCustomVideoPlayer.SelectedIndexChanged += comboBoxCustomVideoPlayer_SelectedIndexChanged;
|
||||
btnCustomVideoPlayerChange.Click += btnCustomVideoPlayerChange_Click;
|
||||
comboBoxSearchEngine.SelectedIndexChanged += comboBoxSearchEngine_SelectedIndexChanged;
|
||||
|
||||
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||
comboBoxSpellCheckLanguage.SelectedValueChanged += comboBoxSpellCheckLanguage_SelectedValueChanged;
|
||||
comboBoxTranslationTarget.SelectedValueChanged += comboBoxTranslationTarget_SelectedValueChanged;
|
||||
comboBoxFirstDayOfWeek.SelectedValueChanged += comboBoxFirstDayOfWeek_SelectedValueChanged;
|
||||
}
|
||||
|
||||
public override void OnClosing(){
|
||||
@@ -160,6 +169,10 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
||||
}
|
||||
|
||||
private void checkFocusDmInput_CheckedChanged(object sender, EventArgs e){
|
||||
Config.FocusDmInput = checkFocusDmInput.Checked;
|
||||
}
|
||||
|
||||
private void checkOpenSearchInFirstColumn_CheckedChanged(object sender, EventArgs e){
|
||||
Config.OpenSearchInFirstColumn = checkOpenSearchInFirstColumn.Checked;
|
||||
}
|
||||
@@ -181,7 +194,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
if (trackBarZoom.AlignValueToTick()){
|
||||
zoomUpdateTimer.Stop();
|
||||
zoomUpdateTimer.Start();
|
||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||
labelZoomValue.Text = trackBarZoom.Value + "%";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,18 +203,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
zoomUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region System Tray
|
||||
|
||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
|
||||
}
|
||||
|
||||
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Updates
|
||||
|
||||
@@ -245,43 +246,95 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
SysConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||
}
|
||||
|
||||
private void UpdateBrowserChangeButton(){
|
||||
btnCustomBrowserChange.Visible = comboBoxCustomBrowser.SelectedIndex == browserListIndexCustom;
|
||||
}
|
||||
|
||||
private void UpdateBrowserPathSelection(){
|
||||
if (string.IsNullOrEmpty(Config.BrowserPath) || !File.Exists(Config.BrowserPath)){
|
||||
comboBoxBrowserPath.SelectedIndex = browserListIndexDefault;
|
||||
comboBoxCustomBrowser.SelectedIndex = browserListIndexDefault;
|
||||
}
|
||||
else{
|
||||
WindowsUtils.Browser browserInfo = comboBoxBrowserPath.Items.OfType<WindowsUtils.Browser>().FirstOrDefault(browser => browser.Path == Config.BrowserPath);
|
||||
WindowsUtils.Browser browserInfo = comboBoxCustomBrowser.Items.OfType<WindowsUtils.Browser>().FirstOrDefault(browser => browser.Path == Config.BrowserPath);
|
||||
|
||||
if (browserInfo == null){
|
||||
comboBoxBrowserPath.SelectedIndex = browserListIndexCustom;
|
||||
if (browserInfo == null || Config.BrowserPathArgs != null){
|
||||
comboBoxCustomBrowser.SelectedIndex = browserListIndexCustom;
|
||||
}
|
||||
else{
|
||||
comboBoxBrowserPath.SelectedItem = browserInfo;
|
||||
}
|
||||
comboBoxCustomBrowser.SelectedItem = browserInfo;
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxBrowserPath_SelectedIndexChanged(object sender, EventArgs e){
|
||||
if (comboBoxBrowserPath.SelectedIndex == browserListIndexCustom){
|
||||
using(OpenFileDialog dialog = new OpenFileDialog{
|
||||
AutoUpgradeEnabled = true,
|
||||
DereferenceLinks = true,
|
||||
InitialDirectory = Path.GetDirectoryName(Config.BrowserPath), // returns null if argument is null
|
||||
Title = "Open Links With...",
|
||||
Filter = "Executables (*.exe;*.bat;*.cmd)|*.exe;*.bat;*.cmd|All Files (*.*)|*.*"
|
||||
UpdateBrowserChangeButton();
|
||||
}
|
||||
|
||||
private void comboBoxCustomBrowser_SelectedIndexChanged(object sender, EventArgs e){
|
||||
if (comboBoxCustomBrowser.SelectedIndex == browserListIndexCustom){
|
||||
btnCustomBrowserChange_Click(sender, e);
|
||||
}
|
||||
else{
|
||||
Config.BrowserPath = (comboBoxCustomBrowser.SelectedItem as WindowsUtils.Browser)?.Path; // default browser item is a string and casts to null
|
||||
Config.BrowserPathArgs = null;
|
||||
UpdateBrowserChangeButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCustomBrowserChange_Click(object sender, EventArgs e){
|
||||
using(DialogSettingsExternalProgram dialog = new DialogSettingsExternalProgram("External Browser", "Open Links With..."){
|
||||
Path = Config.BrowserPath,
|
||||
Args = Config.BrowserPathArgs
|
||||
}){
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
Config.BrowserPath = dialog.FileName;
|
||||
Config.BrowserPath = dialog.Path;
|
||||
Config.BrowserPathArgs = dialog.Args;
|
||||
}
|
||||
}
|
||||
|
||||
comboBoxBrowserPath.SelectedIndexChanged -= comboBoxBrowserPath_SelectedIndexChanged;
|
||||
comboBoxCustomBrowser.SelectedIndexChanged -= comboBoxCustomBrowser_SelectedIndexChanged;
|
||||
UpdateBrowserPathSelection();
|
||||
comboBoxBrowserPath.SelectedIndexChanged += comboBoxBrowserPath_SelectedIndexChanged;
|
||||
comboBoxCustomBrowser.SelectedIndexChanged += comboBoxCustomBrowser_SelectedIndexChanged;
|
||||
}
|
||||
|
||||
private void UpdateVideoPlayerChangeButton(){
|
||||
btnCustomVideoPlayerChange.Visible = comboBoxCustomVideoPlayer.SelectedIndex == videoPlayerListIndexCustom;
|
||||
}
|
||||
|
||||
private void UpdateVideoPlayerPathSelection(){
|
||||
if (string.IsNullOrEmpty(Config.VideoPlayerPath) || !File.Exists(Config.VideoPlayerPath)){
|
||||
comboBoxCustomVideoPlayer.SelectedIndex = videoPlayerListIndexDefault;
|
||||
}
|
||||
else{
|
||||
Config.BrowserPath = (comboBoxBrowserPath.SelectedItem as WindowsUtils.Browser)?.Path; // default browser item is a string and casts to null
|
||||
comboBoxCustomVideoPlayer.SelectedIndex = videoPlayerListIndexCustom;
|
||||
}
|
||||
|
||||
UpdateVideoPlayerChangeButton();
|
||||
}
|
||||
|
||||
private void comboBoxCustomVideoPlayer_SelectedIndexChanged(object sender, EventArgs e){
|
||||
if (comboBoxCustomVideoPlayer.SelectedIndex == videoPlayerListIndexCustom){
|
||||
btnCustomVideoPlayerChange_Click(sender, e);
|
||||
}
|
||||
else{
|
||||
Config.VideoPlayerPath = null;
|
||||
Config.VideoPlayerPathArgs = null;
|
||||
UpdateVideoPlayerChangeButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCustomVideoPlayerChange_Click(object sender, EventArgs e){
|
||||
using(DialogSettingsExternalProgram dialog = new DialogSettingsExternalProgram("External Video Player", "Play Videos With..."){
|
||||
Path = Config.VideoPlayerPath,
|
||||
Args = Config.VideoPlayerPathArgs
|
||||
}){
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
Config.VideoPlayerPath = dialog.Path;
|
||||
Config.VideoPlayerPathArgs = dialog.Args;
|
||||
}
|
||||
}
|
||||
|
||||
comboBoxCustomVideoPlayer.SelectedIndexChanged -= comboBoxCustomVideoPlayer_SelectedIndexChanged;
|
||||
UpdateVideoPlayerPathSelection();
|
||||
comboBoxCustomVideoPlayer.SelectedIndexChanged += comboBoxCustomVideoPlayer_SelectedIndexChanged;
|
||||
}
|
||||
|
||||
private void comboBoxSearchEngine_SelectedIndexChanged(object sender, EventArgs e){
|
||||
@@ -347,6 +400,24 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.TranslationTarget = (comboBoxTranslationTarget.SelectedItem as LocaleUtils.Item)?.Code ?? "en";
|
||||
}
|
||||
|
||||
private void comboBoxFirstDayOfWeek_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.CalendarFirstDay = (comboBoxFirstDayOfWeek.SelectedItem as DayOfWeekItem)?.Id ?? -1;
|
||||
}
|
||||
|
||||
private sealed class DayOfWeekItem{
|
||||
private string Name { get; }
|
||||
public int Id { get; }
|
||||
|
||||
public DayOfWeekItem(string name, DayOfWeek dow){
|
||||
Name = name;
|
||||
Id = LocaleUtils.GetJQueryDayOfWeek(dow);
|
||||
}
|
||||
|
||||
public override int GetHashCode() => Name.GetHashCode();
|
||||
public override bool Equals(object obj) => obj is DayOfWeekItem other && Name == other.Name;
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
namespace TweetDuck.Dialogs.Settings {
|
||||
partial class TabSettingsNotifications {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -35,9 +35,9 @@
|
||||
this.radioLocTL = new System.Windows.Forms.RadioButton();
|
||||
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
||||
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.btnDurationMedium = new TweetDuck.Core.Controls.FlatButton();
|
||||
this.btnDurationLong = new TweetDuck.Core.Controls.FlatButton();
|
||||
this.btnDurationShort = new TweetDuck.Core.Controls.FlatButton();
|
||||
this.btnDurationMedium = new TweetDuck.Controls.FlatButton();
|
||||
this.btnDurationLong = new TweetDuck.Controls.FlatButton();
|
||||
this.btnDurationShort = new TweetDuck.Controls.FlatButton();
|
||||
this.labelDurationValue = new System.Windows.Forms.Label();
|
||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||
this.checkSkipOnLinkClick = new System.Windows.Forms.CheckBox();
|
||||
@@ -65,6 +65,10 @@
|
||||
this.panelSize = new System.Windows.Forms.Panel();
|
||||
this.durationUpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.flowPanelLeft = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.labelOpacity = new System.Windows.Forms.Label();
|
||||
this.panelOpacity = new System.Windows.Forms.Panel();
|
||||
this.labelOpacityValue = new System.Windows.Forms.Label();
|
||||
this.trackBarOpacity = new System.Windows.Forms.TrackBar();
|
||||
this.panelScrollSpeed = new System.Windows.Forms.Panel();
|
||||
this.flowPanelRight = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panelSeparator = new System.Windows.Forms.Panel();
|
||||
@@ -77,6 +81,8 @@
|
||||
this.panelTimer.SuspendLayout();
|
||||
this.panelSize.SuspendLayout();
|
||||
this.flowPanelLeft.SuspendLayout();
|
||||
this.panelOpacity.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarOpacity)).BeginInit();
|
||||
this.panelScrollSpeed.SuspendLayout();
|
||||
this.flowPanelRight.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -84,7 +90,7 @@
|
||||
// labelEdgeDistanceValue
|
||||
//
|
||||
this.labelEdgeDistanceValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelEdgeDistanceValue.Location = new System.Drawing.Point(145, 4);
|
||||
this.labelEdgeDistanceValue.Location = new System.Drawing.Point(175, 4);
|
||||
this.labelEdgeDistanceValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue";
|
||||
this.labelEdgeDistanceValue.Size = new System.Drawing.Size(40, 15);
|
||||
@@ -193,7 +199,7 @@
|
||||
this.trackBarEdgeDistance.Maximum = 40;
|
||||
this.trackBarEdgeDistance.Minimum = 8;
|
||||
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
||||
this.trackBarEdgeDistance.Size = new System.Drawing.Size(148, 30);
|
||||
this.trackBarEdgeDistance.Size = new System.Drawing.Size(177, 30);
|
||||
this.trackBarEdgeDistance.SmallChange = 2;
|
||||
this.trackBarEdgeDistance.TabIndex = 0;
|
||||
this.trackBarEdgeDistance.TickFrequency = 4;
|
||||
@@ -208,12 +214,12 @@
|
||||
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationMedium, 0, 0);
|
||||
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationLong, 1, 0);
|
||||
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationShort, 0, 0);
|
||||
this.tableLayoutDurationButtons.Location = new System.Drawing.Point(3, 353);
|
||||
this.tableLayoutDurationButtons.Location = new System.Drawing.Point(3, 401);
|
||||
this.tableLayoutDurationButtons.Name = "tableLayoutDurationButtons";
|
||||
this.tableLayoutDurationButtons.RowCount = 1;
|
||||
this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutDurationButtons.Size = new System.Drawing.Size(180, 27);
|
||||
this.tableLayoutDurationButtons.TabIndex = 12;
|
||||
this.tableLayoutDurationButtons.TabIndex = 14;
|
||||
//
|
||||
// btnDurationMedium
|
||||
//
|
||||
@@ -267,7 +273,7 @@
|
||||
//
|
||||
this.labelDurationValue.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelDurationValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelDurationValue.Location = new System.Drawing.Point(147, 4);
|
||||
this.labelDurationValue.Location = new System.Drawing.Point(177, 4);
|
||||
this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelDurationValue.Name = "labelDurationValue";
|
||||
this.labelDurationValue.Size = new System.Drawing.Size(52, 15);
|
||||
@@ -282,7 +288,7 @@
|
||||
this.trackBarDuration.Maximum = 60;
|
||||
this.trackBarDuration.Minimum = 10;
|
||||
this.trackBarDuration.Name = "trackBarDuration";
|
||||
this.trackBarDuration.Size = new System.Drawing.Size(148, 30);
|
||||
this.trackBarDuration.Size = new System.Drawing.Size(177, 30);
|
||||
this.trackBarDuration.TabIndex = 0;
|
||||
this.trackBarDuration.TickFrequency = 5;
|
||||
this.trackBarDuration.Value = 25;
|
||||
@@ -349,11 +355,11 @@
|
||||
//
|
||||
this.checkTimerCountDown.AutoSize = true;
|
||||
this.checkTimerCountDown.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 266);
|
||||
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 314);
|
||||
this.checkTimerCountDown.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkTimerCountDown.Name = "checkTimerCountDown";
|
||||
this.checkTimerCountDown.Size = new System.Drawing.Size(132, 19);
|
||||
this.checkTimerCountDown.TabIndex = 9;
|
||||
this.checkTimerCountDown.TabIndex = 11;
|
||||
this.checkTimerCountDown.Text = "Timer Counts Down";
|
||||
this.checkTimerCountDown.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -361,11 +367,11 @@
|
||||
//
|
||||
this.checkNotificationTimer.AutoSize = true;
|
||||
this.checkNotificationTimer.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 242);
|
||||
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 290);
|
||||
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
||||
this.checkNotificationTimer.Size = new System.Drawing.Size(164, 19);
|
||||
this.checkNotificationTimer.TabIndex = 8;
|
||||
this.checkNotificationTimer.TabIndex = 10;
|
||||
this.checkNotificationTimer.Text = "Display Notification Timer";
|
||||
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -429,7 +435,7 @@
|
||||
// labelScrollSpeedValue
|
||||
//
|
||||
this.labelScrollSpeedValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelScrollSpeedValue.Location = new System.Drawing.Point(145, 4);
|
||||
this.labelScrollSpeedValue.Location = new System.Drawing.Point(176, 4);
|
||||
this.labelScrollSpeedValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelScrollSpeedValue.Name = "labelScrollSpeedValue";
|
||||
this.labelScrollSpeedValue.Size = new System.Drawing.Size(38, 15);
|
||||
@@ -445,7 +451,7 @@
|
||||
this.trackBarScrollSpeed.Maximum = 200;
|
||||
this.trackBarScrollSpeed.Minimum = 25;
|
||||
this.trackBarScrollSpeed.Name = "trackBarScrollSpeed";
|
||||
this.trackBarScrollSpeed.Size = new System.Drawing.Size(148, 30);
|
||||
this.trackBarScrollSpeed.Size = new System.Drawing.Size(177, 30);
|
||||
this.trackBarScrollSpeed.SmallChange = 5;
|
||||
this.trackBarScrollSpeed.TabIndex = 0;
|
||||
this.trackBarScrollSpeed.TickFrequency = 25;
|
||||
@@ -490,32 +496,32 @@
|
||||
//
|
||||
this.panelTimer.Controls.Add(this.labelDurationValue);
|
||||
this.panelTimer.Controls.Add(this.trackBarDuration);
|
||||
this.panelTimer.Location = new System.Drawing.Point(0, 315);
|
||||
this.panelTimer.Location = new System.Drawing.Point(0, 363);
|
||||
this.panelTimer.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelTimer.Name = "panelTimer";
|
||||
this.panelTimer.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelTimer.TabIndex = 11;
|
||||
this.panelTimer.TabIndex = 13;
|
||||
//
|
||||
// labelDuration
|
||||
//
|
||||
this.labelDuration.AutoSize = true;
|
||||
this.labelDuration.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelDuration.Location = new System.Drawing.Point(3, 299);
|
||||
this.labelDuration.Location = new System.Drawing.Point(3, 347);
|
||||
this.labelDuration.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelDuration.Name = "labelDuration";
|
||||
this.labelDuration.Size = new System.Drawing.Size(54, 15);
|
||||
this.labelDuration.TabIndex = 10;
|
||||
this.labelDuration.TabIndex = 12;
|
||||
this.labelDuration.Text = "Duration";
|
||||
//
|
||||
// labelTimer
|
||||
//
|
||||
this.labelTimer.AutoSize = true;
|
||||
this.labelTimer.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTimer.Location = new System.Drawing.Point(0, 216);
|
||||
this.labelTimer.Margin = new System.Windows.Forms.Padding(0, 40, 0, 1);
|
||||
this.labelTimer.Location = new System.Drawing.Point(0, 264);
|
||||
this.labelTimer.Margin = new System.Windows.Forms.Padding(0, 25, 0, 1);
|
||||
this.labelTimer.Name = "labelTimer";
|
||||
this.labelTimer.Size = new System.Drawing.Size(50, 19);
|
||||
this.labelTimer.TabIndex = 7;
|
||||
this.labelTimer.TabIndex = 9;
|
||||
this.labelTimer.Text = "TIMER";
|
||||
//
|
||||
// labelSize
|
||||
@@ -555,6 +561,8 @@
|
||||
this.flowPanelLeft.Controls.Add(this.checkNonIntrusive);
|
||||
this.flowPanelLeft.Controls.Add(this.labelIdlePause);
|
||||
this.flowPanelLeft.Controls.Add(this.comboBoxIdlePause);
|
||||
this.flowPanelLeft.Controls.Add(this.labelOpacity);
|
||||
this.flowPanelLeft.Controls.Add(this.panelOpacity);
|
||||
this.flowPanelLeft.Controls.Add(this.labelTimer);
|
||||
this.flowPanelLeft.Controls.Add(this.checkNotificationTimer);
|
||||
this.flowPanelLeft.Controls.Add(this.checkTimerCountDown);
|
||||
@@ -568,6 +576,52 @@
|
||||
this.flowPanelLeft.TabIndex = 0;
|
||||
this.flowPanelLeft.WrapContents = false;
|
||||
//
|
||||
// labelOpacity
|
||||
//
|
||||
this.labelOpacity.AutoSize = true;
|
||||
this.labelOpacity.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelOpacity.Location = new System.Drawing.Point(3, 188);
|
||||
this.labelOpacity.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelOpacity.Name = "labelOpacity";
|
||||
this.labelOpacity.Size = new System.Drawing.Size(48, 15);
|
||||
this.labelOpacity.TabIndex = 7;
|
||||
this.labelOpacity.Text = "Opacity";
|
||||
//
|
||||
// panelOpacity
|
||||
//
|
||||
this.panelOpacity.Controls.Add(this.labelOpacityValue);
|
||||
this.panelOpacity.Controls.Add(this.trackBarOpacity);
|
||||
this.panelOpacity.Location = new System.Drawing.Point(0, 204);
|
||||
this.panelOpacity.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelOpacity.Name = "panelOpacity";
|
||||
this.panelOpacity.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelOpacity.TabIndex = 8;
|
||||
//
|
||||
// labelOpacityValue
|
||||
//
|
||||
this.labelOpacityValue.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.labelOpacityValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelOpacityValue.Location = new System.Drawing.Point(176, 4);
|
||||
this.labelOpacityValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelOpacityValue.Name = "labelOpacityValue";
|
||||
this.labelOpacityValue.Size = new System.Drawing.Size(38, 15);
|
||||
this.labelOpacityValue.TabIndex = 1;
|
||||
this.labelOpacityValue.Text = "100%";
|
||||
this.labelOpacityValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// trackBarOpacity
|
||||
//
|
||||
this.trackBarOpacity.AutoSize = false;
|
||||
this.trackBarOpacity.Location = new System.Drawing.Point(3, 3);
|
||||
this.trackBarOpacity.Maximum = 100;
|
||||
this.trackBarOpacity.Minimum = 20;
|
||||
this.trackBarOpacity.Name = "trackBarOpacity";
|
||||
this.trackBarOpacity.Size = new System.Drawing.Size(177, 30);
|
||||
this.trackBarOpacity.SmallChange = 5;
|
||||
this.trackBarOpacity.TabIndex = 0;
|
||||
this.trackBarOpacity.TickFrequency = 10;
|
||||
this.trackBarOpacity.Value = 100;
|
||||
//
|
||||
// panelScrollSpeed
|
||||
//
|
||||
this.panelScrollSpeed.Controls.Add(this.trackBarScrollSpeed);
|
||||
@@ -630,6 +684,8 @@
|
||||
this.panelSize.ResumeLayout(false);
|
||||
this.flowPanelLeft.ResumeLayout(false);
|
||||
this.flowPanelLeft.PerformLayout();
|
||||
this.panelOpacity.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarOpacity)).EndInit();
|
||||
this.panelScrollSpeed.ResumeLayout(false);
|
||||
this.flowPanelRight.ResumeLayout(false);
|
||||
this.flowPanelRight.PerformLayout();
|
||||
@@ -652,9 +708,9 @@
|
||||
private System.Windows.Forms.Label labelDurationValue;
|
||||
private System.Windows.Forms.TrackBar trackBarDuration;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
||||
private TweetDuck.Core.Controls.FlatButton btnDurationMedium;
|
||||
private TweetDuck.Core.Controls.FlatButton btnDurationLong;
|
||||
private TweetDuck.Core.Controls.FlatButton btnDurationShort;
|
||||
private TweetDuck.Controls.FlatButton btnDurationMedium;
|
||||
private TweetDuck.Controls.FlatButton btnDurationLong;
|
||||
private TweetDuck.Controls.FlatButton btnDurationShort;
|
||||
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
||||
private System.Windows.Forms.Label labelIdlePause;
|
||||
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
||||
@@ -682,5 +738,9 @@
|
||||
private System.Windows.Forms.Panel panelScrollSpeed;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelRight;
|
||||
private System.Windows.Forms.Panel panelSeparator;
|
||||
private System.Windows.Forms.Label labelOpacity;
|
||||
private System.Windows.Forms.Panel panelOpacity;
|
||||
private System.Windows.Forms.Label labelOpacityValue;
|
||||
private System.Windows.Forms.TrackBar trackBarOpacity;
|
||||
}
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Notification.Example;
|
||||
using TweetDuck.Browser.Notification.Example;
|
||||
using TweetDuck.Controls;
|
||||
using TweetLib.Core.Features.Notifications;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsNotifications : BaseTabSettings{
|
||||
namespace TweetDuck.Dialogs.Settings{
|
||||
sealed partial class TabSettingsNotifications : FormSettings.BaseTab{
|
||||
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
||||
|
||||
private readonly FormNotificationExample notification;
|
||||
@@ -23,7 +23,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
});
|
||||
};
|
||||
|
||||
this.notification.Activated += notification_Activated;
|
||||
this.notification.Show();
|
||||
|
||||
Disposed += (sender, args) => this.notification.Dispose();
|
||||
@@ -48,6 +47,9 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
comboBoxIdlePause.Items.Add("5 minutes");
|
||||
comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds));
|
||||
|
||||
trackBarOpacity.SetValueSafe(Config.NotificationWindowOpacity);
|
||||
labelOpacityValue.Text = Config.NotificationWindowOpacity + "%";
|
||||
|
||||
// timer
|
||||
|
||||
toolTip.SetToolTip(checkTimerCountDown, "The notification timer counts down instead of up.");
|
||||
@@ -59,31 +61,31 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
|
||||
|
||||
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||
labelDurationValue.Text = Config.NotificationDurationValue + " ms/c";
|
||||
|
||||
// location
|
||||
|
||||
toolTip.SetToolTip(radioLocCustom, "Drag the example notification window to the desired location.");
|
||||
|
||||
switch(Config.NotificationPosition){
|
||||
case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break;
|
||||
case TweetNotification.Position.TopRight: radioLocTR.Checked = true; break;
|
||||
case TweetNotification.Position.BottomLeft: radioLocBL.Checked = true; break;
|
||||
case TweetNotification.Position.BottomRight: radioLocBR.Checked = true; break;
|
||||
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
|
||||
case DesktopNotification.Position.TopLeft: radioLocTL.Checked = true; break;
|
||||
case DesktopNotification.Position.TopRight: radioLocTR.Checked = true; break;
|
||||
case DesktopNotification.Position.BottomLeft: radioLocBL.Checked = true; break;
|
||||
case DesktopNotification.Position.BottomRight: radioLocBR.Checked = true; break;
|
||||
case DesktopNotification.Position.Custom: radioLocCustom.Checked = true; break;
|
||||
}
|
||||
|
||||
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
|
||||
comboBoxDisplay.Items.Add("(Same as TweetDuck)");
|
||||
|
||||
foreach(Screen screen in Screen.AllScreens){
|
||||
comboBoxDisplay.Items.Add(screen.DeviceName.TrimStart('\\', '.')+" ("+screen.Bounds.Width+"x"+screen.Bounds.Height+")");
|
||||
comboBoxDisplay.Items.Add($"{screen.DeviceName.TrimStart('\\', '.')} ({screen.Bounds.Width}x{screen.Bounds.Height})");
|
||||
}
|
||||
|
||||
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1, Config.NotificationDisplay);
|
||||
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count - 1, Config.NotificationDisplay);
|
||||
|
||||
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value + " px";
|
||||
|
||||
// size
|
||||
|
||||
@@ -91,12 +93,12 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
toolTip.SetToolTip(radioSizeCustom, "Resize the example notification window to the desired size.");
|
||||
|
||||
switch(Config.NotificationSize){
|
||||
case TweetNotification.Size.Auto: radioSizeAuto.Checked = true; break;
|
||||
case TweetNotification.Size.Custom: radioSizeCustom.Checked = true; break;
|
||||
case DesktopNotification.Size.Auto: radioSizeAuto.Checked = true; break;
|
||||
case DesktopNotification.Size.Custom: radioSizeCustom.Checked = true; break;
|
||||
}
|
||||
|
||||
trackBarScrollSpeed.SetValueSafe(Config.NotificationScrollSpeed);
|
||||
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value+"%";
|
||||
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value + "%";
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
@@ -105,6 +107,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
checkSkipOnLinkClick.CheckedChanged += checkSkipOnLinkClick_CheckedChanged;
|
||||
checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged;
|
||||
comboBoxIdlePause.SelectedValueChanged += comboBoxIdlePause_SelectedValueChanged;
|
||||
trackBarOpacity.ValueChanged += trackBarOpacity_ValueChanged;
|
||||
|
||||
checkNotificationTimer.CheckedChanged += checkNotificationTimer_CheckedChanged;
|
||||
checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged;
|
||||
@@ -135,11 +138,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
private void notification_Activated(object sender, EventArgs e){
|
||||
notification.Hide();
|
||||
notification.Activated -= notification_Activated;
|
||||
}
|
||||
|
||||
private void notification_Move(object sender, EventArgs e){
|
||||
if (radioLocCustom.Checked && notification.Location != ControlExtensions.InvisibleLocation){
|
||||
Config.CustomNotificationPosition = notification.Location;
|
||||
@@ -176,6 +174,13 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.NotificationIdlePauseSeconds = IdlePauseSeconds[comboBoxIdlePause.SelectedIndex];
|
||||
}
|
||||
|
||||
private void trackBarOpacity_ValueChanged(object sender, EventArgs e){
|
||||
if (trackBarOpacity.AlignValueToTick()){
|
||||
Config.NotificationWindowOpacity = trackBarOpacity.Value;
|
||||
labelOpacityValue.Text = Config.NotificationWindowOpacity + "%";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Timer
|
||||
|
||||
@@ -195,7 +200,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
durationUpdateTimer.Start();
|
||||
|
||||
Config.NotificationDurationValue = trackBarDuration.Value;
|
||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||
labelDurationValue.Text = Config.NotificationDurationValue + " ms/c";
|
||||
}
|
||||
|
||||
private void btnDurationShort_Click(object sender, EventArgs e){
|
||||
@@ -219,10 +224,18 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
#region Location
|
||||
|
||||
private void radioLoc_CheckedChanged(object sender, EventArgs e){
|
||||
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
|
||||
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
|
||||
else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight;
|
||||
if (radioLocTL.Checked){
|
||||
Config.NotificationPosition = DesktopNotification.Position.TopLeft;
|
||||
}
|
||||
else if (radioLocTR.Checked){
|
||||
Config.NotificationPosition = DesktopNotification.Position.TopRight;
|
||||
}
|
||||
else if (radioLocBL.Checked){
|
||||
Config.NotificationPosition = DesktopNotification.Position.BottomLeft;
|
||||
}
|
||||
else if (radioLocBR.Checked){
|
||||
Config.NotificationPosition = DesktopNotification.Position.BottomRight;
|
||||
}
|
||||
|
||||
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = true;
|
||||
notification.ShowExampleNotification(false);
|
||||
@@ -233,18 +246,18 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.CustomNotificationPosition = notification.Location;
|
||||
}
|
||||
|
||||
Config.NotificationPosition = TweetNotification.Position.Custom;
|
||||
Config.NotificationPosition = DesktopNotification.Position.Custom;
|
||||
|
||||
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = false;
|
||||
notification.ShowExampleNotification(false);
|
||||
|
||||
if (notification.IsFullyOutsideView() && FormMessage.Question("Notification is Outside View", "The notification seems to be outside of view, would you like to reset its position?", FormMessage.Yes, FormMessage.No)){
|
||||
Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||
Config.NotificationPosition = DesktopNotification.Position.TopRight;
|
||||
notification.MoveToVisibleLocation();
|
||||
|
||||
Config.CustomNotificationPosition = notification.Location;
|
||||
|
||||
Config.NotificationPosition = TweetNotification.Position.Custom;
|
||||
Config.NotificationPosition = DesktopNotification.Position.Custom;
|
||||
notification.MoveToVisibleLocation();
|
||||
}
|
||||
}
|
||||
@@ -255,7 +268,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
|
||||
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value + " px";
|
||||
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
@@ -265,7 +278,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
private void radioSize_CheckedChanged(object sender, EventArgs e){
|
||||
if (radioSizeAuto.Checked){
|
||||
Config.NotificationSize = TweetNotification.Size.Auto;
|
||||
Config.NotificationSize = DesktopNotification.Size.Auto;
|
||||
}
|
||||
|
||||
notification.ShowExampleNotification(false);
|
||||
@@ -276,13 +289,13 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.CustomNotificationSize = notification.BrowserSize;
|
||||
}
|
||||
|
||||
Config.NotificationSize = TweetNotification.Size.Custom;
|
||||
Config.NotificationSize = DesktopNotification.Size.Custom;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void trackBarScrollSpeed_ValueChanged(object sender, EventArgs e){
|
||||
if (trackBarScrollSpeed.AlignValueToTick()){
|
||||
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value+"%";
|
||||
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value + "%";
|
||||
Config.NotificationScrollSpeed = trackBarScrollSpeed.Value;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user