C2016-029 can now apply the Bold, Italics, Underline, Upper case, Lower case, and Title case styles to a selected range of table cells
This commit is contained in:
parent
8afa945327
commit
3e0f5e19bb
@ -18,6 +18,8 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
|
public delegate void CellRangeApplyStyle();
|
||||||
|
|
||||||
public partial class StepTabRibbon : UserControl
|
public partial class StepTabRibbon : UserControl
|
||||||
{
|
{
|
||||||
private static string _SpecifiedVisioPath = null;
|
private static string _SpecifiedVisioPath = null;
|
||||||
@ -2317,8 +2319,8 @@ namespace Volian.Controls.Library
|
|||||||
MyStepRTB.SelectAll();
|
MyStepRTB.SelectAll();
|
||||||
break;
|
break;
|
||||||
case SelectionOption.End:
|
case SelectionOption.End:
|
||||||
break;
|
|
||||||
MyStepRTB.Select(MyStepRTB.TextLength, 0);
|
MyStepRTB.Select(MyStepRTB.TextLength, 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
MyStepRTB.Select(0, 0);
|
MyStepRTB.Select(0, 0);
|
||||||
break;
|
break;
|
||||||
@ -2326,6 +2328,56 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// C2016-029 apply a style (bold,italics,underline,text case) to the selected grid cells
|
||||||
|
// This method will apply the past in style to either the selected grid cells or to the currently selected step type
|
||||||
|
private void ApplyStyleToCurrentStepOrGridSelection(SelectionOption selOpt, CellRangeApplyStyle applyStyle)
|
||||||
|
{
|
||||||
|
// Need to check if the selected table cell is in edit mode already.
|
||||||
|
// if already in edit mode, we don't want to do the StartEditing code below, because it
|
||||||
|
// will override the current cursor positioning and selection range.
|
||||||
|
Control ctrl = FindActiveControl();
|
||||||
|
if (ctrl == null) return; // null if on property page for procedure & section number/title
|
||||||
|
if (ctrl is VlnFlexGrid)
|
||||||
|
{
|
||||||
|
// Selected table cell is not in edit mode. Go into edit mode and position acording
|
||||||
|
// to the pass in selOpt.
|
||||||
|
if (MyFlexGrid != null && MyFlexGrid.Editor == null)
|
||||||
|
{
|
||||||
|
C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.Selection; // get the selected grid cell range
|
||||||
|
for (int r = cr.r1; r <= cr.r2; r++)
|
||||||
|
for (int c = cr.c1; c <= cr.c2; c++)
|
||||||
|
{
|
||||||
|
MyFlexGrid.Select(r, c);
|
||||||
|
MyFlexGrid.StartEditing();
|
||||||
|
switch (selOpt)
|
||||||
|
{
|
||||||
|
case SelectionOption.Start:
|
||||||
|
MyStepRTB.Select(0, 0);
|
||||||
|
break;
|
||||||
|
case SelectionOption.All:
|
||||||
|
MyStepRTB.SelectAll();
|
||||||
|
break;
|
||||||
|
case SelectionOption.End:
|
||||||
|
MyStepRTB.Select(MyStepRTB.TextLength, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MyStepRTB.Select(0, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
applyStyle();
|
||||||
|
}
|
||||||
|
MyFlexGrid.Select(cr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
applyStyle(); // not in a grid, apply style to current step type
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToggleBold()
|
||||||
|
{
|
||||||
|
RTBAPI.ToggleBold(!RTBAPI.IsBold(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
||||||
|
}
|
||||||
|
|
||||||
public void btnInsPgBrk_Click(object sender, EventArgs e)
|
public void btnInsPgBrk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//rtabInsert.Select(); // insert page break is no longer visible on the ribbon
|
//rtabInsert.Select(); // insert page break is no longer visible on the ribbon
|
||||||
@ -2546,23 +2598,30 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
private void btnBold_Click(object sender, EventArgs e)
|
private void btnBold_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All,ToggleBold);
|
||||||
RTBAPI.ToggleBold(!RTBAPI.IsBold(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB);
|
btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB);
|
||||||
}
|
}
|
||||||
private void btnItalics_Click(object sender, EventArgs e)
|
private void btnItalics_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All,ToggleItalic);
|
||||||
RTBAPI.ToggleItalic(!RTBAPI.IsItalic(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB);
|
btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleItalic()
|
||||||
|
{
|
||||||
|
RTBAPI.ToggleItalic(!RTBAPI.IsItalic(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
||||||
|
}
|
||||||
private void btnUnderline_Click(object sender, EventArgs e)
|
private void btnUnderline_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, ToggleUnderline);
|
||||||
RTBAPI.ToggleUnderline(!RTBAPI.IsUnderline(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
|
||||||
btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB);
|
btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleUnderline()
|
||||||
|
{
|
||||||
|
RTBAPI.ToggleUnderline(!RTBAPI.IsUnderline(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
||||||
|
}
|
||||||
|
|
||||||
public void btnSuperscript_Click(object sender, EventArgs e)
|
public void btnSuperscript_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
StartGridEditing(SelectionOption.All);
|
||||||
@ -2579,19 +2638,31 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
private void btnUppercase_Click(object sender, EventArgs e)
|
private void btnUppercase_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, SetUpperCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetUpperCase()
|
||||||
|
{
|
||||||
_MyStepRTB.SetSelectedCase('U');
|
_MyStepRTB.SetSelectedCase('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnLowercase_Click(object sender, EventArgs e)
|
private void btnLowercase_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, SetLowerCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLowerCase()
|
||||||
|
{
|
||||||
_MyStepRTB.SetSelectedCase('l');
|
_MyStepRTB.SetSelectedCase('l');
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnTitleCase_Click(object sender, EventArgs e)
|
private void btnTitleCase_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
ApplyStyleToCurrentStepOrGridSelection(SelectionOption.All, SetTitleCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTitleCase()
|
||||||
|
{
|
||||||
_MyStepRTB.SetSelectedCase('T');
|
_MyStepRTB.SetSelectedCase('T');
|
||||||
}
|
}
|
||||||
private void btnInsTrans_Click(object sender, EventArgs e)
|
private void btnInsTrans_Click(object sender, EventArgs e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user