Exemple #1
0
 void SpeakAloud_LostFocus(object sender, EventArgs e)
 {
     if (_uiInputModified)
     {
         _speakAloudInfo.Save();
     }
 }
Exemple #2
0
        private void chkCTRLSpeak_CheckedChanged(object sender, EventArgs e)
        {
            if (!_initialized)
            {
                return;
            }
            _uiInputModified = true;
            SpeakAloudInfo newInfo = new SpeakAloudInfo();

            LoadSpeakInfoFromUI(newInfo);
            newInfo.Save();
            _uiInputModified = false;

            if (!_speakAloudInfo.StartShortcut.Equals(newInfo.StartShortcut))
            {
                _speakAloudInfo.StartShortcut.UnregisterKey(this.Handle);
                newInfo.StartShortcut.RegisterKey(this.Handle);
            }
            if (!_speakAloudInfo.StopShortcut.Equals(newInfo.StopShortcut))
            {
                _speakAloudInfo.StopShortcut.UnregisterKey(this.Handle);
                newInfo.StopShortcut.RegisterKey(this.Handle);
            }
            if (!_speakAloudInfo.ReadClipboardShortcut.Equals(newInfo.ReadClipboardShortcut))
            {
                _speakAloudInfo.ReadClipboardShortcut.UnregisterKey(this.Handle);
                newInfo.ReadClipboardShortcut.RegisterKey(this.Handle);
            }
            if (!_speakAloudInfo.PauseShortcut.Equals(newInfo.PauseShortcut))
            {
                _speakAloudInfo.PauseShortcut.UnregisterKey(this.Handle);
                newInfo.PauseShortcut.RegisterKey(this.Handle);
            }
            if (!_speakAloudInfo.ResumeShortcut.Equals(newInfo.ResumeShortcut))
            {
                _speakAloudInfo.ResumeShortcut.UnregisterKey(this.Handle);
                newInfo.ResumeShortcut.RegisterKey(this.Handle);
            }

            _speakAloudInfo = newInfo;
        }
