mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 19:32:10 +02:00
Compare commits
77 Commits
Author | SHA1 | Date | |
---|---|---|---|
c741767b11 | |||
4a09358e14 | |||
3f4ea1af08 | |||
35bb196832 | |||
cb5b50dd42 | |||
8652272526 | |||
0f32504fde | |||
4735c21fc0 | |||
ecbcbcaed4 | |||
1677b73ff8 | |||
5929067a3d | |||
d06834617b | |||
9d048efe06 | |||
6a379bc2cd | |||
9f415b11b5 | |||
b9b9193222 | |||
867c2d1632 | |||
5447afc3f5 | |||
b5e58db242 | |||
8ab99619d6 | |||
4c7660ee65 | |||
c1b9bde7b0 | |||
0e8c6c066f | |||
9e44a86be0 | |||
b61479f84f | |||
e3c709b005 | |||
b2b3dba504 | |||
4d05441aa8 | |||
419b3ee850 | |||
4c31e72d29 | |||
e3b2ff7f0e | |||
4c5f5e2cce | |||
39ae9b8ba0 | |||
5c7eb0535d | |||
235718390b | |||
5d4b72f224 | |||
dc76ae9d1f | |||
e44f4bb003 | |||
1fc1370d41 | |||
80a669c989 | |||
801c9eba2d | |||
f9704d2836 | |||
39687171e9 | |||
1d73691ef4 | |||
f8678d2515 | |||
fb108ea18d | |||
a7229a0677 | |||
d0dd112b98 | |||
1e07120eb5 | |||
fcd1f76cff | |||
e400d86d75 | |||
dca3410a5b | |||
9b314e2953 | |||
5635daf66d | |||
7e2e1645e9 | |||
4990afcdbb | |||
c11f36dfef | |||
abddf61c88 | |||
37fec7e952 | |||
0f6a93ae8f | |||
25eae334b0 | |||
74377d01ce | |||
6e78ba1e7b | |||
39e0dedf27 | |||
bbe2c88802 | |||
586b31b63e | |||
041abe6d7e | |||
a69b3cd05f | |||
b48213e79e | |||
5bbc14aca5 | |||
8ccbf502e8 | |||
c426ca97e2 | |||
d9eef86a8b | |||
3fed921748 | |||
02827d53a2 | |||
1ad5fde9ae | |||
909d5ed99c |
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
static class Arguments{
|
static class Arguments{
|
||||||
// public args
|
// public args
|
||||||
public const string ArgDataFolder = "-datafolder";
|
public const string ArgDataFolder = "-datafolder";
|
||||||
@@ -12,6 +12,7 @@ namespace TweetDck.Configuration{
|
|||||||
// internal args
|
// internal args
|
||||||
public const string ArgRestart = "-restart";
|
public const string ArgRestart = "-restart";
|
||||||
public const string ArgImportCookies = "-importcookies";
|
public const string ArgImportCookies = "-importcookies";
|
||||||
|
public const string ArgUpdated = "-updated";
|
||||||
|
|
||||||
// class data and methods
|
// class data and methods
|
||||||
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
|
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
|
||||||
@@ -28,7 +29,18 @@ namespace TweetDck.Configuration{
|
|||||||
CommandLineArgs args = Current.Clone();
|
CommandLineArgs args = Current.Clone();
|
||||||
args.RemoveFlag(ArgRestart);
|
args.RemoveFlag(ArgRestart);
|
||||||
args.RemoveFlag(ArgImportCookies);
|
args.RemoveFlag(ArgImportCookies);
|
||||||
|
args.RemoveFlag(ArgUpdated);
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CommandLineArgs GetCurrentForInstaller(){
|
||||||
|
CommandLineArgs args = GetCurrentClean();
|
||||||
|
args.AddFlag(ArgUpdated);
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetCurrentForInstallerCmd(){
|
||||||
|
return GetCurrentForInstaller().ToString().Replace("\"", "::");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
sealed class LockManager{
|
sealed class LockManager{
|
||||||
public enum Result{
|
public enum Result{
|
||||||
Success, HasProcess, Fail
|
Success, HasProcess, Fail
|
||||||
|
66
Configuration/SystemConfig.cs
Normal file
66
Configuration/SystemConfig.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace TweetDuck.Configuration{
|
||||||
|
sealed class SystemConfig{
|
||||||
|
public static readonly bool IsHardwareAccelerationSupported = File.Exists(Path.Combine(Program.ProgramPath, "libEGL.dll")) &&
|
||||||
|
File.Exists(Path.Combine(Program.ProgramPath, "libGLESv2.dll"));
|
||||||
|
|
||||||
|
public bool HardwareAcceleration{
|
||||||
|
get => hardwareAcceleration && IsHardwareAccelerationSupported;
|
||||||
|
set => hardwareAcceleration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly string file;
|
||||||
|
|
||||||
|
private bool hardwareAcceleration;
|
||||||
|
|
||||||
|
private SystemConfig(string file){
|
||||||
|
this.file = file;
|
||||||
|
|
||||||
|
HardwareAcceleration = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteToStream(Stream stream){
|
||||||
|
stream.WriteByte((byte)(HardwareAcceleration ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadFromStream(Stream stream){
|
||||||
|
HardwareAcceleration = stream.ReadByte() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Save(){
|
||||||
|
try{
|
||||||
|
string directory = Path.GetDirectoryName(file);
|
||||||
|
if (directory == null)return false;
|
||||||
|
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
|
||||||
|
using(Stream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None)){
|
||||||
|
WriteToStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Configuration Error", "Could not save the system configuration file.", true, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemConfig Load(string file){
|
||||||
|
SystemConfig config = new SystemConfig(file);
|
||||||
|
|
||||||
|
try{
|
||||||
|
using(Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)){
|
||||||
|
config.ReadFromStream(stream);
|
||||||
|
}
|
||||||
|
}catch(FileNotFoundException){
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Configuration Error", "Could not open the system configuration file. If you continue, you will lose system specific configuration such as Hardware Acceleration.", true, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -3,18 +3,24 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using TweetDck.Core;
|
using TweetDuck.Core;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
sealed class UserConfig{
|
sealed class UserConfig{
|
||||||
private static readonly IFormatter Formatter = new BinaryFormatter();
|
private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new LegacyBinder() };
|
||||||
|
|
||||||
private const int CurrentFileVersion = 7;
|
private class LegacyBinder : SerializationBinder{
|
||||||
|
public override Type BindToType(string assemblyName, string typeName){
|
||||||
|
return Type.GetType(string.Format("{0}, {1}", typeName.Replace("TweetDck", "TweetDuck"), assemblyName.Replace("TweetDck", "TweetDuck")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private const int CurrentFileVersion = 9;
|
||||||
|
|
||||||
// START OF CONFIGURATION
|
// START OF CONFIGURATION
|
||||||
|
|
||||||
@@ -34,62 +40,57 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
public bool EnableSpellCheck { get; set; }
|
public bool EnableSpellCheck { get; set; }
|
||||||
public bool ExpandLinksOnHover { get; set; }
|
public bool ExpandLinksOnHover { get; set; }
|
||||||
|
public bool SwitchAccountSelectors { get; set; }
|
||||||
public bool EnableTrayHighlight { get; set; }
|
public bool EnableTrayHighlight { get; set; }
|
||||||
|
|
||||||
public bool EnableUpdateCheck { get; set; }
|
public bool EnableUpdateCheck { get; set; }
|
||||||
public string DismissedUpdate { get; set; }
|
public string DismissedUpdate { get; set; }
|
||||||
|
|
||||||
public PluginConfig Plugins { get; private set; }
|
[Obsolete] public PluginConfig Plugins { get; set; } // TODO remove eventually
|
||||||
public WindowState PluginsWindow { get; set; }
|
public WindowState PluginsWindow { get; set; }
|
||||||
|
|
||||||
public string CustomCefArgs { get; set; }
|
public string CustomCefArgs { get; set; }
|
||||||
public string CustomBrowserCSS { get; set; }
|
public string CustomBrowserCSS { get; set; }
|
||||||
public string CustomNotificationCSS { get; set; }
|
public string CustomNotificationCSS { get; set; }
|
||||||
|
|
||||||
public bool IsCustomNotificationPositionSet{
|
public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
||||||
get{
|
|
||||||
return CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
public string NotificationSoundPath{
|
||||||
}
|
get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
||||||
|
set => notificationSoundPath = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MuteNotifications{
|
public bool MuteNotifications{
|
||||||
get{
|
get => muteNotifications;
|
||||||
return muteNotifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (muteNotifications == value)return;
|
if (muteNotifications != value){
|
||||||
|
|
||||||
muteNotifications = value;
|
muteNotifications = value;
|
||||||
|
MuteToggled?.Invoke(this, new EventArgs());
|
||||||
if (MuteToggled != null){
|
|
||||||
MuteToggled(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string NotificationSoundPath{
|
public int ZoomLevel{
|
||||||
get{
|
get => zoomLevel;
|
||||||
return string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
notificationSoundPath = value;
|
if (zoomLevel != value){
|
||||||
|
zoomLevel = value;
|
||||||
|
ZoomLevelChanged?.Invoke(this, new EventArgs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ZoomMultiplier => zoomLevel/100.0;
|
||||||
|
|
||||||
public TrayIcon.Behavior TrayBehavior{
|
public TrayIcon.Behavior TrayBehavior{
|
||||||
get{
|
get => trayBehavior;
|
||||||
return trayBehavior;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (trayBehavior == value)return;
|
if (trayBehavior != value){
|
||||||
|
|
||||||
trayBehavior = value;
|
trayBehavior = value;
|
||||||
|
TrayBehaviorChanged?.Invoke(this, new EventArgs());
|
||||||
if (TrayBehaviorChanged != null){
|
|
||||||
TrayBehaviorChanged(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,6 +100,9 @@ namespace TweetDck.Configuration{
|
|||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
public event EventHandler MuteToggled;
|
public event EventHandler MuteToggled;
|
||||||
|
|
||||||
|
[field:NonSerialized]
|
||||||
|
public event EventHandler ZoomLevelChanged;
|
||||||
|
|
||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
public event EventHandler TrayBehaviorChanged;
|
public event EventHandler TrayBehaviorChanged;
|
||||||
|
|
||||||
@@ -107,6 +111,7 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
private int fileVersion;
|
private int fileVersion;
|
||||||
private bool muteNotifications;
|
private bool muteNotifications;
|
||||||
|
private int zoomLevel;
|
||||||
private string notificationSoundPath;
|
private string notificationSoundPath;
|
||||||
private TrayIcon.Behavior trayBehavior;
|
private TrayIcon.Behavior trayBehavior;
|
||||||
|
|
||||||
@@ -114,6 +119,7 @@ namespace TweetDck.Configuration{
|
|||||||
this.file = file;
|
this.file = file;
|
||||||
|
|
||||||
BrowserWindow = new WindowState();
|
BrowserWindow = new WindowState();
|
||||||
|
ZoomLevel = 100;
|
||||||
DisplayNotificationTimer = true;
|
DisplayNotificationTimer = true;
|
||||||
NotificationNonIntrusiveMode = true;
|
NotificationNonIntrusiveMode = true;
|
||||||
NotificationPosition = TweetNotification.Position.TopRight;
|
NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
@@ -122,12 +128,9 @@ namespace TweetDck.Configuration{
|
|||||||
NotificationDurationValue = 25;
|
NotificationDurationValue = 25;
|
||||||
EnableUpdateCheck = true;
|
EnableUpdateCheck = true;
|
||||||
ExpandLinksOnHover = true;
|
ExpandLinksOnHover = true;
|
||||||
|
SwitchAccountSelectors = true;
|
||||||
EnableTrayHighlight = true;
|
EnableTrayHighlight = true;
|
||||||
Plugins = new PluginConfig();
|
|
||||||
PluginsWindow = new WindowState();
|
PluginsWindow = new WindowState();
|
||||||
|
|
||||||
Plugins.DisableOfficialFromConfig("clear-columns");
|
|
||||||
Plugins.DisableOfficialFromConfig("reply-account");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpgradeFile(){
|
private void UpgradeFile(){
|
||||||
@@ -149,7 +152,6 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
if (fileVersion == 2){
|
if (fileVersion == 2){
|
||||||
BrowserWindow = new WindowState();
|
BrowserWindow = new WindowState();
|
||||||
Plugins = new PluginConfig();
|
|
||||||
PluginsWindow = new WindowState();
|
PluginsWindow = new WindowState();
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
@@ -161,8 +163,6 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fileVersion == 4){
|
if (fileVersion == 4){
|
||||||
Plugins.DisableOfficialFromConfig("clear-columns");
|
|
||||||
Plugins.DisableOfficialFromConfig("reply-account");
|
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +175,16 @@ namespace TweetDck.Configuration{
|
|||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileVersion == 7){
|
||||||
|
ZoomLevel = 100;
|
||||||
|
++fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileVersion == 8){
|
||||||
|
SwitchAccountSelectors = true;
|
||||||
|
++fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
// update the version
|
// update the version
|
||||||
fileVersion = CurrentFileVersion;
|
fileVersion = CurrentFileVersion;
|
||||||
Save();
|
Save();
|
||||||
@@ -216,10 +226,7 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config != null){
|
config?.UpgradeFile();
|
||||||
config.UpgradeFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}catch(FileNotFoundException){
|
}catch(FileNotFoundException){
|
||||||
}catch(DirectoryNotFoundException){
|
}catch(DirectoryNotFoundException){
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
sealed class CallbackBridge{
|
sealed class CallbackBridge{
|
||||||
private readonly Control owner;
|
private readonly Control owner;
|
||||||
private readonly Action safeCallback;
|
private readonly Action safeCallback;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
static class PropertyBridge{
|
static class PropertyBridge{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Properties{
|
public enum Properties{
|
||||||
@@ -9,7 +9,8 @@ namespace TweetDck.Core.Bridge{
|
|||||||
MuteNotifications = 2,
|
MuteNotifications = 2,
|
||||||
HasCustomNotificationSound = 4,
|
HasCustomNotificationSound = 4,
|
||||||
SkipOnLinkClick = 8,
|
SkipOnLinkClick = 8,
|
||||||
AllBrowser = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound,
|
SwitchAccountSelectors = 16,
|
||||||
|
AllBrowser = ExpandLinksOnHover | SwitchAccountSelectors | MuteNotifications | HasCustomNotificationSound,
|
||||||
AllNotification = ExpandLinksOnHover | SkipOnLinkClick
|
AllNotification = ExpandLinksOnHover | SkipOnLinkClick
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
|
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (properties.HasFlag(Properties.SwitchAccountSelectors)){
|
||||||
|
build.Append("c.switchAccountSelectors=").Append(Program.UserConfig.SwitchAccountSelectors ? "true;" : "false;");
|
||||||
|
}
|
||||||
|
|
||||||
if (properties.HasFlag(Properties.MuteNotifications)){
|
if (properties.HasFlag(Properties.MuteNotifications)){
|
||||||
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
|
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
sealed class TweetDeckBridge{
|
sealed class TweetDeckBridge{
|
||||||
public static string LastRightClickedLink = string.Empty;
|
public static string LastRightClickedLink = string.Empty;
|
||||||
public static string LastHighlightedTweet = string.Empty;
|
public static string LastHighlightedTweet = string.Empty;
|
||||||
@@ -83,6 +83,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetIdleSeconds(){
|
||||||
|
return NativeMethods.GetIdleSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenBrowser(string url){
|
public void OpenBrowser(string url){
|
||||||
BrowserUtils.OpenExternalBrowser(url);
|
BrowserUtils.OpenExternalBrowser(url);
|
||||||
}
|
}
|
||||||
@@ -100,6 +104,13 @@ namespace TweetDck.Core.Bridge{
|
|||||||
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CrashDebug(string message){
|
||||||
|
#if DEBUG
|
||||||
|
Log(message);
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void Log(string data){
|
public void Log(string data){
|
||||||
System.Diagnostics.Debug.WriteLine(data);
|
System.Diagnostics.Debug.WriteLine(data);
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
static class ControlExtensions{
|
static class ControlExtensions{
|
||||||
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
||||||
|
|
||||||
@@ -20,6 +21,10 @@ namespace TweetDck.Core.Controls{
|
|||||||
control.BeginInvoke(func);
|
control.BeginInvoke(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsFullyOutsideView(this Form form){
|
||||||
|
return !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds));
|
||||||
|
}
|
||||||
|
|
||||||
public static void MoveToCenter(this Form targetForm, Form parentForm){
|
public static void MoveToCenter(this Form targetForm, Form parentForm){
|
||||||
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
|
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
class FlatButton : Button{
|
class FlatButton : Button{
|
||||||
protected override bool ShowFocusCues{
|
protected override bool ShowFocusCues => false;
|
||||||
get{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlatButton(){
|
public FlatButton(){
|
||||||
GotFocus += FlatButton_GotFocus;
|
GotFocus += FlatButton_GotFocus;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed class FlatProgressBar : ProgressBar{
|
sealed class FlatProgressBar : ProgressBar{
|
||||||
private readonly SolidBrush brush;
|
private readonly SolidBrush brush;
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed class TabButton : FlatButton{
|
sealed class TabButton : FlatButton{
|
||||||
public Action Callback { get; private set; }
|
public Action Callback { get; private set; }
|
||||||
|
|
||||||
|
2
Core/Controls/TabPanel.Designer.cs
generated
2
Core/Controls/TabPanel.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Controls {
|
namespace TweetDuck.Core.Controls {
|
||||||
partial class TabPanel {
|
partial class TabPanel {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -4,23 +4,13 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed partial class TabPanel : UserControl{
|
sealed partial class TabPanel : UserControl{
|
||||||
public IEnumerable<TabButton> Buttons{
|
public Panel Content => panelContent;
|
||||||
get{
|
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
||||||
return panelButtons.Controls.Cast<TabButton>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TabButton ActiveButton { get; private set; }
|
public TabButton ActiveButton { get; private set; }
|
||||||
|
|
||||||
// ReSharper disable once ConvertToAutoPropertyWithPrivateSetter
|
|
||||||
public Panel Content{
|
|
||||||
get{
|
|
||||||
return panelContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int btnWidth;
|
private int btnWidth;
|
||||||
|
|
||||||
public TabPanel(){
|
public TabPanel(){
|
||||||
|
9
Core/FormBrowser.Designer.cs
generated
9
Core/FormBrowser.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core {
|
namespace TweetDuck.Core {
|
||||||
sealed partial class FormBrowser {
|
sealed partial class FormBrowser {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.trayIcon = new TweetDck.Core.TrayIcon(this.components);
|
this.trayIcon = new TweetDuck.Core.TrayIcon(this.components);
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -32,15 +32,16 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackColor = TweetDck.Core.Utils.BrowserUtils.BackgroundColor;
|
this.BackColor = TweetDuck.Core.Utils.BrowserUtils.BackgroundColor;
|
||||||
this.ClientSize = new System.Drawing.Size(324, 386);
|
this.ClientSize = new System.Drawing.Size(324, 386);
|
||||||
this.Icon = Properties.Resources.icon;
|
this.Icon = Properties.Resources.icon;
|
||||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MinimumSize = new System.Drawing.Size(340, 424);
|
this.MinimumSize = new System.Drawing.Size(340, 424);
|
||||||
this.Name = "FormBrowser";
|
this.Name = "FormBrowser";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
||||||
|
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed);
|
||||||
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
||||||
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@@ -1,33 +1,29 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
using TweetDck.Configuration;
|
using System;
|
||||||
using TweetDck.Core.Handling;
|
|
||||||
using TweetDck.Core.Other;
|
|
||||||
using TweetDck.Resources;
|
|
||||||
using TweetDck.Core.Controls;
|
|
||||||
using System.Drawing;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
using TweetDck.Updates;
|
|
||||||
using TweetDck.Plugins;
|
|
||||||
using TweetDck.Plugins.Enums;
|
|
||||||
using TweetDck.Plugins.Events;
|
|
||||||
using TweetDck.Core.Bridge;
|
|
||||||
using TweetDck.Core.Notification;
|
|
||||||
using TweetDck.Core.Notification.Screenshot;
|
|
||||||
using TweetDck.Updates.Events;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using TweetDck.Core.Notification.Sound;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Configuration;
|
||||||
|
using TweetDuck.Core.Bridge;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Handling;
|
||||||
|
using TweetDuck.Core.Notification;
|
||||||
|
using TweetDuck.Core.Notification.Screenshot;
|
||||||
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
using TweetDuck.Core.Other;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Plugins;
|
||||||
|
using TweetDuck.Plugins.Enums;
|
||||||
|
using TweetDuck.Plugins.Events;
|
||||||
|
using TweetDuck.Resources;
|
||||||
|
using TweetDuck.Updates;
|
||||||
|
using TweetDuck.Updates.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDuck.Core{
|
||||||
sealed partial class FormBrowser : Form{
|
sealed partial class FormBrowser : Form{
|
||||||
private static UserConfig Config{
|
private static UserConfig Config => Program.UserConfig;
|
||||||
get{
|
|
||||||
return Program.UserConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string UpdateInstallerPath { get; private set; }
|
public string UpdateInstallerPath { get; private set; }
|
||||||
|
|
||||||
@@ -68,7 +64,8 @@ namespace TweetDck.Core{
|
|||||||
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
||||||
MenuHandler = new ContextMenuBrowser(this),
|
MenuHandler = new ContextMenuBrowser(this),
|
||||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||||
LifeSpanHandler = new LifeSpanHandler()
|
LifeSpanHandler = new LifeSpanHandler(),
|
||||||
|
RequestHandler = new RequestHandlerBrowser()
|
||||||
};
|
};
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@@ -93,13 +90,8 @@ namespace TweetDck.Core{
|
|||||||
browser.Dispose();
|
browser.Dispose();
|
||||||
contextMenu.Dispose();
|
contextMenu.Dispose();
|
||||||
|
|
||||||
if (notificationScreenshotManager != null){
|
notificationScreenshotManager?.Dispose();
|
||||||
notificationScreenshotManager.Dispose();
|
soundNotification?.Dispose();
|
||||||
}
|
|
||||||
|
|
||||||
if (soundNotification != null){
|
|
||||||
soundNotification.Dispose();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.trayIcon.ClickRestore += trayIcon_ClickRestore;
|
this.trayIcon.ClickRestore += trayIcon_ClickRestore;
|
||||||
@@ -109,6 +101,7 @@ namespace TweetDck.Core{
|
|||||||
UpdateTrayIcon();
|
UpdateTrayIcon();
|
||||||
|
|
||||||
Config.MuteToggled += Config_MuteToggled;
|
Config.MuteToggled += Config_MuteToggled;
|
||||||
|
Config.ZoomLevelChanged += Config_ZoomLevelChanged;
|
||||||
|
|
||||||
this.updates = new UpdateHandler(browser, this, updaterSettings);
|
this.updates = new UpdateHandler(browser, this, updaterSettings);
|
||||||
this.updates.UpdateAccepted += updates_UpdateAccepted;
|
this.updates.UpdateAccepted += updates_UpdateAccepted;
|
||||||
@@ -171,10 +164,16 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
|
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
|
||||||
if (e.Frame.IsMain && BrowserUtils.IsTwitterWebsite(e.Frame)){
|
if (e.Frame.IsMain){
|
||||||
|
if (Config.ZoomLevel != 100){
|
||||||
|
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BrowserUtils.IsTwitterWebsite(e.Frame)){
|
||||||
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
|
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||||
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
|
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
|
||||||
@@ -249,10 +248,20 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FormBrowser_FormClosed(object sender, FormClosedEventArgs e){
|
||||||
|
if (isLoaded && UpdateInstallerPath == null){
|
||||||
|
updates.CleanupDownload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Config_MuteToggled(object sender, EventArgs e){
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Config_ZoomLevelChanged(object sender, EventArgs e){
|
||||||
|
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
|
||||||
|
}
|
||||||
|
|
||||||
private void Config_TrayBehaviorChanged(object sender, EventArgs e){
|
private void Config_TrayBehaviorChanged(object sender, EventArgs e){
|
||||||
UpdateTrayIcon();
|
UpdateTrayIcon();
|
||||||
}
|
}
|
||||||
@@ -274,27 +283,22 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||||
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||||
Config.Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
||||||
Hide();
|
foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){
|
||||||
|
if (form is FormSettings || form is FormPlugins || form is FormAbout){
|
||||||
|
form.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FormUpdateDownload downloadForm = new FormUpdateDownload(e.UpdateInfo);
|
updates.BeginUpdateDownload(this, e.UpdateInfo, update => {
|
||||||
downloadForm.MoveToCenter(this);
|
if (update.DownloadStatus == UpdateDownloadStatus.Done){
|
||||||
downloadForm.ShowDialog();
|
UpdateInstallerPath = update.InstallerPath;
|
||||||
downloadForm.Dispose();
|
}
|
||||||
|
|
||||||
if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Succeeded){
|
|
||||||
UpdateInstallerPath = downloadForm.InstallerPath;
|
|
||||||
ForceClose();
|
ForceClose();
|
||||||
}
|
});
|
||||||
else if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Manual){
|
|
||||||
ForceClose();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
||||||
@@ -329,7 +333,7 @@ namespace TweetDck.Core{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBrowserReady && m.Msg == 0x210 && (m.WParam.ToInt32() & 0xFFFF) == 0x020B){ // WM_PARENTNOTIFY, WM_XBUTTONDOWN
|
if (isBrowserReady && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN){
|
||||||
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
|
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -354,7 +358,7 @@ namespace TweetDck.Core{
|
|||||||
// javascript calls
|
// javascript calls
|
||||||
|
|
||||||
public void ReinjectCustomCSS(string css){
|
public void ReinjectCustomCSS(string css){
|
||||||
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css == null ? string.Empty : css.Replace(Environment.NewLine, " "));
|
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css?.Replace(Environment.NewLine, " ") ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProperties(PropertyBridge.Properties properties){
|
public void UpdateProperties(PropertyBridge.Properties properties){
|
||||||
@@ -391,7 +395,7 @@ namespace TweetDck.Core{
|
|||||||
trayIcon.HasNotifications = false;
|
trayIcon.HasNotifications = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound);
|
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound);
|
||||||
form.Dispose();
|
form.Dispose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class BrowserProcessHandler : IBrowserProcessHandler{
|
class BrowserProcessHandler : IBrowserProcessHandler{
|
||||||
void IBrowserProcessHandler.OnContextInitialized(){
|
void IBrowserProcessHandler.OnContextInitialized(){
|
||||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||||
string err;
|
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out string _);
|
||||||
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,13 +3,14 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
abstract class ContextMenuBase : IContextMenuHandler{
|
abstract class ContextMenuBase : IContextMenuHandler{
|
||||||
private static readonly Regex RegexTwitterAccount = new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled);
|
private static readonly Lazy<Regex> RegexTwitterAccount = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled), false);
|
||||||
|
protected static readonly bool HasDevTools = File.Exists(Path.Combine(Program.ProgramPath, "devtools_resources.pak"));
|
||||||
|
|
||||||
private const int MenuOpenLinkUrl = 26500;
|
private const int MenuOpenLinkUrl = 26500;
|
||||||
private const int MenuCopyLinkUrl = 26501;
|
private const int MenuCopyLinkUrl = 26501;
|
||||||
@@ -17,15 +18,8 @@ namespace TweetDck.Core.Handling{
|
|||||||
private const int MenuOpenImage = 26503;
|
private const int MenuOpenImage = 26503;
|
||||||
private const int MenuSaveImage = 26504;
|
private const int MenuSaveImage = 26504;
|
||||||
private const int MenuCopyImageUrl = 26505;
|
private const int MenuCopyImageUrl = 26505;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
private const int MenuOpenDevTools = 26599;
|
private const int MenuOpenDevTools = 26599;
|
||||||
|
|
||||||
protected void AddDebugMenuItems(IMenuModel model){
|
|
||||||
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private readonly Form form;
|
private readonly Form form;
|
||||||
|
|
||||||
protected ContextMenuBase(Form form){
|
protected ContextMenuBase(Form form){
|
||||||
@@ -34,7 +28,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||||
if (RegexTwitterAccount.IsMatch(parameters.UnfilteredLinkUrl)){
|
if (RegexTwitterAccount.Value.IsMatch(parameters.UnfilteredLinkUrl)){
|
||||||
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open account in browser");
|
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open account in browser");
|
||||||
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy account address");
|
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy account address");
|
||||||
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
|
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
|
||||||
@@ -85,7 +79,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (saveTarget != null){
|
if (saveTarget != null){
|
||||||
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, ex => {
|
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, null, ex => {
|
||||||
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -97,15 +91,13 @@ namespace TweetDck.Core.Handling{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyUsername:
|
case MenuCopyUsername:
|
||||||
Match match = RegexTwitterAccount.Match(parameters.UnfilteredLinkUrl);
|
Match match = RegexTwitterAccount.Value.Match(parameters.UnfilteredLinkUrl);
|
||||||
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
case MenuOpenDevTools:
|
case MenuOpenDevTools:
|
||||||
browserControl.ShowDevTools();
|
browserControl.ShowDevTools();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -121,6 +113,10 @@ namespace TweetDck.Core.Handling{
|
|||||||
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void AddDebugMenuItems(IMenuModel model){
|
||||||
|
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
||||||
|
}
|
||||||
|
|
||||||
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
||||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
||||||
model.RemoveAt(model.Count-1);
|
model.RemoveAt(model.Count-1);
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using System.Windows.Forms;
|
using CefSharp;
|
||||||
using CefSharp;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ContextMenuBrowser : ContextMenuBase{
|
class ContextMenuBrowser : ContextMenuBase{
|
||||||
private const int MenuGlobal = 26600;
|
private const int MenuGlobal = 26600;
|
||||||
private const int MenuMute = 26601;
|
private const int MenuMute = 26601;
|
||||||
@@ -82,10 +82,10 @@ namespace TweetDck.Core.Handling{
|
|||||||
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
|
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
|
||||||
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
|
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
|
||||||
|
|
||||||
#if DEBUG
|
if (HasDevTools){
|
||||||
globalMenu.AddSeparator();
|
globalMenu.AddSeparator();
|
||||||
AddDebugMenuItems(globalMenu);
|
AddDebugMenuItems(globalMenu);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ContextMenuNotification : ContextMenuBase{
|
class ContextMenuNotification : ContextMenuBase{
|
||||||
private const int MenuSkipTweet = 26600;
|
private const int MenuSkipTweet = 26600;
|
||||||
private const int MenuFreeze = 26601;
|
private const int MenuFreeze = 26601;
|
||||||
@@ -44,9 +44,9 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
if (HasDevTools){
|
||||||
AddDebugMenuItems(model);
|
AddDebugMenuItems(model);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
|
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling {
|
namespace TweetDuck.Core.Handling {
|
||||||
class JavaScriptDialogHandler : IJsDialogHandler{
|
class JavaScriptDialogHandler : IJsDialogHandler{
|
||||||
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
||||||
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class LifeSpanHandler : ILifeSpanHandler{
|
class LifeSpanHandler : ILifeSpanHandler{
|
||||||
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
||||||
newBrowser = null;
|
newBrowser = null;
|
||||||
|
68
Core/Handling/RequestHandler.cs
Normal file
68
Core/Handling/RequestHandler.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
abstract class RequestHandler : IRequestHandler{
|
||||||
|
// Browser
|
||||||
|
|
||||||
|
public virtual void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser){}
|
||||||
|
|
||||||
|
public virtual void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){}
|
||||||
|
|
||||||
|
public virtual bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resources
|
||||||
|
|
||||||
|
public virtual CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||||
|
return CefReturnValue.Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl){}
|
||||||
|
|
||||||
|
public virtual bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength){}
|
||||||
|
|
||||||
|
// JavaScript & Plugins
|
||||||
|
|
||||||
|
public virtual bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath){}
|
||||||
|
|
||||||
|
// Auth
|
||||||
|
|
||||||
|
public virtual bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port, X509Certificate2Collection certificates, ISelectClientCertificateCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
class RequestHandlerBrowser : RequestHandler{
|
||||||
|
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||||
|
browser.Reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -3,16 +3,13 @@ using System.Collections.Specialized;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ResourceHandlerNotification : IResourceHandler{
|
class ResourceHandlerNotification : IResourceHandler{
|
||||||
private readonly NameValueCollection headers = new NameValueCollection(0);
|
private readonly NameValueCollection headers = new NameValueCollection(0);
|
||||||
private MemoryStream dataIn;
|
private MemoryStream dataIn;
|
||||||
|
|
||||||
public void SetHTML(string html){
|
public void SetHTML(string html){
|
||||||
if (dataIn != null){
|
dataIn?.Dispose();
|
||||||
dataIn.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8);
|
dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +32,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
response.StatusCode = 200;
|
response.StatusCode = 200;
|
||||||
response.StatusText = "OK";
|
response.StatusText = "OK";
|
||||||
response.ResponseHeaders = headers;
|
response.ResponseHeaders = headers;
|
||||||
responseLength = dataIn != null ? dataIn.Length : -1;
|
responseLength = dataIn?.Length ?? -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){
|
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Notification {
|
namespace TweetDuck.Core.Notification {
|
||||||
partial class FormNotificationBase {
|
partial class FormNotificationBase {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
this.BackColor = System.Drawing.SystemColors.Control;
|
this.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.ClientSize = new System.Drawing.Size(284, 122);
|
this.ClientSize = new System.Drawing.Size(284, 122);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormNotification";
|
this.Name = "FormNotification";
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using CefSharp.WinForms;
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
using TweetDuck.Configuration;
|
||||||
using CefSharp.WinForms;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Core.Handling;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Core.Handling;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
partial class FormNotificationBase : Form{
|
partial class FormNotificationBase : Form{
|
||||||
protected Point PrimaryLocation{
|
protected Point PrimaryLocation{
|
||||||
get{
|
get{
|
||||||
@@ -50,23 +50,22 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsNotificationVisible{
|
public bool IsNotificationVisible => Location != ControlExtensions.InvisibleLocation;
|
||||||
get{
|
|
||||||
return Location != ControlExtensions.InvisibleLocation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new Point Location{
|
public new Point Location{
|
||||||
get{
|
get => base.Location;
|
||||||
return base.Location;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||||
|
|
||||||
|
if (WindowsUtils.ShouldAvoidToolWindow){
|
||||||
|
FormBorderStyle = Visible ? FormBorderStyle.FixedSingle : FormBorderStyle.FixedToolWindow; // workaround for alt+tab
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<bool> CanMoveWindow = () => true;
|
public Func<bool> CanMoveWindow = () => true;
|
||||||
|
protected override bool ShowWithoutActivation => true;
|
||||||
|
|
||||||
protected readonly Form owner;
|
protected readonly Form owner;
|
||||||
protected readonly ChromiumWebBrowser browser;
|
protected readonly ChromiumWebBrowser browser;
|
||||||
@@ -76,17 +75,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
private string currentColumn;
|
private string currentColumn;
|
||||||
private int pauseCounter;
|
private int pauseCounter;
|
||||||
|
|
||||||
public bool IsPaused{
|
public bool IsPaused => pauseCounter > 0;
|
||||||
get{
|
|
||||||
return pauseCounter > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool ShowWithoutActivation{
|
|
||||||
get{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FreezeTimer { get; set; }
|
public bool FreezeTimer { get; set; }
|
||||||
public bool ContextMenuOpen { get; set; }
|
public bool ContextMenuOpen { get; set; }
|
||||||
@@ -143,8 +132,8 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
|
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
|
||||||
if (e.IsBrowserInitialized && Initialized != null){
|
if (e.IsBrowserInitialized){
|
||||||
Initialized(this, new EventArgs());
|
Initialized?.Invoke(this, new EventArgs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,16 +177,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SetNotificationSize(int width, int height){
|
protected virtual void SetNotificationSize(int width, int height){
|
||||||
browser.ClientSize = ClientSize = new Size(width, height);
|
browser.ClientSize = ClientSize = new Size((int)Math.Round(width*Program.UserConfig.ZoomMultiplier), (int)Math.Round(height*Program.UserConfig.ZoomMultiplier));
|
||||||
}
|
|
||||||
|
|
||||||
protected void MoveToVisibleLocation(){
|
|
||||||
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
|
|
||||||
Location = PrimaryLocation;
|
|
||||||
|
|
||||||
if (needsReactivating){
|
|
||||||
NativeMethods.SetFormPos(this, NativeMethods.HWND_TOPMOST, NativeMethods.SWP_NOACTIVATE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnNotificationReady(){
|
protected virtual void OnNotificationReady(){
|
||||||
@@ -208,6 +188,15 @@ namespace TweetDck.Core.Notification{
|
|||||||
Text = string.IsNullOrEmpty(currentColumn) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumn;
|
Text = string.IsNullOrEmpty(currentColumn) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MoveToVisibleLocation(){
|
||||||
|
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
|
||||||
|
Location = PrimaryLocation;
|
||||||
|
|
||||||
|
if (needsReactivating){
|
||||||
|
NativeMethods.SetFormPos(this, NativeMethods.HWND_TOPMOST, NativeMethods.SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DisplayTooltip(string text){
|
public void DisplayTooltip(string text){
|
||||||
if (string.IsNullOrEmpty(text)){
|
if (string.IsNullOrEmpty(text)){
|
||||||
toolTip.Hide(this);
|
toolTip.Hide(this);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Notification {
|
namespace TweetDuck.Core.Notification {
|
||||||
partial class FormNotificationMain {
|
partial class FormNotificationMain {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
||||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||||
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
|
this.progressBarTimer = new TweetDuck.Core.Controls.FlatProgressBar();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// timerDisplayDelay
|
// timerDisplayDelay
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Resources;
|
||||||
using TweetDck.Resources;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
partial class FormNotificationMain : FormNotificationBase{
|
partial class FormNotificationMain : FormNotificationBase{
|
||||||
private const string NotificationScriptFile = "notification.js";
|
private const string NotificationScriptFile = "notification.js";
|
||||||
|
|
||||||
@@ -26,14 +26,16 @@ namespace TweetDck.Core.Notification{
|
|||||||
private static int BaseClientWidth{
|
private static int BaseClientWidth{
|
||||||
get{
|
get{
|
||||||
int level = TweetNotification.FontSizeLevel;
|
int level = TweetNotification.FontSizeLevel;
|
||||||
return level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level));
|
int width = level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level));
|
||||||
|
return (int)Math.Round(width*Program.UserConfig.ZoomMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int BaseClientHeight{
|
private static int BaseClientHeight{
|
||||||
get{
|
get{
|
||||||
int level = TweetNotification.FontSizeLevel;
|
int level = TweetNotification.FontSizeLevel;
|
||||||
return level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level));
|
int height = level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level));
|
||||||
|
return (int)Math.Round(height*Program.UserConfig.ZoomMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +46,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
|
|
||||||
private readonly NativeMethods.HookProc mouseHookDelegate;
|
private readonly NativeMethods.HookProc mouseHookDelegate;
|
||||||
private IntPtr mouseHook;
|
private IntPtr mouseHook;
|
||||||
|
private bool blockXButtonUp;
|
||||||
|
|
||||||
private bool? prevDisplayTimer;
|
private bool? prevDisplayTimer;
|
||||||
private int? prevFontSize;
|
private int? prevFontSize;
|
||||||
@@ -77,7 +80,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
||||||
|
|
||||||
mouseHookDelegate = MouseHookProc;
|
mouseHookDelegate = MouseHookProc;
|
||||||
Disposed += (sender, args) => StopMouseHook();
|
Disposed += (sender, args) => StopMouseHook(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mouse wheel hook
|
// mouse wheel hook
|
||||||
@@ -88,18 +91,45 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StopMouseHook(){
|
private void StopMouseHook(bool force){
|
||||||
if (mouseHook != IntPtr.Zero){
|
if (mouseHook != IntPtr.Zero && (force || !blockXButtonUp)){
|
||||||
NativeMethods.UnhookWindowsHookEx(mouseHook);
|
NativeMethods.UnhookWindowsHookEx(mouseHook);
|
||||||
mouseHook = IntPtr.Zero;
|
mouseHook = IntPtr.Zero;
|
||||||
|
blockXButtonUp = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
|
private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
|
||||||
if (nCode == 0 && wParam.ToInt32() == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position)) && !ContainsFocus && !owner.ContainsFocus){
|
if (nCode == 0){
|
||||||
browser.SendMouseWheelEvent(0, 0, 0, NativeMethods.GetHookWheelDelta(lParam), CefEventFlags.None);
|
int eventType = wParam.ToInt32();
|
||||||
|
|
||||||
|
if (eventType == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position)) && !ContainsFocus && !owner.ContainsFocus){
|
||||||
|
browser.SendMouseWheelEvent(0, 0, 0, NativeMethods.GetMouseHookData(lParam), CefEventFlags.None);
|
||||||
return NativeMethods.HOOK_HANDLED;
|
return NativeMethods.HOOK_HANDLED;
|
||||||
}
|
}
|
||||||
|
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
|
||||||
|
int extraButton = NativeMethods.GetMouseHookData(lParam);
|
||||||
|
|
||||||
|
if (extraButton == 2){ // forward button
|
||||||
|
this.InvokeAsyncSafe(FinishCurrentNotification);
|
||||||
|
}
|
||||||
|
else if (extraButton == 1){ // back button
|
||||||
|
this.InvokeAsyncSafe(Close);
|
||||||
|
}
|
||||||
|
|
||||||
|
blockXButtonUp = true;
|
||||||
|
return NativeMethods.HOOK_HANDLED;
|
||||||
|
}
|
||||||
|
else if (eventType == NativeMethods.WM_XBUTTONUP && blockXButtonUp){
|
||||||
|
blockXButtonUp = false;
|
||||||
|
|
||||||
|
if (!Visible){
|
||||||
|
StopMouseHook(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NativeMethods.HOOK_HANDLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NativeMethods.CallNextHookEx(mouseHook, nCode, wParam, lParam);
|
return NativeMethods.CallNextHookEx(mouseHook, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
@@ -177,7 +207,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
timerProgress.Stop();
|
timerProgress.Stop();
|
||||||
totalTime = 0;
|
totalTime = 0;
|
||||||
|
|
||||||
StopMouseHook();
|
StopMouseHook(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void FinishCurrentNotification(){
|
public override void FinishCurrentNotification(){
|
||||||
@@ -188,7 +218,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
if (!IsPaused){
|
if (!IsPaused){
|
||||||
pausedDuringNotification = IsNotificationVisible;
|
pausedDuringNotification = IsNotificationVisible;
|
||||||
timerProgress.Stop();
|
timerProgress.Stop();
|
||||||
StopMouseHook();
|
StopMouseHook(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.PauseNotification();
|
base.PauseNotification();
|
||||||
|
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace TweetDuck.Core.Notification {
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification {
|
|
||||||
partial class FormNotificationTweet {
|
partial class FormNotificationTweet {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,20 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
sealed partial class FormNotificationTweet : FormNotificationMain{
|
sealed partial class FormNotificationTweet : FormNotificationMain{
|
||||||
private const int NonIntrusiveIdleLimit = 30;
|
private const int NonIntrusiveIdleLimit = 30;
|
||||||
private const int TrimMinimum = 32;
|
private const int TrimMinimum = 32;
|
||||||
|
|
||||||
private bool IsCursorOverNotificationArea{
|
private bool IsCursorOverNotificationArea => new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
||||||
get{
|
|
||||||
return new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
||||||
private bool needsTrim;
|
private bool needsTrim;
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
|
||||||
using TweetDck.Core.Bridge;
|
|
||||||
using TweetDck.Resources;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using TweetDck.Core.Utils;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Bridge;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDuck.Core.Notification.Screenshot{
|
||||||
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||||
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
|
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
|
||||||
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDuck.Core.Notification.Screenshot{
|
||||||
sealed class TweetScreenshotManager : IDisposable{
|
sealed class TweetScreenshotManager : IDisposable{
|
||||||
private readonly Form owner;
|
private readonly Form owner;
|
||||||
private readonly Timer timeout;
|
private readonly Timer timeout;
|
||||||
@@ -16,7 +16,7 @@ namespace TweetDck.Core.Notification.Screenshot{
|
|||||||
public TweetScreenshotManager(Form owner){
|
public TweetScreenshotManager(Form owner){
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
|
||||||
this.timeout = new Timer{ Interval = 5000 };
|
this.timeout = new Timer{ Interval = 8000 };
|
||||||
this.timeout.Tick += timeout_Tick;
|
this.timeout.Tick += timeout_Tick;
|
||||||
|
|
||||||
this.disposer = new Timer{ Interval = 1 };
|
this.disposer = new Timer{ Interval = 1 };
|
||||||
@@ -61,6 +61,7 @@ namespace TweetDck.Core.Notification.Screenshot{
|
|||||||
screenshot.Location = ControlExtensions.InvisibleLocation;
|
screenshot.Location = ControlExtensions.InvisibleLocation;
|
||||||
disposer.Start();
|
disposer.Start();
|
||||||
#else
|
#else
|
||||||
|
screenshot.MoveToVisibleLocation();
|
||||||
screenshot.FormClosed += (sender, args) => disposer.Start();
|
screenshot.FormClosed += (sender, args) => disposer.Start();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -68,10 +69,7 @@ namespace TweetDck.Core.Notification.Screenshot{
|
|||||||
public void Dispose(){
|
public void Dispose(){
|
||||||
timeout.Dispose();
|
timeout.Dispose();
|
||||||
disposer.Dispose();
|
disposer.Dispose();
|
||||||
|
screenshot?.Dispose();
|
||||||
if (screenshot != null){
|
|
||||||
screenshot.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
interface ISoundNotificationPlayer : IDisposable{
|
interface ISoundNotificationPlayer : IDisposable{
|
||||||
string SupportedFormats { get; }
|
string SupportedFormats { get; }
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
sealed class PlaybackErrorEventArgs : EventArgs{
|
sealed class PlaybackErrorEventArgs : EventArgs{
|
||||||
public string Message { get; private set; }
|
public string Message { get; }
|
||||||
public bool Ignore { get; set; }
|
public bool Ignore { get; set; }
|
||||||
|
|
||||||
public PlaybackErrorEventArgs(string message){
|
public PlaybackErrorEventArgs(string message){
|
||||||
|
@@ -2,13 +2,9 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Media;
|
using System.Media;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
||||||
string ISoundNotificationPlayer.SupportedFormats{
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav";
|
||||||
get{
|
|
||||||
return "*.wav";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
|
@@ -1,15 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using WMPLib;
|
using WMPLib;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
||||||
string ISoundNotificationPlayer.SupportedFormats{
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
||||||
get{
|
|
||||||
return "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
@@ -36,6 +32,7 @@ namespace TweetDck.Core.Notification.Sound{
|
|||||||
void ISoundNotificationPlayer.Play(string file){
|
void ISoundNotificationPlayer.Play(string file){
|
||||||
wasTryingToPlay = true;
|
wasTryingToPlay = true;
|
||||||
|
|
||||||
|
try{
|
||||||
if (player.URL != file){
|
if (player.URL != file){
|
||||||
player.close();
|
player.close();
|
||||||
player.URL = file;
|
player.URL = file;
|
||||||
@@ -46,10 +43,17 @@ namespace TweetDck.Core.Notification.Sound{
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.controls.play();
|
player.controls.play();
|
||||||
|
}catch(Exception e){
|
||||||
|
OnNotificationSoundError("An error occurred in Windows Media Player: "+e.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISoundNotificationPlayer.Stop(){
|
void ISoundNotificationPlayer.Stop(){
|
||||||
|
try{
|
||||||
player.controls.stop();
|
player.controls.stop();
|
||||||
|
}catch{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDisposable.Dispose(){
|
void IDisposable.Dispose(){
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using TweetDck.Core.Notification.Sound;
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
static class SoundNotification{
|
static class SoundNotification{
|
||||||
private static bool? IsWMPAvailable;
|
private static bool? IsWMPAvailable;
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Resources;
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
sealed class TweetNotification{
|
sealed class TweetNotification{
|
||||||
private static string FontSizeClass { get; set; }
|
private static string FontSizeClass { get; set; }
|
||||||
private static string HeadTag { get; set; }
|
private static string HeadTag { get; set; }
|
||||||
|
|
||||||
private const string DefaultFontSizeClass = "medium";
|
private const string DefaultFontSizeClass = "medium";
|
||||||
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'>";
|
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'><style type='text/css'>body{background:#222426}</style>";
|
||||||
private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
|
private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
|
||||||
|
|
||||||
public static int FontSizeLevel{
|
public static int FontSizeLevel{
|
||||||
@@ -51,38 +51,22 @@ namespace TweetDck.Core.Notification{
|
|||||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Column{
|
public string Column { get; }
|
||||||
get{
|
public string TweetUrl { get; }
|
||||||
return column;
|
public string QuoteUrl { get; }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string TweetUrl{
|
|
||||||
get{
|
|
||||||
return tweetUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string QuoteUrl{
|
|
||||||
get{
|
|
||||||
return quoteUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly string column;
|
|
||||||
private readonly string html;
|
private readonly string html;
|
||||||
private readonly int characters;
|
private readonly int characters;
|
||||||
private readonly string tweetUrl;
|
|
||||||
private readonly string quoteUrl;
|
|
||||||
private readonly bool isExample;
|
private readonly bool isExample;
|
||||||
|
|
||||||
public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
|
public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
|
||||||
|
|
||||||
private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
||||||
this.column = column;
|
this.Column = column;
|
||||||
|
this.TweetUrl = tweetUrl;
|
||||||
|
this.QuoteUrl = quoteUrl;
|
||||||
|
|
||||||
this.html = html;
|
this.html = html;
|
||||||
this.tweetUrl = tweetUrl;
|
|
||||||
this.quoteUrl = quoteUrl;
|
|
||||||
this.characters = characters;
|
this.characters = characters;
|
||||||
this.isExample = isExample;
|
this.isExample = isExample;
|
||||||
}
|
}
|
||||||
|
4
Core/Other/FormAbout.Designer.cs
generated
4
Core/Other/FormAbout.Designer.cs
generated
@@ -1,6 +1,4 @@
|
|||||||
using TweetDck.Core.Controls;
|
namespace TweetDuck.Core.Other {
|
||||||
|
|
||||||
namespace TweetDck.Core.Other {
|
|
||||||
sealed partial class FormAbout {
|
sealed partial class FormAbout {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormAbout : Form{
|
sealed partial class FormAbout : Form{
|
||||||
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
||||||
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
||||||
|
2
Core/Other/FormMessage.Designer.cs
generated
2
Core/Other/FormMessage.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
partial class FormMessage {
|
partial class FormMessage {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,24 +2,15 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormMessage : Form{
|
sealed partial class FormMessage : Form{
|
||||||
public Button ClickedButton { get; private set; }
|
public Button ClickedButton { get; private set; }
|
||||||
|
|
||||||
public int ActionPanelY{
|
public int ActionPanelY => panelActions.Location.Y;
|
||||||
get{
|
|
||||||
return panelActions.Location.Y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int ClientWidth{
|
private int ClientWidth{
|
||||||
get{
|
get => ClientSize.Width;
|
||||||
return ClientSize.Width;
|
set => ClientSize = new Size(value, ClientSize.Height);
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
|
||||||
ClientSize = new Size(value, ClientSize.Height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Icon icon;
|
private readonly Icon icon;
|
||||||
|
8
Core/Other/FormPlugins.Designer.cs
generated
8
Core/Other/FormPlugins.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
partial class FormPlugins {
|
partial class FormPlugins {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.btnReload = new System.Windows.Forms.Button();
|
this.btnReload = new System.Windows.Forms.Button();
|
||||||
this.btnOpenFolder = new System.Windows.Forms.Button();
|
this.btnOpenFolder = new System.Windows.Forms.Button();
|
||||||
this.tabPanelPlugins = new TweetDck.Core.Controls.TabPanel();
|
this.tabPanelPlugins = new TweetDuck.Core.Controls.TabPanel();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
this.Controls.Add(this.btnOpenFolder);
|
this.Controls.Add(this.btnOpenFolder);
|
||||||
this.Controls.Add(this.btnReload);
|
this.Controls.Add(this.btnReload);
|
||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||||
this.MinimumSize = new System.Drawing.Size(480, 320);
|
this.MinimumSize = new System.Drawing.Size(480, 320);
|
||||||
this.Name = "FormPlugins";
|
this.Name = "FormPlugins";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
@@ -101,6 +101,6 @@
|
|||||||
private System.Windows.Forms.Button btnClose;
|
private System.Windows.Forms.Button btnClose;
|
||||||
private System.Windows.Forms.Button btnReload;
|
private System.Windows.Forms.Button btnReload;
|
||||||
private System.Windows.Forms.Button btnOpenFolder;
|
private System.Windows.Forms.Button btnOpenFolder;
|
||||||
private TweetDck.Core.Controls.TabPanel tabPanelPlugins;
|
private TweetDuck.Core.Controls.TabPanel tabPanelPlugins;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -3,13 +3,13 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Controls;
|
using TweetDuck.Plugins.Controls;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormPlugins : Form{
|
sealed partial class FormPlugins : Form{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
||||||
|
6
Core/Other/FormSettings.Designer.cs
generated
6
Core/Other/FormSettings.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
sealed partial class FormSettings {
|
sealed partial class FormSettings {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.labelTip = new System.Windows.Forms.Label();
|
this.labelTip = new System.Windows.Forms.Label();
|
||||||
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
|
this.tabPanel = new TweetDuck.Core.Controls.TabPanel();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Controls.Add(this.tabPanel);
|
this.Controls.Add(this.tabPanel);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormSettings";
|
this.Name = "FormSettings";
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other.Settings;
|
using TweetDuck.Core.Other.Settings;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Updates;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormSettings : Form{
|
sealed partial class FormSettings : Form{
|
||||||
public const int TabIndexNotification = 1;
|
public const int TabIndexNotification = 1;
|
||||||
|
|
||||||
@@ -31,9 +31,7 @@ namespace TweetDck.Core.Other{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
|
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
|
||||||
BaseTabSettings control;
|
if (tabs.TryGetValue(typeof(T), out BaseTabSettings control)){
|
||||||
|
|
||||||
if (tabs.TryGetValue(typeof(T), out control)){
|
|
||||||
tabPanel.ReplaceContent(control);
|
tabPanel.ReplaceContent(control);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@@ -1,13 +1,9 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
class BaseTabSettings : UserControl{
|
class BaseTabSettings : UserControl{
|
||||||
protected static UserConfig Config{
|
protected static UserConfig Config => Program.UserConfig;
|
||||||
get{
|
|
||||||
return Program.UserConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseTabSettings(){
|
public BaseTabSettings(){
|
||||||
Padding = new Padding(6);
|
Padding = new Padding(6);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsCSS {
|
partial class DialogSettingsCSS {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,21 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCSS : Form{
|
sealed partial class DialogSettingsCSS : Form{
|
||||||
public string BrowserCSS{
|
public string BrowserCSS => textBoxBrowserCSS.Text;
|
||||||
get{
|
public string NotificationCSS => textBoxNotificationCSS.Text;
|
||||||
return textBoxBrowserCSS.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NotificationCSS{
|
|
||||||
get{
|
|
||||||
return textBoxNotificationCSS.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Action<string> reinjectBrowserCSS;
|
private readonly Action<string> reinjectBrowserCSS;
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsCefArgs {
|
partial class DialogSettingsCefArgs {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,15 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCefArgs : Form{
|
sealed partial class DialogSettingsCefArgs : Form{
|
||||||
public string CefArgs{
|
public string CefArgs => textBoxArgs.Text;
|
||||||
get{
|
|
||||||
return textBoxArgs.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSettingsCefArgs(){
|
public DialogSettingsCefArgs(){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsExport {
|
partial class DialogSettingsExport {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsExport : Form{
|
sealed partial class DialogSettingsExport : Form{
|
||||||
public static DialogSettingsExport Import(ExportFileFlags flags){
|
public static DialogSettingsExport Import(ExportFileFlags flags){
|
||||||
return new DialogSettingsExport(flags);
|
return new DialogSettingsExport(flags);
|
||||||
@@ -13,9 +13,7 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExportFileFlags Flags{
|
public ExportFileFlags Flags{
|
||||||
get{
|
get => selectedFlags;
|
||||||
return selectedFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
// this will call events and SetFlag, which also updates the UI
|
// this will call events and SetFlag, which also updates the UI
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsRestart {
|
partial class DialogSettingsRestart {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsRestart : Form{
|
sealed partial class DialogSettingsRestart : Form{
|
||||||
private const string DefaultLocale = "en-US";
|
private const string DefaultLocale = "en-US";
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
class CombinedFileStream : IDisposable{
|
class CombinedFileStream : IDisposable{
|
||||||
public const char KeySeparator = '|';
|
public const char KeySeparator = '|';
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Entry{
|
public class Entry{
|
||||||
public string Identifier { get; private set; }
|
public string Identifier { get; }
|
||||||
|
|
||||||
public string KeyName{
|
public string KeyName{
|
||||||
get{
|
get{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum ExportFileFlags{
|
enum ExportFileFlags{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
sealed class ExportManager{
|
sealed class ExportManager{
|
||||||
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
||||||
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
||||||
@@ -27,10 +27,12 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
try{
|
try{
|
||||||
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
||||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||||
stream.WriteFile("config", Program.ConfigFilePath);
|
stream.WriteFile("config", Program.UserConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
|
stream.WriteFile("plugin.config", Program.PluginConfigFilePath);
|
||||||
|
|
||||||
foreach(Plugin plugin in plugins.Plugins){
|
foreach(Plugin plugin in plugins.Plugins){
|
||||||
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
|
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
|
||||||
try{
|
try{
|
||||||
@@ -69,6 +71,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
flags |= ExportFileFlags.Config;
|
flags |= ExportFileFlags.Config;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "plugin.config":
|
||||||
case "plugin.data":
|
case "plugin.data":
|
||||||
flags |= ExportFileFlags.PluginData;
|
flags |= ExportFileFlags.PluginData;
|
||||||
break;
|
break;
|
||||||
@@ -98,7 +101,14 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
switch(entry.KeyName){
|
switch(entry.KeyName){
|
||||||
case "config":
|
case "config":
|
||||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||||
entry.WriteToFile(Program.ConfigFilePath);
|
entry.WriteToFile(Program.UserConfigFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "plugin.config":
|
||||||
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
|
entry.WriteToFile(Program.PluginConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsAdvanced {
|
partial class TabSettingsAdvanced {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Other.Settings.Dialogs;
|
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsAdvanced : BaseTabSettings{
|
partial class TabSettingsAdvanced : BaseTabSettings{
|
||||||
private readonly Action<string> reinjectBrowserCSS;
|
private readonly Action<string> reinjectBrowserCSS;
|
||||||
private readonly PluginManager plugins;
|
private readonly PluginManager plugins;
|
||||||
@@ -19,7 +19,13 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
|
|
||||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
if (SystemConfig.IsHardwareAccelerationSupported){
|
||||||
|
checkHardwareAcceleration.Checked = Program.SystemConfig.HardwareAcceleration;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
checkHardwareAcceleration.Enabled = false;
|
||||||
|
checkHardwareAcceleration.Checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
||||||
if (bytes == -1L){
|
if (bytes == -1L){
|
||||||
@@ -56,52 +62,54 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
||||||
bool succeeded = false;
|
Program.SystemConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||||
|
Program.SystemConfig.Save();
|
||||||
if (checkHardwareAcceleration.Checked){
|
|
||||||
if (HardwareAcceleration.CanEnable){
|
|
||||||
succeeded = HardwareAcceleration.Enable();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
MessageBox.Show("Cannot enable hardware acceleration, the libraries libEGL.dll and libGLESv2.dll could not be restored.", Program.BrandName+" Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
succeeded = HardwareAcceleration.Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (succeeded){
|
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
|
|
||||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
|
||||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
||||||
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
||||||
|
|
||||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
form.VisibleChanged += (sender2, args2) => {
|
||||||
|
form.MoveToCenter(ParentForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.FormClosed += (sender2, args2) => {
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||||
|
|
||||||
|
if (form.DialogResult == DialogResult.OK){
|
||||||
Config.CustomCefArgs = form.CefArgs;
|
Config.CustomCefArgs = form.CefArgs;
|
||||||
form.Dispose();
|
form.Dispose();
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
else{
|
else form.Dispose();
|
||||||
form.Dispose();
|
};
|
||||||
}
|
|
||||||
|
form.Show(ParentForm);
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnEditCSS_Click(object sender, EventArgs e){
|
private void btnEditCSS_Click(object sender, EventArgs e){
|
||||||
using(DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS)){
|
DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS);
|
||||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
|
||||||
|
form.VisibleChanged += (sender2, args2) => {
|
||||||
|
form.MoveToCenter(ParentForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.FormClosed += (sender2, args2) => {
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||||
|
|
||||||
|
if (form.DialogResult == DialogResult.OK){
|
||||||
Config.CustomBrowserCSS = form.BrowserCSS;
|
Config.CustomBrowserCSS = form.BrowserCSS;
|
||||||
Config.CustomNotificationCSS = form.NotificationCSS;
|
Config.CustomNotificationCSS = form.NotificationCSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
||||||
}
|
form.Dispose();
|
||||||
|
};
|
||||||
|
|
||||||
|
form.Show(ParentForm);
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnExport_Click(object sender, EventArgs e){
|
private void btnExport_Click(object sender, EventArgs e){
|
||||||
@@ -180,7 +188,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void btnReset_Click(object sender, EventArgs e){
|
private void btnReset_Click(object sender, EventArgs e){
|
||||||
if (MessageBox.Show("This will reset all of your settings, including disabled plugins. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
if (MessageBox.Show("This will reset all of your program settings. Plugins will not be affected. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
Program.ResetConfig();
|
Program.ResetConfig();
|
||||||
((FormSettings)ParentForm).ReloadUI();
|
((FormSettings)ParentForm).ReloadUI();
|
||||||
}
|
}
|
||||||
|
85
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
85
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsGeneral {
|
partial class TabSettingsGeneral {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -31,12 +31,18 @@
|
|||||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||||
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
||||||
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
||||||
|
this.labelZoomValue = new System.Windows.Forms.Label();
|
||||||
|
this.checkSwitchAccountSelectors = new System.Windows.Forms.CheckBox();
|
||||||
this.groupTray = new System.Windows.Forms.GroupBox();
|
this.groupTray = new System.Windows.Forms.GroupBox();
|
||||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||||
this.groupInterface = new System.Windows.Forms.GroupBox();
|
this.groupInterface = new System.Windows.Forms.GroupBox();
|
||||||
|
this.trackBarZoom = new System.Windows.Forms.TrackBar();
|
||||||
|
this.labelZoom = new System.Windows.Forms.Label();
|
||||||
this.groupUpdates = new System.Windows.Forms.GroupBox();
|
this.groupUpdates = new System.Windows.Forms.GroupBox();
|
||||||
|
this.zoomUpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.groupTray.SuspendLayout();
|
this.groupTray.SuspendLayout();
|
||||||
this.groupInterface.SuspendLayout();
|
this.groupInterface.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).BeginInit();
|
||||||
this.groupUpdates.SuspendLayout();
|
this.groupUpdates.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -79,11 +85,11 @@
|
|||||||
// checkSpellCheck
|
// checkSpellCheck
|
||||||
//
|
//
|
||||||
this.checkSpellCheck.AutoSize = true;
|
this.checkSpellCheck.AutoSize = true;
|
||||||
this.checkSpellCheck.Location = new System.Drawing.Point(9, 44);
|
this.checkSpellCheck.Location = new System.Drawing.Point(9, 67);
|
||||||
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkSpellCheck.Name = "checkSpellCheck";
|
this.checkSpellCheck.Name = "checkSpellCheck";
|
||||||
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
|
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
|
||||||
this.checkSpellCheck.TabIndex = 1;
|
this.checkSpellCheck.TabIndex = 2;
|
||||||
this.checkSpellCheck.Text = "Enable Spell Check";
|
this.checkSpellCheck.Text = "Enable Spell Check";
|
||||||
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||||
@@ -111,12 +117,38 @@
|
|||||||
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
||||||
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// labelZoomValue
|
||||||
|
//
|
||||||
|
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.labelZoomValue.Location = new System.Drawing.Point(139, 116);
|
||||||
|
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
|
this.labelZoomValue.Name = "labelZoomValue";
|
||||||
|
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
|
||||||
|
this.labelZoomValue.TabIndex = 5;
|
||||||
|
this.labelZoomValue.Text = "100%";
|
||||||
|
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
|
||||||
|
//
|
||||||
|
// checkSwitchAccountSelectors
|
||||||
|
//
|
||||||
|
this.checkSwitchAccountSelectors.AutoSize = true;
|
||||||
|
this.checkSwitchAccountSelectors.Location = new System.Drawing.Point(9, 44);
|
||||||
|
this.checkSwitchAccountSelectors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
|
this.checkSwitchAccountSelectors.Name = "checkSwitchAccountSelectors";
|
||||||
|
this.checkSwitchAccountSelectors.Size = new System.Drawing.Size(172, 17);
|
||||||
|
this.checkSwitchAccountSelectors.TabIndex = 1;
|
||||||
|
this.checkSwitchAccountSelectors.Text = "Shift Selects Multiple Accounts";
|
||||||
|
this.toolTip.SetToolTip(this.checkSwitchAccountSelectors, "When (re)tweeting, click to select a single account or hold Shift to\r\nselect mult" +
|
||||||
|
"iple accounts, instead of TweetDeck\'s default behavior.");
|
||||||
|
this.checkSwitchAccountSelectors.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// groupTray
|
// groupTray
|
||||||
//
|
//
|
||||||
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
||||||
this.groupTray.Controls.Add(this.labelTrayIcon);
|
this.groupTray.Controls.Add(this.labelTrayIcon);
|
||||||
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
||||||
this.groupTray.Location = new System.Drawing.Point(9, 82);
|
this.groupTray.Location = new System.Drawing.Point(9, 168);
|
||||||
this.groupTray.Name = "groupTray";
|
this.groupTray.Name = "groupTray";
|
||||||
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
||||||
this.groupTray.TabIndex = 1;
|
this.groupTray.TabIndex = 1;
|
||||||
@@ -135,15 +167,47 @@
|
|||||||
//
|
//
|
||||||
// groupInterface
|
// groupInterface
|
||||||
//
|
//
|
||||||
|
this.groupInterface.Controls.Add(this.checkSwitchAccountSelectors);
|
||||||
|
this.groupInterface.Controls.Add(this.labelZoomValue);
|
||||||
|
this.groupInterface.Controls.Add(this.trackBarZoom);
|
||||||
|
this.groupInterface.Controls.Add(this.labelZoom);
|
||||||
this.groupInterface.Controls.Add(this.checkSpellCheck);
|
this.groupInterface.Controls.Add(this.checkSpellCheck);
|
||||||
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
||||||
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
||||||
this.groupInterface.Name = "groupInterface";
|
this.groupInterface.Name = "groupInterface";
|
||||||
this.groupInterface.Size = new System.Drawing.Size(183, 67);
|
this.groupInterface.Size = new System.Drawing.Size(183, 153);
|
||||||
this.groupInterface.TabIndex = 0;
|
this.groupInterface.TabIndex = 0;
|
||||||
this.groupInterface.TabStop = false;
|
this.groupInterface.TabStop = false;
|
||||||
this.groupInterface.Text = "User Interface";
|
this.groupInterface.Text = "User Interface";
|
||||||
//
|
//
|
||||||
|
// trackBarZoom
|
||||||
|
//
|
||||||
|
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.trackBarZoom.AutoSize = false;
|
||||||
|
this.trackBarZoom.LargeChange = 25;
|
||||||
|
this.trackBarZoom.Location = new System.Drawing.Point(6, 115);
|
||||||
|
this.trackBarZoom.Maximum = 200;
|
||||||
|
this.trackBarZoom.Minimum = 50;
|
||||||
|
this.trackBarZoom.Name = "trackBarZoom";
|
||||||
|
this.trackBarZoom.Size = new System.Drawing.Size(141, 30);
|
||||||
|
this.trackBarZoom.SmallChange = 5;
|
||||||
|
this.trackBarZoom.TabIndex = 4;
|
||||||
|
this.trackBarZoom.TickFrequency = 25;
|
||||||
|
this.trackBarZoom.Value = 100;
|
||||||
|
//
|
||||||
|
// labelZoom
|
||||||
|
//
|
||||||
|
this.labelZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.labelZoom.AutoSize = true;
|
||||||
|
this.labelZoom.Location = new System.Drawing.Point(5, 99);
|
||||||
|
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
|
this.labelZoom.Name = "labelZoom";
|
||||||
|
this.labelZoom.Size = new System.Drawing.Size(34, 13);
|
||||||
|
this.labelZoom.TabIndex = 3;
|
||||||
|
this.labelZoom.Text = "Zoom";
|
||||||
|
//
|
||||||
// groupUpdates
|
// groupUpdates
|
||||||
//
|
//
|
||||||
this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
|
this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
|
||||||
@@ -155,6 +219,11 @@
|
|||||||
this.groupUpdates.TabStop = false;
|
this.groupUpdates.TabStop = false;
|
||||||
this.groupUpdates.Text = "Updates";
|
this.groupUpdates.Text = "Updates";
|
||||||
//
|
//
|
||||||
|
// zoomUpdateTimer
|
||||||
|
//
|
||||||
|
this.zoomUpdateTimer.Interval = 250;
|
||||||
|
this.zoomUpdateTimer.Tick += new System.EventHandler(this.zoomUpdateTimer_Tick);
|
||||||
|
//
|
||||||
// TabSettingsGeneral
|
// TabSettingsGeneral
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -168,6 +237,7 @@
|
|||||||
this.groupTray.PerformLayout();
|
this.groupTray.PerformLayout();
|
||||||
this.groupInterface.ResumeLayout(false);
|
this.groupInterface.ResumeLayout(false);
|
||||||
this.groupInterface.PerformLayout();
|
this.groupInterface.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).EndInit();
|
||||||
this.groupUpdates.ResumeLayout(false);
|
this.groupUpdates.ResumeLayout(false);
|
||||||
this.groupUpdates.PerformLayout();
|
this.groupUpdates.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
@@ -187,5 +257,10 @@
|
|||||||
private System.Windows.Forms.GroupBox groupUpdates;
|
private System.Windows.Forms.GroupBox groupUpdates;
|
||||||
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
||||||
private System.Windows.Forms.Button btnCheckUpdates;
|
private System.Windows.Forms.Button btnCheckUpdates;
|
||||||
|
private System.Windows.Forms.Label labelZoom;
|
||||||
|
private System.Windows.Forms.Label labelZoomValue;
|
||||||
|
private System.Windows.Forms.TrackBar trackBarZoom;
|
||||||
|
private System.Windows.Forms.Timer zoomUpdateTimer;
|
||||||
|
private System.Windows.Forms.CheckBox checkSwitchAccountSelectors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Updates.Events;
|
using TweetDuck.Updates;
|
||||||
|
using TweetDuck.Updates.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsGeneral : BaseTabSettings{
|
partial class TabSettingsGeneral : BaseTabSettings{
|
||||||
private readonly UpdateHandler updates;
|
private readonly UpdateHandler updates;
|
||||||
private int updateCheckEventId = -1;
|
private int updateCheckEventId = -1;
|
||||||
@@ -22,7 +23,12 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
comboBoxTrayType.Items.Add("Combined");
|
comboBoxTrayType.Items.Add("Combined");
|
||||||
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
||||||
|
|
||||||
|
toolTip.SetToolTip(trackBarZoom, toolTip.GetToolTip(labelZoomValue));
|
||||||
|
trackBarZoom.SetValueSafe(Config.ZoomLevel);
|
||||||
|
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||||
|
|
||||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||||
|
checkSwitchAccountSelectors.Checked = Config.SwitchAccountSelectors;
|
||||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||||
|
|
||||||
@@ -31,7 +37,9 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
|
|
||||||
public override void OnReady(){
|
public override void OnReady(){
|
||||||
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||||
|
checkSwitchAccountSelectors.CheckedChanged += checkSwitchAccountSelectors_CheckedChanged;
|
||||||
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||||
|
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
|
||||||
|
|
||||||
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
||||||
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
||||||
@@ -40,15 +48,34 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
btnCheckUpdates.Click += btnCheckUpdates_Click;
|
btnCheckUpdates.Click += btnCheckUpdates_Click;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnClosing(){
|
||||||
|
Config.ZoomLevel = trackBarZoom.Value;
|
||||||
|
}
|
||||||
|
|
||||||
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
|
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
|
||||||
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkSwitchAccountSelectors_CheckedChanged(object sender, EventArgs e){
|
||||||
|
Config.SwitchAccountSelectors = checkSwitchAccountSelectors.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
||||||
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void trackBarZoom_ValueChanged(object sender, EventArgs e){
|
||||||
|
if (trackBarZoom.Value % trackBarZoom.SmallChange != 0){
|
||||||
|
trackBarZoom.Value = trackBarZoom.SmallChange*(int)Math.Floor(((double)trackBarZoom.Value/trackBarZoom.SmallChange)+0.5);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
zoomUpdateTimer.Stop();
|
||||||
|
zoomUpdateTimer.Start();
|
||||||
|
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||||
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||||
}
|
}
|
||||||
@@ -82,5 +109,10 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void zoomUpdateTimer_Tick(object sender, EventArgs e){
|
||||||
|
Config.ZoomLevel = trackBarZoom.Value;
|
||||||
|
zoomUpdateTimer.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsNotifications {
|
partial class TabSettingsNotifications {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
||||||
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
||||||
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.btnDurationMedium = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationMedium = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.btnDurationLong = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationLong = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.btnDurationShort = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationShort = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.labelDurationValue = new System.Windows.Forms.Label();
|
this.labelDurationValue = new System.Windows.Forms.Label();
|
||||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||||
@@ -48,9 +48,9 @@
|
|||||||
this.labelIdlePause = new System.Windows.Forms.Label();
|
this.labelIdlePause = new System.Windows.Forms.Label();
|
||||||
this.comboBoxIdlePause = new System.Windows.Forms.ComboBox();
|
this.comboBoxIdlePause = new System.Windows.Forms.ComboBox();
|
||||||
this.checkNonIntrusive = new System.Windows.Forms.CheckBox();
|
this.checkNonIntrusive = new System.Windows.Forms.CheckBox();
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
|
||||||
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
|
||||||
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
||||||
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.groupNotificationLocation.SuspendLayout();
|
this.groupNotificationLocation.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
||||||
this.groupNotificationDuration.SuspendLayout();
|
this.groupNotificationDuration.SuspendLayout();
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxDisplay.FormattingEnabled = true;
|
this.comboBoxDisplay.FormattingEnabled = true;
|
||||||
this.comboBoxDisplay.Location = new System.Drawing.Point(8, 160);
|
this.comboBoxDisplay.Location = new System.Drawing.Point(6, 160);
|
||||||
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
||||||
this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21);
|
this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21);
|
||||||
this.comboBoxDisplay.TabIndex = 6;
|
this.comboBoxDisplay.TabIndex = 6;
|
||||||
@@ -185,12 +185,13 @@
|
|||||||
//
|
//
|
||||||
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.trackBarEdgeDistance.AutoSize = false;
|
||||||
this.trackBarEdgeDistance.LargeChange = 8;
|
this.trackBarEdgeDistance.LargeChange = 8;
|
||||||
this.trackBarEdgeDistance.Location = new System.Drawing.Point(8, 212);
|
this.trackBarEdgeDistance.Location = new System.Drawing.Point(8, 212);
|
||||||
this.trackBarEdgeDistance.Maximum = 40;
|
this.trackBarEdgeDistance.Maximum = 40;
|
||||||
this.trackBarEdgeDistance.Minimum = 8;
|
this.trackBarEdgeDistance.Minimum = 8;
|
||||||
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
||||||
this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 45);
|
this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 30);
|
||||||
this.trackBarEdgeDistance.SmallChange = 2;
|
this.trackBarEdgeDistance.SmallChange = 2;
|
||||||
this.trackBarEdgeDistance.TabIndex = 8;
|
this.trackBarEdgeDistance.TabIndex = 8;
|
||||||
this.trackBarEdgeDistance.TickFrequency = 4;
|
this.trackBarEdgeDistance.TickFrequency = 4;
|
||||||
@@ -288,11 +289,12 @@
|
|||||||
//
|
//
|
||||||
this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.trackBarDuration.AutoSize = false;
|
||||||
this.trackBarDuration.Location = new System.Drawing.Point(6, 19);
|
this.trackBarDuration.Location = new System.Drawing.Point(6, 19);
|
||||||
this.trackBarDuration.Maximum = 60;
|
this.trackBarDuration.Maximum = 60;
|
||||||
this.trackBarDuration.Minimum = 10;
|
this.trackBarDuration.Minimum = 10;
|
||||||
this.trackBarDuration.Name = "trackBarDuration";
|
this.trackBarDuration.Name = "trackBarDuration";
|
||||||
this.trackBarDuration.Size = new System.Drawing.Size(128, 45);
|
this.trackBarDuration.Size = new System.Drawing.Size(128, 30);
|
||||||
this.trackBarDuration.TabIndex = 0;
|
this.trackBarDuration.TabIndex = 0;
|
||||||
this.trackBarDuration.TickFrequency = 5;
|
this.trackBarDuration.TickFrequency = 5;
|
||||||
this.trackBarDuration.Value = 25;
|
this.trackBarDuration.Value = 25;
|
||||||
@@ -342,7 +344,7 @@
|
|||||||
//
|
//
|
||||||
this.labelIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.labelIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.labelIdlePause.AutoSize = true;
|
this.labelIdlePause.AutoSize = true;
|
||||||
this.labelIdlePause.Location = new System.Drawing.Point(3, 141);
|
this.labelIdlePause.Location = new System.Drawing.Point(5, 141);
|
||||||
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelIdlePause.Name = "labelIdlePause";
|
this.labelIdlePause.Name = "labelIdlePause";
|
||||||
this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
|
this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
|
||||||
@@ -374,17 +376,6 @@
|
|||||||
"delayed until the cursor moves away to prevent accidental clicks.");
|
"delayed until the cursor moves away to prevent accidental clicks.");
|
||||||
this.checkNonIntrusive.UseVisualStyleBackColor = true;
|
this.checkNonIntrusive.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// checkNotificationTimer
|
|
||||||
//
|
|
||||||
this.checkNotificationTimer.AutoSize = true;
|
|
||||||
this.checkNotificationTimer.Location = new System.Drawing.Point(9, 44);
|
|
||||||
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
|
||||||
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
|
||||||
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
|
|
||||||
this.checkNotificationTimer.TabIndex = 1;
|
|
||||||
this.checkNotificationTimer.Text = "Display Notification Timer";
|
|
||||||
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkTimerCountDown
|
// checkTimerCountDown
|
||||||
//
|
//
|
||||||
this.checkTimerCountDown.AutoSize = true;
|
this.checkTimerCountDown.AutoSize = true;
|
||||||
@@ -397,6 +388,17 @@
|
|||||||
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
|
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
|
||||||
this.checkTimerCountDown.UseVisualStyleBackColor = true;
|
this.checkTimerCountDown.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// checkNotificationTimer
|
||||||
|
//
|
||||||
|
this.checkNotificationTimer.AutoSize = true;
|
||||||
|
this.checkNotificationTimer.Location = new System.Drawing.Point(9, 44);
|
||||||
|
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
|
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
||||||
|
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
|
||||||
|
this.checkNotificationTimer.TabIndex = 1;
|
||||||
|
this.checkNotificationTimer.Text = "Display Notification Timer";
|
||||||
|
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// TabSettingsNotifications
|
// TabSettingsNotifications
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -411,7 +413,6 @@
|
|||||||
this.groupNotificationLocation.PerformLayout();
|
this.groupNotificationLocation.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
|
||||||
this.groupNotificationDuration.ResumeLayout(false);
|
this.groupNotificationDuration.ResumeLayout(false);
|
||||||
this.groupNotificationDuration.PerformLayout();
|
|
||||||
this.tableLayoutDurationButtons.ResumeLayout(false);
|
this.tableLayoutDurationButtons.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit();
|
||||||
this.groupUserInterface.ResumeLayout(false);
|
this.groupUserInterface.ResumeLayout(false);
|
||||||
@@ -439,9 +440,9 @@
|
|||||||
private System.Windows.Forms.Label labelDurationValue;
|
private System.Windows.Forms.Label labelDurationValue;
|
||||||
private System.Windows.Forms.TrackBar trackBarDuration;
|
private System.Windows.Forms.TrackBar trackBarDuration;
|
||||||
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationMedium;
|
private TweetDuck.Core.Controls.FlatButton btnDurationMedium;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationLong;
|
private TweetDuck.Core.Controls.FlatButton btnDurationLong;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationShort;
|
private TweetDuck.Core.Controls.FlatButton btnDurationShort;
|
||||||
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
||||||
private System.Windows.Forms.Label labelIdlePause;
|
private System.Windows.Forms.Label labelIdlePause;
|
||||||
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsNotifications : BaseTabSettings{
|
partial class TabSettingsNotifications : BaseTabSettings{
|
||||||
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
|
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
|
||||||
|
|
||||||
this.notification.Move += (sender, args) => {
|
this.notification.Move += (sender, args) => {
|
||||||
if (radioLocCustom.Checked){
|
if (radioLocCustom.Checked && this.notification.Location != ControlExtensions.InvisibleLocation){
|
||||||
Config.CustomNotificationPosition = this.notification.Location;
|
Config.CustomNotificationPosition = this.notification.Location;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -37,6 +37,9 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
|
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
|
||||||
|
|
||||||
|
toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue));
|
||||||
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
||||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||||
|
|
||||||
@@ -73,7 +76,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
radioLocTR.CheckedChanged += radioLoc_CheckedChanged;
|
radioLocTR.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
radioLocBL.CheckedChanged += radioLoc_CheckedChanged;
|
radioLocBL.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
|
radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
radioLocCustom.CheckedChanged += radioLoc_CheckedChanged;
|
radioLocCustom.Click += radioLocCustom_Click;
|
||||||
|
|
||||||
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
|
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
|
||||||
btnDurationShort.Click += btnDurationShort_Click;
|
btnDurationShort.Click += btnDurationShort_Click;
|
||||||
@@ -111,16 +114,30 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
|
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
|
||||||
else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight;
|
else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight;
|
||||||
else if (radioLocCustom.Checked){
|
|
||||||
|
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = true;
|
||||||
|
notification.ShowNotificationForSettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void radioLocCustom_Click(object sender, EventArgs e){
|
||||||
if (!Config.IsCustomNotificationPositionSet){
|
if (!Config.IsCustomNotificationPositionSet){
|
||||||
Config.CustomNotificationPosition = notification.Location;
|
Config.CustomNotificationPosition = notification.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.NotificationPosition = TweetNotification.Position.Custom;
|
Config.NotificationPosition = TweetNotification.Position.Custom;
|
||||||
}
|
|
||||||
|
|
||||||
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
|
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = false;
|
||||||
notification.ShowNotificationForSettings(false);
|
notification.ShowNotificationForSettings(false);
|
||||||
|
|
||||||
|
if (notification.IsFullyOutsideView() && MessageBox.Show("The notification seems to be outside of view, would you like to reset its position?", "Notification is outside view", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
|
Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
|
notification.MoveToVisibleLocation();
|
||||||
|
|
||||||
|
Config.CustomNotificationPosition = notification.Location;
|
||||||
|
|
||||||
|
Config.NotificationPosition = TweetNotification.Position.Custom;
|
||||||
|
notification.MoveToVisibleLocation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
|
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsSounds {
|
partial class TabSettingsSounds {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Notification.Sound;
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsSounds : BaseTabSettings{
|
partial class TabSettingsSounds : BaseTabSettings{
|
||||||
private readonly ISoundNotificationPlayer soundNotification;
|
private readonly ISoundNotificationPlayer soundNotification;
|
||||||
|
|
||||||
|
2
Core/TrayIcon.Designer.cs
generated
2
Core/TrayIcon.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core {
|
namespace TweetDuck.Core {
|
||||||
partial class TrayIcon {
|
partial class TrayIcon {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDuck.Core{
|
||||||
partial class TrayIcon : Component{
|
partial class TrayIcon : Component{
|
||||||
public enum Behavior{ // keep order
|
public enum Behavior{ // keep order
|
||||||
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
||||||
@@ -12,9 +12,7 @@ namespace TweetDck.Core{
|
|||||||
public event EventHandler ClickClose;
|
public event EventHandler ClickClose;
|
||||||
|
|
||||||
public bool Visible{
|
public bool Visible{
|
||||||
get{
|
get => notifyIcon.Visible;
|
||||||
return notifyIcon.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (value){
|
if (value){
|
||||||
@@ -72,9 +70,7 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemRestore_Click(object sender, EventArgs e){
|
private void menuItemRestore_Click(object sender, EventArgs e){
|
||||||
if (ClickRestore != null){
|
ClickRestore?.Invoke(this, e);
|
||||||
ClickRestore(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemMuteNotifications_Click(object sender, EventArgs e){
|
private void menuItemMuteNotifications_Click(object sender, EventArgs e){
|
||||||
@@ -83,9 +79,7 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemClose_Click(object sender, EventArgs e){
|
private void menuItemClose_Click(object sender, EventArgs e){
|
||||||
if (ClickClose != null){
|
ClickClose?.Invoke(this, e);
|
||||||
ClickClose(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ using System.IO;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class BrowserCache{
|
static class BrowserCache{
|
||||||
private static bool ClearOnExit { get; set; }
|
private static bool ClearOnExit { get; set; }
|
||||||
|
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Drawing;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class BrowserUtils{
|
static class BrowserUtils{
|
||||||
public static string HeaderAcceptLanguage{
|
public static string HeaderAcceptLanguage{
|
||||||
get{
|
get{
|
||||||
@@ -23,11 +23,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string HeaderUserAgent{
|
public static string HeaderUserAgent => Program.BrandName+" "+Application.ProductVersion;
|
||||||
get{
|
|
||||||
return Program.BrandName+" "+Application.ProductVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||||
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
|
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
|
||||||
@@ -37,9 +33,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static bool IsValidUrl(string url){
|
public static bool IsValidUrl(string url){
|
||||||
Uri uri;
|
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||||
|
|
||||||
if (Uri.TryCreate(url, UriKind.Absolute, out uri)){
|
|
||||||
string scheme = uri.Scheme;
|
string scheme = uri.Scheme;
|
||||||
return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto;
|
return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto;
|
||||||
}
|
}
|
||||||
@@ -75,17 +69,32 @@ namespace TweetDck.Core.Utils{
|
|||||||
return ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
return ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DownloadFileAsync(string url, string target, Action<Exception> onFailure){
|
public static WebClient DownloadFileAsync(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||||
WebClient client = new WebClient{ Proxy = null };
|
WebClient client = new WebClient{ Proxy = null };
|
||||||
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
||||||
|
|
||||||
client.DownloadFileCompleted += (sender, args) => {
|
client.DownloadFileCompleted += (sender, args) => {
|
||||||
if (args.Error != null){
|
if (args.Cancelled){
|
||||||
onFailure(args.Error);
|
try{
|
||||||
|
File.Delete(target);
|
||||||
|
}catch{
|
||||||
|
// didn't want it deleted anyways
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.Error != null){
|
||||||
|
onFailure?.Invoke(args.Error);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
onSuccess?.Invoke();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
client.DownloadFileAsync(new Uri(url), target);
|
client.DownloadFileAsync(new Uri(url), target);
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetZoomLevel(IBrowser browser, int percentage){
|
||||||
|
browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsTweetDeckWebsite(IFrame frame){
|
public static bool IsTweetDeckWebsite(IFrame frame){
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class CommandLineArgs{
|
class CommandLineArgs{
|
||||||
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
||||||
CommandLineArgs args = new CommandLineArgs();
|
CommandLineArgs args = new CommandLineArgs();
|
||||||
@@ -35,11 +35,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
private readonly HashSet<string> flags = new HashSet<string>();
|
private readonly HashSet<string> flags = new HashSet<string>();
|
||||||
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
|
||||||
|
|
||||||
public int Count{
|
public int Count => flags.Count+values.Count;
|
||||||
get{
|
|
||||||
return flags.Count+values.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddFlag(string flag){
|
public void AddFlag(string flag){
|
||||||
flags.Add(flag.ToLowerInvariant());
|
flags.Add(flag.ToLowerInvariant());
|
||||||
@@ -62,8 +58,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string GetValue(string key, string defaultValue){
|
public string GetValue(string key, string defaultValue){
|
||||||
string val;
|
return values.TryGetValue(key.ToLowerInvariant(), out string val) ? val : defaultValue;
|
||||||
return values.TryGetValue(key.ToLowerInvariant(), out val) ? val : defaultValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveValue(string key){
|
public void RemoveValue(string key){
|
||||||
|
@@ -1,14 +1,9 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class CommandLineArgsParser{
|
static class CommandLineArgsParser{
|
||||||
private static Regex splitRegex;
|
private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled), false);
|
||||||
|
|
||||||
private static Regex SplitRegex{
|
|
||||||
get{
|
|
||||||
return splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommandLineArgs ReadCefArguments(string argumentString){
|
public static CommandLineArgs ReadCefArguments(string argumentString){
|
||||||
CommandLineArgs args = new CommandLineArgs();
|
CommandLineArgs args = new CommandLineArgs();
|
||||||
@@ -17,7 +12,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Match match in SplitRegex.Matches(argumentString)){
|
foreach(Match match in SplitRegex.Value.Matches(argumentString)){
|
||||||
string matchValue = match.Value;
|
string matchValue = match.Value;
|
||||||
|
|
||||||
int indexEquals = matchValue.IndexOf('=');
|
int indexEquals = matchValue.IndexOf('=');
|
||||||
|
@@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
|
||||||
static class HardwareAcceleration{
|
|
||||||
private static readonly string LibEGL = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libEGL.dll");
|
|
||||||
private static readonly string LibGLES = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libGLESv2.dll");
|
|
||||||
|
|
||||||
private static readonly string DisabledLibEGL = LibEGL+".bak";
|
|
||||||
private static readonly string DisabledLibGLES = LibGLES+".bak";
|
|
||||||
|
|
||||||
public static bool IsEnabled{
|
|
||||||
get{
|
|
||||||
return File.Exists(LibEGL) && File.Exists(LibGLES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool CanEnable{
|
|
||||||
get{
|
|
||||||
return File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Enable(){
|
|
||||||
if (IsEnabled)return false;
|
|
||||||
|
|
||||||
try{
|
|
||||||
File.Move(DisabledLibEGL, LibEGL);
|
|
||||||
File.Move(DisabledLibGLES, LibGLES);
|
|
||||||
return true;
|
|
||||||
}catch{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Disable(){
|
|
||||||
if (!IsEnabled)return false;
|
|
||||||
|
|
||||||
try{
|
|
||||||
if (File.Exists(DisabledLibEGL)){
|
|
||||||
File.Delete(DisabledLibEGL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(DisabledLibGLES)){
|
|
||||||
File.Delete(DisabledLibGLES);
|
|
||||||
}
|
|
||||||
}catch{
|
|
||||||
// woops
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
File.Move(LibEGL, DisabledLibEGL);
|
|
||||||
File.Move(LibGLES, DisabledLibGLES);
|
|
||||||
return true;
|
|
||||||
}catch{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class InjectedHTML{
|
class InjectedHTML{
|
||||||
public enum Position{
|
public enum Position{
|
||||||
Before, After
|
Before, After
|
||||||
|
@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class NativeCoreAudio{
|
static class NativeCoreAudio{
|
||||||
private const int EDATAFLOW_RENDER = 0;
|
private const int EDATAFLOW_RENDER = 0;
|
||||||
private const int EROLE_MULTIMEDIA = 1;
|
private const int EROLE_MULTIMEDIA = 1;
|
||||||
|
@@ -4,7 +4,7 @@ using System.Drawing;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
|
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
|
||||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
|
||||||
static class NativeMethods{
|
static class NativeMethods{
|
||||||
@@ -13,12 +13,17 @@ namespace TweetDck.Core.Utils{
|
|||||||
|
|
||||||
public const int HWND_TOPMOST = -1;
|
public const int HWND_TOPMOST = -1;
|
||||||
public const uint SWP_NOACTIVATE = 0x0010;
|
public const uint SWP_NOACTIVATE = 0x0010;
|
||||||
|
public const int WS_DISABLED = 0x08000000;
|
||||||
|
public const int GWL_STYLE = -16;
|
||||||
|
|
||||||
public const int SB_HORZ = 0;
|
public const int SB_HORZ = 0;
|
||||||
public const int BCM_SETSHIELD = 0x160C;
|
public const int BCM_SETSHIELD = 0x160C;
|
||||||
|
|
||||||
public const int WM_MOUSE_LL = 14;
|
public const int WM_MOUSE_LL = 14;
|
||||||
public const int WM_MOUSEWHEEL = 0x020A;
|
public const int WM_MOUSEWHEEL = 0x020A;
|
||||||
|
public const int WM_XBUTTONDOWN = 0x020B;
|
||||||
|
public const int WM_XBUTTONUP = 0x020C;
|
||||||
|
public const int WM_PARENTNOTIFY = 0x0210;
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
private struct LASTINPUTINFO{
|
private struct LASTINPUTINFO{
|
||||||
@@ -80,11 +85,26 @@ namespace TweetDck.Core.Utils{
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||||
|
|
||||||
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
||||||
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetHookWheelDelta(IntPtr ptr){
|
public static void SetFormDisabled(Form form, bool disabled){
|
||||||
|
if (disabled){
|
||||||
|
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) | WS_DISABLED);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) & ~WS_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetMouseHookData(IntPtr ptr){
|
||||||
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
|
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class TwoKeyDictionary<K1, K2, V>{
|
class TwoKeyDictionary<K1, K2, V>{
|
||||||
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
||||||
private readonly int innerCapacity;
|
private readonly int innerCapacity;
|
||||||
@@ -21,9 +21,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
set{
|
set{
|
||||||
Dictionary<K2, V> innerDict;
|
if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (!dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,9 +42,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
// Members
|
// Members
|
||||||
|
|
||||||
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
|
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
|
||||||
Dictionary<K2, V> innerDict;
|
if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (!dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +50,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Clear(){
|
public void Clear(){
|
||||||
this.dict.Clear();
|
dict.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
|
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
|
||||||
@@ -83,10 +79,8 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(K1 outerKey, K2 innerKey){
|
public bool Remove(K1 outerKey, K2 innerKey){
|
||||||
Dictionary<K2, V> innerDict;
|
if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict) && innerDict.Remove(innerKey)){
|
||||||
|
if (innerDict.Count == 0) {
|
||||||
if (dict.TryGetValue(outerKey, out innerDict) && innerDict.Remove(innerKey)){
|
|
||||||
if (innerDict.Count == 0){
|
|
||||||
dict.Remove(outerKey);
|
dict.Remove(outerKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +90,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
||||||
Dictionary<K2, V> innerDict;
|
if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
return innerDict.TryGetValue(innerKey, out value);
|
return innerDict.TryGetValue(innerKey, out value);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class WindowState{
|
class WindowState{
|
||||||
private Rectangle rect;
|
private Rectangle rect;
|
||||||
@@ -20,7 +20,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
form.WindowState = isMaximized ? FormWindowState.Maximized : FormWindowState.Normal;
|
form.WindowState = isMaximized ? FormWindowState.Maximized : FormWindowState.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rect == Rectangle.Empty && firstTimeFullscreen) || !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds))){
|
if ((rect == Rectangle.Empty && firstTimeFullscreen) || form.IsFullyOutsideView()){
|
||||||
form.DesktopBounds = Screen.PrimaryScreen.WorkingArea;
|
form.DesktopBounds = Screen.PrimaryScreen.WorkingArea;
|
||||||
form.WindowState = FormWindowState.Maximized;
|
form.WindowState = FormWindowState.Maximized;
|
||||||
Save(form);
|
Save(form);
|
||||||
|
@@ -6,8 +6,18 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class WindowsUtils{
|
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);
|
||||||
|
|
||||||
|
public static bool ShouldAvoidToolWindow { get; }
|
||||||
|
|
||||||
|
static WindowsUtils(){
|
||||||
|
Version ver = Environment.OSVersion.Version;
|
||||||
|
ShouldAvoidToolWindow = ver.Major == 6 && ver.Minor == 2; // windows 8/10
|
||||||
|
}
|
||||||
|
|
||||||
public static bool CheckFolderWritePermission(string path){
|
public static bool CheckFolderWritePermission(string path){
|
||||||
string testFile = Path.Combine(path, ".test");
|
string testFile = Path.Combine(path, ".test");
|
||||||
|
|
||||||
@@ -47,6 +57,21 @@ namespace TweetDck.Core.Utils{
|
|||||||
return false;
|
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(){
|
public static void ClipboardStripHtmlStyles(){
|
||||||
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
||||||
return;
|
return;
|
||||||
@@ -55,10 +80,10 @@ namespace TweetDck.Core.Utils{
|
|||||||
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||||
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
||||||
|
|
||||||
string updatedHtml = ClipboardRegexes.RegexStripHtmlStyles.Replace(originalHtml, string.Empty);
|
string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty);
|
||||||
|
|
||||||
int removed = originalHtml.Length-updatedHtml.Length;
|
int removed = originalHtml.Length-updatedHtml.Length;
|
||||||
updatedHtml = ClipboardRegexes.RegexOffsetClipboardHtml.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||||
|
|
||||||
DataObject obj = new DataObject();
|
DataObject obj = new DataObject();
|
||||||
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
||||||
@@ -83,10 +108,5 @@ namespace TweetDck.Core.Utils{
|
|||||||
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e);
|
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ClipboardRegexes{ // delays construction of regular expressions until needed
|
|
||||||
public static readonly Regex RegexStripHtmlStyles = new Regex(@"\s?(?:style|class)="".*?""");
|
|
||||||
public static readonly Regex RegexOffsetClipboardHtml = new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
Plugins/Controls/PluginControl.Designer.cs
generated
2
Plugins/Controls/PluginControl.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Controls {
|
namespace TweetDuck.Plugins.Controls {
|
||||||
partial class PluginControl {
|
partial class PluginControl {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -3,9 +3,9 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
partial class PluginControl : UserControl{
|
partial class PluginControl : UserControl{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
private readonly Plugin plugin;
|
private readonly Plugin plugin;
|
||||||
@@ -61,7 +61,7 @@ namespace TweetDck.Plugins.Controls{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePluginState(){
|
private void UpdatePluginState(){
|
||||||
bool isEnabled = plugin.CanRun && pluginManager.Config.IsEnabled(plugin);
|
bool isEnabled = pluginManager.Config.IsEnabled(plugin) && plugin.CanRun;
|
||||||
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
|
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
|
||||||
|
|
||||||
labelVersion.ForeColor = textColor;
|
labelVersion.ForeColor = textColor;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
||||||
public PluginListFlowLayout(){
|
public PluginListFlowLayout(){
|
||||||
FlowDirection = FlowDirection.TopDown;
|
FlowDirection = FlowDirection.TopDown;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum PluginEnvironment{
|
enum PluginEnvironment{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
enum PluginFolder{
|
enum PluginFolder{
|
||||||
Root, Data
|
Root, Data
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
enum PluginGroup{
|
enum PluginGroup{
|
||||||
Official, Custom
|
Official, Custom
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDuck.Plugins.Events{
|
||||||
class PluginChangedStateEventArgs : EventArgs{
|
class PluginChangedStateEventArgs : EventArgs{
|
||||||
public Plugin Plugin { get; private set; }
|
public Plugin Plugin { get; }
|
||||||
public bool IsEnabled { get; private set; }
|
public bool IsEnabled { get; }
|
||||||
|
|
||||||
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
|
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
|
@@ -1,13 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDuck.Plugins.Events{
|
||||||
class PluginErrorEventArgs : EventArgs{
|
class PluginErrorEventArgs : EventArgs{
|
||||||
public bool HasErrors{
|
public bool HasErrors => Errors.Count > 0;
|
||||||
get{
|
|
||||||
return Errors.Count > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IList<string> Errors;
|
public IList<string> Errors;
|
||||||
|
|
||||||
|
@@ -3,55 +3,45 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
class Plugin{
|
class Plugin{
|
||||||
public string Identifier { get { return identifier; } }
|
public string Identifier { get; }
|
||||||
public string Name { get { return metadata["NAME"]; } }
|
public PluginGroup Group { get; }
|
||||||
public string Description { get { return metadata["DESCRIPTION"]; } }
|
|
||||||
public string Author { get { return metadata["AUTHOR"]; } }
|
|
||||||
public string Version { get { return metadata["VERSION"]; } }
|
|
||||||
public string Website { get { return metadata["WEBSITE"]; } }
|
|
||||||
public string ConfigFile { get { return metadata["CONFIGFILE"]; } }
|
|
||||||
public string ConfigDefault { get { return metadata["CONFIGDEFAULT"]; } }
|
|
||||||
public string RequiredVersion { get { return metadata["REQUIRES"]; } }
|
|
||||||
public PluginGroup Group { get; private set; }
|
|
||||||
public PluginEnvironment Environments { get; private set; }
|
public PluginEnvironment Environments { get; private set; }
|
||||||
|
|
||||||
|
public string Name => metadata["NAME"];
|
||||||
|
public string Description => metadata["DESCRIPTION"];
|
||||||
|
public string Author => metadata["AUTHOR"];
|
||||||
|
public string Version => metadata["VERSION"];
|
||||||
|
public string Website => metadata["WEBSITE"];
|
||||||
|
public string ConfigFile => metadata["CONFIGFILE"];
|
||||||
|
public string ConfigDefault => metadata["CONFIGDEFAULT"];
|
||||||
|
public string RequiredVersion => metadata["REQUIRES"];
|
||||||
|
|
||||||
public bool CanRun{
|
public bool CanRun{
|
||||||
get{
|
get => canRun ?? (canRun = CheckRequiredVersion(RequiredVersion)).Value;
|
||||||
return canRun ?? (canRun = CheckRequiredVersion(RequiredVersion)).Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasConfig{
|
public bool HasConfig{
|
||||||
get{
|
get => ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
|
||||||
return ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ConfigPath{
|
public string ConfigPath{
|
||||||
get{
|
get => HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
|
||||||
return HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasDefaultConfig{
|
public bool HasDefaultConfig{
|
||||||
get{
|
get => ConfigDefault.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigDefault).Length > 0;
|
||||||
return ConfigDefault.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigDefault).Length > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DefaultConfigPath{
|
public string DefaultConfigPath{
|
||||||
get{
|
get => HasDefaultConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigDefault) : string.Empty;
|
||||||
return HasDefaultConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigDefault) : string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string pathRoot;
|
private readonly string pathRoot;
|
||||||
private readonly string pathData;
|
private readonly string pathData;
|
||||||
private readonly string identifier;
|
|
||||||
private readonly Dictionary<string, string> metadata = new Dictionary<string, string>(4){
|
private readonly Dictionary<string, string> metadata = new Dictionary<string, string>(4){
|
||||||
{ "NAME", "" },
|
{ "NAME", "" },
|
||||||
{ "DESCRIPTION", "" },
|
{ "DESCRIPTION", "" },
|
||||||
@@ -72,7 +62,7 @@ namespace TweetDck.Plugins{
|
|||||||
this.pathRoot = path;
|
this.pathRoot = path;
|
||||||
this.pathData = Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name);
|
this.pathData = Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name);
|
||||||
|
|
||||||
this.identifier = group.GetIdentifierPrefix()+name;
|
this.Identifier = group.GetIdentifierPrefix()+name;
|
||||||
this.Group = group;
|
this.Group = group;
|
||||||
this.Environments = PluginEnvironment.None;
|
this.Environments = PluginEnvironment.None;
|
||||||
}
|
}
|
||||||
@@ -83,27 +73,11 @@ namespace TweetDck.Plugins{
|
|||||||
if (configPath.Length > 0 && defaultConfigPath.Length > 0 && !File.Exists(configPath) && File.Exists(defaultConfigPath)){
|
if (configPath.Length > 0 && defaultConfigPath.Length > 0 && !File.Exists(configPath) && File.Exists(defaultConfigPath)){
|
||||||
string dataFolder = GetPluginFolder(PluginFolder.Data);
|
string dataFolder = GetPluginFolder(PluginFolder.Data);
|
||||||
|
|
||||||
if (!Directory.Exists(dataFolder)){ // config migration
|
|
||||||
string originalFile = Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigFile);
|
|
||||||
|
|
||||||
if (File.Exists(originalFile)){
|
|
||||||
try{
|
|
||||||
Directory.CreateDirectory(dataFolder);
|
|
||||||
File.Copy(originalFile, configPath, false);
|
|
||||||
File.Delete(originalFile); // will fail without write perms in program folder, ignore if so
|
|
||||||
}catch{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Directory.CreateDirectory(dataFolder);
|
Directory.CreateDirectory(dataFolder);
|
||||||
File.Copy(defaultConfigPath, configPath, false);
|
File.Copy(defaultConfigPath, configPath, false);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+identifier+"' plugin.", true, e);
|
Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+Identifier+"' plugin.", true, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,12 +128,12 @@ namespace TweetDck.Plugins{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode(){
|
public override int GetHashCode(){
|
||||||
return identifier.GetHashCode();
|
return Identifier.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj){
|
public override bool Equals(object obj){
|
||||||
Plugin plugin = obj as Plugin;
|
Plugin plugin = obj as Plugin;
|
||||||
return plugin != null && plugin.identifier.Equals(identifier);
|
return plugin != null && plugin.Identifier.Equals(Identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Plugin CreateFromFolder(string path, PluginGroup group, out string error){
|
public static Plugin CreateFromFolder(string path, PluginGroup group, out string error){
|
||||||
@@ -236,9 +210,7 @@ namespace TweetDck.Plugins{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version ver;
|
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out Version _))){
|
||||||
|
|
||||||
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out ver))){
|
|
||||||
error = "Plugin contains invalid version: "+plugin.RequiredVersion;
|
error = "Plugin contains invalid version: "+plugin.RequiredVersion;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
class PluginBridge{
|
class PluginBridge{
|
||||||
private static string SanitizeCacheKey(string key){
|
private static string SanitizeCacheKey(string key){
|
||||||
return key.Replace('\\', '/').Trim();
|
return key.Replace('\\', '/').Trim();
|
||||||
@@ -16,11 +16,7 @@ namespace TweetDck.Plugins{
|
|||||||
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2);
|
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2);
|
||||||
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1);
|
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1);
|
||||||
|
|
||||||
public IEnumerable<InjectedHTML> NotificationInjections{
|
public IEnumerable<InjectedHTML> NotificationInjections => notificationInjections.InnerValues;
|
||||||
get{
|
|
||||||
return notificationInjections.InnerValues;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PluginBridge(PluginManager manager){
|
public PluginBridge(PluginManager manager){
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
@@ -64,9 +60,7 @@ namespace TweetDck.Plugins{
|
|||||||
private string ReadFileUnsafe(int token, string cacheKey, string fullPath, bool readCached){
|
private string ReadFileUnsafe(int token, string cacheKey, string fullPath, bool readCached){
|
||||||
cacheKey = SanitizeCacheKey(cacheKey);
|
cacheKey = SanitizeCacheKey(cacheKey);
|
||||||
|
|
||||||
string cachedContents;
|
if (readCached && fileCache.TryGetValue(token, cacheKey, out string cachedContents)){
|
||||||
|
|
||||||
if (readCached && fileCache.TryGetValue(token, cacheKey, out cachedContents)){
|
|
||||||
return cachedContents;
|
return cachedContents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,41 +1,75 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using TweetDck.Plugins.Events;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
sealed class PluginConfig{
|
sealed class PluginConfig{
|
||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
|
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
|
||||||
|
|
||||||
public IEnumerable<string> DisabledPlugins{
|
public IEnumerable<string> DisabledPlugins => Disabled;
|
||||||
get{
|
public bool AnyDisabled => Disabled.Count > 0;
|
||||||
return Disabled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AnyDisabled{
|
private readonly HashSet<string> Disabled = new HashSet<string>{
|
||||||
get{
|
"official/clear-columns",
|
||||||
return Disabled.Count > 0;
|
"official/reply-account"
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private readonly HashSet<string> Disabled = new HashSet<string>();
|
public void ImportLegacy(PluginConfig config){
|
||||||
|
Disabled.Clear();
|
||||||
|
|
||||||
|
foreach(string plugin in config.Disabled){
|
||||||
|
Disabled.Add(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetEnabled(Plugin plugin, bool enabled){
|
public void SetEnabled(Plugin plugin, bool enabled){
|
||||||
if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){
|
if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){
|
||||||
if (InternalPluginChangedState != null){
|
InternalPluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||||
InternalPluginChangedState(this, new PluginChangedStateEventArgs(plugin, enabled));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEnabled(Plugin plugin){
|
public bool IsEnabled(Plugin plugin){
|
||||||
return !Disabled.Contains(plugin.Identifier) && plugin.CanRun;
|
return !Disabled.Contains(plugin.Identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisableOfficialFromConfig(string pluginName){
|
public void Load(string file){
|
||||||
Disabled.Add("official/"+pluginName);
|
try{
|
||||||
|
using(FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
using(StreamReader reader = new StreamReader(stream, Encoding.UTF8)){
|
||||||
|
string line = reader.ReadLine();
|
||||||
|
|
||||||
|
if (line == "#Disabled"){
|
||||||
|
Disabled.Clear();
|
||||||
|
|
||||||
|
while((line = reader.ReadLine()) != null){
|
||||||
|
Disabled.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(FileNotFoundException){
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Plugin Configuration Error", "Could not read the plugin configuration file. If you continue, the list of disabled plugins will be reset to default.", true, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(string file){
|
||||||
|
try{
|
||||||
|
using(FileStream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
|
using(StreamWriter writer = new StreamWriter(stream, Encoding.UTF8)){
|
||||||
|
writer.WriteLine("#Disabled");
|
||||||
|
|
||||||
|
foreach(string disabled in Disabled){
|
||||||
|
writer.WriteLine(disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Plugin Configuration Error", "Could not save the plugin configuration file.", true, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CefSharp;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Events;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Resources;
|
||||||
using TweetDck.Resources;
|
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
sealed class PluginManager{
|
sealed class PluginManager{
|
||||||
public const string PluginBrowserScriptFile = "plugins.browser.js";
|
public const string PluginBrowserScriptFile = "plugins.browser.js";
|
||||||
public const string PluginNotificationScriptFile = "plugins.notification.js";
|
public const string PluginNotificationScriptFile = "plugins.notification.js";
|
||||||
@@ -15,50 +15,62 @@ namespace TweetDck.Plugins{
|
|||||||
|
|
||||||
private const int InvalidToken = 0;
|
private const int InvalidToken = 0;
|
||||||
|
|
||||||
public string PathOfficialPlugins { get { return Path.Combine(rootPath, "official"); } }
|
public string PathOfficialPlugins => Path.Combine(rootPath, "official");
|
||||||
public string PathCustomPlugins { get { return Path.Combine(rootPath, "user"); } }
|
public string PathCustomPlugins => Path.Combine(rootPath, "user");
|
||||||
|
|
||||||
public IEnumerable<Plugin> Plugins { get { return plugins; } }
|
public IEnumerable<Plugin> Plugins => plugins;
|
||||||
public PluginConfig Config { get; private set; }
|
public PluginConfig Config { get; }
|
||||||
public PluginBridge Bridge { get; private set; }
|
public PluginBridge Bridge { get; }
|
||||||
|
|
||||||
public event EventHandler<PluginErrorEventArgs> Reloaded;
|
public event EventHandler<PluginErrorEventArgs> Reloaded;
|
||||||
public event EventHandler<PluginErrorEventArgs> Executed;
|
public event EventHandler<PluginErrorEventArgs> Executed;
|
||||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||||
|
|
||||||
private readonly string rootPath;
|
private readonly string rootPath;
|
||||||
|
private readonly string configPath;
|
||||||
|
|
||||||
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
|
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
|
||||||
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
|
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
|
||||||
private readonly Random rand = new Random();
|
private readonly Random rand = new Random();
|
||||||
|
|
||||||
private List<string> loadErrors;
|
private List<string> loadErrors;
|
||||||
|
|
||||||
public PluginManager(string path, PluginConfig config){
|
public PluginManager(string rootPath, string configPath){
|
||||||
this.rootPath = path;
|
this.rootPath = rootPath;
|
||||||
this.SetConfig(config);
|
this.configPath = configPath;
|
||||||
|
|
||||||
|
this.Config = new PluginConfig();
|
||||||
this.Bridge = new PluginBridge(this);
|
this.Bridge = new PluginBridge(this);
|
||||||
|
|
||||||
|
LoadConfig();
|
||||||
|
|
||||||
|
Config.InternalPluginChangedState += Config_InternalPluginChangedState;
|
||||||
Program.UserConfigReplaced += Program_UserConfigReplaced;
|
Program.UserConfigReplaced += Program_UserConfigReplaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadConfig(){
|
||||||
|
#pragma warning disable 612
|
||||||
|
if (Program.UserConfig.Plugins != null){
|
||||||
|
Config.ImportLegacy(Program.UserConfig.Plugins);
|
||||||
|
Config.Save(configPath);
|
||||||
|
|
||||||
|
Program.UserConfig.Plugins = null;
|
||||||
|
Program.UserConfig.Save();
|
||||||
|
}
|
||||||
|
#pragma warning restore 612
|
||||||
|
else{
|
||||||
|
Config.Load(configPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Program_UserConfigReplaced(object sender, EventArgs e){
|
private void Program_UserConfigReplaced(object sender, EventArgs e){
|
||||||
SetConfig(Program.UserConfig.Plugins);
|
LoadConfig();
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){
|
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||||
if (PluginChangedState != null){
|
PluginChangedState?.Invoke(this, e);
|
||||||
PluginChangedState(this, e);
|
Config.Save(configPath);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetConfig(PluginConfig config){
|
|
||||||
if (this.Config != null){
|
|
||||||
this.Config.InternalPluginChangedState -= Config_InternalPluginChangedState;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Config = config;
|
|
||||||
this.Config.InternalPluginChangedState += Config_InternalPluginChangedState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPluginInstalled(string identifier){
|
public bool IsPluginInstalled(string identifier){
|
||||||
@@ -88,8 +100,7 @@ namespace TweetDck.Plugins{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plugin GetPluginFromToken(int token){
|
public Plugin GetPluginFromToken(int token){
|
||||||
Plugin plugin;
|
return tokens.TryGetValue(token, out Plugin plugin) ? plugin : null;
|
||||||
return tokens.TryGetValue(token, out plugin) ? plugin : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reload(){
|
public void Reload(){
|
||||||
@@ -106,9 +117,7 @@ namespace TweetDck.Plugins{
|
|||||||
plugins.Add(plugin);
|
plugins.Add(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Reloaded != null){
|
Reloaded?.Invoke(this, new PluginErrorEventArgs(loadErrors));
|
||||||
Reloaded(this, new PluginErrorEventArgs(loadErrors));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled){
|
public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled){
|
||||||
@@ -120,7 +129,7 @@ namespace TweetDck.Plugins{
|
|||||||
|
|
||||||
foreach(Plugin plugin in Plugins){
|
foreach(Plugin plugin in Plugins){
|
||||||
string path = plugin.GetScriptPath(environment);
|
string path = plugin.GetScriptPath(environment);
|
||||||
if (string.IsNullOrEmpty(path) || !plugin.CanRun || (!includeDisabled && !Config.IsEnabled(plugin)))continue;
|
if (string.IsNullOrEmpty(path) || (!includeDisabled && !Config.IsEnabled(plugin)) || !plugin.CanRun)continue;
|
||||||
|
|
||||||
string script;
|
string script;
|
||||||
|
|
||||||
@@ -144,9 +153,7 @@ namespace TweetDck.Plugins{
|
|||||||
ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:"+plugin);
|
ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:"+plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Executed != null){
|
Executed?.Invoke(this, new PluginErrorEventArgs(failedPlugins));
|
||||||
Executed(this, new PluginErrorEventArgs(failedPlugins));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<Plugin> LoadPluginsFrom(string path, PluginGroup group){
|
private IEnumerable<Plugin> LoadPluginsFrom(string path, PluginGroup group){
|
||||||
@@ -155,8 +162,7 @@ namespace TweetDck.Plugins{
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){
|
foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){
|
||||||
string error;
|
Plugin plugin = Plugin.CreateFromFolder(fullDir, group, out string error);
|
||||||
Plugin plugin = Plugin.CreateFromFolder(fullDir, group, out error);
|
|
||||||
|
|
||||||
if (plugin == null){
|
if (plugin == null){
|
||||||
loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+error);
|
loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+error);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
static class PluginScriptGenerator{
|
static class PluginScriptGenerator{
|
||||||
public static string GenerateConfig(PluginConfig config){
|
public static string GenerateConfig(PluginConfig config){
|
||||||
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty;
|
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty;
|
||||||
|
73
Program.cs
73
Program.cs
@@ -1,27 +1,27 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using TweetDck.Configuration;
|
|
||||||
using TweetDck.Core;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using TweetDck.Plugins;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDuck.Core.Handling;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Plugins;
|
||||||
|
using TweetDuck.Plugins.Events;
|
||||||
|
using TweetDuck.Updates;
|
||||||
|
|
||||||
namespace TweetDck{
|
namespace TweetDuck{
|
||||||
static class Program{
|
static class Program{
|
||||||
public const string BrandName = "TweetDuck";
|
public const string BrandName = "TweetDuck";
|
||||||
public const string Website = "https://tweetduck.chylex.com";
|
public const string Website = "https://tweetduck.chylex.com";
|
||||||
|
|
||||||
public const string VersionTag = "1.7.2";
|
public const string VersionTag = "1.7.7";
|
||||||
public const string VersionFull = "1.7.2.0";
|
public const string VersionFull = "1.7.7.0";
|
||||||
|
|
||||||
public static readonly Version Version = new Version(VersionTag);
|
public static readonly Version Version = new Version(VersionTag);
|
||||||
public static readonly bool IsPortable = File.Exists("makeportable");
|
public static readonly bool IsPortable = File.Exists("makeportable");
|
||||||
@@ -29,20 +29,26 @@ namespace TweetDck{
|
|||||||
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath();
|
public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath();
|
||||||
|
|
||||||
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
|
|
||||||
public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
|
||||||
private static readonly string ErrorLogFilePath = Path.Combine(StoragePath, "TD_Log.txt");
|
|
||||||
private static readonly string ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt");
|
|
||||||
|
|
||||||
public static readonly string ScriptPath = Path.Combine(ProgramPath, "scripts");
|
public static readonly string ScriptPath = Path.Combine(ProgramPath, "scripts");
|
||||||
public static readonly string PluginPath = Path.Combine(ProgramPath, "plugins");
|
public static readonly string PluginPath = Path.Combine(ProgramPath, "plugins");
|
||||||
|
|
||||||
|
public static readonly string UserConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
||||||
|
public static readonly string SystemConfigFilePath = Path.Combine(StoragePath, "TD_SystemConfig.cfg");
|
||||||
|
public static readonly string PluginConfigFilePath = Path.Combine(StoragePath, "TD_PluginConfig.cfg");
|
||||||
|
|
||||||
|
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
|
||||||
|
private static readonly string InstallerPath = Path.Combine(StoragePath, "TD_Updates");
|
||||||
|
|
||||||
|
private static string ErrorLogFilePath => Path.Combine(StoragePath, "TD_Log.txt");
|
||||||
|
private static string ConsoleLogFilePath => Path.Combine(StoragePath, "TD_Console.txt");
|
||||||
|
|
||||||
public static uint WindowRestoreMessage;
|
public static uint WindowRestoreMessage;
|
||||||
|
|
||||||
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath, ".lock"));
|
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath, ".lock"));
|
||||||
private static bool HasCleanedUp;
|
private static bool HasCleanedUp;
|
||||||
|
|
||||||
public static UserConfig UserConfig { get; private set; }
|
public static UserConfig UserConfig { get; private set; }
|
||||||
|
public static SystemConfig SystemConfig { get; private set; }
|
||||||
public static Reporter Reporter { get; private set; }
|
public static Reporter Reporter { get; private set; }
|
||||||
|
|
||||||
public static event EventHandler UserConfigReplaced;
|
public static event EventHandler UserConfigReplaced;
|
||||||
@@ -121,28 +127,33 @@ namespace TweetDck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReloadConfig();
|
ReloadConfig();
|
||||||
|
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
|
||||||
|
|
||||||
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
||||||
ExportManager.ImportCookies();
|
ExportManager.ImportCookies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Arguments.HasFlag(Arguments.ArgUpdated)){
|
||||||
|
WindowsUtils.TryDeleteFolderWhenAble(InstallerPath, 8000);
|
||||||
|
}
|
||||||
|
|
||||||
CefSharpSettings.WcfEnabled = false;
|
CefSharpSettings.WcfEnabled = false;
|
||||||
|
|
||||||
CefSettings settings = new CefSettings{
|
CefSettings settings = new CefSettings{
|
||||||
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
|
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
|
||||||
UserAgent = BrowserUtils.HeaderUserAgent,
|
UserAgent = BrowserUtils.HeaderUserAgent,
|
||||||
Locale = Arguments.GetValue(Arguments.ArgLocale, string.Empty),
|
Locale = Arguments.GetValue(Arguments.ArgLocale, string.Empty),
|
||||||
|
BrowserSubprocessPath = BrandName+".Browser.exe",
|
||||||
CachePath = StoragePath,
|
CachePath = StoragePath,
|
||||||
LogFile = ConsoleLogFilePath,
|
LogFile = ConsoleLogFilePath,
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
BrowserSubprocessPath = BrandName+".Browser.exe",
|
|
||||||
LogSeverity = Arguments.HasFlag(Arguments.ArgLogging) ? LogSeverity.Info : LogSeverity.Disable
|
LogSeverity = Arguments.HasFlag(Arguments.ArgLogging) ? LogSeverity.Info : LogSeverity.Disable
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
CommandLineArgsParser.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
CommandLineArgsParser.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
||||||
|
|
||||||
if (!HardwareAcceleration.IsEnabled){
|
if (!SystemConfig.HardwareAcceleration){
|
||||||
settings.CefCommandLineArgs["disable-gpu"] = "1";
|
settings.CefCommandLineArgs["disable-gpu"] = "1";
|
||||||
settings.CefCommandLineArgs["disable-gpu-vsync"] = "1";
|
settings.CefCommandLineArgs["disable-gpu-vsync"] = "1";
|
||||||
}
|
}
|
||||||
@@ -155,14 +166,15 @@ namespace TweetDck{
|
|||||||
|
|
||||||
Application.ApplicationExit += (sender, args) => ExitCleanup();
|
Application.ApplicationExit += (sender, args) => ExitCleanup();
|
||||||
|
|
||||||
PluginManager plugins = new PluginManager(PluginPath, UserConfig.Plugins);
|
PluginManager plugins = new PluginManager(PluginPath, PluginConfigFilePath);
|
||||||
plugins.Reloaded += plugins_Reloaded;
|
plugins.Reloaded += plugins_Reloaded;
|
||||||
plugins.Executed += plugins_Executed;
|
plugins.Executed += plugins_Executed;
|
||||||
plugins.Reload();
|
plugins.Reload();
|
||||||
|
|
||||||
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{
|
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{
|
||||||
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
|
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
|
||||||
DismissedUpdate = UserConfig.DismissedUpdate
|
DismissedUpdate = UserConfig.DismissedUpdate,
|
||||||
|
InstallerDownloadFolder = InstallerPath
|
||||||
});
|
});
|
||||||
|
|
||||||
Application.Run(mainForm);
|
Application.Run(mainForm);
|
||||||
@@ -171,7 +183,7 @@ namespace TweetDck{
|
|||||||
ExitCleanup();
|
ExitCleanup();
|
||||||
|
|
||||||
// ProgramPath has a trailing backslash
|
// ProgramPath has a trailing backslash
|
||||||
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentClean().ToString().Replace("\"", "^\"")+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentForInstallerCmd()+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
||||||
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
|
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
|
||||||
|
|
||||||
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated);
|
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated);
|
||||||
@@ -212,17 +224,14 @@ namespace TweetDck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ReloadConfig(){
|
public static void ReloadConfig(){
|
||||||
UserConfig = UserConfig.Load(ConfigFilePath);
|
UserConfig = UserConfig.Load(UserConfigFilePath);
|
||||||
|
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
|
||||||
if (UserConfigReplaced != null){
|
|
||||||
UserConfigReplaced(UserConfig, new EventArgs());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResetConfig(){
|
public static void ResetConfig(){
|
||||||
try{
|
try{
|
||||||
File.Delete(ConfigFilePath);
|
File.Delete(UserConfigFilePath);
|
||||||
File.Delete(UserConfig.GetBackupFile(ConfigFilePath));
|
File.Delete(UserConfig.GetBackupFile(UserConfigFilePath));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e);
|
Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e);
|
||||||
return;
|
return;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
using TweetDck;
|
using System.Runtime.InteropServices;
|
||||||
|
using TweetDuck;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
@@ -37,7 +37,7 @@ using TweetDck;
|
|||||||
[assembly: AssemblyVersion(Program.VersionFull)]
|
[assembly: AssemblyVersion(Program.VersionFull)]
|
||||||
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
||||||
|
|
||||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
|
|
||||||
|
4
Properties/Resources.Designer.cs
generated
4
Properties/Resources.Designer.cs
generated
@@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace TweetDck.Properties {
|
namespace TweetDuck.Properties {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace TweetDck.Properties {
|
|||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TweetDck.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TweetDuck.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
# Build Instructions
|
# Build Instructions
|
||||||
|
|
||||||
The program was build using Visual Studio 2013. After opening the solution, make sure you have **CefSharp.WinForms** and **Microsoft.VC120.CRT.JetBrains** included - if not, download them using NuGet.
|
The program was built using Visual Studio 2017. After opening the solution, make sure you have **CefSharp.WinForms** and **Microsoft.VC120.CRT.JetBrains** included - if not, download them using NuGet.
|
||||||
```
|
```
|
||||||
PM> Install-Package CefSharp.WinForms -Version 57.0.0-pre01
|
PM> Install-Package CefSharp.WinForms -Version 57.0.0
|
||||||
PM> Install-Package Microsoft.VC120.CRT.JetBrains
|
PM> Install-Package Microsoft.VC120.CRT.JetBrains
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -5,9 +5,9 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDck{
|
namespace TweetDuck{
|
||||||
class Reporter{
|
class Reporter{
|
||||||
private readonly string logFile;
|
private readonly string logFile;
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ Clear columns
|
|||||||
|
|
||||||
[description]
|
[description]
|
||||||
- Adds buttons and keyboard shortcuts to quickly clear columns
|
- Adds buttons and keyboard shortcuts to quickly clear columns
|
||||||
- Hold Shift when clicking or using a keyboard shortcut to reset the column instead
|
- Hold Shift when clicking or using a keyboard shortcut to restore the column instead
|
||||||
|
|
||||||
[author]
|
[author]
|
||||||
chylex
|
chylex
|
||||||
|
@@ -38,7 +38,7 @@ enabled(){
|
|||||||
$(document).off("mousemove", this.eventKeyUp);
|
$(document).off("mousemove", this.eventKeyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#clear-columns-btn-all").text(pressed ? "Reset all" : "Clear all");
|
$("#clear-columns-btn-all").text(pressed ? "Restore columns" : "Clear columns");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ enabled(){
|
|||||||
replaceMustache("column/column_header.mustache", "</header>", [
|
replaceMustache("column/column_header.mustache", "</header>", [
|
||||||
'{{^isTemporary}}',
|
'{{^isTemporary}}',
|
||||||
'<a class="column-header-link" href="#" data-action="td-clearcolumns-dosingle" style="right:34px">',
|
'<a class="column-header-link" href="#" data-action="td-clearcolumns-dosingle" style="right:34px">',
|
||||||
'<i class="icon icon-clear-timeline"></i>',
|
'<i class="icon icon-clear-timeline js-show-tip" data-placement="bottom" data-original-title="Clear column (hold Shift to restore)"></i>',
|
||||||
'</a>',
|
'</a>',
|
||||||
'{{/isTemporary}}',
|
'{{/isTemporary}}',
|
||||||
'</header>'
|
'</header>'
|
||||||
@@ -94,7 +94,7 @@ enabled(){
|
|||||||
'<dd class="keyboard-shortcut-definition" style="white-space:nowrap">',
|
'<dd class="keyboard-shortcut-definition" style="white-space:nowrap">',
|
||||||
'<span class="text-like-keyboard-key">1</span> … <span class="text-like-keyboard-key">9</span> + <span class="text-like-keyboard-key">Del</span> Clear column 1-9',
|
'<span class="text-like-keyboard-key">1</span> … <span class="text-like-keyboard-key">9</span> + <span class="text-like-keyboard-key">Del</span> Clear column 1-9',
|
||||||
'</dd><dd class="keyboard-shortcut-definition">',
|
'</dd><dd class="keyboard-shortcut-definition">',
|
||||||
'<span class="text-like-keyboard-key">Alt</span> + <span class="text-like-keyboard-key">Del</span> Clear all',
|
'<span class="text-like-keyboard-key">Alt</span> + <span class="text-like-keyboard-key">Del</span> Clear all columns',
|
||||||
'</dd></dl><dl'
|
'</dd></dl><dl'
|
||||||
].join(""));
|
].join(""));
|
||||||
|
|
||||||
@@ -116,11 +116,18 @@ ready(){
|
|||||||
|
|
||||||
// add clear all button
|
// add clear all button
|
||||||
$("nav.app-navigator").first().append([
|
$("nav.app-navigator").first().append([
|
||||||
'<a class="link-clean cf app-nav-link padding-h--10" data-title="Clear all" data-action="td-clearcolumns-doall">',
|
'<a id="clear-columns-btn-all-parent" class="js-header-action link-clean cf app-nav-link padding-h--10" data-title="Clear columns (hold Shift to restore)" data-action="td-clearcolumns-doall">',
|
||||||
'<div class="obj-left margin-l--2"><i class="icon icon-medium icon-clear-timeline"></i></div>',
|
'<div class="obj-left margin-l--2"><i class="icon icon-medium icon-clear-timeline"></i></div>',
|
||||||
'<div id="clear-columns-btn-all" class="nbfc padding-ts hide-condensed txt-size--16">Clear all</div>',
|
'<div id="clear-columns-btn-all" class="nbfc padding-ts hide-condensed txt-size--16">Clear columns</div>',
|
||||||
'</a></nav>'
|
'</a></nav>'
|
||||||
].join(""));
|
].join(""));
|
||||||
|
|
||||||
|
// setup tooltip handling
|
||||||
|
var tooltipEvents = $._data($(".js-header-action")[0]).events;
|
||||||
|
|
||||||
|
if (tooltipEvents.mouseover && tooltipEvents.mouseover.length && tooltipEvents.mouseout && tooltipEvents.mouseout.length){
|
||||||
|
$("#clear-columns-btn-all-parent").on("mouseover", tooltipEvents.mouseover[0].handler).on("mouseout", tooltipEvents.mouseout[0].handler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disabled(){
|
disabled(){
|
||||||
|
@@ -16,6 +16,7 @@ enabled(){
|
|||||||
hideTweetActions: true,
|
hideTweetActions: true,
|
||||||
moveTweetActionsToRight: true,
|
moveTweetActionsToRight: true,
|
||||||
revertReplies: false,
|
revertReplies: false,
|
||||||
|
themeColorTweaks: true,
|
||||||
roundedScrollBars: false,
|
roundedScrollBars: false,
|
||||||
smallComposeTextSize: false,
|
smallComposeTextSize: false,
|
||||||
optimizeAnimations: true,
|
optimizeAnimations: true,
|
||||||
@@ -54,6 +55,7 @@ enabled(){
|
|||||||
$TDP.checkFileExists(this.$token, configFile).then(exists => {
|
$TDP.checkFileExists(this.$token, configFile).then(exists => {
|
||||||
if (!exists){
|
if (!exists){
|
||||||
loadConfigObject(null);
|
loadConfigObject(null);
|
||||||
|
$TDP.writeFile(this.$token, configFile, JSON.stringify(this.defaultConfig));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$TDP.readFile(this.$token, configFile, true).then(contents => {
|
$TDP.readFile(this.$token, configFile, true).then(contents => {
|
||||||
@@ -199,6 +201,7 @@ enabled(){
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
TD.settings.setTheme($(this).attr("data-td-theme"));
|
TD.settings.setTheme($(this).attr("data-td-theme"));
|
||||||
$(document).trigger("uiToggleTheme");
|
$(document).trigger("uiToggleTheme");
|
||||||
|
me.reinjectAll();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
}).methods({
|
}).methods({
|
||||||
@@ -227,6 +230,70 @@ enabled(){
|
|||||||
this.$pluginSettings.requiresPageReload = enable;
|
this.$pluginSettings.requiresPageReload = enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// animation optimization
|
||||||
|
this.optimizations = null;
|
||||||
|
this.optimizationTimer = null;
|
||||||
|
|
||||||
|
let clearOptimizationTimer = () => {
|
||||||
|
if (this.optimizationTimer){
|
||||||
|
window.clearTimeout(this.optimizationTimer);
|
||||||
|
this.optimizationTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let runOptimizationTimer = timeout => {
|
||||||
|
if (!this.optimizationTimer){
|
||||||
|
this.optimizationTimer = window.setTimeout(optimizationTimerFunc, timeout);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let optimizationTimerFunc = () => {
|
||||||
|
this.optimizationTimer = null;
|
||||||
|
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
$TD.getIdleSeconds().then(s => {
|
||||||
|
if (s >= 16){
|
||||||
|
disableOptimizations();
|
||||||
|
runOptimizationTimer(2500);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
injectOptimizations();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let injectOptimizations = force => {
|
||||||
|
if (!this.optimizations && (force || document.hasFocus())){
|
||||||
|
this.optimizations = window.TDPF_createCustomStyle(this);
|
||||||
|
this.optimizations.insert(".app-content { will-change: transform }");
|
||||||
|
this.optimizations.insert(".column-holder { will-change: transform }");
|
||||||
|
}
|
||||||
|
|
||||||
|
clearOptimizationTimer();
|
||||||
|
runOptimizationTimer(10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
let disableOptimizations = () => {
|
||||||
|
if (this.optimizations){
|
||||||
|
this.optimizations.remove();
|
||||||
|
this.optimizations = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onWindowFocusEvent = () => {
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
injectOptimizations(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onWindowBlurEvent = () => {
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
disableOptimizations();
|
||||||
|
clearOptimizationTimer();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// css and layout injection
|
// css and layout injection
|
||||||
this.resetDesign = () => {
|
this.resetDesign = () => {
|
||||||
if (this.css){
|
if (this.css){
|
||||||
@@ -239,12 +306,36 @@ enabled(){
|
|||||||
this.reinjectAll = () => {
|
this.reinjectAll = () => {
|
||||||
this.resetDesign();
|
this.resetDesign();
|
||||||
|
|
||||||
|
clearOptimizationTimer();
|
||||||
|
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
injectOptimizations();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
disableOptimizations();
|
||||||
|
}
|
||||||
|
|
||||||
this.css.insert("#general_settings .cf { display: none !important }");
|
this.css.insert("#general_settings .cf { display: none !important }");
|
||||||
this.css.insert("#general_settings .divider-bar::after { display: inline-block; padding-top: 10px; line-height: 17px; content: 'Use the new | Edit layout & design | option in the Settings to modify TweetDeck theme, column width, font size, and other features.' }");
|
this.css.insert("#general_settings .divider-bar::after { display: inline-block; padding-top: 10px; line-height: 17px; content: 'Use the new | Edit layout & design | option in the Settings to modify TweetDeck theme, column width, font size, and other features.' }");
|
||||||
|
|
||||||
this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }");
|
this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }");
|
||||||
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");
|
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");
|
||||||
|
|
||||||
|
if (this.config.themeColorTweaks){
|
||||||
|
switch(TD.settings.getTheme()){
|
||||||
|
case "dark":
|
||||||
|
this.css.insert(".app-content, .app-columns-container { background-color: #444448 }");
|
||||||
|
this.css.insert(".column-drag-handle { opacity: 0.5 }");
|
||||||
|
this.css.insert(".column-drag-handle:hover { opacity: 1 }");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "light":
|
||||||
|
this.css.insert(".scroll-styled-v::-webkit-scrollbar-thumb, .scroll-styled-h::-webkit-scrollbar-thumb { background-color: #d2d6da }");
|
||||||
|
this.css.insert(".app-columns-container.scroll-styled-h::-webkit-scrollbar-thumb:not(:hover) { background-color: #a5aeb5 }");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.config.hideTweetActions){
|
if (this.config.hideTweetActions){
|
||||||
this.css.insert(".tweet-action { opacity: 0; }");
|
this.css.insert(".tweet-action { opacity: 0; }");
|
||||||
this.css.insert(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important }");
|
this.css.insert(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important }");
|
||||||
@@ -268,11 +359,12 @@ enabled(){
|
|||||||
this.css.insert(".antiscroll-scrollbar { border-radius: 0 }");
|
this.css.insert(".antiscroll-scrollbar { border-radius: 0 }");
|
||||||
this.css.insert(".antiscroll-scrollbar-vertical { margin-top: 0 }");
|
this.css.insert(".antiscroll-scrollbar-vertical { margin-top: 0 }");
|
||||||
this.css.insert(".antiscroll-scrollbar-horizontal { margin-left: 0 }");
|
this.css.insert(".antiscroll-scrollbar-horizontal { margin-left: 0 }");
|
||||||
|
this.css.insert(".app-columns-container::-webkit-scrollbar { height: 9px !important }");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.optimizeAnimations){
|
if (this.config.revertReplies){
|
||||||
this.css.insert(".app-content { will-change: transform }");
|
this.css.insert(".activity-header + .tweet .tweet-context { margin-left: -35px }");
|
||||||
this.css.insert(".column-holder { will-change: transform }");
|
this.css.insert(".activity-header + .tweet .tweet-context .obj-left { margin-right: 5px }");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.columnWidth[0] === '/'){
|
if (this.config.columnWidth[0] === '/'){
|
||||||
@@ -311,6 +403,7 @@ enabled(){
|
|||||||
"<style type='text/css'>",
|
"<style type='text/css'>",
|
||||||
".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }",
|
".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }",
|
||||||
".avatar { border-radius: "+this.config.avatarRadius+"% !important }",
|
".avatar { border-radius: "+this.config.avatarRadius+"% !important }",
|
||||||
|
(this.config.revertReplies ? ".activity-header + .tweet .tweet-context { margin-left: -35px } .activity-header + .tweet .tweet-context .obj-left { margin-right: 5px }" : ""),
|
||||||
"</style>"
|
"</style>"
|
||||||
].join(""));
|
].join(""));
|
||||||
};
|
};
|
||||||
@@ -338,6 +431,10 @@ ready(){
|
|||||||
|
|
||||||
this.onAppReady();
|
this.onAppReady();
|
||||||
|
|
||||||
|
// optimization events
|
||||||
|
$(window).on("focus", this.onWindowFocusEvent);
|
||||||
|
$(window).on("blur", this.onWindowBlurEvent);
|
||||||
|
|
||||||
// layout events
|
// layout events
|
||||||
$(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
$(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||||
|
|
||||||
@@ -351,7 +448,17 @@ disabled(){
|
|||||||
this.css.remove();
|
this.css.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.optimizations){
|
||||||
|
this.optimizations.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.optimizationTimer){
|
||||||
|
window.clearTimeout(this.optimizationTimer);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||||
|
$(window).off("focus", this.onWindowFocusEvent);
|
||||||
|
$(window).off("blur", this.onWindowBlurEvent);
|
||||||
|
|
||||||
$("[data-action='settings-menu']").off("click", this.onSettingsMenuClickedEvent);
|
$("[data-action='settings-menu']").off("click", this.onSettingsMenuClickedEvent);
|
||||||
$("#td-design-plugin-modal").remove();
|
$("#td-design-plugin-modal").remove();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user