Object and Property name changes for consistency

This commit is contained in:
Rich 2008-03-27 19:39:10 +00:00
parent 7caa952bc3
commit c0511c990d
19 changed files with 2229 additions and 1407 deletions

View File

@ -13,81 +13,106 @@ namespace Volian.Controls.Library
{ {
public partial class DSOTabPanel : DevComponents.DotNetBar.PanelDockContainer 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 static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private AxDSOFramer.AxFramerControl _MyDSOFramer; private AxDSOFramer.AxFramerControl _MyDSOFramer;
private TransPanel _MyTransPanel; private TransparentPanel _MyTransparentPanel;
private static int _Count = 0; private static int _Count = 0;
private DocumentInfo _MyDocument; private DocumentInfo _MyDocumentInfo;
private int _MyCount; private int _MyCount;
private DisplayTabItem _MyDisplayTabItem;
private DSOFile _DSOFile;
#endregion
#region Public Properties
/// <summary>
/// Count of DSO Pages open. Limited to 18 in DisplayTabControl
/// </summary>
public static int Count public static int Count
{ {
get { return _Count; } get { return _Count; }
set { _Count = value; } set { _Count = value; }
} }
private DisplayTabItem _TabItem; /// <summary>
public DisplayTabItem TabItem /// Pointer to the related DisplayTabItem
/// </summary>
public DisplayTabItem MyDisplayTabItem
{ {
get { return _TabItem; } get { return _MyDisplayTabItem; }
set { _TabItem = value; } set { _MyDisplayTabItem = value; }
} }
//private frmPG _frm = null; /// <summary>
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myTabControl) /// DocumentInfo record for the Word document
/// </summary>
public DocumentInfo MyDocumentInfo
{ {
_MyTabControl = myTabControl; get { return _MyDocumentInfo; }
InitializeComponent();
SetupDSOTabPanel();
_MyDocument = documentInfo;
SetupDSO();
//_frm = new frmPG(_MyDSOFramer);
//_frm.Show();
} }
private void SetupDSOTabPanel() /// <summary>
{ /// Temporary Word file used for editing.
Dock = System.Windows.Forms.DockStyle.Fill; /// </summary>
} internal DSOFile MyDSOFile
public DocumentInfo DocumentInfo
{
get { return _MyDocument; }
}
private DSOFile _DSOFile;
internal DSOFile DSOFile
{ {
get get
{ {
if (_DSOFile == null) if (_DSOFile == null)
_DSOFile = new DSOFile(_MyDocument); _DSOFile = new DSOFile(_MyDocumentInfo);
return _DSOFile; return _DSOFile;
} }
} }
/// <summary>
/// Dirty status. Only saved if dirty.
/// </summary>
public bool IsDirty public bool IsDirty
{ {
get { return _MyDSOFramer.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() private void SetupDSO()
{ {
_Count++; _Count++; // Increment the count of open Word documents (Limit in DisplayTabControl)
_MyCount = _Count; _MyCount = _Count;
this._MyTransPanel = new TransPanel(); this._MyTransparentPanel = new TransparentPanel();
this._MyDSOFramer = new AxDSOFramer.AxFramerControl(); this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
this.Controls.Add(this._MyDSOFramer); 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._MyDSOFramer);
this.components.Add(this._MyTransPanel); this.components.Add(this._MyTransparentPanel);
this._MyTransPanel.Dock = System.Windows.Forms.DockStyle.Fill; this._MyTransparentPanel.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._MyTransparentPanel.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._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.Location = new System.Drawing.Point(0, 0);
//this._MyTransPanel.Name = "transPanel1"; //this._MyTransPanel.Name = "transPanel1";
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423); //this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1; //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; this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab)); //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState"))); //this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
this._MyDSOFramer.Open(DSOFile.MyFile.FullName); this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
this._MyDSOFramer.Menubar = false; this._MyDSOFramer.Menubar = false;
this._MyDSOFramer.Titlebar = false; this._MyDSOFramer.Titlebar = false;
//if (_MyCount < 20) //if (_MyCount < 20)
@ -98,18 +123,40 @@ namespace Volian.Controls.Library
this.Enter += new EventHandler(DSOTabPanel_Enter); this.Enter += new EventHandler(DSOTabPanel_Enter);
this.Leave += new EventHandler(DSOTabPanel_Leave); this.Leave += new EventHandler(DSOTabPanel_Leave);
} }
#endregion
#region Event Handlers
/// <summary>
/// When the user leaves a Word document, place the transparent frame on top with the words "InActive" in the upper right
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void DSOTabPanel_Leave(object sender, EventArgs e) void DSOTabPanel_Leave(object sender, EventArgs e)
{ {
_MyTransPanel.BringToFront(); _MyTransparentPanel.BringToFront();
} }
void _MyTransPanel_Click(object sender, EventArgs e) /// <summary>
/// Force this item to be selected when the transparent window is clicked.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void _MyTransparentPanel_Click(object sender, EventArgs e)
{ {
this.Select(); this.Select();
} }
/// <summary>
/// If the user presses the save button, tell the file to save it's contents to the database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e) void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
{ {
DSOFile.SaveFile(); MyDSOFile.SaveFile();
} }
/// <summary>
/// Before a document closes check to see if it's contents should be saved.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e) void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e)
{ {
try try
@ -121,9 +168,15 @@ namespace Volian.Controls.Library
_MyLog.Warn("Before Closing Document ", ex); _MyLog.Warn("Before Closing Document ", ex);
} }
} }
/// <summary>
/// When a Word document is selected make sure it's tab is activated and
/// the SelectedItem for the DisplayTabControl is updated.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void DSOTabPanel_Enter(object sender, EventArgs e) void DSOTabPanel_Enter(object sender, EventArgs e)
{ {
_MyTransPanel.SendToBack(); _MyTransparentPanel.SendToBack();
try try
{ {
_MyDSOFramer.EventsEnabled = true; _MyDSOFramer.EventsEnabled = true;
@ -133,16 +186,23 @@ namespace Volian.Controls.Library
{ {
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex); if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
} }
_MyTabControl.OnItemSelectedChanged(this, null); _MyDisplayTabControl.OnItemSelectedChanged(this, null);
_MyDSOFramer.Focus(); _MyDSOFramer.Focus();
} }
#endregion
#region Public Methods
/// <summary>
/// Save the contents of the Word Document to a file
/// and save the file to the database
/// </summary>
/// <returns></returns>
public bool SaveDSO() public bool SaveDSO()
{ {
bool result = true; bool result = true;
try try
{ {
_MyDSOFramer.Save(); _MyDSOFramer.Save();
DSOFile.SaveFile(); MyDSOFile.SaveFile();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -151,21 +211,35 @@ namespace Volian.Controls.Library
} }
return result; return result;
} }
/// <summary>
/// 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".
/// </summary>
/// <returns></returns>
public bool SaveDirty() public bool SaveDirty()
{ {
if (_MyDSOFramer.IsDirty) if (_MyDSOFramer.IsDirty)
{ {
// TODO: Should be based upon Item rather than Document. // 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 SaveDSO();
return false; return false;
} }
return true; return true;
} }
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <returns></returns>
public bool CloseDSO() public bool CloseDSO()
{ {
return CloseDSO(false); return CloseDSO(false);
} }
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <param name="force"></param>
/// <returns></returns>
public bool CloseDSO(bool force) public bool CloseDSO(bool force)
{ {
_MyLog.Debug("CloseDSO"); _MyLog.Debug("CloseDSO");
@ -186,6 +260,9 @@ namespace Volian.Controls.Library
} }
return result; return result;
} }
/// <summary>
/// Activates the current DSO Framer window (Word)
/// </summary>
public void Activate() public void Activate()
{ {
try try
@ -199,5 +276,6 @@ namespace Volian.Controls.Library
if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex);
} }
} }
#endregion
} }
} }

View File

@ -55,24 +55,23 @@ namespace Volian.Controls.Library
{ {
if (!Visible) return; if (!Visible) return;
if (_MyRTB != null) if (_MyRTB != null)
_MyRTB.LinkChanged -= new DisplayRTBLinkEvent(_MyRTB_LinkChanged); _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (value == null) return; if (value == null) return;
_MyRTB = value; _MyRTB = value;
_MyRTB.LinkChanged += new DisplayRTBLinkEvent(_MyRTB_LinkChanged); _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (_MyRTB.MyLinkText == null) if (_MyRTB.MyLinkText == null)
{ {
_CurROLink = null; _CurROLink = null;
} }
} }
} }
void _MyRTB_LinkChanged(object sender, LinkClickedEventArgs e) void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
{ {
if (_MyRTB.MyLinkText == null) if (_MyRTB.MyLinkText == null)
CurROLink = null; CurROLink = null;
else else
{ {
DisplayLinkEventArgs tmp = new DisplayLinkEventArgs(null, e); CurROLink = args.RoUsageid;
CurROLink = tmp.RoUsageid;
} }
} }
#endregion #endregion

View File

