@@ -82,12 +82,17 @@ private void KeyCaptureConfig_Load(object sender, EventArgs e)
8282 IniManager . RestoreState ( this , m_zIniManager . GetValue ( Name ) ) ;
8383
8484 // setup the various mouse output options
85- comboBoxMouseOut . Items . Add ( "No Action" ) ;
85+ comboBoxOutMouse . Items . Add ( "No Action" ) ;
8686 foreach ( OutputConfig . MouseButton sName in Enum . GetValues ( typeof ( OutputConfig . MouseButton ) ) )
8787 {
88- comboBoxMouseOut . Items . Add ( sName ) ;
88+ comboBoxOutMouse . Items . Add ( sName ) ;
8989 }
90- comboBoxMouseOut . SelectedIndex = 0 ;
90+ comboBoxOutMouse . SelectedIndex = 0 ;
91+
92+ // toggle: mouse buttons, Key
93+ // action: mouse buttons down/up, Key down/up
94+
95+
9196
9297 // set the notification icon accordingly
9398 notifyIcon . Icon = Resources . KeyCapIdle ;
@@ -106,8 +111,10 @@ private void KeyCaptureConfig_Load(object sender, EventArgs e)
106111 // initialize capture from command line specified file
107112 if ( 0 != m_sLoadedFile . Length )
108113 {
114+ #if false
109115 btnStart_Click ( sender , new EventArgs ( ) ) ;
110116 new Thread ( MinimizeThread ) { Name = "MinimizeThread" } . Start ( ) ;
117+ #endif
111118 }
112119 }
113120
@@ -183,9 +190,9 @@ private void KeyCaptureConfig_Resize(object sender, EventArgs e)
183190 }
184191 }
185192
186- #endregion
193+ #endregion
187194
188- #region Text Capture Handling
195+ #region Text Capture Handling
189196
190197#warning Need to make an input and output version of this
191198 private void txtKeyIn_KeyDown ( object sender , KeyEventArgs e )
@@ -217,9 +224,9 @@ private void txtKey_Leave(object sender, EventArgs e)
217224 ( ( TextBox ) sender ) . BackColor = SystemColors . Control ;
218225 }
219226
220- #endregion
227+ #endregion
221228
222- #region AbstractDirtyForm overrides
229+ #region AbstractDirtyForm overrides
223230
224231 protected override bool SaveFormData ( string sFileName )
225232 {
@@ -260,9 +267,9 @@ protected override bool OpenFormData(string sFileName)
260267 return true ;
261268 }
262269
263- #endregion
270+ #endregion
264271
265- #region Menu Events
272+ #region Menu Events
266273
267274 private void loadToolStripMenuItem_Click ( object sender , EventArgs e )
268275 {
@@ -301,9 +308,9 @@ private void recentConfiguration_Click(object sender, EventArgs e)
301308 InitOpen ( zItem . Text ) ;
302309 }
303310
304- #endregion
311+ #endregion
305312
306- #region Control Events
313+ #region Control Events
307314
308315 private void listViewKeys_SelectedIndexChanged ( object sender , EventArgs e )
309316 {
@@ -317,13 +324,13 @@ private void listViewKeys_Resize(object sender, EventArgs e)
317324 ListViewAssist . ResizeColumnHeaders ( listViewKeys ) ;
318325 }
319326
320- private void comboBoxSpecialOut_SelectedIndexChanged ( object sender , EventArgs e )
327+ private void comboBoxMouseOut_SelectedIndexChanged ( object sender , EventArgs e )
321328 {
322- if ( 0 != comboBoxMouseOut . SelectedIndex ) // the first entry does nothing
329+ if ( 0 != comboBoxOutMouse . SelectedIndex ) // the first entry does nothing
323330 {
324331 var zOutputConfig = new OutputConfig (
325332 ( byte ) OutputConfig . OutputFlag . MouseOut ,
326- ( byte ) ( OutputConfig . MouseButton ) comboBoxMouseOut . SelectedItem ) ;
333+ ( byte ) ( OutputConfig . MouseButton ) comboBoxOutMouse . SelectedItem ) ;
327334 var zDisplay = txtKeyOut ;
328335 zDisplay . Text = zOutputConfig . GetDescription ( ) ;
329336 zDisplay . Tag = zOutputConfig ;
@@ -343,7 +350,7 @@ private void numericUpDownDelay_ValueChanged(object sender, EventArgs e)
343350
344351 private void btnAdd_Click ( object sender , EventArgs e )
345352 {
346- var zInput = ( InputConfig ) txtKeyIn . Tag ;
353+ var zInput = new InputConfig ( ( InputConfig ) txtKeyIn . Tag ) ;
347354 var zOutput = getCurrentOutputDefinition ( ) ;
348355
349356 if ( null == zInput || null == zOutput )
@@ -357,6 +364,7 @@ private void btnAdd_Click(object sender, EventArgs e)
357364 var zPairDef = new RemapEntry ( zInput , zOutput ) ;
358365
359366 // TODO: is it worth keeping a hashset of these to cut the time from o(n) to o(1)?
367+ // TODO: validation method for this (also need to check that an output actually does something (unless do nothing is selected)
360368 // verify this is not already defined
361369 foreach ( ListViewItem zListItem in listViewKeys . Items )
362370 {
@@ -420,12 +428,13 @@ private void btnAppend_Click(object sender, EventArgs e)
420428
421429 private OutputConfig getCurrentOutputDefinition ( )
422430 {
423- var zOutput = ( OutputConfig ) txtKeyOut . Tag ;
431+ var zOutput = new OutputConfig ( ( OutputConfig ) txtKeyOut . Tag ) ;
424432 if ( zOutput == null )
425433 {
426434 return null ;
427435 }
428436
437+ #warning Is this necessary? Why not just let the do nothing flag override?
429438 if ( checkOutputNone . Checked ) // if output is set to none change zOutput keyarg
430439 {
431440 zOutput = new OutputConfig ( ( byte ) OutputConfig . OutputFlag . DoNothing , 0x00 ) ;
@@ -472,9 +481,9 @@ private void btnStart_Click(object sender, EventArgs e)
472481 }
473482 }
474483
475- #endregion
484+ #endregion
476485
477- #region Support Methods
486+ #region Support Methods
478487
479488 /// <summary>
480489 /// Updates the recent loaded file list
@@ -519,8 +528,10 @@ private void UpdateOutputFlags(OutputConfig zOutputConfig)
519528 var bShift = checkOutputShift . Checked ;
520529 var bNone = checkOutputNone . Checked ;
521530 var bToggle = checkOutputToggle . Checked ;
531+ var bDown = checkOutputDown . Checked ;
532+ var bUp = checkOutputUp . Checked ;
522533
523- int nFlags = 0 ;
534+ var nFlags = 0 ;
524535#warning Make a new method on the config object to update the flag on a field and eliminate this copy+paste garbage
525536 nFlags = BitUtil . UpdateFlag ( nFlags , bShift , OutputConfig . OutputFlag . Shift ) ;
526537 nFlags = BitUtil . UpdateFlag ( nFlags , bControl , OutputConfig . OutputFlag . Control ) ;
@@ -531,6 +542,8 @@ private void UpdateOutputFlags(OutputConfig zOutputConfig)
531542
532543 nFlags = BitUtil . UpdateFlag ( nFlags , bNone , OutputConfig . OutputFlag . DoNothing ) ;
533544 nFlags = BitUtil . UpdateFlag ( nFlags , bToggle , OutputConfig . OutputFlag . Toggle ) ;
545+ nFlags = BitUtil . UpdateFlag ( nFlags , bDown , OutputConfig . OutputFlag . Down ) ;
546+ nFlags = BitUtil . UpdateFlag ( nFlags , bUp , OutputConfig . OutputFlag . Up ) ;
534547 zOutputConfig . Flags = nFlags ;
535548 }
536549
@@ -559,5 +572,24 @@ private void MinimizeThread()
559572 }
560573
561574 #endregion
575+
576+ private void checkOutputToggle_CheckedChanged ( object sender , EventArgs e )
577+ {
578+ checkOutputUp . Checked = checkOutputToggle . Checked ;
579+ checkOutputDown . Checked = checkOutputToggle . Checked ;
580+ checkOutputUp . Enabled = ! checkOutputToggle . Checked ;
581+ checkOutputDown . Enabled = ! checkOutputToggle . Checked ;
582+ }
583+
584+ private void checkOutputNone_CheckedChanged ( object sender , EventArgs e )
585+ {
586+ comboBoxOutMouse . Enabled = ! checkOutputNone . Checked ;
587+ checkOutputAlt . Enabled = ! checkOutputNone . Checked ;
588+ checkOutputShift . Enabled = ! checkOutputNone . Checked ;
589+ checkOutputControl . Enabled = ! checkOutputNone . Checked ;
590+ checkOutputUp . Enabled = ! checkOutputNone . Checked ;
591+ checkOutputDown . Enabled = ! checkOutputNone . Checked ;
592+ checkOutputToggle . Enabled = ! checkOutputNone . Checked ;
593+ }
562594 }
563595}
0 commit comments