diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
index be9663d4..b92134d8 100644
--- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs
+++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
@@ -929,8 +929,42 @@ namespace Volian.Controls.Library
private void btnSym_Click(object sender, EventArgs e)
{
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
+ StartGridEditing(SelectionOption.Start); // If in a FlexGrid, start the editor for a cell
_MyStepRTB.InsertSymbol(Convert.ToInt32(b.Tag));
}
+ private enum SelectionOption
+ {
+ Start,
+ All,
+ End
+ }
+ ///
+ /// If in a FlexGrid, start the editor for a cell
+ ///
+ /// If false cursor will be placed at the begining
+ private void StartGridEditing(SelectionOption selOpt)
+ {
+ if (MyFlexGrid != null && MyFlexGrid.Editor == null)
+ {
+ MyFlexGrid.StartEditing();
+ switch (selOpt)
+ {
+ case SelectionOption.Start:
+ MyStepRTB.Select(0, 0);
+ break;
+ case SelectionOption.All:
+ MyStepRTB.SelectAll();
+ break;
+ case SelectionOption.End:
+ break;
+ MyStepRTB.Select(MyStepRTB.TextLength, 0);
+ default:
+ MyStepRTB.Select(0, 0);
+ break;
+ }
+ }
+
+ }
public void btnInsPgBrk_Click(object sender, EventArgs e)
{
rtabInsert.Select();
@@ -943,6 +977,7 @@ namespace Volian.Controls.Library
}
private void btnIndent_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.Start);
_MyStepRTB.InsertIndent(MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken);
}
private void btnCMIndent_Click(object sender, EventArgs e)
@@ -954,6 +989,7 @@ namespace Volian.Controls.Library
private bool _PastePlainText = false;
private void btnPaste_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.End);
IDataObject myDO = Clipboard.GetDataObject();
RichTextBox myRtb = _MyStepRTB;
Control ctrl = FindActiveControl();
@@ -1027,6 +1063,7 @@ namespace Volian.Controls.Library
}
private void btnCut_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
MoveSelectedToClipboard(true);
}
private void MoveSelectedToClipboard(bool isCut)
@@ -1092,52 +1129,62 @@ namespace Volian.Controls.Library
}
private void btnCopy_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
MoveSelectedToClipboard(false);
}
private void btnBold_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
RTBAPI.ToggleBold(!RTBAPI.IsBold(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB);
}
private void btnItalics_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
RTBAPI.ToggleItalic(!RTBAPI.IsItalic(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB);
}
private void btnUnderline_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
RTBAPI.ToggleUnderline(!RTBAPI.IsUnderline(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB);
}
private void btnSuperscript_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
}
private void btnSubscript_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
}
private void btnUppercase_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
_MyStepRTB.SetSelectedCase('U');
}
private void btnLowercase_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
_MyStepRTB.SetSelectedCase('l');
}
private void btnTitleCase_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.All);
_MyStepRTB.SetSelectedCase('T');
}
private void btnInsTrans_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.Start);
// see if user is positioned 'on' a transition within the rtb, if so do a modify, otherwise,
// insert transition.
StepTabPanel tmp = Parent as StepTabPanel;
@@ -1146,11 +1193,13 @@ namespace Volian.Controls.Library
private void btnInsHrdSpc_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.Start);
_MyStepRTB.InsertSymbol(@"\u160?");
}
private void btnInsRO_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.Start);
// see if user is positioned 'on' an ReferencedObject within the rtb, if so do a modify, otherwise,
// insert transition.
StepTabPanel tmp = Parent as StepTabPanel;
@@ -2127,7 +2176,8 @@ namespace Volian.Controls.Library
// for paste, see if there is clipboard data, & if so, of a type we can use.
IDataObject iData = Clipboard.GetDataObject();
// set to true if editing cell, otherwise false for grids
- bool enable = (MyFlexGrid != null && MyFlexGrid.Editor != null);
+ //bool enable = (MyFlexGrid != null && MyFlexGrid.Editor != null);
+ bool enable = (MyFlexGrid != null);
//btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = enable;
btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf)) && enable;
btnCMPasteText.Enabled = btnPasteText.Enabled = iData.GetDataPresent(DataFormats.Text) && enable;
@@ -2316,6 +2366,7 @@ namespace Volian.Controls.Library
private void btnPasteText_Click(object sender, EventArgs e)
{
+ StartGridEditing(SelectionOption.End);
_PastePlainText = true;
btnPaste_Click(sender, e);
}
diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
index f6c7f1cf..6dde583c 100644
Binary files a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs and b/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs differ