@ -12,17 +12,12 @@ using System.Reflection;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public enum LinkType : int public partial class StepRTBSimple : RichTextBox, IStepRTB
{
ReferencedObject = 21,
Transition = 9516,
TransitionRange = 9574
}
public partial class DisplayRTBSimple : RichTextBox, IDisplayRTB
{ {
#region Fields #region Fields
private StepItem _MyStepItem;
private IContainer _Container = null; private IContainer _Container = null;
private ItemInfo _MyItem; private ItemInfo _MyItemInfo;
private Size _AdjustSize; private Size _AdjustSize;
private Rectangle _ContentsRectangle; private Rectangle _ContentsRectangle;
private E_EditPrintMode _EpMode; private E_EditPrintMode _EpMode;
@ -65,15 +60,23 @@ namespace Volian.Controls.Library
//} //}
#endregion #endregion
#region Events #region Events
public event DisplayRTBLinkEvent LinkGoTo; /// <summary>
private void OnLinkGoTo(object sender,LinkClickedEventArgs args) /// Occurs in response to Link GoTo
/// </summary>
public event StepRTBLinkEvent LinkGoTo;
/// <summary>
/// Checks to see if the LinkGoTo event is handled and launches it.
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private void OnLinkGoTo(object sender, StepPanelLinkEventArgs args)
{ {
if (LinkGoTo != null) LinkGoTo(sender, args); if (LinkGoTo != null) LinkGoTo(sender, args);
} }
/// <summary> /// <summary>
/// Occurs when a content or format change causes the box to get taller or shorter /// Occurs when a content or format change causes the box to get taller or shorter
/// </summary> /// </summary>
public event DisplayRTBEvent HeightChanged; public event StepRTBEvent HeightChanged;
/// <summary> /// <summary>
/// Checks to see if the HeightChanged event is handled and launches it /// Checks to see if the HeightChanged event is handled and launches it
/// </summary> /// </summary>
@ -90,18 +93,18 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
/// <param name="match"></param> /// <param name="match"></param>
/// <returns></returns> /// <returns></returns>
public ItemInfo MyItem public ItemInfo MyItemInfo
{ {
get { return _MyItem; } get { return _MyItemInfo; }
set set
{ {
_MyItem = value; _MyItemInfo = value;
if (value != null) if (value != null)
{ {
//// TIMING: DisplayItem.TimeIt("rtbMyItem Start"); //// TIMING: DisplayItem.TimeIt("rtbMyItem Start");
//if (value.ItemID == 90) //if (value.ItemID == 90)
// if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat(value.MyContent.Text); // 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 = txt.Replace("\n", "\r\n\\par ");
//txt = Regex.Replace(txt, "(.){([0-9]*){([0-9 ]*)}}",FixTransition); //txt = Regex.Replace(txt, "(.){([0-9]*){([0-9 ]*)}}",FixTransition);
//txt = Regex.Replace(txt, @"(.)\\v TRAN", 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 public Size AdjustSize
{ {
get { return _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[2].Value);
int transitionID = Convert.ToInt32(match.Groups[4].Value.Split(" ".ToCharArray())[1]); int transitionID = Convert.ToInt32(match.Groups[4].Value.Split(" ".ToCharArray())[1]);
// Find the transition // Find the transition
foreach (TransitionInfo ti in _MyItem.MyContent.ContentTransitions) foreach (TransitionInfo ti in _MyItemInfo.MyContent.ContentTransitions)
{ {
if (ti.TransitionID == transitionID) if (ti.TransitionID == transitionID)
{ {
@ -227,23 +235,23 @@ namespace Volian.Controls.Library
//ContextMenuStrip = this.contextMenuStrip1; //ContextMenuStrip = this.contextMenuStrip1;
//ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; //ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
//this.TextChanged += new EventHandler(VERichTextBox_TextChanged); //this.TextChanged += new EventHandler(VERichTextBox_TextChanged);
this.ContentsResized += new ContentsResizedEventHandler(VERichTextBox_ContentsResized); this.ContentsResized += new ContentsResizedEventHandler(StepRTBSimple_ContentsResized);
//if (Text != "") ResizeForText(); //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 #endregion
#region Constructors #region Constructors
public DisplayRTBSimple() public StepRTBSimple()
{ {
InitializeComponent(); InitializeComponent();
SetUp(); SetUp();
} }
public DisplayRTBSimple(IContainer container) public StepRTBSimple(IContainer container)
{ {
container.Add(this); container.Add(this);
InitializeComponent(); InitializeComponent();
@ -252,7 +260,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region Event Handlers #region Event Handlers
void VERichTextBox_ContentsResized(object sender, ContentsResizedEventArgs e) void StepRTBSimple_ContentsResized(object sender, ContentsResizedEventArgs e)
{ {
this.Height = e.NewRectangle.Height; this.Height = e.NewRectangle.Height;
OnHeightChanged(sender, new EventArgs()); OnHeightChanged(sender, new EventArgs());
@ -260,10 +268,11 @@ namespace Volian.Controls.Library
#endregion #endregion
} }
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public interface IDisplayRTB public interface IStepRTB
{ {
event DisplayRTBEvent HeightChanged; event StepRTBEvent HeightChanged;
ItemInfo MyItem { get; } ItemInfo MyItemInfo { get; set;}
StepItem MyStepItem { get; set;}
Size AdjustSize { get; set; } Size AdjustSize { get; set; }
Rectangle ContentsRectangle { get; set; } Rectangle ContentsRectangle { get; set; }
E_EditPrintMode EpMode { get; set; } E_EditPrintMode EpMode { get; set; }
@ -274,5 +283,11 @@ namespace Volian.Controls.Library
// public DisplayRTBSimple() // public DisplayRTBSimple()
// public DisplayRTBSimple(IContainer container) // public DisplayRTBSimple(IContainer container)
} }
public enum LinkType : int
{
ReferencedObject = 21,
Transition = 9516,
TransitionRange = 9574
}
} }

View File

@ -1,6 +1,6 @@
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
partial class DisplayRTBSimple partial class StepRTBSimple
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.

View File

@ -13,48 +13,127 @@ namespace Volian.Controls.Library
{ {
public partial class DisplayTabControl : UserControl public partial class DisplayTabControl : UserControl
{ {
private Dictionary<string, DisplayTabItem> _MyPages; #region Private Fields
public event DisplayPanelEvent ItemClick; /// <summary>
private List<DisplayTabItem> _RemovedItems = null; /// This is a lookup table for all of the DisplayTabItems that are currently open
internal void OnItemClick(object sender, DisplayPanelEventArgs args) /// The key is:
/// "Item - " + Procedure ItemID for step pages
/// "Doc - " + DocumentID for Word Documents
/// </summary>
private Dictionary<string, DisplayTabItem> _MyDisplayTabItems;
/// <summary>
/// When a Tab is closed it is added to this list.
/// When another Tab is opened, any Tabs in this list are closed
/// </summary>
private List<DisplayTabItem> _RemovedDisplayTabItems = null;
/// <summary>
/// This stores a UniqueID for Bars as they are opened.
/// A bar is the docking location for the DisplayTabItems.
/// </summary>
private int _UniqueBarCount;
#endregion
#region Events
/// <summary>
/// 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.
/// </summary>
public event StepPanelEvent ItemClick;
/// <summary>
/// Checks to see if the ItemClick event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnItemClick(object sender, StepPanelEventArgs args)
{ {
if (ItemClick != null) ItemClick(sender, args); if (ItemClick != null) ItemClick(sender, args);
} }
public event DisplayPanelLinkEvent LinkActiveChanged; /// <summary>
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.
/// </summary>
public event StepPanelLinkEvent LinkActiveChanged;
/// <summary>
/// Checks to see if the LinkActiveChanged event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnLinkActiveChanged(object sender, StepPanelLinkEventArgs args)
{ {
if (LinkActiveChanged != null) LinkActiveChanged(sender, 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; /// <summary>
internal void OnLinkInsertTran(object sender, DisplayLinkEventArgs args) /// This occurs when a Transition is inserted
/// </summary>
public event StepPanelLinkEvent LinkInsertTran;
/// <summary>
/// Checks to see if the 'LinkInsertTran' event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnLinkInsertTran(object sender, StepPanelLinkEventArgs args)
{ {
if (LinkInsertTran != null) LinkInsertTran(sender, 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; /// <summary>
internal void OnLinkInsertRO(object sender, DisplayLinkEventArgs args) /// This occurs when an RO is inserted
/// </summary>
public event StepPanelLinkEvent LinkInsertRO;
/// <summary>
/// Checks to see if the 'LinkInsertRO' event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnLinkInsertRO(object sender, StepPanelLinkEventArgs args)
{ {
if (LinkInsertRO != null) LinkInsertRO(sender, 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; /// <summary>
internal void OnLinkModifyTran(object sender, DisplayLinkEventArgs args) /// This occurs when a Transition is modified
/// </summary>
public event StepPanelLinkEvent LinkModifyTran;
/// <summary>
/// Checks to see if the 'LinkModifyTran' event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
{ {
if (LinkModifyTran != null) LinkModifyTran(sender, 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; /// <summary>
internal void OnLinkModifyRO(object sender, DisplayLinkEventArgs args) /// This occurs when an RO is modified
/// </summary>
public event StepPanelLinkEvent LinkModifyRO;
/// <summary>
/// Checks to see if the 'LinkModifyRO' event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
{ {
if (LinkModifyRO != null) LinkModifyRO(sender, 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; /// <summary>
internal void OnItemSelectedChanged(object sender, DisplayPanelEventArgs args) /// Occurs when the user selects a different item or page
/// </summary>
public event StepPanelEvent ItemSelectedChanged;
/// <summary>
/// Checks to see if the 'ItemSelectedChanged' event is handled and launches it
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
internal void OnItemSelectedChanged(object sender, StepPanelEventArgs args)
{ {
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args); if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
} }
#endregion
#region Contructor & Setup
public DisplayTabControl() public DisplayTabControl()
{ {
InitializeComponent(); InitializeComponent();
@ -62,18 +141,13 @@ namespace Volian.Controls.Library
} }
private void SetUp() private void SetUp()
{ {
_RemovedItems = new List<DisplayTabItem>(); _RemovedDisplayTabItems = new List<DisplayTabItem>();
Dock = DockStyle.Fill; Dock = DockStyle.Fill;
dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
_MyPages = new Dictionary<string, DisplayTabItem>(); _MyDisplayTabItems = new Dictionary<string, DisplayTabItem>();
SetupBar(_MyBar); SetupBar(_MyBar);
dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff); 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) private void SetupBar(Bar myBar)
{ {
if (myBar.DockTabControl != null) if (myBar.DockTabControl != null)
@ -88,16 +162,38 @@ namespace Volian.Controls.Library
myBar.Visible = true; myBar.Visible = true;
myBar.RecalcLayout(); myBar.RecalcLayout();
} }
#endregion
#region Internal Event Handlers
/// <summary>
/// This is code recommended by DotNetBar
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void dotNetBarManager1_BarTearOff(object sender, EventArgs e)
{
Bar myBar = sender as Bar;
myBar.Enter += new EventHandler(myBar_Enter);
}
/// <summary>
/// This sets-up the bar after it is selected.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void myBar_Enter(object sender, EventArgs e) void myBar_Enter(object sender, EventArgs e)
{ {
Bar myBar = sender as Bar; Bar myBar = sender as Bar;
myBar.Enter -= new EventHandler(myBar_Enter); myBar.Enter -= new EventHandler(myBar_Enter);
SetupBar(sender as Bar); SetupBar(sender as Bar);
} }
/// <summary>
/// This handles the closing of a document page
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void myBar_DockTabClosing(object sender, DockTabClosingEventArgs e) void myBar_DockTabClosing(object sender, DockTabClosingEventArgs e)
{ {
e.RemoveDockTab = true; e.RemoveDockTab = true;
_RemovedItems.Add((DisplayTabItem)e.DockContainerItem); _RemovedDisplayTabItems.Add((DisplayTabItem)e.DockContainerItem);
DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem; DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem;
if (myTabItem != null) if (myTabItem != null)
{ {
@ -117,6 +213,30 @@ namespace Volian.Controls.Library
} }
} }
} }
#endregion
#region Public Methods
/// <summary>
/// Open a Step Item or a Word Item
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
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);
}
/// <summary>
/// Look for a tab and set it to active.
/// </summary>
private void ActivateRemainingTab() private void ActivateRemainingTab()
{ {
foreach (Bar myBar in dotNetBarManager1.Bars) foreach (Bar myBar in dotNetBarManager1.Bars)
@ -132,12 +252,18 @@ namespace Volian.Controls.Library
// No Document Tabs Remaining - need to raise OnItemSelectedChanged // No Document Tabs Remaining - need to raise OnItemSelectedChanged
OnItemSelectedChanged(this, null); OnItemSelectedChanged(this, null);
} }
private int _UniqueBarCount; #endregion
#region Public Properties
public DevComponents.DotNetBar.Bar MyBar public DevComponents.DotNetBar.Bar MyBar
{ {
get { return _MyBar; } get { return _MyBar; }
} }
public DisplayTabItem SelectedTab #endregion
#region Private Methods
/// <summary>
/// Gets and sets the SelectedDisplayTabItem (Active Tab)
/// </summary>
public DisplayTabItem SelectedDisplayTabItem
{ {
get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; } get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
set set
@ -149,33 +275,25 @@ namespace Volian.Controls.Library
} }
} }
} }
public DisplayTabItem OpenItem(ItemInfo myItem) /// <summary>
{ /// This returns the parent bar (current docking location) for an item.
while (_RemovedItems.Count > 0) /// It creates a bar if none exist
{ /// </summary>
DisplayTabItem myTabItem = _RemovedItems[0]; /// <param name="myItemInfo"></param>
_RemovedItems.RemoveAt(0); /// <returns></returns>
RemoveItem(myTabItem); private Bar GetParentBar(ItemInfo myItemInfo)
}
_MyBar = GetParentBar(myItem);
if (myItem.MyContent.MyEntry == null)
return OpenDisplayTabPage(myItem);
else
return OpenDSOTabPage(myItem);
}
private Bar GetParentBar(ItemInfo myItem)
{ {
Bar myBar = null; Bar myBar = null;
foreach (Bar b in dotNetBarManager1.Bars) foreach (Bar b in dotNetBarManager1.Bars)
{ {
if (b.DockSide == eDockSide.Document && b.Visible) 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) foreach (object itm in b.Items)
{ {
DisplayTabItem myTabItem = itm as DisplayTabItem; DisplayTabItem myTabItem = itm as DisplayTabItem;
if (myTabItem != null && myTabItem.MyTabPanel != null) if (myTabItem != null && myTabItem.MyStepTabPanel != null)
if (myTabItem.MyTabPanel.MyItem.ItemID == myItem.MyProcedure.ItemID) if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
return b; return b;
} }
} }
@ -192,64 +310,81 @@ namespace Volian.Controls.Library
} }
return myBar; return myBar;
} }
private DisplayTabItem OpenDisplayTabPage(ItemInfo myItem) /// <summary>
/// This opens a Step page based upon a ItemInfo.
///
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
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(); string key = "Item - " + proc.ItemID.ToString();
DisplayTabItem pg = null; 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; 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 pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
_MyPages.Add(key, pg); _MyDisplayTabItems.Add(key, pg);
pg.Selected = true; pg.Selected = true;
SelectedTab = pg; SelectedDisplayTabItem = pg;
pg.MyTabPanel.MyItem = proc; pg.MyStepTabPanel.MyProcedureItemInfo = proc;
} }
Application.DoEvents(); Application.DoEvents();
pg.ItemSelected = myItem; // Select the item pg.SelectedItemInfo = myItemInfo; // Select the item
#if (DEBUG) #if (DEBUG)
pg.MyTabPanel.MyPanel.BackColor = SystemColors.Control; pg.MyStepTabPanel.MyStepPanel.BackColor = SystemColors.Control;
#else #else
pg.MyTabPanel.MyPanel.BackColor = Color.White; pg.MyTabPanel.MyPanel.BackColor = Color.White;
#endif #endif
return pg; return pg;
} }
internal void RemoveItem(DisplayTabItem myItem) /// <summary>
{ /// This opens a Word page based upon an itemInfo. Since a word document may be a library
_MyPages.Remove(myItem.MyKey); /// document, the related DocID is used for the Word document.
// Can I dispose the Panel /// </summary>
if(myItem.MyTabPanel!=null) /// <param name="myItemInfo"></param>
myItem.MyTabPanel.Dispose(); /// <returns></returns>
if (myItem.MyDSOTabPanel != null) private DisplayTabItem OpenDSOTabPage(ItemInfo myItemInfo)
myItem.MyDSOTabPanel.CloseDSO();
components.Remove(myItem);
myItem.Dispose();
}
private DisplayTabItem OpenDSOTabPage(ItemInfo myItem)
{ {
DisplayTabItem pg = null; DisplayTabItem pg = null;
EntryInfo myEntry = myItem.MyContent.MyEntry; EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
string key = "Doc - " + myEntry.DocID; string key = "Doc - " + myEntry.DocID;
if (_MyPages.ContainsKey(key)) // If Procedure Open use it if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
pg = _MyPages[key]; pg = _MyDisplayTabItems[key];
else 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"); MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
return null; return null;
} }
pg = new DisplayTabItem(this.components, this, myItem,key); // Open a new Procedure Tab pg = new DisplayTabItem(this.components, this, myItemInfo,key); // Open a new document page
_MyPages.Add(key, pg); _MyDisplayTabItems.Add(key, pg);
} }
SelectedTab = pg; SelectedDisplayTabItem = pg;
return pg; return pg;
} }
/// <summary>
/// Clean-up after a page is closed
/// </summary>
/// <param name="myDisplayTabItem"></param>
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
} }
} }

View File

@ -10,101 +10,138 @@ namespace Volian.Controls.Library
{ {
public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem public partial class DisplayTabItem : DevComponents.DotNetBar.DockContainerItem
{ {
private DisplayTabControl _MyTabControl; #region Private Fields
private ItemInfo _MyItem; private DisplayTabControl _MyDisplayTabControl;
private ItemInfo _MyItemInfo;
public ItemInfo MyItem private StepTabPanel _MyStepTabPanel;
{
get { return _MyItem; }
set { _MyItem = value; }
}
private StepTabPanel _MyTabPanel;
private string _MyKey; private string _MyKey;
private DSOTabPanel _MyDSOTabPanel;
#endregion
#region Properties
/// <summary>
/// ItemInfo associated with this DisplayTabItem
/// </summary>
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
//set { _MyItemInfo = value; }
}
/// <summary>
/// get Key Either:
/// "Item - " + Procedure ItemID for step pages
/// "Doc - " + DocumentID for Word Documents
/// </summary>
public string MyKey public string MyKey
{ {
get { return _MyKey; } get { return _MyKey; }
} }
public StepTabPanel MyTabPanel /// <summary>
/// Related StepTabPanel for a Step page
/// </summary>
public StepTabPanel MyStepTabPanel
{ {
get { return _MyTabPanel; } get { return _MyStepTabPanel; }
set { _MyTabPanel = value; } set { _MyStepTabPanel = value; }
} }
private DSOTabPanel _MyDSOTabPanel; /// <summary>
/// Related DSOTabPanle for a Word page
/// </summary>
public DSOTabPanel MyDSOTabPanel public DSOTabPanel MyDSOTabPanel
{ {
get { return _MyDSOTabPanel; } get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; } set { _MyDSOTabPanel = value; }
} }
public ItemInfo ItemSelected /// <summary>
/// Current SelectedItemInfo for this page
/// </summary>
public ItemInfo SelectedItemInfo
{ {
get { return _MyTabPanel.ItemSelected; } get { return _MyStepTabPanel.SelectedItemInfo; }
set { _MyTabPanel.ItemSelected = value; } 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; _MyKey = myKey;
_MyTabControl = myTabControl; _MyDisplayTabControl = myDisplayTabControl;
_MyItem = myItem; _MyItemInfo = myItemInfo;
container.Add(this); container.Add(this);
InitializeComponent(); InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click); this.Click += new EventHandler(DisplayTabItem_Click);
if (myItem.MyContent.MyEntry == null) if (myItemInfo.MyContent.MyEntry == null)
SetupDisplayTabPanel(); SetupStepTabPanel();
else else
SetupDSOPanel(); SetupDSOTabPanel();
Name = string.Format("DisplayTabItem {0}", myItem.ItemID); Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
} }
void DisplayTabItem_Click(object sender, EventArgs e) #endregion
#region Event Handlers
/// <summary>
/// Updates SelectedStepItem when the user selects a DisplayTabItem
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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; DisplayTabItem myTabItem = sender as DisplayTabItem;
if(myTabItem == null)return; if(myTabItem == null)return;
StepTabPanel myTabPanel = myTabItem.MyTabPanel as StepTabPanel; StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel;
if(myTabPanel == null) return; 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
/// <summary>
/// Creates and sets-up a StepTabPanel
/// </summary>
private void SetupStepTabPanel()
{ {
((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
_MyTabControl.MyBar.SuspendLayout(); _MyDisplayTabControl.MyBar.SuspendLayout();
_MyTabPanel = new StepTabPanel(_MyTabControl); _MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
// //
// tabItem // tabItem
// //
Control = _MyTabPanel; Control = _MyStepTabPanel;
Name = "tabItem Item " + _MyItem.ItemID; Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItem.TabTitle; Text = _MyItemInfo.TabTitle;
Tooltip = _MyItem.TabToolTip; Tooltip = _MyItemInfo.TabToolTip;
// //
_MyTabControl.Controls.Add(_MyTabPanel); _MyDisplayTabControl.Controls.Add(_MyStepTabPanel);
_MyTabControl.MyBar.Items.Add(this); _MyDisplayTabControl.MyBar.Items.Add(this);
// //
// tabPanel // tabPanel
// //
_MyTabPanel.TabItem = this; _MyStepTabPanel.MyDisplayTabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit();
_MyTabControl.MyBar.ResumeLayout(false); _MyDisplayTabControl.MyBar.ResumeLayout(false);
} }
private void SetupDSOPanel() /// <summary>
/// Creates and sets-up a DSOTabPanel
/// </summary>
private void SetupDSOTabPanel()
{ {
EntryInfo myEntry = _MyItem.MyContent.MyEntry; EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyTabControl); _MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl);
// //
// tabItem // tabItem
// //
Control = _MyDSOTabPanel; Control = _MyDSOTabPanel;
Name = "tabItem Item " + _MyItem.ItemID; Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItem.TabTitle; Text = _MyItemInfo.TabTitle;
Tooltip = _MyItem.TabToolTip; Tooltip = _MyItemInfo.TabToolTip;
// //
_MyTabControl.Controls.Add(_MyDSOTabPanel); _MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
_MyTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { _MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this}); this});
// //
// tabPanel // tabPanel
// //
_MyTabControl.SelectedTab = this; _MyDisplayTabControl.SelectedDisplayTabItem = this;
_MyDSOTabPanel.TabItem = this; _MyDSOTabPanel.MyDisplayTabItem = this;
} }
#endregion
} }
} }

View File

@ -27,15 +27,15 @@ namespace Volian.Controls.Library
if (value == null) // Insert a transition if (value == null) // Insert a transition
{ {
if (MyRTB == null) return; if (MyRTB == null) return;
if (_CurTrans == value && _CurItemFrom == MyRTB.MyItem) return; if (_CurTrans == value && _CurItemFrom == MyRTB.MyItemInfo) return;
_CurItemFrom = MyRTB.MyItem; _CurItemFrom = MyRTB.MyItemInfo;
_TranFmtIndx = 0; _TranFmtIndx = 0;
} }
else // Modify a transition else // Modify a transition
{ {
if (_CurTrans == value) return; if (_CurTrans == value) return;
_TranFmtIndx = value.TranType; _TranFmtIndx = value.TranType;
_CurItemFrom = MyRTB.MyItem; _CurItemFrom = MyRTB.MyItemInfo;
} }
_CurTrans = value; _CurTrans = value;
_SavCurItemFrom = _CurItemFrom; _SavCurItemFrom = _CurItemFrom;
@ -67,25 +67,25 @@ namespace Volian.Controls.Library
if (!Visible) return; if (!Visible) return;
// add or remove events for // add or remove events for
if (_MyRTB != null) if (_MyRTB != null)
_MyRTB.LinkChanged -= new DisplayRTBLinkEvent(_MyRTB_LinkChanged); _MyRTB.LinkChanged -= new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (value == null) return; if (value == null) return;
_MyRTB = value; _MyRTB = value;
_MyRTB.LinkChanged += new DisplayRTBLinkEvent(_MyRTB_LinkChanged); _MyRTB.LinkChanged += new StepRTBLinkEvent(_MyRTB_LinkChanged);
if (_MyRTB.MyLinkText == null) if (_MyRTB.MyLinkText == null)
{ {
CurTrans = null; CurTrans = null;
} }
} }
} }
void _MyRTB_LinkChanged(object sender, LinkClickedEventArgs e) void _MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
{ {
if (_MyRTB.MyLinkText == null) //if (_MyRTB.MyLinkText == null)
CurTrans = null; // CurTrans = null;
else //else
{ //{
DisplayLinkEventArgs tmp = new DisplayLinkEventArgs(null, e); // StepPanelLinkEventArgs tmp = new StepPanelLinkEventArgs(null, e);
CurTrans = tmp.MyTransition; CurTrans = args.MyTransitionInfo;
} //}
} }
private ItemInfo _CurrentItemProcedure; // the selected item's procedure private ItemInfo _CurrentItemProcedure; // the selected item's procedure
private ItemInfo _CurrentToProcedure; // the 'to' location's procedure (may be same as _CurrentItemProcedure) private ItemInfo _CurrentToProcedure; // the 'to' location's procedure (may be same as _CurrentItemProcedure)

