This commit is contained in:
@@ -17,10 +17,82 @@ namespace Volian.Controls.Library
|
||||
public delegate void StepRTBCursorKeysEvent(object sender, KeyEventArgs args);
|
||||
public delegate void StepRTBCursorMovementEvent(object sender, StepRTBCursorMovementEventArgs args);
|
||||
public delegate void StepRTBModeChangeEvent(object sender, StepRTBModeChangeEventArgs args);
|
||||
public delegate void StepRTBMenuEvent(object sender, StepRTBMenuEventArgs args);
|
||||
public delegate void StepRTBTableWidthEvent(object sender, StepRTBTableWidthEventArgs args);
|
||||
public delegate bool StepRTBBooleanEvent(object sender, EventArgs args);
|
||||
public delegate void StepRTBLocationEvent(object sender, StepRTBLocationEventArgs args);
|
||||
public delegate void StepRTBMouseEvent(object sender, MouseEventArgs args);
|
||||
//public delegate void StepRTBMouseWheelEvent(object sender, MouseEventArgs args);
|
||||
public partial class StepRTB : RichTextBox , IStepRTB
|
||||
public partial class StepRTB : RichTextBox // , IStepRTB
|
||||
{
|
||||
#region Events
|
||||
public event StepRTBEvent ReturnToEditor;
|
||||
public void OnReturnToEditor(object sender, EventArgs args)
|
||||
{
|
||||
if (ReturnToEditor != null) ReturnToEditor(sender, args);
|
||||
}
|
||||
public event StepRTBEvent EditModeChanged;
|
||||
public void OnEditModeChanged(object sender, EventArgs args)
|
||||
{
|
||||
if (EditModeChanged != null) EditModeChanged(sender, args);
|
||||
}
|
||||
public event StepRTBEvent DoSaveContents;
|
||||
public void OnDoSaveContents(object sender, EventArgs args)
|
||||
{
|
||||
if (DoSaveContents != null) DoSaveContents(sender, args);
|
||||
}
|
||||
public event StepRTBMouseEvent DoMouseWheel;
|
||||
public void OnDoMouseWheel(object sender, MouseEventArgs args)
|
||||
{
|
||||
if (DoMouseWheel != null) DoMouseWheel(sender, args);
|
||||
}
|
||||
public event StepRTBLocationEvent OpenContextMenu;
|
||||
public void OnOpenContextMenu(object sender, StepRTBLocationEventArgs args)
|
||||
{
|
||||
if (OpenContextMenu != null) OpenContextMenu(sender, args);
|
||||
}
|
||||
public event StepRTBEvent CopyStep;
|
||||
public void OnCopyStep(object sender, EventArgs args)
|
||||
{
|
||||
if (CopyStep != null) CopyStep(sender, args);
|
||||
}
|
||||
public event StepRTBBooleanEvent CheckClipboard;
|
||||
public bool OnCheckClipboard(object sender, EventArgs args)
|
||||
{
|
||||
if (CheckClipboard != null) return CheckClipboard(sender, args);
|
||||
return false;
|
||||
}
|
||||
public event StepRTBCursorKeysEvent EnterKeyPressed;
|
||||
public void OnEnterKeyPressed(object sender, KeyEventArgs args)
|
||||
{
|
||||
if (EnterKeyPressed != null) EnterKeyPressed(sender, args);
|
||||
}
|
||||
public event StepRTBEvent InsertPgBrk;
|
||||
public void OnInsertPgBrk(object sender, EventArgs args)
|
||||
{
|
||||
if (InsertPgBrk != null) InsertPgBrk(sender, args);
|
||||
}
|
||||
public event StepRTBEvent OpenAnnotations;
|
||||
public void OnOpenAnnotations(object sender, EventArgs args)
|
||||
{
|
||||
if (OpenAnnotations != null) OpenAnnotations(sender, args);
|
||||
}
|
||||
public event StepRTBBooleanEvent IsNotCurrentSelection;
|
||||
public bool OnIsNotCurrentSelection(object sender, EventArgs args)
|
||||
{
|
||||
if (IsNotCurrentSelection != null) return IsNotCurrentSelection(sender, args);
|
||||
return false;
|
||||
}
|
||||
public event StepRTBTableWidthEvent AdjustTableWidth;
|
||||
public void OnAdjustTableWidth(object sender, StepRTBTableWidthEventArgs args)
|
||||
{
|
||||
if (AdjustTableWidth != null) AdjustTableWidth(sender, args);
|
||||
}
|
||||
public event StepRTBMenuEvent SetMenu;
|
||||
private void OnSetMenu(object sender, StepRTBMenuEventArgs args)
|
||||
{
|
||||
if (SetMenu != null) SetMenu(sender, args);
|
||||
}
|
||||
public event StepRTBEvent RTBSelectionChanged;
|
||||
private void OnRTBSelectionChanged(object sender, EventArgs args)
|
||||
{
|
||||
@@ -46,13 +118,13 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (CursorMovement != null) CursorMovement(sender, args);
|
||||
}
|
||||
public event StepRTBModeChangeEvent ModeChange;
|
||||
private void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
|
||||
{
|
||||
//_MyModeChangeEventArgs = args;
|
||||
if (ModeChange != null) ModeChange(sender, args);
|
||||
else MessageBox.Show("StepRTB - no mode change defined");
|
||||
}
|
||||
//public event StepRTBModeChangeEvent ModeChange;
|
||||
//private void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
|
||||
//{
|
||||
// //_MyModeChangeEventArgs = args;
|
||||
// if (ModeChange != null) ModeChange(sender, args);
|
||||
// else MessageBox.Show("StepRTB - no mode change defined");
|
||||
//}
|
||||
//public event StepRTBMouseWheelEvent MouseWheel;
|
||||
//private void OnMouseWheel(object sender, MouseEventArgs args)
|
||||
//{
|
||||
@@ -69,6 +141,19 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region Properties and Variables
|
||||
private bool _EditMode = true;
|
||||
/// <summary>
|
||||
/// Allows insert of links. If false, don't allow selection of links.
|
||||
/// </summary>
|
||||
public bool EditMode
|
||||
{
|
||||
get { return _EditMode; }
|
||||
set
|
||||
{
|
||||
_EditMode = value;
|
||||
OnEditModeChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
private static FontFamily _MyFontFamily = null;
|
||||
public static FontFamily MyFontFamily
|
||||
{
|
||||
@@ -103,15 +188,15 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return _RtfPrefix + @"\f1\fs" + this.Font.SizeInPoints * 2 + " ";
|
||||
if (_RtfPrefix == null)
|
||||
{
|
||||
StringBuilder selectedRtfSB = new StringBuilder();
|
||||
AddFontTable(selectedRtfSB, FormatFont, FontIsFixed(FormatFont));
|
||||
_RtfPrefix = selectedRtfSB.ToString();
|
||||
}
|
||||
return _RtfPrefix + @"\f1\fs" + FormatFont.SizeInPoints * 2 + " ";
|
||||
}
|
||||
}
|
||||
private RTBItem _MyRTBItem;
|
||||
public RTBItem MyRTBItem
|
||||
{
|
||||
get { return _MyRTBItem; }
|
||||
set { _MyRTBItem = value; }
|
||||
}
|
||||
// August 5, 2009 - KBR & RHM:
|
||||
// Insert/Overwrite will be developed later if needed. various issues
|
||||
// were found during initial development that made its scope larger than
|
||||
@@ -124,9 +209,9 @@ namespace Volian.Controls.Library
|
||||
// private bool _OverWrite;
|
||||
// _IsDirty compares the original rtf to the current rtf from the
|
||||
// richtextbox to see if a change was made.
|
||||
private bool _IsDirty
|
||||
public bool IsDirty
|
||||
{
|
||||
get { return _origRTF != Rtf; }
|
||||
get { return OrigRTF != Rtf; }
|
||||
}
|
||||
private bool _InitializingRTB;
|
||||
private IContainer _Container = null;
|
||||
@@ -136,12 +221,14 @@ namespace Volian.Controls.Library
|
||||
get { if (_MyClassName == string.Empty)_MyClassName = CreateParams.ClassName; return _MyClassName; }
|
||||
set { _MyClassName = value; }
|
||||
}
|
||||
private E_EditPrintMode _epMode = E_EditPrintMode.Edit;
|
||||
public E_EditPrintMode EpMode
|
||||
{
|
||||
get { return _epMode; }
|
||||
set { _epMode = value; }
|
||||
}
|
||||
//private E_EditPrintMode _epMode = E_EditPrintMode.Edit;
|
||||
//public E_EditPrintMode EpMode
|
||||
//{
|
||||
// get { return _epMode; }
|
||||
// set {
|
||||
// if (value == E_EditPrintMode.Print) Console.WriteLine("");
|
||||
// _epMode = value; }
|
||||
//}
|
||||
private E_ViewMode _vwMode = E_ViewMode.Edit;
|
||||
public E_ViewMode VwMode
|
||||
{
|
||||
@@ -151,76 +238,73 @@ namespace Volian.Controls.Library
|
||||
private VE_Font _MyStyleFont;
|
||||
public VE_Font MyStyleFont
|
||||
{
|
||||
get { return _origDisplayText.TextFont; }
|
||||
get
|
||||
{
|
||||
if (_MyStyleFont == null) _MyStyleFont = MyItemInfo.GetItemFont();
|
||||
return _MyStyleFont;
|
||||
}
|
||||
}
|
||||
private bool _ActiveMode = false;
|
||||
public bool ActiveMode
|
||||
{
|
||||
get { return _ActiveMode; }
|
||||
set { _ActiveMode = value; }
|
||||
}
|
||||
public bool ViewRTB = true;
|
||||
private ItemInfo _MyItemInfo;
|
||||
public ItemInfo MyItemInfo
|
||||
{
|
||||
get { return _MyItemInfo; }
|
||||
set
|
||||
set { _MyItemInfo = value; }
|
||||
}
|
||||
private string _OrigRTF;
|
||||
public string OrigRTF
|
||||
{
|
||||
get { return _OrigRTF; }
|
||||
set { _OrigRTF = value; }
|
||||
}
|
||||
private Font _FormatFont;
|
||||
public Font FormatFont
|
||||
{
|
||||
get
|
||||
{
|
||||
_MyItemInfo = value;
|
||||
if (value != null)
|
||||
if (_FormatFont == null)
|
||||
{
|
||||
RTBFillIn(!ViewRTB);
|
||||
SetBackColor();
|
||||
//ViewRTB = MyRTBItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View;
|
||||
Font formatFont = MyItemInfo.GetItemFont().WindowsFont; // OrigDisplayText.TextFont.WindowsFont;
|
||||
if (MyItemInfo.IsTable || MyItemInfo.IsFigure)
|
||||
_FormatFont = formatFont;
|
||||
else
|
||||
{
|
||||
if (VlnSettings.DebugMode || VlnSettings.ProductionMode)
|
||||
_FormatFont = new Font(_MyFontFamily == null ? formatFont.FontFamily : _MyFontFamily, formatFont.Size, formatFont.Style);
|
||||
else
|
||||
_FormatFont = new Font("Bookman Old Style", formatFont.Size, formatFont.Style);
|
||||
// TODO: Release Mode
|
||||
//Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format
|
||||
}
|
||||
}
|
||||
return _FormatFont;
|
||||
}
|
||||
}
|
||||
public void SetBackColor()
|
||||
public void RefreshDisplay()
|
||||
{
|
||||
if (MyRTBItem == null || MyRTBItem.MyStepPanel == null) return;
|
||||
if (Focused) // If active Set BackColor to the active color
|
||||
BackColor = MyRTBItem.MyStepPanel.ActiveColor;
|
||||
else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor
|
||||
BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyRTBItem.MyStepPanel.InactiveColor : MyRTBItem.MyStepPanel.AnnotationColor;
|
||||
RefreshDisplay(ActiveMode);
|
||||
}
|
||||
public void HighlightBackColor()
|
||||
// RefreshDisplay is used to update the rtb for an entire Item as defined by MyItemInfo.
|
||||
public void RefreshDisplay(bool activeMode)
|
||||
{
|
||||
// Don't try to highlight if this rtb is used on property pages.
|
||||
if (MyRTBItem == null || MyRTBItem.MyStepPanel == null) return;
|
||||
BackColor = Color.Gray;
|
||||
}
|
||||
private string _origRTF;
|
||||
public void RTBFillIn(bool edit)
|
||||
{
|
||||
if (edit && _MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
||||
{
|
||||
// First get ColR
|
||||
int colR = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
|
||||
// Second get WidS
|
||||
int widS = /* _WidthAdjust + borderWidth + */ MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode);
|
||||
//int wNew = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT);
|
||||
int wNew = 70 + widS + colR * MyItemInfo.ColumnMode;
|
||||
if (wNew > _MyRTBItem.ItemWidth)
|
||||
{
|
||||
_MyRTBItem.ItemWidth = wNew;
|
||||
_MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, wNew);
|
||||
}
|
||||
}
|
||||
ActiveMode = activeMode;
|
||||
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
||||
_InitializingRTB = true;
|
||||
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit, true);
|
||||
DisplayText vlntxt = new DisplayText(MyItemInfo, E_EditPrintMode.Edit, VwMode, !ActiveMode, FieldToEdit, true);
|
||||
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||
//{
|
||||
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||
// if (!ReadOnly && !edit) ReadOnly = true;
|
||||
// return;
|
||||
//}
|
||||
_origDisplayText = vlntxt;
|
||||
Font formatFont = _origDisplayText.TextFont.WindowsFont;
|
||||
if (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)
|
||||
Font = formatFont;
|
||||
else
|
||||
{
|
||||
if (VlnSettings.DebugMode || VlnSettings.ProductionMode)
|
||||
Font = new Font(_MyFontFamily == null ? formatFont.FontFamily : _MyFontFamily, formatFont.Size, formatFont.Style);
|
||||
else
|
||||
Font = new Font("Bookman Old Style", formatFont.Size, formatFont.Style);
|
||||
// TODO: Release Mode
|
||||
//Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format
|
||||
}
|
||||
OrigDisplayText = vlntxt;
|
||||
|
||||
|
||||
// RHM 20101201 - Don't reset the text. Calculate the text and compare it with the existing text in AddRTFText
|
||||
//Text = ""; // Initialize text before add text
|
||||
// IMPORTANT: SetLineSpacing must be set before Links, otherwise it
|
||||
@@ -228,7 +312,7 @@ namespace Volian.Controls.Library
|
||||
//Console.WriteLine("'font',{0}", Font);
|
||||
//if(Text == "")SelectionFont = Font; // Initialize SelectionFont
|
||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
||||
ReadOnly = EpMode == E_EditPrintMode.Print || VwMode == E_ViewMode.View || edit == false;
|
||||
ReadOnly = VwMode == E_ViewMode.View || ActiveMode == false;
|
||||
AddRtfText(vlntxt.StartText);
|
||||
//AddRtfStyles();
|
||||
// set readonly based on initial modes, however, these may change if
|
||||
@@ -252,23 +336,14 @@ namespace Volian.Controls.Library
|
||||
// the text within the RichTextBox.
|
||||
RightMargin = Width > 0 ? Width - 1 : 0;
|
||||
// figure out if needs outlined, depends on table/figure type
|
||||
if (!edit)
|
||||
if (!ActiveMode)
|
||||
{
|
||||
RemoveEventHandlers();
|
||||
if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
||||
{
|
||||
int newwidth = (int)_MyRTBItem.TableWidth(Font, Text, false);
|
||||
if (_MyRTBItem.ItemWidth != newwidth)
|
||||
{
|
||||
_MyRTBItem.ItemWidth = newwidth;
|
||||
_MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, newwidth);
|
||||
|
||||
}
|
||||
}
|
||||
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(false));// View Mode
|
||||
SelectAll();
|
||||
if (SelectionHangingIndent !=0) SelectionHangingIndent = 0;
|
||||
int indchar = 0;
|
||||
string indentToken = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken;
|
||||
string indentToken = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken;
|
||||
if (indentToken == null) indentToken = "\x5";
|
||||
while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0)
|
||||
{
|
||||
@@ -280,17 +355,16 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// if (_MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
||||
// if (MyRTBItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
||||
// {
|
||||
// //_MyRTBItem.ItemWidth = (int)_MyRTBItem.TableWidth(Font, Text,false);
|
||||
// _MyRTBItem.ItemWidth = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT);
|
||||
// //MyRTBItem.ItemWidth = (int)MyRTBItem.TableWidth(Font, Text,false);
|
||||
// MyRTBItem.ItemWidth = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidT);
|
||||
// }
|
||||
//}
|
||||
_origRTF = Rtf;
|
||||
OrigRTF = Rtf;
|
||||
_InitializingRTB = false;
|
||||
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
|
||||
AdjustSizeForContents(!edit); // TODO: this is not quite right yet.
|
||||
if (MyRTBItem != null) MyRTBItem.ChangeBar = MyRTBItem.MyItemInfo.HasChangeBar;
|
||||
|
||||
AdjustSizeForContents(!ActiveMode); // TODO: this is not quite right yet.
|
||||
}
|
||||
private bool _ProcessKeystrokes = true;
|
||||
public bool ProcessKeystrokes
|
||||
@@ -352,7 +426,13 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
public System.Windows.Forms.AutoScaleMode AutoScaleMode;
|
||||
private DisplayText _origDisplayText;
|
||||
private DisplayText _OrigDisplayText;
|
||||
|
||||
public DisplayText OrigDisplayText
|
||||
{
|
||||
get { return _OrigDisplayText; }
|
||||
set { _OrigDisplayText = value; }
|
||||
}
|
||||
private RichTextBox _rtbTemp = new RichTextBox();
|
||||
private string _MyLinkText;
|
||||
public string MyLinkText
|
||||
@@ -365,7 +445,7 @@ namespace Volian.Controls.Library
|
||||
// updates to the info panel were not always occurring when the previous two
|
||||
// lines were active
|
||||
_MyLinkText = value;
|
||||
OnLinkChanged(this, new StepPanelLinkEventArgs(_MyRTBItem, _MyLinkText));
|
||||
OnLinkChanged(this, new StepPanelLinkEventArgs(_MyLinkText));
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -387,7 +467,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
_MyRTBItem.MyStepPanel.MouseWheel(e);
|
||||
OnDoMouseWheel(this, e);
|
||||
//MyRTBItem.MyStepPanel.MouseWheel(e);
|
||||
//base.OnMouseWheel(e);
|
||||
}
|
||||
private void RemoveEventHandlers()
|
||||
@@ -435,7 +516,7 @@ namespace Volian.Controls.Library
|
||||
try
|
||||
{
|
||||
//Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName);
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu();
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs(null));
|
||||
sublocation = 1;
|
||||
_ContextMenuStripChanged = true;
|
||||
sublocation = 2;
|
||||
@@ -465,10 +546,10 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MouseDown = false;
|
||||
}
|
||||
void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
SaveConfig();
|
||||
}
|
||||
//void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
//{
|
||||
// SaveConfig();
|
||||
//}
|
||||
private void StepRTB_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
@@ -486,8 +567,8 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MouseDown = true;
|
||||
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
|
||||
if (!_ContextMenuStripChanged && this.MyRTBItem != null)
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu();
|
||||
if (!_ContextMenuStripChanged)
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("OpenContextMenu"));
|
||||
_ContextMenuStripChanged = false;
|
||||
CorrectSelectionAtEndOfLine();
|
||||
}
|
||||
@@ -505,22 +586,24 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region ApplicationSupport
|
||||
public void ToggleEditView()
|
||||
{
|
||||
SaveText();
|
||||
//ItemInfo tmp = MyItemInfo;
|
||||
//MyItemInfo = null;
|
||||
ReadOnly = !ReadOnly;
|
||||
EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
|
||||
VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit;
|
||||
ViewRTB = ReadOnly;
|
||||
Clear();
|
||||
RTBFillIn(!ViewRTB);
|
||||
//MyItemInfo = tmp;
|
||||
SelectionStart = 0;
|
||||
SelectionLength = 0;
|
||||
OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit));
|
||||
}
|
||||
// Used in StepTabRibbon:
|
||||
//public void ToggleEditView(E_ViewMode vwMode)
|
||||
//{
|
||||
// OnDoSaveContents(this, new EventArgs()); // SaveText();
|
||||
// //ItemInfo tmp = MyItemInfo;
|
||||
// //MyItemInfo = null;
|
||||
// //ReadOnly = !ReadOnly;
|
||||
// //EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
|
||||
// VwMode = vwMode;
|
||||
// ReadOnly = VwMode == E_ViewMode.View;
|
||||
// ViewRTB = ReadOnly;
|
||||
// Clear();
|
||||
// RefreshDisplay(!ViewRTB);
|
||||
// //MyItemInfo = tmp;
|
||||
// SelectionStart = 0;
|
||||
// SelectionLength = 0;
|
||||
// //OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit));
|
||||
//}
|
||||
public void InsertRO(string value, string link)
|
||||
{
|
||||
AddRtfLink(value, link);
|
||||
@@ -541,9 +624,8 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
AddSymbol(symbol);
|
||||
}
|
||||
public void InsertIndent()
|
||||
public void InsertIndent(string indentToken)
|
||||
{
|
||||
string indentToken = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken;
|
||||
if (indentToken == null) indentToken = "\x5";
|
||||
AddText(indentToken);
|
||||
}
|
||||
@@ -675,44 +757,6 @@ namespace Volian.Controls.Library
|
||||
SelectionLength = olen;
|
||||
}
|
||||
#endregion
|
||||
#region SaveData
|
||||
public void SaveText(bool force)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
if (ViewRTB) return;
|
||||
if (!force && !_IsDirty && Text.Contains("(Resolved Transition Text)") == false) return;
|
||||
bool success = _origDisplayText.Save((RichTextBox)this);
|
||||
if (success)
|
||||
{
|
||||
FindAllLinks();
|
||||
_origRTF = Rtf;
|
||||
ClearUndo();
|
||||
}
|
||||
}
|
||||
public void SaveText()
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
if (ViewRTB) return;
|
||||
if (!_IsDirty && Text.Contains("(Resolved Transition Text)") == false) return;
|
||||
bool success = _origDisplayText.Save((RichTextBox)this);
|
||||
if (success)
|
||||
{
|
||||
FindAllLinks();
|
||||
_origRTF = Rtf;
|
||||
ClearUndo();
|
||||
}
|
||||
}
|
||||
public void SaveConfig()
|
||||
{
|
||||
if (!_MyItemInfo.MyConfig.IsDirty) return;
|
||||
using (Item itm = _MyItemInfo.Get())
|
||||
{
|
||||
itm.MyContent.Config = _MyItemInfo.MyConfig.ToString();
|
||||
itm.Save();
|
||||
}
|
||||
_MyItemInfo.MyConfig.IsDirty = false;
|
||||
}
|
||||
#endregion
|
||||
#region AddRtfTextAndStyles
|
||||
private string _LastRtf = "";
|
||||
private bool _lastReadOnly = false;
|
||||
@@ -722,7 +766,7 @@ namespace Volian.Controls.Library
|
||||
//if(MyItemInfo.ItemID==10256)
|
||||
// Volian.Base.Library.vlnStackTrace.ShowStackLocal("ItemID:{0}", MyItemInfo.ItemID.ToString());
|
||||
StringBuilder selectedRtfSB = new StringBuilder();
|
||||
AddFontTable(selectedRtfSB);
|
||||
AddFontTable(selectedRtfSB, FormatFont, FontIsFixed(FormatFont));
|
||||
_RtfPrefix = selectedRtfSB.ToString();
|
||||
selectedRtfSB.Append(txt);
|
||||
string newRtf = selectedRtfSB.ToString() + "}";
|
||||
@@ -737,40 +781,40 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
FindAllLinks();
|
||||
}
|
||||
private void AddFontTable(StringBuilder selectedRtfSB)
|
||||
private static void AddFontTable(StringBuilder selectedRtfSB, Font myFont, bool isFixed)
|
||||
{
|
||||
StringBuilder sbbeg = new StringBuilder();
|
||||
StringBuilder sbend = new StringBuilder();
|
||||
if (Font.Bold)
|
||||
if (myFont.Bold)
|
||||
{
|
||||
sbbeg.Append(@"\b");
|
||||
sbend.Append(@"\b0");
|
||||
}
|
||||
if (Font.Underline)
|
||||
if (myFont.Underline)
|
||||
{
|
||||
sbbeg.Append(@"\ul");
|
||||
sbend.Insert(0, @"\ulnone");
|
||||
}
|
||||
if (Font.Italic)
|
||||
if (myFont.Italic)
|
||||
{
|
||||
sbbeg.Append(@"\i");
|
||||
sbend.Insert(0, @"\i0");
|
||||
}
|
||||
selectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}";
|
||||
if (!FontIsFixed())
|
||||
selectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + myFont.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}";
|
||||
if (!isFixed)
|
||||
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}");
|
||||
else
|
||||
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}");
|
||||
selectedRtfSB.Append("\r\n");
|
||||
// use styles to construct rtf commands to insert into next line (where \b, etc is)
|
||||
selectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
|
||||
selectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(myFont.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}";
|
||||
}
|
||||
|
||||
private bool FontIsFixed()
|
||||
private bool FontIsFixed(Font myFont)
|
||||
{
|
||||
Graphics grph = Graphics.FromHwnd(this.Handle);
|
||||
SizeF sfW = grph.MeasureString("W", this.Font);
|
||||
SizeF sfE = grph.MeasureString("!", this.Font);
|
||||
SizeF sfW = grph.MeasureString("W", myFont);
|
||||
SizeF sfE = grph.MeasureString("!", myFont);
|
||||
if (sfW.Width == sfE.Width) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -805,11 +849,11 @@ namespace Volian.Controls.Library
|
||||
// See comments in AddRtf(string str) to explain the font style setting
|
||||
RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(this);
|
||||
int position = SelectionStart;
|
||||
SelectedRtf = _RtfPrefix + @"\f1\fs" + this.Font.SizeInPoints * 2 + @" " + str + @"}";
|
||||
SelectedRtf = RtfPrefix + str + @"}";
|
||||
Select(position, 1);
|
||||
RTBAPI.SetFontStyle(this, fs);
|
||||
Select(position + 1, 0);
|
||||
SelectionFont = _origDisplayText.TextFont.WindowsFont;
|
||||
SelectionFont = MyItemInfo.GetItemFont().WindowsFont;
|
||||
}
|
||||
private string GetAddSymbolText(string symtxt)
|
||||
{
|
||||
@@ -828,8 +872,8 @@ namespace Volian.Controls.Library
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(@"{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}");
|
||||
if (!FontIsFixed())
|
||||
sb.Append(@"{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}");
|
||||
if (!FontIsFixed(this.Font))
|
||||
sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}");
|
||||
else
|
||||
sb.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}");
|
||||
@@ -850,14 +894,11 @@ namespace Volian.Controls.Library
|
||||
string fonttab = FontTable;
|
||||
string fontsize = FontSize;
|
||||
this.DetectUrls = false;
|
||||
//if (SelectionLength > 0) DeleteCurrentSelection(null);
|
||||
if (SelectionLength > 0)HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), null);
|
||||
int position = SelectionStart;
|
||||
SelectionLength = 0;
|
||||
//Console.WriteLine(this.Rtf);
|
||||
linkValue = linkValue.Replace("\\u8209?", "\\f1\\u8209?\\f0 ");
|
||||
SelectedRtf = @"{\rtf1\ansi"+FontTable+@"{\colortbl ;\red255\green0\blue0;}\v"+FontSize+@" <START]\v0\cf1 " + linkValue + @"\cf0\v " + linkUrl + @"[END>\v0 }";
|
||||
//Console.WriteLine(this.Rtf);
|
||||
this.SelectionLength = 0;
|
||||
this.SelectionStart = position;
|
||||
FindAllLinks();
|
||||
@@ -873,7 +914,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void AddRtfStyles()
|
||||
{
|
||||
if ((_origDisplayText.TextFont.Style & E_Style.Bold) > 0)
|
||||
if ((OrigDisplayText.TextFont.Style & E_Style.Bold) > 0)
|
||||
{
|
||||
this.SelectAll();
|
||||
RTBAPI.ToggleBold(true, this, RTBAPI.RTBSelection.SCF_SELECTION);
|
||||
@@ -884,7 +925,7 @@ namespace Volian.Controls.Library
|
||||
// apply the underlining to the selected text, because if the
|
||||
// the underlining was applied to RTBAPI.RTBSelection.SCF_ALL
|
||||
// the Links were changed so that they were no longer hidden.
|
||||
if ((_origDisplayText.TextFont.Style & E_Style.Underline) > 0)
|
||||
if ((OrigDisplayText.TextFont.Style & E_Style.Underline) > 0)
|
||||
// RTBAPI.ToggleUnderline(true, this, RTBAPI.RTBSelection.SCF_ALL);
|
||||
{
|
||||
this.SelectAll();
|
||||
@@ -896,7 +937,7 @@ namespace Volian.Controls.Library
|
||||
// apply the italics to the selected text, because if the
|
||||
// the italics was applied to RTBAPI.RTBSelection.SCF_ALL
|
||||
// the Links were changed so that they were no longer hidden.
|
||||
if ((_origDisplayText.TextFont.Style & E_Style.Italics) > 0)
|
||||
if ((OrigDisplayText.TextFont.Style & E_Style.Italics) > 0)
|
||||
// RTBAPI.ToggleItalic(true, this, RTBAPI.RTBSelection.SCF_ALL);
|
||||
{
|
||||
this.SelectAll();
|
||||
@@ -1027,22 +1068,22 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region ColorSupport - Not currently used.
|
||||
private void SetBackGroundColor(ItemInfo itemInfo)
|
||||
{
|
||||
string backcolor = null;
|
||||
int type = (int)itemInfo.MyContent.Type;
|
||||
FormatInfo formatinfo = itemInfo.ActiveFormat;
|
||||
if (type == (int)E_FromType.Procedure)
|
||||
backcolor = formatinfo.PlantFormat.FormatData.ProcData.BackColor;
|
||||
else if (type == (int)E_FromType.Section)
|
||||
backcolor = formatinfo.PlantFormat.FormatData.SectData.BackColor;
|
||||
else
|
||||
{
|
||||
int typindx = (int)itemInfo.MyContent.Type - 20000; // what to do for other types rather than steps
|
||||
backcolor = formatinfo.PlantFormat.FormatData.StepDataList[typindx].StepLayoutData.BackColor;
|
||||
}
|
||||
BackColor = Color.FromName(backcolor);
|
||||
}
|
||||
//private void SetBackGroundColor(ItemInfo itemInfo)
|
||||
//{
|
||||
// string backcolor = null;
|
||||
// int type = (int)itemInfo.MyContent.Type;
|
||||
// FormatInfo formatinfo = itemInfo.ActiveFormat;
|
||||
// if (type == (int)E_FromType.Procedure)
|
||||
// backcolor = formatinfo.PlantFormat.FormatData.ProcData.BackColor;
|
||||
// else if (type == (int)E_FromType.Section)
|
||||
// backcolor = formatinfo.PlantFormat.FormatData.SectData.BackColor;
|
||||
// else
|
||||
// {
|
||||
// int typindx = (int)itemInfo.MyContent.Type - 20000; // what to do for other types rather than steps
|
||||
// backcolor = formatinfo.PlantFormat.FormatData.StepDataList[typindx].StepLayoutData.BackColor;
|
||||
// }
|
||||
// BackColor = Color.FromName(backcolor);
|
||||
//}
|
||||
#endregion
|
||||
#region EventSupport
|
||||
#region LinkEvents
|
||||
@@ -1093,7 +1134,8 @@ namespace Volian.Controls.Library
|
||||
private bool _HandlingCtrlA = false;
|
||||
private void HandleLocalSelectionChange()
|
||||
{
|
||||
if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this)
|
||||
//if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this)
|
||||
if (OnIsNotCurrentSelection(this, new EventArgs()))
|
||||
return;
|
||||
|
||||
HandleSelectionChange();
|
||||
@@ -1339,9 +1381,10 @@ namespace Volian.Controls.Library
|
||||
public bool WasXDelete = false;
|
||||
private void DeleteCurrentSelection(string keys)
|
||||
{
|
||||
|
||||
DebugPrint("vvvvvvvvvvvvxxxxxxxxxxxx>");
|
||||
DebugSelection("Before X");
|
||||
|
||||
DebugPrint(keys == null ? "NULL" : "NOT NULL");
|
||||
SelectedText = keys==null?"X":keys; // replace text with X
|
||||
WasXDelete = (keys == null);
|
||||
DebugSelection("After X");
|
||||
@@ -1418,53 +1461,50 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (e.Control)
|
||||
{
|
||||
if (this.MyRTBItem != null)
|
||||
if (e.Alt)
|
||||
{
|
||||
if (e.Alt)
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.M:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(sender, e);
|
||||
e.Handled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case Keys.M:
|
||||
OnOpenAnnotations(this, new EventArgs());
|
||||
e.Handled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (e.Shift)
|
||||
}
|
||||
if (e.Shift)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.F:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsFigure");
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.T:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsTable");
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.N:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsNote");
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.C:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsCaution");
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.S:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsSubStps");
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.H:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsHLS");
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.R:
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsRNO");
|
||||
e.Handled = true;
|
||||
break;
|
||||
}
|
||||
case Keys.F:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsFigure"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.T:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsTable"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.N:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsNote"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.C:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsCaution"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.S:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsSubStps"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.H:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsHLS"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.R:
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("InsRNO"));
|
||||
e.Handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1567,11 +1607,8 @@ namespace Volian.Controls.Library
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.Enter:
|
||||
if (this.MyRTBItem != null)
|
||||
{
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnInsPgBrk_Click(sender, e);
|
||||
e.Handled = true;
|
||||
}
|
||||
OnInsertPgBrk(this, new EventArgs());
|
||||
e.Handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1626,7 +1663,7 @@ namespace Volian.Controls.Library
|
||||
// because selection is first character or link without any other selection. Don't
|
||||
// need to write code to handle link at beginning of box in Shift Right code because
|
||||
// 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 len = SelectionLength + newlen;
|
||||
@@ -1658,13 +1695,13 @@ namespace Volian.Controls.Library
|
||||
if (!e.Shift) HandleLocalSelectionChange();
|
||||
// if shift-down & on link at beginning of box - do special processing (regular processing
|
||||
// didn't handle it correctly.
|
||||
if (e.Shift && lastLine > 0 && SelectionStart==0 && _LinkLocations.Count>0 && _LinkLocations[0].Start==7)
|
||||
if (e.Shift && lastLine > 0 && SelectionStart == 0 && _LinkLocations.Count > 0 && _LinkLocations[0].Start == 7)
|
||||
{
|
||||
Point cpos = GetPositionFromCharIndex(SelectionStart);
|
||||
int addon = ClientRectangle.Height / (lastLine + 1);
|
||||
cpos.Y = cpos.Y + addon;
|
||||
int selend = GetCharIndexFromPosition(cpos);
|
||||
Select(7, selend-7);
|
||||
Select(7, selend - 7);
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
@@ -1735,19 +1772,16 @@ namespace Volian.Controls.Library
|
||||
e.Handled = true;
|
||||
break;
|
||||
case Keys.F5:
|
||||
if (this.MyRTBItem != null)
|
||||
if (e.Shift)
|
||||
{
|
||||
if (e.Shift)
|
||||
{
|
||||
e.Handled = true;
|
||||
if (MyRTBItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep == null) return;
|
||||
MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste");
|
||||
}
|
||||
else if (!e.Control && !e.Alt)
|
||||
{
|
||||
e.Handled = true;
|
||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep();
|
||||
}
|
||||
e.Handled = true;
|
||||
if (!OnCheckClipboard(this, new EventArgs())) return; // check if 'clipboard' contains a step.
|
||||
OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));
|
||||
}
|
||||
else if (!e.Control && !e.Alt)
|
||||
{
|
||||
e.Handled = true;
|
||||
OnCopyStep(this, new EventArgs());
|
||||
}
|
||||
break;
|
||||
case Keys.F6:
|
||||
@@ -1755,52 +1789,44 @@ namespace Volian.Controls.Library
|
||||
SendKeys.Send("%H{ESC}");
|
||||
break;
|
||||
case Keys.Tab:
|
||||
e.SuppressKeyPress = true;
|
||||
e.Handled = true;
|
||||
if (MyRTBItem == null)
|
||||
{
|
||||
Form frm = ParentForm(this);
|
||||
if (frm != null)
|
||||
frm.SelectNextControl(this, true, true, true, true);
|
||||
}
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
e.Handled = true;
|
||||
Form frm = ParentForm(this);
|
||||
if (frm != null)
|
||||
frm.SelectNextControl(this, true, true, true, true);
|
||||
break;
|
||||
case Keys.Enter:
|
||||
if (!e.Control && !e.Shift && !e.Alt)
|
||||
{
|
||||
if (MyRTBItem != null && !MyRTBItem.MyItemInfo.IsTablePart)
|
||||
{
|
||||
e.Handled = true;
|
||||
MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey();
|
||||
}
|
||||
OnEnterKeyPressed(sender, e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
private static Form ParentForm(Control ctrl)
|
||||
{
|
||||
while (!(ctrl.Parent is Form)) ctrl = ctrl.Parent;
|
||||
while (!(ctrl.Parent is Form || ctrl.Parent is EditItem))
|
||||
ctrl = ctrl.Parent;
|
||||
return ctrl.Parent as Form;
|
||||
}
|
||||
|
||||
private void StepRTB_HomeEndPressed(KeyEventArgs keyargs)
|
||||
{
|
||||
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
|
||||
// Cursor moves out of box only if control is pressed too - otherwise key is
|
||||
// handled in rtb.
|
||||
//if (keyargs.Control)_MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); // Replaced with an event
|
||||
//if (keyargs.Control)MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); // Replaced with an event
|
||||
if (keyargs.Control) OnCursorKeyPress(this, keyargs);
|
||||
}
|
||||
private void StepRTB_PageKeyPressed(KeyEventArgs keyargs)
|
||||
{
|
||||
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
|
||||
//_MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); Replaced with an event
|
||||
//MyRTBItem.MyStepPanel.StepCursorKeys(this, keyargs); Replaced with an event
|
||||
OnCursorKeyPress(this, keyargs);
|
||||
}
|
||||
public void StepRTB_ArrowPressed(E_ArrowKeys key)
|
||||
{
|
||||
Point cp = PointToClient(Cursor.Position);
|
||||
//_MyRTBItem.MyStepPanel.CursorMovement(this, cp, key); Replaced with an event
|
||||
//MyRTBItem.MyStepPanel.CursorMovement(this, cp, key); Replaced with an event
|
||||
OnCursorMovement(this, new StepRTBCursorMovementEventArgs(cp, key));
|
||||
}
|
||||
private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
||||
@@ -2607,7 +2633,8 @@ namespace Volian.Controls.Library
|
||||
static void tsi_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
|
||||
_ContextMenuStepRTB.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(tsmi.Owner.Location);
|
||||
//_ContextMenuStepRTB.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.OpenContextMenu(tsmi.Owner.Location);
|
||||
_ContextMenuStepRTB.OnOpenContextMenu(sender, new StepRTBLocationEventArgs(tsmi.Owner.Location));
|
||||
}
|
||||
|
||||
// This is our customized Spell Check dialog
|
||||
@@ -2681,6 +2708,32 @@ namespace Volian.Controls.Library
|
||||
_ViewMode = vmode;
|
||||
}
|
||||
}
|
||||
public partial class StepRTBMenuEventArgs
|
||||
{
|
||||
private string _MenuGroup;
|
||||
public string MenuGroup
|
||||
{
|
||||
get { return _MenuGroup; }
|
||||
set { _MenuGroup = value; }
|
||||
}
|
||||
public StepRTBMenuEventArgs(string menuGroup)
|
||||
{
|
||||
_MenuGroup = menuGroup;
|
||||
}
|
||||
}
|
||||
public partial class StepRTBTableWidthEventArgs
|
||||
{
|
||||
bool _EditMode;
|
||||
public bool EditMode
|
||||
{
|
||||
get { return _EditMode; }
|
||||
set { _EditMode = value; }
|
||||
}
|
||||
public StepRTBTableWidthEventArgs(bool editMode)
|
||||
{
|
||||
_EditMode = editMode;
|
||||
}
|
||||
}
|
||||
public class StepRTBCursorMovementEventArgs
|
||||
{
|
||||
private Point _CursorLocation;
|
||||
@@ -2701,6 +2754,19 @@ namespace Volian.Controls.Library
|
||||
_Key = key;
|
||||
}
|
||||
}
|
||||
public class StepRTBLocationEventArgs:EventArgs
|
||||
{
|
||||
private Point _Location;
|
||||
public Point Location
|
||||
{
|
||||
get { return _Location; }
|
||||
set { _Location = value; }
|
||||
}
|
||||
public StepRTBLocationEventArgs(Point location)
|
||||
{
|
||||
_Location = location;
|
||||
}
|
||||
}
|
||||
#region LinkLocation Class
|
||||
public class LinkLocation
|
||||
{
|
||||
|
Reference in New Issue
Block a user