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

Compare commits

...

38 Commits
1.3 ... 1.3.2

Author SHA1 Message Date
45bdd95dc8 Release 1.3.2 2016-08-13 13:20:13 +02:00
569fdec380 Fix middle-clicking on certain user links opening the page in TweetDuck window 2016-08-13 03:26:00 +02:00
3f15ff1c06 Fix missing default value for NotificationDurationValue causing crash with fresh install 2016-08-13 03:16:28 +02:00
506cd52255 Change the Reload context menu action to return to TD website 2016-08-12 22:30:36 +02:00
300c0c6195 Minor TweetDeck UI fixes (cut off account names and verified badge icons) 2016-08-10 17:16:39 +02:00
7689fe97b0 Fix unimplemented cache param in plugin bridge and clear cache on plugin reload 2016-08-10 16:53:26 +02:00
99ed077dbc Fix missing url word break in notifications 2016-08-10 15:48:50 +02:00
65aeb6656f Add a very basic setting for custom CSS in browser and notifications 2016-08-10 15:45:56 +02:00
e4f5766ffb Change font and check for null in CEF argument dialog 2016-08-10 15:03:15 +02:00
353ac7c76b Add setting for CEF command line args
Closes #52
2016-08-10 14:46:24 +02:00
8073fa206b Add a safety net to track bar value setting in case the config file is faulty 2016-08-10 12:47:56 +02:00
1a1cfa2220 Force visibility for fav/rt tweet actions in design-revert in detail view 2016-08-10 01:27:38 +02:00
5e93d866ad Fix missing fav/rt indicators in design-revert plugin
Closes #51
2016-08-10 01:17:26 +02:00
f29e03e250 Release 1.3.1 2016-08-06 03:35:59 +02:00
3775b5968d Fix potential memory leaks with FlatProgressBar color brush 2016-08-04 13:43:32 +02:00
ba6242e09d Change notification duration setting to a track bar 2016-07-28 21:58:42 +02:00
f6b0ddddb9 Add FlatButton for generic buttons without double border on focus 2016-07-28 21:51:49 +02:00
9e8d5c6768 Unify group boxes and layout in Settings tab 2016-07-28 15:21:29 +02:00
ef78496d5d Add notification count down toggle option 2016-07-28 14:24:43 +02:00
41a45a14df Change tray highlight to trigger on any notification and reset on window focus
Closes #33
2016-07-27 04:48:09 +02:00
5d3721ad04 Move Import/Export/Reset buttons to Advanced tab and replace them with a hint label 2016-07-26 23:45:20 +02:00
f75bcb505c Unify Settings tab size in Designer for easier manipulation 2016-07-26 23:43:48 +02:00
fa365794a0 Rewrite plugin file methods for the JS promise system 2016-07-24 21:26:24 +02:00
a747ab700e Fix blank space in Plugin Control description when none is provided 2016-07-24 19:28:17 +02:00
b51b017005 Fix plugin script generator causing JS syntax error 2016-07-24 18:14:56 +02:00
b9e1dd5950 Add combined tray icon behavior option
Closes #46
2016-07-24 16:48:26 +02:00
56bf33229b Add a legacy notification load system option 2016-07-24 16:30:58 +02:00
5740dd8c8a Add plugin bridge object to script variable list 2016-07-24 15:35:17 +02:00
d3f205287c Reset Notification Settings example timer when switching tabs 2016-07-24 15:17:08 +02:00
53518cd6e6 Change Notification Settings labels and add edge distance label 2016-07-24 15:13:51 +02:00
0ff3896d51 Add tooltips to Settings items 2016-07-24 14:27:00 +02:00
c64e16471b Add plugin utility bridge with file functionality and a plugin token system 2016-07-23 18:36:58 +02:00
2f2e2b82b8 Reset notification mouse hook variable when disposing 2016-07-11 15:55:18 +02:00
af9a503f3c Fix call order with notification scroll focus 2016-07-10 17:33:21 +02:00
971affa607 Fix unreliable unfocused notification window scroll wheel hook 2016-07-09 21:33:46 +02:00
2de5d6206e Change notification window scrollbar width and remove border radius 2016-07-09 20:54:13 +02:00
34e0bcc56a Focus notification window when mouse wheel is scrolled above it 2016-07-09 19:37:27 +02:00
bb9f09c11f Make sure all Settings controls are disposed when closing 2016-07-09 16:46:08 +02:00
38 changed files with 1382 additions and 331 deletions

View File