View File

@ -67,19 +67,19 @@ namespace Volian.Controls.Library
public class MostRecentItem public class MostRecentItem
{ {
[NonSerialized] [NonSerialized]
private ItemInfo _MyItem; private ItemInfo _MyItemInfo;
public ItemInfo MyItem public ItemInfo MyItemInfo
{ {
get get
{ {
if (_MyItem == null) if (_MyItemInfo == null)
_MyItem = ItemInfo.Get(_ItemID); _MyItemInfo = ItemInfo.Get(_ItemID);
return _MyItem; return _MyItemInfo;
} }
set set
{ {
_ItemID = value.ItemID; _ItemID = value.ItemID;
_MyItem = value; _MyItemInfo = value;
_MenuTitle = GetMenuTitle(); _MenuTitle = GetMenuTitle();
_ToolTip = GetToolTip(); _ToolTip = GetToolTip();
} }
@ -103,7 +103,7 @@ namespace Volian.Controls.Library
} }
private string GetMenuTitle() private string GetMenuTitle()
{ {
return MyItem.Path; return MyItemInfo.Path;
} }
private string _ToolTip; private string _ToolTip;
public string ToolTip public string ToolTip
@ -118,7 +118,7 @@ namespace Volian.Controls.Library
} }
private string GetToolTip() private string GetToolTip()
{ {
DocVersionInfo tmp = (DocVersionInfo)(MyItem.MyProcedure.ActiveParent); DocVersionInfo tmp = (DocVersionInfo)(MyItemInfo.MyProcedure.ActiveParent);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int indent = BuildPath(tmp.MyFolder, ref sb); int indent = BuildPath(tmp.MyFolder, ref sb);
return sb.ToString(); return sb.ToString();
@ -143,7 +143,7 @@ namespace Volian.Controls.Library
} }
public MostRecentItem(ItemInfo myItem) public MostRecentItem(ItemInfo myItem)
{ {
MyItem = myItem; MyItemInfo = myItem;
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -28,8 +28,8 @@ namespace Volian.Controls.Library
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.lblTab = new System.Windows.Forms.Label(); this.lblTab = new System.Windows.Forms.Label();
this._DisplayRTB = new Volian.Controls.Library.StepRTB(this.components); this._MyStepRTB = new Volian.Controls.Library.StepRTB(this.components);
this.vlnExp = new Volian.Controls.Library.vlnExpander(); this._MyvlnExpander = new Volian.Controls.Library.vlnExpander();
this.SuspendLayout(); this.SuspendLayout();
// //
// lblTab // lblTab
@ -42,75 +42,76 @@ namespace Volian.Controls.Library
this.lblTab.Visible = false; this.lblTab.Visible = false;
this.lblTab.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown); this.lblTab.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown);
// //
// _DisplayRTB // _MyStepRTB
// //
this._DisplayRTB.AdjustSize = new System.Drawing.Size(0, 0); this._MyStepRTB.AdjustSize = new System.Drawing.Size(0, 0);
this._DisplayRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this._MyStepRTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this._DisplayRTB.BackColor = System.Drawing.Color.Linen; this._MyStepRTB.BackColor = System.Drawing.Color.Linen;
this._DisplayRTB.BorderStyle = System.Windows.Forms.BorderStyle.None; this._MyStepRTB.BorderStyle = System.Windows.Forms.BorderStyle.None;
this._DisplayRTB.ContentsRectangle = new System.Drawing.Rectangle(0, 0, 0, 0); this._MyStepRTB.ContentsRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
this._DisplayRTB.EpMode = VEPROMS.CSLA.Library.E_EditPrintMode.Edit; this._MyStepRTB.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._MyStepRTB.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._MyStepRTB.Location = new System.Drawing.Point(80, 0);
this._DisplayRTB.MyClassName = "RichEdit20W"; this._MyStepRTB.MyClassName = "RichEdit20W";
this._DisplayRTB.MyItem = null; this._MyStepRTB.MyItemInfo = null;
this._DisplayRTB.Name = "_DisplayRTB"; this._MyStepRTB.MyLinkText = null;
this._DisplayRTB.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; this._MyStepRTB.Name = "_MyStepRTB";
this._DisplayRTB.Size = new System.Drawing.Size(234, 20); this._MyStepRTB.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
this._DisplayRTB.TabIndex = 2; this._MyStepRTB.Size = new System.Drawing.Size(234, 20);
this._DisplayRTB.Text = ""; this._MyStepRTB.TabIndex = 2;
this._DisplayRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit; this._MyStepRTB.Text = "";
this._DisplayRTB.Enter += new System.EventHandler(this._DisplayRTB_Enter); this._MyStepRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.Edit;
this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo); this._MyStepRTB.LinkGoTo += new Volian.Controls.Library.StepRTBLinkEvent(this._StepRTB_LinkGoTo);
this._DisplayRTB.HeightChanged += new Volian.Controls.Library.DisplayRTBEvent(this.veRichTextBoxText_HeightChanged); this._MyStepRTB.Enter += new System.EventHandler(this._StepRTB_Enter);
this._DisplayRTB.LinkModifyTran += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyTran); this._MyStepRTB.HeightChanged += new Volian.Controls.Library.StepRTBEvent(this._StepRTB_HeightChanged);
this._DisplayRTB.LinkModifyRO += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkModifyRO); 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._MyvlnExpander.Attachment = false;
this.vlnExp.BackColor = System.Drawing.Color.Transparent; this._MyvlnExpander.BackColor = System.Drawing.Color.Transparent;
this.vlnExp.BorderColor = System.Drawing.Color.Silver; this._MyvlnExpander.BorderColor = System.Drawing.Color.Silver;
this.vlnExp.Color1 = System.Drawing.Color.Aquamarine; this._MyvlnExpander.Color1 = System.Drawing.Color.Aquamarine;
this.vlnExp.Color2 = System.Drawing.Color.Violet; this._MyvlnExpander.Color2 = System.Drawing.Color.Violet;
this.vlnExp.Expanded = false; this._MyvlnExpander.Expanded = false;
this.vlnExp.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this._MyvlnExpander.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.vlnExp.GradientAngle = 45; this._MyvlnExpander.GradientAngle = 45;
this.vlnExp.Location = new System.Drawing.Point(3, 3); this._MyvlnExpander.Location = new System.Drawing.Point(3, 3);
this.vlnExp.Name = "vlnExp"; this._MyvlnExpander.MyExpanderStyle = Volian.Controls.Library.ExpanderStyle.Round;
this.vlnExp.PenWidth = 0; this._MyvlnExpander.Name = "_MyvlnExpander";
this.vlnExp.Size = new System.Drawing.Size(14, 14); this._MyvlnExpander.PenWidth = 0;
this.vlnExp.Style = Volian.Controls.Library.ExpanderStyle.Round; this._MyvlnExpander.Size = new System.Drawing.Size(14, 14);
this.vlnExp.TabIndex = 0; this._MyvlnExpander.TabIndex = 0;
this.vlnExp.Trans1 = 128; this._MyvlnExpander.Trans1 = 128;
this.vlnExp.Trans2 = 128; this._MyvlnExpander.Trans2 = 128;
this.vlnExp.WidthFactor = 7; this._MyvlnExpander.WidthFactor = 7;
this.vlnExp.BeforeExpand += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeExpand); this._MyvlnExpander.AttachmentClick += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_AttachmentClick);
this.vlnExp.AttachmentClick += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_AttachmentClick); this._MyvlnExpander.BeforeColapse += new Volian.Controls.Library.vlnExpanderEvent(this.vlnExp_BeforeColapse);
this.vlnExp.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.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonFace; this.BackColor = System.Drawing.SystemColors.ButtonFace;
this.Controls.Add(this.lblTab); this.Controls.Add(this.lblTab);
this.Controls.Add(this._DisplayRTB); this.Controls.Add(this._MyStepRTB);
this.Controls.Add(this.vlnExp); this.Controls.Add(this._MyvlnExpander);
this.Name = "DisplayItem"; this.Name = "StepItem";
this.Size = new System.Drawing.Size(314, 20); this.Size = new System.Drawing.Size(314, 20);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lblTab_MouseDown);
this.Move += new System.EventHandler(this.DisplayItem_Move); this.Resize += new System.EventHandler(this.StepItem_Resize);
this.Resize += new System.EventHandler(this.DisplayItem_Resize); this.Move += new System.EventHandler(this.StepItem_Move);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private vlnExpander vlnExp; private vlnExpander _MyvlnExpander;
private StepRTB _DisplayRTB; private StepRTB _MyStepRTB;
private System.Windows.Forms.Label lblTab; private System.Windows.Forms.Label lblTab;
} }
} }

