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

Compare commits

..

13 Commits
1.8.1 ... 1.8.2

29 changed files with 351 additions and 176 deletions

View File

@@ -19,24 +19,30 @@ namespace TweetDuck.Configuration{
} }
} }
private const int CurrentFileVersion = 10; private const int CurrentFileVersion = 11;
// START OF CONFIGURATION // START OF CONFIGURATION
public WindowState BrowserWindow { get; set; } public WindowState BrowserWindow { get; set; }
public WindowState PluginsWindow { get; set; }
public bool DisplayNotificationColumn { get; set; } public bool DisplayNotificationColumn { get; set; }
public bool DisplayNotificationTimer { get; set; } public bool DisplayNotificationTimer { get; set; }
public bool NotificationTimerCountDown { get; set; } public bool NotificationTimerCountDown { get; set; }
public bool NotificationSkipOnLinkClick { get; set; } public bool NotificationSkipOnLinkClick { get; set; }
public bool NotificationNonIntrusiveMode { get; set; } public bool NotificationNonIntrusiveMode { get; set; }
public int NotificationIdlePauseSeconds { get; set; }
public int NotificationDurationValue { get; set; }
public int NotificationScrollSpeed { get; set; }
public TweetNotification.Position NotificationPosition { get; set; } public TweetNotification.Position NotificationPosition { get; set; }
public Point CustomNotificationPosition { get; set; } public Point CustomNotificationPosition { get; set; }
public int NotificationEdgeDistance { get; set; } public int NotificationEdgeDistance { get; set; }
public int NotificationDisplay { get; set; } public int NotificationDisplay { get; set; }
public int NotificationIdlePauseSeconds { get; set; }
public int NotificationDurationValue { get; set; } public TweetNotification.Size NotificationSize { get; set; }
public int NotificationScrollSpeed { get; set; } public Size CustomNotificationSize { get; set; }
public bool EnableSpellCheck { get; set; } public bool EnableSpellCheck { get; set; }
public bool ExpandLinksOnHover { get; set; } public bool ExpandLinksOnHover { get; set; }
@@ -46,13 +52,12 @@ namespace TweetDuck.Configuration{
public bool EnableUpdateCheck { get; set; } public bool EnableUpdateCheck { get; set; }
public string DismissedUpdate { get; set; } public string DismissedUpdate { get; set; }
public WindowState PluginsWindow { get; set; }
public string CustomCefArgs { get; set; } public string CustomCefArgs { get; set; }
public string CustomBrowserCSS { get; set; } public string CustomBrowserCSS { get; set; }
public string CustomNotificationCSS { get; set; } public string CustomNotificationCSS { get; set; }
public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation; public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
public bool IsCustomNotificationSizeSet => CustomNotificationSize != Size.Empty;
public string NotificationSoundPath{ public string NotificationSoundPath{
get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath; get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
@@ -123,6 +128,7 @@ namespace TweetDuck.Configuration{
NotificationNonIntrusiveMode = true; NotificationNonIntrusiveMode = true;
NotificationPosition = TweetNotification.Position.TopRight; NotificationPosition = TweetNotification.Position.TopRight;
CustomNotificationPosition = ControlExtensions.InvisibleLocation; CustomNotificationPosition = ControlExtensions.InvisibleLocation;
NotificationSize = TweetNotification.Size.Auto;
NotificationEdgeDistance = 8; NotificationEdgeDistance = 8;
NotificationDurationValue = 25; NotificationDurationValue = 25;
NotificationScrollSpeed = 100; NotificationScrollSpeed = 100;
@@ -190,6 +196,11 @@ namespace TweetDuck.Configuration{
++fileVersion; ++fileVersion;
} }
if (fileVersion == 10){
NotificationSize = TweetNotification.Size.Auto;
++fileVersion;
}
// update the version // update the version
fileVersion = CurrentFileVersion; fileVersion = CurrentFileVersion;
Save(); Save();

View File

@@ -21,6 +21,12 @@ namespace TweetDuck.Core.Controls{
control.BeginInvoke(func); control.BeginInvoke(func);
} }
public static float GetDPIScale(this Control control){
using(Graphics graphics = control.CreateGraphics()){
return graphics.DpiY/96F;
}
}
public static bool IsFullyOutsideView(this Form form){ public static bool IsFullyOutsideView(this Form form){
return !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds)); return !Screen.AllScreens.Any(screen => screen.WorkingArea.IntersectsWith(form.Bounds));
} }

View File

@@ -26,8 +26,14 @@
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.trayIcon = new TweetDuck.Core.TrayIcon(this.components); this.trayIcon = new TweetDuck.Core.TrayIcon(this.components);
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.timerResize = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout(); this.SuspendLayout();
// //
// timerResize
//
this.timerResize.Interval = 500;
this.timerResize.Tick += new System.EventHandler(this.timerResize_Tick);
//
// FormBrowser // FormBrowser
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -42,6 +48,7 @@
this.Activated += new System.EventHandler(this.FormBrowser_Activated); this.Activated += new System.EventHandler(this.FormBrowser_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed);
this.LocationChanged += new System.EventHandler(this.FormBrowser_LocationChanged);
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd); this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
this.Resize += new System.EventHandler(this.FormBrowser_Resize); this.Resize += new System.EventHandler(this.FormBrowser_Resize);
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -52,6 +59,7 @@
private TrayIcon trayIcon; private TrayIcon trayIcon;
private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Timer timerResize;
} }
} }

View File

@@ -104,7 +104,7 @@ namespace TweetDuck.Core{
Config.MuteToggled += Config_MuteToggled; Config.MuteToggled += Config_MuteToggled;
Config.ZoomLevelChanged += Config_ZoomLevelChanged; Config.ZoomLevelChanged += Config_ZoomLevelChanged;
this.updates = new UpdateHandler(browser, this, updaterSettings); this.updates = new UpdateHandler(browser, updaterSettings);
this.updates.UpdateAccepted += updates_UpdateAccepted; this.updates.UpdateAccepted += updates_UpdateAccepted;
this.updates.UpdateDismissed += updates_UpdateDismissed; this.updates.UpdateDismissed += updates_UpdateDismissed;
@@ -208,12 +208,23 @@ namespace TweetDuck.Core{
} }
} }
private void timerResize_Tick(object sender, EventArgs e){
FormBrowser_ResizeEnd(this, e); // also stops timer
}
private void FormBrowser_Activated(object sender, EventArgs e){ private void FormBrowser_Activated(object sender, EventArgs e){
if (!isLoaded)return; if (!isLoaded)return;
trayIcon.HasNotifications = false; trayIcon.HasNotifications = false;
} }
private void FormBrowser_LocationChanged(object sender, EventArgs e){
if (!isLoaded)return;
timerResize.Stop();
timerResize.Start();
}
private void FormBrowser_Resize(object sender, EventArgs e){ private void FormBrowser_Resize(object sender, EventArgs e){
if (!isLoaded)return; if (!isLoaded)return;
@@ -229,11 +240,17 @@ namespace TweetDuck.Core{
FormBrowser_ResizeEnd(sender, e); FormBrowser_ResizeEnd(sender, e);
} }
} }
else{
timerResize.Stop();
timerResize.Start();
}
} }
private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves private void FormBrowser_ResizeEnd(object sender, EventArgs e){ // also triggers when the window moves
if (!isLoaded)return; if (!isLoaded)return;
timerResize.Stop();
if (Location != ControlExtensions.InvisibleLocation){ if (Location != ControlExtensions.InvisibleLocation){
Config.BrowserWindow.Save(this); Config.BrowserWindow.Save(this);
Config.Save(); Config.Save();
@@ -287,24 +304,28 @@ namespace TweetDuck.Core{
} }
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){ private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){ this.InvokeAsyncSafe(() => {
if (form is FormSettings || form is FormPlugins || form is FormAbout){ foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){
form.Close(); if (form is FormSettings || form is FormPlugins || form is FormAbout){
} form.Close();
} }
updates.BeginUpdateDownload(this, e.UpdateInfo, update => {
if (update.DownloadStatus == UpdateDownloadStatus.Done){
UpdateInstallerPath = update.InstallerPath;
} }
ForceClose(); updates.BeginUpdateDownload(this, e.UpdateInfo, update => {
if (update.DownloadStatus == UpdateDownloadStatus.Done){
UpdateInstallerPath = update.InstallerPath;
}
ForceClose();
});
}); });
} }
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){ private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
Config.DismissedUpdate = e.VersionTag; this.InvokeAsyncSafe(() => {
Config.Save(); Config.DismissedUpdate = e.VersionTag;
Config.Save();
});
} }
private void soundNotification_PlaybackError(object sender, PlaybackErrorEventArgs e){ private void soundNotification_PlaybackError(object sender, PlaybackErrorEventArgs e){
@@ -397,6 +418,8 @@ namespace TweetDuck.Core{
} }
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound); UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound);
notification.RequiresResize = true;
form.Dispose(); form.Dispose();
}; };

