@@ -202,7 +202,6 @@ private void LoadSettingsFromConfiguration()
202202 //
203203 checkBoxRunAtStartup . IsChecked = config . RunAtStartup ;
204204
205-
206205 //
207206 // Custom commands
208207 //
@@ -222,6 +221,11 @@ private void LoadSettingsFromConfiguration()
222221 }
223222 textCommandsAfter . Text = tmp ;
224223
224+ //
225+ // Debugging
226+ //
227+ checkBoxDebugging . IsChecked = config . DebuggingEnabled ;
228+
225229
226230 // Update canvases
227231 UpdateCanvasElements ( ) ;
@@ -410,6 +414,11 @@ private void UpdateSettingsToConfiguration()
410414 config . CommandsAfter = commandList . ToArray ( ) ;
411415
412416
417+ //
418+ // Debugging
419+ //
420+ config . DebuggingEnabled = ( bool ) checkBoxDebugging . IsChecked ;
421+
413422
414423 UpdateCanvasElements ( ) ;
415424
@@ -953,7 +962,6 @@ private void CheckboxChanged(object sender, RoutedEventArgs e)
953962 {
954963 if ( isLoadingSettings ) return ;
955964
956-
957965 // Disable tablet area settings when full area is forced
958966 if ( checkBoxForceFullArea . IsChecked == true )
959967 {
@@ -1005,6 +1013,19 @@ private void CheckboxChanged(object sender, RoutedEventArgs e)
10051013 textDesktopHeight . IsEnabled = true ;
10061014 }
10071015
1016+ // Debugging checkbox
1017+ if ( sender == checkBoxDebugging )
1018+ {
1019+ if ( checkBoxDebugging . IsChecked == true )
1020+ {
1021+ driver . SendCommand ( "Debug true" ) ;
1022+ }
1023+ else
1024+ {
1025+ driver . SendCommand ( "Debug false" ) ;
1026+ }
1027+ }
1028+
10081029 UpdateSettingsToConfiguration ( ) ;
10091030
10101031 if ( sender == checkBoxForceFullArea )
@@ -1064,6 +1085,21 @@ private void ComboBoxMonitor_MouseDown(object sender, MouseButtonEventArgs e)
10641085 comboBoxMonitor . Items . Add ( System . Windows . Forms . Screen . PrimaryScreen . DeviceName ) ;
10651086 }
10661087
1088+ // TabletDriverGUI window
1089+ comboBoxMonitor . Items . Add ( "This window" ) ;
1090+
1091+ // osu!.exe processes window
1092+ try
1093+ {
1094+ if ( Process . GetProcessesByName ( "osu!" ) . Length > 0 )
1095+ {
1096+ comboBoxMonitor . Items . Add ( "osu! window" ) ;
1097+ }
1098+ }
1099+ catch ( Exception )
1100+ {
1101+ }
1102+
10671103 }
10681104
10691105
@@ -1092,13 +1128,50 @@ private void ComboBoxMonitor_SelectionChanged(object sender, SelectionChangedEve
10921128 else if ( index > 0 )
10931129 {
10941130 index -- ;
1131+
1132+ // Monitors
10951133 if ( index >= 0 && index < screens . Length )
10961134 {
10971135 textScreenAreaX . Text = Utils . GetNumberString ( screens [ index ] . Bounds . X - minX ) ;
10981136 textScreenAreaY . Text = Utils . GetNumberString ( screens [ index ] . Bounds . Y - minY ) ;
10991137 textScreenAreaWidth . Text = Utils . GetNumberString ( screens [ index ] . Bounds . Width ) ;
11001138 textScreenAreaHeight . Text = Utils . GetNumberString ( screens [ index ] . Bounds . Height ) ;
11011139 }
1140+
1141+ // TabletDriverGUI window
1142+ else if ( comboBoxMonitor . SelectedValue . ToString ( ) == "This window" )
1143+ {
1144+ textScreenAreaX . Text = Utils . GetNumberString ( Application . Current . MainWindow . Left - minX ) ;
1145+ textScreenAreaY . Text = Utils . GetNumberString ( Application . Current . MainWindow . Top - minY ) ;
1146+ textScreenAreaWidth . Text = Utils . GetNumberString ( Application . Current . MainWindow . Width ) ;
1147+ textScreenAreaHeight . Text = Utils . GetNumberString ( Application . Current . MainWindow . Height ) ;
1148+ }
1149+
1150+ // osu! window
1151+ else if ( comboBoxMonitor . SelectedValue . ToString ( ) == "osu! window" )
1152+ {
1153+ try
1154+ {
1155+ Process [ ] processes = Process . GetProcessesByName ( "osu!" ) ;
1156+
1157+ if ( processes . Length > 0 )
1158+ {
1159+ IntPtr osuHandle = processes [ 0 ] . MainWindowHandle ;
1160+ NativeMethods . RECT rect ;
1161+ NativeMethods . GetWindowRect ( osuHandle , out rect ) ;
1162+
1163+ textScreenAreaX . Text = Utils . GetNumberString ( rect . X - minX ) ;
1164+ textScreenAreaY . Text = Utils . GetNumberString ( rect . Y - minY ) ;
1165+ textScreenAreaWidth . Text = Utils . GetNumberString ( rect . Width ) ;
1166+ textScreenAreaHeight . Text = Utils . GetNumberString ( rect . Height - 1 ) ;
1167+
1168+ }
1169+ }
1170+ catch ( Exception )
1171+ {
1172+
1173+ }
1174+ }
11021175 }
11031176 UpdateSettingsToConfiguration ( ) ;
11041177 }
0 commit comments