mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
120 Commits
Author | SHA1 | Date | |
---|---|---|---|
4d8e764211 | |||
544b8664fd | |||
d0610865bd | |||
ebc0b51590 | |||
4487f1169e | |||
85559b6083 | |||
1056273c57 | |||
61af2ebc8b | |||
9121c86656 | |||
1ccefe853a | |||
aca438b837 | |||
7210c29cd8 | |||
26d90c0c9b | |||
a03b222a95 | |||
7944a24d3c | |||
cc8459c759 | |||
10074ff92c | |||
173f25bebc | |||
31680fc4ae | |||
e937d43614 | |||
20e29a7975 | |||
ef815dabce | |||
1fb133e6b8 | |||
50b58cd6a6 | |||
01485d7ef9 | |||
b17c6a5ac7 | |||
d2ed2b4a00 | |||
710a7524a1 | |||
2be46464d6 | |||
8d536a6734 | |||
250d502238 | |||
e8de7266d0 | |||
9414f372d7 | |||
b0f9de67cf | |||
9b082e114e | |||
816a5334ac | |||
15a4e10da9 | |||
01b9302b0c | |||
442126a11a | |||
a9c140c0fc | |||
97ad7a3e68 | |||
7d737eefb6 | |||
4ac05b38d3 | |||
651bbbb672 | |||
52da4d8687 | |||
36063ae76a | |||
2fcec2d2cd | |||
762a7fdfb7 | |||
cd7aeaeed2 | |||
6f414d312c | |||
1b5304efb7 | |||
d59375308f | |||
8c9509a906 | |||
fb86d8f3a8 | |||
50e909cb3d | |||
2f54edf7e7 | |||
c251603e1e | |||
4476edb6c3 | |||
28fc67660f | |||
6e8b5a5ce5 | |||
e53681416f | |||
acb5e184e8 | |||
bdbafb3e5c | |||
ac70cf87c6 | |||
93de835ab4 | |||
2ea38b88ce | |||
2c4f2be57d | |||
fa4beea425 | |||
7a976edc82 | |||
bb22c35221 | |||
ff3dc59016 | |||
2e4dd3df3e | |||
b82e5d33f9 | |||
65d56b336b | |||
7836d61173 | |||
898437720b | |||
d9a80d1085 | |||
ab3d8b0ae2 | |||
b865074c32 | |||
2b8ca77c0d | |||
fa8b4e1e7f | |||
a310c5bcc1 | |||
b5dccd6b91 | |||
c2bcb39b38 | |||
4515add0a0 | |||
5b6aaec48c | |||
810e56ca31 | |||
5bcc8ac2e0 | |||
f5bfb35867 | |||
9088b8cd07 | |||
a7d90dc708 | |||
5968b57a01 | |||
94946a9ed6 | |||
561aec5ef0 | |||
e31696d843 | |||
8b33fd2002 | |||
064e43750f | |||
29d2f4f681 | |||
c11b40b94a | |||
e874e1d798 | |||
01244ec632 | |||
671657e2b0 | |||
dff7278e2e | |||
0881328636 | |||
a951c3a7c9 | |||
b25fae54fe | |||
a87bc4609e | |||
3e68026949 | |||
78d6d285cd | |||
72e3596a3c | |||
643ebcaab4 | |||
52ef6cd95a | |||
4aec2f3260 | |||
73549515eb | |||
d83d2660cf | |||
8de913172c | |||
4acfd64cff | |||
b56f90ed52 | |||
1375630727 | |||
668825bc01 |
4
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
patreon: chylex
|
||||
ko_fi: chylex
|
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Collections;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
static class Arguments{
|
||||
@@ -7,6 +7,7 @@ namespace TweetDuck.Configuration{
|
||||
public const string ArgDataFolder = "-datafolder";
|
||||
public const string ArgLogging = "-log";
|
||||
public const string ArgIgnoreGDPR = "-nogdpr";
|
||||
public const string ArgFreeze = "-freeze";
|
||||
|
||||
// internal args
|
||||
public const string ArgRestart = "-restart";
|
||||
@@ -21,8 +22,8 @@ namespace TweetDuck.Configuration{
|
||||
return Current.HasFlag(flag);
|
||||
}
|
||||
|
||||
public static string GetValue(string key, string defaultValue){
|
||||
return Current.GetValue(key, defaultValue);
|
||||
public static string GetValue(string key){
|
||||
return Current.GetValue(key);
|
||||
}
|
||||
|
||||
public static CommandLineArgs GetCurrentClean(){
|
||||
|
82
Configuration/ConfigManager.cs
Normal file
82
Configuration/ConfigManager.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Serialization.Converters;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class ConfigManager : IConfigManager{
|
||||
public UserConfig User { get; }
|
||||
public SystemConfig System { get; }
|
||||
public PluginConfig Plugins { get; }
|
||||
|
||||
public event EventHandler ProgramRestartRequested;
|
||||
|
||||
private readonly FileConfigInstance<UserConfig> infoUser;
|
||||
private readonly FileConfigInstance<SystemConfig> infoSystem;
|
||||
private readonly PluginConfigInstance<PluginConfig> infoPlugins;
|
||||
|
||||
private readonly IConfigInstance<BaseConfig>[] infoList;
|
||||
|
||||
public ConfigManager(){
|
||||
User = new UserConfig(this);
|
||||
System = new SystemConfig(this);
|
||||
Plugins = new PluginConfig(this);
|
||||
|
||||
infoList = new IConfigInstance<BaseConfig>[]{
|
||||
infoUser = new FileConfigInstance<UserConfig>(Program.UserConfigFilePath, User, "program options"),
|
||||
infoSystem = new FileConfigInstance<SystemConfig>(Program.SystemConfigFilePath, System, "system options"),
|
||||
infoPlugins = new PluginConfigInstance<PluginConfig>(Program.PluginConfigFilePath, Plugins)
|
||||
};
|
||||
|
||||
// TODO refactor further
|
||||
|
||||
infoUser.Serializer.RegisterTypeConverter(typeof(WindowState), WindowState.Converter);
|
||||
|
||||
infoUser.Serializer.RegisterTypeConverter(typeof(Point), new SingleTypeConverter<Point>{
|
||||
ConvertToString = value => $"{value.X} {value.Y}",
|
||||
ConvertToObject = value => {
|
||||
int[] elements = StringUtils.ParseInts(value, ' ');
|
||||
return new Point(elements[0], elements[1]);
|
||||
}
|
||||
});
|
||||
|
||||
infoUser.Serializer.RegisterTypeConverter(typeof(Size), new SingleTypeConverter<Size>{
|
||||
ConvertToString = value => $"{value.Width} {value.Height}",
|
||||
ConvertToObject = value => {
|
||||
int[] elements = StringUtils.ParseInts(value, ' ');
|
||||
return new Size(elements[0], elements[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void LoadAll(){
|
||||
infoUser.Load();
|
||||
infoSystem.Load();
|
||||
infoPlugins.Load();
|
||||
}
|
||||
|
||||
public void SaveAll(){
|
||||
infoUser.Save();
|
||||
infoSystem.Save();
|
||||
infoPlugins.Save();
|
||||
}
|
||||
|
||||
public void ReloadAll(){
|
||||
infoUser.Reload();
|
||||
infoSystem.Reload();
|
||||
infoPlugins.Reload();
|
||||
}
|
||||
|
||||
void IConfigManager.TriggerProgramRestartRequested(){
|
||||
ProgramRestartRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
IConfigInstance<BaseConfig> IConfigManager.GetInstanceInfo(BaseConfig instance){
|
||||
Type instanceType = instance.GetType();
|
||||
return Array.Find(infoList, info => info.Instance.GetType() == instanceType); // TODO handle null
|
||||
}
|
||||
}
|
||||
}
|
@@ -124,7 +124,7 @@ namespace TweetDuck.Configuration{
|
||||
try{
|
||||
File.Delete(file);
|
||||
}catch(Exception e){
|
||||
Program.Reporter.Log(e.ToString());
|
||||
Program.Reporter.LogImportant(e.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
51
Configuration/PluginConfig.cs
Normal file
51
Configuration/PluginConfig.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class PluginConfig : BaseConfig, IPluginConfig{
|
||||
private static readonly string[] DefaultDisabled = {
|
||||
"official/clear-columns",
|
||||
"official/reply-account"
|
||||
};
|
||||
|
||||
// CONFIGURATION DATA
|
||||
|
||||
private readonly HashSet<string> disabled = new HashSet<string>(DefaultDisabled);
|
||||
|
||||
// EVENTS
|
||||
|
||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
public PluginConfig(IConfigManager configManager) : base(configManager){}
|
||||
|
||||
protected override BaseConfig ConstructWithDefaults(IConfigManager configManager){
|
||||
return new PluginConfig(configManager);
|
||||
}
|
||||
|
||||
// INTERFACE IMPLEMENTATION
|
||||
|
||||
IEnumerable<string> IPluginConfig.DisabledPlugins => disabled;
|
||||
|
||||
void IPluginConfig.Reset(IEnumerable<string> newDisabledPlugins){
|
||||
disabled.Clear();
|
||||
disabled.UnionWith(newDisabledPlugins);
|
||||
}
|
||||
|
||||
public void SetEnabled(Plugin plugin, bool enabled){
|
||||
if ((enabled && disabled.Remove(plugin.Identifier)) || (!enabled && disabled.Add(plugin.Identifier))){
|
||||
PluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabled(Plugin plugin){
|
||||
return !disabled.Contains(plugin.Identifier);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,43 +1,28 @@
|
||||
using System;
|
||||
using TweetDuck.Data.Serialization;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class SystemConfig{
|
||||
private static readonly FileSerializer<SystemConfig> Serializer = new FileSerializer<SystemConfig>();
|
||||
sealed class SystemConfig : BaseConfig{
|
||||
|
||||
// CONFIGURATION DATA
|
||||
|
||||
public bool HardwareAcceleration { get; set; } = true;
|
||||
public bool _hardwareAcceleration = true;
|
||||
|
||||
public bool ClearCacheAutomatically { get; set; } = true;
|
||||
public int ClearCacheThreshold { get; set; } = 250;
|
||||
|
||||
// SPECIAL PROPERTIES
|
||||
|
||||
public bool HardwareAcceleration{
|
||||
get => _hardwareAcceleration;
|
||||
set => UpdatePropertyWithRestartRequest(ref _hardwareAcceleration, value);
|
||||
}
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
private readonly string file;
|
||||
public SystemConfig(IConfigManager configManager) : base(configManager){}
|
||||
|
||||
private SystemConfig(string file){
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public void Save(){
|
||||
try{
|
||||
Serializer.Write(file, this);
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not save the system configuration file.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static SystemConfig Load(string file){
|
||||
SystemConfig config = new SystemConfig(file);
|
||||
|
||||
try{
|
||||
Serializer.ReadIfExists(file, config);
|
||||
}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;
|
||||
protected override BaseConfig ConstructWithDefaults(IConfigManager configManager){
|
||||
return new SystemConfig(configManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,37 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Data.Serialization;
|
||||
using TweetLib.Core.Features.Configuration;
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class UserConfig{
|
||||
private static readonly FileSerializer<UserConfig> Serializer = new FileSerializer<UserConfig>();
|
||||
|
||||
static UserConfig(){
|
||||
Serializer.RegisterTypeConverter(typeof(WindowState), WindowState.Converter);
|
||||
|
||||
Serializer.RegisterTypeConverter(typeof(Point), new SingleTypeConverter<Point>{
|
||||
ConvertToString = value => $"{value.X} {value.Y}",
|
||||
ConvertToObject = value => {
|
||||
int[] elements = StringUtils.ParseInts(value, ' ');
|
||||
return new Point(elements[0], elements[1]);
|
||||
}
|
||||
});
|
||||
|
||||
Serializer.RegisterTypeConverter(typeof(Size), new SingleTypeConverter<Size>{
|
||||
ConvertToString = value => $"{value.Width} {value.Height}",
|
||||
ConvertToObject = value => {
|
||||
int[] elements = StringUtils.ParseInts(value, ' ');
|
||||
return new Size(elements[0], elements[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
sealed class UserConfig : BaseConfig{
|
||||
|
||||
// CONFIGURATION DATA
|
||||
|
||||
@@ -42,23 +19,27 @@ namespace TweetDuck.Configuration{
|
||||
public Size PluginsWindowSize { get; set; } = Size.Empty;
|
||||
|
||||
public bool ExpandLinksOnHover { get; set; } = true;
|
||||
public bool FocusDmInput { get; set; } = true;
|
||||
public bool OpenSearchInFirstColumn { get; set; } = true;
|
||||
public bool KeepLikeFollowDialogsOpen { get; set; } = true;
|
||||
public bool BestImageQuality { get; set; } = true;
|
||||
public bool EnableAnimatedImages { get; set; } = true;
|
||||
|
||||
public bool IgnoreTrackingUrlWarning { get; set; } = false;
|
||||
public bool EnableSmoothScrolling { get; set; } = true;
|
||||
private bool _enableSmoothScrolling = true;
|
||||
private bool _enableTouchAdjustment = false;
|
||||
private string _customCefArgs = null;
|
||||
|
||||
public string BrowserPath { get; set; } = null;
|
||||
public bool IgnoreTrackingUrlWarning { get; set; } = false;
|
||||
public string SearchEngineUrl { get; set; } = null;
|
||||
private int _zoomLevel = 100;
|
||||
private bool _muteNotifications;
|
||||
|
||||
public int VideoPlayerVolume { get; set; } = 50;
|
||||
|
||||
public bool EnableSpellCheck { get; set; } = false;
|
||||
public string SpellCheckLanguage { get; set; } = "en-US";
|
||||
public string TranslationTarget { get; set; } = "en";
|
||||
public bool EnableSpellCheck { get; set; } = false;
|
||||
private string _spellCheckLanguage = "en-US";
|
||||
|
||||
public string TranslationTarget { get; set; } = "en";
|
||||
|
||||
private TrayIcon.Behavior _trayBehavior = TrayIcon.Behavior.Disabled;
|
||||
public bool EnableTrayHighlight { get; set; } = true;
|
||||
@@ -72,9 +53,9 @@ namespace TweetDuck.Configuration{
|
||||
public bool NotificationNonIntrusiveMode { get; set; } = true;
|
||||
public int NotificationIdlePauseSeconds { get; set; } = 0;
|
||||
|
||||
public bool DisplayNotificationTimer { get; set; } = true;
|
||||
public bool NotificationTimerCountDown { get; set; } = false;
|
||||
public int NotificationDurationValue { get; set; } = 25;
|
||||
public bool DisplayNotificationTimer { get; set; } = true;
|
||||
public bool NotificationTimerCountDown { get; set; } = false;
|
||||
public int NotificationDurationValue { get; set; } = 25;
|
||||
|
||||
public TweetNotification.Position NotificationPosition { get; set; } = TweetNotification.Position.TopRight;
|
||||
public Point CustomNotificationPosition { get; set; } = ControlExtensions.InvisibleLocation;
|
||||
@@ -88,7 +69,8 @@ namespace TweetDuck.Configuration{
|
||||
private string _notificationSoundPath;
|
||||
private int _notificationSoundVolume = 100;
|
||||
|
||||
public string CustomCefArgs { get; set; } = null;
|
||||
private bool _muteNotifications;
|
||||
|
||||
public string CustomBrowserCSS { get; set; } = null;
|
||||
public string CustomNotificationCSS { get; set; } = null;
|
||||
|
||||
@@ -125,6 +107,26 @@ namespace TweetDuck.Configuration{
|
||||
set => UpdatePropertyWithEvent(ref _trayBehavior, value, TrayBehaviorChanged);
|
||||
}
|
||||
|
||||
public bool EnableSmoothScrolling{
|
||||
get => _enableSmoothScrolling;
|
||||
set => UpdatePropertyWithRestartRequest(ref _enableSmoothScrolling, value);
|
||||
}
|
||||
|
||||
public bool EnableTouchAdjustment{
|
||||
get => _enableTouchAdjustment;
|
||||
set => UpdatePropertyWithRestartRequest(ref _enableTouchAdjustment, value);
|
||||
}
|
||||
|
||||
public string CustomCefArgs{
|
||||
get => _customCefArgs;
|
||||
set => UpdatePropertyWithRestartRequest(ref _customCefArgs, value);
|
||||
}
|
||||
|
||||
public string SpellCheckLanguage{
|
||||
get => _spellCheckLanguage;
|
||||
set => UpdatePropertyWithRestartRequest(ref _spellCheckLanguage, value);
|
||||
}
|
||||
|
||||
// EVENTS
|
||||
|
||||
public event EventHandler MuteToggled;
|
||||
@@ -134,105 +136,10 @@ namespace TweetDuck.Configuration{
|
||||
|
||||
// END OF CONFIG
|
||||
|
||||
private readonly string file;
|
||||
public UserConfig(IConfigManager configManager) : base(configManager){}
|
||||
|
||||
private UserConfig(string file){
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
private void UpdatePropertyWithEvent<T>(ref T field, T value, EventHandler eventHandler){
|
||||
if (!EqualityComparer<T>.Default.Equals(field, value)){
|
||||
field = value;
|
||||
eventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public void Save(){
|
||||
try{
|
||||
if (File.Exists(file)){
|
||||
string backupFile = GetBackupFile(file);
|
||||
File.Delete(backupFile);
|
||||
File.Move(file, backupFile);
|
||||
}
|
||||
|
||||
Serializer.Write(file, this);
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not save the configuration file.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reload(){
|
||||
try{
|
||||
LoadInternal(false);
|
||||
}catch(FileNotFoundException){
|
||||
try{
|
||||
Serializer.Write(file, new UserConfig(file));
|
||||
LoadInternal(false);
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not regenerate configuration file.", true, e);
|
||||
}
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not reload configuration file.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset(){
|
||||
try{
|
||||
File.Delete(file);
|
||||
File.Delete(GetBackupFile(file));
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not delete configuration files to reset the options.", true, e);
|
||||
return;
|
||||
}
|
||||
|
||||
Reload();
|
||||
}
|
||||
|
||||
private void LoadInternal(bool backup){
|
||||
Serializer.Read(backup ? GetBackupFile(file) : file, this);
|
||||
|
||||
if (NotificationScrollSpeed == 10){ // incorrect initial value
|
||||
NotificationScrollSpeed = 100;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static UserConfig Load(string file){
|
||||
Exception firstException = null;
|
||||
|
||||
for(int attempt = 0; attempt < 2; attempt++){
|
||||
try{
|
||||
UserConfig config = new UserConfig(file);
|
||||
config.LoadInternal(attempt > 0);
|
||||
return config;
|
||||
}catch(FileNotFoundException){
|
||||
}catch(DirectoryNotFoundException){
|
||||
break;
|
||||
}catch(Exception e){
|
||||
if (attempt == 0){
|
||||
firstException = e;
|
||||
Program.Reporter.Log(e.ToString());
|
||||
}
|
||||
else if (firstException is FormatException){
|
||||
Program.Reporter.HandleException("Configuration Error", "The configuration file is outdated or corrupted. If you continue, your program options will be reset.", true, e);
|
||||
return new UserConfig(file);
|
||||
}
|
||||
else if (firstException != null){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not open the backup configuration file. If you continue, your program options will be reset.", true, e);
|
||||
return new UserConfig(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firstException != null){
|
||||
Program.Reporter.HandleException("Configuration Error", "Could not open the configuration file.", true, firstException);
|
||||
}
|
||||
|
||||
return new UserConfig(file);
|
||||
}
|
||||
|
||||
public static string GetBackupFile(string file){
|
||||
return file+".bak";
|
||||
protected override BaseConfig ConstructWithDefaults(IConfigManager configManager){
|
||||
return new UserConfig(configManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using TweetDuck.Configuration;
|
||||
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
static class PropertyBridge{
|
||||
@@ -10,20 +11,22 @@ namespace TweetDuck.Core.Bridge{
|
||||
string Bool(bool value) => value ? "true;" : "false;";
|
||||
string Str(string value) => '"'+value+"\";";
|
||||
|
||||
StringBuilder build = new StringBuilder().Append("(function(x){");
|
||||
UserConfig config = Program.Config.User;
|
||||
StringBuilder build = new StringBuilder(128).Append("(function(x){");
|
||||
|
||||
build.Append("x.expandLinksOnHover=").Append(Bool(Program.UserConfig.ExpandLinksOnHover));
|
||||
build.Append("x.expandLinksOnHover=").Append(Bool(config.ExpandLinksOnHover));
|
||||
|
||||
if (environment == Environment.Browser){
|
||||
build.Append("x.openSearchInFirstColumn=").Append(Bool(Program.UserConfig.OpenSearchInFirstColumn));
|
||||
build.Append("x.keepLikeFollowDialogsOpen=").Append(Bool(Program.UserConfig.KeepLikeFollowDialogsOpen));
|
||||
build.Append("x.muteNotifications=").Append(Bool(Program.UserConfig.MuteNotifications));
|
||||
build.Append("x.notificationMediaPreviews=").Append(Bool(Program.UserConfig.NotificationMediaPreviews));
|
||||
build.Append("x.translationTarget=").Append(Str(Program.UserConfig.TranslationTarget));
|
||||
build.Append("x.focusDmInput=").Append(Bool(config.FocusDmInput));
|
||||
build.Append("x.openSearchInFirstColumn=").Append(Bool(config.OpenSearchInFirstColumn));
|
||||
build.Append("x.keepLikeFollowDialogsOpen=").Append(Bool(config.KeepLikeFollowDialogsOpen));
|
||||
build.Append("x.muteNotifications=").Append(Bool(config.MuteNotifications));
|
||||
build.Append("x.notificationMediaPreviews=").Append(Bool(config.NotificationMediaPreviews));
|
||||
build.Append("x.translationTarget=").Append(Str(config.TranslationTarget));
|
||||
}
|
||||
|
||||
if (environment == Environment.Notification){
|
||||
build.Append("x.skipOnLinkClick=").Append(Bool(Program.UserConfig.NotificationSkipOnLinkClick));
|
||||
build.Append("x.skipOnLinkClick=").Append(Bool(config.NotificationSkipOnLinkClick));
|
||||
}
|
||||
|
||||
return build.Append("})(window.$TDX=window.$TDX||{})").ToString();
|
||||
|
@@ -1,39 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
class TweetDeckBridge{
|
||||
public static string FontSize { get; private set; }
|
||||
public static string NotificationHeadLayout { get; private set; }
|
||||
public static readonly ContextInfo ContextInfo = new ContextInfo();
|
||||
|
||||
private static readonly Dictionary<string, string> SessionData = new Dictionary<string, string>(2);
|
||||
|
||||
public static void ResetStaticProperties(){
|
||||
FontSize = NotificationHeadLayout = null;
|
||||
}
|
||||
|
||||
public static void RestoreSessionData(IFrame frame){
|
||||
if (SessionData.Count > 0){
|
||||
StringBuilder build = new StringBuilder().Append("window.TD_SESSION={");
|
||||
|
||||
foreach(KeyValuePair<string, string> kvp in SessionData){
|
||||
build.Append(kvp.Key).Append(":'").Append(kvp.Value.Replace("'", "\\'")).Append("',");
|
||||
}
|
||||
|
||||
ScriptLoader.ExecuteScript(frame, build.Append("}").ToString(), "gen:session");
|
||||
SessionData.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly FormBrowser form;
|
||||
private readonly FormNotificationMain notification;
|
||||
|
||||
@@ -79,12 +62,6 @@ namespace TweetDuck.Core.Bridge{
|
||||
public void DisplayTooltip(string text){
|
||||
form.InvokeAsyncSafe(() => form.DisplayTooltip(text));
|
||||
}
|
||||
|
||||
public void SetSessionData(string key, string value){
|
||||
form.InvokeSafe(() => { // do not use InvokeAsyncSafe, return only after invocation
|
||||
SessionData.Add(key, value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Notification only
|
||||
|
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Updates;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
|
||||
namespace TweetDuck.Core.Bridge{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
class UpdateBridge{
|
||||
private readonly UpdateHandler updates;
|
||||
private readonly Control sync;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
@@ -14,13 +15,14 @@ using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Updates;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{
|
||||
private static UserConfig Config => Program.UserConfig;
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
public bool IsWaiting{
|
||||
set{
|
||||
@@ -63,7 +65,7 @@ namespace TweetDuck.Core{
|
||||
|
||||
Text = Program.BrandName;
|
||||
|
||||
this.plugins = new PluginManager(Program.PluginPath, Program.PluginConfigFilePath);
|
||||
this.plugins = new PluginManager(Program.Config.Plugins, Program.PluginPath);
|
||||
this.plugins.Reloaded += plugins_Reloaded;
|
||||
this.plugins.Executed += plugins_Executed;
|
||||
this.plugins.Reload();
|
||||
@@ -71,7 +73,7 @@ namespace TweetDuck.Core{
|
||||
this.notification = new FormNotificationTweet(this, plugins);
|
||||
this.notification.Show();
|
||||
|
||||
this.updates = new UpdateHandler(Program.InstallerPath);
|
||||
this.updates = new UpdateHandler(new UpdateCheckClient(Program.InstallerPath), TaskScheduler.FromCurrentSynchronizationContext());
|
||||
this.updates.CheckFinished += updates_CheckFinished;
|
||||
|
||||
this.updateBridge = new UpdateBridge(updates, this);
|
||||
@@ -79,11 +81,9 @@ namespace TweetDuck.Core{
|
||||
this.updateBridge.UpdateDelayed += updateBridge_UpdateDelayed;
|
||||
this.updateBridge.UpdateDismissed += updateBridge_UpdateDismissed;
|
||||
|
||||
this.browser = new TweetDeckBrowser(this, new TweetDeckBridge.Browser(this, notification), updateBridge);
|
||||
this.browser = new TweetDeckBrowser(this, plugins, new TweetDeckBridge.Browser(this, notification), updateBridge);
|
||||
this.contextMenu = ContextMenuBrowser.CreateMenu(this);
|
||||
|
||||
this.plugins.Register(browser, PluginEnvironment.Browser, this, true);
|
||||
|
||||
Controls.Add(new MenuStrip{ Visible = false }); // fixes Alt freezing the program in Win 10 Anniversary Update
|
||||
|
||||
Disposed += (sender, args) => {
|
||||
@@ -368,7 +368,11 @@ namespace TweetDuck.Core{
|
||||
|
||||
public void ReloadToTweetDeck(){
|
||||
#if DEBUG
|
||||
Resources.ScriptLoader.HotSwap();
|
||||
ScriptLoader.HotSwap();
|
||||
#else
|
||||
if (ModifierKeys.HasFlag(Keys.Shift)){
|
||||
ScriptLoader.ClearCache();
|
||||
}
|
||||
#endif
|
||||
|
||||
ignoreUpdateCheckError = false;
|
||||
@@ -492,7 +496,7 @@ namespace TweetDuck.Core{
|
||||
FormManager.TryFind<FormSettings>()?.Close();
|
||||
|
||||
using(DialogSettingsManage dialog = new DialogSettingsManage(plugins, true)){
|
||||
if (dialog.ShowDialog() == DialogResult.OK && !dialog.IsRestarting){
|
||||
if (!dialog.IsDisposed && dialog.ShowDialog() == DialogResult.OK && !dialog.IsRestarting){ // needs disposal check because the dialog may be closed in constructor
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
FormManager.TryFind<FormPlugins>()?.Close();
|
||||
plugins.Reload(); // also reloads the browser
|
||||
|
@@ -17,8 +17,6 @@ namespace TweetDuck.Core{
|
||||
else return false;
|
||||
}
|
||||
|
||||
public static bool HasAnyDialogs => Application.OpenForms.OfType<IAppDialog>().Any();
|
||||
|
||||
public static void CloseAllDialogs(){
|
||||
foreach(IAppDialog dialog in Application.OpenForms.OfType<IAppDialog>().Reverse()){
|
||||
((Form)dialog).Close();
|
||||
|
@@ -1,21 +1,24 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System.Linq;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Resources;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
abstract class ContextMenuBase : IContextMenuHandler{
|
||||
private static TwitterUtils.ImageQuality ImageQuality => Program.UserConfig.TwitterImageQuality;
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
|
||||
private static TwitterUtils.ImageQuality ImageQuality => Config.TwitterImageQuality;
|
||||
|
||||
private const CefMenuCommand MenuOpenLinkUrl = (CefMenuCommand)26500;
|
||||
private const CefMenuCommand MenuCopyLinkUrl = (CefMenuCommand)26501;
|
||||
@@ -29,8 +32,7 @@ namespace TweetDuck.Core.Handling{
|
||||
private const CefMenuCommand MenuReadApplyROT13 = (CefMenuCommand)26509;
|
||||
private const CefMenuCommand MenuOpenDevTools = (CefMenuCommand)26599;
|
||||
|
||||
protected ContextInfo.LinkInfo LastLink { get; private set; }
|
||||
protected ContextInfo.ChirpInfo LastChirp { get; private set; }
|
||||
protected ContextInfo.ContextData Context { get; private set; }
|
||||
|
||||
private readonly AnalyticsFile.IProvider analytics;
|
||||
|
||||
@@ -38,19 +40,12 @@ namespace TweetDuck.Core.Handling{
|
||||
this.analytics = analytics;
|
||||
}
|
||||
|
||||
private void ResetContextInfo(){
|
||||
LastLink = default(ContextInfo.LinkInfo);
|
||||
LastChirp = default(ContextInfo.ChirpInfo);
|
||||
TweetDeckBridge.ContextInfo.Reset();
|
||||
}
|
||||
|
||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
|
||||
ResetContextInfo();
|
||||
Context = TweetDeckBridge.ContextInfo.Reset();
|
||||
}
|
||||
else{
|
||||
LastLink = TweetDeckBridge.ContextInfo.Link;
|
||||
LastChirp = TweetDeckBridge.ContextInfo.Chirp;
|
||||
Context = TweetDeckBridge.ContextInfo.Create(parameters);
|
||||
}
|
||||
|
||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection) && !parameters.TypeFlags.HasFlag(ContextMenuType.Editable)){
|
||||
@@ -60,15 +55,12 @@ namespace TweetDuck.Core.Handling{
|
||||
model.AddSeparator();
|
||||
}
|
||||
|
||||
bool hasTweetImage = LastLink.IsImage;
|
||||
bool hasTweetVideo = LastLink.IsVideo;
|
||||
|
||||
string TextOpen(string name) => "Open "+name+" in browser";
|
||||
string TextCopy(string name) => "Copy "+name+" address";
|
||||
string TextSave(string name) => "Save "+name+" as...";
|
||||
|
||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal) && !hasTweetImage && !hasTweetVideo){
|
||||
if (TwitterUtils.RegexAccount.IsMatch(parameters.UnfilteredLinkUrl)){
|
||||
if (Context.Types.HasFlag(ContextInfo.ContextType.Link) && !Context.UnsafeLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||
if (TwitterUtils.RegexAccount.IsMatch(Context.UnsafeLinkUrl)){
|
||||
model.AddItem(MenuOpenLinkUrl, TextOpen("account"));
|
||||
model.AddItem(MenuCopyLinkUrl, TextCopy("account"));
|
||||
model.AddItem(MenuCopyUsername, "Copy account username");
|
||||
@@ -81,19 +73,19 @@ namespace TweetDuck.Core.Handling{
|
||||
model.AddSeparator();
|
||||
}
|
||||
|
||||
if (hasTweetVideo){
|
||||
if (Context.Types.HasFlag(ContextInfo.ContextType.Video)){
|
||||
model.AddItem(MenuOpenMediaUrl, TextOpen("video"));
|
||||
model.AddItem(MenuCopyMediaUrl, TextCopy("video"));
|
||||
model.AddItem(MenuSaveMedia, TextSave("video"));
|
||||
model.AddSeparator();
|
||||
}
|
||||
else if (((parameters.TypeFlags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents) || hasTweetImage) && parameters.SourceUrl != TweetNotification.AppLogo.Url){
|
||||
else if (Context.Types.HasFlag(ContextInfo.ContextType.Image) && Context.MediaUrl != TweetNotification.AppLogo.Url){
|
||||
model.AddItem(MenuViewImage, "View image in photo viewer");
|
||||
model.AddItem(MenuOpenMediaUrl, TextOpen("image"));
|
||||
model.AddItem(MenuCopyMediaUrl, TextCopy("image"));
|
||||
model.AddItem(MenuSaveMedia, TextSave("image"));
|
||||
|
||||
if (LastChirp.Images.Length > 1){
|
||||
if (Context.Chirp.Images.Length > 1){
|
||||
model.AddItem(MenuSaveTweetImages, TextSave("all images"));
|
||||
}
|
||||
|
||||
@@ -106,64 +98,45 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
switch(commandId){
|
||||
case MenuOpenLinkUrl:
|
||||
OpenBrowser(control, LastLink.GetUrl(parameters, true));
|
||||
OpenBrowser(control, Context.LinkUrl);
|
||||
break;
|
||||
|
||||
case MenuCopyLinkUrl:
|
||||
SetClipboardText(control, LastLink.GetUrl(parameters, false));
|
||||
SetClipboardText(control, Context.UnsafeLinkUrl);
|
||||
break;
|
||||
|
||||
case MenuCopyUsername:
|
||||
Match match = TwitterUtils.RegexAccount.Match(parameters.UnfilteredLinkUrl);
|
||||
SetClipboardText(control, match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||
case MenuCopyUsername: {
|
||||
string url = Context.UnsafeLinkUrl;
|
||||
Match match = TwitterUtils.RegexAccount.Match(url);
|
||||
|
||||
SetClipboardText(control, match.Success ? match.Groups[1].Value : url);
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.CopiedUsernames.Trigger);
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuOpenMediaUrl:
|
||||
OpenBrowser(control, TwitterUtils.GetMediaLink(LastLink.GetMediaSource(parameters), ImageQuality));
|
||||
OpenBrowser(control, TwitterUtils.GetMediaLink(Context.MediaUrl, ImageQuality));
|
||||
break;
|
||||
|
||||
case MenuCopyMediaUrl:
|
||||
SetClipboardText(control, TwitterUtils.GetMediaLink(LastLink.GetMediaSource(parameters), ImageQuality));
|
||||
SetClipboardText(control, TwitterUtils.GetMediaLink(Context.MediaUrl, ImageQuality));
|
||||
break;
|
||||
|
||||
case MenuViewImage: {
|
||||
void ViewImage(string path){
|
||||
string ext = Path.GetExtension(path);
|
||||
|
||||
if (TwitterUtils.ValidImageExtensions.Contains(ext)){
|
||||
WindowsUtils.OpenAssociatedProgram(path);
|
||||
}
|
||||
else{
|
||||
FormMessage.Error("Image Download", "Invalid file extension "+ext, FormMessage.OK);
|
||||
}
|
||||
}
|
||||
|
||||
string url = LastLink.GetMediaSource(parameters);
|
||||
string file = Path.Combine(BrowserCache.CacheFolder, TwitterUtils.GetImageFileName(url) ?? Path.GetRandomFileName());
|
||||
string url = Context.MediaUrl;
|
||||
|
||||
control.InvokeAsyncSafe(() => {
|
||||
if (File.Exists(file)){
|
||||
ViewImage(file);
|
||||
}
|
||||
else{
|
||||
analytics.AnalyticsFile.ViewedImages.Trigger();
|
||||
|
||||
BrowserUtils.DownloadFileAsync(TwitterUtils.GetMediaLink(url, ImageQuality), file, () => {
|
||||
ViewImage(file);
|
||||
}, ex => {
|
||||
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
TwitterUtils.ViewImage(url, ImageQuality);
|
||||
analytics.AnalyticsFile.ViewedImages.Trigger();
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MenuSaveMedia: {
|
||||
bool isVideo = LastLink.IsVideo;
|
||||
string url = LastLink.GetMediaSource(parameters);
|
||||
string username = LastChirp.Authors.LastOrDefault();
|
||||
bool isVideo = Context.Types.HasFlag(ContextInfo.ContextType.Video);
|
||||
string url = Context.MediaUrl;
|
||||
string username = Context.Chirp.Authors.LastOrDefault();
|
||||
|
||||
control.InvokeAsyncSafe(() => {
|
||||
if (isVideo){
|
||||
@@ -180,8 +153,8 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
case MenuSaveTweetImages: {
|
||||
string[] urls = LastChirp.Images;
|
||||
string username = LastChirp.Authors.LastOrDefault();
|
||||
string[] urls = Context.Chirp.Images;
|
||||
string username = Context.Chirp.Authors.LastOrDefault();
|
||||
|
||||
control.InvokeAsyncSafe(() => {
|
||||
TwitterUtils.DownloadImages(urls, username, ImageQuality);
|
||||
@@ -212,7 +185,7 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
public virtual void OnContextMenuDismissed(IWebBrowser browserControl, IBrowser browser, IFrame frame){
|
||||
ResetContextInfo();
|
||||
Context = TweetDeckBridge.ContextInfo.Reset();
|
||||
}
|
||||
|
||||
public virtual bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model, IRunContextMenuCallback callback){
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using CefSharp;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
@@ -56,12 +57,12 @@ namespace TweetDuck.Core.Handling{
|
||||
InsertSelectionSearchItem(model, MenuSearchInColumn, "Search in a column");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(LastChirp.TweetUrl) && !isSelecting && !isEditing){
|
||||
if (Context.Types.HasFlag(ContextInfo.ContextType.Chirp) && !isSelecting && !isEditing){
|
||||
model.AddItem(MenuOpenTweetUrl, "Open tweet in browser");
|
||||
model.AddItem(MenuCopyTweetUrl, "Copy tweet address");
|
||||
model.AddItem(MenuScreenshotTweet, "Screenshot tweet to clipboard");
|
||||
|
||||
if (!string.IsNullOrEmpty(LastChirp.QuoteUrl)){
|
||||
if (!string.IsNullOrEmpty(Context.Chirp.QuoteUrl)){
|
||||
model.AddSeparator();
|
||||
model.AddItem(MenuOpenQuotedTweetUrl, "Open quoted tweet in browser");
|
||||
model.AddItem(MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
|
||||
@@ -77,7 +78,7 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
globalMenu.AddItem(CefMenuCommand.Reload, TitleReloadBrowser);
|
||||
globalMenu.AddCheckItem(MenuMute, TitleMuteNotifications);
|
||||
globalMenu.SetChecked(MenuMute, Program.UserConfig.MuteNotifications);
|
||||
globalMenu.SetChecked(MenuMute, Config.MuteNotifications);
|
||||
globalMenu.AddSeparator();
|
||||
|
||||
globalMenu.AddItem(MenuSettings, TitleSettings);
|
||||
@@ -119,11 +120,11 @@ namespace TweetDuck.Core.Handling{
|
||||
return true;
|
||||
|
||||
case MenuOpenTweetUrl:
|
||||
OpenBrowser(form, LastChirp.TweetUrl);
|
||||
OpenBrowser(form, Context.Chirp.TweetUrl);
|
||||
return true;
|
||||
|
||||
case MenuCopyTweetUrl:
|
||||
SetClipboardText(form, LastChirp.TweetUrl);
|
||||
SetClipboardText(form, Context.Chirp.TweetUrl);
|
||||
return true;
|
||||
|
||||
case MenuScreenshotTweet:
|
||||
@@ -131,11 +132,11 @@ namespace TweetDuck.Core.Handling{
|
||||
return true;
|
||||
|
||||
case MenuOpenQuotedTweetUrl:
|
||||
OpenBrowser(form, LastChirp.QuoteUrl);
|
||||
OpenBrowser(form, Context.Chirp.QuoteUrl);
|
||||
return true;
|
||||
|
||||
case MenuCopyQuotedTweetUrl:
|
||||
SetClipboardText(form, LastChirp.QuoteUrl);
|
||||
SetClipboardText(form, Context.Chirp.QuoteUrl);
|
||||
return true;
|
||||
|
||||
case MenuWriteApplyROT13:
|
||||
@@ -163,7 +164,7 @@ namespace TweetDuck.Core.Handling{
|
||||
menu.MenuItems.Add(TitleAboutProgram, (sender, args) => form.OpenAbout());
|
||||
|
||||
menu.Popup += (sender, args) => {
|
||||
menu.MenuItems[1].Checked = Program.UserConfig.MuteNotifications;
|
||||
menu.MenuItems[1].Checked = Config.MuteNotifications;
|
||||
form.AnalyticsFile.BrowserContextMenus.Trigger();
|
||||
};
|
||||
|
||||
@@ -171,8 +172,8 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
private static void ToggleMuteNotifications(){
|
||||
Program.UserConfig.MuteNotifications = !Program.UserConfig.MuteNotifications;
|
||||
Program.UserConfig.Save();
|
||||
Config.MuteNotifications = !Config.MuteNotifications;
|
||||
Config.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,9 +25,9 @@ namespace TweetDuck.Core.Handling.Filters{
|
||||
int responseLength = responseData.Length;
|
||||
|
||||
if (state == State.Reading){
|
||||
int bytesToRead = Math.Min(responseLength-offset, (int)Math.Min(dataIn.Length, int.MaxValue));
|
||||
int bytesToRead = Math.Min(responseLength-offset, (int)Math.Min(dataIn?.Length ?? 0, int.MaxValue));
|
||||
|
||||
dataIn.Read(responseData, offset, bytesToRead);
|
||||
dataIn?.Read(responseData, offset, bytesToRead);
|
||||
offset += bytesToRead;
|
||||
|
||||
dataInRead = bytesToRead;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using CefSharp;
|
||||
using TweetDuck.Configuration;
|
||||
|
||||
namespace TweetDuck.Core.Handling.General{
|
||||
sealed class BrowserProcessHandler : IBrowserProcessHandler{
|
||||
@@ -9,10 +10,12 @@ namespace TweetDuck.Core.Handling.General{
|
||||
}
|
||||
|
||||
private static void UpdatePrefsInternal(){
|
||||
UserConfig config = Program.Config.User;
|
||||
|
||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out string _);
|
||||
ctx.SetPreference("spellcheck.dictionary", Program.UserConfig.SpellCheckLanguage, out string _);
|
||||
ctx.SetPreference("settings.a11y.animation_policy", Program.UserConfig.EnableAnimatedImages ? "allowed" : "none", out string _);
|
||||
ctx.SetPreference("browser.enable_spellchecking", config.EnableSpellCheck, out string _);
|
||||
ctx.SetPreference("spellcheck.dictionary", config.SpellCheckLanguage, out string _);
|
||||
ctx.SetPreference("settings.a11y.animation_policy", config.EnableAnimatedImages ? "allowed" : "none", out string _);
|
||||
}
|
||||
}
|
||||
|
||||
|
47
Core/Handling/KeyboardHandlerBase.cs
Normal file
47
Core/Handling/KeyboardHandlerBase.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class KeyboardHandlerBase : IKeyboardHandler{
|
||||
protected virtual bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||
if (modifiers == (CefEventFlags.ControlDown | CefEventFlags.ShiftDown) && key == Keys.I){
|
||||
if (BrowserUtils.HasDevTools){
|
||||
browser.ShowDevTools();
|
||||
}
|
||||
else{
|
||||
browserControl.AsControl().InvokeSafe(() => {
|
||||
string extraMessage;
|
||||
|
||||
if (Program.IsPortable){
|
||||
extraMessage = "Please download the portable installer, select the folder with your current installation of TweetDuck Portable, and tick 'Install dev tools' during the installation process.";
|
||||
}
|
||||
else{
|
||||
extraMessage = "Please download the installer, and tick 'Install dev tools' during the installation process. The installer will automatically find and update your current installation of TweetDuck.";
|
||||
}
|
||||
|
||||
FormMessage.Information("Dev Tools", "You do not have dev tools installed. "+extraMessage, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
||||
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("chrome-devtools://")){
|
||||
return HandleRawKey(browserControl, browser, (Keys)windowsKeyCode, modifiers);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,19 +2,19 @@
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class KeyboardHandlerBrowser : IKeyboardHandler{
|
||||
sealed class KeyboardHandlerBrowser : KeyboardHandlerBase{
|
||||
private readonly FormBrowser form;
|
||||
|
||||
public KeyboardHandlerBrowser(FormBrowser form){
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
||||
return type == KeyType.RawKeyDown && form.ProcessBrowserKey((Keys)windowsKeyCode);
|
||||
}
|
||||
protected override bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||
if (base.HandleRawKey(browserControl, browser, key, modifiers)){
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
||||
return false;
|
||||
return form.ProcessBrowserKey(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
|
||||
namespace TweetDuck.Core.Handling {
|
||||
sealed class KeyboardHandlerNotification : IKeyboardHandler{
|
||||
sealed class KeyboardHandlerNotification : KeyboardHandlerBase{
|
||||
private readonly FormNotificationBase notification;
|
||||
|
||||
public KeyboardHandlerNotification(FormNotificationBase notification){
|
||||
@@ -15,31 +15,30 @@ namespace TweetDuck.Core.Handling {
|
||||
notification.InvokeAsyncSafe(notification.AnalyticsFile.NotificationKeyboardShortcuts.Trigger);
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
||||
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("chrome-devtools://")){
|
||||
switch((Keys)windowsKeyCode){
|
||||
case Keys.Enter:
|
||||
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
||||
TriggerKeyboardShortcutAnalytics();
|
||||
return true;
|
||||
|
||||
case Keys.Escape:
|
||||
notification.InvokeAsyncSafe(notification.HideNotification);
|
||||
TriggerKeyboardShortcutAnalytics();
|
||||
return true;
|
||||
|
||||
case Keys.Space:
|
||||
notification.InvokeAsyncSafe(() => notification.FreezeTimer = !notification.FreezeTimer);
|
||||
TriggerKeyboardShortcutAnalytics();
|
||||
return true;
|
||||
}
|
||||
protected override bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||
if (base.HandleRawKey(browserControl, browser, key, modifiers)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
switch(key){
|
||||
case Keys.Enter:
|
||||
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
||||
TriggerKeyboardShortcutAnalytics();
|
||||
return true;
|
||||
|
||||
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
||||
return false;
|
||||
case Keys.Escape:
|
||||
notification.InvokeAsyncSafe(notification.HideNotification);
|
||||
TriggerKeyboardShortcutAnalytics();
|
||||
return true;
|
||||
|
||||
case Keys.Space:
|
||||
notification.InvokeAsyncSafe(() => notification.FreezeTimer = !notification.FreezeTimer);
|
||||
TriggerKeyboardShortcutAnalytics();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,8 @@
|
||||
using System.Collections.Specialized;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
@@ -6,6 +10,36 @@ using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
class RequestHandlerBase : DefaultRequestHandler{
|
||||
private static readonly Regex TweetDeckResourceUrl = new Regex(@"/dist/(.*?)\.(.*?)\.(css|js)$", RegexOptions.Compiled);
|
||||
private static readonly SortedList<string, string> TweetDeckHashes = new SortedList<string, string>(4);
|
||||
|
||||
public static void LoadResourceRewriteRules(string rules){
|
||||
if (string.IsNullOrEmpty(rules)){
|
||||
return;
|
||||
}
|
||||
|
||||
TweetDeckHashes.Clear();
|
||||
|
||||
foreach(string rule in rules.Replace(" ", "").ToLower().Split(',')){
|
||||
string[] split = rule.Split('=');
|
||||
|
||||
if (split.Length == 2){
|
||||
string key = split[0];
|
||||
string hash = split[1];
|
||||
|
||||
if (hash.All(chr => char.IsDigit(chr) || (chr >= 'a' && chr <= 'f'))){
|
||||
TweetDeckHashes.Add(key, hash);
|
||||
}
|
||||
else{
|
||||
throw new ArgumentException("Invalid hash characters: "+rule);
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw new ArgumentException("A rule must have exactly one '=' character: "+rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly bool autoReload;
|
||||
|
||||
public RequestHandlerBase(bool autoReload){
|
||||
@@ -26,6 +60,26 @@ namespace TweetDuck.Core.Handling{
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
}
|
||||
|
||||
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if ((request.ResourceType == ResourceType.Script || request.ResourceType == ResourceType.Stylesheet) && TweetDeckHashes.Count > 0){
|
||||
string url = request.Url;
|
||||
Match match = TweetDeckResourceUrl.Match(url);
|
||||
|
||||
if (match.Success && TweetDeckHashes.TryGetValue($"{match.Groups[1]}.{match.Groups[3]}", out string hash)){
|
||||
if (match.Groups[2].Value == hash){
|
||||
Program.Reporter.LogVerbose("[RequestHandlerBase] Accepting " + url);
|
||||
}
|
||||
else{
|
||||
Program.Reporter.LogVerbose("[RequestHandlerBase] Replacing " + url + " hash with " + hash);
|
||||
request.Url = TweetDeckResourceUrl.Replace(url, $"/dist/$1.{hash}.$3");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||
}
|
||||
|
||||
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||
if (autoReload){
|
||||
browser.Reload();
|
||||
|
@@ -1,26 +1,35 @@
|
||||
// Uncomment to force TweetDeck to load a predefined version of the vendor/bundle scripts
|
||||
// #define FREEZE_TWEETDECK_SCRIPTS
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Collections.Specialized;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Handling.Filters;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
#if FREEZE_TWEETDECK_SCRIPTS
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
#endif
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class RequestHandlerBrowser : RequestHandlerBase{
|
||||
private const string UrlVendorResource = "/dist/vendor";
|
||||
private const string UrlLoadingSpinner = "/backgrounds/spinner_blue";
|
||||
|
||||
public string BlockNextUserNavUrl { get; set; }
|
||||
|
||||
public RequestHandlerBrowser() : base(true){}
|
||||
|
||||
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (request.ResourceType == ResourceType.Script && request.Url.Contains("analytics.")){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
if (request.ResourceType == ResourceType.MainFrame){
|
||||
if (request.Url.EndsWith("//twitter.com/")){
|
||||
request.Url = TwitterUtils.TweetDeckURL; // redirect plain twitter.com requests, fixes bugs with login 2FA
|
||||
}
|
||||
}
|
||||
else if (request.ResourceType == ResourceType.Script){
|
||||
string url = request.Url;
|
||||
|
||||
if (url.Contains("analytics.")){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
}
|
||||
else if (url.Contains(UrlVendorResource)){
|
||||
NameValueCollection headers = request.Headers;
|
||||
headers["Accept-Encoding"] = "identity";
|
||||
request.Headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
@@ -36,58 +45,18 @@ namespace TweetDuck.Core.Handling{
|
||||
return base.OnBeforeBrowse(browserControl, browser, frame, request, userGesture, isRedirect);
|
||||
}
|
||||
|
||||
#if FREEZE_TWEETDECK_SCRIPTS
|
||||
private static readonly Regex TweetDeckScriptUrl = new Regex(@"/dist/(.*?)\.(.*?)\.js$", RegexOptions.Compiled);
|
||||
|
||||
private static readonly SortedList<string, string> TweetDeckHashes = new SortedList<string, string>(2){
|
||||
{ "vendor", "942c0a20e8" },
|
||||
{ "bundle", "1bd75b5854" }
|
||||
};
|
||||
#endif
|
||||
|
||||
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if (request.ResourceType == ResourceType.Image && request.Url.Contains("/backgrounds/spinner_blue")){
|
||||
if (request.ResourceType == ResourceType.Image && request.Url.Contains(UrlLoadingSpinner)){
|
||||
request.Url = TwitterUtils.LoadingSpinner.Url;
|
||||
return true;
|
||||
}
|
||||
#if FREEZE_TWEETDECK_SCRIPTS
|
||||
else if (request.ResourceType == ResourceType.Script){
|
||||
Match match = TweetDeckScriptUrl.Match(request.Url);
|
||||
|
||||
if (match.Success && TweetDeckHashes.TryGetValue(match.Groups[1].Value, out string hash)){
|
||||
if (match.Groups[2].Value == hash){
|
||||
System.Diagnostics.Debug.WriteLine($"accepting {request.Url}");
|
||||
}
|
||||
else{
|
||||
System.Diagnostics.Debug.WriteLine($"rewriting {request.Url} to {hash}");
|
||||
request.Url = TweetDeckScriptUrl.Replace(request.Url, "/dist/$1."+hash+".js");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||
}
|
||||
|
||||
public override IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if (request.ResourceType == ResourceType.Script && request.Url.Contains("/dist/vendor")){
|
||||
NameValueCollection headers = response.ResponseHeaders;
|
||||
|
||||
if (int.TryParse(headers["x-ton-expected-size"], out int totalBytes)){
|
||||
return new ResponseFilterVendor(totalBytes);
|
||||
}
|
||||
#if DEBUG
|
||||
else{
|
||||
System.Diagnostics.Debug.WriteLine($"Missing uncompressed size header in {request.Url}");
|
||||
|
||||
foreach(string key in headers){
|
||||
System.Diagnostics.Debug.WriteLine($" {key}: {headers[key]}");
|
||||
}
|
||||
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
#endif
|
||||
if (request.ResourceType == ResourceType.Script && request.Url.Contains(UrlVendorResource) && int.TryParse(response.ResponseHeaders["Content-Length"], out int totalBytes)){
|
||||
return new ResponseFilterVendor(totalBytes);
|
||||
}
|
||||
|
||||
return base.GetResourceResponseFilter(browserControl, browser, frame, request, response);
|
||||
|
43
Core/Handling/ResourceHandlerFactory.cs
Normal file
43
Core/Handling/ResourceHandlerFactory.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using CefSharp;
|
||||
using TweetDuck.Data;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class ResourceHandlerFactory : IResourceHandlerFactory{
|
||||
public bool HasHandlers => !handlers.IsEmpty;
|
||||
|
||||
private readonly ConcurrentDictionary<string, IResourceHandler> handlers = new ConcurrentDictionary<string, IResourceHandler>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request){
|
||||
try{
|
||||
return handlers.TryGetValue(request.Url, out IResourceHandler handler) ? handler : null;
|
||||
}finally{
|
||||
request.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// registration
|
||||
|
||||
public bool RegisterHandler(string url, IResourceHandler handler){
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||
handlers.AddOrUpdate(uri.AbsoluteUri, handler, (key, prev) => handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool RegisterHandler(ResourceLink link){
|
||||
return RegisterHandler(link.Url, link.Handler);
|
||||
}
|
||||
|
||||
public bool UnregisterHandler(string url){
|
||||
return handlers.TryRemove(url, out IResourceHandler _);
|
||||
}
|
||||
|
||||
public bool UnregisterHandler(ResourceLink link){
|
||||
return UnregisterHandler(link.Url);
|
||||
}
|
||||
}
|
||||
}
|
@@ -28,7 +28,7 @@ namespace TweetDuck.Core.Management{
|
||||
}
|
||||
|
||||
public static void RefreshTimer(){
|
||||
bool shouldRun = Program.SystemConfig.ClearCacheAutomatically && !ClearOnExit;
|
||||
bool shouldRun = Program.Config.System.ClearCacheAutomatically && !ClearOnExit;
|
||||
|
||||
if (!shouldRun && AutoClearTimer != null){
|
||||
AutoClearTimer.Dispose();
|
||||
@@ -38,7 +38,7 @@ namespace TweetDuck.Core.Management{
|
||||
AutoClearTimer = new Timer(state => {
|
||||
if (AutoClearTimer != null){
|
||||
try{
|
||||
if (CalculateCacheSize() >= Program.SystemConfig.ClearCacheThreshold*1024L*1024L){
|
||||
if (CalculateCacheSize() >= Program.Config.System.ClearCacheThreshold*1024L*1024L){
|
||||
SetClearOnExit();
|
||||
}
|
||||
}catch(Exception){
|
||||
@@ -54,6 +54,14 @@ namespace TweetDuck.Core.Management{
|
||||
RefreshTimer();
|
||||
}
|
||||
|
||||
public static void TryClearNow(){
|
||||
try{
|
||||
Directory.Delete(CacheFolder, true);
|
||||
}catch{
|
||||
// welp, too bad
|
||||
}
|
||||
}
|
||||
|
||||
public static void Exit(){
|
||||
if (AutoClearTimer != null){
|
||||
AutoClearTimer.Dispose();
|
||||
@@ -61,11 +69,7 @@ namespace TweetDuck.Core.Management{
|
||||
}
|
||||
|
||||
if (ClearOnExit){
|
||||
try{
|
||||
Directory.Delete(CacheFolder, true);
|
||||
}catch{
|
||||
// welp, too bad
|
||||
}
|
||||
TryClearNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,49 +1,54 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System;
|
||||
using CefSharp;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Management{
|
||||
sealed class ContextInfo{
|
||||
public LinkInfo Link { get; private set; }
|
||||
public ChirpInfo Chirp { get; private set; }
|
||||
private LinkInfo link;
|
||||
private ChirpInfo? chirp;
|
||||
|
||||
public ContextInfo(){
|
||||
Reset();
|
||||
}
|
||||
|
||||
public void SetLink(string type, string url){
|
||||
Link = string.IsNullOrEmpty(url) ? new LinkInfo() : new LinkInfo(type, url);
|
||||
link = string.IsNullOrEmpty(url) ? null : new LinkInfo(type, url);
|
||||
}
|
||||
|
||||
public void SetChirp(string tweetUrl, string quoteUrl, string chirpAuthors, string chirpImages){
|
||||
Chirp = new ChirpInfo(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
|
||||
chirp = string.IsNullOrEmpty(tweetUrl) ? (ChirpInfo?)null : new ChirpInfo(tweetUrl, quoteUrl, chirpAuthors, chirpImages);
|
||||
}
|
||||
|
||||
public void Reset(){
|
||||
Link = new LinkInfo();
|
||||
Chirp = new ChirpInfo();
|
||||
public ContextData Reset(){
|
||||
link = null;
|
||||
chirp = null;
|
||||
return ContextData.Empty;
|
||||
}
|
||||
|
||||
public ContextData Create(IContextMenuParams parameters){
|
||||
ContextData.Builder builder = new ContextData.Builder();
|
||||
builder.AddContext(parameters);
|
||||
|
||||
if (link != null){
|
||||
builder.AddOverride(link.Type, link.Url);
|
||||
}
|
||||
|
||||
if (chirp.HasValue){
|
||||
builder.AddChirp(chirp.Value);
|
||||
}
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
// Data structures
|
||||
|
||||
public struct LinkInfo{
|
||||
public bool IsLink => type == "link";
|
||||
public bool IsImage => type == "image";
|
||||
public bool IsVideo => type == "video";
|
||||
|
||||
public string GetUrl(IContextMenuParams parameters, bool safe){
|
||||
return IsLink ? url : (safe ? parameters.LinkUrl : parameters.UnfilteredLinkUrl);
|
||||
}
|
||||
|
||||
public string GetMediaSource(IContextMenuParams parameters){
|
||||
return IsImage || IsVideo ? url : parameters.SourceUrl;
|
||||
}
|
||||
|
||||
private readonly string type;
|
||||
private readonly string url;
|
||||
private sealed class LinkInfo{
|
||||
public string Type { get; }
|
||||
public string Url { get; }
|
||||
|
||||
public LinkInfo(string type, string url){
|
||||
this.type = type;
|
||||
this.url = url;
|
||||
this.Type = type;
|
||||
this.Url = url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,5 +69,93 @@ namespace TweetDuck.Core.Management{
|
||||
this.chirpImages = chirpImages;
|
||||
}
|
||||
}
|
||||
|
||||
// Constructed context
|
||||
|
||||
[Flags]
|
||||
public enum ContextType{
|
||||
Unknown = 0,
|
||||
Link = 0b0001,
|
||||
Image = 0b0010,
|
||||
Video = 0b0100,
|
||||
Chirp = 0b1000
|
||||
}
|
||||
|
||||
public sealed class ContextData{
|
||||
public static readonly ContextData Empty = new Builder().Build();
|
||||
|
||||
public ContextType Types { get; }
|
||||
|
||||
public string LinkUrl { get; }
|
||||
public string UnsafeLinkUrl { get; }
|
||||
public string MediaUrl { get; }
|
||||
|
||||
public ChirpInfo Chirp { get; }
|
||||
|
||||
public ContextData(ContextType types, string linkUrl, string unsafeLinkUrl, string mediaUrl, ChirpInfo chirp){
|
||||
Types = types;
|
||||
LinkUrl = linkUrl;
|
||||
UnsafeLinkUrl = unsafeLinkUrl;
|
||||
MediaUrl = mediaUrl;
|
||||
Chirp = chirp;
|
||||
}
|
||||
|
||||
public sealed class Builder{
|
||||
private ContextType types = ContextType.Unknown;
|
||||
|
||||
private string linkUrl = string.Empty;
|
||||
private string unsafeLinkUrl = string.Empty;
|
||||
private string mediaUrl = string.Empty;
|
||||
|
||||
private ChirpInfo chirp = default;
|
||||
|
||||
public void AddContext(IContextMenuParams parameters){
|
||||
ContextMenuType flags = parameters.TypeFlags;
|
||||
|
||||
if (flags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents){
|
||||
types |= ContextType.Image;
|
||||
types &= ~ContextType.Video;
|
||||
mediaUrl = parameters.SourceUrl;
|
||||
}
|
||||
|
||||
if (flags.HasFlag(ContextMenuType.Link)){
|
||||
types |= ContextType.Link;
|
||||
linkUrl = parameters.LinkUrl;
|
||||
unsafeLinkUrl = parameters.UnfilteredLinkUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddOverride(string type, string url){
|
||||
switch(type){
|
||||
case "link":
|
||||
types |= ContextType.Link;
|
||||
linkUrl = url;
|
||||
unsafeLinkUrl = url;
|
||||
break;
|
||||
|
||||
case "image":
|
||||
types |= ContextType.Image;
|
||||
types &= ~(ContextType.Video | ContextType.Link);
|
||||
mediaUrl = url;
|
||||
break;
|
||||
|
||||
case "video":
|
||||
types |= ContextType.Video;
|
||||
types &= ~(ContextType.Image | ContextType.Link);
|
||||
mediaUrl = url;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddChirp(ChirpInfo chirp){
|
||||
this.types |= ContextType.Chirp;
|
||||
this.chirp = chirp;
|
||||
}
|
||||
|
||||
public ContextData Build(){
|
||||
return new ContextData(types, linkUrl, unsafeLinkUrl, mediaUrl, chirp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,9 +3,10 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetLib.Core.Data;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
|
||||
namespace TweetDuck.Core.Management{
|
||||
sealed class ProfileManager{
|
||||
@@ -22,8 +23,6 @@ namespace TweetDuck.Core.Management{
|
||||
All = UserConfig|SystemConfig|Session|PluginData
|
||||
}
|
||||
|
||||
public bool IsRestarting { get; private set; }
|
||||
|
||||
private readonly string file;
|
||||
private readonly PluginManager plugins;
|
||||
|
||||
@@ -125,7 +124,6 @@ namespace TweetDuck.Core.Management{
|
||||
case "system":
|
||||
if (items.HasFlag(Items.SystemConfig)){
|
||||
entry.WriteToFile(Program.SystemConfigFilePath);
|
||||
IsRestarting = true;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -153,7 +151,6 @@ namespace TweetDuck.Core.Management{
|
||||
case "cookies":
|
||||
if (items.HasFlag(Items.Session)){
|
||||
entry.WriteToFile(Path.Combine(Program.StoragePath, TempCookiesPath));
|
||||
IsRestarting = true;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -167,7 +164,7 @@ namespace TweetDuck.Core.Management{
|
||||
|
||||
return true;
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Profile Import Error", "An exception happened while importing TweetDuck profile.", true, e);
|
||||
Program.Reporter.HandleException("Profile Import", "An exception happened while importing TweetDuck profile.", true, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -216,10 +213,4 @@ namespace TweetDuck.Core.Management{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class ProfileManagerExtensions{
|
||||
public static bool NeedsRestart(this ProfileManager.Items items){
|
||||
return items.HasFlag(ProfileManager.Items.SystemConfig) || items.HasFlag(ProfileManager.Items.Session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
@@ -9,6 +10,8 @@ using TweetLib.Communication;
|
||||
|
||||
namespace TweetDuck.Core.Management{
|
||||
sealed class VideoPlayer : IDisposable{
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
public bool Running => currentInstance != null && currentInstance.Running;
|
||||
|
||||
public event EventHandler ProcessExited;
|
||||
@@ -37,7 +40,7 @@ namespace TweetDuck.Core.Management{
|
||||
|
||||
if ((process = Process.Start(new ProcessStartInfo{
|
||||
FileName = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe"),
|
||||
Arguments = $"{owner.Handle} {Program.UserConfig.VideoPlayerVolume} \"{url}\" \"{pipe.GenerateToken()}\"",
|
||||
Arguments = $"{owner.Handle} {(int)Math.Floor(100F*owner.GetDPIScale())} {Config.VideoPlayerVolume} \"{url}\" \"{pipe.GenerateToken()}\"",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true
|
||||
})) != null){
|
||||
@@ -68,9 +71,9 @@ namespace TweetDuck.Core.Management{
|
||||
owner.InvokeSafe(() => {
|
||||
switch(e.Key){
|
||||
case "vol":
|
||||
if (int.TryParse(e.Data, out int volume) && volume != Program.UserConfig.VideoPlayerVolume){
|
||||
Program.UserConfig.VideoPlayerVolume = volume;
|
||||
Program.UserConfig.Save();
|
||||
if (int.TryParse(e.Data, out int volume) && volume != Config.VideoPlayerVolume){
|
||||
Config.VideoPlayerVolume = volume;
|
||||
Config.Save();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -132,7 +135,7 @@ namespace TweetDuck.Core.Management{
|
||||
|
||||
private void process_OutputDataReceived(object sender, DataReceivedEventArgs e){
|
||||
if (!string.IsNullOrEmpty(e.Data)){
|
||||
Program.Reporter.Log("[VideoPlayer] "+e.Data);
|
||||
Program.Reporter.LogVerbose("[VideoPlayer] "+e.Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -8,11 +8,11 @@ using TweetDuck.Resources;
|
||||
namespace TweetDuck.Core.Notification.Example{
|
||||
sealed class FormNotificationExample : FormNotificationMain{
|
||||
public override bool RequiresResize => true;
|
||||
protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom;
|
||||
protected override bool CanDragWindow => Config.NotificationPosition == TweetNotification.Position.Custom;
|
||||
|
||||
protected override FormBorderStyle NotificationBorderStyle{
|
||||
get{
|
||||
if (Program.UserConfig.NotificationSize == TweetNotification.Size.Custom){
|
||||
if (Config.NotificationSize == TweetNotification.Size.Custom){
|
||||
switch(base.NotificationBorderStyle){
|
||||
case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable;
|
||||
case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow;
|
||||
@@ -23,6 +23,8 @@ namespace TweetDuck.Core.Notification.Example{
|
||||
}
|
||||
}
|
||||
|
||||
protected override string BodyClasses => base.BodyClasses+" td-example";
|
||||
|
||||
public event EventHandler Ready;
|
||||
|
||||
private readonly TweetNotification exampleNotification;
|
||||
@@ -36,7 +38,7 @@ namespace TweetDuck.Core.Notification.Example{
|
||||
exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>");
|
||||
#endif
|
||||
|
||||
exampleNotification = TweetNotification.Example(exampleTweetHTML, 176);
|
||||
exampleNotification = new TweetNotification(string.Empty, string.Empty, "Home", exampleTweetHTML, 176, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||
|
@@ -10,7 +10,9 @@ using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
partial class FormNotificationBase : Form, AnalyticsFile.IProvider{
|
||||
abstract partial class FormNotificationBase : Form, AnalyticsFile.IProvider{
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
|
||||
protected static int FontSizeLevel{
|
||||
get{
|
||||
switch(TweetDeckBridge.FontSize){
|
||||
@@ -25,19 +27,18 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
protected virtual Point PrimaryLocation{
|
||||
get{
|
||||
UserConfig config = Program.UserConfig;
|
||||
Screen screen;
|
||||
|
||||
if (config.NotificationDisplay > 0 && config.NotificationDisplay <= Screen.AllScreens.Length){
|
||||
screen = Screen.AllScreens[config.NotificationDisplay-1];
|
||||
if (Config.NotificationDisplay > 0 && Config.NotificationDisplay <= Screen.AllScreens.Length){
|
||||
screen = Screen.AllScreens[Config.NotificationDisplay-1];
|
||||
}
|
||||
else{
|
||||
screen = Screen.FromControl(owner);
|
||||
}
|
||||
|
||||
int edgeDist = config.NotificationEdgeDistance;
|
||||
int edgeDist = Config.NotificationEdgeDistance;
|
||||
|
||||
switch(config.NotificationPosition){
|
||||
switch(Config.NotificationPosition){
|
||||
case TweetNotification.Position.TopLeft:
|
||||
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+edgeDist);
|
||||
|
||||
@@ -51,12 +52,12 @@ namespace TweetDuck.Core.Notification{
|
||||
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
||||
|
||||
case TweetNotification.Position.Custom:
|
||||
if (!config.IsCustomNotificationPositionSet){
|
||||
config.CustomNotificationPosition = new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
|
||||
config.Save();
|
||||
if (!Config.IsCustomNotificationPositionSet){
|
||||
Config.CustomNotificationPosition = new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
|
||||
Config.Save();
|
||||
}
|
||||
|
||||
return config.CustomNotificationPosition;
|
||||
return Config.CustomNotificationPosition;
|
||||
}
|
||||
|
||||
return Location;
|
||||
@@ -93,7 +94,7 @@ namespace TweetDuck.Core.Notification{
|
||||
protected override bool ShowWithoutActivation => true;
|
||||
|
||||
protected float DpiScale { get; }
|
||||
protected double SizeScale => DpiScale*Program.UserConfig.ZoomLevel/100.0;
|
||||
protected double SizeScale => DpiScale*Config.ZoomLevel/100.0;
|
||||
|
||||
protected readonly FormBrowser owner;
|
||||
protected readonly ChromiumWebBrowser browser;
|
||||
@@ -120,18 +121,21 @@ namespace TweetDuck.Core.Notification{
|
||||
this.owner = owner;
|
||||
this.owner.FormClosed += owner_FormClosed;
|
||||
|
||||
ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();
|
||||
resourceHandlerFactory.RegisterHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
|
||||
resourceHandlerFactory.RegisterHandler(TweetNotification.AppLogo);
|
||||
|
||||
this.browser = new ChromiumWebBrowser("about:blank"){
|
||||
MenuHandler = new ContextMenuNotification(this, enableContextMenu),
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = new RequestHandlerBase(false)
|
||||
RequestHandler = new RequestHandlerBase(false),
|
||||
ResourceHandlerFactory = resourceHandlerFactory
|
||||
};
|
||||
|
||||
this.browser.Dock = DockStyle.None;
|
||||
this.browser.ClientSize = ClientSize;
|
||||
|
||||
browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
|
||||
browser.SetupResourceHandler(TweetNotification.AppLogo);
|
||||
this.browser.SetupZoomEvents();
|
||||
|
||||
Controls.Add(browser);
|
||||
|
||||
@@ -184,9 +188,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual string GetTweetHTML(TweetNotification tweet){
|
||||
return tweet.GenerateHtml(IsCursorOverBrowser ? "td-notification td-hover" : "td-notification", this);
|
||||
}
|
||||
protected abstract string GetTweetHTML(TweetNotification tweet);
|
||||
|
||||
protected virtual void LoadTweet(TweetNotification tweet){
|
||||
currentNotification = tweet;
|
||||
@@ -202,7 +204,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
protected virtual void UpdateTitle(){
|
||||
string title = currentNotification?.ColumnTitle;
|
||||
Text = string.IsNullOrEmpty(title) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+title;
|
||||
Text = string.IsNullOrEmpty(title) || !Config.DisplayNotificationColumn ? Program.BrandName : $"{Program.BrandName} - {title}";
|
||||
}
|
||||
|
||||
public void ShowTweetDetail(){
|
||||
|
@@ -5,15 +5,14 @@ using System.Windows.Forms;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Other.Interfaces;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Resources;
|
||||
using TweetLib.Core.Data;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
abstract partial class FormNotificationMain : FormNotificationBase, ITweetDeckBrowser{
|
||||
abstract partial class FormNotificationMain : FormNotificationBase{
|
||||
private readonly PluginManager plugins;
|
||||
private readonly int timerBarHeight;
|
||||
|
||||
@@ -29,7 +28,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
public virtual bool RequiresResize{
|
||||
get{
|
||||
return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Program.UserConfig.DisplayNotificationTimer || prevFontSize != FontSizeLevel;
|
||||
return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Config.DisplayNotificationTimer || prevFontSize != FontSizeLevel;
|
||||
}
|
||||
|
||||
set{
|
||||
@@ -38,7 +37,7 @@ namespace TweetDuck.Core.Notification{
|
||||
prevFontSize = null;
|
||||
}
|
||||
else{
|
||||
prevDisplayTimer = Program.UserConfig.DisplayNotificationTimer;
|
||||
prevDisplayTimer = Config.DisplayNotificationTimer;
|
||||
prevFontSize = FontSizeLevel;
|
||||
}
|
||||
}
|
||||
@@ -46,29 +45,31 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
private int BaseClientWidth{
|
||||
get{
|
||||
switch(Program.UserConfig.NotificationSize){
|
||||
switch(Config.NotificationSize){
|
||||
default:
|
||||
return BrowserUtils.Scale(284, SizeScale*(1.0+0.05*FontSizeLevel));
|
||||
|
||||
case TweetNotification.Size.Custom:
|
||||
return Program.UserConfig.CustomNotificationSize.Width;
|
||||
return Config.CustomNotificationSize.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int BaseClientHeight{
|
||||
get{
|
||||
switch(Program.UserConfig.NotificationSize){
|
||||
switch(Config.NotificationSize){
|
||||
default:
|
||||
return BrowserUtils.Scale(122, SizeScale*(1.0+0.08*FontSizeLevel));
|
||||
|
||||
case TweetNotification.Size.Custom:
|
||||
return Program.UserConfig.CustomNotificationSize.Height;
|
||||
return Config.CustomNotificationSize.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Size BrowserSize => Program.UserConfig.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-timerBarHeight) : ClientSize;
|
||||
protected virtual string BodyClasses => IsCursorOverBrowser ? "td-notification td-hover" : "td-notification";
|
||||
|
||||
public Size BrowserSize => Config.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-timerBarHeight) : ClientSize;
|
||||
|
||||
protected FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
|
||||
InitializeComponent();
|
||||
@@ -82,34 +83,12 @@ namespace TweetDuck.Core.Notification{
|
||||
browser.LoadingStateChanged += Browser_LoadingStateChanged;
|
||||
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
||||
|
||||
plugins.Register(this, PluginEnvironment.Notification, this);
|
||||
plugins.Register(browser, PluginEnvironment.Notification, this);
|
||||
|
||||
mouseHookDelegate = MouseHookProc;
|
||||
Disposed += (sender, args) => StopMouseHook(true);
|
||||
}
|
||||
|
||||
// implementation of ITweetDeckBrowser
|
||||
|
||||
bool ITweetDeckBrowser.IsTweetDeckWebsite => IsNotificationVisible;
|
||||
|
||||
void ITweetDeckBrowser.RegisterBridge(string name, object obj){
|
||||
browser.RegisterAsyncJsObject(name, obj);
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.OnFrameLoaded(Action<IFrame> callback){
|
||||
browser.FrameLoadEnd += (sender, args) => {
|
||||
IFrame frame = args.Frame;
|
||||
|
||||
if (frame.IsMain && browser.Address != "about:blank"){
|
||||
callback(frame);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.ExecuteFunction(string name, params object[] args){
|
||||
browser.ExecuteScriptAsync(name, args);
|
||||
}
|
||||
|
||||
// mouse wheel hook
|
||||
|
||||
private void StartMouseHook(){
|
||||
@@ -131,7 +110,7 @@ namespace TweetDuck.Core.Notification{
|
||||
int eventType = wParam.ToInt32();
|
||||
|
||||
if (eventType == NativeMethods.WM_MOUSEWHEEL && IsCursorOverBrowser){
|
||||
browser.SendMouseWheelEvent(0, 0, 0, BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Program.UserConfig.NotificationScrollSpeed*0.01), CefEventFlags.None);
|
||||
browser.SendMouseWheelEvent(0, 0, 0, BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Config.NotificationScrollSpeed*0.01), CefEventFlags.None);
|
||||
return NativeMethods.HOOK_HANDLED;
|
||||
}
|
||||
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
|
||||
@@ -181,9 +160,11 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
if (e.Frame.IsMain && browser.Address != "about:blank"){
|
||||
e.Frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Environment.Notification));
|
||||
ScriptLoader.ExecuteScript(e.Frame, ScriptLoader.LoadResource("notification.js", this), "root:notification");
|
||||
IFrame frame = e.Frame;
|
||||
|
||||
if (frame.IsMain && browser.Address != "about:blank"){
|
||||
frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Environment.Notification));
|
||||
ScriptLoader.ExecuteFile(frame, "notification.js", this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +181,7 @@ namespace TweetDuck.Core.Notification{
|
||||
timeLeft -= timerProgress.Interval;
|
||||
|
||||
int value = BrowserUtils.Scale(progressBarTimer.Maximum+25, (totalTime-timeLeft)/(double)totalTime);
|
||||
progressBarTimer.SetValueInstant(Program.UserConfig.NotificationTimerCountDown ? progressBarTimer.Maximum-value : value);
|
||||
progressBarTimer.SetValueInstant(Config.NotificationTimerCountDown ? progressBarTimer.Maximum-value : value);
|
||||
|
||||
if (timeLeft <= 0){
|
||||
FinishCurrentNotification();
|
||||
@@ -216,7 +197,7 @@ namespace TweetDuck.Core.Notification{
|
||||
public override void HideNotification(){
|
||||
base.HideNotification();
|
||||
|
||||
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? progressBarTimer.Maximum : progressBarTimer.Minimum;
|
||||
progressBarTimer.Value = Config.NotificationTimerCountDown ? progressBarTimer.Maximum : progressBarTimer.Minimum;
|
||||
timerProgress.Stop();
|
||||
totalTime = 0;
|
||||
|
||||
@@ -247,7 +228,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
protected override string GetTweetHTML(TweetNotification tweet){
|
||||
string html = base.GetTweetHTML(tweet);
|
||||
string html = tweet.GenerateHtml(BodyClasses, this);
|
||||
|
||||
foreach(InjectedHTML injection in plugins.NotificationInjections){
|
||||
html = injection.InjectInto(html);
|
||||
@@ -258,14 +239,14 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
protected override void LoadTweet(TweetNotification tweet){
|
||||
timerProgress.Stop();
|
||||
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDurationValue);
|
||||
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? progressBarTimer.Maximum : progressBarTimer.Minimum;
|
||||
totalTime = timeLeft = tweet.GetDisplayDuration(Config.NotificationDurationValue);
|
||||
progressBarTimer.Value = Config.NotificationTimerCountDown ? progressBarTimer.Maximum : progressBarTimer.Minimum;
|
||||
|
||||
base.LoadTweet(tweet);
|
||||
}
|
||||
|
||||
protected override void SetNotificationSize(int width, int height){
|
||||
if (Program.UserConfig.DisplayNotificationTimer){
|
||||
if (Config.DisplayNotificationTimer){
|
||||
ClientSize = new Size(width, height+timerBarHeight);
|
||||
progressBarTimer.Visible = true;
|
||||
}
|
||||
|
@@ -32,10 +32,10 @@ namespace TweetDuck.Core.Notification{
|
||||
public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, true){
|
||||
InitializeComponent();
|
||||
|
||||
Program.UserConfig.MuteToggled += Config_MuteToggled;
|
||||
Disposed += (sender, args) => Program.UserConfig.MuteToggled -= Config_MuteToggled;
|
||||
Config.MuteToggled += Config_MuteToggled;
|
||||
Disposed += (sender, args) => Config.MuteToggled -= Config_MuteToggled;
|
||||
|
||||
if (Program.UserConfig.MuteNotifications){
|
||||
if (Config.MuteNotifications){
|
||||
PauseNotification();
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace TweetDuck.Core.Notification{
|
||||
// event handlers
|
||||
|
||||
private void Config_MuteToggled(object sender, EventArgs e){
|
||||
if (Program.UserConfig.MuteNotifications){
|
||||
if (Config.MuteNotifications){
|
||||
PauseNotification();
|
||||
}
|
||||
else{
|
||||
@@ -73,7 +73,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
private void timerIdlePauseCheck_Tick(object sender, EventArgs e){
|
||||
if (NativeMethods.GetIdleSeconds() < Program.UserConfig.NotificationIdlePauseSeconds){
|
||||
if (NativeMethods.GetIdleSeconds() < Config.NotificationIdlePauseSeconds){
|
||||
ResumeNotification();
|
||||
timerIdlePauseCheck.Stop();
|
||||
}
|
||||
@@ -128,7 +128,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
private void LoadNextNotification(){
|
||||
if (!IsNotificationVisible){
|
||||
if (Program.UserConfig.NotificationNonIntrusiveMode && IsCursorOverNotificationArea && NativeMethods.GetIdleSeconds() < NonIntrusiveIdleLimit){
|
||||
if (Config.NotificationNonIntrusiveMode && IsCursorOverNotificationArea && NativeMethods.GetIdleSeconds() < NonIntrusiveIdleLimit){
|
||||
if (!timerCursorCheck.Enabled){
|
||||
PauseNotification();
|
||||
timerCursorCheck.Start();
|
||||
@@ -136,7 +136,7 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
return;
|
||||
}
|
||||
else if (Program.UserConfig.NotificationIdlePauseSeconds > 0 && NativeMethods.GetIdleSeconds() >= Program.UserConfig.NotificationIdlePauseSeconds){
|
||||
else if (Config.NotificationIdlePauseSeconds > 0 && NativeMethods.GetIdleSeconds() >= Config.NotificationIdlePauseSeconds){
|
||||
if (!timerIdlePauseCheck.Enabled){
|
||||
PauseNotification();
|
||||
timerIdlePauseCheck.Start();
|
||||
|
@@ -6,9 +6,9 @@ using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Resources;
|
||||
using TweetLib.Core.Data;
|
||||
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||
|
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
|
||||
namespace TweetDuck.Core.Notification.Screenshot{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
sealed class ScreenshotBridge{
|
||||
private readonly Control owner;
|
||||
|
||||
|
@@ -11,10 +11,6 @@ namespace TweetDuck.Core.Notification{
|
||||
private const string DefaultHeadLayout = @"<html class=""scroll-v os-windows dark txt-size--14"" lang=""en-US"" id=""tduck"" data-td-font=""medium"" data-td-theme=""dark""><head><meta charset=""utf-8""><link href=""https://ton.twimg.com/tweetdeck-web/web/dist/bundle.4b1f87e09d.css"" rel=""stylesheet""><style type='text/css'>body { background: rgb(34, 36, 38) !important }</style>";
|
||||
public static readonly ResourceLink AppLogo = new ResourceLink("https://ton.twimg.com/tduck/avatar", ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png"));
|
||||
|
||||
public static TweetNotification Example(string html, int characters){
|
||||
return new TweetNotification(string.Empty, string.Empty, "Home", html, characters, string.Empty, string.Empty, true);
|
||||
}
|
||||
|
||||
public enum Position{
|
||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||
}
|
||||
@@ -32,11 +28,8 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
private readonly string html;
|
||||
private readonly int characters;
|
||||
private readonly bool isExample;
|
||||
|
||||
public TweetNotification(string columnId, string chirpId, string title, string html, int characters, string tweetUrl, string quoteUrl) : this(columnId, chirpId, title, html, characters, tweetUrl, quoteUrl, false){}
|
||||
|
||||
private TweetNotification(string columnId, string chirpId, string title, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
||||
public TweetNotification(string columnId, string chirpId, string title, string html, int characters, string tweetUrl, string quoteUrl){
|
||||
this.ColumnId = columnId;
|
||||
this.ChirpId = chirpId;
|
||||
|
||||
@@ -46,7 +39,6 @@ namespace TweetDuck.Core.Notification{
|
||||
|
||||
this.html = html;
|
||||
this.characters = characters;
|
||||
this.isExample = isExample;
|
||||
}
|
||||
|
||||
public int GetDisplayDuration(int value){
|
||||
@@ -54,26 +46,28 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
public string GenerateHtml(string bodyClasses, Control sync){
|
||||
StringBuilder build = new StringBuilder();
|
||||
build.Append("<!DOCTYPE html>");
|
||||
build.Append(TweetDeckBridge.NotificationHeadLayout ?? DefaultHeadLayout);
|
||||
build.Append("<style type='text/css'>").Append(ScriptLoader.LoadResource("styles/notification.css", sync) ?? string.Empty).Append("</style>");
|
||||
string headLayout = TweetDeckBridge.NotificationHeadLayout ?? DefaultHeadLayout;
|
||||
string mainCSS = ScriptLoader.LoadResource("styles/notification.css", sync) ?? string.Empty;
|
||||
string customCSS = Program.Config.User.CustomNotificationCSS ?? string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(Program.UserConfig.CustomNotificationCSS)){
|
||||
build.Append("<style type='text/css'>").Append(Program.UserConfig.CustomNotificationCSS).Append("</style>");
|
||||
StringBuilder build = new StringBuilder(320 + headLayout.Length + mainCSS.Length + customCSS.Length + html.Length);
|
||||
build.Append("<!DOCTYPE html>");
|
||||
build.Append(headLayout);
|
||||
build.Append("<style type='text/css'>").Append(mainCSS).Append("</style>");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(customCSS)){
|
||||
build.Append("<style type='text/css'>").Append(customCSS).Append("</style>");
|
||||
}
|
||||
|
||||
build.Append("</head>");
|
||||
build.Append("<body class='scroll-styled-v");
|
||||
build.Append("</head><body class='scroll-styled-v");
|
||||
|
||||
if (!string.IsNullOrEmpty(bodyClasses)){
|
||||
build.Append(' ').Append(bodyClasses);
|
||||
}
|
||||
|
||||
build.Append('\'').Append(isExample ? " td-example-notification" : "").Append("><div class='column' style='width:100%!important;min-height:100vh!important;height:auto!important;overflow:initial!important;'>");
|
||||
build.Append("'><div class='column' style='width:100%!important;min-height:100vh!important;height:auto!important;overflow:initial!important;'>");
|
||||
build.Append(html);
|
||||
build.Append("</div></body>");
|
||||
build.Append("</html>");
|
||||
build.Append("</div></body></html>");
|
||||
return build.ToString();
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,8 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using TweetDuck.Data.Serialization;
|
||||
using TweetLib.Core.Serialization;
|
||||
using TweetLib.Core.Serialization.Converters;
|
||||
|
||||
namespace TweetDuck.Core.Other.Analytics{
|
||||
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local")]
|
||||
|
@@ -9,6 +9,8 @@ using System.Timers;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Analytics{
|
||||
sealed class AnalyticsManager : IDisposable{
|
||||
@@ -20,7 +22,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
#else
|
||||
"https://tweetduck.chylex.com/breadcrumb/report"
|
||||
#endif
|
||||
);
|
||||
);
|
||||
|
||||
public AnalyticsFile File { get; }
|
||||
|
||||
@@ -80,7 +82,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
private void SetLastDataCollectionTime(DateTime dt, string message = null){
|
||||
File.LastDataCollection = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, 0, dt.Kind);
|
||||
File.LastCollectionVersion = Program.VersionTag;
|
||||
File.LastCollectionMessage = message ?? dt.ToString("g", Program.Culture);
|
||||
File.LastCollectionMessage = message ?? dt.ToString("g", Lib.Culture);
|
||||
|
||||
File.Save();
|
||||
RestartTimer();
|
||||
@@ -117,7 +119,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
#endif
|
||||
|
||||
BrowserUtils.CreateWebClient().UploadValues(CollectionUrl, "POST", report.ToNameValueCollection());
|
||||
WebUtils.NewClient(BrowserUtils.UserAgentVanilla).UploadValues(CollectionUrl, "POST", report.ToNameValueCollection());
|
||||
}).ContinueWith(task => browser.InvokeAsyncSafe(() => {
|
||||
if (task.Status == TaskStatus.RanToCompletion){
|
||||
SetLastDataCollectionTime(DateTime.Now);
|
||||
|
@@ -40,7 +40,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
}
|
||||
|
||||
public override string ToString(){
|
||||
StringBuilder build = new StringBuilder();
|
||||
StringBuilder build = new StringBuilder(625);
|
||||
|
||||
foreach(DictionaryEntry entry in data){
|
||||
if (entry.Value == null){
|
||||
|
@@ -11,7 +11,10 @@ using System.Text.RegularExpressions;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Analytics{
|
||||
static class AnalyticsReportGenerator{
|
||||
@@ -27,7 +30,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
{ "System Edition" , SystemEdition },
|
||||
{ "System Environment" , Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit" },
|
||||
{ "System Build" , SystemBuild },
|
||||
{ "System Locale" , Program.Culture.Name.ToLower() },
|
||||
{ "System Locale" , Lib.Culture.Name.ToLower() },
|
||||
0,
|
||||
{ "RAM" , Exact(RamSize) },
|
||||
{ "GPU" , GpuVendor },
|
||||
@@ -119,8 +122,8 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
}.FinalizeReport();
|
||||
}
|
||||
|
||||
private static UserConfig UserConfig => Program.UserConfig;
|
||||
private static SystemConfig SysConfig => Program.SystemConfig;
|
||||
private static UserConfig UserConfig => Program.Config.User;
|
||||
private static SystemConfig SysConfig => Program.Config.System;
|
||||
|
||||
private static string Bool(bool value) => value ? "on" : "off";
|
||||
private static string Exact(int value) => value.ToString();
|
||||
|
8
Core/Other/FormAbout.Designer.cs
generated
8
Core/Other/FormAbout.Designer.cs
generated
@@ -50,7 +50,7 @@ namespace TweetDuck.Core.Other {
|
||||
this.labelDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelDescription.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDescription.Font = new System.Drawing.Font("Segoe UI", 9.75F);
|
||||
this.labelDescription.Location = new System.Drawing.Point(114, 12);
|
||||
this.labelDescription.Name = "labelDescription";
|
||||
this.labelDescription.Size = new System.Drawing.Size(232, 113);
|
||||
@@ -59,7 +59,7 @@ namespace TweetDuck.Core.Other {
|
||||
// labelTips
|
||||
//
|
||||
this.labelTips.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelTips.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelTips.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular);
|
||||
this.labelTips.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
|
||||
this.labelTips.Location = new System.Drawing.Point(117, 0);
|
||||
this.labelTips.Margin = new System.Windows.Forms.Padding(0);
|
||||
@@ -74,7 +74,7 @@ namespace TweetDuck.Core.Other {
|
||||
//
|
||||
this.labelWebsite.AutoSize = true;
|
||||
this.labelWebsite.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelWebsite.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelWebsite.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular);
|
||||
this.labelWebsite.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
|
||||
this.labelWebsite.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelWebsite.Margin = new System.Windows.Forms.Padding(0);
|
||||
@@ -106,7 +106,7 @@ namespace TweetDuck.Core.Other {
|
||||
// labelIssues
|
||||
//
|
||||
this.labelIssues.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelIssues.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelIssues.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular);
|
||||
this.labelIssues.LinkArea = new System.Windows.Forms.LinkArea(0, 0);
|
||||
this.labelIssues.Location = new System.Drawing.Point(216, 0);
|
||||
this.labelIssues.Margin = new System.Windows.Forms.Padding(0);
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
@@ -65,31 +64,31 @@ namespace TweetDuck.Core.Other{
|
||||
Size = new Size(owner.Size.Width*3/4, owner.Size.Height*3/4);
|
||||
VisibleChanged += (sender, args) => this.MoveToCenter(owner);
|
||||
|
||||
ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();
|
||||
resourceHandlerFactory.RegisterHandler(DummyPage);
|
||||
|
||||
this.browser = new ChromiumWebBrowser(url){
|
||||
MenuHandler = new ContextMenuGuide(owner),
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
KeyboardHandler = new KeyboardHandlerBase(),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = new RequestHandlerBase(true)
|
||||
RequestHandler = new RequestHandlerBase(true),
|
||||
ResourceHandlerFactory = resourceHandlerFactory
|
||||
};
|
||||
|
||||
browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||
browser.FrameLoadStart += browser_FrameLoadStart;
|
||||
browser.FrameLoadEnd += browser_FrameLoadEnd;
|
||||
|
||||
browser.BrowserSettings.BackgroundColor = (uint)BackColor.ToArgb();
|
||||
browser.Dock = DockStyle.None;
|
||||
browser.Location = ControlExtensions.InvisibleLocation;
|
||||
|
||||
browser.SetupResourceHandler(DummyPage);
|
||||
browser.SetupZoomEvents();
|
||||
|
||||
Controls.Add(browser);
|
||||
|
||||
Disposed += (sender, args) => {
|
||||
Program.UserConfig.ZoomLevelChanged -= Config_ZoomLevelChanged;
|
||||
browser.Dispose();
|
||||
};
|
||||
|
||||
Program.UserConfig.ZoomLevelChanged += Config_ZoomLevelChanged;
|
||||
}
|
||||
|
||||
private void Reload(string url){
|
||||
@@ -116,16 +115,8 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
}
|
||||
|
||||
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
|
||||
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
|
||||
}
|
||||
|
||||
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
ScriptLoader.ExecuteScript(e.Frame, "Array.prototype.forEach.call(document.getElementsByTagName('A'), ele => ele.addEventListener('click', e => { e.preventDefault(); window.open(ele.getAttribute('href')); }))", "gen:links");
|
||||
}
|
||||
|
||||
private void Config_ZoomLevelChanged(object sender, EventArgs e){
|
||||
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
Core/Other/FormPlugins.Designer.cs
generated
6
Core/Other/FormPlugins.Designer.cs
generated
@@ -35,7 +35,7 @@
|
||||
//
|
||||
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnClose.AutoSize = true;
|
||||
this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnClose.Location = new System.Drawing.Point(642, 433);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -49,7 +49,7 @@
|
||||
//
|
||||
this.btnReload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnReload.AutoSize = true;
|
||||
this.btnReload.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnReload.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnReload.Location = new System.Drawing.Point(141, 433);
|
||||
this.btnReload.Name = "btnReload";
|
||||
this.btnReload.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -63,7 +63,7 @@
|
||||
//
|
||||
this.btnOpenFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnOpenFolder.AutoSize = true;
|
||||
this.btnOpenFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnOpenFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnOpenFolder.Location = new System.Drawing.Point(12, 433);
|
||||
this.btnOpenFolder.Name = "btnOpenFolder";
|
||||
this.btnOpenFolder.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
|
@@ -3,11 +3,15 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Controls;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
sealed partial class FormPlugins : Form, FormManager.IAppDialog{
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
private readonly PluginManager pluginManager;
|
||||
|
||||
public FormPlugins(){
|
||||
@@ -19,8 +23,8 @@ namespace TweetDuck.Core.Other{
|
||||
public FormPlugins(PluginManager pluginManager) : this(){
|
||||
this.pluginManager = pluginManager;
|
||||
|
||||
if (!Program.UserConfig.PluginsWindowSize.IsEmpty){
|
||||
Size targetSize = Program.UserConfig.PluginsWindowSize;
|
||||
if (!Config.PluginsWindowSize.IsEmpty){
|
||||
Size targetSize = Config.PluginsWindowSize;
|
||||
Size = new Size(Math.Max(MinimumSize.Width, targetSize.Width), Math.Max(MinimumSize.Height, targetSize.Height));
|
||||
}
|
||||
|
||||
@@ -29,8 +33,8 @@ namespace TweetDuck.Core.Other{
|
||||
};
|
||||
|
||||
FormClosed += (sender, args) => {
|
||||
Program.UserConfig.PluginsWindowSize = Size;
|
||||
Program.UserConfig.Save();
|
||||
Config.PluginsWindowSize = Size;
|
||||
Config.Save();
|
||||
};
|
||||
|
||||
ResizeEnd += (sender, args) => {
|
||||
|
14
Core/Other/FormSettings.Designer.cs
generated
14
Core/Other/FormSettings.Designer.cs
generated
@@ -33,8 +33,8 @@
|
||||
//
|
||||
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnClose.AutoSize = true;
|
||||
this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnClose.Location = new System.Drawing.Point(448, 525);
|
||||
this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnClose.Location = new System.Drawing.Point(747, 500);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnClose.Size = new System.Drawing.Size(50, 25);
|
||||
@@ -53,7 +53,7 @@
|
||||
this.panelContents.Location = new System.Drawing.Point(135, 12);
|
||||
this.panelContents.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.panelContents.Name = "panelContents";
|
||||
this.panelContents.Size = new System.Drawing.Size(363, 507);
|
||||
this.panelContents.Size = new System.Drawing.Size(662, 482);
|
||||
this.panelContents.TabIndex = 1;
|
||||
//
|
||||
// panelButtons
|
||||
@@ -64,15 +64,15 @@
|
||||
this.panelButtons.Location = new System.Drawing.Point(12, 12);
|
||||
this.panelButtons.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
||||
this.panelButtons.Name = "panelButtons";
|
||||
this.panelButtons.Size = new System.Drawing.Size(124, 507);
|
||||
this.panelButtons.Size = new System.Drawing.Size(124, 482);
|
||||
this.panelButtons.TabIndex = 0;
|
||||
//
|
||||
// btnManageOptions
|
||||
//
|
||||
this.btnManageOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnManageOptions.AutoSize = true;
|
||||
this.btnManageOptions.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnManageOptions.Location = new System.Drawing.Point(12, 525);
|
||||
this.btnManageOptions.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnManageOptions.Location = new System.Drawing.Point(12, 500);
|
||||
this.btnManageOptions.Name = "btnManageOptions";
|
||||
this.btnManageOptions.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnManageOptions.Size = new System.Drawing.Size(109, 25);
|
||||
@@ -85,7 +85,7 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(510, 562);
|
||||
this.ClientSize = new System.Drawing.Size(809, 537);
|
||||
this.Controls.Add(this.btnManageOptions);
|
||||
this.Controls.Add(this.panelContents);
|
||||
this.Controls.Add(this.panelButtons);
|
||||
|
@@ -10,20 +10,20 @@ using TweetDuck.Core.Other.Settings;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Updates;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
|
||||
namespace TweetDuck.Core.Other{
|
||||
sealed partial class FormSettings : Form, FormManager.IAppDialog{
|
||||
public bool ShouldReloadBrowser { get; private set; }
|
||||
|
||||
private readonly FormBrowser browser;
|
||||
private readonly PluginManager plugins;
|
||||
|
||||
private readonly int buttonHeight;
|
||||
|
||||
private readonly Dictionary<Type, SettingsTab> tabs = new Dictionary<Type, SettingsTab>(4);
|
||||
private readonly Dictionary<Type, SettingsTab> tabs = new Dictionary<Type, SettingsTab>(8);
|
||||
private SettingsTab currentTab;
|
||||
|
||||
public bool ShouldReloadBrowser { get; private set; }
|
||||
|
||||
public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler updates, AnalyticsManager analytics, Type startTab){
|
||||
InitializeComponent();
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace TweetDuck.Core.Other{
|
||||
|
||||
this.buttonHeight = BrowserUtils.Scale(39, this.GetDPIScale()) | 1;
|
||||
|
||||
PrepareLoad();
|
||||
|
||||
AddButton("General", () => new TabSettingsGeneral(this.browser.ReloadColumns, updates));
|
||||
AddButton("Locales", () => new TabSettingsLocales());
|
||||
AddButton("System Tray", () => new TabSettingsTray());
|
||||
AddButton("Notifications", () => new TabSettingsNotifications(new FormNotificationExample(this.browser, this.plugins)));
|
||||
AddButton("Sounds", () => new TabSettingsSounds(this.browser.PlaySoundNotification));
|
||||
AddButton("Feedback", () => new TabSettingsFeedback(analytics, AnalyticsReportGenerator.ExternalInfo.From(this.browser), this.plugins));
|
||||
@@ -47,21 +47,37 @@ namespace TweetDuck.Core.Other{
|
||||
SelectTab(tabs[startTab ?? typeof(TabSettingsGeneral)]);
|
||||
}
|
||||
|
||||
private void FormSettings_FormClosing(object sender, FormClosingEventArgs e){
|
||||
private void PrepareLoad(){
|
||||
Program.Config.ProgramRestartRequested += Config_ProgramRestartRequested;
|
||||
}
|
||||
|
||||
private void PrepareUnload(){ // TODO refactor this further later
|
||||
currentTab.Control.OnClosing();
|
||||
|
||||
Program.Config.ProgramRestartRequested -= Config_ProgramRestartRequested;
|
||||
Program.Config.SaveAll();
|
||||
}
|
||||
|
||||
private void Config_ProgramRestartRequested(object sender, EventArgs e){
|
||||
if (FormMessage.Information("TweetDuck Options", "The application must restart for the option to take place. Do you want to restart now?", FormMessage.Yes, FormMessage.No)){
|
||||
Program.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
private void FormSettings_FormClosing(object sender, FormClosingEventArgs e){
|
||||
PrepareUnload();
|
||||
|
||||
foreach(SettingsTab tab in tabs.Values){
|
||||
if (tab.IsInitialized){
|
||||
tab.Control.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Program.UserConfig.Save();
|
||||
browser.ResumeNotification();
|
||||
}
|
||||
|
||||
private void btnManageOptions_Click(object sender, EventArgs e){
|
||||
currentTab.Control.OnClosing();
|
||||
PrepareUnload();
|
||||
|
||||
using(DialogSettingsManage dialog = new DialogSettingsManage(plugins)){
|
||||
FormClosing -= FormSettings_FormClosing;
|
||||
@@ -70,14 +86,17 @@ namespace TweetDuck.Core.Other{
|
||||
if (!dialog.IsRestarting){
|
||||
browser.ResumeNotification();
|
||||
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
ShouldReloadBrowser = dialog.ShouldReloadBrowser;
|
||||
if (dialog.ShouldReloadBrowser){
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
ShouldReloadBrowser = true;
|
||||
}
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
else{
|
||||
FormClosing += FormSettings_FormClosing;
|
||||
PrepareLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,6 +157,10 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
}
|
||||
|
||||
if (tab.Control.Height < panelContents.Height-2){
|
||||
tab.Control.Height = panelContents.Height-2; // fixes off-by-pixel error on high DPI
|
||||
}
|
||||
|
||||
tab.Control.OnReady();
|
||||
}
|
||||
|
||||
@@ -172,7 +195,7 @@ namespace TweetDuck.Core.Other{
|
||||
private sealed class SettingsTab{
|
||||
public Button Button { get; }
|
||||
|
||||
public BaseTabSettings Control => control ?? (control = constructor());
|
||||
public BaseTabSettings Control => control ??= constructor();
|
||||
public bool IsInitialized => control != null;
|
||||
|
||||
private readonly Func<BaseTabSettings> constructor;
|
||||
|
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core.Other.Interfaces{
|
||||
interface ITweetDeckBrowser{
|
||||
bool IsTweetDeckWebsite { get; }
|
||||
|
||||
void RegisterBridge(string name, object obj);
|
||||
void OnFrameLoaded(Action<IFrame> callback);
|
||||
void ExecuteFunction(string name, params object[] args);
|
||||
}
|
||||
}
|
@@ -4,7 +4,8 @@ using TweetDuck.Configuration;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
class BaseTabSettings : UserControl{
|
||||
protected static UserConfig Config => Program.UserConfig;
|
||||
protected static UserConfig Config => Program.Config.User;
|
||||
protected static SystemConfig SysConfig => Program.Config.System;
|
||||
|
||||
public IEnumerable<Control> InteractiveControls{
|
||||
get{
|
||||
@@ -31,11 +32,5 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
public virtual void OnReady(){}
|
||||
public virtual void OnClosing(){}
|
||||
|
||||
protected static void PromptRestart(){
|
||||
if (FormMessage.Information("TweetDuck Options", "The application must restart for the option to take place. Do you want to restart now?", FormMessage.Yes, FormMessage.No)){
|
||||
Program.Restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@
|
||||
this.textBoxReport.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxReport.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.textBoxReport.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular);
|
||||
this.textBoxReport.Location = new System.Drawing.Point(12, 45);
|
||||
this.textBoxReport.Multiline = true;
|
||||
this.textBoxReport.Name = "textBoxReport";
|
||||
@@ -46,7 +46,7 @@
|
||||
//
|
||||
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnClose.AutoSize = true;
|
||||
this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnClose.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnClose.Location = new System.Drawing.Point(397, 525);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -59,7 +59,7 @@
|
||||
// labelInfo
|
||||
//
|
||||
this.labelInfo.AutoSize = true;
|
||||
this.labelInfo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelInfo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelInfo.Location = new System.Drawing.Point(12, 9);
|
||||
this.labelInfo.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
||||
this.labelInfo.Name = "labelInfo";
|
||||
|
@@ -5,8 +5,6 @@ using TweetDuck.Core.Other.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsAnalytics : Form{
|
||||
public string CefArgs => textBoxReport.Text;
|
||||
|
||||
public DialogSettingsAnalytics(AnalyticsReport report){
|
||||
InitializeComponent();
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
// textBoxBrowserCSS
|
||||
//
|
||||
this.textBoxBrowserCSS.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxBrowserCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.textBoxBrowserCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular);
|
||||
this.textBoxBrowserCSS.Location = new System.Drawing.Point(3, 3);
|
||||
this.textBoxBrowserCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
|
||||
this.textBoxBrowserCSS.Multiline = true;
|
||||
@@ -84,7 +84,7 @@
|
||||
// textBoxNotificationCSS
|
||||
//
|
||||
this.textBoxNotificationCSS.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxNotificationCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.textBoxNotificationCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular);
|
||||
this.textBoxNotificationCSS.Location = new System.Drawing.Point(3, 3);
|
||||
this.textBoxNotificationCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
|
||||
this.textBoxNotificationCSS.Multiline = true;
|
||||
@@ -121,7 +121,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tabPanel.Controls.Add(this.tabPageBrowser);
|
||||
this.tabPanel.Controls.Add(this.tabPageNotification);
|
||||
this.tabPanel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.tabPanel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.tabPanel.Location = new System.Drawing.Point(12, 12);
|
||||
this.tabPanel.Name = "tabPanel";
|
||||
this.tabPanel.SelectedIndex = 0;
|
||||
|
@@ -13,7 +13,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
private readonly Action<string> reinjectBrowserCSS;
|
||||
private readonly Action openDevTools;
|
||||
|
||||
public DialogSettingsCSS(Action<string> reinjectBrowserCSS, Action openDevTools){
|
||||
public DialogSettingsCSS(string browserCSS, string notificationCSS, Action<string> reinjectBrowserCSS, Action openDevTools){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options - CSS";
|
||||
@@ -22,10 +22,10 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
this.openDevTools = openDevTools;
|
||||
|
||||
textBoxBrowserCSS.EnableMultilineShortcuts();
|
||||
textBoxBrowserCSS.Text = Program.UserConfig.CustomBrowserCSS ?? "";
|
||||
textBoxBrowserCSS.Text = browserCSS ?? "";
|
||||
|
||||
textBoxNotificationCSS.EnableMultilineShortcuts();
|
||||
textBoxNotificationCSS.Text = Program.UserConfig.CustomNotificationCSS ?? "";
|
||||
textBoxNotificationCSS.Text = notificationCSS ?? "";
|
||||
|
||||
if (!BrowserUtils.HasDevTools){
|
||||
btnOpenDevTools.Enabled = false;
|
||||
|
@@ -35,7 +35,7 @@
|
||||
this.textBoxArgs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxArgs.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.textBoxArgs.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular);
|
||||
this.textBoxArgs.Location = new System.Drawing.Point(12, 30);
|
||||
this.textBoxArgs.Multiline = true;
|
||||
this.textBoxArgs.Name = "textBoxArgs";
|
||||
@@ -46,7 +46,7 @@
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnCancel.Location = new System.Drawing.Point(377, 225);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -60,7 +60,7 @@
|
||||
//
|
||||
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnApply.AutoSize = true;
|
||||
this.btnApply.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnApply.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnApply.Location = new System.Drawing.Point(440, 225);
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -74,7 +74,7 @@
|
||||
//
|
||||
this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnHelp.AutoSize = true;
|
||||
this.btnHelp.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnHelp.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnHelp.Location = new System.Drawing.Point(12, 225);
|
||||
this.btnHelp.Name = "btnHelp";
|
||||
this.btnHelp.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -87,7 +87,7 @@
|
||||
// labelWarning
|
||||
//
|
||||
this.labelWarning.AutoSize = true;
|
||||
this.labelWarning.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelWarning.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelWarning.Location = new System.Drawing.Point(12, 9);
|
||||
this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
||||
this.labelWarning.Name = "labelWarning";
|
||||
|
@@ -2,19 +2,21 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Collections;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsCefArgs : Form{
|
||||
public string CefArgs => textBoxArgs.Text;
|
||||
|
||||
public DialogSettingsCefArgs(){
|
||||
private readonly string initialArgs;
|
||||
|
||||
public DialogSettingsCefArgs(string args){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Options - CEF Arguments";
|
||||
|
||||
textBoxArgs.EnableMultilineShortcuts();
|
||||
textBoxArgs.Text = Program.UserConfig.CustomCefArgs ?? "";
|
||||
textBoxArgs.Text = initialArgs = args ?? "";
|
||||
textBoxArgs.Select(textBoxArgs.Text.Length, 0);
|
||||
}
|
||||
|
||||
@@ -23,16 +25,14 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
}
|
||||
|
||||
private void btnApply_Click(object sender, EventArgs e){
|
||||
string prevArgs = Program.UserConfig.CustomCefArgs;
|
||||
|
||||
if (CefArgs == prevArgs){
|
||||
if (CefArgs == initialArgs){
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
int count = CommandLineArgs.ReadCefArguments(CefArgs).Count;
|
||||
string prompt = count == 0 && !string.IsNullOrWhiteSpace(prevArgs) ? "All current arguments will be removed. Continue?" : count+(count == 1 ? " argument was" : " arguments were")+" detected. Continue?";
|
||||
string prompt = count == 0 && !string.IsNullOrWhiteSpace(initialArgs) ? "All current arguments will be removed. Continue?" : count+(count == 1 ? " argument was" : " arguments were")+" detected. Continue?";
|
||||
|
||||
if (FormMessage.Question("Confirm CEF Arguments", prompt, FormMessage.OK, FormMessage.Cancel)){
|
||||
DialogResult = DialogResult.OK;
|
||||
|
@@ -44,7 +44,7 @@
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnCancel.Location = new System.Drawing.Point(165, 92);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -59,7 +59,7 @@
|
||||
this.btnContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnContinue.AutoSize = true;
|
||||
this.btnContinue.Enabled = false;
|
||||
this.btnContinue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnContinue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnContinue.Location = new System.Drawing.Point(114, 92);
|
||||
this.btnContinue.Name = "btnContinue";
|
||||
this.btnContinue.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -72,7 +72,7 @@
|
||||
// cbProgramConfig
|
||||
//
|
||||
this.cbProgramConfig.AutoSize = true;
|
||||
this.cbProgramConfig.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.cbProgramConfig.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.cbProgramConfig.Location = new System.Drawing.Point(3, 3);
|
||||
this.cbProgramConfig.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.cbProgramConfig.Name = "cbProgramConfig";
|
||||
@@ -86,7 +86,7 @@
|
||||
// cbSession
|
||||
//
|
||||
this.cbSession.AutoSize = true;
|
||||
this.cbSession.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.cbSession.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.cbSession.Location = new System.Drawing.Point(3, 51);
|
||||
this.cbSession.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.cbSession.Name = "cbSession";
|
||||
@@ -100,7 +100,7 @@
|
||||
// cbPluginData
|
||||
//
|
||||
this.cbPluginData.AutoSize = true;
|
||||
this.cbPluginData.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.cbPluginData.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.cbPluginData.Location = new System.Drawing.Point(3, 75);
|
||||
this.cbPluginData.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.cbPluginData.Name = "cbPluginData";
|
||||
@@ -114,7 +114,7 @@
|
||||
// cbSystemConfig
|
||||
//
|
||||
this.cbSystemConfig.AutoSize = true;
|
||||
this.cbSystemConfig.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.cbSystemConfig.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.cbSystemConfig.Location = new System.Drawing.Point(3, 27);
|
||||
this.cbSystemConfig.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.cbSystemConfig.Name = "cbSystemConfig";
|
||||
@@ -158,7 +158,7 @@
|
||||
// radioImport
|
||||
//
|
||||
this.radioImport.AutoSize = true;
|
||||
this.radioImport.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioImport.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.radioImport.Location = new System.Drawing.Point(3, 3);
|
||||
this.radioImport.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.radioImport.Name = "radioImport";
|
||||
@@ -172,7 +172,7 @@
|
||||
// radioExport
|
||||
//
|
||||
this.radioExport.AutoSize = true;
|
||||
this.radioExport.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioExport.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.radioExport.Location = new System.Drawing.Point(3, 27);
|
||||
this.radioExport.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.radioExport.Name = "radioExport";
|
||||
@@ -186,7 +186,7 @@
|
||||
// radioReset
|
||||
//
|
||||
this.radioReset.AutoSize = true;
|
||||
this.radioReset.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioReset.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.radioReset.Location = new System.Drawing.Point(3, 51);
|
||||
this.radioReset.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.radioReset.Name = "radioReset";
|
||||
|
@@ -5,6 +5,7 @@ using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsManage : Form{
|
||||
@@ -23,14 +24,20 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
}
|
||||
}
|
||||
|
||||
private bool SelectedItemsForceRestart{
|
||||
get => _selectedItems.HasFlag(ProfileManager.Items.Session);
|
||||
}
|
||||
|
||||
public bool IsRestarting { get; private set; }
|
||||
public bool ShouldReloadBrowser { get; private set; }
|
||||
|
||||
private readonly PluginManager plugins;
|
||||
private readonly Dictionary<CheckBox, ProfileManager.Items> checkBoxMap = new Dictionary<CheckBox, ProfileManager.Items>(4);
|
||||
private readonly bool openImportImmediately;
|
||||
|
||||
private State currentState;
|
||||
private ProfileManager importManager;
|
||||
private bool requestedRestartFromConfig;
|
||||
|
||||
private ProfileManager.Items _selectedItems = ProfileManager.Items.None;
|
||||
|
||||
@@ -45,6 +52,8 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
this.checkBoxMap[cbSession] = ProfileManager.Items.Session;
|
||||
this.checkBoxMap[cbPluginData] = ProfileManager.Items.PluginData;
|
||||
|
||||
this.openImportImmediately = openImportImmediately;
|
||||
|
||||
if (openImportImmediately){
|
||||
radioImport.Checked = true;
|
||||
btnContinue_Click(null, EventArgs.Empty);
|
||||
@@ -82,6 +91,10 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
Filter = "TweetDuck Profile (*.tdsettings)|*.tdsettings"
|
||||
}){
|
||||
if (dialog.ShowDialog() != DialogResult.OK){
|
||||
if (openImportImmediately){
|
||||
Close();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,37 +129,39 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
case State.Reset:
|
||||
if (FormMessage.Warning("Reset TweetDuck Options", "This will reset the selected items. Are you sure you want to proceed?", FormMessage.Yes, FormMessage.No)){
|
||||
Program.Config.ProgramRestartRequested += Config_ProgramRestartRequested;
|
||||
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.UserConfig)){
|
||||
Program.UserConfig.Reset();
|
||||
Program.Config.User.Reset();
|
||||
}
|
||||
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||
try{
|
||||
File.Delete(Program.SystemConfigFilePath);
|
||||
}catch(Exception ex){
|
||||
Program.Reporter.HandleException("System Config Reset Error", "Could not delete system config.", true, ex);
|
||||
}
|
||||
Program.Config.System.Reset();
|
||||
}
|
||||
|
||||
Program.Config.ProgramRestartRequested -= Config_ProgramRestartRequested;
|
||||
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.PluginData)){
|
||||
Program.Config.Plugins.Reset();
|
||||
|
||||
try{
|
||||
File.Delete(Program.PluginConfigFilePath);
|
||||
Directory.Delete(Program.PluginDataPath, true);
|
||||
}catch(Exception ex){
|
||||
Program.Reporter.HandleException("Plugin Data Reset Error", "Could not delete plugin data.", true, ex);
|
||||
Program.Reporter.HandleException("Profile Reset", "Could not delete plugin data.", true, ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
|
||||
RestartProgram(Arguments.ArgDeleteCookies);
|
||||
if (SelectedItemsForceRestart){
|
||||
RestartProgram(SelectedItems.HasFlag(ProfileManager.Items.Session) ? new string[]{ Arguments.ArgDeleteCookies } : StringUtils.EmptyArray);
|
||||
}
|
||||
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||
RestartProgram();
|
||||
}
|
||||
else{
|
||||
ShouldReloadBrowser = true;
|
||||
else if (requestedRestartFromConfig){
|
||||
if (FormMessage.Information("Profile Reset", "The application must restart for some of the restored options to take place. Do you want to restart now?", FormMessage.Yes, FormMessage.No)){
|
||||
RestartProgram();
|
||||
}
|
||||
}
|
||||
|
||||
ShouldReloadBrowser = true;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
@@ -155,21 +170,22 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
case State.Import:
|
||||
if (importManager.Import(SelectedItems)){
|
||||
Program.UserConfig.Reload();
|
||||
Program.Config.ProgramRestartRequested += Config_ProgramRestartRequested;
|
||||
Program.Config.ReloadAll();
|
||||
Program.Config.ProgramRestartRequested -= Config_ProgramRestartRequested;
|
||||
|
||||
if (importManager.IsRestarting){
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
|
||||
RestartProgram(Arguments.ArgImportCookies);
|
||||
}
|
||||
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||
if (SelectedItemsForceRestart){
|
||||
RestartProgram(SelectedItems.HasFlag(ProfileManager.Items.Session) ? new string[]{ Arguments.ArgImportCookies } : StringUtils.EmptyArray);
|
||||
}
|
||||
else if (requestedRestartFromConfig){
|
||||
if (FormMessage.Information("Profile Import", "The application must restart for some of the imported options to take place. Do you want to restart now?", FormMessage.Yes, FormMessage.No)){
|
||||
RestartProgram();
|
||||
}
|
||||
}
|
||||
else{
|
||||
ShouldReloadBrowser = true;
|
||||
}
|
||||
}
|
||||
|
||||
ShouldReloadBrowser = true;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
break;
|
||||
@@ -191,9 +207,6 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
file = dialog.FileName;
|
||||
}
|
||||
|
||||
Program.UserConfig.Save();
|
||||
Program.SystemConfig.Save();
|
||||
|
||||
new ProfileManager(file, plugins).Export(SelectedItems);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
@@ -207,15 +220,19 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Config_ProgramRestartRequested(object sender, EventArgs e){
|
||||
requestedRestartFromConfig = true;
|
||||
}
|
||||
|
||||
private void SetFlag(ProfileManager.Items flag, bool enable){
|
||||
_selectedItems = enable ? _selectedItems | flag : _selectedItems & ~flag;
|
||||
btnContinue.Enabled = _selectedItems != ProfileManager.Items.None;
|
||||
|
||||
if (currentState == State.Import){
|
||||
btnContinue.Text = _selectedItems.NeedsRestart() ? "Import && Restart" : "Import Profile";
|
||||
btnContinue.Text = SelectedItemsForceRestart ? "Import && Restart" : "Import Profile";
|
||||
}
|
||||
else if (currentState == State.Reset){
|
||||
btnContinue.Text = _selectedItems.NeedsRestart() ? "Restore && Restart" : "Restore Defaults";
|
||||
btnContinue.Text = SelectedItemsForceRestart ? "Restore && Restart" : "Restore Defaults";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnCancel.Location = new System.Drawing.Point(215, 146);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -54,7 +54,7 @@
|
||||
//
|
||||
this.btnRestart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnRestart.AutoSize = true;
|
||||
this.btnRestart.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnRestart.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnRestart.Location = new System.Drawing.Point(152, 146);
|
||||
this.btnRestart.Name = "btnRestart";
|
||||
this.btnRestart.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -67,7 +67,7 @@
|
||||
// cbLogging
|
||||
//
|
||||
this.cbLogging.AutoSize = true;
|
||||
this.cbLogging.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.cbLogging.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.cbLogging.Location = new System.Drawing.Point(3, 3);
|
||||
this.cbLogging.Margin = new System.Windows.Forms.Padding(3, 3, 3, 2);
|
||||
this.cbLogging.Name = "cbLogging";
|
||||
@@ -79,7 +79,7 @@
|
||||
//
|
||||
// tbDataFolder
|
||||
//
|
||||
this.tbDataFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.tbDataFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.tbDataFolder.Location = new System.Drawing.Point(3, 54);
|
||||
this.tbDataFolder.Name = "tbDataFolder";
|
||||
this.tbDataFolder.Size = new System.Drawing.Size(260, 23);
|
||||
@@ -92,7 +92,7 @@
|
||||
this.tbShortcutTarget.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbShortcutTarget.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.tbShortcutTarget.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.tbShortcutTarget.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.tbShortcutTarget.Location = new System.Drawing.Point(3, 110);
|
||||
this.tbShortcutTarget.Name = "tbShortcutTarget";
|
||||
this.tbShortcutTarget.ReadOnly = true;
|
||||
@@ -103,7 +103,7 @@
|
||||
// labelDataFolder
|
||||
//
|
||||
this.labelDataFolder.AutoSize = true;
|
||||
this.labelDataFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDataFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelDataFolder.Location = new System.Drawing.Point(3, 36);
|
||||
this.labelDataFolder.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelDataFolder.Name = "labelDataFolder";
|
||||
@@ -114,7 +114,7 @@
|
||||
// labelShortcutTarget
|
||||
//
|
||||
this.labelShortcutTarget.AutoSize = true;
|
||||
this.labelShortcutTarget.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelShortcutTarget.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelShortcutTarget.Location = new System.Drawing.Point(3, 92);
|
||||
this.labelShortcutTarget.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelShortcutTarget.Name = "labelShortcutTarget";
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Collections;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
sealed partial class DialogSettingsRestart : Form{
|
||||
@@ -18,7 +18,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
tbDataFolder.Enabled = false;
|
||||
}
|
||||
else{
|
||||
tbDataFolder.Text = currentArgs.GetValue(Arguments.ArgDataFolder, string.Empty);
|
||||
tbDataFolder.Text = currentArgs.GetValue(Arguments.ArgDataFolder) ?? string.Empty;
|
||||
tbDataFolder.TextChanged += control_Change;
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
this.textBoxUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxUrl.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.textBoxUrl.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.textBoxUrl.Location = new System.Drawing.Point(12, 30);
|
||||
this.textBoxUrl.Name = "textBoxUrl";
|
||||
this.textBoxUrl.Size = new System.Drawing.Size(310, 23);
|
||||
@@ -44,7 +44,7 @@
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnCancel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnCancel.Location = new System.Drawing.Point(207, 59);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -58,7 +58,7 @@
|
||||
//
|
||||
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnApply.AutoSize = true;
|
||||
this.btnApply.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnApply.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnApply.Location = new System.Drawing.Point(270, 59);
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -71,7 +71,7 @@
|
||||
// labelInfo
|
||||
//
|
||||
this.labelInfo.AutoSize = true;
|
||||
this.labelInfo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelInfo.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelInfo.Location = new System.Drawing.Point(12, 9);
|
||||
this.labelInfo.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
||||
this.labelInfo.Name = "labelInfo";
|
||||
|
@@ -10,7 +10,7 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
Text = Program.BrandName+" Options - Custom Search Engine";
|
||||
|
||||
textBoxUrl.Text = Program.UserConfig.SearchEngineUrl ?? "";
|
||||
textBoxUrl.Text = Program.Config.User.SearchEngineUrl ?? "";
|
||||
textBoxUrl.Select(textBoxUrl.Text.Length, 0);
|
||||
}
|
||||
|
||||
|
155
Core/Other/Settings/TabSettingsAdvanced.Designer.cs
generated
155
Core/Other/Settings/TabSettingsAdvanced.Designer.cs
generated
@@ -25,7 +25,6 @@
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.btnClearCache = new System.Windows.Forms.Button();
|
||||
this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.btnEditCefArgs = new System.Windows.Forms.Button();
|
||||
this.btnEditCSS = new System.Windows.Forms.Button();
|
||||
@@ -37,9 +36,8 @@
|
||||
this.checkClearCacheAuto = new System.Windows.Forms.CheckBox();
|
||||
this.labelApp = new System.Windows.Forms.Label();
|
||||
this.panelAppButtons = new System.Windows.Forms.Panel();
|
||||
this.labelPerformance = new System.Windows.Forms.Label();
|
||||
this.panelClearCacheAuto = new System.Windows.Forms.Panel();
|
||||
this.labelCache = new System.Windows.Forms.Label();
|
||||
this.panelClearCacheAuto = new System.Windows.Forms.Panel();
|
||||
this.panelConfiguration = new System.Windows.Forms.Panel();
|
||||
this.labelConfiguration = new System.Windows.Forms.Label();
|
||||
this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
@@ -52,99 +50,87 @@
|
||||
//
|
||||
// btnClearCache
|
||||
//
|
||||
this.btnClearCache.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnClearCache.Location = new System.Drawing.Point(5, 179);
|
||||
this.btnClearCache.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnClearCache.Location = new System.Drawing.Point(5, 135);
|
||||
this.btnClearCache.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnClearCache.Name = "btnClearCache";
|
||||
this.btnClearCache.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnClearCache.TabIndex = 5;
|
||||
this.btnClearCache.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnClearCache.TabIndex = 3;
|
||||
this.btnClearCache.Text = "Clear Cache (...)";
|
||||
this.btnClearCache.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkHardwareAcceleration
|
||||
//
|
||||
this.checkHardwareAcceleration.AutoSize = true;
|
||||
this.checkHardwareAcceleration.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 128);
|
||||
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
|
||||
this.checkHardwareAcceleration.Size = new System.Drawing.Size(146, 19);
|
||||
this.checkHardwareAcceleration.TabIndex = 3;
|
||||
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
|
||||
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnEditCefArgs
|
||||
//
|
||||
this.btnEditCefArgs.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnEditCefArgs.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnEditCefArgs.Location = new System.Drawing.Point(5, 3);
|
||||
this.btnEditCefArgs.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnEditCefArgs.Name = "btnEditCefArgs";
|
||||
this.btnEditCefArgs.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnEditCefArgs.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnEditCefArgs.TabIndex = 0;
|
||||
this.btnEditCefArgs.Text = "Edit CEF Arguments";
|
||||
this.btnEditCefArgs.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnEditCSS
|
||||
//
|
||||
this.btnEditCSS.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnEditCSS.Location = new System.Drawing.Point(155, 3);
|
||||
this.btnEditCSS.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnEditCSS.Location = new System.Drawing.Point(154, 3);
|
||||
this.btnEditCSS.Name = "btnEditCSS";
|
||||
this.btnEditCSS.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnEditCSS.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnEditCSS.TabIndex = 1;
|
||||
this.btnEditCSS.Text = "Edit CSS";
|
||||
this.btnEditCSS.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnRestartArgs
|
||||
//
|
||||
this.btnRestartArgs.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnRestartArgs.Location = new System.Drawing.Point(155, 32);
|
||||
this.btnRestartArgs.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnRestartArgs.Location = new System.Drawing.Point(154, 32);
|
||||
this.btnRestartArgs.Name = "btnRestartArgs";
|
||||
this.btnRestartArgs.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnRestartArgs.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnRestartArgs.TabIndex = 3;
|
||||
this.btnRestartArgs.Text = "Restart with Arguments";
|
||||
this.btnRestartArgs.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnRestart
|
||||
//
|
||||
this.btnRestart.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnRestart.Location = new System.Drawing.Point(155, 3);
|
||||
this.btnRestart.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnRestart.Location = new System.Drawing.Point(154, 3);
|
||||
this.btnRestart.Name = "btnRestart";
|
||||
this.btnRestart.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnRestart.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnRestart.TabIndex = 2;
|
||||
this.btnRestart.Text = "Restart the Program";
|
||||
this.btnRestart.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnOpenAppFolder
|
||||
//
|
||||
this.btnOpenAppFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnOpenAppFolder.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnOpenAppFolder.Location = new System.Drawing.Point(5, 3);
|
||||
this.btnOpenAppFolder.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnOpenAppFolder.Name = "btnOpenAppFolder";
|
||||
this.btnOpenAppFolder.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnOpenAppFolder.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnOpenAppFolder.TabIndex = 0;
|
||||
this.btnOpenAppFolder.Text = "Open Program Folder";
|
||||
this.btnOpenAppFolder.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnOpenDataFolder
|
||||
//
|
||||
this.btnOpenDataFolder.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnOpenDataFolder.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnOpenDataFolder.Location = new System.Drawing.Point(5, 32);
|
||||
this.btnOpenDataFolder.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnOpenDataFolder.Name = "btnOpenDataFolder";
|
||||
this.btnOpenDataFolder.Size = new System.Drawing.Size(144, 25);
|
||||
this.btnOpenDataFolder.Size = new System.Drawing.Size(143, 25);
|
||||
this.btnOpenDataFolder.TabIndex = 1;
|
||||
this.btnOpenDataFolder.Text = "Open Data Folder";
|
||||
this.btnOpenDataFolder.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numClearCacheThreshold
|
||||
//
|
||||
this.numClearCacheThreshold.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.numClearCacheThreshold.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.numClearCacheThreshold.Increment = new decimal(new int[] {
|
||||
50,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numClearCacheThreshold.Location = new System.Drawing.Point(246, 5);
|
||||
this.numClearCacheThreshold.Location = new System.Drawing.Point(210, 5);
|
||||
this.numClearCacheThreshold.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
@@ -156,7 +142,7 @@
|
||||
0,
|
||||
0});
|
||||
this.numClearCacheThreshold.Name = "numClearCacheThreshold";
|
||||
this.numClearCacheThreshold.Size = new System.Drawing.Size(68, 23);
|
||||
this.numClearCacheThreshold.Size = new System.Drawing.Size(89, 23);
|
||||
this.numClearCacheThreshold.TabIndex = 1;
|
||||
this.numClearCacheThreshold.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.numClearCacheThreshold.TextSuffix = " MB";
|
||||
@@ -169,29 +155,28 @@
|
||||
// checkClearCacheAuto
|
||||
//
|
||||
this.checkClearCacheAuto.AutoSize = true;
|
||||
this.checkClearCacheAuto.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkClearCacheAuto.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkClearCacheAuto.Location = new System.Drawing.Point(6, 6);
|
||||
this.checkClearCacheAuto.Margin = new System.Windows.Forms.Padding(6, 6, 0, 2);
|
||||
this.checkClearCacheAuto.Name = "checkClearCacheAuto";
|
||||
this.checkClearCacheAuto.Size = new System.Drawing.Size(237, 19);
|
||||
this.checkClearCacheAuto.Size = new System.Drawing.Size(201, 19);
|
||||
this.checkClearCacheAuto.TabIndex = 0;
|
||||
this.checkClearCacheAuto.Text = "Clear Cache Automatically When Above";
|
||||
this.checkClearCacheAuto.Text = "Clear Automatically When Above";
|
||||
this.checkClearCacheAuto.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelApp
|
||||
//
|
||||
this.labelApp.AutoSize = true;
|
||||
this.labelApp.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelApp.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelApp.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelApp.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelApp.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelApp.Name = "labelApp";
|
||||
this.labelApp.Size = new System.Drawing.Size(37, 20);
|
||||
this.labelApp.Size = new System.Drawing.Size(97, 19);
|
||||
this.labelApp.TabIndex = 0;
|
||||
this.labelApp.Text = "App";
|
||||
this.labelApp.Text = "APPLICATION";
|
||||
//
|
||||
// panelAppButtons
|
||||
//
|
||||
this.panelAppButtons.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelAppButtons.Controls.Add(this.btnOpenDataFolder);
|
||||
this.panelAppButtons.Controls.Add(this.btnOpenAppFolder);
|
||||
this.panelAppButtons.Controls.Add(this.btnRestart);
|
||||
@@ -199,73 +184,57 @@
|
||||
this.panelAppButtons.Location = new System.Drawing.Point(0, 20);
|
||||
this.panelAppButtons.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelAppButtons.Name = "panelAppButtons";
|
||||
this.panelAppButtons.Size = new System.Drawing.Size(322, 62);
|
||||
this.panelAppButtons.Size = new System.Drawing.Size(300, 62);
|
||||
this.panelAppButtons.TabIndex = 1;
|
||||
//
|
||||
// labelPerformance
|
||||
//
|
||||
this.labelPerformance.AutoSize = true;
|
||||
this.labelPerformance.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelPerformance.Location = new System.Drawing.Point(0, 102);
|
||||
this.labelPerformance.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelPerformance.Name = "labelPerformance";
|
||||
this.labelPerformance.Size = new System.Drawing.Size(93, 20);
|
||||
this.labelPerformance.TabIndex = 2;
|
||||
this.labelPerformance.Text = "Performance";
|
||||
//
|
||||
// panelClearCacheAuto
|
||||
//
|
||||
this.panelClearCacheAuto.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelClearCacheAuto.Controls.Add(this.checkClearCacheAuto);
|
||||
this.panelClearCacheAuto.Controls.Add(this.numClearCacheThreshold);
|
||||
this.panelClearCacheAuto.Location = new System.Drawing.Point(0, 207);
|
||||
this.panelClearCacheAuto.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelClearCacheAuto.Name = "panelClearCacheAuto";
|
||||
this.panelClearCacheAuto.Size = new System.Drawing.Size(322, 28);
|
||||
this.panelClearCacheAuto.TabIndex = 6;
|
||||
//
|
||||
// labelCache
|
||||
//
|
||||
this.labelCache.AutoSize = true;
|
||||
this.labelCache.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelCache.Location = new System.Drawing.Point(3, 161);
|
||||
this.labelCache.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelCache.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelCache.Location = new System.Drawing.Point(0, 112);
|
||||
this.labelCache.Margin = new System.Windows.Forms.Padding(0, 30, 0, 1);
|
||||
this.labelCache.Name = "labelCache";
|
||||
this.labelCache.Size = new System.Drawing.Size(40, 15);
|
||||
this.labelCache.TabIndex = 4;
|
||||
this.labelCache.Text = "Cache";
|
||||
this.labelCache.Size = new System.Drawing.Size(123, 19);
|
||||
this.labelCache.TabIndex = 2;
|
||||
this.labelCache.Text = "BROWSER CACHE";
|
||||
//
|
||||
// panelClearCacheAuto
|
||||
//
|
||||
this.panelClearCacheAuto.Controls.Add(this.checkClearCacheAuto);
|
||||
this.panelClearCacheAuto.Controls.Add(this.numClearCacheThreshold);
|
||||
this.panelClearCacheAuto.Location = new System.Drawing.Point(0, 163);
|
||||
this.panelClearCacheAuto.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelClearCacheAuto.Name = "panelClearCacheAuto";
|
||||
this.panelClearCacheAuto.Size = new System.Drawing.Size(300, 28);
|
||||
this.panelClearCacheAuto.TabIndex = 4;
|
||||
//
|
||||
// panelConfiguration
|
||||
//
|
||||
this.panelConfiguration.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelConfiguration.Controls.Add(this.btnEditCSS);
|
||||
this.panelConfiguration.Controls.Add(this.btnEditCefArgs);
|
||||
this.panelConfiguration.Location = new System.Drawing.Point(0, 275);
|
||||
this.panelConfiguration.Location = new System.Drawing.Point(0, 241);
|
||||
this.panelConfiguration.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelConfiguration.Name = "panelConfiguration";
|
||||
this.panelConfiguration.Size = new System.Drawing.Size(322, 31);
|
||||
this.panelConfiguration.TabIndex = 8;
|
||||
this.panelConfiguration.Size = new System.Drawing.Size(300, 31);
|
||||
this.panelConfiguration.TabIndex = 6;
|
||||
//
|
||||
// labelConfiguration
|
||||
//
|
||||
this.labelConfiguration.AutoSize = true;
|
||||
this.labelConfiguration.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelConfiguration.Location = new System.Drawing.Point(0, 255);
|
||||
this.labelConfiguration.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelConfiguration.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelConfiguration.Location = new System.Drawing.Point(0, 221);
|
||||
this.labelConfiguration.Margin = new System.Windows.Forms.Padding(0, 30, 0, 1);
|
||||
this.labelConfiguration.Name = "labelConfiguration";
|
||||
this.labelConfiguration.Size = new System.Drawing.Size(100, 20);
|
||||
this.labelConfiguration.TabIndex = 7;
|
||||
this.labelConfiguration.Text = "Configuration";
|
||||
this.labelConfiguration.Size = new System.Drawing.Size(123, 19);
|
||||
this.labelConfiguration.TabIndex = 5;
|
||||
this.labelConfiguration.Text = "CONFIGURATION";
|
||||
//
|
||||
// flowPanel
|
||||
//
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanel.Controls.Add(this.labelApp);
|
||||
this.flowPanel.Controls.Add(this.panelAppButtons);
|
||||
this.flowPanel.Controls.Add(this.labelPerformance);
|
||||
this.flowPanel.Controls.Add(this.checkHardwareAcceleration);
|
||||
this.flowPanel.Controls.Add(this.labelCache);
|
||||
this.flowPanel.Controls.Add(this.btnClearCache);
|
||||
this.flowPanel.Controls.Add(this.panelClearCacheAuto);
|
||||
@@ -274,7 +243,7 @@
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 307);
|
||||
this.flowPanel.Size = new System.Drawing.Size(300, 462);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
//
|
||||
@@ -284,7 +253,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Name = "TabSettingsAdvanced";
|
||||
this.Size = new System.Drawing.Size(340, 325);
|
||||
this.Size = new System.Drawing.Size(631, 480);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numClearCacheThreshold)).EndInit();
|
||||
this.panelAppButtons.ResumeLayout(false);
|
||||
this.panelClearCacheAuto.ResumeLayout(false);
|
||||
@@ -299,7 +268,6 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnClearCache;
|
||||
private System.Windows.Forms.CheckBox checkHardwareAcceleration;
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.Button btnEditCefArgs;
|
||||
private System.Windows.Forms.Button btnEditCSS;
|
||||
@@ -309,11 +277,10 @@
|
||||
private System.Windows.Forms.Button btnOpenDataFolder;
|
||||
private System.Windows.Forms.Label labelApp;
|
||||
private System.Windows.Forms.Panel panelAppButtons;
|
||||
private System.Windows.Forms.Label labelPerformance;
|
||||
private System.Windows.Forms.Label labelCache;
|
||||
private System.Windows.Forms.Panel panelClearCacheAuto;
|
||||
private System.Windows.Forms.Panel panelConfiguration;
|
||||
private System.Windows.Forms.Label labelConfiguration;
|
||||
private System.Windows.Forms.Label labelCache;
|
||||
private Controls.NumericUpDownEx numClearCacheThreshold;
|
||||
private System.Windows.Forms.CheckBox checkClearCacheAuto;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanel;
|
||||
|
@@ -10,8 +10,6 @@ using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsAdvanced : BaseTabSettings{
|
||||
private static SystemConfig SysConfig => Program.SystemConfig;
|
||||
|
||||
private readonly Action<string> reinjectBrowserCSS;
|
||||
private readonly Action openDevTools;
|
||||
|
||||
@@ -21,21 +19,18 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
||||
this.openDevTools = openDevTools;
|
||||
|
||||
// application
|
||||
|
||||
toolTip.SetToolTip(btnOpenAppFolder, "Opens the folder where the app is located.");
|
||||
toolTip.SetToolTip(btnOpenDataFolder, "Opens the folder where your profile data is located.");
|
||||
toolTip.SetToolTip(btnRestart, "Restarts the program using the same command\r\nline arguments that were used at launch.");
|
||||
toolTip.SetToolTip(btnRestartArgs, "Restarts the program with customizable\r\ncommand line arguments.");
|
||||
|
||||
toolTip.SetToolTip(checkHardwareAcceleration, "Uses graphics card to improve performance. Disable if you experience visual glitches, or to save a small amount of RAM.");
|
||||
// browser cache
|
||||
|
||||
toolTip.SetToolTip(btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources.");
|
||||
toolTip.SetToolTip(checkClearCacheAuto, "Automatically clears cache when its size exceeds the set threshold. Note that cache can only be cleared when closing TweetDuck.");
|
||||
|
||||
toolTip.SetToolTip(btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
|
||||
toolTip.SetToolTip(btnEditCSS, "Set custom CSS for browser and notification windows.");
|
||||
|
||||
checkHardwareAcceleration.Checked = SysConfig.HardwareAcceleration;
|
||||
|
||||
checkClearCacheAuto.Checked = SysConfig.ClearCacheAutomatically;
|
||||
numClearCacheThreshold.Enabled = checkClearCacheAuto.Checked;
|
||||
numClearCacheThreshold.SetValueSafe(SysConfig.ClearCacheThreshold);
|
||||
@@ -44,6 +39,11 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
string text = task.Status == TaskStatus.RanToCompletion ? (int)Math.Ceiling(task.Result/(1024.0*1024.0))+" MB" : "unknown";
|
||||
this.InvokeSafe(() => btnClearCache.Text = $"Clear Cache ({text})");
|
||||
});
|
||||
|
||||
// configuration
|
||||
|
||||
toolTip.SetToolTip(btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
|
||||
toolTip.SetToolTip(btnEditCSS, "Set custom CSS for browser and notification windows.");
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
@@ -52,8 +52,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
btnRestart.Click += btnRestart_Click;
|
||||
btnRestartArgs.Click += btnRestartArgs_Click;
|
||||
|
||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
||||
|
||||
btnClearCache.Click += btnClearCache_Click;
|
||||
checkClearCacheAuto.CheckedChanged += checkClearCacheAuto_CheckedChanged;
|
||||
|
||||
@@ -64,68 +62,9 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
public override void OnClosing(){
|
||||
SysConfig.ClearCacheAutomatically = checkClearCacheAuto.Checked;
|
||||
SysConfig.ClearCacheThreshold = (int)numClearCacheThreshold.Value;
|
||||
SysConfig.Save();
|
||||
}
|
||||
|
||||
private void btnClearCache_Click(object sender, EventArgs e){
|
||||
btnClearCache.Enabled = false;
|
||||
BrowserCache.SetClearOnExit();
|
||||
FormMessage.Information("Clear Cache", "Cache will be automatically cleared when TweetDuck exits.", FormMessage.OK);
|
||||
}
|
||||
|
||||
private void checkClearCacheAuto_CheckedChanged(object sender, EventArgs e){
|
||||
numClearCacheThreshold.Enabled = checkClearCacheAuto.Checked;
|
||||
}
|
||||
|
||||
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
||||
SysConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||
PromptRestart(); // calls OnClosing
|
||||
}
|
||||
|
||||
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
||||
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
||||
|
||||
form.VisibleChanged += (sender2, args2) => {
|
||||
form.MoveToCenter(ParentForm);
|
||||
};
|
||||
|
||||
form.FormClosed += (sender2, args2) => {
|
||||
RestoreParentForm();
|
||||
|
||||
if (form.DialogResult == DialogResult.OK){
|
||||
Config.CustomCefArgs = form.CefArgs;
|
||||
PromptRestart();
|
||||
form.Dispose();
|
||||
}
|
||||
else form.Dispose();
|
||||
};
|
||||
|
||||
form.Show(ParentForm);
|
||||
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||
}
|
||||
|
||||
private void btnEditCSS_Click(object sender, EventArgs e){
|
||||
DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS, openDevTools);
|
||||
|
||||
form.VisibleChanged += (sender2, args2) => {
|
||||
form.MoveToCenter(ParentForm);
|
||||
};
|
||||
|
||||
form.FormClosed += (sender2, args2) => {
|
||||
RestoreParentForm();
|
||||
|
||||
if (form.DialogResult == DialogResult.OK){
|
||||
Config.CustomBrowserCSS = form.BrowserCSS;
|
||||
Config.CustomNotificationCSS = form.NotificationCSS;
|
||||
}
|
||||
|
||||
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
||||
form.Dispose();
|
||||
};
|
||||
|
||||
form.Show(ParentForm);
|
||||
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||
}
|
||||
#region Application
|
||||
|
||||
private void btnOpenAppFolder_Click(object sender, EventArgs e){
|
||||
using(Process.Start("explorer.exe", "\""+Program.ProgramPath+"\"")){}
|
||||
@@ -147,10 +86,72 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Browser Cache
|
||||
|
||||
private void btnClearCache_Click(object sender, EventArgs e){
|
||||
btnClearCache.Enabled = false;
|
||||
BrowserCache.SetClearOnExit();
|
||||
FormMessage.Information("Clear Cache", "Cache will be automatically cleared when TweetDuck exits.", FormMessage.OK);
|
||||
}
|
||||
|
||||
private void checkClearCacheAuto_CheckedChanged(object sender, EventArgs e){
|
||||
numClearCacheThreshold.Enabled = checkClearCacheAuto.Checked;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Configuration
|
||||
|
||||
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
||||
DialogSettingsCefArgs form = new DialogSettingsCefArgs(Config.CustomCefArgs);
|
||||
|
||||
form.VisibleChanged += (sender2, args2) => {
|
||||
form.MoveToCenter(ParentForm);
|
||||
};
|
||||
|
||||
form.FormClosed += (sender2, args2) => {
|
||||
RestoreParentForm();
|
||||
|
||||
if (form.DialogResult == DialogResult.OK){
|
||||
Config.CustomCefArgs = form.CefArgs;
|
||||
}
|
||||
|
||||
form.Dispose();
|
||||
};
|
||||
|
||||
form.Show(ParentForm);
|
||||
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||
}
|
||||
|
||||
private void btnEditCSS_Click(object sender, EventArgs e){
|
||||
DialogSettingsCSS form = new DialogSettingsCSS(Config.CustomBrowserCSS, Config.CustomNotificationCSS, reinjectBrowserCSS, openDevTools);
|
||||
|
||||
form.VisibleChanged += (sender2, args2) => {
|
||||
form.MoveToCenter(ParentForm);
|
||||
};
|
||||
|
||||
form.FormClosed += (sender2, args2) => {
|
||||
RestoreParentForm();
|
||||
|
||||
if (form.DialogResult == DialogResult.OK){
|
||||
Config.CustomBrowserCSS = form.BrowserCSS;
|
||||
Config.CustomNotificationCSS = form.NotificationCSS;
|
||||
}
|
||||
|
||||
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 RestoreParentForm(){
|
||||
if (ParentForm != null){ // when the parent is closed first, ParentForm is null in FormClosed event
|
||||
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
29
Core/Other/Settings/TabSettingsFeedback.Designer.cs
generated
29
Core/Other/Settings/TabSettingsFeedback.Designer.cs
generated
@@ -40,19 +40,18 @@
|
||||
//
|
||||
// panelDataCollection
|
||||
//
|
||||
this.panelDataCollection.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelDataCollection.Controls.Add(this.labelDataCollectionLink);
|
||||
this.panelDataCollection.Controls.Add(this.checkDataCollection);
|
||||
this.panelDataCollection.Location = new System.Drawing.Point(0, 78);
|
||||
this.panelDataCollection.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelDataCollection.Name = "panelDataCollection";
|
||||
this.panelDataCollection.Size = new System.Drawing.Size(322, 28);
|
||||
this.panelDataCollection.Size = new System.Drawing.Size(300, 28);
|
||||
this.panelDataCollection.TabIndex = 3;
|
||||
//
|
||||
// labelDataCollectionLink
|
||||
//
|
||||
this.labelDataCollectionLink.AutoSize = true;
|
||||
this.labelDataCollectionLink.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDataCollectionLink.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelDataCollectionLink.LinkArea = new System.Windows.Forms.LinkArea(1, 10);
|
||||
this.labelDataCollectionLink.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
|
||||
this.labelDataCollectionLink.Location = new System.Drawing.Point(153, 4);
|
||||
@@ -68,7 +67,7 @@
|
||||
// checkDataCollection
|
||||
//
|
||||
this.checkDataCollection.AutoSize = true;
|
||||
this.checkDataCollection.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkDataCollection.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkDataCollection.Location = new System.Drawing.Point(6, 6);
|
||||
this.checkDataCollection.Margin = new System.Windows.Forms.Padding(6, 6, 0, 2);
|
||||
this.checkDataCollection.Name = "checkDataCollection";
|
||||
@@ -79,17 +78,17 @@
|
||||
//
|
||||
// labelDataCollectionMessage
|
||||
//
|
||||
this.labelDataCollectionMessage.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDataCollectionMessage.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelDataCollectionMessage.Location = new System.Drawing.Point(6, 143);
|
||||
this.labelDataCollectionMessage.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.labelDataCollectionMessage.Name = "labelDataCollectionMessage";
|
||||
this.labelDataCollectionMessage.Size = new System.Drawing.Size(310, 67);
|
||||
this.labelDataCollectionMessage.Size = new System.Drawing.Size(288, 67);
|
||||
this.labelDataCollectionMessage.TabIndex = 5;
|
||||
//
|
||||
// btnViewReport
|
||||
//
|
||||
this.btnViewReport.AutoSize = true;
|
||||
this.btnViewReport.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnViewReport.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnViewReport.Location = new System.Drawing.Point(5, 109);
|
||||
this.btnViewReport.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnViewReport.Name = "btnViewReport";
|
||||
@@ -102,7 +101,7 @@
|
||||
// btnSendFeedback
|
||||
//
|
||||
this.btnSendFeedback.AutoSize = true;
|
||||
this.btnSendFeedback.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnSendFeedback.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnSendFeedback.Location = new System.Drawing.Point(5, 23);
|
||||
this.btnSendFeedback.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnSendFeedback.Name = "btnSendFeedback";
|
||||
@@ -115,7 +114,7 @@
|
||||
// labelDataCollection
|
||||
//
|
||||
this.labelDataCollection.AutoSize = true;
|
||||
this.labelDataCollection.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDataCollection.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelDataCollection.Location = new System.Drawing.Point(3, 63);
|
||||
this.labelDataCollection.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelDataCollection.Name = "labelDataCollection";
|
||||
@@ -126,13 +125,13 @@
|
||||
// labelFeedback
|
||||
//
|
||||
this.labelFeedback.AutoSize = true;
|
||||
this.labelFeedback.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelFeedback.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelFeedback.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelFeedback.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelFeedback.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelFeedback.Name = "labelFeedback";
|
||||
this.labelFeedback.Size = new System.Drawing.Size(72, 20);
|
||||
this.labelFeedback.Size = new System.Drawing.Size(75, 19);
|
||||
this.labelFeedback.TabIndex = 0;
|
||||
this.labelFeedback.Text = "Feedback";
|
||||
this.labelFeedback.Text = "FEEDBACK";
|
||||
//
|
||||
// flowPanel
|
||||
//
|
||||
@@ -148,7 +147,7 @@
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 212);
|
||||
this.flowPanel.Size = new System.Drawing.Size(300, 462);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
//
|
||||
@@ -158,7 +157,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Name = "TabSettingsFeedback";
|
||||
this.Size = new System.Drawing.Size(340, 230);
|
||||
this.Size = new System.Drawing.Size(631, 480);
|
||||
this.panelDataCollection.ResumeLayout(false);
|
||||
this.panelDataCollection.PerformLayout();
|
||||
this.flowPanel.ResumeLayout(false);
|
||||
|
@@ -18,6 +18,8 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
this.analyticsInfo = analyticsInfo;
|
||||
this.plugins = plugins;
|
||||
|
||||
// feedback
|
||||
|
||||
checkDataCollection.Checked = Config.AllowDataCollection;
|
||||
|
||||
if (analytics != null){
|
||||
@@ -33,6 +35,8 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
btnViewReport.Click += btnViewReport_Click;
|
||||
}
|
||||
|
||||
#region Feedback
|
||||
|
||||
private void btnSendFeedback_Click(object sender, EventArgs e){
|
||||
BrowserUtils.OpenExternalBrowser("https://github.com/chylex/TweetDuck/issues/new");
|
||||
}
|
||||
@@ -50,5 +54,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
410
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
410
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@@ -38,23 +38,39 @@
|
||||
this.panelZoom = new System.Windows.Forms.Panel();
|
||||
this.checkAnimatedAvatars = new System.Windows.Forms.CheckBox();
|
||||
this.labelUpdates = new System.Windows.Forms.Label();
|
||||
this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flowPanelLeft = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.checkFocusDmInput = new System.Windows.Forms.CheckBox();
|
||||
this.checkKeepLikeFollowDialogsOpen = new System.Windows.Forms.CheckBox();
|
||||
this.labelTray = new System.Windows.Forms.Label();
|
||||
this.comboBoxTrayType = new System.Windows.Forms.ComboBox();
|
||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
||||
this.labelBrowserSettings = new System.Windows.Forms.Label();
|
||||
this.checkSmoothScrolling = new System.Windows.Forms.CheckBox();
|
||||
this.checkTouchAdjustment = new System.Windows.Forms.CheckBox();
|
||||
this.labelBrowserPath = new System.Windows.Forms.Label();
|
||||
this.comboBoxBrowserPath = new System.Windows.Forms.ComboBox();
|
||||
this.labelSearchEngine = new System.Windows.Forms.Label();
|
||||
this.comboBoxSearchEngine = new System.Windows.Forms.ComboBox();
|
||||
this.flowPanelRight = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox();
|
||||
this.labelLocales = new System.Windows.Forms.Label();
|
||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||
this.labelSpellCheckLanguage = new System.Windows.Forms.Label();
|
||||
this.comboBoxSpellCheckLanguage = new System.Windows.Forms.ComboBox();
|
||||
this.labelTranslationTarget = new System.Windows.Forms.Label();
|
||||
this.comboBoxTranslationTarget = new System.Windows.Forms.ComboBox();
|
||||
this.panelSeparator = new System.Windows.Forms.Panel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).BeginInit();
|
||||
this.panelZoom.SuspendLayout();
|
||||
this.flowPanel.SuspendLayout();
|
||||
this.flowPanelLeft.SuspendLayout();
|
||||
this.flowPanelRight.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkExpandLinks
|
||||
//
|
||||
this.checkExpandLinks.AutoSize = true;
|
||||
this.checkExpandLinks.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkExpandLinks.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkExpandLinks.Location = new System.Drawing.Point(6, 26);
|
||||
this.checkExpandLinks.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkExpandLinks.Name = "checkExpandLinks";
|
||||
@@ -66,32 +82,32 @@
|
||||
// checkUpdateNotifications
|
||||
//
|
||||
this.checkUpdateNotifications.AutoSize = true;
|
||||
this.checkUpdateNotifications.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 427);
|
||||
this.checkUpdateNotifications.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 409);
|
||||
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
||||
this.checkUpdateNotifications.Size = new System.Drawing.Size(182, 19);
|
||||
this.checkUpdateNotifications.TabIndex = 15;
|
||||
this.checkUpdateNotifications.TabIndex = 14;
|
||||
this.checkUpdateNotifications.Text = "Check Updates Automatically";
|
||||
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnCheckUpdates
|
||||
//
|
||||
this.btnCheckUpdates.AutoSize = true;
|
||||
this.btnCheckUpdates.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnCheckUpdates.Location = new System.Drawing.Point(5, 451);
|
||||
this.btnCheckUpdates.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnCheckUpdates.Location = new System.Drawing.Point(5, 433);
|
||||
this.btnCheckUpdates.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.btnCheckUpdates.Name = "btnCheckUpdates";
|
||||
this.btnCheckUpdates.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.btnCheckUpdates.Size = new System.Drawing.Size(128, 25);
|
||||
this.btnCheckUpdates.TabIndex = 16;
|
||||
this.btnCheckUpdates.TabIndex = 15;
|
||||
this.btnCheckUpdates.Text = "Check Updates Now";
|
||||
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelZoomValue
|
||||
//
|
||||
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelZoomValue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelZoomValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelZoomValue.Location = new System.Drawing.Point(147, 4);
|
||||
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelZoomValue.Name = "labelZoomValue";
|
||||
@@ -103,24 +119,24 @@
|
||||
// checkBestImageQuality
|
||||
//
|
||||
this.checkBestImageQuality.AutoSize = true;
|
||||
this.checkBestImageQuality.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkBestImageQuality.Location = new System.Drawing.Point(6, 98);
|
||||
this.checkBestImageQuality.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkBestImageQuality.Location = new System.Drawing.Point(6, 122);
|
||||
this.checkBestImageQuality.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkBestImageQuality.Name = "checkBestImageQuality";
|
||||
this.checkBestImageQuality.Size = new System.Drawing.Size(125, 19);
|
||||
this.checkBestImageQuality.TabIndex = 4;
|
||||
this.checkBestImageQuality.TabIndex = 5;
|
||||
this.checkBestImageQuality.Text = "Best Image Quality";
|
||||
this.checkBestImageQuality.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkOpenSearchInFirstColumn
|
||||
//
|
||||
this.checkOpenSearchInFirstColumn.AutoSize = true;
|
||||
this.checkOpenSearchInFirstColumn.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkOpenSearchInFirstColumn.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkOpenSearchInFirstColumn.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkOpenSearchInFirstColumn.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkOpenSearchInFirstColumn.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkOpenSearchInFirstColumn.Name = "checkOpenSearchInFirstColumn";
|
||||
this.checkOpenSearchInFirstColumn.Size = new System.Drawing.Size(245, 19);
|
||||
this.checkOpenSearchInFirstColumn.TabIndex = 2;
|
||||
this.checkOpenSearchInFirstColumn.TabIndex = 3;
|
||||
this.checkOpenSearchInFirstColumn.Text = "Add Search Columns Before First Column";
|
||||
this.checkOpenSearchInFirstColumn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -142,12 +158,12 @@
|
||||
// labelZoom
|
||||
//
|
||||
this.labelZoom.AutoSize = true;
|
||||
this.labelZoom.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelZoom.Location = new System.Drawing.Point(3, 330);
|
||||
this.labelZoom.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelZoom.Location = new System.Drawing.Point(3, 179);
|
||||
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelZoom.Name = "labelZoom";
|
||||
this.labelZoom.Size = new System.Drawing.Size(39, 15);
|
||||
this.labelZoom.TabIndex = 12;
|
||||
this.labelZoom.TabIndex = 7;
|
||||
this.labelZoom.Text = "Zoom";
|
||||
//
|
||||
// zoomUpdateTimer
|
||||
@@ -158,167 +174,352 @@
|
||||
// labelUI
|
||||
//
|
||||
this.labelUI.AutoSize = true;
|
||||
this.labelUI.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelUI.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelUI.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelUI.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelUI.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelUI.Name = "labelUI";
|
||||
this.labelUI.Size = new System.Drawing.Size(100, 20);
|
||||
this.labelUI.Size = new System.Drawing.Size(118, 19);
|
||||
this.labelUI.TabIndex = 0;
|
||||
this.labelUI.Text = "User Interface";
|
||||
this.labelUI.Text = "USER INTERFACE";
|
||||
//
|
||||
// panelZoom
|
||||
//
|
||||
this.panelZoom.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelZoom.Controls.Add(this.trackBarZoom);
|
||||
this.panelZoom.Controls.Add(this.labelZoomValue);
|
||||
this.panelZoom.Location = new System.Drawing.Point(0, 345);
|
||||
this.panelZoom.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelZoom.Location = new System.Drawing.Point(0, 195);
|
||||
this.panelZoom.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelZoom.Name = "panelZoom";
|
||||
this.panelZoom.Size = new System.Drawing.Size(322, 36);
|
||||
this.panelZoom.TabIndex = 13;
|
||||
this.panelZoom.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelZoom.TabIndex = 8;
|
||||
//
|
||||
// checkAnimatedAvatars
|
||||
//
|
||||
this.checkAnimatedAvatars.AutoSize = true;
|
||||
this.checkAnimatedAvatars.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkAnimatedAvatars.Location = new System.Drawing.Point(6, 122);
|
||||
this.checkAnimatedAvatars.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkAnimatedAvatars.Location = new System.Drawing.Point(6, 146);
|
||||
this.checkAnimatedAvatars.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkAnimatedAvatars.Name = "checkAnimatedAvatars";
|
||||
this.checkAnimatedAvatars.Size = new System.Drawing.Size(158, 19);
|
||||
this.checkAnimatedAvatars.TabIndex = 5;
|
||||
this.checkAnimatedAvatars.TabIndex = 6;
|
||||
this.checkAnimatedAvatars.Text = "Enable Animated Avatars";
|
||||
this.checkAnimatedAvatars.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelUpdates
|
||||
//
|
||||
this.labelUpdates.AutoSize = true;
|
||||
this.labelUpdates.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelUpdates.Location = new System.Drawing.Point(0, 401);
|
||||
this.labelUpdates.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelUpdates.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelUpdates.Location = new System.Drawing.Point(0, 383);
|
||||
this.labelUpdates.Margin = new System.Windows.Forms.Padding(0, 27, 0, 1);
|
||||
this.labelUpdates.Name = "labelUpdates";
|
||||
this.labelUpdates.Size = new System.Drawing.Size(64, 20);
|
||||
this.labelUpdates.TabIndex = 14;
|
||||
this.labelUpdates.Text = "Updates";
|
||||
this.labelUpdates.Size = new System.Drawing.Size(69, 19);
|
||||
this.labelUpdates.TabIndex = 13;
|
||||
this.labelUpdates.Text = "UPDATES";
|
||||
//
|
||||
// flowPanel
|
||||
// flowPanelLeft
|
||||
//
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowPanel.Controls.Add(this.labelUI);
|
||||
this.flowPanel.Controls.Add(this.checkExpandLinks);
|
||||
this.flowPanel.Controls.Add(this.checkOpenSearchInFirstColumn);
|
||||
this.flowPanel.Controls.Add(this.checkKeepLikeFollowDialogsOpen);
|
||||
this.flowPanel.Controls.Add(this.checkBestImageQuality);
|
||||
this.flowPanel.Controls.Add(this.checkAnimatedAvatars);
|
||||
this.flowPanel.Controls.Add(this.labelBrowserSettings);
|
||||
this.flowPanel.Controls.Add(this.checkSmoothScrolling);
|
||||
this.flowPanel.Controls.Add(this.labelBrowserPath);
|
||||
this.flowPanel.Controls.Add(this.comboBoxBrowserPath);
|
||||
this.flowPanel.Controls.Add(this.labelSearchEngine);
|
||||
this.flowPanel.Controls.Add(this.comboBoxSearchEngine);
|
||||
this.flowPanel.Controls.Add(this.labelZoom);
|
||||
this.flowPanel.Controls.Add(this.panelZoom);
|
||||
this.flowPanel.Controls.Add(this.labelUpdates);
|
||||
this.flowPanel.Controls.Add(this.checkUpdateNotifications);
|
||||
this.flowPanel.Controls.Add(this.btnCheckUpdates);
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 486);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
this.flowPanelLeft.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanelLeft.Controls.Add(this.labelUI);
|
||||
this.flowPanelLeft.Controls.Add(this.checkExpandLinks);
|
||||
this.flowPanelLeft.Controls.Add(this.checkFocusDmInput);
|
||||
this.flowPanelLeft.Controls.Add(this.checkOpenSearchInFirstColumn);
|
||||
this.flowPanelLeft.Controls.Add(this.checkKeepLikeFollowDialogsOpen);
|
||||
this.flowPanelLeft.Controls.Add(this.checkBestImageQuality);
|
||||
this.flowPanelLeft.Controls.Add(this.checkAnimatedAvatars);
|
||||
this.flowPanelLeft.Controls.Add(this.labelZoom);
|
||||
this.flowPanelLeft.Controls.Add(this.panelZoom);
|
||||
this.flowPanelLeft.Controls.Add(this.labelTray);
|
||||
this.flowPanelLeft.Controls.Add(this.comboBoxTrayType);
|
||||
this.flowPanelLeft.Controls.Add(this.labelTrayIcon);
|
||||
this.flowPanelLeft.Controls.Add(this.checkTrayHighlight);
|
||||
this.flowPanelLeft.Controls.Add(this.labelUpdates);
|
||||
this.flowPanelLeft.Controls.Add(this.checkUpdateNotifications);
|
||||
this.flowPanelLeft.Controls.Add(this.btnCheckUpdates);
|
||||
this.flowPanelLeft.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanelLeft.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanelLeft.Name = "flowPanelLeft";
|
||||
this.flowPanelLeft.Size = new System.Drawing.Size(300, 462);
|
||||
this.flowPanelLeft.TabIndex = 0;
|
||||
this.flowPanelLeft.WrapContents = false;
|
||||
//
|
||||
// checkFocusDmInput
|
||||
//
|
||||
this.checkFocusDmInput.AutoSize = true;
|
||||
this.checkFocusDmInput.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkFocusDmInput.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkFocusDmInput.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkFocusDmInput.Name = "checkFocusDmInput";
|
||||
this.checkFocusDmInput.Size = new System.Drawing.Size(282, 19);
|
||||
this.checkFocusDmInput.TabIndex = 2;
|
||||
this.checkFocusDmInput.Text = "Focus Input Field When Opening Direct Message";
|
||||
this.checkFocusDmInput.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkKeepLikeFollowDialogsOpen
|
||||
//
|
||||
this.checkKeepLikeFollowDialogsOpen.AutoSize = true;
|
||||
this.checkKeepLikeFollowDialogsOpen.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkKeepLikeFollowDialogsOpen.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkKeepLikeFollowDialogsOpen.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkKeepLikeFollowDialogsOpen.Location = new System.Drawing.Point(6, 98);
|
||||
this.checkKeepLikeFollowDialogsOpen.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkKeepLikeFollowDialogsOpen.Name = "checkKeepLikeFollowDialogsOpen";
|
||||
this.checkKeepLikeFollowDialogsOpen.Size = new System.Drawing.Size(190, 19);
|
||||
this.checkKeepLikeFollowDialogsOpen.TabIndex = 3;
|
||||
this.checkKeepLikeFollowDialogsOpen.TabIndex = 4;
|
||||
this.checkKeepLikeFollowDialogsOpen.Text = "Keep Like/Follow Dialogs Open";
|
||||
this.checkKeepLikeFollowDialogsOpen.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelTray
|
||||
//
|
||||
this.labelTray.AutoSize = true;
|
||||
this.labelTray.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTray.Location = new System.Drawing.Point(0, 255);
|
||||
this.labelTray.Margin = new System.Windows.Forms.Padding(0, 25, 0, 1);
|
||||
this.labelTray.Name = "labelTray";
|
||||
this.labelTray.Size = new System.Drawing.Size(99, 19);
|
||||
this.labelTray.TabIndex = 9;
|
||||
this.labelTray.Text = "SYSTEM TRAY";
|
||||
//
|
||||
// comboBoxTrayType
|
||||
//
|
||||
this.comboBoxTrayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxTrayType.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxTrayType.FormattingEnabled = true;
|
||||
this.comboBoxTrayType.Location = new System.Drawing.Point(5, 279);
|
||||
this.comboBoxTrayType.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxTrayType.Name = "comboBoxTrayType";
|
||||
this.comboBoxTrayType.Size = new System.Drawing.Size(144, 23);
|
||||
this.comboBoxTrayType.TabIndex = 10;
|
||||
//
|
||||
// labelTrayIcon
|
||||
//
|
||||
this.labelTrayIcon.AutoSize = true;
|
||||
this.labelTrayIcon.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTrayIcon.Location = new System.Drawing.Point(3, 314);
|
||||
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||
this.labelTrayIcon.Name = "labelTrayIcon";
|
||||
this.labelTrayIcon.Size = new System.Drawing.Size(56, 15);
|
||||
this.labelTrayIcon.TabIndex = 11;
|
||||
this.labelTrayIcon.Text = "Tray Icon";
|
||||
//
|
||||
// checkTrayHighlight
|
||||
//
|
||||
this.checkTrayHighlight.AutoSize = true;
|
||||
this.checkTrayHighlight.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkTrayHighlight.Location = new System.Drawing.Point(6, 335);
|
||||
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkTrayHighlight.Name = "checkTrayHighlight";
|
||||
this.checkTrayHighlight.Size = new System.Drawing.Size(114, 19);
|
||||
this.checkTrayHighlight.TabIndex = 12;
|
||||
this.checkTrayHighlight.Text = "Enable Highlight";
|
||||
this.checkTrayHighlight.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBrowserSettings
|
||||
//
|
||||
this.labelBrowserSettings.AutoSize = true;
|
||||
this.labelBrowserSettings.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelBrowserSettings.Location = new System.Drawing.Point(0, 163);
|
||||
this.labelBrowserSettings.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelBrowserSettings.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelBrowserSettings.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelBrowserSettings.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelBrowserSettings.Name = "labelBrowserSettings";
|
||||
this.labelBrowserSettings.Size = new System.Drawing.Size(119, 20);
|
||||
this.labelBrowserSettings.TabIndex = 6;
|
||||
this.labelBrowserSettings.Text = "Browser Settings";
|
||||
this.labelBrowserSettings.Size = new System.Drawing.Size(143, 19);
|
||||
this.labelBrowserSettings.TabIndex = 0;
|
||||
this.labelBrowserSettings.Text = "BROWSER SETTINGS";
|
||||
//
|
||||
// checkSmoothScrolling
|
||||
//
|
||||
this.checkSmoothScrolling.AutoSize = true;
|
||||
this.checkSmoothScrolling.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkSmoothScrolling.Location = new System.Drawing.Point(6, 189);
|
||||
this.checkSmoothScrolling.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkSmoothScrolling.Location = new System.Drawing.Point(6, 26);
|
||||
this.checkSmoothScrolling.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkSmoothScrolling.Name = "checkSmoothScrolling";
|
||||
this.checkSmoothScrolling.Size = new System.Drawing.Size(117, 19);
|
||||
this.checkSmoothScrolling.TabIndex = 7;
|
||||
this.checkSmoothScrolling.TabIndex = 1;
|
||||
this.checkSmoothScrolling.Text = "Smooth Scrolling";
|
||||
this.checkSmoothScrolling.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkTouchAdjustment
|
||||
//
|
||||
this.checkTouchAdjustment.AutoSize = true;
|
||||
this.checkTouchAdjustment.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkTouchAdjustment.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkTouchAdjustment.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkTouchAdjustment.Name = "checkTouchAdjustment";
|
||||
this.checkTouchAdjustment.Size = new System.Drawing.Size(163, 19);
|
||||
this.checkTouchAdjustment.TabIndex = 2;
|
||||
this.checkTouchAdjustment.Text = "Touch Screen Adjustment";
|
||||
this.checkTouchAdjustment.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelBrowserPath
|
||||
//
|
||||
this.labelBrowserPath.AutoSize = true;
|
||||
this.labelBrowserPath.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelBrowserPath.Location = new System.Drawing.Point(3, 222);
|
||||
this.labelBrowserPath.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelBrowserPath.Location = new System.Drawing.Point(3, 107);
|
||||
this.labelBrowserPath.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelBrowserPath.Name = "labelBrowserPath";
|
||||
this.labelBrowserPath.Size = new System.Drawing.Size(103, 15);
|
||||
this.labelBrowserPath.TabIndex = 8;
|
||||
this.labelBrowserPath.Size = new System.Drawing.Size(104, 15);
|
||||
this.labelBrowserPath.TabIndex = 4;
|
||||
this.labelBrowserPath.Text = "Open Links With...";
|
||||
//
|
||||
// comboBoxBrowserPath
|
||||
//
|
||||
this.comboBoxBrowserPath.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxBrowserPath.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxBrowserPath.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxBrowserPath.FormattingEnabled = true;
|
||||
this.comboBoxBrowserPath.Location = new System.Drawing.Point(5, 240);
|
||||
this.comboBoxBrowserPath.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.comboBoxBrowserPath.Location = new System.Drawing.Point(5, 126);
|
||||
this.comboBoxBrowserPath.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxBrowserPath.Name = "comboBoxBrowserPath";
|
||||
this.comboBoxBrowserPath.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxBrowserPath.TabIndex = 9;
|
||||
this.comboBoxBrowserPath.TabIndex = 5;
|
||||
//
|
||||
// labelSearchEngine
|
||||
//
|
||||
this.labelSearchEngine.AutoSize = true;
|
||||
this.labelSearchEngine.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelSearchEngine.Location = new System.Drawing.Point(3, 276);
|
||||
this.labelSearchEngine.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelSearchEngine.Location = new System.Drawing.Point(3, 164);
|
||||
this.labelSearchEngine.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelSearchEngine.Name = "labelSearchEngine";
|
||||
this.labelSearchEngine.Size = new System.Drawing.Size(81, 15);
|
||||
this.labelSearchEngine.TabIndex = 10;
|
||||
this.labelSearchEngine.Size = new System.Drawing.Size(82, 15);
|
||||
this.labelSearchEngine.TabIndex = 6;
|
||||
this.labelSearchEngine.Text = "Search Engine";
|
||||
//
|
||||
// comboBoxSearchEngine
|
||||
//
|
||||
this.comboBoxSearchEngine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSearchEngine.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxSearchEngine.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxSearchEngine.FormattingEnabled = true;
|
||||
this.comboBoxSearchEngine.Location = new System.Drawing.Point(5, 294);
|
||||
this.comboBoxSearchEngine.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.comboBoxSearchEngine.Location = new System.Drawing.Point(5, 183);
|
||||
this.comboBoxSearchEngine.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxSearchEngine.Name = "comboBoxSearchEngine";
|
||||
this.comboBoxSearchEngine.Size = new System.Drawing.Size(173, 23);
|
||||
this.comboBoxSearchEngine.TabIndex = 11;
|
||||
this.comboBoxSearchEngine.TabIndex = 7;
|
||||
//
|
||||
// flowPanelRight
|
||||
//
|
||||
this.flowPanelRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanelRight.Controls.Add(this.labelBrowserSettings);
|
||||
this.flowPanelRight.Controls.Add(this.checkSmoothScrolling);
|
||||
this.flowPanelRight.Controls.Add(this.checkTouchAdjustment);
|
||||
this.flowPanelRight.Controls.Add(this.checkHardwareAcceleration);
|
||||
this.flowPanelRight.Controls.Add(this.labelBrowserPath);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxBrowserPath);
|
||||
this.flowPanelRight.Controls.Add(this.labelSearchEngine);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxSearchEngine);
|
||||
this.flowPanelRight.Controls.Add(this.labelLocales);
|
||||
this.flowPanelRight.Controls.Add(this.checkSpellCheck);
|
||||
this.flowPanelRight.Controls.Add(this.labelSpellCheckLanguage);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxSpellCheckLanguage);
|
||||
this.flowPanelRight.Controls.Add(this.labelTranslationTarget);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxTranslationTarget);
|
||||
this.flowPanelRight.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanelRight.Location = new System.Drawing.Point(322, 9);
|
||||
this.flowPanelRight.Name = "flowPanelRight";
|
||||
this.flowPanelRight.Size = new System.Drawing.Size(300, 462);
|
||||
this.flowPanelRight.TabIndex = 1;
|
||||
this.flowPanelRight.WrapContents = false;
|
||||
//
|
||||
// checkHardwareAcceleration
|
||||
//
|
||||
this.checkHardwareAcceleration.AutoSize = true;
|
||||
this.checkHardwareAcceleration.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
|
||||
this.checkHardwareAcceleration.Size = new System.Drawing.Size(146, 19);
|
||||
this.checkHardwareAcceleration.TabIndex = 3;
|
||||
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
|
||||
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelLocales
|
||||
//
|
||||
this.labelLocales.AutoSize = true;
|
||||
this.labelLocales.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelLocales.Location = new System.Drawing.Point(0, 236);
|
||||
this.labelLocales.Margin = new System.Windows.Forms.Padding(0, 27, 0, 1);
|
||||
this.labelLocales.Name = "labelLocales";
|
||||
this.labelLocales.Size = new System.Drawing.Size(67, 19);
|
||||
this.labelLocales.TabIndex = 8;
|
||||
this.labelLocales.Text = "LOCALES";
|
||||
//
|
||||
// checkSpellCheck
|
||||
//
|
||||
this.checkSpellCheck.AutoSize = true;
|
||||
this.checkSpellCheck.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkSpellCheck.Location = new System.Drawing.Point(6, 262);
|
||||
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkSpellCheck.Name = "checkSpellCheck";
|
||||
this.checkSpellCheck.Size = new System.Drawing.Size(125, 19);
|
||||
this.checkSpellCheck.TabIndex = 9;
|
||||
this.checkSpellCheck.Text = "Enable Spell Check";
|
||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelSpellCheckLanguage
|
||||
//
|
||||
this.labelSpellCheckLanguage.AutoSize = true;
|
||||
this.labelSpellCheckLanguage.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelSpellCheckLanguage.Location = new System.Drawing.Point(3, 295);
|
||||
this.labelSpellCheckLanguage.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelSpellCheckLanguage.Name = "labelSpellCheckLanguage";
|
||||
this.labelSpellCheckLanguage.Size = new System.Drawing.Size(123, 15);
|
||||
this.labelSpellCheckLanguage.TabIndex = 10;
|
||||
this.labelSpellCheckLanguage.Text = "Spell Check Language";
|
||||
//
|
||||
// comboBoxSpellCheckLanguage
|
||||
//
|
||||
this.comboBoxSpellCheckLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSpellCheckLanguage.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxSpellCheckLanguage.FormattingEnabled = true;
|
||||
this.comboBoxSpellCheckLanguage.Location = new System.Drawing.Point(5, 314);
|
||||
this.comboBoxSpellCheckLanguage.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxSpellCheckLanguage.Name = "comboBoxSpellCheckLanguage";
|
||||
this.comboBoxSpellCheckLanguage.Size = new System.Drawing.Size(290, 23);
|
||||
this.comboBoxSpellCheckLanguage.TabIndex = 11;
|
||||
//
|
||||
// labelTranslationTarget
|
||||
//
|
||||
this.labelTranslationTarget.AutoSize = true;
|
||||
this.labelTranslationTarget.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTranslationTarget.Location = new System.Drawing.Point(3, 352);
|
||||
this.labelTranslationTarget.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelTranslationTarget.Name = "labelTranslationTarget";
|
||||
this.labelTranslationTarget.Size = new System.Drawing.Size(142, 15);
|
||||
this.labelTranslationTarget.TabIndex = 12;
|
||||
this.labelTranslationTarget.Text = "Bing Translator Language";
|
||||
//
|
||||
// comboBoxTranslationTarget
|
||||
//
|
||||
this.comboBoxTranslationTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxTranslationTarget.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxTranslationTarget.FormattingEnabled = true;
|
||||
this.comboBoxTranslationTarget.Location = new System.Drawing.Point(5, 371);
|
||||
this.comboBoxTranslationTarget.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxTranslationTarget.Name = "comboBoxTranslationTarget";
|
||||
this.comboBoxTranslationTarget.Size = new System.Drawing.Size(290, 23);
|
||||
this.comboBoxTranslationTarget.TabIndex = 13;
|
||||
//
|
||||
// panelSeparator
|
||||
//
|
||||
this.panelSeparator.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.panelSeparator.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200)))));
|
||||
this.panelSeparator.Location = new System.Drawing.Point(312, 0);
|
||||
this.panelSeparator.Margin = new System.Windows.Forms.Padding(0, 0, 6, 0);
|
||||
this.panelSeparator.Name = "panelSeparator";
|
||||
this.panelSeparator.Size = new System.Drawing.Size(1, 480);
|
||||
this.panelSeparator.TabIndex = 2;
|
||||
//
|
||||
// TabSettingsGeneral
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Controls.Add(this.panelSeparator);
|
||||
this.Controls.Add(this.flowPanelRight);
|
||||
this.Controls.Add(this.flowPanelLeft);
|
||||
this.Name = "TabSettingsGeneral";
|
||||
this.Size = new System.Drawing.Size(340, 504);
|
||||
this.Size = new System.Drawing.Size(631, 480);
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).EndInit();
|
||||
this.panelZoom.ResumeLayout(false);
|
||||
this.flowPanel.ResumeLayout(false);
|
||||
this.flowPanel.PerformLayout();
|
||||
this.flowPanelLeft.ResumeLayout(false);
|
||||
this.flowPanelLeft.PerformLayout();
|
||||
this.flowPanelRight.ResumeLayout(false);
|
||||
this.flowPanelRight.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -339,7 +540,7 @@
|
||||
private System.Windows.Forms.CheckBox checkBestImageQuality;
|
||||
private System.Windows.Forms.CheckBox checkOpenSearchInFirstColumn;
|
||||
private System.Windows.Forms.CheckBox checkAnimatedAvatars;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanel;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelLeft;
|
||||
private System.Windows.Forms.CheckBox checkKeepLikeFollowDialogsOpen;
|
||||
private System.Windows.Forms.Label labelBrowserPath;
|
||||
private System.Windows.Forms.ComboBox comboBoxBrowserPath;
|
||||
@@ -347,5 +548,20 @@
|
||||
private System.Windows.Forms.CheckBox checkSmoothScrolling;
|
||||
private System.Windows.Forms.Label labelSearchEngine;
|
||||
private System.Windows.Forms.ComboBox comboBoxSearchEngine;
|
||||
private System.Windows.Forms.CheckBox checkTouchAdjustment;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelRight;
|
||||
private System.Windows.Forms.Panel panelSeparator;
|
||||
private System.Windows.Forms.Label labelTray;
|
||||
private System.Windows.Forms.ComboBox comboBoxTrayType;
|
||||
private System.Windows.Forms.Label labelTrayIcon;
|
||||
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
||||
private System.Windows.Forms.Label labelLocales;
|
||||
private System.Windows.Forms.CheckBox checkSpellCheck;
|
||||
private System.Windows.Forms.Label labelSpellCheckLanguage;
|
||||
private System.Windows.Forms.ComboBox comboBoxSpellCheckLanguage;
|
||||
private System.Windows.Forms.Label labelTranslationTarget;
|
||||
private System.Windows.Forms.ComboBox comboBoxTranslationTarget;
|
||||
private System.Windows.Forms.CheckBox checkHardwareAcceleration;
|
||||
private System.Windows.Forms.CheckBox checkFocusDmInput;
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,8 @@ using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Updates;
|
||||
using TweetLib.Core.Features.Updates;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsGeneral : BaseTabSettings{
|
||||
@@ -28,29 +29,63 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
this.updates = updates;
|
||||
this.updates.CheckFinished += updates_CheckFinished;
|
||||
|
||||
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
|
||||
|
||||
// user interface
|
||||
|
||||
toolTip.SetToolTip(checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a tooltip instead.");
|
||||
toolTip.SetToolTip(checkFocusDmInput, "Places cursor into Direct Message input\r\nfield when opening a conversation.");
|
||||
toolTip.SetToolTip(checkOpenSearchInFirstColumn, "By default, TweetDeck adds Search columns at the end.\r\nThis option makes them appear before the first column instead.");
|
||||
toolTip.SetToolTip(checkKeepLikeFollowDialogsOpen, "Allows liking and following from multiple accounts at once,\r\ninstead of automatically closing the dialog after taking an action.");
|
||||
toolTip.SetToolTip(checkBestImageQuality, "When right-clicking a tweet image, the context menu options\r\nwill use links to the original image size (:orig in the URL).");
|
||||
toolTip.SetToolTip(checkAnimatedAvatars, "Some old Twitter avatars could be uploaded as animated GIFs.");
|
||||
|
||||
toolTip.SetToolTip(checkSmoothScrolling, "Toggles smooth mouse wheel scrolling.");
|
||||
toolTip.SetToolTip(comboBoxBrowserPath, "Sets the default browser for opening links.");
|
||||
toolTip.SetToolTip(labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
|
||||
toolTip.SetToolTip(trackBarZoom, toolTip.GetToolTip(labelZoomValue));
|
||||
|
||||
toolTip.SetToolTip(checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear again.");
|
||||
toolTip.SetToolTip(btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
||||
|
||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||
checkFocusDmInput.Checked = Config.FocusDmInput;
|
||||
checkOpenSearchInFirstColumn.Checked = Config.OpenSearchInFirstColumn;
|
||||
checkKeepLikeFollowDialogsOpen.Checked = Config.KeepLikeFollowDialogsOpen;
|
||||
checkBestImageQuality.Checked = Config.BestImageQuality;
|
||||
checkAnimatedAvatars.Checked = Config.EnableAnimatedImages;
|
||||
|
||||
trackBarZoom.SetValueSafe(Config.ZoomLevel);
|
||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||
|
||||
// system tray
|
||||
|
||||
toolTip.SetToolTip(comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
|
||||
toolTip.SetToolTip(checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with popup or audio notifications.\r\nThe icon resets when the main window is restored.");
|
||||
|
||||
comboBoxTrayType.Items.Add("Disabled");
|
||||
comboBoxTrayType.Items.Add("Display Icon Only");
|
||||
comboBoxTrayType.Items.Add("Minimize to Tray");
|
||||
comboBoxTrayType.Items.Add("Close to Tray");
|
||||
comboBoxTrayType.Items.Add("Combined");
|
||||
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
||||
|
||||
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
|
||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||
|
||||
// updates
|
||||
|
||||
toolTip.SetToolTip(checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear again.");
|
||||
toolTip.SetToolTip(btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
||||
|
||||
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
||||
|
||||
// browser settings
|
||||
|
||||
toolTip.SetToolTip(checkSmoothScrolling, "Toggles smooth mouse wheel scrolling.");
|
||||
toolTip.SetToolTip(checkTouchAdjustment, "Toggles Chromium touch screen adjustment.\r\nDisabled by default, because it is very imprecise with TweetDeck.");
|
||||
toolTip.SetToolTip(checkHardwareAcceleration, "Uses graphics card to improve performance.\r\nDisable if you experience visual glitches, or to save a small amount of RAM.");
|
||||
toolTip.SetToolTip(comboBoxBrowserPath, "Sets the default browser for opening links.");
|
||||
toolTip.SetToolTip(comboBoxSearchEngine, "Sets the default website for opening searches.");
|
||||
|
||||
checkSmoothScrolling.Checked = Config.EnableSmoothScrolling;
|
||||
checkTouchAdjustment.Checked = Config.EnableTouchAdjustment;
|
||||
checkHardwareAcceleration.Checked = SysConfig.HardwareAcceleration;
|
||||
|
||||
foreach(WindowsUtils.Browser browserInfo in WindowsUtils.FindInstalledBrowsers()){
|
||||
comboBoxBrowserPath.Items.Add(browserInfo);
|
||||
@@ -68,36 +103,71 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
searchEngineIndexCustom = comboBoxSearchEngine.Items.Add("(custom url...)");
|
||||
UpdateSearchEngineSelection();
|
||||
|
||||
trackBarZoom.SetValueSafe(Config.ZoomLevel);
|
||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||
// locales
|
||||
|
||||
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
||||
toolTip.SetToolTip(checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||
toolTip.SetToolTip(comboBoxSpellCheckLanguage, "Language used for spell check.");
|
||||
toolTip.SetToolTip(comboBoxTranslationTarget, "Language tweets are translated into.");
|
||||
|
||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||
|
||||
try{
|
||||
foreach(LocaleUtils.Item item in LocaleUtils.SpellCheckLanguages){
|
||||
comboBoxSpellCheckLanguage.Items.Add(item);
|
||||
}
|
||||
}catch{
|
||||
comboBoxSpellCheckLanguage.Items.Add(new LocaleUtils.Item("en-US"));
|
||||
}
|
||||
|
||||
comboBoxSpellCheckLanguage.SelectedItem = new LocaleUtils.Item(Config.SpellCheckLanguage);
|
||||
|
||||
foreach(LocaleUtils.Item item in LocaleUtils.TweetDeckTranslationLocales){
|
||||
comboBoxTranslationTarget.Items.Add(item);
|
||||
}
|
||||
|
||||
comboBoxTranslationTarget.SelectedItem = new LocaleUtils.Item(Config.TranslationTarget);
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||
checkFocusDmInput.CheckedChanged += checkFocusDmInput_CheckedChanged;
|
||||
checkOpenSearchInFirstColumn.CheckedChanged += checkOpenSearchInFirstColumn_CheckedChanged;
|
||||
checkKeepLikeFollowDialogsOpen.CheckedChanged += checkKeepLikeFollowDialogsOpen_CheckedChanged;
|
||||
checkBestImageQuality.CheckedChanged += checkBestImageQuality_CheckedChanged;
|
||||
checkAnimatedAvatars.CheckedChanged += checkAnimatedAvatars_CheckedChanged;
|
||||
|
||||
checkSmoothScrolling.CheckedChanged += checkSmoothScrolling_CheckedChanged;
|
||||
comboBoxBrowserPath.SelectedIndexChanged += comboBoxBrowserPath_SelectedIndexChanged;
|
||||
comboBoxSearchEngine.SelectedIndexChanged += comboBoxSearchEngine_SelectedIndexChanged;
|
||||
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
|
||||
|
||||
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
||||
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
||||
|
||||
checkUpdateNotifications.CheckedChanged += checkUpdateNotifications_CheckedChanged;
|
||||
btnCheckUpdates.Click += btnCheckUpdates_Click;
|
||||
|
||||
checkSmoothScrolling.CheckedChanged += checkSmoothScrolling_CheckedChanged;
|
||||
checkTouchAdjustment.CheckedChanged += checkTouchAdjustment_CheckedChanged;
|
||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
||||
comboBoxBrowserPath.SelectedIndexChanged += comboBoxBrowserPath_SelectedIndexChanged;
|
||||
comboBoxSearchEngine.SelectedIndexChanged += comboBoxSearchEngine_SelectedIndexChanged;
|
||||
|
||||
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||
comboBoxSpellCheckLanguage.SelectedValueChanged += comboBoxSpellCheckLanguage_SelectedValueChanged;
|
||||
comboBoxTranslationTarget.SelectedValueChanged += comboBoxTranslationTarget_SelectedValueChanged;
|
||||
}
|
||||
|
||||
public override void OnClosing(){
|
||||
Config.ZoomLevel = trackBarZoom.Value;
|
||||
}
|
||||
|
||||
#region User Interface
|
||||
|
||||
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
|
||||
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
||||
}
|
||||
|
||||
private void checkFocusDmInput_CheckedChanged(object sender, EventArgs e){
|
||||
Config.FocusDmInput = checkFocusDmInput.Checked;
|
||||
}
|
||||
|
||||
private void checkOpenSearchInFirstColumn_CheckedChanged(object sender, EventArgs e){
|
||||
Config.OpenSearchInFirstColumn = checkOpenSearchInFirstColumn.Checked;
|
||||
}
|
||||
@@ -115,9 +185,72 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
BrowserProcessHandler.UpdatePrefs().ContinueWith(task => reloadColumns());
|
||||
}
|
||||
|
||||
private void trackBarZoom_ValueChanged(object sender, EventArgs e){
|
||||
if (trackBarZoom.AlignValueToTick()){
|
||||
zoomUpdateTimer.Stop();
|
||||
zoomUpdateTimer.Start();
|
||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||
}
|
||||
}
|
||||
|
||||
private void zoomUpdateTimer_Tick(object sender, EventArgs e){
|
||||
Config.ZoomLevel = trackBarZoom.Value;
|
||||
zoomUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region System Tray
|
||||
|
||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
|
||||
}
|
||||
|
||||
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Updates
|
||||
|
||||
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
|
||||
}
|
||||
|
||||
private void btnCheckUpdates_Click(object sender, EventArgs e){
|
||||
Config.DismissedUpdate = null;
|
||||
|
||||
btnCheckUpdates.Enabled = false;
|
||||
updateCheckEventId = updates.Check(true);
|
||||
}
|
||||
|
||||
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
|
||||
if (e.EventId == updateCheckEventId){
|
||||
btnCheckUpdates.Enabled = true;
|
||||
|
||||
e.Result.Handle(update => {
|
||||
if (update.VersionTag == Program.VersionTag){
|
||||
FormMessage.Information("No Updates Available", "Your version of TweetDuck is up to date.", FormMessage.OK);
|
||||
}
|
||||
}, ex => {
|
||||
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Browser Settings
|
||||
|
||||
private void checkSmoothScrolling_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableSmoothScrolling = checkSmoothScrolling.Checked;
|
||||
PromptRestart();
|
||||
}
|
||||
|
||||
private void checkTouchAdjustment_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableTouchAdjustment = checkTouchAdjustment.Checked;
|
||||
}
|
||||
|
||||
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
||||
SysConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||
}
|
||||
|
||||
private void UpdateBrowserPathSelection(){
|
||||
@@ -192,44 +325,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
private void trackBarZoom_ValueChanged(object sender, EventArgs e){
|
||||
if (trackBarZoom.AlignValueToTick()){
|
||||
zoomUpdateTimer.Stop();
|
||||
zoomUpdateTimer.Start();
|
||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
|
||||
}
|
||||
|
||||
private void btnCheckUpdates_Click(object sender, EventArgs e){
|
||||
Config.DismissedUpdate = null;
|
||||
|
||||
btnCheckUpdates.Enabled = false;
|
||||
updateCheckEventId = updates.Check(true);
|
||||
}
|
||||
|
||||
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
|
||||
if (e.EventId == updateCheckEventId){
|
||||
btnCheckUpdates.Enabled = true;
|
||||
|
||||
e.Result.Handle(update => {
|
||||
if (update.VersionTag == Program.VersionTag){
|
||||
FormMessage.Information("No Updates Available", "Your version of TweetDuck is up to date.", FormMessage.OK);
|
||||
}
|
||||
}, ex => {
|
||||
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void zoomUpdateTimer_Tick(object sender, EventArgs e){
|
||||
Config.ZoomLevel = trackBarZoom.Value;
|
||||
zoomUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
private sealed class SearchEngine{
|
||||
private string Name { get; }
|
||||
public string Url { get; }
|
||||
@@ -243,5 +338,23 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
public override bool Equals(object obj) => obj is SearchEngine other && Name == other.Name;
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Locales
|
||||
|
||||
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
}
|
||||
|
||||
private void comboBoxSpellCheckLanguage_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.SpellCheckLanguage = (comboBoxSpellCheckLanguage.SelectedItem as LocaleUtils.Item)?.Code ?? "en-US";
|
||||
}
|
||||
|
||||
private void comboBoxTranslationTarget_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.TranslationTarget = (comboBoxTranslationTarget.SelectedItem as LocaleUtils.Item)?.Code ?? "en";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
160
Core/Other/Settings/TabSettingsLocales.Designer.cs
generated
160
Core/Other/Settings/TabSettingsLocales.Designer.cs
generated
@@ -1,160 +0,0 @@
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
partial class TabSettingsLocales {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||
this.labelLocales = new System.Windows.Forms.Label();
|
||||
this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.labelSpellCheckLanguage = new System.Windows.Forms.Label();
|
||||
this.comboBoxSpellCheckLanguage = new System.Windows.Forms.ComboBox();
|
||||
this.labelTranslations = new System.Windows.Forms.Label();
|
||||
this.labelTranslationTarget = new System.Windows.Forms.Label();
|
||||
this.comboBoxTranslationTarget = new System.Windows.Forms.ComboBox();
|
||||
this.flowPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkSpellCheck
|
||||
//
|
||||
this.checkSpellCheck.AutoSize = true;
|
||||
this.checkSpellCheck.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkSpellCheck.Location = new System.Drawing.Point(6, 26);
|
||||
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkSpellCheck.Name = "checkSpellCheck";
|
||||
this.checkSpellCheck.Size = new System.Drawing.Size(125, 19);
|
||||
this.checkSpellCheck.TabIndex = 1;
|
||||
this.checkSpellCheck.Text = "Enable Spell Check";
|
||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelLocales
|
||||
//
|
||||
this.labelLocales.AutoSize = true;
|
||||
this.labelLocales.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelLocales.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelLocales.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelLocales.Name = "labelLocales";
|
||||
this.labelLocales.Size = new System.Drawing.Size(58, 20);
|
||||
this.labelLocales.TabIndex = 0;
|
||||
this.labelLocales.Text = "Locales";
|
||||
//
|
||||
// flowPanel
|
||||
//
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowPanel.Controls.Add(this.labelLocales);
|
||||
this.flowPanel.Controls.Add(this.checkSpellCheck);
|
||||
this.flowPanel.Controls.Add(this.labelSpellCheckLanguage);
|
||||
this.flowPanel.Controls.Add(this.comboBoxSpellCheckLanguage);
|
||||
this.flowPanel.Controls.Add(this.labelTranslations);
|
||||
this.flowPanel.Controls.Add(this.labelTranslationTarget);
|
||||
this.flowPanel.Controls.Add(this.comboBoxTranslationTarget);
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 201);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
//
|
||||
// labelSpellCheckLanguage
|
||||
//
|
||||
this.labelSpellCheckLanguage.AutoSize = true;
|
||||
this.labelSpellCheckLanguage.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelSpellCheckLanguage.Location = new System.Drawing.Point(3, 59);
|
||||
this.labelSpellCheckLanguage.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelSpellCheckLanguage.Name = "labelSpellCheckLanguage";
|
||||
this.labelSpellCheckLanguage.Size = new System.Drawing.Size(123, 15);
|
||||
this.labelSpellCheckLanguage.TabIndex = 2;
|
||||
this.labelSpellCheckLanguage.Text = "Spell Check Language";
|
||||
//
|
||||
// comboBoxSpellCheckLanguage
|
||||
//
|
||||
this.comboBoxSpellCheckLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSpellCheckLanguage.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxSpellCheckLanguage.FormattingEnabled = true;
|
||||
this.comboBoxSpellCheckLanguage.Location = new System.Drawing.Point(5, 77);
|
||||
this.comboBoxSpellCheckLanguage.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.comboBoxSpellCheckLanguage.Name = "comboBoxSpellCheckLanguage";
|
||||
this.comboBoxSpellCheckLanguage.Size = new System.Drawing.Size(311, 23);
|
||||
this.comboBoxSpellCheckLanguage.TabIndex = 3;
|
||||
//
|
||||
// labelTranslations
|
||||
//
|
||||
this.labelTranslations.AutoSize = true;
|
||||
this.labelTranslations.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelTranslations.Location = new System.Drawing.Point(0, 123);
|
||||
this.labelTranslations.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelTranslations.Name = "labelTranslations";
|
||||
this.labelTranslations.Size = new System.Drawing.Size(109, 20);
|
||||
this.labelTranslations.TabIndex = 4;
|
||||
this.labelTranslations.Text = "Bing Translator";
|
||||
//
|
||||
// labelTranslationTarget
|
||||
//
|
||||
this.labelTranslationTarget.AutoSize = true;
|
||||
this.labelTranslationTarget.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelTranslationTarget.Location = new System.Drawing.Point(3, 155);
|
||||
this.labelTranslationTarget.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelTranslationTarget.Name = "labelTranslationTarget";
|
||||
this.labelTranslationTarget.Size = new System.Drawing.Size(96, 15);
|
||||
this.labelTranslationTarget.TabIndex = 5;
|
||||
this.labelTranslationTarget.Text = "Target Language";
|
||||
//
|
||||
// comboBoxTranslationTarget
|
||||
//
|
||||
this.comboBoxTranslationTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxTranslationTarget.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxTranslationTarget.FormattingEnabled = true;
|
||||
this.comboBoxTranslationTarget.Location = new System.Drawing.Point(5, 173);
|
||||
this.comboBoxTranslationTarget.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.comboBoxTranslationTarget.Name = "comboBoxTranslationTarget";
|
||||
this.comboBoxTranslationTarget.Size = new System.Drawing.Size(311, 23);
|
||||
this.comboBoxTranslationTarget.TabIndex = 6;
|
||||
//
|
||||
// TabSettingsLocales
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Name = "TabSettingsLocales";
|
||||
this.Size = new System.Drawing.Size(340, 219);
|
||||
this.flowPanel.ResumeLayout(false);
|
||||
this.flowPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.CheckBox checkSpellCheck;
|
||||
private System.Windows.Forms.Label labelLocales;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanel;
|
||||
private System.Windows.Forms.ComboBox comboBoxTranslationTarget;
|
||||
private System.Windows.Forms.Label labelTranslationTarget;
|
||||
private System.Windows.Forms.ComboBox comboBoxSpellCheckLanguage;
|
||||
private System.Windows.Forms.Label labelTranslations;
|
||||
private System.Windows.Forms.Label labelSpellCheckLanguage;
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsLocales : BaseTabSettings{
|
||||
public TabSettingsLocales(){
|
||||
InitializeComponent();
|
||||
|
||||
toolTip.SetToolTip(checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||
toolTip.SetToolTip(comboBoxSpellCheckLanguage, "Language used for spell check.");
|
||||
toolTip.SetToolTip(comboBoxTranslationTarget, "Language tweets are translated into.");
|
||||
|
||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||
|
||||
try{
|
||||
foreach(LocaleUtils.Item item in LocaleUtils.SpellCheckLanguages){
|
||||
comboBoxSpellCheckLanguage.Items.Add(item);
|
||||
}
|
||||
}catch{
|
||||
comboBoxSpellCheckLanguage.Items.Add(new LocaleUtils.Item("en-US"));
|
||||
}
|
||||
|
||||
comboBoxSpellCheckLanguage.SelectedItem = new LocaleUtils.Item(Config.SpellCheckLanguage);
|
||||
|
||||
foreach(LocaleUtils.Item item in LocaleUtils.TweetDeckTranslationLocales){
|
||||
comboBoxTranslationTarget.Items.Add(item);
|
||||
}
|
||||
|
||||
comboBoxTranslationTarget.SelectedItem = new LocaleUtils.Item(Config.TranslationTarget);
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||
comboBoxSpellCheckLanguage.SelectedValueChanged += comboBoxSpellCheckLanguage_SelectedValueChanged;
|
||||
comboBoxTranslationTarget.SelectedValueChanged += comboBoxTranslationTarget_SelectedValueChanged;
|
||||
}
|
||||
|
||||
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
}
|
||||
|
||||
private void comboBoxSpellCheckLanguage_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.SpellCheckLanguage = (comboBoxSpellCheckLanguage.SelectedItem as LocaleUtils.Item)?.Code ?? "en-US";
|
||||
PromptRestart();
|
||||
}
|
||||
|
||||
private void comboBoxTranslationTarget_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.TranslationTarget = (comboBoxTranslationTarget.SelectedItem as LocaleUtils.Item)?.Code ?? "en";
|
||||
}
|
||||
}
|
||||
}
|
300
Core/Other/Settings/TabSettingsNotifications.Designer.cs
generated
300
Core/Other/Settings/TabSettingsNotifications.Designer.cs
generated
@@ -64,8 +64,10 @@
|
||||
this.labelSize = new System.Windows.Forms.Label();
|
||||
this.panelSize = new System.Windows.Forms.Panel();
|
||||
this.durationUpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flowPanelLeft = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panelScrollSpeed = new System.Windows.Forms.Panel();
|
||||
this.flowPanelRight = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panelSeparator = new System.Windows.Forms.Panel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
||||
this.tableLayoutDurationButtons.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).BeginInit();
|
||||
@@ -74,13 +76,14 @@
|
||||
this.panelLocation.SuspendLayout();
|
||||
this.panelTimer.SuspendLayout();
|
||||
this.panelSize.SuspendLayout();
|
||||
this.flowPanel.SuspendLayout();
|
||||
this.flowPanelLeft.SuspendLayout();
|
||||
this.panelScrollSpeed.SuspendLayout();
|
||||
this.flowPanelRight.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelEdgeDistanceValue
|
||||
//
|
||||
this.labelEdgeDistanceValue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelEdgeDistanceValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelEdgeDistanceValue.Location = new System.Drawing.Point(145, 4);
|
||||
this.labelEdgeDistanceValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue";
|
||||
@@ -92,41 +95,41 @@
|
||||
// labelDisplay
|
||||
//
|
||||
this.labelDisplay.AutoSize = true;
|
||||
this.labelDisplay.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDisplay.Location = new System.Drawing.Point(3, 465);
|
||||
this.labelDisplay.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelDisplay.Location = new System.Drawing.Point(3, 83);
|
||||
this.labelDisplay.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelDisplay.Name = "labelDisplay";
|
||||
this.labelDisplay.Size = new System.Drawing.Size(45, 15);
|
||||
this.labelDisplay.TabIndex = 15;
|
||||
this.labelDisplay.Size = new System.Drawing.Size(46, 15);
|
||||
this.labelDisplay.TabIndex = 2;
|
||||
this.labelDisplay.Text = "Display";
|
||||
//
|
||||
// comboBoxDisplay
|
||||
//
|
||||
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxDisplay.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxDisplay.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxDisplay.FormattingEnabled = true;
|
||||
this.comboBoxDisplay.Location = new System.Drawing.Point(5, 483);
|
||||
this.comboBoxDisplay.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.comboBoxDisplay.Location = new System.Drawing.Point(5, 102);
|
||||
this.comboBoxDisplay.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
||||
this.comboBoxDisplay.Size = new System.Drawing.Size(144, 23);
|
||||
this.comboBoxDisplay.TabIndex = 16;
|
||||
this.comboBoxDisplay.TabIndex = 3;
|
||||
//
|
||||
// labelEdgeDistance
|
||||
//
|
||||
this.labelEdgeDistance.AutoSize = true;
|
||||
this.labelEdgeDistance.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelEdgeDistance.Location = new System.Drawing.Point(3, 521);
|
||||
this.labelEdgeDistance.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelEdgeDistance.Location = new System.Drawing.Point(3, 140);
|
||||
this.labelEdgeDistance.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelEdgeDistance.Name = "labelEdgeDistance";
|
||||
this.labelEdgeDistance.Size = new System.Drawing.Size(112, 15);
|
||||
this.labelEdgeDistance.TabIndex = 17;
|
||||
this.labelEdgeDistance.Size = new System.Drawing.Size(113, 15);
|
||||
this.labelEdgeDistance.TabIndex = 4;
|
||||
this.labelEdgeDistance.Text = "Distance From Edge";
|
||||
//
|
||||
// radioLocCustom
|
||||
//
|
||||
this.radioLocCustom.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioLocCustom.Location = new System.Drawing.Point(205, 4);
|
||||
this.radioLocCustom.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioLocCustom.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioLocCustom.Location = new System.Drawing.Point(218, 4);
|
||||
this.radioLocCustom.Margin = new System.Windows.Forms.Padding(10, 4, 3, 3);
|
||||
this.radioLocCustom.Name = "radioLocCustom";
|
||||
this.radioLocCustom.Size = new System.Drawing.Size(70, 43);
|
||||
this.radioLocCustom.TabIndex = 4;
|
||||
@@ -136,11 +139,11 @@
|
||||
//
|
||||
// radioLocBR
|
||||
//
|
||||
this.radioLocBR.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioLocBR.Location = new System.Drawing.Point(105, 28);
|
||||
this.radioLocBR.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioLocBR.Location = new System.Drawing.Point(109, 28);
|
||||
this.radioLocBR.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioLocBR.Name = "radioLocBR";
|
||||
this.radioLocBR.Size = new System.Drawing.Size(92, 19);
|
||||
this.radioLocBR.Size = new System.Drawing.Size(96, 19);
|
||||
this.radioLocBR.TabIndex = 3;
|
||||
this.radioLocBR.TabStop = true;
|
||||
this.radioLocBR.Text = "Bottom Right";
|
||||
@@ -148,11 +151,11 @@
|
||||
//
|
||||
// radioLocBL
|
||||
//
|
||||
this.radioLocBL.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioLocBL.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioLocBL.Location = new System.Drawing.Point(5, 28);
|
||||
this.radioLocBL.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioLocBL.Name = "radioLocBL";
|
||||
this.radioLocBL.Size = new System.Drawing.Size(92, 19);
|
||||
this.radioLocBL.Size = new System.Drawing.Size(96, 19);
|
||||
this.radioLocBL.TabIndex = 2;
|
||||
this.radioLocBL.TabStop = true;
|
||||
this.radioLocBL.Text = "Bottom Left";
|
||||
@@ -160,11 +163,11 @@
|
||||
//
|
||||
// radioLocTR
|
||||
//
|
||||
this.radioLocTR.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioLocTR.Location = new System.Drawing.Point(105, 4);
|
||||
this.radioLocTR.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioLocTR.Location = new System.Drawing.Point(109, 4);
|
||||
this.radioLocTR.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioLocTR.Name = "radioLocTR";
|
||||
this.radioLocTR.Size = new System.Drawing.Size(92, 19);
|
||||
this.radioLocTR.Size = new System.Drawing.Size(96, 19);
|
||||
this.radioLocTR.TabIndex = 1;
|
||||
this.radioLocTR.TabStop = true;
|
||||
this.radioLocTR.Text = "Top Right";
|
||||
@@ -172,11 +175,11 @@
|
||||
//
|
||||
// radioLocTL
|
||||
//
|
||||
this.radioLocTL.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioLocTL.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioLocTL.Location = new System.Drawing.Point(5, 4);
|
||||
this.radioLocTL.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioLocTL.Name = "radioLocTL";
|
||||
this.radioLocTL.Size = new System.Drawing.Size(92, 19);
|
||||
this.radioLocTL.Size = new System.Drawing.Size(96, 19);
|
||||
this.radioLocTL.TabIndex = 0;
|
||||
this.radioLocTL.TabStop = true;
|
||||
this.radioLocTL.Text = "Top Left";
|
||||
@@ -205,7 +208,7 @@
|
||||
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationMedium, 0, 0);
|
||||
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationLong, 1, 0);
|
||||
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationShort, 0, 0);
|
||||
this.tableLayoutDurationButtons.Location = new System.Drawing.Point(3, 332);
|
||||
this.tableLayoutDurationButtons.Location = new System.Drawing.Point(3, 353);
|
||||
this.tableLayoutDurationButtons.Name = "tableLayoutDurationButtons";
|
||||
this.tableLayoutDurationButtons.RowCount = 1;
|
||||
this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
@@ -219,7 +222,7 @@
|
||||
this.btnDurationMedium.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.btnDurationMedium.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White;
|
||||
this.btnDurationMedium.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnDurationMedium.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnDurationMedium.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnDurationMedium.Location = new System.Drawing.Point(58, 1);
|
||||
this.btnDurationMedium.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.btnDurationMedium.Name = "btnDurationMedium";
|
||||
@@ -235,7 +238,7 @@
|
||||
this.btnDurationLong.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.btnDurationLong.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White;
|
||||
this.btnDurationLong.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnDurationLong.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnDurationLong.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnDurationLong.Location = new System.Drawing.Point(122, 1);
|
||||
this.btnDurationLong.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.btnDurationLong.Name = "btnDurationLong";
|
||||
@@ -251,7 +254,7 @@
|
||||
this.btnDurationShort.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.btnDurationShort.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White;
|
||||
this.btnDurationShort.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnDurationShort.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnDurationShort.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnDurationShort.Location = new System.Drawing.Point(1, 1);
|
||||
this.btnDurationShort.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.btnDurationShort.Name = "btnDurationShort";
|
||||
@@ -263,7 +266,7 @@
|
||||
// labelDurationValue
|
||||
//
|
||||
this.labelDurationValue.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelDurationValue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDurationValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelDurationValue.Location = new System.Drawing.Point(147, 4);
|
||||
this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelDurationValue.Name = "labelDurationValue";
|
||||
@@ -287,7 +290,7 @@
|
||||
// checkSkipOnLinkClick
|
||||
//
|
||||
this.checkSkipOnLinkClick.AutoSize = true;
|
||||
this.checkSkipOnLinkClick.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkSkipOnLinkClick.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkSkipOnLinkClick.Location = new System.Drawing.Point(6, 74);
|
||||
this.checkSkipOnLinkClick.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkSkipOnLinkClick.Name = "checkSkipOnLinkClick";
|
||||
@@ -299,7 +302,7 @@
|
||||
// checkColumnName
|
||||
//
|
||||
this.checkColumnName.AutoSize = true;
|
||||
this.checkColumnName.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkColumnName.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkColumnName.Location = new System.Drawing.Point(6, 26);
|
||||
this.checkColumnName.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkColumnName.Name = "checkColumnName";
|
||||
@@ -311,21 +314,21 @@
|
||||
// labelIdlePause
|
||||
//
|
||||
this.labelIdlePause.AutoSize = true;
|
||||
this.labelIdlePause.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelIdlePause.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelIdlePause.Location = new System.Drawing.Point(3, 131);
|
||||
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelIdlePause.Name = "labelIdlePause";
|
||||
this.labelIdlePause.Size = new System.Drawing.Size(94, 15);
|
||||
this.labelIdlePause.Size = new System.Drawing.Size(95, 15);
|
||||
this.labelIdlePause.TabIndex = 5;
|
||||
this.labelIdlePause.Text = "Pause When Idle";
|
||||
//
|
||||
// comboBoxIdlePause
|
||||
//
|
||||
this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxIdlePause.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxIdlePause.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.comboBoxIdlePause.FormattingEnabled = true;
|
||||
this.comboBoxIdlePause.Location = new System.Drawing.Point(5, 149);
|
||||
this.comboBoxIdlePause.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||
this.comboBoxIdlePause.Location = new System.Drawing.Point(5, 150);
|
||||
this.comboBoxIdlePause.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.comboBoxIdlePause.Name = "comboBoxIdlePause";
|
||||
this.comboBoxIdlePause.Size = new System.Drawing.Size(144, 23);
|
||||
this.comboBoxIdlePause.TabIndex = 6;
|
||||
@@ -333,7 +336,7 @@
|
||||
// checkNonIntrusive
|
||||
//
|
||||
this.checkNonIntrusive.AutoSize = true;
|
||||
this.checkNonIntrusive.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkNonIntrusive.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkNonIntrusive.Location = new System.Drawing.Point(6, 98);
|
||||
this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkNonIntrusive.Name = "checkNonIntrusive";
|
||||
@@ -345,8 +348,8 @@
|
||||
// checkTimerCountDown
|
||||
//
|
||||
this.checkTimerCountDown.AutoSize = true;
|
||||
this.checkTimerCountDown.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 245);
|
||||
this.checkTimerCountDown.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 266);
|
||||
this.checkTimerCountDown.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkTimerCountDown.Name = "checkTimerCountDown";
|
||||
this.checkTimerCountDown.Size = new System.Drawing.Size(132, 19);
|
||||
@@ -357,8 +360,8 @@
|
||||
// checkNotificationTimer
|
||||
//
|
||||
this.checkNotificationTimer.AutoSize = true;
|
||||
this.checkNotificationTimer.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 221);
|
||||
this.checkNotificationTimer.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 242);
|
||||
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
||||
this.checkNotificationTimer.Size = new System.Drawing.Size(164, 19);
|
||||
@@ -368,7 +371,7 @@
|
||||
//
|
||||
// radioSizeAuto
|
||||
//
|
||||
this.radioSizeAuto.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioSizeAuto.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioSizeAuto.Location = new System.Drawing.Point(5, 4);
|
||||
this.radioSizeAuto.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioSizeAuto.Name = "radioSizeAuto";
|
||||
@@ -380,7 +383,7 @@
|
||||
//
|
||||
// radioSizeCustom
|
||||
//
|
||||
this.radioSizeCustom.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.radioSizeCustom.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.radioSizeCustom.Location = new System.Drawing.Point(105, 4);
|
||||
this.radioSizeCustom.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||
this.radioSizeCustom.Name = "radioSizeCustom";
|
||||
@@ -393,29 +396,28 @@
|
||||
// labelGeneral
|
||||
//
|
||||
this.labelGeneral.AutoSize = true;
|
||||
this.labelGeneral.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelGeneral.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelGeneral.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelGeneral.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelGeneral.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelGeneral.Name = "labelGeneral";
|
||||
this.labelGeneral.Size = new System.Drawing.Size(60, 20);
|
||||
this.labelGeneral.Size = new System.Drawing.Size(69, 19);
|
||||
this.labelGeneral.TabIndex = 0;
|
||||
this.labelGeneral.Text = "General";
|
||||
this.labelGeneral.Text = "GENERAL";
|
||||
//
|
||||
// panelEdgeDistance
|
||||
//
|
||||
this.panelEdgeDistance.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelEdgeDistance.Controls.Add(this.trackBarEdgeDistance);
|
||||
this.panelEdgeDistance.Controls.Add(this.labelEdgeDistanceValue);
|
||||
this.panelEdgeDistance.Location = new System.Drawing.Point(0, 536);
|
||||
this.panelEdgeDistance.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelEdgeDistance.Location = new System.Drawing.Point(0, 156);
|
||||
this.panelEdgeDistance.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelEdgeDistance.Name = "panelEdgeDistance";
|
||||
this.panelEdgeDistance.Size = new System.Drawing.Size(322, 36);
|
||||
this.panelEdgeDistance.TabIndex = 18;
|
||||
this.panelEdgeDistance.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelEdgeDistance.TabIndex = 5;
|
||||
//
|
||||
// checkMediaPreviews
|
||||
//
|
||||
this.checkMediaPreviews.AutoSize = true;
|
||||
this.checkMediaPreviews.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkMediaPreviews.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.checkMediaPreviews.Location = new System.Drawing.Point(6, 50);
|
||||
this.checkMediaPreviews.Margin = new System.Windows.Forms.Padding(6, 3, 3, 2);
|
||||
this.checkMediaPreviews.Name = "checkMediaPreviews";
|
||||
@@ -426,7 +428,7 @@
|
||||
//
|
||||
// labelScrollSpeedValue
|
||||
//
|
||||
this.labelScrollSpeedValue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelScrollSpeedValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelScrollSpeedValue.Location = new System.Drawing.Point(145, 4);
|
||||
this.labelScrollSpeedValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelScrollSpeedValue.Name = "labelScrollSpeedValue";
|
||||
@@ -452,153 +454,171 @@
|
||||
// labelScrollSpeed
|
||||
//
|
||||
this.labelScrollSpeed.AutoSize = true;
|
||||
this.labelScrollSpeed.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelScrollSpeed.Location = new System.Drawing.Point(3, 651);
|
||||
this.labelScrollSpeed.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelScrollSpeed.Location = new System.Drawing.Point(3, 275);
|
||||
this.labelScrollSpeed.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelScrollSpeed.Name = "labelScrollSpeed";
|
||||
this.labelScrollSpeed.Size = new System.Drawing.Size(71, 15);
|
||||
this.labelScrollSpeed.TabIndex = 21;
|
||||
this.labelScrollSpeed.Size = new System.Drawing.Size(73, 15);
|
||||
this.labelScrollSpeed.TabIndex = 8;
|
||||
this.labelScrollSpeed.Text = "Scroll Speed";
|
||||
//
|
||||
// labelLocation
|
||||
//
|
||||
this.labelLocation.AutoSize = true;
|
||||
this.labelLocation.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelLocation.Location = new System.Drawing.Point(0, 382);
|
||||
this.labelLocation.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelLocation.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelLocation.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelLocation.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelLocation.Name = "labelLocation";
|
||||
this.labelLocation.Size = new System.Drawing.Size(66, 20);
|
||||
this.labelLocation.TabIndex = 13;
|
||||
this.labelLocation.Text = "Location";
|
||||
this.labelLocation.Size = new System.Drawing.Size(79, 19);
|
||||
this.labelLocation.TabIndex = 0;
|
||||
this.labelLocation.Text = "LOCATION";
|
||||
//
|
||||
// panelLocation
|
||||
//
|
||||
this.panelLocation.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelLocation.Controls.Add(this.radioLocTL);
|
||||
this.panelLocation.Controls.Add(this.radioLocTR);
|
||||
this.panelLocation.Controls.Add(this.radioLocBL);
|
||||
this.panelLocation.Controls.Add(this.radioLocCustom);
|
||||
this.panelLocation.Controls.Add(this.radioLocBR);
|
||||
this.panelLocation.Location = new System.Drawing.Point(0, 402);
|
||||
this.panelLocation.Location = new System.Drawing.Point(0, 20);
|
||||
this.panelLocation.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelLocation.Name = "panelLocation";
|
||||
this.panelLocation.Size = new System.Drawing.Size(322, 51);
|
||||
this.panelLocation.TabIndex = 14;
|
||||
this.panelLocation.Size = new System.Drawing.Size(300, 51);
|
||||
this.panelLocation.TabIndex = 1;
|
||||
//
|
||||
// panelTimer
|
||||
//
|
||||
this.panelTimer.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelTimer.Controls.Add(this.labelDurationValue);
|
||||
this.panelTimer.Controls.Add(this.trackBarDuration);
|
||||
this.panelTimer.Location = new System.Drawing.Point(0, 293);
|
||||
this.panelTimer.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelTimer.Location = new System.Drawing.Point(0, 315);
|
||||
this.panelTimer.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelTimer.Name = "panelTimer";
|
||||
this.panelTimer.Size = new System.Drawing.Size(322, 36);
|
||||
this.panelTimer.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelTimer.TabIndex = 11;
|
||||
//
|
||||
// labelDuration
|
||||
//
|
||||
this.labelDuration.AutoSize = true;
|
||||
this.labelDuration.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelDuration.Location = new System.Drawing.Point(3, 278);
|
||||
this.labelDuration.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelDuration.Location = new System.Drawing.Point(3, 299);
|
||||
this.labelDuration.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelDuration.Name = "labelDuration";
|
||||
this.labelDuration.Size = new System.Drawing.Size(53, 15);
|
||||
this.labelDuration.Size = new System.Drawing.Size(54, 15);
|
||||
this.labelDuration.TabIndex = 10;
|
||||
this.labelDuration.Text = "Duration";
|
||||
//
|
||||
// labelTimer
|
||||
//
|
||||
this.labelTimer.AutoSize = true;
|
||||
this.labelTimer.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelTimer.Location = new System.Drawing.Point(0, 195);
|
||||
this.labelTimer.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelTimer.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelTimer.Location = new System.Drawing.Point(0, 216);
|
||||
this.labelTimer.Margin = new System.Windows.Forms.Padding(0, 40, 0, 1);
|
||||
this.labelTimer.Name = "labelTimer";
|
||||
this.labelTimer.Size = new System.Drawing.Size(47, 20);
|
||||
this.labelTimer.Size = new System.Drawing.Size(50, 19);
|
||||
this.labelTimer.TabIndex = 7;
|
||||
this.labelTimer.Text = "Timer";
|
||||
this.labelTimer.Text = "TIMER";
|
||||
//
|
||||
// labelSize
|
||||
//
|
||||
this.labelSize.AutoSize = true;
|
||||
this.labelSize.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelSize.Location = new System.Drawing.Point(0, 592);
|
||||
this.labelSize.Margin = new System.Windows.Forms.Padding(0, 20, 0, 0);
|
||||
this.labelSize.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelSize.Location = new System.Drawing.Point(0, 216);
|
||||
this.labelSize.Margin = new System.Windows.Forms.Padding(0, 25, 0, 1);
|
||||
this.labelSize.Name = "labelSize";
|
||||
this.labelSize.Size = new System.Drawing.Size(36, 20);
|
||||
this.labelSize.TabIndex = 19;
|
||||
this.labelSize.Text = "Size";
|
||||
this.labelSize.Size = new System.Drawing.Size(36, 19);
|
||||
this.labelSize.TabIndex = 6;
|
||||
this.labelSize.Text = "SIZE";
|
||||
//
|
||||
// panelSize
|
||||
//
|
||||
this.panelSize.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelSize.Controls.Add(this.radioSizeCustom);
|
||||
this.panelSize.Controls.Add(this.radioSizeAuto);
|
||||
this.panelSize.Location = new System.Drawing.Point(0, 612);
|
||||
this.panelSize.Location = new System.Drawing.Point(0, 236);
|
||||
this.panelSize.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelSize.Name = "panelSize";
|
||||
this.panelSize.Size = new System.Drawing.Size(322, 27);
|
||||
this.panelSize.TabIndex = 20;
|
||||
this.panelSize.Size = new System.Drawing.Size(300, 27);
|
||||
this.panelSize.TabIndex = 7;
|
||||
//
|
||||
// durationUpdateTimer
|
||||
//
|
||||
this.durationUpdateTimer.Interval = 200;
|
||||
this.durationUpdateTimer.Tick += new System.EventHandler(this.durationUpdateTimer_Tick);
|
||||
//
|
||||
// flowPanel
|
||||
// flowPanelLeft
|
||||
//
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowPanel.Controls.Add(this.labelGeneral);
|
||||
this.flowPanel.Controls.Add(this.checkColumnName);
|
||||
this.flowPanel.Controls.Add(this.checkMediaPreviews);
|
||||
this.flowPanel.Controls.Add(this.checkSkipOnLinkClick);
|
||||
this.flowPanel.Controls.Add(this.checkNonIntrusive);
|
||||
this.flowPanel.Controls.Add(this.labelIdlePause);
|
||||
this.flowPanel.Controls.Add(this.comboBoxIdlePause);
|
||||
this.flowPanel.Controls.Add(this.labelTimer);
|
||||
this.flowPanel.Controls.Add(this.checkNotificationTimer);
|
||||
this.flowPanel.Controls.Add(this.checkTimerCountDown);
|
||||
this.flowPanel.Controls.Add(this.labelDuration);
|
||||
this.flowPanel.Controls.Add(this.panelTimer);
|
||||
this.flowPanel.Controls.Add(this.tableLayoutDurationButtons);
|
||||
this.flowPanel.Controls.Add(this.labelLocation);
|
||||
this.flowPanel.Controls.Add(this.panelLocation);
|
||||
this.flowPanel.Controls.Add(this.labelDisplay);
|
||||
this.flowPanel.Controls.Add(this.comboBoxDisplay);
|
||||
this.flowPanel.Controls.Add(this.labelEdgeDistance);
|
||||
this.flowPanel.Controls.Add(this.panelEdgeDistance);
|
||||
this.flowPanel.Controls.Add(this.labelSize);
|
||||
this.flowPanel.Controls.Add(this.panelSize);
|
||||
this.flowPanel.Controls.Add(this.labelScrollSpeed);
|
||||
this.flowPanel.Controls.Add(this.panelScrollSpeed);
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 698);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
this.flowPanelLeft.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanelLeft.Controls.Add(this.labelGeneral);
|
||||
this.flowPanelLeft.Controls.Add(this.checkColumnName);
|
||||
this.flowPanelLeft.Controls.Add(this.checkMediaPreviews);
|
||||
this.flowPanelLeft.Controls.Add(this.checkSkipOnLinkClick);
|
||||
this.flowPanelLeft.Controls.Add(this.checkNonIntrusive);
|
||||
this.flowPanelLeft.Controls.Add(this.labelIdlePause);
|
||||
this.flowPanelLeft.Controls.Add(this.comboBoxIdlePause);
|
||||
this.flowPanelLeft.Controls.Add(this.labelTimer);
|
||||
this.flowPanelLeft.Controls.Add(this.checkNotificationTimer);
|
||||
this.flowPanelLeft.Controls.Add(this.checkTimerCountDown);
|
||||
this.flowPanelLeft.Controls.Add(this.labelDuration);
|
||||
this.flowPanelLeft.Controls.Add(this.panelTimer);
|
||||
this.flowPanelLeft.Controls.Add(this.tableLayoutDurationButtons);
|
||||
this.flowPanelLeft.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanelLeft.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanelLeft.Name = "flowPanelLeft";
|
||||
this.flowPanelLeft.Size = new System.Drawing.Size(300, 461);
|
||||
this.flowPanelLeft.TabIndex = 0;
|
||||
this.flowPanelLeft.WrapContents = false;
|
||||
//
|
||||
// panelScrollSpeed
|
||||
//
|
||||
this.panelScrollSpeed.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelScrollSpeed.Controls.Add(this.trackBarScrollSpeed);
|
||||
this.panelScrollSpeed.Controls.Add(this.labelScrollSpeedValue);
|
||||
this.panelScrollSpeed.Location = new System.Drawing.Point(0, 666);
|
||||
this.panelScrollSpeed.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelScrollSpeed.Location = new System.Drawing.Point(0, 291);
|
||||
this.panelScrollSpeed.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelScrollSpeed.Name = "panelScrollSpeed";
|
||||
this.panelScrollSpeed.Size = new System.Drawing.Size(322, 36);
|
||||
this.panelScrollSpeed.TabIndex = 22;
|
||||
this.panelScrollSpeed.Size = new System.Drawing.Size(300, 35);
|
||||
this.panelScrollSpeed.TabIndex = 9;
|
||||
//
|
||||
// flowPanelRight
|
||||
//
|
||||
this.flowPanelRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanelRight.Controls.Add(this.labelLocation);
|
||||
this.flowPanelRight.Controls.Add(this.panelLocation);
|
||||
this.flowPanelRight.Controls.Add(this.labelDisplay);
|
||||
this.flowPanelRight.Controls.Add(this.comboBoxDisplay);
|
||||
this.flowPanelRight.Controls.Add(this.labelEdgeDistance);
|
||||
this.flowPanelRight.Controls.Add(this.panelEdgeDistance);
|
||||
this.flowPanelRight.Controls.Add(this.labelSize);
|
||||
this.flowPanelRight.Controls.Add(this.panelSize);
|
||||
this.flowPanelRight.Controls.Add(this.labelScrollSpeed);
|
||||
this.flowPanelRight.Controls.Add(this.panelScrollSpeed);
|
||||
this.flowPanelRight.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanelRight.Location = new System.Drawing.Point(322, 9);
|
||||
this.flowPanelRight.Name = "flowPanelRight";
|
||||
this.flowPanelRight.Size = new System.Drawing.Size(300, 461);
|
||||
this.flowPanelRight.TabIndex = 1;
|
||||
this.flowPanelRight.WrapContents = false;
|
||||
//
|
||||
// panelSeparator
|
||||
//
|
||||
this.panelSeparator.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.panelSeparator.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(200)))));
|
||||
this.panelSeparator.Location = new System.Drawing.Point(312, 0);
|
||||
this.panelSeparator.Margin = new System.Windows.Forms.Padding(0, 0, 6, 0);
|
||||
this.panelSeparator.Name = "panelSeparator";
|
||||
this.panelSeparator.Size = new System.Drawing.Size(1, 480);
|
||||
this.panelSeparator.TabIndex = 2;
|
||||
//
|
||||
// TabSettingsNotifications
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Controls.Add(this.flowPanelRight);
|
||||
this.Controls.Add(this.flowPanelLeft);
|
||||
this.Controls.Add(this.panelSeparator);
|
||||
this.Name = "TabSettingsNotifications";
|
||||
this.Size = new System.Drawing.Size(340, 717);
|
||||
this.Size = new System.Drawing.Size(631, 480);
|
||||
this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged);
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
|
||||
this.tableLayoutDurationButtons.ResumeLayout(false);
|
||||
@@ -608,9 +628,11 @@
|
||||
this.panelLocation.ResumeLayout(false);
|
||||
this.panelTimer.ResumeLayout(false);
|
||||
this.panelSize.ResumeLayout(false);
|
||||
this.flowPanel.ResumeLayout(false);
|
||||
this.flowPanel.PerformLayout();
|
||||
this.flowPanelLeft.ResumeLayout(false);
|
||||
this.flowPanelLeft.PerformLayout();
|
||||
this.panelScrollSpeed.ResumeLayout(false);
|
||||
this.flowPanelRight.ResumeLayout(false);
|
||||
this.flowPanelRight.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -656,7 +678,9 @@
|
||||
private System.Windows.Forms.RadioButton radioSizeCustom;
|
||||
private System.Windows.Forms.RadioButton radioSizeAuto;
|
||||
private System.Windows.Forms.CheckBox checkMediaPreviews;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanel;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelLeft;
|
||||
private System.Windows.Forms.Panel panelScrollSpeed;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanelRight;
|
||||
private System.Windows.Forms.Panel panelSeparator;
|
||||
}
|
||||
}
|
||||
|
@@ -26,22 +26,16 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
this.notification.Activated += notification_Activated;
|
||||
this.notification.Show();
|
||||
|
||||
Disposed += (sender, args) => this.notification.Dispose();
|
||||
|
||||
// general
|
||||
|
||||
toolTip.SetToolTip(checkColumnName, "Shows column name each notification originated\r\nfrom in the notification window title.");
|
||||
toolTip.SetToolTip(checkMediaPreviews, "Shows image and video thumbnails in the notification window.");
|
||||
toolTip.SetToolTip(checkSkipOnLinkClick, "Skips current notification when a link\r\ninside the notification is clicked.");
|
||||
toolTip.SetToolTip(checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be delayed until the cursor moves away to prevent accidental clicks.");
|
||||
|
||||
toolTip.SetToolTip(comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time.");
|
||||
|
||||
toolTip.SetToolTip(checkTimerCountDown, "The notification timer counts down instead of up.");
|
||||
toolTip.SetToolTip(labelDurationValue, "Milliseconds per character.");
|
||||
toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue));
|
||||
|
||||
toolTip.SetToolTip(radioLocCustom, "Drag the example notification window to the desired location.");
|
||||
|
||||
toolTip.SetToolTip(radioSizeAuto, "Notification size is based on the font size and browser zoom level.");
|
||||
toolTip.SetToolTip(radioSizeCustom, "Resize the example notification window to the desired size.");
|
||||
|
||||
checkColumnName.Checked = Config.DisplayNotificationColumn;
|
||||
checkMediaPreviews.Checked = Config.NotificationMediaPreviews;
|
||||
checkSkipOnLinkClick.Checked = Config.NotificationSkipOnLinkClick;
|
||||
@@ -54,6 +48,12 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
comboBoxIdlePause.Items.Add("5 minutes");
|
||||
comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds));
|
||||
|
||||
// timer
|
||||
|
||||
toolTip.SetToolTip(checkTimerCountDown, "The notification timer counts down instead of up.");
|
||||
toolTip.SetToolTip(labelDurationValue, "Milliseconds per character.");
|
||||
toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue));
|
||||
|
||||
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
|
||||
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
||||
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
|
||||
@@ -61,6 +61,10 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||
|
||||
// location
|
||||
|
||||
toolTip.SetToolTip(radioLocCustom, "Drag the example notification window to the desired location.");
|
||||
|
||||
switch(Config.NotificationPosition){
|
||||
case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break;
|
||||
case TweetNotification.Position.TopRight: radioLocTR.Checked = true; break;
|
||||
@@ -81,6 +85,11 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
|
||||
|
||||
// size
|
||||
|
||||
toolTip.SetToolTip(radioSizeAuto, "Notification size is based on the font size and browser zoom level.");
|
||||
toolTip.SetToolTip(radioSizeCustom, "Resize the example notification window to the desired size.");
|
||||
|
||||
switch(Config.NotificationSize){
|
||||
case TweetNotification.Size.Auto: radioSizeAuto.Checked = true; break;
|
||||
case TweetNotification.Size.Custom: radioSizeCustom.Checked = true; break;
|
||||
@@ -88,8 +97,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
trackBarScrollSpeed.SetValueSafe(Config.NotificationScrollSpeed);
|
||||
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value+"%";
|
||||
|
||||
Disposed += (sender, args) => this.notification.Dispose();
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
@@ -97,12 +104,10 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
checkMediaPreviews.CheckedChanged += checkMediaPreviews_CheckedChanged;
|
||||
checkSkipOnLinkClick.CheckedChanged += checkSkipOnLinkClick_CheckedChanged;
|
||||
checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged;
|
||||
|
||||
comboBoxIdlePause.SelectedValueChanged += comboBoxIdlePause_SelectedValueChanged;
|
||||
|
||||
checkNotificationTimer.CheckedChanged += checkNotificationTimer_CheckedChanged;
|
||||
checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged;
|
||||
|
||||
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
|
||||
btnDurationShort.Click += btnDurationShort_Click;
|
||||
btnDurationMedium.Click += btnDurationMedium_Click;
|
||||
@@ -113,13 +118,11 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
radioLocBL.CheckedChanged += radioLoc_CheckedChanged;
|
||||
radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
|
||||
radioLocCustom.Click += radioLocCustom_Click;
|
||||
|
||||
comboBoxDisplay.SelectedValueChanged += comboBoxDisplay_SelectedValueChanged;
|
||||
trackBarEdgeDistance.ValueChanged += trackBarEdgeDistance_ValueChanged;
|
||||
|
||||
radioSizeAuto.CheckedChanged += radioSize_CheckedChanged;
|
||||
radioSizeCustom.Click += radioSizeCustom_Click;
|
||||
|
||||
trackBarScrollSpeed.ValueChanged += trackBarScrollSpeed_ValueChanged;
|
||||
}
|
||||
|
||||
@@ -150,6 +153,71 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
#region General
|
||||
|
||||
private void checkColumnName_CheckedChanged(object sender, EventArgs e){
|
||||
Config.DisplayNotificationColumn = checkColumnName.Checked;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void checkMediaPreviews_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationMediaPreviews = checkMediaPreviews.Checked;
|
||||
}
|
||||
|
||||
private void checkSkipOnLinkClick_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationSkipOnLinkClick = checkSkipOnLinkClick.Checked;
|
||||
}
|
||||
|
||||
private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked;
|
||||
}
|
||||
|
||||
private void comboBoxIdlePause_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.NotificationIdlePauseSeconds = IdlePauseSeconds[comboBoxIdlePause.SelectedIndex];
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Timer
|
||||
|
||||
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
|
||||
Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
|
||||
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
||||
notification.ShowExampleNotification(true);
|
||||
}
|
||||
|
||||
private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationTimerCountDown = checkTimerCountDown.Checked;
|
||||
notification.ShowExampleNotification(true);
|
||||
}
|
||||
|
||||
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
|
||||
durationUpdateTimer.Stop();
|
||||
durationUpdateTimer.Start();
|
||||
|
||||
Config.NotificationDurationValue = trackBarDuration.Value;
|
||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||
}
|
||||
|
||||
private void btnDurationShort_Click(object sender, EventArgs e){
|
||||
trackBarDuration.Value = 15;
|
||||
}
|
||||
|
||||
private void btnDurationMedium_Click(object sender, EventArgs e){
|
||||
trackBarDuration.Value = 25;
|
||||
}
|
||||
|
||||
private void btnDurationLong_Click(object sender, EventArgs e){
|
||||
trackBarDuration.Value = 35;
|
||||
}
|
||||
|
||||
private void durationUpdateTimer_Tick(object sender, EventArgs e){
|
||||
notification.ShowExampleNotification(true);
|
||||
durationUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Location
|
||||
|
||||
private void radioLoc_CheckedChanged(object sender, EventArgs e){
|
||||
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
|
||||
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||
@@ -181,6 +249,20 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
|
||||
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Size
|
||||
|
||||
private void radioSize_CheckedChanged(object sender, EventArgs e){
|
||||
if (radioSizeAuto.Checked){
|
||||
Config.NotificationSize = TweetNotification.Size.Auto;
|
||||
@@ -198,58 +280,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
|
||||
durationUpdateTimer.Stop();
|
||||
durationUpdateTimer.Start();
|
||||
|
||||
Config.NotificationDurationValue = trackBarDuration.Value;
|
||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||
}
|
||||
|
||||
private void btnDurationShort_Click(object sender, EventArgs e){
|
||||
trackBarDuration.Value = 15;
|
||||
}
|
||||
|
||||
private void btnDurationMedium_Click(object sender, EventArgs e){
|
||||
trackBarDuration.Value = 25;
|
||||
}
|
||||
|
||||
private void btnDurationLong_Click(object sender, EventArgs e){
|
||||
trackBarDuration.Value = 35;
|
||||
}
|
||||
|
||||
private void checkColumnName_CheckedChanged(object sender, EventArgs e){
|
||||
Config.DisplayNotificationColumn = checkColumnName.Checked;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
|
||||
Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
|
||||
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
||||
notification.ShowExampleNotification(true);
|
||||
}
|
||||
|
||||
private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationTimerCountDown = checkTimerCountDown.Checked;
|
||||
notification.ShowExampleNotification(true);
|
||||
}
|
||||
|
||||
private void checkMediaPreviews_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationMediaPreviews = checkMediaPreviews.Checked;
|
||||
}
|
||||
|
||||
private void checkSkipOnLinkClick_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationSkipOnLinkClick = checkSkipOnLinkClick.Checked;
|
||||
}
|
||||
|
||||
private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){
|
||||
Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked;
|
||||
}
|
||||
|
||||
private void comboBoxIdlePause_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.NotificationIdlePauseSeconds = IdlePauseSeconds[comboBoxIdlePause.SelectedIndex];
|
||||
}
|
||||
|
||||
private void trackBarScrollSpeed_ValueChanged(object sender, EventArgs e){
|
||||
if (trackBarScrollSpeed.AlignValueToTick()){
|
||||
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value+"%";
|
||||
@@ -257,20 +287,6 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
|
||||
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
|
||||
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
|
||||
notification.ShowExampleNotification(false);
|
||||
}
|
||||
|
||||
private void durationUpdateTimer_Tick(object sender, EventArgs e){
|
||||
notification.ShowExampleNotification(true);
|
||||
durationUpdateTimer.Stop();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
36
Core/Other/Settings/TabSettingsSounds.Designer.cs
generated
36
Core/Other/Settings/TabSettingsSounds.Designer.cs
generated
@@ -47,7 +47,7 @@
|
||||
//
|
||||
this.tbCustomSound.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbCustomSound.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.tbCustomSound.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.tbCustomSound.Location = new System.Drawing.Point(3, 3);
|
||||
this.tbCustomSound.Name = "tbCustomSound";
|
||||
this.tbCustomSound.Size = new System.Drawing.Size(316, 23);
|
||||
@@ -56,7 +56,7 @@
|
||||
// labelVolumeValue
|
||||
//
|
||||
this.labelVolumeValue.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelVolumeValue.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelVolumeValue.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.labelVolumeValue.Location = new System.Drawing.Point(147, 4);
|
||||
this.labelVolumeValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.labelVolumeValue.Name = "labelVolumeValue";
|
||||
@@ -69,7 +69,7 @@
|
||||
//
|
||||
this.btnPlaySound.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPlaySound.AutoSize = true;
|
||||
this.btnPlaySound.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnPlaySound.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnPlaySound.Location = new System.Drawing.Point(202, 32);
|
||||
this.btnPlaySound.Name = "btnPlaySound";
|
||||
this.btnPlaySound.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -81,7 +81,7 @@
|
||||
// btnResetSound
|
||||
//
|
||||
this.btnResetSound.AutoSize = true;
|
||||
this.btnResetSound.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnResetSound.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnResetSound.Location = new System.Drawing.Point(3, 32);
|
||||
this.btnResetSound.Name = "btnResetSound";
|
||||
this.btnResetSound.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -94,7 +94,7 @@
|
||||
//
|
||||
this.btnBrowseSound.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBrowseSound.AutoSize = true;
|
||||
this.btnBrowseSound.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnBrowseSound.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
this.btnBrowseSound.Location = new System.Drawing.Point(251, 32);
|
||||
this.btnBrowseSound.Name = "btnBrowseSound";
|
||||
this.btnBrowseSound.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
@@ -106,17 +106,16 @@
|
||||
// labelSoundNotification
|
||||
//
|
||||
this.labelSoundNotification.AutoSize = true;
|
||||
this.labelSoundNotification.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelSoundNotification.Font = new System.Drawing.Font("Segoe UI Semibold", 10.5F, System.Drawing.FontStyle.Bold);
|
||||
this.labelSoundNotification.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelSoundNotification.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelSoundNotification.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelSoundNotification.Name = "labelSoundNotification";
|
||||
this.labelSoundNotification.Size = new System.Drawing.Size(188, 20);
|
||||
this.labelSoundNotification.Size = new System.Drawing.Size(160, 19);
|
||||
this.labelSoundNotification.TabIndex = 0;
|
||||
this.labelSoundNotification.Text = "Custom Sound Notification";
|
||||
this.labelSoundNotification.Text = "SOUND NOTIFICATION";
|
||||
//
|
||||
// panelSoundNotification
|
||||
//
|
||||
this.panelSoundNotification.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.panelSoundNotification.Controls.Add(this.btnPlaySound);
|
||||
this.panelSoundNotification.Controls.Add(this.tbCustomSound);
|
||||
this.panelSoundNotification.Controls.Add(this.btnResetSound);
|
||||
@@ -130,11 +129,11 @@
|
||||
// labelVolume
|
||||
//
|
||||
this.labelVolume.AutoSize = true;
|
||||
this.labelVolume.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelVolume.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.labelVolume.Location = new System.Drawing.Point(3, 91);
|
||||
this.labelVolume.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||
this.labelVolume.Name = "labelVolume";
|
||||
this.labelVolume.Size = new System.Drawing.Size(48, 15);
|
||||
this.labelVolume.Size = new System.Drawing.Size(49, 15);
|
||||
this.labelVolume.TabIndex = 2;
|
||||
this.labelVolume.Text = "Volume";
|
||||
//
|
||||
@@ -153,9 +152,8 @@
|
||||
//
|
||||
// flowPanel
|
||||
//
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowPanel.Controls.Add(this.labelSoundNotification);
|
||||
this.flowPanel.Controls.Add(this.panelSoundNotification);
|
||||
this.flowPanel.Controls.Add(this.labelVolume);
|
||||
@@ -163,7 +161,7 @@
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 142);
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 462);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
//
|
||||
@@ -171,8 +169,8 @@
|
||||
//
|
||||
this.panelVolume.Controls.Add(this.trackBarVolume);
|
||||
this.panelVolume.Controls.Add(this.labelVolumeValue);
|
||||
this.panelVolume.Location = new System.Drawing.Point(0, 106);
|
||||
this.panelVolume.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelVolume.Location = new System.Drawing.Point(0, 107);
|
||||
this.panelVolume.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.panelVolume.Name = "panelVolume";
|
||||
this.panelVolume.Size = new System.Drawing.Size(322, 36);
|
||||
this.panelVolume.TabIndex = 3;
|
||||
@@ -188,7 +186,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Name = "TabSettingsSounds";
|
||||
this.Size = new System.Drawing.Size(340, 160);
|
||||
this.Size = new System.Drawing.Size(631, 480);
|
||||
this.panelSoundNotification.ResumeLayout(false);
|
||||
this.panelSoundNotification.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarVolume)).EndInit();
|
||||
|
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsSounds : BaseTabSettings{
|
||||
@@ -14,6 +15,8 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
this.playSoundNotification = playSoundNotification;
|
||||
|
||||
// sound notification
|
||||
|
||||
toolTip.SetToolTip(tbCustomSound, "When empty, the default TweetDeck sound notification is used.");
|
||||
|
||||
trackBarVolume.SetValueSafe(Config.NotificationSoundVolume);
|
||||
@@ -21,6 +24,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
|
||||
tbCustomSound.Text = Config.NotificationSoundPath;
|
||||
tbCustomSound_TextChanged(tbCustomSound, EventArgs.Empty);
|
||||
NativeMethods.SendMessage(tbCustomSound.Handle, NativeMethods.EM_SETCUEBANNER, 0, "(default TweetDeck sound)");
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
@@ -35,6 +39,8 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.NotificationSoundVolume = trackBarVolume.Value;
|
||||
}
|
||||
|
||||
#region Sound Notification
|
||||
|
||||
private bool RefreshCanPlay(){
|
||||
bool isEmpty = string.IsNullOrEmpty(tbCustomSound.Text);
|
||||
bool canPlay = isEmpty || File.Exists(tbCustomSound.Text);
|
||||
@@ -84,5 +90,7 @@ namespace TweetDuck.Core.Other.Settings{
|
||||
Config.NotificationSoundVolume = trackBarVolume.Value;
|
||||
volumeUpdateTimer.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
118
Core/Other/Settings/TabSettingsTray.Designer.cs
generated
118
Core/Other/Settings/TabSettingsTray.Designer.cs
generated
@@ -1,118 +0,0 @@
|
||||
namespace TweetDuck.Core.Other.Settings {
|
||||
partial class TabSettingsTray {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
||||
this.comboBoxTrayType = new System.Windows.Forms.ComboBox();
|
||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||
this.labelTray = new System.Windows.Forms.Label();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.flowPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flowPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkTrayHighlight
|
||||
//
|
||||
this.checkTrayHighlight.AutoSize = true;
|
||||
this.checkTrayHighlight.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.checkTrayHighlight.Location = new System.Drawing.Point(6, 81);
|
||||
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(6, 6, 3, 2);
|
||||
this.checkTrayHighlight.Name = "checkTrayHighlight";
|
||||
this.checkTrayHighlight.Size = new System.Drawing.Size(114, 19);
|
||||
this.checkTrayHighlight.TabIndex = 3;
|
||||
this.checkTrayHighlight.Text = "Enable Highlight";
|
||||
this.checkTrayHighlight.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// comboBoxTrayType
|
||||
//
|
||||
this.comboBoxTrayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxTrayType.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.comboBoxTrayType.FormattingEnabled = true;
|
||||
this.comboBoxTrayType.Location = new System.Drawing.Point(5, 25);
|
||||
this.comboBoxTrayType.Margin = new System.Windows.Forms.Padding(5, 5, 3, 3);
|
||||
this.comboBoxTrayType.Name = "comboBoxTrayType";
|
||||
this.comboBoxTrayType.Size = new System.Drawing.Size(144, 23);
|
||||
this.comboBoxTrayType.TabIndex = 1;
|
||||
//
|
||||
// labelTrayIcon
|
||||
//
|
||||
this.labelTrayIcon.AutoSize = true;
|
||||
this.labelTrayIcon.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelTrayIcon.Location = new System.Drawing.Point(3, 60);
|
||||
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||
this.labelTrayIcon.Name = "labelTrayIcon";
|
||||
this.labelTrayIcon.Size = new System.Drawing.Size(56, 15);
|
||||
this.labelTrayIcon.TabIndex = 2;
|
||||
this.labelTrayIcon.Text = "Tray Icon";
|
||||
//
|
||||
// labelTray
|
||||
//
|
||||
this.labelTray.AutoSize = true;
|
||||
this.labelTray.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelTray.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelTray.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelTray.Name = "labelTray";
|
||||
this.labelTray.Size = new System.Drawing.Size(88, 20);
|
||||
this.labelTray.TabIndex = 0;
|
||||
this.labelTray.Text = "System Tray";
|
||||
//
|
||||
// flowPanel
|
||||
//
|
||||
this.flowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowPanel.Controls.Add(this.labelTray);
|
||||
this.flowPanel.Controls.Add(this.comboBoxTrayType);
|
||||
this.flowPanel.Controls.Add(this.labelTrayIcon);
|
||||
this.flowPanel.Controls.Add(this.checkTrayHighlight);
|
||||
this.flowPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowPanel.Location = new System.Drawing.Point(9, 9);
|
||||
this.flowPanel.Name = "flowPanel";
|
||||
this.flowPanel.Size = new System.Drawing.Size(322, 102);
|
||||
this.flowPanel.TabIndex = 0;
|
||||
this.flowPanel.WrapContents = false;
|
||||
//
|
||||
// TabSettingsTray
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.flowPanel);
|
||||
this.Name = "TabSettingsTray";
|
||||
this.Size = new System.Drawing.Size(340, 120);
|
||||
this.flowPanel.ResumeLayout(false);
|
||||
this.flowPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
||||
private System.Windows.Forms.ComboBox comboBoxTrayType;
|
||||
private System.Windows.Forms.Label labelTrayIcon;
|
||||
private System.Windows.Forms.Label labelTray;
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowPanel;
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDuck.Core.Other.Settings{
|
||||
sealed partial class TabSettingsTray : BaseTabSettings{
|
||||
public TabSettingsTray(){
|
||||
InitializeComponent();
|
||||
|
||||
toolTip.SetToolTip(comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
|
||||
toolTip.SetToolTip(checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with popup or audio notifications.\r\nThe icon resets when the main window is restored.");
|
||||
|
||||
comboBoxTrayType.Items.Add("Disabled");
|
||||
comboBoxTrayType.Items.Add("Display Icon Only");
|
||||
comboBoxTrayType.Items.Add("Minimize to Tray");
|
||||
comboBoxTrayType.Items.Add("Close to Tray");
|
||||
comboBoxTrayType.Items.Add("Combined");
|
||||
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
||||
|
||||
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
|
||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||
}
|
||||
|
||||
public override void OnReady(){
|
||||
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
||||
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
||||
}
|
||||
|
||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
|
||||
}
|
||||
|
||||
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
|
||||
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
|
||||
}
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@ namespace TweetDuck.Core.Other{
|
||||
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
||||
}
|
||||
|
||||
private static UserConfig Config => Program.UserConfig;
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
public event EventHandler ClickRestore;
|
||||
public event EventHandler ClickClose;
|
||||
@@ -56,6 +56,7 @@ namespace TweetDuck.Core.Other{
|
||||
this.notifyIcon.Text = Program.BrandName;
|
||||
|
||||
Config.MuteToggled += Config_MuteToggled;
|
||||
Disposed += (sender, args) => Config.MuteToggled -= Config_MuteToggled;
|
||||
}
|
||||
|
||||
public TrayIcon(IContainer container) : this(){
|
||||
|
@@ -10,12 +10,18 @@ using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other.Interfaces;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Resources;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
sealed class TweetDeckBrowser : ITweetDeckBrowser, IDisposable{
|
||||
sealed class TweetDeckBrowser : IDisposable{
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
|
||||
private const string ErrorUrl = "http://td/error";
|
||||
private const string TwitterStyleUrl = "https://abs.twimg.com/tduck/css";
|
||||
|
||||
public bool Ready { get; private set; }
|
||||
|
||||
public bool Enabled{
|
||||
@@ -36,10 +42,14 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
private readonly ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();
|
||||
|
||||
private string prevSoundNotificationPath = null;
|
||||
|
||||
public TweetDeckBrowser(FormBrowser owner, TweetDeckBridge tdBridge, UpdateBridge updateBridge){
|
||||
public TweetDeckBrowser(FormBrowser owner, PluginManager plugins, TweetDeckBridge tdBridge, UpdateBridge updateBridge){
|
||||
resourceHandlerFactory.RegisterHandler(TweetNotification.AppLogo);
|
||||
resourceHandlerFactory.RegisterHandler(TwitterUtils.LoadingSpinner);
|
||||
|
||||
RequestHandlerBrowser requestHandler = new RequestHandlerBrowser();
|
||||
|
||||
this.browser = new ChromiumWebBrowser(TwitterUtils.TweetDeckURL){
|
||||
@@ -49,7 +59,8 @@ namespace TweetDuck.Core{
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
KeyboardHandler = new KeyboardHandlerBrowser(owner),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = requestHandler
|
||||
RequestHandler = requestHandler,
|
||||
ResourceHandlerFactory = resourceHandlerFactory
|
||||
};
|
||||
|
||||
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||
@@ -63,15 +74,13 @@ namespace TweetDuck.Core{
|
||||
this.browser.BrowserSettings.BackgroundColor = (uint)TwitterUtils.BackgroundColor.ToArgb();
|
||||
this.browser.Dock = DockStyle.None;
|
||||
this.browser.Location = ControlExtensions.InvisibleLocation;
|
||||
|
||||
this.browser.SetupResourceHandler(TweetNotification.AppLogo);
|
||||
this.browser.SetupResourceHandler(TwitterUtils.LoadingSpinner);
|
||||
this.browser.SetupZoomEvents();
|
||||
|
||||
owner.Controls.Add(browser);
|
||||
plugins.Register(browser, PluginEnvironment.Browser, owner, true);
|
||||
|
||||
Program.UserConfig.MuteToggled += UserConfig_MuteToggled;
|
||||
Program.UserConfig.ZoomLevelChanged += UserConfig_ZoomLevelChanged;
|
||||
Program.UserConfig.SoundNotificationChanged += UserConfig_SoundNotificationInfoChanged;
|
||||
Config.MuteToggled += Config_MuteToggled;
|
||||
Config.SoundNotificationChanged += Config_SoundNotificationInfoChanged;
|
||||
}
|
||||
|
||||
// setup and management
|
||||
@@ -89,31 +98,12 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
public void Dispose(){
|
||||
Program.UserConfig.MuteToggled -= UserConfig_MuteToggled;
|
||||
Program.UserConfig.ZoomLevelChanged -= UserConfig_ZoomLevelChanged;
|
||||
Program.UserConfig.SoundNotificationChanged -= UserConfig_SoundNotificationInfoChanged;
|
||||
Config.MuteToggled -= Config_MuteToggled;
|
||||
Config.SoundNotificationChanged -= Config_SoundNotificationInfoChanged;
|
||||
|
||||
browser.Dispose();
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.RegisterBridge(string name, object obj){
|
||||
browser.RegisterAsyncJsObject(name, obj);
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.OnFrameLoaded(Action<IFrame> callback){
|
||||
browser.FrameLoadEnd += (sender, args) => {
|
||||
IFrame frame = args.Frame;
|
||||
|
||||
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
callback(frame);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.ExecuteFunction(string name, params object[] args){
|
||||
browser.ExecuteScriptAsync(name, args);
|
||||
}
|
||||
|
||||
// event handlers
|
||||
|
||||
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||
@@ -131,15 +121,16 @@ namespace TweetDuck.Core{
|
||||
IFrame frame = e.Frame;
|
||||
|
||||
if (frame.IsMain){
|
||||
if (Program.UserConfig.ZoomLevel != 100){
|
||||
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
|
||||
}
|
||||
|
||||
if (TwitterUtils.IsTwitterWebsite(frame)){
|
||||
string css = ScriptLoader.LoadResource("styles/twitter.css", browser);
|
||||
resourceHandlerFactory.RegisterHandler(TwitterStyleUrl, ResourceHandler.FromString(css, mimeType: "text/css"));
|
||||
|
||||
ScriptLoader.ExecuteFile(frame, "twitter.js", browser);
|
||||
}
|
||||
|
||||
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
|
||||
if (!TwitterUtils.IsTwitterLogin2FactorWebsite(frame)){
|
||||
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,12 +140,11 @@ namespace TweetDuck.Core{
|
||||
if (frame.IsMain){
|
||||
if (TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
UpdateProperties();
|
||||
TweetDeckBridge.RestoreSessionData(frame);
|
||||
ScriptLoader.ExecuteFile(frame, "code.js", browser);
|
||||
|
||||
InjectBrowserCSS();
|
||||
ReinjectCustomCSS(Program.UserConfig.CustomBrowserCSS);
|
||||
UserConfig_SoundNotificationInfoChanged(null, EventArgs.Empty);
|
||||
ReinjectCustomCSS(Config.CustomBrowserCSS);
|
||||
Config_SoundNotificationInfoChanged(null, EventArgs.Empty);
|
||||
|
||||
TweetDeckBridge.ResetStaticProperties();
|
||||
|
||||
@@ -162,13 +152,17 @@ namespace TweetDuck.Core{
|
||||
ScriptLoader.ExecuteScript(frame, "TD.storage.Account.prototype.requiresConsent = function(){ return false; }", "gen:gdpr");
|
||||
}
|
||||
|
||||
if (Program.UserConfig.FirstRun){
|
||||
if (Config.FirstRun){
|
||||
ScriptLoader.ExecuteFile(frame, "introduction.js", browser);
|
||||
}
|
||||
}
|
||||
|
||||
ScriptLoader.ExecuteFile(frame, "update.js", browser);
|
||||
}
|
||||
|
||||
if (frame.Url == ErrorUrl){
|
||||
resourceHandlerFactory.UnregisterHandler(ErrorUrl);
|
||||
}
|
||||
}
|
||||
|
||||
private void browser_LoadError(object sender, LoadErrorEventArgs e){
|
||||
@@ -180,29 +174,34 @@ namespace TweetDuck.Core{
|
||||
string errorPage = ScriptLoader.LoadResourceSilent("pages/error.html");
|
||||
|
||||
if (errorPage != null){
|
||||
browser.LoadHtml(errorPage.Replace("{err}", BrowserUtils.GetErrorName(e.ErrorCode)), "http://td/error");
|
||||
resourceHandlerFactory.RegisterHandler(ErrorUrl, ResourceHandler.FromString(errorPage.Replace("{err}", BrowserUtils.GetErrorName(e.ErrorCode))));
|
||||
browser.Load(ErrorUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UserConfig_MuteToggled(object sender, EventArgs e){
|
||||
private void Config_MuteToggled(object sender, EventArgs e){
|
||||
UpdateProperties();
|
||||
}
|
||||
|
||||
private void UserConfig_ZoomLevelChanged(object sender, EventArgs e){
|
||||
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Program.UserConfig.ZoomLevel);
|
||||
}
|
||||
|
||||
private void UserConfig_SoundNotificationInfoChanged(object sender, EventArgs e){
|
||||
private void Config_SoundNotificationInfoChanged(object sender, EventArgs e){
|
||||
const string soundUrl = "https://ton.twimg.com/tduck/updatesnd";
|
||||
bool hasCustomSound = Program.UserConfig.IsCustomSoundNotificationSet;
|
||||
|
||||
if (prevSoundNotificationPath != Program.UserConfig.NotificationSoundPath){
|
||||
browser.SetupResourceHandler(soundUrl, hasCustomSound ? SoundNotification.CreateFileHandler(Program.UserConfig.NotificationSoundPath) : null);
|
||||
prevSoundNotificationPath = Program.UserConfig.NotificationSoundPath;
|
||||
bool hasCustomSound = Config.IsCustomSoundNotificationSet;
|
||||
string newNotificationPath = Config.NotificationSoundPath;
|
||||
|
||||
if (prevSoundNotificationPath != newNotificationPath){
|
||||
prevSoundNotificationPath = newNotificationPath;
|
||||
|
||||
if (hasCustomSound){
|
||||
resourceHandlerFactory.RegisterHandler(soundUrl, SoundNotification.CreateFileHandler(newNotificationPath));
|
||||
}
|
||||
else{
|
||||
resourceHandlerFactory.UnregisterHandler(soundUrl);
|
||||
}
|
||||
}
|
||||
|
||||
browser.ExecuteScriptAsync("TDGF_setSoundNotificationData", hasCustomSound, Program.UserConfig.NotificationSoundVolume);
|
||||
browser.ExecuteScriptAsync("TDGF_setSoundNotificationData", hasCustomSound, Config.NotificationSoundVolume);
|
||||
}
|
||||
|
||||
// external handling
|
||||
|
@@ -3,26 +3,29 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp.WinForms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class BrowserUtils{
|
||||
public static string UserAgentVanilla => Program.BrandName+" "+Application.ProductVersion;
|
||||
public static string UserAgentChrome => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"+Cef.ChromiumVersion+" Safari/537.36";
|
||||
public static string UserAgentVanilla => Program.BrandName + " " + Application.ProductVersion;
|
||||
public static string UserAgentChrome => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" + Cef.ChromiumVersion + " Safari/537.36";
|
||||
|
||||
public static readonly bool HasDevTools = File.Exists(Path.Combine(Program.ProgramPath, "devtools_resources.pak"));
|
||||
|
||||
private static UserConfig Config => Program.Config.User;
|
||||
private static SystemConfig SysConfig => Program.Config.System;
|
||||
|
||||
public static void SetupCefArgs(IDictionary<string, string> args){
|
||||
if (!Program.SystemConfig.HardwareAcceleration){
|
||||
if (!SysConfig.HardwareAcceleration){
|
||||
args["disable-gpu"] = "1";
|
||||
args["disable-gpu-vsync"] = "1";
|
||||
}
|
||||
|
||||
if (Program.UserConfig.EnableSmoothScrolling){
|
||||
if (Config.EnableSmoothScrolling){
|
||||
args["disable-threaded-scrolling"] = "1";
|
||||
|
||||
if (args.TryGetValue("disable-features", out string disabledFeatures)){
|
||||
@@ -36,6 +39,10 @@ namespace TweetDuck.Core.Utils{
|
||||
args["disable-smooth-scrolling"] = "1";
|
||||
}
|
||||
|
||||
if (!Config.EnableTouchAdjustment){
|
||||
args["disable-touch-adjustment"] = "1";
|
||||
}
|
||||
|
||||
args["disable-pdf-extension"] = "1";
|
||||
args["disable-plugins-discovery"] = "1";
|
||||
args["enable-system-flash"] = "0";
|
||||
@@ -52,49 +59,31 @@ namespace TweetDuck.Core.Utils{
|
||||
return (ChromiumWebBrowser)browserControl;
|
||||
}
|
||||
|
||||
public static void SetupResourceHandler(this ChromiumWebBrowser browser, string url, IResourceHandler handler){
|
||||
DefaultResourceHandlerFactory factory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory;
|
||||
|
||||
if (handler == null){
|
||||
factory.UnregisterHandler(url);
|
||||
public static void SetupZoomEvents(this ChromiumWebBrowser browser){
|
||||
void UpdateZoomLevel(object sender, EventArgs args){
|
||||
SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
|
||||
}
|
||||
else{
|
||||
factory.RegisterHandler(url, handler);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetupResourceHandler(this ChromiumWebBrowser browser, ResourceLink resource){
|
||||
browser.SetupResourceHandler(resource.Url, resource.Handler);
|
||||
}
|
||||
Config.ZoomLevelChanged += UpdateZoomLevel;
|
||||
browser.Disposed += (sender, args) => Config.ZoomLevelChanged -= UpdateZoomLevel;
|
||||
|
||||
private const string TwitterTrackingUrl = "t.co";
|
||||
|
||||
public enum UrlCheckResult{
|
||||
Invalid, Tracking, Fine
|
||||
}
|
||||
|
||||
public static UrlCheckResult CheckUrl(string url){
|
||||
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||
string scheme = uri.Scheme;
|
||||
|
||||
if (scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto){
|
||||
return uri.Host == TwitterTrackingUrl ? UrlCheckResult.Tracking : UrlCheckResult.Fine;
|
||||
browser.FrameLoadStart += (sender, args) => {
|
||||
if (args.Frame.IsMain && Config.ZoomLevel != 100){
|
||||
SetZoomLevel(args.Browser, Config.ZoomLevel);
|
||||
}
|
||||
}
|
||||
|
||||
return UrlCheckResult.Invalid;
|
||||
};
|
||||
}
|
||||
|
||||
public static void OpenExternalBrowser(string url){
|
||||
if (string.IsNullOrWhiteSpace(url))return;
|
||||
|
||||
switch(CheckUrl(url)){
|
||||
case UrlCheckResult.Fine:
|
||||
switch(UrlUtils.Check(url)){
|
||||
case UrlUtils.CheckResult.Fine:
|
||||
if (FormGuide.CheckGuideUrl(url, out string hash)){
|
||||
FormGuide.Show(hash);
|
||||
}
|
||||
else{
|
||||
string browserPath = Program.UserConfig.BrowserPath;
|
||||
string browserPath = Config.BrowserPath;
|
||||
|
||||
if (browserPath == null || !File.Exists(browserPath)){
|
||||
WindowsUtils.OpenAssociatedProgram(url);
|
||||
@@ -110,9 +99,9 @@ namespace TweetDuck.Core.Utils{
|
||||
|
||||
break;
|
||||
|
||||
case UrlCheckResult.Tracking:
|
||||
if (Program.UserConfig.IgnoreTrackingUrlWarning){
|
||||
goto case UrlCheckResult.Fine;
|
||||
case UrlUtils.CheckResult.Tracking:
|
||||
if (Config.IgnoreTrackingUrlWarning){
|
||||
goto case UrlUtils.CheckResult.Fine;
|
||||
}
|
||||
|
||||
using(FormMessage form = new FormMessage("Blocked URL", "TweetDuck has blocked a tracking url due to privacy concerns. Do you want to visit it anyway?\n"+url, MessageBoxIcon.Warning)){
|
||||
@@ -123,18 +112,18 @@ namespace TweetDuck.Core.Utils{
|
||||
DialogResult result = form.ShowDialog();
|
||||
|
||||
if (result == DialogResult.Ignore){
|
||||
Program.UserConfig.IgnoreTrackingUrlWarning = true;
|
||||
Program.UserConfig.Save();
|
||||
Config.IgnoreTrackingUrlWarning = true;
|
||||
Config.Save();
|
||||
}
|
||||
|
||||
if (result == DialogResult.Ignore || result == DialogResult.Yes){
|
||||
goto case UrlCheckResult.Fine;
|
||||
goto case UrlUtils.CheckResult.Fine;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case UrlCheckResult.Invalid:
|
||||
case UrlUtils.CheckResult.Invalid:
|
||||
FormMessage.Warning("Blocked URL", "A potentially malicious URL was blocked from opening:\n"+url, FormMessage.OK);
|
||||
break;
|
||||
}
|
||||
@@ -143,7 +132,7 @@ namespace TweetDuck.Core.Utils{
|
||||
public static void OpenExternalSearch(string query){
|
||||
if (string.IsNullOrWhiteSpace(query))return;
|
||||
|
||||
string searchUrl = Program.UserConfig.SearchEngineUrl;
|
||||
string searchUrl = Config.SearchEngineUrl;
|
||||
|
||||
if (string.IsNullOrEmpty(searchUrl)){
|
||||
if (FormMessage.Question("Search Options", "You have not configured a default search engine yet, would you like to do it now?", FormMessage.Yes, FormMessage.No)){
|
||||
@@ -156,7 +145,7 @@ namespace TweetDuck.Core.Utils{
|
||||
if (settings == null)return;
|
||||
|
||||
settings.FormClosed += (sender, args) => {
|
||||
if (args.CloseReason == CloseReason.UserClosing && Program.UserConfig.SearchEngineUrl != searchUrl){
|
||||
if (args.CloseReason == CloseReason.UserClosing && Config.SearchEngineUrl != searchUrl){
|
||||
OpenExternalSearch(query);
|
||||
}
|
||||
};
|
||||
@@ -167,46 +156,10 @@ namespace TweetDuck.Core.Utils{
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetFileNameFromUrl(string url){
|
||||
string file = Path.GetFileName(new Uri(url).AbsolutePath);
|
||||
return string.IsNullOrEmpty(file) ? null : file;
|
||||
}
|
||||
|
||||
public static string GetErrorName(CefErrorCode code){
|
||||
return StringUtils.ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
||||
}
|
||||
|
||||
public static WebClient CreateWebClient(){
|
||||
WindowsUtils.EnsureTLS12();
|
||||
|
||||
WebClient client = new WebClient{ Proxy = null };
|
||||
client.Headers[HttpRequestHeader.UserAgent] = UserAgentVanilla;
|
||||
return client;
|
||||
}
|
||||
|
||||
public static WebClient DownloadFileAsync(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||
WebClient client = CreateWebClient();
|
||||
|
||||
client.DownloadFileCompleted += (sender, args) => {
|
||||
if (args.Cancelled){
|
||||
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);
|
||||
return client;
|
||||
}
|
||||
|
||||
public static int Scale(int baseValue, double scaleFactor){
|
||||
return (int)Math.Round(baseValue*scaleFactor);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ namespace TweetDuck.Core.Utils{
|
||||
public const int GWL_STYLE = -16;
|
||||
|
||||
public const int SB_HORZ = 0;
|
||||
public const int EM_SETCUEBANNER = 0x1501;
|
||||
|
||||
public const int WM_MOUSE_LL = 14;
|
||||
public const int WM_MOUSEWHEEL = 0x020A;
|
||||
@@ -52,6 +53,9 @@ namespace TweetDuck.Core.Utils{
|
||||
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
|
||||
private static extern bool SetWindowPos(int hWnd, int hWndOrder, int x, int y, int width, int height, uint flags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool PostMessage(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam);
|
||||
|
||||
|
@@ -2,18 +2,23 @@
|
||||
using CefSharp;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using TweetLib.Core.Utils;
|
||||
using Cookie = CefSharp.Cookie;
|
||||
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class TwitterUtils{
|
||||
public const string TweetDeckURL = "https://tweetdeck.twitter.com";
|
||||
|
||||
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||
public const string BackgroundColorOverride = "setTimeout(function f(){let h=document.head;if(!h){setTimeout(f,5);return;}let e=document.createElement('style');e.innerHTML='body,body::before{background:#1c6399!important}';h.appendChild(e);},1)";
|
||||
public const string BackgroundColorOverride = "setTimeout(function f(){let h=document.head;if(!h){setTimeout(f,5);return;}let e=document.createElement('style');e.innerHTML='body,body::before{background:#1c6399!important;margin:0}';h.appendChild(e);},1)";
|
||||
|
||||
public static readonly ResourceLink LoadingSpinner = new ResourceLink("https://ton.twimg.com/tduck/spinner", ResourceHandler.FromByteArray(Properties.Resources.spinner, "image/apng"));
|
||||
|
||||
@@ -40,6 +45,10 @@ namespace TweetDuck.Core.Utils{
|
||||
return frame.Url.Contains("//twitter.com/");
|
||||
}
|
||||
|
||||
public static bool IsTwitterLogin2FactorWebsite(IFrame frame){
|
||||
return frame.Url.Contains("//twitter.com/account/login_verification");
|
||||
}
|
||||
|
||||
private static string ExtractMediaBaseLink(string url){
|
||||
int slash = url.LastIndexOf('/');
|
||||
return slash == -1 ? url : StringUtils.ExtractBefore(url, ':', slash);
|
||||
@@ -49,7 +58,10 @@ namespace TweetDuck.Core.Utils{
|
||||
if (quality == ImageQuality.Orig){
|
||||
string result = ExtractMediaBaseLink(url);
|
||||
|
||||
if (result != url || url.Contains("//pbs.twimg.com/media/")){
|
||||
if (url.Contains("//ton.twitter.com/") && url.Contains("/ton/data/dm/")){
|
||||
result += ":large";
|
||||
}
|
||||
else if (result != url || url.Contains("//pbs.twimg.com/media/")){
|
||||
result += ":orig";
|
||||
}
|
||||
|
||||
@@ -61,7 +73,33 @@ namespace TweetDuck.Core.Utils{
|
||||
}
|
||||
|
||||
public static string GetImageFileName(string url){
|
||||
return BrowserUtils.GetFileNameFromUrl(ExtractMediaBaseLink(url));
|
||||
return UrlUtils.GetFileNameFromUrl(ExtractMediaBaseLink(url));
|
||||
}
|
||||
|
||||
public static void ViewImage(string url, ImageQuality quality){
|
||||
void ViewImageInternal(string path){
|
||||
string ext = Path.GetExtension(path);
|
||||
|
||||
if (ValidImageExtensions.Contains(ext)){
|
||||
WindowsUtils.OpenAssociatedProgram(path);
|
||||
}
|
||||
else{
|
||||
FormMessage.Error("Image Download", "Invalid file extension "+ext, FormMessage.OK);
|
||||
}
|
||||
}
|
||||
|
||||
string file = Path.Combine(BrowserCache.CacheFolder, GetImageFileName(url) ?? Path.GetRandomFileName());
|
||||
|
||||
if (FileUtils.FileExistsAndNotEmpty(file)){
|
||||
ViewImageInternal(file);
|
||||
}
|
||||
else{
|
||||
DownloadFileAuth(GetMediaLink(url, quality), file, () => {
|
||||
ViewImageInternal(file);
|
||||
}, ex => {
|
||||
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void DownloadImage(string url, string username, ImageQuality quality){
|
||||
@@ -92,14 +130,14 @@ namespace TweetDuck.Core.Utils{
|
||||
}
|
||||
|
||||
if (urls.Length == 1){
|
||||
BrowserUtils.DownloadFileAsync(firstImageLink, dialog.FileName, null, OnFailure);
|
||||
DownloadFileAuth(firstImageLink, dialog.FileName, null, OnFailure);
|
||||
}
|
||||
else{
|
||||
string pathBase = Path.ChangeExtension(dialog.FileName, null);
|
||||
string pathExt = Path.GetExtension(dialog.FileName);
|
||||
|
||||
for(int index = 0; index < urls.Length; index++){
|
||||
BrowserUtils.DownloadFileAsync(GetMediaLink(urls[index], quality), $"{pathBase} {index+1}{pathExt}", null, OnFailure);
|
||||
DownloadFileAuth(GetMediaLink(urls[index], quality), $"{pathBase} {index+1}{pathExt}", null, OnFailure);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +145,7 @@ namespace TweetDuck.Core.Utils{
|
||||
}
|
||||
|
||||
public static void DownloadVideo(string url, string username){
|
||||
string filename = BrowserUtils.GetFileNameFromUrl(url);
|
||||
string filename = UrlUtils.GetFileNameFromUrl(url);
|
||||
string ext = Path.GetExtension(filename);
|
||||
|
||||
using(SaveFileDialog dialog = new SaveFileDialog{
|
||||
@@ -118,11 +156,36 @@ namespace TweetDuck.Core.Utils{
|
||||
Filter = "Video"+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
|
||||
}){
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
BrowserUtils.DownloadFileAsync(url, dialog.FileName, null, ex => {
|
||||
DownloadFileAuth(url, dialog.FileName, null, ex => {
|
||||
FormMessage.Error("Video Download", "An error occurred while downloading the video: "+ex.Message, FormMessage.OK);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DownloadFileAuth(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||
const string AuthCookieName = "auth_token";
|
||||
|
||||
TaskScheduler scheduler = TaskScheduler.FromCurrentSynchronizationContext();
|
||||
|
||||
using(ICookieManager cookies = Cef.GetGlobalCookieManager()){
|
||||
cookies.VisitUrlCookiesAsync(url, true).ContinueWith(task => {
|
||||
string cookieStr = null;
|
||||
|
||||
if (task.Status == TaskStatus.RanToCompletion){
|
||||
Cookie found = task.Result?.Find(cookie => cookie.Name == AuthCookieName); // the list may be null
|
||||
|
||||
if (found != null){
|
||||
cookieStr = $"{found.Name}={found.Value}";
|
||||
}
|
||||
}
|
||||
|
||||
WebClient client = WebUtils.NewClient(BrowserUtils.UserAgentChrome);
|
||||
client.Headers[HttpRequestHeader.Cookie] = cookieStr;
|
||||
client.DownloadFileCompleted += WebUtils.FileDownloadCallback(target, onSuccess, onFailure);
|
||||
client.DownloadFileAsync(new Uri(url), target);
|
||||
}, scheduler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
@@ -16,7 +15,6 @@ namespace TweetDuck.Core.Utils{
|
||||
private static readonly Lazy<Regex> RegexOffsetClipboardHtml = new Lazy<Regex>(() => new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)"), false);
|
||||
|
||||
private static readonly bool IsWindows8OrNewer;
|
||||
private static bool HasMicrosoftBeenBroughtTo2008Yet;
|
||||
|
||||
public static int CurrentProcessID { get; }
|
||||
public static bool ShouldAvoidToolWindow { get; }
|
||||
@@ -33,39 +31,6 @@ namespace TweetDuck.Core.Utils{
|
||||
ShouldAvoidToolWindow = IsWindows8OrNewer;
|
||||
}
|
||||
|
||||
public static void EnsureTLS12(){
|
||||
if (!HasMicrosoftBeenBroughtTo2008Yet){
|
||||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
|
||||
ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);
|
||||
HasMicrosoftBeenBroughtTo2008Yet = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateDirectoryForFile(string file){
|
||||
string dir = Path.GetDirectoryName(file);
|
||||
|
||||
if (dir == null){
|
||||
throw new ArgumentException("Invalid file path: "+file);
|
||||
}
|
||||
else if (dir.Length > 0){
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckFolderWritePermission(string path){
|
||||
string testFile = Path.Combine(path, ".test");
|
||||
|
||||
try{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
using(File.Create(testFile)){}
|
||||
File.Delete(testFile);
|
||||
return true;
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool OpenAssociatedProgram(string file, string arguments = "", bool runElevated = false){
|
||||
try{
|
||||
using(Process.Start(new ProcessStartInfo{
|
||||
|
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace TweetDuck.Data.Serialization{
|
||||
interface ITypeConverter{
|
||||
bool TryWriteType(Type type, object value, out string converted);
|
||||
bool TryReadType(Type type, string value, out object converted);
|
||||
}
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data.Serialization;
|
||||
using TweetLib.Core.Serialization.Converters;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Data{
|
||||
sealed class WindowState{
|
||||
|
16
Plugins/Controls/PluginControl.Designer.cs
generated
16
Plugins/Controls/PluginControl.Designer.cs
generated
@@ -43,7 +43,7 @@
|
||||
// btnToggleState
|
||||
//
|
||||
this.btnToggleState.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnToggleState.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnToggleState.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnToggleState.Location = new System.Drawing.Point(451, 59);
|
||||
this.btnToggleState.Name = "btnToggleState";
|
||||
this.btnToggleState.Size = new System.Drawing.Size(70, 23);
|
||||
@@ -56,7 +56,7 @@
|
||||
//
|
||||
this.labelName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelName.AutoSize = true;
|
||||
this.labelName.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelName.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold);
|
||||
this.labelName.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelName.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelName.Name = "labelName";
|
||||
@@ -72,7 +72,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelDescription.AutoScroll = true;
|
||||
this.panelDescription.Controls.Add(this.labelDescription);
|
||||
this.panelDescription.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.panelDescription.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.panelDescription.Location = new System.Drawing.Point(28, 33);
|
||||
this.panelDescription.Name = "panelDescription";
|
||||
this.panelDescription.Size = new System.Drawing.Size(410, 47);
|
||||
@@ -96,7 +96,7 @@
|
||||
//
|
||||
this.labelAuthor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelAuthor.AutoSize = true;
|
||||
this.labelAuthor.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelAuthor.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelAuthor.Location = new System.Drawing.Point(53, 5);
|
||||
this.labelAuthor.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.labelAuthor.Name = "labelAuthor";
|
||||
@@ -125,7 +125,7 @@
|
||||
this.labelWebsite.AutoEllipsis = true;
|
||||
this.labelWebsite.AutoSize = true;
|
||||
this.labelWebsite.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.labelWebsite.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelWebsite.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline);
|
||||
this.labelWebsite.ForeColor = System.Drawing.Color.Blue;
|
||||
this.labelWebsite.Location = new System.Drawing.Point(100, 5);
|
||||
this.labelWebsite.Margin = new System.Windows.Forms.Padding(3, 0, 0, 1);
|
||||
@@ -140,7 +140,7 @@
|
||||
//
|
||||
this.labelVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.labelVersion.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelVersion.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.labelVersion.Location = new System.Drawing.Point(88, 6);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(0, 0, 1, 0);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
@@ -154,7 +154,7 @@
|
||||
// btnConfigure
|
||||
//
|
||||
this.btnConfigure.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnConfigure.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.btnConfigure.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular);
|
||||
this.btnConfigure.Location = new System.Drawing.Point(451, 30);
|
||||
this.btnConfigure.Name = "btnConfigure";
|
||||
this.btnConfigure.Size = new System.Drawing.Size(70, 23);
|
||||
@@ -168,7 +168,7 @@
|
||||
this.labelType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelType.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.labelType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold);
|
||||
this.labelType.LineHeight = 0;
|
||||
this.labelType.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelType.Name = "labelType";
|
||||
|
@@ -3,7 +3,8 @@ using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
|
||||
namespace TweetDuck.Plugins.Controls{
|
||||
sealed partial class PluginControl : UserControl{
|
||||
@@ -89,7 +90,7 @@ namespace TweetDuck.Plugins.Controls{
|
||||
}
|
||||
|
||||
private void btnToggleState_Click(object sender, EventArgs e){
|
||||
pluginManager.Config.ToggleEnabled(plugin);
|
||||
pluginManager.Config.SetEnabled(plugin, !pluginManager.Config.IsEnabled(plugin));
|
||||
UpdatePluginState();
|
||||
}
|
||||
|
||||
|
@@ -1,5 +0,0 @@
|
||||
namespace TweetDuck.Plugins.Enums{
|
||||
enum PluginFolder{
|
||||
Root, Data
|
||||
}
|
||||
}
|
@@ -1,13 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetLib.Core.Collections;
|
||||
using TweetLib.Core.Data;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Plugins{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
sealed class PluginBridge{
|
||||
private static string SanitizeCacheKey(string key){
|
||||
return key.Replace('\\', '/').Trim();
|
||||
@@ -80,7 +84,7 @@ namespace TweetDuck.Plugins{
|
||||
public void WriteFile(int token, string path, string contents){
|
||||
string fullPath = GetFullPathOrThrow(token, PluginFolder.Data, path);
|
||||
|
||||
WindowsUtils.CreateDirectoryForFile(fullPath);
|
||||
FileUtils.CreateDirectoryForFile(fullPath);
|
||||
File.WriteAllText(fullPath, contents, Encoding.UTF8);
|
||||
fileCache[token, SanitizeCacheKey(path)] = contents;
|
||||
}
|
||||
|
@@ -1,72 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TweetDuck.Plugins.Events;
|
||||
|
||||
namespace TweetDuck.Plugins{
|
||||
sealed class PluginConfig{
|
||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||
|
||||
public IEnumerable<string> DisabledPlugins => disabled;
|
||||
public bool AnyDisabled => disabled.Count > 0;
|
||||
|
||||
private static readonly string[] DefaultDisabled = {
|
||||
"official/clear-columns",
|
||||
"official/reply-account"
|
||||
};
|
||||
|
||||
private readonly HashSet<string> disabled = new HashSet<string>();
|
||||
|
||||
public void SetEnabled(Plugin plugin, bool enabled){
|
||||
if ((enabled && disabled.Remove(plugin.Identifier)) || (!enabled && disabled.Add(plugin.Identifier))){
|
||||
PluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleEnabled(Plugin plugin){
|
||||
SetEnabled(plugin, !IsEnabled(plugin));
|
||||
}
|
||||
|
||||
public bool IsEnabled(Plugin plugin){
|
||||
return !disabled.Contains(plugin.Identifier);
|
||||
}
|
||||
|
||||
public void Save(string file){
|
||||
try{
|
||||
using(StreamWriter writer = new StreamWriter(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None), Encoding.UTF8)){
|
||||
writer.WriteLine("#Disabled");
|
||||
|
||||
foreach(string identifier in disabled){
|
||||
writer.WriteLine(identifier);
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
Program.Reporter.HandleException("Plugin Configuration Error", "Could not save the plugin configuration file.", true, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void Load(string file){
|
||||
try{
|
||||
using(StreamReader reader = new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read), Encoding.UTF8)){
|
||||
string line = reader.ReadLine();
|
||||
|
||||
if (line == "#Disabled"){
|
||||
disabled.Clear();
|
||||
|
||||
while((line = reader.ReadLine()) != null){
|
||||
disabled.Add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(FileNotFoundException){
|
||||
disabled.Clear();
|
||||
disabled.UnionWith(DefaultDisabled);
|
||||
Save(file);
|
||||
}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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,11 +5,13 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Other.Interfaces;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Resources;
|
||||
using TweetLib.Core.Data;
|
||||
using TweetLib.Core.Features.Plugins;
|
||||
using TweetLib.Core.Features.Plugins.Config;
|
||||
using TweetLib.Core.Features.Plugins.Enums;
|
||||
using TweetLib.Core.Features.Plugins.Events;
|
||||
|
||||
namespace TweetDuck.Plugins{
|
||||
sealed class PluginManager{
|
||||
@@ -21,35 +23,38 @@ namespace TweetDuck.Plugins{
|
||||
public IEnumerable<Plugin> Plugins => plugins;
|
||||
public IEnumerable<InjectedHTML> NotificationInjections => bridge.NotificationInjections;
|
||||
|
||||
public PluginConfig Config { get; }
|
||||
public IPluginConfig Config { get; }
|
||||
|
||||
public event EventHandler<PluginErrorEventArgs> Reloaded;
|
||||
public event EventHandler<PluginErrorEventArgs> Executed;
|
||||
|
||||
private readonly string rootPath;
|
||||
private readonly string configPath;
|
||||
private readonly PluginBridge bridge;
|
||||
|
||||
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
|
||||
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
private ITweetDeckBrowser mainBrowser;
|
||||
private IWebBrowser mainBrowser;
|
||||
|
||||
public PluginManager(IPluginConfig config, string rootPath){
|
||||
this.Config = config;
|
||||
this.Config.PluginChangedState += Config_PluginChangedState;
|
||||
|
||||
public PluginManager(string rootPath, string configPath){
|
||||
this.rootPath = rootPath;
|
||||
this.configPath = configPath;
|
||||
|
||||
this.Config = new PluginConfig();
|
||||
this.bridge = new PluginBridge(this);
|
||||
|
||||
Config.Load(configPath);
|
||||
Config.PluginChangedState += Config_PluginChangedState;
|
||||
}
|
||||
|
||||
public void Register(ITweetDeckBrowser browser, PluginEnvironment environment, Control sync, bool asMainBrowser = false){
|
||||
browser.OnFrameLoaded(frame => ExecutePlugins(frame, environment, sync));
|
||||
browser.RegisterBridge("$TDP", bridge);
|
||||
public void Register(IWebBrowser browser, PluginEnvironment environment, Control sync, bool asMainBrowser = false){
|
||||
browser.FrameLoadEnd += (sender, args) => {
|
||||
IFrame frame = args.Frame;
|
||||
|
||||
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
ExecutePlugins(frame, environment, sync);
|
||||
}
|
||||
};
|
||||
|
||||
browser.RegisterAsyncJsObject("$TDP", bridge);
|
||||
|
||||
if (asMainBrowser){
|
||||
mainBrowser = browser;
|
||||
@@ -57,8 +62,7 @@ namespace TweetDuck.Plugins{
|
||||
}
|
||||
|
||||
private void Config_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||
mainBrowser?.ExecuteFunction("TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||
Config.Save(configPath);
|
||||
mainBrowser?.ExecuteScriptAsync("TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||
}
|
||||
|
||||
public bool IsPluginInstalled(string identifier){
|
||||
@@ -75,7 +79,7 @@ namespace TweetDuck.Plugins{
|
||||
|
||||
public void ConfigurePlugin(Plugin plugin){
|
||||
if (bridge.WithConfigureFunction.Contains(plugin)){
|
||||
mainBrowser?.ExecuteFunction("TDPF_configurePlugin", plugin);
|
||||
mainBrowser?.ExecuteScriptAsync("TDPF_configurePlugin", plugin);
|
||||
}
|
||||
else if (plugin.HasConfig){
|
||||
if (File.Exists(plugin.ConfigPath)){
|
||||
@@ -113,8 +117,6 @@ namespace TweetDuck.Plugins{
|
||||
}
|
||||
|
||||
public void Reload(){
|
||||
Config.Load(configPath);
|
||||
|
||||
plugins.Clear();
|
||||
tokens.Clear();
|
||||
|
||||
@@ -126,12 +128,19 @@ namespace TweetDuck.Plugins{
|
||||
}
|
||||
|
||||
foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){
|
||||
string name = Path.GetFileName(fullDir);
|
||||
|
||||
if (string.IsNullOrEmpty(name)){
|
||||
loadErrors.Add($"{group.GetIdentifierPrefix()}(?): Could not extract directory name from path: {fullDir}");
|
||||
continue;
|
||||
}
|
||||
|
||||
Plugin plugin;
|
||||
|
||||
try{
|
||||
plugin = PluginLoader.FromFolder(fullDir, group);
|
||||
plugin = PluginLoader.FromFolder(name, fullDir, Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name), group);
|
||||
}catch(Exception e){
|
||||
loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+e.Message);
|
||||
loadErrors.Add($"{group.GetIdentifierPrefix()}{name}: {e.Message}");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
53
Program.cs
53
Program.cs
@@ -1,25 +1,27 @@
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Collections;
|
||||
using TweetLib.Core.Utils;
|
||||
|
||||
namespace TweetDuck{
|
||||
static class Program{
|
||||
public const string BrandName = "TweetDuck";
|
||||
public const string Website = "https://tweetduck.chylex.com";
|
||||
public const string BrandName = Lib.BrandName;
|
||||
public const string VersionTag = Lib.VersionTag;
|
||||
|
||||
public const string VersionTag = "1.15.1";
|
||||
public const string Website = "https://tweetduck.chylex.com";
|
||||
|
||||
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||
public static readonly bool IsPortable = File.Exists(Path.Combine(ProgramPath, "makeportable"));
|
||||
@@ -46,22 +48,18 @@ namespace TweetDuck{
|
||||
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath, ".lock"));
|
||||
private static bool HasCleanedUp;
|
||||
|
||||
public static UserConfig UserConfig { get; private set; }
|
||||
public static SystemConfig SystemConfig { get; private set; }
|
||||
public static Reporter Reporter { get; }
|
||||
public static CultureInfo Culture { get; }
|
||||
public static ConfigManager Config { get; }
|
||||
|
||||
static Program(){
|
||||
Culture = CultureInfo.CurrentCulture;
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
|
||||
|
||||
#if DEBUG
|
||||
CultureInfo.DefaultThreadCurrentUICulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us"); // force english exceptions
|
||||
#endif
|
||||
|
||||
Reporter = new Reporter(ErrorLogFilePath);
|
||||
Reporter.SetupUnhandledExceptionHandler("TweetDuck Has Failed :(");
|
||||
|
||||
Config = new ConfigManager();
|
||||
|
||||
Lib.Initialize(new App.Builder{
|
||||
ErrorHandler = Reporter
|
||||
});
|
||||
}
|
||||
|
||||
[STAThread]
|
||||
@@ -72,7 +70,7 @@ namespace TweetDuck{
|
||||
|
||||
WindowRestoreMessage = NativeMethods.RegisterWindowMessage("TweetDuckRestore");
|
||||
|
||||
if (!WindowsUtils.CheckFolderWritePermission(StoragePath)){
|
||||
if (!FileUtils.CheckFolderWritePermission(StoragePath)){
|
||||
FormMessage.Warning("Permission Error", "TweetDuck does not have write permissions to the storage folder: "+StoragePath, FormMessage.OK);
|
||||
return;
|
||||
}
|
||||
@@ -113,8 +111,7 @@ namespace TweetDuck{
|
||||
}
|
||||
}
|
||||
|
||||
UserConfig = UserConfig.Load(UserConfigFilePath);
|
||||
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
|
||||
Config.LoadAll();
|
||||
|
||||
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
||||
ProfileManager.ImportCookies();
|
||||
@@ -125,6 +122,14 @@ namespace TweetDuck{
|
||||
|
||||
if (Arguments.HasFlag(Arguments.ArgUpdated)){
|
||||
WindowsUtils.TryDeleteFolderWhenAble(InstallerPath, 8000);
|
||||
BrowserCache.TryClearNow();
|
||||
}
|
||||
|
||||
try{
|
||||
RequestHandlerBase.LoadResourceRewriteRules(Arguments.GetValue(Arguments.ArgFreeze));
|
||||
}catch(Exception e){
|
||||
FormMessage.Error("Resource Freeze", "Error parsing resource rewrite rules: "+e.Message, FormMessage.OK);
|
||||
return;
|
||||
}
|
||||
|
||||
BrowserCache.RefreshTimer();
|
||||
@@ -143,7 +148,7 @@ namespace TweetDuck{
|
||||
#endif
|
||||
};
|
||||
|
||||
CommandLineArgs.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
||||
CommandLineArgs.ReadCefArguments(Config.User.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
||||
BrowserUtils.SetupCefArgs(settings.CefCommandLineArgs);
|
||||
|
||||
Cef.Initialize(settings, false, new BrowserProcessHandler());
|
||||
@@ -158,7 +163,7 @@ namespace TweetDuck{
|
||||
|
||||
// ProgramPath has a trailing backslash
|
||||
string updaterArgs = "/SP- /SILENT /FORCECLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentForInstallerCmd()+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
||||
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
|
||||
bool runElevated = !IsPortable || !FileUtils.CheckFolderWritePermission(ProgramPath);
|
||||
|
||||
if (WindowsUtils.OpenAssociatedProgram(mainForm.UpdateInstallerPath, updaterArgs, runElevated)){
|
||||
Application.Exit();
|
||||
@@ -170,7 +175,7 @@ namespace TweetDuck{
|
||||
}
|
||||
|
||||
private static string GetDataStoragePath(){
|
||||
string custom = Arguments.GetValue(Arguments.ArgDataFolder, null);
|
||||
string custom = Arguments.GetValue(Arguments.ArgDataFolder);
|
||||
|
||||
if (custom != null && (custom.Contains(Path.DirectorySeparatorChar) || custom.Contains(Path.AltDirectorySeparatorChar))){
|
||||
if (Path.GetInvalidPathChars().Any(custom.Contains)){
|
||||
@@ -213,7 +218,7 @@ namespace TweetDuck{
|
||||
private static void ExitCleanup(){
|
||||
if (HasCleanedUp)return;
|
||||
|
||||
UserConfig.Save();
|
||||
Config.SaveAll();
|
||||
|
||||
Cef.Shutdown();
|
||||
BrowserCache.Exit();
|
||||
|
2
Properties/Resources.Designer.cs
generated
2
Properties/Resources.Designer.cs
generated
@@ -19,7 +19,7 @@ namespace TweetDuck.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
28
README.md
28
README.md
@@ -1,30 +1,28 @@
|
||||
# Support
|
||||
|
||||
[Follow TweetDuck on Twitter](https://twitter.com/TryMyAwesomeApp) | [Support via PayPal](https://paypal.me/chylex) | [Support via Patreon](https://www.patreon.com/chylex)
|
||||
[Follow TweetDuck on Twitter](https://twitter.com/TryMyAwesomeApp) | [Support via Ko-fi](https://ko-fi.com/chylex) | [Support via Patreon](https://www.patreon.com/chylex)
|
||||
|
||||
# Build Instructions
|
||||
|
||||
### Setup
|
||||
|
||||
The program was built using Visual Studio 2017. Before opening the solution, please make sure you have the following workloads and components installed (optional components that are not listed can be deselected to save space):
|
||||
The program can be built using Visual Studio 2019. Before opening the solution, please make sure you have the following workloads and components installed (optional components that are not listed can be deselected to save space):
|
||||
* **.NET desktop development**
|
||||
* .NET Framework 4 – 4.6 development tools
|
||||
* .NET Framework 4.7.2 SDK
|
||||
* F# desktop language support
|
||||
* **Desktop development with C++**
|
||||
* VC++ 2017 latest v141 tools
|
||||
* MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.20)
|
||||
|
||||
After opening the solution, right-click the solution and select **Restore NuGet Packages**, or manually run this command in the **Package Manager Console**:
|
||||
```
|
||||
PM> Install-Package CefSharp.WinForms -Version 67.0.0-CI2662 -Source https://www.myget.org/F/cefsharp/api/v3/index.json
|
||||
PM> Install-Package CefSharp.WinForms -Version 67.0.0
|
||||
```
|
||||
|
||||
Note that some pre-release builds of CefSharp are not available on NuGet. To correctly restore packages in that case, open **Package Manager Settings**, and add `https://www.myget.org/F/cefsharp/api/v3/index.json` to the list of package sources.
|
||||
|
||||
### Debug
|
||||
|
||||
The `Debug` configuration uses a separate data folder by default (`%LOCALAPPDATA%\TweetDuckDebug`) to avoid affecting an existing installation of TweetDuck. You can modify this by opening **TweetDuck Properties** in Visual Studio, clicking the **Debug** tab, and changing the **Command line arguments** field.
|
||||
|
||||
While debugging, opening the main menu and clicking **Reload browser** automatically rebuilds all resources in the `Resources/Scripts` and `Resources/Plugins` folders. This allows editing HTML/CSS/JS files and applying the changes without restarting the program, but it will cause a short delay between browser reloads.
|
||||
While debugging, opening the main menu and clicking **Reload browser** automatically rebuilds all resources in `Resources/Scripts` and `Resources/Plugins`. This allows editing HTML/CSS/JS files without restarting the program, but it will cause a short delay between browser reloads. An F# compiler must be present when building the project to enable this feature: `C:\Program Files (x86)\Microsoft SDKs\F#\10.1\Framework\v4.0\fsc.exe`
|
||||
|
||||
### Release
|
||||
|
||||
@@ -32,7 +30,7 @@ Open **Batch Build**, tick all `Release` configurations with `x86` platform, and
|
||||
|
||||
After the build succeeds, the `bin/x86/Release` folder will contain files intended for distribution (no debug symbols or other unnecessary files). You may package these files yourself, or see the [Installers](#installers) section for automated installer generation.
|
||||
|
||||
The `Release` configuration omits debug symbols and other unnecessary files. You can modify this behavior by opening `TweetDuck.csproj`, and editing the `<Target Name="AfterBuild" Condition="$(ConfigurationName) == Release">` section.
|
||||
The `Release` configuration omits debug symbols and other unnecessary files, and it will automatically generate the [update installer](#installers) if the environment is setup correctly. You can modify this behavior by opening `TweetDuck.csproj`, and editing the `<Target Name="AfterBuild" Condition="$(ConfigurationName) == Release">` section.
|
||||
|
||||
If you decide to publicly release a custom version, please make it clear that it is not an official release of TweetDuck. There are many references to the official website and this repository, especially in the update system, so search for `chylex.com` and `github.com` in all files and replace them appropriately.
|
||||
|
||||
@@ -40,7 +38,7 @@ If you decide to publicly release a custom version, please make it clear that it
|
||||
|
||||
#### Error: The command (...) exited with code 1
|
||||
- This indicates a failed post-build event, open the **Output** tab for logs
|
||||
- Determine if there was an IO error from the `rmdir` commands, or whether the error was in the **PostBuild.ps1** script (`Encountered an error while running PostBuild.ps1 on line <xyz>`)
|
||||
- Determine if there was an IO error from the `rmdir` commands, the custom MSBuild targets near the end of the [.csproj file](https://github.com/chylex/TweetDuck/blob/master/TweetDuck.csproj), or in the **PostBuild.fsx** script (`Encountered an error while running PostBuild`)
|
||||
- Some files are checked for invalid characters:
|
||||
- `Resources/Plugins/emoji-keyboard/emoji-ordering.txt` line endings must be LF (line feed); any CR (carriage return) in the file will cause a failed build, and you will need to ensure correct line endings in your text editor
|
||||
|
||||
@@ -50,22 +48,24 @@ TweetDuck uses **Inno Setup** for installers and updates. First, download and in
|
||||
|
||||
Next, add the Inno Setup installation folder (usually `C:\Program Files (x86)\Inno Setup 5`) into your **PATH** environment variable. You may need to restart File Explorer for the change to take place.
|
||||
|
||||
Now you can generate installers after a build by running `bld/RUN BUILD.bat`. Note that this will only package the files, you still need to run the [release build](#release) in Visual Studio!
|
||||
Now you can generate installers by running `bld/GEN INSTALLERS.bat`. Note that this will only package the files, you still need to run the [release build](#release) in Visual Studio!
|
||||
|
||||
After the window closes, three installers will be generated inside the `bld/Output` folder:
|
||||
* **TweetDuck.exe**
|
||||
* This is the main installer that creates entries in the Start Menu & Programs and Features, and an optional desktop icon
|
||||
* **TweetDuck.Update.exe**
|
||||
* This is a lightweight update installer that only contains the most important files that usually change across releases
|
||||
* It will automatically download and apply the full installer if the user's current version of CEF does not match (the download link is in `gen_upd.iss` and points to this repository by default)
|
||||
* It will automatically download and apply the full installer if the user's current version of CEF does not match
|
||||
* **TweetDuck.Portable.exe**
|
||||
* This is a portable installer that does not need administrator privileges
|
||||
* It automatically creates a `makeportable` file in the program folder, which forces TweetDuck to run in portable mode
|
||||
|
||||
The installers are built for GitHub Releases, where the main and portable installers can download and install Visual C++ if it's missing, and the update installer will download and apply the full installer when needed. If you plan to distribute your own installers via GitHub, you can change the variables in the installer files (`.iss`) and in the update system to point to your repository, and use the power of the existing update system.
|
||||
|
||||
#### Notes
|
||||
|
||||
> When opening **Batch Build**, you will also see `x64` and `AnyCPU` configurations. These are visible due to what I consider a Visual Studio bug, and will not work without significant changes to the project. Manually running the `Resources/PostCefUpdate.ps1` PowerShell script modifies the downloaded CefSharp packages, and removes the invalid configurations.
|
||||
|
||||
> There is a small chance running `RUN BUILD.bat` immediately shows a resource error. If that happens, close the console window (which terminates all Inno Setup processes and leaves corrupted installers in the output folder), and run it again.
|
||||
> There is a small chance running `GEN INSTALLERS.bat` immediately shows a resource error. If that happens, close the console window (which terminates all Inno Setup processes and leaves corrupted installers in the output folder), and run it again.
|
||||
|
||||
> Running `RUN BUILD.bat` uses about 400 MB of RAM due to high compression. You can lower this to about 140 MB by opening `gen_full.iss` and `gen_port.iss`, and changing `LZMADictionarySize=15360` to `LZMADictionarySize=4096`.
|
||||
> Running `GEN INSTALLERS.bat` uses about 400 MB of RAM due to high compression. You can lower this to about 140 MB by opening `gen_full.iss` and `gen_port.iss`, and changing `LZMADictionarySize=15360` to `LZMADictionarySize=4096`.
|
||||
|
23
Reporter.cs
23
Reporter.cs
@@ -4,10 +4,13 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetLib.Core;
|
||||
using TweetLib.Core.Application;
|
||||
|
||||
namespace TweetDuck{
|
||||
sealed class Reporter{
|
||||
sealed class Reporter : IAppErrorHandler{
|
||||
private readonly string logFile;
|
||||
|
||||
public Reporter(string logFile){
|
||||
@@ -22,9 +25,17 @@ namespace TweetDuck{
|
||||
};
|
||||
}
|
||||
|
||||
public bool Log(string data){
|
||||
public bool LogVerbose(string data){
|
||||
return Arguments.HasFlag(Arguments.ArgLogging) && LogImportant(data);
|
||||
}
|
||||
|
||||
public bool LogImportant(string data){
|
||||
return ((IAppErrorHandler)this).Log(data);
|
||||
}
|
||||
|
||||
bool IAppErrorHandler.Log(string text){
|
||||
#if DEBUG
|
||||
Debug.WriteLine(data);
|
||||
Debug.WriteLine(text);
|
||||
#endif
|
||||
|
||||
StringBuilder build = new StringBuilder();
|
||||
@@ -33,8 +44,8 @@ namespace TweetDuck{
|
||||
build.Append("Please, report all issues to: https://github.com/chylex/TweetDuck/issues\r\n\r\n");
|
||||
}
|
||||
|
||||
build.Append("[").Append(DateTime.Now.ToString("G", Program.Culture)).Append("]\r\n");
|
||||
build.Append(data).Append("\r\n\r\n");
|
||||
build.Append("[").Append(DateTime.Now.ToString("G", Lib.Culture)).Append("]\r\n");
|
||||
build.Append(text).Append("\r\n\r\n");
|
||||
|
||||
try{
|
||||
File.AppendAllText(logFile, build.ToString(), Encoding.UTF8);
|
||||
@@ -45,7 +56,7 @@ namespace TweetDuck{
|
||||
}
|
||||
|
||||
public void HandleException(string caption, string message, bool canIgnore, Exception e){
|
||||
bool loggedSuccessfully = Log(e.ToString());
|
||||
bool loggedSuccessfully = LogImportant(e.ToString());
|
||||
|
||||
string exceptionText = e is ExpandedLogException ? e.Message+"\n\nDetails with potentially sensitive information are in the Error Log." : e.Message;
|
||||
FormMessage form = new FormMessage(caption, message+"\nError: "+exceptionText, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);
|
||||
|
3
Resources/Plugins/.debug/notification.js
Normal file
3
Resources/Plugins/.debug/notification.js
Normal file
@@ -0,0 +1,3 @@
|
||||
run(){
|
||||
console.info("executed debug plugin in notification");
|
||||
}
|
@@ -87,14 +87,14 @@ enabled(){
|
||||
// update UI
|
||||
|
||||
this.btnClearAllHTML = `
|
||||
<a class="clear-columns-btn-all-parent 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">
|
||||
<a class="clear-columns-btn-all-parent js-header-action link-clean cf app-nav-link padding-h--16 padding-v--2" 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="clear-columns-btn-all nbfc padding-ts hide-condensed txt-size--16 app-nav-link-text">Clear columns</div>
|
||||
<div class="clear-columns-btn-all nbfc padding-ts hide-condensed txt-size--14 app-nav-link-text">Clear columns</div>
|
||||
</a>`;
|
||||
|
||||
this.btnClearOneHTML = `
|
||||
<a class="js-action-header-button column-header-link" href="#" data-action="td-clearcolumns-dosingle">
|
||||
<i class="icon icon-clear-timeline js-show-tip" data-placement="bottom" data-original-title="Clear column (hold Shift to restore)" data-action="td-clearcolumns-dosingle"></i>
|
||||
<i class="icon icon-clear-timeline js-show-tip" data-placement="bottom" data-original-title="Clear column (hold Shift to restore)" data-action="td-clearcolumns-dosingle"></i>
|
||||
</a>`;
|
||||
|
||||
this.prevNavMenuMustache = TD.mustaches["menus/column_nav_menu.mustache"];
|
||||
@@ -110,16 +110,28 @@ enabled(){
|
||||
|
||||
// styles
|
||||
|
||||
if (!document.getElementById("td-clearcolumns-workaround")){
|
||||
// TD started caching mustaches so disabling the plugin doesn't update the column headers properly...
|
||||
let workaround = document.createElement("style");
|
||||
workaround.id = "td-clearcolumns-workaround";
|
||||
workaround.innerText = "#tduck a[data-action='td-clearcolumns-dosingle'] { display: none }";
|
||||
document.head.appendChild(workaround);
|
||||
}
|
||||
|
||||
this.css = window.TDPF_createCustomStyle(this);
|
||||
|
||||
this.css.insert(".js-app-add-column.is-hidden + .clear-columns-btn-all-parent { display: none; }");
|
||||
this.css.insert(".column-header-links { min-width: 51px !important; }");
|
||||
this.css.insert("[data-td-icon='icon-message'] .column-header-links { min-width: 110px !important; }");
|
||||
this.css.insert(".column-navigator-overflow .clear-columns-btn-all-parent { display: none !important; }");
|
||||
this.css.insert(".column-navigator-overflow { bottom: 224px !important; }");
|
||||
this.css.insert("[data-action='td-clearcolumns-dosingle'] { padding: 3px 0 !important; }");
|
||||
this.css.insert("[data-action='clear'].btn-options-tray { display: none !important; }");
|
||||
this.css.insert("[data-td-icon='icon-schedule'] .td-clear-column-shortcut { display: none; }");
|
||||
this.css.insert("[data-td-icon='icon-custom-timeline'] .td-clear-column-shortcut { display: none; }");
|
||||
this.css.insert(".app-navigator .clear-columns-btn-all-parent { font-weight: 700; }");
|
||||
|
||||
this.css.insert(".column-header-links { min-width: 51px !important; }");
|
||||
this.css.insert(".column[data-td-icon='icon-message'] .column-header-links { min-width: 110px !important; }");
|
||||
this.css.insert(".btn-options-tray[data-action='clear'] { display: none !important; }");
|
||||
|
||||
this.css.insert("#tduck a[data-action='td-clearcolumns-dosingle'] { display: inline-block; }");
|
||||
this.css.insert("#tduck .column[data-td-icon='icon-schedule'] a[data-action='td-clearcolumns-dosingle'] { display: none; }");
|
||||
this.css.insert("#tduck .column[data-td-icon='icon-custom-timeline'] a[data-action='td-clearcolumns-dosingle'] { display: none; }");
|
||||
}
|
||||
|
||||
ready(){
|
||||
|
@@ -2,19 +2,20 @@ enabled(){
|
||||
// elements & data
|
||||
this.css = null;
|
||||
this.icons = null;
|
||||
this.htmlModal = null;
|
||||
this.config = null;
|
||||
|
||||
this.defaultConfig = {
|
||||
_theme: "light",
|
||||
themeOverride: false,
|
||||
columnWidth: "310px",
|
||||
composerWidth: "default",
|
||||
fontSize: "12px",
|
||||
hideTweetActions: true,
|
||||
moveTweetActionsToRight: true,
|
||||
themeColorTweaks: true,
|
||||
revertIcons: true,
|
||||
showCharacterCount: true,
|
||||
forceArialFont: true,
|
||||
increaseQuoteTextSize: false,
|
||||
smallComposeTextSize: false,
|
||||
optimizeAnimations: true,
|
||||
@@ -41,13 +42,6 @@ enabled(){
|
||||
|
||||
const me = this;
|
||||
|
||||
// modal dialog loading
|
||||
$TDP.readFileRoot(this.$token, "modal.html").then(contents => {
|
||||
this.htmlModal = contents;
|
||||
}).catch(err => {
|
||||
$TD.alert("error", "Problem loading data for the design edit plugin: "+err.message);
|
||||
});
|
||||
|
||||
// configuration
|
||||
const configFile = "config.json";
|
||||
|
||||
@@ -112,7 +106,7 @@ enabled(){
|
||||
|
||||
// settings click event
|
||||
this.onSettingsMenuClickedEvent = () => {
|
||||
return if this.htmlModal === null || this.config === null;
|
||||
return if this.config === null;
|
||||
|
||||
setTimeout(() => {
|
||||
let menu = $(".js-dropdown-content").children("ul").first();
|
||||
@@ -181,20 +175,26 @@ enabled(){
|
||||
// SELECTS
|
||||
else if (tag === "SELECT"){
|
||||
let optionCustom = item.find("option[value^='custom']");
|
||||
let optionCustomNew = item.find("option[value^='change-custom']");
|
||||
|
||||
let resetMyValue = () => {
|
||||
if (!item.val(me.config[key]).val() && optionCustom.length === 1){
|
||||
item.val(optionCustom.attr("value"));
|
||||
optionCustom.text(getTextForCustom(key));
|
||||
optionCustomNew.show();
|
||||
}
|
||||
else{
|
||||
optionCustom.text("Custom");
|
||||
optionCustomNew.hide();
|
||||
}
|
||||
};
|
||||
|
||||
resetMyValue();
|
||||
|
||||
item.change(function(){ // TODO change doesn't fire when Custom is already selected
|
||||
item.change(function(){
|
||||
let val = item.val();
|
||||
|
||||
if (val === "custom-px"){
|
||||
if (val.endsWith("custom-px")){
|
||||
val = (prompt("Enter custom value (px):") || "").trim();
|
||||
|
||||
if (val){
|
||||
@@ -204,21 +204,17 @@ enabled(){
|
||||
|
||||
if (/^[0-9]+$/.test(val)){
|
||||
updateKey(key, val+"px");
|
||||
optionCustom.text(getTextForCustom(key));
|
||||
}
|
||||
else{
|
||||
alert("Invalid value, only px values are supported.");
|
||||
resetMyValue();
|
||||
}
|
||||
}
|
||||
else{
|
||||
resetMyValue();
|
||||
}
|
||||
}
|
||||
else{
|
||||
updateKey(key, item.val());
|
||||
optionCustom.text("Custom");
|
||||
}
|
||||
|
||||
resetMyValue();
|
||||
});
|
||||
}
|
||||
// CUSTOM ELEMENTS
|
||||
@@ -260,7 +256,7 @@ enabled(){
|
||||
|
||||
setTimeout(function(){
|
||||
if (theme != TD.settings.getTheme()){
|
||||
$(document).trigger("uiToggleTheme");
|
||||
TD.settings.setTheme(theme);
|
||||
}
|
||||
|
||||
me.saveConfig();
|
||||
@@ -268,13 +264,17 @@ enabled(){
|
||||
}, 1);
|
||||
});
|
||||
}).methods({
|
||||
_render: () => $(this.htmlModal),
|
||||
_render: function(){
|
||||
return $(me.htmlModal);
|
||||
},
|
||||
destroy: function(){
|
||||
if (this.reloadPage){
|
||||
window.TDPF_requestReload();
|
||||
return;
|
||||
}
|
||||
|
||||
delete me.htmlModal;
|
||||
|
||||
$("#td-design-plugin-modal").hide();
|
||||
this.supr();
|
||||
}
|
||||
@@ -381,8 +381,15 @@ enabled(){
|
||||
this.css.insert("#general_settings .cf { display: none !important }");
|
||||
this.css.insert("#settings-modal .js-setting-list li:nth-child(3) { border-bottom: 1px solid #ccd6dd }");
|
||||
|
||||
this.css.insert("html[data-td-font] { font-size: "+this.config.fontSize+" !important }");
|
||||
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");
|
||||
this.css.insert(`html[data-td-font] { font-size: ${this.config.fontSize} !important }`);
|
||||
this.css.insert(`.avatar { border-radius: ${this.config.avatarRadius}% !important }`);
|
||||
|
||||
if (this.config.composerWidth !== "default"){
|
||||
const width = this.config.composerWidth;
|
||||
this.css.insert(`.js-app-content.is-open { margin-right: ${width} !important; transform: translateX(${width}) !important }`);
|
||||
this.css.insert(`#tduck .js-app-content.tduck-is-opening { margin-right: 0 !important }`);
|
||||
this.css.insert(`.js-drawer { width: ${width} !important; left: -${width} !important }`);
|
||||
}
|
||||
|
||||
let currentTheme = TD.settings.getTheme();
|
||||
|
||||
@@ -432,6 +439,11 @@ enabled(){
|
||||
this.css.insert("#tduck .tweet-actions > li:nth-child(4) { margin-right: 2px !important }");
|
||||
}
|
||||
|
||||
if (this.config.forceArialFont){
|
||||
this.css.insert("#tduck { font-family: Arial, sans-serif; font-weight: 400 }");
|
||||
this.css.insert("#tduck input, #tduck label, #tduck select, #tduck textarea { font-family: Arial }")
|
||||
}
|
||||
|
||||
if (this.config.increaseQuoteTextSize){
|
||||
this.css.insert(".quoted-tweet { font-size: 1em !important }");
|
||||
}
|
||||
@@ -538,11 +550,13 @@ ${iconData.map(entry => `#tduck .icon-${entry[0]}:before{content:\"\\f0${entry[1
|
||||
|
||||
.drawer .btn .icon, .app-header .btn .icon { line-height: 1em !important }
|
||||
.app-search-fake .icon { margin-top: -3px !important }
|
||||
#tduck .js-docked-compose .js-drawer-close { margin: 20px 0 0 !important }
|
||||
#tduck .search-input-control .icon { font-size: 20px !important; top: -4px !important }
|
||||
#tduck .js-docked-compose .js-drawer-close { margin: 20px 0 0 !important }
|
||||
#tduck .compose-media-bar-remove .icon-close, #tduck .compose-media-grid-remove .icon-close { padding: 3px 2px 1px !important }
|
||||
|
||||
.js-column-header .column-type-icon { margin-top: -1px !important }
|
||||
.js-column-header .column-type-icon { margin-top: 0 !important }
|
||||
.inline-reply .pull-left .Button--link { margin-top: 3px !important }
|
||||
.js-inline-compose-pop .icon-popout { font-size: 23px !important }
|
||||
|
||||
.tweet-action-item .icon-favorite-toggle { font-size: 16px !important; }
|
||||
.tweet-action-item .heartsprite { top: -260% !important; left: -260% !important; transform: scale(0.4, 0.39) translateY(0.5px) !important; }
|
||||
@@ -597,6 +611,10 @@ ${iconData.map(entry => `#tduck .icon-${entry[0]}:before{content:\"\\f0${entry[1
|
||||
html[data-td-font] { font-size: ${this.config.fontSize} !important }
|
||||
.avatar { border-radius: ${this.config.avatarRadius}% !important }
|
||||
|
||||
${this.config.forceArialFont ? `
|
||||
#tduck { font-family: Arial, sans-serif; font-weight: 400 }
|
||||
` : ``}
|
||||
|
||||
${this.config.increaseQuoteTextSize ? `
|
||||
.quoted-tweet { font-size: 1em !important }
|
||||
` : ``}
|
||||
@@ -628,6 +646,13 @@ ${notificationScrollbarColor ? `
|
||||
$(".js-dropdown.pos-r").toggleClass("pos-r pos-l");
|
||||
}
|
||||
};
|
||||
|
||||
this.uiDrawerActiveEvent = (e, data) => {
|
||||
return if data.activeDrawer === null || this.config.composerWidth === "default";
|
||||
|
||||
const ele = $(".js-app-content").addClass("tduck-is-opening");
|
||||
setTimeout(() => ele.removeClass("tduck-is-opening"), 250);
|
||||
};
|
||||
}
|
||||
|
||||
ready(){
|
||||
@@ -637,6 +662,7 @@ ready(){
|
||||
|
||||
// layout events
|
||||
$(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||
$(document).on("uiDrawerActive", this.uiDrawerActiveEvent);
|
||||
|
||||
// modal
|
||||
$("[data-action='settings-menu']").on("click", this.onSettingsMenuClickedEvent);
|
||||
@@ -670,7 +696,12 @@ ready(){
|
||||
}
|
||||
|
||||
configure(){
|
||||
new this.customDesignModal();
|
||||
$TDP.readFileRoot(this.$token, "modal.html").then(contents => {
|
||||
this.htmlModal = contents;
|
||||
new this.customDesignModal();
|
||||
}).catch(err => {
|
||||
$TD.alert("error", "Error loading the configuration dialog: "+err.message);
|
||||
});
|
||||
}
|
||||
|
||||
disabled(){
|
||||
@@ -694,10 +725,12 @@ disabled(){
|
||||
window.clearTimeout(this.optimizationTimer);
|
||||
}
|
||||
|
||||
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||
$(window).off("focus", this.onWindowFocusEvent);
|
||||
$(window).off("blur", this.onWindowBlurEvent);
|
||||
|
||||
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||
$(document).off("uiDrawerActive", this.uiDrawerActiveEvent);
|
||||
|
||||
TD.components.GlobalSettings.prototype.getInfo = this.prevFuncSettingsGetInfo;
|
||||
TD.components.GlobalSettings.prototype.switchTab = this.prevFuncSettingsSwitchTab;
|
||||
|
||||
|
@@ -41,6 +41,7 @@
|
||||
<option value="350px">Wide (350px)</option>
|
||||
<option value="400px">Extreme (400px)</option>
|
||||
<option value="custom-px">Custom</option>
|
||||
<option value="change-custom-px">Change custom value...</option>
|
||||
</optgroup>
|
||||
<option disabled></option>
|
||||
<optgroup label="Dynamic width">
|
||||
@@ -54,6 +55,20 @@
|
||||
<option disabled></option>
|
||||
</select>
|
||||
|
||||
<!-- COMPOSER SIZE -->
|
||||
|
||||
<label class="txt-uppercase touch-larger-label">
|
||||
<b>New Tweet panel</b>
|
||||
</label>
|
||||
<select data-td-key="composerWidth">
|
||||
<option value="default">Default</option>
|
||||
<option value="270px">Narrow (270px)</option>
|
||||
<option value="310px">Medium (310px)</option>
|
||||
<option value="350px">Wide (350px)</option>
|
||||
<option value="custom-px">Custom</option>
|
||||
<option value="change-custom-px">Change custom value...</option>
|
||||
</select>
|
||||
|
||||
<!-- FONT SIZE -->
|
||||
|
||||
<label class="txt-uppercase touch-larger-label">
|
||||
@@ -66,6 +81,7 @@
|
||||
<option value="15px">Large (15px)</option>
|
||||
<option value="16px">Largest (16px)</option>
|
||||
<option value="custom-px">Custom</option>
|
||||
<option value="change-custom-px">Change custom value...</option>
|
||||
</select>
|
||||
<label class="checkbox">
|
||||
<input data-td-key="increaseQuoteTextSize" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
@@ -110,6 +126,10 @@
|
||||
<input data-td-key="themeColorTweaks" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Theme color tweaks
|
||||
</label>
|
||||
<label class="checkbox">
|
||||
<input data-td-key="forceArialFont" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||
Use Arial as default font
|
||||
</label>
|
||||
|
||||
<!-- ADVANCED -->
|
||||
|
||||
@@ -166,13 +186,24 @@
|
||||
|
||||
#edit-design-panel {
|
||||
width: 693px;
|
||||
height: 380px;
|
||||
height: 424px;
|
||||
background-color: #FFF;
|
||||
box-shadow: 0 0 10px rgba(17, 17, 17, 0.5);
|
||||
}
|
||||
|
||||
#edit-design-panel .mdl-header {
|
||||
color: #8899A6;
|
||||
}
|
||||
|
||||
#edit-design-panel .mdl-inner {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#edit-design-panel .mdl-content {
|
||||
border: 1px solid #CCD6DD;
|
||||
background: #EAEAEA;
|
||||
}
|
||||
|
||||
#edit-design-panel-inner-cols {
|
||||
padding: 0 6px;
|
||||
}
|
||||
@@ -200,7 +231,7 @@
|
||||
|
||||
#edit-design-panel-content label.radio {
|
||||
display: inline-block;
|
||||
margin: 0 16px 5px 4px;
|
||||
margin: 0 16px 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
@@ -117,7 +117,7 @@ html.dark .account-settings-bt{border-top:1px solid #e1e8ed}
|
||||
html.dark .account-settings-bb{border-bottom:1px solid #e1e8ed}
|
||||
html.dark .account-stats a{color:#66757f}
|
||||
html.dark .account-stats a:hover{color:#2b7bb9}
|
||||
html.dark .column{background-color:#222426}
|
||||
html.dark .column-panel{background-color:#222426}
|
||||
html.dark .column.is-focused{box-shadow:0 0 0 6px #7aa2c0}
|
||||
html.dark .column-background-fill{background-color:#F5F8FA}
|
||||
html.dark .more-tweets-glow{background-color:#55acee;background:radial-gradient(ellipse farthest-corner at 50% 100%,#55acee 0%,#55acee 25%,rgba(255,255,255,0) 75%)}
|
||||
@@ -135,7 +135,6 @@ html.dark .column-header{background-color:#292F33}
|
||||
html.dark .is-inverted-dark .column-header{border-bottom:1px solid #ddd}
|
||||
html.dark .is-inverted-dark .column-title-edit-box{color:#111;background-color:#fff;border-color:#e1e8ed}
|
||||
html.dark .column-header{border-bottom:1px solid #222426}
|
||||
html.dark .column-header-temp{border-bottom:1px solid #ddd}
|
||||
html.dark .column-title-edit-box{color:#e1e8ed;background-color:#14171A;border-color:#111}
|
||||
html.dark .column-number{color:#66757f}
|
||||
html.dark .is-new .column-type-icon{color:#55acee}
|
||||
@@ -428,8 +427,7 @@ html.dark .list-account .username{color:#8899a6}
|
||||
html.dark .list-listmember .username{color:#8899a6}
|
||||
html.dark .list-listmember .bio{color:#657786}
|
||||
html.dark .divider-bar{background-color:#ddd}
|
||||
html.dark select{background-color:#fff}
|
||||
html.dark input,html.dark textarea,html.dark select{color:#111;border:1px solid #e1e8ed}
|
||||
html.dark input,html.dark textarea,html.dark select{color:#111;border:1px solid #e1e8ed;background-color:#fff}
|
||||
html.dark input:disabled{background-color:#eaeaea;border-color:#e1e8ed}
|
||||
html.dark select:disabled{background-color:#f5f8fa}
|
||||
html.dark input:focus,html.dark select:focus,html.dark textarea:focus,html.dark .focus{border-color:rgba(80,165,230,0.8);box-shadow:inset 0 1px 3px rgba(17,17,17,0.1),0 0 8px rgba(80,165,230,0.6)}
|
||||
@@ -802,5 +800,12 @@ html.dark .NotificationList .Notification-body{color:#14171A}
|
||||
html.dark .DrawerModal{color:#14171A}
|
||||
/* fixes */
|
||||
html.dark .app-search-fake{border-color:transparent}
|
||||
html.dark .spinner-small,html.dark .spinner-large{filter:grayscale(80%)brightness(93%)}
|
||||
html.dark .spinner-small,html.dark .spinner-large{filter:grayscale(85%)brightness(117%)}
|
||||
html.dark .tweet>.color-twitter-blue{color:#8bd!important}
|
||||
html.dark .hw-card-container>div{border-color:#292F33;background:transparent}
|
||||
html.dark .hw-card-container>div>div{border-color:#292F33}
|
||||
html.dark .modal-content,html.dark .lst-group,html.dark #actions-modal{color:#292F33}
|
||||
html.dark #actions-modal .account-link{color:#38444d}
|
||||
html.dark .mdl-accent{background-color:transparent}
|
||||
html.dark .lst-launcher a span{color:#657786!important}
|
||||
html.dark .social-proof-names a{color:#3b94d9}
|
||||
|
@@ -56,11 +56,13 @@ enabled(){
|
||||
this.prevComposeMustache = TD.mustaches["compose/docked_compose.mustache"];
|
||||
window.TDPF_injectMustache("compose/docked_compose.mustache", "append", '<div class="cf margin-t--12 margin-b--30">', buttonHTML);
|
||||
|
||||
let maybeDockedComposePanel = $(".js-docked-compose");
|
||||
this.getDrawerInput = () => {
|
||||
return $(".js-compose-text", me.composeDrawer);
|
||||
};
|
||||
|
||||
if (maybeDockedComposePanel.length){
|
||||
maybeDockedComposePanel.find(".cf.margin-t--12.margin-b--30").first().append(buttonHTML);
|
||||
}
|
||||
this.getDrawerScroller = () => {
|
||||
return $(".js-compose-scroller > .scroll-v", me.composeDrawer);
|
||||
};
|
||||
|
||||
// keyboard generation
|
||||
|
||||
@@ -79,12 +81,12 @@ enabled(){
|
||||
|
||||
this.currentKeywords = [];
|
||||
|
||||
this.composePanelScroller.trigger("scroll");
|
||||
this.getDrawerScroller().trigger("scroll");
|
||||
|
||||
$(".emoji-keyboard-popup-btn").removeClass("is-selected");
|
||||
|
||||
if (refocus){
|
||||
this.composeInput.focus();
|
||||
this.getDrawerInput().focus();
|
||||
|
||||
if (lastEmojiKeyword && lastEmojiPosition === 0){
|
||||
document.execCommand("insertText", false, lastEmojiKeyword);
|
||||
@@ -229,16 +231,16 @@ enabled(){
|
||||
this.currentSpanner.style.height = ($(this.currentKeyboard).height()-10)+"px";
|
||||
$(".emoji-keyboard-popup-btn").parent().after(this.currentSpanner);
|
||||
|
||||
this.composePanelScroller.trigger("scroll");
|
||||
this.getDrawerScroller().trigger("scroll");
|
||||
};
|
||||
|
||||
const getKeyboardTop = () => {
|
||||
let button = $(".emoji-keyboard-popup-btn");
|
||||
return button.offset().top+button.outerHeight()+me.composePanelScroller.scrollTop()+8;
|
||||
return button.offset().top + button.outerHeight() + me.getDrawerScroller().scrollTop() + 8;
|
||||
};
|
||||
|
||||
const insertEmoji = (src, alt) => {
|
||||
let input = this.composeInput;
|
||||
let input = this.getDrawerInput();
|
||||
|
||||
let val = input.val();
|
||||
let posStart = input[0].selectionStart;
|
||||
@@ -378,6 +380,11 @@ enabled(){
|
||||
hideKeyboard();
|
||||
};
|
||||
|
||||
this.composerActiveEvent = function(e){
|
||||
$(".emoji-keyboard-popup-btn", me.composeDrawer).on("click", me.emojiKeyboardButtonClickEvent);
|
||||
$(".js-docked-compose .js-compose-scroller > .scroll-v", me.composeDrawer).on("scroll", me.composerScrollEvent);
|
||||
};
|
||||
|
||||
this.documentClickEvent = function(e){
|
||||
if (me.currentKeyboard && $(e.target).closest(".compose-text-container").length === 0){
|
||||
hideKeyboard();
|
||||
@@ -396,20 +403,26 @@ enabled(){
|
||||
me.currentKeyboard.style.top = getKeyboardTop()+"px";
|
||||
}
|
||||
};
|
||||
|
||||
// re-enabling
|
||||
|
||||
let maybeDockedComposePanel = $(".js-docked-compose");
|
||||
|
||||
if (maybeDockedComposePanel.length){
|
||||
maybeDockedComposePanel.find(".cf.margin-t--12.margin-b--30").first().append(buttonHTML);
|
||||
this.composerActiveEvent();
|
||||
}
|
||||
}
|
||||
|
||||
ready(){
|
||||
this.composeDrawer = $("[data-drawer='compose']");
|
||||
this.composeInput = $(".js-compose-text", ".js-docked-compose");
|
||||
this.composeDrawer = $(".js-drawer[data-drawer='compose']");
|
||||
this.composeSelector = ".js-compose-text,.js-reply-tweetbox";
|
||||
|
||||
this.composePanelScroller = $(".js-compose-scroller", ".js-docked-compose").first().children().first();
|
||||
this.composePanelScroller.on("scroll", this.composerScrollEvent);
|
||||
|
||||
$(".emoji-keyboard-popup-btn").on("click", this.emojiKeyboardButtonClickEvent);
|
||||
$(document).on("click", this.documentClickEvent);
|
||||
$(document).on("keydown", this.documentKeyEvent);
|
||||
$(document).on("tduckOldComposerActive", this.composerActiveEvent);
|
||||
$(document).on("uiComposeImageAdded", this.uploadFilesEvent);
|
||||
|
||||
this.composeDrawer.on("uiComposeTweetSending", this.composerSendingEvent);
|
||||
|
||||
$(document).on("keydown", this.composeSelector, this.composeInputKeyDownEvent);
|
||||
@@ -529,14 +542,13 @@ disabled(){
|
||||
$(this.currentSpanner).remove();
|
||||
}
|
||||
|
||||
this.composePanelScroller.off("scroll", this.composerScrollEvent);
|
||||
|
||||
$(".emoji-keyboard-popup-btn").off("click", this.emojiKeyboardButtonClickEvent);
|
||||
$(".emoji-keyboard-popup-btn").remove();
|
||||
|
||||
$(document).off("click", this.documentClickEvent);
|
||||
$(document).off("keydown", this.documentKeyEvent);
|
||||
$(document).off("tduckOldComposerActive", this.composerActiveEvent);
|
||||
$(document).off("uiComposeImageAdded", this.uploadFilesEvent);
|
||||
|
||||
this.composeDrawer.off("uiComposeTweetSending", this.composerSendingEvent);
|
||||
|
||||
$(document).off("keydown", this.composeSelector, this.composeInputKeyDownEvent);
|
||||
|
@@ -376,22 +376,25 @@ enabled(){
|
||||
};
|
||||
|
||||
this.drawerToggleEvent = function(e, data){
|
||||
if (data.activeDrawer === null){
|
||||
if (typeof data === "undefined" || data.activeDrawer !== "compose"){
|
||||
hideTemplateModal();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ready(){
|
||||
$(".manage-templates-btn").on("click", this.manageTemplatesButtonClickEvent);
|
||||
$(".js-drawer[data-drawer='compose']").on("click", ".manage-templates-btn", this.manageTemplatesButtonClickEvent);
|
||||
$(document).on("uiDrawerActive", this.drawerToggleEvent);
|
||||
$(document).on("click", ".js-new-composer-opt-in", this.drawerToggleEvent);
|
||||
}
|
||||
|
||||
disabled(){
|
||||
$(".manage-templates-btn").remove();
|
||||
$("#templates-modal-wrap").remove();
|
||||
|
||||
$(".js-drawer[data-drawer='compose']").off("click", ".manage-templates-btn", this.manageTemplatesButtonClickEvent);
|
||||
$(document).off("uiDrawerActive", this.drawerToggleEvent);
|
||||
$(document).off("click", ".js-new-composer-opt-in", this.drawerToggleEvent);
|
||||
|
||||
TD.mustaches["compose/docked_compose.mustache"] = this.prevComposeMustache;
|
||||
}
|
||||
|
@@ -171,14 +171,14 @@
|
||||
}
|
||||
|
||||
.template-editor-form input, .template-editor-form textarea {
|
||||
color: #111;
|
||||
background-color: #fff;
|
||||
color: #111 !important;
|
||||
background-color: #fff !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.template-editor-form input:focus, .template-editor-form textarea:focus {
|
||||
box-shadow: inset 0 1px 3px rgba(17, 17, 17, 0.1), 0 0 8px rgba(80, 165, 230, 0.6);
|
||||
box-shadow: inset 0 1px 3px rgba(17, 17, 17, 0.1), 0 0 8px rgba(80, 165, 230, 0.6) !important;
|
||||
}
|
||||
|
||||
.template-editor-form textarea {
|
||||
|
249
Resources/PostBuild.fsx
Normal file
249
Resources/PostBuild.fsx
Normal file
@@ -0,0 +1,249 @@
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
open System.Diagnostics
|
||||
open System.IO
|
||||
open System.Text.RegularExpressions
|
||||
open System.Threading.Tasks
|
||||
|
||||
// "$(DevEnvDir)CommonExtensions\Microsoft\FSharp\fsi.exe" "$(ProjectDir)Resources\PostBuild.fsx" --exec --nologo -- "$(TargetDir)\" "$(ProjectDir)\" "$(ConfigurationName)"
|
||||
// "$(ProjectDir)bld\post_build.exe" "$(TargetDir)\" "$(ProjectDir)\" "$(ConfigurationName)"
|
||||
|
||||
exception ArgumentUsage of string
|
||||
|
||||
#if !INTERACTIVE
|
||||
[<EntryPoint>]
|
||||
#endif
|
||||
let main (argv: string[]) =
|
||||
try
|
||||
if argv.Length < 2 then
|
||||
#if INTERACTIVE
|
||||
raise (ArgumentUsage "fsi.exe PostBuild.fsx --exec --nologo -- <TargetDir> <ProjectDir> [ConfigurationName] [VersionTag]")
|
||||
#else
|
||||
raise (ArgumentUsage "PostBuild.exe <TargetDir> <ProjectDir> [ConfigurationName] [VersionTag]")
|
||||
#endif
|
||||
|
||||
let _time name func =
|
||||
let sw = Stopwatch.StartNew()
|
||||
func()
|
||||
sw.Stop()
|
||||
printfn "[%s took %i ms]" name (int (Math.Round(sw.Elapsed.TotalMilliseconds)))
|
||||
|
||||
let (+/) path1 path2 =
|
||||
Path.Combine(path1, path2)
|
||||
|
||||
let sw = Stopwatch.StartNew()
|
||||
|
||||
// Setup
|
||||
|
||||
let targetDir = argv.[0]
|
||||
let projectDir = argv.[1]
|
||||
|
||||
let configuration = if argv.Length >= 3 then argv.[2]
|
||||
else "Release"
|
||||
|
||||
let version = if argv.Length >= 4 then argv.[3]
|
||||
else ((targetDir +/ "TweetDuck.exe") |> FileVersionInfo.GetVersionInfo).FileVersion
|
||||
|
||||
printfn "--------------------------"
|
||||
printfn "TweetDuck version %s" version
|
||||
printfn "--------------------------"
|
||||
|
||||
let localesDir = targetDir +/ "locales"
|
||||
let scriptsDir = targetDir +/ "scripts"
|
||||
let pluginsDir = targetDir +/ "plugins"
|
||||
let importsDir = scriptsDir +/ "imports"
|
||||
|
||||
// Functions (Strings)
|
||||
|
||||
let filterNotEmpty =
|
||||
Seq.filter (not << String.IsNullOrEmpty)
|
||||
|
||||
let replaceRegex (pattern: string) (replacement: string) input =
|
||||
Regex.Replace(input, pattern, replacement)
|
||||
|
||||
let collapseLines separator (sequence: string seq) =
|
||||
String.Join(separator, sequence)
|
||||
|
||||
let trimStart (line: string) =
|
||||
line.TrimStart()
|
||||
|
||||
// Functions (File Management)
|
||||
let copyFile source target =
|
||||
File.Copy(source, target, true)
|
||||
|
||||
let createDirectory path =
|
||||
Directory.CreateDirectory(path) |> ignore
|
||||
|
||||
let rec copyDirectoryContentsFiltered source target (filter: string -> bool) =
|
||||
if not (Directory.Exists(target)) then
|
||||
Directory.CreateDirectory(target) |> ignore
|
||||
|
||||
let src = DirectoryInfo(source)
|
||||
|
||||
for file in src.EnumerateFiles() do
|
||||
if filter file.Name then
|
||||
file.CopyTo(target +/ file.Name) |> ignore
|
||||
|
||||
for dir in src.EnumerateDirectories() do
|
||||
if filter dir.Name then
|
||||
copyDirectoryContentsFiltered dir.FullName (target +/ dir.Name) filter
|
||||
|
||||
let copyDirectoryContents source target =
|
||||
copyDirectoryContentsFiltered source target (fun _ -> true)
|
||||
|
||||
// Functions (File Processing)
|
||||
|
||||
let byPattern path pattern =
|
||||
Directory.EnumerateFiles(path, pattern, SearchOption.AllDirectories)
|
||||
|
||||
let exceptEndingWith name =
|
||||
Seq.filter (fun (file: string) -> not (file.EndsWith(name)))
|
||||
|
||||
let iterateFiles (files: string seq) (func: string -> unit) =
|
||||
Parallel.ForEach(files, func) |> ignore
|
||||
|
||||
let readFile file = seq {
|
||||
use stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 0x1000, FileOptions.SequentialScan)
|
||||
use reader = new StreamReader(stream)
|
||||
let mutable cont = true
|
||||
|
||||
while cont do
|
||||
let line = reader.ReadLine()
|
||||
|
||||
if line = null then
|
||||
cont <- false
|
||||
else
|
||||
yield line
|
||||
}
|
||||
|
||||
let writeFile (fullPath: string) (lines: string seq) =
|
||||
let relativePath = fullPath.[(targetDir.Length)..]
|
||||
let includeVersion = relativePath.StartsWith(@"scripts\") && not (relativePath.StartsWith(@"scripts\imports\"))
|
||||
let finalLines = if includeVersion then seq { yield "#" + version; yield! lines } else lines
|
||||
|
||||
File.WriteAllLines(fullPath, finalLines |> filterNotEmpty |> Seq.toArray)
|
||||
printfn "Processed %s" relativePath
|
||||
|
||||
let processFiles (files: string seq) (extProcessors: IDictionary<string, (string seq -> string seq)>) =
|
||||
let rec processFileContents file =
|
||||
readFile file
|
||||
|> extProcessors.[Path.GetExtension(file)]
|
||||
|> Seq.map (fun line ->
|
||||
Regex.Replace(line, @"#import ""(.*?)""", (fun matchInfo ->
|
||||
processFileContents(importsDir +/ matchInfo.Groups.[1].Value.Trim())
|
||||
|> collapseLines (Environment.NewLine)
|
||||
|> (fun contents -> contents.TrimEnd())
|
||||
))
|
||||
)
|
||||
|
||||
iterateFiles files (fun file ->
|
||||
processFileContents file
|
||||
|> (writeFile file)
|
||||
)
|
||||
|
||||
// Build
|
||||
|
||||
copyFile (projectDir +/ "bld/Resources/LICENSES.txt") (targetDir +/ "LICENSES.txt")
|
||||
|
||||
copyDirectoryContents (projectDir +/ "Resources/Scripts") scriptsDir
|
||||
|
||||
createDirectory (pluginsDir +/ "official")
|
||||
createDirectory (pluginsDir +/ "user")
|
||||
|
||||
copyDirectoryContentsFiltered
|
||||
(projectDir +/ "Resources/Plugins")
|
||||
(pluginsDir +/ "official")
|
||||
(fun name -> name <> ".debug" && name <> "emoji-instructions.txt")
|
||||
|
||||
if configuration = "Debug" then
|
||||
copyDirectoryContents
|
||||
(projectDir +/ "Resources/Plugins/.debug")
|
||||
(pluginsDir +/ "user/.debug")
|
||||
|
||||
if Directory.Exists(localesDir) || configuration = "Release" then
|
||||
Directory.EnumerateFiles(localesDir, "*.pak")
|
||||
|> exceptEndingWith @"\en-US.pak"
|
||||
|> Seq.iter (File.Delete)
|
||||
|
||||
// Validation
|
||||
|
||||
if File.ReadAllText(pluginsDir +/ "official/emoji-keyboard/emoji-ordering.txt").IndexOf('\r') <> -1 then
|
||||
raise (FormatException("emoji-ordering.txt must not have any carriage return characters"))
|
||||
else
|
||||
printfn "Verified emoji-ordering.txt"
|
||||
|
||||
// Processing
|
||||
|
||||
let fileProcessors =
|
||||
dict [
|
||||
".js", (fun (lines: string seq) ->
|
||||
lines
|
||||
|> Seq.map (fun line ->
|
||||
line
|
||||
|> trimStart
|
||||
|> replaceRegex @"^(.*?)((?<=^|[;{}()])\s?//(?:\s.*|$))?$" "$1"
|
||||
|> replaceRegex @"(?<!\w)(return|throw)(\s.*?)? if (.*?);" "if ($3)$1$2;"
|
||||
)
|
||||
);
|
||||
|
||||
".css", (fun (lines: string seq) ->
|
||||
lines
|
||||
|> Seq.map (fun line ->
|
||||
line
|
||||
|> replaceRegex @"\s*/\*.*?\*/" ""
|
||||
|> replaceRegex @"^(\S.*) {$" "$1{"
|
||||
|> replaceRegex @"^\s+(.+?):\s*(.+?)(?:\s*(!important))?;$" "$1:$2$3;"
|
||||
)
|
||||
|> filterNotEmpty
|
||||
|> collapseLines " "
|
||||
|> replaceRegex @"([{};])\s" "$1"
|
||||
|> replaceRegex @";}" "}"
|
||||
|> Seq.singleton
|
||||
);
|
||||
|
||||
".html", (fun (lines: string seq) ->
|
||||
lines
|
||||
|> Seq.map trimStart
|
||||
);
|
||||
|
||||
".meta", (fun (lines: string seq) ->
|
||||
lines
|
||||
|> Seq.map (fun line -> line.Replace("{version}", version))
|
||||
);
|
||||
]
|
||||
|
||||
processFiles ((byPattern targetDir "*.js") |> exceptEndingWith @"\configuration.default.js") fileProcessors
|
||||
processFiles (byPattern targetDir "*.css") fileProcessors
|
||||
processFiles (byPattern targetDir "*.html") fileProcessors
|
||||
processFiles (byPattern pluginsDir "*.meta") fileProcessors
|
||||
|
||||
// Cleanup
|
||||
|
||||
Directory.Delete(importsDir, true)
|
||||
|
||||
// Finished
|
||||
|
||||
sw.Stop()
|
||||
printfn "------------------"
|
||||
printfn "Finished in %i ms" (int (Math.Round(sw.Elapsed.TotalMilliseconds)))
|
||||
printfn "------------------"
|
||||
0
|
||||
|
||||
with
|
||||
| ArgumentUsage message ->
|
||||
printfn ""
|
||||
printfn "Build script usage:"
|
||||
printfn "%s" message
|
||||
printfn ""
|
||||
1
|
||||
| ex ->
|
||||
printfn ""
|
||||
printfn "Encountered an error while running PostBuild:"
|
||||
printfn "%A" ex
|
||||
printfn ""
|
||||
1
|
||||
|
||||
#if INTERACTIVE
|
||||
printfn "Running PostBuild in interpreter..."
|
||||
main (fsi.CommandLineArgs |> Array.skip (1 + (fsi.CommandLineArgs |> Array.findIndex (fun arg -> arg = "--"))))
|
||||
#endif
|
@@ -1,166 +0,0 @@
|
||||
Param(
|
||||
[Parameter(Mandatory = $True, Position = 1)][string] $targetDir,
|
||||
[Parameter(Mandatory = $True, Position = 2)][string] $projectDir,
|
||||
[Parameter(Position = 3)][string] $configuration = "Release",
|
||||
[Parameter(Position = 4)][string] $version = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
try{
|
||||
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||
|
||||
if ($version.Equals("")){
|
||||
$version = (Get-Item (Join-Path $targetDir "TweetDuck.exe")).VersionInfo.FileVersion
|
||||
}
|
||||
|
||||
Write-Host "--------------------------"
|
||||
Write-Host "TweetDuck version" $version
|
||||
Write-Host "--------------------------"
|
||||
|
||||
# Cleanup
|
||||
|
||||
if (Test-Path (Join-Path $targetDir "locales")){
|
||||
Remove-Item -Path (Join-Path $targetDir "locales\*.pak") -Exclude "en-US.pak"
|
||||
}
|
||||
|
||||
# Copy resources
|
||||
|
||||
Copy-Item (Join-Path $projectDir "bld\Resources\LICENSES.txt") -Destination $targetDir -Force
|
||||
|
||||
New-Item -ItemType directory -Path $targetDir -Name "scripts" | Out-Null
|
||||
New-Item -ItemType directory -Path $targetDir -Name "plugins" | Out-Null
|
||||
New-Item -ItemType directory -Path $targetDir -Name "plugins\official" | Out-Null
|
||||
New-Item -ItemType directory -Path $targetDir -Name "plugins\user" | Out-Null
|
||||
|
||||
Copy-Item (Join-Path $projectDir "Resources\Scripts\*") -Recurse -Destination (Join-Path $targetDir "scripts")
|
||||
Copy-Item (Join-Path $projectDir "Resources\Plugins\*") -Recurse -Destination (Join-Path $targetDir "plugins\official") -Exclude ".debug", "emoji-instructions.txt"
|
||||
|
||||
if ($configuration -eq "Debug"){
|
||||
New-Item -ItemType directory -Path $targetDir -Name "plugins\user\.debug" | Out-Null
|
||||
Copy-Item (Join-Path $projectDir "Resources\Plugins\.debug\*") -Recurse -Destination (Join-Path $targetDir "plugins\user\.debug")
|
||||
}
|
||||
|
||||
# Helper functions
|
||||
|
||||
function Remove-Empty-Lines{
|
||||
Param([Parameter(Mandatory = $True, Position = 1)] $lines)
|
||||
|
||||
foreach($line in $lines){
|
||||
if ($line -ne ''){
|
||||
$line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Carriage-Return{
|
||||
Param([Parameter(Mandatory = $True, Position = 1)] $file)
|
||||
|
||||
if (!(Test-Path $file)){
|
||||
Throw "$file does not exist"
|
||||
}
|
||||
|
||||
if ((Get-Content -Path $file -Raw).Contains("`r")){
|
||||
Throw "$file must not have any carriage return characters"
|
||||
}
|
||||
|
||||
Write-Host "Verified" $file.Substring($targetDir.Length)
|
||||
}
|
||||
|
||||
function Rewrite-File{
|
||||
Param([Parameter(Mandatory = $True, Position = 1)] $file,
|
||||
[Parameter(Mandatory = $True, Position = 2)] $lines,
|
||||
[Parameter(Mandatory = $True, Position = 3)] $imports)
|
||||
|
||||
$lines = Remove-Empty-Lines($lines)
|
||||
$relativePath = $file.FullName.Substring($targetDir.Length)
|
||||
|
||||
foreach($line in $lines){
|
||||
if ($line.Contains('#import ')){
|
||||
$imports.Add($file.FullName)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($relativePath.StartsWith("scripts\")){
|
||||
$lines = (,("#" + $version) + $lines)
|
||||
}
|
||||
|
||||
[IO.File]::WriteAllLines($file.FullName, $lines)
|
||||
Write-Host "Processed" $relativePath
|
||||
}
|
||||
|
||||
# Validation
|
||||
|
||||
Check-Carriage-Return(Join-Path $targetDir "plugins\official\emoji-keyboard\emoji-ordering.txt")
|
||||
|
||||
# Processing
|
||||
|
||||
$imports = New-Object "System.Collections.Generic.List[string]"
|
||||
|
||||
foreach($file in Get-ChildItem -Path $targetDir -Filter "*.js" -Exclude "configuration.default.js" -Recurse){
|
||||
$lines = [IO.File]::ReadLines($file.FullName)
|
||||
$lines = $lines | ForEach-Object { $_.TrimStart() }
|
||||
$lines = $lines -Replace '^(.*?)((?<=^|[;{}()])\s?//(?:\s.*|$))?$', '$1'
|
||||
$lines = $lines -Replace '(?<!\w)(return|throw)(\s.*?)? if (.*?);', 'if ($3)$1$2;'
|
||||
Rewrite-File $file $lines $imports
|
||||
}
|
||||
|
||||
foreach($file in Get-ChildItem -Path $targetDir -Filter "*.css" -Recurse){
|
||||
$lines = [IO.File]::ReadLines($file.FullName)
|
||||
$lines = $lines -Replace '\s*/\*.*?\*/', ''
|
||||
$lines = $lines -Replace '^(\S.*) {$', '$1{'
|
||||
$lines = $lines -Replace '^\s+(.+?):\s*(.+?)(?:\s*(!important))?;$', '$1:$2$3;'
|
||||
$lines = @((Remove-Empty-Lines($lines)) -Join ' ')
|
||||
$lines = $lines -Replace '([{};])\s', '$1'
|
||||
$lines = $lines -Replace ';}', '}'
|
||||
Rewrite-File $file $lines $imports
|
||||
}
|
||||
|
||||
foreach($file in Get-ChildItem -Path $targetDir -Filter "*.html" -Recurse){
|
||||
$lines = [IO.File]::ReadLines($file.FullName)
|
||||
$lines = $lines | ForEach-Object { $_.TrimStart() }
|
||||
Rewrite-File $file $lines $imports
|
||||
}
|
||||
|
||||
foreach($file in Get-ChildItem -Path (Join-Path $targetDir "plugins") -Filter "*.meta" -Recurse){
|
||||
$lines = [IO.File]::ReadLines($file.FullName)
|
||||
$lines = $lines -Replace '\{version\}', $version
|
||||
Rewrite-File $file $lines $imports
|
||||
}
|
||||
|
||||
# Imports
|
||||
|
||||
$importFolder = Join-Path $targetDir "scripts\imports"
|
||||
|
||||
foreach($path in $imports){
|
||||
$text = [IO.File]::ReadAllText($path)
|
||||
$text = [Regex]::Replace($text, '#import "(.*?)"', {
|
||||
$importPath = Join-Path $importFolder ($args[0].Groups[1].Value.Trim())
|
||||
$importStr = [IO.File]::ReadAllText($importPath).TrimEnd()
|
||||
|
||||
if ($importStr[0] -eq '#'){
|
||||
$importStr = $importStr.Substring($importStr.IndexOf("`n") + 1)
|
||||
}
|
||||
|
||||
return $importStr
|
||||
}, [System.Text.RegularExpressions.RegexOptions]::MultiLine)
|
||||
|
||||
[IO.File]::WriteAllText($path, $text)
|
||||
Write-Host "Resolved" $path.Substring($targetDir.Length)
|
||||
}
|
||||
|
||||
[IO.Directory]::Delete($importFolder, $True)
|
||||
|
||||
# Finished
|
||||
|
||||
$sw.Stop()
|
||||
Write-Host "------------------"
|
||||
Write-Host "Finished in" $([math]::Round($sw.Elapsed.TotalMilliseconds)) "ms"
|
||||
Write-Host "------------------"
|
||||
|
||||
}catch{
|
||||
Write-Host "Encountered an error while running PostBuild.ps1 on line" $_.InvocationInfo.ScriptLineNumber
|
||||
Write-Host $_
|
||||
Exit 1
|
||||
}
|
@@ -10,8 +10,11 @@ try{
|
||||
$sharpMatch = Select-String -Path $mainProj '<Import Project="packages\\CefSharp\.Common\.(.*?)\\'
|
||||
$sharpVersion = $sharpMatch.Matches[0].Groups[1].Value
|
||||
|
||||
$propsFiles = "..\packages\CefSharp.Common.${sharpVersion}\build\CefSharp.Common.props",
|
||||
"..\packages\CefSharp.WinForms.${sharpVersion}\build\CefSharp.WinForms.props"
|
||||
$replaceWhenTag = "..\packages\CefSharp.Common.${sharpVersion}\build\CefSharp.Common.props",
|
||||
"..\packages\CefSharp.WinForms.${sharpVersion}\build\CefSharp.WinForms.props",
|
||||
"..\packages\CefSharp.WinForms.${sharpVersion}\build\CefSharp.WinForms.targets"
|
||||
|
||||
$replaceItemGroupTag = "..\packages\CefSharp.Common.${sharpVersion}\build\CefSharp.Common.targets"
|
||||
|
||||
# Greetings
|
||||
|
||||
@@ -35,15 +38,22 @@ try{
|
||||
|
||||
[IO.File]::WriteAllText($browserProj, $contents)
|
||||
|
||||
Write-Host "Removing x64 and AnyCPU from CefSharp props..."
|
||||
Write-Host "Removing x64 and AnyCPU from package files..."
|
||||
|
||||
foreach($file in $propsFiles){
|
||||
foreach($file in $replaceWhenTag){
|
||||
$contents = [IO.File]::ReadAllText($file)
|
||||
$contents = $contents -Replace '(?<=<When Condition=")(''\$\(Platform\)'' == ''(AnyCPU|x64)'')(?=">)', 'false'
|
||||
|
||||
[IO.File]::WriteAllText($file, $contents)
|
||||
}
|
||||
|
||||
foreach($file in $replaceItemGroupTag){
|
||||
$contents = [IO.File]::ReadAllText($file)
|
||||
$contents = $contents -Replace '(?<=<ItemGroup Condition=")(''\$\(Platform\)'' == ''(AnyCPU|x64)'')(?=">)', 'false'
|
||||
|
||||
[IO.File]::WriteAllText($file, $contents)
|
||||
}
|
||||
|
||||
# Finished
|
||||
|
||||
Write-Host ""
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user