View File

@@ -117,11 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <metadata name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<data name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing">
<value>17, 17</value> <value>17, 17</value>
</data> </metadata>
<data name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing"> <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>112, 17</value> <value>112, 17</value>
</data> </metadata>
<metadata name="timerResize.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>202, 17</value>
</metadata>
</root> </root>

View File

@@ -57,20 +57,25 @@ namespace TweetDuck.Core.Notification{
set{ set{
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation; Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
FormBorderStyle = GetBorderStyle(CanResizeWindow);
if (WindowsUtils.ShouldAvoidToolWindow){
FormBorderStyle = Visible ? FormBorderStyle.FixedSingle : FormBorderStyle.FixedToolWindow; // workaround for alt+tab
}
} }
} }
public Func<bool> CanMoveWindow = () => true; public bool CanResizeWindow{
get => FormBorderStyle == FormBorderStyle.Sizable || FormBorderStyle == FormBorderStyle.SizableToolWindow;
set => FormBorderStyle = GetBorderStyle(value);
}
public Func<bool> CanMoveWindow { get; set; } = () => true;
protected override bool ShowWithoutActivation => true; protected override bool ShowWithoutActivation => true;
protected double SizeScale => dpiScale*Program.UserConfig.ZoomMultiplier;
protected readonly Form owner; protected readonly Form owner;
protected readonly ChromiumWebBrowser browser; protected readonly ChromiumWebBrowser browser;
private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification(); private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
private readonly float dpiScale;
private string currentColumn; private string currentColumn;
private int pauseCounter; private int pauseCounter;
@@ -103,6 +108,8 @@ namespace TweetDuck.Core.Notification{
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage; this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
#endif #endif
this.dpiScale = this.GetDPIScale();
DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory; DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory;
handlerFactory.RegisterHandler("https://tweetdeck.twitter.com", this.resourceHandler); handlerFactory.RegisterHandler("https://tweetdeck.twitter.com", this.resourceHandler);
@@ -177,7 +184,7 @@ namespace TweetDuck.Core.Notification{
} }
protected virtual void SetNotificationSize(int width, int height){ protected virtual void SetNotificationSize(int width, int height){
browser.ClientSize = ClientSize = new Size((int)Math.Round(width*Program.UserConfig.ZoomMultiplier), (int)Math.Round(height*Program.UserConfig.ZoomMultiplier)); browser.ClientSize = ClientSize = new Size(BrowserUtils.Scale(width, SizeScale), BrowserUtils.Scale(height, SizeScale));
} }
protected virtual void OnNotificationReady(){ protected virtual void OnNotificationReady(){
@@ -207,5 +214,14 @@ namespace TweetDuck.Core.Notification{
toolTip.Show(text, this, position); toolTip.Show(text, this, position);
} }
} }
private FormBorderStyle GetBorderStyle(bool sizable){
if (WindowsUtils.ShouldAvoidToolWindow && Visible){ // Visible = workaround for alt+tab
return sizable ? FormBorderStyle.Sizable : FormBorderStyle.FixedSingle;
}
else{
return sizable ? FormBorderStyle.SizableToolWindow : FormBorderStyle.FixedToolWindow;
}
}
} }
} }

View File

@@ -49,7 +49,7 @@
this.progressBarTimer.Margin = new System.Windows.Forms.Padding(0); this.progressBarTimer.Margin = new System.Windows.Forms.Padding(0);
this.progressBarTimer.Maximum = 1000; this.progressBarTimer.Maximum = 1000;
this.progressBarTimer.Name = "progressBarTimer"; this.progressBarTimer.Name = "progressBarTimer";
this.progressBarTimer.Size = new System.Drawing.Size(284, 4); this.progressBarTimer.Size = new System.Drawing.Size(284, TimerBarHeight);
this.progressBarTimer.TabIndex = 1; this.progressBarTimer.TabIndex = 1;
// //
// FormNotification // FormNotification

View File