@@ -16,7 +16,7 @@ namespace TweetDck.Configuration{
Binder = new SerializationCompatibilityHandler()
};
private const int CurrentFileVersion = 3;
private const int CurrentFileVersion = 4;
// START OF CONFIGURATION
@@ -25,20 +25,29 @@ namespace TweetDck.Configuration{
public WindowState BrowserWindow { get; set; }
public bool DisplayNotificationTimer { get; set; }
public bool NotificationTimerCountDown { get; set; }
public TweetNotification.Duration NotificationDuration { get; set; }
public TweetNotification.Position NotificationPosition { get; set; }
public Point CustomNotificationPosition { get; set; }
public int NotificationEdgeDistance { get; set; }
public int NotificationDisplay { get; set; }
public int NotificationDurationValue { get; set; }
public bool NotificationLegacyLoad { get; set; }
public bool ExpandLinksOnHover { get; set; }
public bool EnableTrayHighlight { get; set; }
public bool EnableUpdateCheck { get; set; }
public string DismissedUpdate { get; set; }
public bool ExpandLinksOnHover { get; set; }
public PluginConfig Plugins { get; private set; }
public WindowState PluginsWindow { get; set; }
public string CustomCefArgs { get; set; }
public string CustomBrowserCSS { get; set; }
public string CustomNotificationCSS { get; set; }
public bool IsCustomNotificationPositionSet{
get{
return CustomNotificationPosition.X != -32000 && CustomNotificationPosition.X != 32000;
@@ -101,8 +110,10 @@ namespace TweetDck.Configuration{
NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = new Point(-32000,-32000);
NotificationEdgeDistance = 8;
NotificationDurationValue = 25;
EnableUpdateCheck = true;
ExpandLinksOnHover = true;
EnableTrayHighlight = true;
Plugins = new PluginConfig();
PluginsWindow = new WindowState();
}
@@ -131,6 +142,19 @@ namespace TweetDck.Configuration{
++fileVersion;
}
if (fileVersion == 3){
EnableTrayHighlight = true;
switch(NotificationDuration){
case TweetNotification.Duration.Short: NotificationDurationValue = 15; break;
case TweetNotification.Duration.Medium: NotificationDurationValue = 25; break;
case TweetNotification.Duration.Long: NotificationDurationValue = 35; break;
case TweetNotification.Duration.VeryLong: NotificationDurationValue = 45; break;
}
++fileVersion;
}
// update the version
fileVersion = CurrentFileVersion;
Save();

View File

@@ -28,5 +28,11 @@ namespace TweetDck.Core.Controls{
bar.Value = value;
}
}
public static void SetValueSafe(this TrackBar trackBar, int value){
if (value >= trackBar.Minimum && value <= trackBar.Maximum){
trackBar.Value = value;
}
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
class FlatButton : Button{
protected override bool ShowFocusCues{
get{
return false;
}
}
public FlatButton(){
GotFocus += FlatButton_GotFocus;
}
private void FlatButton_GotFocus(object sender, EventArgs e){ // removes extra border when focused
NotifyDefault(false);
}
}
}

View File

@@ -3,9 +3,11 @@ using System.Windows.Forms;
namespace TweetDck.Core.Controls{
public partial class FlatProgressBar : ProgressBar{
private SolidBrush brush;
private readonly SolidBrush brush;
public FlatProgressBar(){
brush = new SolidBrush(Color.White);
SetStyle(ControlStyles.UserPaint,true);
SetStyle(ControlStyles.OptimizedDoubleBuffer,true);
}
@@ -15,8 +17,8 @@ namespace TweetDck.Core.Controls{
}
protected override void OnPaint(PaintEventArgs e){
if (brush == null || brush.Color != ForeColor){
brush = new SolidBrush(ForeColor);
if (brush.Color != ForeColor){
brush.Color = ForeColor;
}
Rectangle rect = e.ClipRectangle;
@@ -25,9 +27,11 @@ namespace TweetDck.Core.Controls{
}
protected override void Dispose(bool disposing){
if (brush != null)brush.Dispose();
base.Dispose(disposing);
if (disposing){
brush.Dispose();
}
}
}
}

View File

@@ -3,19 +3,9 @@ using System.Drawing;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
sealed partial class TabButton : Button{
protected override bool ShowFocusCues{
get{
return false;
}
}
sealed partial class TabButton : FlatButton{
public Action Callback { get; private set; }
public TabButton(){
GotFocus += TabButton_GotFocus;
}
public void SetupButton(int locationX, int sizeWidth, string title, Action callback){
Callback = callback;
@@ -31,9 +21,5 @@ namespace TweetDck.Core.Controls{
UseVisualStyleBackColor = true;
ResumeLayout(true);
}
private void TabButton_GotFocus(object sender, EventArgs e){ // removes extra border when focused
NotifyDefault(false);
}
}
}

View File

@@ -43,6 +43,7 @@
this.MinimumSize = new System.Drawing.Size(340, 424);
this.Name = "FormBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
this.Resize += new System.EventHandler(this.FormBrowser_Resize);

View File

@@ -55,6 +55,7 @@ namespace TweetDck.Core{
this.browser.LoadingStateChanged += Browser_LoadingStateChanged;
this.browser.FrameLoadEnd += Browser_FrameLoadEnd;
this.browser.RegisterJsObject("$TD",new TweetDeckBridge(this,notification));
this.browser.RegisterAsyncJsObject("$TDP",plugins.Bridge);
Controls.Add(browser);
@@ -81,7 +82,7 @@ namespace TweetDck.Core{
}
public FormNotification CreateNotificationForm(bool autoHide){
return new FormNotification(this,plugins,trayIcon,autoHide);
return new FormNotification(this,plugins,autoHide);
}
// window setup
@@ -93,7 +94,7 @@ namespace TweetDck.Core{
}
private void UpdateTrayIcon(){
trayIcon.Visible = Config.TrayBehavior != TrayIcon.Behavior.Disabled;
trayIcon.Visible = Config.TrayBehavior.ShouldDisplayIcon();
}
// active event handlers
@@ -116,6 +117,12 @@ namespace TweetDck.Core{
}
}
private void FormBrowser_Activated(object sender, EventArgs e){
if (!isLoaded)return;
trayIcon.HasNotifications = false;
}
private void FormBrowser_Resize(object sender, EventArgs e){
if (!isLoaded)return;
@@ -123,7 +130,7 @@ namespace TweetDck.Core{
prevState = WindowState;
if (WindowState == FormWindowState.Minimized){
if (Config.TrayBehavior == TrayIcon.Behavior.MinimizeToTray){
if (Config.TrayBehavior.ShouldHideOnMinimize()){
Hide(); // hides taskbar too?! welp that works I guess
}
}
@@ -145,7 +152,7 @@ namespace TweetDck.Core{
private void FormBrowser_FormClosing(object sender, FormClosingEventArgs e){
if (!isLoaded)return;
if (Config.TrayBehavior == TrayIcon.Behavior.CloseToTray && trayIcon.Visible && e.CloseReason == CloseReason.UserClosing){
if (Config.TrayBehavior.ShouldHideOnClose() && trayIcon.Visible && e.CloseReason == CloseReason.UserClosing){
Hide(); // hides taskbar too?! welp that works I guess
e.Cancel = true;
}
@@ -174,7 +181,7 @@ namespace TweetDck.Core{
}
private void plugins_Reloaded(object sender, PluginLoadEventArgs e){
browser.ExecuteScriptAsync("window.location.reload()");
ReloadBrowser();
}
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
@@ -233,6 +240,10 @@ namespace TweetDck.Core{
Config.Save();
updates.Check(false);
}
if (!Config.EnableTrayHighlight){
trayIcon.HasNotifications = false;
}
};
ShowChildForm(currentFormSettings);
@@ -261,8 +272,10 @@ namespace TweetDck.Core{
}
}
public void OnTweetSound(){
public void OnTweetNotification(){
if (Config.EnableTrayHighlight && !ContainsFocus){
trayIcon.HasNotifications = true;
}
}
public void DisplayTooltip(string text){
@@ -283,5 +296,9 @@ namespace TweetDck.Core{
public void OnImagePastedFinish(){
browser.ExecuteScriptAsync("TDGF_tryPasteImageFinish",new object[0]);
}
public void ReloadBrowser(){
browser.ExecuteScriptAsync("window.location.reload()");
}
}
}

View File

@@ -21,12 +21,14 @@ namespace TweetDck.Core{
private readonly Form owner;
private readonly PluginManager plugins;
private readonly TrayIcon trayIcon;
private readonly ChromiumWebBrowser browser;
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
private readonly bool autoHide;
private int timeLeft, totalTime;
private readonly NativeMethods.HookProc mouseHookDelegate;
private IntPtr mouseHook;
private bool? prevDisplayTimer;
private int? prevFontSize;
@@ -78,14 +80,13 @@ namespace TweetDck.Core{
}
}
public FormNotification(FormBrowser owner, PluginManager plugins, TrayIcon trayIcon, bool autoHide){
public FormNotification(FormBrowser owner, PluginManager pluginManager, bool autoHide){
InitializeComponent();
Text = Program.BrandName;
this.owner = owner;
this.plugins = plugins;
this.trayIcon = trayIcon;
this.plugins = pluginManager;
this.autoHide = autoHide;
owner.FormClosed += (sender, args) => Close();
@@ -101,6 +102,7 @@ namespace TweetDck.Core{
browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
browser.FrameLoadEnd += Browser_FrameLoadEnd;
browser.RegisterJsObject("$TD",new TweetDeckBridge(owner,this));
browser.RegisterAsyncJsObject("$TDP",plugins.Bridge);
panelBrowser.Controls.Add(browser);
@@ -109,7 +111,10 @@ namespace TweetDck.Core{
Disposed += (sender, args) => Program.UserConfig.MuteToggled -= Config_MuteToggled;
}
Disposed += (sender, args) => browser.Dispose();
mouseHookDelegate = MouseHookProc;
mouseHook = NativeMethods.SetWindowsHookEx(NativeMethods.WH_MOUSE_LL,mouseHookDelegate,IntPtr.Zero,0);
Disposed += FormNotification_Disposed;
}
protected override void WndProc(ref Message m){
@@ -120,13 +125,27 @@ namespace TweetDck.Core{
base.WndProc(ref m);
}
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(-1,-1));
NativeMethods.SimulateMouseClick(NativeMethods.MouseButton.Left);
Cursor.Position = prevPos;
}
return NativeMethods.CallNextHookEx(mouseHook,nCode,wParam,lParam);
}
// event handlers
private void timerHideProgress_Tick(object sender, EventArgs e){
if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen)return;
timeLeft -= timerProgress.Interval;
progressBarTimer.SetValueInstant((int)Math.Min(1000,Math.Round(1025.0*(totalTime-timeLeft)/totalTime)));
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();
@@ -137,12 +156,8 @@ namespace TweetDck.Core{
if (Program.UserConfig.MuteNotifications){
HideNotification(true);
}
else{
if (tweetQueue.Count > 0){
LoadNextNotification();
}
trayIcon.HasNotifications = false;
else if (tweetQueue.Count > 0){
LoadNextNotification();
}
}
@@ -155,7 +170,7 @@ namespace TweetDck.Core{
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
if (!e.Frame.IsMain)return;
if (!isInitialized){
if (!isInitialized && !Program.UserConfig.NotificationLegacyLoad){
isInitialized = true;
if (Initialized != null){
@@ -180,12 +195,20 @@ namespace TweetDck.Core{
}
}
private void FormNotification_Disposed(object sender, EventArgs e){
browser.Dispose();
if (mouseHook != IntPtr.Zero){
NativeMethods.UnhookWindowsHookEx(mouseHook);
mouseHook = IntPtr.Zero;
}
}
// notification methods
public void ShowNotification(TweetNotification notification){
if (Program.UserConfig.MuteNotifications){
tweetQueue.Enqueue(notification);
trayIcon.HasNotifications = true;
}
else{
tweetQueue.Enqueue(notification);
@@ -207,12 +230,12 @@ namespace TweetDck.Core{
}
public void HideNotification(bool loadBlank){
if (loadBlank){
if (loadBlank || Program.UserConfig.NotificationLegacyLoad){
browser.LoadHtml("","about:blank");
}
Location = new Point(-32000,-32000);
progressBarTimer.Value = 0;
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
timerProgress.Stop();
}
@@ -242,10 +265,14 @@ namespace TweetDck.Core{
CurrentUrl = tweet.Url;
timerProgress.Stop();
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDuration);
progressBarTimer.Value = 0;
totalTime = timeLeft = tweet.GetDisplayDuration(Program.UserConfig.NotificationDurationValue);
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
browser.LoadHtml(tweet.GenerateHtml(),"http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
if (Program.UserConfig.NotificationLegacyLoad){
OnNotificationReady();
}
}
private void MoveToVisibleLocation(){

View File

@@ -57,6 +57,10 @@ namespace TweetDck.Core.Handling{
}
switch((int)commandId){
case (int)CefMenuCommand.Reload:
frame.ExecuteJavaScriptAsync("window.location.href = 'https://tweetdeck.twitter.com'");
return true;
case MenuSettings:
form.InvokeSafe(form.OpenSettings);
return true;

View File

@@ -41,6 +41,18 @@ namespace TweetDck.Core.Handling{
}
}
public bool HasCustomBrowserCSS{
get{
return !string.IsNullOrEmpty(Program.UserConfig.CustomBrowserCSS);
}
}
public string CustomBrowserCSS{
get{
return Program.UserConfig.CustomBrowserCSS;
}
}
public TweetDeckBridge(FormBrowser form, FormNotification notification){
this.form = form;
this.notification = notification;
@@ -83,16 +95,19 @@ namespace TweetDck.Core.Handling{
public void OnTweetPopup(string tweetHtml, string tweetUrl, int tweetCharacters){
notification.InvokeSafe(() => {
form.OnTweetNotification();
notification.ShowNotification(new TweetNotification(tweetHtml,tweetUrl,tweetCharacters));
});
}
public void OnTweetSound(){
form.InvokeSafe(form.OnTweetSound);
form.InvokeSafe(form.OnTweetNotification);
}
public void OnNotificationReady(){
notification.InvokeSafe(notification.OnNotificationReady);
if (!Program.UserConfig.NotificationLegacyLoad){
notification.InvokeSafe(notification.OnNotificationReady);
}
}
public void DisplayTooltip(string text, bool showInNotification){

View File

@@ -18,6 +18,12 @@ namespace TweetDck.Core.Handling{
}
}
private static string CustomCSS{
get{
return @".scroll-styled-v::-webkit-scrollbar{width:8px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}a[data-full-url]{word-break:break-all}";
}
}
public static int FontSizeLevel{
get{
switch(FontSizeClass){
@@ -80,24 +86,21 @@ namespace TweetDck.Core.Handling{
this.characters = characters;
}
public int GetDisplayDuration(Duration modifier){
int multiplier;
switch(modifier){
case Duration.Short: multiplier = 15; break;
case Duration.Long: multiplier = 35; break;
case Duration.VeryLong: multiplier = 45; break;
default: multiplier = 25; break;
}
return 2000+Math.Max(1000,multiplier*characters);
public int GetDisplayDuration(int value){
return 2000+Math.Max(1000,value*characters);
}
public string GenerateHtml(){
StringBuilder build = new StringBuilder();
build.Append("<!DOCTYPE html>");
build.Append("<html class='os-windows txt-base-").Append(FontSizeClass ?? DefaultFontSizeClass).Append("'>");
build.Append("<head>").Append(HeadTag ?? DefaultHeadTag).Append("</head>");
build.Append("<head>").Append(HeadTag ?? DefaultHeadTag).Append("<style type='text/css'>").Append(CustomCSS).Append("</style>");
if (!string.IsNullOrEmpty(Program.UserConfig.CustomNotificationCSS)){
build.Append("<style type='text/css'>").Append(Program.UserConfig.CustomNotificationCSS).Append("</style>");
}
build.Append("</head>");
build.Append("<body class='hearty'><div class='app-columns-container'><div class='column scroll-styled-v' style='width:100%;overflow-y:auto'>");
build.Append(html);
build.Append("</div></div></body>");

View File

@@ -24,23 +24,11 @@
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormSettings));
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
this.btnClose = new System.Windows.Forms.Button();
this.btnExport = new System.Windows.Forms.Button();
this.btnImport = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
this.labelTip = new System.Windows.Forms.Label();
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
this.SuspendLayout();
//
// tabPanel
//
this.tabPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabPanel.Location = new System.Drawing.Point(12, 12);
this.tabPanel.Name = "tabPanel";
this.tabPanel.Size = new System.Drawing.Size(480, 313);
this.tabPanel.TabIndex = 3;
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@@ -54,53 +42,31 @@
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnExport
// labelTip
//
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnExport.AutoSize = true;
this.btnExport.Location = new System.Drawing.Point(12, 331);
this.btnExport.Name = "btnExport";
this.btnExport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnExport.Size = new System.Drawing.Size(94, 23);
this.btnExport.TabIndex = 5;
this.btnExport.Text = "Export Settings";
this.btnExport.UseVisualStyleBackColor = true;
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
this.labelTip.AutoSize = true;
this.labelTip.Location = new System.Drawing.Point(12, 333);
this.labelTip.Name = "labelTip";
this.labelTip.Size = new System.Drawing.Size(310, 13);
this.labelTip.TabIndex = 5;
this.labelTip.Text = "Tip: Move your cursor over an option to see detailed explanation";
//
// btnImport
// tabPanel
//
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnImport.AutoSize = true;
this.btnImport.Location = new System.Drawing.Point(112, 331);
this.btnImport.Name = "btnImport";
this.btnImport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnImport.Size = new System.Drawing.Size(94, 23);
this.btnImport.TabIndex = 6;
this.btnImport.Text = "Import Settings";
this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// btnReset
//
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnReset.AutoSize = true;
this.btnReset.Location = new System.Drawing.Point(212, 331);
this.btnReset.Name = "btnReset";
this.btnReset.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnReset.Size = new System.Drawing.Size(102, 23);
this.btnReset.TabIndex = 7;
this.btnReset.Text = "Restore Defaults";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
this.tabPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabPanel.Location = new System.Drawing.Point(12, 12);
this.tabPanel.Name = "tabPanel";
this.tabPanel.Size = new System.Drawing.Size(480, 313);
this.tabPanel.TabIndex = 3;
//
// FormSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(504, 366);
this.Controls.Add(this.btnReset);
this.Controls.Add(this.btnImport);
this.Controls.Add(this.btnExport);
this.Controls.Add(this.labelTip);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.tabPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@@ -119,8 +85,6 @@
private Controls.TabPanel tabPanel;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Label labelTip;
}
}

View File

@@ -19,7 +19,7 @@ namespace TweetDck.Core.Other{
this.tabPanel.AddButton("General",SelectTab<TabSettingsGeneral>);
this.tabPanel.AddButton("Notifications",() => SelectTab(() => new TabSettingsNotifications(browserForm.CreateNotificationForm(false))));
this.tabPanel.AddButton("Updates",() => SelectTab(() => new TabSettingsUpdates(updates)));
this.tabPanel.AddButton("Advanced",SelectTab<TabSettingsAdvanced>);
this.tabPanel.AddButton("Advanced",() => SelectTab(() => new TabSettingsAdvanced(browserForm.ReloadBrowser)));
this.tabPanel.SelectTab(tabPanel.Buttons.First());
}
@@ -42,66 +42,9 @@ namespace TweetDck.Core.Other{
private void FormSettings_FormClosing(object sender, FormClosingEventArgs e){
Program.UserConfig.Save();
}
private void btnExport_Click(object sender, EventArgs e){
DialogResult resultSaveCredentials = MessageBox.Show("Do you want to include your login session? This will not save your password into the file, but it will allow anyone with the file to login into TweetDeck as you.","Export "+Program.BrandName+" Settings",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button3);
if (resultSaveCredentials == DialogResult.Cancel)return;
bool saveCredentials = resultSaveCredentials == DialogResult.Yes;
string file;
using(SaveFileDialog dialog = new SaveFileDialog{
AddExtension = true,
AutoUpgradeEnabled = true,
OverwritePrompt = true,
DefaultExt = "tdsettings",
FileName = Program.BrandName+".tdsettings",
Title = "Export "+Program.BrandName+" Settings",
Filter = Program.BrandName+" Settings (*.tdsettings)|*.tdsettings"
}){
file = dialog.ShowDialog() == DialogResult.OK ? dialog.FileName : null;
}
if (file != null){
Program.UserConfig.Save();
ExportManager manager = new ExportManager(file);
if (!manager.Export(saveCredentials)){
Program.HandleException("An exception happened while exporting "+Program.BrandName+" settings.",manager.LastException);
}
}
}
private void btnImport_Click(object sender, EventArgs e){
string file;
using(OpenFileDialog dialog = new OpenFileDialog{
AutoUpgradeEnabled = true,
DereferenceLinks = true,
Title = "Import "+Program.BrandName+" Settings",
Filter = Program.BrandName+" Settings (*.tdsettings)|*.tdsettings"
}){
file = dialog.ShowDialog() == DialogResult.OK ? dialog.FileName : null;
}
if (file != null){
ExportManager manager = new ExportManager(file);
if (manager.Import()){
ReloadUI();
}
else{
Program.HandleException("An exception happened while importing "+Program.BrandName+" settings.",manager.LastException);
}
}
}
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){
Program.ResetConfig();
ReloadUI();
foreach(BaseTabSettings control in tabs.Values){
control.Dispose();
}
}
@@ -109,7 +52,7 @@ namespace TweetDck.Core.Other{
Close();
}
private void ReloadUI(){
public void ReloadUI(){
tabs.Clear();
tabPanel.Content.Controls.Clear();
tabPanel.ActiveButton.Callback();

View File

@@ -0,0 +1,181 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
partial class DialogSettingsCSS {
/// <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.textBoxBrowserCSS = new System.Windows.Forms.TextBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.labelBrowser = new System.Windows.Forms.Label();
this.labelNotification = new System.Windows.Forms.Label();
this.textBoxNotificationCSS = new System.Windows.Forms.TextBox();
this.labelWarning = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// textBoxBrowserCSS
//
this.textBoxBrowserCSS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxBrowserCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.textBoxBrowserCSS.Location = new System.Drawing.Point(0, 16);
this.textBoxBrowserCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.textBoxBrowserCSS.Multiline = true;
this.textBoxBrowserCSS.Name = "textBoxBrowserCSS";
this.textBoxBrowserCSS.Size = new System.Drawing.Size(226, 193);
this.textBoxBrowserCSS.TabIndex = 0;
this.textBoxBrowserCSS.WordWrap = false;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(354, 227);
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 = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnApply
//
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnApply.Location = new System.Drawing.Point(416, 227);
this.btnApply.Name = "btnApply";
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnApply.Size = new System.Drawing.Size(56, 23);
this.btnApply.TabIndex = 2;
this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// splitContainer
//
this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer.Location = new System.Drawing.Point(12, 12);
this.splitContainer.Name = "splitContainer";
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.Controls.Add(this.labelBrowser);
this.splitContainer.Panel1.Controls.Add(this.textBoxBrowserCSS);
this.splitContainer.Panel1MinSize = 64;
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.labelNotification);
this.splitContainer.Panel2.Controls.Add(this.textBoxNotificationCSS);
this.splitContainer.Panel2MinSize = 64;
this.splitContainer.Size = new System.Drawing.Size(460, 209);
this.splitContainer.SplitterDistance = 226;
this.splitContainer.SplitterWidth = 5;
this.splitContainer.TabIndex = 5;
//
// labelBrowser
//
this.labelBrowser.AutoSize = true;
this.labelBrowser.Location = new System.Drawing.Point(-3, 0);
this.labelBrowser.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelBrowser.Name = "labelBrowser";
this.labelBrowser.Size = new System.Drawing.Size(45, 13);
this.labelBrowser.TabIndex = 1;
this.labelBrowser.Text = "Browser";
//
// labelNotification
//
this.labelNotification.AutoSize = true;
this.labelNotification.Location = new System.Drawing.Point(-3, 0);
this.labelNotification.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelNotification.Name = "labelNotification";
this.labelNotification.Size = new System.Drawing.Size(60, 13);
this.labelNotification.TabIndex = 2;
this.labelNotification.Text = "Notification";
//
// textBoxNotificationCSS
//
this.textBoxNotificationCSS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxNotificationCSS.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.textBoxNotificationCSS.Location = new System.Drawing.Point(0, 16);
this.textBoxNotificationCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.textBoxNotificationCSS.Multiline = true;
this.textBoxNotificationCSS.Name = "textBoxNotificationCSS";
this.textBoxNotificationCSS.Size = new System.Drawing.Size(227, 193);
this.textBoxNotificationCSS.TabIndex = 1;
this.textBoxNotificationCSS.WordWrap = false;
//
// labelWarning
//
this.labelWarning.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelWarning.AutoSize = true;
this.labelWarning.Location = new System.Drawing.Point(9, 232);
this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(341, 13);
this.labelWarning.TabIndex = 6;
this.labelWarning.Text = "The code is not validated, please make sure there are no syntax errors.";
//
// DialogSettingsCSS
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(484, 262);
this.Controls.Add(this.labelWarning);
this.Controls.Add(this.splitContainer);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnCancel);
this.MinimumSize = new System.Drawing.Size(500, 160);
this.Name = "DialogSettingsCSS";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel1.PerformLayout();
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxBrowserCSS;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.TextBox textBoxNotificationCSS;
private System.Windows.Forms.Label labelBrowser;
private System.Windows.Forms.Label labelNotification;
private System.Windows.Forms.Label labelWarning;
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Windows.Forms;
namespace TweetDck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCSS : Form{
public string BrowserCSS{
get{
return textBoxBrowserCSS.Text;
}
}
public string NotificationCSS{
get{
return textBoxNotificationCSS.Text;
}
}
public DialogSettingsCSS(){
InitializeComponent();
Text = Program.BrandName+" Settings - CSS";
textBoxBrowserCSS.Text = Program.UserConfig.CustomBrowserCSS ?? "";
textBoxNotificationCSS.Text = Program.UserConfig.CustomNotificationCSS ?? "";
}
private void btnApply_Click(object sender, EventArgs e){
DialogResult = DialogResult.OK;
Close();
}
private void btnCancel_Click(object sender, EventArgs e){
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@@ -0,0 +1,120 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
partial class DialogSettingsCefArgs {
/// <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.textBoxArgs = new System.Windows.Forms.TextBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.btnHelp = new System.Windows.Forms.Button();
this.labelWarning = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBoxArgs
//
this.textBoxArgs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxArgs.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.textBoxArgs.Location = new System.Drawing.Point(12, 28);
this.textBoxArgs.Multiline = true;
this.textBoxArgs.Name = "textBoxArgs";
this.textBoxArgs.Size = new System.Drawing.Size(460, 193);
this.textBoxArgs.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(354, 227);
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 = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnApply
//
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnApply.Location = new System.Drawing.Point(416, 227);
this.btnApply.Name = "btnApply";
this.btnApply.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnApply.Size = new System.Drawing.Size(56, 23);
this.btnApply.TabIndex = 2;
this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// btnHelp
//
this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnHelp.AutoSize = true;
this.btnHelp.Location = new System.Drawing.Point(12, 227);
this.btnHelp.Name = "btnHelp";
this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnHelp.Size = new System.Drawing.Size(124, 23);
this.btnHelp.TabIndex = 3;
this.btnHelp.Text = "List of Chromium Args";
this.btnHelp.UseVisualStyleBackColor = true;
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
//
// labelWarning
//
this.labelWarning.AutoSize = true;
this.labelWarning.Location = new System.Drawing.Point(12, 9);
this.labelWarning.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(423, 13);
this.labelWarning.TabIndex = 4;
this.labelWarning.Text = "Warning: Some arguments may cause the program to stop working, edit at your own r" +
"isk.";
//
// DialogSettingsCefArgs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(484, 262);
this.Controls.Add(this.labelWarning);
this.Controls.Add(this.btnHelp);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.textBoxArgs);
this.MinimumSize = new System.Drawing.Size(500, 160);
this.Name = "DialogSettingsCefArgs";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxArgs;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Button btnHelp;
private System.Windows.Forms.Label labelWarning;
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TweetDck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCefArgs : Form{
public string CefArgs{
get{
return textBoxArgs.Text;
}
}
public DialogSettingsCefArgs(){
InitializeComponent();
Text = Program.BrandName+" Settings - CEF Arguments";
textBoxArgs.Text = Program.UserConfig.CustomCefArgs ?? "";
textBoxArgs.Select(textBoxArgs.Text.Length,0);
}
private void btnHelp_Click(object sender, EventArgs e){
BrowserUtils.OpenExternalBrowser("http://peter.sh/experiments/chromium-command-line-switches/");
}
private void btnApply_Click(object sender, EventArgs e){
string prevArgs = Program.UserConfig.CustomCefArgs;
if (CefArgs == prevArgs){
DialogResult = DialogResult.Cancel;
Close();
return;
}
int count = CommandLineArgsParser.AddToDictionary(CefArgs,new Dictionary<string,string>());
string prompt = count == 0 && !string.IsNullOrWhiteSpace(prevArgs) ? "All arguments will be removed from the settings. Continue?" : count+(count == 1 ? " argument" : " arguments")+" will be added to the settings. Continue?";
if (MessageBox.Show(prompt,"Confirm CEF Arguments",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.OK){
DialogResult = DialogResult.OK;
Close();
}
}
private void btnCancel_Click(object sender, EventArgs e){
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@@ -23,51 +23,144 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.btnClearCache = new System.Windows.Forms.Button();
this.labelMiscellaneous = new System.Windows.Forms.Label();
this.checkHardwareAcceleration = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.btnEditCefArgs = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
this.btnImport = new System.Windows.Forms.Button();
this.btnExport = new System.Windows.Forms.Button();
this.groupPerformance = new System.Windows.Forms.GroupBox();
this.groupConfiguration = new System.Windows.Forms.GroupBox();
this.btnEditCSS = new System.Windows.Forms.Button();
this.groupPerformance.SuspendLayout();
this.groupConfiguration.SuspendLayout();
this.SuspendLayout();
//
// btnClearCache
//
this.btnClearCache.Location = new System.Drawing.Point(12, 56);
this.btnClearCache.Location = new System.Drawing.Point(6, 44);
this.btnClearCache.Name = "btnClearCache";
this.btnClearCache.Size = new System.Drawing.Size(171, 23);
this.btnClearCache.TabIndex = 14;
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.btnClearCache.UseVisualStyleBackColor = true;
this.btnClearCache.Click += new System.EventHandler(this.btnClearCache_Click);
//
// labelMiscellaneous
//
this.labelMiscellaneous.AutoSize = true;
this.labelMiscellaneous.Location = new System.Drawing.Point(9, 40);
this.labelMiscellaneous.Margin = new System.Windows.Forms.Padding(3, 11, 3, 0);
this.labelMiscellaneous.Name = "labelMiscellaneous";
this.labelMiscellaneous.Size = new System.Drawing.Size(74, 13);
this.labelMiscellaneous.TabIndex = 13;
this.labelMiscellaneous.Text = "Miscellaneous";
//
// checkHardwareAcceleration
//
this.checkHardwareAcceleration.AutoSize = true;
this.checkHardwareAcceleration.Location = new System.Drawing.Point(9, 9);
this.checkHardwareAcceleration.Location = new System.Drawing.Point(6, 21);
this.checkHardwareAcceleration.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.checkHardwareAcceleration.Name = "checkHardwareAcceleration";
this.checkHardwareAcceleration.Size = new System.Drawing.Size(134, 17);
this.checkHardwareAcceleration.TabIndex = 12;
this.checkHardwareAcceleration.Text = "Hardware Acceleration";
this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" +
" with rendering.");
this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
this.checkHardwareAcceleration.CheckedChanged += new System.EventHandler(this.checkHardwareAcceleration_CheckedChanged);
//
// btnEditCefArgs
//
this.btnEditCefArgs.Location = new System.Drawing.Point(6, 19);
this.btnEditCefArgs.Name = "btnEditCefArgs";
this.btnEditCefArgs.Size = new System.Drawing.Size(171, 23);
this.btnEditCefArgs.TabIndex = 15;
this.btnEditCefArgs.Text = "Edit CEF Arguments";
this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
this.btnEditCefArgs.UseVisualStyleBackColor = true;
this.btnEditCefArgs.Click += new System.EventHandler(this.btnEditCefArgs_Click);
//
// btnReset
//
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnReset.AutoSize = true;
this.btnReset.Location = new System.Drawing.Point(209, 250);
this.btnReset.Name = "btnReset";
this.btnReset.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnReset.Size = new System.Drawing.Size(102, 23);
this.btnReset.TabIndex = 17;
this.btnReset.Text = "Restore Defaults";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// btnImport
//
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnImport.AutoSize = true;
this.btnImport.Location = new System.Drawing.Point(109, 250);
this.btnImport.Name = "btnImport";
this.btnImport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnImport.Size = new System.Drawing.Size(94, 23);
this.btnImport.TabIndex = 16;
this.btnImport.Text = "Import Settings";
this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// btnExport
//
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnExport.AutoSize = true;
this.btnExport.Location = new System.Drawing.Point(9, 250);
this.btnExport.Name = "btnExport";
this.btnExport.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.btnExport.Size = new System.Drawing.Size(94, 23);
this.btnExport.TabIndex = 15;
this.btnExport.Text = "Export Settings";
this.btnExport.UseVisualStyleBackColor = true;
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
//
// groupPerformance
//
this.groupPerformance.Controls.Add(this.checkHardwareAcceleration);
this.groupPerformance.Controls.Add(this.btnClearCache);
this.groupPerformance.Location = new System.Drawing.Point(9, 9);
this.groupPerformance.Name = "groupPerformance";
this.groupPerformance.Size = new System.Drawing.Size(183, 74);
this.groupPerformance.TabIndex = 18;
this.groupPerformance.TabStop = false;
this.groupPerformance.Text = "Performance";
//
// groupConfiguration
//
this.groupConfiguration.Controls.Add(this.btnEditCSS);
this.groupConfiguration.Controls.Add(this.btnEditCefArgs);
this.groupConfiguration.Location = new System.Drawing.Point(9, 89);
this.groupConfiguration.Name = "groupConfiguration";
this.groupConfiguration.Size = new System.Drawing.Size(183, 77);
this.groupConfiguration.TabIndex = 19;
this.groupConfiguration.TabStop = false;
this.groupConfiguration.Text = "Configuration";
//
// btnEditCSS
//
this.btnEditCSS.Location = new System.Drawing.Point(6, 48);
this.btnEditCSS.Name = "btnEditCSS";
this.btnEditCSS.Size = new System.Drawing.Size(171, 23);
this.btnEditCSS.TabIndex = 16;
this.btnEditCSS.Text = "Edit CSS";
this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows.");
this.btnEditCSS.UseVisualStyleBackColor = true;
this.btnEditCSS.Click += new System.EventHandler(this.btnEditCSS_Click);
//
// TabSettingsAdvanced
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.btnClearCache);
this.Controls.Add(this.labelMiscellaneous);
this.Controls.Add(this.checkHardwareAcceleration);
this.Controls.Add(this.groupConfiguration);
this.Controls.Add(this.groupPerformance);
this.Controls.Add(this.btnReset);
this.Controls.Add(this.btnImport);
this.Controls.Add(this.btnExport);
this.Name = "TabSettingsAdvanced";
this.Size = new System.Drawing.Size(239, 120);
this.Size = new System.Drawing.Size(478, 282);
this.groupPerformance.ResumeLayout(false);
this.groupPerformance.PerformLayout();
this.groupConfiguration.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -76,7 +169,14 @@
#endregion
private System.Windows.Forms.Button btnClearCache;
private System.Windows.Forms.Label labelMiscellaneous;
private System.Windows.Forms.CheckBox checkHardwareAcceleration;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.GroupBox groupPerformance;
private System.Windows.Forms.GroupBox groupConfiguration;
private System.Windows.Forms.Button btnEditCefArgs;
private System.Windows.Forms.Button btnEditCSS;
}
}

View File

@@ -2,13 +2,19 @@
using System.Diagnostics;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Other.Settings.Dialogs;
using TweetDck.Core.Other.Settings.Export;
using TweetDck.Core.Utils;
namespace TweetDck.Core.Other.Settings{
partial class TabSettingsAdvanced : BaseTabSettings{
public TabSettingsAdvanced(){
private readonly Action browserReloadAction;
public TabSettingsAdvanced(Action browserReloadAction){
InitializeComponent();
this.browserReloadAction = browserReloadAction;
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
@@ -47,15 +53,106 @@ namespace TweetDck.Core.Other.Settings{
succeeded = HardwareAcceleration.Disable();
}
if (succeeded && MessageBox.Show("The application must restart for the setting to take place. Do you want to restart now?",Program.BrandName+" Settings",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.Yes){ // TODO
Process.Start(Application.ExecutablePath,"-restart");
Application.Exit();
if (succeeded){
PromptRestart();
}
else if (!succeeded){
else{
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
}
}
private void btnEditCefArgs_Click(object sender, EventArgs e){
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
if (form.ShowDialog(ParentForm) == DialogResult.OK){
Config.CustomCefArgs = form.CefArgs;
PromptRestart();
}
}
private void btnEditCSS_Click(object sender, EventArgs e){
DialogSettingsCSS form = new DialogSettingsCSS();
if (form.ShowDialog(ParentForm) == DialogResult.OK){
bool hasChangedBrowser = form.BrowserCSS != Config.CustomBrowserCSS;
Config.CustomBrowserCSS = form.BrowserCSS;
Config.CustomNotificationCSS = form.NotificationCSS;
if (hasChangedBrowser && MessageBox.Show("The browser CSS has changed, do you want to reload it?","Browser CSS Changed",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.Yes){
browserReloadAction();
}
}
}
private void btnExport_Click(object sender, EventArgs e){
DialogResult resultSaveCredentials = MessageBox.Show("Do you want to include your login session? This will not save your password into the file, but it will allow anyone with the file to login into TweetDeck as you.","Export "+Program.BrandName+" Settings",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button3);
if (resultSaveCredentials == DialogResult.Cancel)return;
bool saveCredentials = resultSaveCredentials == DialogResult.Yes;
string file;
using(SaveFileDialog dialog = new SaveFileDialog{
AddExtension = true,
AutoUpgradeEnabled = true,
OverwritePrompt = true,
DefaultExt = "tdsettings",
FileName = Program.BrandName+".tdsettings",
Title = "Export "+Program.BrandName+" Settings",
Filter = Program.BrandName+" Settings (*.tdsettings)|*.tdsettings"
}){
file = dialog.ShowDialog() == DialogResult.OK ? dialog.FileName : null;
}
if (file != null){
Program.UserConfig.Save();
ExportManager manager = new ExportManager(file);
if (!manager.Export(saveCredentials)){
Program.HandleException("An exception happened while exporting "+Program.BrandName+" settings.",manager.LastException);
}
}
}
private void btnImport_Click(object sender, EventArgs e){
string file;
using(OpenFileDialog dialog = new OpenFileDialog{
AutoUpgradeEnabled = true,
DereferenceLinks = true,
Title = "Import "+Program.BrandName+" Settings",
Filter = Program.BrandName+" Settings (*.tdsettings)|*.tdsettings"
}){
file = dialog.ShowDialog() == DialogResult.OK ? dialog.FileName : null;
}
if (file != null){
ExportManager manager = new ExportManager(file);
if (manager.Import()){
((FormSettings)ParentForm).ReloadUI();
}
else{
Program.HandleException("An exception happened while importing "+Program.BrandName+" settings.",manager.LastException);
}
}
}
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){
Program.ResetConfig();
((FormSettings)ParentForm).ReloadUI();
}
}
private static void PromptRestart(){
if (MessageBox.Show("The application must restart for the setting to take place. Do you want to restart now?",Program.BrandName+" Settings",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.Yes){
Process.Start(Application.ExecutablePath,"-restart");
Application.Exit();
}
}
}
}

View File

@@ -23,19 +23,29 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.checkExpandLinks = new System.Windows.Forms.CheckBox();
this.comboBoxTrayType = new System.Windows.Forms.ComboBox();
this.labelTrayType = new System.Windows.Forms.Label();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
this.groupTray = new System.Windows.Forms.GroupBox();
this.labelTrayIcon = new System.Windows.Forms.Label();
this.groupInterface = new System.Windows.Forms.GroupBox();
this.groupTray.SuspendLayout();
this.groupInterface.SuspendLayout();
this.SuspendLayout();
//
// checkExpandLinks
//
this.checkExpandLinks.AutoSize = true;
this.checkExpandLinks.Location = new System.Drawing.Point(9, 9);
this.checkExpandLinks.Location = new System.Drawing.Point(9, 21);
this.checkExpandLinks.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.checkExpandLinks.Name = "checkExpandLinks";
this.checkExpandLinks.Size = new System.Drawing.Size(166, 17);
this.checkExpandLinks.TabIndex = 14;
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" +
"p instead.");
this.checkExpandLinks.UseVisualStyleBackColor = true;
this.checkExpandLinks.CheckedChanged += new System.EventHandler(this.checkExpandLinks_CheckedChanged);
//
@@ -43,33 +53,72 @@
//
this.comboBoxTrayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTrayType.FormattingEnabled = true;
this.comboBoxTrayType.Location = new System.Drawing.Point(9, 56);
this.comboBoxTrayType.Location = new System.Drawing.Point(6, 19);
this.comboBoxTrayType.Name = "comboBoxTrayType";
this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21);
this.comboBoxTrayType.TabIndex = 13;
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);
//
// labelTrayType
// checkTrayHighlight
//
this.labelTrayType.AutoSize = true;
this.labelTrayType.Location = new System.Drawing.Point(6, 40);
this.labelTrayType.Margin = new System.Windows.Forms.Padding(3, 11, 3, 0);
this.labelTrayType.Name = "labelTrayType";
this.labelTrayType.Size = new System.Drawing.Size(52, 13);
this.labelTrayType.TabIndex = 12;
this.labelTrayType.Text = "Tray Icon";
this.checkTrayHighlight.AutoSize = true;
this.checkTrayHighlight.Location = new System.Drawing.Point(9, 70);
this.checkTrayHighlight.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.checkTrayHighlight.Name = "checkTrayHighlight";
this.checkTrayHighlight.Size = new System.Drawing.Size(103, 17);
this.checkTrayHighlight.TabIndex = 15;
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" +
"pup or audio notifications.\r\nThe icon resets when the main window is restored.");
this.checkTrayHighlight.UseVisualStyleBackColor = true;
this.checkTrayHighlight.CheckedChanged += new System.EventHandler(this.checkTrayHighlight_CheckedChanged);
//
// groupTray
//
this.groupTray.Controls.Add(this.checkTrayHighlight);
this.groupTray.Controls.Add(this.labelTrayIcon);
this.groupTray.Controls.Add(this.comboBoxTrayType);
this.groupTray.Location = new System.Drawing.Point(9, 63);
this.groupTray.Name = "groupTray";
this.groupTray.Size = new System.Drawing.Size(183, 93);
this.groupTray.TabIndex = 15;
this.groupTray.TabStop = false;
this.groupTray.Text = "System Tray";
//
// labelTrayIcon
//
this.labelTrayIcon.AutoSize = true;
this.labelTrayIcon.Location = new System.Drawing.Point(6, 52);
this.labelTrayIcon.Margin = new System.Windows.Forms.Padding(3, 9, 3, 0);
this.labelTrayIcon.Name = "labelTrayIcon";
this.labelTrayIcon.Size = new System.Drawing.Size(52, 13);
this.labelTrayIcon.TabIndex = 14;
this.labelTrayIcon.Text = "Tray Icon";
//
// groupInterface
//
this.groupInterface.Controls.Add(this.checkExpandLinks);
this.groupInterface.Location = new System.Drawing.Point(9, 9);
this.groupInterface.Name = "groupInterface";
this.groupInterface.Size = new System.Drawing.Size(183, 48);
this.groupInterface.TabIndex = 16;
this.groupInterface.TabStop = false;
this.groupInterface.Text = "User Interface";
//
// TabSettingsGeneral
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.checkExpandLinks);
this.Controls.Add(this.comboBoxTrayType);
this.Controls.Add(this.labelTrayType);
this.Controls.Add(this.groupInterface);
this.Controls.Add(this.groupTray);
this.Name = "TabSettingsGeneral";
this.Size = new System.Drawing.Size(219, 99);
this.Size = new System.Drawing.Size(478, 282);
this.groupTray.ResumeLayout(false);
this.groupTray.PerformLayout();
this.groupInterface.ResumeLayout(false);
this.groupInterface.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -77,6 +126,10 @@
private System.Windows.Forms.CheckBox checkExpandLinks;
private System.Windows.Forms.ComboBox comboBoxTrayType;
private System.Windows.Forms.Label labelTrayType;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.GroupBox groupTray;
private System.Windows.Forms.GroupBox groupInterface;
private System.Windows.Forms.Label labelTrayIcon;
private System.Windows.Forms.CheckBox checkTrayHighlight;
}
}

View File

@@ -9,9 +9,11 @@ namespace TweetDck.Core.Other.Settings{
comboBoxTrayType.Items.Add("Display Icon Only");
comboBoxTrayType.Items.Add("Minimize to Tray");
comboBoxTrayType.Items.Add("Close to Tray");
comboBoxTrayType.Items.Add("Combined");
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior,0),comboBoxTrayType.Items.Count-1);
checkExpandLinks.Checked = Program.UserConfig.ExpandLinksOnHover;
checkTrayHighlight.Checked = Program.UserConfig.EnableTrayHighlight;
}
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
@@ -25,5 +27,11 @@ namespace TweetDck.Core.Other.Settings{
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
}
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.EnableTrayHighlight = checkTrayHighlight.Checked;
}
}
}

View File

@@ -23,7 +23,9 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.groupNotificationLocation = new System.Windows.Forms.GroupBox();
this.labelEdgeDistanceValue = new System.Windows.Forms.Label();
this.labelDisplay = new System.Windows.Forms.Label();
this.comboBoxDisplay = new System.Windows.Forms.ComboBox();
this.labelEdgeDistance = new System.Windows.Forms.Label();
@@ -34,20 +36,28 @@
this.radioLocTL = new System.Windows.Forms.RadioButton();
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
this.radioDurVeryLong = new System.Windows.Forms.RadioButton();
this.radioDurLong = new System.Windows.Forms.RadioButton();
this.radioDurMedium = new System.Windows.Forms.RadioButton();
this.radioDurShort = new System.Windows.Forms.RadioButton();
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
this.btnDurationMedium = new TweetDck.Core.Controls.FlatButton();
this.btnDurationLong = new TweetDck.Core.Controls.FlatButton();
this.btnDurationShort = new TweetDck.Core.Controls.FlatButton();
this.labelDurationValue = new System.Windows.Forms.Label();
this.trackBarDuration = new System.Windows.Forms.TrackBar();
this.groupUserInterface = new System.Windows.Forms.GroupBox();
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
this.checkLegacyLoad = new System.Windows.Forms.CheckBox();
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.groupNotificationLocation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
this.groupNotificationDuration.SuspendLayout();
this.tableLayoutDurationButtons.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).BeginInit();
this.groupUserInterface.SuspendLayout();
this.SuspendLayout();
//
// groupNotificationLocation
//
this.groupNotificationLocation.Controls.Add(this.labelEdgeDistanceValue);
this.groupNotificationLocation.Controls.Add(this.labelDisplay);
this.groupNotificationLocation.Controls.Add(this.comboBoxDisplay);
this.groupNotificationLocation.Controls.Add(this.labelEdgeDistance);
@@ -57,12 +67,23 @@
this.groupNotificationLocation.Controls.Add(this.radioLocTR);
this.groupNotificationLocation.Controls.Add(this.radioLocTL);
this.groupNotificationLocation.Controls.Add(this.trackBarEdgeDistance);
this.groupNotificationLocation.Location = new System.Drawing.Point(9, 9);
this.groupNotificationLocation.Location = new System.Drawing.Point(198, 9);
this.groupNotificationLocation.Name = "groupNotificationLocation";
this.groupNotificationLocation.Size = new System.Drawing.Size(183, 264);
this.groupNotificationLocation.TabIndex = 1;
this.groupNotificationLocation.TabStop = false;
this.groupNotificationLocation.Text = "Notification Location";
this.groupNotificationLocation.Text = "Location";
//
// labelEdgeDistanceValue
//
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.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelEdgeDistanceValue.Name = "labelEdgeDistanceValue";
this.labelEdgeDistanceValue.Size = new System.Drawing.Size(34, 13);
this.labelEdgeDistanceValue.TabIndex = 11;
this.labelEdgeDistanceValue.Text = "0 px";
this.labelEdgeDistanceValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// labelDisplay
//
@@ -105,6 +126,7 @@
this.radioLocCustom.TabIndex = 4;
this.radioLocCustom.TabStop = true;
this.radioLocCustom.Text = "Custom";
this.toolTip.SetToolTip(this.radioLocCustom, "Drag the notification window to the desired location.");
this.radioLocCustom.UseVisualStyleBackColor = true;
this.radioLocCustom.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
//
@@ -165,87 +187,154 @@
this.trackBarEdgeDistance.Maximum = 40;
this.trackBarEdgeDistance.Minimum = 8;
this.trackBarEdgeDistance.Name = "trackBarEdgeDistance";
this.trackBarEdgeDistance.Size = new System.Drawing.Size(171, 45);
this.trackBarEdgeDistance.Size = new System.Drawing.Size(141, 45);
this.trackBarEdgeDistance.SmallChange = 2;
this.trackBarEdgeDistance.TabIndex = 5;
this.trackBarEdgeDistance.TickFrequency = 2;
this.trackBarEdgeDistance.TickFrequency = 4;
this.trackBarEdgeDistance.Value = 8;
this.trackBarEdgeDistance.ValueChanged += new System.EventHandler(this.trackBarEdgeDistance_ValueChanged);
//
// groupNotificationDuration
//
this.groupNotificationDuration.Controls.Add(this.radioDurVeryLong);
this.groupNotificationDuration.Controls.Add(this.radioDurLong);
this.groupNotificationDuration.Controls.Add(this.radioDurMedium);
this.groupNotificationDuration.Controls.Add(this.radioDurShort);
this.groupNotificationDuration.Location = new System.Drawing.Point(198, 9);
this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons);
this.groupNotificationDuration.Controls.Add(this.labelDurationValue);
this.groupNotificationDuration.Controls.Add(this.trackBarDuration);
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 106);
this.groupNotificationDuration.Name = "groupNotificationDuration";
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 119);
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89);
this.groupNotificationDuration.TabIndex = 9;
this.groupNotificationDuration.TabStop = false;
this.groupNotificationDuration.Text = "Notification Duration";
this.groupNotificationDuration.Text = "Duration";
//
// radioDurVeryLong
// tableLayoutDurationButtons
//
this.radioDurVeryLong.AutoSize = true;
this.radioDurVeryLong.Location = new System.Drawing.Point(6, 92);
this.radioDurVeryLong.Name = "radioDurVeryLong";
this.radioDurVeryLong.Size = new System.Drawing.Size(73, 17);
this.radioDurVeryLong.TabIndex = 3;
this.radioDurVeryLong.TabStop = true;
this.radioDurVeryLong.Text = "Very Long";
this.radioDurVeryLong.UseVisualStyleBackColor = true;
this.radioDurVeryLong.CheckedChanged += new System.EventHandler(this.radioDur_CheckedChanged);
this.radioDurVeryLong.Click += new System.EventHandler(this.radioDur_Click);
this.tableLayoutDurationButtons.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutDurationButtons.ColumnCount = 3;
this.tableLayoutDurationButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 32F));
this.tableLayoutDurationButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 36F));
this.tableLayoutDurationButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 32F));
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationMedium, 0, 0);
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationLong, 1, 0);
this.tableLayoutDurationButtons.Controls.Add(this.btnDurationShort, 0, 0);
this.tableLayoutDurationButtons.Location = new System.Drawing.Point(6, 56);
this.tableLayoutDurationButtons.Name = "tableLayoutDurationButtons";
this.tableLayoutDurationButtons.RowCount = 1;
this.tableLayoutDurationButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutDurationButtons.Size = new System.Drawing.Size(171, 27);
this.tableLayoutDurationButtons.TabIndex = 5;
//
// radioDurLong
// btnDurationMedium
//
this.radioDurLong.AutoSize = true;
this.radioDurLong.Location = new System.Drawing.Point(6, 68);
this.radioDurLong.Name = "radioDurLong";
this.radioDurLong.Size = new System.Drawing.Size(49, 17);
this.radioDurLong.TabIndex = 2;
this.radioDurLong.TabStop = true;
this.radioDurLong.Text = "Long";
this.radioDurLong.UseVisualStyleBackColor = true;
this.radioDurLong.CheckedChanged += new System.EventHandler(this.radioDur_CheckedChanged);
this.radioDurLong.Click += new System.EventHandler(this.radioDur_Click);
this.btnDurationMedium.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnDurationMedium.FlatAppearance.BorderColor = System.Drawing.Color.Gray;
this.btnDurationMedium.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlLight;
this.btnDurationMedium.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White;
this.btnDurationMedium.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDurationMedium.Location = new System.Drawing.Point(55, 1);
this.btnDurationMedium.Margin = new System.Windows.Forms.Padding(1);
this.btnDurationMedium.Name = "btnDurationMedium";
this.btnDurationMedium.Size = new System.Drawing.Size(59, 25);
this.btnDurationMedium.TabIndex = 2;
this.btnDurationMedium.Text = "Medium";
this.btnDurationMedium.UseVisualStyleBackColor = true;
this.btnDurationMedium.Click += new System.EventHandler(this.btnDurationMedium_Click);
//
// radioDurMedium
// btnDurationLong
//
this.radioDurMedium.AutoSize = true;
this.radioDurMedium.Location = new System.Drawing.Point(6, 44);
this.radioDurMedium.Name = "radioDurMedium";
this.radioDurMedium.Size = new System.Drawing.Size(62, 17);
this.radioDurMedium.TabIndex = 1;
this.radioDurMedium.TabStop = true;
this.radioDurMedium.Text = "Medium";
this.radioDurMedium.UseVisualStyleBackColor = true;
this.radioDurMedium.CheckedChanged += new System.EventHandler(this.radioDur_CheckedChanged);
this.radioDurMedium.Click += new System.EventHandler(this.radioDur_Click);
this.btnDurationLong.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnDurationLong.FlatAppearance.BorderColor = System.Drawing.Color.Gray;
this.btnDurationLong.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlLight;
this.btnDurationLong.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White;
this.btnDurationLong.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDurationLong.Location = new System.Drawing.Point(116, 1);
this.btnDurationLong.Margin = new System.Windows.Forms.Padding(1);
this.btnDurationLong.Name = "btnDurationLong";
this.btnDurationLong.Size = new System.Drawing.Size(54, 25);
this.btnDurationLong.TabIndex = 1;
this.btnDurationLong.Text = "Long";
this.btnDurationLong.UseVisualStyleBackColor = true;
this.btnDurationLong.Click += new System.EventHandler(this.btnDurationLong_Click);
//
// radioDurShort
// btnDurationShort
//
this.radioDurShort.AutoSize = true;
this.radioDurShort.Location = new System.Drawing.Point(6, 20);
this.radioDurShort.Name = "radioDurShort";
this.radioDurShort.Size = new System.Drawing.Size(50, 17);
this.radioDurShort.TabIndex = 0;
this.radioDurShort.TabStop = true;
this.radioDurShort.Text = "Short";
this.radioDurShort.UseVisualStyleBackColor = true;
this.radioDurShort.CheckedChanged += new System.EventHandler(this.radioDur_CheckedChanged);
this.radioDurShort.Click += new System.EventHandler(this.radioDur_Click);
this.btnDurationShort.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnDurationShort.FlatAppearance.BorderColor = System.Drawing.Color.Gray;
this.btnDurationShort.FlatAppearance.MouseDownBackColor = System.Drawing.SystemColors.ControlLight;
this.btnDurationShort.FlatAppearance.MouseOverBackColor = System.Drawing.Color.White;
this.btnDurationShort.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDurationShort.Location = new System.Drawing.Point(1, 1);
this.btnDurationShort.Margin = new System.Windows.Forms.Padding(1);
this.btnDurationShort.Name = "btnDurationShort";
this.btnDurationShort.Size = new System.Drawing.Size(52, 25);
this.btnDurationShort.TabIndex = 0;
this.btnDurationShort.Text = "Short";
this.btnDurationShort.UseVisualStyleBackColor = true;
this.btnDurationShort.Click += new System.EventHandler(this.btnDurationShort_Click);
//
// labelDurationValue
//
this.labelDurationValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelDurationValue.BackColor = System.Drawing.Color.Transparent;
this.labelDurationValue.Location = new System.Drawing.Point(129, 20);
this.labelDurationValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelDurationValue.Name = "labelDurationValue";
this.labelDurationValue.Size = new System.Drawing.Size(48, 13);
this.labelDurationValue.TabIndex = 13;
this.labelDurationValue.Text = "0 ms/c";
this.labelDurationValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.toolTip.SetToolTip(this.labelDurationValue, "Milliseconds per character.");
//
// trackBarDuration
//
this.trackBarDuration.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.trackBarDuration.Location = new System.Drawing.Point(6, 19);
this.trackBarDuration.Maximum = 60;
this.trackBarDuration.Minimum = 10;
this.trackBarDuration.Name = "trackBarDuration";
this.trackBarDuration.Size = new System.Drawing.Size(128, 45);
this.trackBarDuration.TabIndex = 12;
this.trackBarDuration.TickFrequency = 5;
this.trackBarDuration.Value = 25;
this.trackBarDuration.ValueChanged += new System.EventHandler(this.trackBarDuration_ValueChanged);
//
// groupUserInterface
//
this.groupUserInterface.Controls.Add(this.checkTimerCountDown);
this.groupUserInterface.Controls.Add(this.checkLegacyLoad);
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
this.groupUserInterface.Location = new System.Drawing.Point(198, 134);
this.groupUserInterface.Location = new System.Drawing.Point(9, 9);
this.groupUserInterface.Name = "groupUserInterface";
this.groupUserInterface.Size = new System.Drawing.Size(183, 48);
this.groupUserInterface.Size = new System.Drawing.Size(183, 91);
this.groupUserInterface.TabIndex = 10;
this.groupUserInterface.TabStop = false;
this.groupUserInterface.Text = "User Interface";
this.groupUserInterface.Text = "General";
//
// checkTimerCountDown
//
this.checkTimerCountDown.AutoSize = true;
this.checkTimerCountDown.Location = new System.Drawing.Point(6, 44);
this.checkTimerCountDown.Name = "checkTimerCountDown";
this.checkTimerCountDown.Size = new System.Drawing.Size(119, 17);
this.checkTimerCountDown.TabIndex = 6;
this.checkTimerCountDown.Text = "Timer Counts Down";
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
this.checkTimerCountDown.UseVisualStyleBackColor = true;
this.checkTimerCountDown.CheckedChanged += new System.EventHandler(this.checkTimerCountDown_CheckedChanged);
//
// checkLegacyLoad
//
this.checkLegacyLoad.AutoSize = true;
this.checkLegacyLoad.Location = new System.Drawing.Point(6, 67);
this.checkLegacyLoad.Name = "checkLegacyLoad";
this.checkLegacyLoad.Size = new System.Drawing.Size(139, 17);
this.checkLegacyLoad.TabIndex = 5;
this.checkLegacyLoad.Text = "Legacy Loading System";
this.toolTip.SetToolTip(this.checkLegacyLoad, "Try enabling if notifications do not display.\r\nMight cause delays and visual arti" +
"facts.");
this.checkLegacyLoad.UseVisualStyleBackColor = true;
this.checkLegacyLoad.CheckedChanged += new System.EventHandler(this.checkLegacyLoad_CheckedChanged);
//
// checkNotificationTimer
//
@@ -256,6 +345,7 @@
this.checkNotificationTimer.Size = new System.Drawing.Size(145, 17);
this.checkNotificationTimer.TabIndex = 4;
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.CheckedChanged += new System.EventHandler(this.checkNotificationTimer_CheckedChanged);
//
@@ -267,13 +357,15 @@
this.Controls.Add(this.groupNotificationDuration);
this.Controls.Add(this.groupNotificationLocation);
this.Name = "TabSettingsNotifications";
this.Size = new System.Drawing.Size(397, 282);
this.Size = new System.Drawing.Size(478, 282);
this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged);
this.groupNotificationLocation.ResumeLayout(false);
this.groupNotificationLocation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
this.groupNotificationDuration.ResumeLayout(false);
this.groupNotificationDuration.PerformLayout();
this.tableLayoutDurationButtons.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).EndInit();
this.groupUserInterface.ResumeLayout(false);
this.groupUserInterface.PerformLayout();
this.ResumeLayout(false);
@@ -293,11 +385,17 @@
private System.Windows.Forms.RadioButton radioLocTR;
private System.Windows.Forms.RadioButton radioLocTL;
private System.Windows.Forms.GroupBox groupNotificationDuration;
private System.Windows.Forms.RadioButton radioDurVeryLong;
private System.Windows.Forms.RadioButton radioDurLong;
private System.Windows.Forms.RadioButton radioDurMedium;
private System.Windows.Forms.RadioButton radioDurShort;
private System.Windows.Forms.GroupBox groupUserInterface;
private System.Windows.Forms.CheckBox checkNotificationTimer;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Label labelEdgeDistanceValue;
private System.Windows.Forms.CheckBox checkLegacyLoad;
private System.Windows.Forms.CheckBox checkTimerCountDown;
private System.Windows.Forms.Label labelDurationValue;
private System.Windows.Forms.TrackBar trackBarDuration;
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
private TweetDck.Core.Controls.FlatButton btnDurationMedium;
private TweetDck.Core.Controls.FlatButton btnDurationLong;
private TweetDck.Core.Controls.FlatButton btnDurationShort;
}
}

