Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for vertical multiple display setup. #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Carnac.Logic/Models/PopupSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ protected void OnLeftChanged(EventArgs e)
if (handler != null) handler(this, e);
}

double top;
public double Top
{
get { return top; }
set
{
top = value;
OnTopChanged(EventArgs.Empty);
}
}

public event EventHandler TopChanged;

protected void OnTopChanged(EventArgs e)
{
var handler = TopChanged;
if (handler != null) handler(this, e);
}

[NotifyProperty(AlsoNotifyFor = new[] { "Margins" })]
public int TopOffset { get; set; }

Expand Down
1 change: 0 additions & 1 deletion src/Carnac.Logic/ScreenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public IEnumerable<DetailedScreen> GetScreens()
{
s.RelativeWidth = 200 * (s.Width / maxWidth);
s.RelativeHeight = s.RelativeWidth * (s.Height / s.Width);
s.Top *= (s.RelativeHeight / s.Height);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this line

}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Carnac/CarnacTrayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Carnac
{
public class CarnacTrayIcon : IDisposable
public sealed class CarnacTrayIcon : IDisposable
{
readonly NotifyIcon trayIcon;

Expand Down
10 changes: 10 additions & 0 deletions src/Carnac/UI/KeyShowView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ protected override void OnSourceInitialized(EventArgs e)
var vm = ((KeyShowViewModel)DataContext);
Left = vm.Settings.Left;
vm.Settings.LeftChanged += SettingsLeftChanged;
Top = vm.Settings.Top;
vm.Settings.TopChanged += SettingsTopChanged;
WindowState = WindowState.Maximized;
}

Expand Down Expand Up @@ -92,5 +94,13 @@ void SettingsLeftChanged(object sender, EventArgs e)
Left = vm.Settings.Left;
WindowState = WindowState.Maximized;
}

void SettingsTopChanged(object sender, EventArgs e)
{
WindowState = WindowState.Normal;
var vm = ((KeyShowViewModel)DataContext);
Top = vm.Settings.Top;
WindowState = WindowState.Maximized;
}
}
}
1 change: 1 addition & 0 deletions src/Carnac/UI/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ void PlaceScreen()
}

Settings.Left = SelectedScreen.Left;
Settings.Top = SelectedScreen.Top;
}
}
}