@@ -12,6 +12,7 @@ using TweetDuck.Resources;
namespace TweetDuck.Core.Notification{ namespace TweetDuck.Core.Notification{
partial class FormNotificationMain : FormNotificationBase{ partial class FormNotificationMain : FormNotificationBase{
private const string NotificationScriptFile = "notification.js"; private const string NotificationScriptFile = "notification.js";
private const int TimerBarHeight = 4;
private static readonly string NotificationScriptIdentifier = ScriptLoader.GetRootIdentifier(NotificationScriptFile); private static readonly string NotificationScriptIdentifier = ScriptLoader.GetRootIdentifier(NotificationScriptFile);
private static readonly string PluginScriptIdentifier = ScriptLoader.GetRootIdentifier(PluginManager.PluginNotificationScriptFile); private static readonly string PluginScriptIdentifier = ScriptLoader.GetRootIdentifier(PluginManager.PluginNotificationScriptFile);
@@ -23,22 +24,6 @@ namespace TweetDuck.Core.Notification{
PluginJS = ScriptLoader.LoadResource(PluginManager.PluginNotificationScriptFile); PluginJS = ScriptLoader.LoadResource(PluginManager.PluginNotificationScriptFile);
} }
private static int BaseClientWidth{
get{
int level = TweetNotification.FontSizeLevel;
int width = level == 0 ? 284 : (int)Math.Round(284.0*(1.0+0.05*level));
return (int)Math.Round(width*Program.UserConfig.ZoomMultiplier);
}
}
private static int BaseClientHeight{
get{
int level = TweetNotification.FontSizeLevel;
int height = level == 0 ? 118 : (int)Math.Round(118.0*(1.0+0.075*level));
return (int)Math.Round(height*Program.UserConfig.ZoomMultiplier);
}
}
private readonly PluginManager plugins; private readonly PluginManager plugins;
protected int timeLeft, totalTime; protected int timeLeft, totalTime;
@@ -51,9 +36,9 @@ namespace TweetDuck.Core.Notification{
private bool? prevDisplayTimer; private bool? prevDisplayTimer;
private int? prevFontSize; private int? prevFontSize;
private bool RequiresResize{ public bool RequiresResize{
get{ get{
return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Program.UserConfig.DisplayNotificationTimer || prevFontSize != TweetNotification.FontSizeLevel; return !prevDisplayTimer.HasValue || !prevFontSize.HasValue || prevDisplayTimer != Program.UserConfig.DisplayNotificationTimer || prevFontSize != TweetNotification.FontSizeLevel || CanResizeWindow;
} }
set{ set{
@@ -68,6 +53,34 @@ namespace TweetDuck.Core.Notification{
} }
} }
private int BaseClientWidth{
get{
switch(Program.UserConfig.NotificationSize){
default:
return BrowserUtils.Scale(284, SizeScale*(1.0+0.05*TweetNotification.FontSizeLevel));
case TweetNotification.Size.Custom:
return Program.UserConfig.CustomNotificationSize.Width;
}
}
}
private int BaseClientHeight{
get{
switch(Program.UserConfig.NotificationSize){
default:
return BrowserUtils.Scale(118, SizeScale*(1.0+0.075*TweetNotification.FontSizeLevel));
case TweetNotification.Size.Custom:
return Program.UserConfig.CustomNotificationSize.Height;
}
}
}
public Size BrowserSize{
get => Program.UserConfig.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-TimerBarHeight) : ClientSize;
}
public FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){ public FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
InitializeComponent(); InitializeComponent();
@@ -104,9 +117,7 @@ namespace TweetDuck.Core.Notification{
int eventType = wParam.ToInt32(); int eventType = wParam.ToInt32();
if (eventType == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position))){ if (eventType == NativeMethods.WM_MOUSEWHEEL && browser.Bounds.Contains(PointToClient(Cursor.Position))){
int distance = (int)Math.Round(NativeMethods.GetMouseHookData(lParam)*(Program.UserConfig.NotificationScrollSpeed/100.0)); browser.SendMouseWheelEvent(0, 0, 0, BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Program.UserConfig.NotificationScrollSpeed/100.0), CefEventFlags.None);
browser.SendMouseWheelEvent(0, 0, 0, distance, CefEventFlags.None);
return NativeMethods.HOOK_HANDLED; return NativeMethods.HOOK_HANDLED;
} }
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){ else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
@@ -177,7 +188,7 @@ namespace TweetDuck.Core.Notification{
timeLeft -= timerProgress.Interval; timeLeft -= timerProgress.Interval;
int value = (int)Math.Round(1025.0*(totalTime-timeLeft)/totalTime); int value = BrowserUtils.Scale(1025, (totalTime-timeLeft)/(double)totalTime);
progressBarTimer.SetValueInstant(Math.Min(1000, Math.Max(0, Program.UserConfig.NotificationTimerCountDown ? 1000-value : value))); progressBarTimer.SetValueInstant(Math.Min(1000, Math.Max(0, Program.UserConfig.NotificationTimerCountDown ? 1000-value : value)));
if (timeLeft <= 0){ if (timeLeft <= 0){
@@ -255,7 +266,7 @@ namespace TweetDuck.Core.Notification{
protected override void SetNotificationSize(int width, int height){ protected override void SetNotificationSize(int width, int height){
if (Program.UserConfig.DisplayNotificationTimer){ if (Program.UserConfig.DisplayNotificationTimer){
ClientSize = new Size(width, height+4); ClientSize = new Size(width, height+TimerBarHeight);
progressBarTimer.Visible = true; progressBarTimer.Visible = true;
} }
else{ else{

View File

@@ -51,6 +51,10 @@ namespace TweetDuck.Core.Notification{
TopLeft, TopRight, BottomLeft, BottomRight, Custom TopLeft, TopRight, BottomLeft, BottomRight, Custom
} }
public enum Size{
Auto, Custom
}
public string Column { get; } public string Column { get; }
public string TweetUrl { get; } public string TweetUrl { get; }
public string QuoteUrl { get; } public string QuoteUrl { get; }

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;
namespace TweetDuck.Core.Other{ namespace TweetDuck.Core.Other{
sealed partial class FormMessage : Form{ sealed partial class FormMessage : Form{
@@ -13,8 +15,13 @@ namespace TweetDuck.Core.Other{
set => ClientSize = new Size(value, ClientSize.Height); set => ClientSize = new Size(value, ClientSize.Height);
} }
private int ButtonDistance{
get => BrowserUtils.Scale(96, dpiScale);
}
private readonly Icon icon; private readonly Icon icon;
private readonly bool isReady; private readonly bool isReady;
private readonly float dpiScale;
private int realFormWidth, minFormWidth; private int realFormWidth, minFormWidth;
private int buttonCount; private int buttonCount;
@@ -24,9 +31,11 @@ namespace TweetDuck.Core.Other{
public FormMessage(string caption, string text, MessageBoxIcon messageIcon){ public FormMessage(string caption, string text, MessageBoxIcon messageIcon){
InitializeComponent(); InitializeComponent();
this.dpiScale = this.GetDPIScale();
this.prevLabelWidth = labelMessage.Width; this.prevLabelWidth = labelMessage.Width;
this.prevLabelHeight = labelMessage.Height; this.prevLabelHeight = labelMessage.Height;
this.minFormWidth = 40; this.minFormWidth = BrowserUtils.Scale(40, dpiScale);
switch(messageIcon){ switch(messageIcon){
case MessageBoxIcon.Information: case MessageBoxIcon.Information:
@@ -66,7 +75,7 @@ namespace TweetDuck.Core.Other{
Anchor = AnchorStyles.Bottom, Anchor = AnchorStyles.Bottom,
Font = SystemFonts.MessageBoxFont, Font = SystemFonts.MessageBoxFont,
Location = new Point(0, 12), Location = new Point(0, 12),
Size = new Size(88, 26), Size = new Size(BrowserUtils.Scale(88, dpiScale), BrowserUtils.Scale(26, dpiScale)),
TabIndex = buttonCount, TabIndex = buttonCount,
Text = title, Text = title,
UseVisualStyleBackColor = true UseVisualStyleBackColor = true
@@ -81,7 +90,7 @@ namespace TweetDuck.Core.Other{
panelActions.Controls.Add(button); panelActions.Controls.Add(button);
++buttonCount; ++buttonCount;
minFormWidth += 96; minFormWidth += ButtonDistance;
ClientWidth = Math.Max(realFormWidth, minFormWidth); ClientWidth = Math.Max(realFormWidth, minFormWidth);
RecalculateButtonLocation(); RecalculateButtonLocation();
@@ -91,14 +100,19 @@ namespace TweetDuck.Core.Other{
public void AddActionControl(Control control){ public void AddActionControl(Control control){
panelActions.Controls.Add(control); panelActions.Controls.Add(control);
control.Size = new Size(BrowserUtils.Scale(control.Width, dpiScale), BrowserUtils.Scale(control.Height, dpiScale));
minFormWidth += control.Width+control.Margin.Horizontal; minFormWidth += control.Width+control.Margin.Horizontal;
ClientWidth = Math.Max(realFormWidth, minFormWidth); ClientWidth = Math.Max(realFormWidth, minFormWidth);
} }
private void RecalculateButtonLocation(){ private void RecalculateButtonLocation(){
int dist = ButtonDistance;
int start = ClientWidth-dist-BrowserUtils.Scale(1, dpiScale);
for(int index = 0; index < buttonCount; index++){ for(int index = 0; index < buttonCount; index++){
Control control = panelActions.Controls[index]; Control control = panelActions.Controls[index];
control.Location = new Point(ClientWidth-97-index*96, control.Location.Y); control.Location = new Point(start-index*dist, control.Location.Y);
} }
} }
@@ -108,14 +122,15 @@ namespace TweetDuck.Core.Other{
} }
bool isMultiline = labelMessage.Height > labelMessage.MinimumSize.Height; bool isMultiline = labelMessage.Height > labelMessage.MinimumSize.Height;
int labelOffset = BrowserUtils.Scale(8, dpiScale);
if (isMultiline && !wasLabelMultiline){ if (isMultiline && !wasLabelMultiline){
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y-8); labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y-labelOffset);
prevLabelHeight += 8; prevLabelHeight += labelOffset;
} }
else if (!isMultiline && wasLabelMultiline){ else if (!isMultiline && wasLabelMultiline){
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y+8); labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y+labelOffset);
prevLabelHeight -= 8; prevLabelHeight -= labelOffset;
} }
realFormWidth = ClientWidth-(icon == null ? 50 : 0)+labelMessage.Width-prevLabelWidth; realFormWidth = ClientWidth-(icon == null ? 50 : 0)+labelMessage.Width-prevLabelWidth;

View File

@@ -5,6 +5,7 @@ using System.Windows.Forms;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Other.Settings; using TweetDuck.Core.Other.Settings;
using TweetDuck.Core.Other.Settings.Dialogs; using TweetDuck.Core.Other.Settings.Dialogs;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins; using TweetDuck.Plugins;
using TweetDuck.Updates; using TweetDuck.Updates;
@@ -13,6 +14,8 @@ namespace TweetDuck.Core.Other{
private readonly FormBrowser browser; private readonly FormBrowser browser;
private readonly PluginManager plugins; private readonly PluginManager plugins;
private readonly int buttonHeight;
private readonly Dictionary<Type, SettingsTab> tabs = new Dictionary<Type, SettingsTab>(4); private readonly Dictionary<Type, SettingsTab> tabs = new Dictionary<Type, SettingsTab>(4);
private SettingsTab currentTab; private SettingsTab currentTab;
@@ -26,6 +29,8 @@ namespace TweetDuck.Core.Other{
this.plugins = plugins; this.plugins = plugins;
this.buttonHeight = BrowserUtils.Scale(39, this.GetDPIScale()) | 1;
AddButton("General", () => new TabSettingsGeneral(updates)); AddButton("General", () => new TabSettingsGeneral(updates));
AddButton("Notifications", () => new TabSettingsNotifications(browser.CreateNotificationForm(false))); AddButton("Notifications", () => new TabSettingsNotifications(browser.CreateNotificationForm(false)));
AddButton("Sounds", () => new TabSettingsSounds()); AddButton("Sounds", () => new TabSettingsSounds());
@@ -63,14 +68,12 @@ namespace TweetDuck.Core.Other{
} }
private void AddButton<T>(string title, Func<T> constructor) where T : BaseTabSettings{ private void AddButton<T>(string title, Func<T> constructor) where T : BaseTabSettings{
const int btnHeight = 39;
FlatButton btn = new FlatButton{ FlatButton btn = new FlatButton{
BackColor = SystemColors.Control, BackColor = SystemColors.Control,
FlatStyle = FlatStyle.Flat, FlatStyle = FlatStyle.Flat,
Location = new Point(0, (btnHeight+1)*(panelButtons.Controls.Count/2)), Location = new Point(0, (buttonHeight+1)*(panelButtons.Controls.Count/2)),
Margin = new Padding(0), Margin = new Padding(0),
Size = new Size(panelButtons.Width, btnHeight), Size = new Size(panelButtons.Width, buttonHeight),
Text = title, Text = title,
UseVisualStyleBackColor = true UseVisualStyleBackColor = true
}; };
@@ -83,7 +86,7 @@ namespace TweetDuck.Core.Other{
panelButtons.Controls.Add(new Panel{ panelButtons.Controls.Add(new Panel{
BackColor = Color.DimGray, BackColor = Color.DimGray,
Location = new Point(0, panelButtons.Controls[panelButtons.Controls.Count-1].Location.Y+btnHeight), Location = new Point(0, panelButtons.Controls[panelButtons.Controls.Count-1].Location.Y+buttonHeight),
Margin = new Padding(0), Margin = new Padding(0),
Size = new Size(panelButtons.Width, 1) Size = new Size(panelButtons.Width, 1)
}); });

View File

@@ -42,16 +42,14 @@
// //
// textBoxBrowserCSS // textBoxBrowserCSS
// //
this.textBoxBrowserCSS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.textBoxBrowserCSS.Dock = System.Windows.Forms.DockStyle.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.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.Location = new System.Drawing.Point(0, 16);
this.textBoxBrowserCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0); this.textBoxBrowserCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.textBoxBrowserCSS.Multiline = true; this.textBoxBrowserCSS.Multiline = true;
this.textBoxBrowserCSS.Name = "textBoxBrowserCSS"; this.textBoxBrowserCSS.Name = "textBoxBrowserCSS";
this.textBoxBrowserCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxBrowserCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxBrowserCSS.Size = new System.Drawing.Size(373, 253); this.textBoxBrowserCSS.Size = new System.Drawing.Size(378, 253);
this.textBoxBrowserCSS.TabIndex = 1; this.textBoxBrowserCSS.TabIndex = 1;
this.textBoxBrowserCSS.WordWrap = false; this.textBoxBrowserCSS.WordWrap = false;
this.textBoxBrowserCSS.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxBrowserCSS_KeyUp); this.textBoxBrowserCSS.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxBrowserCSS_KeyUp);
@@ -100,7 +98,7 @@
this.splitContainer.Panel2.Controls.Add(this.textBoxNotificationCSS); this.splitContainer.Panel2.Controls.Add(this.textBoxNotificationCSS);
this.splitContainer.Panel2MinSize = 64; this.splitContainer.Panel2MinSize = 64;
this.splitContainer.Size = new System.Drawing.Size(760, 269); this.splitContainer.Size = new System.Drawing.Size(760, 269);
this.splitContainer.SplitterDistance = 373; this.splitContainer.SplitterDistance = 378;
this.splitContainer.SplitterWidth = 5; this.splitContainer.SplitterWidth = 5;
this.splitContainer.TabIndex = 0; this.splitContainer.TabIndex = 0;
// //
@@ -126,16 +124,14 @@
// //
// textBoxNotificationCSS // textBoxNotificationCSS
// //
this.textBoxNotificationCSS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.textBoxNotificationCSS.Dock = System.Windows.Forms.DockStyle.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.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.Location = new System.Drawing.Point(0, 16);
this.textBoxNotificationCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0); this.textBoxNotificationCSS.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
this.textBoxNotificationCSS.Multiline = true; this.textBoxNotificationCSS.Multiline = true;
this.textBoxNotificationCSS.Name = "textBoxNotificationCSS"; this.textBoxNotificationCSS.Name = "textBoxNotificationCSS";
this.textBoxNotificationCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxNotificationCSS.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxNotificationCSS.Size = new System.Drawing.Size(372, 253); this.textBoxNotificationCSS.Size = new System.Drawing.Size(377, 253);
this.textBoxNotificationCSS.TabIndex = 1; this.textBoxNotificationCSS.TabIndex = 1;
this.textBoxNotificationCSS.WordWrap = false; this.textBoxNotificationCSS.WordWrap = false;
// //
@@ -152,7 +148,6 @@
// btnOpenWiki // btnOpenWiki
// //
this.btnOpenWiki.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnOpenWiki.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOpenWiki.AutoSize = true;
this.btnOpenWiki.Location = new System.Drawing.Point(12, 287); this.btnOpenWiki.Location = new System.Drawing.Point(12, 287);
this.btnOpenWiki.Name = "btnOpenWiki"; this.btnOpenWiki.Name = "btnOpenWiki";
this.btnOpenWiki.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnOpenWiki.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);

View File

@@ -69,7 +69,6 @@
// btnHelp // btnHelp
// //
this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 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.Location = new System.Drawing.Point(12, 227);
this.btnHelp.Name = "btnHelp"; this.btnHelp.Name = "btnHelp";
this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnHelp.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);

View File

@@ -42,7 +42,6 @@
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.AutoSize = true;
this.btnCancel.Location = new System.Drawing.Point(176, 97); this.btnCancel.Location = new System.Drawing.Point(176, 97);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
@@ -56,7 +55,6 @@
// //
this.btnContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnContinue.AutoSize = true; this.btnContinue.AutoSize = true;
this.btnContinue.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnContinue.Enabled = false; this.btnContinue.Enabled = false;
this.btnContinue.Location = new System.Drawing.Point(125, 97); this.btnContinue.Location = new System.Drawing.Point(125, 97);
this.btnContinue.Name = "btnContinue"; this.btnContinue.Name = "btnContinue";

View File

@@ -38,7 +38,6 @@
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.AutoSize = true;
this.btnCancel.Location = new System.Drawing.Point(160, 171); this.btnCancel.Location = new System.Drawing.Point(160, 171);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
@@ -51,7 +50,6 @@
// btnRestart // btnRestart
// //
this.btnRestart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnRestart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRestart.AutoSize = true;
this.btnRestart.Location = new System.Drawing.Point(97, 171); this.btnRestart.Location = new System.Drawing.Point(97, 171);
this.btnRestart.Name = "btnRestart"; this.btnRestart.Name = "btnRestart";
this.btnRestart.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnRestart.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);

View File

@@ -142,7 +142,7 @@ namespace TweetDuck.Core.Other.Settings.Export{
} }
if (IsRestarting){ if (IsRestarting){
Program.Restart(new string[]{ Arguments.ArgImportCookies }); Program.Restart(Arguments.ArgImportCookies);
} }
else{ else{
Program.ReloadConfig(); Program.ReloadConfig();

View File

@@ -98,13 +98,15 @@ namespace TweetDuck.Core.Other.Settings{
} }
private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){ private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
if (e.EventId == updateCheckEventId){ this.InvokeAsyncSafe(() => {
btnCheckUpdates.Enabled = true; if (e.EventId == updateCheckEventId){
btnCheckUpdates.Enabled = true;
if (!e.UpdateAvailable){ if (!e.UpdateAvailable){
MessageBox.Show("Your version of "+Program.BrandName+" is up to date.", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Your version of "+Program.BrandName+" is up to date.", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
} }
} });
} }
private void zoomUpdateTimer_Tick(object sender, EventArgs e){ private void zoomUpdateTimer_Tick(object sender, EventArgs e){

View File

@@ -48,6 +48,8 @@
this.checkTimerCountDown = new System.Windows.Forms.CheckBox(); this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
this.checkNotificationTimer = new System.Windows.Forms.CheckBox(); this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.radioSizeAuto = new System.Windows.Forms.RadioButton();
this.radioSizeCustom = new System.Windows.Forms.RadioButton();
this.labelGeneral = new System.Windows.Forms.Label(); this.labelGeneral = new System.Windows.Forms.Label();
this.panelGeneral = new System.Windows.Forms.Panel(); this.panelGeneral = new System.Windows.Forms.Panel();
this.labelScrollSpeedValue = new System.Windows.Forms.Label(); this.labelScrollSpeedValue = new System.Windows.Forms.Label();
@@ -58,8 +60,9 @@
this.panelTimer = new System.Windows.Forms.Panel(); this.panelTimer = new System.Windows.Forms.Panel();
this.labelDuration = new System.Windows.Forms.Label(); this.labelDuration = new System.Windows.Forms.Label();
this.labelTimer = new System.Windows.Forms.Label(); this.labelTimer = new System.Windows.Forms.Label();
this.labelMiscellaneous = new System.Windows.Forms.Label(); this.labelSize = new System.Windows.Forms.Label();
this.panelMiscellaneous = new System.Windows.Forms.Panel(); this.panelMiscellaneous = new System.Windows.Forms.Panel();
this.durationUpdateTimer = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
this.tableLayoutDurationButtons.SuspendLayout(); this.tableLayoutDurationButtons.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarDuration)).BeginInit();
@@ -121,7 +124,7 @@
this.radioLocCustom.TabIndex = 4; this.radioLocCustom.TabIndex = 4;
this.radioLocCustom.TabStop = true; this.radioLocCustom.TabStop = true;
this.radioLocCustom.Text = "Custom"; this.radioLocCustom.Text = "Custom";
this.toolTip.SetToolTip(this.radioLocCustom, "Drag the notification window to the desired location."); this.toolTip.SetToolTip(this.radioLocCustom, "Drag the example notification window to the desired location.");
this.radioLocCustom.UseVisualStyleBackColor = true; this.radioLocCustom.UseVisualStyleBackColor = true;
// //
// radioLocBR // radioLocBR
@@ -295,32 +298,32 @@
// labelIdlePause // labelIdlePause
// //
this.labelIdlePause.AutoSize = true; this.labelIdlePause.AutoSize = true;
this.labelIdlePause.Location = new System.Drawing.Point(3, 60); this.labelIdlePause.Location = new System.Drawing.Point(3, 83);
this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelIdlePause.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelIdlePause.Name = "labelIdlePause"; this.labelIdlePause.Name = "labelIdlePause";
this.labelIdlePause.Size = new System.Drawing.Size(89, 13); this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
this.labelIdlePause.TabIndex = 2; this.labelIdlePause.TabIndex = 3;
this.labelIdlePause.Text = "Pause When Idle"; this.labelIdlePause.Text = "Pause When Idle";
// //
// comboBoxIdlePause // comboBoxIdlePause
// //
this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxIdlePause.FormattingEnabled = true; this.comboBoxIdlePause.FormattingEnabled = true;
this.comboBoxIdlePause.Location = new System.Drawing.Point(5, 76); this.comboBoxIdlePause.Location = new System.Drawing.Point(5, 99);
this.comboBoxIdlePause.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3); this.comboBoxIdlePause.Margin = new System.Windows.Forms.Padding(5, 3, 3, 3);
this.comboBoxIdlePause.Name = "comboBoxIdlePause"; this.comboBoxIdlePause.Name = "comboBoxIdlePause";
this.comboBoxIdlePause.Size = new System.Drawing.Size(144, 21); this.comboBoxIdlePause.Size = new System.Drawing.Size(144, 21);
this.comboBoxIdlePause.TabIndex = 3; this.comboBoxIdlePause.TabIndex = 4;
this.toolTip.SetToolTip(this.comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time."); this.toolTip.SetToolTip(this.comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time.");
// //
// checkNonIntrusive // checkNonIntrusive
// //
this.checkNonIntrusive.AutoSize = true; this.checkNonIntrusive.AutoSize = true;
this.checkNonIntrusive.Location = new System.Drawing.Point(6, 5); this.checkNonIntrusive.Location = new System.Drawing.Point(6, 51);
this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3); this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
this.checkNonIntrusive.Name = "checkNonIntrusive"; this.checkNonIntrusive.Name = "checkNonIntrusive";
this.checkNonIntrusive.Size = new System.Drawing.Size(128, 17); this.checkNonIntrusive.Size = new System.Drawing.Size(128, 17);
this.checkNonIntrusive.TabIndex = 0; this.checkNonIntrusive.TabIndex = 2;
this.checkNonIntrusive.Text = "Non-Intrusive Popups"; this.checkNonIntrusive.Text = "Non-Intrusive Popups";
this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " + this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " +
"delayed until the cursor moves away to prevent accidental clicks."); "delayed until the cursor moves away to prevent accidental clicks.");
@@ -349,6 +352,30 @@
this.checkNotificationTimer.Text = "Display Notification Timer"; this.checkNotificationTimer.Text = "Display Notification Timer";
this.checkNotificationTimer.UseVisualStyleBackColor = true; this.checkNotificationTimer.UseVisualStyleBackColor = true;
// //
// radioSizeAuto
//
this.radioSizeAuto.Location = new System.Drawing.Point(6, 4);
this.radioSizeAuto.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
this.radioSizeAuto.Name = "radioSizeAuto";
this.radioSizeAuto.Size = new System.Drawing.Size(92, 17);
this.radioSizeAuto.TabIndex = 0;
this.radioSizeAuto.TabStop = true;
this.radioSizeAuto.Text = "Auto";
this.toolTip.SetToolTip(this.radioSizeAuto, "Notification size is based on the font size and browser zoom level.");
this.radioSizeAuto.UseVisualStyleBackColor = true;
//
// radioSizeCustom
//
this.radioSizeCustom.Location = new System.Drawing.Point(106, 4);
this.radioSizeCustom.Margin = new System.Windows.Forms.Padding(5, 4, 3, 3);
this.radioSizeCustom.Name = "radioSizeCustom";
this.radioSizeCustom.Size = new System.Drawing.Size(92, 17);
this.radioSizeCustom.TabIndex = 1;
this.radioSizeCustom.TabStop = true;
this.radioSizeCustom.Text = "Custom";
this.toolTip.SetToolTip(this.radioSizeCustom, "Resize the example notification window to the desired size.");
this.radioSizeCustom.UseVisualStyleBackColor = true;
//
// labelGeneral // labelGeneral
// //
this.labelGeneral.AutoSize = true; this.labelGeneral.AutoSize = true;
@@ -366,20 +393,21 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panelGeneral.Controls.Add(this.checkColumnName); this.panelGeneral.Controls.Add(this.checkColumnName);
this.panelGeneral.Controls.Add(this.checkSkipOnLinkClick); this.panelGeneral.Controls.Add(this.checkSkipOnLinkClick);
this.panelGeneral.Controls.Add(this.checkNonIntrusive);
this.panelGeneral.Controls.Add(this.labelIdlePause); this.panelGeneral.Controls.Add(this.labelIdlePause);
this.panelGeneral.Controls.Add(this.comboBoxIdlePause); this.panelGeneral.Controls.Add(this.comboBoxIdlePause);
this.panelGeneral.Location = new System.Drawing.Point(9, 31); this.panelGeneral.Location = new System.Drawing.Point(9, 31);
this.panelGeneral.Name = "panelGeneral"; this.panelGeneral.Name = "panelGeneral";
this.panelGeneral.Size = new System.Drawing.Size(322, 103); this.panelGeneral.Size = new System.Drawing.Size(322, 126);
this.panelGeneral.TabIndex = 1; this.panelGeneral.TabIndex = 1;
// //
// labelScrollSpeedValue // labelScrollSpeedValue
// //
this.labelScrollSpeedValue.Location = new System.Drawing.Point(147, 54); this.labelScrollSpeedValue.Location = new System.Drawing.Point(147, 53);
this.labelScrollSpeedValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.labelScrollSpeedValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.labelScrollSpeedValue.Name = "labelScrollSpeedValue"; this.labelScrollSpeedValue.Name = "labelScrollSpeedValue";
this.labelScrollSpeedValue.Size = new System.Drawing.Size(34, 13); this.labelScrollSpeedValue.Size = new System.Drawing.Size(34, 13);
this.labelScrollSpeedValue.TabIndex = 3; this.labelScrollSpeedValue.TabIndex = 4;
this.labelScrollSpeedValue.Text = "100%"; this.labelScrollSpeedValue.Text = "100%";
this.labelScrollSpeedValue.TextAlign = System.Drawing.ContentAlignment.TopRight; this.labelScrollSpeedValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
@@ -387,35 +415,35 @@
// //
this.trackBarScrollSpeed.AutoSize = false; this.trackBarScrollSpeed.AutoSize = false;
this.trackBarScrollSpeed.LargeChange = 25; this.trackBarScrollSpeed.LargeChange = 25;
this.trackBarScrollSpeed.Location = new System.Drawing.Point(5, 53); this.trackBarScrollSpeed.Location = new System.Drawing.Point(5, 52);
this.trackBarScrollSpeed.Maximum = 200; this.trackBarScrollSpeed.Maximum = 200;
this.trackBarScrollSpeed.Minimum = 25; this.trackBarScrollSpeed.Minimum = 25;
this.trackBarScrollSpeed.Name = "trackBarScrollSpeed"; this.trackBarScrollSpeed.Name = "trackBarScrollSpeed";
this.trackBarScrollSpeed.Size = new System.Drawing.Size(148, 30); this.trackBarScrollSpeed.Size = new System.Drawing.Size(148, 30);
this.trackBarScrollSpeed.SmallChange = 25; this.trackBarScrollSpeed.SmallChange = 5;
this.trackBarScrollSpeed.TabIndex = 2; this.trackBarScrollSpeed.TabIndex = 3;
this.trackBarScrollSpeed.TickFrequency = 25; this.trackBarScrollSpeed.TickFrequency = 25;
this.trackBarScrollSpeed.Value = 100; this.trackBarScrollSpeed.Value = 100;
// //
// labelScrollSpeed // labelScrollSpeed
// //
this.labelScrollSpeed.AutoSize = true; this.labelScrollSpeed.AutoSize = true;
this.labelScrollSpeed.Location = new System.Drawing.Point(3, 37); this.labelScrollSpeed.Location = new System.Drawing.Point(3, 36);
this.labelScrollSpeed.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0); this.labelScrollSpeed.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
this.labelScrollSpeed.Name = "labelScrollSpeed"; this.labelScrollSpeed.Name = "labelScrollSpeed";
this.labelScrollSpeed.Size = new System.Drawing.Size(67, 13); this.labelScrollSpeed.Size = new System.Drawing.Size(67, 13);
this.labelScrollSpeed.TabIndex = 1; this.labelScrollSpeed.TabIndex = 2;
this.labelScrollSpeed.Text = "Scroll Speed"; this.labelScrollSpeed.Text = "Scroll Speed";
// //
// labelLocation // labelLocation
// //
this.labelLocation.AutoSize = true; this.labelLocation.AutoSize = true;
this.labelLocation.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.labelLocation.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.labelLocation.Location = new System.Drawing.Point(6, 158); this.labelLocation.Location = new System.Drawing.Point(6, 372);
this.labelLocation.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0); this.labelLocation.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0);
this.labelLocation.Name = "labelLocation"; this.labelLocation.Name = "labelLocation";
this.labelLocation.Size = new System.Drawing.Size(70, 20); this.labelLocation.Size = new System.Drawing.Size(70, 20);
this.labelLocation.TabIndex = 2; this.labelLocation.TabIndex = 4;
this.labelLocation.Text = "Location"; this.labelLocation.Text = "Location";
// //
// panelLocation // panelLocation
@@ -432,10 +460,10 @@
this.panelLocation.Controls.Add(this.radioLocBL); this.panelLocation.Controls.Add(this.radioLocBL);
this.panelLocation.Controls.Add(this.radioLocCustom); this.panelLocation.Controls.Add(this.radioLocCustom);
this.panelLocation.Controls.Add(this.radioLocBR); this.panelLocation.Controls.Add(this.radioLocBR);
this.panelLocation.Location = new System.Drawing.Point(9, 181); this.panelLocation.Location = new System.Drawing.Point(9, 395);
this.panelLocation.Name = "panelLocation"; this.panelLocation.Name = "panelLocation";
this.panelLocation.Size = new System.Drawing.Size(322, 165); this.panelLocation.Size = new System.Drawing.Size(322, 165);
this.panelLocation.TabIndex = 3; this.panelLocation.TabIndex = 5;
// //
// panelTimer // panelTimer
// //
@@ -447,10 +475,10 @@
this.panelTimer.Controls.Add(this.checkTimerCountDown); this.panelTimer.Controls.Add(this.checkTimerCountDown);
this.panelTimer.Controls.Add(this.labelDurationValue); this.panelTimer.Controls.Add(this.labelDurationValue);
this.panelTimer.Controls.Add(this.trackBarDuration); this.panelTimer.Controls.Add(this.trackBarDuration);
this.panelTimer.Location = new System.Drawing.Point(9, 393); this.panelTimer.Location = new System.Drawing.Point(9, 204);
this.panelTimer.Name = "panelTimer"; this.panelTimer.Name = "panelTimer";
this.panelTimer.Size = new System.Drawing.Size(322, 144); this.panelTimer.Size = new System.Drawing.Size(322, 144);
this.panelTimer.TabIndex = 5; this.panelTimer.TabIndex = 3;
// //
// labelDuration // labelDuration
// //
@@ -466,43 +494,49 @@
// //
this.labelTimer.AutoSize = true; this.labelTimer.AutoSize = true;
this.labelTimer.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.labelTimer.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.labelTimer.Location = new System.Drawing.Point(6, 370); this.labelTimer.Location = new System.Drawing.Point(6, 181);
this.labelTimer.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0); this.labelTimer.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0);
this.labelTimer.Name = "labelTimer"; this.labelTimer.Name = "labelTimer";
this.labelTimer.Size = new System.Drawing.Size(48, 20); this.labelTimer.Size = new System.Drawing.Size(48, 20);
this.labelTimer.TabIndex = 4; this.labelTimer.TabIndex = 2;
this.labelTimer.Text = "Timer"; this.labelTimer.Text = "Timer";
// //
// labelMiscellaneous // labelSize
// //
this.labelMiscellaneous.AutoSize = true; this.labelSize.AutoSize = true;
this.labelMiscellaneous.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.labelSize.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.labelMiscellaneous.Location = new System.Drawing.Point(6, 561); this.labelSize.Location = new System.Drawing.Point(6, 584);
this.labelMiscellaneous.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0); this.labelSize.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0);
this.labelMiscellaneous.Name = "labelMiscellaneous"; this.labelSize.Name = "labelSize";
this.labelMiscellaneous.Size = new System.Drawing.Size(109, 20); this.labelSize.Size = new System.Drawing.Size(40, 20);
this.labelMiscellaneous.TabIndex = 6; this.labelSize.TabIndex = 6;
this.labelMiscellaneous.Text = "Miscellaneous"; this.labelSize.Text = "Size";
// //
// panelMiscellaneous // panelMiscellaneous
// //
this.panelMiscellaneous.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.panelMiscellaneous.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panelMiscellaneous.Controls.Add(this.radioSizeCustom);
this.panelMiscellaneous.Controls.Add(this.radioSizeAuto);
this.panelMiscellaneous.Controls.Add(this.labelScrollSpeedValue); this.panelMiscellaneous.Controls.Add(this.labelScrollSpeedValue);
this.panelMiscellaneous.Controls.Add(this.trackBarScrollSpeed); this.panelMiscellaneous.Controls.Add(this.trackBarScrollSpeed);
this.panelMiscellaneous.Controls.Add(this.checkNonIntrusive);
this.panelMiscellaneous.Controls.Add(this.labelScrollSpeed); this.panelMiscellaneous.Controls.Add(this.labelScrollSpeed);
this.panelMiscellaneous.Location = new System.Drawing.Point(9, 584); this.panelMiscellaneous.Location = new System.Drawing.Point(9, 607);
this.panelMiscellaneous.Name = "panelMiscellaneous"; this.panelMiscellaneous.Name = "panelMiscellaneous";
this.panelMiscellaneous.Size = new System.Drawing.Size(322, 90); this.panelMiscellaneous.Size = new System.Drawing.Size(322, 92);
this.panelMiscellaneous.TabIndex = 7; this.panelMiscellaneous.TabIndex = 7;
// //
// durationUpdateTimer
//
this.durationUpdateTimer.Interval = 200;
this.durationUpdateTimer.Tick += new System.EventHandler(this.durationUpdateTimer_Tick);
//
// TabSettingsNotifications // TabSettingsNotifications
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.panelMiscellaneous); this.Controls.Add(this.panelMiscellaneous);
this.Controls.Add(this.labelMiscellaneous); this.Controls.Add(this.labelSize);
this.Controls.Add(this.labelTimer); this.Controls.Add(this.labelTimer);
this.Controls.Add(this.panelLocation); this.Controls.Add(this.panelLocation);
this.Controls.Add(this.labelLocation); this.Controls.Add(this.labelLocation);
@@ -510,7 +544,7 @@
this.Controls.Add(this.labelGeneral); this.Controls.Add(this.labelGeneral);
this.Controls.Add(this.panelTimer); this.Controls.Add(this.panelTimer);
this.Name = "TabSettingsNotifications"; this.Name = "TabSettingsNotifications";
this.Size = new System.Drawing.Size(340, 684); this.Size = new System.Drawing.Size(340, 708);
this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged); this.ParentChanged += new System.EventHandler(this.TabSettingsNotifications_ParentChanged);
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
this.tableLayoutDurationButtons.ResumeLayout(false); this.tableLayoutDurationButtons.ResumeLayout(false);
@@ -563,8 +597,11 @@
private System.Windows.Forms.Label labelScrollSpeedValue; private System.Windows.Forms.Label labelScrollSpeedValue;
private System.Windows.Forms.TrackBar trackBarScrollSpeed; private System.Windows.Forms.TrackBar trackBarScrollSpeed;
private System.Windows.Forms.Label labelScrollSpeed; private System.Windows.Forms.Label labelScrollSpeed;
private System.Windows.Forms.Label labelMiscellaneous; private System.Windows.Forms.Label labelSize;
private System.Windows.Forms.Panel panelMiscellaneous; private System.Windows.Forms.Panel panelMiscellaneous;
private System.Windows.Forms.Label labelDuration; private System.Windows.Forms.Label labelDuration;
private System.Windows.Forms.Timer durationUpdateTimer;
private System.Windows.Forms.RadioButton radioSizeCustom;
private System.Windows.Forms.RadioButton radioSizeAuto;
} }
} }