View File

@ -120,10 +120,10 @@
<metadata name="lblTab.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="lblTab.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="_DisplayRTB.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="_MyStepRTB.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="vlnExp.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="_MyvlnExpander.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,8 @@ using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
public delegate void DisplayRTBEvent(object sender, EventArgs args); public delegate void StepRTBEvent(object sender, EventArgs args);
public partial class StepRTB : RichTextBox public partial class StepRTB : RichTextBox , IStepRTB
{ {
#region Properties and Variables #region Properties and Variables
// use newer rich text box.... // use newer rich text box....
@ -32,6 +32,12 @@ namespace Volian.Controls.Library
// return prams; // return prams;
// } // }
//} //}
private StepItem _MyStepItem;
public StepItem MyStepItem
{
get { return _MyStepItem; }
set { _MyStepItem = value; }
}
private bool _IsDirty = false; private bool _IsDirty = false;
private bool _InitializingRTB; private bool _InitializingRTB;
private IContainer _Container = null; private IContainer _Container = null;
@ -53,19 +59,19 @@ namespace Volian.Controls.Library
get { return _vwMode; } get { return _vwMode; }
set { _vwMode = value; } set { _vwMode = value; }
} }
private ItemInfo _MyItem; private ItemInfo _MyItemInfo;
public ItemInfo MyItem public ItemInfo MyItemInfo
{ {
get { return _MyItem; } get { return _MyItemInfo; }
set set
{ {
_MyItem = value; _MyItemInfo = value;
if (value != null) if (value != null)
{ {
_InitializingRTB = true; _InitializingRTB = true;
DisplayText vlntxt = new DisplayText(_MyItem, EpMode, VwMode); DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode);
_origVlnText = vlntxt; _origDisplayText = vlntxt;
Font = _origVlnText.TextFont.WindowsFont; Font = _origDisplayText.TextFont.WindowsFont;
AddRtfText(vlntxt); AddRtfText(vlntxt);
ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit); ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT); RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
@ -122,7 +128,7 @@ namespace Volian.Controls.Library
} }
} }
public System.Windows.Forms.AutoScaleMode AutoScaleMode; public System.Windows.Forms.AutoScaleMode AutoScaleMode;
private DisplayText _origVlnText; private DisplayText _origDisplayText;
private RichTextBox _rtbTemp = new RichTextBox(); private RichTextBox _rtbTemp = new RichTextBox();
private string _MyLinkText; private string _MyLinkText;
@ -134,7 +140,7 @@ namespace Volian.Controls.Library
if (value != _MyLinkText) if (value != _MyLinkText)
{ {
_MyLinkText = value; _MyLinkText = value;
OnLinkChanged(this, new LinkClickedEventArgs(_MyLinkText)); OnLinkChanged(this, new StepPanelLinkEventArgs(_MyStepItem, _MyLinkText));
Console.WriteLine("DisplayRTB - MyLinkText changed {0}", _MyLinkText); Console.WriteLine("DisplayRTB - MyLinkText changed {0}", _MyLinkText);
} }
} }
@ -170,17 +176,17 @@ namespace Volian.Controls.Library
BorderStyle = System.Windows.Forms.BorderStyle.None; BorderStyle = System.Windows.Forms.BorderStyle.None;
this.DetectUrls = true; this.DetectUrls = true;
ContextMenuStrip = contextMenuStrip; ContextMenuStrip = contextMenuStrip;
ContentsResized += new ContentsResizedEventHandler(DisplayRTB_ContentsResized); ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
this.LinkClicked += new LinkClickedEventHandler(DisplayRTB_LinkClicked); this.LinkClicked += new LinkClickedEventHandler(StepRTB_LinkClicked);
this.Click +=new EventHandler(DisplayRTB_Click); this.Click +=new EventHandler(StepRTB_Click);
this.KeyPress += new KeyPressEventHandler(DisplayRTB_KeyPress); this.KeyPress += new KeyPressEventHandler(StepRTB_KeyPress);
this.KeyUp += new KeyEventHandler(DisplayRTB_KeyUp); this.KeyUp += new KeyEventHandler(StepRTB_KeyUp);
this.KeyDown += new KeyEventHandler(DisplayRTB_KeyDown); this.KeyDown += new KeyEventHandler(StepRTB_KeyDown);
this.TextChanged += new EventHandler(DisplayRTB_TextChanged); this.TextChanged += new EventHandler(StepRTB_TextChanged);
//this.SelectionChanged += new EventHandler(DisplayRTB_SelectionChanged); //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; 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); Console.WriteLine("SelectionStart {0}, SelectionLength {1}", SelectionStart, SelectionLength);
if (!SelectionProtected && MyLinkText != null) if (!SelectionProtected && MyLinkText != null)
@ -202,13 +208,13 @@ namespace Volian.Controls.Library
#region ApplicationSupport #region ApplicationSupport
public void ToggleViewEdit() public void ToggleViewEdit()
{ {
ItemInfo tmp = MyItem; ItemInfo tmp = MyItemInfo;
MyItem = null; MyItemInfo = null;
ReadOnly = !ReadOnly; ReadOnly = !ReadOnly;
EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit; EpMode = ReadOnly ? E_EditPrintMode.Print : E_EditPrintMode.Edit;
VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit; VwMode = ReadOnly ? E_ViewMode.View : E_ViewMode.Edit;
Clear(); Clear();
MyItem = tmp; MyItemInfo = tmp;
} }
public void InsertRO(string value, string link) public void InsertRO(string value, string link)
{ {
@ -228,14 +234,14 @@ namespace Volian.Controls.Library
{ {
if (ReadOnly) return; if (ReadOnly) return;
if (!_IsDirty) 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); if (!success) Console.WriteLine("Failed to save text: {0}", this.Text);
} }
#endregion #endregion
#region AddRtfText #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) if (vte.Type == E_TextElementType.TEXT)
AddRtf(vte); AddRtf(vte);
@ -245,30 +251,30 @@ namespace Volian.Controls.Library
AddRtfLink((displayLinkElement)vte); 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) private void AddRtf(string str)
{ {
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset2 " + this.Font.FontFamily.Name + @";}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + 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) private void AddSymbol(string str)
{ {
SelectedRtf = @"{\rtf1{\fonttbl{\f0\fcharset0 Arial Unicode MS;}}\f0\fs" + this.Font.SizeInPoints * 2 + " " + /* ConvertUnicodeChar(str) */ 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") if (CreateParams.ClassName == "RICHEDIT50W")
AddLink50(vte.Text, vte.Link); AddLink50(myDisplayLinkElement.Text, myDisplayLinkElement.Link);
else else
AddLink20(vte.Text, vte.Link); AddLink20(myDisplayLinkElement.Text, myDisplayLinkElement.Link);
} }
public void AddRtfLink(string linkUrl, string linkValue) public void AddRtfLink(string linkUrl, string linkValue)
{ {
@ -305,7 +311,7 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region HeightSupport #region HeightSupport
public event DisplayRTBEvent HeightChanged; public event StepRTBEvent HeightChanged;
private void OnHeightChanged(object sender, EventArgs args) private void OnHeightChanged(object sender, EventArgs args)
{ {
if (HeightChanged != null) HeightChanged(sender, args); if (HeightChanged != null) HeightChanged(sender, args);
@ -376,40 +382,40 @@ namespace Volian.Controls.Library
#endregion #endregion
#region EventSupport #region EventSupport
#region LinkEvents #region LinkEvents
private LinkClickedEventArgs _LinkClickedEventArgs; private StepPanelLinkEventArgs _MyLinkClickedEventArgs;
public event DisplayRTBLinkEvent LinkChanged; // TODO: ? public event StepRTBLinkEvent LinkChanged; // TODO: ?
private void OnLinkChanged(object sender, LinkClickedEventArgs args) private void OnLinkChanged(object sender, StepPanelLinkEventArgs args)
{ {
_LinkClickedEventArgs = args; _MyLinkClickedEventArgs = args;
if (LinkChanged != null) LinkChanged(sender, args); if (LinkChanged != null) LinkChanged(sender, args);
} }
public event DisplayRTBLinkEvent LinkGoTo; public event StepRTBLinkEvent LinkGoTo;
private void OnLinkGoTo(object sender, LinkClickedEventArgs args) private void OnLinkGoTo(object sender, StepPanelLinkEventArgs args)
{ {
_LinkClickedEventArgs = args; _MyLinkClickedEventArgs = args;
if (LinkGoTo != null) LinkGoTo(sender, args); if (LinkGoTo != null) LinkGoTo(sender, args);
} }
public event DisplayRTBLinkEvent LinkModifyTran; public event StepRTBLinkEvent LinkModifyTran;
private void OnLinkModifyTran(object sender, LinkClickedEventArgs args) private void OnLinkModifyTran(object sender, StepPanelLinkEventArgs args)
{ {
_LinkClickedEventArgs = args; _MyLinkClickedEventArgs = args;
if (LinkModifyTran != null) LinkModifyTran(sender, args); if (LinkModifyTran != null) LinkModifyTran(sender, args);
} }
public event DisplayRTBLinkEvent LinkModifyRO; public event StepRTBLinkEvent LinkModifyRO;
private void OnLinkModifyRO(object sender, LinkClickedEventArgs args) private void OnLinkModifyRO(object sender, StepPanelLinkEventArgs args)
{ {
_LinkClickedEventArgs = args; _MyLinkClickedEventArgs = args;
if (LinkModifyRO != null) LinkModifyRO(sender, args); if (LinkModifyRO != null) LinkModifyRO(sender, args);
} }
private Point _savcurpos; 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; if (ReadOnly) return;
_LinkClickedEventArgs = e; _MyLinkClickedEventArgs = new StepPanelLinkEventArgs(_MyStepItem, args.LinkText);
_savcurpos = Cursor.Position; _savcurpos = Cursor.Position;
SelectLink(e.LinkText); SelectLink(args.LinkText);
OnLinkChanged(sender, e); OnLinkChanged(sender, _MyLinkClickedEventArgs);
//_savcurpos = Cursor.Position; //_savcurpos = Cursor.Position;
//if (e.LinkText.IndexOf("ReferencedObject") > -1) //if (e.LinkText.IndexOf("ReferencedObject") > -1)
// this.contextMenuStripROs.Show(System.Windows.Forms.Cursor.Position); // this.contextMenuStripROs.Show(System.Windows.Forms.Cursor.Position);
@ -440,18 +446,18 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
#region TextOrContents #region TextOrContents
void DisplayRTB_TextChanged(object sender, EventArgs e) void StepRTB_TextChanged(object sender, EventArgs e)
{ {
_IsDirty = true; _IsDirty = true;
} }
void DisplayRTB_ContentsResized(object sender, ContentsResizedEventArgs e) void StepRTB_ContentsResized(object sender, ContentsResizedEventArgs e)
{ {
ContentsRectangle = e.NewRectangle; ContentsRectangle = e.NewRectangle;
} }
#endregion #endregion
#region KeyboardHandling #region KeyboardHandling
private bool IsControlChar = false; private bool IsControlChar = false;
void DisplayRTB_KeyDown(object sender, KeyEventArgs e) void StepRTB_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Modifiers == Keys.Control) 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) if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
{ {
@ -514,7 +520,7 @@ namespace Volian.Controls.Library
SelectLink(); SelectLink();
return true; 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) if (!ReadOnly)
{ {
@ -713,12 +719,12 @@ namespace Volian.Controls.Library
if (e.ClickedItem.ToString() == "Delete Transition") DeleteTransition(); if (e.ClickedItem.ToString() == "Delete Transition") DeleteTransition();
else if (e.ClickedItem.ToString() == "Modify Transition") else if (e.ClickedItem.ToString() == "Modify Transition")
{ {
OnLinkModifyTran(sender, _LinkClickedEventArgs); OnLinkModifyTran(sender, _MyLinkClickedEventArgs);
} }
else if (e.ClickedItem.ToString() == "Go To") else if (e.ClickedItem.ToString() == "Go To")
{ {
Console.WriteLine("DisplayRTB:contextMenu: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) private void contextMenuStripROs_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{ {
if (e.ClickedItem.ToString() == "Delete RO") DeleteRefObj(); 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 #endregion

View File

@ -11,125 +11,212 @@ namespace Volian.Controls.Library
{ {
public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer
{ {
private DisplayTabControl _MyTabControl; #region Private Fields
private DisplayTabControl _MyDisplayTabControl;
public DisplayTabControl MyTabControl private StepTabRibbon _MyStepTabRibbon;
private StepPanel _MyStepPanel;
private DisplayTabItem _MyDisplayTabItem;
#endregion
#region Properties
/// <summary>
/// Container
/// </summary>
public DisplayTabControl MyDisplayTabControl
{ {
get { return _MyTabControl; } get { return _MyDisplayTabControl; }
set { _MyTabControl = value; } //set { _MyDisplayTabControl = value; }
} }
private StepTabRibbon _MyTabRibbon; /// <summary>
private Volian.Controls.Library.StepPanel _MyPanel; /// StepPanel contained in this control.
public Volian.Controls.Library.StepPanel MyPanel /// </summary>
public Volian.Controls.Library.StepPanel MyStepPanel
{ {
get { return _MyPanel; } get { return _MyStepPanel; }
set { _MyPanel = value; } //set { _MyStepPanel = value; }
} }
private DisplayTabItem _TabItem; /// <summary>
public DisplayTabItem TabItem /// related DisplayTabItem
/// </summary>
public DisplayTabItem MyDisplayTabItem
{ {
get { return _TabItem; } get { return _MyDisplayTabItem; }
set { _TabItem = value; } set { _MyDisplayTabItem = value; }
} }
public ItemInfo ItemSelected /// <summary>
/// Currently Selected ItemInfo
/// </summary>
public ItemInfo SelectedItemInfo
{ {
get { return _MyPanel.ItemSelected; } get { return _MyStepPanel.SelectedItemInfo; }
set { _MyPanel.ItemSelected = value; } set { _MyStepPanel.SelectedItemInfo = value; }
} }
public StepItem SelectedItem /// <summary>
/// Currently Selected StepItem
/// </summary>
public StepItem SelectedStepItem
{ {
get { return _MyPanel._ItemLookup[_MyPanel.ItemSelected.ItemID]; } //get { return _MyStepPanel._LookupStepItems[_MyStepPanel.SelectedItemInfo.ItemID]; }
get { return _MyStepPanel.SelectedStepItem; }
} }
public ItemInfo MyItem /// <summary>
/// Procedure ItemInfo
/// </summary>
public ItemInfo MyProcedureItemInfo
{ {
get { return _MyPanel.MyItem; } get { return _MyStepPanel.MyProcedureItemInfo; }
set { _MyPanel.MyItem = value; } set { _MyStepPanel.MyProcedureItemInfo = value; }
} }
public StepTabPanel(DisplayTabControl myTabControl) #endregion
#region Contructors
public StepTabPanel(DisplayTabControl myDisplayTabControl)
{ {
_MyTabControl = myTabControl; _MyDisplayTabControl = myDisplayTabControl;
InitializeComponent(); InitializeComponent();
SetupDisplayTabPanel(); SetupStepTabPanel();
SetupDisplayPanel(); SetupStepPanel();
SetupDisplayTabRibbon(); SetupStepTabRibbon();
} }
private void SetupDisplayTabRibbon() #endregion
#region Private Methods - Setup
/// <summary>
/// Setup StepTabRibbon
/// </summary>
private void SetupStepTabRibbon()
{ {
_MyTabRibbon = new StepTabRibbon(); _MyStepTabRibbon = new StepTabRibbon();
_MyTabRibbon.Dock = System.Windows.Forms.DockStyle.Top; _MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
_MyTabRibbon.Location = new System.Drawing.Point(0, 0); _MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
_MyTabRibbon.Name = "displayTabRibbon1"; _MyStepTabRibbon.Name = "displayTabRibbon1";
//_MyTabRibbon.MyDisplayRTB = null; //_MyTabRibbon.MyDisplayRTB = null;
_MyTabRibbon.MyDisplayItem = null; _MyStepTabRibbon.MyStepItem = null;
this.Controls.Add(_MyTabRibbon); this.Controls.Add(_MyStepTabRibbon);
} }
private void SetupDisplayTabPanel() /// <summary>
/// Setup this within control
/// </summary>
private void SetupStepTabPanel()
{ {
Dock = System.Windows.Forms.DockStyle.Fill; 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) /// <summary>
{ /// Setup StepPanel
//if (ItemSelected != null) /// </summary>
_MyPanel.ItemShow(); private void SetupStepPanel()
}
private void SetupDisplayPanel()
{ {
//this.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); //this.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
_MyPanel = new Volian.Controls.Library.StepPanel(this.components); _MyStepPanel = new Volian.Controls.Library.StepPanel(this.components);
this.Controls.Add(_MyPanel); this.Controls.Add(_MyStepPanel);
// //
// _MyPanel // _MyPanel
// //
_MyPanel.AutoScroll = true; _MyStepPanel.AutoScroll = true;
_MyPanel.Dock = System.Windows.Forms.DockStyle.Fill; _MyStepPanel.Dock = System.Windows.Forms.DockStyle.Fill;
_MyPanel.LinkClicked +=new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkClicked); _MyStepPanel.LinkClicked +=new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkClicked);
_MyPanel.LinkActiveChanged += new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkActiveChanged); _MyStepPanel.LinkActiveChanged += new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkActiveChanged);
_MyPanel.LinkInsertTran += new DisplayPanelLinkEvent(_MyPanel_LinkInsertTran); _MyStepPanel.LinkInsertTran += new StepPanelLinkEvent(_MyStepPanel_LinkInsertTran);
_MyPanel.LinkInsertRO += new DisplayPanelLinkEvent(_MyPanel_LinkInsertRO); _MyStepPanel.LinkInsertRO += new StepPanelLinkEvent(_MyStepPanel_LinkInsertRO);
_MyPanel.LinkModifyTran += new DisplayPanelLinkEvent(_MyPanel_LinkModifyTran); _MyStepPanel.LinkModifyTran += new StepPanelLinkEvent(_MyStepPanel_LinkModifyTran);
_MyPanel.LinkModifyRO += new DisplayPanelLinkEvent(_MyPanel_LinkModifyRO); _MyStepPanel.LinkModifyRO += new StepPanelLinkEvent(_MyStepPanel_LinkModifyRO);
_MyPanel.ItemClick +=new Volian.Controls.Library.DisplayPanelEvent(_MyPanel_ItemClick); _MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick);
_MyPanel.AttachmentClicked += new Volian.Controls.Library.DisplayPanelAttachmentEvent(_MyPanel_AttachmentClicked); _MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked);
_MyPanel.ItemSelectedChanged += new DisplayPanelEvent(_MyPanel_ItemSelectedChanged); _MyStepPanel.ItemSelectedChanged += new StepPanelEvent(_MyStepPanel_ItemSelectedChanged);
} }
void _MyPanel_LinkActiveChanged(object sender, DisplayLinkEventArgs args) #endregion
#region Event Handlers
/// <summary>
/// Occurs when the user clicks on a StepTabPanel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void StepTabPanel_Enter(object sender, EventArgs e)
{ {
_MyTabControl.OnLinkActiveChanged(sender, args); //if (ItemSelected != null)
_MyStepPanel.ItemShow();
} }
void _MyPanel_LinkInsertTran(object sender, DisplayLinkEventArgs args) /// <summary>
/// Occurs when the cursor moves onto or off of a link
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_LinkActiveChanged(object sender, StepPanelLinkEventArgs args)
{ {
_MyTabControl.OnLinkInsertTran(sender, args); _MyDisplayTabControl.OnLinkActiveChanged(sender, args);
} }
void _MyPanel_LinkInsertRO(object sender, DisplayLinkEventArgs args) /// <summary>
/// Occurs when the user chooses to add a transition
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_LinkInsertTran(object sender, StepPanelLinkEventArgs args)
{ {
_MyTabControl.OnLinkInsertRO(sender, args); _MyDisplayTabControl.OnLinkInsertTran(sender, args);
} }
void _MyPanel_LinkModifyTran(object sender, DisplayLinkEventArgs args) /// <summary>
/// Occurs when the user chooses to add an RO
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_LinkInsertRO(object sender, StepPanelLinkEventArgs args)
{ {
_MyTabControl.OnLinkModifyTran(sender, args); _MyDisplayTabControl.OnLinkInsertRO(sender, args);
} }
void _MyPanel_LinkModifyRO(object sender, DisplayLinkEventArgs args) /// <summary>
/// Occurs when the user chosses to modify a transition
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
{ {
_MyTabControl.OnLinkModifyRO(sender, args); _MyDisplayTabControl.OnLinkModifyTran(sender, args);
} }
void _MyPanel_ItemSelectedChanged(object sender, DisplayPanelEventArgs args) /// <summary>
/// Occurs when the user chooses to Modify an RO
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_LinkModifyRO(object sender, StepPanelLinkEventArgs args)
{
_MyDisplayTabControl.OnLinkModifyRO(sender, args);
}
/// <summary>
/// Occurs when the Selected Item changes
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_ItemSelectedChanged(object sender, StepPanelEventArgs args)
{ {
//_MyTabRibbon.MyDisplayRTB = args.MyDisplayItem.MyDisplayRTB; //_MyTabRibbon.MyDisplayRTB = args.MyDisplayItem.MyDisplayRTB;
_MyTabRibbon.MyDisplayItem = args.MyDisplayItem; _MyStepTabRibbon.MyStepItem = args.MyStepItem;
_MyTabControl.OnItemSelectedChanged(sender, args); _MyDisplayTabControl.OnItemSelectedChanged(sender, args);
} }
void _MyPanel_AttachmentClicked(object sender, DisplayPanelAttachmentEventArgs args) /// <summary>
/// Occurs when the user clicks on the Attachment Expander
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_AttachmentClicked(object sender, StepPanelAttachmentEventArgs args)
{ {
_MyTabControl.OpenItem(args.MyDisplayItem.MyItem); _MyDisplayTabControl.OpenItem(args.MyStepItem.MyItemInfo);
} }
void _MyPanel_ItemClick(object sender, DisplayPanelEventArgs args) /// <summary>
/// Occurs when the user clicks on the tab next to an item
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_ItemClick(object sender, StepPanelEventArgs args)
{ {
_MyTabControl.OnItemClick(sender, args); _MyDisplayTabControl.OnItemClick(sender, args);
} }
void _MyPanel_LinkClicked(object sender, DisplayLinkEventArgs args) /// <summary>
/// Occurs when the user clicks on an item
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
void _MyStepPanel_LinkClicked(object sender, StepPanelLinkEventArgs args)
{ {
_MyTabControl.OpenItem(args.ItemTo); _MyDisplayTabControl.OpenItem(args.MyTranToItemInfo);
} }
#endregion
} }
} }

View File

@ -11,47 +11,47 @@ namespace Volian.Controls.Library
{ {
public partial class StepTabRibbon : UserControl public partial class StepTabRibbon : UserControl
{ {
private StepItem _MyDisplayItem; private StepItem _MyStepItem;
public StepItem MyDisplayItem public StepItem MyStepItem
{ {
get { return _MyDisplayItem; } get { return _MyStepItem; }
set set
{ {
_MyDisplayItem = value; _MyStepItem = value;
if (value != null) if (value != null)
{ {
_MyDisplayRTB = value.MyDisplayRTB; _MyStepRTB = value.MyStepRTB;
} }
} }
} }
private StepRTB _MyDisplayRTB; private StepRTB _MyStepRTB;
public StepRTB MyDisplayRTB public StepRTB MyStepRTB
{ {
get { return _MyDisplayRTB; } get { return _MyStepRTB; }
set set
{ {
_MyDisplayRTB = value; _MyStepRTB = value;
if (value != null) if (value != null)
{ {
_ContextMenuBar.SetContextMenuEx(_MyDisplayRTB, btnCMRtfEdit); _ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
_MyDisplayRTB.SelectionChanged += new EventHandler(MyDisplayRTB_SelectionChanged); _MyStepRTB.SelectionChanged += new EventHandler(MyStepRTB_SelectionChanged);
_MyDisplayRTB.Leave += new EventHandler(MyDisplayRTB_Leave); _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); _MyStepRTB.SelectionChanged -= new EventHandler(MyStepRTB_SelectionChanged);
_MyDisplayRTB.Leave -= new EventHandler(MyDisplayRTB_Leave); _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; btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
btnCMItalics.Checked = btnItalics.Checked = _MyDisplayRTB.SelectionFont.Italic; btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
btnCMUnderline.Checked = btnUnderline.Checked = _MyDisplayRTB.SelectionFont.Underline; btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyDisplayRTB); btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyDisplayRTB); btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyDisplayRTB.SelectionLength > 0; btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
} }
public StepTabRibbon() public StepTabRibbon()
{ {
@ -85,73 +85,73 @@ namespace Volian.Controls.Library
private void btnSym_Click(object sender, EventArgs e) private void btnSym_Click(object sender, EventArgs e)
{ {
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; 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) private void btnPaste_Click(object sender, EventArgs e)
{ {
IDataObject myDO = Clipboard.GetDataObject(); IDataObject myDO = Clipboard.GetDataObject();
if (myDO.GetDataPresent("Rich Text Format")) 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")) 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) private void btnCut_Click(object sender, EventArgs e)
{ {
Clipboard.Clear(); Clipboard.Clear();
DataObject myDO = new DataObject("Rich Text Format", _MyDisplayRTB.SelectedRtf); DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
Clipboard.SetDataObject(myDO); Clipboard.SetDataObject(myDO);
_MyDisplayRTB.SelectedText = ""; _MyStepRTB.SelectedText = "";
} }
private void btnCopy_Click(object sender, EventArgs e) private void btnCopy_Click(object sender, EventArgs e)
{ {
Clipboard.Clear(); Clipboard.Clear();
DataObject myDO = new DataObject("Rich Text Format", _MyDisplayRTB.SelectedRtf); DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
Clipboard.SetDataObject(myDO); Clipboard.SetDataObject(myDO);
} }
private void btnBold_Click(object sender, EventArgs e) private void btnBold_Click(object sender, EventArgs e)
{ {
FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Bold; FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Bold;
_MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs); _MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
btnCMBold.Checked = btnBold.Checked = _MyDisplayRTB.SelectionFont.Bold; btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
} }
private void btnItalics_Click(object sender, EventArgs e) private void btnItalics_Click(object sender, EventArgs e)
{ {
FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Italic; FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Italic;
_MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs); _MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
btnCMItalics.Checked = btnItalics.Checked = _MyDisplayRTB.SelectionFont.Italic; btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
} }
private void btnUnderline_Click(object sender, EventArgs e) private void btnUnderline_Click(object sender, EventArgs e)
{ {
FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Underline; FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Underline;
_MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs); _MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
btnCMUnderline.Checked = btnUnderline.Checked = _MyDisplayRTB.SelectionFont.Underline; btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
} }
private void btnSuperscript_Click(object sender, EventArgs e) 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); RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyDisplayRTB); btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
} }
private void btnSubscript_Click(object sender, EventArgs e) 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); RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyDisplayRTB); btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
} }
private void btnUppercase_Click(object sender, EventArgs e) private void btnUppercase_Click(object sender, EventArgs e)
{ {
_MyDisplayRTB.SetSelectedCase('U'); _MyStepRTB.SetSelectedCase('U');
} }
private void btnLowercase_Click(object sender, EventArgs e) private void btnLowercase_Click(object sender, EventArgs e)
{ {
_MyDisplayRTB.SetSelectedCase('l'); _MyStepRTB.SetSelectedCase('l');
} }
private void btnTitleCase_Click(object sender, EventArgs e) private void btnTitleCase_Click(object sender, EventArgs e)
{ {
_MyDisplayRTB.SetSelectedCase('T'); _MyStepRTB.SetSelectedCase('T');
} }
//public event DisplayRTBLinkEvent LinkInsertTran; //public event DisplayRTBLinkEvent LinkInsertTran;
//private void OnLinkInsertTran(object sender, LinkClickedEventArgs args) //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, // see if user is positioned 'on' a transition within the rtb, if so do a modify, otherwise,
// insert transition. // insert transition.
StepTabPanel tmp = Parent as StepTabPanel; 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) private void btnInsHrdSpc_Click(object sender, EventArgs e)
{ {
_MyDisplayRTB.InsertSymbol(@"\u160?"); _MyStepRTB.InsertSymbol(@"\u160?");
} }
private void btnInsRO_Click(object sender, EventArgs e) 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, // see if user is positioned 'on' an RO within the rtb, if so do a modify, otherwise,
// insert transition. // insert transition.
StepTabPanel tmp = Parent as StepTabPanel; 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) private void btnRedo_Click(object sender, EventArgs e)
{ {
_MyDisplayRTB.Redo(); _MyStepRTB.Redo();
} }
private void btnUndo_Click(object sender, EventArgs e) private void btnUndo_Click(object sender, EventArgs e)
{ {
_MyDisplayRTB.Undo(); _MyStepRTB.Undo();
} }
} }
} }