View File

@@ -1,6 +1,8 @@
using System;
using System.Globalization;
using System.Windows.Forms;
using TweetDck.Core.Handling;
using TweetDck.Core.Controls;
namespace TweetDck.Core.Other.Settings{
partial class TabSettingsNotifications : BaseTabSettings{
@@ -19,7 +21,7 @@ namespace TweetDck.Core.Other.Settings{
};
this.notification.Initialized += (sender, args) => {
this.notification.ShowNotificationForSettings(true);
this.InvokeSafe(() => this.notification.ShowNotificationForSettings(true));
};
this.notification.Show(this);
@@ -32,12 +34,8 @@ namespace TweetDck.Core.Other.Settings{
case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break;
}
switch(Config.NotificationDuration){
case TweetNotification.Duration.Short: radioDurShort.Checked = true; break;
case TweetNotification.Duration.Medium: radioDurMedium.Checked = true; break;
case TweetNotification.Duration.Long: radioDurLong.Checked = true; break;
case TweetNotification.Duration.VeryLong: radioDurVeryLong.Checked = true; break;
}
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
comboBoxDisplay.Items.Add("(Same As "+Program.BrandName+")");
@@ -48,7 +46,14 @@ namespace TweetDck.Core.Other.Settings{
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1,Config.NotificationDisplay);
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
trackBarEdgeDistance.Value = Config.NotificationEdgeDistance;
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
checkLegacyLoad.Checked = Config.NotificationLegacyLoad;
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
Disposed += (sender, args) => this.notification.Dispose();
}
private void TabSettingsNotifications_ParentChanged(object sender, EventArgs e){
@@ -56,7 +61,7 @@ namespace TweetDck.Core.Other.Settings{
notification.HideNotification(false);
}
else{
notification.ShowNotificationForSettings(false);
notification.ShowNotificationForSettings(true);
}
}
@@ -79,30 +84,54 @@ namespace TweetDck.Core.Other.Settings{
notification.ShowNotificationForSettings(false);
}
private void radioDur_CheckedChanged(object sender, EventArgs e){
private void trackBarDuration_ValueChanged(object sender, EventArgs e){
if (!Ready)return;
if (radioDurShort.Checked)Config.NotificationDuration = TweetNotification.Duration.Short;
else if (radioDurMedium.Checked)Config.NotificationDuration = TweetNotification.Duration.Medium;
else if (radioDurLong.Checked)Config.NotificationDuration = TweetNotification.Duration.Long;
else if (radioDurVeryLong.Checked)Config.NotificationDuration = TweetNotification.Duration.VeryLong;
Config.NotificationDurationValue = trackBarDuration.Value;
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
notification.ShowNotificationForSettings(true);
}
private void radioDur_Click(object sender, EventArgs e){
private void btnDurationShort_Click(object sender, EventArgs e){
if (!Ready)return;
notification.ShowNotificationForSettings(true);
trackBarDuration.Value = 15;
}
private void btnDurationMedium_Click(object sender, EventArgs e){
if (!Ready)return;
trackBarDuration.Value = 25;
}
private void btnDurationLong_Click(object sender, EventArgs e){
if (!Ready)return;
trackBarDuration.Value = 35;
}
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
notification.ShowNotificationForSettings(true);
}
private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationTimerCountDown = checkTimerCountDown.Checked;
notification.ShowNotificationForSettings(true);
}
private void checkLegacyLoad_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationLegacyLoad = checkLegacyLoad.Checked;
}
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
if (!Ready)return;
@@ -112,7 +141,8 @@ namespace TweetDck.Core.Other.Settings{
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
if (!Ready)return;
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
notification.ShowNotificationForSettings(false);
}

