This commit is contained in:
@@ -20,7 +20,7 @@ namespace Volian.Controls.Library
|
||||
_MyStepItem = value;
|
||||
if (value != null)
|
||||
{
|
||||
_MyStepRTB = value.MyStepRTB;
|
||||
MyStepRTB = value.MyStepRTB;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,30 +36,64 @@ namespace Volian.Controls.Library
|
||||
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
|
||||
_MyStepRTB.SelectionChanged += new EventHandler(MyStepRTB_SelectionChanged);
|
||||
_MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave);
|
||||
_MyStepRTB.LinkChanged += new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
|
||||
SetButtonAndMenuEnabling();
|
||||
}
|
||||
}
|
||||
}
|
||||
void _MyStepRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
|
||||
btnCMGoTo.Enabled = btnGoTo.Enabled = (_MyStepRTB.MyLinkText != null);
|
||||
if (btnCMGoTo.Enabled == true) // must have some link test, use it to set edit of transition or ro...
|
||||
{
|
||||
btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition
|
||||
btnCMEditRO.Enabled = _MyStepRTB.MyLinkText.IndexOf("ReferencedObject") > -1; // selected link must be ro
|
||||
}
|
||||
}
|
||||
void MyStepRTB_Leave(object sender, EventArgs e)
|
||||
{
|
||||
_MyStepRTB.SelectionChanged -= new EventHandler(MyStepRTB_SelectionChanged);
|
||||
_MyStepRTB.Leave -= new EventHandler(MyStepRTB_Leave);
|
||||
_MyStepRTB.LinkChanged -= new StepRTBLinkEvent(_MyStepRTB_LinkChanged);
|
||||
}
|
||||
void MyStepRTB_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
|
||||
btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
|
||||
btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
|
||||
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
|
||||
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
|
||||
SetButtonAndMenuEnabling();
|
||||
}
|
||||
private void SetButtonAndMenuEnabling()
|
||||
{
|
||||
if (_MyStepRTB == null) return;
|
||||
if (_MyStepRTB.SelectionFont != null)
|
||||
{
|
||||
btnCMBold.Checked = btnBold.Checked = RTBAPI.IsBold(_MyStepRTB);
|
||||
btnCMItalics.Checked = btnItalics.Checked = RTBAPI.IsItalic(_MyStepRTB);
|
||||
btnCMUnderline.Checked = btnUnderline.Checked = RTBAPI.IsUnderline(_MyStepRTB);
|
||||
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
|
||||
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
|
||||
}
|
||||
btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
|
||||
btnCMUndo.Enabled = btnUndo.Enabled = _MyStepRTB.CanUndo;
|
||||
btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo;
|
||||
|
||||
// for paste, see if there is clipboard data, & if so, of a type we can use.
|
||||
IDataObject iData = Clipboard.GetDataObject();
|
||||
btnCMPaste.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
|
||||
|
||||
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
|
||||
btnCMGoTo.Enabled = btnGoTo.Enabled = (_MyStepRTB.MyLinkText != null);
|
||||
if (btnCMGoTo.Enabled == true) // must have some link test, use it to set edit of transition or ro...
|
||||
{
|
||||
btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition")>-1; // selected link must be a transition
|
||||
btnCMEditRO.Enabled = _MyStepRTB.MyLinkText.IndexOf("ReferencedObject") > -1; // selected link must be ro
|
||||
}
|
||||
}
|
||||
public StepTabRibbon()
|
||||
{
|
||||
InitializeComponent();
|
||||
// get the xml for all of the symbols, create buttons for them & add them to the gallery.
|
||||
// Note that this code was added here rather than in DisplayTabRinnon.designer.cs because
|
||||
// if it is in the designer, this tabribbon could not be brought up in the VS form designer!
|
||||
// Also note that the ButtonItems must be used in order to place the buttons on a gallery (cannot
|
||||
|
||||
// Add symbols to the tabribbon & also to the context menu getting info from the format file...
|
||||
// Note that the ButtonItems must be used in order to place the buttons on a gallery (cannot
|
||||
// use buttonx or dotnet/windows/button). However, you cannot change the font on ButtonItems so
|
||||
// the ribbon MUST use the Arial Unicode MS Font for this to work!!!!
|
||||
Format fmt = VEPROMS.CSLA.Library.Format.Get(1); //base for now - TO DO KBR:
|
||||
@@ -80,6 +114,15 @@ namespace Volian.Controls.Library
|
||||
btn.FontBold = true;
|
||||
btn.Click += new System.EventHandler(btnSym_Click);
|
||||
galleryContainerSymbols.SubItems.Add(btn);
|
||||
DevComponents.DotNetBar.ButtonItem btnCM = new DevComponents.DotNetBar.ButtonItem();
|
||||
btnCM.Text = string.Format("{0}", (char)sym.Unicode);
|
||||
// to name button use unicode rather than desc, desc may have spaces or odd chars
|
||||
btnCM.Name = "btnCM" + sym.Unicode.ToString();
|
||||
btnCM.Tooltip = sym.Desc;
|
||||
btnCM.Tag = string.Format(@"\u{0}", sym.Unicode);
|
||||
btnCM.FontBold = true;
|
||||
btnCM.Click += new System.EventHandler(btnSym_Click);
|
||||
galleryContainerSymbolsCM.SubItems.Add(btnCM);
|
||||
}
|
||||
}
|
||||
private void btnSym_Click(object sender, EventArgs e)
|
||||
@@ -90,10 +133,10 @@ namespace Volian.Controls.Library
|
||||
private void btnPaste_Click(object sender, EventArgs e)
|
||||
{
|
||||
IDataObject myDO = Clipboard.GetDataObject();
|
||||
if (myDO.GetDataPresent("Rich Text Format"))
|
||||
_MyStepRTB.SelectedRtf = myDO.GetData("Rich Text Format").ToString();
|
||||
else if (myDO.GetDataPresent("Text"))
|
||||
_MyStepRTB.SelectedText = myDO.GetData("Text").ToString();
|
||||
if (myDO.GetDataPresent(DataFormats.Rtf))
|
||||
_MyStepRTB.SelectedRtf = myDO.GetData(DataFormats.Rtf).ToString();
|
||||
else if (myDO.GetDataPresent(DataFormats.Text))
|
||||
_MyStepRTB.SelectedText = myDO.GetData(DataFormats.Text).ToString();
|
||||
}
|
||||
private void btnCut_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -110,21 +153,18 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void btnBold_Click(object sender, EventArgs e)
|
||||
{
|
||||
FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Bold;
|
||||
_MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
|
||||
btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
|
||||
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)
|
||||
{
|
||||
FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Italic;
|
||||
_MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
|
||||
btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
|
||||
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)
|
||||
{
|
||||
FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Underline;
|
||||
_MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
|
||||
btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
|
||||
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)
|
||||
@@ -153,18 +193,12 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MyStepRTB.SetSelectedCase('T');
|
||||
}
|
||||
//public event DisplayRTBLinkEvent LinkInsertTran;
|
||||
//private void OnLinkInsertTran(object sender, LinkClickedEventArgs args)
|
||||
//{
|
||||
// _LinkClickedEventArgs = args;
|
||||
// if (LinkInsertTran != null) LinkInsertTran(sender, args);
|
||||
//}
|
||||
private void btnInsTrans_Click(object sender, EventArgs e)
|
||||
{
|
||||
// see if user is positioned 'on' a transition within the rtb, if so do a modify, otherwise,
|
||||
// insert transition.
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyTran(this, new StepPanelLinkEventArgs(_MyStepItem, null));
|
||||
tmp.MyDisplayTabControl.OnLinkModifyTran(this, new StepPanelLinkEventArgs(_MyStepItem, MyStepRTB.MyLinkText));
|
||||
}
|
||||
|
||||
private void btnInsHrdSpc_Click(object sender, EventArgs e)
|
||||
@@ -174,10 +208,10 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void btnInsRO_Click(object sender, EventArgs e)
|
||||
{
|
||||
// see if user is positioned 'on' an RO within the rtb, if so do a modify, otherwise,
|
||||
// see if user is positioned 'on' an ReferencedObject within the rtb, if so do a modify, otherwise,
|
||||
// insert transition.
|
||||
StepTabPanel tmp = Parent as StepTabPanel;
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(_MyStepItem, null));
|
||||
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(_MyStepItem, MyStepRTB.MyLinkText));
|
||||
}
|
||||
|
||||
private void btnRedo_Click(object sender, EventArgs e)
|
||||
@@ -189,5 +223,19 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MyStepRTB.Undo();
|
||||
}
|
||||
private void btnGoTo_Click(object sender, EventArgs e)
|
||||
{
|
||||
// if on a transition, go to the selected transition 'to'. If on
|
||||
// a referenced object, bring up ReferencedObject Editor (for now, just put up a message box.
|
||||
if (_MyStepRTB.MyLinkText.IndexOf("Transition") > -1)
|
||||
{
|
||||
_MyStepItem.MyStepPanel.OnLinkClicked(sender, new StepPanelLinkEventArgs(_MyStepItem, _MyStepRTB.MyLinkText));
|
||||
}
|
||||
else
|
||||
{
|
||||
// bring up ro editor - for now just do a messagebox.
|
||||
MessageBox.Show("Bring up ro editor");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user