1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-06 14:34:05 +02:00

Add notification display selection

This commit is contained in:
chylex 2016-04-11 16:25:43 +02:00
parent 6773d69e07
commit 797b7e8ead
4 changed files with 47 additions and 2 deletions

View File

@ -22,6 +22,7 @@ sealed class UserConfig{
public TweetNotification.Position NotificationPosition { get; set; }
public Point CustomNotificationPosition { get; set; }
public int NotificationEdgeDistance { get; set; }
public int NotificationDisplay { get; set; }
public bool IsCustomWindowLocationSet{
get{

View File

@ -72,6 +72,10 @@ private void MoveToVisibleLocation(){
UserConfig config = Program.UserConfig;
Screen screen = Screen.FromControl(owner);
if (config.NotificationDisplay > 0 && config.NotificationDisplay <= Screen.AllScreens.Length){
screen = Screen.AllScreens[config.NotificationDisplay-1];
}
int edgeDist = config.NotificationEdgeDistance;
switch(config.NotificationPosition){

View File

@ -24,6 +24,8 @@ protected override void Dispose(bool disposing) {
/// </summary>
private void InitializeComponent() {
this.groupNotificationLocation = new System.Windows.Forms.GroupBox();
this.labelDisplay = new System.Windows.Forms.Label();
this.comboBoxDisplay = new System.Windows.Forms.ComboBox();
this.labelEdgeDistance = new System.Windows.Forms.Label();
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
this.radioLocCustom = new System.Windows.Forms.RadioButton();
@ -59,6 +61,29 @@ private void InitializeComponent() {
this.groupNotificationLocation.TabStop = false;
this.groupNotificationLocation.Text = "Notification Location";
//
// labelDisplay
//
this.labelDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelDisplay.AutoSize = true;
this.labelDisplay.Location = new System.Drawing.Point(6, 154);
this.labelDisplay.Name = "labelDisplay";
this.labelDisplay.Size = new System.Drawing.Size(41, 13);
this.labelDisplay.TabIndex = 8;
this.labelDisplay.Text = "Display";
//
// comboBoxDisplay
//
this.comboBoxDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxDisplay.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDisplay.FormattingEnabled = true;
this.comboBoxDisplay.Location = new System.Drawing.Point(9, 170);
this.comboBoxDisplay.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
this.comboBoxDisplay.Name = "comboBoxDisplay";
this.comboBoxDisplay.Size = new System.Drawing.Size(168, 21);
this.comboBoxDisplay.TabIndex = 7;
this.comboBoxDisplay.SelectedValueChanged += new System.EventHandler(this.comboBoxDisplay_SelectedValueChanged);
//
// labelEdgeDistance
//
this.labelEdgeDistance.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@ -214,7 +239,7 @@ private void InitializeComponent() {
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(328, 242);
this.ClientSize = new System.Drawing.Size(384, 282);
this.Controls.Add(this.groupNotificationDuration);
this.Controls.Add(this.groupNotificationLocation);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@ -248,5 +273,7 @@ private void InitializeComponent() {
private System.Windows.Forms.RadioButton radioDurLong;
private System.Windows.Forms.RadioButton radioDurMedium;
private System.Windows.Forms.RadioButton radioDurShort;
private System.Windows.Forms.Label labelDisplay;
private System.Windows.Forms.ComboBox comboBoxDisplay;
}
}

View File

@ -40,6 +40,14 @@ public FormSettings(FormBrowser browserForm){
case TweetNotification.Duration.VeryLong: radioDurVeryLong.Checked = true; break;
}
comboBoxDisplay.Items.Add("(Same As TweetDick)");
foreach(Screen screen in Screen.AllScreens){
comboBoxDisplay.Items.Add(screen.DeviceName+" ("+screen.Bounds.Width+"x"+screen.Bounds.Height+")");
}
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1,Config.NotificationDisplay);
trackBarEdgeDistance.Value = Config.NotificationEdgeDistance;
notification.HideNotification();
}
@ -61,7 +69,12 @@ private void radioLoc_CheckedChanged(object sender, EventArgs e){
Config.NotificationPosition = TweetNotification.Position.Custom;
}
trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked;
notification.ShowNotificationForSettings(false);
}
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
notification.ShowNotificationForSettings(false);
}