View File

@@ -23,41 +23,60 @@
/// 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(9, 32);
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(9, 9);
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.btnCheckUpdates);
this.Controls.Add(this.checkUpdateNotifications);
this.Controls.Add(this.groupGeneral);
this.Name = "TabSettingsUpdates";
this.Size = new System.Drawing.Size(211, 78);
this.Size = new System.Drawing.Size(478, 282);
this.groupGeneral.ResumeLayout(false);
this.groupGeneral.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -65,5 +84,7 @@
private System.Windows.Forms.Button btnCheckUpdates;
private System.Windows.Forms.CheckBox checkUpdateNotifications;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.GroupBox groupGeneral;
}
}

View File

@@ -5,7 +5,7 @@ using System.Windows.Forms;
namespace TweetDck.Core{
partial class TrayIcon : Component{
public enum Behavior{ // keep order
Disabled, DisplayOnly, MinimizeToTray, CloseToTray
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
}
public event EventHandler ClickRestore;
@@ -75,4 +75,18 @@ namespace TweetDck.Core{
}
}
}
static class BehaviorExtensions{
public static bool ShouldDisplayIcon(this TrayIcon.Behavior behavior){
return behavior != TrayIcon.Behavior.Disabled;
}
public static bool ShouldHideOnMinimize(this TrayIcon.Behavior behavior){
return behavior == TrayIcon.Behavior.MinimizeToTray || behavior == TrayIcon.Behavior.Combined;
}
public static bool ShouldHideOnClose(this TrayIcon.Behavior behavior){
return behavior == TrayIcon.Behavior.CloseToTray || behavior == TrayIcon.Behavior.Combined;
}
}
}

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace TweetDck.Core.Utils{
static class CommandLineArgsParser{
private static Regex splitRegex;
private static Regex SplitRegex{
get{
return splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:""[^""]*?""|[^ ]*))?)",RegexOptions.Compiled));
}
}
public static int AddToDictionary(string args, IDictionary<string,string> dictionary){
if (string.IsNullOrWhiteSpace(args)){
return 0;
}
int count = 0;
foreach(Match match in SplitRegex.Matches(args)){
string matchValue = match.Value;
int indexEquals = matchValue.IndexOf('=');
string key, value;
if (indexEquals == -1){
key = matchValue.TrimStart('-');
value = "1";
}
else{
key = matchValue.Substring(0,indexEquals).TrimStart('-');
value = matchValue.Substring(indexEquals+1).Trim('"');
}
if (key != string.Empty){
dictionary[key] = value;
++count;
}
}
return count;
}
}
}