View File

@@ -14,16 +14,13 @@ namespace TweetDuck.Core.Other.Settings{
InitializeComponent(); InitializeComponent();
this.notification = notification; this.notification = notification;
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
this.notification.Move += (sender, args) => {
if (radioLocCustom.Checked && this.notification.Location != ControlExtensions.InvisibleLocation){
Config.CustomNotificationPosition = this.notification.Location;
}
};
this.notification.Initialized += (sender, args) => { this.notification.Initialized += (sender, args) => {
this.InvokeAsyncSafe(() => this.notification.ShowNotificationForSettings(true)); this.InvokeAsyncSafe(() => {
this.notification.ShowNotificationForSettings(true);
this.notification.Move += notification_Move;
this.notification.ResizeEnd += notification_ResizeEnd;
});
}; };
this.notification.Activated += notification_Activated; this.notification.Activated += notification_Activated;
@@ -39,6 +36,11 @@ namespace TweetDuck.Core.Other.Settings{
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked; comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
switch(Config.NotificationSize){
case TweetNotification.Size.Auto: radioSizeAuto.Checked = true; break;
case TweetNotification.Size.Custom: radioSizeCustom.Checked = true; break;
}
toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue)); toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue));
trackBarDuration.SetValueSafe(Config.NotificationDurationValue); trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c"; labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
@@ -71,6 +73,9 @@ namespace TweetDuck.Core.Other.Settings{
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance); trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px"; labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
this.notification.CanResizeWindow = radioSizeCustom.Checked;
Disposed += (sender, args) => this.notification.Dispose(); Disposed += (sender, args) => this.notification.Dispose();
} }
@@ -81,6 +86,9 @@ namespace TweetDuck.Core.Other.Settings{
radioLocBR.CheckedChanged += radioLoc_CheckedChanged; radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
radioLocCustom.Click += radioLocCustom_Click; radioLocCustom.Click += radioLocCustom_Click;
radioSizeAuto.CheckedChanged += radioSize_CheckedChanged;
radioSizeCustom.Click += radioSizeCustom_Click;
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged; trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
btnDurationShort.Click += btnDurationShort_Click; btnDurationShort.Click += btnDurationShort_Click;
btnDurationMedium.Click += btnDurationMedium_Click; btnDurationMedium.Click += btnDurationMedium_Click;
@@ -113,6 +121,19 @@ namespace TweetDuck.Core.Other.Settings{
notification.Activated -= notification_Activated; notification.Activated -= notification_Activated;
} }
private void notification_Move(object sender, EventArgs e){
if (radioLocCustom.Checked && notification.Location != ControlExtensions.InvisibleLocation){
Config.CustomNotificationPosition = notification.Location;
}
}
private void notification_ResizeEnd(object sender, EventArgs e){
if (radioSizeCustom.Checked){
Config.CustomNotificationSize = notification.BrowserSize;
notification.ShowNotificationForSettings(false);
}
}
private void radioLoc_CheckedChanged(object sender, EventArgs e){ private void radioLoc_CheckedChanged(object sender, EventArgs e){
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft; if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight; else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
@@ -144,11 +165,30 @@ namespace TweetDuck.Core.Other.Settings{
} }
} }
private void radioSize_CheckedChanged(object sender, EventArgs e){
if (radioSizeAuto.Checked)Config.NotificationSize = TweetNotification.Size.Auto;
notification.ShowNotificationForSettings(false);
notification.CanResizeWindow = false; // must be after ShowNotificationForSettings
}
private void radioSizeCustom_Click(object sender, EventArgs e){
if (!Config.IsCustomNotificationSizeSet){
Config.CustomNotificationSize = notification.BrowserSize;
}
Config.NotificationSize = TweetNotification.Size.Custom;
notification.CanResizeWindow = true;
notification.ShowNotificationForSettings(false);
}
private void trackBarDuration_ValueChanged(object sender, EventArgs e){ private void trackBarDuration_ValueChanged(object sender, EventArgs e){
durationUpdateTimer.Stop();
durationUpdateTimer.Start();
Config.NotificationDurationValue = trackBarDuration.Value; Config.NotificationDurationValue = trackBarDuration.Value;
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c"; labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
notification.ShowNotificationForSettings(true);
} }
private void btnDurationShort_Click(object sender, EventArgs e){ private void btnDurationShort_Click(object sender, EventArgs e){
@@ -208,5 +248,10 @@ namespace TweetDuck.Core.Other.Settings{
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value; Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);
} }
private void durationUpdateTimer_Tick(object sender, EventArgs e){
notification.ShowNotificationForSettings(true);
durationUpdateTimer.Stop();
}
} }
} }

