Skip to content
Merged
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
2 changes: 2 additions & 0 deletions vibrance.GUI/AMD/AmdDynamicVibranceProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public VibranceInfo GetVibranceInfo()
return _vibranceInfo;
}

public GraphicsAdapter GraphicsAdapter { get; } = GraphicsAdapter.Amd;

[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();

Expand Down
21 changes: 14 additions & 7 deletions vibrance.GUI/AMD/AmdVibranceGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
using vibrance.GUI.AMD.vendor;
using vibrance.GUI.AMD.vendor.utils;
using vibrance.GUI.common;
using vibrance.GUI.NVIDIA;
using Application = System.Windows.Forms.Application;
using MessageBox = System.Windows.Forms.MessageBox;

namespace vibrance.GUI.AMD
{
public partial class AmdVibranceGui : Form
{
private readonly int _defaultWindowsLevel;
private readonly Func<int, string> _resolveLabelLevel;
private readonly IVibranceProxy _v;
private IRegistryController _registryController;
public bool Silenced = false;
private const string AppName = "vibranceGUI";
private const string TwitterLink = "https://twitter.com/juvlarN";
private const string PaypalDonationLink = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JDQFNKNNEW356";
Expand All @@ -32,8 +34,13 @@ public partial class AmdVibranceGui : Form
private readonly List<ResolutionModeWrapper> _supportedResolutionList;
private readonly ResolutionModeWrapper _windowsResolutionSettings;

public AmdVibranceGui(IAmdAdapter amdAdapter)
public AmdVibranceGui(
Func<List<ApplicationSetting>, ResolutionModeWrapper, IVibranceProxy> getProxy,
int defaultWindowsLevel,
Func<int, string> resolveLabelLevel)
{
_defaultWindowsLevel = defaultWindowsLevel;
_resolveLabelLevel = resolveLabelLevel;
_allowVisible = true;
InitializeComponent();

Expand All @@ -50,7 +57,7 @@ public AmdVibranceGui(IAmdAdapter amdAdapter)
}

_applicationSettings = new List<ApplicationSetting>();
_v = new AmdDynamicVibranceProxy(amdAdapter, _applicationSettings, _windowsResolutionSettings);
_v = getProxy(_applicationSettings, _windowsResolutionSettings);

backgroundWorker.WorkerReportsProgress = true;
settingsBackgroundWorker.WorkerReportsProgress = true;
Expand Down Expand Up @@ -94,7 +101,7 @@ private void Form1_Resize(object sender, EventArgs e)

private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
int vibranceWindowsLevel = 100;
int vibranceWindowsLevel = _defaultWindowsLevel;
bool affectPrimaryMonitorOnly = false;

while (!this.IsHandleCreated)
Expand Down Expand Up @@ -148,7 +155,7 @@ private void exitToolStripMenuItem_Click(object sender, EventArgs e)
private void trackBarWindowsLevel_Scroll(object sender, EventArgs e)
{
_v.SetVibranceWindowsLevel(trackBarWindowsLevel.Value);
labelWindowsLevel.Text = trackBarWindowsLevel.Value.ToString();
labelWindowsLevel.Text = _resolveLabelLevel(trackBarWindowsLevel.Value);
if (!settingsBackgroundWorker.IsBusy)
{
settingsBackgroundWorker.RunWorkerAsync();
Expand Down Expand Up @@ -323,7 +330,7 @@ private void ReadVibranceSettings(out int vibranceWindowsLevel, out bool affectP
this.checkBoxAutostart.Checked = _registryController.IsProgramRegistered(AppName);

SettingsController settingsController = new SettingsController();
settingsController.ReadVibranceSettings(GraphicsAdapter.Amd, out vibranceWindowsLevel, out affectPrimaryMonitorOnly, out _applicationSettings);
settingsController.ReadVibranceSettings(_v.GraphicsAdapter, out vibranceWindowsLevel, out affectPrimaryMonitorOnly, out _applicationSettings);

if (this.IsHandleCreated)
{
Expand Down Expand Up @@ -426,7 +433,7 @@ private void listApplications_DoubleClick(object sender, EventArgs e)
if (selectedItem != null)
{
ApplicationSetting actualSetting = _applicationSettings.FirstOrDefault(x => x.FileName == selectedItem.Tag.ToString());
VibranceSettings settingsWindow = new VibranceSettings(_v, selectedItem, actualSetting, _supportedResolutionList);
VibranceSettings settingsWindow = new VibranceSettings(_v, 0, 300, selectedItem, actualSetting, _supportedResolutionList, x => x.ToString());
DialogResult result = settingsWindow.ShowDialog();
if (result == DialogResult.OK)
{
Expand Down
187 changes: 0 additions & 187 deletions vibrance.GUI/AMD/VibranceSettings.Designer.cs

This file was deleted.

57 changes: 0 additions & 57 deletions vibrance.GUI/AMD/VibranceSettings.cs

This file was deleted.

3 changes: 2 additions & 1 deletion vibrance.GUI/NVIDIA/NvidiaDynamicVibranceProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ public void SetSleepInterval(int interval)

public void HandleDvc()
{
//throw new NotImplementedException();
}

public void SetAffectPrimaryMonitorOnly(bool affectPrimaryMonitorOnly)
Expand All @@ -344,6 +343,8 @@ public VibranceInfo GetVibranceInfo()
return _vibranceInfo;
}

public GraphicsAdapter GraphicsAdapter { get; } = GraphicsAdapter.Nvidia;

public bool UnloadLibraryEx()
{
_hook.RemoveWinEventHook();
Expand Down
Loading