View File

@@ -16,10 +16,15 @@ namespace TweetDck.Core.Utils{
public const int SB_HORZ = 0;
public const int WH_MOUSE_LL = 14;
public const int WH_MOUSEWHEEL = 0x020A;
public enum MouseButton{
Left, Right
}
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("Shell32.dll")]
public static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@@ -39,6 +44,15 @@ namespace TweetDck.Core.Utils{
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow);
[DllImport("user32.dll")]
public static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);
[DllImport("user32.dll")]
public static extern bool UnhookWindowsHookEx(IntPtr idHook);
[DllImport("user32.dll")]
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
public static void SetFormPos(Form form, int hWndOrder, uint flags){
SetWindowPos(form.Handle.ToInt32(),hWndOrder,form.Left,form.Top,form.Width,form.Height,flags);
}

View File

@@ -138,7 +138,7 @@
this.Controls.Add(this.btnToggleState);
this.Controls.Add(this.labelVersion);
this.MaximumSize = new System.Drawing.Size(65535, 109);
this.MinimumSize = new System.Drawing.Size(0, 83);
this.MinimumSize = new System.Drawing.Size(0, 61);
this.Name = "PluginControl";
this.Padding = new System.Windows.Forms.Padding(3);
this.Size = new System.Drawing.Size(530, 109);

