mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
249 Commits
Author | SHA1 | Date | |
---|---|---|---|
ecbcbcaed4 | |||
1677b73ff8 | |||
5929067a3d | |||
d06834617b | |||
9d048efe06 | |||
6a379bc2cd | |||
9f415b11b5 | |||
b9b9193222 | |||
867c2d1632 | |||
5447afc3f5 | |||
b5e58db242 | |||
8ab99619d6 | |||
4c7660ee65 | |||
c1b9bde7b0 | |||
0e8c6c066f | |||
9e44a86be0 | |||
b61479f84f | |||
e3c709b005 | |||
b2b3dba504 | |||
4d05441aa8 | |||
419b3ee850 | |||
4c31e72d29 | |||
e3b2ff7f0e | |||
4c5f5e2cce | |||
39ae9b8ba0 | |||
5c7eb0535d | |||
235718390b | |||
5d4b72f224 | |||
dc76ae9d1f | |||
e44f4bb003 | |||
1fc1370d41 | |||
80a669c989 | |||
801c9eba2d | |||
f9704d2836 | |||
39687171e9 | |||
1d73691ef4 | |||
f8678d2515 | |||
fb108ea18d | |||
a7229a0677 | |||
d0dd112b98 | |||
1e07120eb5 | |||
fcd1f76cff | |||
e400d86d75 | |||
dca3410a5b | |||
9b314e2953 | |||
5635daf66d | |||
7e2e1645e9 | |||
4990afcdbb | |||
c11f36dfef | |||
abddf61c88 | |||
37fec7e952 | |||
0f6a93ae8f | |||
25eae334b0 | |||
74377d01ce | |||
6e78ba1e7b | |||
39e0dedf27 | |||
bbe2c88802 | |||
586b31b63e | |||
041abe6d7e | |||
a69b3cd05f | |||
b48213e79e | |||
5bbc14aca5 | |||
8ccbf502e8 | |||
c426ca97e2 | |||
d9eef86a8b | |||
3fed921748 | |||
02827d53a2 | |||
1ad5fde9ae | |||
909d5ed99c | |||
b9096df218 | |||
1137485c55 | |||
61b1155a03 | |||
35624bcb1c | |||
6e262334ed | |||
829d69485a | |||
0d32c168eb | |||
38d6d93f65 | |||
9a280492c2 | |||
d49ee79c90 | |||
73b83af6b1 | |||
064673ef23 | |||
81bf93e5ab | |||
26d5a8ce08 | |||
c6f5c8d91f | |||
63a1928468 | |||
27c2aee8b9 | |||
5219d29aca | |||
84955352dd | |||
8e05c30063 | |||
6f98bcafec | |||
4afac91bce | |||
6e6312f6d7 | |||
df4c4e443d | |||
ff40474f92 | |||
aca06ee805 | |||
ba8e29a9f8 | |||
583da2bd9f | |||
0ea07016b4 | |||
616421db9a | |||
293ddacd19 | |||
13945ec937 | |||
4ea6f336f8 | |||
58296aa266 | |||
742df9dff3 | |||
011e1f5922 | |||
8f67d69325 | |||
9ac133b605 | |||
538b2d26cd | |||
cc3895c423 | |||
79454bfc3b | |||
734c7572bb | |||
9f93fbb161 | |||
c78c63285e | |||
c8cbf70a28 | |||
2b116d6756 | |||
da611153cf | |||
fd9bf4468a | |||
fa234eb9d6 | |||
dbfebf6a32 | |||
7b91e31485 | |||
e882fc8b5e | |||
5a54195cac | |||
a442adf8d5 | |||
38466878db | |||
7c86e4e743 | |||
41cbfb8d39 | |||
7c394f4b20 | |||
c1a35e1053 | |||
cddce8596f | |||
c75058b1da | |||
1a73fcdb39 | |||
8e0c4f5308 | |||
51e2791cc7 | |||
130159f06c | |||
42d1140b55 | |||
dfd987041a | |||
790d1787fd | |||
2a6a607c7b | |||
b3521d2a18 | |||
dee99caa7d | |||
cf525a3929 | |||
18d658f7e1 | |||
1c42ab77d8 | |||
33d5638bb0 | |||
8ce92df87a | |||
80654449af | |||
eee1622801 | |||
4c54876ecf | |||
1cbcd5c2da | |||
55253e284e | |||
e9795cd697 | |||
be76d9a6dc | |||
d7cdaf2870 | |||
48ed0e01d1 | |||
dca31dedde | |||
ab7356b991 | |||
a46a673cf8 | |||
c8d52539ca | |||
ed9267b6ba | |||
b7c02d1cf8 | |||
fb66beb29f | |||
8c3bf6bbc3 | |||
b943078132 | |||
e727617bf1 | |||
ffaea6dcbe | |||
bf1f72a2a4 | |||
be0df7c5b0 | |||
5ab769e74d | |||
d22ddb1731 | |||
9fed8c022b | |||
a315ed90af | |||
1ebf3c9af2 | |||
0e4c923c23 | |||
63835b9f99 | |||
ff17f7c132 | |||
f4631c9b38 | |||
35931023ae | |||
6d93381760 | |||
f1bdd5f1b2 | |||
1c3e2fbad7 | |||
29a02db07d | |||
f1db1ba708 | |||
c1420bac88 | |||
8e527fbbdf | |||
5ec1bcfe3f | |||
7226461cd0 | |||
6d6f383c92 | |||
e1a6328d09 | |||
6e4153911a | |||
342f74646e | |||
fe5191d3b5 | |||
504cf97c6c | |||
f8c494c9c1 | |||
b90d7f721a | |||
7936af6c9a | |||
52d01e3dd7 | |||
d30d70395a | |||
491a3ae525 | |||
1eae380b08 | |||
f091b2526e | |||
7548e2e202 | |||
d9b9afbf2d | |||
8036659003 | |||
f9fb4668c2 | |||
7047924947 | |||
8f6be3911a | |||
0d95b8eb44 | |||
61d2d124ff | |||
7b218b2544 | |||
87ac7daf76 | |||
6b4817df36 | |||
22d99da2e1 | |||
47b6cf7068 | |||
606c9512f8 | |||
aef9c591e9 | |||
71f67e9191 | |||
636f2b3017 | |||
2de5b5c6e4 | |||
0cbcc8c9f3 | |||
96146e3dc8 | |||
5aaae51be1 | |||
b98625fdbc | |||
09a748e9dc | |||
87b07c6d5b | |||
f39e668f8d | |||
6ea95342a0 | |||
c594bf5757 | |||
cd3b198c6f | |||
b249b5f46e | |||
bbe3b48bcc | |||
3bcd056197 | |||
6387ab41b3 | |||
4df16b7f15 | |||
ed387a2873 | |||
9e225530a6 | |||
7b23686dc6 | |||
4de31453fd | |||
4c59526e39 | |||
9ec1764194 | |||
47afa32902 | |||
2a09487b55 | |||
563c856dd3 | |||
69ea242408 | |||
d6e0e0726f | |||
73d460d40a | |||
1f27d96ac9 | |||
93e9f28d69 | |||
ec2e26752a | |||
fadd95f3e6 |
108
.gitignore
vendored
108
.gitignore
vendored
@@ -1,6 +1,12 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# TweetDuck installer builds
|
||||||
|
bld/*
|
||||||
|
!bld/*.iss
|
||||||
|
!bld/*.bat
|
||||||
|
!bld/Resources
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
@@ -19,16 +25,9 @@ x64/
|
|||||||
x86/
|
x86/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
bld/*
|
|
||||||
!bld/gen_full.iss
|
|
||||||
!bld/gen_port.iss
|
|
||||||
!bld/gen_upd.iss
|
|
||||||
!bld/Resources
|
|
||||||
|
|
||||||
# Visual Studio 2015 cache/options directory
|
# Visual Studio 2015 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# MSTest test Results
|
# MSTest test Results
|
||||||
[Tt]est[Rr]esult*/
|
[Tt]est[Rr]esult*/
|
||||||
@@ -38,11 +37,6 @@ bld/*
|
|||||||
*.VisualState.xml
|
*.VisualState.xml
|
||||||
TestResult.xml
|
TestResult.xml
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# DNX
|
# DNX
|
||||||
project.lock.json
|
project.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
@@ -71,27 +65,12 @@ artifacts/
|
|||||||
*.svclog
|
*.svclog
|
||||||
*.scc
|
*.scc
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
# Visual Studio profiler
|
||||||
*.psess
|
*.psess
|
||||||
*.vsp
|
*.vsp
|
||||||
*.vspx
|
*.vspx
|
||||||
*.sap
|
*.sap
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
# Guidance Automation Toolkit
|
||||||
*.gpState
|
*.gpState
|
||||||
|
|
||||||
@@ -118,33 +97,9 @@ nCrunchTemp_*
|
|||||||
*.mm.*
|
*.mm.*
|
||||||
AutoTest.Net/
|
AutoTest.Net/
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
# Click-Once directory
|
||||||
publish/
|
publish/
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# The packages folder can be ignored because of Package Restore
|
# The packages folder can be ignored because of Package Restore
|
||||||
@@ -157,17 +112,6 @@ publish/
|
|||||||
*.nuget.props
|
*.nuget.props
|
||||||
*.nuget.targets
|
*.nuget.targets
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Microsoft Azure ApplicationInsights config file
|
|
||||||
ApplicationInsights.config
|
|
||||||
|
|
||||||
# Windows Store app package directory
|
# Windows Store app package directory
|
||||||
AppPackages/
|
AppPackages/
|
||||||
BundleArtifacts/
|
BundleArtifacts/
|
||||||
@@ -189,9 +133,6 @@ ClientBin/
|
|||||||
node_modules/
|
node_modules/
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
# Backup & report files from converting an old project file
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
# because we have git ;-)
|
# because we have git ;-)
|
||||||
@@ -200,40 +141,3 @@ Backup*/
|
|||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
UpgradeLog*.htm
|
UpgradeLog*.htm
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
46
Configuration/Arguments.cs
Normal file
46
Configuration/Arguments.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
namespace TweetDuck.Configuration{
|
||||||
|
static class Arguments{
|
||||||
|
// public args
|
||||||
|
public const string ArgDataFolder = "-datafolder";
|
||||||
|
public const string ArgLocale = "-locale";
|
||||||
|
public const string ArgLogging = "-log";
|
||||||
|
public const string ArgDebugUpdates = "-debugupdates";
|
||||||
|
|
||||||
|
// internal args
|
||||||
|
public const string ArgRestart = "-restart";
|
||||||
|
public const string ArgImportCookies = "-importcookies";
|
||||||
|
public const string ArgUpdated = "-updated";
|
||||||
|
|
||||||
|
// class data and methods
|
||||||
|
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
|
||||||
|
|
||||||
|
public static bool HasFlag(string flag){
|
||||||
|
return Current.HasFlag(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetValue(string key, string defaultValue){
|
||||||
|
return Current.GetValue(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CommandLineArgs GetCurrentClean(){
|
||||||
|
CommandLineArgs args = Current.Clone();
|
||||||
|
args.RemoveFlag(ArgRestart);
|
||||||
|
args.RemoveFlag(ArgImportCookies);
|
||||||
|
args.RemoveFlag(ArgUpdated);
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CommandLineArgs GetCurrentForInstaller(){
|
||||||
|
CommandLineArgs args = GetCurrentClean();
|
||||||
|
args.AddFlag(ArgUpdated);
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetCurrentForInstallerCmd(){
|
||||||
|
return GetCurrentForInstaller().ToString().Replace("\"", "::");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -2,9 +2,9 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
sealed class LockManager{
|
sealed class LockManager{
|
||||||
public enum Result{
|
public enum Result{
|
||||||
Success, HasProcess, Fail
|
Success, HasProcess, Fail
|
||||||
|
66
Configuration/SystemConfig.cs
Normal file
66
Configuration/SystemConfig.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace TweetDuck.Configuration{
|
||||||
|
sealed class SystemConfig{
|
||||||
|
public static readonly bool IsHardwareAccelerationSupported = File.Exists(Path.Combine(Program.ProgramPath, "libEGL.dll")) &&
|
||||||
|
File.Exists(Path.Combine(Program.ProgramPath, "libGLESv2.dll"));
|
||||||
|
|
||||||
|
public bool HardwareAcceleration{
|
||||||
|
get => hardwareAcceleration && IsHardwareAccelerationSupported;
|
||||||
|
set => hardwareAcceleration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly string file;
|
||||||
|
|
||||||
|
private bool hardwareAcceleration;
|
||||||
|
|
||||||
|
private SystemConfig(string file){
|
||||||
|
this.file = file;
|
||||||
|
|
||||||
|
HardwareAcceleration = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteToStream(Stream stream){
|
||||||
|
stream.WriteByte((byte)(HardwareAcceleration ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadFromStream(Stream stream){
|
||||||
|
HardwareAcceleration = stream.ReadByte() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Save(){
|
||||||
|
try{
|
||||||
|
string directory = Path.GetDirectoryName(file);
|
||||||
|
if (directory == null)return false;
|
||||||
|
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
|
||||||
|
using(Stream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None)){
|
||||||
|
WriteToStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Configuration Error", "Could not save the system configuration file.", true, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemConfig Load(string file){
|
||||||
|
SystemConfig config = new SystemConfig(file);
|
||||||
|
|
||||||
|
try{
|
||||||
|
using(Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)){
|
||||||
|
config.ReadFromStream(stream);
|
||||||
|
}
|
||||||
|
}catch(FileNotFoundException){
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Configuration Error", "Could not open the system configuration file. If you continue, you will lose system specific configuration such as Hardware Acceleration.", true, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -3,90 +3,94 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using TweetDck.Core;
|
using TweetDuck.Core;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
sealed class UserConfig{
|
sealed class UserConfig{
|
||||||
private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new CustomBinder() };
|
private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new LegacyBinder() };
|
||||||
|
|
||||||
private const int CurrentFileVersion = 6;
|
private class LegacyBinder : SerializationBinder{
|
||||||
|
public override Type BindToType(string assemblyName, string typeName){
|
||||||
|
return Type.GetType(string.Format("{0}, {1}", typeName.Replace("TweetDck", "TweetDuck"), assemblyName.Replace("TweetDck", "TweetDuck")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private const int CurrentFileVersion = 9;
|
||||||
|
|
||||||
// START OF CONFIGURATION
|
// START OF CONFIGURATION
|
||||||
|
|
||||||
public WindowState BrowserWindow { get; set; }
|
public WindowState BrowserWindow { get; set; }
|
||||||
|
public bool DisplayNotificationColumn { get; set; }
|
||||||
public bool DisplayNotificationTimer { get; set; }
|
public bool DisplayNotificationTimer { get; set; }
|
||||||
public bool NotificationTimerCountDown { get; set; }
|
public bool NotificationTimerCountDown { get; set; }
|
||||||
|
public bool NotificationSkipOnLinkClick { get; set; }
|
||||||
|
public bool NotificationNonIntrusiveMode { get; set; }
|
||||||
|
|
||||||
public TweetNotification.Position NotificationPosition { get; set; }
|
public TweetNotification.Position NotificationPosition { get; set; }
|
||||||
public Point CustomNotificationPosition { get; set; }
|
public Point CustomNotificationPosition { get; set; }
|
||||||
public int NotificationEdgeDistance { get; set; }
|
public int NotificationEdgeDistance { get; set; }
|
||||||
public int NotificationDisplay { get; set; }
|
public int NotificationDisplay { get; set; }
|
||||||
|
public int NotificationIdlePauseSeconds { get; set; }
|
||||||
public int NotificationDurationValue { get; set; }
|
public int NotificationDurationValue { get; set; }
|
||||||
|
|
||||||
public bool EnableSpellCheck { get; set; }
|
public bool EnableSpellCheck { get; set; }
|
||||||
public bool ExpandLinksOnHover { get; set; }
|
public bool ExpandLinksOnHover { get; set; }
|
||||||
public bool ShowScreenshotBorder { get; set; }
|
public bool SwitchAccountSelectors { get; set; }
|
||||||
public bool EnableTrayHighlight { get; set; }
|
public bool EnableTrayHighlight { get; set; }
|
||||||
|
|
||||||
public bool EnableUpdateCheck { get; set; }
|
public bool EnableUpdateCheck { get; set; }
|
||||||
public string DismissedUpdate { get; set; }
|
public string DismissedUpdate { get; set; }
|
||||||
|
|
||||||
public PluginConfig Plugins { get; private set; }
|
[Obsolete] public PluginConfig Plugins { get; set; } // TODO remove eventually
|
||||||
public WindowState PluginsWindow { get; set; }
|
public WindowState PluginsWindow { get; set; }
|
||||||
|
|
||||||
public string CustomCefArgs { get; set; }
|
public string CustomCefArgs { get; set; }
|
||||||
public string CustomBrowserCSS { get; set; }
|
public string CustomBrowserCSS { get; set; }
|
||||||
public string CustomNotificationCSS { get; set; }
|
public string CustomNotificationCSS { get; set; }
|
||||||
|
|
||||||
public bool IsCustomNotificationPositionSet{
|
public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
||||||
get{
|
|
||||||
return CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
public string NotificationSoundPath{
|
||||||
}
|
get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
||||||
|
set => notificationSoundPath = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MuteNotifications{
|
public bool MuteNotifications{
|
||||||
get{
|
get => muteNotifications;
|
||||||
return muteNotifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (muteNotifications == value)return;
|
if (muteNotifications != value){
|
||||||
|
|
||||||
muteNotifications = value;
|
muteNotifications = value;
|
||||||
|
MuteToggled?.Invoke(this, new EventArgs());
|
||||||
if (MuteToggled != null){
|
|
||||||
MuteToggled(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string NotificationSoundPath{
|
public int ZoomLevel{
|
||||||
get{
|
get => zoomLevel;
|
||||||
return string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
notificationSoundPath = value;
|
if (zoomLevel != value){
|
||||||
|
zoomLevel = value;
|
||||||
|
ZoomLevelChanged?.Invoke(this, new EventArgs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double ZoomMultiplier => zoomLevel/100.0;
|
||||||
|
|
||||||
public TrayIcon.Behavior TrayBehavior{
|
public TrayIcon.Behavior TrayBehavior{
|
||||||
get{
|
get => trayBehavior;
|
||||||
return trayBehavior;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (trayBehavior == value)return;
|
if (trayBehavior != value){
|
||||||
|
|
||||||
trayBehavior = value;
|
trayBehavior = value;
|
||||||
|
TrayBehaviorChanged?.Invoke(this, new EventArgs());
|
||||||
if (TrayBehaviorChanged != null){
|
|
||||||
TrayBehaviorChanged(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,6 +100,9 @@ namespace TweetDck.Configuration{
|
|||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
public event EventHandler MuteToggled;
|
public event EventHandler MuteToggled;
|
||||||
|
|
||||||
|
[field:NonSerialized]
|
||||||
|
public event EventHandler ZoomLevelChanged;
|
||||||
|
|
||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
public event EventHandler TrayBehaviorChanged;
|
public event EventHandler TrayBehaviorChanged;
|
||||||
|
|
||||||
@@ -104,6 +111,7 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
private int fileVersion;
|
private int fileVersion;
|
||||||
private bool muteNotifications;
|
private bool muteNotifications;
|
||||||
|
private int zoomLevel;
|
||||||
private string notificationSoundPath;
|
private string notificationSoundPath;
|
||||||
private TrayIcon.Behavior trayBehavior;
|
private TrayIcon.Behavior trayBehavior;
|
||||||
|
|
||||||
@@ -111,20 +119,18 @@ namespace TweetDck.Configuration{
|
|||||||
this.file = file;
|
this.file = file;
|
||||||
|
|
||||||
BrowserWindow = new WindowState();
|
BrowserWindow = new WindowState();
|
||||||
|
ZoomLevel = 100;
|
||||||
DisplayNotificationTimer = true;
|
DisplayNotificationTimer = true;
|
||||||
|
NotificationNonIntrusiveMode = true;
|
||||||
NotificationPosition = TweetNotification.Position.TopRight;
|
NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
CustomNotificationPosition = ControlExtensions.InvisibleLocation;
|
CustomNotificationPosition = ControlExtensions.InvisibleLocation;
|
||||||
NotificationEdgeDistance = 8;
|
NotificationEdgeDistance = 8;
|
||||||
NotificationDurationValue = 25;
|
NotificationDurationValue = 25;
|
||||||
EnableUpdateCheck = true;
|
EnableUpdateCheck = true;
|
||||||
ExpandLinksOnHover = true;
|
ExpandLinksOnHover = true;
|
||||||
ShowScreenshotBorder = true;
|
SwitchAccountSelectors = true;
|
||||||
EnableTrayHighlight = true;
|
EnableTrayHighlight = true;
|
||||||
Plugins = new PluginConfig();
|
|
||||||
PluginsWindow = new WindowState();
|
PluginsWindow = new WindowState();
|
||||||
|
|
||||||
Plugins.DisableOfficialFromConfig("clear-columns");
|
|
||||||
Plugins.DisableOfficialFromConfig("reply-account");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpgradeFile(){
|
private void UpgradeFile(){
|
||||||
@@ -146,7 +152,6 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
if (fileVersion == 2){
|
if (fileVersion == 2){
|
||||||
BrowserWindow = new WindowState();
|
BrowserWindow = new WindowState();
|
||||||
Plugins = new PluginConfig();
|
|
||||||
PluginsWindow = new WindowState();
|
PluginsWindow = new WindowState();
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
@@ -158,13 +163,25 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fileVersion == 4){
|
if (fileVersion == 4){
|
||||||
Plugins.DisableOfficialFromConfig("clear-columns");
|
|
||||||
Plugins.DisableOfficialFromConfig("reply-account");
|
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileVersion == 5){
|
if (fileVersion == 5){
|
||||||
ShowScreenshotBorder = true;
|
++fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileVersion == 6){
|
||||||
|
NotificationNonIntrusiveMode = true;
|
||||||
|
++fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileVersion == 7){
|
||||||
|
ZoomLevel = 100;
|
||||||
|
++fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileVersion == 8){
|
||||||
|
SwitchAccountSelectors = true;
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,10 +226,7 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config != null){
|
config?.UpgradeFile();
|
||||||
config.UpgradeFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}catch(FileNotFoundException){
|
}catch(FileNotFoundException){
|
||||||
}catch(DirectoryNotFoundException){
|
}catch(DirectoryNotFoundException){
|
||||||
@@ -238,15 +252,5 @@ namespace TweetDck.Configuration{
|
|||||||
public static string GetBackupFile(string file){
|
public static string GetBackupFile(string file){
|
||||||
return file+".bak";
|
return file+".bak";
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class CustomBinder : SerializationBinder{
|
|
||||||
public override Type BindToType(string assemblyName, string typeName){
|
|
||||||
if (typeName == "TweetDck.Core.Handling.TweetNotification+Position"){
|
|
||||||
return typeof(TweetNotification.Position);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>
|
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
||||||
<package id="cef.redist.x64" version="3.2883.1552" targetFramework="net452" xmlns="" />
|
|
||||||
<package id="cef.redist.x86" version="3.2883.1552" targetFramework="net452" xmlns="" />
|
|
||||||
<package id="CefSharp.Common" version="55.0.0" targetFramework="net452" xmlns="" />
|
|
||||||
<package id="CefSharp.WinForms" version="55.0.0" targetFramework="net452" xmlns="" />
|
|
||||||
<package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" />
|
|
||||||
</packages>
|
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
sealed class CallbackBridge{
|
sealed class CallbackBridge{
|
||||||
private readonly Control owner;
|
private readonly Control owner;
|
||||||
private readonly Action safeCallback;
|
private readonly Action safeCallback;
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
static class PropertyBridge{
|
static class PropertyBridge{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Properties{
|
public enum Properties{
|
||||||
ExpandLinksOnHover = 1,
|
ExpandLinksOnHover = 1,
|
||||||
MuteNotifications = 2,
|
MuteNotifications = 2,
|
||||||
HasCustomNotificationSound = 4,
|
HasCustomNotificationSound = 4,
|
||||||
All = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound
|
SkipOnLinkClick = 8,
|
||||||
|
SwitchAccountSelectors = 16,
|
||||||
|
AllBrowser = ExpandLinksOnHover | SwitchAccountSelectors | MuteNotifications | HasCustomNotificationSound,
|
||||||
|
AllNotification = ExpandLinksOnHover | SkipOnLinkClick
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GenerateScript(Properties properties = Properties.All){
|
public static string GenerateScript(Properties properties){
|
||||||
StringBuilder build = new StringBuilder();
|
StringBuilder build = new StringBuilder();
|
||||||
build.Append("(function(c){");
|
build.Append("(function(c){");
|
||||||
|
|
||||||
@@ -19,6 +22,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
|
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (properties.HasFlag(Properties.SwitchAccountSelectors)){
|
||||||
|
build.Append("c.switchAccountSelectors=").Append(Program.UserConfig.SwitchAccountSelectors ? "true;" : "false;");
|
||||||
|
}
|
||||||
|
|
||||||
if (properties.HasFlag(Properties.MuteNotifications)){
|
if (properties.HasFlag(Properties.MuteNotifications)){
|
||||||
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
|
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
@@ -27,6 +34,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
build.Append("c.hasCustomNotificationSound=").Append(Program.UserConfig.NotificationSoundPath.Length > 0 ? "true;" : "false;");
|
build.Append("c.hasCustomNotificationSound=").Append(Program.UserConfig.NotificationSoundPath.Length > 0 ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (properties.HasFlag(Properties.SkipOnLinkClick)){
|
||||||
|
build.Append("c.skipOnLinkClick=").Append(Program.UserConfig.NotificationSkipOnLinkClick ? "true;" : "false;");
|
||||||
|
}
|
||||||
|
|
||||||
build.Append("})(window.$TDX=window.$TDX||{})");
|
build.Append("})(window.$TDX=window.$TDX||{})");
|
||||||
return build.ToString();
|
return build.ToString();
|
||||||
}
|
}
|
||||||
|
@@ -1,27 +1,22 @@
|
|||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Drawing;
|
using TweetDuck.Core.Controls;
|
||||||
using System.Drawing.Imaging;
|
using TweetDuck.Core.Notification;
|
||||||
using System.IO;
|
using TweetDuck.Core.Utils;
|
||||||
using System.Windows.Forms;
|
|
||||||
using TweetDck.Core.Controls;
|
|
||||||
using TweetDck.Core.Notification;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
sealed class TweetDeckBridge{
|
sealed class TweetDeckBridge{
|
||||||
public static string LastRightClickedLink = string.Empty;
|
public static string LastRightClickedLink = string.Empty;
|
||||||
public static string LastHighlightedTweet = string.Empty;
|
public static string LastHighlightedTweet = string.Empty;
|
||||||
public static string LastHighlightedQuotedTweet = string.Empty;
|
public static string LastHighlightedQuotedTweet = string.Empty;
|
||||||
public static string ClipboardImagePath = string.Empty;
|
|
||||||
|
|
||||||
public static void ResetStaticProperties(){
|
public static void ResetStaticProperties(){
|
||||||
LastRightClickedLink = LastHighlightedTweet = LastHighlightedQuotedTweet = ClipboardImagePath = string.Empty;
|
LastRightClickedLink = LastHighlightedTweet = LastHighlightedQuotedTweet = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
private readonly FormNotification notification;
|
private readonly FormNotificationMain notification;
|
||||||
|
|
||||||
public TweetDeckBridge(FormBrowser form, FormNotification notification){
|
public TweetDeckBridge(FormBrowser form, FormNotificationMain notification){
|
||||||
this.form = form;
|
this.form = form;
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
}
|
}
|
||||||
@@ -49,22 +44,14 @@ namespace TweetDck.Core.Bridge{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNotificationQuotedTweet(string link){
|
public void OpenContextMenu(){
|
||||||
notification.InvokeAsyncSafe(() => notification.CurrentQuotedTweetUrl = link);
|
form.InvokeAsyncSafe(form.OpenContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenSettingsMenu(){
|
public void OnTweetPopup(string columnName, string tweetHtml, int tweetCharacters, string tweetUrl, string quoteUrl){
|
||||||
form.InvokeAsyncSafe(form.OpenSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenPluginsMenu(){
|
|
||||||
form.InvokeAsyncSafe(form.OpenPlugins);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnTweetPopup(string tweetHtml, string tweetUrl, int tweetCharacters){
|
|
||||||
notification.InvokeAsyncSafe(() => {
|
notification.InvokeAsyncSafe(() => {
|
||||||
form.OnTweetNotification();
|
form.OnTweetNotification();
|
||||||
notification.ShowNotification(new TweetNotification(tweetHtml, tweetUrl, tweetCharacters));
|
notification.ShowNotification(new TweetNotification(columnName, tweetHtml, tweetCharacters, tweetUrl, quoteUrl));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,31 +72,7 @@ namespace TweetDck.Core.Bridge{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void LoadNextNotification(){
|
public void LoadNextNotification(){
|
||||||
notification.InvokeAsyncSafe(notification.FinishCurrentTweet);
|
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
||||||
}
|
|
||||||
|
|
||||||
public void TryPasteImage(){
|
|
||||||
form.InvokeSafe(() => {
|
|
||||||
if (Clipboard.ContainsImage()){
|
|
||||||
Image img = Clipboard.GetImage();
|
|
||||||
if (img == null)return;
|
|
||||||
|
|
||||||
try{
|
|
||||||
Directory.CreateDirectory(Program.TemporaryPath);
|
|
||||||
|
|
||||||
ClipboardImagePath = Path.Combine(Program.TemporaryPath, "TD-Img-"+DateTime.Now.Ticks+".png");
|
|
||||||
img.Save(ClipboardImagePath, ImageFormat.Png);
|
|
||||||
|
|
||||||
form.OnImagePasted();
|
|
||||||
}catch(Exception e){
|
|
||||||
Program.Reporter.HandleException("Clipboard Image Error", "Could not paste image from clipboard.", true, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClickUploadImage(int offsetX, int offsetY){
|
|
||||||
form.InvokeAsyncSafe(() => form.TriggerImageUpload(offsetX, offsetY));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScreenshotTweet(string html, int width, int height){
|
public void ScreenshotTweet(string html, int width, int height){
|
||||||
@@ -120,6 +83,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetIdleSeconds(){
|
||||||
|
return NativeMethods.GetIdleSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenBrowser(string url){
|
public void OpenBrowser(string url){
|
||||||
BrowserUtils.OpenExternalBrowser(url);
|
BrowserUtils.OpenExternalBrowser(url);
|
||||||
}
|
}
|
||||||
@@ -137,6 +104,13 @@ namespace TweetDck.Core.Bridge{
|
|||||||
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CrashDebug(string message){
|
||||||
|
#if DEBUG
|
||||||
|
Log(message);
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void Log(string data){
|
public void Log(string data){
|
||||||
System.Diagnostics.Debug.WriteLine(data);
|
System.Diagnostics.Debug.WriteLine(data);
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
static class ControlExtensions{
|
static class ControlExtensions{
|
||||||
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
||||||
|
|
||||||
@@ -20,6 +21,10 @@ namespace TweetDck.Core.Controls{
|
|||||||
control.BeginInvoke(func);
|
control.BeginInvoke(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsFullyOutsideView(this Form form){
|
||||||
|
return !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds));
|
||||||
|
}
|
||||||
|
|
||||||
public static void MoveToCenter(this Form targetForm, Form parentForm){
|
public static void MoveToCenter(this Form targetForm, Form parentForm){
|
||||||
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
|
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
class FlatButton : Button{
|
class FlatButton : Button{
|
||||||
protected override bool ShowFocusCues{
|
protected override bool ShowFocusCues => false;
|
||||||
get{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlatButton(){
|
public FlatButton(){
|
||||||
GotFocus += FlatButton_GotFocus;
|
GotFocus += FlatButton_GotFocus;
|
||||||
|
3
Core/Controls/FlatProgressBar.Designer.cs
generated
3
Core/Controls/FlatProgressBar.Designer.cs
generated
@@ -1,3 +0,0 @@
|
|||||||
namespace TweetDck.Core.Controls{
|
|
||||||
partial class FlatProgressBar{}
|
|
||||||
}
|
|
@@ -1,8 +1,8 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed partial class FlatProgressBar : ProgressBar{
|
sealed class FlatProgressBar : ProgressBar{
|
||||||
private readonly SolidBrush brush;
|
private readonly SolidBrush brush;
|
||||||
|
|
||||||
public FlatProgressBar(){
|
public FlatProgressBar(){
|
||||||
|
3
Core/Controls/TabButton.Designer.cs
generated
3
Core/Controls/TabButton.Designer.cs
generated
@@ -1,3 +0,0 @@
|
|||||||
namespace TweetDck.Core.Controls{
|
|
||||||
partial class TabButton{}
|
|
||||||
}
|
|
@@ -2,8 +2,8 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed partial class TabButton : FlatButton{
|
sealed class TabButton : FlatButton{
|
||||||
public Action Callback { get; private set; }
|
public Action Callback { get; private set; }
|
||||||
|
|
||||||
public void SetupButton(int locationX, int sizeWidth, string title, Action callback){
|
public void SetupButton(int locationX, int sizeWidth, string title, Action callback){
|
||||||
|
2
Core/Controls/TabPanel.Designer.cs
generated
2
Core/Controls/TabPanel.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Controls {
|
namespace TweetDuck.Core.Controls {
|
||||||
partial class TabPanel {
|
partial class TabPanel {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -4,23 +4,13 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed partial class TabPanel : UserControl{
|
sealed partial class TabPanel : UserControl{
|
||||||
public IEnumerable<TabButton> Buttons{
|
public Panel Content => panelContent;
|
||||||
get{
|
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
||||||
return panelButtons.Controls.Cast<TabButton>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TabButton ActiveButton { get; private set; }
|
public TabButton ActiveButton { get; private set; }
|
||||||
|
|
||||||
// ReSharper disable once ConvertToAutoPropertyWithPrivateSetter
|
|
||||||
public Panel Content{
|
|
||||||
get{
|
|
||||||
return panelContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int btnWidth;
|
private int btnWidth;
|
||||||
|
|
||||||
public TabPanel(){
|
public TabPanel(){
|
||||||
|
12
Core/FormBrowser.Designer.cs
generated
12
Core/FormBrowser.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core {
|
namespace TweetDuck.Core {
|
||||||
sealed partial class FormBrowser {
|
sealed partial class FormBrowser {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -24,26 +24,24 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.trayIcon = new TweetDck.Core.TrayIcon();
|
this.trayIcon = new TweetDuck.Core.TrayIcon(this.components);
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// trayIcon
|
|
||||||
//
|
|
||||||
this.trayIcon.Visible = false;
|
|
||||||
//
|
|
||||||
// FormBrowser
|
// FormBrowser
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = TweetDuck.Core.Utils.BrowserUtils.BackgroundColor;
|
||||||
this.ClientSize = new System.Drawing.Size(324, 386);
|
this.ClientSize = new System.Drawing.Size(324, 386);
|
||||||
this.Icon = Properties.Resources.icon;
|
this.Icon = Properties.Resources.icon;
|
||||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MinimumSize = new System.Drawing.Size(340, 424);
|
this.MinimumSize = new System.Drawing.Size(340, 424);
|
||||||
this.Name = "FormBrowser";
|
this.Name = "FormBrowser";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
||||||
|
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed);
|
||||||
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
||||||
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@@ -1,48 +1,44 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
using TweetDck.Configuration;
|
using System;
|
||||||
using TweetDck.Core.Handling;
|
|
||||||
using TweetDck.Core.Other;
|
|
||||||
using TweetDck.Resources;
|
|
||||||
using TweetDck.Core.Controls;
|
|
||||||
using System.Drawing;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
using TweetDck.Updates;
|
|
||||||
using TweetDck.Plugins;
|
|
||||||
using TweetDck.Plugins.Enums;
|
|
||||||
using TweetDck.Plugins.Events;
|
|
||||||
using TweetDck.Core.Bridge;
|
|
||||||
using TweetDck.Core.Notification;
|
|
||||||
using TweetDck.Core.Notification.Screenshot;
|
|
||||||
using TweetDck.Updates.Events;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Configuration;
|
||||||
|
using TweetDuck.Core.Bridge;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Handling;
|
||||||
|
using TweetDuck.Core.Notification;
|
||||||
|
using TweetDuck.Core.Notification.Screenshot;
|
||||||
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
using TweetDuck.Core.Other;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Plugins;
|
||||||
|
using TweetDuck.Plugins.Enums;
|
||||||
|
using TweetDuck.Plugins.Events;
|
||||||
|
using TweetDuck.Resources;
|
||||||
|
using TweetDuck.Updates;
|
||||||
|
using TweetDuck.Updates.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDuck.Core{
|
||||||
sealed partial class FormBrowser : Form{
|
sealed partial class FormBrowser : Form{
|
||||||
private static UserConfig Config{
|
private static UserConfig Config => Program.UserConfig;
|
||||||
get{
|
|
||||||
return Program.UserConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string UpdateInstallerPath { get; private set; }
|
public string UpdateInstallerPath { get; private set; }
|
||||||
|
|
||||||
private readonly ChromiumWebBrowser browser;
|
private readonly ChromiumWebBrowser browser;
|
||||||
private readonly PluginManager plugins;
|
private readonly PluginManager plugins;
|
||||||
private readonly UpdateHandler updates;
|
private readonly UpdateHandler updates;
|
||||||
private readonly FormNotification notification;
|
private readonly FormNotificationTweet notification;
|
||||||
|
private readonly ContextMenu contextMenu;
|
||||||
|
|
||||||
private FormSettings currentFormSettings;
|
|
||||||
private FormAbout currentFormAbout;
|
|
||||||
private FormPlugins currentFormPlugins;
|
|
||||||
private bool isLoaded;
|
private bool isLoaded;
|
||||||
|
private bool isBrowserReady;
|
||||||
private FormWindowState prevState;
|
private FormWindowState prevState;
|
||||||
|
|
||||||
private TweetScreenshotManager notificationScreenshotManager;
|
private TweetScreenshotManager notificationScreenshotManager;
|
||||||
private SoundNotification soundNotification;
|
private ISoundNotificationPlayer soundNotification;
|
||||||
|
|
||||||
public FormBrowser(PluginManager pluginManager, UpdaterSettings updaterSettings){
|
public FormBrowser(PluginManager pluginManager, UpdaterSettings updaterSettings){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -53,44 +49,49 @@ namespace TweetDck.Core{
|
|||||||
this.plugins.Reloaded += plugins_Reloaded;
|
this.plugins.Reloaded += plugins_Reloaded;
|
||||||
this.plugins.PluginChangedState += plugins_PluginChangedState;
|
this.plugins.PluginChangedState += plugins_PluginChangedState;
|
||||||
|
|
||||||
this.notification = CreateNotificationForm(NotificationFlags.AutoHide | NotificationFlags.TopMost);
|
this.contextMenu = ContextMenuBrowser.CreateMenu(this);
|
||||||
|
|
||||||
|
this.notification = new FormNotificationTweet(this, plugins){
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
this.notification.CanMoveWindow = () => (ModifierKeys & Keys.Alt) == Keys.Alt;
|
CanMoveWindow = () => (ModifierKeys & Keys.Alt) == Keys.Alt
|
||||||
#else
|
#else
|
||||||
this.notification.CanMoveWindow = () => false;
|
CanMoveWindow = () => false
|
||||||
#endif
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
this.notification.Show();
|
this.notification.Show();
|
||||||
|
|
||||||
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
||||||
MenuHandler = new ContextMenuBrowser(this),
|
MenuHandler = new ContextMenuBrowser(this),
|
||||||
DialogHandler = new FileDialogHandler(this),
|
|
||||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||||
LifeSpanHandler = new LifeSpanHandler()
|
LifeSpanHandler = new LifeSpanHandler(),
|
||||||
|
RequestHandler = new RequestHandlerBrowser()
|
||||||
};
|
};
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
|
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this.browser.LoadingStateChanged += Browser_LoadingStateChanged;
|
this.browser.LoadingStateChanged += browser_LoadingStateChanged;
|
||||||
this.browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
this.browser.FrameLoadStart += browser_FrameLoadStart;
|
||||||
|
this.browser.FrameLoadEnd += browser_FrameLoadEnd;
|
||||||
|
this.browser.LoadError += browser_LoadError;
|
||||||
this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
|
this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
|
||||||
this.browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
|
this.browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
|
||||||
|
|
||||||
|
browser.BrowserSettings.BackgroundColor = (uint)BrowserUtils.BackgroundColor.ToArgb();
|
||||||
|
browser.Dock = DockStyle.None;
|
||||||
|
browser.Location = ControlExtensions.InvisibleLocation;
|
||||||
Controls.Add(browser);
|
Controls.Add(browser);
|
||||||
|
|
||||||
Controls.Add(new MenuStrip{ Visible = false }); // fixes Alt freezing the program in Win 10 Anniversary Update
|
Controls.Add(new MenuStrip{ Visible = false }); // fixes Alt freezing the program in Win 10 Anniversary Update
|
||||||
|
|
||||||
Disposed += (sender, args) => {
|
Disposed += (sender, args) => {
|
||||||
browser.Dispose();
|
browser.Dispose();
|
||||||
|
contextMenu.Dispose();
|
||||||
|
|
||||||
if (notificationScreenshotManager != null){
|
notificationScreenshotManager?.Dispose();
|
||||||
notificationScreenshotManager.Dispose();
|
soundNotification?.Dispose();
|
||||||
}
|
|
||||||
|
|
||||||
if (soundNotification != null){
|
|
||||||
soundNotification.Dispose();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.trayIcon.ClickRestore += trayIcon_ClickRestore;
|
this.trayIcon.ClickRestore += trayIcon_ClickRestore;
|
||||||
@@ -100,10 +101,23 @@ namespace TweetDck.Core{
|
|||||||
UpdateTrayIcon();
|
UpdateTrayIcon();
|
||||||
|
|
||||||
Config.MuteToggled += Config_MuteToggled;
|
Config.MuteToggled += Config_MuteToggled;
|
||||||
|
Config.ZoomLevelChanged += Config_ZoomLevelChanged;
|
||||||
|
|
||||||
this.updates = new UpdateHandler(browser, this, updaterSettings);
|
this.updates = new UpdateHandler(browser, this, updaterSettings);
|
||||||
this.updates.UpdateAccepted += updates_UpdateAccepted;
|
this.updates.UpdateAccepted += updates_UpdateAccepted;
|
||||||
this.updates.UpdateDismissed += updates_UpdateDismissed;
|
this.updates.UpdateDismissed += updates_UpdateDismissed;
|
||||||
|
|
||||||
|
RestoreWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryBringToFront<T>() where T : Form{
|
||||||
|
T form = Application.OpenForms.OfType<T>().FirstOrDefault();
|
||||||
|
|
||||||
|
if (form != null){
|
||||||
|
form.BringToFront();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowChildForm(Form form){
|
private void ShowChildForm(Form form){
|
||||||
@@ -118,41 +132,57 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
// window setup
|
// window setup
|
||||||
|
|
||||||
private void SetupWindow(){
|
private void RestoreWindow(){
|
||||||
Config.BrowserWindow.Restore(this, true);
|
Config.BrowserWindow.Restore(this, true);
|
||||||
prevState = WindowState;
|
prevState = WindowState;
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnBrowserReady(){
|
||||||
|
if (!isBrowserReady){
|
||||||
|
browser.Location = Point.Empty;
|
||||||
|
browser.Dock = DockStyle.Fill;
|
||||||
|
isBrowserReady = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateTrayIcon(){
|
private void UpdateTrayIcon(){
|
||||||
trayIcon.Visible = Config.TrayBehavior.ShouldDisplayIcon();
|
trayIcon.Visible = Config.TrayBehavior.ShouldDisplayIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
// active event handlers
|
// active event handlers
|
||||||
|
|
||||||
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||||
if (!e.IsLoading){
|
if (!e.IsLoading){
|
||||||
browser.AddWordToDictionary("tweetdeck");
|
foreach(string word in BrowserUtils.DictionaryWords){
|
||||||
browser.AddWordToDictionary("TweetDeck");
|
browser.AddWordToDictionary(word);
|
||||||
browser.AddWordToDictionary("tweetduck");
|
}
|
||||||
browser.AddWordToDictionary("TweetDuck");
|
|
||||||
browser.AddWordToDictionary("TD");
|
|
||||||
|
|
||||||
Invoke(new Action(SetupWindow));
|
BeginInvoke(new Action(OnBrowserReady));
|
||||||
browser.LoadingStateChanged -= Browser_LoadingStateChanged;
|
browser.LoadingStateChanged -= browser_LoadingStateChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
private void browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e){
|
||||||
|
if (e.Frame.IsMain){
|
||||||
|
if (Config.ZoomLevel != 100){
|
||||||
|
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BrowserUtils.IsTwitterWebsite(e.Frame)){
|
||||||
|
ScriptLoader.ExecuteFile(e.Frame, "twitter.js");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||||
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
|
if (e.Frame.IsMain && BrowserUtils.IsTweetDeckWebsite(e.Frame)){
|
||||||
UpdateProperties();
|
e.Frame.ExecuteJavaScriptAsync(BrowserUtils.BackgroundColorFix);
|
||||||
|
|
||||||
|
UpdateProperties(PropertyBridge.Properties.AllBrowser);
|
||||||
ScriptLoader.ExecuteFile(e.Frame, "code.js");
|
ScriptLoader.ExecuteFile(e.Frame, "code.js");
|
||||||
ReinjectCustomCSS(Config.CustomBrowserCSS);
|
ReinjectCustomCSS(Config.CustomBrowserCSS);
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
ScriptLoader.ExecuteFile(e.Frame, "debug.js");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (plugins.HasAnyPlugin(PluginEnvironment.Browser)){
|
if (plugins.HasAnyPlugin(PluginEnvironment.Browser)){
|
||||||
ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginBrowserScriptFile);
|
ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginBrowserScriptFile);
|
||||||
ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginGlobalScriptFile);
|
ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginGlobalScriptFile);
|
||||||
@@ -163,6 +193,20 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void browser_LoadError(object sender, LoadErrorEventArgs e){
|
||||||
|
if (e.ErrorCode == CefErrorCode.Aborted){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!e.FailedUrl.StartsWith("http://td/")){
|
||||||
|
string errorPage = ScriptLoader.LoadResource("pages/error.html", true);
|
||||||
|
|
||||||
|
if (errorPage != null){
|
||||||
|
browser.LoadHtml(errorPage.Replace("{err}", BrowserUtils.GetErrorName(e.ErrorCode)), "http://td/error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void FormBrowser_Activated(object sender, EventArgs e){
|
private void FormBrowser_Activated(object sender, EventArgs e){
|
||||||
if (!isLoaded)return;
|
if (!isLoaded)return;
|
||||||
|
|
||||||
@@ -204,58 +248,57 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FormBrowser_FormClosed(object sender, FormClosedEventArgs e){
|
||||||
|
if (isLoaded && UpdateInstallerPath == null){
|
||||||
|
updates.CleanupDownload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Config_MuteToggled(object sender, EventArgs e){
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Config_TrayBehaviorChanged(object sender, EventArgs e){
|
private void Config_ZoomLevelChanged(object sender, EventArgs e){
|
||||||
if (!isLoaded)return;
|
BrowserUtils.SetZoomLevel(browser.GetBrowser(), Config.ZoomLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Config_TrayBehaviorChanged(object sender, EventArgs e){
|
||||||
UpdateTrayIcon();
|
UpdateTrayIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trayIcon_ClickRestore(object sender, EventArgs e){
|
private void trayIcon_ClickRestore(object sender, EventArgs e){
|
||||||
if (!isLoaded)return;
|
|
||||||
|
|
||||||
isLoaded = false;
|
|
||||||
Show();
|
Show();
|
||||||
SetupWindow();
|
RestoreWindow();
|
||||||
Activate();
|
Activate();
|
||||||
UpdateTrayIcon();
|
UpdateTrayIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trayIcon_ClickClose(object sender, EventArgs e){
|
private void trayIcon_ClickClose(object sender, EventArgs e){
|
||||||
if (!isLoaded)return;
|
|
||||||
|
|
||||||
ForceClose();
|
ForceClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void plugins_Reloaded(object sender, PluginLoadEventArgs e){
|
private void plugins_Reloaded(object sender, PluginErrorEventArgs e){
|
||||||
browser.GetBrowser().Reload();
|
browser.GetBrowser().Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||||
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled ? 1 : 0); // ExecuteScriptAsync cannot handle boolean values as of yet
|
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
||||||
Hide();
|
foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){
|
||||||
|
if (form is FormSettings || form is FormPlugins || form is FormAbout){
|
||||||
|
form.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FormUpdateDownload downloadForm = new FormUpdateDownload(e.UpdateInfo);
|
updates.BeginUpdateDownload(this, e.UpdateInfo, update => {
|
||||||
downloadForm.MoveToCenter(this);
|
if (update.DownloadStatus == UpdateDownloadStatus.Done){
|
||||||
downloadForm.ShowDialog();
|
UpdateInstallerPath = update.InstallerPath;
|
||||||
downloadForm.Dispose();
|
}
|
||||||
|
|
||||||
if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Succeeded){
|
|
||||||
UpdateInstallerPath = downloadForm.InstallerPath;
|
|
||||||
ForceClose();
|
ForceClose();
|
||||||
}
|
});
|
||||||
else if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Manual){
|
|
||||||
ForceClose();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
||||||
@@ -263,6 +306,22 @@ namespace TweetDck.Core{
|
|||||||
Config.Save();
|
Config.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void soundNotification_PlaybackError(object sender, PlaybackErrorEventArgs e){
|
||||||
|
e.Ignore = true;
|
||||||
|
|
||||||
|
using(FormMessage form = new FormMessage("Notification Sound Error", "Could not play custom notification sound."+Environment.NewLine+e.Message, MessageBoxIcon.Error)){
|
||||||
|
form.CancelButton = form.AddButton("Ignore");
|
||||||
|
|
||||||
|
Button btnOpenSettings = form.AddButton("Open Settings");
|
||||||
|
btnOpenSettings.Width += 16;
|
||||||
|
btnOpenSettings.Location = new Point(btnOpenSettings.Location.X-16, btnOpenSettings.Location.Y);
|
||||||
|
|
||||||
|
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnOpenSettings){
|
||||||
|
OpenSettings(FormSettings.TabIndexNotification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m){
|
protected override void WndProc(ref Message m){
|
||||||
if (isLoaded && m.Msg == Program.WindowRestoreMessage){
|
if (isLoaded && m.Msg == Program.WindowRestoreMessage){
|
||||||
using(Process process = Process.GetCurrentProcess()){
|
using(Process process = Process.GetCurrentProcess()){
|
||||||
@@ -274,7 +333,7 @@ namespace TweetDck.Core{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoaded && m.Msg == 0x210 && (m.WParam.ToInt32() & 0xFFFF) == 0x020B){ // WM_PARENTNOTIFY, WM_XBUTTONDOWN
|
if (isBrowserReady && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN){
|
||||||
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
|
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -284,8 +343,8 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
// notification helpers
|
// notification helpers
|
||||||
|
|
||||||
public FormNotification CreateNotificationForm(NotificationFlags flags){
|
public FormNotificationMain CreateNotificationForm(bool enableContextMenu){
|
||||||
return new FormNotification(this, plugins, flags);
|
return new FormNotificationMain(this, plugins, enableContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PauseNotification(){
|
public void PauseNotification(){
|
||||||
@@ -299,36 +358,36 @@ namespace TweetDck.Core{
|
|||||||
// javascript calls
|
// javascript calls
|
||||||
|
|
||||||
public void ReinjectCustomCSS(string css){
|
public void ReinjectCustomCSS(string css){
|
||||||
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css == null ? string.Empty : css.Replace(Environment.NewLine, " "));
|
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css?.Replace(Environment.NewLine, " ") ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProperties(PropertyBridge.Properties properties = PropertyBridge.Properties.All){
|
public void UpdateProperties(PropertyBridge.Properties properties){
|
||||||
browser.ExecuteScriptAsync(PropertyBridge.GenerateScript(properties));
|
browser.ExecuteScriptAsync(PropertyBridge.GenerateScript(properties));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ReloadToTweetDeck(){
|
||||||
|
browser.ExecuteScriptAsync("window.location.href = 'https://tweetdeck.twitter.com'");
|
||||||
|
}
|
||||||
|
|
||||||
// callback handlers
|
// callback handlers
|
||||||
|
|
||||||
|
public void OpenContextMenu(){
|
||||||
|
contextMenu.Show(this, PointToClient(Cursor.Position));
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenSettings(){
|
public void OpenSettings(){
|
||||||
OpenSettings(0);
|
OpenSettings(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenSettings(int tabIndex){
|
public void OpenSettings(int tabIndex){
|
||||||
if (currentFormSettings != null){
|
if (!TryBringToFront<FormSettings>()){
|
||||||
currentFormSettings.BringToFront();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
bool prevEnableUpdateCheck = Config.EnableUpdateCheck;
|
bool prevEnableUpdateCheck = Config.EnableUpdateCheck;
|
||||||
|
|
||||||
currentFormSettings = new FormSettings(this, plugins, updates, tabIndex);
|
FormSettings form = new FormSettings(this, plugins, updates, tabIndex);
|
||||||
|
|
||||||
currentFormSettings.FormClosed += (sender, args) => {
|
|
||||||
currentFormSettings = null;
|
|
||||||
|
|
||||||
|
form.FormClosed += (sender, args) => {
|
||||||
if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){
|
if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){
|
||||||
updates.Settings.DismissedUpdate = string.Empty;
|
updates.DismissUpdate(string.Empty);
|
||||||
Config.DismissedUpdate = string.Empty;
|
|
||||||
Config.Save();
|
|
||||||
|
|
||||||
updates.Check(false);
|
updates.Check(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,32 +395,23 @@ namespace TweetDck.Core{
|
|||||||
trayIcon.HasNotifications = false;
|
trayIcon.HasNotifications = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound);
|
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound);
|
||||||
|
form.Dispose();
|
||||||
};
|
};
|
||||||
|
|
||||||
ShowChildForm(currentFormSettings);
|
ShowChildForm(form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenAbout(){
|
public void OpenAbout(){
|
||||||
if (currentFormAbout != null){
|
if (!TryBringToFront<FormAbout>()){
|
||||||
currentFormAbout.BringToFront();
|
ShowChildForm(new FormAbout());
|
||||||
}
|
|
||||||
else{
|
|
||||||
currentFormAbout = new FormAbout();
|
|
||||||
currentFormAbout.FormClosed += (sender, args) => currentFormAbout = null;
|
|
||||||
ShowChildForm(currentFormAbout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenPlugins(){
|
public void OpenPlugins(){
|
||||||
if (currentFormPlugins != null){
|
if (!TryBringToFront<FormPlugins>()){
|
||||||
currentFormPlugins.BringToFront();
|
ShowChildForm(new FormPlugins(plugins));
|
||||||
}
|
|
||||||
else{
|
|
||||||
currentFormPlugins = new FormPlugins(plugins);
|
|
||||||
currentFormPlugins.FormClosed += (sender, args) => currentFormPlugins = null;
|
|
||||||
ShowChildForm(currentFormPlugins);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +427,8 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (soundNotification == null){
|
if (soundNotification == null){
|
||||||
soundNotification = new SoundNotification(this);
|
soundNotification = SoundNotification.New();
|
||||||
|
soundNotification.PlaybackError += soundNotification_PlaybackError;
|
||||||
}
|
}
|
||||||
|
|
||||||
soundNotification.Play(Config.NotificationSoundPath);
|
soundNotification.Play(Config.NotificationSoundPath);
|
||||||
@@ -402,16 +453,6 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnImagePasted(){
|
|
||||||
browser.ExecuteScriptAsync("TDGF_tryPasteImage()");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TriggerImageUpload(int offsetX, int offsetY){
|
|
||||||
IBrowserHost host = browser.GetBrowser().GetHost();
|
|
||||||
host.SendMouseClickEvent(offsetX, offsetY, MouseButtonType.Left, false, 1, CefEventFlags.None);
|
|
||||||
host.SendMouseClickEvent(offsetX, offsetY, MouseButtonType.Left, true, 1, CefEventFlags.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TriggerTweetScreenshot(){
|
public void TriggerTweetScreenshot(){
|
||||||
browser.ExecuteScriptAsync("TDGF_triggerScreenshot()");
|
browser.ExecuteScriptAsync("TDGF_triggerScreenshot()");
|
||||||
}
|
}
|
||||||
|
@@ -1,443 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
|
||||||
using TweetDck.Configuration;
|
|
||||||
using TweetDck.Core.Bridge;
|
|
||||||
using TweetDck.Core.Handling;
|
|
||||||
using TweetDck.Resources;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
using TweetDck.Plugins;
|
|
||||||
using TweetDck.Plugins.Enums;
|
|
||||||
using TweetDck.Core.Controls;
|
|
||||||
using TweetDck.Core.Notification;
|
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
|
||||||
partial class FormNotification : Form{
|
|
||||||
private const string NotificationScriptFile = "notification.js";
|
|
||||||
|
|
||||||
private static readonly string NotificationScriptIdentifier = ScriptLoader.GetRootIdentifier(NotificationScriptFile);
|
|
||||||
private static readonly string PluginScriptIdentifier = ScriptLoader.GetRootIdentifier(PluginManager.PluginNotificationScriptFile);
|
|
||||||
|
|
||||||
public Func<bool> CanMoveWindow = () => true;
|
|
||||||
|
|
||||||
public bool IsNotificationVisible{
|
|
||||||
get{
|
|
||||||
return Location != ControlExtensions.InvisibleLocation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new Point Location{
|
|
||||||
get{
|
|
||||||
return base.Location;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
|
||||||
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Control owner;
|
|
||||||
private readonly PluginManager plugins;
|
|
||||||
protected readonly NotificationFlags flags;
|
|
||||||
protected readonly ChromiumWebBrowser browser;
|
|
||||||
|
|
||||||
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
|
||||||
private int timeLeft, totalTime;
|
|
||||||
|
|
||||||
private readonly NativeMethods.HookProc mouseHookDelegate;
|
|
||||||
private IntPtr mouseHook;
|
|
||||||
|
|
||||||
private bool? prevDisplayTimer;
|
|
||||||
private int? prevFontSize;
|
|
||||||
|
|
||||||
private bool RequiresResize{
|
|
||||||
get{
|
|
||||||
return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Program.UserConfig.DisplayNotificationTimer || prevFontSize != TweetNotification.FontSizeLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
|
||||||
if (value){
|
|
||||||
prevDisplayTimer = null;
|
|
||||||
prevFontSize = null;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
prevDisplayTimer = Program.UserConfig.DisplayNotificationTimer;
|
|
||||||
prevFontSize = TweetNotification.FontSizeLevel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly string notificationJS;
|
|
||||||
private readonly string pluginJS;
|
|
||||||
|
|
||||||
protected override bool ShowWithoutActivation{
|
|
||||||
get{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FreezeTimer { get; set; }
|
|
||||||
public bool ContextMenuOpen { get; set; }
|
|
||||||
public string CurrentUrl { get; private set; }
|
|
||||||
public string CurrentQuotedTweetUrl { get; set; }
|
|
||||||
|
|
||||||
public EventHandler Initialized;
|
|
||||||
|
|
||||||
private int pauseCounter;
|
|
||||||
private bool pausedDuringNotification;
|
|
||||||
|
|
||||||
public bool IsPaused{
|
|
||||||
get{
|
|
||||||
return pauseCounter > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int BaseClientWidth{
|
|
||||||
get{
|
|
||||||
int level = TweetNotification.FontSizeLevel;
|
|
||||||
return level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int BaseClientHeight{
|
|
||||||
get{
|
|
||||||
int level = TweetNotification.FontSizeLevel;
|
|
||||||
return level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FormNotification(FormBrowser owner, PluginManager pluginManager, NotificationFlags flags){
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
this.owner = owner;
|
|
||||||
this.plugins = pluginManager;
|
|
||||||
this.flags = flags;
|
|
||||||
|
|
||||||
owner.FormClosed += (sender, args) => Close();
|
|
||||||
|
|
||||||
browser = new ChromiumWebBrowser("about:blank"){
|
|
||||||
MenuHandler = new ContextMenuNotification(this, !flags.HasFlag(NotificationFlags.DisableContextMenu)),
|
|
||||||
LifeSpanHandler = new LifeSpanHandler()
|
|
||||||
};
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
|
|
||||||
browser.LoadingStateChanged += Browser_LoadingStateChanged;
|
|
||||||
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
|
||||||
|
|
||||||
if (!flags.HasFlag(NotificationFlags.DisableScripts)){
|
|
||||||
notificationJS = ScriptLoader.LoadResource(NotificationScriptFile);
|
|
||||||
browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(owner, this));
|
|
||||||
|
|
||||||
if (plugins != null){
|
|
||||||
pluginJS = ScriptLoader.LoadResource(PluginManager.PluginNotificationScriptFile);
|
|
||||||
browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
panelBrowser.Controls.Add(browser);
|
|
||||||
|
|
||||||
if (flags.HasFlag(NotificationFlags.AutoHide)){
|
|
||||||
Program.UserConfig.MuteToggled += Config_MuteToggled;
|
|
||||||
Disposed += (sender, args) => Program.UserConfig.MuteToggled -= Config_MuteToggled;
|
|
||||||
|
|
||||||
if (Program.UserConfig.MuteNotifications){
|
|
||||||
PauseNotification();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mouseHookDelegate = MouseHookProc;
|
|
||||||
|
|
||||||
Disposed += FormNotification_Disposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void WndProc(ref Message m){
|
|
||||||
if (m.Msg == 0x0112 && (m.WParam.ToInt32() & 0xFFF0) == 0xF010 && !CanMoveWindow()){ // WM_SYSCOMMAND, SC_MOVE
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
base.WndProc(ref m);
|
|
||||||
}
|
|
||||||
|
|
||||||
// mouse wheel hook
|
|
||||||
|
|
||||||
private void StartMouseHook(){
|
|
||||||
if (mouseHook == IntPtr.Zero){
|
|
||||||
mouseHook = NativeMethods.SetWindowsHookEx(NativeMethods.WH_MOUSE_LL, mouseHookDelegate, IntPtr.Zero, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StopMouseHook(){
|
|
||||||
if (mouseHook != IntPtr.Zero){
|
|
||||||
NativeMethods.UnhookWindowsHookEx(mouseHook);
|
|
||||||
mouseHook = IntPtr.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
|
|
||||||
if (!ContainsFocus && wParam.ToInt32() == NativeMethods.WH_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position))){
|
|
||||||
// fuck it, Activate() doesn't work with this
|
|
||||||
Point prevPos = Cursor.Position;
|
|
||||||
Cursor.Position = PointToScreen(new Point(0, -1));
|
|
||||||
NativeMethods.SimulateMouseClick(NativeMethods.MouseButton.Left);
|
|
||||||
Cursor.Position = prevPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NativeMethods.CallNextHookEx(mouseHook, nCode, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
// event handlers
|
|
||||||
|
|
||||||
private void timerDisplayDelay_Tick(object sender, EventArgs e){
|
|
||||||
OnNotificationReady();
|
|
||||||
timerDisplayDelay.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void timerHideProgress_Tick(object sender, EventArgs e){
|
|
||||||
if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen)return;
|
|
||||||
|
|
||||||
timeLeft -= timerProgress.Interval;
|
|
||||||
|
|
||||||
int value = (int)Math.Round(1025.0*(totalTime-timeLeft)/totalTime);
|
|
||||||
progressBarTimer.SetValueInstant(Math.Min(1000, Math.Max(0, Program.UserConfig.NotificationTimerCountDown ? 1000-value : value)));
|
|
||||||
|
|
||||||
if (timeLeft <= 0){
|
|
||||||
FinishCurrentTweet();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Config_MuteToggled(object sender, EventArgs e){
|
|
||||||
if (Program.UserConfig.MuteNotifications){
|
|
||||||
PauseNotification();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ResumeNotification();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
|
|
||||||
if (e.IsBrowserInitialized && Initialized != null){
|
|
||||||
Initialized(this, new EventArgs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
|
||||||
if (!e.IsLoading && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.ManualDisplay)){
|
|
||||||
this.InvokeSafe(() => {
|
|
||||||
Visible = true; // ensures repaint before moving the window to a visible location
|
|
||||||
timerDisplayDelay.Start();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
|
||||||
if (e.Frame.IsMain && notificationJS != null && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.DisableScripts)){
|
|
||||||
e.Frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Properties.ExpandLinksOnHover));
|
|
||||||
ScriptLoader.ExecuteScript(e.Frame, notificationJS, NotificationScriptIdentifier);
|
|
||||||
|
|
||||||
if (plugins != null && plugins.HasAnyPlugin(PluginEnvironment.Notification)){
|
|
||||||
ScriptLoader.ExecuteScript(e.Frame, pluginJS, PluginScriptIdentifier);
|
|
||||||
ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginGlobalScriptFile);
|
|
||||||
plugins.ExecutePlugins(e.Frame, PluginEnvironment.Notification, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
|
|
||||||
if (e.CloseReason == CloseReason.UserClosing){
|
|
||||||
HideNotification(false);
|
|
||||||
tweetQueue.Clear();
|
|
||||||
e.Cancel = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormNotification_Disposed(object sender, EventArgs e){
|
|
||||||
browser.Dispose();
|
|
||||||
StopMouseHook();
|
|
||||||
}
|
|
||||||
|
|
||||||
// notification methods
|
|
||||||
|
|
||||||
public void ShowNotification(TweetNotification notification){
|
|
||||||
if (IsPaused){
|
|
||||||
tweetQueue.Enqueue(notification);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
tweetQueue.Enqueue(notification);
|
|
||||||
UpdateTitle();
|
|
||||||
|
|
||||||
if (totalTime == 0){
|
|
||||||
LoadNextNotification();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowNotificationForSettings(bool reset){
|
|
||||||
if (reset){
|
|
||||||
LoadTweet(TweetNotification.ExampleTweet);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
PrepareAndDisplayWindow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HideNotification(bool loadBlank){
|
|
||||||
if (loadBlank){
|
|
||||||
browser.LoadHtml("", "about:blank");
|
|
||||||
}
|
|
||||||
|
|
||||||
Location = ControlExtensions.InvisibleLocation;
|
|
||||||
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
|
||||||
timerProgress.Stop();
|
|
||||||
totalTime = 0;
|
|
||||||
|
|
||||||
StopMouseHook();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FinishCurrentTweet(){
|
|
||||||
if (tweetQueue.Count > 0){
|
|
||||||
LoadNextNotification();
|
|
||||||
}
|
|
||||||
else if (flags.HasFlag(NotificationFlags.AutoHide)){
|
|
||||||
HideNotification(true);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
timerProgress.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PauseNotification(){
|
|
||||||
if (pauseCounter++ == 0){
|
|
||||||
pausedDuringNotification = IsNotificationVisible;
|
|
||||||
|
|
||||||
if (IsNotificationVisible){
|
|
||||||
Location = ControlExtensions.InvisibleLocation;
|
|
||||||
timerProgress.Stop();
|
|
||||||
StopMouseHook();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResumeNotification(){
|
|
||||||
if (pauseCounter > 0 && --pauseCounter == 0){
|
|
||||||
if (pausedDuringNotification){
|
|
||||||
OnNotificationReady();
|
|
||||||
}
|
|
||||||
else if (tweetQueue.Count > 0){
|
|
||||||
LoadNextNotification();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadNextNotification(){
|
|
||||||
LoadTweet(tweetQueue.Dequeue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadTweet(TweetNotification tweet){
|
|
||||||
CurrentUrl = tweet.Url;
|
|
||||||
CurrentQuotedTweetUrl = string.Empty; // load from JS
|
|
||||||
|
|
||||||
timerProgress.Stop();
|
|
||||||
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDurationValue);
|
|
||||||
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
|
||||||
|
|
||||||
string bodyClasses = browser.Bounds.Contains(PointToClient(Cursor.Position)) ? "td-hover" : string.Empty;
|
|
||||||
|
|
||||||
browser.LoadHtml(tweet.GenerateHtml(bodyClasses), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PrepareAndDisplayWindow(){
|
|
||||||
if (RequiresResize){
|
|
||||||
RequiresResize = false;
|
|
||||||
SetNotificationSize(BaseClientWidth, BaseClientHeight, Program.UserConfig.DisplayNotificationTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveToVisibleLocation();
|
|
||||||
StartMouseHook();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetNotificationSize(int width, int height, bool displayTimer){
|
|
||||||
if (displayTimer){
|
|
||||||
ClientSize = new Size(width, height+4);
|
|
||||||
progressBarTimer.Visible = true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ClientSize = new Size(width, height);
|
|
||||||
progressBarTimer.Visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
panelBrowser.Height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void MoveToVisibleLocation(){
|
|
||||||
UserConfig config = Program.UserConfig;
|
|
||||||
|
|
||||||
Screen screen = Screen.FromControl(owner);
|
|
||||||
|
|
||||||
if (config.NotificationDisplay > 0 && config.NotificationDisplay <= Screen.AllScreens.Length){
|
|
||||||
screen = Screen.AllScreens[config.NotificationDisplay-1];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
|
|
||||||
int edgeDist = config.NotificationEdgeDistance;
|
|
||||||
|
|
||||||
switch(config.NotificationPosition){
|
|
||||||
case TweetNotification.Position.TopLeft:
|
|
||||||
Location = new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+edgeDist);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TweetNotification.Position.TopRight:
|
|
||||||
Location = new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TweetNotification.Position.BottomLeft:
|
|
||||||
Location = new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TweetNotification.Position.BottomRight:
|
|
||||||
Location = new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
|
||||||
break;
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
Location = config.CustomNotificationPosition;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needsReactivating && flags.HasFlag(NotificationFlags.TopMost)){
|
|
||||||
NativeMethods.SetFormPos(this, NativeMethods.HWND_TOPMOST, NativeMethods.SWP_NOACTIVATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void UpdateTitle(){
|
|
||||||
Text = tweetQueue.Count > 0 ? Program.BrandName+" ("+tweetQueue.Count+" more left)" : Program.BrandName;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void OnNotificationReady(){
|
|
||||||
UpdateTitle();
|
|
||||||
PrepareAndDisplayWindow();
|
|
||||||
timerProgress.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DisplayTooltip(string text){
|
|
||||||
if (string.IsNullOrEmpty(text)){
|
|
||||||
toolTip.Hide(this);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Point position = PointToClient(Cursor.Position);
|
|
||||||
position.Offset(20, 5);
|
|
||||||
toolTip.Show(text, this, position); // TODO figure out flickering when moving the mouse
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +1,11 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class BrowserProcessHandler : IBrowserProcessHandler{
|
class BrowserProcessHandler : IBrowserProcessHandler{
|
||||||
void IBrowserProcessHandler.OnContextInitialized(){
|
void IBrowserProcessHandler.OnContextInitialized(){
|
||||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||||
string err;
|
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out string _);
|
||||||
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,27 +1,25 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
abstract class ContextMenuBase : IContextMenuHandler{
|
abstract class ContextMenuBase : IContextMenuHandler{
|
||||||
|
private static readonly Lazy<Regex> RegexTwitterAccount = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled), false);
|
||||||
|
protected static readonly bool HasDevTools = File.Exists(Path.Combine(Program.ProgramPath, "devtools_resources.pak"));
|
||||||
|
|
||||||
private const int MenuOpenLinkUrl = 26500;
|
private const int MenuOpenLinkUrl = 26500;
|
||||||
private const int MenuCopyLinkUrl = 26501;
|
private const int MenuCopyLinkUrl = 26501;
|
||||||
private const int MenuOpenImage = 26502;
|
private const int MenuCopyUsername = 26502;
|
||||||
private const int MenuSaveImage = 26503;
|
private const int MenuOpenImage = 26503;
|
||||||
private const int MenuCopyImageUrl = 26504;
|
private const int MenuSaveImage = 26504;
|
||||||
|
private const int MenuCopyImageUrl = 26505;
|
||||||
#if DEBUG
|
|
||||||
private const int MenuOpenDevTools = 26599;
|
private const int MenuOpenDevTools = 26599;
|
||||||
|
|
||||||
protected void AddDebugMenuItems(IMenuModel model){
|
|
||||||
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private readonly Form form;
|
private readonly Form form;
|
||||||
|
|
||||||
protected ContextMenuBase(Form form){
|
protected ContextMenuBase(Form form){
|
||||||
@@ -30,8 +28,16 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||||
|
if (RegexTwitterAccount.Value.IsMatch(parameters.UnfilteredLinkUrl)){
|
||||||
|
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open account in browser");
|
||||||
|
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy account address");
|
||||||
|
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
|
||||||
|
}
|
||||||
|
else{
|
||||||
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open link in browser");
|
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open link in browser");
|
||||||
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy link address");
|
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy link address");
|
||||||
|
}
|
||||||
|
|
||||||
model.AddSeparator();
|
model.AddSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +79,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (saveTarget != null){
|
if (saveTarget != null){
|
||||||
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, ex => {
|
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, null, ex => {
|
||||||
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -84,11 +90,14 @@ namespace TweetDck.Core.Handling{
|
|||||||
SetClipboardText(parameters.SourceUrl);
|
SetClipboardText(parameters.SourceUrl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if DEBUG
|
case MenuCopyUsername:
|
||||||
|
Match match = RegexTwitterAccount.Value.Match(parameters.UnfilteredLinkUrl);
|
||||||
|
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||||
|
break;
|
||||||
|
|
||||||
case MenuOpenDevTools:
|
case MenuOpenDevTools:
|
||||||
browserControl.ShowDevTools();
|
browserControl.ShowDevTools();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -104,6 +113,10 @@ namespace TweetDck.Core.Handling{
|
|||||||
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void AddDebugMenuItems(IMenuModel model){
|
||||||
|
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
||||||
|
}
|
||||||
|
|
||||||
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
||||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
||||||
model.RemoveAt(model.Count-1);
|
model.RemoveAt(model.Count-1);
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Bridge;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ContextMenuBrowser : ContextMenuBase{
|
class ContextMenuBrowser : ContextMenuBase{
|
||||||
private const int MenuGlobal = 26600;
|
private const int MenuGlobal = 26600;
|
||||||
private const int MenuMute = 26601;
|
private const int MenuMute = 26601;
|
||||||
@@ -17,6 +18,12 @@ namespace TweetDck.Core.Handling{
|
|||||||
private const int MenuCopyQuotedTweetUrl = 26613;
|
private const int MenuCopyQuotedTweetUrl = 26613;
|
||||||
private const int MenuScreenshotTweet = 26614;
|
private const int MenuScreenshotTweet = 26614;
|
||||||
|
|
||||||
|
private const string TitleReloadBrowser = "Reload browser";
|
||||||
|
private const string TitleMuteNotifications = "Mute notifications";
|
||||||
|
private const string TitleSettings = "Settings";
|
||||||
|
private const string TitlePlugins = "Plugins";
|
||||||
|
private const string TitleAboutProgram = "About "+Program.BrandName;
|
||||||
|
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
|
|
||||||
private string lastHighlightedTweet;
|
private string lastHighlightedTweet;
|
||||||
@@ -66,19 +73,19 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu((CefMenuCommand)MenuGlobal, Program.BrandName);
|
IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu((CefMenuCommand)MenuGlobal, Program.BrandName);
|
||||||
|
|
||||||
globalMenu.AddItem(CefMenuCommand.Reload, "Reload browser");
|
globalMenu.AddItem(CefMenuCommand.Reload, TitleReloadBrowser);
|
||||||
globalMenu.AddCheckItem((CefMenuCommand)MenuMute, "Mute notifications");
|
globalMenu.AddCheckItem((CefMenuCommand)MenuMute, TitleMuteNotifications);
|
||||||
globalMenu.SetChecked((CefMenuCommand)MenuMute, Program.UserConfig.MuteNotifications);
|
globalMenu.SetChecked((CefMenuCommand)MenuMute, Program.UserConfig.MuteNotifications);
|
||||||
globalMenu.AddSeparator();
|
globalMenu.AddSeparator();
|
||||||
|
|
||||||
globalMenu.AddItem((CefMenuCommand)MenuSettings, "Settings");
|
globalMenu.AddItem((CefMenuCommand)MenuSettings, TitleSettings);
|
||||||
globalMenu.AddItem((CefMenuCommand)MenuPlugins, "Plugins");
|
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
|
||||||
globalMenu.AddItem((CefMenuCommand)MenuAbout, "About "+Program.BrandName);
|
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
|
||||||
|
|
||||||
#if DEBUG
|
if (HasDevTools){
|
||||||
globalMenu.AddSeparator();
|
globalMenu.AddSeparator();
|
||||||
AddDebugMenuItems(globalMenu);
|
AddDebugMenuItems(globalMenu);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
@@ -91,7 +98,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
switch((int)commandId){
|
switch((int)commandId){
|
||||||
case (int)CefMenuCommand.Reload:
|
case (int)CefMenuCommand.Reload:
|
||||||
frame.ExecuteJavaScriptAsync("window.location.href = 'https://tweetdeck.twitter.com'");
|
form.InvokeAsyncSafe(form.ReloadToTweetDeck);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuSettings:
|
case MenuSettings:
|
||||||
@@ -107,11 +114,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuMute:
|
case MenuMute:
|
||||||
form.InvokeAsyncSafe(() => {
|
form.InvokeAsyncSafe(ToggleMuteNotifications);
|
||||||
Program.UserConfig.MuteNotifications = !Program.UserConfig.MuteNotifications;
|
|
||||||
Program.UserConfig.Save();
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuOpenTweetUrl:
|
case MenuOpenTweetUrl:
|
||||||
@@ -137,5 +140,27 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ContextMenu CreateMenu(FormBrowser form){
|
||||||
|
ContextMenu menu = new ContextMenu();
|
||||||
|
|
||||||
|
menu.MenuItems.Add(TitleReloadBrowser, (sender, args) => form.ReloadToTweetDeck());
|
||||||
|
menu.MenuItems.Add(TitleMuteNotifications, (sender, args) => ToggleMuteNotifications());
|
||||||
|
menu.MenuItems.Add("-");
|
||||||
|
menu.MenuItems.Add(TitleSettings, (sender, args) => form.OpenSettings());
|
||||||
|
menu.MenuItems.Add(TitlePlugins, (sender, args) => form.OpenPlugins());
|
||||||
|
menu.MenuItems.Add(TitleAboutProgram, (sender, args) => form.OpenAbout());
|
||||||
|
|
||||||
|
menu.Popup += (sender, args) => {
|
||||||
|
menu.MenuItems[1].Checked = Program.UserConfig.MuteNotifications;
|
||||||
|
};
|
||||||
|
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ToggleMuteNotifications(){
|
||||||
|
Program.UserConfig.MuteNotifications = !Program.UserConfig.MuteNotifications;
|
||||||
|
Program.UserConfig.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,18 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Notification;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ContextMenuNotification : ContextMenuBase{
|
class ContextMenuNotification : ContextMenuBase{
|
||||||
private const int MenuSkipTweet = 26600;
|
private const int MenuSkipTweet = 26600;
|
||||||
private const int MenuFreeze = 26601;
|
private const int MenuFreeze = 26601;
|
||||||
private const int MenuCopyTweetUrl = 26602;
|
private const int MenuCopyTweetUrl = 26602;
|
||||||
private const int MenuCopyQuotedTweetUrl = 26603;
|
private const int MenuCopyQuotedTweetUrl = 26603;
|
||||||
|
|
||||||
private readonly FormNotification form;
|
private readonly FormNotificationBase form;
|
||||||
private readonly bool enableCustomMenu;
|
private readonly bool enableCustomMenu;
|
||||||
|
|
||||||
public ContextMenuNotification(FormNotification form, bool enableCustomMenu) : base(form){
|
public ContextMenuNotification(FormNotificationBase form, bool enableCustomMenu) : base(form){
|
||||||
this.form = form;
|
this.form = form;
|
||||||
this.enableCustomMenu = enableCustomMenu;
|
this.enableCustomMenu = enableCustomMenu;
|
||||||
}
|
}
|
||||||
@@ -32,10 +33,10 @@ namespace TweetDck.Core.Handling{
|
|||||||
model.SetChecked((CefMenuCommand)MenuFreeze, form.FreezeTimer);
|
model.SetChecked((CefMenuCommand)MenuFreeze, form.FreezeTimer);
|
||||||
model.AddSeparator();
|
model.AddSeparator();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(form.CurrentUrl)){
|
if (!string.IsNullOrEmpty(form.CurrentTweetUrl)){
|
||||||
model.AddItem((CefMenuCommand)MenuCopyTweetUrl, "Copy tweet address");
|
model.AddItem((CefMenuCommand)MenuCopyTweetUrl, "Copy tweet address");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(form.CurrentQuotedTweetUrl)){
|
if (!string.IsNullOrEmpty(form.CurrentQuoteUrl)){
|
||||||
model.AddItem((CefMenuCommand)MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
|
model.AddItem((CefMenuCommand)MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,9 +44,9 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
if (HasDevTools){
|
||||||
AddDebugMenuItems(model);
|
AddDebugMenuItems(model);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
switch((int)commandId){
|
switch((int)commandId){
|
||||||
case MenuSkipTweet:
|
case MenuSkipTweet:
|
||||||
form.InvokeAsyncSafe(form.FinishCurrentTweet);
|
form.InvokeAsyncSafe(form.FinishCurrentNotification);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuFreeze:
|
case MenuFreeze:
|
||||||
@@ -67,11 +68,11 @@ namespace TweetDck.Core.Handling{
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuCopyTweetUrl:
|
case MenuCopyTweetUrl:
|
||||||
SetClipboardText(form.CurrentUrl);
|
SetClipboardText(form.CurrentTweetUrl);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MenuCopyQuotedTweetUrl:
|
case MenuCopyQuotedTweetUrl:
|
||||||
SetClipboardText(form.CurrentQuotedTweetUrl);
|
SetClipboardText(form.CurrentQuoteUrl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,28 +0,0 @@
|
|||||||
using CefSharp;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using TweetDck.Core.Bridge;
|
|
||||||
using TweetDck.Core.Controls;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
|
||||||
class FileDialogHandler : IDialogHandler{
|
|
||||||
private readonly FormBrowser form;
|
|
||||||
|
|
||||||
public FileDialogHandler(FormBrowser form){
|
|
||||||
this.form = form;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List<string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback){
|
|
||||||
if (!string.IsNullOrEmpty(TweetDeckBridge.ClipboardImagePath)){
|
|
||||||
callback.Continue(selectedAcceptFilter, new List<string>{ TweetDeckBridge.ClipboardImagePath });
|
|
||||||
|
|
||||||
form.InvokeSafe(() => {
|
|
||||||
TweetDeckBridge.ClipboardImagePath = string.Empty;
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +1,47 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling {
|
namespace TweetDuck.Core.Handling {
|
||||||
class JavaScriptDialogHandler : IJsDialogHandler{
|
class JavaScriptDialogHandler : IJsDialogHandler{
|
||||||
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
||||||
if (dialogType != CefJsDialogType.Alert && dialogType != CefJsDialogType.Confirm){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
||||||
FormMessage form = new FormMessage(Program.BrandName, messageText, MessageBoxIcon.None);
|
FormMessage form = new FormMessage(Program.BrandName, messageText, MessageBoxIcon.None);
|
||||||
Button btnConfirm;
|
TextBox input = null;
|
||||||
|
|
||||||
if (dialogType == CefJsDialogType.Alert){
|
if (dialogType == CefJsDialogType.Alert){
|
||||||
btnConfirm = form.AddButton("OK");
|
form.AcceptButton = form.AddButton("OK");
|
||||||
}
|
}
|
||||||
else if (dialogType == CefJsDialogType.Confirm){
|
else if (dialogType == CefJsDialogType.Confirm){
|
||||||
form.AddButton("No");
|
form.CancelButton = form.AddButton("No", DialogResult.No);
|
||||||
btnConfirm = form.AddButton("Yes");
|
form.AcceptButton = form.AddButton("Yes");
|
||||||
}
|
}
|
||||||
else{
|
else if (dialogType == CefJsDialogType.Prompt){
|
||||||
return;
|
form.CancelButton = form.AddButton("Cancel", DialogResult.Cancel);
|
||||||
|
form.AcceptButton = form.AddButton("OK");
|
||||||
|
|
||||||
|
input = new TextBox{
|
||||||
|
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
|
||||||
|
Location = new Point(27, form.ActionPanelY-46),
|
||||||
|
Size = new Size(form.ClientSize.Width-54, 20)
|
||||||
|
};
|
||||||
|
|
||||||
|
form.Controls.Add(input);
|
||||||
|
form.ActiveControl = input;
|
||||||
|
form.Height += input.Size.Height+input.Margin.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnConfirm){
|
bool success = form.ShowDialog() == DialogResult.OK;
|
||||||
callback.Continue(true);
|
|
||||||
|
if (input == null){
|
||||||
|
callback.Continue(success);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
callback.Continue(false);
|
callback.Continue(success, input.Text);
|
||||||
|
input.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
form.Dispose();
|
form.Dispose();
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class LifeSpanHandler : ILifeSpanHandler{
|
class LifeSpanHandler : ILifeSpanHandler{
|
||||||
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
||||||
newBrowser = null;
|
newBrowser = null;
|
||||||
|
68
Core/Handling/RequestHandler.cs
Normal file
68
Core/Handling/RequestHandler.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
abstract class RequestHandler : IRequestHandler{
|
||||||
|
// Browser
|
||||||
|
|
||||||
|
public virtual void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser){}
|
||||||
|
|
||||||
|
public virtual void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){}
|
||||||
|
|
||||||
|
public virtual bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resources
|
||||||
|
|
||||||
|
public virtual CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||||
|
return CefReturnValue.Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl){}
|
||||||
|
|
||||||
|
public virtual bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength){}
|
||||||
|
|
||||||
|
// JavaScript & Plugins
|
||||||
|
|
||||||
|
public virtual bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath){}
|
||||||
|
|
||||||
|
// Auth
|
||||||
|
|
||||||
|
public virtual bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port, X509Certificate2Collection certificates, ISelectClientCertificateCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
class RequestHandlerBrowser : RequestHandler{
|
||||||
|
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||||
|
browser.Reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
Core/Handling/ResourceHandlerNotification.cs
Normal file
63
Core/Handling/ResourceHandlerNotification.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using CefSharp;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
class ResourceHandlerNotification : IResourceHandler{
|
||||||
|
private readonly NameValueCollection headers = new NameValueCollection(0);
|
||||||
|
private MemoryStream dataIn;
|
||||||
|
|
||||||
|
public void SetHTML(string html){
|
||||||
|
dataIn?.Dispose();
|
||||||
|
dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose(){
|
||||||
|
if (dataIn != null){
|
||||||
|
dataIn.Dispose();
|
||||||
|
dataIn = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback){
|
||||||
|
callback.Continue();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IResourceHandler.GetResponseHeaders(IResponse response, out long responseLength, out string redirectUrl){
|
||||||
|
redirectUrl = null;
|
||||||
|
|
||||||
|
response.MimeType = "text/html";
|
||||||
|
response.StatusCode = 200;
|
||||||
|
response.StatusText = "OK";
|
||||||
|
response.ResponseHeaders = headers;
|
||||||
|
responseLength = dataIn?.Length ?? -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
|
||||||
|
try{
|
||||||
|
int length = (int)dataIn.Length;
|
||||||
|
|
||||||
|
dataIn.CopyTo(dataOut, length);
|
||||||
|
bytesRead = length;
|
||||||
|
return true;
|
||||||
|
}catch{ // catch IOException, possibly NullReferenceException if dataIn is null
|
||||||
|
bytesRead = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IResourceHandler.CanGetCookie(Cookie cookie){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IResourceHandler.CanSetCookie(Cookie cookie){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IResourceHandler.Cancel(){}
|
||||||
|
}
|
||||||
|
}
|
52
Core/Notification/FormNotificationBase.Designer.cs
generated
Normal file
52
Core/Notification/FormNotificationBase.Designer.cs
generated
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
namespace TweetDuck.Core.Notification {
|
||||||
|
partial class FormNotificationBase {
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
if (disposing && (components != null)) {
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.SuspendLayout();
|
||||||
|
//
|
||||||
|
// FormNotification
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
this.ClientSize = new System.Drawing.Size(284, 122);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
|
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "FormNotification";
|
||||||
|
this.ShowIcon = false;
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ToolTip toolTip;
|
||||||
|
}
|
||||||
|
}
|
211
Core/Notification/FormNotificationBase.cs
Normal file
211
Core/Notification/FormNotificationBase.cs
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
using CefSharp;
|
||||||
|
using CefSharp.WinForms;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Configuration;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Handling;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification{
|
||||||
|
partial class FormNotificationBase : Form{
|
||||||
|
protected Point PrimaryLocation{
|
||||||
|
get{
|
||||||
|
UserConfig config = Program.UserConfig;
|
||||||
|
Screen screen;
|
||||||
|
|
||||||
|
if (config.NotificationDisplay > 0 && config.NotificationDisplay <= Screen.AllScreens.Length){
|
||||||
|
screen = Screen.AllScreens[config.NotificationDisplay-1];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
screen = Screen.FromControl(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
int edgeDist = config.NotificationEdgeDistance;
|
||||||
|
|
||||||
|
switch(config.NotificationPosition){
|
||||||
|
case TweetNotification.Position.TopLeft:
|
||||||
|
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+edgeDist);
|
||||||
|
|
||||||
|
case TweetNotification.Position.TopRight:
|
||||||
|
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
|
||||||
|
|
||||||
|
case TweetNotification.Position.BottomLeft:
|
||||||
|
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
||||||
|
|
||||||
|
case TweetNotification.Position.BottomRight:
|
||||||
|
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
|
||||||
|
|
||||||
|
case TweetNotification.Position.Custom:
|
||||||
|
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 Location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNotificationVisible => Location != ControlExtensions.InvisibleLocation;
|
||||||
|
|
||||||
|
public new Point Location{
|
||||||
|
get => base.Location;
|
||||||
|
|
||||||
|
set{
|
||||||
|
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||||
|
|
||||||
|
if (WindowsUtils.ShouldAvoidToolWindow){
|
||||||
|
FormBorderStyle = Visible ? FormBorderStyle.FixedSingle : FormBorderStyle.FixedToolWindow; // workaround for alt+tab
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<bool> CanMoveWindow = () => true;
|
||||||
|
protected override bool ShowWithoutActivation => true;
|
||||||
|
|
||||||
|
protected readonly Form owner;
|
||||||
|
protected readonly ChromiumWebBrowser browser;
|
||||||
|
|
||||||
|
private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
|
||||||
|
|
||||||
|
private string currentColumn;
|
||||||
|
private int pauseCounter;
|
||||||
|
|
||||||
|
public bool IsPaused => pauseCounter > 0;
|
||||||
|
|
||||||
|
public bool FreezeTimer { get; set; }
|
||||||
|
public bool ContextMenuOpen { get; set; }
|
||||||
|
public string CurrentTweetUrl { get; private set; }
|
||||||
|
public string CurrentQuoteUrl { get; private set; }
|
||||||
|
|
||||||
|
public event EventHandler Initialized;
|
||||||
|
|
||||||
|
public FormNotificationBase(Form owner, bool enableContextMenu){
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.owner = owner;
|
||||||
|
this.owner.FormClosed += owner_FormClosed;
|
||||||
|
|
||||||
|
this.browser = new ChromiumWebBrowser("about:blank"){
|
||||||
|
MenuHandler = new ContextMenuNotification(this, enableContextMenu),
|
||||||
|
LifeSpanHandler = new LifeSpanHandler()
|
||||||
|
};
|
||||||
|
|
||||||
|
this.browser.Dock = DockStyle.None;
|
||||||
|
this.browser.ClientSize = ClientSize;
|
||||||
|
this.browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory;
|
||||||
|
handlerFactory.RegisterHandler("https://tweetdeck.twitter.com", this.resourceHandler);
|
||||||
|
|
||||||
|
Controls.Add(browser);
|
||||||
|
|
||||||
|
Disposed += (sender, args) => {
|
||||||
|
this.browser.Dispose();
|
||||||
|
this.owner.FormClosed -= owner_FormClosed;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ReSharper disable once VirtualMemberCallInContructor
|
||||||
|
UpdateTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void WndProc(ref Message m){
|
||||||
|
if (m.Msg == 0x0112 && (m.WParam.ToInt32() & 0xFFF0) == 0xF010 && !CanMoveWindow()){ // WM_SYSCOMMAND, SC_MOVE
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.WndProc(ref m);
|
||||||
|
}
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
private void owner_FormClosed(object sender, FormClosedEventArgs e){
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
|
||||||
|
if (e.IsBrowserInitialized){
|
||||||
|
Initialized?.Invoke(this, new EventArgs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// notification methods
|
||||||
|
|
||||||
|
public virtual void HideNotification(bool loadBlank){
|
||||||
|
if (loadBlank){
|
||||||
|
browser.Load("about:blank");
|
||||||
|
}
|
||||||
|
|
||||||
|
Location = ControlExtensions.InvisibleLocation;
|
||||||
|
currentColumn = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void FinishCurrentNotification(){}
|
||||||
|
|
||||||
|
public virtual void PauseNotification(){
|
||||||
|
if (pauseCounter++ == 0 && IsNotificationVisible){
|
||||||
|
Location = ControlExtensions.InvisibleLocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void ResumeNotification(){
|
||||||
|
if (pauseCounter > 0){
|
||||||
|
--pauseCounter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string GetTweetHTML(TweetNotification tweet){
|
||||||
|
string bodyClasses = browser.Bounds.Contains(PointToClient(Cursor.Position)) ? "td-hover" : string.Empty;
|
||||||
|
return tweet.GenerateHtml(bodyClasses);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void LoadTweet(TweetNotification tweet){
|
||||||
|
CurrentTweetUrl = tweet.TweetUrl;
|
||||||
|
CurrentQuoteUrl = tweet.QuoteUrl;
|
||||||
|
currentColumn = tweet.Column;
|
||||||
|
|
||||||
|
resourceHandler.SetHTML(GetTweetHTML(tweet));
|
||||||
|
browser.Load("https://tweetdeck.twitter.com");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void SetNotificationSize(int width, int height){
|
||||||
|
browser.ClientSize = ClientSize = new Size((int)Math.Round(width*Program.UserConfig.ZoomMultiplier), (int)Math.Round(height*Program.UserConfig.ZoomMultiplier));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnNotificationReady(){
|
||||||
|
MoveToVisibleLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateTitle(){
|
||||||
|
Text = string.IsNullOrEmpty(currentColumn) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveToVisibleLocation(){
|
||||||
|
bool needsReactivating = Location == ControlExtensions.InvisibleLocation;
|
||||||
|
Location = PrimaryLocation;
|
||||||
|
|
||||||
|
if (needsReactivating){
|
||||||
|
NativeMethods.SetFormPos(this, NativeMethods.HWND_TOPMOST, NativeMethods.SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayTooltip(string text){
|
||||||
|
if (string.IsNullOrEmpty(text)){
|
||||||
|
toolTip.Hide(this);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Point position = PointToClient(Cursor.Position);
|
||||||
|
position.Offset(20, 5);
|
||||||
|
toolTip.Show(text, this, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,5 @@
|
|||||||
using TweetDck.Core.Controls;
|
namespace TweetDuck.Core.Notification {
|
||||||
|
partial class FormNotificationMain {
|
||||||
namespace TweetDck.Core {
|
|
||||||
partial class FormNotification {
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -26,23 +24,15 @@ namespace TweetDck.Core {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.panelBrowser = new System.Windows.Forms.Panel();
|
|
||||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
|
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
|
||||||
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.progressBarTimer = new TweetDuck.Core.Controls.FlatProgressBar();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// panelBrowser
|
// timerDisplayDelay
|
||||||
//
|
//
|
||||||
this.panelBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.timerDisplayDelay.Interval = 17;
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
this.timerDisplayDelay.Tick += new System.EventHandler(this.timerDisplayDelay_Tick);
|
||||||
this.panelBrowser.BackColor = System.Drawing.Color.White;
|
|
||||||
this.panelBrowser.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.panelBrowser.Margin = new System.Windows.Forms.Padding(0);
|
|
||||||
this.panelBrowser.Name = "panelBrowser";
|
|
||||||
this.panelBrowser.Size = new System.Drawing.Size(284, 118);
|
|
||||||
this.panelBrowser.TabIndex = 0;
|
|
||||||
//
|
//
|
||||||
// timerProgress
|
// timerProgress
|
||||||
//
|
//
|
||||||
@@ -62,11 +52,6 @@ namespace TweetDck.Core {
|
|||||||
this.progressBarTimer.Size = new System.Drawing.Size(284, 4);
|
this.progressBarTimer.Size = new System.Drawing.Size(284, 4);
|
||||||
this.progressBarTimer.TabIndex = 1;
|
this.progressBarTimer.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// timerDisplayDelay
|
|
||||||
//
|
|
||||||
this.timerDisplayDelay.Interval = 17;
|
|
||||||
this.timerDisplayDelay.Tick += new System.EventHandler(this.timerDisplayDelay_Tick);
|
|
||||||
//
|
|
||||||
// FormNotification
|
// FormNotification
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -74,15 +59,6 @@ namespace TweetDck.Core {
|
|||||||
this.BackColor = System.Drawing.SystemColors.Control;
|
this.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.ClientSize = new System.Drawing.Size(284, 122);
|
this.ClientSize = new System.Drawing.Size(284, 122);
|
||||||
this.Controls.Add(this.progressBarTimer);
|
this.Controls.Add(this.progressBarTimer);
|
||||||
this.Controls.Add(this.panelBrowser);
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
|
||||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
|
||||||
this.MaximizeBox = false;
|
|
||||||
this.MinimizeBox = false;
|
|
||||||
this.Name = "FormNotification";
|
|
||||||
this.ShowIcon = false;
|
|
||||||
this.ShowInTaskbar = false;
|
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormNotification_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormNotification_FormClosing);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@@ -90,10 +66,8 @@ namespace TweetDck.Core {
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Panel panelBrowser;
|
|
||||||
private Controls.FlatProgressBar progressBarTimer;
|
|
||||||
private System.Windows.Forms.Timer timerProgress;
|
|
||||||
private System.Windows.Forms.ToolTip toolTip;
|
|
||||||
private System.Windows.Forms.Timer timerDisplayDelay;
|
private System.Windows.Forms.Timer timerDisplayDelay;
|
||||||
|
protected System.Windows.Forms.Timer timerProgress;
|
||||||
|
private Controls.FlatProgressBar progressBarTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
282
Core/Notification/FormNotificationMain.cs
Normal file
282
Core/Notification/FormNotificationMain.cs
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
using CefSharp;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Bridge;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Plugins;
|
||||||
|
using TweetDuck.Plugins.Enums;
|
||||||
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification{
|
||||||
|
partial class FormNotificationMain : FormNotificationBase{
|
||||||
|
private const string NotificationScriptFile = "notification.js";
|
||||||
|
|
||||||
|
private static readonly string NotificationScriptIdentifier = ScriptLoader.GetRootIdentifier(NotificationScriptFile);
|
||||||
|
private static readonly string PluginScriptIdentifier = ScriptLoader.GetRootIdentifier(PluginManager.PluginNotificationScriptFile);
|
||||||
|
|
||||||
|
private static readonly string NotificationJS, PluginJS;
|
||||||
|
|
||||||
|
static FormNotificationMain(){
|
||||||
|
NotificationJS = ScriptLoader.LoadResource(NotificationScriptFile);
|
||||||
|
PluginJS = ScriptLoader.LoadResource(PluginManager.PluginNotificationScriptFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int BaseClientWidth{
|
||||||
|
get{
|
||||||
|
int level = TweetNotification.FontSizeLevel;
|
||||||
|
int width = level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level));
|
||||||
|
return (int)Math.Round(width*Program.UserConfig.ZoomMultiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int BaseClientHeight{
|
||||||
|
get{
|
||||||
|
int level = TweetNotification.FontSizeLevel;
|
||||||
|
int height = level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level));
|
||||||
|
return (int)Math.Round(height*Program.UserConfig.ZoomMultiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly PluginManager plugins;
|
||||||
|
|
||||||
|
protected int timeLeft, totalTime;
|
||||||
|
protected bool pausedDuringNotification;
|
||||||
|
|
||||||
|
private readonly NativeMethods.HookProc mouseHookDelegate;
|
||||||
|
private IntPtr mouseHook;
|
||||||
|
private bool blockXButtonUp;
|
||||||
|
|
||||||
|
private bool? prevDisplayTimer;
|
||||||
|
private int? prevFontSize;
|
||||||
|
|
||||||
|
private bool RequiresResize{
|
||||||
|
get{
|
||||||
|
return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Program.UserConfig.DisplayNotificationTimer || prevFontSize != TweetNotification.FontSizeLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
set{
|
||||||
|
if (value){
|
||||||
|
prevDisplayTimer = null;
|
||||||
|
prevFontSize = null;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
prevDisplayTimer = Program.UserConfig.DisplayNotificationTimer;
|
||||||
|
prevFontSize = TweetNotification.FontSizeLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.plugins = pluginManager;
|
||||||
|
|
||||||
|
browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(owner, this));
|
||||||
|
browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
|
||||||
|
|
||||||
|
browser.LoadingStateChanged += Browser_LoadingStateChanged;
|
||||||
|
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
||||||
|
|
||||||
|
mouseHookDelegate = MouseHookProc;
|
||||||
|
Disposed += (sender, args) => StopMouseHook(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// mouse wheel hook
|
||||||
|
|
||||||
|
private void StartMouseHook(){
|
||||||
|
if (mouseHook == IntPtr.Zero){
|
||||||
|
mouseHook = NativeMethods.SetWindowsHookEx(NativeMethods.WM_MOUSE_LL, mouseHookDelegate, IntPtr.Zero, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopMouseHook(bool force){
|
||||||
|
if (mouseHook != IntPtr.Zero && (force || !blockXButtonUp)){
|
||||||
|
NativeMethods.UnhookWindowsHookEx(mouseHook);
|
||||||
|
mouseHook = IntPtr.Zero;
|
||||||
|
blockXButtonUp = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
|
||||||
|
if (nCode == 0){
|
||||||
|
int eventType = wParam.ToInt32();
|
||||||
|
|
||||||
|
if (eventType == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position)) && !ContainsFocus && !owner.ContainsFocus){
|
||||||
|
browser.SendMouseWheelEvent(0, 0, 0, NativeMethods.GetMouseHookData(lParam), CefEventFlags.None);
|
||||||
|
return NativeMethods.HOOK_HANDLED;
|
||||||
|
}
|
||||||
|
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
|
||||||
|
int extraButton = NativeMethods.GetMouseHookData(lParam);
|
||||||
|
|
||||||
|
if (extraButton == 2){ // forward button
|
||||||
|
this.InvokeAsyncSafe(FinishCurrentNotification);
|
||||||
|
}
|
||||||
|
else if (extraButton == 1){ // back button
|
||||||
|
this.InvokeAsyncSafe(Close);
|
||||||
|
}
|
||||||
|
|
||||||
|
blockXButtonUp = true;
|
||||||
|
return NativeMethods.HOOK_HANDLED;
|
||||||
|
}
|
||||||
|
else if (eventType == NativeMethods.WM_XBUTTONUP && blockXButtonUp){
|
||||||
|
blockXButtonUp = false;
|
||||||
|
|
||||||
|
if (!Visible){
|
||||||
|
StopMouseHook(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NativeMethods.HOOK_HANDLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NativeMethods.CallNextHookEx(mouseHook, nCode, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
|
||||||
|
if (e.CloseReason == CloseReason.UserClosing){
|
||||||
|
HideNotification(true);
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||||
|
if (!e.IsLoading && browser.Address != "about:blank"){
|
||||||
|
this.InvokeSafe(() => {
|
||||||
|
Visible = true; // ensures repaint before moving the window to a visible location
|
||||||
|
timerDisplayDelay.Start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||||
|
if (e.Frame.IsMain && NotificationJS != null && browser.Address != "about:blank"){
|
||||||
|
e.Frame.ExecuteJavaScriptAsync(PropertyBridge.GenerateScript(PropertyBridge.Properties.AllNotification));
|
||||||
|
ScriptLoader.ExecuteScript(e.Frame, NotificationJS, NotificationScriptIdentifier);
|
||||||
|
|
||||||
|
if (plugins.HasAnyPlugin(PluginEnvironment.Notification)){
|
||||||
|
ScriptLoader.ExecuteScript(e.Frame, PluginJS, PluginScriptIdentifier);
|
||||||
|
ScriptLoader.ExecuteFile(e.Frame, PluginManager.PluginGlobalScriptFile);
|
||||||
|
plugins.ExecutePlugins(e.Frame, PluginEnvironment.Notification, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerDisplayDelay_Tick(object sender, EventArgs e){
|
||||||
|
OnNotificationReady();
|
||||||
|
timerDisplayDelay.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerHideProgress_Tick(object sender, EventArgs e){
|
||||||
|
if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen)return;
|
||||||
|
|
||||||
|
timeLeft -= timerProgress.Interval;
|
||||||
|
|
||||||
|
int value = (int)Math.Round(1025.0*(totalTime-timeLeft)/totalTime);
|
||||||
|
progressBarTimer.SetValueInstant(Math.Min(1000, Math.Max(0, Program.UserConfig.NotificationTimerCountDown ? 1000-value : value)));
|
||||||
|
|
||||||
|
if (timeLeft <= 0){
|
||||||
|
FinishCurrentNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// notification methods
|
||||||
|
|
||||||
|
public virtual void ShowNotification(TweetNotification notification){
|
||||||
|
LoadTweet(notification);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowNotificationForSettings(bool reset){
|
||||||
|
if (reset){
|
||||||
|
LoadTweet(TweetNotification.ExampleTweet);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
PrepareAndDisplayWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void HideNotification(bool loadBlank){
|
||||||
|
base.HideNotification(loadBlank);
|
||||||
|
|
||||||
|
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
||||||
|
timerProgress.Stop();
|
||||||
|
totalTime = 0;
|
||||||
|
|
||||||
|
StopMouseHook(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void FinishCurrentNotification(){
|
||||||
|
timerProgress.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PauseNotification(){
|
||||||
|
if (!IsPaused){
|
||||||
|
pausedDuringNotification = IsNotificationVisible;
|
||||||
|
timerProgress.Stop();
|
||||||
|
StopMouseHook(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.PauseNotification();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResumeNotification(){
|
||||||
|
bool wasPaused = IsPaused;
|
||||||
|
base.ResumeNotification();
|
||||||
|
|
||||||
|
if (wasPaused && !IsPaused && pausedDuringNotification){
|
||||||
|
OnNotificationReady();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GetTweetHTML(TweetNotification tweet){
|
||||||
|
string html = base.GetTweetHTML(tweet);
|
||||||
|
|
||||||
|
foreach(InjectedHTML injection in plugins.Bridge.NotificationInjections){
|
||||||
|
html = injection.Inject(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadTweet(TweetNotification tweet){
|
||||||
|
timerProgress.Stop();
|
||||||
|
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDurationValue);
|
||||||
|
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
||||||
|
|
||||||
|
base.LoadTweet(tweet);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void SetNotificationSize(int width, int height){
|
||||||
|
if (Program.UserConfig.DisplayNotificationTimer){
|
||||||
|
ClientSize = new Size(width, height+4);
|
||||||
|
progressBarTimer.Visible = true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ClientSize = new Size(width, height);
|
||||||
|
progressBarTimer.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.ClientSize = new Size(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrepareAndDisplayWindow(){
|
||||||
|
if (RequiresResize){
|
||||||
|
RequiresResize = false;
|
||||||
|
SetNotificationSize(BaseClientWidth, BaseClientHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveToVisibleLocation();
|
||||||
|
StartMouseHook();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNotificationReady(){
|
||||||
|
PrepareAndDisplayWindow();
|
||||||
|
timerProgress.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
Core/Notification/FormNotificationTweet.Designer.cs
generated
Normal file
53
Core/Notification/FormNotificationTweet.Designer.cs
generated
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
namespace TweetDuck.Core.Notification {
|
||||||
|
partial class FormNotificationTweet {
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
if (disposing && (components != null)) {
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent() {
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.timerCursorCheck = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.timerIdlePauseCheck = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// timerCursorCheck
|
||||||
|
//
|
||||||
|
this.timerCursorCheck.Interval = 200;
|
||||||
|
this.timerCursorCheck.Tick += new System.EventHandler(this.timerCursorCheck_Tick);
|
||||||
|
//
|
||||||
|
// timerIdlePauseCheck
|
||||||
|
//
|
||||||
|
this.timerIdlePauseCheck.Interval = 750;
|
||||||
|
this.timerIdlePauseCheck.Tick += new System.EventHandler(this.timerIdlePauseCheck_Tick);
|
||||||
|
//
|
||||||
|
// FormNotificationTweet
|
||||||
|
//
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormNotificationTweet_FormClosing);
|
||||||
|
this.ResumeLayout(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Timer timerCursorCheck;
|
||||||
|
private System.Windows.Forms.Timer timerIdlePauseCheck;
|
||||||
|
}
|
||||||
|
}
|
141
Core/Notification/FormNotificationTweet.cs
Normal file
141
Core/Notification/FormNotificationTweet.cs
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using TweetDuck.Plugins;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification{
|
||||||
|
sealed partial class FormNotificationTweet : FormNotificationMain{
|
||||||
|
private const int NonIntrusiveIdleLimit = 30;
|
||||||
|
private const int TrimMinimum = 32;
|
||||||
|
|
||||||
|
private bool IsCursorOverNotificationArea => new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
||||||
|
|
||||||
|
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
||||||
|
private bool needsTrim;
|
||||||
|
|
||||||
|
public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, true){
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Program.UserConfig.MuteToggled += Config_MuteToggled;
|
||||||
|
Disposed += (sender, args) => Program.UserConfig.MuteToggled -= Config_MuteToggled;
|
||||||
|
|
||||||
|
if (Program.UserConfig.MuteNotifications){
|
||||||
|
PauseNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormNotificationTweet_FormClosing(object sender, FormClosingEventArgs e){
|
||||||
|
if (e.CloseReason == CloseReason.UserClosing){
|
||||||
|
tweetQueue.Clear(); // already canceled
|
||||||
|
TrimQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TrimQueue(){
|
||||||
|
if (needsTrim){
|
||||||
|
tweetQueue.TrimExcess();
|
||||||
|
needsTrim = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
|
||||||
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
|
if (Program.UserConfig.MuteNotifications){
|
||||||
|
PauseNotification();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ResumeNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerCursorCheck_Tick(object sender, EventArgs e){
|
||||||
|
if (!IsCursorOverNotificationArea){
|
||||||
|
ResumeNotification();
|
||||||
|
timerCursorCheck.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerIdlePauseCheck_Tick(object sender, EventArgs e){
|
||||||
|
if (NativeMethods.GetIdleSeconds() < Program.UserConfig.NotificationIdlePauseSeconds){
|
||||||
|
ResumeNotification();
|
||||||
|
timerIdlePauseCheck.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// notification methods
|
||||||
|
|
||||||
|
public override void ShowNotification(TweetNotification notification){
|
||||||
|
if (IsPaused){
|
||||||
|
tweetQueue.Enqueue(notification);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
tweetQueue.Enqueue(notification);
|
||||||
|
UpdateTitle();
|
||||||
|
|
||||||
|
if (totalTime == 0){
|
||||||
|
LoadNextNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
needsTrim |= tweetQueue.Count >= TrimMinimum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void FinishCurrentNotification(){
|
||||||
|
if (tweetQueue.Count > 0){
|
||||||
|
LoadNextNotification();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
HideNotification(true);
|
||||||
|
TrimQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResumeNotification(){
|
||||||
|
bool wasPaused = IsPaused;
|
||||||
|
base.ResumeNotification();
|
||||||
|
|
||||||
|
if (wasPaused && !IsPaused && !pausedDuringNotification && tweetQueue.Count > 0){
|
||||||
|
LoadNextNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadNextNotification(){
|
||||||
|
if (!IsNotificationVisible){
|
||||||
|
if (Program.UserConfig.NotificationNonIntrusiveMode && IsCursorOverNotificationArea && NativeMethods.GetIdleSeconds() < NonIntrusiveIdleLimit){
|
||||||
|
if (!timerCursorCheck.Enabled){
|
||||||
|
PauseNotification();
|
||||||
|
timerCursorCheck.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (Program.UserConfig.NotificationIdlePauseSeconds > 0 && NativeMethods.GetIdleSeconds() >= Program.UserConfig.NotificationIdlePauseSeconds){
|
||||||
|
if (!timerIdlePauseCheck.Enabled){
|
||||||
|
PauseNotification();
|
||||||
|
timerIdlePauseCheck.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadTweet(tweetQueue.Dequeue());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateTitle(){
|
||||||
|
base.UpdateTitle();
|
||||||
|
|
||||||
|
if (tweetQueue.Count > 0){
|
||||||
|
Text = Text+" ("+tweetQueue.Count+" more left)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNotificationReady(){
|
||||||
|
UpdateTitle();
|
||||||
|
base.OnNotificationReady();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
|
||||||
[Flags]
|
|
||||||
public enum NotificationFlags{
|
|
||||||
None = 0,
|
|
||||||
AutoHide = 1,
|
|
||||||
DisableScripts = 2,
|
|
||||||
DisableContextMenu = 4,
|
|
||||||
TopMost = 8,
|
|
||||||
ManualDisplay = 16
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,43 +1,49 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Resources;
|
||||||
using TweetDck.Resources;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDuck.Core.Notification.Screenshot{
|
||||||
sealed class FormNotificationScreenshotable : FormNotification{
|
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||||
public FormNotificationScreenshotable(Action callback, FormBrowser owner, NotificationFlags flags) : base(owner, null, flags){
|
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
|
||||||
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
||||||
|
|
||||||
browser.FrameLoadEnd += (sender, args) => {
|
browser.FrameLoadEnd += (sender, args) => {
|
||||||
if (args.Frame.IsMain && browser.Address != "about:blank"){
|
if (args.Frame.IsMain && browser.Address != "about:blank"){
|
||||||
ScriptLoader.ExecuteScript(args.Frame, "window.setTimeout($TD_NotificationScreenshot.trigger, 25)", "gen:screenshot");
|
ScriptLoader.ExecuteScript(args.Frame, "window.setTimeout($TD_NotificationScreenshot.trigger, 67)", "gen:screenshot");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
UpdateTitle();
|
protected override string GetTweetHTML(TweetNotification tweet){
|
||||||
|
return tweet.GenerateHtml(enableCustomCSS: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){
|
public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){
|
||||||
browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
LoadTweet(tweet);
|
||||||
|
SetNotificationSize(width, height);
|
||||||
Location = ControlExtensions.InvisibleLocation;
|
|
||||||
FormBorderStyle = Program.UserConfig.ShowScreenshotBorder ? FormBorderStyle.FixedToolWindow : FormBorderStyle.None;
|
|
||||||
|
|
||||||
SetNotificationSize(width, height, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeScreenshotAndHide(){
|
public void TakeScreenshot(){
|
||||||
MoveToVisibleLocation();
|
IntPtr context = NativeMethods.GetDC(this.Handle);
|
||||||
Activate();
|
|
||||||
SendKeys.SendWait("%{PRTSC}");
|
if (context == IntPtr.Zero){
|
||||||
Reset();
|
MessageBox.Show("Could not retrieve a graphics context handle for the notification window to take the screenshot.", "Screenshot Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
using(Bitmap bmp = new Bitmap(ClientSize.Width, ClientSize.Height, PixelFormat.Format32bppRgb)){
|
||||||
|
try{
|
||||||
|
NativeMethods.RenderSourceIntoBitmap(context, bmp);
|
||||||
|
}finally{
|
||||||
|
NativeMethods.ReleaseDC(this.Handle, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset(){
|
Clipboard.SetImage(bmp);
|
||||||
Location = ControlExtensions.InvisibleLocation;
|
}
|
||||||
browser.LoadHtml("", "about:blank");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,50 @@
|
|||||||
using System;
|
// Uncomment to keep screenshot windows visible for debugging
|
||||||
|
// #define NO_HIDE_SCREENSHOTS
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDuck.Core.Notification.Screenshot{
|
||||||
sealed class TweetScreenshotManager : IDisposable{
|
sealed class TweetScreenshotManager : IDisposable{
|
||||||
private readonly FormBrowser browser;
|
private readonly Form owner;
|
||||||
private readonly FormNotificationScreenshotable screenshot;
|
|
||||||
private readonly Timer timeout;
|
private readonly Timer timeout;
|
||||||
|
private readonly Timer disposer;
|
||||||
|
|
||||||
public TweetScreenshotManager(FormBrowser browser){
|
private FormNotificationScreenshotable screenshot;
|
||||||
this.browser = browser;
|
|
||||||
|
|
||||||
this.screenshot = new FormNotificationScreenshotable(Callback, browser, NotificationFlags.DisableScripts | NotificationFlags.DisableContextMenu | NotificationFlags.TopMost | NotificationFlags.ManualDisplay){
|
public TweetScreenshotManager(Form owner){
|
||||||
CanMoveWindow = () => false
|
this.owner = owner;
|
||||||
};
|
|
||||||
|
|
||||||
this.timeout = WindowsUtils.CreateSingleTickTimer(10000);
|
this.timeout = new Timer{ Interval = 8000 };
|
||||||
this.timeout.Tick += (sender, args) => screenshot.Reset();
|
this.timeout.Tick += timeout_Tick;
|
||||||
|
|
||||||
|
this.disposer = new Timer{ Interval = 1 };
|
||||||
|
this.disposer.Tick += disposer_Tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timeout_Tick(object sender, EventArgs e){
|
||||||
|
timeout.Stop();
|
||||||
|
screenshot.Location = ControlExtensions.InvisibleLocation;
|
||||||
|
disposer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void disposer_Tick(object sender, EventArgs e){
|
||||||
|
disposer.Stop();
|
||||||
|
screenshot.Dispose();
|
||||||
|
screenshot = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Trigger(string html, int width, int height){
|
public void Trigger(string html, int width, int height){
|
||||||
screenshot.LoadNotificationForScreenshot(new TweetNotification(html, string.Empty, 0), width, height);
|
if (screenshot != null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
screenshot = new FormNotificationScreenshotable(Callback, owner){
|
||||||
|
CanMoveWindow = () => false
|
||||||
|
};
|
||||||
|
|
||||||
|
screenshot.LoadNotificationForScreenshot(new TweetNotification(string.Empty, html, 0, string.Empty, string.Empty), width, height);
|
||||||
screenshot.Show();
|
screenshot.Show();
|
||||||
timeout.Start();
|
timeout.Start();
|
||||||
}
|
}
|
||||||
@@ -31,15 +55,21 @@ namespace TweetDck.Core.Notification.Screenshot{
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeout.Stop();
|
timeout.Stop();
|
||||||
|
screenshot.TakeScreenshot();
|
||||||
|
|
||||||
browser.PauseNotification();
|
#if !(DEBUG && NO_HIDE_SCREENSHOTS)
|
||||||
screenshot.TakeScreenshotAndHide();
|
screenshot.Location = ControlExtensions.InvisibleLocation;
|
||||||
browser.ResumeNotification();
|
disposer.Start();
|
||||||
|
#else
|
||||||
|
screenshot.MoveToVisibleLocation();
|
||||||
|
screenshot.FormClosed += (sender, args) => disposer.Start();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose(){
|
public void Dispose(){
|
||||||
timeout.Dispose();
|
timeout.Dispose();
|
||||||
screenshot.Dispose();
|
disposer.Dispose();
|
||||||
|
screenshot?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
Core/Notification/Sound/ISoundNotificationPlayer.cs
Normal file
12
Core/Notification/Sound/ISoundNotificationPlayer.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
|
interface ISoundNotificationPlayer : IDisposable{
|
||||||
|
string SupportedFormats { get; }
|
||||||
|
|
||||||
|
event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
|
void Play(string file);
|
||||||
|
void Stop();
|
||||||
|
}
|
||||||
|
}
|
13
Core/Notification/Sound/PlaybackErrorEventArgs.cs
Normal file
13
Core/Notification/Sound/PlaybackErrorEventArgs.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
|
sealed class PlaybackErrorEventArgs : EventArgs{
|
||||||
|
public string Message { get; }
|
||||||
|
public bool Ignore { get; set; }
|
||||||
|
|
||||||
|
public PlaybackErrorEventArgs(string message){
|
||||||
|
this.Message = message;
|
||||||
|
this.Ignore = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
Core/Notification/Sound/SoundPlayerImplFallback.cs
Normal file
53
Core/Notification/Sound/SoundPlayerImplFallback.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Media;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
|
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
||||||
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav";
|
||||||
|
|
||||||
|
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
|
private readonly SoundPlayer player;
|
||||||
|
private bool ignorePlaybackError;
|
||||||
|
|
||||||
|
public SoundPlayerImplFallback(){
|
||||||
|
player = new SoundPlayer{
|
||||||
|
LoadTimeout = 5000
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISoundNotificationPlayer.Play(string file){
|
||||||
|
if (player.SoundLocation != file){
|
||||||
|
player.SoundLocation = file;
|
||||||
|
ignorePlaybackError = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
player.Play();
|
||||||
|
}catch(FileNotFoundException e){
|
||||||
|
OnNotificationSoundError("File not found: "+e.FileName);
|
||||||
|
}catch(InvalidOperationException){
|
||||||
|
OnNotificationSoundError("File format was not recognized.");
|
||||||
|
}catch(TimeoutException){
|
||||||
|
OnNotificationSoundError("File took too long to load.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISoundNotificationPlayer.Stop(){
|
||||||
|
player.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDisposable.Dispose(){
|
||||||
|
player.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNotificationSoundError(string message){
|
||||||
|
if (!ignorePlaybackError && PlaybackError != null){
|
||||||
|
PlaybackErrorEventArgs args = new PlaybackErrorEventArgs(message);
|
||||||
|
PlaybackError(this, args);
|
||||||
|
ignorePlaybackError = args.Ignore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
113
Core/Notification/Sound/SoundPlayerImplWMP.cs
Normal file
113
Core/Notification/Sound/SoundPlayerImplWMP.cs
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
using WMPLib;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
|
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
||||||
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
||||||
|
|
||||||
|
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
|
private readonly WindowsMediaPlayer player;
|
||||||
|
private bool wasTryingToPlay;
|
||||||
|
private bool ignorePlaybackError;
|
||||||
|
|
||||||
|
// changing the player volume also affects the value in the Windows mixer
|
||||||
|
// however, the initial value is always 50 or some other stupid shit
|
||||||
|
// so we have to tell the player to set its volume to whatever the mixer is set to
|
||||||
|
// using the most code required for the least functionality with a sorry excuse for an API
|
||||||
|
// thanks, Microsoft
|
||||||
|
|
||||||
|
public SoundPlayerImplWMP(){
|
||||||
|
player = new WindowsMediaPlayer();
|
||||||
|
player.settings.autoStart = false;
|
||||||
|
player.settings.enableErrorDialogs = false;
|
||||||
|
player.settings.invokeURLs = false;
|
||||||
|
player.settings.volume = (int)Math.Floor(100.0*NativeCoreAudio.GetMixerVolumeForCurrentProcess());
|
||||||
|
player.MediaChange += player_MediaChange;
|
||||||
|
player.MediaError += player_MediaError;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISoundNotificationPlayer.Play(string file){
|
||||||
|
wasTryingToPlay = true;
|
||||||
|
|
||||||
|
try{
|
||||||
|
if (player.URL != file){
|
||||||
|
player.close();
|
||||||
|
player.URL = file;
|
||||||
|
ignorePlaybackError = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
player.controls.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
player.controls.play();
|
||||||
|
}catch(Exception e){
|
||||||
|
OnNotificationSoundError("An error occurred in Windows Media Player: "+e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISoundNotificationPlayer.Stop(){
|
||||||
|
try{
|
||||||
|
player.controls.stop();
|
||||||
|
}catch{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IDisposable.Dispose(){
|
||||||
|
player.close();
|
||||||
|
Marshal.ReleaseComObject(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void player_MediaChange(object item){
|
||||||
|
IWMPMedia2 media = item as IWMPMedia2;
|
||||||
|
|
||||||
|
if (media == null){
|
||||||
|
OnNotificationSoundError("Unknown error.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
||||||
|
else if (media.Error == null && media.duration == 0.0){
|
||||||
|
OnNotificationSoundError("File does not contain an audio track.");
|
||||||
|
}
|
||||||
|
else if (media.Error != null){
|
||||||
|
OnNotificationSoundError(media.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Marshal.ReleaseComObject(media);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void player_MediaError(object pMediaObject){
|
||||||
|
IWMPMedia2 media = pMediaObject as IWMPMedia2;
|
||||||
|
|
||||||
|
if (media == null){
|
||||||
|
OnNotificationSoundError("Unknown error.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (media.Error != null){
|
||||||
|
OnNotificationSoundError(media.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Marshal.ReleaseComObject(media);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNotificationSoundError(IWMPErrorItem error){
|
||||||
|
OnNotificationSoundError(error.errorCode == -1072885353 ? "Invalid media file." : error.errorDescription);
|
||||||
|
Marshal.ReleaseComObject(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNotificationSoundError(string message){
|
||||||
|
if (wasTryingToPlay){
|
||||||
|
wasTryingToPlay = false;
|
||||||
|
|
||||||
|
if (!ignorePlaybackError && PlaybackError != null){
|
||||||
|
PlaybackErrorEventArgs args = new PlaybackErrorEventArgs(message);
|
||||||
|
PlaybackError(this, args);
|
||||||
|
ignorePlaybackError = args.Ignore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,65 +1,27 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.Drawing;
|
using TweetDuck.Core.Notification.Sound;
|
||||||
using System.IO;
|
|
||||||
using System.Media;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using TweetDck.Core.Other;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
class SoundNotification : IDisposable{
|
static class SoundNotification{
|
||||||
private readonly FormBrowser browserForm;
|
private static bool? IsWMPAvailable;
|
||||||
|
|
||||||
private SoundPlayer notificationSound;
|
public static ISoundNotificationPlayer New(){
|
||||||
private bool ignoreNotificationSoundError;
|
if (IsWMPAvailable.HasValue){
|
||||||
|
if (IsWMPAvailable.Value){
|
||||||
public SoundNotification(FormBrowser browserForm){
|
return new SoundPlayerImplWMP();
|
||||||
this.browserForm = browserForm;
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
public void Play(string file){
|
return new SoundPlayerImplFallback();
|
||||||
if (notificationSound == null){
|
|
||||||
notificationSound = new SoundPlayer{
|
|
||||||
LoadTimeout = 5000
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notificationSound.SoundLocation != file){
|
|
||||||
notificationSound.SoundLocation = file;
|
|
||||||
ignoreNotificationSoundError = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
notificationSound.Play();
|
SoundPlayerImplWMP implWMP = new SoundPlayerImplWMP();
|
||||||
}catch(FileNotFoundException e){
|
IsWMPAvailable = true;
|
||||||
OnNotificationSoundError("File not found: "+e.FileName);
|
return implWMP;
|
||||||
}catch(InvalidOperationException){
|
}catch(COMException){
|
||||||
OnNotificationSoundError("File is not a valid sound file.");
|
IsWMPAvailable = false;
|
||||||
}catch(TimeoutException){
|
return new SoundPlayerImplFallback();
|
||||||
OnNotificationSoundError("File took too long to load.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnNotificationSoundError(string message){
|
|
||||||
if (!ignoreNotificationSoundError){
|
|
||||||
ignoreNotificationSoundError = true;
|
|
||||||
|
|
||||||
using(FormMessage form = new FormMessage("Notification Sound Error", "Could not play custom notification sound."+Environment.NewLine+message, MessageBoxIcon.Error)){
|
|
||||||
form.AddButton("Ignore");
|
|
||||||
|
|
||||||
Button btnOpenSettings = form.AddButton("Open Settings");
|
|
||||||
btnOpenSettings.Width += 16;
|
|
||||||
btnOpenSettings.Location = new Point(btnOpenSettings.Location.X-16, btnOpenSettings.Location.Y);
|
|
||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnOpenSettings){
|
|
||||||
browserForm.OpenSettings(FormSettings.TabIndexNotification);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose(){
|
|
||||||
if (notificationSound != null){
|
|
||||||
notificationSound.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
sealed class TweetNotification{
|
sealed class TweetNotification{
|
||||||
private static string FontSizeClass { get; set; }
|
private static string FontSizeClass { get; set; }
|
||||||
private static string HeadTag { get; set; }
|
private static string HeadTag { get; set; }
|
||||||
|
|
||||||
private const string DefaultFontSizeClass = "medium";
|
private const string DefaultFontSizeClass = "medium";
|
||||||
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'>";
|
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'><style type='text/css'>body{background:#222426}</style>";
|
||||||
|
private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
|
||||||
private const string FixedCSS = @"a[data-full-url]{word-break:break-all}.txt-base-smallest .badge-verified:before{height:13px!important}";
|
|
||||||
private const string CustomCSS = @".scroll-styled-v::-webkit-scrollbar{width:8px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
|
|
||||||
|
|
||||||
public static int FontSizeLevel{
|
public static int FontSizeLevel{
|
||||||
get{
|
get{
|
||||||
@@ -24,26 +23,19 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string ExampleTweetHTML;
|
||||||
|
|
||||||
public static TweetNotification ExampleTweet{
|
public static TweetNotification ExampleTweet{
|
||||||
get{
|
get{
|
||||||
StringBuilder build = new StringBuilder();
|
if (ExampleTweetHTML == null){
|
||||||
build.Append(@"<article><div class='js-stream-item-content item-box js-show-detail'><div class='js-tweet tweet'>");
|
ExampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true);
|
||||||
build.Append(@"<header class='tweet-header'>");
|
|
||||||
build.Append(@"<time class='tweet-timestamp js-timestamp pull-right txt-mute'><a target='_blank' rel='url' href='https://twitter.com/chylexmc' class='txt-small'>0s</a></time>");
|
|
||||||
build.Append(@"<a target='_blank' rel='user' href='https://twitter.com/chylexmc' class='account-link link-complex block'>");
|
|
||||||
build.Append(@"<div class='obj-left item-img tweet-img'><img width='48' height='48' alt='chylexmc's avatar' src='https://pbs.twimg.com/profile_images/765161905312980992/AhDP9iY-_normal.jpg' class='tweet-avatar avatar pull-right'></div>");
|
|
||||||
build.Append(@"<div class='nbfc'><span class='account-inline txt-ellipsis'><b class='fullname link-complex-target'>chylex</b> <span class='username txt-mute'>@chylexmc</span></span></div>");
|
|
||||||
build.Append(@"</a>");
|
|
||||||
build.Append(@"</header>");
|
|
||||||
build.Append(@"<div class='tweet-body'><p class='js-tweet-text tweet-text with-linebreaks'>This is an example tweet, which lets you test the location and duration of popup notifications.</p></div>");
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
build.Append(@"<div style='margin-top:64px'>Scrollbar test padding...</div>");
|
ExampleTweetHTML = ExampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:64px'>Scrollbar test padding...</div>");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
build.Append(@"</div></div></article>");
|
return new TweetNotification("Home", ExampleTweetHTML, 95, string.Empty, string.Empty, true);
|
||||||
|
|
||||||
return new TweetNotification(build.ToString(), "", 95, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,22 +51,22 @@ namespace TweetDck.Core.Notification{
|
|||||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Url{
|
public string Column { get; }
|
||||||
get{
|
public string TweetUrl { get; }
|
||||||
return url;
|
public string QuoteUrl { get; }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly string html;
|
private readonly string html;
|
||||||
private readonly string url;
|
|
||||||
private readonly int characters;
|
private readonly int characters;
|
||||||
private readonly bool isExample;
|
private readonly bool isExample;
|
||||||
|
|
||||||
public TweetNotification(string html, string url, int characters) : this(html, url, characters, false){}
|
public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
|
||||||
|
|
||||||
|
private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
||||||
|
this.Column = column;
|
||||||
|
this.TweetUrl = tweetUrl;
|
||||||
|
this.QuoteUrl = quoteUrl;
|
||||||
|
|
||||||
private TweetNotification(string html, string url, int characters, bool isExample){
|
|
||||||
this.html = html;
|
this.html = html;
|
||||||
this.url = url;
|
|
||||||
this.characters = characters;
|
this.characters = characters;
|
||||||
this.isExample = isExample;
|
this.isExample = isExample;
|
||||||
}
|
}
|
||||||
@@ -90,26 +82,23 @@ namespace TweetDck.Core.Notification{
|
|||||||
build.Append("<head>").Append(HeadTag ?? DefaultHeadTag);
|
build.Append("<head>").Append(HeadTag ?? DefaultHeadTag);
|
||||||
|
|
||||||
if (enableCustomCSS){
|
if (enableCustomCSS){
|
||||||
build.Append("<style type='text/css'>").Append(FixedCSS).Append(CustomCSS).Append("</style>");
|
build.Append("<style type='text/css'>").Append(CustomCSS).Append("</style>");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Program.UserConfig.CustomNotificationCSS)){
|
if (!string.IsNullOrEmpty(Program.UserConfig.CustomNotificationCSS)){
|
||||||
build.Append("<style type='text/css'>").Append(Program.UserConfig.CustomNotificationCSS).Append("</style>");
|
build.Append("<style type='text/css'>").Append(Program.UserConfig.CustomNotificationCSS).Append("</style>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
build.Append("<style type='text/css'>").Append(FixedCSS).Append("</style>");
|
|
||||||
}
|
|
||||||
|
|
||||||
build.Append("</head>");
|
build.Append("</head>");
|
||||||
build.Append("<body class='hearty");
|
build.Append("<body class='scroll-styled-v");
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(bodyClasses)){
|
if (!string.IsNullOrEmpty(bodyClasses)){
|
||||||
build.Append(' ').Append(bodyClasses);
|
build.Append(' ').Append(bodyClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
build.Append('\'').Append(isExample ? " td-example-notification" : "").Append("><div class='app-columns-container'><div class='column scroll-styled-v' style='width:100%;overflow-y:auto'>");
|
build.Append('\'').Append(isExample ? " td-example-notification" : "").Append("><div class='column' style='width:100%;height:auto;overflow:initial;'>");
|
||||||
build.Append(html);
|
build.Append(html);
|
||||||
build.Append("</div></div></body>");
|
build.Append("</div></body>");
|
||||||
build.Append("</html>");
|
build.Append("</html>");
|
||||||
return build.ToString();
|
return build.ToString();
|
||||||
}
|
}
|
||||||
|
17
Core/Other/FormAbout.Designer.cs
generated
17
Core/Other/FormAbout.Designer.cs
generated
@@ -1,6 +1,4 @@
|
|||||||
using TweetDck.Core.Controls;
|
namespace TweetDuck.Core.Other {
|
||||||
|
|
||||||
namespace TweetDck.Core.Other {
|
|
||||||
sealed partial class FormAbout {
|
sealed partial class FormAbout {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -57,7 +55,7 @@ namespace TweetDck.Core.Other {
|
|||||||
this.labelDescription.Location = new System.Drawing.Point(114, 12);
|
this.labelDescription.Location = new System.Drawing.Point(114, 12);
|
||||||
this.labelDescription.Name = "labelDescription";
|
this.labelDescription.Name = "labelDescription";
|
||||||
this.labelDescription.Size = new System.Drawing.Size(232, 109);
|
this.labelDescription.Size = new System.Drawing.Size(232, 109);
|
||||||
this.labelDescription.TabIndex = 1;
|
this.labelDescription.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// labelTips
|
// labelTips
|
||||||
//
|
//
|
||||||
@@ -68,7 +66,8 @@ namespace TweetDck.Core.Other {
|
|||||||
this.labelTips.Margin = new System.Windows.Forms.Padding(0);
|
this.labelTips.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.labelTips.Name = "labelTips";
|
this.labelTips.Name = "labelTips";
|
||||||
this.labelTips.Size = new System.Drawing.Size(99, 16);
|
this.labelTips.Size = new System.Drawing.Size(99, 16);
|
||||||
this.labelTips.TabIndex = 3;
|
this.labelTips.TabIndex = 1;
|
||||||
|
this.labelTips.TabStop = true;
|
||||||
this.labelTips.Text = "Tips && Tricks";
|
this.labelTips.Text = "Tips && Tricks";
|
||||||
this.labelTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
this.labelTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
this.labelTips.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
|
this.labelTips.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
|
||||||
@@ -83,7 +82,8 @@ namespace TweetDck.Core.Other {
|
|||||||
this.labelWebsite.Margin = new System.Windows.Forms.Padding(0);
|
this.labelWebsite.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.labelWebsite.Name = "labelWebsite";
|
this.labelWebsite.Name = "labelWebsite";
|
||||||
this.labelWebsite.Size = new System.Drawing.Size(117, 16);
|
this.labelWebsite.Size = new System.Drawing.Size(117, 16);
|
||||||
this.labelWebsite.TabIndex = 2;
|
this.labelWebsite.TabIndex = 0;
|
||||||
|
this.labelWebsite.TabStop = true;
|
||||||
this.labelWebsite.Text = "Official Website";
|
this.labelWebsite.Text = "Official Website";
|
||||||
this.labelWebsite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.labelWebsite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
this.labelWebsite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
|
this.labelWebsite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
|
||||||
@@ -104,7 +104,7 @@ namespace TweetDck.Core.Other {
|
|||||||
this.tablePanelLinks.RowCount = 1;
|
this.tablePanelLinks.RowCount = 1;
|
||||||
this.tablePanelLinks.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
this.tablePanelLinks.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tablePanelLinks.Size = new System.Drawing.Size(334, 16);
|
this.tablePanelLinks.Size = new System.Drawing.Size(334, 16);
|
||||||
this.tablePanelLinks.TabIndex = 4;
|
this.tablePanelLinks.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// labelIssues
|
// labelIssues
|
||||||
//
|
//
|
||||||
@@ -115,7 +115,8 @@ namespace TweetDck.Core.Other {
|
|||||||
this.labelIssues.Margin = new System.Windows.Forms.Padding(0);
|
this.labelIssues.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.labelIssues.Name = "labelIssues";
|
this.labelIssues.Name = "labelIssues";
|
||||||
this.labelIssues.Size = new System.Drawing.Size(118, 16);
|
this.labelIssues.Size = new System.Drawing.Size(118, 16);
|
||||||
this.labelIssues.TabIndex = 4;
|
this.labelIssues.TabIndex = 2;
|
||||||
|
this.labelIssues.TabStop = true;
|
||||||
this.labelIssues.Text = "Report an Issue";
|
this.labelIssues.Text = "Report an Issue";
|
||||||
this.labelIssues.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.labelIssues.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
this.labelIssues.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
|
this.labelIssues.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLinkClicked);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormAbout : Form{
|
sealed partial class FormAbout : Form{
|
||||||
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
||||||
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
||||||
@@ -19,7 +19,7 @@ namespace TweetDck.Core.Other{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnLinkClicked(object sender, LinkLabelLinkClickedEventArgs e){
|
private void OnLinkClicked(object sender, LinkLabelLinkClickedEventArgs e){
|
||||||
BrowserUtils.OpenExternalBrowser(e.Link.LinkData as string);
|
BrowserUtils.OpenExternalBrowserUnsafe(e.Link.LinkData as string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
Core/Other/FormMessage.Designer.cs
generated
5
Core/Other/FormMessage.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
partial class FormMessage {
|
partial class FormMessage {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
this.panelActions.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.panelActions.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.panelActions.Location = new System.Drawing.Point(0, 84);
|
this.panelActions.Location = new System.Drawing.Point(0, 84);
|
||||||
this.panelActions.Name = "panelActions";
|
this.panelActions.Name = "panelActions";
|
||||||
this.panelActions.Size = new System.Drawing.Size(233, 49);
|
this.panelActions.Size = new System.Drawing.Size(98, 49);
|
||||||
this.panelActions.TabIndex = 0;
|
this.panelActions.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// labelMessage
|
// labelMessage
|
||||||
@@ -66,6 +66,7 @@
|
|||||||
this.Name = "FormMessage";
|
this.Name = "FormMessage";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.SizeChanged += new System.EventHandler(this.FormMessage_SizeChanged);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
@@ -2,10 +2,17 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormMessage : Form{
|
sealed partial class FormMessage : Form{
|
||||||
public Button ClickedButton { get; private set; }
|
public Button ClickedButton { get; private set; }
|
||||||
|
|
||||||
|
public int ActionPanelY => panelActions.Location.Y;
|
||||||
|
|
||||||
|
private int ClientWidth{
|
||||||
|
get => ClientSize.Width;
|
||||||
|
set => ClientSize = new Size(value, ClientSize.Height);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Icon icon;
|
private readonly Icon icon;
|
||||||
private readonly bool isReady;
|
private readonly bool isReady;
|
||||||
|
|
||||||
@@ -19,7 +26,7 @@ namespace TweetDck.Core.Other{
|
|||||||
|
|
||||||
this.prevLabelWidth = labelMessage.Width;
|
this.prevLabelWidth = labelMessage.Width;
|
||||||
this.prevLabelHeight = labelMessage.Height;
|
this.prevLabelHeight = labelMessage.Height;
|
||||||
this.minFormWidth = 18;
|
this.minFormWidth = 40;
|
||||||
|
|
||||||
switch(messageIcon){
|
switch(messageIcon){
|
||||||
case MessageBoxIcon.Information:
|
case MessageBoxIcon.Information:
|
||||||
@@ -40,7 +47,7 @@ namespace TweetDck.Core.Other{
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
icon = null;
|
icon = null;
|
||||||
labelMessage.Location = new Point(labelMessage.Location.X-37, labelMessage.Location.Y);
|
labelMessage.Location = new Point(labelMessage.Location.X-38, labelMessage.Location.Y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,11 +57,15 @@ namespace TweetDck.Core.Other{
|
|||||||
this.labelMessage.Text = text;
|
this.labelMessage.Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button AddButton(string title){
|
private void FormMessage_SizeChanged(object sender, EventArgs e){
|
||||||
|
RecalculateButtonLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button AddButton(string title, DialogResult result = DialogResult.OK){
|
||||||
Button button = new Button{
|
Button button = new Button{
|
||||||
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
|
Anchor = AnchorStyles.Bottom,
|
||||||
Font = SystemFonts.MessageBoxFont,
|
Font = SystemFonts.MessageBoxFont,
|
||||||
Location = new Point(Width-112-buttonCount*96, 12),
|
Location = new Point(0, 12),
|
||||||
Size = new Size(88, 26),
|
Size = new Size(88, 26),
|
||||||
TabIndex = buttonCount,
|
TabIndex = buttonCount,
|
||||||
Text = title,
|
Text = title,
|
||||||
@@ -63,16 +74,17 @@ namespace TweetDck.Core.Other{
|
|||||||
|
|
||||||
button.Click += (sender, args) => {
|
button.Click += (sender, args) => {
|
||||||
ClickedButton = (Button)sender;
|
ClickedButton = (Button)sender;
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = result;
|
||||||
Close();
|
Close();
|
||||||
};
|
};
|
||||||
|
|
||||||
panelActions.Controls.Add(button);
|
panelActions.Controls.Add(button);
|
||||||
|
++buttonCount;
|
||||||
|
|
||||||
minFormWidth += 96;
|
minFormWidth += 96;
|
||||||
Width = Math.Max(realFormWidth, minFormWidth);
|
ClientWidth = Math.Max(realFormWidth, minFormWidth);
|
||||||
|
RecalculateButtonLocation();
|
||||||
|
|
||||||
++buttonCount;
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +92,14 @@ namespace TweetDck.Core.Other{
|
|||||||
panelActions.Controls.Add(control);
|
panelActions.Controls.Add(control);
|
||||||
|
|
||||||
minFormWidth += control.Width+control.Margin.Horizontal;
|
minFormWidth += control.Width+control.Margin.Horizontal;
|
||||||
Width = Math.Max(realFormWidth, minFormWidth);
|
ClientWidth = Math.Max(realFormWidth, minFormWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RecalculateButtonLocation(){
|
||||||
|
for(int index = 0; index < buttonCount; index++){
|
||||||
|
Control control = panelActions.Controls[index];
|
||||||
|
control.Location = new Point(ClientWidth-97-index*96, control.Location.Y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void labelMessage_SizeChanged(object sender, EventArgs e){
|
private void labelMessage_SizeChanged(object sender, EventArgs e){
|
||||||
@@ -99,8 +118,8 @@ namespace TweetDck.Core.Other{
|
|||||||
prevLabelHeight -= 8;
|
prevLabelHeight -= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
realFormWidth = Width-(icon == null ? 32+35+(labelMessage.Margin.Left-labelMessage.Margin.Right) : 0)+labelMessage.Margin.Right+labelMessage.Width-prevLabelWidth;
|
realFormWidth = ClientWidth-(icon == null ? 50 : 0)+labelMessage.Width-prevLabelWidth;
|
||||||
Width = Math.Max(realFormWidth, minFormWidth);
|
ClientWidth = Math.Max(realFormWidth, minFormWidth);
|
||||||
Height += labelMessage.Height-prevLabelHeight;
|
Height += labelMessage.Height-prevLabelHeight;
|
||||||
|
|
||||||
prevLabelWidth = labelMessage.Width;
|
prevLabelWidth = labelMessage.Width;
|
||||||
|
10
Core/Other/FormPlugins.Designer.cs
generated
10
Core/Other/FormPlugins.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
partial class FormPlugins {
|
partial class FormPlugins {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.btnReload = new System.Windows.Forms.Button();
|
this.btnReload = new System.Windows.Forms.Button();
|
||||||
this.btnOpenFolder = new System.Windows.Forms.Button();
|
this.btnOpenFolder = new System.Windows.Forms.Button();
|
||||||
this.tabPanelPlugins = new TweetDck.Core.Controls.TabPanel();
|
this.tabPanelPlugins = new TweetDuck.Core.Controls.TabPanel();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
this.tabPanelPlugins.Location = new System.Drawing.Point(12, 12);
|
this.tabPanelPlugins.Location = new System.Drawing.Point(12, 12);
|
||||||
this.tabPanelPlugins.Name = "tabPanelPlugins";
|
this.tabPanelPlugins.Name = "tabPanelPlugins";
|
||||||
this.tabPanelPlugins.Size = new System.Drawing.Size(680, 421);
|
this.tabPanelPlugins.Size = new System.Drawing.Size(680, 421);
|
||||||
this.tabPanelPlugins.TabIndex = 4;
|
this.tabPanelPlugins.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// FormPlugins
|
// FormPlugins
|
||||||
//
|
//
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
this.Controls.Add(this.btnOpenFolder);
|
this.Controls.Add(this.btnOpenFolder);
|
||||||
this.Controls.Add(this.btnReload);
|
this.Controls.Add(this.btnReload);
|
||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||||
this.MinimumSize = new System.Drawing.Size(480, 320);
|
this.MinimumSize = new System.Drawing.Size(480, 320);
|
||||||
this.Name = "FormPlugins";
|
this.Name = "FormPlugins";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
@@ -101,6 +101,6 @@
|
|||||||
private System.Windows.Forms.Button btnClose;
|
private System.Windows.Forms.Button btnClose;
|
||||||
private System.Windows.Forms.Button btnReload;
|
private System.Windows.Forms.Button btnReload;
|
||||||
private System.Windows.Forms.Button btnOpenFolder;
|
private System.Windows.Forms.Button btnOpenFolder;
|
||||||
private TweetDck.Core.Controls.TabPanel tabPanelPlugins;
|
private TweetDuck.Core.Controls.TabPanel tabPanelPlugins;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -3,13 +3,13 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Controls;
|
using TweetDuck.Plugins.Controls;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormPlugins : Form{
|
sealed partial class FormPlugins : Form{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
||||||
@@ -36,17 +36,19 @@ namespace TweetDck.Core.Other{
|
|||||||
this.tabBtnOfficial = tabPanelPlugins.AddButton("", () => SelectGroup(PluginGroup.Official));
|
this.tabBtnOfficial = tabPanelPlugins.AddButton("", () => SelectGroup(PluginGroup.Official));
|
||||||
this.tabBtnCustom = tabPanelPlugins.AddButton("", () => SelectGroup(PluginGroup.Custom));
|
this.tabBtnCustom = tabPanelPlugins.AddButton("", () => SelectGroup(PluginGroup.Custom));
|
||||||
|
|
||||||
this.tabPanelPlugins.SelectTab(tabBtnOfficial);
|
|
||||||
this.pluginManager_Reloaded(pluginManager, null);
|
this.pluginManager_Reloaded(pluginManager, null);
|
||||||
|
|
||||||
Shown += (sender, args) => {
|
Shown += (sender, args) => {
|
||||||
Program.UserConfig.PluginsWindow.Restore(this, false);
|
Program.UserConfig.PluginsWindow.Restore(this, false);
|
||||||
|
this.tabPanelPlugins.SelectTab(tabBtnOfficial);
|
||||||
};
|
};
|
||||||
|
|
||||||
FormClosed += (sender, args) => {
|
FormClosed += (sender, args) => {
|
||||||
Program.UserConfig.PluginsWindow.Save(this);
|
Program.UserConfig.PluginsWindow.Save(this);
|
||||||
Program.UserConfig.Save();
|
Program.UserConfig.Save();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Disposed += (sender, args) => this.pluginManager.Reloaded -= pluginManager_Reloaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectGroup(PluginGroup group){
|
private void SelectGroup(PluginGroup group){
|
||||||
@@ -76,11 +78,11 @@ namespace TweetDck.Core.Other{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flowLayoutPlugins_Resize(flowLayoutPlugins, new EventArgs());
|
|
||||||
flowLayoutPlugins.ResumeLayout(true);
|
flowLayoutPlugins.ResumeLayout(true);
|
||||||
|
flowLayoutPlugins_Resize(flowLayoutPlugins, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pluginManager_Reloaded(object sender, PluginLoadEventArgs e){
|
private void pluginManager_Reloaded(object sender, PluginErrorEventArgs e){
|
||||||
tabBtnOfficial.Text = "Official: "+pluginManager.CountPluginByGroup(PluginGroup.Official);
|
tabBtnOfficial.Text = "Official: "+pluginManager.CountPluginByGroup(PluginGroup.Official);
|
||||||
tabBtnCustom.Text = "Custom: "+pluginManager.CountPluginByGroup(PluginGroup.Custom);
|
tabBtnCustom.Text = "Custom: "+pluginManager.CountPluginByGroup(PluginGroup.Custom);
|
||||||
}
|
}
|
||||||
|
15
Core/Other/FormSettings.Designer.cs
generated
15
Core/Other/FormSettings.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
sealed partial class FormSettings {
|
sealed partial class FormSettings {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -25,14 +25,14 @@
|
|||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.labelTip = new System.Windows.Forms.Label();
|
this.labelTip = new System.Windows.Forms.Label();
|
||||||
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
|
this.tabPanel = new TweetDuck.Core.Controls.TabPanel();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
//
|
//
|
||||||
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.btnClose.AutoSize = true;
|
this.btnClose.AutoSize = true;
|
||||||
this.btnClose.Location = new System.Drawing.Point(443, 331);
|
this.btnClose.Location = new System.Drawing.Point(443, 349);
|
||||||
this.btnClose.Name = "btnClose";
|
this.btnClose.Name = "btnClose";
|
||||||
this.btnClose.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnClose.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnClose.Size = new System.Drawing.Size(49, 23);
|
this.btnClose.Size = new System.Drawing.Size(49, 23);
|
||||||
@@ -43,8 +43,9 @@
|
|||||||
//
|
//
|
||||||
// labelTip
|
// labelTip
|
||||||
//
|
//
|
||||||
|
this.labelTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.labelTip.AutoSize = true;
|
this.labelTip.AutoSize = true;
|
||||||
this.labelTip.Location = new System.Drawing.Point(12, 333);
|
this.labelTip.Location = new System.Drawing.Point(12, 351);
|
||||||
this.labelTip.Name = "labelTip";
|
this.labelTip.Name = "labelTip";
|
||||||
this.labelTip.Size = new System.Drawing.Size(310, 13);
|
this.labelTip.Size = new System.Drawing.Size(310, 13);
|
||||||
this.labelTip.TabIndex = 5;
|
this.labelTip.TabIndex = 5;
|
||||||
@@ -57,19 +58,19 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.tabPanel.Location = new System.Drawing.Point(12, 12);
|
this.tabPanel.Location = new System.Drawing.Point(12, 12);
|
||||||
this.tabPanel.Name = "tabPanel";
|
this.tabPanel.Name = "tabPanel";
|
||||||
this.tabPanel.Size = new System.Drawing.Size(480, 313);
|
this.tabPanel.Size = new System.Drawing.Size(480, 331);
|
||||||
this.tabPanel.TabIndex = 3;
|
this.tabPanel.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// FormSettings
|
// FormSettings
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(504, 366);
|
this.ClientSize = new System.Drawing.Size(504, 384);
|
||||||
this.Controls.Add(this.labelTip);
|
this.Controls.Add(this.labelTip);
|
||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Controls.Add(this.tabPanel);
|
this.Controls.Add(this.tabPanel);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = Properties.Resources.icon;
|
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormSettings";
|
this.Name = "FormSettings";
|
||||||
|
@@ -2,18 +2,16 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Other.Settings;
|
||||||
using TweetDck.Core.Other.Settings;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Updates;
|
||||||
using TweetDck.Updates;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormSettings : Form{
|
sealed partial class FormSettings : Form{
|
||||||
public const int TabIndexNotification = 1;
|
public const int TabIndexNotification = 1;
|
||||||
|
|
||||||
private readonly FormBrowser browser;
|
private readonly FormBrowser browser;
|
||||||
private readonly Dictionary<Type, BaseTabSettings> tabs = new Dictionary<Type, BaseTabSettings>(4);
|
private readonly Dictionary<Type, BaseTabSettings> tabs = new Dictionary<Type, BaseTabSettings>(4);
|
||||||
private readonly bool hasFinishedLoading;
|
|
||||||
|
|
||||||
public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler updates, int startTabIndex = 0){
|
public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler updates, int startTabIndex = 0){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -24,28 +22,21 @@ namespace TweetDck.Core.Other{
|
|||||||
this.browser.PauseNotification();
|
this.browser.PauseNotification();
|
||||||
|
|
||||||
this.tabPanel.SetupTabPanel(100);
|
this.tabPanel.SetupTabPanel(100);
|
||||||
this.tabPanel.AddButton("General", SelectTab<TabSettingsGeneral>);
|
this.tabPanel.AddButton("General", () => SelectTab(() => new TabSettingsGeneral(updates)));
|
||||||
this.tabPanel.AddButton("Notifications", () => SelectTab(() => new TabSettingsNotifications(browser.CreateNotificationForm(NotificationFlags.DisableContextMenu), !hasFinishedLoading)));
|
this.tabPanel.AddButton("Notifications", () => SelectTab(() => new TabSettingsNotifications(browser.CreateNotificationForm(false))));
|
||||||
this.tabPanel.AddButton("Updates", () => SelectTab(() => new TabSettingsUpdates(updates)));
|
this.tabPanel.AddButton("Sounds", () => SelectTab(() => new TabSettingsSounds()));
|
||||||
this.tabPanel.AddButton("Advanced", () => SelectTab(() => new TabSettingsAdvanced(browser.ReinjectCustomCSS, plugins)));
|
this.tabPanel.AddButton("Advanced", () => SelectTab(() => new TabSettingsAdvanced(browser.ReinjectCustomCSS, plugins)));
|
||||||
|
|
||||||
this.tabPanel.SelectTab(tabPanel.Buttons.ElementAt(startTabIndex));
|
this.tabPanel.SelectTab(tabPanel.Buttons.ElementAt(startTabIndex));
|
||||||
hasFinishedLoading = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SelectTab<T>() where T : BaseTabSettings, new(){
|
|
||||||
SelectTab(() => new T());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
|
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
|
||||||
BaseTabSettings control;
|
if (tabs.TryGetValue(typeof(T), out BaseTabSettings control)){
|
||||||
|
|
||||||
if (tabs.TryGetValue(typeof(T), out control)){
|
|
||||||
tabPanel.ReplaceContent(control);
|
tabPanel.ReplaceContent(control);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
control = tabs[typeof(T)] = constructor();
|
control = tabs[typeof(T)] = constructor();
|
||||||
control.Ready = true;
|
control.OnReady();
|
||||||
tabPanel.ReplaceContent(control);
|
tabPanel.ReplaceContent(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
Core/Other/Settings/BaseTabSettings.Designer.cs
generated
3
Core/Other/Settings/BaseTabSettings.Designer.cs
generated
@@ -1,3 +0,0 @@
|
|||||||
namespace TweetDck.Core.Other.Settings{
|
|
||||||
partial class BaseTabSettings{}
|
|
||||||
}
|
|
@@ -1,20 +1,15 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class BaseTabSettings : UserControl{
|
class BaseTabSettings : UserControl{
|
||||||
protected static UserConfig Config{
|
protected static UserConfig Config => Program.UserConfig;
|
||||||
get{
|
|
||||||
return Program.UserConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Ready { get; set; }
|
|
||||||
|
|
||||||
public BaseTabSettings(){
|
public BaseTabSettings(){
|
||||||
Padding = new Padding(6);
|
Padding = new Padding(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnReady(){}
|
||||||
public virtual void OnClosing(){}
|
public virtual void OnClosing(){}
|
||||||
|
|
||||||
protected static void PromptRestart(){
|
protected static void PromptRestart(){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsCSS {
|
partial class DialogSettingsCSS {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
this.textBoxBrowserCSS.Name = "textBoxBrowserCSS";
|
this.textBoxBrowserCSS.Name = "textBoxBrowserCSS";
|
||||||
this.textBoxBrowserCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
this.textBoxBrowserCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
this.textBoxBrowserCSS.Size = new System.Drawing.Size(373, 253);
|
this.textBoxBrowserCSS.Size = new System.Drawing.Size(373, 253);
|
||||||
this.textBoxBrowserCSS.TabIndex = 0;
|
this.textBoxBrowserCSS.TabIndex = 1;
|
||||||
this.textBoxBrowserCSS.WordWrap = false;
|
this.textBoxBrowserCSS.WordWrap = false;
|
||||||
this.textBoxBrowserCSS.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxBrowserCSS_KeyUp);
|
this.textBoxBrowserCSS.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxBrowserCSS_KeyUp);
|
||||||
//
|
//
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
this.btnCancel.Name = "btnCancel";
|
this.btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
||||||
this.btnCancel.TabIndex = 1;
|
this.btnCancel.TabIndex = 2;
|
||||||
this.btnCancel.Text = "Cancel";
|
this.btnCancel.Text = "Cancel";
|
||||||
this.btnCancel.UseVisualStyleBackColor = true;
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
this.btnApply.Name = "btnApply";
|
this.btnApply.Name = "btnApply";
|
||||||
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnApply.Size = new System.Drawing.Size(56, 23);
|
this.btnApply.Size = new System.Drawing.Size(56, 23);
|
||||||
this.btnApply.TabIndex = 2;
|
this.btnApply.TabIndex = 1;
|
||||||
this.btnApply.Text = "Apply";
|
this.btnApply.Text = "Apply";
|
||||||
this.btnApply.UseVisualStyleBackColor = true;
|
this.btnApply.UseVisualStyleBackColor = true;
|
||||||
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
this.splitContainer.Size = new System.Drawing.Size(760, 269);
|
this.splitContainer.Size = new System.Drawing.Size(760, 269);
|
||||||
this.splitContainer.SplitterDistance = 373;
|
this.splitContainer.SplitterDistance = 373;
|
||||||
this.splitContainer.SplitterWidth = 5;
|
this.splitContainer.SplitterWidth = 5;
|
||||||
this.splitContainer.TabIndex = 5;
|
this.splitContainer.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// labelBrowser
|
// labelBrowser
|
||||||
//
|
//
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
this.labelBrowser.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
this.labelBrowser.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
this.labelBrowser.Name = "labelBrowser";
|
this.labelBrowser.Name = "labelBrowser";
|
||||||
this.labelBrowser.Size = new System.Drawing.Size(45, 13);
|
this.labelBrowser.Size = new System.Drawing.Size(45, 13);
|
||||||
this.labelBrowser.TabIndex = 1;
|
this.labelBrowser.TabIndex = 0;
|
||||||
this.labelBrowser.Text = "Browser";
|
this.labelBrowser.Text = "Browser";
|
||||||
//
|
//
|
||||||
// labelNotification
|
// labelNotification
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
this.labelNotification.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
this.labelNotification.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
this.labelNotification.Name = "labelNotification";
|
this.labelNotification.Name = "labelNotification";
|
||||||
this.labelNotification.Size = new System.Drawing.Size(60, 13);
|
this.labelNotification.Size = new System.Drawing.Size(60, 13);
|
||||||
this.labelNotification.TabIndex = 2;
|
this.labelNotification.TabIndex = 0;
|
||||||
this.labelNotification.Text = "Notification";
|
this.labelNotification.Text = "Notification";
|
||||||
//
|
//
|
||||||
// textBoxNotificationCSS
|
// textBoxNotificationCSS
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
this.textBoxNotificationCSS.Multiline = true;
|
this.textBoxNotificationCSS.Multiline = true;
|
||||||
this.textBoxNotificationCSS.Name = "textBoxNotificationCSS";
|
this.textBoxNotificationCSS.Name = "textBoxNotificationCSS";
|
||||||
this.textBoxNotificationCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
this.textBoxNotificationCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
this.textBoxNotificationCSS.Size = new System.Drawing.Size(373, 253);
|
this.textBoxNotificationCSS.Size = new System.Drawing.Size(372, 253);
|
||||||
this.textBoxNotificationCSS.TabIndex = 1;
|
this.textBoxNotificationCSS.TabIndex = 1;
|
||||||
this.textBoxNotificationCSS.WordWrap = false;
|
this.textBoxNotificationCSS.WordWrap = false;
|
||||||
//
|
//
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
this.labelWarning.Location = new System.Drawing.Point(91, 292);
|
this.labelWarning.Location = new System.Drawing.Point(91, 292);
|
||||||
this.labelWarning.Name = "labelWarning";
|
this.labelWarning.Name = "labelWarning";
|
||||||
this.labelWarning.Size = new System.Drawing.Size(341, 13);
|
this.labelWarning.Size = new System.Drawing.Size(341, 13);
|
||||||
this.labelWarning.TabIndex = 6;
|
this.labelWarning.TabIndex = 3;
|
||||||
this.labelWarning.Text = "The code is not validated, please make sure there are no syntax errors.";
|
this.labelWarning.Text = "The code is not validated, please make sure there are no syntax errors.";
|
||||||
//
|
//
|
||||||
// btnOpenWiki
|
// btnOpenWiki
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
this.btnOpenWiki.Name = "btnOpenWiki";
|
this.btnOpenWiki.Name = "btnOpenWiki";
|
||||||
this.btnOpenWiki.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnOpenWiki.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnOpenWiki.Size = new System.Drawing.Size(73, 23);
|
this.btnOpenWiki.Size = new System.Drawing.Size(73, 23);
|
||||||
this.btnOpenWiki.TabIndex = 7;
|
this.btnOpenWiki.TabIndex = 4;
|
||||||
this.btnOpenWiki.Text = "Open Wiki";
|
this.btnOpenWiki.Text = "Open Wiki";
|
||||||
this.btnOpenWiki.UseVisualStyleBackColor = true;
|
this.btnOpenWiki.UseVisualStyleBackColor = true;
|
||||||
this.btnOpenWiki.Click += new System.EventHandler(this.btnOpenWiki_Click);
|
this.btnOpenWiki.Click += new System.EventHandler(this.btnOpenWiki_Click);
|
||||||
|
@@ -1,21 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCSS : Form{
|
sealed partial class DialogSettingsCSS : Form{
|
||||||
public string BrowserCSS{
|
public string BrowserCSS => textBoxBrowserCSS.Text;
|
||||||
get{
|
public string NotificationCSS => textBoxNotificationCSS.Text;
|
||||||
return textBoxBrowserCSS.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NotificationCSS{
|
|
||||||
get{
|
|
||||||
return textBoxNotificationCSS.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Action<string> reinjectBrowserCSS;
|
private readonly Action<string> reinjectBrowserCSS;
|
||||||
|
|
||||||
@@ -44,7 +35,7 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void btnOpenWiki_Click(object sender, EventArgs e){
|
private void btnOpenWiki_Click(object sender, EventArgs e){
|
||||||
BrowserUtils.OpenExternalBrowser("https://github.com/chylex/TweetDuck/wiki");
|
BrowserUtils.OpenExternalBrowserUnsafe("https://github.com/chylex/TweetDuck/wiki");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnApply_Click(object sender, EventArgs e){
|
private void btnApply_Click(object sender, EventArgs e){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsCefArgs {
|
partial class DialogSettingsCefArgs {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
this.textBoxArgs.Multiline = true;
|
this.textBoxArgs.Multiline = true;
|
||||||
this.textBoxArgs.Name = "textBoxArgs";
|
this.textBoxArgs.Name = "textBoxArgs";
|
||||||
this.textBoxArgs.Size = new System.Drawing.Size(460, 193);
|
this.textBoxArgs.Size = new System.Drawing.Size(460, 193);
|
||||||
this.textBoxArgs.TabIndex = 0;
|
this.textBoxArgs.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// btnCancel
|
// btnCancel
|
||||||
//
|
//
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
this.btnCancel.Name = "btnCancel";
|
this.btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
||||||
this.btnCancel.TabIndex = 1;
|
this.btnCancel.TabIndex = 3;
|
||||||
this.btnCancel.Text = "Cancel";
|
this.btnCancel.Text = "Cancel";
|
||||||
this.btnCancel.UseVisualStyleBackColor = true;
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
this.btnHelp.Name = "btnHelp";
|
this.btnHelp.Name = "btnHelp";
|
||||||
this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnHelp.Size = new System.Drawing.Size(124, 23);
|
this.btnHelp.Size = new System.Drawing.Size(124, 23);
|
||||||
this.btnHelp.TabIndex = 3;
|
this.btnHelp.TabIndex = 4;
|
||||||
this.btnHelp.Text = "List of Chromium Args";
|
this.btnHelp.Text = "List of Chromium Args";
|
||||||
this.btnHelp.UseVisualStyleBackColor = true;
|
this.btnHelp.UseVisualStyleBackColor = true;
|
||||||
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
|
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
||||||
this.labelWarning.Name = "labelWarning";
|
this.labelWarning.Name = "labelWarning";
|
||||||
this.labelWarning.Size = new System.Drawing.Size(423, 13);
|
this.labelWarning.Size = new System.Drawing.Size(423, 13);
|
||||||
this.labelWarning.TabIndex = 4;
|
this.labelWarning.TabIndex = 0;
|
||||||
this.labelWarning.Text = "Warning: Some arguments may cause the program to stop working, edit at your own r" +
|
this.labelWarning.Text = "Warning: Some arguments may cause the program to stop working, edit at your own r" +
|
||||||
"isk.";
|
"isk.";
|
||||||
//
|
//
|
||||||
|
@@ -1,15 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCefArgs : Form{
|
sealed partial class DialogSettingsCefArgs : Form{
|
||||||
public string CefArgs{
|
public string CefArgs => textBoxArgs.Text;
|
||||||
get{
|
|
||||||
return textBoxArgs.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSettingsCefArgs(){
|
public DialogSettingsCefArgs(){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -22,7 +18,7 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void btnHelp_Click(object sender, EventArgs e){
|
private void btnHelp_Click(object sender, EventArgs e){
|
||||||
BrowserUtils.OpenExternalBrowser("http://peter.sh/experiments/chromium-command-line-switches/");
|
BrowserUtils.OpenExternalBrowserUnsafe("http://peter.sh/experiments/chromium-command-line-switches/");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnApply_Click(object sender, EventArgs e){
|
private void btnApply_Click(object sender, EventArgs e){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsExport {
|
partial class DialogSettingsExport {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
this.btnCancel.Name = "btnCancel";
|
this.btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
||||||
this.btnCancel.TabIndex = 0;
|
this.btnCancel.TabIndex = 4;
|
||||||
this.btnCancel.Text = "Cancel";
|
this.btnCancel.Text = "Cancel";
|
||||||
this.btnCancel.UseVisualStyleBackColor = true;
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||||
@@ -49,11 +49,13 @@
|
|||||||
//
|
//
|
||||||
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.btnApply.AutoSize = true;
|
this.btnApply.AutoSize = true;
|
||||||
this.btnApply.Location = new System.Drawing.Point(117, 97);
|
this.btnApply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.btnApply.Location = new System.Drawing.Point(144, 97);
|
||||||
this.btnApply.Name = "btnApply";
|
this.btnApply.Name = "btnApply";
|
||||||
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnApply.Size = new System.Drawing.Size(53, 23);
|
this.btnApply.Size = new System.Drawing.Size(26, 23);
|
||||||
this.btnApply.TabIndex = 1;
|
this.btnApply.TabIndex = 3;
|
||||||
|
this.btnApply.Text = " ";
|
||||||
this.btnApply.UseVisualStyleBackColor = true;
|
this.btnApply.UseVisualStyleBackColor = true;
|
||||||
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
||||||
//
|
//
|
||||||
@@ -63,7 +65,7 @@
|
|||||||
this.cbConfig.Location = new System.Drawing.Point(13, 13);
|
this.cbConfig.Location = new System.Drawing.Point(13, 13);
|
||||||
this.cbConfig.Name = "cbConfig";
|
this.cbConfig.Name = "cbConfig";
|
||||||
this.cbConfig.Size = new System.Drawing.Size(106, 17);
|
this.cbConfig.Size = new System.Drawing.Size(106, 17);
|
||||||
this.cbConfig.TabIndex = 2;
|
this.cbConfig.TabIndex = 0;
|
||||||
this.cbConfig.Text = "Program Settings";
|
this.cbConfig.Text = "Program Settings";
|
||||||
this.toolTip.SetToolTip(this.cbConfig, "Interface, notification, and update settings.\r\nIncludes a list of disabled plugin" +
|
this.toolTip.SetToolTip(this.cbConfig, "Interface, notification, and update settings.\r\nIncludes a list of disabled plugin" +
|
||||||
"s.");
|
"s.");
|
||||||
@@ -76,7 +78,7 @@
|
|||||||
this.cbSession.Location = new System.Drawing.Point(13, 37);
|
this.cbSession.Location = new System.Drawing.Point(13, 37);
|
||||||
this.cbSession.Name = "cbSession";
|
this.cbSession.Name = "cbSession";
|
||||||
this.cbSession.Size = new System.Drawing.Size(92, 17);
|
this.cbSession.Size = new System.Drawing.Size(92, 17);
|
||||||
this.cbSession.TabIndex = 3;
|
this.cbSession.TabIndex = 1;
|
||||||
this.cbSession.Text = "Login Session";
|
this.cbSession.Text = "Login Session";
|
||||||
this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account.");
|
this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account.");
|
||||||
this.cbSession.UseVisualStyleBackColor = true;
|
this.cbSession.UseVisualStyleBackColor = true;
|
||||||
@@ -88,7 +90,7 @@
|
|||||||
this.cbPluginData.Location = new System.Drawing.Point(13, 61);
|
this.cbPluginData.Location = new System.Drawing.Point(13, 61);
|
||||||
this.cbPluginData.Name = "cbPluginData";
|
this.cbPluginData.Name = "cbPluginData";
|
||||||
this.cbPluginData.Size = new System.Drawing.Size(81, 17);
|
this.cbPluginData.Size = new System.Drawing.Size(81, 17);
|
||||||
this.cbPluginData.TabIndex = 4;
|
this.cbPluginData.TabIndex = 2;
|
||||||
this.cbPluginData.Text = "Plugin Data";
|
this.cbPluginData.Text = "Plugin Data";
|
||||||
this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves.");
|
this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves.");
|
||||||
this.cbPluginData.UseVisualStyleBackColor = true;
|
this.cbPluginData.UseVisualStyleBackColor = true;
|
||||||
@@ -105,6 +107,8 @@
|
|||||||
this.Controls.Add(this.btnApply);
|
this.Controls.Add(this.btnApply);
|
||||||
this.Controls.Add(this.btnCancel);
|
this.Controls.Add(this.btnCancel);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
this.MinimumSize = new System.Drawing.Size(200, 170);
|
this.MinimumSize = new System.Drawing.Size(200, 170);
|
||||||
this.Name = "DialogSettingsExport";
|
this.Name = "DialogSettingsExport";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsExport : Form{
|
sealed partial class DialogSettingsExport : Form{
|
||||||
public static DialogSettingsExport Import(ExportFileFlags flags){
|
public static DialogSettingsExport Import(ExportFileFlags flags){
|
||||||
return new DialogSettingsExport(flags);
|
return new DialogSettingsExport(flags);
|
||||||
@@ -13,35 +13,31 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExportFileFlags Flags{
|
public ExportFileFlags Flags{
|
||||||
get{
|
get => selectedFlags;
|
||||||
return selectedFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
selectedFlags = value;
|
// this will call events and SetFlag, which also updates the UI
|
||||||
btnApply.Enabled = selectedFlags != ExportFileFlags.None;
|
cbConfig.Checked = value.HasFlag(ExportFileFlags.Config);
|
||||||
|
cbSession.Checked = value.HasFlag(ExportFileFlags.Session);
|
||||||
cbConfig.Checked = selectedFlags.HasFlag(ExportFileFlags.Config);
|
cbPluginData.Checked = value.HasFlag(ExportFileFlags.PluginData);
|
||||||
cbSession.Checked = selectedFlags.HasFlag(ExportFileFlags.Session);
|
|
||||||
cbPluginData.Checked = selectedFlags.HasFlag(ExportFileFlags.PluginData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly bool isExporting;
|
||||||
private ExportFileFlags selectedFlags = ExportFileFlags.None;
|
private ExportFileFlags selectedFlags = ExportFileFlags.None;
|
||||||
|
|
||||||
private DialogSettingsExport(ExportFileFlags importFlags){
|
private DialogSettingsExport(ExportFileFlags importFlags){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
bool isExporting = importFlags == ExportFileFlags.None;
|
this.isExporting = importFlags == ExportFileFlags.None;
|
||||||
|
|
||||||
if (isExporting){
|
if (isExporting){
|
||||||
Text = "Export Profile";
|
Text = "Export Profile";
|
||||||
btnApply.Text = "Export";
|
btnApply.Text = "Export Profile";
|
||||||
Flags = ExportFileFlags.All & ~ExportFileFlags.Session;
|
Flags = ExportFileFlags.All & ~ExportFileFlags.Session;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Text = "Import Profile";
|
Text = "Import Profile";
|
||||||
btnApply.Text = "Import";
|
|
||||||
Flags = importFlags;
|
Flags = importFlags;
|
||||||
|
|
||||||
cbConfig.Enabled = cbConfig.Checked;
|
cbConfig.Enabled = cbConfig.Checked;
|
||||||
@@ -53,6 +49,10 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
|
|||||||
private void SetFlag(ExportFileFlags flag, bool enable){
|
private void SetFlag(ExportFileFlags flag, bool enable){
|
||||||
selectedFlags = enable ? selectedFlags | flag : selectedFlags & ~flag;
|
selectedFlags = enable ? selectedFlags | flag : selectedFlags & ~flag;
|
||||||
btnApply.Enabled = selectedFlags != ExportFileFlags.None;
|
btnApply.Enabled = selectedFlags != ExportFileFlags.None;
|
||||||
|
|
||||||
|
if (!isExporting){
|
||||||
|
btnApply.Text = selectedFlags.HasFlag(ExportFileFlags.Session) ? "Import && Restart" : "Import Profile";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbConfig_CheckedChanged(object sender, EventArgs e){
|
private void cbConfig_CheckedChanged(object sender, EventArgs e){
|
||||||
|
161
Core/Other/Settings/Dialogs/DialogSettingsRestart.Designer.cs
generated
Normal file
161
Core/Other/Settings/Dialogs/DialogSettingsRestart.Designer.cs
generated
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
|
partial class DialogSettingsRestart {
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
if (disposing && (components != null)) {
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent() {
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.btnCancel = new System.Windows.Forms.Button();
|
||||||
|
this.btnRestart = new System.Windows.Forms.Button();
|
||||||
|
this.cbLogging = new System.Windows.Forms.CheckBox();
|
||||||
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
|
this.cbDebugUpdates = new System.Windows.Forms.CheckBox();
|
||||||
|
this.labelLocale = new System.Windows.Forms.Label();
|
||||||
|
this.comboLocale = new System.Windows.Forms.ComboBox();
|
||||||
|
this.labelDataFolder = new System.Windows.Forms.Label();
|
||||||
|
this.tbDataFolder = new System.Windows.Forms.TextBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// btnCancel
|
||||||
|
//
|
||||||
|
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.btnCancel.AutoSize = true;
|
||||||
|
this.btnCancel.Location = new System.Drawing.Point(160, 171);
|
||||||
|
this.btnCancel.Name = "btnCancel";
|
||||||
|
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
this.btnCancel.Size = new System.Drawing.Size(56, 23);
|
||||||
|
this.btnCancel.TabIndex = 7;
|
||||||
|
this.btnCancel.Text = "Cancel";
|
||||||
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||||
|
//
|
||||||
|
// btnRestart
|
||||||
|
//
|
||||||
|
this.btnRestart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.btnRestart.AutoSize = true;
|
||||||
|
this.btnRestart.Location = new System.Drawing.Point(97, 171);
|
||||||
|
this.btnRestart.Name = "btnRestart";
|
||||||
|
this.btnRestart.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
this.btnRestart.Size = new System.Drawing.Size(57, 23);
|
||||||
|
this.btnRestart.TabIndex = 6;
|
||||||
|
this.btnRestart.Text = "Restart";
|
||||||
|
this.btnRestart.UseVisualStyleBackColor = true;
|
||||||
|
this.btnRestart.Click += new System.EventHandler(this.btnRestart_Click);
|
||||||
|
//
|
||||||
|
// cbLogging
|
||||||
|
//
|
||||||
|
this.cbLogging.AutoSize = true;
|
||||||
|
this.cbLogging.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.cbLogging.Name = "cbLogging";
|
||||||
|
this.cbLogging.Size = new System.Drawing.Size(64, 17);
|
||||||
|
this.cbLogging.TabIndex = 0;
|
||||||
|
this.cbLogging.Text = "Logging";
|
||||||
|
this.toolTip.SetToolTip(this.cbLogging, "Logging JavaScript output into a\r\ndebug.txt file in the data folder.");
|
||||||
|
this.cbLogging.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// cbDebugUpdates
|
||||||
|
//
|
||||||
|
this.cbDebugUpdates.AutoSize = true;
|
||||||
|
this.cbDebugUpdates.Location = new System.Drawing.Point(12, 35);
|
||||||
|
this.cbDebugUpdates.Name = "cbDebugUpdates";
|
||||||
|
this.cbDebugUpdates.Size = new System.Drawing.Size(127, 17);
|
||||||
|
this.cbDebugUpdates.TabIndex = 1;
|
||||||
|
this.cbDebugUpdates.Text = "Pre-Release Updates";
|
||||||
|
this.toolTip.SetToolTip(this.cbDebugUpdates, "Allows updating to pre-releases.");
|
||||||
|
this.cbDebugUpdates.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// labelLocale
|
||||||
|
//
|
||||||
|
this.labelLocale.AutoSize = true;
|
||||||
|
this.labelLocale.Location = new System.Drawing.Point(12, 67);
|
||||||
|
this.labelLocale.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
|
this.labelLocale.Name = "labelLocale";
|
||||||
|
this.labelLocale.Size = new System.Drawing.Size(39, 13);
|
||||||
|
this.labelLocale.TabIndex = 2;
|
||||||
|
this.labelLocale.Text = "Locale";
|
||||||
|
//
|
||||||
|
// comboLocale
|
||||||
|
//
|
||||||
|
this.comboLocale.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.comboLocale.FormattingEnabled = true;
|
||||||
|
this.comboLocale.Location = new System.Drawing.Point(15, 83);
|
||||||
|
this.comboLocale.Name = "comboLocale";
|
||||||
|
this.comboLocale.Size = new System.Drawing.Size(201, 21);
|
||||||
|
this.comboLocale.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// labelDataFolder
|
||||||
|
//
|
||||||
|
this.labelDataFolder.AutoSize = true;
|
||||||
|
this.labelDataFolder.Location = new System.Drawing.Point(12, 119);
|
||||||
|
this.labelDataFolder.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
|
this.labelDataFolder.Name = "labelDataFolder";
|
||||||
|
this.labelDataFolder.Size = new System.Drawing.Size(62, 13);
|
||||||
|
this.labelDataFolder.TabIndex = 4;
|
||||||
|
this.labelDataFolder.Text = "Data Folder";
|
||||||
|
//
|
||||||
|
// tbDataFolder
|
||||||
|
//
|
||||||
|
this.tbDataFolder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.tbDataFolder.Location = new System.Drawing.Point(15, 135);
|
||||||
|
this.tbDataFolder.Name = "tbDataFolder";
|
||||||
|
this.tbDataFolder.Size = new System.Drawing.Size(201, 20);
|
||||||
|
this.tbDataFolder.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// DialogSettingsRestart
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(228, 206);
|
||||||
|
this.Controls.Add(this.tbDataFolder);
|
||||||
|
this.Controls.Add(this.labelDataFolder);
|
||||||
|
this.Controls.Add(this.comboLocale);
|
||||||
|
this.Controls.Add(this.labelLocale);
|
||||||
|
this.Controls.Add(this.cbDebugUpdates);
|
||||||
|
this.Controls.Add(this.cbLogging);
|
||||||
|
this.Controls.Add(this.btnRestart);
|
||||||
|
this.Controls.Add(this.btnCancel);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "DialogSettingsRestart";
|
||||||
|
this.ShowIcon = false;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button btnCancel;
|
||||||
|
private System.Windows.Forms.Button btnRestart;
|
||||||
|
private System.Windows.Forms.CheckBox cbLogging;
|
||||||
|
private System.Windows.Forms.ToolTip toolTip;
|
||||||
|
private System.Windows.Forms.CheckBox cbDebugUpdates;
|
||||||
|
private System.Windows.Forms.Label labelLocale;
|
||||||
|
private System.Windows.Forms.ComboBox comboLocale;
|
||||||
|
private System.Windows.Forms.Label labelDataFolder;
|
||||||
|
private System.Windows.Forms.TextBox tbDataFolder;
|
||||||
|
}
|
||||||
|
}
|
62
Core/Other/Settings/Dialogs/DialogSettingsRestart.cs
Normal file
62
Core/Other/Settings/Dialogs/DialogSettingsRestart.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Configuration;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
|
sealed partial class DialogSettingsRestart : Form{
|
||||||
|
private const string DefaultLocale = "en-US";
|
||||||
|
|
||||||
|
public CommandLineArgs Args { get; private set; }
|
||||||
|
|
||||||
|
public DialogSettingsRestart(CommandLineArgs currentArgs){
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
try{
|
||||||
|
object[] locales = Directory.EnumerateFiles(Path.Combine(Program.ProgramPath, "locales"), "*.pak", SearchOption.TopDirectoryOnly).Select(Path.GetFileNameWithoutExtension).ToArray<object>();
|
||||||
|
comboLocale.Items.AddRange(locales);
|
||||||
|
}catch{
|
||||||
|
comboLocale.Items.Add(DefaultLocale);
|
||||||
|
}
|
||||||
|
|
||||||
|
cbLogging.Checked = currentArgs.HasFlag(Arguments.ArgLogging);
|
||||||
|
cbDebugUpdates.Checked = currentArgs.HasFlag(Arguments.ArgDebugUpdates);
|
||||||
|
comboLocale.SelectedItem = currentArgs.GetValue(Arguments.ArgLocale, DefaultLocale);
|
||||||
|
tbDataFolder.Text = currentArgs.GetValue(Arguments.ArgDataFolder, string.Empty);
|
||||||
|
|
||||||
|
Text = Program.BrandName+" Arguments";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnRestart_Click(object sender, EventArgs e){
|
||||||
|
Args = new CommandLineArgs();
|
||||||
|
|
||||||
|
if (cbLogging.Checked){
|
||||||
|
Args.AddFlag(Arguments.ArgLogging);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cbDebugUpdates.Checked){
|
||||||
|
Args.AddFlag(Arguments.ArgDebugUpdates);
|
||||||
|
}
|
||||||
|
|
||||||
|
string locale = comboLocale.SelectedItem as string;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(locale) && locale != DefaultLocale){
|
||||||
|
Args.SetValue(Arguments.ArgLocale, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(tbDataFolder.Text)){
|
||||||
|
Args.SetValue(Arguments.ArgDataFolder, tbDataFolder.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCancel_Click(object sender, EventArgs e){
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
class CombinedFileStream : IDisposable{
|
class CombinedFileStream : IDisposable{
|
||||||
public const char KeySeparator = '|';
|
public const char KeySeparator = '|';
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Entry{
|
public class Entry{
|
||||||
public string Identifier { get; private set; }
|
public string Identifier { get; }
|
||||||
|
|
||||||
public string KeyName{
|
public string KeyName{
|
||||||
get{
|
get{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum ExportFileFlags{
|
enum ExportFileFlags{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@@ -3,10 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins;
|
||||||
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
sealed class ExportManager{
|
sealed class ExportManager{
|
||||||
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
||||||
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
||||||
@@ -26,10 +27,12 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
try{
|
try{
|
||||||
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
||||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||||
stream.WriteFile("config", Program.ConfigFilePath);
|
stream.WriteFile("config", Program.UserConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
|
stream.WriteFile("plugin.config", Program.PluginConfigFilePath);
|
||||||
|
|
||||||
foreach(Plugin plugin in plugins.Plugins){
|
foreach(Plugin plugin in plugins.Plugins){
|
||||||
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
|
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
|
||||||
try{
|
try{
|
||||||
@@ -68,6 +71,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
flags |= ExportFileFlags.Config;
|
flags |= ExportFileFlags.Config;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "plugin.config":
|
||||||
case "plugin.data":
|
case "plugin.data":
|
||||||
flags |= ExportFileFlags.PluginData;
|
flags |= ExportFileFlags.PluginData;
|
||||||
break;
|
break;
|
||||||
@@ -97,8 +101,14 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
switch(entry.KeyName){
|
switch(entry.KeyName){
|
||||||
case "config":
|
case "config":
|
||||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||||
entry.WriteToFile(Program.ConfigFilePath);
|
entry.WriteToFile(Program.UserConfigFilePath);
|
||||||
Program.ReloadConfig();
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "plugin.config":
|
||||||
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
|
entry.WriteToFile(Program.PluginConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -117,7 +127,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "cookies":
|
case "cookies":
|
||||||
if (flags.HasFlag(ExportFileFlags.Session) && MessageBox.Show("Do you want to import the login session? This will restart "+Program.BrandName+".", "Importing "+Program.BrandName+" Profile", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
if (flags.HasFlag(ExportFileFlags.Session)){
|
||||||
entry.WriteToFile(Path.Combine(Program.StoragePath, TempCookiesPath));
|
entry.WriteToFile(Path.Combine(Program.StoragePath, TempCookiesPath));
|
||||||
IsRestarting = true;
|
IsRestarting = true;
|
||||||
}
|
}
|
||||||
@@ -132,10 +142,10 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsRestarting){
|
if (IsRestarting){
|
||||||
Program.Restart(new string[]{ "-importcookies" });
|
Program.Restart(new string[]{ Arguments.ArgImportCookies });
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
plugins.Reload();
|
Program.ReloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
74
Core/Other/Settings/TabSettingsAdvanced.Designer.cs
generated
74
Core/Other/Settings/TabSettingsAdvanced.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsAdvanced {
|
partial class TabSettingsAdvanced {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.btnEditCefArgs = new System.Windows.Forms.Button();
|
this.btnEditCefArgs = new System.Windows.Forms.Button();
|
||||||
this.btnEditCSS = new System.Windows.Forms.Button();
|
this.btnEditCSS = new System.Windows.Forms.Button();
|
||||||
this.btnRestartLog = new System.Windows.Forms.Button();
|
this.btnRestartArgs = new System.Windows.Forms.Button();
|
||||||
this.btnRestart = new System.Windows.Forms.Button();
|
this.btnRestart = new System.Windows.Forms.Button();
|
||||||
this.btnOpenAppFolder = new System.Windows.Forms.Button();
|
this.btnOpenAppFolder = new System.Windows.Forms.Button();
|
||||||
this.btnOpenDataFolder = new System.Windows.Forms.Button();
|
this.btnOpenDataFolder = new System.Windows.Forms.Button();
|
||||||
@@ -49,134 +49,122 @@
|
|||||||
this.btnClearCache.Location = new System.Drawing.Point(6, 44);
|
this.btnClearCache.Location = new System.Drawing.Point(6, 44);
|
||||||
this.btnClearCache.Name = "btnClearCache";
|
this.btnClearCache.Name = "btnClearCache";
|
||||||
this.btnClearCache.Size = new System.Drawing.Size(171, 23);
|
this.btnClearCache.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnClearCache.TabIndex = 14;
|
this.btnClearCache.TabIndex = 1;
|
||||||
this.btnClearCache.Text = "Clear Cache (calculating)";
|
this.btnClearCache.Text = "Clear Cache (calculating)";
|
||||||
this.toolTip.SetToolTip(this.btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources." +
|
this.toolTip.SetToolTip(this.btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources." +
|
||||||
"");
|
"");
|
||||||
this.btnClearCache.UseVisualStyleBackColor = true;
|
this.btnClearCache.UseVisualStyleBackColor = true;
|
||||||
this.btnClearCache.Click += new System.EventHandler(this.btnClearCache_Click);
|
|
||||||
//
|
//
|
||||||
// checkHardwareAcceleration
|
// checkHardwareAcceleration
|
||||||
//
|
//
|
||||||
this.checkHardwareAcceleration.AutoSize = true;
|
this.checkHardwareAcceleration.AutoSize = true;
|
||||||
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 21);
|
this.checkHardwareAcceleration.Location = new System.Drawing.Point(9, 21);
|
||||||
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
|
||||||
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
|
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
|
||||||
this.checkHardwareAcceleration.Size = new System.Drawing.Size(134, 17);
|
this.checkHardwareAcceleration.Size = new System.Drawing.Size(134, 17);
|
||||||
this.checkHardwareAcceleration.TabIndex = 12;
|
this.checkHardwareAcceleration.TabIndex = 0;
|
||||||
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
|
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
|
||||||
this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" +
|
this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" +
|
||||||
" with rendering.");
|
" with rendering.");
|
||||||
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
|
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
|
||||||
this.checkHardwareAcceleration.CheckedChanged += new System.EventHandler(this.checkHardwareAcceleration_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// btnEditCefArgs
|
// btnEditCefArgs
|
||||||
//
|
//
|
||||||
this.btnEditCefArgs.Location = new System.Drawing.Point(6, 19);
|
this.btnEditCefArgs.Location = new System.Drawing.Point(6, 19);
|
||||||
this.btnEditCefArgs.Name = "btnEditCefArgs";
|
this.btnEditCefArgs.Name = "btnEditCefArgs";
|
||||||
this.btnEditCefArgs.Size = new System.Drawing.Size(171, 23);
|
this.btnEditCefArgs.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnEditCefArgs.TabIndex = 15;
|
this.btnEditCefArgs.TabIndex = 0;
|
||||||
this.btnEditCefArgs.Text = "Edit CEF Arguments";
|
this.btnEditCefArgs.Text = "Edit CEF Arguments";
|
||||||
this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
|
this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
|
||||||
this.btnEditCefArgs.UseVisualStyleBackColor = true;
|
this.btnEditCefArgs.UseVisualStyleBackColor = true;
|
||||||
this.btnEditCefArgs.Click += new System.EventHandler(this.btnEditCefArgs_Click);
|
|
||||||
//
|
//
|
||||||
// btnEditCSS
|
// btnEditCSS
|
||||||
//
|
//
|
||||||
this.btnEditCSS.Location = new System.Drawing.Point(6, 48);
|
this.btnEditCSS.Location = new System.Drawing.Point(6, 48);
|
||||||
this.btnEditCSS.Name = "btnEditCSS";
|
this.btnEditCSS.Name = "btnEditCSS";
|
||||||
this.btnEditCSS.Size = new System.Drawing.Size(171, 23);
|
this.btnEditCSS.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnEditCSS.TabIndex = 16;
|
this.btnEditCSS.TabIndex = 1;
|
||||||
this.btnEditCSS.Text = "Edit CSS";
|
this.btnEditCSS.Text = "Edit CSS";
|
||||||
this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows.");
|
this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows.");
|
||||||
this.btnEditCSS.UseVisualStyleBackColor = true;
|
this.btnEditCSS.UseVisualStyleBackColor = true;
|
||||||
this.btnEditCSS.Click += new System.EventHandler(this.btnEditCSS_Click);
|
|
||||||
//
|
//
|
||||||
// btnRestartLog
|
// btnRestartArgs
|
||||||
//
|
//
|
||||||
this.btnRestartLog.Location = new System.Drawing.Point(6, 106);
|
this.btnRestartArgs.Location = new System.Drawing.Point(6, 106);
|
||||||
this.btnRestartLog.Name = "btnRestartLog";
|
this.btnRestartArgs.Name = "btnRestartArgs";
|
||||||
this.btnRestartLog.Size = new System.Drawing.Size(171, 23);
|
this.btnRestartArgs.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnRestartLog.TabIndex = 18;
|
this.btnRestartArgs.TabIndex = 3;
|
||||||
this.btnRestartLog.Text = "Restart with Logging";
|
this.btnRestartArgs.Text = "Restart with Arguments";
|
||||||
this.toolTip.SetToolTip(this.btnRestartLog, "Restarts the program and enables logging\r\ninto a debug.txt file in the data folde" +
|
this.toolTip.SetToolTip(this.btnRestartArgs, "Restarts the program with customizable\r\ncommand line arguments.");
|
||||||
"r.");
|
this.btnRestartArgs.UseVisualStyleBackColor = true;
|
||||||
this.btnRestartLog.UseVisualStyleBackColor = true;
|
|
||||||
this.btnRestartLog.Click += new System.EventHandler(this.btnRestartLog_Click);
|
|
||||||
//
|
//
|
||||||
// btnRestart
|
// btnRestart
|
||||||
//
|
//
|
||||||
this.btnRestart.Location = new System.Drawing.Point(6, 77);
|
this.btnRestart.Location = new System.Drawing.Point(6, 77);
|
||||||
this.btnRestart.Name = "btnRestart";
|
this.btnRestart.Name = "btnRestart";
|
||||||
this.btnRestart.Size = new System.Drawing.Size(171, 23);
|
this.btnRestart.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnRestart.TabIndex = 17;
|
this.btnRestart.TabIndex = 2;
|
||||||
this.btnRestart.Text = "Restart the Program";
|
this.btnRestart.Text = "Restart the Program";
|
||||||
this.toolTip.SetToolTip(this.btnRestart, "Restarts the program using the same command\r\nline arguments that were used at lau" +
|
this.toolTip.SetToolTip(this.btnRestart, "Restarts the program using the same command\r\nline arguments that were used at lau" +
|
||||||
"nch.");
|
"nch.");
|
||||||
this.btnRestart.UseVisualStyleBackColor = true;
|
this.btnRestart.UseVisualStyleBackColor = true;
|
||||||
this.btnRestart.Click += new System.EventHandler(this.btnRestart_Click);
|
|
||||||
//
|
//
|
||||||
// btnOpenAppFolder
|
// btnOpenAppFolder
|
||||||
//
|
//
|
||||||
this.btnOpenAppFolder.Location = new System.Drawing.Point(6, 19);
|
this.btnOpenAppFolder.Location = new System.Drawing.Point(6, 19);
|
||||||
this.btnOpenAppFolder.Name = "btnOpenAppFolder";
|
this.btnOpenAppFolder.Name = "btnOpenAppFolder";
|
||||||
this.btnOpenAppFolder.Size = new System.Drawing.Size(171, 23);
|
this.btnOpenAppFolder.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnOpenAppFolder.TabIndex = 16;
|
this.btnOpenAppFolder.TabIndex = 0;
|
||||||
this.btnOpenAppFolder.Text = "Open Program Folder";
|
this.btnOpenAppFolder.Text = "Open Program Folder";
|
||||||
this.toolTip.SetToolTip(this.btnOpenAppFolder, "Opens the folder where the app is located.");
|
this.toolTip.SetToolTip(this.btnOpenAppFolder, "Opens the folder where the app is located.");
|
||||||
this.btnOpenAppFolder.UseVisualStyleBackColor = true;
|
this.btnOpenAppFolder.UseVisualStyleBackColor = true;
|
||||||
this.btnOpenAppFolder.Click += new System.EventHandler(this.btnOpenAppFolder_Click);
|
|
||||||
//
|
//
|
||||||
// btnOpenDataFolder
|
// btnOpenDataFolder
|
||||||
//
|
//
|
||||||
this.btnOpenDataFolder.Location = new System.Drawing.Point(6, 48);
|
this.btnOpenDataFolder.Location = new System.Drawing.Point(6, 48);
|
||||||
this.btnOpenDataFolder.Name = "btnOpenDataFolder";
|
this.btnOpenDataFolder.Name = "btnOpenDataFolder";
|
||||||
this.btnOpenDataFolder.Size = new System.Drawing.Size(171, 23);
|
this.btnOpenDataFolder.Size = new System.Drawing.Size(171, 23);
|
||||||
this.btnOpenDataFolder.TabIndex = 19;
|
this.btnOpenDataFolder.TabIndex = 1;
|
||||||
this.btnOpenDataFolder.Text = "Open Data Folder";
|
this.btnOpenDataFolder.Text = "Open Data Folder";
|
||||||
this.toolTip.SetToolTip(this.btnOpenDataFolder, "Opens the folder where your profile data is located.");
|
this.toolTip.SetToolTip(this.btnOpenDataFolder, "Opens the folder where your profile data is located.");
|
||||||
this.btnOpenDataFolder.UseVisualStyleBackColor = true;
|
this.btnOpenDataFolder.UseVisualStyleBackColor = true;
|
||||||
this.btnOpenDataFolder.Click += new System.EventHandler(this.btnOpenDataFolder_Click);
|
|
||||||
//
|
//
|
||||||
// btnReset
|
// btnReset
|
||||||
//
|
//
|
||||||
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.btnReset.AutoSize = true;
|
this.btnReset.AutoSize = true;
|
||||||
this.btnReset.Location = new System.Drawing.Point(190, 250);
|
this.btnReset.Location = new System.Drawing.Point(190, 268);
|
||||||
this.btnReset.Name = "btnReset";
|
this.btnReset.Name = "btnReset";
|
||||||
this.btnReset.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnReset.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnReset.Size = new System.Drawing.Size(102, 23);
|
this.btnReset.Size = new System.Drawing.Size(102, 23);
|
||||||
this.btnReset.TabIndex = 17;
|
this.btnReset.TabIndex = 5;
|
||||||
this.btnReset.Text = "Restore Defaults";
|
this.btnReset.Text = "Restore Defaults";
|
||||||
this.btnReset.UseVisualStyleBackColor = true;
|
this.btnReset.UseVisualStyleBackColor = true;
|
||||||
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
|
|
||||||
//
|
//
|
||||||
// btnImport
|
// btnImport
|
||||||
//
|
//
|
||||||
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.btnImport.AutoSize = true;
|
this.btnImport.AutoSize = true;
|
||||||
this.btnImport.Location = new System.Drawing.Point(100, 250);
|
this.btnImport.Location = new System.Drawing.Point(100, 268);
|
||||||
this.btnImport.Name = "btnImport";
|
this.btnImport.Name = "btnImport";
|
||||||
this.btnImport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnImport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnImport.Size = new System.Drawing.Size(84, 23);
|
this.btnImport.Size = new System.Drawing.Size(84, 23);
|
||||||
this.btnImport.TabIndex = 16;
|
this.btnImport.TabIndex = 4;
|
||||||
this.btnImport.Text = "Import Profile";
|
this.btnImport.Text = "Import Profile";
|
||||||
this.btnImport.UseVisualStyleBackColor = true;
|
this.btnImport.UseVisualStyleBackColor = true;
|
||||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
|
||||||
//
|
//
|
||||||
// btnExport
|
// btnExport
|
||||||
//
|
//
|
||||||
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.btnExport.AutoSize = true;
|
this.btnExport.AutoSize = true;
|
||||||
this.btnExport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.btnExport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.btnExport.Location = new System.Drawing.Point(9, 250);
|
this.btnExport.Location = new System.Drawing.Point(9, 268);
|
||||||
this.btnExport.Name = "btnExport";
|
this.btnExport.Name = "btnExport";
|
||||||
this.btnExport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
this.btnExport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
this.btnExport.Size = new System.Drawing.Size(85, 23);
|
this.btnExport.Size = new System.Drawing.Size(85, 23);
|
||||||
this.btnExport.TabIndex = 15;
|
this.btnExport.TabIndex = 3;
|
||||||
this.btnExport.Text = "Export Profile";
|
this.btnExport.Text = "Export Profile";
|
||||||
this.btnExport.UseVisualStyleBackColor = true;
|
this.btnExport.UseVisualStyleBackColor = true;
|
||||||
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
|
|
||||||
//
|
//
|
||||||
// groupPerformance
|
// groupPerformance
|
||||||
//
|
//
|
||||||
@@ -185,7 +173,7 @@
|
|||||||
this.groupPerformance.Location = new System.Drawing.Point(9, 9);
|
this.groupPerformance.Location = new System.Drawing.Point(9, 9);
|
||||||
this.groupPerformance.Name = "groupPerformance";
|
this.groupPerformance.Name = "groupPerformance";
|
||||||
this.groupPerformance.Size = new System.Drawing.Size(183, 74);
|
this.groupPerformance.Size = new System.Drawing.Size(183, 74);
|
||||||
this.groupPerformance.TabIndex = 18;
|
this.groupPerformance.TabIndex = 0;
|
||||||
this.groupPerformance.TabStop = false;
|
this.groupPerformance.TabStop = false;
|
||||||
this.groupPerformance.Text = "Performance";
|
this.groupPerformance.Text = "Performance";
|
||||||
//
|
//
|
||||||
@@ -196,7 +184,7 @@
|
|||||||
this.groupConfiguration.Location = new System.Drawing.Point(9, 89);
|
this.groupConfiguration.Location = new System.Drawing.Point(9, 89);
|
||||||
this.groupConfiguration.Name = "groupConfiguration";
|
this.groupConfiguration.Name = "groupConfiguration";
|
||||||
this.groupConfiguration.Size = new System.Drawing.Size(183, 77);
|
this.groupConfiguration.Size = new System.Drawing.Size(183, 77);
|
||||||
this.groupConfiguration.TabIndex = 19;
|
this.groupConfiguration.TabIndex = 1;
|
||||||
this.groupConfiguration.TabStop = false;
|
this.groupConfiguration.TabStop = false;
|
||||||
this.groupConfiguration.Text = "Configuration";
|
this.groupConfiguration.Text = "Configuration";
|
||||||
//
|
//
|
||||||
@@ -204,12 +192,12 @@
|
|||||||
//
|
//
|
||||||
this.groupApp.Controls.Add(this.btnOpenDataFolder);
|
this.groupApp.Controls.Add(this.btnOpenDataFolder);
|
||||||
this.groupApp.Controls.Add(this.btnOpenAppFolder);
|
this.groupApp.Controls.Add(this.btnOpenAppFolder);
|
||||||
this.groupApp.Controls.Add(this.btnRestartLog);
|
this.groupApp.Controls.Add(this.btnRestartArgs);
|
||||||
this.groupApp.Controls.Add(this.btnRestart);
|
this.groupApp.Controls.Add(this.btnRestart);
|
||||||
this.groupApp.Location = new System.Drawing.Point(198, 9);
|
this.groupApp.Location = new System.Drawing.Point(198, 9);
|
||||||
this.groupApp.Name = "groupApp";
|
this.groupApp.Name = "groupApp";
|
||||||
this.groupApp.Size = new System.Drawing.Size(183, 135);
|
this.groupApp.Size = new System.Drawing.Size(183, 135);
|
||||||
this.groupApp.TabIndex = 20;
|
this.groupApp.TabIndex = 2;
|
||||||
this.groupApp.TabStop = false;
|
this.groupApp.TabStop = false;
|
||||||
this.groupApp.Text = "App";
|
this.groupApp.Text = "App";
|
||||||
//
|
//
|
||||||
@@ -224,7 +212,7 @@
|
|||||||
this.Controls.Add(this.btnImport);
|
this.Controls.Add(this.btnImport);
|
||||||
this.Controls.Add(this.btnExport);
|
this.Controls.Add(this.btnExport);
|
||||||
this.Name = "TabSettingsAdvanced";
|
this.Name = "TabSettingsAdvanced";
|
||||||
this.Size = new System.Drawing.Size(478, 282);
|
this.Size = new System.Drawing.Size(478, 300);
|
||||||
this.groupPerformance.ResumeLayout(false);
|
this.groupPerformance.ResumeLayout(false);
|
||||||
this.groupPerformance.PerformLayout();
|
this.groupPerformance.PerformLayout();
|
||||||
this.groupConfiguration.ResumeLayout(false);
|
this.groupConfiguration.ResumeLayout(false);
|
||||||
@@ -247,7 +235,7 @@
|
|||||||
private System.Windows.Forms.Button btnEditCefArgs;
|
private System.Windows.Forms.Button btnEditCefArgs;
|
||||||
private System.Windows.Forms.Button btnEditCSS;
|
private System.Windows.Forms.Button btnEditCSS;
|
||||||
private System.Windows.Forms.GroupBox groupApp;
|
private System.Windows.Forms.GroupBox groupApp;
|
||||||
private System.Windows.Forms.Button btnRestartLog;
|
private System.Windows.Forms.Button btnRestartArgs;
|
||||||
private System.Windows.Forms.Button btnRestart;
|
private System.Windows.Forms.Button btnRestart;
|
||||||
private System.Windows.Forms.Button btnOpenAppFolder;
|
private System.Windows.Forms.Button btnOpenAppFolder;
|
||||||
private System.Windows.Forms.Button btnOpenDataFolder;
|
private System.Windows.Forms.Button btnOpenDataFolder;
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Other.Settings.Dialogs;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Core.Utils;
|
||||||
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsAdvanced : BaseTabSettings{
|
partial class TabSettingsAdvanced : BaseTabSettings{
|
||||||
private readonly Action<string> reinjectBrowserCSS;
|
private readonly Action<string> reinjectBrowserCSS;
|
||||||
private readonly PluginManager plugins;
|
private readonly PluginManager plugins;
|
||||||
@@ -18,7 +19,13 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
|
|
||||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
if (SystemConfig.IsHardwareAccelerationSupported){
|
||||||
|
checkHardwareAcceleration.Checked = Program.SystemConfig.HardwareAcceleration;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
checkHardwareAcceleration.Enabled = false;
|
||||||
|
checkHardwareAcceleration.Checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
||||||
if (bytes == -1L){
|
if (bytes == -1L){
|
||||||
@@ -30,9 +37,24 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnClearCache_Click(object sender, EventArgs e){
|
public override void OnReady(){
|
||||||
if (!Ready)return;
|
btnClearCache.Click += btnClearCache_Click;
|
||||||
|
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
||||||
|
|
||||||
|
btnEditCefArgs.Click += btnEditCefArgs_Click;
|
||||||
|
btnEditCSS.Click += btnEditCSS_Click;
|
||||||
|
|
||||||
|
btnExport.Click += btnExport_Click;
|
||||||
|
btnImport.Click += btnImport_Click;
|
||||||
|
btnReset.Click += btnReset_Click;
|
||||||
|
|
||||||
|
btnOpenAppFolder.Click += btnOpenAppFolder_Click;
|
||||||
|
btnOpenDataFolder.Click += btnOpenDataFolder_Click;
|
||||||
|
btnRestart.Click += btnRestart_Click;
|
||||||
|
btnRestartArgs.Click += btnRestartArgs_Click;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClearCache_Click(object sender, EventArgs e){
|
||||||
btnClearCache.Enabled = false;
|
btnClearCache.Enabled = false;
|
||||||
BrowserCache.SetClearOnExit();
|
BrowserCache.SetClearOnExit();
|
||||||
|
|
||||||
@@ -40,54 +62,54 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
Program.SystemConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||||
|
Program.SystemConfig.Save();
|
||||||
bool succeeded = false;
|
|
||||||
|
|
||||||
if (checkHardwareAcceleration.Checked){
|
|
||||||
if (HardwareAcceleration.CanEnable){
|
|
||||||
succeeded = HardwareAcceleration.Enable();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
MessageBox.Show("Cannot enable hardware acceleration, the libraries libEGL.dll and libGLESv2.dll could not be restored.", Program.BrandName+" Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
succeeded = HardwareAcceleration.Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (succeeded){
|
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
|
|
||||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
|
||||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
||||||
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
||||||
|
|
||||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
form.VisibleChanged += (sender2, args2) => {
|
||||||
|
form.MoveToCenter(ParentForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.FormClosed += (sender2, args2) => {
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||||
|
|
||||||
|
if (form.DialogResult == DialogResult.OK){
|
||||||
Config.CustomCefArgs = form.CefArgs;
|
Config.CustomCefArgs = form.CefArgs;
|
||||||
form.Dispose();
|
form.Dispose();
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
else{
|
else form.Dispose();
|
||||||
form.Dispose();
|
};
|
||||||
}
|
|
||||||
|
form.Show(ParentForm);
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnEditCSS_Click(object sender, EventArgs e){
|
private void btnEditCSS_Click(object sender, EventArgs e){
|
||||||
using(DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS)){
|
DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS);
|
||||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
|
||||||
|
form.VisibleChanged += (sender2, args2) => {
|
||||||
|
form.MoveToCenter(ParentForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.FormClosed += (sender2, args2) => {
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||||
|
|
||||||
|
if (form.DialogResult == DialogResult.OK){
|
||||||
Config.CustomBrowserCSS = form.BrowserCSS;
|
Config.CustomBrowserCSS = form.BrowserCSS;
|
||||||
Config.CustomNotificationCSS = form.NotificationCSS;
|
Config.CustomNotificationCSS = form.NotificationCSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
||||||
}
|
form.Dispose();
|
||||||
|
};
|
||||||
|
|
||||||
|
form.Show(ParentForm);
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnExport_Click(object sender, EventArgs e){
|
private void btnExport_Click(object sender, EventArgs e){
|
||||||
@@ -166,7 +188,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void btnReset_Click(object sender, EventArgs e){
|
private void btnReset_Click(object sender, EventArgs e){
|
||||||
if (MessageBox.Show("This will reset all of your settings, including disabled plugins. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
if (MessageBox.Show("This will reset all of your program settings. Plugins will not be affected. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
Program.ResetConfig();
|
Program.ResetConfig();
|
||||||
((FormSettings)ParentForm).ReloadUI();
|
((FormSettings)ParentForm).ReloadUI();
|
||||||
}
|
}
|
||||||
@@ -184,8 +206,12 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
Program.Restart();
|
Program.Restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnRestartLog_Click(object sender, EventArgs e){
|
private void btnRestartArgs_Click(object sender, EventArgs e){
|
||||||
Program.Restart(new string[]{ "-log" });
|
using(DialogSettingsRestart dialog = new DialogSettingsRestart(Arguments.GetCurrentClean())){
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK){
|
||||||
|
Program.RestartWithArgs(dialog.Args);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
163
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
163
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsGeneral {
|
partial class TabSettingsGeneral {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -29,27 +29,35 @@
|
|||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
||||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||||
this.checkScreenshotBorder = new System.Windows.Forms.CheckBox();
|
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
||||||
|
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
||||||
|
this.labelZoomValue = new System.Windows.Forms.Label();
|
||||||
|
this.checkSwitchAccountSelectors = new System.Windows.Forms.CheckBox();
|
||||||
this.groupTray = new System.Windows.Forms.GroupBox();
|
this.groupTray = new System.Windows.Forms.GroupBox();
|
||||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||||
this.groupInterface = new System.Windows.Forms.GroupBox();
|
this.groupInterface = new System.Windows.Forms.GroupBox();
|
||||||
|
this.trackBarZoom = new System.Windows.Forms.TrackBar();
|
||||||
|
this.labelZoom = new System.Windows.Forms.Label();
|
||||||
|
this.groupUpdates = new System.Windows.Forms.GroupBox();
|
||||||
|
this.zoomUpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.groupTray.SuspendLayout();
|
this.groupTray.SuspendLayout();
|
||||||
this.groupInterface.SuspendLayout();
|
this.groupInterface.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).BeginInit();
|
||||||
|
this.groupUpdates.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// checkExpandLinks
|
// checkExpandLinks
|
||||||
//
|
//
|
||||||
this.checkExpandLinks.AutoSize = true;
|
this.checkExpandLinks.AutoSize = true;
|
||||||
this.checkExpandLinks.Location = new System.Drawing.Point(9, 21);
|
this.checkExpandLinks.Location = new System.Drawing.Point(9, 21);
|
||||||
this.checkExpandLinks.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.checkExpandLinks.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
|
||||||
this.checkExpandLinks.Name = "checkExpandLinks";
|
this.checkExpandLinks.Name = "checkExpandLinks";
|
||||||
this.checkExpandLinks.Size = new System.Drawing.Size(166, 17);
|
this.checkExpandLinks.Size = new System.Drawing.Size(166, 17);
|
||||||
this.checkExpandLinks.TabIndex = 14;
|
this.checkExpandLinks.TabIndex = 0;
|
||||||
this.checkExpandLinks.Text = "Expand Links When Hovered";
|
this.checkExpandLinks.Text = "Expand Links When Hovered";
|
||||||
this.toolTip.SetToolTip(this.checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a toolti" +
|
this.toolTip.SetToolTip(this.checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a toolti" +
|
||||||
"p instead.");
|
"p instead.");
|
||||||
this.checkExpandLinks.UseVisualStyleBackColor = true;
|
this.checkExpandLinks.UseVisualStyleBackColor = true;
|
||||||
this.checkExpandLinks.CheckedChanged += new System.EventHandler(this.checkExpandLinks_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// comboBoxTrayType
|
// comboBoxTrayType
|
||||||
//
|
//
|
||||||
@@ -58,57 +66,92 @@
|
|||||||
this.comboBoxTrayType.Location = new System.Drawing.Point(6, 19);
|
this.comboBoxTrayType.Location = new System.Drawing.Point(6, 19);
|
||||||
this.comboBoxTrayType.Name = "comboBoxTrayType";
|
this.comboBoxTrayType.Name = "comboBoxTrayType";
|
||||||
this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21);
|
this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21);
|
||||||
this.comboBoxTrayType.TabIndex = 13;
|
this.comboBoxTrayType.TabIndex = 0;
|
||||||
this.toolTip.SetToolTip(this.comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
|
this.toolTip.SetToolTip(this.comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
|
||||||
this.comboBoxTrayType.SelectedIndexChanged += new System.EventHandler(this.comboBoxTrayType_SelectedIndexChanged);
|
|
||||||
//
|
//
|
||||||
// checkTrayHighlight
|
// checkTrayHighlight
|
||||||
//
|
//
|
||||||
this.checkTrayHighlight.AutoSize = true;
|
this.checkTrayHighlight.AutoSize = true;
|
||||||
this.checkTrayHighlight.Location = new System.Drawing.Point(9, 70);
|
this.checkTrayHighlight.Location = new System.Drawing.Point(9, 70);
|
||||||
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
|
||||||
this.checkTrayHighlight.Name = "checkTrayHighlight";
|
this.checkTrayHighlight.Name = "checkTrayHighlight";
|
||||||
this.checkTrayHighlight.Size = new System.Drawing.Size(103, 17);
|
this.checkTrayHighlight.Size = new System.Drawing.Size(103, 17);
|
||||||
this.checkTrayHighlight.TabIndex = 15;
|
this.checkTrayHighlight.TabIndex = 2;
|
||||||
this.checkTrayHighlight.Text = "Enable Highlight";
|
this.checkTrayHighlight.Text = "Enable Highlight";
|
||||||
this.toolTip.SetToolTip(this.checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with po" +
|
this.toolTip.SetToolTip(this.checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with po" +
|
||||||
"pup or audio notifications.\r\nThe icon resets when the main window is restored.");
|
"pup or audio notifications.\r\nThe icon resets when the main window is restored.");
|
||||||
this.checkTrayHighlight.UseVisualStyleBackColor = true;
|
this.checkTrayHighlight.UseVisualStyleBackColor = true;
|
||||||
this.checkTrayHighlight.CheckedChanged += new System.EventHandler(this.checkTrayHighlight_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// checkSpellCheck
|
// checkSpellCheck
|
||||||
//
|
//
|
||||||
this.checkSpellCheck.AutoSize = true;
|
this.checkSpellCheck.AutoSize = true;
|
||||||
this.checkSpellCheck.Location = new System.Drawing.Point(9, 44);
|
this.checkSpellCheck.Location = new System.Drawing.Point(9, 67);
|
||||||
|
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkSpellCheck.Name = "checkSpellCheck";
|
this.checkSpellCheck.Name = "checkSpellCheck";
|
||||||
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
|
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
|
||||||
this.checkSpellCheck.TabIndex = 15;
|
this.checkSpellCheck.TabIndex = 2;
|
||||||
this.checkSpellCheck.Text = "Enable Spell Check";
|
this.checkSpellCheck.Text = "Enable Spell Check";
|
||||||
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||||
this.checkSpellCheck.CheckedChanged += new System.EventHandler(this.checkSpellCheck_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// checkScreenshotBorder
|
// checkUpdateNotifications
|
||||||
//
|
//
|
||||||
this.checkScreenshotBorder.AutoSize = true;
|
this.checkUpdateNotifications.AutoSize = true;
|
||||||
this.checkScreenshotBorder.Location = new System.Drawing.Point(9, 67);
|
this.checkUpdateNotifications.Location = new System.Drawing.Point(9, 21);
|
||||||
this.checkScreenshotBorder.Name = "checkScreenshotBorder";
|
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
|
||||||
this.checkScreenshotBorder.Size = new System.Drawing.Size(169, 17);
|
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
||||||
this.checkScreenshotBorder.TabIndex = 16;
|
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
|
||||||
this.checkScreenshotBorder.Text = "Include Border In Screenshots";
|
this.checkUpdateNotifications.TabIndex = 0;
|
||||||
this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots.");
|
this.checkUpdateNotifications.Text = "Check Updates Automatically";
|
||||||
this.checkScreenshotBorder.UseVisualStyleBackColor = true;
|
this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" +
|
||||||
this.checkScreenshotBorder.CheckedChanged += new System.EventHandler(this.checkScreenshotBorder_CheckedChanged);
|
"in.");
|
||||||
|
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnCheckUpdates
|
||||||
|
//
|
||||||
|
this.btnCheckUpdates.Location = new System.Drawing.Point(6, 44);
|
||||||
|
this.btnCheckUpdates.Name = "btnCheckUpdates";
|
||||||
|
this.btnCheckUpdates.Size = new System.Drawing.Size(171, 23);
|
||||||
|
this.btnCheckUpdates.TabIndex = 1;
|
||||||
|
this.btnCheckUpdates.Text = "Check Updates Now";
|
||||||
|
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
||||||
|
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// labelZoomValue
|
||||||
|
//
|
||||||
|
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.labelZoomValue.Location = new System.Drawing.Point(139, 116);
|
||||||
|
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
|
this.labelZoomValue.Name = "labelZoomValue";
|
||||||
|
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
|
||||||
|
this.labelZoomValue.TabIndex = 5;
|
||||||
|
this.labelZoomValue.Text = "100%";
|
||||||
|
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
|
||||||
|
//
|
||||||
|
// checkSwitchAccountSelectors
|
||||||
|
//
|
||||||
|
this.checkSwitchAccountSelectors.AutoSize = true;
|
||||||
|
this.checkSwitchAccountSelectors.Location = new System.Drawing.Point(9, 44);
|
||||||
|
this.checkSwitchAccountSelectors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
|
this.checkSwitchAccountSelectors.Name = "checkSwitchAccountSelectors";
|
||||||
|
this.checkSwitchAccountSelectors.Size = new System.Drawing.Size(172, 17);
|
||||||
|
this.checkSwitchAccountSelectors.TabIndex = 1;
|
||||||
|
this.checkSwitchAccountSelectors.Text = "Shift Selects Multiple Accounts";
|
||||||
|
this.toolTip.SetToolTip(this.checkSwitchAccountSelectors, "When (re)tweeting, click to select a single account or hold Shift to\r\nselect mult" +
|
||||||
|
"iple accounts, instead of TweetDeck\'s default behavior.");
|
||||||
|
this.checkSwitchAccountSelectors.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// groupTray
|
// groupTray
|
||||||
//
|
//
|
||||||
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
||||||
this.groupTray.Controls.Add(this.labelTrayIcon);
|
this.groupTray.Controls.Add(this.labelTrayIcon);
|
||||||
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
||||||
this.groupTray.Location = new System.Drawing.Point(9, 109);
|
this.groupTray.Location = new System.Drawing.Point(9, 168);
|
||||||
this.groupTray.Name = "groupTray";
|
this.groupTray.Name = "groupTray";
|
||||||
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
||||||
this.groupTray.TabIndex = 15;
|
this.groupTray.TabIndex = 1;
|
||||||
this.groupTray.TabStop = false;
|
this.groupTray.TabStop = false;
|
||||||
this.groupTray.Text = "System Tray";
|
this.groupTray.Text = "System Tray";
|
||||||
//
|
//
|
||||||
@@ -119,33 +162,84 @@
|
|||||||
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||||
this.labelTrayIcon.Name = "labelTrayIcon";
|
this.labelTrayIcon.Name = "labelTrayIcon";
|
||||||
this.labelTrayIcon.Size = new System.Drawing.Size(52, 13);
|
this.labelTrayIcon.Size = new System.Drawing.Size(52, 13);
|
||||||
this.labelTrayIcon.TabIndex = 14;
|
this.labelTrayIcon.TabIndex = 1;
|
||||||
this.labelTrayIcon.Text = "Tray Icon";
|
this.labelTrayIcon.Text = "Tray Icon";
|
||||||
//
|
//
|
||||||
// groupInterface
|
// groupInterface
|
||||||
//
|
//
|
||||||
this.groupInterface.Controls.Add(this.checkScreenshotBorder);
|
this.groupInterface.Controls.Add(this.checkSwitchAccountSelectors);
|
||||||
|
this.groupInterface.Controls.Add(this.labelZoomValue);
|
||||||
|
this.groupInterface.Controls.Add(this.trackBarZoom);
|
||||||
|
this.groupInterface.Controls.Add(this.labelZoom);
|
||||||
this.groupInterface.Controls.Add(this.checkSpellCheck);
|
this.groupInterface.Controls.Add(this.checkSpellCheck);
|
||||||
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
||||||
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
||||||
this.groupInterface.Name = "groupInterface";
|
this.groupInterface.Name = "groupInterface";
|
||||||
this.groupInterface.Size = new System.Drawing.Size(183, 90);
|
this.groupInterface.Size = new System.Drawing.Size(183, 153);
|
||||||
this.groupInterface.TabIndex = 16;
|
this.groupInterface.TabIndex = 0;
|
||||||
this.groupInterface.TabStop = false;
|
this.groupInterface.TabStop = false;
|
||||||
this.groupInterface.Text = "User Interface";
|
this.groupInterface.Text = "User Interface";
|
||||||
//
|
//
|
||||||
|
// trackBarZoom
|
||||||
|
//
|
||||||
|
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.trackBarZoom.AutoSize = false;
|
||||||
|
this.trackBarZoom.LargeChange = 25;
|
||||||
|
this.trackBarZoom.Location = new System.Drawing.Point(6, 115);
|
||||||
|
this.trackBarZoom.Maximum = 200;
|
||||||
|
this.trackBarZoom.Minimum = 50;
|
||||||
|
this.trackBarZoom.Name = "trackBarZoom";
|
||||||
|
this.trackBarZoom.Size = new System.Drawing.Size(141, 30);
|
||||||
|
this.trackBarZoom.SmallChange = 5;
|
||||||
|
this.trackBarZoom.TabIndex = 4;
|
||||||
|
this.trackBarZoom.TickFrequency = 25;
|
||||||
|
this.trackBarZoom.Value = 100;
|
||||||
|
//
|
||||||
|
// labelZoom
|
||||||
|
//
|
||||||
|
this.labelZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.labelZoom.AutoSize = true;
|
||||||
|
this.labelZoom.Location = new System.Drawing.Point(5, 99);
|
||||||
|
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
|
this.labelZoom.Name = "labelZoom";
|
||||||
|
this.labelZoom.Size = new System.Drawing.Size(34, 13);
|
||||||
|
this.labelZoom.TabIndex = 3;
|
||||||
|
this.labelZoom.Text = "Zoom";
|
||||||
|
//
|
||||||
|
// groupUpdates
|
||||||
|
//
|
||||||
|
this.groupUpdates.Controls.Add(this.checkUpdateNotifications);
|
||||||
|
this.groupUpdates.Controls.Add(this.btnCheckUpdates);
|
||||||
|
this.groupUpdates.Location = new System.Drawing.Point(198, 9);
|
||||||
|
this.groupUpdates.Name = "groupUpdates";
|
||||||
|
this.groupUpdates.Size = new System.Drawing.Size(183, 75);
|
||||||
|
this.groupUpdates.TabIndex = 2;
|
||||||
|
this.groupUpdates.TabStop = false;
|
||||||
|
this.groupUpdates.Text = "Updates";
|
||||||
|
//
|
||||||
|
// zoomUpdateTimer
|
||||||
|
//
|
||||||
|
this.zoomUpdateTimer.Interval = 250;
|
||||||
|
this.zoomUpdateTimer.Tick += new System.EventHandler(this.zoomUpdateTimer_Tick);
|
||||||
|
//
|
||||||
// TabSettingsGeneral
|
// TabSettingsGeneral
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.groupUpdates);
|
||||||
this.Controls.Add(this.groupInterface);
|
this.Controls.Add(this.groupInterface);
|
||||||
this.Controls.Add(this.groupTray);
|
this.Controls.Add(this.groupTray);
|
||||||
this.Name = "TabSettingsGeneral";
|
this.Name = "TabSettingsGeneral";
|
||||||
this.Size = new System.Drawing.Size(478, 282);
|
this.Size = new System.Drawing.Size(478, 300);
|
||||||
this.groupTray.ResumeLayout(false);
|
this.groupTray.ResumeLayout(false);
|
||||||
this.groupTray.PerformLayout();
|
this.groupTray.PerformLayout();
|
||||||
this.groupInterface.ResumeLayout(false);
|
this.groupInterface.ResumeLayout(false);
|
||||||
this.groupInterface.PerformLayout();
|
this.groupInterface.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.trackBarZoom)).EndInit();
|
||||||
|
this.groupUpdates.ResumeLayout(false);
|
||||||
|
this.groupUpdates.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -160,6 +254,13 @@
|
|||||||
private System.Windows.Forms.Label labelTrayIcon;
|
private System.Windows.Forms.Label labelTrayIcon;
|
||||||
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
||||||
private System.Windows.Forms.CheckBox checkSpellCheck;
|
private System.Windows.Forms.CheckBox checkSpellCheck;
|
||||||
private System.Windows.Forms.CheckBox checkScreenshotBorder;
|
private System.Windows.Forms.GroupBox groupUpdates;
|
||||||
|
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
||||||
|
private System.Windows.Forms.Button btnCheckUpdates;
|
||||||
|
private System.Windows.Forms.Label labelZoom;
|
||||||
|
private System.Windows.Forms.Label labelZoomValue;
|
||||||
|
private System.Windows.Forms.TrackBar trackBarZoom;
|
||||||
|
private System.Windows.Forms.Timer zoomUpdateTimer;
|
||||||
|
private System.Windows.Forms.CheckBox checkSwitchAccountSelectors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Updates;
|
||||||
|
using TweetDuck.Updates.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsGeneral : BaseTabSettings{
|
partial class TabSettingsGeneral : BaseTabSettings{
|
||||||
public TabSettingsGeneral(){
|
private readonly UpdateHandler updates;
|
||||||
|
private int updateCheckEventId = -1;
|
||||||
|
|
||||||
|
public TabSettingsGeneral(UpdateHandler updates){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.updates = updates;
|
||||||
|
this.updates.CheckFinished += updates_CheckFinished;
|
||||||
|
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
|
||||||
|
|
||||||
comboBoxTrayType.Items.Add("Disabled");
|
comboBoxTrayType.Items.Add("Disabled");
|
||||||
comboBoxTrayType.Items.Add("Display Icon Only");
|
comboBoxTrayType.Items.Add("Display Icon Only");
|
||||||
comboBoxTrayType.Items.Add("Minimize to Tray");
|
comboBoxTrayType.Items.Add("Minimize to Tray");
|
||||||
@@ -12,41 +23,96 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
comboBoxTrayType.Items.Add("Combined");
|
comboBoxTrayType.Items.Add("Combined");
|
||||||
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
|
||||||
|
|
||||||
|
toolTip.SetToolTip(trackBarZoom, toolTip.GetToolTip(labelZoomValue));
|
||||||
|
trackBarZoom.SetValueSafe(Config.ZoomLevel);
|
||||||
|
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||||
|
|
||||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||||
|
checkSwitchAccountSelectors.Checked = Config.SwitchAccountSelectors;
|
||||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||||
checkScreenshotBorder.Checked = Config.ShowScreenshotBorder;
|
|
||||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||||
|
|
||||||
|
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnReady(){
|
||||||
|
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||||
|
checkSwitchAccountSelectors.CheckedChanged += checkSwitchAccountSelectors_CheckedChanged;
|
||||||
|
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||||
|
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
|
||||||
|
|
||||||
|
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
|
||||||
|
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
|
||||||
|
|
||||||
|
checkUpdateNotifications.CheckedChanged += checkUpdateNotifications_CheckedChanged;
|
||||||
|
btnCheckUpdates.Click += btnCheckUpdates_Click;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnClosing(){
|
||||||
|
Config.ZoomLevel = trackBarZoom.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
|
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
private void checkSwitchAccountSelectors_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
Config.SwitchAccountSelectors = checkSwitchAccountSelectors.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
||||||
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){
|
private void trackBarZoom_ValueChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
if (trackBarZoom.Value % trackBarZoom.SmallChange != 0){
|
||||||
|
trackBarZoom.Value = trackBarZoom.SmallChange*(int)Math.Floor(((double)trackBarZoom.Value/trackBarZoom.SmallChange)+0.5);
|
||||||
Config.ShowScreenshotBorder = checkScreenshotBorder.Checked;
|
}
|
||||||
|
else{
|
||||||
|
zoomUpdateTimer.Stop();
|
||||||
|
zoomUpdateTimer.Start();
|
||||||
|
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
|
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
|
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
|
||||||
|
Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCheckUpdates_Click(object sender, EventArgs e){
|
||||||
|
updateCheckEventId = updates.Check(true);
|
||||||
|
|
||||||
|
if (updateCheckEventId == -1){
|
||||||
|
MessageBox.Show("Sorry, your system is no longer supported.", "Unsupported System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
btnCheckUpdates.Enabled = false;
|
||||||
|
updates.DismissUpdate(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
|
||||||
|
if (e.EventId == updateCheckEventId){
|
||||||
|
btnCheckUpdates.Enabled = true;
|
||||||
|
|
||||||
|
if (!e.UpdateAvailable){
|
||||||
|
MessageBox.Show("Your version of "+Program.BrandName+" is up to date.", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void zoomUpdateTimer_Tick(object sender, EventArgs e){
|
||||||
|
Config.ZoomLevel = trackBarZoom.Value;
|
||||||
|
zoomUpdateTimer.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
243
Core/Other/Settings/TabSettingsNotifications.Designer.cs
generated
243
Core/Other/Settings/TabSettingsNotifications.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsNotifications {
|
partial class TabSettingsNotifications {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -37,26 +37,26 @@
|
|||||||
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
||||||
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
||||||
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.btnDurationMedium = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationMedium = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.btnDurationLong = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationLong = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.btnDurationShort = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationShort = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.labelDurationValue = new System.Windows.Forms.Label();
|
this.labelDurationValue = new System.Windows.Forms.Label();
|
||||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||||
|
this.checkSkipOnLinkClick = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkColumnName = new System.Windows.Forms.CheckBox();
|
||||||
|
this.labelIdlePause = new System.Windows.Forms.Label();
|
||||||
|
this.comboBoxIdlePause = new System.Windows.Forms.ComboBox();
|
||||||
|
this.checkNonIntrusive = new System.Windows.Forms.CheckBox();
|
||||||
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
||||||
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.groupCustomSound = new System.Windows.Forms.GroupBox();
|
|
||||||
this.btnResetSound = new System.Windows.Forms.Button();
|
|
||||||
this.btnBrowseSound = new System.Windows.Forms.Button();
|
|
||||||
this.tbCustomSound = new System.Windows.Forms.TextBox();
|
|
||||||
this.groupNotificationLocation.SuspendLayout();
|
this.groupNotificationLocation.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
||||||
this.groupNotificationDuration.SuspendLayout();
|
this.groupNotificationDuration.SuspendLayout();
|
||||||
this.tableLayoutDurationButtons.SuspendLayout();
|
this.tableLayoutDurationButtons.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).BeginInit();
|
||||||
this.groupUserInterface.SuspendLayout();
|
this.groupUserInterface.SuspendLayout();
|
||||||
this.groupCustomSound.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupNotificationLocation
|
// groupNotificationLocation
|
||||||
@@ -73,30 +73,30 @@
|
|||||||
this.groupNotificationLocation.Controls.Add(this.trackBarEdgeDistance);
|
this.groupNotificationLocation.Controls.Add(this.trackBarEdgeDistance);
|
||||||
this.groupNotificationLocation.Location = new System.Drawing.Point(198, 9);
|
this.groupNotificationLocation.Location = new System.Drawing.Point(198, 9);
|
||||||
this.groupNotificationLocation.Name = "groupNotificationLocation";
|
this.groupNotificationLocation.Name = "groupNotificationLocation";
|
||||||
this.groupNotificationLocation.Size = new System.Drawing.Size(183, 264);
|
this.groupNotificationLocation.Size = new System.Drawing.Size(183, 282);
|
||||||
this.groupNotificationLocation.TabIndex = 1;
|
this.groupNotificationLocation.TabIndex = 2;
|
||||||
this.groupNotificationLocation.TabStop = false;
|
this.groupNotificationLocation.TabStop = false;
|
||||||
this.groupNotificationLocation.Text = "Location";
|
this.groupNotificationLocation.Text = "Location";
|
||||||
//
|
//
|
||||||
// labelEdgeDistanceValue
|
// labelEdgeDistanceValue
|
||||||
//
|
//
|
||||||
this.labelEdgeDistanceValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.labelEdgeDistanceValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.labelEdgeDistanceValue.Location = new System.Drawing.Point(143, 214);
|
this.labelEdgeDistanceValue.Location = new System.Drawing.Point(143, 217);
|
||||||
this.labelEdgeDistanceValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
this.labelEdgeDistanceValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue";
|
this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue";
|
||||||
this.labelEdgeDistanceValue.Size = new System.Drawing.Size(34, 13);
|
this.labelEdgeDistanceValue.Size = new System.Drawing.Size(34, 13);
|
||||||
this.labelEdgeDistanceValue.TabIndex = 11;
|
this.labelEdgeDistanceValue.TabIndex = 9;
|
||||||
this.labelEdgeDistanceValue.Text = "0 px";
|
this.labelEdgeDistanceValue.Text = "0 px";
|
||||||
this.labelEdgeDistanceValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
this.labelEdgeDistanceValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// labelDisplay
|
// labelDisplay
|
||||||
//
|
//
|
||||||
this.labelDisplay.AutoSize = true;
|
this.labelDisplay.AutoSize = true;
|
||||||
this.labelDisplay.Location = new System.Drawing.Point(3, 148);
|
this.labelDisplay.Location = new System.Drawing.Point(5, 144);
|
||||||
this.labelDisplay.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
this.labelDisplay.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelDisplay.Name = "labelDisplay";
|
this.labelDisplay.Name = "labelDisplay";
|
||||||
this.labelDisplay.Size = new System.Drawing.Size(41, 13);
|
this.labelDisplay.Size = new System.Drawing.Size(41, 13);
|
||||||
this.labelDisplay.TabIndex = 8;
|
this.labelDisplay.TabIndex = 5;
|
||||||
this.labelDisplay.Text = "Display";
|
this.labelDisplay.Text = "Display";
|
||||||
//
|
//
|
||||||
// comboBoxDisplay
|
// comboBoxDisplay
|
||||||
@@ -105,26 +105,26 @@
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxDisplay.FormattingEnabled = true;
|
this.comboBoxDisplay.FormattingEnabled = true;
|
||||||
this.comboBoxDisplay.Location = new System.Drawing.Point(6, 164);
|
this.comboBoxDisplay.Location = new System.Drawing.Point(6, 160);
|
||||||
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
this.comboBoxDisplay.Name = "comboBoxDisplay";
|
||||||
this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21);
|
this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21);
|
||||||
this.comboBoxDisplay.TabIndex = 7;
|
this.comboBoxDisplay.TabIndex = 6;
|
||||||
this.comboBoxDisplay.SelectedValueChanged += new System.EventHandler(this.comboBoxDisplay_SelectedValueChanged);
|
|
||||||
//
|
//
|
||||||
// labelEdgeDistance
|
// labelEdgeDistance
|
||||||
//
|
//
|
||||||
this.labelEdgeDistance.AutoSize = true;
|
this.labelEdgeDistance.AutoSize = true;
|
||||||
this.labelEdgeDistance.Location = new System.Drawing.Point(3, 197);
|
this.labelEdgeDistance.Location = new System.Drawing.Point(5, 196);
|
||||||
this.labelEdgeDistance.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
this.labelEdgeDistance.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelEdgeDistance.Name = "labelEdgeDistance";
|
this.labelEdgeDistance.Name = "labelEdgeDistance";
|
||||||
this.labelEdgeDistance.Size = new System.Drawing.Size(103, 13);
|
this.labelEdgeDistance.Size = new System.Drawing.Size(103, 13);
|
||||||
this.labelEdgeDistance.TabIndex = 6;
|
this.labelEdgeDistance.TabIndex = 7;
|
||||||
this.labelEdgeDistance.Text = "Distance From Edge";
|
this.labelEdgeDistance.Text = "Distance From Edge";
|
||||||
//
|
//
|
||||||
// radioLocCustom
|
// radioLocCustom
|
||||||
//
|
//
|
||||||
this.radioLocCustom.AutoSize = true;
|
this.radioLocCustom.AutoSize = true;
|
||||||
this.radioLocCustom.Location = new System.Drawing.Point(7, 116);
|
this.radioLocCustom.Location = new System.Drawing.Point(8, 112);
|
||||||
|
this.radioLocCustom.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||||
this.radioLocCustom.Name = "radioLocCustom";
|
this.radioLocCustom.Name = "radioLocCustom";
|
||||||
this.radioLocCustom.Size = new System.Drawing.Size(60, 17);
|
this.radioLocCustom.Size = new System.Drawing.Size(60, 17);
|
||||||
this.radioLocCustom.TabIndex = 4;
|
this.radioLocCustom.TabIndex = 4;
|
||||||
@@ -132,81 +132,80 @@
|
|||||||
this.radioLocCustom.Text = "Custom";
|
this.radioLocCustom.Text = "Custom";
|
||||||
this.toolTip.SetToolTip(this.radioLocCustom, "Drag the notification window to the desired location.");
|
this.toolTip.SetToolTip(this.radioLocCustom, "Drag the notification window to the desired location.");
|
||||||
this.radioLocCustom.UseVisualStyleBackColor = true;
|
this.radioLocCustom.UseVisualStyleBackColor = true;
|
||||||
this.radioLocCustom.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// radioLocBR
|
// radioLocBR
|
||||||
//
|
//
|
||||||
this.radioLocBR.AutoSize = true;
|
this.radioLocBR.AutoSize = true;
|
||||||
this.radioLocBR.Location = new System.Drawing.Point(7, 92);
|
this.radioLocBR.Location = new System.Drawing.Point(8, 89);
|
||||||
|
this.radioLocBR.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||||
this.radioLocBR.Name = "radioLocBR";
|
this.radioLocBR.Name = "radioLocBR";
|
||||||
this.radioLocBR.Size = new System.Drawing.Size(86, 17);
|
this.radioLocBR.Size = new System.Drawing.Size(86, 17);
|
||||||
this.radioLocBR.TabIndex = 3;
|
this.radioLocBR.TabIndex = 3;
|
||||||
this.radioLocBR.TabStop = true;
|
this.radioLocBR.TabStop = true;
|
||||||
this.radioLocBR.Text = "Bottom Right";
|
this.radioLocBR.Text = "Bottom Right";
|
||||||
this.radioLocBR.UseVisualStyleBackColor = true;
|
this.radioLocBR.UseVisualStyleBackColor = true;
|
||||||
this.radioLocBR.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// radioLocBL
|
// radioLocBL
|
||||||
//
|
//
|
||||||
this.radioLocBL.AutoSize = true;
|
this.radioLocBL.AutoSize = true;
|
||||||
this.radioLocBL.Location = new System.Drawing.Point(7, 68);
|
this.radioLocBL.Location = new System.Drawing.Point(8, 66);
|
||||||
|
this.radioLocBL.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||||
this.radioLocBL.Name = "radioLocBL";
|
this.radioLocBL.Name = "radioLocBL";
|
||||||
this.radioLocBL.Size = new System.Drawing.Size(79, 17);
|
this.radioLocBL.Size = new System.Drawing.Size(79, 17);
|
||||||
this.radioLocBL.TabIndex = 2;
|
this.radioLocBL.TabIndex = 2;
|
||||||
this.radioLocBL.TabStop = true;
|
this.radioLocBL.TabStop = true;
|
||||||
this.radioLocBL.Text = "Bottom Left";
|
this.radioLocBL.Text = "Bottom Left";
|
||||||
this.radioLocBL.UseVisualStyleBackColor = true;
|
this.radioLocBL.UseVisualStyleBackColor = true;
|
||||||
this.radioLocBL.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// radioLocTR
|
// radioLocTR
|
||||||
//
|
//
|
||||||
this.radioLocTR.AutoSize = true;
|
this.radioLocTR.AutoSize = true;
|
||||||
this.radioLocTR.Location = new System.Drawing.Point(7, 44);
|
this.radioLocTR.Location = new System.Drawing.Point(8, 43);
|
||||||
|
this.radioLocTR.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
|
||||||
this.radioLocTR.Name = "radioLocTR";
|
this.radioLocTR.Name = "radioLocTR";
|
||||||
this.radioLocTR.Size = new System.Drawing.Size(72, 17);
|
this.radioLocTR.Size = new System.Drawing.Size(72, 17);
|
||||||
this.radioLocTR.TabIndex = 1;
|
this.radioLocTR.TabIndex = 1;
|
||||||
this.radioLocTR.TabStop = true;
|
this.radioLocTR.TabStop = true;
|
||||||
this.radioLocTR.Text = "Top Right";
|
this.radioLocTR.Text = "Top Right";
|
||||||
this.radioLocTR.UseVisualStyleBackColor = true;
|
this.radioLocTR.UseVisualStyleBackColor = true;
|
||||||
this.radioLocTR.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// radioLocTL
|
// radioLocTL
|
||||||
//
|
//
|
||||||
this.radioLocTL.AutoSize = true;
|
this.radioLocTL.AutoSize = true;
|
||||||
this.radioLocTL.Location = new System.Drawing.Point(7, 20);
|
this.radioLocTL.Location = new System.Drawing.Point(8, 20);
|
||||||
|
this.radioLocTL.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
|
||||||
this.radioLocTL.Name = "radioLocTL";
|
this.radioLocTL.Name = "radioLocTL";
|
||||||
this.radioLocTL.Size = new System.Drawing.Size(65, 17);
|
this.radioLocTL.Size = new System.Drawing.Size(65, 17);
|
||||||
this.radioLocTL.TabIndex = 0;
|
this.radioLocTL.TabIndex = 0;
|
||||||
this.radioLocTL.TabStop = true;
|
this.radioLocTL.TabStop = true;
|
||||||
this.radioLocTL.Text = "Top Left";
|
this.radioLocTL.Text = "Top Left";
|
||||||
this.radioLocTL.UseVisualStyleBackColor = true;
|
this.radioLocTL.UseVisualStyleBackColor = true;
|
||||||
this.radioLocTL.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// trackBarEdgeDistance
|
// trackBarEdgeDistance
|
||||||
//
|
//
|
||||||
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBarEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.trackBarEdgeDistance.AutoSize = false;
|
||||||
this.trackBarEdgeDistance.LargeChange = 8;
|
this.trackBarEdgeDistance.LargeChange = 8;
|
||||||
this.trackBarEdgeDistance.Location = new System.Drawing.Point(6, 213);
|
this.trackBarEdgeDistance.Location = new System.Drawing.Point(8, 212);
|
||||||
this.trackBarEdgeDistance.Maximum = 40;
|
this.trackBarEdgeDistance.Maximum = 40;
|
||||||
this.trackBarEdgeDistance.Minimum = 8;
|
this.trackBarEdgeDistance.Minimum = 8;
|
||||||
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
|
||||||
this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 45);
|
this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 30);
|
||||||
this.trackBarEdgeDistance.SmallChange = 2;
|
this.trackBarEdgeDistance.SmallChange = 2;
|
||||||
this.trackBarEdgeDistance.TabIndex = 5;
|
this.trackBarEdgeDistance.TabIndex = 8;
|
||||||
this.trackBarEdgeDistance.TickFrequency = 4;
|
this.trackBarEdgeDistance.TickFrequency = 4;
|
||||||
this.trackBarEdgeDistance.Value = 8;
|
this.trackBarEdgeDistance.Value = 8;
|
||||||
this.trackBarEdgeDistance.ValueChanged += new System.EventHandler(this.trackBarEdgeDistance_ValueChanged);
|
|
||||||
//
|
//
|
||||||
// groupNotificationDuration
|
// groupNotificationDuration
|
||||||
//
|
//
|
||||||
this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons);
|
this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons);
|
||||||
this.groupNotificationDuration.Controls.Add(this.labelDurationValue);
|
this.groupNotificationDuration.Controls.Add(this.labelDurationValue);
|
||||||
this.groupNotificationDuration.Controls.Add(this.trackBarDuration);
|
this.groupNotificationDuration.Controls.Add(this.trackBarDuration);
|
||||||
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 83);
|
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 202);
|
||||||
this.groupNotificationDuration.Name = "groupNotificationDuration";
|
this.groupNotificationDuration.Name = "groupNotificationDuration";
|
||||||
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89);
|
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89);
|
||||||
this.groupNotificationDuration.TabIndex = 9;
|
this.groupNotificationDuration.TabIndex = 1;
|
||||||
this.groupNotificationDuration.TabStop = false;
|
this.groupNotificationDuration.TabStop = false;
|
||||||
this.groupNotificationDuration.Text = "Duration";
|
this.groupNotificationDuration.Text = "Duration";
|
||||||
//
|
//
|
||||||
@@ -226,7 +225,7 @@
|
|||||||
this.tableLayoutDurationButtons.RowCount = 1;
|
this.tableLayoutDurationButtons.RowCount = 1;
|
||||||
this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tableLayoutDurationButtons.Size = new System.Drawing.Size(171, 27);
|
this.tableLayoutDurationButtons.Size = new System.Drawing.Size(171, 27);
|
||||||
this.tableLayoutDurationButtons.TabIndex = 5;
|
this.tableLayoutDurationButtons.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// btnDurationMedium
|
// btnDurationMedium
|
||||||
//
|
//
|
||||||
@@ -239,10 +238,9 @@
|
|||||||
this.btnDurationMedium.Margin = new System.Windows.Forms.Padding(1);
|
this.btnDurationMedium.Margin = new System.Windows.Forms.Padding(1);
|
||||||
this.btnDurationMedium.Name = "btnDurationMedium";
|
this.btnDurationMedium.Name = "btnDurationMedium";
|
||||||
this.btnDurationMedium.Size = new System.Drawing.Size(59, 25);
|
this.btnDurationMedium.Size = new System.Drawing.Size(59, 25);
|
||||||
this.btnDurationMedium.TabIndex = 2;
|
this.btnDurationMedium.TabIndex = 1;
|
||||||
this.btnDurationMedium.Text = "Medium";
|
this.btnDurationMedium.Text = "Medium";
|
||||||
this.btnDurationMedium.UseVisualStyleBackColor = true;
|
this.btnDurationMedium.UseVisualStyleBackColor = true;
|
||||||
this.btnDurationMedium.Click += new System.EventHandler(this.btnDurationMedium_Click);
|
|
||||||
//
|
//
|
||||||
// btnDurationLong
|
// btnDurationLong
|
||||||
//
|
//
|
||||||
@@ -255,10 +253,9 @@
|
|||||||
this.btnDurationLong.Margin = new System.Windows.Forms.Padding(1);
|
this.btnDurationLong.Margin = new System.Windows.Forms.Padding(1);
|
||||||
this.btnDurationLong.Name = "btnDurationLong";
|
this.btnDurationLong.Name = "btnDurationLong";
|
||||||
this.btnDurationLong.Size = new System.Drawing.Size(54, 25);
|
this.btnDurationLong.Size = new System.Drawing.Size(54, 25);
|
||||||
this.btnDurationLong.TabIndex = 1;
|
this.btnDurationLong.TabIndex = 2;
|
||||||
this.btnDurationLong.Text = "Long";
|
this.btnDurationLong.Text = "Long";
|
||||||
this.btnDurationLong.UseVisualStyleBackColor = true;
|
this.btnDurationLong.UseVisualStyleBackColor = true;
|
||||||
this.btnDurationLong.Click += new System.EventHandler(this.btnDurationLong_Click);
|
|
||||||
//
|
//
|
||||||
// btnDurationShort
|
// btnDurationShort
|
||||||
//
|
//
|
||||||
@@ -274,7 +271,6 @@
|
|||||||
this.btnDurationShort.TabIndex = 0;
|
this.btnDurationShort.TabIndex = 0;
|
||||||
this.btnDurationShort.Text = "Short";
|
this.btnDurationShort.Text = "Short";
|
||||||
this.btnDurationShort.UseVisualStyleBackColor = true;
|
this.btnDurationShort.UseVisualStyleBackColor = true;
|
||||||
this.btnDurationShort.Click += new System.EventHandler(this.btnDurationShort_Click);
|
|
||||||
//
|
//
|
||||||
// labelDurationValue
|
// labelDurationValue
|
||||||
//
|
//
|
||||||
@@ -284,7 +280,7 @@
|
|||||||
this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
this.labelDurationValue.Name = "labelDurationValue";
|
this.labelDurationValue.Name = "labelDurationValue";
|
||||||
this.labelDurationValue.Size = new System.Drawing.Size(48, 13);
|
this.labelDurationValue.Size = new System.Drawing.Size(48, 13);
|
||||||
this.labelDurationValue.TabIndex = 13;
|
this.labelDurationValue.TabIndex = 1;
|
||||||
this.labelDurationValue.Text = "0 ms/c";
|
this.labelDurationValue.Text = "0 ms/c";
|
||||||
this.labelDurationValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
this.labelDurationValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
this.toolTip.SetToolTip(this.labelDurationValue, "Milliseconds per character.");
|
this.toolTip.SetToolTip(this.labelDurationValue, "Milliseconds per character.");
|
||||||
@@ -293,118 +289,134 @@
|
|||||||
//
|
//
|
||||||
this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.trackBarDuration.AutoSize = false;
|
||||||
this.trackBarDuration.Location = new System.Drawing.Point(6, 19);
|
this.trackBarDuration.Location = new System.Drawing.Point(6, 19);
|
||||||
this.trackBarDuration.Maximum = 60;
|
this.trackBarDuration.Maximum = 60;
|
||||||
this.trackBarDuration.Minimum = 10;
|
this.trackBarDuration.Minimum = 10;
|
||||||
this.trackBarDuration.Name = "trackBarDuration";
|
this.trackBarDuration.Name = "trackBarDuration";
|
||||||
this.trackBarDuration.Size = new System.Drawing.Size(128, 45);
|
this.trackBarDuration.Size = new System.Drawing.Size(128, 30);
|
||||||
this.trackBarDuration.TabIndex = 12;
|
this.trackBarDuration.TabIndex = 0;
|
||||||
this.trackBarDuration.TickFrequency = 5;
|
this.trackBarDuration.TickFrequency = 5;
|
||||||
this.trackBarDuration.Value = 25;
|
this.trackBarDuration.Value = 25;
|
||||||
this.trackBarDuration.ValueChanged += new System.EventHandler(this.trackBarDuration_ValueChanged);
|
|
||||||
//
|
//
|
||||||
// groupUserInterface
|
// groupUserInterface
|
||||||
//
|
//
|
||||||
|
this.groupUserInterface.Controls.Add(this.checkSkipOnLinkClick);
|
||||||
|
this.groupUserInterface.Controls.Add(this.checkColumnName);
|
||||||
|
this.groupUserInterface.Controls.Add(this.labelIdlePause);
|
||||||
|
this.groupUserInterface.Controls.Add(this.comboBoxIdlePause);
|
||||||
|
this.groupUserInterface.Controls.Add(this.checkNonIntrusive);
|
||||||
this.groupUserInterface.Controls.Add(this.checkTimerCountDown);
|
this.groupUserInterface.Controls.Add(this.checkTimerCountDown);
|
||||||
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
|
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
|
||||||
this.groupUserInterface.Location = new System.Drawing.Point(9, 9);
|
this.groupUserInterface.Location = new System.Drawing.Point(9, 9);
|
||||||
this.groupUserInterface.Name = "groupUserInterface";
|
this.groupUserInterface.Name = "groupUserInterface";
|
||||||
this.groupUserInterface.Size = new System.Drawing.Size(183, 68);
|
this.groupUserInterface.Size = new System.Drawing.Size(183, 187);
|
||||||
this.groupUserInterface.TabIndex = 10;
|
this.groupUserInterface.TabIndex = 0;
|
||||||
this.groupUserInterface.TabStop = false;
|
this.groupUserInterface.TabStop = false;
|
||||||
this.groupUserInterface.Text = "General";
|
this.groupUserInterface.Text = "General";
|
||||||
//
|
//
|
||||||
|
// checkSkipOnLinkClick
|
||||||
|
//
|
||||||
|
this.checkSkipOnLinkClick.AutoSize = true;
|
||||||
|
this.checkSkipOnLinkClick.Location = new System.Drawing.Point(9, 90);
|
||||||
|
this.checkSkipOnLinkClick.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
|
this.checkSkipOnLinkClick.Name = "checkSkipOnLinkClick";
|
||||||
|
this.checkSkipOnLinkClick.Size = new System.Drawing.Size(113, 17);
|
||||||
|
this.checkSkipOnLinkClick.TabIndex = 3;
|
||||||
|
this.checkSkipOnLinkClick.Text = "Skip On Link Click";
|
||||||
|
this.toolTip.SetToolTip(this.checkSkipOnLinkClick, "Skips current notification when a link\r\ninside the notification is clicked.");
|
||||||
|
this.checkSkipOnLinkClick.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkColumnName
|
||||||
|
//
|
||||||
|
this.checkColumnName.AutoSize = true;
|
||||||
|
this.checkColumnName.Location = new System.Drawing.Point(9, 21);
|
||||||
|
this.checkColumnName.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
|
||||||
|
this.checkColumnName.Name = "checkColumnName";
|
||||||
|
this.checkColumnName.Size = new System.Drawing.Size(129, 17);
|
||||||
|
this.checkColumnName.TabIndex = 0;
|
||||||
|
this.checkColumnName.Text = "Display Column Name";
|
||||||
|
this.toolTip.SetToolTip(this.checkColumnName, "Shows column name each notification originated\r\nfrom in the notification window t" +
|
||||||
|
"itle.");
|
||||||
|
this.checkColumnName.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// labelIdlePause
|
||||||
|
//
|
||||||
|
this.labelIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.labelIdlePause.AutoSize = true;
|
||||||
|
this.labelIdlePause.Location = new System.Drawing.Point(5, 141);
|
||||||
|
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
|
this.labelIdlePause.Name = "labelIdlePause";
|
||||||
|
this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
|
||||||
|
this.labelIdlePause.TabIndex = 3;
|
||||||
|
this.labelIdlePause.Text = "Pause When Idle";
|
||||||
|
//
|
||||||
|
// comboBoxIdlePause
|
||||||
|
//
|
||||||
|
this.comboBoxIdlePause.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxIdlePause.FormattingEnabled = true;
|
||||||
|
this.comboBoxIdlePause.Location = new System.Drawing.Point(6, 157);
|
||||||
|
this.comboBoxIdlePause.Name = "comboBoxIdlePause";
|
||||||
|
this.comboBoxIdlePause.Size = new System.Drawing.Size(171, 21);
|
||||||
|
this.comboBoxIdlePause.TabIndex = 4;
|
||||||
|
this.toolTip.SetToolTip(this.comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time.");
|
||||||
|
//
|
||||||
|
// checkNonIntrusive
|
||||||
|
//
|
||||||
|
this.checkNonIntrusive.AutoSize = true;
|
||||||
|
this.checkNonIntrusive.Location = new System.Drawing.Point(9, 113);
|
||||||
|
this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
|
this.checkNonIntrusive.Name = "checkNonIntrusive";
|
||||||
|
this.checkNonIntrusive.Size = new System.Drawing.Size(128, 17);
|
||||||
|
this.checkNonIntrusive.TabIndex = 4;
|
||||||
|
this.checkNonIntrusive.Text = "Non-Intrusive Popups";
|
||||||
|
this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " +
|
||||||
|
"delayed until the cursor moves away to prevent accidental clicks.");
|
||||||
|
this.checkNonIntrusive.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// checkTimerCountDown
|
// checkTimerCountDown
|
||||||
//
|
//
|
||||||
this.checkTimerCountDown.AutoSize = true;
|
this.checkTimerCountDown.AutoSize = true;
|
||||||
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 44);
|
this.checkTimerCountDown.Location = new System.Drawing.Point(9, 67);
|
||||||
|
this.checkTimerCountDown.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkTimerCountDown.Name = "checkTimerCountDown";
|
this.checkTimerCountDown.Name = "checkTimerCountDown";
|
||||||
this.checkTimerCountDown.Size = new System.Drawing.Size(119, 17);
|
this.checkTimerCountDown.Size = new System.Drawing.Size(119, 17);
|
||||||
this.checkTimerCountDown.TabIndex = 6;
|
this.checkTimerCountDown.TabIndex = 2;
|
||||||
this.checkTimerCountDown.Text = "Timer Counts Down";
|
this.checkTimerCountDown.Text = "Timer Counts Down";
|
||||||
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
|
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
|
||||||
this.checkTimerCountDown.UseVisualStyleBackColor = true;
|
this.checkTimerCountDown.UseVisualStyleBackColor = true;
|
||||||
this.checkTimerCountDown.CheckedChanged += new System.EventHandler(this.checkTimerCountDown_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// checkNotificationTimer
|
// checkNotificationTimer
|
||||||
//
|
//
|
||||||
this.checkNotificationTimer.AutoSize = true;
|
this.checkNotificationTimer.AutoSize = true;
|
||||||
this.checkNotificationTimer.Location = new System.Drawing.Point(6, 21);
|
this.checkNotificationTimer.Location = new System.Drawing.Point(9, 44);
|
||||||
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
this.checkNotificationTimer.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
this.checkNotificationTimer.Name = "checkNotificationTimer";
|
||||||
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
|
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
|
||||||
this.checkNotificationTimer.TabIndex = 4;
|
this.checkNotificationTimer.TabIndex = 1;
|
||||||
this.checkNotificationTimer.Text = "Display Notification Timer";
|
this.checkNotificationTimer.Text = "Display Notification Timer";
|
||||||
this.toolTip.SetToolTip(this.checkNotificationTimer, "Shows how much time is left before the current notification disappears.");
|
|
||||||
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
this.checkNotificationTimer.UseVisualStyleBackColor = true;
|
||||||
this.checkNotificationTimer.CheckedChanged += new System.EventHandler(this.checkNotificationTimer_CheckedChanged);
|
|
||||||
//
|
|
||||||
// groupCustomSound
|
|
||||||
//
|
|
||||||
this.groupCustomSound.Controls.Add(this.btnResetSound);
|
|
||||||
this.groupCustomSound.Controls.Add(this.btnBrowseSound);
|
|
||||||
this.groupCustomSound.Controls.Add(this.tbCustomSound);
|
|
||||||
this.groupCustomSound.Location = new System.Drawing.Point(9, 178);
|
|
||||||
this.groupCustomSound.Name = "groupCustomSound";
|
|
||||||
this.groupCustomSound.Size = new System.Drawing.Size(183, 72);
|
|
||||||
this.groupCustomSound.TabIndex = 11;
|
|
||||||
this.groupCustomSound.TabStop = false;
|
|
||||||
this.groupCustomSound.Text = "Custom Sound";
|
|
||||||
//
|
|
||||||
// btnResetSound
|
|
||||||
//
|
|
||||||
this.btnResetSound.AutoSize = true;
|
|
||||||
this.btnResetSound.Location = new System.Drawing.Point(126, 43);
|
|
||||||
this.btnResetSound.Name = "btnResetSound";
|
|
||||||
this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
|
||||||
this.btnResetSound.Size = new System.Drawing.Size(51, 23);
|
|
||||||
this.btnResetSound.TabIndex = 2;
|
|
||||||
this.btnResetSound.Text = "Reset";
|
|
||||||
this.btnResetSound.UseVisualStyleBackColor = true;
|
|
||||||
this.btnResetSound.Click += new System.EventHandler(this.btnResetSound_Click);
|
|
||||||
//
|
|
||||||
// btnBrowseSound
|
|
||||||
//
|
|
||||||
this.btnBrowseSound.AutoSize = true;
|
|
||||||
this.btnBrowseSound.Location = new System.Drawing.Point(53, 43);
|
|
||||||
this.btnBrowseSound.Name = "btnBrowseSound";
|
|
||||||
this.btnBrowseSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
|
||||||
this.btnBrowseSound.Size = new System.Drawing.Size(67, 23);
|
|
||||||
this.btnBrowseSound.TabIndex = 1;
|
|
||||||
this.btnBrowseSound.Text = "Browse...";
|
|
||||||
this.btnBrowseSound.UseVisualStyleBackColor = true;
|
|
||||||
this.btnBrowseSound.Click += new System.EventHandler(this.btnBrowseSound_Click);
|
|
||||||
//
|
|
||||||
// tbCustomSound
|
|
||||||
//
|
|
||||||
this.tbCustomSound.Location = new System.Drawing.Point(6, 19);
|
|
||||||
this.tbCustomSound.Name = "tbCustomSound";
|
|
||||||
this.tbCustomSound.Size = new System.Drawing.Size(170, 20);
|
|
||||||
this.tbCustomSound.TabIndex = 0;
|
|
||||||
this.tbCustomSound.TextChanged += new System.EventHandler(this.tbCustomSound_TextChanged);
|
|
||||||
//
|
//
|
||||||
// TabSettingsNotifications
|
// TabSettingsNotifications
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.Controls.Add(this.groupCustomSound);
|
|
||||||
this.Controls.Add(this.groupUserInterface);
|
this.Controls.Add(this.groupUserInterface);
|
||||||
this.Controls.Add(this.groupNotificationDuration);
|
this.Controls.Add(this.groupNotificationDuration);
|
||||||
this.Controls.Add(this.groupNotificationLocation);
|
this.Controls.Add(this.groupNotificationLocation);
|
||||||
this.Name = "TabSettingsNotifications";
|
this.Name = "TabSettingsNotifications";
|
||||||
this.Size = new System.Drawing.Size(478, 282);
|
this.Size = new System.Drawing.Size(478, 300);
|
||||||
this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged);
|
this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged);
|
||||||
this.groupNotificationLocation.ResumeLayout(false);
|
this.groupNotificationLocation.ResumeLayout(false);
|
||||||
this.groupNotificationLocation.PerformLayout();
|
this.groupNotificationLocation.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
|
||||||
this.groupNotificationDuration.ResumeLayout(false);
|
this.groupNotificationDuration.ResumeLayout(false);
|
||||||
this.groupNotificationDuration.PerformLayout();
|
|
||||||
this.tableLayoutDurationButtons.ResumeLayout(false);
|
this.tableLayoutDurationButtons.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit();
|
||||||
this.groupUserInterface.ResumeLayout(false);
|
this.groupUserInterface.ResumeLayout(false);
|
||||||
this.groupUserInterface.PerformLayout();
|
this.groupUserInterface.PerformLayout();
|
||||||
this.groupCustomSound.ResumeLayout(false);
|
|
||||||
this.groupCustomSound.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -423,19 +435,20 @@
|
|||||||
private System.Windows.Forms.RadioButton radioLocTL;
|
private System.Windows.Forms.RadioButton radioLocTL;
|
||||||
private System.Windows.Forms.GroupBox groupNotificationDuration;
|
private System.Windows.Forms.GroupBox groupNotificationDuration;
|
||||||
private System.Windows.Forms.GroupBox groupUserInterface;
|
private System.Windows.Forms.GroupBox groupUserInterface;
|
||||||
private System.Windows.Forms.CheckBox checkNotificationTimer;
|
|
||||||
private System.Windows.Forms.ToolTip toolTip;
|
private System.Windows.Forms.ToolTip toolTip;
|
||||||
private System.Windows.Forms.Label labelEdgeDistanceValue;
|
private System.Windows.Forms.Label labelEdgeDistanceValue;
|
||||||
private System.Windows.Forms.CheckBox checkTimerCountDown;
|
|
||||||
private System.Windows.Forms.Label labelDurationValue;
|
private System.Windows.Forms.Label labelDurationValue;
|
||||||
private System.Windows.Forms.TrackBar trackBarDuration;
|
private System.Windows.Forms.TrackBar trackBarDuration;
|
||||||
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationMedium;
|
private TweetDuck.Core.Controls.FlatButton btnDurationMedium;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationLong;
|
private TweetDuck.Core.Controls.FlatButton btnDurationLong;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationShort;
|
private TweetDuck.Core.Controls.FlatButton btnDurationShort;
|
||||||
private System.Windows.Forms.GroupBox groupCustomSound;
|
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
||||||
private System.Windows.Forms.Button btnResetSound;
|
private System.Windows.Forms.Label labelIdlePause;
|
||||||
private System.Windows.Forms.Button btnBrowseSound;
|
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
||||||
private System.Windows.Forms.TextBox tbCustomSound;
|
private System.Windows.Forms.CheckBox checkColumnName;
|
||||||
|
private System.Windows.Forms.CheckBox checkSkipOnLinkClick;
|
||||||
|
private System.Windows.Forms.CheckBox checkTimerCountDown;
|
||||||
|
private System.Windows.Forms.CheckBox checkNotificationTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,37 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsNotifications : BaseTabSettings{
|
partial class TabSettingsNotifications : BaseTabSettings{
|
||||||
private readonly FormNotification notification;
|
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
||||||
private readonly Point initCursorPosition;
|
|
||||||
|
|
||||||
public TabSettingsNotifications(FormNotification notification, bool ignoreAutoClick){
|
private readonly FormNotificationMain notification;
|
||||||
|
|
||||||
|
public TabSettingsNotifications(FormNotificationMain notification){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
|
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
|
||||||
|
|
||||||
this.notification.Move += (sender, args) => {
|
this.notification.Move += (sender, args) => {
|
||||||
if (radioLocCustom.Checked){
|
if (radioLocCustom.Checked && this.notification.Location != ControlExtensions.InvisibleLocation){
|
||||||
Config.CustomNotificationPosition = this.notification.Location;
|
Config.CustomNotificationPosition = this.notification.Location;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.notification.Initialized += (sender, args) => {
|
this.notification.Initialized += (sender, args) => {
|
||||||
this.InvokeSafe(() => this.notification.ShowNotificationForSettings(true));
|
this.InvokeAsyncSafe(() => this.notification.ShowNotificationForSettings(true));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.notification.Activated += notification_Activated;
|
this.notification.Activated += notification_Activated;
|
||||||
this.notification.Show(this);
|
this.notification.Show();
|
||||||
|
|
||||||
initCursorPosition = ignoreAutoClick ? ControlExtensions.InvisibleLocation : Cursor.Position;
|
|
||||||
|
|
||||||
switch(Config.NotificationPosition){
|
switch(Config.NotificationPosition){
|
||||||
case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break;
|
case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break;
|
||||||
@@ -41,9 +37,19 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
|
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
|
||||||
|
|
||||||
|
toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue));
|
||||||
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
||||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||||
|
|
||||||
|
comboBoxIdlePause.Items.Add("Disabled");
|
||||||
|
comboBoxIdlePause.Items.Add("30 seconds");
|
||||||
|
comboBoxIdlePause.Items.Add("1 minute");
|
||||||
|
comboBoxIdlePause.Items.Add("2 minutes");
|
||||||
|
comboBoxIdlePause.Items.Add("5 minutes");
|
||||||
|
comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds));
|
||||||
|
|
||||||
comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")");
|
comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")");
|
||||||
|
|
||||||
foreach(Screen screen in Screen.AllScreens){
|
foreach(Screen screen in Screen.AllScreens){
|
||||||
@@ -52,20 +58,41 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
|
|
||||||
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1, Config.NotificationDisplay);
|
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1, Config.NotificationDisplay);
|
||||||
|
|
||||||
|
checkColumnName.Checked = Config.DisplayNotificationColumn;
|
||||||
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
|
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
|
||||||
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
||||||
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
|
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
|
||||||
|
checkSkipOnLinkClick.Checked = Config.NotificationSkipOnLinkClick;
|
||||||
|
checkNonIntrusive.Checked = Config.NotificationNonIntrusiveMode;
|
||||||
|
|
||||||
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
|
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
|
||||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
|
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
|
||||||
|
|
||||||
tbCustomSound.Text = Config.NotificationSoundPath;
|
|
||||||
|
|
||||||
Disposed += (sender, args) => this.notification.Dispose();
|
Disposed += (sender, args) => this.notification.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnClosing(){
|
public override void OnReady(){
|
||||||
Config.NotificationSoundPath = tbCustomSound.Text;
|
radioLocTL.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
|
radioLocTR.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
|
radioLocBL.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
|
radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
|
||||||
|
radioLocCustom.Click += radioLocCustom_Click;
|
||||||
|
|
||||||
|
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
|
||||||
|
btnDurationShort.Click += btnDurationShort_Click;
|
||||||
|
btnDurationMedium.Click += btnDurationMedium_Click;
|
||||||
|
btnDurationLong.Click += btnDurationLong_Click;
|
||||||
|
|
||||||
|
checkColumnName.CheckedChanged += checkColumnName_CheckedChanged;
|
||||||
|
checkNotificationTimer.CheckedChanged += checkNotificationTimer_CheckedChanged;
|
||||||
|
checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged;
|
||||||
|
checkSkipOnLinkClick.CheckedChanged += checkSkipOnLinkClick_CheckedChanged;
|
||||||
|
checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged;
|
||||||
|
|
||||||
|
comboBoxIdlePause.SelectedValueChanged += comboBoxIdlePause_SelectedValueChanged;
|
||||||
|
|
||||||
|
comboBoxDisplay.SelectedValueChanged += comboBoxDisplay_SelectedValueChanged;
|
||||||
|
trackBarEdgeDistance.ValueChanged += trackBarEdgeDistance_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TabSettingsNotifications_ParentChanged(object sender, EventArgs e){
|
private void TabSettingsNotifications_ParentChanged(object sender, EventArgs e){
|
||||||
@@ -78,42 +105,42 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notification_Activated(object sender, EventArgs e){
|
private void notification_Activated(object sender, EventArgs e){
|
||||||
if (Cursor.Position == initCursorPosition && initCursorPosition != ControlExtensions.InvisibleLocation){
|
notification.Hide();
|
||||||
Timer delay = WindowsUtils.CreateSingleTickTimer(1);
|
|
||||||
|
|
||||||
delay.Tick += (sender2, args2) => { // here you can see a disgusting hack to force the freshly opened notification window out of focus
|
|
||||||
NativeMethods.SimulateMouseClick(NativeMethods.MouseButton.Left); // because for some reason, the stupid thing keeps stealing it
|
|
||||||
delay.Dispose(); // even after using ShowWithoutActivation, the CreateParams bullshit, and about a million different combinations
|
|
||||||
}; // of trying to force the original form back into focus in various events, so you will have to fucking deal with it, alright
|
|
||||||
|
|
||||||
delay.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
notification.Activated -= notification_Activated;
|
notification.Activated -= notification_Activated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void radioLoc_CheckedChanged(object sender, EventArgs e){
|
private void radioLoc_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
|
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
|
||||||
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
|
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
|
||||||
else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight;
|
else if (radioLocBR.Checked)Config.NotificationPosition = TweetNotification.Position.BottomRight;
|
||||||
else if (radioLocCustom.Checked){
|
|
||||||
|
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = true;
|
||||||
|
notification.ShowNotificationForSettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void radioLocCustom_Click(object sender, EventArgs e){
|
||||||
if (!Config.IsCustomNotificationPositionSet){
|
if (!Config.IsCustomNotificationPositionSet){
|
||||||
Config.CustomNotificationPosition = notification.Location;
|
Config.CustomNotificationPosition = notification.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.NotificationPosition = TweetNotification.Position.Custom;
|
Config.NotificationPosition = TweetNotification.Position.Custom;
|
||||||
}
|
|
||||||
|
|
||||||
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
|
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = false;
|
||||||
notification.ShowNotificationForSettings(false);
|
notification.ShowNotificationForSettings(false);
|
||||||
|
|
||||||
|
if (notification.IsFullyOutsideView() && MessageBox.Show("The notification seems to be outside of view, would you like to reset its position?", "Notification is outside view", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
|
Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||||
|
notification.MoveToVisibleLocation();
|
||||||
|
|
||||||
|
Config.CustomNotificationPosition = notification.Location;
|
||||||
|
|
||||||
|
Config.NotificationPosition = TweetNotification.Position.Custom;
|
||||||
|
notification.MoveToVisibleLocation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
|
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
Config.NotificationDurationValue = trackBarDuration.Value;
|
Config.NotificationDurationValue = trackBarDuration.Value;
|
||||||
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
|
||||||
|
|
||||||
@@ -121,75 +148,54 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void btnDurationShort_Click(object sender, EventArgs e){
|
private void btnDurationShort_Click(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
trackBarDuration.Value = 15;
|
trackBarDuration.Value = 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnDurationMedium_Click(object sender, EventArgs e){
|
private void btnDurationMedium_Click(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
trackBarDuration.Value = 25;
|
trackBarDuration.Value = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnDurationLong_Click(object sender, EventArgs e){
|
private void btnDurationLong_Click(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
trackBarDuration.Value = 35;
|
trackBarDuration.Value = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
|
private void checkColumnName_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
Config.DisplayNotificationColumn = checkColumnName.Checked;
|
||||||
|
notification.ShowNotificationForSettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
|
||||||
Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
|
Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
|
||||||
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
||||||
notification.ShowNotificationForSettings(true);
|
notification.ShowNotificationForSettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){
|
private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
Config.NotificationTimerCountDown = checkTimerCountDown.Checked;
|
Config.NotificationTimerCountDown = checkTimerCountDown.Checked;
|
||||||
notification.ShowNotificationForSettings(true);
|
notification.ShowNotificationForSettings(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
|
private void checkSkipOnLinkClick_CheckedChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
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 comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
|
||||||
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
|
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
|
||||||
notification.ShowNotificationForSettings(false);
|
notification.ShowNotificationForSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
|
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
|
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
|
||||||
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
|
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
|
||||||
notification.ShowNotificationForSettings(false);
|
notification.ShowNotificationForSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tbCustomSound_TextChanged(object sender, EventArgs e){
|
|
||||||
// also runs when the control is created, i.e. when Ready is false
|
|
||||||
|
|
||||||
bool fileExists = string.IsNullOrEmpty(tbCustomSound.Text) || File.Exists(tbCustomSound.Text);
|
|
||||||
tbCustomSound.ForeColor = fileExists ? SystemColors.WindowText : Color.Maroon;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnBrowseSound_Click(object sender, EventArgs e){
|
|
||||||
using(OpenFileDialog dialog = new OpenFileDialog{
|
|
||||||
AutoUpgradeEnabled = true,
|
|
||||||
DereferenceLinks = true,
|
|
||||||
Title = "Custom Notification Sound",
|
|
||||||
Filter = "Wave file (*.wav)|*.wav"
|
|
||||||
}){
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK){
|
|
||||||
tbCustomSound.Text = dialog.FileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnResetSound_Click(object sender, EventArgs e){
|
|
||||||
tbCustomSound.Text = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
111
Core/Other/Settings/TabSettingsSounds.Designer.cs
generated
Normal file
111
Core/Other/Settings/TabSettingsSounds.Designer.cs
generated
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
|
partial class TabSettingsSounds {
|
||||||
|
/// <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.groupCustomSound = new System.Windows.Forms.GroupBox();
|
||||||
|
this.btnPlaySound = new System.Windows.Forms.Button();
|
||||||
|
this.btnResetSound = new System.Windows.Forms.Button();
|
||||||
|
this.btnBrowseSound = new System.Windows.Forms.Button();
|
||||||
|
this.tbCustomSound = new System.Windows.Forms.TextBox();
|
||||||
|
this.groupCustomSound.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupCustomSound
|
||||||
|
//
|
||||||
|
this.groupCustomSound.Controls.Add(this.btnPlaySound);
|
||||||
|
this.groupCustomSound.Controls.Add(this.btnResetSound);
|
||||||
|
this.groupCustomSound.Controls.Add(this.btnBrowseSound);
|
||||||
|
this.groupCustomSound.Controls.Add(this.tbCustomSound);
|
||||||
|
this.groupCustomSound.Location = new System.Drawing.Point(9, 9);
|
||||||
|
this.groupCustomSound.Name = "groupCustomSound";
|
||||||
|
this.groupCustomSound.Size = new System.Drawing.Size(372, 75);
|
||||||
|
this.groupCustomSound.TabIndex = 0;
|
||||||
|
this.groupCustomSound.TabStop = false;
|
||||||
|
this.groupCustomSound.Text = "Custom Sound Notification";
|
||||||
|
//
|
||||||
|
// btnPlaySound
|
||||||
|
//
|
||||||
|
this.btnPlaySound.AutoSize = true;
|
||||||
|
this.btnPlaySound.Location = new System.Drawing.Point(250, 45);
|
||||||
|
this.btnPlaySound.Name = "btnPlaySound";
|
||||||
|
this.btnPlaySound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
this.btnPlaySound.Size = new System.Drawing.Size(43, 23);
|
||||||
|
this.btnPlaySound.TabIndex = 2;
|
||||||
|
this.btnPlaySound.Text = "Play";
|
||||||
|
this.btnPlaySound.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnResetSound
|
||||||
|
//
|
||||||
|
this.btnResetSound.AutoSize = true;
|
||||||
|
this.btnResetSound.Location = new System.Drawing.Point(6, 45);
|
||||||
|
this.btnResetSound.Name = "btnResetSound";
|
||||||
|
this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
this.btnResetSound.Size = new System.Drawing.Size(51, 23);
|
||||||
|
this.btnResetSound.TabIndex = 3;
|
||||||
|
this.btnResetSound.Text = "Reset";
|
||||||
|
this.btnResetSound.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnBrowseSound
|
||||||
|
//
|
||||||
|
this.btnBrowseSound.AutoSize = true;
|
||||||
|
this.btnBrowseSound.Location = new System.Drawing.Point(299, 45);
|
||||||
|
this.btnBrowseSound.Name = "btnBrowseSound";
|
||||||
|
this.btnBrowseSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||||
|
this.btnBrowseSound.Size = new System.Drawing.Size(67, 23);
|
||||||
|
this.btnBrowseSound.TabIndex = 1;
|
||||||
|
this.btnBrowseSound.Text = "Browse...";
|
||||||
|
this.btnBrowseSound.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// tbCustomSound
|
||||||
|
//
|
||||||
|
this.tbCustomSound.Location = new System.Drawing.Point(6, 19);
|
||||||
|
this.tbCustomSound.Name = "tbCustomSound";
|
||||||
|
this.tbCustomSound.Size = new System.Drawing.Size(360, 20);
|
||||||
|
this.tbCustomSound.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// TabSettingsSounds
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.groupCustomSound);
|
||||||
|
this.Name = "TabSettingsSounds";
|
||||||
|
this.Size = new System.Drawing.Size(478, 300);
|
||||||
|
this.groupCustomSound.ResumeLayout(false);
|
||||||
|
this.groupCustomSound.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.ToolTip toolTip;
|
||||||
|
private System.Windows.Forms.GroupBox groupCustomSound;
|
||||||
|
private System.Windows.Forms.Button btnResetSound;
|
||||||
|
private System.Windows.Forms.Button btnBrowseSound;
|
||||||
|
private System.Windows.Forms.TextBox tbCustomSound;
|
||||||
|
private System.Windows.Forms.Button btnPlaySound;
|
||||||
|
}
|
||||||
|
}
|
67
Core/Other/Settings/TabSettingsSounds.cs
Normal file
67
Core/Other/Settings/TabSettingsSounds.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Notification;
|
||||||
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
|
partial class TabSettingsSounds : BaseTabSettings{
|
||||||
|
private readonly ISoundNotificationPlayer soundNotification;
|
||||||
|
|
||||||
|
public TabSettingsSounds(){
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
soundNotification = SoundNotification.New();
|
||||||
|
soundNotification.PlaybackError += sound_PlaybackError;
|
||||||
|
|
||||||
|
tbCustomSound.Text = Config.NotificationSoundPath;
|
||||||
|
tbCustomSound_TextChanged(tbCustomSound, new EventArgs());
|
||||||
|
|
||||||
|
Disposed += (sender, args) => soundNotification.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnReady(){
|
||||||
|
tbCustomSound.TextChanged += tbCustomSound_TextChanged;
|
||||||
|
btnPlaySound.Click += btnPlaySound_Click;
|
||||||
|
btnBrowseSound.Click += btnBrowseSound_Click;
|
||||||
|
btnResetSound.Click += btnResetSound_Click;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnClosing(){
|
||||||
|
Config.NotificationSoundPath = tbCustomSound.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbCustomSound_TextChanged(object sender, EventArgs e){
|
||||||
|
bool isEmpty = string.IsNullOrEmpty(tbCustomSound.Text);
|
||||||
|
tbCustomSound.ForeColor = isEmpty || File.Exists(tbCustomSound.Text) ? SystemColors.WindowText : Color.Maroon;
|
||||||
|
btnPlaySound.Enabled = !isEmpty;
|
||||||
|
btnResetSound.Enabled = !isEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnPlaySound_Click(object sender, EventArgs e){
|
||||||
|
soundNotification.Play(tbCustomSound.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sound_PlaybackError(object sender, PlaybackErrorEventArgs e){
|
||||||
|
MessageBox.Show("Could not play custom notification sound."+Environment.NewLine+e.Message, "Notification Sound Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnBrowseSound_Click(object sender, EventArgs e){
|
||||||
|
using(OpenFileDialog dialog = new OpenFileDialog{
|
||||||
|
AutoUpgradeEnabled = true,
|
||||||
|
DereferenceLinks = true,
|
||||||
|
Title = "Custom Notification Sound",
|
||||||
|
Filter = "Sound file ("+soundNotification.SupportedFormats+")|"+soundNotification.SupportedFormats+"|All files (*.*)|*.*"
|
||||||
|
}){
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK){
|
||||||
|
tbCustomSound.Text = dialog.FileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnResetSound_Click(object sender, EventArgs e){
|
||||||
|
tbCustomSound.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
90
Core/Other/Settings/TabSettingsUpdates.Designer.cs
generated
90
Core/Other/Settings/TabSettingsUpdates.Designer.cs
generated
@@ -1,90 +0,0 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
|
||||||
partial class TabSettingsUpdates {
|
|
||||||
/// <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.btnCheckUpdates = new System.Windows.Forms.Button();
|
|
||||||
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
|
||||||
this.groupGeneral = new System.Windows.Forms.GroupBox();
|
|
||||||
this.groupGeneral.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// btnCheckUpdates
|
|
||||||
//
|
|
||||||
this.btnCheckUpdates.Location = new System.Drawing.Point(6, 44);
|
|
||||||
this.btnCheckUpdates.Name = "btnCheckUpdates";
|
|
||||||
this.btnCheckUpdates.Size = new System.Drawing.Size(171, 23);
|
|
||||||
this.btnCheckUpdates.TabIndex = 15;
|
|
||||||
this.btnCheckUpdates.Text = "Check Updates Now";
|
|
||||||
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
|
||||||
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
|
||||||
this.btnCheckUpdates.Click += new System.EventHandler(this.btnCheckUpdates_Click);
|
|
||||||
//
|
|
||||||
// checkUpdateNotifications
|
|
||||||
//
|
|
||||||
this.checkUpdateNotifications.AutoSize = true;
|
|
||||||
this.checkUpdateNotifications.Location = new System.Drawing.Point(6, 21);
|
|
||||||
this.checkUpdateNotifications.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
|
|
||||||
this.checkUpdateNotifications.Name = "checkUpdateNotifications";
|
|
||||||
this.checkUpdateNotifications.Size = new System.Drawing.Size(165, 17);
|
|
||||||
this.checkUpdateNotifications.TabIndex = 14;
|
|
||||||
this.checkUpdateNotifications.Text = "Check Updates Automatically";
|
|
||||||
this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" +
|
|
||||||
"in.");
|
|
||||||
this.checkUpdateNotifications.UseVisualStyleBackColor = true;
|
|
||||||
this.checkUpdateNotifications.CheckedChanged += new System.EventHandler(this.checkUpdateNotifications_CheckedChanged);
|
|
||||||
//
|
|
||||||
// groupGeneral
|
|
||||||
//
|
|
||||||
this.groupGeneral.Controls.Add(this.checkUpdateNotifications);
|
|
||||||
this.groupGeneral.Controls.Add(this.btnCheckUpdates);
|
|
||||||
this.groupGeneral.Location = new System.Drawing.Point(9, 9);
|
|
||||||
this.groupGeneral.Name = "groupGeneral";
|
|
||||||
this.groupGeneral.Size = new System.Drawing.Size(183, 75);
|
|
||||||
this.groupGeneral.TabIndex = 16;
|
|
||||||
this.groupGeneral.TabStop = false;
|
|
||||||
this.groupGeneral.Text = "General";
|
|
||||||
//
|
|
||||||
// TabSettingsUpdates
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.Controls.Add(this.groupGeneral);
|
|
||||||
this.Name = "TabSettingsUpdates";
|
|
||||||
this.Size = new System.Drawing.Size(478, 282);
|
|
||||||
this.groupGeneral.ResumeLayout(false);
|
|
||||||
this.groupGeneral.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.Button btnCheckUpdates;
|
|
||||||
private System.Windows.Forms.CheckBox checkUpdateNotifications;
|
|
||||||
private System.Windows.Forms.ToolTip toolTip;
|
|
||||||
private System.Windows.Forms.GroupBox groupGeneral;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using TweetDck.Updates;
|
|
||||||
using TweetDck.Updates.Events;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
|
||||||
partial class TabSettingsUpdates : BaseTabSettings{
|
|
||||||
private readonly UpdateHandler updates;
|
|
||||||
private int updateCheckEventId = -1;
|
|
||||||
|
|
||||||
public TabSettingsUpdates(UpdateHandler updates){
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
this.updates = updates;
|
|
||||||
|
|
||||||
this.updates.CheckFinished += updates_CheckFinished;
|
|
||||||
Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished;
|
|
||||||
|
|
||||||
checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
|
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnCheckUpdates_Click(object sender, EventArgs e){
|
|
||||||
if (!Ready)return;
|
|
||||||
|
|
||||||
updateCheckEventId = updates.Check(true);
|
|
||||||
|
|
||||||
if (updateCheckEventId == -1){
|
|
||||||
MessageBox.Show("Sorry, your system is no longer supported.", "Unsupported System", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
btnCheckUpdates.Enabled = false;
|
|
||||||
|
|
||||||
updates.Settings.DismissedUpdate = string.Empty;
|
|
||||||
Config.DismissedUpdate = string.Empty;
|
|
||||||
Config.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
|
|
||||||
if (e.EventId == updateCheckEventId){
|
|
||||||
btnCheckUpdates.Enabled = true;
|
|
||||||
|
|
||||||
if (!e.UpdateAvailable){
|
|
||||||
MessageBox.Show("Your version of "+Program.BrandName+" is up to date.", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
50
Core/TrayIcon.Designer.cs
generated
50
Core/TrayIcon.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core {
|
namespace TweetDuck.Core {
|
||||||
partial class TrayIcon {
|
partial class TrayIcon {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -25,65 +25,17 @@
|
|||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||||
this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
|
||||||
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.muteNotificationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.contextMenu.SuspendLayout();
|
|
||||||
//
|
//
|
||||||
// notifyIcon
|
// notifyIcon
|
||||||
//
|
//
|
||||||
this.notifyIcon.ContextMenuStrip = this.contextMenu;
|
|
||||||
this.notifyIcon.Icon = global::TweetDck.Properties.Resources.icon_tray;
|
|
||||||
this.notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseClick);
|
this.notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.trayIcon_MouseClick);
|
||||||
//
|
//
|
||||||
// contextMenu
|
|
||||||
//
|
|
||||||
this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.restoreToolStripMenuItem,
|
|
||||||
this.muteNotificationsToolStripMenuItem,
|
|
||||||
this.closeToolStripMenuItem});
|
|
||||||
this.contextMenu.Name = "contextMenuTray";
|
|
||||||
this.contextMenu.ShowCheckMargin = true;
|
|
||||||
this.contextMenu.ShowImageMargin = false;
|
|
||||||
this.contextMenu.ShowItemToolTips = false;
|
|
||||||
this.contextMenu.Size = new System.Drawing.Size(174, 92);
|
|
||||||
this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuTray_Opening);
|
|
||||||
this.contextMenu.Opened += new System.EventHandler(this.contextMenuTray_Opened);
|
|
||||||
//
|
|
||||||
// restoreToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.restoreToolStripMenuItem.Name = "restoreToolStripMenuItem";
|
|
||||||
this.restoreToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
|
|
||||||
this.restoreToolStripMenuItem.Text = "Restore";
|
|
||||||
this.restoreToolStripMenuItem.Click += new System.EventHandler(this.restoreToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// muteNotificationsToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.muteNotificationsToolStripMenuItem.CheckOnClick = true;
|
|
||||||
this.muteNotificationsToolStripMenuItem.Name = "muteNotificationsToolStripMenuItem";
|
|
||||||
this.muteNotificationsToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
|
|
||||||
this.muteNotificationsToolStripMenuItem.Text = "Mute Notifications";
|
|
||||||
this.muteNotificationsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.muteNotificationsToolStripMenuItem_CheckedChanged);
|
|
||||||
//
|
|
||||||
// closeToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
|
|
||||||
this.closeToolStripMenuItem.Size = new System.Drawing.Size(173, 22);
|
|
||||||
this.closeToolStripMenuItem.Text = "Close";
|
|
||||||
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// TrayIcon
|
// TrayIcon
|
||||||
//
|
//
|
||||||
this.contextMenu.ResumeLayout(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.NotifyIcon notifyIcon;
|
private System.Windows.Forms.NotifyIcon notifyIcon;
|
||||||
private System.Windows.Forms.ContextMenuStrip contextMenu;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem muteNotificationsToolStripMenuItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDuck.Core{
|
||||||
partial class TrayIcon : Component{
|
partial class TrayIcon : Component{
|
||||||
public enum Behavior{ // keep order
|
public enum Behavior{ // keep order
|
||||||
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
||||||
@@ -12,12 +12,15 @@ namespace TweetDck.Core{
|
|||||||
public event EventHandler ClickClose;
|
public event EventHandler ClickClose;
|
||||||
|
|
||||||
public bool Visible{
|
public bool Visible{
|
||||||
get{
|
get => notifyIcon.Visible;
|
||||||
return notifyIcon.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
|
if (value){
|
||||||
|
notifyIcon.Icon = Properties.Resources.icon_tray;
|
||||||
|
}
|
||||||
|
|
||||||
notifyIcon.Visible = value;
|
notifyIcon.Visible = value;
|
||||||
|
hasNotifications = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,52 +30,56 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (hasNotifications != value){
|
if (hasNotifications != value && Visible){
|
||||||
notifyIcon.Icon = value ? Properties.Resources.icon_tray_new : Properties.Resources.icon_tray;
|
notifyIcon.Icon = value ? Properties.Resources.icon_tray_new : Properties.Resources.icon_tray;
|
||||||
hasNotifications = value;
|
hasNotifications = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly ContextMenu contextMenu;
|
||||||
private bool hasNotifications;
|
private bool hasNotifications;
|
||||||
|
|
||||||
public TrayIcon(){
|
public TrayIcon(){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
notifyIcon.Text = Program.BrandName;
|
|
||||||
|
this.contextMenu = new ContextMenu();
|
||||||
|
this.contextMenu.MenuItems.Add("Restore", menuItemRestore_Click);
|
||||||
|
this.contextMenu.MenuItems.Add("Mute notifications", menuItemMuteNotifications_Click);
|
||||||
|
this.contextMenu.MenuItems.Add("Close", menuItemClose_Click);
|
||||||
|
this.contextMenu.Popup += contextMenu_Popup;
|
||||||
|
|
||||||
|
this.notifyIcon.ContextMenu = contextMenu;
|
||||||
|
this.notifyIcon.Text = Program.BrandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrayIcon(IContainer container) : this(){
|
||||||
|
container.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
|
|
||||||
private void trayIcon_MouseClick(object sender, MouseEventArgs e){
|
private void trayIcon_MouseClick(object sender, MouseEventArgs e){
|
||||||
if (e.Button == MouseButtons.Left){
|
if (e.Button == MouseButtons.Left){
|
||||||
restoreToolStripMenuItem_Click(sender, e);
|
menuItemRestore_Click(sender, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contextMenuTray_Opening(object sender, CancelEventArgs e){
|
private void contextMenu_Popup(object sender, EventArgs e){
|
||||||
muteNotificationsToolStripMenuItem.CheckedChanged -= muteNotificationsToolStripMenuItem_CheckedChanged;
|
contextMenu.MenuItems[1].Checked = Program.UserConfig.MuteNotifications;
|
||||||
muteNotificationsToolStripMenuItem.Checked = Program.UserConfig.MuteNotifications;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contextMenuTray_Opened(object sender, EventArgs e){
|
private void menuItemRestore_Click(object sender, EventArgs e){
|
||||||
muteNotificationsToolStripMenuItem.CheckedChanged += muteNotificationsToolStripMenuItem_CheckedChanged;
|
ClickRestore?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreToolStripMenuItem_Click(object sender, EventArgs e){
|
private void menuItemMuteNotifications_Click(object sender, EventArgs e){
|
||||||
if (ClickRestore != null){
|
Program.UserConfig.MuteNotifications = !contextMenu.MenuItems[1].Checked;
|
||||||
ClickRestore(this, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void muteNotificationsToolStripMenuItem_CheckedChanged(object sender, EventArgs e){
|
|
||||||
Program.UserConfig.MuteNotifications = muteNotificationsToolStripMenuItem.Checked;
|
|
||||||
Program.UserConfig.Save();
|
Program.UserConfig.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeToolStripMenuItem_Click(object sender, EventArgs e){
|
private void menuItemClose_Click(object sender, EventArgs e){
|
||||||
if (ClickClose != null){
|
ClickClose?.Invoke(this, e);
|
||||||
ClickClose(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ using System.IO;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class BrowserCache{
|
static class BrowserCache{
|
||||||
private static bool ClearOnExit { get; set; }
|
private static bool ClearOnExit { get; set; }
|
||||||
|
|
||||||
@@ -31,21 +31,6 @@ namespace TweetDck.Core.Utils{
|
|||||||
task.Start();
|
task.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ClearOldCacheFiles(){
|
|
||||||
if (!Directory.Exists(CacheFolder)){
|
|
||||||
foreach(string file in Directory.EnumerateFiles(Program.StoragePath).Where(path => {
|
|
||||||
string file = Path.GetFileName(path);
|
|
||||||
return file != null && (file.StartsWith("data_", StringComparison.Ordinal) || file.StartsWith("f_", StringComparison.Ordinal));
|
|
||||||
}).Concat(new[]{ Path.Combine(Program.StoragePath, "index") })){
|
|
||||||
try{
|
|
||||||
File.Delete(file);
|
|
||||||
}catch{
|
|
||||||
// welp, too bad
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetClearOnExit(){
|
public static void SetClearOnExit(){
|
||||||
ClearOnExit = true;
|
ClearOnExit = true;
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class BrowserUtils{
|
static class BrowserUtils{
|
||||||
public static string HeaderAcceptLanguage{
|
public static string HeaderAcceptLanguage{
|
||||||
get{
|
get{
|
||||||
@@ -21,13 +23,36 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string HeaderUserAgent{
|
public static string HeaderUserAgent => Program.BrandName+" "+Application.ProductVersion;
|
||||||
get{
|
|
||||||
return Program.BrandName+" "+Application.ProductVersion;
|
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||||
|
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
|
||||||
|
|
||||||
|
public static readonly string[] DictionaryWords = {
|
||||||
|
"tweetdeck", "TweetDeck", "tweetduck", "TweetDuck", "TD"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static bool IsValidUrl(string url){
|
||||||
|
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||||
|
string scheme = uri.Scheme;
|
||||||
|
return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenExternalBrowser(string url){
|
||||||
|
if (string.IsNullOrWhiteSpace(url))return;
|
||||||
|
|
||||||
|
if (IsValidUrl(url)){
|
||||||
|
OpenExternalBrowserUnsafe(url);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
MessageBox.Show("A potentially malicious URL was blocked from opening:"+Environment.NewLine+url, "Blocked URL", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenExternalBrowser(string url){ // TODO implement mailto
|
public static void OpenExternalBrowserUnsafe(string url){
|
||||||
using(Process.Start(url)){}
|
using(Process.Start(url)){}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,23 +61,50 @@ namespace TweetDck.Core.Utils{
|
|||||||
return string.IsNullOrEmpty(file) ? null : file;
|
return string.IsNullOrEmpty(file) ? null : file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DownloadFileAsync(string url, string target, Action<Exception> onFailure){
|
public static string ConvertPascalCaseToScreamingSnakeCase(string str){
|
||||||
|
return Regex.Replace(str, @"(\p{Ll})(\P{Ll})|(\P{Ll})(\P{Ll}\p{Ll})", "$1$3_$2$4").ToUpperInvariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetErrorName(CefErrorCode code){
|
||||||
|
return ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WebClient DownloadFileAsync(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||||
WebClient client = new WebClient{ Proxy = null };
|
WebClient client = new WebClient{ Proxy = null };
|
||||||
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
||||||
|
|
||||||
client.DownloadFileCompleted += (sender, args) => {
|
client.DownloadFileCompleted += (sender, args) => {
|
||||||
if (args.Error != null){
|
if (args.Cancelled){
|
||||||
onFailure(args.Error);
|
try{
|
||||||
|
File.Delete(target);
|
||||||
|
}catch{
|
||||||
|
// didn't want it deleted anyways
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.Error != null){
|
||||||
|
onFailure?.Invoke(args.Error);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
onSuccess?.Invoke();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
client.DownloadFileAsync(new Uri(url), target);
|
client.DownloadFileAsync(new Uri(url), target);
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetZoomLevel(IBrowser browser, int percentage){
|
||||||
|
browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsTweetDeckWebsite(IFrame frame){
|
public static bool IsTweetDeckWebsite(IFrame frame){
|
||||||
return frame.Url.Contains("//tweetdeck.twitter.com/");
|
return frame.Url.Contains("//tweetdeck.twitter.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsTwitterWebsite(IFrame frame){
|
||||||
|
return frame.Url.Contains("//twitter.com/");
|
||||||
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
|
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
|
||||||
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);
|
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class CommandLineArgs{
|
class CommandLineArgs{
|
||||||
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
||||||
CommandLineArgs args = new CommandLineArgs();
|
CommandLineArgs args = new CommandLineArgs();
|
||||||
@@ -35,11 +35,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
private readonly HashSet<string> flags = new HashSet<string>();
|
private readonly HashSet<string> flags = new HashSet<string>();
|
||||||
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
|
||||||
|
|
||||||
public int Count{
|
public int Count => flags.Count+values.Count;
|
||||||
get{
|
|
||||||
return flags.Count+values.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddFlag(string flag){
|
public void AddFlag(string flag){
|
||||||
flags.Add(flag.ToLowerInvariant());
|
flags.Add(flag.ToLowerInvariant());
|
||||||
@@ -62,8 +58,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string GetValue(string key, string defaultValue){
|
public string GetValue(string key, string defaultValue){
|
||||||
string val;
|
return values.TryGetValue(key.ToLowerInvariant(), out string val) ? val : defaultValue;
|
||||||
return values.TryGetValue(key.ToLowerInvariant(), out val) ? val : defaultValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveValue(string key){
|
public void RemoveValue(string key){
|
||||||
|
@@ -1,14 +1,9 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class CommandLineArgsParser{
|
static class CommandLineArgsParser{
|
||||||
private static Regex splitRegex;
|
private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled), false);
|
||||||
|
|
||||||
private static Regex SplitRegex{
|
|
||||||
get{
|
|
||||||
return splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommandLineArgs ReadCefArguments(string argumentString){
|
public static CommandLineArgs ReadCefArguments(string argumentString){
|
||||||
CommandLineArgs args = new CommandLineArgs();
|
CommandLineArgs args = new CommandLineArgs();
|
||||||
@@ -17,7 +12,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Match match in SplitRegex.Matches(argumentString)){
|
foreach(Match match in SplitRegex.Value.Matches(argumentString)){
|
||||||
string matchValue = match.Value;
|
string matchValue = match.Value;
|
||||||
|
|
||||||
int indexEquals = matchValue.IndexOf('=');
|
int indexEquals = matchValue.IndexOf('=');
|
||||||
|
@@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
|
||||||
static class HardwareAcceleration{
|
|
||||||
private static readonly string LibEGL = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libEGL.dll");
|
|
||||||
private static readonly string LibGLES = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libGLESv2.dll");
|
|
||||||
|
|
||||||
private static readonly string DisabledLibEGL = LibEGL+".bak";
|
|
||||||
private static readonly string DisabledLibGLES = LibGLES+".bak";
|
|
||||||
|
|
||||||
public static bool IsEnabled{
|
|
||||||
get{
|
|
||||||
return File.Exists(LibEGL) && File.Exists(LibGLES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool CanEnable{
|
|
||||||
get{
|
|
||||||
return File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Enable(){
|
|
||||||
if (IsEnabled)return false;
|
|
||||||
|
|
||||||
try{
|
|
||||||
File.Move(DisabledLibEGL, LibEGL);
|
|
||||||
File.Move(DisabledLibGLES, LibGLES);
|
|
||||||
return true;
|
|
||||||
}catch{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Disable(){
|
|
||||||
if (!IsEnabled)return false;
|
|
||||||
|
|
||||||
try{
|
|
||||||
if (File.Exists(DisabledLibEGL)){
|
|
||||||
File.Delete(DisabledLibEGL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(DisabledLibGLES)){
|
|
||||||
File.Delete(DisabledLibGLES);
|
|
||||||
}
|
|
||||||
}catch{
|
|
||||||
// woops
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
File.Move(LibEGL, DisabledLibEGL);
|
|
||||||
File.Move(LibGLES, DisabledLibGLES);
|
|
||||||
return true;
|
|
||||||
}catch{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
37
Core/Utils/InjectedHTML.cs
Normal file
37
Core/Utils/InjectedHTML.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Utils{
|
||||||
|
class InjectedHTML{
|
||||||
|
public enum Position{
|
||||||
|
Before, After
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly Position position;
|
||||||
|
private readonly string search;
|
||||||
|
private readonly string html;
|
||||||
|
|
||||||
|
public InjectedHTML(Position position, string search, string html){
|
||||||
|
this.position = position;
|
||||||
|
this.search = search;
|
||||||
|
this.html = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Inject(string targetHTML){
|
||||||
|
int index = targetHTML.IndexOf(search, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
if (index == -1){
|
||||||
|
return targetHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cutIndex;
|
||||||
|
|
||||||
|
switch(position){
|
||||||
|
case Position.Before: cutIndex = index; break;
|
||||||
|
case Position.After: cutIndex = index+search.Length; break;
|
||||||
|
default: return targetHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetHTML.Insert(cutIndex, html);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
129
Core/Utils/NativeCoreAudio.cs
Normal file
129
Core/Utils/NativeCoreAudio.cs
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Utils{
|
||||||
|
static class NativeCoreAudio{
|
||||||
|
private const int EDATAFLOW_RENDER = 0;
|
||||||
|
private const int EROLE_MULTIMEDIA = 1;
|
||||||
|
|
||||||
|
[ComImport]
|
||||||
|
[Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")]
|
||||||
|
private class MMDeviceEnumerator{}
|
||||||
|
|
||||||
|
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface IMMDeviceEnumerator{
|
||||||
|
int Unimpl_EnumAudioEndpoints();
|
||||||
|
IMMDevice GetDefaultAudioEndpoint(int dataFlow, int role);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Guid("D666063F-1587-4E43-81F1-B948E807363F")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface IMMDevice{
|
||||||
|
[return:MarshalAs(UnmanagedType.IUnknown)]
|
||||||
|
object Activate(ref Guid id, int clsCtx, IntPtr activationParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Guid("77AA99A0-1BD6-484F-8BC7-2C654C9A9B6F")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface IAudioSessionManager2{
|
||||||
|
int Unimpl_FindWillToLive();
|
||||||
|
int Unimpl_HelloDarknessMyOldFriend();
|
||||||
|
IAudioSessionEnumerator GetSessionEnumerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Guid("E2F5BB11-0570-40CA-ACDD-3AA01277DEE8")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface IAudioSessionEnumerator{
|
||||||
|
int GetCount();
|
||||||
|
IAudioSessionControl GetSession(int sessionIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Guid("F4B1A599-7266-4319-A8CA-E70ACB11E8CD")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface IAudioSessionControl{}
|
||||||
|
|
||||||
|
[Guid("BFB7FF88-7239-4FC9-8FA2-07C950BE9C6D")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface IAudioSessionControl2{
|
||||||
|
int Unimpl_GetState();
|
||||||
|
int Unimpl_GetDisplayName();
|
||||||
|
int Unimpl_SetDisplayName();
|
||||||
|
int Unimpl_GetIconPath();
|
||||||
|
int Unimpl_SetIconPath();
|
||||||
|
int Unimpl_GetGroupingParam();
|
||||||
|
int Unimpl_SetGroupingParam();
|
||||||
|
int Unimpl_RegisterAudioSessionNotification();
|
||||||
|
int Unimpl_UnregisterAudioSessionNotification();
|
||||||
|
|
||||||
|
[return:MarshalAs(UnmanagedType.LPWStr)]
|
||||||
|
string GetSessionIdentifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Guid("87CE5498-68D6-44E5-9215-6DA47EF883D8")]
|
||||||
|
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
private interface ISimpleAudioVolume{
|
||||||
|
void SetMasterVolume(float level, ref Guid eventContext);
|
||||||
|
float GetMasterVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "SuspiciousTypeConversion.Global")]
|
||||||
|
private static ISimpleAudioVolume GetVolumeObject(string name){
|
||||||
|
IMMDeviceEnumerator devices = (IMMDeviceEnumerator)new MMDeviceEnumerator();
|
||||||
|
IMMDevice device = devices.GetDefaultAudioEndpoint(EDATAFLOW_RENDER, EROLE_MULTIMEDIA);
|
||||||
|
|
||||||
|
Guid sessionManagerGUID = typeof(IAudioSessionManager2).GUID;
|
||||||
|
IAudioSessionManager2 manager = (IAudioSessionManager2)device.Activate(ref sessionManagerGUID, 0, IntPtr.Zero);
|
||||||
|
IAudioSessionEnumerator sessions = manager.GetSessionEnumerator();
|
||||||
|
|
||||||
|
ISimpleAudioVolume volumeObj = null;
|
||||||
|
|
||||||
|
for(int index = sessions.GetCount()-1; index >= 0; index--){
|
||||||
|
IAudioSessionControl2 ctl = sessions.GetSession(index) as IAudioSessionControl2;
|
||||||
|
|
||||||
|
if (ctl != null){
|
||||||
|
string identifier = ctl.GetSessionIdentifier();
|
||||||
|
|
||||||
|
if (identifier != null && identifier.Contains(name)){
|
||||||
|
volumeObj = ctl as ISimpleAudioVolume;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Marshal.ReleaseComObject(ctl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Marshal.ReleaseComObject(devices);
|
||||||
|
Marshal.ReleaseComObject(device);
|
||||||
|
Marshal.ReleaseComObject(manager);
|
||||||
|
Marshal.ReleaseComObject(sessions);
|
||||||
|
return volumeObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double GetMixerVolume(string appPath){
|
||||||
|
ISimpleAudioVolume obj = GetVolumeObject(appPath);
|
||||||
|
float level = 1F;
|
||||||
|
|
||||||
|
if (obj != null){
|
||||||
|
level = obj.GetMasterVolume();
|
||||||
|
Marshal.ReleaseComObject(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.Round(level, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double GetMixerVolumeForCurrentProcess(){
|
||||||
|
string path;
|
||||||
|
|
||||||
|
using(Process process = Process.GetCurrentProcess()){
|
||||||
|
path = process.MainModule.FileName;
|
||||||
|
path = path.Substring(Path.GetPathRoot(path).Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetMixerVolume(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,37 +1,51 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
|
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
|
||||||
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
|
||||||
static class NativeMethods{
|
static class NativeMethods{
|
||||||
public static readonly IntPtr HWND_BROADCAST = new IntPtr(0xFFFF);
|
public static readonly IntPtr HWND_BROADCAST = new IntPtr(0xFFFF);
|
||||||
|
public static readonly IntPtr HOOK_HANDLED = new IntPtr(-1);
|
||||||
|
|
||||||
public const int HWND_TOPMOST = -1;
|
public const int HWND_TOPMOST = -1;
|
||||||
public const uint SWP_NOACTIVATE = 0x0010;
|
public const uint SWP_NOACTIVATE = 0x0010;
|
||||||
|
public const int WS_DISABLED = 0x08000000;
|
||||||
public const int MOUSEEVENTF_LEFTDOWN = 0x02;
|
public const int GWL_STYLE = -16;
|
||||||
public const int MOUSEEVENTF_LEFTUP = 0x04;
|
|
||||||
public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
|
|
||||||
public const int MOUSEEVENTF_RIGHTUP = 0x10;
|
|
||||||
|
|
||||||
public const int SB_HORZ = 0;
|
public const int SB_HORZ = 0;
|
||||||
public const int BCM_SETSHIELD = 0x160C;
|
public const int BCM_SETSHIELD = 0x160C;
|
||||||
|
|
||||||
public const int WH_MOUSE_LL = 14;
|
public const int WM_MOUSE_LL = 14;
|
||||||
public const int WH_MOUSEWHEEL = 0x020A;
|
public const int WM_MOUSEWHEEL = 0x020A;
|
||||||
|
public const int WM_XBUTTONDOWN = 0x020B;
|
||||||
public enum MouseButton{
|
public const int WM_XBUTTONUP = 0x020C;
|
||||||
Left, Right
|
public const int WM_PARENTNOTIFY = 0x0210;
|
||||||
}
|
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
private struct LASTINPUTINFO{
|
private struct LASTINPUTINFO{
|
||||||
public static readonly uint Size = (uint)Marshal.SizeOf(typeof(LASTINPUTINFO));
|
public static readonly uint Size = (uint)Marshal.SizeOf(typeof(LASTINPUTINFO));
|
||||||
|
|
||||||
// ReSharper disable once NotAccessedField.Local
|
|
||||||
public uint cbSize;
|
public uint cbSize;
|
||||||
#pragma warning disable 649
|
|
||||||
public uint dwTime;
|
public uint dwTime;
|
||||||
#pragma warning restore 649
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct POINT{
|
||||||
|
public int X;
|
||||||
|
public int Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct MSLLHOOKSTRUCT{
|
||||||
|
public POINT pt;
|
||||||
|
public int mouseData;
|
||||||
|
public int flags;
|
||||||
|
public int time;
|
||||||
|
public UIntPtr dwExtraInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
|
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
|
||||||
@@ -40,10 +54,17 @@ namespace TweetDck.Core.Utils{
|
|||||||
private static extern bool SetWindowPos(int hWnd, int hWndOrder, int x, int y, int width, int height, uint flags);
|
private static extern bool SetWindowPos(int hWnd, int hWndOrder, int x, int y, int width, int height, uint flags);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
|
private static extern bool GetLastInputInfo(ref LASTINPUTINFO info);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern bool GetLastInputInfo(ref LASTINPUTINFO info);
|
public static extern IntPtr GetDC(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC);
|
||||||
|
|
||||||
|
[DllImport("gdi32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
private static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam);
|
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam);
|
||||||
@@ -64,29 +85,27 @@ namespace TweetDck.Core.Utils{
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||||
|
|
||||||
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
||||||
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SimulateMouseClick(MouseButton button){
|
public static void SetFormDisabled(Form form, bool disabled){
|
||||||
int flagHold, flagRelease;
|
if (disabled){
|
||||||
|
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) | WS_DISABLED);
|
||||||
switch(button){
|
}
|
||||||
case MouseButton.Left:
|
else{
|
||||||
flagHold = SystemInformation.MouseButtonsSwapped ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN;
|
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) & ~WS_DISABLED);
|
||||||
flagRelease = SystemInformation.MouseButtonsSwapped ? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_LEFTUP;
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case MouseButton.Right:
|
|
||||||
flagHold = SystemInformation.MouseButtonsSwapped ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN;
|
|
||||||
flagRelease = SystemInformation.MouseButtonsSwapped ? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_event(flagHold, Cursor.Position.X, Cursor.Position.Y, 0, 0);
|
public static int GetMouseHookData(IntPtr ptr){
|
||||||
mouse_event(flagRelease, Cursor.Position.X, Cursor.Position.Y, 0, 0);
|
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetIdleSeconds(){
|
public static int GetIdleSeconds(){
|
||||||
@@ -106,5 +125,17 @@ namespace TweetDck.Core.Utils{
|
|||||||
int seconds = (int)Math.Floor(TimeSpan.FromMilliseconds(ticks-info.dwTime).TotalSeconds);
|
int seconds = (int)Math.Floor(TimeSpan.FromMilliseconds(ticks-info.dwTime).TotalSeconds);
|
||||||
return Math.Max(0, seconds); // ignore rollover after several weeks of uptime
|
return Math.Max(0, seconds); // ignore rollover after several weeks of uptime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RenderSourceIntoBitmap(IntPtr source, Bitmap target){
|
||||||
|
using(Graphics graphics = Graphics.FromImage(target)){
|
||||||
|
IntPtr graphicsHandle = graphics.GetHdc();
|
||||||
|
|
||||||
|
try{
|
||||||
|
BitBlt(graphicsHandle, 0, 0, target.Width, target.Height, source, 0, 0, 0x00CC0020);
|
||||||
|
}finally{
|
||||||
|
graphics.ReleaseHdc(graphicsHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class TwoKeyDictionary<K1, K2, V>{
|
class TwoKeyDictionary<K1, K2, V>{
|
||||||
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
||||||
private readonly int innerCapacity;
|
private readonly int innerCapacity;
|
||||||
@@ -21,9 +21,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
set{
|
set{
|
||||||
Dictionary<K2, V> innerDict;
|
if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (!dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,12 +29,20 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<V> InnerValues{
|
||||||
|
get{
|
||||||
|
foreach(Dictionary<K2, V> innerDict in dict.Values){
|
||||||
|
foreach(V value in innerDict.Values){
|
||||||
|
yield return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
|
|
||||||
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
|
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
|
||||||
Dictionary<K2, V> innerDict;
|
if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (!dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +50,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Clear(){
|
public void Clear(){
|
||||||
this.dict.Clear();
|
dict.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
|
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
|
||||||
@@ -73,10 +79,8 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(K1 outerKey, K2 innerKey){
|
public bool Remove(K1 outerKey, K2 innerKey){
|
||||||
Dictionary<K2, V> innerDict;
|
if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict) && innerDict.Remove(innerKey)){
|
||||||
|
if (innerDict.Count == 0) {
|
||||||
if (dict.TryGetValue(outerKey, out innerDict) && innerDict.Remove(innerKey)){
|
|
||||||
if (innerDict.Count == 0){
|
|
||||||
dict.Remove(outerKey);
|
dict.Remove(outerKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,9 +90,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
||||||
Dictionary<K2, V> innerDict;
|
if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
return innerDict.TryGetValue(innerKey, out value);
|
return innerDict.TryGetValue(innerKey, out value);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class WindowState{
|
class WindowState{
|
||||||
private Rectangle rect;
|
private Rectangle rect;
|
||||||
@@ -20,7 +20,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
form.WindowState = isMaximized ? FormWindowState.Maximized : FormWindowState.Normal;
|
form.WindowState = isMaximized ? FormWindowState.Maximized : FormWindowState.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rect == Rectangle.Empty && firstTimeFullscreen) || !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds))){
|
if ((rect == Rectangle.Empty && firstTimeFullscreen) || form.IsFullyOutsideView()){
|
||||||
form.DesktopBounds = Screen.PrimaryScreen.WorkingArea;
|
form.DesktopBounds = Screen.PrimaryScreen.WorkingArea;
|
||||||
form.WindowState = FormWindowState.Maximized;
|
form.WindowState = FormWindowState.Maximized;
|
||||||
Save(form);
|
Save(form);
|
||||||
|
@@ -5,12 +5,18 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Timer = System.Windows.Forms.Timer;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class WindowsUtils{
|
static class WindowsUtils{
|
||||||
private static readonly Regex RegexStripHtmlStyles = new Regex(@"\s?(?:style|class)="".*?""");
|
private static readonly Lazy<Regex> RegexStripHtmlStyles = new Lazy<Regex>(() => new Regex(@"\s?(?:style|class)="".*?"""), false);
|
||||||
private static readonly Regex RegexOffsetClipboardHtml = new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)");
|
private static readonly Lazy<Regex> RegexOffsetClipboardHtml = new Lazy<Regex>(() => new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)"), false);
|
||||||
|
|
||||||
|
public static bool ShouldAvoidToolWindow { get; }
|
||||||
|
|
||||||
|
static WindowsUtils(){
|
||||||
|
Version ver = Environment.OSVersion.Version;
|
||||||
|
ShouldAvoidToolWindow = ver.Major == 6 && ver.Minor == 2; // windows 8/10
|
||||||
|
}
|
||||||
|
|
||||||
public static bool CheckFolderWritePermission(string path){
|
public static bool CheckFolderWritePermission(string path){
|
||||||
string testFile = Path.Combine(path, ".test");
|
string testFile = Path.Combine(path, ".test");
|
||||||
@@ -39,15 +45,6 @@ namespace TweetDck.Core.Utils{
|
|||||||
return Process.Start(processInfo);
|
return Process.Start(processInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Timer CreateSingleTickTimer(int timeout){
|
|
||||||
Timer timer = new Timer{
|
|
||||||
Interval = timeout
|
|
||||||
};
|
|
||||||
|
|
||||||
timer.Tick += (sender, args) => timer.Stop();
|
|
||||||
return timer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool TrySleepUntil(Func<bool> test, int timeoutMillis, int timeStepMillis){
|
public static bool TrySleepUntil(Func<bool> test, int timeoutMillis, int timeStepMillis){
|
||||||
for(int waited = 0; waited < timeoutMillis; waited += timeStepMillis){
|
for(int waited = 0; waited < timeoutMillis; waited += timeStepMillis){
|
||||||
if (test()){
|
if (test()){
|
||||||
@@ -60,6 +57,21 @@ namespace TweetDck.Core.Utils{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void TryDeleteFolderWhenAble(string path, int timeout){
|
||||||
|
new Thread(() => {
|
||||||
|
TrySleepUntil(() => {
|
||||||
|
try{
|
||||||
|
Directory.Delete(path, true);
|
||||||
|
return true;
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
return true;
|
||||||
|
}catch{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, timeout, 500);
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
public static void ClipboardStripHtmlStyles(){
|
public static void ClipboardStripHtmlStyles(){
|
||||||
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
||||||
return;
|
return;
|
||||||
@@ -68,10 +80,10 @@ namespace TweetDck.Core.Utils{
|
|||||||
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||||
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
||||||
|
|
||||||
string updatedHtml = RegexStripHtmlStyles.Replace(originalHtml, string.Empty);
|
string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty);
|
||||||
|
|
||||||
int removed = originalHtml.Length-updatedHtml.Length;
|
int removed = originalHtml.Length-updatedHtml.Length;
|
||||||
updatedHtml = RegexOffsetClipboardHtml.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||||
|
|
||||||
DataObject obj = new DataObject();
|
DataObject obj = new DataObject();
|
||||||
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
||||||
|
23
Plugins/Controls/PluginControl.Designer.cs
generated
23
Plugins/Controls/PluginControl.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Controls {
|
namespace TweetDuck.Plugins.Controls {
|
||||||
partial class PluginControl {
|
partial class PluginControl {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
this.btnToggleState.Location = new System.Drawing.Point(459, 80);
|
this.btnToggleState.Location = new System.Drawing.Point(459, 80);
|
||||||
this.btnToggleState.Name = "btnToggleState";
|
this.btnToggleState.Name = "btnToggleState";
|
||||||
this.btnToggleState.Size = new System.Drawing.Size(65, 23);
|
this.btnToggleState.Size = new System.Drawing.Size(65, 23);
|
||||||
this.btnToggleState.TabIndex = 0;
|
this.btnToggleState.TabIndex = 5;
|
||||||
this.btnToggleState.Text = "Disable";
|
this.btnToggleState.Text = "Disable";
|
||||||
this.btnToggleState.UseVisualStyleBackColor = true;
|
this.btnToggleState.UseVisualStyleBackColor = true;
|
||||||
this.btnToggleState.Click += new System.EventHandler(this.btnToggleState_Click);
|
this.btnToggleState.Click += new System.EventHandler(this.btnToggleState_Click);
|
||||||
@@ -54,8 +54,9 @@
|
|||||||
this.labelName.Location = new System.Drawing.Point(7, 7);
|
this.labelName.Location = new System.Drawing.Point(7, 7);
|
||||||
this.labelName.Name = "labelName";
|
this.labelName.Name = "labelName";
|
||||||
this.labelName.Size = new System.Drawing.Size(61, 24);
|
this.labelName.Size = new System.Drawing.Size(61, 24);
|
||||||
this.labelName.TabIndex = 1;
|
this.labelName.TabIndex = 0;
|
||||||
this.labelName.Text = "Name";
|
this.labelName.Text = "Name";
|
||||||
|
this.labelName.UseMnemonic = false;
|
||||||
//
|
//
|
||||||
// panelDescription
|
// panelDescription
|
||||||
//
|
//
|
||||||
@@ -79,8 +80,9 @@
|
|||||||
this.labelDescription.Margin = new System.Windows.Forms.Padding(0);
|
this.labelDescription.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.labelDescription.Name = "labelDescription";
|
this.labelDescription.Name = "labelDescription";
|
||||||
this.labelDescription.Size = new System.Drawing.Size(13, 39);
|
this.labelDescription.Size = new System.Drawing.Size(13, 39);
|
||||||
this.labelDescription.TabIndex = 3;
|
this.labelDescription.TabIndex = 0;
|
||||||
this.labelDescription.Text = "a\r\nb\r\nc";
|
this.labelDescription.Text = "a\r\nb\r\nc";
|
||||||
|
this.labelDescription.UseMnemonic = false;
|
||||||
//
|
//
|
||||||
// labelAuthor
|
// labelAuthor
|
||||||
//
|
//
|
||||||
@@ -89,8 +91,9 @@
|
|||||||
this.labelAuthor.Margin = new System.Windows.Forms.Padding(3, 0, 32, 0);
|
this.labelAuthor.Margin = new System.Windows.Forms.Padding(3, 0, 32, 0);
|
||||||
this.labelAuthor.Name = "labelAuthor";
|
this.labelAuthor.Name = "labelAuthor";
|
||||||
this.labelAuthor.Size = new System.Drawing.Size(38, 13);
|
this.labelAuthor.Size = new System.Drawing.Size(38, 13);
|
||||||
this.labelAuthor.TabIndex = 3;
|
this.labelAuthor.TabIndex = 0;
|
||||||
this.labelAuthor.Text = "Author";
|
this.labelAuthor.Text = "Author";
|
||||||
|
this.labelAuthor.UseMnemonic = false;
|
||||||
//
|
//
|
||||||
// flowLayoutInfo
|
// flowLayoutInfo
|
||||||
//
|
//
|
||||||
@@ -101,7 +104,7 @@
|
|||||||
this.flowLayoutInfo.Location = new System.Drawing.Point(11, 85);
|
this.flowLayoutInfo.Location = new System.Drawing.Point(11, 85);
|
||||||
this.flowLayoutInfo.Name = "flowLayoutInfo";
|
this.flowLayoutInfo.Name = "flowLayoutInfo";
|
||||||
this.flowLayoutInfo.Size = new System.Drawing.Size(368, 18);
|
this.flowLayoutInfo.Size = new System.Drawing.Size(368, 18);
|
||||||
this.flowLayoutInfo.TabIndex = 4;
|
this.flowLayoutInfo.TabIndex = 3;
|
||||||
this.flowLayoutInfo.WrapContents = false;
|
this.flowLayoutInfo.WrapContents = false;
|
||||||
//
|
//
|
||||||
// labelWebsite
|
// labelWebsite
|
||||||
@@ -113,8 +116,9 @@
|
|||||||
this.labelWebsite.Location = new System.Drawing.Point(76, 0);
|
this.labelWebsite.Location = new System.Drawing.Point(76, 0);
|
||||||
this.labelWebsite.Name = "labelWebsite";
|
this.labelWebsite.Name = "labelWebsite";
|
||||||
this.labelWebsite.Size = new System.Drawing.Size(46, 13);
|
this.labelWebsite.Size = new System.Drawing.Size(46, 13);
|
||||||
this.labelWebsite.TabIndex = 5;
|
this.labelWebsite.TabIndex = 1;
|
||||||
this.labelWebsite.Text = "Website";
|
this.labelWebsite.Text = "Website";
|
||||||
|
this.labelWebsite.UseMnemonic = false;
|
||||||
this.labelWebsite.Click += new System.EventHandler(this.labelWebsite_Click);
|
this.labelWebsite.Click += new System.EventHandler(this.labelWebsite_Click);
|
||||||
//
|
//
|
||||||
// labelVersion
|
// labelVersion
|
||||||
@@ -125,9 +129,10 @@
|
|||||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
this.labelVersion.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
|
||||||
this.labelVersion.Name = "labelVersion";
|
this.labelVersion.Name = "labelVersion";
|
||||||
this.labelVersion.Size = new System.Drawing.Size(513, 13);
|
this.labelVersion.Size = new System.Drawing.Size(513, 13);
|
||||||
this.labelVersion.TabIndex = 5;
|
this.labelVersion.TabIndex = 1;
|
||||||
this.labelVersion.Text = "Version";
|
this.labelVersion.Text = "Version";
|
||||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
this.labelVersion.UseMnemonic = false;
|
||||||
//
|
//
|
||||||
// btnOpenConfig
|
// btnOpenConfig
|
||||||
//
|
//
|
||||||
@@ -135,7 +140,7 @@
|
|||||||
this.btnOpenConfig.Location = new System.Drawing.Point(385, 80);
|
this.btnOpenConfig.Location = new System.Drawing.Point(385, 80);
|
||||||
this.btnOpenConfig.Name = "btnOpenConfig";
|
this.btnOpenConfig.Name = "btnOpenConfig";
|
||||||
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23);
|
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23);
|
||||||
this.btnOpenConfig.TabIndex = 6;
|
this.btnOpenConfig.TabIndex = 4;
|
||||||
this.btnOpenConfig.Text = "Configure";
|
this.btnOpenConfig.Text = "Configure";
|
||||||
this.btnOpenConfig.UseVisualStyleBackColor = true;
|
this.btnOpenConfig.UseVisualStyleBackColor = true;
|
||||||
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click);
|
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click);
|
||||||
|
@@ -3,9 +3,9 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
partial class PluginControl : UserControl{
|
partial class PluginControl : UserControl{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
private readonly Plugin plugin;
|
private readonly Plugin plugin;
|
||||||
@@ -61,7 +61,7 @@ namespace TweetDck.Plugins.Controls{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePluginState(){
|
private void UpdatePluginState(){
|
||||||
bool isEnabled = plugin.CanRun && pluginManager.Config.IsEnabled(plugin);
|
bool isEnabled = pluginManager.Config.IsEnabled(plugin) && plugin.CanRun;
|
||||||
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
|
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
|
||||||
|
|
||||||
labelVersion.ForeColor = textColor;
|
labelVersion.ForeColor = textColor;
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
namespace TweetDck.Plugins.Controls{
|
|
||||||
partial class PluginListFlowLayout{}
|
|
||||||
}
|
|
@@ -1,8 +1,8 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
sealed partial class PluginListFlowLayout : FlowLayoutPanel{
|
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
||||||
public PluginListFlowLayout(){
|
public PluginListFlowLayout(){
|
||||||
FlowDirection = FlowDirection.TopDown;
|
FlowDirection = FlowDirection.TopDown;
|
||||||
WrapContents = false;
|
WrapContents = false;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum PluginEnvironment{
|
enum PluginEnvironment{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
enum PluginFolder{
|
enum PluginFolder{
|
||||||
Root, Data
|
Root, Data
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
enum PluginGroup{
|
enum PluginGroup{
|
||||||
Official, Custom
|
Official, Custom
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDuck.Plugins.Events{
|
||||||
class PluginChangedStateEventArgs : EventArgs{
|
class PluginChangedStateEventArgs : EventArgs{
|
||||||
public Plugin Plugin { get; private set; }
|
public Plugin Plugin { get; }
|
||||||
public bool IsEnabled { get; private set; }
|
public bool IsEnabled { get; }
|
||||||
|
|
||||||
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
|
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
|
14
Plugins/Events/PluginErrorEventArgs.cs
Normal file
14
Plugins/Events/PluginErrorEventArgs.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace TweetDuck.Plugins.Events{
|
||||||
|
class PluginErrorEventArgs : EventArgs{
|
||||||
|
public bool HasErrors => Errors.Count > 0;
|
||||||
|
|
||||||
|
public IList<string> Errors;
|
||||||
|
|
||||||
|
public PluginErrorEventArgs(IList<string> errors){
|
||||||
|
this.Errors = errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
|
||||||
class PluginLoadEventArgs : EventArgs{
|
|
||||||
public bool Success{
|
|
||||||
get{
|
|
||||||
return Errors.Count == 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IList<string> Errors;
|
|
||||||
|
|
||||||
public PluginLoadEventArgs(IList<string> errors){
|
|
||||||
this.Errors = errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user