diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs
index 5b706844..e50dedca 100644
--- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs
+++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs
@@ -13,81 +13,106 @@ namespace Volian.Controls.Library
{
public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer
{
- private DisplayTabControl _MyTabControl;
+ #region Private Fields
+ private DisplayTabControl _MyDisplayTabControl;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private AxDSOFramer.AxFramerControl _MyDSOFramer;
- private TransPanel _MyTransPanel;
+ private TransparentPanel _MyTransparentPanel;
private static int _Count = 0;
- private DocumentInfo _MyDocument;
+ private DocumentInfo _MyDocumentInfo;
private int _MyCount;
+ private DisplayTabItem _MyDisplayTabItem;
+ private DSOFile _DSOFile;
+ #endregion
+ #region Public Properties
+ ///
+ /// Count of DSO Pages open. Limited to 18 in DisplayTabControl
+ ///
public static int Count
{
get { return _Count; }
set { _Count = value; }
}
- private DisplayTabItem _TabItem;
- public DisplayTabItem TabItem
+ ///
+ /// Pointer to the related DisplayTabItem
+ ///
+ public DisplayTabItem MyDisplayTabItem
{
- get { return _TabItem; }
- set { _TabItem = value; }
+ get { return _MyDisplayTabItem; }
+ set { _MyDisplayTabItem = value; }
}
- //private frmPG _frm = null;
- public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myTabControl)
+ ///
+ /// DocumentInfo record for the Word document
+ ///
+ public DocumentInfo MyDocumentInfo
{
- _MyTabControl = myTabControl;
- InitializeComponent();
- SetupDSOTabPanel();
- _MyDocument = documentInfo;
- SetupDSO();
- //_frm = new frmPG(_MyDSOFramer);
- //_frm.Show();
+ get { return _MyDocumentInfo; }
}
- private void SetupDSOTabPanel()
- {
- Dock = System.Windows.Forms.DockStyle.Fill;
- }
- public DocumentInfo DocumentInfo
- {
- get { return _MyDocument; }
- }
- private DSOFile _DSOFile;
- internal DSOFile DSOFile
+ ///
+ /// Temporary Word file used for editing.
+ ///
+ internal DSOFile MyDSOFile
{
get
{
if (_DSOFile == null)
- _DSOFile = new DSOFile(_MyDocument);
+ _DSOFile = new DSOFile(_MyDocumentInfo);
return _DSOFile;
}
}
+ ///
+ /// Dirty status. Only saved if dirty.
+ ///
public bool IsDirty
{
get { return _MyDSOFramer.IsDirty; }
}
+ #endregion
+ //private frmPG _frm = null;
+ #region Constructors
+ public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl)
+ {
+ _MyDisplayTabControl = myDisplayTabControl;
+ InitializeComponent();
+ SetupDSOTabPanel();
+ _MyDocumentInfo = documentInfo;
+ SetupDSO();
+ //_frm = new frmPG(_MyDSOFramer);
+ //_frm.Show();
+ }
+ #endregion
+ #region Private Methods
+ private void SetupDSOTabPanel()
+ {
+ Dock = System.Windows.Forms.DockStyle.Fill; // Automatically Fill the panel
+ }
private void SetupDSO()
{
- _Count++;
+ _Count++; // Increment the count of open Word documents (Limit in DisplayTabControl)
_MyCount = _Count;
- this._MyTransPanel = new TransPanel();
+ this._MyTransparentPanel = new TransparentPanel();
this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
this.Controls.Add(this._MyDSOFramer);
- this.Controls.Add(this._MyTransPanel);
+ this.Controls.Add(this._MyTransparentPanel); // A transparent panel is added over top of the DSO Framer window so that
+ // the related tab can be activated when the user clicks on a Word Document. Since the Word document is actually running
+ // in a different thread, it does not behave properly with focus events.
this.components.Add(this._MyDSOFramer);
- this.components.Add(this._MyTransPanel);
- this._MyTransPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this._MyTransPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this._MyTransPanel.ForeColor = System.Drawing.Color.Brown;
+ this.components.Add(this._MyTransparentPanel);
+ this._MyTransparentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this._MyTransparentPanel.ForeColor = System.Drawing.Color.Brown; // This is the color used to show InActive on the right side on the Word
+ // document menu line.
//this._MyTransPanel.Location = new System.Drawing.Point(0, 0);
//this._MyTransPanel.Name = "transPanel1";
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1;
- this._MyTransPanel.Click += new EventHandler(_MyTransPanel_Click);
+ this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click);
this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
- this._MyDSOFramer.Open(DSOFile.MyFile.FullName);
+ this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
this._MyDSOFramer.Menubar = false;
this._MyDSOFramer.Titlebar = false;
//if (_MyCount < 20)
@@ -98,18 +123,40 @@ namespace Volian.Controls.Library
this.Enter += new EventHandler(DSOTabPanel_Enter);
this.Leave += new EventHandler(DSOTabPanel_Leave);
}
+ #endregion
+ #region Event Handlers
+ ///
+ /// When the user leaves a Word document, place the transparent frame on top with the words "InActive" in the upper right
+ ///
+ ///
+ ///
void DSOTabPanel_Leave(object sender, EventArgs e)
{
- _MyTransPanel.BringToFront();
+ _MyTransparentPanel.BringToFront();
}
- void _MyTransPanel_Click(object sender, EventArgs e)
+ ///
+ /// Force this item to be selected when the transparent window is clicked.
+ ///
+ ///
+ ///
+ void _MyTransparentPanel_Click(object sender, EventArgs e)
{
this.Select();
}
+ ///
+ /// If the user presses the save button, tell the file to save it's contents to the database
+ ///
+ ///
+ ///
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
{
- DSOFile.SaveFile();
+ MyDSOFile.SaveFile();
}
+ ///
+ /// Before a document closes check to see if it's contents should be saved.
+ ///
+ ///
+ ///
void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e)
{
try
@@ -121,9 +168,15 @@ namespace Volian.Controls.Library
_MyLog.Warn("Before Closing Document ", ex);
}
}
+ ///
+ /// When a Word document is selected make sure it's tab is activated and
+ /// the SelectedItem for the DisplayTabControl is updated.
+ ///
+ ///
+ ///
void DSOTabPanel_Enter(object sender, EventArgs e)
{
- _MyTransPanel.SendToBack();
+ _MyTransparentPanel.SendToBack();
try
{
_MyDSOFramer.EventsEnabled = true;
@@ -133,16 +186,23 @@ namespace Volian.Controls.Library
{
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
}
- _MyTabControl.OnItemSelectedChanged(this, null);
+ _MyDisplayTabControl.OnItemSelectedChanged(this, null);
_MyDSOFramer.Focus();
}
+ #endregion
+ #region Public Methods
+ ///
+ /// Save the contents of the Word Document to a file
+ /// and save the file to the database
+ ///
+ ///
public bool SaveDSO()
{
bool result = true;
try
{
_MyDSOFramer.Save();
- DSOFile.SaveFile();
+ MyDSOFile.SaveFile();
}
catch (Exception ex)
{
@@ -151,21 +211,35 @@ namespace Volian.Controls.Library
}
return result;
}
+ ///
+ /// Check to see if a Word document should be saved. If it is dirty ask the user if the
+ /// changes should be changed. Save the changes if the user says "yes".
+ ///
+ ///
public bool SaveDirty()
{
if (_MyDSOFramer.IsDirty)
{
// TODO: Should be based upon Item rather than Document.
- if (MessageBox.Show("Save changes to " + _TabItem.MyItem.TabTitle + "\r\n" + _TabItem.MyItem.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();
return false;
}
return true;
}
+ ///
+ /// Cleans-up the DSO Framer window
+ ///
+ ///
public bool CloseDSO()
{
return CloseDSO(false);
}
+ ///
+ /// Cleans-up the DSO Framer window
+ ///
+ ///
+ ///
public bool CloseDSO(bool force)
{
_MyLog.Debug("CloseDSO");
@@ -186,6 +260,9 @@ namespace Volian.Controls.Library
}
return result;
}
+ ///
+ /// Activates the current DSO Framer window (Word)
+ ///
public void Activate()
{
try
@@ -199,5 +276,6 @@ namespace Volian.Controls.Library
if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex);
}
}
+ #endregion
}
}
diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs
index 40d742ec..9fcc4edd 100644
--- a/PROMS/Volian.Controls.Library/DisplayRO.cs
+++ b/PROMS/Volian.Controls.Library/DisplayRO.cs
@@ -55,24 +55,23 @@ namespace Volian.Controls.Library
{
if (!Visible) return;
if (_MyRTB != null)
- _MyRTB.LinkChanged -= new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
+ _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (value == null) return;
_MyRTB = value;
- _MyRTB.LinkChanged += new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
+ _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (_MyRTB.MyLinkText == null)
{
_CurROLink = null;
}
}
}
- void _MyRTB_LinkChanged(object sender, LinkClickedEventArgs e)
+ void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
{
if (_MyRTB.MyLinkText == null)
CurROLink = null;
else
{
- DisplayLinkEventArgs tmp = new DisplayLinkEventArgs(null, e);
- CurROLink = tmp.RoUsageid;
+ CurROLink = args.RoUsageid;
}
}
#endregion
diff --git a/PROMS/Volian.Controls.Library/DisplayRTBSimple.cs b/PROMS/Volian.Controls.Library/DisplayRTBSimple.cs
index 5c4879c6..88df564d 100644
--- a/PROMS/Volian.Controls.Library/DisplayRTBSimple.cs
+++ b/PROMS/Volian.Controls.Library/DisplayRTBSimple.cs
@@ -12,17 +12,12 @@ using System.Reflection;
namespace Volian.Controls.Library
{
- public enum LinkType : int
- {
- ReferencedObject = 21,
- Transition = 9516,
- TransitionRange = 9574
- }
- public partial class DisplayRTBSimple : RichTextBox, IDisplayRTB
+ public partial class StepRTBSimple : RichTextBox, IStepRTB
{
#region Fields
+ private StepItem _MyStepItem;
private IContainer _Container = null;
- private ItemInfo _MyItem;
+ private ItemInfo _MyItemInfo;
private Size _AdjustSize;
private Rectangle _ContentsRectangle;
private E_EditPrintMode _EpMode;
@@ -65,15 +60,23 @@ namespace Volian.Controls.Library
//}
#endregion
#region Events
- public event DisplayRTBLinkEvent LinkGoTo;
- private void OnLinkGoTo(object sender,LinkClickedEventArgs args)
+ ///
+ /// Occurs in response to Link GoTo
+ ///
+ public event StepRTBLinkEvent LinkGoTo;
+ ///
+ /// Checks to see if the LinkGoTo event is handled and launches it.
+ ///
+ ///
+ ///
+ private void OnLinkGoTo(object sender, StepPanelLinkEventArgs args)
{
if (LinkGoTo != null) LinkGoTo(sender, args);
}
///
/// Occurs when a content or format change causes the box to get taller or shorter
///
- public event DisplayRTBEvent HeightChanged;
+ public event StepRTBEvent HeightChanged;
///
/// Checks to see if the HeightChanged event is handled and launches it
///
@@ -90,18 +93,18 @@ namespace Volian.Controls.Library
///
///
///
- public ItemInfo MyItem
+ public ItemInfo MyItemInfo
{
- get { return _MyItem; }
+ get { return _MyItemInfo; }
set
{
- _MyItem = value;
+ _MyItemInfo = value;
if (value != null)
{
//// TIMING: DisplayItem.TimeIt("rtbMyItem Start");
//if (value.ItemID == 90)
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat(value.MyContent.Text);
- string txt = _MyItem.MyContent.Text;
+ string txt = _MyItemInfo.MyContent.Text;
txt = txt.Replace("\n", "\r\n\\par ");
//txt = Regex.Replace(txt, "(.){([0-9]*){([0-9 ]*)}}",FixTransition);
//txt = Regex.Replace(txt, @"(.)\\v TRAN", FixTransition);
@@ -132,6 +135,11 @@ namespace Volian.Controls.Library
}
}
}
+ public StepItem MyStepItem
+ {
+ get { return _MyStepItem; }
+ set { _MyStepItem = value; }
+ }
public Size AdjustSize
{
get { return _AdjustSize; }
@@ -164,7 +172,7 @@ namespace Volian.Controls.Library
//int transitionID = Convert.ToInt32(match.Groups[2].Value);
int transitionID = Convert.ToInt32(match.Groups[4].Value.Split(" ".ToCharArray())[1]);
// Find the transition
- foreach (TransitionInfo ti in _MyItem.MyContent.ContentTransitions)
+ foreach (TransitionInfo ti in _MyItemInfo.MyContent.ContentTransitions)
{
if (ti.TransitionID == transitionID)
{
@@ -227,23 +235,23 @@ namespace Volian.Controls.Library
//ContextMenuStrip = this.contextMenuStrip1;
//ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
//this.TextChanged += new EventHandler(VERichTextBox_TextChanged);
- this.ContentsResized += new ContentsResizedEventHandler(VERichTextBox_ContentsResized);
+ this.ContentsResized += new ContentsResizedEventHandler(StepRTBSimple_ContentsResized);
//if (Text != "") ResizeForText();
- this.LinkClicked += new LinkClickedEventHandler(DisplayRTBSimple_LinkClicked);
+ this.LinkClicked += new LinkClickedEventHandler(StepRTBSimple_LinkClicked);
}
- void DisplayRTBSimple_LinkClicked(object sender, LinkClickedEventArgs e)
+ void StepRTBSimple_LinkClicked(object sender, LinkClickedEventArgs args)
{
- OnLinkGoTo(sender, e);
+ OnLinkGoTo(sender, new StepPanelLinkEventArgs(_MyStepItem, args.LinkText));
}
#endregion
#region Constructors
- public DisplayRTBSimple()
+ public StepRTBSimple()
{
InitializeComponent();
SetUp();
}
- public DisplayRTBSimple(IContainer container)
+ public StepRTBSimple(IContainer container)
{
container.Add(this);
InitializeComponent();
@@ -252,7 +260,7 @@ namespace Volian.Controls.Library
}
#endregion
#region Event Handlers
- void VERichTextBox_ContentsResized(object sender, ContentsResizedEventArgs e)
+ void StepRTBSimple_ContentsResized(object sender, ContentsResizedEventArgs e)
{
this.Height = e.NewRectangle.Height;
OnHeightChanged(sender, new EventArgs());
@@ -260,10 +268,11 @@ namespace Volian.Controls.Library
#endregion
}
[TypeConverter(typeof(ExpandableObjectConverter))]
- public interface IDisplayRTB
+ public interface IStepRTB
{
- event DisplayRTBEvent HeightChanged;
- ItemInfo MyItem { get; }
+ event StepRTBEvent HeightChanged;
+ ItemInfo MyItemInfo { get; set;}
+ StepItem MyStepItem { get; set;}
Size AdjustSize { get; set; }
Rectangle ContentsRectangle { get; set; }
E_EditPrintMode EpMode { get; set; }
@@ -274,5 +283,11 @@ namespace Volian.Controls.Library
// public DisplayRTBSimple()
// public DisplayRTBSimple(IContainer container)
}
+ public enum LinkType : int
+ {
+ ReferencedObject = 21,
+ Transition = 9516,
+ TransitionRange = 9574
+ }
}
diff --git a/PROMS/Volian.Controls.Library/DisplayRTBSimple.designer.cs b/PROMS/Volian.Controls.Library/DisplayRTBSimple.designer.cs
index b0851861..81063654 100644
--- a/PROMS/Volian.Controls.Library/DisplayRTBSimple.designer.cs
+++ b/PROMS/Volian.Controls.Library/DisplayRTBSimple.designer.cs
@@ -1,6 +1,6 @@
namespace Volian.Controls.Library
{
- partial class DisplayRTBSimple
+ partial class StepRTBSimple
{
///
/// Required designer variable.
diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
index 42ffc248..4d0972c2 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs
@@ -13,48 +13,127 @@ namespace Volian.Controls.Library
{
public partial class DisplayTabControl : UserControl
{
- private Dictionary _MyPages;
- public event DisplayPanelEvent ItemClick;
- private List _RemovedItems = null;
- internal void OnItemClick(object sender, DisplayPanelEventArgs args)
+ #region Private Fields
+ ///
+ /// This is a lookup table for all of the DisplayTabItems that are currently open
+ /// The key is:
+ /// "Item - " + Procedure ItemID for step pages
+ /// "Doc - " + DocumentID for Word Documents
+ ///
+ private Dictionary _MyDisplayTabItems;
+ ///
+ /// When a Tab is closed it is added to this list.
+ /// When another Tab is opened, any Tabs in this list are closed
+ ///
+ private List _RemovedDisplayTabItems = null;
+ ///
+ /// This stores a UniqueID for Bars as they are opened.
+ /// A bar is the docking location for the DisplayTabItems.
+ ///
+ private int _UniqueBarCount;
+ #endregion
+ #region Events
+ ///
+ /// This event is raised when a the "Tab" of a DisplayItem is clicked with a mouse.
+ /// So far this has just been used for demo purposes. It could be used to select a
+ /// step and it's children for the purpose of copying.
+ ///
+ public event StepPanelEvent ItemClick;
+ ///
+ /// Checks to see if the ItemClick event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnItemClick(object sender, StepPanelEventArgs args)
{
if (ItemClick != null) ItemClick(sender, args);
}
- public event DisplayPanelLinkEvent LinkActiveChanged;
- internal void OnLinkActiveChanged(object sender, DisplayLinkEventArgs args)
+ ///
+ /// This occurs when the user moves onto or off of a link within a RichTextBox
+ /// or moves between RichTextBoxes or Pages.
+ ///
+ public event StepPanelLinkEvent LinkActiveChanged;
+ ///
+ /// Checks to see if the LinkActiveChanged event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkActiveChanged(object sender, StepPanelLinkEventArgs args)
{
if (LinkActiveChanged != null) LinkActiveChanged(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- public event DisplayPanelLinkEvent LinkInsertTran;
- internal void OnLinkInsertTran(object sender, DisplayLinkEventArgs args)
+ ///
+ /// This occurs when a Transition is inserted
+ ///
+ public event StepPanelLinkEvent LinkInsertTran;
+ ///
+ /// Checks to see if the 'LinkInsertTran' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkInsertTran(object sender, StepPanelLinkEventArgs args)
{
if (LinkInsertTran != null) LinkInsertTran(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- public event DisplayPanelLinkEvent LinkInsertRO;
- internal void OnLinkInsertRO(object sender, DisplayLinkEventArgs args)
+ ///
+ /// This occurs when an RO is inserted
+ ///
+ public event StepPanelLinkEvent LinkInsertRO;
+ ///
+ /// Checks to see if the 'LinkInsertRO' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkInsertRO(object sender, StepPanelLinkEventArgs args)
{
if (LinkInsertRO != null) LinkInsertRO(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- public event DisplayPanelLinkEvent LinkModifyTran;
- internal void OnLinkModifyTran(object sender, DisplayLinkEventArgs args)
+ ///
+ /// This occurs when a Transition is modified
+ ///
+ public event StepPanelLinkEvent LinkModifyTran;
+ ///
+ /// Checks to see if the 'LinkModifyTran' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
{
if (LinkModifyTran != null) LinkModifyTran(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- public event DisplayPanelLinkEvent LinkModifyRO;
- internal void OnLinkModifyRO(object sender, DisplayLinkEventArgs args)
+ ///
+ /// This occurs when an RO is modified
+ ///
+ public event StepPanelLinkEvent LinkModifyRO;
+ ///
+ /// Checks to see if the 'LinkModifyRO' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
{
if (LinkModifyRO != null) LinkModifyRO(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- public event DisplayPanelEvent ItemSelectedChanged;
- internal void OnItemSelectedChanged(object sender, DisplayPanelEventArgs args)
+ ///
+ /// Occurs when the user selects a different item or page
+ ///
+ public event StepPanelEvent ItemSelectedChanged;
+ ///
+ /// Checks to see if the 'ItemSelectedChanged' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnItemSelectedChanged(object sender, StepPanelEventArgs args)
{
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
}
+ #endregion
+ #region Contructor & Setup
public DisplayTabControl()
{
InitializeComponent();
@@ -62,18 +141,13 @@ namespace Volian.Controls.Library
}
private void SetUp()
{
- _RemovedItems = new List();
+ _RemovedDisplayTabItems = new List();
Dock = DockStyle.Fill;
dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
- _MyPages = new Dictionary();
+ _MyDisplayTabItems = new Dictionary();
SetupBar(_MyBar);
dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff);
}
- void dotNetBarManager1_BarTearOff(object sender, EventArgs e)
- {
- Bar myBar = sender as Bar;
- myBar.Enter += new EventHandler(myBar_Enter);
- }
private void SetupBar(Bar myBar)
{
if (myBar.DockTabControl != null)
@@ -88,16 +162,38 @@ namespace Volian.Controls.Library
myBar.Visible = true;
myBar.RecalcLayout();
}
+ #endregion
+ #region Internal Event Handlers
+ ///
+ /// This is code recommended by DotNetBar
+ ///
+ ///
+ ///
+ void dotNetBarManager1_BarTearOff(object sender, EventArgs e)
+ {
+ Bar myBar = sender as Bar;
+ myBar.Enter += new EventHandler(myBar_Enter);
+ }
+ ///
+ /// This sets-up the bar after it is selected.
+ ///
+ ///
+ ///
void myBar_Enter(object sender, EventArgs e)
{
Bar myBar = sender as Bar;
myBar.Enter -= new EventHandler(myBar_Enter);
SetupBar(sender as Bar);
}
+ ///
+ /// This handles the closing of a document page
+ ///
+ ///
+ ///
void myBar_DockTabClosing(object sender, DockTabClosingEventArgs e)
{
e.RemoveDockTab = true;
- _RemovedItems.Add((DisplayTabItem)e.DockContainerItem);
+ _RemovedDisplayTabItems.Add((DisplayTabItem)e.DockContainerItem);
DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem;
if (myTabItem != null)
{
@@ -117,6 +213,30 @@ namespace Volian.Controls.Library
}
}
}
+ #endregion
+ #region Public Methods
+ ///
+ /// Open a Step Item or a Word Item
+ ///
+ ///
+ ///
+ public DisplayTabItem OpenItem(ItemInfo myItemInfo)
+ {
+ while (_RemovedDisplayTabItems.Count > 0) // Clean-up any items that have been closed.
+ {
+ DisplayTabItem myTabItem = _RemovedDisplayTabItems[0];
+ _RemovedDisplayTabItems.RemoveAt(0);
+ RemoveItem(myTabItem);
+ }
+ _MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item.
+ if (myItemInfo.MyContent.MyEntry == null) // If it is a Word document open it in Word
+ return OpenStepTabPage(myItemInfo);
+ else // Otherwise open it in the step editor
+ return OpenDSOTabPage(myItemInfo);
+ }
+ ///
+ /// Look for a tab and set it to active.
+ ///
private void ActivateRemainingTab()
{
foreach (Bar myBar in dotNetBarManager1.Bars)
@@ -132,12 +252,18 @@ namespace Volian.Controls.Library
// No Document Tabs Remaining - need to raise OnItemSelectedChanged
OnItemSelectedChanged(this, null);
}
- private int _UniqueBarCount;
+ #endregion
+ #region Public Properties
public DevComponents.DotNetBar.Bar MyBar
{
get { return _MyBar; }
}
- public DisplayTabItem SelectedTab
+ #endregion
+ #region Private Methods
+ ///
+ /// Gets and sets the SelectedDisplayTabItem (Active Tab)
+ ///
+ public DisplayTabItem SelectedDisplayTabItem
{
get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
set
@@ -149,33 +275,25 @@ namespace Volian.Controls.Library
}
}
}
- public DisplayTabItem OpenItem(ItemInfo myItem)
- {
- while (_RemovedItems.Count > 0)
- {
- DisplayTabItem myTabItem = _RemovedItems[0];
- _RemovedItems.RemoveAt(0);
- RemoveItem(myTabItem);
- }
- _MyBar = GetParentBar(myItem);
- if (myItem.MyContent.MyEntry == null)
- return OpenDisplayTabPage(myItem);
- else
- return OpenDSOTabPage(myItem);
- }
- private Bar GetParentBar(ItemInfo myItem)
+ ///
+ /// This returns the parent bar (current docking location) for an item.
+ /// It creates a bar if none exist
+ ///
+ ///
+ ///
+ private Bar GetParentBar(ItemInfo myItemInfo)
{
Bar myBar = null;
foreach (Bar b in dotNetBarManager1.Bars)
{
if (b.DockSide == eDockSide.Document && b.Visible)
{
- if(myBar == null)myBar = b;
+ if(myBar == null)myBar = b;// Remember the first available bar if a specific bar cannot be found
foreach (object itm in b.Items)
{
DisplayTabItem myTabItem = itm as DisplayTabItem;
- if (myTabItem != null && myTabItem.MyTabPanel != null)
- if (myTabItem.MyTabPanel.MyItem.ItemID == myItem.MyProcedure.ItemID)
+ if (myTabItem != null && myTabItem.MyStepTabPanel != null)
+ if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
return b;
}
}
@@ -192,64 +310,81 @@ namespace Volian.Controls.Library
}
return myBar;
}
- private DisplayTabItem OpenDisplayTabPage(ItemInfo myItem)
+ ///
+ /// This opens a Step page based upon a ItemInfo.
+ ///
+ ///
+ ///
+ ///
+ private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo)
{
- ItemInfo proc = myItem.MyProcedure; // Find procedure Item
+ ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString();
DisplayTabItem pg = null;
- if (_MyPages.ContainsKey(key)) // If Procedure Open use it
+ if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{
- pg = _MyPages[key];
+ pg = _MyDisplayTabItems[key];
pg.Selected = true;
- SelectedTab = pg;
+ SelectedDisplayTabItem = pg;
}
- else
+ else // If not already open, create a new Page
{
pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
- _MyPages.Add(key, pg);
+ _MyDisplayTabItems.Add(key, pg);
pg.Selected = true;
- SelectedTab = pg;
- pg.MyTabPanel.MyItem = proc;
+ SelectedDisplayTabItem = pg;
+ pg.MyStepTabPanel.MyProcedureItemInfo = proc;
}
Application.DoEvents();
- pg.ItemSelected = myItem; // Select the item
+ pg.SelectedItemInfo = myItemInfo; // Select the item
#if (DEBUG)
- pg.MyTabPanel.MyPanel.BackColor = SystemColors.Control;
+ pg.MyStepTabPanel.MyStepPanel.BackColor = SystemColors.Control;
#else
pg.MyTabPanel.MyPanel.BackColor = Color.White;
#endif
return pg;
}
- internal void RemoveItem(DisplayTabItem myItem)
- {
- _MyPages.Remove(myItem.MyKey);
- // Can I dispose the Panel
- if(myItem.MyTabPanel!=null)
- myItem.MyTabPanel.Dispose();
- if (myItem.MyDSOTabPanel != null)
- myItem.MyDSOTabPanel.CloseDSO();
- components.Remove(myItem);
- myItem.Dispose();
- }
- private DisplayTabItem OpenDSOTabPage(ItemInfo myItem)
+ ///
+ /// This opens a Word page based upon an itemInfo. Since a word document may be a library
+ /// document, the related DocID is used for the Word document.
+ ///
+ ///
+ ///
+ private DisplayTabItem OpenDSOTabPage(ItemInfo myItemInfo)
{
DisplayTabItem pg = null;
- EntryInfo myEntry = myItem.MyContent.MyEntry;
+ EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
string key = "Doc - " + myEntry.DocID;
- if (_MyPages.ContainsKey(key)) // If Procedure Open use it
- pg = _MyPages[key];
+ if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
+ pg = _MyDisplayTabItems[key];
else
{
- if (DSOTabPanel.Count > 18)
+ if (DSOTabPanel.Count > 18) // Limit the number of open document pages to 18
{
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
return null;
}
- pg = new DisplayTabItem(this.components, this, myItem,key); // Open a new Procedure Tab
- _MyPages.Add(key, pg);
+ pg = new DisplayTabItem(this.components, this, myItemInfo,key); // Open a new document page
+ _MyDisplayTabItems.Add(key, pg);
}
- SelectedTab = pg;
+ SelectedDisplayTabItem = pg;
return pg;
}
+ ///
+ /// Clean-up after a page is closed
+ ///
+ ///
+ internal void RemoveItem(DisplayTabItem myDisplayTabItem)
+ {
+ _MyDisplayTabItems.Remove(myDisplayTabItem.MyKey);
+ // Dispose the Panel
+ if(myDisplayTabItem.MyStepTabPanel!=null)
+ myDisplayTabItem.MyStepTabPanel.Dispose();
+ if (myDisplayTabItem.MyDSOTabPanel != null)
+ myDisplayTabItem.MyDSOTabPanel.CloseDSO();
+ components.Remove(myDisplayTabItem);
+ myDisplayTabItem.Dispose();
+ }
+ #endregion
}
}
diff --git a/PROMS/Volian.Controls.Library/DisplayTabItem.cs b/PROMS/Volian.Controls.Library/DisplayTabItem.cs
index c2c3485e..fe37afa5 100644
--- a/PROMS/Volian.Controls.Library/DisplayTabItem.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTabItem.cs
@@ -10,101 +10,138 @@ namespace Volian.Controls.Library
{
public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem
{
- private DisplayTabControl _MyTabControl;
- private ItemInfo _MyItem;
-
- public ItemInfo MyItem
- {
- get { return _MyItem; }
- set { _MyItem = value; }
- }
- private StepTabPanel _MyTabPanel;
+ #region Private Fields
+ private DisplayTabControl _MyDisplayTabControl;
+ private ItemInfo _MyItemInfo;
+ private StepTabPanel _MyStepTabPanel;
private string _MyKey;
+ private DSOTabPanel _MyDSOTabPanel;
+ #endregion
+ #region Properties
+ ///
+ /// ItemInfo associated with this DisplayTabItem
+ ///
+ public ItemInfo MyItemInfo
+ {
+ get { return _MyItemInfo; }
+ //set { _MyItemInfo = value; }
+ }
+ ///
+ /// get Key Either:
+ /// "Item - " + Procedure ItemID for step pages
+ /// "Doc - " + DocumentID for Word Documents
+ ///
public string MyKey
{
get { return _MyKey; }
}
- public StepTabPanel MyTabPanel
+ ///
+ /// Related StepTabPanel for a Step page
+ ///
+ public StepTabPanel MyStepTabPanel
{
- get { return _MyTabPanel; }
- set { _MyTabPanel = value; }
+ get { return _MyStepTabPanel; }
+ set { _MyStepTabPanel = value; }
}
- private DSOTabPanel _MyDSOTabPanel;
+ ///
+ /// Related DSOTabPanle for a Word page
+ ///
public DSOTabPanel MyDSOTabPanel
{
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
- public ItemInfo ItemSelected
+ ///
+ /// Current SelectedItemInfo for this page
+ ///
+ public ItemInfo SelectedItemInfo
{
- get { return _MyTabPanel.ItemSelected; }
- set { _MyTabPanel.ItemSelected = value; }
+ get { return _MyStepTabPanel.SelectedItemInfo; }
+ set { _MyStepTabPanel.SelectedItemInfo = value; }
}
- public DisplayTabItem(IContainer container, DisplayTabControl myTabControl, ItemInfo myItem, string myKey)
+ #endregion
+ #region Constructors
+ public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
{
_MyKey = myKey;
- _MyTabControl = myTabControl;
- _MyItem = myItem;
+ _MyDisplayTabControl = myDisplayTabControl;
+ _MyItemInfo = myItemInfo;
container.Add(this);
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
- if (myItem.MyContent.MyEntry == null)
- SetupDisplayTabPanel();
+ if (myItemInfo.MyContent.MyEntry == null)
+ SetupStepTabPanel();
else
- SetupDSOPanel();
- Name = string.Format("DisplayTabItem {0}", myItem.ItemID);
+ SetupDSOTabPanel();
+ Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
}
- void DisplayTabItem_Click(object sender, EventArgs e)
+ #endregion
+ #region Event Handlers
+ ///
+ /// Updates SelectedStepItem when the user selects a DisplayTabItem
+ ///
+ ///
+ ///
+ private void DisplayTabItem_Click(object sender, EventArgs e)
{
- // See if I can tell the TabControl that the ItemSelected has changed
+ // Tell the TabControl that the ItemSelected has changed
DisplayTabItem myTabItem = sender as DisplayTabItem;
if(myTabItem == null)return;
- StepTabPanel myTabPanel = myTabItem.MyTabPanel as StepTabPanel;
+ StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel;
if(myTabPanel == null) return;
- _MyTabControl.OnItemSelectedChanged(this,new DisplayPanelEventArgs(MyTabPanel.SelectedItem,null));
+ _MyDisplayTabControl.OnItemSelectedChanged(this,new StepPanelEventArgs(MyStepTabPanel.SelectedStepItem,null));
}
- private void SetupDisplayTabPanel()
+ #endregion
+ #region private Methods
+ ///
+ /// Creates and sets-up a StepTabPanel
+ ///
+ private void SetupStepTabPanel()
{
- ((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).BeginInit();
- _MyTabControl.MyBar.SuspendLayout();
- _MyTabPanel = new StepTabPanel(_MyTabControl);
+ ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
+ _MyDisplayTabControl.MyBar.SuspendLayout();
+ _MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
//
// tabItem
//
- Control = _MyTabPanel;
- Name = "tabItem Item " + _MyItem.ItemID;
- Text = _MyItem.TabTitle;
- Tooltip = _MyItem.TabToolTip;
+ Control = _MyStepTabPanel;
+ Name = "tabItem Item " + _MyItemInfo.ItemID;
+ Text = _MyItemInfo.TabTitle;
+ Tooltip = _MyItemInfo.TabToolTip;
//
- _MyTabControl.Controls.Add(_MyTabPanel);
- _MyTabControl.MyBar.Items.Add(this);
+ _MyDisplayTabControl.Controls.Add(_MyStepTabPanel);
+ _MyDisplayTabControl.MyBar.Items.Add(this);
//
// tabPanel
//
- _MyTabPanel.TabItem = this;
- ((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).EndInit();
- _MyTabControl.MyBar.ResumeLayout(false);
+ _MyStepTabPanel.MyDisplayTabItem = this;
+ ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit();
+ _MyDisplayTabControl.MyBar.ResumeLayout(false);
}
- private void SetupDSOPanel()
+ ///
+ /// Creates and sets-up a DSOTabPanel
+ ///
+ private void SetupDSOTabPanel()
{
- EntryInfo myEntry = _MyItem.MyContent.MyEntry;
- _MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyTabControl);
+ EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
+ _MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl);
//
// tabItem
//
Control = _MyDSOTabPanel;
- Name = "tabItem Item " + _MyItem.ItemID;
- Text = _MyItem.TabTitle;
- Tooltip = _MyItem.TabToolTip;
+ Name = "tabItem Item " + _MyItemInfo.ItemID;
+ Text = _MyItemInfo.TabTitle;
+ Tooltip = _MyItemInfo.TabToolTip;
//
- _MyTabControl.Controls.Add(_MyDSOTabPanel);
- _MyTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
+ _MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
+ _MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this});
//
// tabPanel
//
- _MyTabControl.SelectedTab = this;
- _MyDSOTabPanel.TabItem = this;
+ _MyDisplayTabControl.SelectedDisplayTabItem = this;
+ _MyDSOTabPanel.MyDisplayTabItem = this;
}
+ #endregion
}
}
diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs
index be56ee92..f3cc64dc 100644
--- a/PROMS/Volian.Controls.Library/DisplayTransition.cs
+++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs
@@ -27,15 +27,15 @@ namespace Volian.Controls.Library
if (value == null) // Insert a transition
{
if (MyRTB == null) return;
- if (_CurTrans == value && _CurItemFrom == MyRTB.MyItem) return;
- _CurItemFrom = MyRTB.MyItem;
+ if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return;
+ _CurItemFrom = MyRTB.MyItemInfo;
_TranFmtIndx = 0;
}
else // Modify a transition
{
if (_CurTrans == value) return;
_TranFmtIndx = value.TranType;
- _CurItemFrom = MyRTB.MyItem;
+ _CurItemFrom = MyRTB.MyItemInfo;
}
_CurTrans = value;
_SavCurItemFrom = _CurItemFrom;
@@ -67,25 +67,25 @@ namespace Volian.Controls.Library
if (!Visible) return;
// add or remove events for
if (_MyRTB != null)
- _MyRTB.LinkChanged -= new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
+ _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (value == null) return;
_MyRTB = value;
- _MyRTB.LinkChanged += new DisplayRTBLinkEvent(_MyRTB_LinkChanged);
+ _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (_MyRTB.MyLinkText == null)
{
CurTrans = null;
}
}
}
- void _MyRTB_LinkChanged(object sender, LinkClickedEventArgs e)
+ void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
{
- if (_MyRTB.MyLinkText == null)
- CurTrans = null;
- else
- {
- DisplayLinkEventArgs tmp = new DisplayLinkEventArgs(null, e);
- CurTrans = tmp.MyTransition;
- }
+ //if (_MyRTB.MyLinkText == null)
+ // CurTrans = null;
+ //else
+ //{
+ // StepPanelLinkEventArgs tmp = new StepPanelLinkEventArgs(null, e);
+ CurTrans = args.MyTransitionInfo;
+ //}
}
private ItemInfo _CurrentItemProcedure; // the selected item's procedure
private ItemInfo _CurrentToProcedure; // the 'to' location's procedure (may be same as _CurrentItemProcedure)
diff --git a/PROMS/Volian.Controls.Library/MostRecentItem.cs b/PROMS/Volian.Controls.Library/MostRecentItem.cs
index 389455b0..85108a79 100644
--- a/PROMS/Volian.Controls.Library/MostRecentItem.cs
+++ b/PROMS/Volian.Controls.Library/MostRecentItem.cs
@@ -67,19 +67,19 @@ namespace Volian.Controls.Library
public class MostRecentItem
{
[NonSerialized]
- private ItemInfo _MyItem;
- public ItemInfo MyItem
+ private ItemInfo _MyItemInfo;
+ public ItemInfo MyItemInfo
{
get
{
- if (_MyItem == null)
- _MyItem = ItemInfo.Get(_ItemID);
- return _MyItem;
+ if (_MyItemInfo == null)
+ _MyItemInfo = ItemInfo.Get(_ItemID);
+ return _MyItemInfo;
}
set
{
_ItemID = value.ItemID;
- _MyItem = value;
+ _MyItemInfo = value;
_MenuTitle = GetMenuTitle();
_ToolTip = GetToolTip();
}
@@ -103,7 +103,7 @@ namespace Volian.Controls.Library
}
private string GetMenuTitle()
{
- return MyItem.Path;
+ return MyItemInfo.Path;
}
private string _ToolTip;
public string ToolTip
@@ -118,7 +118,7 @@ namespace Volian.Controls.Library
}
private string GetToolTip()
{
- DocVersionInfo tmp = (DocVersionInfo)(MyItem.MyProcedure.ActiveParent);
+ DocVersionInfo tmp = (DocVersionInfo)(MyItemInfo.MyProcedure.ActiveParent);
StringBuilder sb = new StringBuilder();
int indent = BuildPath(tmp.MyFolder, ref sb);
return sb.ToString();
@@ -143,7 +143,7 @@ namespace Volian.Controls.Library
}
public MostRecentItem(ItemInfo myItem)
{
- MyItem = myItem;
+ MyItemInfo = myItem;
}
}
}
diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs
index 481d4855..358f4c54 100644
--- a/PROMS/Volian.Controls.Library/StepItem.cs
+++ b/PROMS/Volian.Controls.Library/StepItem.cs
@@ -30,211 +30,262 @@ namespace Volian.Controls.Library
#endregion
public partial class StepItem : UserControl
{
- private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- #region Events
- #endregion
#region Private Fields
- private bool _ChildrenLoaded=false;
- private StepSectionLayoutData _Layout;
- private StepPanel _Panel;
- private ChildRelation _Relation;
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ private StepPanel _MyStepPanel;
+ private ChildRelation _MyChildRelation;
+ private StepItem _MyParentStepItem = null;
+ private StepItem _MySectionStepItem;
+ private StepItem _MyPreviousStepItem = null;
+ private StepItem _MyNextStepItem = null;
+ private bool _ChildrenLoaded = false;
+ private List _MyBeforeStepItems;
+ private List _MyAfterStepItems;
+ private List _MyRNOStepItems;
+ private StepSectionLayoutData _MyStepSectionLayoutData;
private bool _Loading = true;
- private List _Before;
- private List _After;
- private List _RNO;
- private StepData _StepData;
+ private StepData _MyStepData;
+ private ItemInfo _MyItemInfo;
+ private static int _WidthAdjust = 3;
+ private string _TabFormat;
+ private int _ExpandPrefix = 0;
+ private int _ExpandSuffix = 0;
+ private ExpandingStatus _MyExpandingStatus = ExpandingStatus.No;
+ private bool _Colapsing = false;
+ private bool _Moving = false;
+ private int _RNOLevel = 0;
+ private int _SeqLevel = 0;
+ private int _Type;
+ private bool _Circle = false;
+ private bool _CheckOff = false;
+ private bool _ChangeBar = false;
#endregion
- // TODO: Look at modules to see if any should be made static
#region Properties
- private ItemInfo _MyItem;
- public ItemInfo MyItem
+ ///
+ /// This returns the section or procedure for the current item.
+ /// If the item is a step or section, it returns the section
+ /// If it is a procedure, it returns the procedure
+ ///
+ public StepItem MySectionStepItem
{
- get { return _MyItem; }
+ get
+ {
+ if (_MySectionStepItem == null)
+ {
+ if (MyItemInfo.IsSection || MyItemInfo.IsProcedure) _MySectionStepItem = this;
+ else _MySectionStepItem = _MyParentStepItem.MySectionStepItem;
+ }
+ return _MySectionStepItem;
+ }
+ set { _MySectionStepItem = value; }
+ }
+ ///
+ /// Gets or Sets ItemInfo
+ ///
+ public ItemInfo MyItemInfo
+ {
+ get { return _MyItemInfo; }
set
{
- _MyItem = value;
- int typ = (int) value.MyContent.Type;
+ _MyItemInfo = value;
+ int typ = (int)value.MyContent.Type;
if (typ >= 20000)
{
int stepType = typ % 10000;
- _StepData = value.ActiveFormat.PlantFormat.FormatData.StepDataList[stepType];
+ _MyStepData = value.ActiveFormat.PlantFormat.FormatData.StepDataList[stepType];
}
- if (value.MyContent.Type == 20001)
+#if(DEBUG)
+ // TODO: This formatting should come from the format file
+ if (value.MyContent.Type == 20001)
Circle = true;
- if (_TabFormat == "o ")
+ if (_TabFormat == "o ")
CheckOff = true;
- if ((value.ItemID % 25) == 0)
+ if ((value.ItemID % 25) == 0)
ChangeBar = true;
+#endif
}
}
- public StepRTB MyDisplayRTB
+ ///
+ /// Used to connect the RichTextBox with the menus and toolbars
+ ///
+ public StepRTB MyStepRTB
{
- get { return _DisplayRTB; }
+ get { return _MyStepRTB; }
}
- private void SetText()
+ ///
+ /// Return the Parent StepItem
+ ///
+ private StepItem UpOneStepItem
{
- if (_MyItem != null)
- this._DisplayRTB.MyItem = _MyItem;
+ get
+ {
+ StepItem tmp = this;
+ while (tmp != null && tmp.MyParentStepItem == null) tmp = tmp.MyPreviousStepItem;
+ if (tmp != null) return tmp.MyParentStepItem;
+ return null;
+ }
}
- private static int __WidthAdjust = 3;
- private StepItem _MyParent = null;
- public StepItem MyParent
+ ///
+ /// Sets the parent and postions the item with respect to the parent
+ ///
+ public StepItem MyParentStepItem
{
- get { return _MyParent; }
+ get { return _MyParentStepItem; }
set
{
- _MyParent = value;
- if (_MyParent != null)
+ _MyParentStepItem = value;
+ if (_MyParentStepItem != null)
{
- switch (_Relation)
+ switch (_MyChildRelation)
{
case ChildRelation.None: // Same as after
case ChildRelation.After:
// The size depends upon the parent type
- int iType = (int)_MyParent._Type;
+ int iType = (int)_MyParentStepItem._Type;
switch (iType / 10000)
{
- case 0:
- ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom);
- ItemWidth = _Panel.ToDisplay(_Layout.ColT) + _Panel.ToDisplay(_Layout.WidT);
+ case 0: // Procedure
+ ItemLocation = new Point(_MyParentStepItem.ItemLocation.X + 20, _MyParentStepItem.Bottom);
+ ItemWidth = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColT) + _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidT);
break;
- case 1:
- ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom);
- int borderWidth = _DisplayRTB.Width - _DisplayRTB.ClientRectangle.Width;
- TextWidth = __WidthAdjust + borderWidth + _Panel.ToDisplay(_Layout.WidSTableEdit, Convert.ToInt32(_Layout.PMode) - 1);
+ case 1: // Section
+ ItemLocation = new Point(_MyParentStepItem.ItemLocation.X + 20, _MyParentStepItem.Bottom);
+ int borderWidth = _MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width;
+ TextWidth = _WidthAdjust + borderWidth + _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1);
break;
- case 2:
+ case 2: // Step
// if Table then determine width and location based upon it's parent's location
- if (_StepData.Type == "TABLE" || _StepData.ParentType == "TABLE")
+ if (_MyStepData.Type == "TABLE" || _MyStepData.ParentType == "TABLE")
{
- _DisplayRTB.Font = _StepData.Font.WindowsFont;
- ItemWidth = (int)TableWidth(_DisplayRTB.Font, _MyItem.MyContent.Text);
- ItemLocation = new Point(50, _MyParent.Bottom);
- ItemLocation = TableLocation(_MyParent, _Layout, ItemWidth);
+ _MyStepRTB.Font = _MyStepData.Font.WindowsFont;
+ ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text);
+ ItemLocation = new Point(50, _MyParentStepItem.Bottom);
+ ItemLocation = TableLocation(_MyParentStepItem, _MyStepSectionLayoutData, ItemWidth);
}
else
{
- ItemLocation = new Point(_MyParent.TextLeft, _MyParent.Bottom);
- ItemWidth = _MyParent.TextWidth;
+ ItemLocation = new Point(_MyParentStepItem.TextLeft, _MyParentStepItem.Bottom);
+ ItemWidth = _MyParentStepItem.TextWidth;
}
break;
}
break;
case ChildRelation.RNO:
- if (RNOLevel <= _Panel.MaxRNO)
+ if (RNOLevel <= _MyStepPanel.MaxRNO)
{
- int colR = _Panel.ToDisplay(_Layout.ColRTable, Convert.ToInt32(_Layout.PMode) - 1);
- if(colR - _MyParent.Width < 0) colR = _MyParent.Width + 0;
- ItemLocation = new Point(_MyParent.ItemLeft + RNOLevel * colR , _MyParent.Top);
+ int colR = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1);
+ if (colR - _MyParentStepItem.Width < 0) colR = _MyParentStepItem.Width + 0;
+ ItemLocation = new Point(_MyParentStepItem.ItemLeft + RNOLevel * colR, _MyParentStepItem.Top);
}
else
{
- TextLocation = new Point(_MyParent.TextLeft, _MyParent.BottomMost.Bottom);
+ TextLocation = new Point(_MyParentStepItem.TextLeft, _MyParentStepItem.BottomMostStepItem.Bottom);
}
- // Same size as the Parent
+ // Same size as the Parent
TabFormat = "";
- TextWidth = _MyParent.TextWidth;
+ TextWidth = _MyParentStepItem.TextWidth;
break;
case ChildRelation.Before:
- Location = new Point(_MyParent.Left + 20, _MyParent.Top);
- _Panel.Scrolling++;
- _MyParent.Top = Bottom;
- _Panel.Scrolling--;
+ Location = new Point(_MyParentStepItem.Left + 20, _MyParentStepItem.Top);
+ _MyStepPanel.ItemMoving++;
+ _MyParentStepItem.Top = Bottom;
+ _MyStepPanel.ItemMoving--;
// Could be a Caution or Note - Need to get WidT
- Width = _Panel.ToDisplay(_Layout.WidT);
+ Width = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidT);
break;
}
}
}
}
- private float TableWidth(Font fnt, string txt)
- {
- string[] lines = txt.Split("\n".ToCharArray());
- float max = 0;
- Graphics g = this.CreateGraphics();
- PointF pnt = new PointF(0, 0);
- foreach (string line in lines)
- {
- string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands
- SizeF siz = g.MeasureString(line2, fnt,pnt,StringFormat.GenericTypographic) ;
- if (siz.Width+ _Panel.Settings.TableWidthAdjust > max) max = siz.Width + _Panel.Settings.TableWidthAdjust;
- }
- return max;
- }
- private Point TableLocation(StepItem parent, StepSectionLayoutData layout, int width)
- {
- int x = parent.TextLeft;
- int y = parent.Bottom;
- if (x + width > parent.Right) x = parent.Right - width;
- int colT = _Panel.ToDisplay(layout.ColT);
- if (x < colT) x = colT;
- return new Point(x,y);
- }
+ ///
+ /// The left edge of the Tab
+ ///
public int ItemLeft
{
- get { return Left+lblTab.Left; }
- set { Left = value - lblTab.Left; }
+ get { return Left + lblTab.Left; }
+ set { Left = value - lblTab.Left; }
}
+ ///
+ /// The Top of the StepItem
+ ///
public int ItemTop
{
get { return Top; }
- set {
- _Panel.Scrolling++;
+ set
+ {
+ _MyStepPanel.ItemMoving++;
Top = value;
- _Panel.Scrolling--;
+ _MyStepPanel.ItemMoving--;
}
}
+ ///
+ /// The Location of the Tab
+ ///
public Point ItemLocation
{
get { return new Point(Location.X + lblTab.Left, Location.Y); }
- set { Location = new Point(value.X - lblTab.Left,value.Y); }
+ set { Location = new Point(value.X - lblTab.Left, value.Y); }
}
+ ///
+ /// Width of the Tab and RTB
+ ///
public int ItemWidth
{
get { return Width - lblTab.Left; }
- set
+ set
{
- Width = value + lblTab.Left;
+ Width = value + lblTab.Left;
}
}
+ ///
+ /// Width of the RichTextBox
+ ///
public int TextWidth
{
- get { return _DisplayRTB.Width; }
- set
+ get { return _MyStepRTB.Width; }
+ set
{
- Width = value + lblTab.Left + lblTab.Width;
+ Width = value + lblTab.Left + lblTab.Width;
}
}
+ ///
+ /// Location of the RichTextBox
+ ///
public Point TextLocation
{
- get { return new Point(Location.X + _DisplayRTB.Left, Location.Y); }
- set { Location = new Point(value.X - _DisplayRTB.Left, value.Y); }
+ get { return new Point(Location.X + _MyStepRTB.Left, Location.Y); }
+ set { Location = new Point(value.X - _MyStepRTB.Left, value.Y); }
}
+ ///
+ /// Left edge of the RichTextBox
+ ///
public int TextLeft
{
- get { return Left + _DisplayRTB.Left; }
+ get { return Left + _MyStepRTB.Left; }
}
- private string _TabFormat ;
+ ///
+ /// Tab Format used for outputing the Tab
+ ///
public string TabFormat
{
get { return _TabFormat; }
set
{
_TabFormat = value;
- if (_MyItem != null)
+ if (_MyItemInfo != null)
{
string tabString = _TabFormat;
switch (_Type / 10000)
{
case 0: // Procedure
//// TIMING: DisplayItem.TimeIt("TabFormat Start");
- tabString = _MyItem.MyContent.Number.PadRight(20);
+ tabString = _MyItemInfo.MyContent.Number.PadRight(20);
//// TIMING: DisplayItem.TimeIt("TabFormat End");
break;
case 1: // Section
//// TIMING: DisplayItem.TimeIt("TabFormat Start");
- tabString = _MyItem.MyContent.Number.PadRight(20);
+ tabString = _MyItemInfo.MyContent.Number.PadRight(20);
//// TIMING: DisplayItem.TimeIt("TabFormat End");
break;
case 2: // Step
@@ -254,33 +305,38 @@ namespace Volian.Controls.Library
}
lblTab.Text = tabString;
lblTab.Width = tabString.Length * 8;
- _DisplayRTB.Left = lblTab.Left + lblTab.Width;// +2;
- _DisplayRTB.Width = Width - _DisplayRTB.Left;
+ _MyStepRTB.Left = lblTab.Left + lblTab.Width;// +2;
+ _MyStepRTB.Width = Width - _MyStepRTB.Left;
// TODO: Performance - SetToolTip();
}
}
}
+ ///
+ /// This is the "number" of the item (1, 2, 3 etc.) for Substeps
+ ///
public int Ordinal
{
- get
+ get
{
int count = 1;
- for (StepItem tmp = this; tmp.Previous != null; tmp = tmp.Previous) count++;
+ for (StepItem tmp = this; tmp.MyPreviousStepItem != null; tmp = tmp.MyPreviousStepItem) count++;
return count;
}
}
- private StepItem _Previous = null;
- public StepItem Previous
+ ///
+ /// Sets the previous item and adjusts locations
+ ///
+ public StepItem MyPreviousStepItem
{
- get { return _Previous; }
+ get { return _MyPreviousStepItem; }
set
{
- _Previous = value;
- if (_Previous != null)
+ _MyPreviousStepItem = value;
+ if (_MyPreviousStepItem != null)
{
- Location = new Point(_Previous.Left, _Previous.BottomMost.Bottom);
- Width = Previous.Width;
- switch (_Relation)
+ Location = new Point(_MyPreviousStepItem.Left, _MyPreviousStepItem.BottomMostStepItem.Bottom);
+ Width = MyPreviousStepItem.Width;
+ switch (_MyChildRelation)
{
case ChildRelation.None:
break;
@@ -289,40 +345,50 @@ namespace Volian.Controls.Library
case ChildRelation.RNO:
break;
case ChildRelation.Before:
- _Panel.Scrolling++;
- UpOne.Top = BottomMost.Bottom;
- _Panel.Scrolling--;
+ _MyStepPanel.ItemMoving++;
+ UpOneStepItem.Top = BottomMostStepItem.Bottom;
+ _MyStepPanel.ItemMoving--;
break;
}
- if (_Previous.Next != this) _Previous.Next = this;
+ if (_MyPreviousStepItem.MyNextStepItem != this) _MyPreviousStepItem.MyNextStepItem = this;
}
}
}
- private StepItem _Next = null;
- public StepItem Next
+ ///
+ /// Sets the next item and adjusts the location,
+ /// This also sets the previous for the "next" item
+ /// which adjusts other locations.
+ ///
+ public StepItem MyNextStepItem
{
- get { return _Next; }
+ get { return _MyNextStepItem; }
set
{
- _Next = value;
- if (_Next != null)
+ _MyNextStepItem = value;
+ if (_MyNextStepItem != null)
{
- if (_Next.Previous != this)
+ if (_MyNextStepItem.MyPreviousStepItem != this)
{
- _Next.Previous = this;
- Next.Location = new Point(Left, Bottom);
+ _MyNextStepItem.MyPreviousStepItem = this;
+ MyNextStepItem.Location = new Point(Left, Bottom);
}
}
}
}
- public StepItem TopMost
+ ///
+ /// returns the TopMostChild
+ ///
+ public StepItem TopMostStepItem
{
get
{
- if (Expanded && _Before != null) return _Before[0].TopMost;
+ if (Expanded && _MyBeforeStepItems != null) return _MyBeforeStepItems[0].TopMostStepItem;
return this;
}
}
+ ///
+ /// Returns the bottom location (Top + Height)
+ ///
public new int Bottom
{
get
@@ -330,14 +396,18 @@ namespace Volian.Controls.Library
return Top + (Visible ? Height : 0);
}
}
- public StepItem BottomMost
+ ///
+ /// Bottom most child
+ ///
+ public StepItem BottomMostStepItem
{
get
{
- StepItem tmpr = null;
- if ((Expanding != ExpandingStatus.No || Expanded) && _RNO != null) tmpr = _RNO[_RNO.Count - 1].BottomMost;
- StepItem tmpa = this;
- if ((Expanding != ExpandingStatus.No || Expanded) & _After != null) tmpa = _After[_After.Count - 1].BottomMost;
+ StepItem tmpr = null; // BottomMost RNO
+ if ((MyExpandingStatus != ExpandingStatus.No || Expanded) && _MyRNOStepItems != null) tmpr = _MyRNOStepItems[_MyRNOStepItems.Count - 1].BottomMostStepItem;
+ StepItem tmpa = this; // BottomMost After
+ if ((MyExpandingStatus != ExpandingStatus.No || Expanded) & _MyAfterStepItems != null) tmpa = _MyAfterStepItems[_MyAfterStepItems.Count - 1].BottomMostStepItem;
+ // return the bottom most of the two results
if (tmpr == null)
return tmpa;
if (tmpa.Bottom >= tmpr.Bottom)
@@ -345,421 +415,657 @@ namespace Volian.Controls.Library
return tmpr;
}
}
- private StepItem FirstSibling
+ ///
+ /// First sibling
+ ///
+ private StepItem FirstSiblingStepItem
{
get
{
StepItem tmp = this;
- while (tmp.Previous != null)
- tmp = tmp.Previous;
+ while (tmp.MyPreviousStepItem != null)
+ tmp = tmp.MyPreviousStepItem;
return tmp;
}
}
- private int _ExpandPrefix = 0;
- private int _ExpandSuffix = 0;
- private StepItem LastSibling
+ ///
+ /// Last sibling
+ ///
+ private StepItem LastSiblingStepItem
{
get
{
StepItem tmp = this;
- while (tmp.Next != null)
- tmp = tmp.Next;
+ while (tmp.MyNextStepItem != null)
+ tmp = tmp.MyNextStepItem;
return tmp;
}
}
+ ///
+ /// Returns the status of the vlnExpander unless it is in the process of expanding or collapsing
+ /// If it is colapsing it returns false
+ /// If it is expanding it returns true
+ ///
public bool Expanded
{
- get { return !_Colapsing && (Expanding != ExpandingStatus.No || vlnExp.Expanded); }
- set { vlnExp.Expanded = value; }
+ get { return !_Colapsing && (MyExpandingStatus != ExpandingStatus.No || _MyvlnExpander.Expanded); }
+ set { _MyvlnExpander.Expanded = value; }
}
- private ExpandingStatus _Expanding = ExpandingStatus.No; // Volian Property Snippet
- public ExpandingStatus Expanding
+ ///
+ /// Sets or Gets expanding status
+ ///
+ public ExpandingStatus MyExpandingStatus
{
- get { return _Expanding; }
- set { _Expanding = value; }
+ get { return _MyExpandingStatus; }
+ set { _MyExpandingStatus = value; }
}
- private bool _Colapsing = false; // Volian Property Snippet
+ ///
+ /// Gets or sets colapsing
+ ///
public bool Colapsing
{
get { return _Colapsing; }
set { _Colapsing = value; }
}
+ ///
+ /// Gets or Sets the ability to expand
+ ///
public bool CanExpand
{
- get { return vlnExp.Visible; }
- set { vlnExp.Visible = value; }
+ get { return _MyvlnExpander.Visible; }
+ set { _MyvlnExpander.Visible = value; }
}
+ ///
+ /// Gets the text from the content
+ ///
public string MyText
{
- get { return _MyItem == null ? null : _MyItem.MyContent.Text; }
+ get { return _MyItemInfo == null ? null : _MyItemInfo.MyContent.Text; }
}
+ ///
+ /// Gets the ItemID from the ItemInfo
+ ///
public int MyID
{
- get { return _MyItem == null ? 0 : _MyItem.ItemID; }
+ get { return _MyItemInfo == null ? 0 : _MyItemInfo.ItemID; }
}
- private bool _Moving = false; // Volian Property Snippet
+ ///
+ /// Tracks when a StepItem is moving
+ ///
public bool Moving
{
get { return _Moving; }
set { _Moving = value; }
}
- private int _RNOLevel =0; // Volian Property Snippet
+ ///
+ /// The RNO (Contingency) Level
+ ///
public int RNOLevel
{
get { return _RNOLevel; }
set { _RNOLevel = value; }
}
- private int _SeqLevel = 0; // Volian Property Snippet
+ ///
+ /// Sequential Level - Only counts levels of Sequential substeps
+ ///
public int SeqLevel
{
get { return _SeqLevel; }
set { _SeqLevel = value; }
}
- private int _Type;
- #endregion
+ // TODO: This should be changed to get the Circle format from the data
+ ///
+ /// Show a circle or not
+ ///
+ public bool Circle
+ {
+ get { return _Circle; }
+ set { _Circle = value; }
+ }
+ // TODO: This should be changed to get the Checkoff status from the data
+ ///
+ /// Has a check-off or not
+ ///
+ public bool CheckOff
+ {
+ get { return _CheckOff; }
+ set { _CheckOff = value; }
+ }
+ // TODO: This should be changed to get the ChangeBar status from the data
+ ///
+ /// Has a changebar or not
+ ///
+ public bool ChangeBar
+ {
+ get { return _ChangeBar; }
+ set { _ChangeBar = value; }
+ }
+ #endregion // Properties
#region Constructors
- public StepItem(ItemInfo item, StepPanel panel, StepItem parent, ChildRelation relationType, bool expand)
+ public StepItem(ItemInfo itemInfo, StepPanel myStepPanel, StepItem myParentStepItem, ChildRelation myChildRelation, bool expand)
{
//// TIMING: DisplayItem.TimeIt("CSLARTB Top");
InitializeComponent();// TODO: Performance 25%
+ _MyStepRTB.MyStepItem = this;
//// TIMING: DisplayItem.TimeIt("CSLARTB InitComp");
- BackColor = panel.PanelColor;
- _DisplayRTB.BackColor = panel.InactiveColor;
+ BackColor = myStepPanel.PanelColor;
+ _MyStepRTB.BackColor = myStepPanel.InactiveColor;
// TODO: Adjust top based upon format
// TODO: Remove Label and just output ident on the paint event
lblTab.Top = 3;
- _DisplayRTB.Top = 3;
- this.Paint += new PaintEventHandler(DisplayItem_Paint);
- this.BackColorChanged += new EventHandler(DisplayItem_BackColorChanged);
- //_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
- //_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave);
- //_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus);
- //_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus);
- //_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
- if (item != null)
+ _MyStepRTB.Top = 3;
+ this.Paint += new PaintEventHandler(StepItem_Paint);
+ this.BackColorChanged += new EventHandler(StepItem_BackColorChanged);
+ if (itemInfo != null)
{
- _Type = (int)item.MyContent.Type;
+ _Type = (int)itemInfo.MyContent.Type;
switch (_Type / 10000)
{
- case 0:
- _DisplayRTB.Font = lblTab.Font = panel.ProcFont;
+ case 0: // Procedure
+ _MyStepRTB.Font = lblTab.Font = myStepPanel.ProcFont;
break;
- case 1:
- _DisplayRTB.Font = lblTab.Font = panel.SectFont;
+ case 1: // Section
+ _MyStepRTB.Font = lblTab.Font = myStepPanel.SectFont;
break;
- case 2:
- _DisplayRTB.Font = lblTab.Font = panel.StepFont;
- _StepData = item.ActiveFormat.PlantFormat.FormatData.StepDataList[_Type%10000];
+ case 2: // Steps
+ _MyStepRTB.Font = lblTab.Font = myStepPanel.StepFont;
+ _MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[_Type % 10000];
break;
}
//this.Move += new EventHandler(DisplayItem_Move);
}
else
{
- if (panel.MyFont != null) _DisplayRTB.Font = lblTab.Font = panel.MyFont;
+ if (myStepPanel.MyFont != null) _MyStepRTB.Font = lblTab.Font = myStepPanel.MyFont;
}
- if (expand) vlnExp.ShowExpanded();
- _Panel = panel;
- if(item != null)panel.ItemLookup.Add(item.ItemID, this);
- _Relation = relationType;
- if(parent != null)RNOLevel = parent.RNOLevel;
- if (item != null)
+ if (expand) _MyvlnExpander.ShowExpanded();
+ _MyStepPanel = myStepPanel;
+ if (itemInfo != null) myStepPanel._LookupStepItems.Add(itemInfo.ItemID, this);
+ _MyChildRelation = myChildRelation;
+ if (myParentStepItem != null) RNOLevel = myParentStepItem.RNOLevel;
+ if (itemInfo != null)
{
//// TIMING: DisplayItem.TimeIt("CSLARTB before _Layout");
- _Layout = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
+ _MyStepSectionLayoutData = itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
//// TIMING: DisplayItem.TimeIt("CSLARTB _Layout");
- if (parent != null)
- SeqLevel = parent.SeqLevel + ((relationType == ChildRelation.After || relationType == ChildRelation.Before) && TemporaryFormat.IsSequential(item) ? 1 : 0);
+ if (myParentStepItem != null)
+ SeqLevel = myParentStepItem.SeqLevel + ((myChildRelation == ChildRelation.After || myChildRelation == ChildRelation.Before) && TemporaryFormat.IsSequential(itemInfo) ? 1 : 0);
//// TIMING: DisplayItem.TimeIt("CSLARTB seqLevel");
- MyItem = item;
+ MyItemInfo = itemInfo;
}
//// TIMING: DisplayItem.TimeIt("CSLARTB MyItem");
- switch (relationType)
+ switch (myChildRelation)
{
case ChildRelation.After:
- AddItem(parent, ref parent._After);
+ AddItem(myParentStepItem, ref myParentStepItem._MyAfterStepItems);
break;
case ChildRelation.Before:
- AddItem(parent, ref parent._Before);
+ AddItem(myParentStepItem, ref myParentStepItem._MyBeforeStepItems);
break;
case ChildRelation.RNO:
- RNOLevel = parent.RNOLevel + 1;
- AddItem(parent, ref parent._RNO);
- break;
+ RNOLevel = myParentStepItem.RNOLevel + 1;
+ AddItem(myParentStepItem, ref myParentStepItem._MyRNOStepItems);
+ break;
case ChildRelation.None:
break;
}
- if (item != null)
+ if (itemInfo != null)
{
- if (relationType == ChildRelation.None)
+ if (myChildRelation == ChildRelation.None)
{
- if (_Type == 0 && _Layout != null)
+ if (_Type == 0 && _MyStepSectionLayoutData != null)
{
- Width = _Panel.ToDisplay(_Layout.WidT);
+ Width = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidT);
}
}
}
//// TIMING: DisplayItem.TimeIt("CSLARTB Parent");
SetText();
//// TIMING: DisplayItem.TimeIt("CSLARTB SetText");
- if (item != null)
+ if (itemInfo != null)
{
- Name = string.Format("Item-{0}", item.ItemID);
+ Name = string.Format("Item-{0}", itemInfo.ItemID);
// Don't allow substeps to expand
switch (_Type / 10000)
{
- case 1:
+ case 1: // Section can expand
CanExpand = true;
- vlnExp.Attachment = (item.MyContent.ContentPartCount == 0);
+ // If a word document set the expander to attachment
+ _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0);
break;
- case 2:
- CanExpand = item.IsHigh && item.HasChildren; // TemporaryFormat.IsHigh(item); ;
+ case 2: // High level steps with children can expand
+ CanExpand = itemInfo.IsHigh && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ;
break;
- default:
+ default://Procedures cannot expand, because they automatically expand
CanExpand = false;
break;
}
- if(expand && (item.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
+ if (expand && (itemInfo.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
Expand(true);
else
- if(parent == null)// If it is the top node
- if(_Type >= 20000) // and it is a step - fully expand
+ if (myParentStepItem == null)// If it is the top node
+ if (_Type >= 20000) // and it is a step - fully expand
Expand(true);
else // otherwise only expand one level
Expand(false);
}
//// TIMING: DisplayItem.TimeIt("CSLARTB before Controls Add");
- panel.Controls.Add(this);
+ myStepPanel.Controls.Add(this);
_Loading = false;
//// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add");
}
-
- //void DisplayItem_Move(object sender, EventArgs e)
- //{
- // if(_MyItem != null)
- // if(_MyItem.ItemID == 981)
- // vlnStackTrace.ShowStack("DisplayItem_Move = {0} ({1},{2})", _MyItem.ItemID, Left, Top);// Show StackTrace
- //}
- //void _DisplayRTB_MouseClick(object sender, MouseEventArgs e)
- //{
- // _DisplayRTB.Select();
- //}
- //void _DisplayRTB_Enter(object sender, EventArgs e)
- //{
- // _Panel._ItemSelected = _MyItem;
- // _Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
- //}
- //void _DisplayRTB_LostFocus(object sender, EventArgs e)
- //{
- // //_Panel.ItemSelected = null;
- // //_Panel.OnItemSelectedChanged(sender, null);
- //}
- //void _DisplayRTB_GotFocus(object sender, EventArgs e)
- //{
- // _Panel.ItemSelected = _MyItem;
- // //_Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
- //}
- //void _DisplayRTB_Leave(object sender, EventArgs e)
- //{
- // _Panel._ItemSelected = null;
- // _Panel.OnItemSelectedChanged(sender, null);
- //}
- public void AutoExpand()
- {
- if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections
- {
- //vlnStackTrace.ShowStack(">AutoExpand ID {0} - Can {1} Expanded {2}", _MyItem.ItemID, CanExpand, Expanded);
- Expand(_Type >= 20000);
- //Console.WriteLine("= 0 && Bottom <= _Panel.Height) return;// Don't move if within screen.
- int scrollValue = _Panel.VerticalScroll.Value + (Top - (_Panel.Height / 2)); // calculate scroll center for the item
- //Console.WriteLine("CenterScroll {0} Current {1} New {2} Min {3} Max {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, scrollValue, _Panel.VerticalScroll.Minimum, _Panel.VerticalScroll.Maximum);
- if(scrollValue >= _Panel.VerticalScroll.Minimum && scrollValue <= _Panel.VerticalScroll.Maximum) // If it is within range
- _Panel.VerticalScroll.Value = scrollValue; // Center the item
- }
- private void DisplayItem_Paint(object sender, PaintEventArgs e)
- {
- Graphics g = e.Graphics;
- g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
- g.DrawString(lblTab.Text, _DisplayRTB.Font, Brushes.Black ,new RectangleF(new PointF(_Panel.Settings.NumberLocationX,_Panel.Settings.NumberLocationY),_Panel.Settings.NumberSize), StringFormat.GenericDefault);
- if (Circle)
- {
- Pen penC = new Pen(_Panel.Settings.CircleColor, _Panel.Settings.CircleWeight);
- g.DrawArc(penC, lblTab.Left + 1, 0, _Panel.Settings.CircleDiameter, _Panel.Settings.CircleDiameter, 0F, 360F);
- }
- if (CheckOff)
- {
- Pen penCO = new Pen(_Panel.Settings.CheckOffColor, _Panel.Settings.CheckOffWeight);
- g.DrawRectangle(penCO, _Panel.Settings.CheckOffX, _Panel.Settings.CheckOffY, _Panel.Settings.CheckOffSize, _Panel.Settings.CheckOffSize);
- }
- if (ChangeBar)
- {
- Pen penCB = new Pen(_Panel.Settings.ChangeBarColor, _Panel.Settings.ChangeBarWeight);
- g.DrawLine(penCB, 0, 0, 0, Height);
- }
- }
-
- void DisplayItem_BackColorChanged(object sender, EventArgs e)
- {
- _DisplayRTB.BackColor = BackColor;
- }
-#endregion
+ #endregion
#region AddItem
- public void AddItem(StepItem parent, ref List siblings)
+ ///
+ /// Adds an item to a list
+ ///
+ /// Parent Container
+ /// StepItem List
+ public void AddItem(StepItem parentStepItem, ref List siblingStepItems)
{
- if (siblings == null)
+ if (siblingStepItems == null)
{
- siblings = new List();
- siblings.Add(this);
- MyParent = parent;
+ siblingStepItems = new List();
+ siblingStepItems.Add(this);
+ MyParentStepItem = parentStepItem;
}
else
{
- StepItem lastChild = LastChild(siblings);
- siblings.Add(this);
- Previous = lastChild;
+ StepItem lastChild = LastChild(siblingStepItems);
+ siblingStepItems.Add(this);
+ MyPreviousStepItem = lastChild;
}
TabFormat = TemporaryFormat.TabFormat(this);
}
- public StepItem AddNext(ItemInfo item,bool expand)
- {
- StepItem tmp = new StepItem(item, _Panel,MyParent, ChildRelation.None,expand);
- Next = tmp;
- return tmp;
- }
+ ///
+ /// Add the next item to a list
+ ///
+ ///
+ ///
+ ///
+ //public StepItem AddNext(ItemInfo myItemInfo, bool expand)
+ //{
+ // StepItem tmp = new StepItem(myItemInfo, _MyStepPanel, MyParentStepItem, ChildRelation.None, expand);
+ // MyNextStepItem = tmp;
+ // return tmp;
+ //}
+ #endregion
#region Add Children
- public StepItem LastChild(List children)
+ ///
+ /// Add a child before (Notes, Cautions, etc.)
+ ///
+ ///
+ ///
+ public void AddChildBefore(ItemInfo myItemInfo, bool expand)
{
- return children[children.Count - 1];
+ StepItem child = new StepItem(myItemInfo, _MyStepPanel, this, ChildRelation.Before, expand);
}
- public void AddChildBefore(ItemInfo item,bool expand)
+ ///
+ /// Add a list of children before
+ ///
+ ///
+ ///
+ public void AddChildBefore(ItemInfoList myItemInfoList, bool expand)
{
- StepItem child = new StepItem(item, _Panel,this, ChildRelation.Before,expand);
- }
- public void AddChildBefore(ItemInfoList itemList, bool expand)
- {
- if (itemList != null)
- foreach (ItemInfo item in itemList)
+ if (myItemInfoList != null)
+ foreach (ItemInfo item in myItemInfoList)
AddChildBefore(item, expand);
}
- public void AddChildRNO(ItemInfo item,bool expand)
+ ///
+ /// Add an RNO (Contingency) child
+ ///
+ ///
+ ///
+ public void AddChildRNO(ItemInfo myItemInfo, bool expand)
{
- StepItem child = new StepItem(item, _Panel,this, ChildRelation.RNO,expand);
+ StepItem child = new StepItem(myItemInfo, _MyStepPanel, this, ChildRelation.RNO, expand);
}
- public void AddChildRNO(ItemInfoList itemList,bool expand)
+ ///
+ /// Add a list of RNO (Contingency) children
+ ///
+ ///
+ ///
+ public void AddChildRNO(ItemInfoList myItemInfoList, bool expand)
{
- if (itemList != null)
- foreach (ItemInfo item in itemList)
- AddChildRNO(item,expand);
+ if (myItemInfoList != null)
+ foreach (ItemInfo item in myItemInfoList)
+ AddChildRNO(item, expand);
}
- public void AddChildAfter(ItemInfo item,bool expand)
+ ///
+ /// Add a child after
+ ///
+ ///
+ ///
+ public void AddChildAfter(ItemInfo MyItemInfo, bool expand)
{
- StepItem child = new StepItem(item, _Panel, this, ChildRelation.After,expand);
+ StepItem child = new StepItem(MyItemInfo, _MyStepPanel, this, ChildRelation.After, expand);
child.RNOLevel = this.RNOLevel;
}
- public void AddChildAfter(ItemInfoList itemList,bool expand)
+ ///
+ /// Add a list of children after
+ ///
+ ///
+ ///
+ public void AddChildAfter(ItemInfoList myItemInfoList, bool expand)
{
- if (itemList != null)
- foreach (ItemInfo item in itemList)
- AddChildAfter(item,expand);
+ if (myItemInfoList != null)
+ foreach (ItemInfo item in myItemInfoList)
+ AddChildAfter(item, expand);
}
#endregion
- #endregion
- private void veRichTextBoxText_HeightChanged(object sender, EventArgs args)
+ #region Event Handlers
+ ///
+ /// If the background changes, change the background of the RichTextBox
+ ///
+ ///
+ ///
+ void StepItem_BackColorChanged(object sender, EventArgs e)
{
- this.Height = _DisplayRTB.Height+10;
+ _MyStepRTB.BackColor = BackColor;
}
+ ///
+ /// When the RichTextBox height changes, change the height of the control to match
+ ///
+ ///
+ ///
+ private void _StepRTB_HeightChanged(object sender, EventArgs args)
+ {
+ this.Height = _MyStepRTB.Height + 10;
+ }
+ ///
+ /// Handle the colape event
+ ///
+ ///
+ ///
private void vlnExp_BeforeColapse(object sender, vlnExpanderEventArgs args)
{
Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
- int top = TopMost.Top;// This does'nt work - this is since the last time it was expanded.
+ int top = TopMostStepItem.Top;// This does'nt work - this is since the last time it was expanded.
_Colapsing = true;
// Hide Children
HideChildren();
// Adjust Positions
_ExpandPrefix = Top - top;
- _ExpandSuffix = BottomMost.Bottom - Bottom;
+ _ExpandSuffix = BottomMostStepItem.Bottom - Bottom;
if (Top != top)
{
- _Panel.Scrolling++;
+ _MyStepPanel.ItemMoving++;
Top = top;
- _Panel.Scrolling--;
+ _MyStepPanel.ItemMoving--;
}
else
AdjustLocation();
- BottomMost.AdjustLocation();
+ BottomMostStepItem.AdjustLocation();
_Colapsing = false;
Cursor.Current = tmp;
}
+ ///
+ /// Handle the expand event
+ ///
+ ///
+ ///
+ private void vlnExp_BeforeExpand(object sender, vlnExpanderEventArgs args)
+ {
+ Cursor tmp = Cursor.Current;
+ Cursor.Current = Cursors.WaitCursor;
+ if (!_Loading && MyExpandingStatus == ExpandingStatus.No)
+ Expand(_Type >= 20000);
+ Cursor.Current = tmp;
+ }
+ ///
+ /// Adjust the locations when the StepItem is resized
+ ///
+ ///
+ ///
+ private void StepItem_Resize(object sender, EventArgs e)
+ {
+ if (_MyItemInfo == null) return;
+ AdjustLocation();
+ }
+ ///
+ /// Handles movement of the StepItems
+ ///
+ ///
+ ///
+ private void StepItem_Move(object sender, EventArgs e)
+ {
+ if (_MyStepPanel.ItemMoving == 0) return; // If 0 - Indicates scrolling which requires no action.
+ if (_MyItemInfo == null) return;
+ if (MyExpandingStatus == ExpandingStatus.Expanding) return;
+ _Moving = true;
+ StepItem tmp = (StepItem)sender;
+ if (tmp._MyPreviousStepItem == null && tmp._MyParentStepItem == null)
+ {
+ return;
+ }
+ AdjustLocation();
+ if (_MyRNOStepItems != null)
+ {
+ if (_MyRNOStepItems[0].TopMostStepItem.Top != Top)
+ {
+ //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n'Adjust RNO',{0},'Move',{1}", MyID, _RNO[0].MyID);
+ if (RNOLevel >= _MyStepPanel.MaxRNO)
+ {
+ StepItem tmpBottom = this;
+ if (_MyAfterStepItems != null) tmpBottom = _MyAfterStepItems[_MyAfterStepItems.Count - 1].BottomMostStepItem;
+ _MyStepPanel.ItemMoving++;
+ _MyRNOStepItems[0].TopMostStepItem.Top = tmpBottom.Bottom;
+ _MyStepPanel.ItemMoving--;
+ }
+ else
+ {
+ _MyStepPanel.ItemMoving++;
+ _MyRNOStepItems[0].TopMostStepItem.Top = Top;
+ _MyStepPanel.ItemMoving--;
+ }
+ }
+ }
+ _Moving = false;
+ BottomMostStepItem.AdjustLocation();
+ }
+ ///
+ /// Handle the LinkGoTO event
+ ///
+ ///
+ ///
+ private void _StepRTB_LinkGoTo(object sender, StepPanelLinkEventArgs args)
+ {
+ _MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + args.LinkInfoText);
+ _MyStepPanel.OnLinkClicked(sender, args);
+ }
+ ///
+ /// Raises an ItemClick event when the user clicks on the Tab
+ ///
+ ///
+ ///
+ private void lblTab_MouseDown(object sender, MouseEventArgs e)
+ {
+ _MyStepPanel.OnItemClick(this, new StepPanelEventArgs(this, e));
+ }
+ ///
+ /// When a RichTextBox is entered, the selected StepRTB is set
+ ///
+ ///
+ ///
+ private void _StepRTB_Enter(object sender, EventArgs e)
+ {
+ _MyStepPanel.SelectedStepRTB = _MyStepRTB;
+ }
+ ///
+ /// Raise a OnLinkModifyTran event, when the user chooses to Modify a transition
+ ///
+ ///
+ ///
+ private void _StepRTB_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
+ {
+ _MyStepPanel.OnLinkModifyTran(sender, args);
+ }
+ ///
+ /// Raise a OnLinkModifyRO event, when the user chooses to modify an RO
+ ///
+ ///
+ ///
+ private void _StepRTB_LinkModifyRO(object sender, StepPanelLinkEventArgs args)
+ {
+ _MyStepPanel.OnLinkModifyRO(sender, args);
+ }
+ ///
+ /// Pass the AttachmentClick event to the StepPanel control.
+ ///
+ ///
+ ///
+ private void vlnExp_AttachmentClick(object sender, vlnExpanderEventArgs args)
+ {
+ _MyStepPanel.OnAttachmentClicked(sender, new StepPanelAttachmentEventArgs(this));
+ }
+ #endregion // Event Handlers
+ #region Private Methods
+ ///
+ /// Finds the last child in a list
+ ///
+ ///
+ ///
+ private static StepItem LastChild(List childStepItems)
+ {
+ return childStepItems[childStepItems.Count - 1];
+ }
+ ///
+ /// Calculate the width of the table
+ ///
+ ///
+ ///
+ ///
+ private float TableWidth(Font myFont, string txt)
+ {
+ string[] lines = txt.Split("\n".ToCharArray());
+ float max = 0;
+ Graphics g = this.CreateGraphics();
+ PointF pnt = new PointF(0, 0);
+ foreach (string line in lines)
+ {
+ string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands
+ SizeF siz = g.MeasureString(line2, myFont, pnt, StringFormat.GenericTypographic);
+ if (siz.Width + _MyStepPanel.MyStepPanelSettings.TableWidthAdjust > max) max = siz.Width + _MyStepPanel.MyStepPanelSettings.TableWidthAdjust;
+ }
+ return max;
+ }
+ ///
+ /// Calculates the table location
+ ///
+ ///
+ ///
+ ///
+ ///
+ private Point TableLocation(StepItem myParentStepItem, StepSectionLayoutData myStepSectionLayoutData, int width)
+ {
+ int x = myParentStepItem.TextLeft;
+ int y = myParentStepItem.Bottom;
+ if (x + width > myParentStepItem.Right) x = myParentStepItem.Right - width;
+ int colT = _MyStepPanel.ToDisplay(myStepSectionLayoutData.ColT);
+ if (x < colT) x = colT;
+ return new Point(x, y);
+ }
+ ///
+ /// Sets the Item and as a result the text for the RichTextBox
+ ///
+ private void SetText()
+ {
+ if (_MyItemInfo != null)
+ this._MyStepRTB.MyItemInfo = _MyItemInfo;
+ }
+ ///
+ /// If the selected StepItem is within the window leave it as it is.
+ /// If not, scroll so that the selected window is centered.
+ ///
+ private void ScrollToCenter()
+ {
+ //vlnStackTrace.ShowStack("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);// Show StackTrace
+ //Console.WriteLine("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);
+ if (Top >= 0 && Bottom <= _MyStepPanel.Height) return;// Don't move if within screen.
+ int scrollValue = _MyStepPanel.VerticalScroll.Value + (Top - (_MyStepPanel.Height / 2)); // calculate scroll center for the item
+ //Console.WriteLine("CenterScroll {0} Current {1} New {2} Min {3} Max {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, scrollValue, _Panel.VerticalScroll.Minimum, _Panel.VerticalScroll.Maximum);
+ if (scrollValue >= _MyStepPanel.VerticalScroll.Minimum && scrollValue <= _MyStepPanel.VerticalScroll.Maximum) // If it is within range
+ _MyStepPanel.VerticalScroll.Value = scrollValue; // Center the item
+ }
+ // TODO: the format of the circles, Checkoffs and Changebars should come from the format file
+ ///
+ /// This adds drawing items to the StepItem as needed including
+ /// Circle around the Tab Number
+ /// Check-Offs
+ /// Change Bars
+ ///
+ ///
+ ///
+ private void StepItem_Paint(object sender, PaintEventArgs e)
+ {
+ Graphics g = e.Graphics;
+ g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
+ g.DrawString(lblTab.Text, _MyStepRTB.Font, Brushes.Black, new RectangleF(new PointF(_MyStepPanel.MyStepPanelSettings.NumberLocationX, _MyStepPanel.MyStepPanelSettings.NumberLocationY), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault);
+ if (Circle)
+ {
+ Pen penC = new Pen(_MyStepPanel.MyStepPanelSettings.CircleColor, _MyStepPanel.MyStepPanelSettings.CircleWeight);
+ g.DrawArc(penC, lblTab.Left + 1, 0, _MyStepPanel.MyStepPanelSettings.CircleDiameter, _MyStepPanel.MyStepPanelSettings.CircleDiameter, 0F, 360F);
+ }
+ if (CheckOff)
+ {
+ Pen penCO = new Pen(_MyStepPanel.MyStepPanelSettings.CheckOffColor, _MyStepPanel.MyStepPanelSettings.CheckOffWeight);
+ g.DrawRectangle(penCO, _MyStepPanel.MyStepPanelSettings.CheckOffX, _MyStepPanel.MyStepPanelSettings.CheckOffY, _MyStepPanel.MyStepPanelSettings.CheckOffSize, _MyStepPanel.MyStepPanelSettings.CheckOffSize);
+ }
+ if (ChangeBar)
+ {
+ Pen penCB = new Pen(_MyStepPanel.MyStepPanelSettings.ChangeBarColor, _MyStepPanel.MyStepPanelSettings.ChangeBarWeight);
+ g.DrawLine(penCB, 0, 0, 0, Height);
+ }
+ }
+ ///
+ /// Hide a Items Children - Part of colapsing
+ ///
protected void HideChildren()
{
- HideChildren(_Before);
- HideChildren(_RNO);
- HideChildren(_After);
+ HideChildren(_MyBeforeStepItems);
+ HideChildren(_MyRNOStepItems);
+ HideChildren(_MyAfterStepItems);
}
- private void HideChildren(List children)
+ ///
+ /// Hide a list of children - Part of colapsing
+ ///
+ ///
+ private void HideChildren(List childStepItems)
{
- if (children != null)
+ if (childStepItems != null)
{
- foreach (StepItem child in children)
+ foreach (StepItem child in childStepItems)
{
if (child.Expanded) child.HideChildren();
child.Visible = false;
}
}
}
+ ///
+ /// Unhide an items Children - Part of expanding
+ ///
+ ///
protected void UnhideChildren(bool expand)
{
- UnhideChildren(_Before,expand);
- UnhideChildren(_RNO, expand);
- UnhideChildren(_After, expand);
- if(!vlnExp.Expanded)
- vlnExp.ShowExpanded();
+ UnhideChildren(_MyBeforeStepItems, expand);
+ UnhideChildren(_MyRNOStepItems, expand);
+ UnhideChildren(_MyAfterStepItems, expand);
+ if (!_MyvlnExpander.Expanded)
+ _MyvlnExpander.ShowExpanded();
}
- private void UnhideChildren(List children,bool expand)
+ ///
+ /// Unhide a list of children - part of expanding
+ ///
+ ///
+ ///
+ private void UnhideChildren(List childStepItems, bool expand)
{
- if (children != null)
+ if (childStepItems != null)
{
- foreach (StepItem child in children)
+ foreach (StepItem child in childStepItems)
{
- if (child.Expanded)
+ if (child.Expanded)
child.UnhideChildren(expand);
else if (expand)
child.Expand(expand);
@@ -767,80 +1073,39 @@ namespace Volian.Controls.Library
}
}
}
+ ///
+ /// Move children as necessary
+ ///
protected void AdjustChildren()
{
- AdjustChildren(_Before);
- AdjustChildren(_RNO);
- AdjustChildren(_After);
+ AdjustChildren(_MyBeforeStepItems);
+ AdjustChildren(_MyRNOStepItems);
+ AdjustChildren(_MyAfterStepItems);
}
- private void AdjustChildren(List children)
+ ///
+ /// Move a list of children
+ ///
+ ///
+ private void AdjustChildren(List childStepItems)
{
- if (children != null)
+ if (childStepItems != null)
{
- foreach (StepItem child in children)
+ foreach (StepItem child in childStepItems)
{
child.AdjustLocation();
if (child.Expanded) child.AdjustChildren();
}
}
}
- private void vlnExp_AttachmentClick(object sender, vlnExpanderEventArgs args)
+ ///
+ /// Expand a list of children
+ ///
+ ///
+ private void ExpandChildren(List childStepItems)
{
- _Panel.OnAttachmentClicked(sender, new DisplayPanelAttachmentEventArgs(this));
- }
- public void Expand(bool expand)
- {
- //// TIMING: DisplayItem.TimeIt("Expand Start");
- if (_ChildrenLoaded)
+ if (childStepItems != null)
{
- // Unhide Children
- Expanding = ExpandingStatus.Showing;
- UnhideChildren(expand);
- if (_ExpandPrefix != 0)
- {
- _Panel.Scrolling++;
- TopMost.Top = Top;
- _Panel.Scrolling--;
- }
- else
- TopMost.AdjustLocation();
- AdjustChildren();
- //if(_Before != null )
- // Top = _Before[_Before.Count - 1].BottomMost.Bottom;
- }
- else
- {
- Expanding = ExpandingStatus.Expanding;
- _ChildrenLoaded = true;
- //_Panel.SuspendLayout();
- AddChildBefore(MyItem.Cautions, expand);
- AddChildBefore(MyItem.Notes, expand);
- AddChildAfter(MyItem.Procedures, expand);
- AddChildAfter(MyItem.Sections, expand);
- AddChildAfter(MyItem.Steps, expand);
- AddChildAfter(MyItem.Tables, expand);
- AddChildRNO(MyItem.RNOs, expand);
- if (!vlnExp.Expanded)
- vlnExp.ShowExpanded();
- }
- Expanding = ExpandingStatus.Done;
- BottomMost.AdjustLocation();
- Expanding = ExpandingStatus.No;
- //// TIMING: DisplayItem.TimeIt("Expand End");
- }
- private void vlnExp_BeforeExpand(object sender, vlnExpanderEventArgs args)
- {
- Cursor tmp = Cursor.Current;
- Cursor.Current = Cursors.WaitCursor;
- if (!_Loading && Expanding == ExpandingStatus.No)
- Expand(_Type >= 20000);
- Cursor.Current = tmp;
- }
- private void ExpandChildren(List children)
- {
- if (children != null)
- {
- foreach (StepItem child in children)
+ foreach (StepItem child in childStepItems)
{
if (child.CanExpand)
{
@@ -850,137 +1115,145 @@ namespace Volian.Controls.Library
}
}
}
+ ///
+ /// Expand children
+ ///
private void ExpandChildren()
{
// Walk though Children performing Expand
- ExpandChildren(_Before);
- ExpandChildren(_RNO);
- ExpandChildren(_After);
+ ExpandChildren(_MyBeforeStepItems);
+ ExpandChildren(_MyRNOStepItems);
+ ExpandChildren(_MyAfterStepItems);
}
- public StepItem NextItem
+ ///
+ /// Adjust the Location of all items below the current item.
+ ///
+ private void AdjustLocation()
+ {
+ StepItem tmp = NextDownStepItem;
+ if (tmp == null) return;
+ if (tmp != null && !tmp.Moving && tmp.Top != Bottom)
+ {
+ _MyStepPanel.ItemMoving++;
+ tmp.Top = Bottom;
+ _MyStepPanel.ItemMoving--;
+ }
+ }
+ ///
+ /// Automatically expands Steps if not currently expanded
+ ///
+ internal void AutoExpand()
+ {
+ if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections
+ {
+ //vlnStackTrace.ShowStack(">AutoExpand ID {0} - Can {1} Expanded {2}", _MyItem.ItemID, CanExpand, Expanded);
+ Expand(_Type >= 20000);
+ //Console.WriteLine("
+ /// Sets the focus to this StepItem and positions the cursor to the begining of the string
+ ///
+ public void ItemSelect()
+ {
+ _MyStepRTB.Focus();
+ _MyStepRTB.Select(0, 0);
+ // if (CanExpand) AutoExpand(); // Expand the item if you can
+ ScrollToCenter();
+ }
+ ///
+ /// Sets the focus to this StepItem
+ ///
+ public void ItemShow()
+ {
+ _MyStepRTB.Focus();
+ ScrollToCenter();
+ }
+ ///
+ /// Expand an item and it's children
+ /// If the children have been loaded then just expand them
+ /// If not, load the children and expand their children etc.
+ ///
+ /// normally equal to _Type > = 20000 (Step)
+ public void Expand(bool expand)
+ {
+ //// TIMING: DisplayItem.TimeIt("Expand Start");
+ if (_ChildrenLoaded)
+ {
+ // Unhide Children
+ MyExpandingStatus = ExpandingStatus.Showing;
+ UnhideChildren(expand);
+ if (_ExpandPrefix != 0)
+ {
+ _MyStepPanel.ItemMoving++;
+ TopMostStepItem.Top = Top;
+ _MyStepPanel.ItemMoving--;
+ }
+ else
+ TopMostStepItem.AdjustLocation();
+ AdjustChildren();
+ //if(_Before != null )
+ // Top = _Before[_Before.Count - 1].BottomMost.Bottom;
+ }
+ else
+ {
+ MyExpandingStatus = ExpandingStatus.Expanding;
+ _ChildrenLoaded = true;
+ //_Panel.SuspendLayout();
+ AddChildBefore(MyItemInfo.Cautions, expand);
+ AddChildBefore(MyItemInfo.Notes, expand);
+ AddChildAfter(MyItemInfo.Procedures, expand);
+ AddChildAfter(MyItemInfo.Sections, expand);
+ AddChildAfter(MyItemInfo.Steps, expand);
+ AddChildAfter(MyItemInfo.Tables, expand);
+ AddChildRNO(MyItemInfo.RNOs, expand);
+ if (!_MyvlnExpander.Expanded)
+ _MyvlnExpander.ShowExpanded();
+ }
+ MyExpandingStatus = ExpandingStatus.Done;
+ BottomMostStepItem.AdjustLocation();
+ MyExpandingStatus = ExpandingStatus.No;
+ //// TIMING: DisplayItem.TimeIt("Expand End");
+ }
+ ///
+ /// This finds the next StepItem down.
+ ///
+ public StepItem NextDownStepItem
{
get
{
StepItem tmp = this;
- if (tmp.Next == null && FirstSibling._Relation == ChildRelation.Before)
- return UpOne;
- if (Expanded && tmp._After != null)
- return tmp._After[0].TopMost; // check to see if there is a _After if there is go that way
- while (tmp != null && tmp.Next == null) // if no Next walk up the parent path
+ // If this item appears before it's parent, and it doesn't have anything below it, return the parent
+ if (tmp.MyNextStepItem == null && FirstSiblingStepItem._MyChildRelation == ChildRelation.Before)
+ return UpOneStepItem;
+ if (Expanded && tmp._MyAfterStepItems != null)// check to see if there is a _After
+ return tmp._MyAfterStepItems[0].TopMostStepItem;// if there is go that way
+ while (tmp != null && tmp.MyNextStepItem == null) // if no Next walk up the parent path
{
- tmp = tmp.UpOne;
+ tmp = tmp.UpOneStepItem;
if (tmp == null) // No Parent
return null;
- if (tmp.Expanding == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait
+ if (tmp.MyExpandingStatus == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait
return null;
- StepItem btm = tmp.BottomMost;
+ StepItem btm = tmp.BottomMostStepItem;
if (this != btm)
{
- if (tmp.Next != null && tmp.Next.TopMost.Top != btm.Bottom)
+ if (tmp.MyNextStepItem != null && tmp.MyNextStepItem.TopMostStepItem.Top != btm.Bottom)
{
- _Panel.Scrolling++;
- tmp.Next.TopMost.Top = btm.Bottom;
- _Panel.Scrolling--;
+ _MyStepPanel.ItemMoving++;
+ tmp.MyNextStepItem.TopMostStepItem.Top = btm.Bottom;
+ _MyStepPanel.ItemMoving--;
}
return null; // Not the bottom - don't adjust anything else
}
}
if (tmp != null)
- return tmp.Next.TopMost;// if no _After - check to see if there is a Next
+ return tmp.MyNextStepItem.TopMostStepItem;// if no _After - check to see if there is a Next
return null;
}
}
- private StepItem UpOne
- {
- get
- {
- StepItem tmp = this;
- while (tmp != null && tmp.MyParent == null) tmp = tmp.Previous;
- if (tmp != null) return tmp.MyParent;
- return null;
- }
- }
- private void AdjustLocation()
- {
- StepItem tmp = NextItem;
- if (tmp == null) return;
- if (tmp != null && !tmp.Moving && tmp.Top != Bottom )
- {
- _Panel.Scrolling++;
- tmp.Top = Bottom;
- _Panel.Scrolling--;
- }
- }
- public IDisplayRTB TextBox
- {
- get { return (IDisplayRTB)_DisplayRTB; }
- }
- private void DisplayItem_Resize(object sender, EventArgs e)
- {
- if (_MyItem == null) return;
- AdjustLocation();
- }
- private void DisplayItem_Move(object sender, EventArgs e)
- {
- if (_Panel.Scrolling == 0) return;
- if (_MyItem == null) return;
- if (Expanding == ExpandingStatus.Expanding) return;
- _Moving = true;
- StepItem tmp = (StepItem)sender;
- if (tmp._Previous == null && tmp._MyParent == null)
- {
- return;
- }
- AdjustLocation();
- if (_RNO != null)
- {
- if (_RNO[0].TopMost.Top != Top)
- {
- //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n'Adjust RNO',{0},'Move',{1}", MyID, _RNO[0].MyID);
- if (RNOLevel >= _Panel.MaxRNO)
- {
- StepItem tmpBottom = this;
- if (_After != null) tmpBottom = _After[_After.Count - 1].BottomMost;
- _Panel.Scrolling++;
- _RNO[0].TopMost.Top = tmpBottom.Bottom;
- _Panel.Scrolling--;
- }
- else
- {
- _Panel.Scrolling++;
- _RNO[0].TopMost.Top = Top;
- _Panel.Scrolling--;
- }
- }
- }
- _Moving = false;
- BottomMost.AdjustLocation();
- }
- private void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e)
- {
- _MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + e.LinkText);
- _Panel.OnLinkClicked(sender, new DisplayLinkEventArgs(this, e));
- }
- private void lblTab_MouseDown(object sender, MouseEventArgs e)
- {
- _Panel.OnItemClick(this, new DisplayPanelEventArgs(this, e));
- }
- private void _DisplayRTB_Enter(object sender, EventArgs e)
- {
- _Panel.DisplayRTB = _DisplayRTB;
- //_Panel.ItemSelected = _MyItem;
- }
- //private void veRichTextBoxText_Leave(object sender, EventArgs e)
- //{
- //}
- private void _DisplayRTB_LinkModifyTran(object sender, LinkClickedEventArgs e)
- {
- _Panel.OnLinkModifyTran(sender, new DisplayLinkEventArgs(this, e));
- }
-
- private void _DisplayRTB_LinkModifyRO(object sender, LinkClickedEventArgs e)
- {
- _Panel.OnLinkModifyRO(sender, new DisplayLinkEventArgs(this, e));
- }
+ #endregion
}
}
diff --git a/PROMS/Volian.Controls.Library/StepItem.designer.cs b/PROMS/Volian.Controls.Library/StepItem.designer.cs
index 8e697ffc..f621dc5b 100644
--- a/PROMS/Volian.Controls.Library/StepItem.designer.cs
+++ b/PROMS/Volian.Controls.Library/StepItem.designer.cs
@@ -28,8 +28,8 @@ namespace Volian.Controls.Library
{
this.components = new System.ComponentModel.Container();
this.lblTab = new System.Windows.Forms.Label();
- this._DisplayRTB = new Volian.Controls.Library.StepRTB(this.components);
- this.vlnExp = new Volian.Controls.Library.vlnExpander();
+ this._MyStepRTB = new Volian.Controls.Library.StepRTB(this.components);
+ this._MyvlnExpander = new Volian.Controls.Library.vlnExpander();
this.SuspendLayout();
//
// lblTab
@@ -42,75 +42,76 @@ namespace Volian.Controls.Library
this.lblTab.Visible = false;
this.lblTab.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown);
//
- // _DisplayRTB
+ // _MyStepRTB
//
- this._DisplayRTB.AdjustSize = new System.Drawing.Size(0, 0);
- this._DisplayRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this._DisplayRTB.BackColor = System.Drawing.Color.Linen;
- this._DisplayRTB.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this._DisplayRTB.ContentsRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
- this._DisplayRTB.EpMode = VEPROMS.CSLA.Library.E_EditPrintMode.Edit;
- this._DisplayRTB.Font = new System.Drawing.Font("Prestige Elite Tall", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
- this._DisplayRTB.Location = new System.Drawing.Point(80, 0);
- this._DisplayRTB.MyClassName = "RichEdit20W";
- this._DisplayRTB.MyItem = null;
- this._DisplayRTB.Name = "_DisplayRTB";
- this._DisplayRTB.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
- this._DisplayRTB.Size = new System.Drawing.Size(234, 20);
- this._DisplayRTB.TabIndex = 2;
- this._DisplayRTB.Text = "";
- this._DisplayRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit;
- this._DisplayRTB.Enter += new System.EventHandler(this._DisplayRTB_Enter);
- this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo);
- this._DisplayRTB.HeightChanged += new Volian.Controls.Library.DisplayRTBEvent(this.veRichTextBoxText_HeightChanged);
- this._DisplayRTB.LinkModifyTran += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyTran);
- this._DisplayRTB.LinkModifyRO += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyRO);
+ this._MyStepRTB.AdjustSize = new System.Drawing.Size(0, 0);
+ this._MyStepRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this._MyStepRTB.BackColor = System.Drawing.Color.Linen;
+ this._MyStepRTB.BorderStyle = System.Windows.Forms.BorderStyle.None;
+ this._MyStepRTB.ContentsRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
+ this._MyStepRTB.EpMode = VEPROMS.CSLA.Library.E_EditPrintMode.Edit;
+ this._MyStepRTB.Font = new System.Drawing.Font("Prestige Elite Tall", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
+ this._MyStepRTB.Location = new System.Drawing.Point(80, 0);
+ this._MyStepRTB.MyClassName = "RichEdit20W";
+ this._MyStepRTB.MyItemInfo = null;
+ this._MyStepRTB.MyLinkText = null;
+ this._MyStepRTB.Name = "_MyStepRTB";
+ this._MyStepRTB.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
+ this._MyStepRTB.Size = new System.Drawing.Size(234, 20);
+ this._MyStepRTB.TabIndex = 2;
+ this._MyStepRTB.Text = "";
+ this._MyStepRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit;
+ this._MyStepRTB.LinkGoTo += new Volian.Controls.Library.StepRTBLinkEvent(this._StepRTB_LinkGoTo);
+ this._MyStepRTB.Enter += new System.EventHandler(this._StepRTB_Enter);
+ this._MyStepRTB.HeightChanged += new Volian.Controls.Library.StepRTBEvent(this._StepRTB_HeightChanged);
+ this._MyStepRTB.LinkModifyTran += new Volian.Controls.Library.StepRTBLinkEvent(this._StepRTB_LinkModifyTran);
+ this._MyStepRTB.LinkModifyRO += new Volian.Controls.Library.StepRTBLinkEvent(this._StepRTB_LinkModifyRO);
//
- // vlnExp
+ // _MyvlnExpander
//
- this.vlnExp.Attachment = false;
- this.vlnExp.BackColor = System.Drawing.Color.Transparent;
- this.vlnExp.BorderColor = System.Drawing.Color.Silver;
- this.vlnExp.Color1 = System.Drawing.Color.Aquamarine;
- this.vlnExp.Color2 = System.Drawing.Color.Violet;
- this.vlnExp.Expanded = false;
- this.vlnExp.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
- this.vlnExp.GradientAngle = 45;
- this.vlnExp.Location = new System.Drawing.Point(3, 3);
- this.vlnExp.Name = "vlnExp";
- this.vlnExp.PenWidth = 0;
- this.vlnExp.Size = new System.Drawing.Size(14, 14);
- this.vlnExp.Style = Volian.Controls.Library.ExpanderStyle.Round;
- this.vlnExp.TabIndex = 0;
- this.vlnExp.Trans1 = 128;
- this.vlnExp.Trans2 = 128;
- this.vlnExp.WidthFactor = 7;
- this.vlnExp.BeforeExpand += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeExpand);
- this.vlnExp.AttachmentClick += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_AttachmentClick);
- this.vlnExp.BeforeColapse += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeColapse);
+ this._MyvlnExpander.Attachment = false;
+ this._MyvlnExpander.BackColor = System.Drawing.Color.Transparent;
+ this._MyvlnExpander.BorderColor = System.Drawing.Color.Silver;
+ this._MyvlnExpander.Color1 = System.Drawing.Color.Aquamarine;
+ this._MyvlnExpander.Color2 = System.Drawing.Color.Violet;
+ this._MyvlnExpander.Expanded = false;
+ this._MyvlnExpander.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
+ this._MyvlnExpander.GradientAngle = 45;
+ this._MyvlnExpander.Location = new System.Drawing.Point(3, 3);
+ this._MyvlnExpander.MyExpanderStyle = Volian.Controls.Library.ExpanderStyle.Round;
+ this._MyvlnExpander.Name = "_MyvlnExpander";
+ this._MyvlnExpander.PenWidth = 0;
+ this._MyvlnExpander.Size = new System.Drawing.Size(14, 14);
+ this._MyvlnExpander.TabIndex = 0;
+ this._MyvlnExpander.Trans1 = 128;
+ this._MyvlnExpander.Trans2 = 128;
+ this._MyvlnExpander.WidthFactor = 7;
+ this._MyvlnExpander.AttachmentClick += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_AttachmentClick);
+ this._MyvlnExpander.BeforeColapse += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeColapse);
+ this._MyvlnExpander.BeforeExpand += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeExpand);
//
- // DisplayItem
+ // StepItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonFace;
this.Controls.Add(this.lblTab);
- this.Controls.Add(this._DisplayRTB);
- this.Controls.Add(this.vlnExp);
- this.Name = "DisplayItem";
+ this.Controls.Add(this._MyStepRTB);
+ this.Controls.Add(this._MyvlnExpander);
+ this.Name = "StepItem";
this.Size = new System.Drawing.Size(314, 20);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown);
- this.Move += new System.EventHandler(this.DisplayItem_Move);
- this.Resize += new System.EventHandler(this.DisplayItem_Resize);
+ this.Resize += new System.EventHandler(this.StepItem_Resize);
+ this.Move += new System.EventHandler(this.StepItem_Move);
this.ResumeLayout(false);
}
#endregion
- private vlnExpander vlnExp;
- private StepRTB _DisplayRTB;
+ private vlnExpander _MyvlnExpander;
+ private StepRTB _MyStepRTB;
private System.Windows.Forms.Label lblTab;
}
}
diff --git a/PROMS/Volian.Controls.Library/StepItem.resx b/PROMS/Volian.Controls.Library/StepItem.resx
index f26fdb9e..37d92960 100644
--- a/PROMS/Volian.Controls.Library/StepItem.resx
+++ b/PROMS/Volian.Controls.Library/StepItem.resx
@@ -120,10 +120,10 @@
True
-
+
True
-
+
True
diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs
index 7748ddf9..c34a8418 100644
--- a/PROMS/Volian.Controls.Library/StepPanel.cs
+++ b/PROMS/Volian.Controls.Library/StepPanel.cs
@@ -12,81 +12,516 @@ namespace Volian.Controls.Library
{
public partial class StepPanel : Panel
{
+ #region Fields
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- #region Events
- public event DisplayPanelEvent ItemClick;
- internal void OnItemClick(object sender, DisplayPanelEventArgs args)
+ ///
+ /// Procedure Item Info - Top ItemInfo
+ ///
+ private ItemInfo _MyProcedureItemInfo;
+ ///
+ /// This is not correct. There should be a dictionary of Section Layouts
+ ///
+ private StepSectionLayoutData _MyStepSectionLayoutData;
+ ///
+ /// Lookup Table to convert ItemInfo.ItemID to StepItem
+ ///
+ internal Dictionary _LookupStepItems;
+ ///
+ /// Currently selected RichTextBox
+ ///
+ private StepRTB _SelectedStepRTB = null;
+ ///
+ /// Currently selected ItemInfo
+ ///
+ internal ItemInfo _SelectedItemInfo;
+ private int _ItemMoving = 0;
+ private StepPanelSettings _MyStepPanelSettings;
+ private int _MaxRNO = -1; // TODO: Need to calculate MaxRNO on a section basis rather than for a panel
+ private Font _MyFont = null;
+ private Font _ProcFont = new Font("Arial", 12, FontStyle.Bold);
+ private Font _SectFont = new Font("Arial", 10, FontStyle.Bold);
+ private Font _StepFont = new Font("Arial", 10);
+ private Color _ActiveColor = Color.SkyBlue;
+#if (DEBUG)
+ private Color _InactiveColor = Color.Linen;
+ private Color _TabColor = Color.Beige;
+ private Color _PanelColor = Color.LightGray;
+#else
+ private Color _InactiveColor = Color.White;
+ private Color _TabColor = Color.White;
+ private Color _PanelColor = Color.White;
+#endif
+ private bool _ShowLines = true;
+ private Graphics _MyGraphics = null;
+ private int _DPI = 0;
+ #endregion
+ #region Item Events
+ ///
+ /// Occurs when the user clicks tab of a StepItem
+ ///
+ public event StepPanelEvent ItemClick;
+ ///
+ /// Checks to see if the 'ItemClick' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnItemClick(object sender, StepPanelEventArgs args)
{
if (ItemClick != null) ItemClick(sender, args);
}
- public event DisplayPanelEvent ItemSelectedChanged;
- internal void OnItemSelectedChanged(object sender, DisplayPanelEventArgs args)
+ ///
+ /// Occurs when the selected StepItem changes
+ ///
+ public event StepPanelEvent ItemSelectedChanged;
+ ///
+ /// Checks to see if the 'ItemSelectedChanged' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnItemSelectedChanged(object sender, StepPanelEventArgs args)
{
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
}
- public event DisplayPanelLinkEvent LinkActiveChanged;
- internal void OnLinkActiveChanged(object sender, DisplayLinkEventArgs args)
- {
- if (LinkActiveChanged != null) LinkActiveChanged(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public event DisplayPanelLinkEvent LinkInsertTran;
- internal void OnLinkInsertTran(object sender, DisplayLinkEventArgs args)
- {
- if (LinkInsertTran != null) LinkInsertTran(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public event DisplayPanelLinkEvent LinkInsertRO;
- internal void OnLinkInsertRO(object sender, DisplayLinkEventArgs args)
- {
- if (LinkInsertRO != null) LinkInsertRO(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public event DisplayPanelLinkEvent LinkClicked;
- internal void OnLinkClicked(object sender, DisplayLinkEventArgs args)
- {
- if (LinkClicked != null) LinkClicked(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public event DisplayPanelLinkEvent LinkModifyTran;
- internal void OnLinkModifyTran(object sender, DisplayLinkEventArgs args)
- {
- if (LinkModifyTran != null) LinkModifyTran(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public event DisplayPanelLinkEvent LinkModifyRO;
- internal void OnLinkModifyRO(object sender, DisplayLinkEventArgs args)
- {
- if (LinkModifyRO != null) LinkModifyRO(sender, args);
- else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- public event DisplayPanelAttachmentEvent AttachmentClicked;
- internal void OnAttachmentClicked(object sender, DisplayPanelAttachmentEventArgs args)
+ ///
+ /// Occurs when the user clicks on the Attachment Expander
+ ///
+ public event StepPanelAttachmentEvent AttachmentClicked;
+ ///
+ /// Checks to see if the 'AttachmentClicked' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnAttachmentClicked(object sender, StepPanelAttachmentEventArgs args)
{
if (AttachmentClicked != null) AttachmentClicked(sender, args);
- else MessageBox.Show(args.MyDisplayItem.MyItem.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ else MessageBox.Show(args.MyStepItem.MyItemInfo.MyContent.MyEntry.MyDocument.DocumentTitle, "Unhandled Attachment Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ #endregion
+ #region Link Events
+ ///
+ /// Occurs when the user moves onto or off of a Link
+ ///
+ public event StepPanelLinkEvent LinkActiveChanged;
+ ///
+ /// Checks to see if the 'LinkActiveChanged' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkActiveChanged(object sender, StepPanelLinkEventArgs args)
+ {
+ if (LinkActiveChanged != null) LinkActiveChanged(sender, args);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ ///
+ /// Occurs when the user chooses to Insert a Transition
+ ///
+ public event StepPanelLinkEvent LinkInsertTran;
+ ///
+ /// Checks to see if the 'LinkInsertTran' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkInsertTran(object sender, StepPanelLinkEventArgs args)
+ {
+ if (LinkInsertTran != null) LinkInsertTran(sender, args);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ ///
+ /// Occurs when the user chooses to Insert an RO
+ ///
+ public event StepPanelLinkEvent LinkInsertRO;
+ ///
+ /// Checks to see if the 'LinkInsertRO' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkInsertRO(object sender, StepPanelLinkEventArgs args)
+ {
+ if (LinkInsertRO != null) LinkInsertRO(sender, args);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ ///
+ /// Occurs when the user clicks a Link
+ ///
+ public event StepPanelLinkEvent LinkClicked;
+ ///
+ /// Checks to see if the 'LinkClicked' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkClicked(object sender, StepPanelLinkEventArgs args)
+ {
+ if (LinkClicked != null) LinkClicked(sender, args);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ ///
+ /// Occurs when the user chooses to modify a Transition
+ ///
+ public event StepPanelLinkEvent LinkModifyTran;
+ ///
+ /// Checks to see if the 'LinkModifyTran' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
+ {
+ if (LinkModifyTran != null) LinkModifyTran(sender, args);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ ///
+ /// Occurs when the user chooses to modify an RO
+ ///
+ public event StepPanelLinkEvent LinkModifyRO;
+ ///
+ /// Checks to see if the 'LinkModifyRO' event is handled and launches it
+ ///
+ ///
+ ///
+ internal void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
+ {
+ if (LinkModifyRO != null) LinkModifyRO(sender, args);
+ else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion
#region Constructors
public StepPanel()
{
InitializeComponent();
- this.Paint += new PaintEventHandler(DisplayPanel_Paint);
- this.DoubleClick += new EventHandler(DisplayPanel_DoubleClick);
+ this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged);
+#if(DEBUG)
+ this.Paint += new PaintEventHandler(StepPanel_Paint);
+ this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off
+#endif
this.AutoScroll = true;
}
-
- void DisplayPanel_DoubleClick(object sender, EventArgs e)
+ public StepPanel(IContainer container)
{
- ShowLines = !ShowLines;
- Refresh();
+ container.Add(this);
+ InitializeComponent();
+ this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged);
+#if(DEBUG)
+ this.Paint += new PaintEventHandler(StepPanel_Paint); // Toggles Vertical lines on and off
+ this.DoubleClick += new EventHandler(StepPanel_DoubleClick);
+#endif
+ this.AutoScroll = true;
}
+ void StepPanel_BackColorChanged(object sender, EventArgs e)
+ {
+ // Walk through controls & set colors
+ InactiveColor = PanelColor = BackColor;
+ foreach (Control ctrl in Controls)
+ {
+ if (ctrl.GetType() == typeof(StepItem))
+ {
+ StepItem rtb = (StepItem)ctrl;
+ rtb.BackColor = BackColor;
+ }
+ }
+ }
+ #endregion
+ #region Private Methods
+ ///
+ /// Expands an Item and It's Parents as need to display an item
+ ///
+ /// Item to Expand
+ private void ExpandAsNeeded(ItemInfo myItemInfo)
+ {
+ int id = myItemInfo.ItemID;
+ if (_LookupStepItems.ContainsKey(id)) // If the item is currently displayed
+ {
+ _LookupStepItems[id].AutoExpand(); // Expand it if it should expand
+ }
+ else
+ {
+ ExpandAsNeeded((ItemInfo)myItemInfo.ActiveParent); // Expand it's parent
+ if (!_LookupStepItems.ContainsKey(id)) // Expand Parent if not expanded
+ {
+ int parentId = ((ItemInfo)myItemInfo.ActiveParent).ItemID;
+ _LookupStepItems[parentId].AutoExpand();
+ }
+ }
+ }
+ #endregion
+ #region Properties
+ ///
+ /// Procedure Item Info - Top ItemInfo
+ /// Get and Set - Set stes-up all of the
+ ///
+ public ItemInfo MyProcedureItemInfo
+ {
+ get { return _MyProcedureItemInfo; }
+ set
+ {
+ //// TIMING: DisplayItem.TimeIt("pMyItem Start");
+ _MyProcedureItemInfo = value;
+ if(value != null)
+ _MyStepSectionLayoutData = _MyProcedureItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
+ //// TIMING: DisplayItem.TimeIt("pMyItem Layout");
+ //this.Layout += new LayoutEventHandler(DisplayPanel_Layout);
+ //this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);
+ //// TIMING: DisplayItem.TimeIt("pMyItem Scroll");
+ Controls.Clear();
+ _LookupStepItems = new Dictionary();
+ //// TIMING: DisplayItem.TimeIt("pMyItem Clear");
+ //SuspendLayout();
+ StepItem tmpStepItem = new StepItem(_MyProcedureItemInfo, this, null, ChildRelation.None, false);
+ //ResumeLayout();
+ //// TIMING: DisplayItem.TimeIt("pMyItem End");
+ }
+ }
+ ///
+ /// Get or Set currently selected RichTextBox (StepRTB)
+ ///
+ public StepRTB SelectedStepRTB
+ {
+ get { return _SelectedStepRTB; }
+ set
+ {
+ value.BackColor = ActiveColor; // Set the active color
+ if (_SelectedStepRTB == value) return; // Same - No Change
+ if (_SelectedStepRTB != null)
+ {
+ _SelectedStepRTB.BackColor = InactiveColor;
+ _SelectedStepRTB.SaveText(); // Save any changes to the text
+ }
+ _SelectedStepRTB = value;
+ if (_SelectedItemInfo.ItemID != value.MyItemInfo.ItemID)
+ SelectedItemInfo = value.MyItemInfo;
+ //vlnStackTrace.ShowStack("_DisplayRTB = {0}", _DisplayRTB.MyItem.ItemID);// Show StackTrace
+ }
+ }
+ ///
+ /// Gets or Sets the SelectedItemInfo
+ /// Activates and Expands as necessary
+ ///
+ public ItemInfo SelectedItemInfo
+ {
+ get { return _SelectedItemInfo; }
+ set
+ {
+ _SelectedItemInfo = value;
+ int id = value.ItemID;
+ ExpandAsNeeded(value);
+ StepItem itm = _LookupStepItems[id];
+ itm.ItemSelect();
+ OnItemSelectedChanged(this, new StepPanelEventArgs(itm, null));
+ //vlnStackTrace.ShowStack("_ItemSelected = {0}", _ItemSelected.ItemID);// Show StackTrace
+ }
+ }
+ ///
+ /// Returns the SelectedStepItem
+ ///
+ public StepItem SelectedStepItem
+ {
+ get { return (_SelectedItemInfo != null) ? _LookupStepItems[_SelectedItemInfo.ItemID] : null; }
+ }
+ ///
+ /// Displays the selected StepItem
+ ///
+ public void ItemShow()
+ {
+ if (_SelectedItemInfo != null)
+ SelectedStepItem.ItemShow();
+ }
+ ///
+ /// Used to track movement other than scrolling
+ /// 0 - Indicates no other movement
+ /// > 0 - Indicates that other movement is happening
+ ///
+ public int ItemMoving
+ {
+ get { return _ItemMoving; }
+ set { _ItemMoving = value; }
+ }
+ ///
+ /// Lazy loaded StepPanelSettings
+ ///
+ public StepPanelSettings MyStepPanelSettings
+ {
+ get
+ {
+ if (_MyStepPanelSettings == null) _MyStepPanelSettings = new StepPanelSettings(this);
+ return _MyStepPanelSettings;
+ }
+ set { _MyStepPanelSettings = value;}
+ }
+ // TODO: This needs to move to StepItem and use the format for the current section
+ ///
+ /// Gets the MaxRNO from the StepSectionLayoutData
+ ///
+ public int MaxRNO
+ {
+ get
+ {
+ if(_MaxRNO == -1)
+ {
+ int pmode = Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1;
+ _MaxRNO = Convert.ToInt32( _MyStepSectionLayoutData.MaxRNOTable.Split(",".ToCharArray())[pmode]);
+ }
+ return _MaxRNO;
+ }
+ }
+ ///
+ /// Gets or Sets the font for the Panel
+ ///
+ public Font MyFont
+ {
+ get { return _MyFont; }
+ set { _ProcFont = _SectFont = _StepFont = _MyFont = value; }
+ }
+ ///
+ /// Gets or sets the font for the Procedure Text
+ ///
+ public Font ProcFont
+ {
+ get { return _ProcFont; }
+ set { _ProcFont = value; }
+ }
+ ///
+ /// Gets or sets the font for the Section Text
+ ///
+ public Font SectFont
+ {
+ get { return _SectFont; }
+ set { _SectFont = value; }
+ }
+ ///
+ /// Gets or sets the Step Font
+ ///
+ public Font StepFont
+ {
+ get { return _StepFont; }
+ set { _StepFont = value; }
+ }
+ ///
+ /// Gets or Sets the Active Color for the Panel
+ ///
+ public Color ActiveColor
+ {
+ get { return _ActiveColor; }
+ set { _ActiveColor = value; }
+ }
+ ///
+ /// Gets or sets the InActive Color for the Panel
+ ///
+ public Color InactiveColor
+ {
+ get { return _InactiveColor; }
+ set { _InactiveColor = value; }
+ }
+ ///
+ /// Gets or sets the Tab Color
+ ///
+ public Color TabColor
+ {
+ get { return _TabColor; }
+ set { _TabColor = value; }
+ }
+ ///
+ /// Gets or sets the Panel Color
+ ///
+ public Color PanelColor
+ {
+ get { return _PanelColor; }
+ set { _PanelColor = value;
+ BackColor = value;
+ }
+ }
+ #endregion
+ #region DisplayConversions
+ ///
+ /// gets a Graphic object for the panel
+ ///
+ public Graphics MyGraphics
+ {
+ get
+ {
+ if (_MyGraphics == null)
+ _MyGraphics = CreateGraphics();
+ return _MyGraphics;
+ }
+ }
+ ///
+ /// Gets the DPI setting for the current graphics setting
+ ///
+ internal int DPI
+ {
+ get
+ {
+ if (_DPI == 0)
+ _DPI = Convert.ToInt32(MyGraphics.DpiX);
+ return _DPI;
+ }
+ }
+ ///
+ /// Converts an integer value from Twips to Pixels
+ ///
+ ///
+ ///
+ public int ToDisplay(int value)
+ {
+ //return (DPI * value) / 864;
+ return (DPI * value) / 72;
+ }
+ ///
+ /// Converts an integer? value from Twips to Pixels
+ ///
+ ///
+ ///
+ public int ToDisplay(int? value)
+ {
+ return ToDisplay((int)value);
+ }
+ ///
+ /// Converts an string value from Twips to Pixels
+ ///
+ ///
+ ///
+ public int ToDisplay(string value)
+ {
+ return ToDisplay(Convert.ToInt32(value));
+ }
+ ///
+ /// Converts a value from a list in a string from Twips to Pixels
+ ///
+ ///
+ ///
+ public int ToDisplay(string value,int i)
+ {
+ string s = value.Split(",".ToCharArray())[i];
+ return ToDisplay(s);
+ }
+ #endregion
+ #region Debug Methods
+ ///
+ /// Gets or sets ShowLines so that vertical lines are shown for debugging purposes
+ ///
+ public bool ShowLines
+ {
+ get { return _ShowLines; }
+ set { _ShowLines = value; }
+ }
+ ///
+ /// Draw a vertical line
+ ///
+ ///
+ ///
private void VerticalLine(Graphics g, int x)
{
Pen bluePen = new Pen(Color.CornflowerBlue,1);
g.DrawLine(bluePen, x, 0, x, this.Height);
}
- void DisplayPanel_Paint(object sender, PaintEventArgs e)
+ ///
+ /// Toggle the vertical lines on and off
+ ///
+ ///
+ ///
+ private void StepPanel_DoubleClick(object sender, EventArgs e)
+ {
+ ShowLines = !ShowLines;
+ Refresh();
+ }
+ private void StepPanel_Paint(object sender, PaintEventArgs e)
{
if (ShowLines)
{
@@ -103,296 +538,40 @@ namespace Volian.Controls.Library
//VerticalLine(e.Graphics, 415);
}
}
- public StepPanel(IContainer container)
- {
- container.Add(this);
- InitializeComponent();
- this.Paint += new PaintEventHandler(DisplayPanel_Paint);
- this.BackColorChanged += new EventHandler(DisplayPanel_BackColorChanged);
- this.DoubleClick += new EventHandler(DisplayPanel_DoubleClick);
- this.AutoScroll = true;
- }
- void DisplayPanel_BackColorChanged(object sender, EventArgs e)
- {
- // Walk through controls & set colors
- InactiveColor = PanelColor = BackColor;
- foreach (Control ctrl in Controls)
- {
- if (ctrl.GetType().Name == "StepItem")
- {
- StepItem rtb = (StepItem)ctrl;
- rtb.BackColor = BackColor;
- }
- }
- }
- #endregion
- #region Business
- private StepSectionLayoutData _Layout; // Volian Property Snippet
- private ItemInfo _MyItem;
- public ItemInfo MyItem
- {
- get { return _MyItem; }
- set
- {
- //// TIMING: DisplayItem.TimeIt("pMyItem Start");
- _MyItem = value;
- if(value != null)
- _Layout = _MyItem.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
- //// TIMING: DisplayItem.TimeIt("pMyItem Layout");
- //this.Layout += new LayoutEventHandler(DisplayPanel_Layout);
- //this.Scroll += new ScrollEventHandler(DisplayPanel_Scroll);
- //// TIMING: DisplayItem.TimeIt("pMyItem Scroll");
- Controls.Clear();
- ItemLookup = new Dictionary();
- //// TIMING: DisplayItem.TimeIt("pMyItem Clear");
- //SuspendLayout();
- StepItem vlnRTF = new StepItem(_MyItem, this, null, ChildRelation.None, false);
- //ResumeLayout();
- //// TIMING: DisplayItem.TimeIt("pMyItem End");
- }
- }
- internal Dictionary _ItemLookup;
- public Dictionary ItemLookup
- {
- get { return _ItemLookup; }
- set { _ItemLookup = value; }
- }
- public void ExpandAsNeeded(ItemInfo item)
- {
- int id = item.ItemID;
- if (ItemLookup.ContainsKey(id))
- {
- ItemLookup[id].AutoExpand();
- }
- else
- {
- ExpandAsNeeded((ItemInfo)item.ActiveParent);
- if (!ItemLookup.ContainsKey(id)) // Expand Parent if not expanded
- {
- int parentId = ((ItemInfo)item.ActiveParent).ItemID;
- ItemLookup[parentId].AutoExpand();
- }
- }
- }
- public void ItemSelect(ItemInfo item)
- {
- int id = item.ItemID;
- ExpandAsNeeded(item);
- ItemLookup[id].ItemSelect();
- }
- private StepRTB _DisplayRTB = null;
- public StepRTB DisplayRTB
- {
- get { return _DisplayRTB; }
- set
- {
- value.BackColor = ActiveColor; // Set the active color
- if (_DisplayRTB == value) return; // Same - No Change
- if (_DisplayRTB != null)
- {
- _DisplayRTB.BackColor = InactiveColor;
- _DisplayRTB.SaveText(); // Save any changes to the text
- }
- _DisplayRTB = value;
- if (_ItemSelected.ItemID != value.MyItem.ItemID)
- ItemSelected = value.MyItem;
- //vlnStackTrace.ShowStack("_DisplayRTB = {0}", _DisplayRTB.MyItem.ItemID);// Show StackTrace
- }
- }
- internal ItemInfo _ItemSelected;
- public ItemInfo ItemSelected
- {
- get { return _ItemSelected; }
- set
- {
- _ItemSelected = value;
- int id = value.ItemID;
- ExpandAsNeeded(value);
- StepItem itm = ItemLookup[id];
- itm.ItemSelect();
- OnItemSelectedChanged(this, new DisplayPanelEventArgs(itm, null));
- //vlnStackTrace.ShowStack("_ItemSelected = {0}", _ItemSelected.ItemID);// Show StackTrace
- }
- }
- public StepItem DisplayItemSelected
- {
- get { return (_ItemSelected != null) ? ItemLookup[_ItemSelected.ItemID] : null; }
- }
- public void ItemShow()
- {
- if (_ItemSelected != null)
- ItemLookup[_ItemSelected.ItemID].ItemShow();
- }
- private int _Scrolling = 0; // Volian Property Snippet
- public int Scrolling
- {
- get { return _Scrolling; }
- set { _Scrolling = value; }
- }
- private DisplayPanelSettings _Settings; // Volian Property Snippet
- public DisplayPanelSettings Settings
- {
- get
- {
- if (_Settings == null) _Settings = new DisplayPanelSettings(this);
- return _Settings;
- }
- set { _Settings = value;}
- }
- private int _MaxRNO = -1; // TODO: Need to calculate MaxRNO on a section basis rather than for a panel
- public int MaxRNO
- {
- get
- {
- if(_MaxRNO == -1)
- {
- int pmode = Convert.ToInt32(_Layout.PMode) - 1;
- _MaxRNO = Convert.ToInt32( _Layout.MaxRNOTable.Split(",".ToCharArray())[pmode]);
- }
- return _MaxRNO;
- }
- }
- private Font _MyFont =null; // Volian Property Snippet
- public Font MyFont
- {
- get { return _MyFont; }
- set { _ProcFont = _SectFont = _StepFont = _MyFont = value; }
- }
- private Font _ProcFont =new Font("Arial",12,FontStyle.Bold); // Volian Property Snippet
- public Font ProcFont
- {
- get { return _ProcFont; }
- set { _ProcFont = value; }
- }
- private Font _SectFont = new Font("Arial", 10, FontStyle.Bold); // Volian Property Snippet
- public Font SectFont
- {
- get { return _SectFont; }
- set { _SectFont = value; }
- }
- private Font _StepFont = new Font("Arial", 10); // Volian Property Snippet
- public Font StepFont
- {
- get { return _StepFont; }
- set { _StepFont = value; }
- }
- private Color _ActiveColor =Color.SkyBlue; // Volian Property Snippet
- public Color ActiveColor
- {
- get { return _ActiveColor; }
- set { _ActiveColor = value; }
- }
-#if (DEBUG)
- private Color _InactiveColor =Color.Linen; // Volian Property Snippet
-#else
- private Color _InactiveColor = Color.White; // Volian Property Snippet
-#endif
- public Color InactiveColor
- {
- get { return _InactiveColor; }
- set { _InactiveColor = value; }
- }
-#if (DEBUG)
- private Color _TabColor =Color.Beige; // Volian Property Snippet
-#else
- private Color _TabColor = Color.White; // Volian Property Snippet
-#endif
- public Color TabColor
- {
- get { return _TabColor; }
- set { _TabColor = value; }
- }
-#if (DEBUG)
- private Color _PanelColor = Color.LightGray;// Volian Property Snippet
-#else
- private Color _PanelColor = Color.White; // Volian Property Snippet
-#endif
- public Color PanelColor
- {
- get { return _PanelColor; }
- set { _PanelColor = value;
- BackColor = value;
- }
- }
- private bool _ShowLines =true; // Volian Property Snippet
- public bool ShowLines
- {
- get { return _ShowLines; }
- set { _ShowLines = value; }
- }
- #endregion
- #region DisplayConversions
- private Graphics _MyGraphics = null;
- public Graphics MyGraphics
- {
- get
- {
- if (_MyGraphics == null)
- _MyGraphics = CreateGraphics();
- return _MyGraphics;
- }
- }
- private int _DPI =0; // Volian Property Snippet
- public int DPI
- {
- get
- {
- if (_DPI == 0)
- _DPI = Convert.ToInt32(MyGraphics.DpiX);
- return _DPI;
- }
- }
- public int ToDisplay(int value)
- {
- //return (DPI * value) / 864;
- return (DPI * value) / 72;
- }
- public int ToDisplay(int? value)
- {
- return ToDisplay((int)value);
- }
- public int ToDisplay(string value)
- {
- return ToDisplay(Convert.ToInt32(value));
- }
- public int ToDisplay(string value,int i)
- {
- string s = value.Split(",".ToCharArray())[i];
- return ToDisplay(s);
- }
- #endregion
- #region Debug Methods
- public void ListControls()
+ ///
+ /// Output all of the StepItem controls to the log
+ ///
+ private void ListControls()
{
// Walk through the controls and find the next control for each
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("'Item','Next'");
foreach (Control control in Controls)
- if (control.GetType().Name == "StepItem")
+ if (control.GetType() == typeof(StepItem))
{
StepItem rtb = (StepItem)control;
- StepItem nxt = rtb.NextItem;
+ StepItem nxt = rtb.NextDownStepItem;
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("{0},{1}", rtb.MyID, nxt == null ? 0 : nxt.MyID);
}
}
#endregion
}
[TypeConverter(typeof(ExpandableObjectConverter))]
- public partial class DisplayPanelSettings
+ public partial class StepPanelSettings
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- public DisplayPanelSettings(StepPanel panel)
+ public StepPanelSettings(StepPanel panel)
{
- _Panel = panel;
+ _MyStepPanel = panel;
}
- public DisplayPanelSettings()
+ public StepPanelSettings()
{
}
- private StepPanel _Panel;
+ private StepPanel _MyStepPanel;
[Browsable(false)]
- public StepPanel Panel
+ public StepPanel MyStepPanel
{
- get { return _Panel; }
- set { _Panel = value; }
+ get { return _MyStepPanel; }
+ set { _MyStepPanel = value; }
}
private float _CircleXOffset = -4;
[Category("Circle")]
@@ -400,7 +579,7 @@ namespace Volian.Controls.Library
public float CircleXOffset
{
get { return _CircleXOffset; }
- set { _CircleXOffset = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CircleXOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private float _CircleYOffset = -13;
[Category("Circle")]
@@ -408,15 +587,15 @@ namespace Volian.Controls.Library
public float CircleYOffset
{
get { return _CircleYOffset; }
- set { _CircleYOffset = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CircleYOffset = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
- private Font _CircleFont = new Font("Arial Unicode MS", 23); // Volian Property Snippet
+ private Font _CircleFont = new Font("Arial Unicode MS", 23);
[Category("Circle")]
[DisplayName("Circle Font")]
public Font CircleFont
{
get { return _CircleFont; }
- set { _CircleFont = value; if(_Panel != null) _Panel.Refresh(); }
+ set { _CircleFont = value; if(_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private Color _CircleColor = Color.Black;
[Category("Circle")]
@@ -424,7 +603,7 @@ namespace Volian.Controls.Library
public Color CircleColor
{
get { return _CircleColor; }
- set { _CircleColor = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CircleColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _CircleDiameter = 25;
[Category("Circle")]
@@ -432,7 +611,7 @@ namespace Volian.Controls.Library
public int CircleDiameter
{
get { return _CircleDiameter; }
- set { _CircleDiameter = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CircleDiameter = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _CircleWeight = 2;
[Category("Circle")]
@@ -440,7 +619,7 @@ namespace Volian.Controls.Library
public int CircleWeight
{
get { return _CircleWeight; }
- set { _CircleWeight = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CircleWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private float _NumberLocationX = 20F;
[Category("Number")]
@@ -448,7 +627,7 @@ namespace Volian.Controls.Library
public float NumberLocationX
{
get { return _NumberLocationX; }
- set { _NumberLocationX = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _NumberLocationX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private float _NumberLocationY = 4;
[Category("Number")]
@@ -456,7 +635,7 @@ namespace Volian.Controls.Library
public float NumberLocationY
{
get { return _NumberLocationY; }
- set { _NumberLocationY = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _NumberLocationY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private SizeF _NumberSize = new SizeF(200F, 23F);
[Category("Number")]
@@ -464,7 +643,7 @@ namespace Volian.Controls.Library
public SizeF NumberSize
{
get { return _NumberSize; }
- set { _NumberSize = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _NumberSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _TableWidthAdjust = 4;
[Category("Table")]
@@ -472,7 +651,7 @@ namespace Volian.Controls.Library
public int TableWidthAdjust
{
get { return _TableWidthAdjust; }
- set { _TableWidthAdjust = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _TableWidthAdjust = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _CheckOffWeight = 1;
[Category("CheckOff")]
@@ -480,7 +659,7 @@ namespace Volian.Controls.Library
public int CheckOffWeight
{
get { return _CheckOffWeight; }
- set { _CheckOffWeight = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CheckOffWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private Color _CheckOffColor = Color.Black;
[Category("CheckOff")]
@@ -488,7 +667,7 @@ namespace Volian.Controls.Library
public Color CheckOffColor
{
get { return _CheckOffColor; }
- set { _CheckOffColor = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CheckOffColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _CheckOffSize =12;
[Category("CheckOff")]
@@ -496,7 +675,7 @@ namespace Volian.Controls.Library
public int CheckOffSize
{
get { return _CheckOffSize; }
- set { _CheckOffSize = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CheckOffSize = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _CheckOffX =0;
[Category("CheckOff")]
@@ -504,15 +683,15 @@ namespace Volian.Controls.Library
public int CheckOffX
{
get { return _CheckOffX; }
- set { _CheckOffX = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CheckOffX = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
- private int _CheckOffY =5; // Volian Property Snippet
+ private int _CheckOffY =5;
[Category("CheckOff")]
[DisplayName("CheckOff Y")]
public int CheckOffY
{
get { return _CheckOffY; }
- set { _CheckOffY = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _CheckOffY = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private int _ChangeBarWeight = 1;
@@ -521,7 +700,7 @@ namespace Volian.Controls.Library
public int ChangeBarWeight
{
get { return _ChangeBarWeight; }
- set { _ChangeBarWeight = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _ChangeBarWeight = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
private Color _ChangeBarColor = Color.Black;
[Category("ChangeBar")]
@@ -529,84 +708,96 @@ namespace Volian.Controls.Library
public Color ChangeBarColor
{
get { return _ChangeBarColor; }
- set { _ChangeBarColor = value; if (_Panel != null) _Panel.Refresh(); }
+ set { _ChangeBarColor = value; if (_MyStepPanel != null) _MyStepPanel.Refresh(); }
}
}
- public partial class DisplayPanelEventArgs
+ public partial class StepPanelEventArgs
{
- private StepItem _MyDisplayItem; // Volian Property Snippet
- public StepItem MyDisplayItem
+ private StepItem _MyStepItem;
+ public StepItem MyStepItem
{
- get { return _MyDisplayItem; }
- set { _MyDisplayItem = value; }
+ get { return _MyStepItem; }
+ set { _MyStepItem = value; }
}
- private MouseEventArgs _MyMouseEventArgs; // Volian Property Snippet
+ private MouseEventArgs _MyMouseEventArgs;
public MouseEventArgs MyMouseEventArgs
{
get { return _MyMouseEventArgs; }
set { _MyMouseEventArgs = value; }
}
- public DisplayPanelEventArgs(StepItem myDisplayItem, MouseEventArgs myMouseEventArgs)
+ public StepPanelEventArgs(StepItem myStepItem, MouseEventArgs myMouseEventArgs)
{
- _MyDisplayItem = myDisplayItem;
+ _MyStepItem = myStepItem;
_MyMouseEventArgs = myMouseEventArgs;
}
}
- public partial class DisplayPanelAttachmentEventArgs
+ public partial class StepPanelAttachmentEventArgs
{
- private StepItem _MyDisplayItem; // Volian Property Snippet
- public StepItem MyDisplayItem
+ private StepItem _MyStepItem;
+ public StepItem MyStepItem
{
- get { return _MyDisplayItem; }
- set { _MyDisplayItem = value; }
+ get { return _MyStepItem; }
+ set { _MyStepItem = value; }
}
- public DisplayPanelAttachmentEventArgs(StepItem myDisplayItem)
+ public StepPanelAttachmentEventArgs(StepItem myStepItem)
{
- _MyDisplayItem = myDisplayItem;
+ _MyStepItem = myStepItem;
}
}
- public partial class DisplayLinkEventArgs : EventArgs
+ public partial class StepPanelLinkEventArgs : EventArgs
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- private StepItem _LinkedRTB; // Volian Property Snippet
- public StepItem LinkedRTB
+ private StepItem _LinkedStepItem;
+ public StepItem LinkedStepItem
{
- get { return _LinkedRTB; }
- set { _LinkedRTB = value; }
+ get { return _LinkedStepItem; }
+ //set { _LinkedStepItem = value; }
}
- private LinkClickedEventArgs _LinkInfo; // Volian Property Snippet
- public LinkClickedEventArgs LinkInfo
+ //private LinkClickedEventArgs _LinkInfo;
+ //public LinkClickedEventArgs LinkInfo
+ //{
+ // get { return _LinkInfo; }
+ // set { _LinkInfo = value; }
+ //}
+ private string _LinkInfoText;
+ public string LinkInfoText
{
- get { return _LinkInfo; }
- set { _LinkInfo = value; }
+ get { return _LinkInfoText; }
}
- public DisplayLinkEventArgs(StepItem linkedRTB, LinkClickedEventArgs linkInfo)
+ //public StepPanelLinkEventArgs(StepItem linkedStepItem, LinkClickedEventArgs linkInfo)
+ //{
+ // _LinkedStepItem = linkedStepItem;
+ // if (linkInfo != null) _LinkInfoText = linkInfo.LinkText;
+ // else _LinkInfoText = null;
+ // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText);
+ //}
+ public StepPanelLinkEventArgs(StepItem linkedStepItem, string linkInfoText)
{
- LinkedRTB = linkedRTB;
- LinkInfo = linkInfo;
+ _LinkedStepItem = linkedStepItem;
+ _LinkInfoText = linkInfoText;
//if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("\r\n LinkInfo '{0}'\r\n", linkInfo.LinkText);
}
private void ParseLink()
{
- if (_Type == ParsedLinkType.NotParsed)
+ if (_MyParsedLinkType == ParsedLinkType.NotParsed)
{
- if (_LinkInfo == null) return;
+ if (_LinkInfoText == null) return;
// First parse the string
- Match m = Regex.Match(_LinkInfo.LinkText, ".*[#]Link:([A-Za-z]*):(.*)");
+ Match m = Regex.Match(_LinkInfoText, ".*[#]Link:([A-Za-z]*):(.*)");
switch (m.Groups[1].Value)
{
case "ReferencedObject":
- _Type = ParsedLinkType.ReferencedObject;
+ _MyParsedLinkType = ParsedLinkType.ReferencedObject;
_RoUsageid = m.Groups[2].Value;
_Roid = m.Groups[3].Value;
break;
case "Transition":
case "TransitionRange":
- _Type = (ParsedLinkType)Enum.Parse(_Type.GetType(), m.Groups[1].Value);
+ _MyParsedLinkType = (ParsedLinkType)Enum.Parse(_MyParsedLinkType.GetType(), m.Groups[1].Value);
if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Link String - '{0}'", m.Groups[2].Value);
int transitionID = Convert.ToInt32(m.Groups[2].Value.Split(" ".ToCharArray())[1]);
- _MyTransition = TransitionInfo.Get(transitionID);
+ _MyTransitionInfo = TransitionInfo.Get(transitionID);
//foreach (TransitionInfo ti in _LinkedRTB.MyItem.MyContent.ContentTransitions)
//{
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("Transition ID = '{0}'", ti.TransitionID);
@@ -617,18 +808,18 @@ namespace Volian.Controls.Library
}
}
}
- private TransitionInfo _MyTransition = null; // Volian Property Snippet
- public TransitionInfo MyTransition
+ private TransitionInfo _MyTransitionInfo = null;
+ public TransitionInfo MyTransitionInfo
{
- get { ParseLink(); return _MyTransition; }
+ get { ParseLink(); return _MyTransitionInfo; }
}
- public ItemInfo ItemTo
+ public ItemInfo MyTranToItemInfo
{
- get { ParseLink(); return _MyTransition.MyItemToID; }
+ get { ParseLink(); return _MyTransitionInfo.MyItemToID; }
}
- public ItemInfo ItemRange
+ public ItemInfo MyTranRangeItemInfo
{
- get { ParseLink(); return _MyTransition.MyItemRangeID; }
+ get { ParseLink(); return _MyTransitionInfo.MyItemRangeID; }
}
private string _Roid = null; // TODO: need to return Referenced Object rather than just roid
public string Roid
@@ -640,10 +831,10 @@ namespace Volian.Controls.Library
{
get { ParseLink(); return _RoUsageid; }
}
- private ParsedLinkType _Type = ParsedLinkType.NotParsed; // Volian Property Snippet
- public ParsedLinkType Type
+ private ParsedLinkType _MyParsedLinkType = ParsedLinkType.NotParsed;
+ public ParsedLinkType MyParsedLinkType
{
- get { ParseLink(); return _Type; }
+ get { ParseLink(); return _MyParsedLinkType; }
}
}
@@ -656,8 +847,8 @@ namespace Volian.Controls.Library
ReferencedObject = 3
}
#endregion
- public delegate void DisplayPanelEvent(object sender, DisplayPanelEventArgs args);
- public delegate void DisplayPanelLinkEvent(object sender, DisplayLinkEventArgs args);
- public delegate void DisplayPanelAttachmentEvent(object sender, DisplayPanelAttachmentEventArgs args);
- public delegate void DisplayRTBLinkEvent(object sender, LinkClickedEventArgs e);
+ public delegate void StepPanelEvent(object sender, StepPanelEventArgs args);
+ public delegate void StepPanelLinkEvent(object sender, StepPanelLinkEventArgs args);
+ public delegate void StepPanelAttachmentEvent(object sender, StepPanelAttachmentEventArgs args);
+ public delegate void StepRTBLinkEvent(object sender, StepPanelLinkEventArgs args);
}
diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs
index ba00731e..0cfb53a3 100644
--- a/PROMS/Volian.Controls.Library/StepRTB.cs
+++ b/PROMS/Volian.Controls.Library/StepRTB.cs
@@ -11,8 +11,8 @@ using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
- public delegate void DisplayRTBEvent(object sender, EventArgs args);
- public partial class StepRTB : RichTextBox
+ public delegate void StepRTBEvent(object sender, EventArgs args);
+ public partial class StepRTB : RichTextBox , IStepRTB
{
#region Properties and Variables
// use newer rich text box....
@@ -32,6 +32,12 @@ namespace Volian.Controls.Library
// return prams;
// }
//}
+ private StepItem _MyStepItem;
+ public StepItem MyStepItem
+ {
+ get { return _MyStepItem; }
+ set { _MyStepItem = value; }
+ }
private bool _IsDirty = false;
private bool _InitializingRTB;
private IContainer _Container = null;
@@ -53,19 +59,19 @@ namespace Volian.Controls.Library
get { return _vwMode; }
set { _vwMode = value; }
}
- private ItemInfo _MyItem;
- public ItemInfo MyItem
+ private ItemInfo _MyItemInfo;
+ public ItemInfo MyItemInfo
{
- get { return _MyItem; }
+ get { return _MyItemInfo; }
set
{
- _MyItem = value;
+ _MyItemInfo = value;
if (value != null)
{
_InitializingRTB = true;
- DisplayText vlntxt = new DisplayText(_MyItem, EpMode, VwMode);
- _origVlnText = vlntxt;
- Font = _origVlnText.TextFont.WindowsFont;
+ DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode);
+ _origDisplayText = vlntxt;
+ Font = _origDisplayText.TextFont.WindowsFont;
AddRtfText(vlntxt);
ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
@@ -122,7 +128,7 @@ namespace Volian.Controls.Library
}
}
public System.Windows.Forms.AutoScaleMode AutoScaleMode;
- private DisplayText _origVlnText;
+ private DisplayText _origDisplayText;
private RichTextBox _rtbTemp = new RichTextBox();
private string _MyLinkText;
@@ -134,7 +140,7 @@ namespace Volian.Controls.Library
if (value != _MyLinkText)
{
_MyLinkText = value;
- OnLinkChanged(this, new LinkClickedEventArgs(_MyLinkText));
+ OnLinkChanged(this, new StepPanelLinkEventArgs(_MyStepItem, _MyLinkText));
Console.WriteLine("DisplayRTB - MyLinkText changed {0}", _MyLinkText);
}
}
@@ -170,17 +176,17 @@ namespace Volian.Controls.Library
BorderStyle = System.Windows.Forms.BorderStyle.None;
this.DetectUrls = true;
ContextMenuStrip = contextMenuStrip;
- ContentsResized += new ContentsResizedEventHandler(DisplayRTB_ContentsResized);
- this.LinkClicked += new LinkClickedEventHandler(DisplayRTB_LinkClicked);
- this.Click +=new EventHandler(DisplayRTB_Click);
- this.KeyPress += new KeyPressEventHandler(DisplayRTB_KeyPress);
- this.KeyUp += new KeyEventHandler(DisplayRTB_KeyUp);
- this.KeyDown += new KeyEventHandler(DisplayRTB_KeyDown);
- this.TextChanged += new EventHandler(DisplayRTB_TextChanged);
+ ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
+ this.LinkClicked += new LinkClickedEventHandler(StepRTB_LinkClicked);
+ this.Click +=new EventHandler(StepRTB_Click);
+ this.KeyPress += new KeyPressEventHandler(StepRTB_KeyPress);
+ this.KeyUp += new KeyEventHandler(StepRTB_KeyUp);
+ this.KeyDown += new KeyEventHandler(StepRTB_KeyDown);
+ this.TextChanged += new EventHandler(StepRTB_TextChanged);
//this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged);
}
- private void DisplayRTB_Click(object sender, EventArgs e)
+ private void StepRTB_Click(object sender, EventArgs e)
{
if (ReadOnly) return;
@@ -190,7 +196,7 @@ namespace Volian.Controls.Library
}
}
- void DisplayRTB_SelectionChanged(object sender, EventArgs e)
+ void StepRTB_SelectionChanged(object sender, EventArgs e)
{
Console.WriteLine("SelectionStart {0}, SelectionLength {1}", SelectionStart, SelectionLength);
if (!SelectionProtected && MyLinkText != null)
@@ -202,13 +208,13 @@ namespace Volian.Controls.Library
#region ApplicationSupport
public void ToggleViewEdit()
{
- ItemInfo tmp = MyItem;
- MyItem = null;
+ ItemInfo tmp = MyItemInfo;
+ MyItemInfo = null;
ReadOnly = !ReadOnly;
EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit;
Clear();
- MyItem = tmp;
+ MyItemInfo = tmp;
}
public void InsertRO(string value, string link)
{
@@ -228,14 +234,14 @@ namespace Volian.Controls.Library
{
if (ReadOnly) return;
if (!_IsDirty) return;
- bool success = _origVlnText.Save((RichTextBox)this);
+ bool success = _origDisplayText.Save((RichTextBox)this);
if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
}
#endregion
#region AddRtfText
- private void AddRtfText(DisplayText vlntext)
+ private void AddRtfText(DisplayText myDisplayText)
{
- foreach (displayTextElement vte in vlntext.DisplayTextElementList)
+ foreach (displayTextElement vte in myDisplayText.DisplayTextElementList)
{
if (vte.Type == E_TextElementType.TEXT)
AddRtf(vte);
@@ -245,30 +251,30 @@ namespace Volian.Controls.Library
AddRtfLink((displayLinkElement)vte);
}
}
- private void AddRtf(displayTextElement vte)
+ private void AddRtf(displayTextElement myDisplayTextElement)
{
- SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 "+this.Font.FontFamily.Name+@";}}\f0\fs" + this.Font.SizeInPoints*2 + " " + vte.Text + @"}}";
+ SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 "+this.Font.FontFamily.Name+@";}}\f0\fs" + this.Font.SizeInPoints*2 + " " + myDisplayTextElement.Text + @"}}";
}
private void AddRtf(string str)
{
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 " + this.Font.FontFamily.Name + @";}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + str + @"}}";
}
- private void AddSymbol(displayTextElement vte)
+ private void AddSymbol(displayTextElement myDisplayTextElement)
{
- SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + vte.Text + @"}";
+ SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + myDisplayTextElement.Text + @"}";
}
private void AddSymbol(string str)
{
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + /* ConvertUnicodeChar(str) */ str + @"}";
}
- private void AddRtfLink(displayLinkElement vte)
+ private void AddRtfLink(displayLinkElement myDisplayLinkElement)
{
if (CreateParams.ClassName == "RICHEDIT50W")
- AddLink50(vte.Text, vte.Link);
+ AddLink50(myDisplayLinkElement.Text, myDisplayLinkElement.Link);
else
- AddLink20(vte.Text, vte.Link);
+ AddLink20(myDisplayLinkElement.Text, myDisplayLinkElement.Link);
}
public void AddRtfLink(string linkUrl, string linkValue)
{
@@ -305,7 +311,7 @@ namespace Volian.Controls.Library
}
#endregion
#region HeightSupport
- public event DisplayRTBEvent HeightChanged;
+ public event StepRTBEvent HeightChanged;
private void OnHeightChanged(object sender, EventArgs args)
{
if (HeightChanged != null) HeightChanged(sender, args);
@@ -376,40 +382,40 @@ namespace Volian.Controls.Library
#endregion
#region EventSupport
#region LinkEvents
- private LinkClickedEventArgs _LinkClickedEventArgs;
- public event DisplayRTBLinkEvent LinkChanged; // TODO: ?
- private void OnLinkChanged(object sender, LinkClickedEventArgs args)
+ private StepPanelLinkEventArgs _MyLinkClickedEventArgs;
+ public event StepRTBLinkEvent LinkChanged; // TODO: ?
+ private void OnLinkChanged(object sender, StepPanelLinkEventArgs args)
{
- _LinkClickedEventArgs = args;
+ _MyLinkClickedEventArgs = args;
if (LinkChanged != null) LinkChanged(sender, args);
}
- public event DisplayRTBLinkEvent LinkGoTo;
- private void OnLinkGoTo(object sender, LinkClickedEventArgs args)
+ public event StepRTBLinkEvent LinkGoTo;
+ private void OnLinkGoTo(object sender, StepPanelLinkEventArgs args)
{
- _LinkClickedEventArgs = args;
+ _MyLinkClickedEventArgs = args;
if (LinkGoTo != null) LinkGoTo(sender, args);
}
- public event DisplayRTBLinkEvent LinkModifyTran;
- private void OnLinkModifyTran(object sender, LinkClickedEventArgs args)
+ public event StepRTBLinkEvent LinkModifyTran;
+ private void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
{
- _LinkClickedEventArgs = args;
+ _MyLinkClickedEventArgs = args;
if (LinkModifyTran != null) LinkModifyTran(sender, args);
}
- public event DisplayRTBLinkEvent LinkModifyRO;
- private void OnLinkModifyRO(object sender, LinkClickedEventArgs args)
+ public event StepRTBLinkEvent LinkModifyRO;
+ private void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
{
- _LinkClickedEventArgs = args;
+ _MyLinkClickedEventArgs = args;
if (LinkModifyRO != null) LinkModifyRO(sender, args);
}
private Point _savcurpos;
- private void DisplayRTB_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
+ private void StepRTB_LinkClicked(object sender,LinkClickedEventArgs args)
{
if (ReadOnly) return;
- _LinkClickedEventArgs = e;
+ _MyLinkClickedEventArgs = new StepPanelLinkEventArgs(_MyStepItem, args.LinkText);
_savcurpos = Cursor.Position;
- SelectLink(e.LinkText);
- OnLinkChanged(sender, e);
+ SelectLink(args.LinkText);
+ OnLinkChanged(sender, _MyLinkClickedEventArgs);
//_savcurpos = Cursor.Position;
//if (e.LinkText.IndexOf("ReferencedObject") > -1)
// this.contextMenuStripROs.Show(System.Windows.Forms.Cursor.Position);
@@ -440,18 +446,18 @@ namespace Volian.Controls.Library
}
#endregion
#region TextOrContents
- void DisplayRTB_TextChanged(object sender, EventArgs e)
+ void StepRTB_TextChanged(object sender, EventArgs e)
{
_IsDirty = true;
}
- void DisplayRTB_ContentsResized(object sender, ContentsResizedEventArgs e)
+ void StepRTB_ContentsResized(object sender, ContentsResizedEventArgs e)
{
ContentsRectangle = e.NewRectangle;
}
#endregion
#region KeyboardHandling
private bool IsControlChar = false;
- void DisplayRTB_KeyDown(object sender, KeyEventArgs e)
+ void StepRTB_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control)
{
@@ -467,7 +473,7 @@ namespace Volian.Controls.Library
}
}
}
- void DisplayRTB_KeyUp(object sender, KeyEventArgs e)
+ void StepRTB_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
{
@@ -514,7 +520,7 @@ namespace Volian.Controls.Library
SelectLink();
return true;
}
- private void DisplayRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
+ private void StepRTB_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (!ReadOnly)
{
@@ -713,12 +719,12 @@ namespace Volian.Controls.Library
if (e.ClickedItem.ToString() == "Delete Transition") DeleteTransition();
else if (e.ClickedItem.ToString() == "Modify Transition")
{
- OnLinkModifyTran(sender, _LinkClickedEventArgs);
+ OnLinkModifyTran(sender, _MyLinkClickedEventArgs);
}
else if (e.ClickedItem.ToString() == "Go To")
{
Console.WriteLine("DisplayRTB:contextMenu:Go TO");
- OnLinkGoTo(sender, _LinkClickedEventArgs);
+ OnLinkGoTo(sender, _MyLinkClickedEventArgs);
}
}
@@ -741,7 +747,7 @@ namespace Volian.Controls.Library
private void contextMenuStripROs_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem.ToString() == "Delete RO") DeleteRefObj();
- else if (e.ClickedItem.ToString() == "Modify RO") OnLinkModifyRO(sender, _LinkClickedEventArgs);
+ else if (e.ClickedItem.ToString() == "Modify RO") OnLinkModifyRO(sender, _MyLinkClickedEventArgs);
}
#endregion
diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs
index 953a7779..720b69a3 100644
--- a/PROMS/Volian.Controls.Library/StepTabPanel.cs
+++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs
@@ -11,125 +11,212 @@ namespace Volian.Controls.Library
{
public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer
{
- private DisplayTabControl _MyTabControl;
-
- public DisplayTabControl MyTabControl
+ #region Private Fields
+ private DisplayTabControl _MyDisplayTabControl;
+ private StepTabRibbon _MyStepTabRibbon;
+ private StepPanel _MyStepPanel;
+ private DisplayTabItem _MyDisplayTabItem;
+ #endregion
+ #region Properties
+ ///
+ /// Container
+ ///
+ public DisplayTabControl MyDisplayTabControl
{
- get { return _MyTabControl; }
- set { _MyTabControl = value; }
+ get { return _MyDisplayTabControl; }
+ //set { _MyDisplayTabControl = value; }
}
- private StepTabRibbon _MyTabRibbon;
- private Volian.Controls.Library.StepPanel _MyPanel;
- public Volian.Controls.Library.StepPanel MyPanel
+ ///
+ /// StepPanel contained in this control.
+ ///
+ public Volian.Controls.Library.StepPanel MyStepPanel
{
- get { return _MyPanel; }
- set { _MyPanel = value; }
+ get { return _MyStepPanel; }
+ //set { _MyStepPanel = value; }
}
- private DisplayTabItem _TabItem;
- public DisplayTabItem TabItem
+ ///
+ /// related DisplayTabItem
+ ///
+ public DisplayTabItem MyDisplayTabItem
{
- get { return _TabItem; }
- set { _TabItem = value; }
+ get { return _MyDisplayTabItem; }
+ set { _MyDisplayTabItem = value; }
}
- public ItemInfo ItemSelected
+ ///
+ /// Currently Selected ItemInfo
+ ///
+ public ItemInfo SelectedItemInfo
{
- get { return _MyPanel.ItemSelected; }
- set { _MyPanel.ItemSelected = value; }
+ get { return _MyStepPanel.SelectedItemInfo; }
+ set { _MyStepPanel.SelectedItemInfo = value; }
}
- public StepItem SelectedItem
+ ///
+ /// Currently Selected StepItem
+ ///
+ public StepItem SelectedStepItem
{
- get { return _MyPanel._ItemLookup[_MyPanel.ItemSelected.ItemID]; }
+ //get { return _MyStepPanel._LookupStepItems[_MyStepPanel.SelectedItemInfo.ItemID]; }
+ get { return _MyStepPanel.SelectedStepItem; }
}
- public ItemInfo MyItem
+ ///
+ /// Procedure ItemInfo
+ ///
+ public ItemInfo MyProcedureItemInfo
{
- get { return _MyPanel.MyItem; }
- set { _MyPanel.MyItem = value; }
+ get { return _MyStepPanel.MyProcedureItemInfo; }
+ set { _MyStepPanel.MyProcedureItemInfo = value; }
}
- public StepTabPanel(DisplayTabControl myTabControl)
+ #endregion
+ #region Contructors
+ public StepTabPanel(DisplayTabControl myDisplayTabControl)
{
- _MyTabControl = myTabControl;
+ _MyDisplayTabControl = myDisplayTabControl;
InitializeComponent();
- SetupDisplayTabPanel();
- SetupDisplayPanel();
- SetupDisplayTabRibbon();
+ SetupStepTabPanel();
+ SetupStepPanel();
+ SetupStepTabRibbon();
}
- private void SetupDisplayTabRibbon()
+ #endregion
+ #region Private Methods - Setup
+ ///
+ /// Setup StepTabRibbon
+ ///
+ private void SetupStepTabRibbon()
{
- _MyTabRibbon = new StepTabRibbon();
- _MyTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
- _MyTabRibbon.Location = new System.Drawing.Point(0, 0);
- _MyTabRibbon.Name = "displayTabRibbon1";
+ _MyStepTabRibbon = new StepTabRibbon();
+ _MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
+ _MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
+ _MyStepTabRibbon.Name = "displayTabRibbon1";
//_MyTabRibbon.MyDisplayRTB = null;
- _MyTabRibbon.MyDisplayItem = null;
- this.Controls.Add(_MyTabRibbon);
+ _MyStepTabRibbon.MyStepItem = null;
+ this.Controls.Add(_MyStepTabRibbon);
}
- private void SetupDisplayTabPanel()
+ ///
+ /// Setup this within control
+ ///
+ private void SetupStepTabPanel()
{
Dock = System.Windows.Forms.DockStyle.Fill;
- this.Enter += new EventHandler(DisplayTabPanel_Enter);
+ this.Enter += new EventHandler(StepTabPanel_Enter);
}
- void DisplayTabPanel_Enter(object sender, EventArgs e)
- {
- //if (ItemSelected != null)
- _MyPanel.ItemShow();
- }
- private void SetupDisplayPanel()
+ ///
+ /// Setup StepPanel
+ ///
+ private void SetupStepPanel()
{
//this.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
- _MyPanel = new Volian.Controls.Library.StepPanel(this.components);
- this.Controls.Add(_MyPanel);
+ _MyStepPanel = new Volian.Controls.Library.StepPanel(this.components);
+ this.Controls.Add(_MyStepPanel);
//
// _MyPanel
//
- _MyPanel.AutoScroll = true;
- _MyPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- _MyPanel.LinkClicked +=new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkClicked);
- _MyPanel.LinkActiveChanged += new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkActiveChanged);
- _MyPanel.LinkInsertTran += new DisplayPanelLinkEvent(_MyPanel_LinkInsertTran);
- _MyPanel.LinkInsertRO += new DisplayPanelLinkEvent(_MyPanel_LinkInsertRO);
- _MyPanel.LinkModifyTran += new DisplayPanelLinkEvent(_MyPanel_LinkModifyTran);
- _MyPanel.LinkModifyRO += new DisplayPanelLinkEvent(_MyPanel_LinkModifyRO);
- _MyPanel.ItemClick +=new Volian.Controls.Library.DisplayPanelEvent(_MyPanel_ItemClick);
- _MyPanel.AttachmentClicked += new Volian.Controls.Library.DisplayPanelAttachmentEvent(_MyPanel_AttachmentClicked);
- _MyPanel.ItemSelectedChanged += new DisplayPanelEvent(_MyPanel_ItemSelectedChanged);
+ _MyStepPanel.AutoScroll = true;
+ _MyStepPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ _MyStepPanel.LinkClicked +=new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkClicked);
+ _MyStepPanel.LinkActiveChanged += new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkActiveChanged);
+ _MyStepPanel.LinkInsertTran += new StepPanelLinkEvent(_MyStepPanel_LinkInsertTran);
+ _MyStepPanel.LinkInsertRO += new StepPanelLinkEvent(_MyStepPanel_LinkInsertRO);
+ _MyStepPanel.LinkModifyTran += new StepPanelLinkEvent(_MyStepPanel_LinkModifyTran);
+ _MyStepPanel.LinkModifyRO += new StepPanelLinkEvent(_MyStepPanel_LinkModifyRO);
+ _MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick);
+ _MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked);
+ _MyStepPanel.ItemSelectedChanged += new StepPanelEvent(_MyStepPanel_ItemSelectedChanged);
}
- void _MyPanel_LinkActiveChanged(object sender, DisplayLinkEventArgs args)
+ #endregion
+ #region Event Handlers
+ ///
+ /// Occurs when the user clicks on a StepTabPanel
+ ///
+ ///
+ ///
+ private void StepTabPanel_Enter(object sender, EventArgs e)
{
- _MyTabControl.OnLinkActiveChanged(sender, args);
- }
- void _MyPanel_LinkInsertTran(object sender, DisplayLinkEventArgs args)
+ //if (ItemSelected != null)
+ _MyStepPanel.ItemShow();
+ }
+ ///
+ /// Occurs when the cursor moves onto or off of a link
+ ///
+ ///
+ ///
+ void _MyStepPanel_LinkActiveChanged(object sender, StepPanelLinkEventArgs args)
{
- _MyTabControl.OnLinkInsertTran(sender, args);
+ _MyDisplayTabControl.OnLinkActiveChanged(sender, args);
}
- void _MyPanel_LinkInsertRO(object sender, DisplayLinkEventArgs args)
+ ///
+ /// Occurs when the user chooses to add a transition
+ ///
+ ///
+ ///
+ void _MyStepPanel_LinkInsertTran(object sender, StepPanelLinkEventArgs args)
{
- _MyTabControl.OnLinkInsertRO(sender, args);
+ _MyDisplayTabControl.OnLinkInsertTran(sender, args);
}
- void _MyPanel_LinkModifyTran(object sender, DisplayLinkEventArgs args)
+ ///
+ /// Occurs when the user chooses to add an RO
+ ///
+ ///
+ ///
+ void _MyStepPanel_LinkInsertRO(object sender, StepPanelLinkEventArgs args)
{
- _MyTabControl.OnLinkModifyTran(sender, args);
+ _MyDisplayTabControl.OnLinkInsertRO(sender, args);
}
- void _MyPanel_LinkModifyRO(object sender, DisplayLinkEventArgs args)
+ ///
+ /// Occurs when the user chosses to modify a transition
+ ///
+ ///
+ ///
+ void _MyStepPanel_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
{
- _MyTabControl.OnLinkModifyRO(sender, args);
+ _MyDisplayTabControl.OnLinkModifyTran(sender, args);
}
- void _MyPanel_ItemSelectedChanged(object sender, DisplayPanelEventArgs args)
+ ///
+ /// Occurs when the user chooses to Modify an RO
+ ///
+ ///
+ ///
+ void _MyStepPanel_LinkModifyRO(object sender, StepPanelLinkEventArgs args)
+ {
+ _MyDisplayTabControl.OnLinkModifyRO(sender, args);
+ }
+ ///
+ /// Occurs when the Selected Item changes
+ ///
+ ///
+ ///
+ void _MyStepPanel_ItemSelectedChanged(object sender, StepPanelEventArgs args)
{
//_MyTabRibbon.MyDisplayRTB = args.MyDisplayItem.MyDisplayRTB;
- _MyTabRibbon.MyDisplayItem = args.MyDisplayItem;
- _MyTabControl.OnItemSelectedChanged(sender, args);
+ _MyStepTabRibbon.MyStepItem = args.MyStepItem;
+ _MyDisplayTabControl.OnItemSelectedChanged(sender, args);
}
- void _MyPanel_AttachmentClicked(object sender, DisplayPanelAttachmentEventArgs args)
+ ///
+ /// Occurs when the user clicks on the Attachment Expander
+ ///
+ ///
+ ///
+ void _MyStepPanel_AttachmentClicked(object sender, StepPanelAttachmentEventArgs args)
{
- _MyTabControl.OpenItem(args.MyDisplayItem.MyItem);
+ _MyDisplayTabControl.OpenItem(args.MyStepItem.MyItemInfo);
}
- void _MyPanel_ItemClick(object sender, DisplayPanelEventArgs args)
+ ///
+ /// Occurs when the user clicks on the tab next to an item
+ ///
+ ///
+ ///
+ void _MyStepPanel_ItemClick(object sender, StepPanelEventArgs args)
{
- _MyTabControl.OnItemClick(sender, args);
+ _MyDisplayTabControl.OnItemClick(sender, args);
}
- void _MyPanel_LinkClicked(object sender, DisplayLinkEventArgs args)
+ ///
+ /// Occurs when the user clicks on an item
+ ///
+ ///
+ ///
+ void _MyStepPanel_LinkClicked(object sender, StepPanelLinkEventArgs args)
{
- _MyTabControl.OpenItem(args.ItemTo);
+ _MyDisplayTabControl.OpenItem(args.MyTranToItemInfo);
}
+ #endregion
}
}
diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
index 979e919e..34ac23df 100644
--- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs
+++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs
@@ -11,47 +11,47 @@ namespace Volian.Controls.Library
{
public partial class StepTabRibbon : UserControl
{
- private StepItem _MyDisplayItem;
- public StepItem MyDisplayItem
+ private StepItem _MyStepItem;
+ public StepItem MyStepItem
{
- get { return _MyDisplayItem; }
+ get { return _MyStepItem; }
set
{
- _MyDisplayItem = value;
+ _MyStepItem = value;
if (value != null)
{
- _MyDisplayRTB = value.MyDisplayRTB;
+ _MyStepRTB = value.MyStepRTB;
}
}
}
- private StepRTB _MyDisplayRTB;
- public StepRTB MyDisplayRTB
+ private StepRTB _MyStepRTB;
+ public StepRTB MyStepRTB
{
- get { return _MyDisplayRTB; }
+ get { return _MyStepRTB; }
set
{
- _MyDisplayRTB = value;
+ _MyStepRTB = value;
if (value != null)
{
- _ContextMenuBar.SetContextMenuEx(_MyDisplayRTB, btnCMRtfEdit);
- _MyDisplayRTB.SelectionChanged += new EventHandler(MyDisplayRTB_SelectionChanged);
- _MyDisplayRTB.Leave += new EventHandler(MyDisplayRTB_Leave);
+ _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
+ _MyStepRTB.SelectionChanged += new EventHandler(MyStepRTB_SelectionChanged);
+ _MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave);
}
}
}
- void MyDisplayRTB_Leave(object sender, EventArgs e)
+ void MyStepRTB_Leave(object sender, EventArgs e)
{
- _MyDisplayRTB.SelectionChanged -= new EventHandler(MyDisplayRTB_SelectionChanged);
- _MyDisplayRTB.Leave -= new EventHandler(MyDisplayRTB_Leave);
+ _MyStepRTB.SelectionChanged -= new EventHandler(MyStepRTB_SelectionChanged);
+ _MyStepRTB.Leave -= new EventHandler(MyStepRTB_Leave);
}
- void MyDisplayRTB_SelectionChanged(object sender, EventArgs e)
+ void MyStepRTB_SelectionChanged(object sender, EventArgs e)
{
- btnCMBold.Checked = btnBold.Checked = _MyDisplayRTB.SelectionFont.Bold;
- btnCMItalics.Checked = btnItalics.Checked = _MyDisplayRTB.SelectionFont.Italic;
- btnCMUnderline.Checked = btnUnderline.Checked = _MyDisplayRTB.SelectionFont.Underline;
- btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyDisplayRTB);
- btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyDisplayRTB);
- btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyDisplayRTB.SelectionLength > 0;
+ btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
+ btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
+ btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
+ btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
+ btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
+ btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
}
public StepTabRibbon()
{
@@ -85,73 +85,73 @@ namespace Volian.Controls.Library
private void btnSym_Click(object sender, EventArgs e)
{
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
- _MyDisplayRTB.InsertSymbol((string)b.Tag);
+ _MyStepRTB.InsertSymbol((string)b.Tag);
}
private void btnPaste_Click(object sender, EventArgs e)
{
IDataObject myDO = Clipboard.GetDataObject();
if (myDO.GetDataPresent("Rich Text Format"))
- _MyDisplayRTB.SelectedRtf = myDO.GetData("Rich Text Format").ToString();
+ _MyStepRTB.SelectedRtf = myDO.GetData("Rich Text Format").ToString();
else if (myDO.GetDataPresent("Text"))
- _MyDisplayRTB.SelectedText = myDO.GetData("Text").ToString();
+ _MyStepRTB.SelectedText = myDO.GetData("Text").ToString();
}
private void btnCut_Click(object sender, EventArgs e)
{
Clipboard.Clear();
- DataObject myDO = new DataObject("Rich Text Format", _MyDisplayRTB.SelectedRtf);
+ DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
Clipboard.SetDataObject(myDO);
- _MyDisplayRTB.SelectedText = "";
+ _MyStepRTB.SelectedText = "";
}
private void btnCopy_Click(object sender, EventArgs e)
{
Clipboard.Clear();
- DataObject myDO = new DataObject("Rich Text Format", _MyDisplayRTB.SelectedRtf);
+ DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
Clipboard.SetDataObject(myDO);
}
private void btnBold_Click(object sender, EventArgs e)
{
- FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Bold;
- _MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs);
- btnCMBold.Checked = btnBold.Checked = _MyDisplayRTB.SelectionFont.Bold;
+ FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Bold;
+ _MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
+ btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
}
private void btnItalics_Click(object sender, EventArgs e)
{
- FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Italic;
- _MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs);
- btnCMItalics.Checked = btnItalics.Checked = _MyDisplayRTB.SelectionFont.Italic;
+ FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Italic;
+ _MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
+ btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
}
private void btnUnderline_Click(object sender, EventArgs e)
{
- FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Underline;
- _MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs);
- btnCMUnderline.Checked = btnUnderline.Checked = _MyDisplayRTB.SelectionFont.Underline;
+ FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Underline;
+ _MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
+ btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
}
private void btnSuperscript_Click(object sender, EventArgs e)
{
- RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyDisplayRTB), _MyDisplayRTB, _MyDisplayRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
- btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyDisplayRTB);
+ RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
+ btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
}
private void btnSubscript_Click(object sender, EventArgs e)
{
- RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyDisplayRTB), _MyDisplayRTB, _MyDisplayRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
- btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyDisplayRTB);
+ RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
+ btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
}
private void btnUppercase_Click(object sender, EventArgs e)
{
- _MyDisplayRTB.SetSelectedCase('U');
+ _MyStepRTB.SetSelectedCase('U');
}
private void btnLowercase_Click(object sender, EventArgs e)
{
- _MyDisplayRTB.SetSelectedCase('l');
+ _MyStepRTB.SetSelectedCase('l');
}
private void btnTitleCase_Click(object sender, EventArgs e)
{
- _MyDisplayRTB.SetSelectedCase('T');
+ _MyStepRTB.SetSelectedCase('T');
}
//public event DisplayRTBLinkEvent LinkInsertTran;
//private void OnLinkInsertTran(object sender, LinkClickedEventArgs args)
@@ -164,12 +164,12 @@ namespace Volian.Controls.Library
// see if user is positioned 'on' a transition within the rtb, if so do a modify, otherwise,
// insert transition.
StepTabPanel tmp = Parent as StepTabPanel;
- tmp.MyTabControl.OnLinkModifyTran(this, new DisplayLinkEventArgs(_MyDisplayItem, null));
+ tmp.MyDisplayTabControl.OnLinkModifyTran(this, new StepPanelLinkEventArgs(_MyStepItem, null));
}
private void btnInsHrdSpc_Click(object sender, EventArgs e)
{
- _MyDisplayRTB.InsertSymbol(@"\u160?");
+ _MyStepRTB.InsertSymbol(@"\u160?");
}
private void btnInsRO_Click(object sender, EventArgs e)
@@ -177,17 +177,17 @@ namespace Volian.Controls.Library
// see if user is positioned 'on' an RO within the rtb, if so do a modify, otherwise,
// insert transition.
StepTabPanel tmp = Parent as StepTabPanel;
- tmp.MyTabControl.OnLinkModifyRO(this, new DisplayLinkEventArgs(_MyDisplayItem, null));
+ tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(_MyStepItem, null));
}
private void btnRedo_Click(object sender, EventArgs e)
{
- _MyDisplayRTB.Redo();
+ _MyStepRTB.Redo();
}
private void btnUndo_Click(object sender, EventArgs e)
{
- _MyDisplayRTB.Undo();
+ _MyStepRTB.Undo();
}
}
}
diff --git a/PROMS/Volian.Controls.Library/TemporaryFormat.cs b/PROMS/Volian.Controls.Library/TemporaryFormat.cs
index 575d1ff8..07705c14 100644
--- a/PROMS/Volian.Controls.Library/TemporaryFormat.cs
+++ b/PROMS/Volian.Controls.Library/TemporaryFormat.cs
@@ -65,12 +65,12 @@ namespace Volian.Controls.Library
public static string TabFormat(StepItem myDisplayItem)
{
string format = string.Empty;
- if (myDisplayItem.MyItem != null)
+ if (myDisplayItem.MyItemInfo != null)
{
- int typ = (int)myDisplayItem.MyItem.MyContent.Type;
+ int typ = (int)myDisplayItem.MyItemInfo.MyContent.Type;
if (typ >= 20000)
{
- if (myDisplayItem.RNOLevel > 0 && IsRNO(myDisplayItem.MyItem)) return "";
+ if (myDisplayItem.RNOLevel > 0 && IsRNO(myDisplayItem.MyItemInfo)) return "";
// Step 1: Get TabFormat from Format
format = _TabFormats[typ % 10000];
if (format == "")
diff --git a/PROMS/Volian.Controls.Library/TransPanel.Designer.cs b/PROMS/Volian.Controls.Library/TransPanel.Designer.cs
index 39431e25..b6495219 100644
--- a/PROMS/Volian.Controls.Library/TransPanel.Designer.cs
+++ b/PROMS/Volian.Controls.Library/TransPanel.Designer.cs
@@ -1,6 +1,6 @@
namespace Volian.Controls.Library
{
- partial class TransPanel
+ partial class TransparentPanel
{
///
/// Required designer variable.
diff --git a/PROMS/Volian.Controls.Library/TransPanel.cs b/PROMS/Volian.Controls.Library/TransPanel.cs
index fdc75ea2..fa59f0c1 100644
--- a/PROMS/Volian.Controls.Library/TransPanel.cs
+++ b/PROMS/Volian.Controls.Library/TransPanel.cs
@@ -10,7 +10,7 @@ namespace Volian.Controls.Library
///
/// Summary description for TransPanel.
///
- public partial class TransPanel : Panel
+ public partial class TransparentPanel : Panel
{
private string _Caption = "Inactive";
public string Caption
@@ -24,7 +24,7 @@ namespace Volian.Controls.Library
get { return _Alpha; }
set { _Alpha = value; InvalidateEx(); }
}
- public TransPanel()
+ public TransparentPanel()
{
InitializeComponent();
}
diff --git a/PROMS/Volian.Controls.Library/vlnExpander.cs b/PROMS/Volian.Controls.Library/vlnExpander.cs
index 7963000c..0d93b1e6 100644
--- a/PROMS/Volian.Controls.Library/vlnExpander.cs
+++ b/PROMS/Volian.Controls.Library/vlnExpander.cs
@@ -120,11 +120,11 @@ namespace Volian.Controls.Library
get { return _Attachment; }
set { _Attachment = value; this.Refresh(); }
}
- private ExpanderStyle _Style = ExpanderStyle.Square;
- public ExpanderStyle Style
+ private ExpanderStyle _MyExpanderStyle = ExpanderStyle.Square;
+ public ExpanderStyle MyExpanderStyle
{
- get { return _Style; }
- set { _Style = value; this.Refresh(); }
+ get { return _MyExpanderStyle; }
+ set { _MyExpanderStyle = value; this.Refresh(); }
}
private void vlnExpander_Paint(object sender, PaintEventArgs e)
{
@@ -143,7 +143,7 @@ namespace Volian.Controls.Library
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
p = new Pen(_BorderColor, _PenWidth);
int penWidth = ClientRectangle.Width / _WidthFactor;
- switch (_Style)
+ switch (_MyExpanderStyle)
{
case ExpanderStyle.Round:
//e.Graphics.FillEllipse(Brushes.Gray, 0F, 0F, diameter, diameter);