View File

@@ -27,13 +27,21 @@ namespace TweetDck.Plugins.Controls{
this.labelName.ForeColor = Color.DarkRed;
this.btnToggleState.Enabled = false;
}
else if (labelDescription.Text == string.Empty){
labelDescription.Visible = false;
}
panelDescription_Resize(panelDescription,new EventArgs());
}
private void panelDescription_Resize(object sender, EventArgs e){
labelDescription.MaximumSize = new Size(panelDescription.Width-SystemInformation.VerticalScrollBarWidth,0);
Height = Math.Min(MinimumSize.Height+(labelDescription.Height-13),MaximumSize.Height);
if (labelDescription.Text == string.Empty){
Height = MinimumSize.Height;
}
else{
labelDescription.MaximumSize = new Size(panelDescription.Width-SystemInformation.VerticalScrollBarWidth,0);
Height = Math.Min(MinimumSize.Height+9+labelDescription.Height,MaximumSize.Height);
}
}
private void labelWebsite_Click(object sender, EventArgs e){

View File

@@ -22,6 +22,12 @@ namespace TweetDck.Plugins{
}
}
public string FolderPath{
get{
return path;
}
}
private readonly string path;
private readonly string identifier;
private readonly Dictionary<string,string> metadata = new Dictionary<string,string>(4){

90
Plugins/PluginBridge.cs Normal file
View File

@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using TweetDck.Plugins.Events;
namespace TweetDck.Plugins{
class PluginBridge{
private readonly PluginManager manager;
private readonly Dictionary<string,string> fileCache = new Dictionary<string,string>(2);
public PluginBridge(PluginManager manager){
this.manager = manager;
this.manager.Reloaded += manager_Reloaded;
}
private void manager_Reloaded(object sender, PluginLoadEventArgs e){
fileCache.Clear();
}
private string GetFullPathIfSafe(int token, string path){
Plugin plugin = manager.GetPluginFromToken(token);
if (plugin == null){
return string.Empty;
}
string fullPath = Path.Combine(plugin.FolderPath,path);
try{
string folderPathName = new DirectoryInfo(plugin.FolderPath).FullName;
DirectoryInfo currentInfo = new DirectoryInfo(fullPath);
while(currentInfo.Parent != null){
if (currentInfo.Parent.FullName == folderPathName){
return fullPath;
}
currentInfo = currentInfo.Parent;
}
}
catch{
// ignore
}
return string.Empty;
}
public void WriteFile(int token, string path, string contents){
string fullPath = GetFullPathIfSafe(token,path);
if (fullPath == string.Empty){
throw new Exception("File path has to be relative to the plugin folder.");
}
// ReSharper disable once AssignNullToNotNullAttribute
Directory.CreateDirectory(Path.GetDirectoryName(fullPath));
File.WriteAllText(fullPath,contents,Encoding.UTF8);
fileCache[fullPath] = contents;
}
public string ReadFile(int token, string path, bool cache){
string fullPath = GetFullPathIfSafe(token,path);
if (fullPath == string.Empty){
throw new Exception("File path has to be relative to the plugin folder.");
}
string cachedContents;
if (cache && fileCache.TryGetValue(fullPath,out cachedContents)){
return cachedContents;
}
return fileCache[fullPath] = File.ReadAllText(fullPath,Encoding.UTF8);
}
public void DeleteFile(int token, string path){
string fullPath = GetFullPathIfSafe(token,path);
if (fullPath == string.Empty){
throw new Exception("File path has to be relative to the plugin folder.");
}
fileCache.Remove(fullPath);
File.Delete(fullPath);
}
}
}

View File

@@ -27,8 +27,8 @@ namespace TweetDck.Plugins{
public static string GetScriptVariables(this PluginEnvironment environment){
switch(environment){
case PluginEnvironment.Browser: return "$,$TD,TD";
case PluginEnvironment.Notification: return "$TD";
case PluginEnvironment.Browser: return "$,$TD,$TDP,TD";
case PluginEnvironment.Notification: return "$TD,$TDP";
default: return string.Empty;
}
}

View File

@@ -16,17 +16,21 @@ namespace TweetDck.Plugins{
public IEnumerable<Plugin> Plugins { get { return plugins; } }
public PluginConfig Config { get; private set; }
public PluginBridge Bridge { get; private set; }
public event EventHandler<PluginLoadEventArgs> Reloaded;
private readonly string rootPath;
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
private readonly Dictionary<int,Plugin> tokens = new Dictionary<int,Plugin>();
private readonly Random rand = new Random();
private List<string> loadErrors;
public PluginManager(string path, PluginConfig config){
this.rootPath = path;
this.Config = config;
this.Bridge = new PluginBridge(this);
}
public IEnumerable<Plugin> GetPluginsByGroup(PluginGroup group){
@@ -41,9 +45,15 @@ namespace TweetDck.Plugins{
return plugins.Any(plugin => plugin.Environments.HasFlag(environment));
}
public Plugin GetPluginFromToken(int token){
Plugin plugin;
return tokens.TryGetValue(token,out plugin) ? plugin : null;
}
public void Reload(){
HashSet<Plugin> prevPlugins = new HashSet<Plugin>(plugins);
plugins.Clear();
tokens.Clear();
loadErrors = new List<string>(2);
@@ -78,7 +88,17 @@ namespace TweetDck.Plugins{
continue;
}
ScriptLoader.ExecuteScript(frame,PluginScriptGenerator.GeneratePlugin(plugin.Identifier,script,environment),"plugin:"+plugin);
int token;
if (tokens.ContainsValue(plugin)){
token = tokens.First(kvp => kvp.Value.Equals(plugin)).Key;
}
else{
token = GenerateToken();
tokens[token] = plugin;
}
ScriptLoader.ExecuteScript(frame,PluginScriptGenerator.GeneratePlugin(plugin.Identifier,script,token,environment),"plugin:"+plugin);
}
}
@@ -95,5 +115,17 @@ namespace TweetDck.Plugins{
}
}
}
private int GenerateToken(){
for(int attempt = 0; attempt < 1000; attempt++){
int token = rand.Next();
if (!tokens.ContainsKey(token)){
return token;
}
}
return -tokens.Count;
}
}
}

