1111using System . Threading ;
1212using System . Threading . Tasks ;
1313using System . Windows . Forms ;
14+ using Colore . Effects . Keyboard ;
1415
1516namespace Ambilight . GUI
1617{
@@ -23,14 +24,15 @@ public class TraySettings
2324 public float Saturation { get ; private set ; }
2425 public int KeyboardWidth { get ; private set ; }
2526 public int KeyboardHeight { get ; private set ; }
26- public bool KeyboardEnabledBool { get ; private set ; }
27- public bool MouseEnabledBool { get ; private set ; }
28- public bool LinkEnabledBool { get ; private set ; }
29- public bool PadEnabledBool { get ; private set ; }
30- public bool AmbiModeBool { get ; private set ; }
31- public bool UltrawideModeBool { get ; private set ; }
32- public bool AutostartEnabledBool { get ; private set ; }
33- public int Monitor { get ; set ; }
27+ public bool KeyboardEnabled { get ; private set ; }
28+ public bool MouseEnabled { get ; private set ; }
29+ public bool LinkEnabled { get ; private set ; }
30+ public bool PadEnabled { get ; private set ; }
31+ public bool HeadsetEnabled { get ; private set ; }
32+ public bool AmbiModeEnabled { get ; private set ; }
33+ public bool UltrawideModeEnabled { get ; private set ; }
34+ public bool AutostartEnabled { get ; private set ; }
35+ public int SelectedMonitor { get ; set ; }
3436
3537 private NotifyIcon notifyIcon ;
3638
@@ -39,8 +41,8 @@ public class TraySettings
3941
4042 public TraySettings ( )
4143 {
42- KeyboardWidth = Corale . Colore . Razer . Keyboard . Constants . MaxColumns ;
43- KeyboardHeight = Corale . Colore . Razer . Keyboard . Constants . MaxRows ;
44+ KeyboardWidth = KeyboardConstants . MaxColumns ;
45+ KeyboardHeight = KeyboardConstants . MaxRows ;
4446 loadConfig ( ) ;
4547 Thread trayThread = new Thread ( InitializeTray ) ;
4648 trayThread . Start ( ) ;
@@ -57,27 +59,27 @@ private void loadConfig()
5759 Saturation = Properties . Settings . Default . saturation ;
5860 int _keyboardHeightProperty = Properties . Settings . Default . keyboardHeight ;
5961 int _keyboardWidthProperty = Properties . Settings . Default . keyboardWidth ;
60- AutostartEnabledBool = Properties . Settings . Default . autostartEnabled ;
61- Monitor = Properties . Settings . Default . monitor ;
62+ AutostartEnabled = Properties . Settings . Default . autostartEnabled ;
63+ SelectedMonitor = Properties . Settings . Default . monitor ;
6264
6365
6466
65- if ( _keyboardWidthProperty >= 0 && _keyboardWidthProperty < Corale . Colore . Razer . Keyboard . Constants . MaxColumns )
67+ if ( _keyboardWidthProperty >= 0 && _keyboardWidthProperty < KeyboardConstants . MaxColumns )
6668 {
6769 KeyboardWidth = _keyboardWidthProperty ;
6870 } else
6971 {
7072 logger . Warn ( "Invalid keyboardWidth changing back to default value" ) ;
71- KeyboardWidth = Corale . Colore . Razer . Keyboard . Constants . MaxColumns ;
73+ KeyboardWidth = KeyboardConstants . MaxColumns ;
7274 }
7375
74- if ( _keyboardHeightProperty >= 0 && _keyboardHeightProperty < Corale . Colore . Razer . Keyboard . Constants . MaxRows )
76+ if ( _keyboardHeightProperty >= 0 && _keyboardHeightProperty < KeyboardConstants . MaxRows )
7577 {
7678 KeyboardHeight = _keyboardHeightProperty ;
7779 } else
7880 {
7981 logger . Warn ( "Invalid keyboardHeight changing back to default value" ) ;
80- KeyboardHeight = Corale . Colore . Razer . Keyboard . Constants . MaxRows ;
82+ KeyboardHeight = KeyboardConstants . MaxRows ;
8183 }
8284 }
8385 catch ( SettingsPropertyNotFoundException )
@@ -86,7 +88,7 @@ private void loadConfig()
8688 Saturation = 1f ;
8789 }
8890
89- logger . Info ( "Autostart: " + AutostartEnabledBool ) ;
91+ logger . Info ( "Autostart: " + AutostartEnabled ) ;
9092 logger . Info ( "Keyboard width: " + KeyboardWidth ) ;
9193 logger . Info ( "Keyboard height: " + KeyboardHeight ) ;
9294 logger . Info ( "Max FPS: " + Tickrate ) ;
@@ -102,47 +104,55 @@ private void InitializeTray()
102104 {
103105 EnableMenuItemOnClick ( sender , args ) ;
104106 Properties . Settings . Default . keyboardEnabled = ( sender as MenuItem ) . Checked ;
105- KeyboardEnabledBool = ( sender as MenuItem ) . Checked ;
107+ KeyboardEnabled = ( sender as MenuItem ) . Checked ;
106108 Properties . Settings . Default . Save ( ) ;
107109 } ) ;
108110
109111 MenuItem _mouseEnabled = new MenuItem ( "Mouse enabled" , ( sender , args ) =>
110112 {
111113 EnableMenuItemOnClick ( sender , args ) ;
112114 Properties . Settings . Default . mouseEnabled = ( sender as MenuItem ) . Checked ;
113- MouseEnabledBool = ( sender as MenuItem ) . Checked ;
115+ MouseEnabled = ( sender as MenuItem ) . Checked ;
114116 Properties . Settings . Default . Save ( ) ;
115117 } ) ;
116118
117119 MenuItem _mousematEnabled = new MenuItem ( "Mousemat enabled" , ( sender , args ) =>
118120 {
119121 EnableMenuItemOnClick ( sender , args ) ;
120122 Properties . Settings . Default . mousematEnabled = ( sender as MenuItem ) . Checked ;
121- PadEnabledBool = ( sender as MenuItem ) . Checked ;
123+ PadEnabled = ( sender as MenuItem ) . Checked ;
124+ Properties . Settings . Default . Save ( ) ;
125+ } ) ;
126+
127+ MenuItem _headsetEnabled = new MenuItem ( "Headset enabled" , ( sender , args ) =>
128+ {
129+ EnableMenuItemOnClick ( sender , args ) ;
130+ Properties . Settings . Default . headsetEnabled = ( sender as MenuItem ) . Checked ;
131+ HeadsetEnabled = ( sender as MenuItem ) . Checked ;
122132 Properties . Settings . Default . Save ( ) ;
123133 } ) ;
124134
125135 MenuItem _linkEnabled = new MenuItem ( "LinkChroma enabled" , ( sender , args ) =>
126136 {
127137 EnableMenuItemOnClick ( sender , args ) ;
128138 Properties . Settings . Default . linkEnabled = ( sender as MenuItem ) . Checked ;
129- LinkEnabledBool = ( sender as MenuItem ) . Checked ;
139+ LinkEnabled = ( sender as MenuItem ) . Checked ;
130140 Properties . Settings . Default . Save ( ) ;
131141 } ) ;
132142
133143 MenuItem _ambiModeEnabled = new MenuItem ( "'Real' Ambilight mode" , ( sender , args ) =>
134144 {
135145 EnableMenuItemOnClick ( sender , args ) ;
136146 Properties . Settings . Default . ambiEnabled = ( sender as MenuItem ) . Checked ;
137- AmbiModeBool = ( sender as MenuItem ) . Checked ;
147+ AmbiModeEnabled = ( sender as MenuItem ) . Checked ;
138148 Properties . Settings . Default . Save ( ) ;
139149 } ) ;
140150
141151 MenuItem _ultrawideModeEnabled = new MenuItem ( "Ultrawide Monitor mode" , ( sender , args ) =>
142152 {
143153 EnableMenuItemOnClick ( sender , args ) ;
144154 Properties . Settings . Default . ultrawideEnabled = ( sender as MenuItem ) . Checked ;
145- UltrawideModeBool = ( sender as MenuItem ) . Checked ;
155+ UltrawideModeEnabled = ( sender as MenuItem ) . Checked ;
146156 Properties . Settings . Default . Save ( ) ;
147157 } ) ;
148158
@@ -151,29 +161,30 @@ private void InitializeTray()
151161 EnableMenuItemOnClick ( sender , args ) ;
152162 Properties . Settings . Default . autostartEnabled = ( sender as MenuItem ) . Checked ;
153163 changeAutoStart ( ) ;
154- AutostartEnabledBool = ( sender as MenuItem ) . Checked ;
164+ AutostartEnabled = ( sender as MenuItem ) . Checked ;
155165 Properties . Settings . Default . Save ( ) ;
156166 } ) ;
157167
158168 _keyboardEnabled . Checked = Properties . Settings . Default . keyboardEnabled ;
159- KeyboardEnabledBool = Properties . Settings . Default . keyboardEnabled ;
169+ KeyboardEnabled = Properties . Settings . Default . keyboardEnabled ;
160170 _mouseEnabled . Checked = Properties . Settings . Default . mouseEnabled ;
161- MouseEnabledBool = Properties . Settings . Default . mouseEnabled ;
171+ MouseEnabled = Properties . Settings . Default . mouseEnabled ;
162172 _mousematEnabled . Checked = Properties . Settings . Default . mousematEnabled ;
163- PadEnabledBool = Properties . Settings . Default . mousematEnabled ;
173+ PadEnabled = Properties . Settings . Default . mousematEnabled ;
174+ _headsetEnabled . Checked = Properties . Settings . Default . headsetEnabled ;
175+ HeadsetEnabled = Properties . Settings . Default . headsetEnabled ;
164176 _linkEnabled . Checked = Properties . Settings . Default . linkEnabled ;
165- LinkEnabledBool = Properties . Settings . Default . linkEnabled ;
177+ LinkEnabled = Properties . Settings . Default . linkEnabled ;
166178 _ambiModeEnabled . Checked = Properties . Settings . Default . ambiEnabled ;
167- AmbiModeBool = Properties . Settings . Default . ambiEnabled ;
179+ AmbiModeEnabled = Properties . Settings . Default . ambiEnabled ;
168180 _ultrawideModeEnabled . Checked = Properties . Settings . Default . ambiEnabled ;
169- UltrawideModeBool = Properties . Settings . Default . ultrawideEnabled ;
181+ UltrawideModeEnabled = Properties . Settings . Default . ultrawideEnabled ;
170182 _autostart . Checked = checkAutostart ( Environment . GetFolderPath ( Environment . SpecialFolder . Startup ) + "/Ambilight.lnk" ) ;
171- AutostartEnabledBool = Properties . Settings . Default . autostartEnabled ;
183+ AutostartEnabled = Properties . Settings . Default . autostartEnabled ;
172184
173185 var components = new System . ComponentModel . Container ( ) ;
174186 var contextMenu = new ContextMenu ( ) ;
175187
176- contextMenu . MenuItems . Add ( "Exit" , ( sender , args ) => { notifyIcon . Dispose ( ) ; Environment . Exit ( 0 ) ; } ) ;
177188 contextMenu . MenuItems . Add ( "Change max fps" , ChangeTickrateHandler ) ;
178189 contextMenu . MenuItems . Add ( "Change Saturation" , ChangeSaturationHandler ) ;
179190 contextMenu . MenuItems . Add ( "Set Manual keyboard size" , changeKeyboardSizeHandler ) ;
@@ -187,7 +198,12 @@ private void InitializeTray()
187198 contextMenu . MenuItems . Add ( _keyboardEnabled ) ;
188199 contextMenu . MenuItems . Add ( _mouseEnabled ) ;
189200 contextMenu . MenuItems . Add ( _mousematEnabled ) ;
201+ contextMenu . MenuItems . Add ( _headsetEnabled ) ;
190202 contextMenu . MenuItems . Add ( _linkEnabled ) ;
203+
204+ contextMenu . MenuItems . Add ( "-" ) ;
205+ contextMenu . MenuItems . Add ( "Exit" , ( sender , args ) => { notifyIcon . Dispose ( ) ; Environment . Exit ( 0 ) ; } ) ;
206+
191207
192208 notifyIcon = new NotifyIcon ( components )
193209 {
@@ -199,6 +215,7 @@ private void InitializeTray()
199215 logger . Info ( "Keyboard Enabled: " + _keyboardEnabled . Checked ) ;
200216 logger . Info ( "Mouse Enabled: " + _mouseEnabled . Checked ) ;
201217 logger . Info ( "Mousemat Enabled: " + _mousematEnabled . Checked ) ;
218+ logger . Info ( "Headset Enabled: " + _headsetEnabled . Checked ) ;
202219 logger . Info ( "ChromaLink Enabled: " + _linkEnabled . Checked ) ;
203220 logger . Info ( "Ambilight mode: " + _ambiModeEnabled . Checked ) ;
204221 logger . Info ( "Ultrawide mode: " + _ultrawideModeEnabled . Checked ) ;
@@ -285,7 +302,7 @@ private void keyboardSizeChangedHandler(object sender, EventArgs e)
285302 int KeyboardWidthSetting = k . GetTxtWidth ( ) ;
286303 int KeyboardHeightSetting = k . GetTxtHeight ( ) ;
287304
288- if ( KeyboardWidthSetting < 0 || KeyboardWidthSetting > Corale . Colore . Razer . Keyboard . Constants . MaxColumns || KeyboardHeightSetting < 0 || KeyboardHeightSetting > Corale . Colore . Razer . Keyboard . Constants . MaxRows )
305+ if ( KeyboardWidthSetting < 0 || KeyboardWidthSetting > KeyboardConstants . MaxColumns || KeyboardHeightSetting < 0 || KeyboardHeightSetting > KeyboardConstants . MaxRows )
289306 {
290307 k . errorReport ( "Input invalid" ) ;
291308 return ;
0 commit comments