This commit is contained in:
parent
989b5979a9
commit
7105a1cfb7
File diff suppressed because it is too large
Load Diff
BIN
PROMS/Volian.Controls.Library/RTBItem.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/RTBItem.designer.cs
generated
Binary file not shown.
@ -19,21 +19,25 @@ namespace Volian.Controls.Library
|
|||||||
/// Procedure Item Info - Top ItemInfo
|
/// Procedure Item Info - Top ItemInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private ItemInfo _MyProcedureItemInfo;
|
private ItemInfo _MyProcedureItemInfo;
|
||||||
|
private E_ViewMode _VwMode = E_ViewMode.Edit;
|
||||||
|
public E_ViewMode VwMode
|
||||||
|
{
|
||||||
|
get { return _VwMode; }
|
||||||
|
set { _VwMode = value; }
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: This is not correct. There should be a dictionary of Section Layouts
|
// TODO: This is not correct. There should be a dictionary of Section Layouts
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lookup Table to convert ItemInfo.ItemID to RTBItem
|
/// Lookup Table to convert ItemInfo.ItemID to EditItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal Dictionary<int, RTBItem> _LookupRTBItems;
|
internal Dictionary<int, EditItem> _LookupEditItems;
|
||||||
public RTBItem FindItem(ItemInfo itemInfo)
|
public EditItem FindItem(ItemInfo itemInfo)
|
||||||
{
|
{
|
||||||
if (itemInfo == null) return null;
|
if (itemInfo == null) return null;
|
||||||
if (!_LookupRTBItems.ContainsKey(itemInfo.ItemID)) return null;
|
if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) return null;
|
||||||
return _LookupRTBItems[itemInfo.ItemID];
|
return _LookupEditItems[itemInfo.ItemID];
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Currently selected RichTextBox
|
|
||||||
/// </summary>
|
|
||||||
private StepRTB _SelectedStepRTB = null;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Currently selected ItemInfo
|
/// Currently selected ItemInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -53,7 +57,7 @@ namespace Volian.Controls.Library
|
|||||||
// Whether panel is in view or edit mode. Toggled from steprtb
|
// Whether panel is in view or edit mode. Toggled from steprtb
|
||||||
// or set based on approval/multi-user (these two will be done
|
// or set based on approval/multi-user (these two will be done
|
||||||
// later.
|
// later.
|
||||||
public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
|
//public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
|
||||||
internal string _LastAdjust="";
|
internal string _LastAdjust="";
|
||||||
private bool _ShowLines = true;
|
private bool _ShowLines = true;
|
||||||
private Graphics _MyGraphics = null;
|
private Graphics _MyGraphics = null;
|
||||||
@ -61,7 +65,7 @@ namespace Volian.Controls.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Item Events
|
#region Item Events
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the user clicks tab of a RTBItem
|
/// Occurs when the user clicks tab of a EditItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event StepPanelEvent ItemClick;
|
public event StepPanelEvent ItemClick;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -75,7 +79,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
private bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected.
|
private bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected.
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when the selected RTBItem changes
|
/// Occurs when the selected EditItem changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ItemSelectedChangedEvent ItemSelectedChanged;
|
public event ItemSelectedChangedEvent ItemSelectedChanged;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -101,16 +105,16 @@ namespace Volian.Controls.Library
|
|||||||
internal void OnAttachmentClicked(object sender, StepPanelAttachmentEventArgs args)
|
internal void OnAttachmentClicked(object sender, StepPanelAttachmentEventArgs args)
|
||||||
{
|
{
|
||||||
if (AttachmentClicked != null) AttachmentClicked(sender, args);
|
if (AttachmentClicked != null) AttachmentClicked(sender, args);
|
||||||
else MessageBox.Show(args.MyRTBItem.MyItemInfo.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
else MessageBox.Show(args.MyEditItem.MyItemInfo.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edit/View mode change
|
// Edit/View mode change
|
||||||
public event StepPanelModeChangeEvent ModeChange;
|
//public event StepPanelModeChangeEvent ModeChange;
|
||||||
internal void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
|
//internal void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
|
||||||
{
|
//{
|
||||||
PanelViewEditMode = args.ViewMode;
|
// PanelViewEditMode = args.ViewMode;
|
||||||
ModeChange(sender, args);
|
// ModeChange(sender, args);
|
||||||
}
|
//}
|
||||||
// various selections from steptabribbon that need to filter up to frmveproms
|
// various selections from steptabribbon that need to filter up to frmveproms
|
||||||
// such as 'global search', 'bookmarks'
|
// such as 'global search', 'bookmarks'
|
||||||
public event StepPanelTabDisplayEvent TabDisplay;
|
public event StepPanelTabDisplayEvent TabDisplay;
|
||||||
@ -262,10 +266,10 @@ namespace Volian.Controls.Library
|
|||||||
InactiveColor = PanelColor = BackColor;
|
InactiveColor = PanelColor = BackColor;
|
||||||
foreach (Control ctrl in Controls)
|
foreach (Control ctrl in Controls)
|
||||||
{
|
{
|
||||||
if (ctrl.GetType() == typeof(RTBItem))
|
if (ctrl is EditItem)
|
||||||
{
|
{
|
||||||
RTBItem rtb = (RTBItem)ctrl;
|
EditItem ei = (EditItem)ctrl;
|
||||||
rtb.BackColor = BackColor;
|
ei.BackColor = BackColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -278,11 +282,11 @@ namespace Volian.Controls.Library
|
|||||||
private void ExpandAsNeeded(ItemInfo myItemInfo)
|
private void ExpandAsNeeded(ItemInfo myItemInfo)
|
||||||
{
|
{
|
||||||
int id = myItemInfo.ItemID;
|
int id = myItemInfo.ItemID;
|
||||||
if (!_LookupRTBItems.ContainsKey(id)) // If the item is not currently displayed
|
if (!_LookupEditItems.ContainsKey(id)) // If the item is not currently displayed
|
||||||
ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); // Expand it's parent
|
ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); // Expand it's parent
|
||||||
if (_LookupRTBItems.ContainsKey(id)) // Expanding Parent should have added it to _LookupRTBItems
|
if (_LookupEditItems.ContainsKey(id)) // Expanding Parent should have added it to _LookupEditItems
|
||||||
{
|
{
|
||||||
RTBItem itm = _LookupRTBItems[id];
|
EditItem itm = _LookupEditItems[id];
|
||||||
ItemInfo ii = myItemInfo.ActiveParent as ItemInfo;
|
ItemInfo ii = myItemInfo.ActiveParent as ItemInfo;
|
||||||
if (itm.Visible == false && ii != null)
|
if (itm.Visible == false && ii != null)
|
||||||
ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent);
|
ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent);
|
||||||
@ -309,10 +313,10 @@ namespace Volian.Controls.Library
|
|||||||
//this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);
|
//this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);
|
||||||
//// TIMING: DisplayItem.TimeIt("pMyItem Scroll");
|
//// TIMING: DisplayItem.TimeIt("pMyItem Scroll");
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
_LookupRTBItems = new Dictionary<int, RTBItem>();
|
_LookupEditItems = new Dictionary<int, EditItem>();
|
||||||
//// TIMING: DisplayItem.TimeIt("pMyItem Clear");
|
//// TIMING: DisplayItem.TimeIt("pMyItem Clear");
|
||||||
//SuspendLayout();
|
//SuspendLayout();
|
||||||
RTBItem tmpRTBItem = new RTBItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false);
|
new RTBItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false);
|
||||||
//ResumeLayout();
|
//ResumeLayout();
|
||||||
//// TIMING: DisplayItem.TimeIt("pMyItem End");
|
//// TIMING: DisplayItem.TimeIt("pMyItem End");
|
||||||
}
|
}
|
||||||
@ -328,95 +332,14 @@ namespace Volian.Controls.Library
|
|||||||
ExpandAsNeeded(SelectedItemInfo);
|
ExpandAsNeeded(SelectedItemInfo);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get or Set currently selected RichTextBox (StepRTB)
|
/// Currently selected StepRTB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StepRTB SelectedStepRTB
|
//private StepRTB _SelectedStepRTB = null;
|
||||||
{
|
//public StepRTB SelectedStepRTB
|
||||||
get { return _SelectedStepRTB; }
|
//{
|
||||||
set
|
// get { return _SelectedStepRTB; }
|
||||||
{
|
// set { _SelectedStepRTB=value;}
|
||||||
StepRTB lastRTB = _SelectedStepRTB;
|
//}
|
||||||
if(value != null)
|
|
||||||
value.BackColor = ActiveColor; // Set the active color
|
|
||||||
if (lastRTB == value) return; // Same - No Change
|
|
||||||
//RHM ToDo: Why doesn't it have focus for copy Step/Paste
|
|
||||||
if (value != null) value.Focus();
|
|
||||||
if (lastRTB != null && lastRTB.BeingDisposed == false)
|
|
||||||
{
|
|
||||||
//_SelectedStepRTB.BackColor = InactiveColor;
|
|
||||||
//lastRTB.SetBackColor();
|
|
||||||
bool shouldDelete = !lastRTB.MyRTBItem.BeingRemoved && lastRTB.Text.Length == 0;
|
|
||||||
if (shouldDelete)
|
|
||||||
{
|
|
||||||
if (lastRTB.MyRTBItem.HasChildren)
|
|
||||||
{
|
|
||||||
if (value != null && value.MyItemInfo.HasAncestor(lastRTB.MyItemInfo))
|
|
||||||
{
|
|
||||||
shouldDelete = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DialogResult result = MessageBox.Show("This step does not have text but has substeps. Do you want to delete it and its substeps?", "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
|
||||||
if (result == DialogResult.No) shouldDelete = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (shouldDelete)
|
|
||||||
{
|
|
||||||
float oldTop = lastRTB.MyRTBItem.Top;
|
|
||||||
RTBItem newFocus = lastRTB.MyRTBItem.DeleteItem();
|
|
||||||
float newTop = newFocus.Top;
|
|
||||||
lastRTB.MyRTBItem.Dispose();
|
|
||||||
newFocus.SetAllTabs();
|
|
||||||
// If the step being deleted appears above the step to recieve focus, find another step
|
|
||||||
// to use so that the steps are positioned properly (vertically)
|
|
||||||
if (oldTop < newTop)
|
|
||||||
{
|
|
||||||
if (newFocus.MyParentRTBItem != null)
|
|
||||||
{
|
|
||||||
if (newFocus.Top > newFocus.MyParentRTBItem.Top)
|
|
||||||
newFocus.MyParentRTBItem.AdjustLocation();
|
|
||||||
else if (newFocus.MyParentRTBItem.MyPreviousRTBItem != null &&
|
|
||||||
newFocus.Top > newFocus.MyParentRTBItem.MyPreviousRTBItem.Top)
|
|
||||||
newFocus.MyParentRTBItem.MyPreviousRTBItem.AdjustLocation();
|
|
||||||
else if (newFocus.MyParentRTBItem.MyParentRTBItem != null &&
|
|
||||||
newFocus.Top > newFocus.MyParentRTBItem.MyParentRTBItem.Top)
|
|
||||||
newFocus.MyParentRTBItem.MyParentRTBItem.AdjustLocation();
|
|
||||||
else
|
|
||||||
newFocus.AdjustLocation();
|
|
||||||
}
|
|
||||||
else if (newFocus.MyPreviousRTBItem != null)
|
|
||||||
newFocus.MyPreviousRTBItem.AdjustLocation();
|
|
||||||
else
|
|
||||||
newFocus.AdjustLocation();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
newFocus.AdjustLocation();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lastRTB.SaveText(); // Save any changes to the text
|
|
||||||
lastRTB.SaveConfig(); // This may be redundant
|
|
||||||
//int selst = _SelectedStepRTB.SelectionStart;
|
|
||||||
lastRTB.RTBFillIn(false);
|
|
||||||
//_SelectedStepRTB.SetSelection(selst, 0);
|
|
||||||
//_SelectedStepRTB.SelectionStart=selst;
|
|
||||||
lastRTB.ViewRTB = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_SelectedStepRTB = value;
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
_SelectedStepRTB.ViewRTB = PanelViewEditMode == E_ViewMode.View;
|
|
||||||
_SelectedStepRTB.RTBFillIn(PanelViewEditMode != E_ViewMode.View);
|
|
||||||
if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID)
|
|
||||||
SelectedItemInfo = value.MyItemInfo;
|
|
||||||
}
|
|
||||||
if(lastRTB != null)
|
|
||||||
lastRTB.SetBackColor();
|
|
||||||
//vlnStackTrace.ShowStack("_DisplayRTB = {0}", _DisplayRTB.MyItem.ItemID);// Show StackTrace
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets the SelectedItemInfo
|
/// Gets or Sets the SelectedItemInfo
|
||||||
/// Activates and Expands as necessary
|
/// Activates and Expands as necessary
|
||||||
@ -431,8 +354,8 @@ namespace Volian.Controls.Library
|
|||||||
int id = value.ItemID;
|
int id = value.ItemID;
|
||||||
ExpandAsNeeded(value);
|
ExpandAsNeeded(value);
|
||||||
// reset the entire step panel if the item isn't found.
|
// reset the entire step panel if the item isn't found.
|
||||||
if (!_LookupRTBItems.ContainsKey(id)) Reset();
|
if (!_LookupEditItems.ContainsKey(id)) Reset();
|
||||||
RTBItem itm = _LookupRTBItems[id];
|
EditItem itm = _LookupEditItems[id];
|
||||||
ItemSelectionChangeShown = false;//OnItemSelectedChanged has not run yet.
|
ItemSelectionChangeShown = false;//OnItemSelectedChanged has not run yet.
|
||||||
itm.ItemSelect();
|
itm.ItemSelect();
|
||||||
if (!ItemSelectionChangeShown) OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(itm));
|
if (!ItemSelectionChangeShown) OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(itm));
|
||||||
@ -446,21 +369,100 @@ namespace Volian.Controls.Library
|
|||||||
set { _DisplayItemChanging = value; }
|
set { _DisplayItemChanging = value; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the SelectedRTBItem
|
/// Returns the SelectedEditItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RTBItem SelectedRTBItem
|
private EditItem _SelectedEditItem;
|
||||||
|
public EditItem SelectedEditItem
|
||||||
{
|
{
|
||||||
get { return (_SelectedItemInfo != null) ? _LookupRTBItems[_SelectedItemInfo.ItemID] : null; }
|
get
|
||||||
|
{
|
||||||
|
return _SelectedEditItem;
|
||||||
|
//return (_SelectedItemInfo != null) ? _LookupEditItems[_SelectedItemInfo.ItemID] : null;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
EditItem lastEI = _SelectedEditItem;
|
||||||
|
if (value != null) value.SetActive(); // Set the active color
|
||||||
|
if (lastEI == value) return; // Same - No Change
|
||||||
|
//RHM ToDo: Why doesn't it have focus for copy Step/Paste
|
||||||
|
if (value != null) value.SetFocus();
|
||||||
|
|
||||||
|
if (lastEI != null && lastEI.BeingDisposed == false)
|
||||||
|
{
|
||||||
|
bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty;
|
||||||
|
if (shouldDelete)
|
||||||
|
{
|
||||||
|
if (lastEI.HasChildren)
|
||||||
|
{
|
||||||
|
if (value != null && value.MyItemInfo.HasAncestor(lastEI.MyItemInfo))
|
||||||
|
{
|
||||||
|
shouldDelete = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DialogResult result = MessageBox.Show("This step does not have text but has substeps. Do you want to delete it and its substeps?", "Verify Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
if (result == DialogResult.No) shouldDelete = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shouldDelete)
|
||||||
|
{
|
||||||
|
float oldTop = lastEI.Top;
|
||||||
|
EditItem newFocus = lastEI.DeleteItem();
|
||||||
|
float newTop = newFocus.Top;
|
||||||
|
lastEI.Dispose();
|
||||||
|
newFocus.SetAllTabs();
|
||||||
|
// If the step being deleted appears above the step to recieve focus, find another step
|
||||||
|
// to use so that the steps are positioned properly (vertically)
|
||||||
|
if (oldTop < newTop)
|
||||||
|
{
|
||||||
|
if (newFocus.MyParentEditItem != null)
|
||||||
|
{
|
||||||
|
if (newFocus.Top > newFocus.MyParentEditItem.Top)
|
||||||
|
newFocus.MyParentEditItem.AdjustLocation();
|
||||||
|
else if (newFocus.MyParentEditItem.MyPreviousEditItem != null &&
|
||||||
|
newFocus.Top > newFocus.MyParentEditItem.MyPreviousEditItem.Top)
|
||||||
|
newFocus.MyParentEditItem.MyPreviousEditItem.AdjustLocation();
|
||||||
|
else if (newFocus.MyParentEditItem.MyParentEditItem != null &&
|
||||||
|
newFocus.Top > newFocus.MyParentEditItem.MyParentEditItem.Top)
|
||||||
|
newFocus.MyParentEditItem.MyParentEditItem.AdjustLocation();
|
||||||
|
else
|
||||||
|
newFocus.AdjustLocation();
|
||||||
|
}
|
||||||
|
else if (newFocus.MyPreviousEditItem != null)
|
||||||
|
newFocus.MyPreviousEditItem.AdjustLocation();
|
||||||
|
else
|
||||||
|
newFocus.AdjustLocation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newFocus.AdjustLocation();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastEI.SaveContents();
|
||||||
|
lastEI.RefreshDisplay(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_SelectedEditItem = value;
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
_SelectedEditItem.RefreshDisplay(true);
|
||||||
|
if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID)
|
||||||
|
SelectedItemInfo = value.MyItemInfo;
|
||||||
|
}
|
||||||
|
if (lastEI != null)
|
||||||
|
lastEI.IdentifyMe(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays the selected RTBItem
|
/// Displays the selected EditItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ItemShow()
|
public void ItemShow()
|
||||||
{
|
{
|
||||||
if (_SelectedItemInfo != null && SelectedRTBItem.MyStepRTB.BeingDisposed == false)
|
if (_SelectedItemInfo != null && SelectedEditItem.BeingDisposed == false)
|
||||||
{
|
{
|
||||||
SelectedRTBItem.ItemShow();
|
SelectedEditItem.ItemShow();
|
||||||
OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedRTBItem));
|
OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public new void MouseWheel(MouseEventArgs e)
|
public new void MouseWheel(MouseEventArgs e)
|
||||||
@ -675,18 +677,18 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Output all of the RTBItem controls to the log
|
/// Output all of the EditItem controls to the log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ListControls()
|
private void ListControls()
|
||||||
{
|
{
|
||||||
// Walk through the controls and find the next control for each
|
// Walk through the controls and find the next control for each
|
||||||
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("'Item','Next'");
|
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("'Item','Next'");
|
||||||
foreach (Control control in Controls)
|
foreach (Control control in Controls)
|
||||||
if (control.GetType() == typeof(RTBItem))
|
if (control is EditItem)
|
||||||
{
|
{
|
||||||
RTBItem rtb = (RTBItem)control;
|
EditItem ei = (EditItem)control;
|
||||||
RTBItem nxt = rtb.NextDownRTBItem;
|
EditItem nxt = ei.NextDownEditItem;
|
||||||
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", rtb.MyID, nxt == null ? 0 : nxt.MyID);
|
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", ei.MyID, nxt == null ? 0 : nxt.MyID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -724,7 +726,7 @@ namespace Volian.Controls.Library
|
|||||||
/// <param name="rtb">StepRTB</param>
|
/// <param name="rtb">StepRTB</param>
|
||||||
/// <param name="position">Point</param>
|
/// <param name="position">Point</param>
|
||||||
/// <param name="arrow">E_ArrowKeys</param>
|
/// <param name="arrow">E_ArrowKeys</param>
|
||||||
public void CursorMovement(StepRTB rtb, Point position, E_ArrowKeys arrow)
|
public void CursorMovement(EditItem ei, Point position, E_ArrowKeys arrow)
|
||||||
{
|
{
|
||||||
ItemInfo ii = null;
|
ItemInfo ii = null;
|
||||||
// The following lines are debug to check that the results of moving down and moving up are the same
|
// The following lines are debug to check that the results of moving down and moving up are the same
|
||||||
@ -733,40 +735,40 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
case E_ArrowKeys.Up:
|
case E_ArrowKeys.Up:
|
||||||
case E_ArrowKeys.CtrlUp:
|
case E_ArrowKeys.CtrlUp:
|
||||||
ii = ArrowUp(rtb.MyItemInfo);
|
ii = ArrowUp(ei.MyItemInfo);
|
||||||
// The following lines are debug to check that the results of moving down and moving up are the same
|
// The following lines are debug to check that the results of moving down and moving up are the same
|
||||||
//ix = ArrowDown(ii);
|
//ix = ArrowDown(ii);
|
||||||
//Console.WriteLine("'Up',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
|
//Console.WriteLine("'Up',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
|
||||||
if (ii != null) SelectedStepRTB = _LookupRTBItems[ii.ItemID].MyStepRTB;
|
if (ii != null) SelectedEditItem = _LookupEditItems[ii.ItemID];
|
||||||
break;
|
break;
|
||||||
case E_ArrowKeys.Down:
|
case E_ArrowKeys.Down:
|
||||||
case E_ArrowKeys.CtrlDown:
|
case E_ArrowKeys.CtrlDown:
|
||||||
ii = MoveDown(rtb, ii);
|
ii = MoveDown(ei, ii);
|
||||||
break;
|
break;
|
||||||
case E_ArrowKeys.Right:
|
case E_ArrowKeys.Right:
|
||||||
case E_ArrowKeys.CtrlRight:
|
case E_ArrowKeys.CtrlRight:
|
||||||
if (rtb.MyItemInfo.RNOs != null)
|
if (ei.MyItemInfo.RNOs != null)
|
||||||
SelectedStepRTB = _LookupRTBItems[rtb.MyItemInfo.RNOs[0].ItemID].MyStepRTB;
|
SelectedEditItem = _LookupEditItems[ei.MyItemInfo.RNOs[0].ItemID];
|
||||||
else
|
else
|
||||||
ii = MoveDown(rtb, ii);
|
ii = MoveDown(ei, ii);
|
||||||
break;
|
break;
|
||||||
case E_ArrowKeys.Left:
|
case E_ArrowKeys.Left:
|
||||||
case E_ArrowKeys.CtrlLeft:
|
case E_ArrowKeys.CtrlLeft:
|
||||||
if (!rtb.MyItemInfo.IsProcedure)
|
if (!ei.MyItemInfo.IsProcedure)
|
||||||
SelectedStepRTB = _LookupRTBItems[rtb.MyItemInfo.MyParent.ItemID].MyStepRTB;
|
SelectedEditItem = _LookupEditItems[ei.MyItemInfo.MyParent.ItemID];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemInfo MoveDown(StepRTB rtb, ItemInfo ii)
|
private ItemInfo MoveDown(EditItem ei, ItemInfo ii)
|
||||||
{
|
{
|
||||||
ii = ArrowDown(rtb.MyItemInfo);
|
ii = ArrowDown(ei.MyItemInfo);
|
||||||
// The following lines are debug to check that the results of moving down and moving up are the same
|
// The following lines are debug to check that the results of moving down and moving up are the same
|
||||||
//ix = ArrowUp(ii);
|
//ix = ArrowUp(ii);
|
||||||
//Console.WriteLine("'Down',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
|
//Console.WriteLine("'Down',{0},{1},{2},{3}", rtb.MyItemInfo.ItemID, rtb.MyItemInfo.DBSequence, ii.DBSequence, ix.DBSequence);
|
||||||
if (ii != null) SelectedStepRTB = _LookupRTBItems[ii.ItemID].MyStepRTB;
|
if (ii != null) SelectedEditItem = _LookupEditItems[ii.ItemID];
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
private ItemInfo ArrowUp(ItemInfo ii)
|
private ItemInfo ArrowUp(ItemInfo ii)
|
||||||
@ -831,9 +833,9 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
internal void StepCursorKeys(StepRTB rtb, KeyEventArgs keyargs)
|
internal void StepCursorKeys(EditItem ei, KeyEventArgs keyargs)
|
||||||
{
|
{
|
||||||
ItemInfo ii = rtb.MyItemInfo;
|
ItemInfo ii = ei.MyItemInfo;
|
||||||
if (ii.IsSection || ii.IsProcedure) return;
|
if (ii.IsSection || ii.IsProcedure) return;
|
||||||
while (!ii.IsHigh)
|
while (!ii.IsHigh)
|
||||||
{
|
{
|
||||||
@ -857,7 +859,7 @@ namespace Volian.Controls.Library
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ii == null) return;
|
if (ii == null) return;
|
||||||
SelectedStepRTB = _LookupRTBItems[ii.ItemID].MyStepRTB;
|
SelectedEditItem = _LookupEditItems[ii.ItemID];
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@ -1019,11 +1021,11 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public partial class StepPanelEventArgs
|
public partial class StepPanelEventArgs
|
||||||
{
|
{
|
||||||
private RTBItem _MyRTBItem;
|
private EditItem _MyEditItem;
|
||||||
public RTBItem MyRTBItem
|
public EditItem MyEditItem
|
||||||
{
|
{
|
||||||
get { return _MyRTBItem; }
|
get { return _MyEditItem; }
|
||||||
set { _MyRTBItem = value; }
|
set { _MyEditItem = value; }
|
||||||
}
|
}
|
||||||
private MouseEventArgs _MyMouseEventArgs;
|
private MouseEventArgs _MyMouseEventArgs;
|
||||||
public MouseEventArgs MyMouseEventArgs
|
public MouseEventArgs MyMouseEventArgs
|
||||||
@ -1032,9 +1034,9 @@ namespace Volian.Controls.Library
|
|||||||
set { _MyMouseEventArgs = value; }
|
set { _MyMouseEventArgs = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public StepPanelEventArgs(RTBItem myRTBItem, MouseEventArgs myMouseEventArgs)
|
public StepPanelEventArgs(EditItem myEditItem, MouseEventArgs myMouseEventArgs)
|
||||||
{
|
{
|
||||||
_MyRTBItem = myRTBItem;
|
_MyEditItem = myEditItem;
|
||||||
_MyMouseEventArgs = myMouseEventArgs;
|
_MyMouseEventArgs = myMouseEventArgs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1046,45 +1048,44 @@ namespace Volian.Controls.Library
|
|||||||
get { return _MyItemInfo; }
|
get { return _MyItemInfo; }
|
||||||
set { _MyItemInfo = value; }
|
set { _MyItemInfo = value; }
|
||||||
}
|
}
|
||||||
private RTBItem _MyRTBItem = null;
|
private EditItem _MyEditItem = null;
|
||||||
public RTBItem MyRTBItem
|
public EditItem MyEditItem
|
||||||
{
|
{
|
||||||
get { return _MyRTBItem; }
|
get { return _MyEditItem; }
|
||||||
set { _MyRTBItem = value; }
|
set { _MyEditItem = value; }
|
||||||
}
|
}
|
||||||
public ItemSelectedChangedEventArgs(ItemInfo myItemInfo)
|
public ItemSelectedChangedEventArgs(ItemInfo myItemInfo)
|
||||||
{
|
{
|
||||||
_MyItemInfo = myItemInfo;
|
_MyItemInfo = myItemInfo;
|
||||||
}
|
}
|
||||||
public ItemSelectedChangedEventArgs(RTBItem myRTBItem)
|
public ItemSelectedChangedEventArgs(EditItem myEditItem)
|
||||||
{
|
{
|
||||||
_MyItemInfo = myRTBItem.MyItemInfo;
|
_MyItemInfo = myEditItem.MyItemInfo;
|
||||||
_MyRTBItem = myRTBItem;
|
_MyEditItem = myEditItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public partial class StepPanelAttachmentEventArgs
|
public partial class StepPanelAttachmentEventArgs
|
||||||
{
|
{
|
||||||
private RTBItem _MyRTBItem;
|
private EditItem _MyEditItem;
|
||||||
public RTBItem MyRTBItem
|
public EditItem MyEditItem
|
||||||
{
|
{
|
||||||
get { return _MyRTBItem; }
|
get { return _MyEditItem; }
|
||||||
set { _MyRTBItem = value; }
|
set { _MyEditItem = value; }
|
||||||
}
|
}
|
||||||
public StepPanelAttachmentEventArgs(RTBItem myRTBItem)
|
public StepPanelAttachmentEventArgs(EditItem myEditItem)
|
||||||
{
|
{
|
||||||
_MyRTBItem = myRTBItem;
|
_MyEditItem = myEditItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class StepPanelLinkEventArgs : EventArgs
|
public partial class StepPanelLinkEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private RTBItem _LinkedRTBItem;
|
//private EditItem _LinkedEditItem;
|
||||||
public RTBItem LinkedRTBItem
|
//public EditItem LinkedEditItem
|
||||||
{
|
//{
|
||||||
get { return _LinkedRTBItem; }
|
// get { return _LinkedEditItem; }
|
||||||
//set { _LinkedRTBItem = value; }
|
//}
|
||||||
}
|
|
||||||
private string _LinkInfoText;
|
private string _LinkInfoText;
|
||||||
public string LinkInfoText
|
public string LinkInfoText
|
||||||
{
|
{
|
||||||
@ -1095,9 +1096,9 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
get { return _MyLinkText;}
|
get { return _MyLinkText;}
|
||||||
}
|
}
|
||||||
public StepPanelLinkEventArgs(RTBItem linkedRTBItem, string linkInfoText)
|
public StepPanelLinkEventArgs(string linkInfoText)
|
||||||
{
|
{
|
||||||
_LinkedRTBItem = linkedRTBItem;
|
//_LinkedEditItem = linkedEditItem;
|
||||||
_LinkInfoText = linkInfoText;
|
_LinkInfoText = linkInfoText;
|
||||||
_MyLinkText = new LinkText(_LinkInfoText);
|
_MyLinkText = new LinkText(_LinkInfoText);
|
||||||
//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText);
|
//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText);
|
||||||
|
@ -15,11 +15,11 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
SelectedStepRTB = null; // Save Changes
|
SelectedEditItem = null; // Save Changes
|
||||||
foreach (RTBItem RTBItem in _LookupRTBItems.Values)
|
foreach (EditItem EditItem in _LookupEditItems.Values)
|
||||||
{
|
{
|
||||||
RTBItem.MyItemInfo.ResetParts();
|
EditItem.MyItemInfo.ResetParts();
|
||||||
RTBItem.MyItemInfo.MyContent.RefreshContentParts();
|
EditItem.MyItemInfo.MyContent.RefreshContentParts();
|
||||||
}
|
}
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,82 @@ namespace Volian.Controls.Library
|
|||||||
public delegate void StepRTBCursorKeysEvent(object sender, KeyEventArgs args);
|
public delegate void StepRTBCursorKeysEvent(object sender, KeyEventArgs args);
|
||||||
public delegate void StepRTBCursorMovementEvent(object sender, StepRTBCursorMovementEventArgs args);
|
public delegate void StepRTBCursorMovementEvent(object sender, StepRTBCursorMovementEventArgs args);
|
||||||
public delegate void StepRTBModeChangeEvent(object sender, StepRTBModeChangeEventArgs 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 delegate void StepRTBMouseWheelEvent(object sender, MouseEventArgs args);
|
||||||
public partial class StepRTB : RichTextBox , IStepRTB
|
public partial class StepRTB : RichTextBox // , IStepRTB
|
||||||
{
|
{
|
||||||
#region Events
|
#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;
|
public event StepRTBEvent RTBSelectionChanged;
|
||||||
private void OnRTBSelectionChanged(object sender, EventArgs args)
|
private void OnRTBSelectionChanged(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
@ -46,13 +118,13 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (CursorMovement != null) CursorMovement(sender, args);
|
if (CursorMovement != null) CursorMovement(sender, args);
|
||||||
}
|
}
|
||||||
public event StepRTBModeChangeEvent ModeChange;
|
//public event StepRTBModeChangeEvent ModeChange;
|
||||||
private void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
|
//private void OnModeChange(object sender, StepRTBModeChangeEventArgs args)
|
||||||
{
|
//{
|
||||||
//_MyModeChangeEventArgs = args;
|
// //_MyModeChangeEventArgs = args;
|
||||||
if (ModeChange != null) ModeChange(sender, args);
|
// if (ModeChange != null) ModeChange(sender, args);
|
||||||
else MessageBox.Show("StepRTB - no mode change defined");
|
// else MessageBox.Show("StepRTB - no mode change defined");
|
||||||
}
|
//}
|
||||||
//public event StepRTBMouseWheelEvent MouseWheel;
|
//public event StepRTBMouseWheelEvent MouseWheel;
|
||||||
//private void OnMouseWheel(object sender, MouseEventArgs args)
|
//private void OnMouseWheel(object sender, MouseEventArgs args)
|
||||||
//{
|
//{
|
||||||
@ -69,6 +141,19 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Properties and Variables
|
#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;
|
private static FontFamily _MyFontFamily = null;
|
||||||
public static FontFamily MyFontFamily
|
public static FontFamily MyFontFamily
|
||||||
{
|
{
|
||||||
@ -103,15 +188,15 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
get
|
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:
|
// August 5, 2009 - KBR & RHM:
|
||||||
// Insert/Overwrite will be developed later if needed. various issues
|
// Insert/Overwrite will be developed later if needed. various issues
|
||||||
// were found during initial development that made its scope larger than
|
// were found during initial development that made its scope larger than
|
||||||
@ -124,9 +209,9 @@ namespace Volian.Controls.Library
|
|||||||
// private bool _OverWrite;
|
// private bool _OverWrite;
|
||||||
// _IsDirty compares the original rtf to the current rtf from the
|
// _IsDirty compares the original rtf to the current rtf from the
|
||||||
// richtextbox to see if a change was made.
|
// 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 bool _InitializingRTB;
|
||||||
private IContainer _Container = null;
|
private IContainer _Container = null;
|
||||||
@ -136,12 +221,14 @@ namespace Volian.Controls.Library
|
|||||||
get { if (_MyClassName == string.Empty)_MyClassName = CreateParams.ClassName; return _MyClassName; }
|
get { if (_MyClassName == string.Empty)_MyClassName = CreateParams.ClassName; return _MyClassName; }
|
||||||
set { _MyClassName = value; }
|
set { _MyClassName = value; }
|
||||||
}
|
}
|
||||||
private E_EditPrintMode _epMode = E_EditPrintMode.Edit;
|
//private E_EditPrintMode _epMode = E_EditPrintMode.Edit;
|
||||||
public E_EditPrintMode EpMode
|
//public E_EditPrintMode EpMode
|
||||||
{
|
//{
|
||||||
get { return _epMode; }
|
// get { return _epMode; }
|
||||||
set { _epMode = value; }
|
// set {
|
||||||
}
|
// if (value == E_EditPrintMode.Print) Console.WriteLine("");
|
||||||
|
// _epMode = value; }
|
||||||
|
//}
|
||||||
private E_ViewMode _vwMode = E_ViewMode.Edit;
|
private E_ViewMode _vwMode = E_ViewMode.Edit;
|
||||||
public E_ViewMode VwMode
|
public E_ViewMode VwMode
|
||||||
{
|
{
|
||||||
@ -151,76 +238,73 @@ namespace Volian.Controls.Library
|
|||||||
private VE_Font _MyStyleFont;
|
private VE_Font _MyStyleFont;
|
||||||
public 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;
|
private ItemInfo _MyItemInfo;
|
||||||
public ItemInfo MyItemInfo
|
public ItemInfo MyItemInfo
|
||||||
{
|
{
|
||||||
get { return _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 (_FormatFont == null)
|
||||||
if (value != null)
|
|
||||||
{
|
{
|
||||||
RTBFillIn(!ViewRTB);
|
Font formatFont = MyItemInfo.GetItemFont().WindowsFont; // OrigDisplayText.TextFont.WindowsFont;
|
||||||
SetBackColor();
|
if (MyItemInfo.IsTable || MyItemInfo.IsFigure)
|
||||||
//ViewRTB = MyRTBItem.MyStepPanel.PanelViewEditMode == E_ViewMode.View;
|
_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;
|
RefreshDisplay(ActiveMode);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
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.
|
ActiveMode = activeMode;
|
||||||
if (MyRTBItem == null || MyRTBItem.MyStepPanel == null) return;
|
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_InitializingRTB = 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)
|
//if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
|
||||||
//{
|
//{
|
||||||
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
// ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
|
||||||
// if (!ReadOnly && !edit) ReadOnly = true;
|
// if (!ReadOnly && !edit) ReadOnly = true;
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
_origDisplayText = vlntxt;
|
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
|
|
||||||
}
|
|
||||||
// RHM 20101201 - Don't reset the text. Calculate the text and compare it with the existing text in AddRTFText
|
// 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
|
//Text = ""; // Initialize text before add text
|
||||||
// IMPORTANT: SetLineSpacing must be set before Links, otherwise it
|
// IMPORTANT: SetLineSpacing must be set before Links, otherwise it
|
||||||
@ -228,7 +312,7 @@ namespace Volian.Controls.Library
|
|||||||
//Console.WriteLine("'font',{0}", Font);
|
//Console.WriteLine("'font',{0}", Font);
|
||||||
//if(Text == "")SelectionFont = Font; // Initialize SelectionFont
|
//if(Text == "")SelectionFont = Font; // Initialize SelectionFont
|
||||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
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);
|
AddRtfText(vlntxt.StartText);
|
||||||
//AddRtfStyles();
|
//AddRtfStyles();
|
||||||
// set readonly based on initial modes, however, these may change if
|
// set readonly based on initial modes, however, these may change if
|
||||||
@ -252,23 +336,14 @@ namespace Volian.Controls.Library
|
|||||||
// the text within the RichTextBox.
|
// the text within the RichTextBox.
|
||||||
RightMargin = Width > 0 ? Width - 1 : 0;
|
RightMargin = Width > 0 ? Width - 1 : 0;
|
||||||
// figure out if needs outlined, depends on table/figure type
|
// figure out if needs outlined, depends on table/figure type
|
||||||
if (!edit)
|
if (!ActiveMode)
|
||||||
{
|
{
|
||||||
RemoveEventHandlers();
|
RemoveEventHandlers();
|
||||||
if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
|
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(false));// View Mode
|
||||||
{
|
|
||||||
int newwidth = (int)_MyRTBItem.TableWidth(Font, Text, false);
|
|
||||||
if (_MyRTBItem.ItemWidth != newwidth)
|
|
||||||
{
|
|
||||||
_MyRTBItem.ItemWidth = newwidth;
|
|
||||||
_MyRTBItem.ItemLocation = _MyRTBItem.TableLocation(_MyRTBItem.MyParentRTBItem, _MyRTBItem.MyStepSectionLayoutData, newwidth);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SelectAll();
|
SelectAll();
|
||||||
if (SelectionHangingIndent !=0) SelectionHangingIndent = 0;
|
if (SelectionHangingIndent !=0) SelectionHangingIndent = 0;
|
||||||
int indchar = 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";
|
if (indentToken == null) indentToken = "\x5";
|
||||||
while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0)
|
while ((indchar = Find(indentToken, indchar, RichTextBoxFinds.None)) >= 0)
|
||||||
{
|
{
|
||||||
@ -280,17 +355,16 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
//else
|
//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 = (int)MyRTBItem.TableWidth(Font, Text,false);
|
||||||
// _MyRTBItem.ItemWidth = _MyRTBItem.MyStepPanel.ToDisplay(_MyRTBItem.MyStepSectionLayoutData.WidT);
|
// MyRTBItem.ItemWidth = MyRTBItem.MyStepPanel.ToDisplay(MyRTBItem.MyStepSectionLayoutData.WidT);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
_origRTF = Rtf;
|
OrigRTF = Rtf;
|
||||||
_InitializingRTB = false;
|
_InitializingRTB = false;
|
||||||
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
|
|
||||||
AdjustSizeForContents(!edit); // TODO: this is not quite right yet.
|
AdjustSizeForContents(!ActiveMode); // TODO: this is not quite right yet.
|
||||||
if (MyRTBItem != null) MyRTBItem.ChangeBar = MyRTBItem.MyItemInfo.HasChangeBar;
|
|
||||||
}
|
}
|
||||||
private bool _ProcessKeystrokes = true;
|
private bool _ProcessKeystrokes = true;
|
||||||
public bool ProcessKeystrokes
|
public bool ProcessKeystrokes
|
||||||
@ -352,7 +426,13 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public System.Windows.Forms.AutoScaleMode AutoScaleMode;
|
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 RichTextBox _rtbTemp = new RichTextBox();
|
||||||
private string _MyLinkText;
|
private string _MyLinkText;
|
||||||
public 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
|
// updates to the info panel were not always occurring when the previous two
|
||||||
// lines were active
|
// lines were active
|
||||||
_MyLinkText = value;
|
_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)
|
protected override void OnMouseWheel(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
_MyRTBItem.MyStepPanel.MouseWheel(e);
|
OnDoMouseWheel(this, e);
|
||||||
|
//MyRTBItem.MyStepPanel.MouseWheel(e);
|
||||||
//base.OnMouseWheel(e);
|
//base.OnMouseWheel(e);
|
||||||
}
|
}
|
||||||
private void RemoveEventHandlers()
|
private void RemoveEventHandlers()
|
||||||
@ -435,7 +516,7 @@ namespace Volian.Controls.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName);
|
//Console.WriteLine("{0}", ContextMenuStrip.GetType().FullName);
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ClearContextMenu();
|
OnSetMenu(this, new StepRTBMenuEventArgs(null));
|
||||||
sublocation = 1;
|
sublocation = 1;
|
||||||
_ContextMenuStripChanged = true;
|
_ContextMenuStripChanged = true;
|
||||||
sublocation = 2;
|
sublocation = 2;
|
||||||
@ -465,10 +546,10 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_MouseDown = false;
|
_MouseDown = false;
|
||||||
}
|
}
|
||||||
void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
//void MyConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
{
|
//{
|
||||||
SaveConfig();
|
// SaveConfig();
|
||||||
}
|
//}
|
||||||
private void StepRTB_Click(object sender, EventArgs e)
|
private void StepRTB_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ReadOnly) return;
|
if (ReadOnly) return;
|
||||||
@ -486,8 +567,8 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_MouseDown = true;
|
_MouseDown = true;
|
||||||
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
|
//Console.WriteLine("vvvvvvvvvv StepRTB Mouse Down id= {0}",MyItemInfo.ItemID);
|
||||||
if (!_ContextMenuStripChanged && this.MyRTBItem != null)
|
if (!_ContextMenuStripChanged)
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetContextMenu();
|
OnSetMenu(this, new StepRTBMenuEventArgs("OpenContextMenu"));
|
||||||
_ContextMenuStripChanged = false;
|
_ContextMenuStripChanged = false;
|
||||||
CorrectSelectionAtEndOfLine();
|
CorrectSelectionAtEndOfLine();
|
||||||
}
|
}
|
||||||
@ -505,22 +586,24 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region ApplicationSupport
|
#region ApplicationSupport
|
||||||
public void ToggleEditView()
|
// Used in StepTabRibbon:
|
||||||
{
|
//public void ToggleEditView(E_ViewMode vwMode)
|
||||||
SaveText();
|
//{
|
||||||
//ItemInfo tmp = MyItemInfo;
|
// OnDoSaveContents(this, new EventArgs()); // SaveText();
|
||||||
//MyItemInfo = null;
|
// //ItemInfo tmp = MyItemInfo;
|
||||||
ReadOnly = !ReadOnly;
|
// //MyItemInfo = null;
|
||||||
EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
|
// //ReadOnly = !ReadOnly;
|
||||||
VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit;
|
// //EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
|
||||||
ViewRTB = ReadOnly;
|
// VwMode = vwMode;
|
||||||
Clear();
|
// ReadOnly = VwMode == E_ViewMode.View;
|
||||||
RTBFillIn(!ViewRTB);
|
// ViewRTB = ReadOnly;
|
||||||
//MyItemInfo = tmp;
|
// Clear();
|
||||||
SelectionStart = 0;
|
// RefreshDisplay(!ViewRTB);
|
||||||
SelectionLength = 0;
|
// //MyItemInfo = tmp;
|
||||||
OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit));
|
// SelectionStart = 0;
|
||||||
}
|
// SelectionLength = 0;
|
||||||
|
// //OnModeChange(this, new StepRTBModeChangeEventArgs(ViewRTB?E_ViewMode.View:E_ViewMode.Edit));
|
||||||
|
//}
|
||||||
public void InsertRO(string value, string link)
|
public void InsertRO(string value, string link)
|
||||||
{
|
{
|
||||||
AddRtfLink(value, link);
|
AddRtfLink(value, link);
|
||||||
@ -541,9 +624,8 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
AddSymbol(symbol);
|
AddSymbol(symbol);
|
||||||
}
|
}
|
||||||
public void InsertIndent()
|
public void InsertIndent(string indentToken)
|
||||||
{
|
{
|
||||||
string indentToken = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IndentToken;
|
|
||||||
if (indentToken == null) indentToken = "\x5";
|
if (indentToken == null) indentToken = "\x5";
|
||||||
AddText(indentToken);
|
AddText(indentToken);
|
||||||
}
|
}
|
||||||
@ -675,44 +757,6 @@ namespace Volian.Controls.Library
|
|||||||
SelectionLength = olen;
|
SelectionLength = olen;
|
||||||
}
|
}
|
||||||
#endregion
|
#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
|
#region AddRtfTextAndStyles
|
||||||
private string _LastRtf = "";
|
private string _LastRtf = "";
|
||||||
private bool _lastReadOnly = false;
|
private bool _lastReadOnly = false;
|
||||||
@ -722,7 +766,7 @@ namespace Volian.Controls.Library
|
|||||||
//if(MyItemInfo.ItemID==10256)
|
//if(MyItemInfo.ItemID==10256)
|
||||||
// Volian.Base.Library.vlnStackTrace.ShowStackLocal("ItemID:{0}", MyItemInfo.ItemID.ToString());
|
// Volian.Base.Library.vlnStackTrace.ShowStackLocal("ItemID:{0}", MyItemInfo.ItemID.ToString());
|
||||||
StringBuilder selectedRtfSB = new StringBuilder();
|
StringBuilder selectedRtfSB = new StringBuilder();
|
||||||
AddFontTable(selectedRtfSB);
|
AddFontTable(selectedRtfSB, FormatFont, FontIsFixed(FormatFont));
|
||||||
_RtfPrefix = selectedRtfSB.ToString();
|
_RtfPrefix = selectedRtfSB.ToString();
|
||||||
selectedRtfSB.Append(txt);
|
selectedRtfSB.Append(txt);
|
||||||
string newRtf = selectedRtfSB.ToString() + "}";
|
string newRtf = selectedRtfSB.ToString() + "}";
|
||||||
@ -737,40 +781,40 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
FindAllLinks();
|
FindAllLinks();
|
||||||
}
|
}
|
||||||
private void AddFontTable(StringBuilder selectedRtfSB)
|
private static void AddFontTable(StringBuilder selectedRtfSB, Font myFont, bool isFixed)
|
||||||
{
|
{
|
||||||
StringBuilder sbbeg = new StringBuilder();
|
StringBuilder sbbeg = new StringBuilder();
|
||||||
StringBuilder sbend = new StringBuilder();
|
StringBuilder sbend = new StringBuilder();
|
||||||
if (Font.Bold)
|
if (myFont.Bold)
|
||||||
{
|
{
|
||||||
sbbeg.Append(@"\b");
|
sbbeg.Append(@"\b");
|
||||||
sbend.Append(@"\b0");
|
sbend.Append(@"\b0");
|
||||||
}
|
}
|
||||||
if (Font.Underline)
|
if (myFont.Underline)
|
||||||
{
|
{
|
||||||
sbbeg.Append(@"\ul");
|
sbbeg.Append(@"\ul");
|
||||||
sbend.Insert(0, @"\ulnone");
|
sbend.Insert(0, @"\ulnone");
|
||||||
}
|
}
|
||||||
if (Font.Italic)
|
if (myFont.Italic)
|
||||||
{
|
{
|
||||||
sbbeg.Append(@"\i");
|
sbbeg.Append(@"\i");
|
||||||
sbend.Insert(0, @"\i0");
|
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 + @"}}";
|
selectedRtfSB.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 " + myFont.FontFamily.Name + @";}"); //}\f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}}";
|
||||||
if (!FontIsFixed())
|
if (!isFixed)
|
||||||
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}");
|
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}");
|
||||||
else
|
else
|
||||||
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}");
|
selectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}");
|
||||||
selectedRtfSB.Append("\r\n");
|
selectedRtfSB.Append("\r\n");
|
||||||
// use styles to construct rtf commands to insert into next line (where \b, etc is)
|
// 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);
|
Graphics grph = Graphics.FromHwnd(this.Handle);
|
||||||
SizeF sfW = grph.MeasureString("W", this.Font);
|
SizeF sfW = grph.MeasureString("W", myFont);
|
||||||
SizeF sfE = grph.MeasureString("!", this.Font);
|
SizeF sfE = grph.MeasureString("!", myFont);
|
||||||
if (sfW.Width == sfE.Width) return true;
|
if (sfW.Width == sfE.Width) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -805,11 +849,11 @@ namespace Volian.Controls.Library
|
|||||||
// See comments in AddRtf(string str) to explain the font style setting
|
// See comments in AddRtf(string str) to explain the font style setting
|
||||||
RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(this);
|
RTBAPI.E_FontStyle fs = RTBAPI.GetFontStyle(this);
|
||||||
int position = SelectionStart;
|
int position = SelectionStart;
|
||||||
SelectedRtf = _RtfPrefix + @"\f1\fs" + this.Font.SizeInPoints * 2 + @" " + str + @"}";
|
SelectedRtf = RtfPrefix + str + @"}";
|
||||||
Select(position, 1);
|
Select(position, 1);
|
||||||
RTBAPI.SetFontStyle(this, fs);
|
RTBAPI.SetFontStyle(this, fs);
|
||||||
Select(position + 1, 0);
|
Select(position + 1, 0);
|
||||||
SelectionFont = _origDisplayText.TextFont.WindowsFont;
|
SelectionFont = MyItemInfo.GetItemFont().WindowsFont;
|
||||||
}
|
}
|
||||||
private string GetAddSymbolText(string symtxt)
|
private string GetAddSymbolText(string symtxt)
|
||||||
{
|
{
|
||||||
@ -829,7 +873,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append(@"{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}");
|
sb.Append(@"{\fonttbl{\f0\fnil\fcharset2 " + this.Font.FontFamily.Name + @";}");
|
||||||
if (!FontIsFixed())
|
if (!FontIsFixed(this.Font))
|
||||||
sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}");
|
sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}");
|
||||||
else
|
else
|
||||||
sb.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}");
|
sb.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}");
|
||||||
@ -850,14 +894,11 @@ namespace Volian.Controls.Library
|
|||||||
string fonttab = FontTable;
|
string fonttab = FontTable;
|
||||||
string fontsize = FontSize;
|
string fontsize = FontSize;
|
||||||
this.DetectUrls = false;
|
this.DetectUrls = false;
|
||||||
//if (SelectionLength > 0) DeleteCurrentSelection(null);
|
|
||||||
if (SelectionLength > 0)HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), null);
|
if (SelectionLength > 0)HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), null);
|
||||||
int position = SelectionStart;
|
int position = SelectionStart;
|
||||||
SelectionLength = 0;
|
SelectionLength = 0;
|
||||||
//Console.WriteLine(this.Rtf);
|
|
||||||
linkValue = linkValue.Replace("\\u8209?", "\\f1\\u8209?\\f0 ");
|
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 }";
|
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.SelectionLength = 0;
|
||||||
this.SelectionStart = position;
|
this.SelectionStart = position;
|
||||||
FindAllLinks();
|
FindAllLinks();
|
||||||
@ -873,7 +914,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
private void AddRtfStyles()
|
private void AddRtfStyles()
|
||||||
{
|
{
|
||||||
if ((_origDisplayText.TextFont.Style & E_Style.Bold) > 0)
|
if ((OrigDisplayText.TextFont.Style & E_Style.Bold) > 0)
|
||||||
{
|
{
|
||||||
this.SelectAll();
|
this.SelectAll();
|
||||||
RTBAPI.ToggleBold(true, this, RTBAPI.RTBSelection.SCF_SELECTION);
|
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
|
// apply the underlining to the selected text, because if the
|
||||||
// the underlining was applied to RTBAPI.RTBSelection.SCF_ALL
|
// the underlining was applied to RTBAPI.RTBSelection.SCF_ALL
|
||||||
// the Links were changed so that they were no longer hidden.
|
// 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);
|
// RTBAPI.ToggleUnderline(true, this, RTBAPI.RTBSelection.SCF_ALL);
|
||||||
{
|
{
|
||||||
this.SelectAll();
|
this.SelectAll();
|
||||||
@ -896,7 +937,7 @@ namespace Volian.Controls.Library
|
|||||||
// apply the italics to the selected text, because if the
|
// apply the italics to the selected text, because if the
|
||||||
// the italics was applied to RTBAPI.RTBSelection.SCF_ALL
|
// the italics was applied to RTBAPI.RTBSelection.SCF_ALL
|
||||||
// the Links were changed so that they were no longer hidden.
|
// 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);
|
// RTBAPI.ToggleItalic(true, this, RTBAPI.RTBSelection.SCF_ALL);
|
||||||
{
|
{
|
||||||
this.SelectAll();
|
this.SelectAll();
|
||||||
@ -1027,22 +1068,22 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region ColorSupport - Not currently used.
|
#region ColorSupport - Not currently used.
|
||||||
private void SetBackGroundColor(ItemInfo itemInfo)
|
//private void SetBackGroundColor(ItemInfo itemInfo)
|
||||||
{
|
//{
|
||||||
string backcolor = null;
|
// string backcolor = null;
|
||||||
int type = (int)itemInfo.MyContent.Type;
|
// int type = (int)itemInfo.MyContent.Type;
|
||||||
FormatInfo formatinfo = itemInfo.ActiveFormat;
|
// FormatInfo formatinfo = itemInfo.ActiveFormat;
|
||||||
if (type == (int)E_FromType.Procedure)
|
// if (type == (int)E_FromType.Procedure)
|
||||||
backcolor = formatinfo.PlantFormat.FormatData.ProcData.BackColor;
|
// backcolor = formatinfo.PlantFormat.FormatData.ProcData.BackColor;
|
||||||
else if (type == (int)E_FromType.Section)
|
// else if (type == (int)E_FromType.Section)
|
||||||
backcolor = formatinfo.PlantFormat.FormatData.SectData.BackColor;
|
// backcolor = formatinfo.PlantFormat.FormatData.SectData.BackColor;
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
int typindx = (int)itemInfo.MyContent.Type - 20000; // what to do for other types rather than steps
|
// 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 = formatinfo.PlantFormat.FormatData.StepDataList[typindx].StepLayoutData.BackColor;
|
||||||
}
|
// }
|
||||||
BackColor = Color.FromName(backcolor);
|
// BackColor = Color.FromName(backcolor);
|
||||||
}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
#region EventSupport
|
#region EventSupport
|
||||||
#region LinkEvents
|
#region LinkEvents
|
||||||
@ -1093,7 +1134,8 @@ namespace Volian.Controls.Library
|
|||||||
private bool _HandlingCtrlA = false;
|
private bool _HandlingCtrlA = false;
|
||||||
private void HandleLocalSelectionChange()
|
private void HandleLocalSelectionChange()
|
||||||
{
|
{
|
||||||
if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this)
|
//if (MyRTBItem != null && MyRTBItem.MyStepPanel.SelectedStepRTB != this)
|
||||||
|
if (OnIsNotCurrentSelection(this, new EventArgs()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HandleSelectionChange();
|
HandleSelectionChange();
|
||||||
@ -1339,9 +1381,10 @@ namespace Volian.Controls.Library
|
|||||||
public bool WasXDelete = false;
|
public bool WasXDelete = false;
|
||||||
private void DeleteCurrentSelection(string keys)
|
private void DeleteCurrentSelection(string keys)
|
||||||
{
|
{
|
||||||
|
|
||||||
DebugPrint("vvvvvvvvvvvvxxxxxxxxxxxx>");
|
DebugPrint("vvvvvvvvvvvvxxxxxxxxxxxx>");
|
||||||
DebugSelection("Before X");
|
DebugSelection("Before X");
|
||||||
|
DebugPrint(keys == null ? "NULL" : "NOT NULL");
|
||||||
SelectedText = keys==null?"X":keys; // replace text with X
|
SelectedText = keys==null?"X":keys; // replace text with X
|
||||||
WasXDelete = (keys == null);
|
WasXDelete = (keys == null);
|
||||||
DebugSelection("After X");
|
DebugSelection("After X");
|
||||||
@ -1418,53 +1461,50 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
if (e.Control)
|
if (e.Control)
|
||||||
{
|
{
|
||||||
if (this.MyRTBItem != null)
|
if (e.Alt)
|
||||||
{
|
{
|
||||||
if (e.Alt)
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
switch (e.KeyCode)
|
case Keys.M:
|
||||||
{
|
OnOpenAnnotations(this, new EventArgs());
|
||||||
case Keys.M:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnAnnots_Click(sender, e);
|
break;
|
||||||
e.Handled = true;
|
default:
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (e.Shift)
|
}
|
||||||
|
if (e.Shift)
|
||||||
|
{
|
||||||
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
switch (e.KeyCode)
|
case Keys.F:
|
||||||
{
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsFigure"));
|
||||||
case Keys.F:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsFigure");
|
break;
|
||||||
e.Handled = true;
|
case Keys.T:
|
||||||
break;
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsTable"));
|
||||||
case Keys.T:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsTable");
|
break;
|
||||||
e.Handled = true;
|
case Keys.N:
|
||||||
break;
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsNote"));
|
||||||
case Keys.N:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsNote");
|
break;
|
||||||
e.Handled = true;
|
case Keys.C:
|
||||||
break;
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsCaution"));
|
||||||
case Keys.C:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsCaution");
|
break;
|
||||||
e.Handled = true;
|
case Keys.S:
|
||||||
break;
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsSubStps"));
|
||||||
case Keys.S:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsSubStps");
|
break;
|
||||||
e.Handled = true;
|
case Keys.H:
|
||||||
break;
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsHLS"));
|
||||||
case Keys.H:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsHLS");
|
break;
|
||||||
e.Handled = true;
|
case Keys.R:
|
||||||
break;
|
OnSetMenu(this, new StepRTBMenuEventArgs("InsRNO"));
|
||||||
case Keys.R:
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("InsRNO");
|
break;
|
||||||
e.Handled = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1567,11 +1607,8 @@ namespace Volian.Controls.Library
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
break;
|
break;
|
||||||
case Keys.Enter:
|
case Keys.Enter:
|
||||||
if (this.MyRTBItem != null)
|
OnInsertPgBrk(this, new EventArgs());
|
||||||
{
|
e.Handled = true;
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.btnInsPgBrk_Click(sender, e);
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1626,7 +1663,7 @@ namespace Volian.Controls.Library
|
|||||||
// because selection is first character or link without any other selection. Don't
|
// 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
|
// need to write code to handle link at beginning of box in Shift Right code because
|
||||||
// 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 = FindEnd();
|
||||||
int len = SelectionLength + newlen;
|
int len = SelectionLength + newlen;
|
||||||
@ -1658,13 +1695,13 @@ namespace Volian.Controls.Library
|
|||||||
if (!e.Shift) HandleLocalSelectionChange();
|
if (!e.Shift) HandleLocalSelectionChange();
|
||||||
// if shift-down & on link at beginning of box - do special processing (regular processing
|
// if shift-down & on link at beginning of box - do special processing (regular processing
|
||||||
// didn't handle it correctly.
|
// 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);
|
Point cpos = GetPositionFromCharIndex(SelectionStart);
|
||||||
int addon = ClientRectangle.Height / (lastLine + 1);
|
int addon = ClientRectangle.Height / (lastLine + 1);
|
||||||
cpos.Y = cpos.Y + addon;
|
cpos.Y = cpos.Y + addon;
|
||||||
int selend = GetCharIndexFromPosition(cpos);
|
int selend = GetCharIndexFromPosition(cpos);
|
||||||
Select(7, selend-7);
|
Select(7, selend - 7);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1735,19 +1772,16 @@ namespace Volian.Controls.Library
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
break;
|
break;
|
||||||
case Keys.F5:
|
case Keys.F5:
|
||||||
if (this.MyRTBItem != null)
|
if (e.Shift)
|
||||||
{
|
{
|
||||||
if (e.Shift)
|
e.Handled = true;
|
||||||
{
|
if (!OnCheckClipboard(this, new EventArgs())) return; // check if 'clipboard' contains a step.
|
||||||
e.Handled = true;
|
OnSetMenu(this, new StepRTBMenuEventArgs("StepPaste"));
|
||||||
if (MyRTBItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyCopyStep == null) return;
|
}
|
||||||
MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ShortCutContextMenu("StepPaste");
|
else if (!e.Control && !e.Alt)
|
||||||
}
|
{
|
||||||
else if (!e.Control && !e.Alt)
|
e.Handled = true;
|
||||||
{
|
OnCopyStep(this, new EventArgs());
|
||||||
e.Handled = true;
|
|
||||||
this.MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.DoCopyStep();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Keys.F6:
|
case Keys.F6:
|
||||||
@ -1755,52 +1789,44 @@ namespace Volian.Controls.Library
|
|||||||
SendKeys.Send("%H{ESC}");
|
SendKeys.Send("%H{ESC}");
|
||||||
break;
|
break;
|
||||||
case Keys.Tab:
|
case Keys.Tab:
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
if (MyRTBItem == null)
|
Form frm = ParentForm(this);
|
||||||
{
|
if (frm != null)
|
||||||
Form frm = ParentForm(this);
|
frm.SelectNextControl(this, true, true, true, true);
|
||||||
if (frm != null)
|
|
||||||
frm.SelectNextControl(this, true, true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Keys.Enter:
|
case Keys.Enter:
|
||||||
if (!e.Control && !e.Shift && !e.Alt)
|
if (!e.Control && !e.Shift && !e.Alt)
|
||||||
{
|
{
|
||||||
if (MyRTBItem != null && !MyRTBItem.MyItemInfo.IsTablePart)
|
OnEnterKeyPressed(sender, e);
|
||||||
{
|
|
||||||
e.Handled = true;
|
|
||||||
MyRTBItem.MyStepPanel.MyStepTabPanel.MyStepTabRibbon.ProcessEnterKey();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Form ParentForm(Control ctrl)
|
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;
|
return ctrl.Parent as Form;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StepRTB_HomeEndPressed(KeyEventArgs keyargs)
|
private void StepRTB_HomeEndPressed(KeyEventArgs keyargs)
|
||||||
{
|
{
|
||||||
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
|
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
|
||||||
// Cursor moves out of box only if control is pressed too - otherwise key is
|
// Cursor moves out of box only if control is pressed too - otherwise key is
|
||||||
// handled in rtb.
|
// 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);
|
if (keyargs.Control) OnCursorKeyPress(this, keyargs);
|
||||||
}
|
}
|
||||||
private void StepRTB_PageKeyPressed(KeyEventArgs keyargs)
|
private void StepRTB_PageKeyPressed(KeyEventArgs keyargs)
|
||||||
{
|
{
|
||||||
if (MyItemInfo.IsProcedure || MyItemInfo.IsSection) return;
|
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);
|
OnCursorKeyPress(this, keyargs);
|
||||||
}
|
}
|
||||||
public void StepRTB_ArrowPressed(E_ArrowKeys key)
|
public void StepRTB_ArrowPressed(E_ArrowKeys key)
|
||||||
{
|
{
|
||||||
Point cp = PointToClient(Cursor.Position);
|
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));
|
OnCursorMovement(this, new StepRTBCursorMovementEventArgs(cp, key));
|
||||||
}
|
}
|
||||||
private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
|
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)
|
static void tsi_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
|
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
|
// This is our customized Spell Check dialog
|
||||||
@ -2681,6 +2708,32 @@ namespace Volian.Controls.Library
|
|||||||
_ViewMode = vmode;
|
_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
|
public class StepRTBCursorMovementEventArgs
|
||||||
{
|
{
|
||||||
private Point _CursorLocation;
|
private Point _CursorLocation;
|
||||||
@ -2701,6 +2754,19 @@ namespace Volian.Controls.Library
|
|||||||
_Key = key;
|
_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
|
#region LinkLocation Class
|
||||||
public class LinkLocation
|
public class LinkLocation
|
||||||
{
|
{
|
||||||
|
@ -6,20 +6,13 @@ namespace Volian.Controls.Library
|
|||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
private bool _BeingDisposed = false;
|
|
||||||
|
|
||||||
public bool BeingDisposed
|
|
||||||
{
|
|
||||||
get { return _BeingDisposed; }
|
|
||||||
set { _BeingDisposed = value; }
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clean up any resources being used.
|
/// Clean up any resources being used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
_BeingDisposed = true;
|
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user