Exemple #3
0
        void UpdateSpekaInfoUI(SpeakAloudInfo speakInfo)
        {
            // select the default voice
            for (int i = 0; i < cbVoice.Items.Count; i++)
            {
                string name = cbVoice.Items[i].ToString();
                if (string.Compare(name, speakInfo.Voice, true) == 0)
                {
                    cbVoice.SelectedIndex = i;
                }
            }

            if (cbVoice.SelectedItem == null)
            {
                cbVoice.SelectedIndex = 0;
                speakInfo.Voice       = cbVoice.Items[0].ToString();
                _uiInputModified      = true;
            }

            txtVolume.Text = speakInfo.Volume.ToString();
            for (int i = 0; i < cbSpeed.Items.Count; i++)
            {
                string strVal = cbSpeed.Items[i].ToString();
                if (string.Compare(strVal, speakInfo.Speed.ToString(), true) == 0)
                {
                    cbSpeed.SelectedIndex = i;
                }
            }

            if ((speakInfo.StartShortcut._mod1 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.StartShortcut._mod2 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.StartShortcut._mod3 & Consts.MOD_ALT) == Consts.MOD_ALT)
            {
                chkALTSpeak.Checked = true;
            }
            if ((speakInfo.StartShortcut._mod1 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.StartShortcut._mod2 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.StartShortcut._mod3 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL)
            {
                chkCTRLSpeak.Checked = true;
            }
            if ((speakInfo.StartShortcut._mod1 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.StartShortcut._mod2 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.StartShortcut._mod3 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT)
            {
                chkShiftSpeak.Checked = true;
            }
            if ((speakInfo.StartShortcut._mod1 & Consts.MOD_WIN) == Consts.MOD_WIN)
            {
            }
            cbSpeakKey.SelectedItem = speakInfo.StartShortcut._key;

            if ((speakInfo.StopShortcut._mod1 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.StopShortcut._mod2 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.StopShortcut._mod3 & Consts.MOD_ALT) == Consts.MOD_ALT)
            {
                chkALTStop.Checked = true;
            }
            if ((speakInfo.StopShortcut._mod1 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.StopShortcut._mod2 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.StopShortcut._mod3 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL)
            {
                chkCTRLStop.Checked = true;
            }
            if ((speakInfo.StopShortcut._mod1 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.StopShortcut._mod2 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.StopShortcut._mod3 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT)
            {
                chkSHIFTStop.Checked = true;
            }
            if ((speakInfo.StopShortcut._mod1 & Consts.MOD_WIN) == Consts.MOD_WIN)
            {
            }
            cbStopKey.SelectedItem = speakInfo.StopShortcut._key;

            if ((speakInfo.ReadClipboardShortcut._mod1 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.ReadClipboardShortcut._mod2 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.ReadClipboardShortcut._mod3 & Consts.MOD_ALT) == Consts.MOD_ALT)
            {
                chkALTClipboard.Checked = true;
            }
            if ((speakInfo.ReadClipboardShortcut._mod1 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.ReadClipboardShortcut._mod2 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.ReadClipboardShortcut._mod3 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL)
            {
                chkCTRLClipboard.Checked = true;
            }
            if ((speakInfo.ReadClipboardShortcut._mod1 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.ReadClipboardShortcut._mod2 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.ReadClipboardShortcut._mod3 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT)
            {
                chkSHIFTClipboard.Checked = true;
            }
            if ((speakInfo.ReadClipboardShortcut._mod1 & Consts.MOD_WIN) == Consts.MOD_WIN)
            {
            }
            cbKeyClipboard.SelectedItem = speakInfo.ReadClipboardShortcut._key;

            if ((speakInfo.PauseShortcut._mod1 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.PauseShortcut._mod2 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.PauseShortcut._mod3 & Consts.MOD_ALT) == Consts.MOD_ALT)
            {
                chkALTPause.Checked = true;
            }
            if ((speakInfo.PauseShortcut._mod1 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.PauseShortcut._mod2 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.PauseShortcut._mod3 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL)
            {
                chkCTRLPause.Checked = true;
            }
            if ((speakInfo.PauseShortcut._mod1 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.PauseShortcut._mod2 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.PauseShortcut._mod3 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT)
            {
                chkSHIFTPause.Checked = true;
            }
            if ((speakInfo.PauseShortcut._mod1 & Consts.MOD_WIN) == Consts.MOD_WIN)
            {
            }
            cbPauseKey.SelectedItem = speakInfo.PauseShortcut._key;

            if ((speakInfo.ResumeShortcut._mod1 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.ResumeShortcut._mod2 & Consts.MOD_ALT) == Consts.MOD_ALT ||
                (speakInfo.ResumeShortcut._mod3 & Consts.MOD_ALT) == Consts.MOD_ALT)
            {
                chkALTResume.Checked = true;
            }
            if ((speakInfo.ResumeShortcut._mod1 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.ResumeShortcut._mod2 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL ||
                (speakInfo.ResumeShortcut._mod3 & Consts.MOD_CONTROL) == Consts.MOD_CONTROL)
            {
                chkCTRLResume.Checked = true;
            }
            if ((speakInfo.ResumeShortcut._mod1 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.ResumeShortcut._mod2 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT ||
                (speakInfo.ResumeShortcut._mod3 & Consts.MOD_SHIFT) == Consts.MOD_SHIFT)
            {
                chkSHIFTResume.Checked = true;
            }
            if ((speakInfo.ResumeShortcut._mod1 & Consts.MOD_WIN) == Consts.MOD_WIN)
            {
            }
            cbResumeKey.SelectedItem = speakInfo.ResumeShortcut._key;

            if (_uiInputModified)
            {
                speakInfo.Save();
                _uiInputModified = false;
            }
        }