View File

@@ -6,15 +6,18 @@ namespace TweetDck.Plugins{
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"",config.DisabledPlugins)+"\"];" : string.Empty;
}
public static string GeneratePlugin(string pluginIdentifier, string pluginContents, PluginEnvironment environment){
StringBuilder build = new StringBuilder(pluginIdentifier.Length+pluginContents.Length+110);
public static string GeneratePlugin(string pluginIdentifier, string pluginContents, int pluginToken, PluginEnvironment environment){
StringBuilder build = new StringBuilder(pluginIdentifier.Length+pluginContents.Length+150);
build.Append("(function(").Append(environment.GetScriptVariables()).Append("){");
build.Append("window.TD_PLUGINS.install({");
build.Append("let tmp={");
build.Append("id:\"").Append(pluginIdentifier).Append("\",");
build.Append("obj:new class extends PluginBase{").Append(pluginContents).Append("}");
build.Append("});");
build.Append("};");
build.Append("tmp.obj.$token=").Append(pluginToken).Append(";");
build.Append("window.TD_PLUGINS.install(tmp);");
build.Append("})(").Append(environment.GetScriptVariables()).Append(");");

View File

@@ -28,8 +28,8 @@ namespace TweetDck{
public const string BrowserSubprocess = BrandName+".Browser.exe";
public const string VersionTag = "1.3";
public const string VersionFull = "1.3.0.0";
public const string VersionTag = "1.3.2";
public const string VersionFull = "1.3.2.0";
public static readonly Version Version = new Version(VersionTag);
@@ -115,7 +115,7 @@ namespace TweetDck{
}
};
Cef.Initialize(new CefSettings{
CefSettings settings = new CefSettings{
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
UserAgent = BrowserUtils.HeaderUserAgent,
Locale = CultureInfo.CurrentCulture.TwoLetterISOLanguageName,
@@ -124,7 +124,11 @@ namespace TweetDck{
#if !DEBUG
LogSeverity = programArguments.Contains("-log") ? LogSeverity.Info : LogSeverity.Disable
#endif
});
};
CommandLineArgsParser.AddToDictionary(UserConfig.CustomCefArgs,settings.CefCommandLineArgs);
Cef.Initialize(settings);
AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
Exception ex = args.ExceptionObject as Exception;

View File

@@ -5,8 +5,10 @@ enabled(){
document.head.appendChild(style);
var sheet = style.sheet;
sheet.insertRule(".tweet-actions { float: right !important; width: auto !important; visibility: hidden; }",0);
sheet.insertRule(".tweet-actions:hover { visibility: visible; }",0);
sheet.insertRule(".tweet-actions { float: right !important; width: auto !important; }",0);
sheet.insertRule(".tweet-action { opacity: 0; }",0);
sheet.insertRule(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important; }",0);
sheet.insertRule(".tweet:hover .tweet-action, .is-favorite .tweet-action[rel='favorite'], .is-retweet .tweet-action[rel='retweet'] { opacity: 1; visibility: visible !important; }",0);
sheet.insertRule(".tweet-actions > li:nth-child(4) { margin-right: 2px !important; }",0);
// revert small links around the tweet

View File

@@ -53,11 +53,13 @@
}
});
// Setup video element replacement
// Setup video element replacement and fix missing target in user links
new MutationObserver(function(){
$("video").each(function(){
$(this).parent().replaceWith("<a href='"+$(this).attr("src")+"' rel='url' target='_blank' style='display:block; border:1px solid #555; padding:3px 6px'>&#9658; Open video in browser</a>");
});
$("a[rel='user']").attr("target","_blank");
}).observe($(".js-app-columns")[0],{
childList: true,
subtree: true
@@ -399,12 +401,17 @@
// Block: Inject custom CSS and layout into the page.
//
(function(){
var style = document.createElement("style");
document.head.appendChild(style);
var styleOfficial = document.createElement("style");
document.head.appendChild(styleOfficial);
var sheet = style.sheet;
styleOfficial.sheet.insertRule("a[data-full-url] { word-break: break-all; }",0); // break long urls
styleOfficial.sheet.insertRule(".column-nav-link .attribution { position: absolute; }",0); // fix cut off account names
styleOfficial.sheet.insertRule(".txt-base-smallest .badge-verified:before { height: 13px !important; }",0); // fix cut off badge icon
// break long urls
sheet.insertRule("a[data-full-url] { word-break: break-all; }",0);
if ($TD.hasCustomBrowserCSS){
var styleCustom = document.createElement("style");
styleCustom.innerHTML = $TD.customBrowserCSS;
document.head.appendChild(styleCustom);
}
})();
})($,$TD,TD);

View File

@@ -78,6 +78,9 @@
<Compile Include="Configuration\LockManager.cs" />
<Compile Include="Configuration\UserConfig.cs" />
<Compile Include="Core\Controls\ControlExtensions.cs" />
<Compile Include="Core\Controls\FlatButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Core\Controls\FlatProgressBar.cs">
<SubType>Component</SubType>
</Compile>
@@ -126,6 +129,18 @@
<Compile Include="Core\Other\FormPlugins.Designer.cs">
<DependentUpon>FormPlugins.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCSS.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCSS.Designer.cs">
<DependentUpon>DialogSettingsCSS.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCefArgs.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Core\Other\Settings\Dialogs\DialogSettingsCefArgs.Designer.cs">
<DependentUpon>DialogSettingsCefArgs.cs</DependentUpon>
</Compile>
<Compile Include="Core\Other\Settings\Export\CombinedFileStream.cs" />
<Compile Include="Core\Other\Settings\Export\ExportManager.cs" />
<Compile Include="Core\Other\Settings\TabSettingsAdvanced.cs">
@@ -158,6 +173,7 @@
<Compile Include="Core\Other\Settings\TabSettingsUpdates.Designer.cs">
<DependentUpon>TabSettingsUpdates.cs</DependentUpon>
</Compile>
<Compile Include="Core\Utils\CommandLineArgsParser.cs" />
<Compile Include="Core\Utils\WindowState.cs" />
<Compile Include="Migration\FormBackgroundWork.cs">
<SubType>Form</SubType>
@@ -186,6 +202,7 @@
</Compile>
<Compile Include="Plugins\Plugin.cs" />
<Compile Include="Plugins\Events\PluginChangedStateEventArgs.cs" />
<Compile Include="Plugins\PluginBridge.cs" />
<Compile Include="Plugins\PluginConfig.cs" />
<Compile Include="Plugins\PluginEnvironment.cs" />
<Compile Include="Plugins\PluginGroup.cs" />