View File

@@ -93,6 +93,10 @@ namespace TweetDuck.Core.Utils{
return client; return client;
} }
public static int Scale(int baseValue, double scaleFactor){
return (int)Math.Round(baseValue*scaleFactor);
}
public static void SetZoomLevel(IBrowser browser, int percentage){ public static void SetZoomLevel(IBrowser browser, int percentage){
browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2)); browser.GetHost().SetZoomLevel(Math.Log(percentage/100.0, 1.2));
} }

View File

@@ -3,7 +3,7 @@ using System.Text.RegularExpressions;
namespace TweetDuck.Core.Utils{ namespace TweetDuck.Core.Utils{
static class CommandLineArgsParser{ static class CommandLineArgsParser{
private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled), false); private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:\S*""[^""]*?""\S*|\S*))?)", RegexOptions.Compiled), false);
public static CommandLineArgs ReadCefArguments(string argumentString){ public static CommandLineArgs ReadCefArguments(string argumentString){
CommandLineArgs args = new CommandLineArgs(); CommandLineArgs args = new CommandLineArgs();

View File

@@ -152,7 +152,6 @@
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.labelType.BackColor = System.Drawing.Color.DarkGray; this.labelType.BackColor = System.Drawing.Color.DarkGray;
this.labelType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.labelType.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.labelType.LineHeight = 9;
this.labelType.Location = new System.Drawing.Point(0, 0); this.labelType.Location = new System.Drawing.Point(0, 0);
this.labelType.Name = "labelType"; this.labelType.Name = "labelType";
this.labelType.Size = new System.Drawing.Size(18, 109); this.labelType.Size = new System.Drawing.Size(18, 109);

View File

@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Plugins.Enums; using TweetDuck.Plugins.Enums;
@@ -11,6 +12,8 @@ namespace TweetDuck.Plugins.Controls{
private readonly PluginManager pluginManager; private readonly PluginManager pluginManager;
private readonly Plugin plugin; private readonly Plugin plugin;
private readonly float dpiScale;
public PluginControl(){ public PluginControl(){
InitializeComponent(); InitializeComponent();
} }
@@ -19,12 +22,16 @@ namespace TweetDuck.Plugins.Controls{
this.pluginManager = pluginManager; this.pluginManager = pluginManager;
this.plugin = plugin; this.plugin = plugin;
this.dpiScale = this.GetDPIScale();
this.labelName.Text = plugin.Name; this.labelName.Text = plugin.Name;
this.labelDescription.Text = plugin.CanRun ? plugin.Description : "This plugin requires "+Program.BrandName+" "+plugin.RequiredVersion+" or newer."; this.labelDescription.Text = plugin.CanRun ? plugin.Description : "This plugin requires "+Program.BrandName+" "+plugin.RequiredVersion+" or newer.";
this.labelVersion.Text = plugin.Version; this.labelVersion.Text = plugin.Version;
this.labelAuthor.Text = plugin.Author; this.labelAuthor.Text = plugin.Author;
this.labelWebsite.Text = plugin.Website; this.labelWebsite.Text = plugin.Website;
this.labelType.LineHeight = BrowserUtils.Scale(9, dpiScale);
UpdatePluginState(); UpdatePluginState();
if (labelDescription.Text.Length == 0){ if (labelDescription.Text.Length == 0){
@@ -40,7 +47,7 @@ namespace TweetDuck.Plugins.Controls{
} }
else{ else{
labelDescription.MaximumSize = new Size(panelDescription.Width-SystemInformation.VerticalScrollBarWidth, 0); labelDescription.MaximumSize = new Size(panelDescription.Width-SystemInformation.VerticalScrollBarWidth, 0);
Height = Math.Min(MinimumSize.Height+9+labelDescription.Height, MaximumSize.Height); Height = Math.Min(MinimumSize.Height+BrowserUtils.Scale(9, dpiScale)+labelDescription.Height, MaximumSize.Height);
} }
} }

View File

@@ -20,8 +20,8 @@ namespace TweetDuck{
public const string BrandName = "TweetDuck"; public const string BrandName = "TweetDuck";
public const string Website = "https://tweetduck.chylex.com"; public const string Website = "https://tweetduck.chylex.com";
public const string VersionTag = "1.8"; public const string VersionTag = "1.8.1";
public const string VersionFull = "1.8.0.0"; public const string VersionFull = "1.8.1.0";
public static readonly Version Version = new Version(VersionTag); public static readonly Version Version = new Version(VersionTag);
public static readonly bool IsPortable = File.Exists("makeportable"); public static readonly bool IsPortable = File.Exists("makeportable");
@@ -162,6 +162,7 @@ namespace TweetDuck{
settings.CefCommandLineArgs["disable-plugins-discovery"] = "1"; settings.CefCommandLineArgs["disable-plugins-discovery"] = "1";
settings.CefCommandLineArgs["enable-system-flash"] = "0"; settings.CefCommandLineArgs["enable-system-flash"] = "0";
Cef.EnableHighDPISupport();
Cef.Initialize(settings, false, new BrowserProcessHandler()); Cef.Initialize(settings, false, new BrowserProcessHandler());
Application.ApplicationExit += (sender, args) => ExitCleanup(); Application.ApplicationExit += (sender, args) => ExitCleanup();
@@ -171,12 +172,13 @@ namespace TweetDuck{
plugins.Executed += plugins_Executed; plugins.Executed += plugins_Executed;
plugins.Reload(); plugins.Reload();
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{ UpdaterSettings updaterSettings = new UpdaterSettings{
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates), AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
DismissedUpdate = UserConfig.DismissedUpdate, DismissedUpdate = UserConfig.DismissedUpdate,
InstallerDownloadFolder = InstallerPath InstallerDownloadFolder = InstallerPath
}); };
FormBrowser mainForm = new FormBrowser(plugins, updaterSettings);
Application.Run(mainForm); Application.Run(mainForm);
if (mainForm.UpdateInstallerPath != null){ if (mainForm.UpdateInstallerPath != null){
@@ -240,11 +242,7 @@ namespace TweetDuck{
ReloadConfig(); ReloadConfig();
} }
public static void Restart(){ public static void Restart(params string[] extraArgs){
Restart(new string[0]);
}
public static void Restart(string[] extraArgs){
CommandLineArgs args = Arguments.GetCurrentClean(); CommandLineArgs args = Arguments.GetCurrentClean();
CommandLineArgs.ReadStringArray('-', extraArgs, args); CommandLineArgs.ReadStringArray('-', extraArgs, args);
RestartWithArgs(args); RestartWithArgs(args);

View File

@@ -46,7 +46,7 @@ namespace TweetDuck{
public void HandleException(string caption, string message, bool canIgnore, Exception e){ public void HandleException(string caption, string message, bool canIgnore, Exception e){
bool loggedSuccessfully = Log(e.ToString()); bool loggedSuccessfully = Log(e.ToString());
FormMessage form = new FormMessage(caption, message+"\r\nError: "+e.Message, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error); FormMessage form = new FormMessage(caption, message+Environment.NewLine+"Error: "+e.Message, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);
Button btnExit = form.AddButton("Exit"); Button btnExit = form.AddButton("Exit");
Button btnIgnore = form.AddButton("Ignore", DialogResult.Ignore); Button btnIgnore = form.AddButton("Ignore", DialogResult.Ignore);
@@ -59,9 +59,9 @@ namespace TweetDuck{
Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Anchor = AnchorStyles.Bottom | AnchorStyles.Left,
Enabled = loggedSuccessfully, Enabled = loggedSuccessfully,
Font = SystemFonts.MessageBoxFont, Font = SystemFonts.MessageBoxFont,
Location = new Point(6, 12), Location = new Point(9, 12),
Margin = new Padding(0, 0, 48, 0), Margin = new Padding(0, 0, 48, 0),
Size = new Size(88, 26), Size = new Size(106, 26),
Text = "Show Error Log", Text = "Show Error Log",
UseVisualStyleBackColor = true UseVisualStyleBackColor = true
}; };

View File

@@ -496,11 +496,16 @@
return $(selector, parent).click().length; return $(selector, parent).click().length;
}; };
var tryCloseModal = function(){ var tryCloseModal1 = function(){
var modal = $("#open-modal"); var modal = $("#open-modal");
return modal.is(":visible") && tryClickSelector("a[rel=dismiss]", modal); return modal.is(":visible") && tryClickSelector("a[rel=dismiss]", modal);
}; };
var tryCloseModal2 = function(){
var modal = $(".js-modals-container");
return modal.length && tryClickSelector("a.mdl-dismiss", modal);
};
var tryCloseHighlightedColumn = function(){ var tryCloseHighlightedColumn = function(){
if (highlightedColumnEle){ if (highlightedColumnEle){
var column = highlightedColumnEle.closest(".js-column"); var column = highlightedColumnEle.closest(".js-column");
@@ -510,7 +515,8 @@
window.TDGF_onMouseClickExtra = function(button){ window.TDGF_onMouseClickExtra = function(button){
if (button === 1){ // back button if (button === 1){ // back button
tryCloseModal() || tryCloseModal1() ||
tryCloseModal2() ||
tryClickSelector(".js-inline-compose-close") || tryClickSelector(".js-inline-compose-close") ||
tryCloseHighlightedColumn() || tryCloseHighlightedColumn() ||
tryClickSelector(".js-app-content.is-open .js-drawer-close:visible") || tryClickSelector(".js-app-content.is-open .js-drawer-close:visible") ||

View File

@@ -33,8 +33,6 @@
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.AutoSize = true;
this.btnCancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnCancel.Location = new System.Drawing.Point(195, 34); this.btnCancel.Location = new System.Drawing.Point(195, 34);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);

View File

@@ -2,7 +2,6 @@
using CefSharp.WinForms; using CefSharp.WinForms;
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Resources; using TweetDuck.Resources;
@@ -13,7 +12,6 @@ namespace TweetDuck.Updates{
private static bool IsSystemSupported => true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7 private static bool IsSystemSupported => true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
private readonly ChromiumWebBrowser browser; private readonly ChromiumWebBrowser browser;
private readonly FormBrowser form;
private readonly UpdaterSettings settings; private readonly UpdaterSettings settings;
public event EventHandler<UpdateAcceptedEventArgs> UpdateAccepted; public event EventHandler<UpdateAcceptedEventArgs> UpdateAccepted;
@@ -23,9 +21,8 @@ namespace TweetDuck.Updates{
private int lastEventId; private int lastEventId;
private UpdateInfo lastUpdateInfo; private UpdateInfo lastUpdateInfo;
public UpdateHandler(ChromiumWebBrowser browser, FormBrowser form, UpdaterSettings settings){ public UpdateHandler(ChromiumWebBrowser browser, UpdaterSettings settings){
this.browser = browser; this.browser = browser;
this.form = form;
this.settings = settings; this.settings = settings;
browser.FrameLoadEnd += browser_FrameLoadEnd; browser.FrameLoadEnd += browser_FrameLoadEnd;
@@ -92,27 +89,20 @@ namespace TweetDuck.Updates{
} }
public void DismissUpdate(string tag){ public void DismissUpdate(string tag){
settings.DismissedUpdate = tag; TriggerUpdateDismissedEvent(new UpdateDismissedEventArgs(tag));
UpdateDismissed?.Invoke(this, new UpdateDismissedEventArgs(tag));
} }
private void TriggerUpdateAcceptedEvent(UpdateAcceptedEventArgs args){ private void TriggerUpdateAcceptedEvent(UpdateAcceptedEventArgs args){
if (UpdateAccepted != null){ UpdateAccepted?.Invoke(this, args);
form.InvokeAsyncSafe(() => UpdateAccepted(this, args));
}
} }
private void TriggerUpdateDismissedEvent(UpdateDismissedEventArgs args){ private void TriggerUpdateDismissedEvent(UpdateDismissedEventArgs args){
form.InvokeAsyncSafe(() => { settings.DismissedUpdate = args.VersionTag;
settings.DismissedUpdate = args.VersionTag; UpdateDismissed?.Invoke(this, args);
UpdateDismissed?.Invoke(this, args);
});
} }
private void TriggerCheckFinishedEvent(UpdateCheckEventArgs args){ private void TriggerCheckFinishedEvent(UpdateCheckEventArgs args){
if (CheckFinished != null){ CheckFinished?.Invoke(this, args);
form.InvokeAsyncSafe(() => CheckFinished(this, args));
}
} }
public class Bridge{ public class Bridge{

View File

@@ -12,7 +12,7 @@ namespace UnitTests.Core.Utils{
[TestMethod] [TestMethod]
public void TestValidString(){ public void TestValidString(){
CommandLineArgs args = CommandLineArgsParser.ReadCefArguments("--aaa --bbb --first-value=123 --SECOND-VALUE=\"a b c d e\" --ccc"); CommandLineArgs args = CommandLineArgsParser.ReadCefArguments("--aaa --bbb --first-value=123 --SECOND-VALUE=\"a b c d e\"\r\n--ccc");
// cef has no flags, flag arguments have a value of 1 // cef has no flags, flag arguments have a value of 1
// the processing removes all dashes in front of each key // the processing removes all dashes in front of each key