// ******************************************************************************************************************* // The following functions provide the user with speech prompting when a control is entered. // Most controls may be entered by [TAB] or by arrow key, or by entering it's location via mouse. // ******************************************************************************************************************* /// <summary> /// Bind to both "Enter" and "MouseEnter" events for dynamic token/element buttons to allow voice prompting. /// </summary> /// <param name="sender">The object (castable to "Button") that raised the event</param> /// <param name="e">Event data pertinent to Enter and MouseEnter events</param> private void Button_Dynamic_Enter( object sender, EventArgs e ) { // This event is bound to both "Enter" and "MouseEnter" events. // Its purpose is to provide a speech prompt and visible prompt for what the dynamic button represents Button button = sender as Button; string saySpeech = ""; // This will be the speech to be spoken string showSymbol = ""; //string typeSymbol = "token"; KeyCombo showShortcut = new KeyCombo( true, false, "" ); if( button != null ) { // Check master token list for this button's speech text // First, check <mo> tags foreach( Token tok in MasterToken._mo ) { if( tok != null ) if( tok._symbol == ( string )button.Text ) { saySpeech = tok._speech; showSymbol = tok._symbol; showShortcut.GetWavesTokenShortcut( this, button, false ); } } // Then, check <mi> tags if not yet found if( saySpeech == "" ) { foreach( Token tok in MasterToken._mi ) { if( tok != null ) if( tok._symbol == ( string )button.Text ) { saySpeech = tok._speech; showSymbol = tok._symbol; showShortcut.GetWavesTokenShortcut( this, button, false ); } } } // Then, check element tags if not yet found if( saySpeech == "" ) { foreach( Token tok in MasterToken._mathMLelement ) { if( tok._symbol == ( string )button.Name ) { saySpeech = tok._speech; showSymbol = tok._symbol; //typeSymbol = "element"; showShortcut.GetWavesTokenShortcut( this, button, true ); } } } // And so, we should now have speech to say... flush the Speaker buffer and initialize the current sound byte if( MENU_Options_VoicePrompting.Checked ) { Speaker.SpeakAsyncCancelAll(); Speaker.SpeakAsync( saySpeech ); } string tooltipMessage = "Add \"" + showSymbol + "\" to formula (" + showShortcut.GetKeyCombo() + ")"; TOOLTIP_Display.SetToolTip( button, tooltipMessage ); } // Log the control on the form that has been entered //for( int i = 0; i < Controls.Count; i++ ) { // if( Controls[ i ] == button ) // DynamicSelected = i; //} }