View File

@ -65,12 +65,12 @@ namespace Volian.Controls.Library
public static string TabFormat(StepItem myDisplayItem) public static string TabFormat(StepItem myDisplayItem)
{ {
string format = string.Empty; 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 (typ >= 20000)
{ {
if (myDisplayItem.RNOLevel > 0 && IsRNO(myDisplayItem.MyItem)) return ""; if (myDisplayItem.RNOLevel > 0 && IsRNO(myDisplayItem.MyItemInfo)) return "";
// Step 1: Get TabFormat from Format // Step 1: Get TabFormat from Format
format = _TabFormats[typ % 10000]; format = _TabFormats[typ % 10000];
if (format == "<seq>") if (format == "<seq>")

View File

@ -1,6 +1,6 @@
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
partial class TransPanel partial class TransparentPanel
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.

View File

@ -10,7 +10,7 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Summary description for TransPanel. /// Summary description for TransPanel.
/// </summary> /// </summary>
public partial class TransPanel : Panel public partial class TransparentPanel : Panel
{ {
private string _Caption = "Inactive"; private string _Caption = "Inactive";
public string Caption public string Caption
@ -24,7 +24,7 @@ namespace Volian.Controls.Library
get { return _Alpha; } get { return _Alpha; }
set { _Alpha = value; InvalidateEx(); } set { _Alpha = value; InvalidateEx(); }
} }
public TransPanel() public TransparentPanel()
{ {
InitializeComponent(); InitializeComponent();
} }

View File

@ -120,11 +120,11 @@ namespace Volian.Controls.Library
get { return _Attachment; } get { return _Attachment; }
set { _Attachment = value; this.Refresh(); } set { _Attachment = value; this.Refresh(); }
} }
private ExpanderStyle _Style = ExpanderStyle.Square; private ExpanderStyle _MyExpanderStyle = ExpanderStyle.Square;
public ExpanderStyle Style public ExpanderStyle MyExpanderStyle
{ {
get { return _Style; } get { return _MyExpanderStyle; }
set { _Style = value; this.Refresh(); } set { _MyExpanderStyle = value; this.Refresh(); }
} }
private void vlnExpander_Paint(object sender, PaintEventArgs e) private void vlnExpander_Paint(object sender, PaintEventArgs e)
{ {
@ -143,7 +143,7 @@ namespace Volian.Controls.Library
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
p = new Pen(_BorderColor, _PenWidth); p = new Pen(_BorderColor, _PenWidth);
int penWidth = ClientRectangle.Width / _WidthFactor; int penWidth = ClientRectangle.Width / _WidthFactor;
switch (_Style) switch (_MyExpanderStyle)
{ {
case ExpanderStyle.Round: case ExpanderStyle.Round:
//e.Graphics.FillEllipse(Brushes.Gray, 0F, 0F, diameter, diameter); //e.Graphics.FillEllipse(Brushes.Gray, 0F, 0F, diameter, diameter);