Added events to allow keystrokes to toggle change bars, continuous action summary, and placekeeper check boxes.
Made ribbon buttons for Superscript and Subscript public, also improved logic around the insert pagebreak button.
This commit is contained in:
parent
c06e3901ba
commit
8af0edb375
@ -94,7 +94,37 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (EnterKeyPressed != null) EnterKeyPressed(sender, args);
|
if (EnterKeyPressed != null) EnterKeyPressed(sender, args);
|
||||||
}
|
}
|
||||||
public event StepRTBEvent InsertPgBrk;
|
public event StepRTBEvent ToggleChangeBar; // shortcut key <Alt><F2>
|
||||||
|
public void OnToggleChangeBar(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (ToggleChangeBar != null) ToggleChangeBar(sender, args);
|
||||||
|
}
|
||||||
|
public event StepRTBEvent ToggleContinuousActionSummary; // shortcut key <Shift><F7>
|
||||||
|
public void OnToggleContinuousActionSummary(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (ToggleContinuousActionSummary != null) ToggleContinuousActionSummary(sender, args);
|
||||||
|
}
|
||||||
|
public event StepRTBEvent TogglePlaceKeeper; // shortcut key <Ctrl><F7>
|
||||||
|
public void OnTogglePlaceKeeper(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (TogglePlaceKeeper != null) TogglePlaceKeeper(sender, args);
|
||||||
|
}
|
||||||
|
public event StepRTBEvent TogglePlaceKeeperContAct; // shortcut key <Shift><Ctrl><F7>
|
||||||
|
public void OnTogglePlaceKeeperContAct(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (TogglePlaceKeeperContAct != null) TogglePlaceKeeperContAct(sender, args);
|
||||||
|
}
|
||||||
|
public event StepRTBEvent ToggleSuperScript; // shortcut key <Ctrl><Shift><=>
|
||||||
|
public void OnToggleSuperScript(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (ToggleSuperScript != null) ToggleSuperScript(sender, args);
|
||||||
|
}
|
||||||
|
public event StepRTBEvent ToggleSubScript; // shortcut key <Ctrl><=>
|
||||||
|
public void OnToggleSubScript(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (ToggleSubScript != null) ToggleSubScript(sender, args);
|
||||||
|
}
|
||||||
|
public event StepRTBEvent InsertPgBrk; // short key <Ctrl><Enter>
|
||||||
public void OnInsertPgBrk(object sender, EventArgs args)
|
public void OnInsertPgBrk(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
if (InsertPgBrk != null) InsertPgBrk(sender, args);
|
if (InsertPgBrk != null) InsertPgBrk(sender, args);
|
||||||
@ -1999,11 +2029,20 @@ namespace Volian.Controls.Library
|
|||||||
case Keys.Left:
|
case Keys.Left:
|
||||||
if (e.Shift)
|
if (e.Shift)
|
||||||
{
|
{
|
||||||
int newstart = FindStart(); // find start of link ending on.
|
int linkWidth = FindlinkWidth(false,e.Control);
|
||||||
// if not link, don't do special processing
|
|
||||||
if (newstart == SelectionStart - 1) return;
|
if (linkWidth == 0)// if not link, don't do special processing
|
||||||
int len = SelectionLength + SelectionStart - newstart;
|
{
|
||||||
SetSelection(newstart, len);
|
if (e.Control)
|
||||||
|
{
|
||||||
|
this.AutoWordSelection = true; // this will select a word at a time
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
linkWidth++;
|
||||||
|
int len = SelectionLength - linkWidth;
|
||||||
|
SetSelection(SelectionStart, len); // adjust the selcection around the linked text
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2047,9 +2086,17 @@ namespace Volian.Controls.Library
|
|||||||
// it's handled in HandleSelectionChange.
|
// it's handled in HandleSelectionChange.
|
||||||
if (e.Shift && ((SelectionStart > 0) || (SelectionStart == 0 && _LinkLocations.Count > 0 && _LinkLocations[0].Start != 7)))
|
if (e.Shift && ((SelectionStart > 0) || (SelectionStart == 0 && _LinkLocations.Count > 0 && _LinkLocations[0].Start != 7)))
|
||||||
{
|
{
|
||||||
int newlen = FindEnd();
|
int newlen = FindlinkWidth(true,e.Control);
|
||||||
|
if (newlen == 0) // not on linked text
|
||||||
|
{
|
||||||
|
if (e.Shift && e.Control)
|
||||||
|
this.AutoWordSelection = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (e.Shift && e.Control)
|
||||||
|
newlen++;
|
||||||
int len = SelectionLength + newlen;
|
int len = SelectionLength + newlen;
|
||||||
SetSelection(SelectionStart, len);
|
SetSelection(SelectionStart, len); // adjust the selection around the linked text
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2190,6 +2237,8 @@ namespace Volian.Controls.Library
|
|||||||
Form frm = ParentForm(this);
|
Form frm = ParentForm(this);
|
||||||
if (frm != null)
|
if (frm != null)
|
||||||
frm.SelectNextControl(this, true, true, true, true);
|
frm.SelectNextControl(this, true, true, true, true);
|
||||||
|
else
|
||||||
|
StepRTB_ArrowPressed(e.Shift ? E_ArrowKeys.CtrlUp : E_ArrowKeys.CtrlRight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2221,6 +2270,37 @@ namespace Volian.Controls.Library
|
|||||||
OnEnterKeyPressed(sender, e);
|
OnEnterKeyPressed(sender, e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Keys.F2:
|
||||||
|
if (e.Alt && !e.Control && !e.Shift) // toggle change bar
|
||||||
|
{
|
||||||
|
OnToggleChangeBar(this, new EventArgs());
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Keys.F7:
|
||||||
|
if (!e.Alt) // for the Include On check boxes on the step properties page
|
||||||
|
{
|
||||||
|
if (e.Control && e.Shift) // Toggle include on Placekeeper as Continuous Action
|
||||||
|
OnTogglePlaceKeeperContAct(this, new EventArgs());
|
||||||
|
else if (e.Control) // Toggle include on Placekeeper
|
||||||
|
OnTogglePlaceKeeper(this, new EventArgs());
|
||||||
|
else if (e.Shift) // toggle include on Continuous Action Summary
|
||||||
|
OnToggleContinuousActionSummary(this, new EventArgs());
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (e.KeyValue == 187 && e.Control) // equal key pressed
|
||||||
|
{
|
||||||
|
if (e.Shift) // superscript
|
||||||
|
{
|
||||||
|
OnToggleSuperScript(this, new EventArgs());
|
||||||
|
}
|
||||||
|
else // subscript
|
||||||
|
{
|
||||||
|
OnToggleSubScript(this, new EventArgs());
|
||||||
|
}
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Form ParentForm(Control ctrl)
|
private static Form ParentForm(Control ctrl)
|
||||||
@ -2658,6 +2738,16 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// if the selection is on linked text, then return the length of that linked text (the rtf length)
|
||||||
|
private int FindlinkWidth(bool movingRight, bool ctrlKey)
|
||||||
|
{
|
||||||
|
foreach (LinkLocation ll in _LinkLocations)
|
||||||
|
{
|
||||||
|
int selLen = SelectionLength + ((movingRight) ? 7 : 0);
|
||||||
|
if (SelectionStart + selLen >= ll.Start && SelectionStart + selLen - ((!movingRight && ctrlKey)?1:0) <= ll.End) return ll.End - ll.Start + 7;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
private int FindStartUp()
|
private int FindStartUp()
|
||||||
{
|
{
|
||||||
foreach (LinkLocation ll in _LinkLocations)
|
foreach (LinkLocation ll in _LinkLocations)
|
||||||
|
@ -1650,8 +1650,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public void btnInsPgBrk_Click(object sender, EventArgs e)
|
public void btnInsPgBrk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
rtabInsert.Select();
|
//rtabInsert.Select(); // insert page break is no longer visible on the ribbon
|
||||||
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
|
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection || !MyItemInfo.IsHigh) return;
|
||||||
MyEditItem.SaveContents();
|
MyEditItem.SaveContents();
|
||||||
// toggle manual page break
|
// toggle manual page break
|
||||||
StepConfig cfg = MyItemInfo.MyConfig as StepConfig;
|
StepConfig cfg = MyItemInfo.MyConfig as StepConfig;
|
||||||
@ -1891,14 +1891,14 @@ namespace Volian.Controls.Library
|
|||||||
btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB);
|
btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSuperscript_Click(object sender, EventArgs e)
|
public void btnSuperscript_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
StartGridEditing(SelectionOption.All);
|
||||||
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
||||||
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
|
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnSubscript_Click(object sender, EventArgs e)
|
public void btnSubscript_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
StartGridEditing(SelectionOption.All);
|
StartGridEditing(SelectionOption.All);
|
||||||
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
|
||||||
|
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user