mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-08 11:34:05 +02:00
Add an option for custom notification window size
This commit is contained in:
parent
7f5b99495c
commit
27e2372097
@ -19,7 +19,7 @@ public override Type BindToType(string assemblyName, string typeName){
|
||||
}
|
||||
}
|
||||
|
||||
private const int CurrentFileVersion = 10;
|
||||
private const int CurrentFileVersion = 11;
|
||||
|
||||
// START OF CONFIGURATION
|
||||
|
||||
@ -41,6 +41,9 @@ public override Type BindToType(string assemblyName, string typeName){
|
||||
public int NotificationEdgeDistance { get; set; }
|
||||
public int NotificationDisplay { get; set; }
|
||||
|
||||
public TweetNotification.Size NotificationSize { get; set; }
|
||||
public Size CustomNotificationSize { get; set; }
|
||||
|
||||
public bool EnableSpellCheck { get; set; }
|
||||
public bool ExpandLinksOnHover { get; set; }
|
||||
public bool SwitchAccountSelectors { get; set; }
|
||||
@ -54,6 +57,7 @@ public override Type BindToType(string assemblyName, string typeName){
|
||||
public string CustomNotificationCSS { get; set; }
|
||||
|
||||
public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
||||
public bool IsCustomNotificationSizeSet => CustomNotificationSize != Size.Empty;
|
||||
|
||||
public string NotificationSoundPath{
|
||||
get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
||||
@ -124,6 +128,7 @@ private UserConfig(string file){
|
||||
NotificationNonIntrusiveMode = true;
|
||||
NotificationPosition = TweetNotification.Position.TopRight;
|
||||
CustomNotificationPosition = ControlExtensions.InvisibleLocation;
|
||||
NotificationSize = TweetNotification.Size.Auto;
|
||||
NotificationEdgeDistance = 8;
|
||||
NotificationDurationValue = 25;
|
||||
NotificationScrollSpeed = 100;
|
||||
@ -191,6 +196,11 @@ private void UpgradeFile(){
|
||||
++fileVersion;
|
||||
}
|
||||
|
||||
if (fileVersion == 10){
|
||||
NotificationSize = TweetNotification.Size.Auto;
|
||||
++fileVersion;
|
||||
}
|
||||
|
||||
// update the version
|
||||
fileVersion = CurrentFileVersion;
|
||||
Save();
|
||||
|
@ -416,8 +416,10 @@ public void OpenSettings(Type startTab){
|
||||
if (!Config.EnableTrayHighlight){
|
||||
trayIcon.HasNotifications = false;
|
||||
}
|
||||
|
||||
|
||||
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound);
|
||||
|
||||
notification.RequiresResize = true;
|
||||
form.Dispose();
|
||||
};
|
||||
|
||||
|
@ -57,12 +57,14 @@ protected Point PrimaryLocation{
|
||||
|
||||
set{
|
||||
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||
|
||||
if (WindowsUtils.ShouldAvoidToolWindow){
|
||||
FormBorderStyle = Visible ? FormBorderStyle.FixedSingle : FormBorderStyle.FixedToolWindow; // workaround for alt+tab
|
||||
}
|
||||
FormBorderStyle = GetBorderStyle(CanResizeWindow);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -212,5 +214,14 @@ public void DisplayTooltip(string text){
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ private void InitializeComponent() {
|
||||
this.progressBarTimer.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.progressBarTimer.Maximum = 1000;
|
||||
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;
|
||||
//
|
||||
// FormNotification
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace TweetDuck.Core.Notification{
|
||||
partial class FormNotificationMain : FormNotificationBase{
|
||||
private const string NotificationScriptFile = "notification.js";
|
||||
private const int TimerBarHeight = 4;
|
||||
|
||||
private static readonly string NotificationScriptIdentifier = ScriptLoader.GetRootIdentifier(NotificationScriptFile);
|
||||
private static readonly string PluginScriptIdentifier = ScriptLoader.GetRootIdentifier(PluginManager.PluginNotificationScriptFile);
|
||||
@ -35,9 +36,9 @@ static FormNotificationMain(){
|
||||
private bool? prevDisplayTimer;
|
||||
private int? prevFontSize;
|
||||
|
||||
private bool RequiresResize{
|
||||
public bool RequiresResize{
|
||||
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{
|
||||
@ -54,20 +55,32 @@ private bool RequiresResize{
|
||||
|
||||
private int BaseClientWidth{
|
||||
get{
|
||||
int level = TweetNotification.FontSizeLevel;
|
||||
int width = level == 0 ? 284 : BrowserUtils.Scale(284, 1.0+0.05*level);
|
||||
return BrowserUtils.Scale(width, SizeScale);
|
||||
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{
|
||||
int level = TweetNotification.FontSizeLevel;
|
||||
int height = level == 0 ? 118 : BrowserUtils.Scale(118, 1.0+0.075*level);
|
||||
return BrowserUtils.Scale(height, SizeScale);
|
||||
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){
|
||||
InitializeComponent();
|
||||
|
||||
@ -253,7 +266,7 @@ protected override void LoadTweet(TweetNotification tweet){
|
||||
|
||||
protected override void SetNotificationSize(int width, int height){
|
||||
if (Program.UserConfig.DisplayNotificationTimer){
|
||||
ClientSize = new Size(width, height+4);
|
||||
ClientSize = new Size(width, height+TimerBarHeight);
|
||||
progressBarTimer.Visible = true;
|
||||
}
|
||||
else{
|
||||
|
@ -51,6 +51,10 @@ public enum Position{
|
||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||
}
|
||||
|
||||
public enum Size{
|
||||
Auto, Custom
|
||||
}
|
||||
|
||||
public string Column { get; }
|
||||
public string TweetUrl { get; }
|
||||
public string QuoteUrl { get; }
|
||||
|
108
Core/Other/Settings/TabSettingsNotifications.Designer.cs
generated
108
Core/Other/Settings/TabSettingsNotifications.Designer.cs
generated
@ -48,6 +48,8 @@ private void InitializeComponent() {
|
||||
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
||||
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
||||
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.panelGeneral = new System.Windows.Forms.Panel();
|
||||
this.labelScrollSpeedValue = new System.Windows.Forms.Label();
|
||||
@ -58,7 +60,7 @@ private void InitializeComponent() {
|
||||
this.panelTimer = new System.Windows.Forms.Panel();
|
||||
this.labelDuration = 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.durationUpdateTimer = new System.Windows.Forms.Timer(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
||||
@ -122,7 +124,7 @@ private void InitializeComponent() {
|
||||
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.toolTip.SetToolTip(this.radioLocCustom, "Drag the example notification window to the desired location.");
|
||||
this.radioLocCustom.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// radioLocBR
|
||||
@ -296,32 +298,32 @@ private void InitializeComponent() {
|
||||
// labelIdlePause
|
||||
//
|
||||
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.Name = "labelIdlePause";
|
||||
this.labelIdlePause.Size = new System.Drawing.Size(89, 13);
|
||||
this.labelIdlePause.TabIndex = 2;
|
||||
this.labelIdlePause.TabIndex = 3;
|
||||
this.labelIdlePause.Text = "Pause When Idle";
|
||||
//
|
||||
// comboBoxIdlePause
|
||||
//
|
||||
this.comboBoxIdlePause.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
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.Name = "comboBoxIdlePause";
|
||||
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.");
|
||||
//
|
||||
// checkNonIntrusive
|
||||
//
|
||||
this.checkNonIntrusive.AutoSize = true;
|
||||
this.checkNonIntrusive.Location = new System.Drawing.Point(6, 5);
|
||||
this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 5, 3, 3);
|
||||
this.checkNonIntrusive.Location = new System.Drawing.Point(6, 51);
|
||||
this.checkNonIntrusive.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||
this.checkNonIntrusive.Name = "checkNonIntrusive";
|
||||
this.checkNonIntrusive.Size = new System.Drawing.Size(128, 17);
|
||||
this.checkNonIntrusive.TabIndex = 0;
|
||||
this.checkNonIntrusive.TabIndex = 2;
|
||||
this.checkNonIntrusive.Text = "Non-Intrusive Popups";
|
||||
this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " +
|
||||
"delayed until the cursor moves away to prevent accidental clicks.");
|
||||
@ -350,6 +352,30 @@ private void InitializeComponent() {
|
||||
this.checkNotificationTimer.Text = "Display Notification Timer";
|
||||
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
|
||||
//
|
||||
this.labelGeneral.AutoSize = true;
|
||||
@ -367,20 +393,21 @@ private void InitializeComponent() {
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelGeneral.Controls.Add(this.checkColumnName);
|
||||
this.panelGeneral.Controls.Add(this.checkSkipOnLinkClick);
|
||||
this.panelGeneral.Controls.Add(this.checkNonIntrusive);
|
||||
this.panelGeneral.Controls.Add(this.labelIdlePause);
|
||||
this.panelGeneral.Controls.Add(this.comboBoxIdlePause);
|
||||
this.panelGeneral.Location = new System.Drawing.Point(9, 31);
|
||||
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;
|
||||
//
|
||||
// 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.Name = "labelScrollSpeedValue";
|
||||
this.labelScrollSpeedValue.Size = new System.Drawing.Size(34, 13);
|
||||
this.labelScrollSpeedValue.TabIndex = 3;
|
||||
this.labelScrollSpeedValue.TabIndex = 4;
|
||||
this.labelScrollSpeedValue.Text = "100%";
|
||||
this.labelScrollSpeedValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
@ -388,35 +415,35 @@ private void InitializeComponent() {
|
||||
//
|
||||
this.trackBarScrollSpeed.AutoSize = false;
|
||||
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.Minimum = 25;
|
||||
this.trackBarScrollSpeed.Name = "trackBarScrollSpeed";
|
||||
this.trackBarScrollSpeed.Size = new System.Drawing.Size(148, 30);
|
||||
this.trackBarScrollSpeed.SmallChange = 5;
|
||||
this.trackBarScrollSpeed.TabIndex = 2;
|
||||
this.trackBarScrollSpeed.TabIndex = 3;
|
||||
this.trackBarScrollSpeed.TickFrequency = 25;
|
||||
this.trackBarScrollSpeed.Value = 100;
|
||||
//
|
||||
// labelScrollSpeed
|
||||
//
|
||||
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.Name = "labelScrollSpeed";
|
||||
this.labelScrollSpeed.Size = new System.Drawing.Size(67, 13);
|
||||
this.labelScrollSpeed.TabIndex = 1;
|
||||
this.labelScrollSpeed.TabIndex = 2;
|
||||
this.labelScrollSpeed.Text = "Scroll Speed";
|
||||
//
|
||||
// labelLocation
|
||||
//
|
||||
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.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.Name = "labelLocation";
|
||||
this.labelLocation.Size = new System.Drawing.Size(70, 20);
|
||||
this.labelLocation.TabIndex = 2;
|
||||
this.labelLocation.TabIndex = 4;
|
||||
this.labelLocation.Text = "Location";
|
||||
//
|
||||
// panelLocation
|
||||
@ -433,10 +460,10 @@ private void InitializeComponent() {
|
||||
this.panelLocation.Controls.Add(this.radioLocBL);
|
||||
this.panelLocation.Controls.Add(this.radioLocCustom);
|
||||
this.panelLocation.Controls.Add(this.radioLocBR);
|
||||
this.panelLocation.Location = new System.Drawing.Point(9, 181);
|
||||
this.panelLocation.Location = new System.Drawing.Point(9, 395);
|
||||
this.panelLocation.Name = "panelLocation";
|
||||
this.panelLocation.Size = new System.Drawing.Size(322, 165);
|
||||
this.panelLocation.TabIndex = 3;
|
||||
this.panelLocation.TabIndex = 5;
|
||||
//
|
||||
// panelTimer
|
||||
//
|
||||
@ -448,10 +475,10 @@ private void InitializeComponent() {
|
||||
this.panelTimer.Controls.Add(this.checkTimerCountDown);
|
||||
this.panelTimer.Controls.Add(this.labelDurationValue);
|
||||
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.Size = new System.Drawing.Size(322, 144);
|
||||
this.panelTimer.TabIndex = 5;
|
||||
this.panelTimer.TabIndex = 3;
|
||||
//
|
||||
// labelDuration
|
||||
//
|
||||
@ -467,35 +494,36 @@ private void InitializeComponent() {
|
||||
//
|
||||
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.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.Name = "labelTimer";
|
||||
this.labelTimer.Size = new System.Drawing.Size(48, 20);
|
||||
this.labelTimer.TabIndex = 4;
|
||||
this.labelTimer.TabIndex = 2;
|
||||
this.labelTimer.Text = "Timer";
|
||||
//
|
||||
// labelMiscellaneous
|
||||
// labelSize
|
||||
//
|
||||
this.labelMiscellaneous.AutoSize = true;
|
||||
this.labelMiscellaneous.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.labelMiscellaneous.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0);
|
||||
this.labelMiscellaneous.Name = "labelMiscellaneous";
|
||||
this.labelMiscellaneous.Size = new System.Drawing.Size(109, 20);
|
||||
this.labelMiscellaneous.TabIndex = 6;
|
||||
this.labelMiscellaneous.Text = "Miscellaneous";
|
||||
this.labelSize.AutoSize = true;
|
||||
this.labelSize.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.labelSize.Location = new System.Drawing.Point(6, 584);
|
||||
this.labelSize.Margin = new System.Windows.Forms.Padding(0, 21, 0, 0);
|
||||
this.labelSize.Name = "labelSize";
|
||||
this.labelSize.Size = new System.Drawing.Size(40, 20);
|
||||
this.labelSize.TabIndex = 6;
|
||||
this.labelSize.Text = "Size";
|
||||
//
|
||||
// panelMiscellaneous
|
||||
//
|
||||
this.panelMiscellaneous.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| 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.trackBarScrollSpeed);
|
||||
this.panelMiscellaneous.Controls.Add(this.checkNonIntrusive);
|
||||
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.Size = new System.Drawing.Size(322, 90);
|
||||
this.panelMiscellaneous.Size = new System.Drawing.Size(322, 92);
|
||||
this.panelMiscellaneous.TabIndex = 7;
|
||||
//
|
||||
// durationUpdateTimer
|
||||
@ -508,7 +536,7 @@ private void InitializeComponent() {
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panelMiscellaneous);
|
||||
this.Controls.Add(this.labelMiscellaneous);
|
||||
this.Controls.Add(this.labelSize);
|
||||
this.Controls.Add(this.labelTimer);
|
||||
this.Controls.Add(this.panelLocation);
|
||||
this.Controls.Add(this.labelLocation);
|
||||
@ -516,7 +544,7 @@ private void InitializeComponent() {
|
||||
this.Controls.Add(this.labelGeneral);
|
||||
this.Controls.Add(this.panelTimer);
|
||||
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);
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).EndInit();
|
||||
this.tableLayoutDurationButtons.ResumeLayout(false);
|
||||
@ -569,9 +597,11 @@ private void InitializeComponent() {
|
||||
private System.Windows.Forms.Label labelScrollSpeedValue;
|
||||
private System.Windows.Forms.TrackBar trackBarScrollSpeed;
|
||||
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.Label labelDuration;
|
||||
private System.Windows.Forms.Timer durationUpdateTimer;
|
||||
private System.Windows.Forms.RadioButton radioSizeCustom;
|
||||
private System.Windows.Forms.RadioButton radioSizeAuto;
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ public TabSettingsNotifications(FormNotificationMain notification){
|
||||
InitializeComponent();
|
||||
|
||||
this.notification = notification;
|
||||
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
|
||||
|
||||
this.notification.Initialized += (sender, args) => {
|
||||
this.InvokeAsyncSafe(() => {
|
||||
this.notification.ShowNotificationForSettings(true);
|
||||
this.notification.Move += notification_Move;
|
||||
this.notification.ResizeEnd += notification_ResizeEnd;
|
||||
});
|
||||
};
|
||||
|
||||
@ -35,6 +35,11 @@ public TabSettingsNotifications(FormNotificationMain notification){
|
||||
}
|
||||
|
||||
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));
|
||||
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
|
||||
@ -67,6 +72,9 @@ public TabSettingsNotifications(FormNotificationMain notification){
|
||||
|
||||
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
|
||||
|
||||
this.notification.CanMoveWindow = () => radioLocCustom.Checked;
|
||||
this.notification.CanResizeWindow = radioSizeCustom.Checked;
|
||||
|
||||
Disposed += (sender, args) => this.notification.Dispose();
|
||||
}
|
||||
@ -78,6 +86,9 @@ public override void OnReady(){
|
||||
radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
|
||||
radioLocCustom.Click += radioLocCustom_Click;
|
||||
|
||||
radioSizeAuto.CheckedChanged += radioSize_CheckedChanged;
|
||||
radioSizeCustom.Click += radioSizeCustom_Click;
|
||||
|
||||
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
|
||||
btnDurationShort.Click += btnDurationShort_Click;
|
||||
btnDurationMedium.Click += btnDurationMedium_Click;
|
||||
@ -116,6 +127,13 @@ private void notification_Move(object sender, EventArgs e){
|
||||
}
|
||||
}
|
||||
|
||||
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){
|
||||
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
|
||||
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
|
||||
@ -147,6 +165,24 @@ private void radioLocCustom_Click(object sender, EventArgs e){
|
||||
}
|
||||
}
|
||||
|
||||
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){
|
||||
durationUpdateTimer.Stop();
|
||||
durationUpdateTimer.Start();
|
||||
|
Loading…
Reference in New Issue
Block a user