B2021-052 allow for table cell text font size change when the text ends in a setpoint or transition link

This commit is contained in:
2021-04-22 14:13:30 +00:00
parent 814d26f713
commit 6d9a3f5f4e
2 changed files with 46 additions and 9 deletions

View File

@@ -2561,7 +2561,7 @@ namespace Volian.Controls.Library
else
applyStyle(); // not in a grid, apply style to current step type
}
//C2021-005 the font size for the selected talbe cell(s)
//C2021-005 the font size for the selected table cell(s)
private float GetTableCellFontSize(SelectionOption selOpt)
{
// return 0 if there are multiple font sizes or just an invalid selection
@@ -2652,12 +2652,18 @@ namespace Volian.Controls.Library
MyStepRTB.Select(0, 0);
break;
}
MyStepRTB.SetFontSize(newSize);
ChangeTableTextFontSize(newSize); // Apply font size to selected cells
}
MyFlexGrid.Select(cr);
}
else
MyStepRTB.SetFontSize(newSize); // not in a grid, apply style to current step type
{
int ss = MyStepRTB.SelectionStart;
int sl = MyStepRTB.SelectionLength;
MyStepRTB.OnReturnToEditor(this, new EventArgs());
MyStepRTB.Select(ss, sl);
ChangeTableTextFontSize(newSize);
}
}
else
{
@@ -2671,10 +2677,37 @@ namespace Volian.Controls.Library
int sl = MyStepRTB.SelectionLength;
MyStepRTB.OnReturnToEditor(this, new EventArgs());
MyStepRTB.Select(ss, sl);
MyStepRTB.SetFontSize(newSize);
ChangeTableTextFontSize(newSize);
}
}
}
// B2021-052 table cell text that ends with a link (RO or Transition) was not accepting a change in font size
private void ChangeTableTextFontSize(float newSize)
{
int ss = MyStepRTB.SelectionStart;
int sl = MyStepRTB.SelectionLength;
bool addedSpace = false;
// B2021-052 if the table cell text end with a link, then append a space to the end and reselect the text
if ((sl == MyStepRTB.TextLength || MyStepRTB.SelectedText.EndsWith("[END>")) && MyStepRTB.Text.EndsWith("[END>"))
{
addedSpace = true;
MyStepRTB.OnReturnToEditor(this, new EventArgs()); //reset and refocus to the table cell rtf edtior
MyStepRTB.AppendText(" ");
MyStepRTB.Select(ss, sl);
}
MyStepRTB.SetFontSize(newSize); // change the font size of the selection
// B2021-052 if a space as added, remove the space
if (addedSpace)
{
MyStepRTB.OnReturnToEditor(this, new EventArgs());
MyStepRTB.Select(MyStepRTB.TextLength - 1, 1); // select the space at the end of the text
MyStepRTB.SelectedText = ""; // remove the space
MyStepRTB.Select(ss, sl);
}
}
private void ToggleBold()
{
RTBAPI.ToggleBold(!RTBAPI.IsBold(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);