Added shortcut keys for the buttons

This commit is contained in:
2016-03-16 15:08:34 +00:00
parent c668bbaca6
commit ba019e4476
2 changed files with 28 additions and 30 deletions

View File

@@ -30,6 +30,8 @@ namespace Volian.Controls.Library
_initializing = false;
btnOpen.Enabled = (txbWordFile.Text.Length > 0);
}
private void disableButtons()
{
btnOpen.Enabled = false;
@@ -42,7 +44,6 @@ namespace Volian.Controls.Library
_initializing = true;
txbWordFile.Text = ofd.FileName;
_initializing = false;
//btnOpen.Enabled = true;
}
private void btnBrowse_Click(object sender, EventArgs e)
@@ -64,7 +65,6 @@ namespace Volian.Controls.Library
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
btnOpen_Click(sender, e);
// btnOpen.PerformClick(); // does not work if button is disabled
}
}
@@ -98,7 +98,6 @@ namespace Volian.Controls.Library
_WordApp.Selection.MoveUp(LBWdUnits.wdParagraph, 1, 1);
try
{
//int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
int idx = -1;
if (_WordApp.Selection.Text.EndsWith("\t(\r") || _WordApp.Selection.Text.EndsWith("\t___\r"))
idx = _WordApp.Selection.Text.LastIndexOf("\t");
@@ -110,7 +109,6 @@ namespace Volian.Controls.Library
txbWrdText.Text = txbWrdText.Text.Replace('\x0B', ' '); // replace hard return with regular space
txvStyle.Text = _WordApp.Selection.Style.NameLocal;
txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
//_WordApp.Selection.Copy();
Clipboard.SetText(txbWrdText.Text);
}
catch
@@ -123,7 +121,6 @@ namespace Volian.Controls.Library
_WordApp.Selection.MoveDown(LBWdUnits.wdParagraph, 1, 1);
try
{
//int idx = _WordApp.Selection.Text.IndexOfAny("\t".ToCharArray());
int idx = -1;
if (_WordApp.Selection.Text.EndsWith("\t(\r") || _WordApp.Selection.Text.EndsWith("\t___\r"))
idx = _WordApp.Selection.Text.LastIndexOf("\t");
@@ -137,17 +134,10 @@ namespace Volian.Controls.Library
txvStyle.Text = _WordApp.Selection.Style.NameLocal;
txbLevel.Text = _WordApp.Selection.Style.ListLevelNumber.ToString();
//_WordApp.Selection.Copy();
Clipboard.SetText(txbWrdText.Text);
}
catch
{ }
//string tmp = Clipboard.GetText(TextDataFormat.Html);
//if (MyStepRTB != null)
//{
// MyStepRTB.RtbSendKeys("^+i");
// MyStepRTB.RtbSendKeys("^v");
//}
}
private void txbWordFile_TextChanged(object sender, EventArgs e)
@@ -170,28 +160,31 @@ namespace Volian.Controls.Library
private void btnNextIns_Click(object sender, EventArgs e)
{
//btnNext_Click(sender, e);
if (MyStepRTB != null)
{
if (MyStepRTB.MyItemInfo.IsSection)
{
MyStepRTB.RtbSendKeys("^{DOWN}"); // down arrow
MyStepRTB.RtbSendKeys("^{DOWN}"); // <Ctrl><down arrow> - next edit window
MyStepRTB.RtbSendKeys("^+b"); // insert previous
}
else
MyStepRTB.RtbSendKeys("^+i"); // insert next (same type and level)
MyStepRTB.RtbSendKeys("^v"); // clipboard paste
Application.DoEvents();
}
this.Focus(); // set focus back to this form
}
private void btnNextRpl_Click(object sender, EventArgs e)
{
if (MyStepRTB != null)
{
MyStepRTB.RtbSendKeys("^{DOWN}"); // move to next edit window
MyStepRTB.RtbSendKeys("^{DOWN}"); // <Ctrl><down arrow> - next edit window
MyStepRTB.RtbSendKeys("^a"); // select all
MyStepRTB.RtbSendKeys("^v"); // clipboard paste
Application.DoEvents();
}
this.Focus(); // set focus back to this form
}
}
}