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
{
private DisplayTabControl _MyTabControl;
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private AxDSOFramer.AxFramerControl _MyDSOFramer;
private TransPanel _MyTransPanel;
private TransparentPanel _MyTransparentPanel;
private static int _Count = 0;
private DocumentInfo _MyDocument;
private DocumentInfo _MyDocumentInfo;
private int _MyCount;
private DisplayTabItem _MyDisplayTabItem;
private DSOFile _DSOFile;
#endregion
#region Public Properties
/// <summary>
/// Count of DSO Pages open. Limited to 18 in DisplayTabControl
/// </summary>
public static int Count
{
get { return _Count; }
set { _Count = value; }
}
private DisplayTabItem _TabItem;
public DisplayTabItem TabItem
/// <summary>
/// Pointer to the related DisplayTabItem
/// </summary>
public DisplayTabItem MyDisplayTabItem
{
get { return _TabItem; }
set { _TabItem = value; }
get { return _MyDisplayTabItem; }
set { _MyDisplayTabItem = value; }
}
//private frmPG _frm = null;
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myTabControl)
/// <summary>
/// DocumentInfo record for the Word document
/// </summary>
public DocumentInfo MyDocumentInfo
{
_MyTabControl = myTabControl;
InitializeComponent();
SetupDSOTabPanel();
_MyDocument = documentInfo;
SetupDSO();
//_frm = new frmPG(_MyDSOFramer);
//_frm.Show();
get { return _MyDocumentInfo; }
}
private void SetupDSOTabPanel()
{
Dock = System.Windows.Forms.DockStyle.Fill;
}
public DocumentInfo DocumentInfo
{
get { return _MyDocument; }
}
private DSOFile _DSOFile;
internal DSOFile DSOFile
/// <summary>
/// Temporary Word file used for editing.
/// </summary>
internal DSOFile MyDSOFile
{
get
{
if (_DSOFile == null)
_DSOFile = new DSOFile(_MyDocument);
_DSOFile = new DSOFile(_MyDocumentInfo);
return _DSOFile;
}
}
/// <summary>
/// Dirty status. Only saved if dirty.
/// </summary>
public bool IsDirty
{
get { return _MyDSOFramer.IsDirty; }
}
#endregion
//private frmPG _frm = null;
#region Constructors
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl)
{
_MyDisplayTabControl = myDisplayTabControl;
InitializeComponent();
SetupDSOTabPanel();
_MyDocumentInfo = documentInfo;
SetupDSO();
//_frm = new frmPG(_MyDSOFramer);
//_frm.Show();
}
#endregion
#region Private Methods
private void SetupDSOTabPanel()
{
Dock = System.Windows.Forms.DockStyle.Fill; // Automatically Fill the panel
}
private void SetupDSO()
{
_Count++;
_Count++; // Increment the count of open Word documents (Limit in DisplayTabControl)
_MyCount = _Count;
this._MyTransPanel = new TransPanel();
this._MyTransparentPanel = new TransparentPanel();
this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
this.Controls.Add(this._MyDSOFramer);
this.Controls.Add(this._MyTransPanel);
this.Controls.Add(this._MyTransparentPanel); // A transparent panel is added over top of the DSO Framer window so that
// the related tab can be activated when the user clicks on a Word Document. Since the Word document is actually running
// in a different thread, it does not behave properly with focus events.
this.components.Add(this._MyDSOFramer);
this.components.Add(this._MyTransPanel);
this._MyTransPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._MyTransPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._MyTransPanel.ForeColor = System.Drawing.Color.Brown;
this.components.Add(this._MyTransparentPanel);
this._MyTransparentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._MyTransparentPanel.ForeColor = System.Drawing.Color.Brown; // This is the color used to show InActive on the right side on the Word
// document menu line.
//this._MyTransPanel.Location = new System.Drawing.Point(0, 0);
//this._MyTransPanel.Name = "transPanel1";
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1;
this._MyTransPanel.Click += new EventHandler(_MyTransPanel_Click);
this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click);
this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
this._MyDSOFramer.Open(DSOFile.MyFile.FullName);
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
this._MyDSOFramer.Menubar = false;
this._MyDSOFramer.Titlebar = false;
//if (_MyCount < 20)
@ -98,18 +123,40 @@ namespace Volian.Controls.Library
this.Enter += new EventHandler(DSOTabPanel_Enter);
this.Leave += new EventHandler(DSOTabPanel_Leave);
}
#endregion
#region Event Handlers
/// <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)
{
_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();
}
/// <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)
{
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)
{
try
@ -121,9 +168,15 @@ namespace Volian.Controls.Library
_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)
{
_MyTransPanel.SendToBack();
_MyTransparentPanel.SendToBack();
try
{
_MyDSOFramer.EventsEnabled = true;
@ -133,16 +186,23 @@ namespace Volian.Controls.Library
{
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
}
_MyTabControl.OnItemSelectedChanged(this, null);
_MyDisplayTabControl.OnItemSelectedChanged(this, null);
_MyDSOFramer.Focus();
}
#endregion
#region Public Methods
/// <summary>
/// Save the contents of the Word Document to a file
/// and save the file to the database
/// </summary>
/// <returns></returns>
public bool SaveDSO()
{
bool result = true;
try
{
_MyDSOFramer.Save();
DSOFile.SaveFile();
MyDSOFile.SaveFile();
}
catch (Exception ex)
{
@ -151,21 +211,35 @@ namespace Volian.Controls.Library
}
return result;
}
/// <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()
{
if (_MyDSOFramer.IsDirty)
{
// TODO: Should be based upon Item rather than Document.
if (MessageBox.Show("Save changes to " + _TabItem.MyItem.TabTitle + "\r\n" + _TabItem.MyItem.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();
return false;
}
return true;
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <returns></returns>
public bool CloseDSO()
{
return CloseDSO(false);
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
/// <param name="force"></param>
/// <returns></returns>
public bool CloseDSO(bool force)
{
_MyLog.Debug("CloseDSO");
@ -186,6 +260,9 @@ namespace Volian.Controls.Library
}
return result;
}
/// <summary>
/// Activates the current DSO Framer window (Word)
/// </summary>
public void Activate()
{
try
@ -199,5 +276,6 @@ namespace Volian.Controls.Library
if (_MyLog.IsErrorEnabled) _MyLog.Error("Activate", ex);
}
}
#endregion
}
}

View File

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

View File

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

View File

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

View File

@ -13,48 +13,127 @@ namespace Volian.Controls.Library
{
public partial class DisplayTabControl : UserControl
{
private Dictionary<string, DisplayTabItem> _MyPages;
public event DisplayPanelEvent ItemClick;
private List<DisplayTabItem> _RemovedItems = null;
internal void OnItemClick(object sender, DisplayPanelEventArgs args)
#region Private Fields
/// <summary>
/// This is a lookup table for all of the DisplayTabItems that are currently open
/// The key is:
/// "Item - " + Procedure ItemID for step pages
/// "Doc - " + DocumentID for Word Documents
/// </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);
}
public event DisplayPanelLinkEvent LinkActiveChanged;
internal void OnLinkActiveChanged(object sender, DisplayLinkEventArgs args)
/// <summary>
/// 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);
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
else MessageBox.Show(args.LinkInfoText, "Unhandled Link Active Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public event DisplayPanelLinkEvent LinkInsertTran;
internal void OnLinkInsertTran(object sender, DisplayLinkEventArgs args)
/// <summary>
/// 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);
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public event DisplayPanelLinkEvent LinkInsertRO;
internal void OnLinkInsertRO(object sender, DisplayLinkEventArgs args)
/// <summary>
/// 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);
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
else MessageBox.Show(args.LinkInfoText, "Unhandled Link Insert RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public event DisplayPanelLinkEvent LinkModifyTran;
internal void OnLinkModifyTran(object sender, DisplayLinkEventArgs args)
/// <summary>
/// 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);
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify Tran", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public event DisplayPanelLinkEvent LinkModifyRO;
internal void OnLinkModifyRO(object sender, DisplayLinkEventArgs args)
/// <summary>
/// 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);
else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
else MessageBox.Show(args.LinkInfoText, "Unhandled Link Modify RO", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public event DisplayPanelEvent ItemSelectedChanged;
internal void OnItemSelectedChanged(object sender, DisplayPanelEventArgs args)
/// <summary>
/// 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);
}
#endregion
#region Contructor & Setup
public DisplayTabControl()
{
InitializeComponent();
@ -62,18 +141,13 @@ namespace Volian.Controls.Library
}
private void SetUp()
{
_RemovedItems = new List<DisplayTabItem>();
_RemovedDisplayTabItems = new List<DisplayTabItem>();
Dock = DockStyle.Fill;
dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
_MyPages = new Dictionary<string, DisplayTabItem>();
_MyDisplayTabItems = new Dictionary<string, DisplayTabItem>();
SetupBar(_MyBar);
dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff);
}
void dotNetBarManager1_BarTearOff(object sender, EventArgs e)
{
Bar myBar = sender as Bar;
myBar.Enter += new EventHandler(myBar_Enter);
}
private void SetupBar(Bar myBar)
{
if (myBar.DockTabControl != null)
@ -88,16 +162,38 @@ namespace Volian.Controls.Library
myBar.Visible = true;
myBar.RecalcLayout();
}
#endregion
#region Internal Event Handlers
/// <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)
{
Bar myBar = sender as Bar;
myBar.Enter -= new EventHandler(myBar_Enter);
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)
{
e.RemoveDockTab = true;
_RemovedItems.Add((DisplayTabItem)e.DockContainerItem);
_RemovedDisplayTabItems.Add((DisplayTabItem)e.DockContainerItem);
DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem;
if (myTabItem != null)
{
@ -117,6 +213,30 @@ namespace Volian.Controls.Library
}
}
}
#endregion
#region Public Methods
/// <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()
{
foreach (Bar myBar in dotNetBarManager1.Bars)
@ -132,12 +252,18 @@ namespace Volian.Controls.Library
// No Document Tabs Remaining - need to raise OnItemSelectedChanged
OnItemSelectedChanged(this, null);
}
private int _UniqueBarCount;
#endregion
#region Public Properties
public DevComponents.DotNetBar.Bar MyBar
{
get { return _MyBar; }
}
public DisplayTabItem SelectedTab
#endregion
#region Private Methods
/// <summary>
/// Gets and sets the SelectedDisplayTabItem (Active Tab)
/// </summary>
public DisplayTabItem SelectedDisplayTabItem
{
get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
set
@ -149,33 +275,25 @@ namespace Volian.Controls.Library
}
}
}
public DisplayTabItem OpenItem(ItemInfo myItem)
{
while (_RemovedItems.Count > 0)
{
DisplayTabItem myTabItem = _RemovedItems[0];
_RemovedItems.RemoveAt(0);
RemoveItem(myTabItem);
}
_MyBar = GetParentBar(myItem);
if (myItem.MyContent.MyEntry == null)
return OpenDisplayTabPage(myItem);
else
return OpenDSOTabPage(myItem);
}
private Bar GetParentBar(ItemInfo myItem)
/// <summary>
/// This returns the parent bar (current docking location) for an item.
/// It creates a bar if none exist
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
private Bar GetParentBar(ItemInfo myItemInfo)
{
Bar myBar = null;
foreach (Bar b in dotNetBarManager1.Bars)
{
if (b.DockSide == eDockSide.Document && b.Visible)
{
if(myBar == null)myBar = b;
if(myBar == null)myBar = b;// Remember the first available bar if a specific bar cannot be found
foreach (object itm in b.Items)
{
DisplayTabItem myTabItem = itm as DisplayTabItem;
if (myTabItem != null && myTabItem.MyTabPanel != null)
if (myTabItem.MyTabPanel.MyItem.ItemID == myItem.MyProcedure.ItemID)
if (myTabItem != null && myTabItem.MyStepTabPanel != null)
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
return b;
}
}
@ -192,64 +310,81 @@ namespace Volian.Controls.Library
}
return myBar;
}
private DisplayTabItem OpenDisplayTabPage(ItemInfo myItem)
/// <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();
DisplayTabItem pg = null;
if (_MyPages.ContainsKey(key)) // If Procedure Open use it
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
{
pg = _MyPages[key];
pg = _MyDisplayTabItems[key];
pg.Selected = true;
SelectedTab = pg;
SelectedDisplayTabItem = pg;
}
else
else // If not already open, create a new Page
{
pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
_MyPages.Add(key, pg);
_MyDisplayTabItems.Add(key, pg);
pg.Selected = true;
SelectedTab = pg;
pg.MyTabPanel.MyItem = proc;
SelectedDisplayTabItem = pg;
pg.MyStepTabPanel.MyProcedureItemInfo = proc;
}
Application.DoEvents();
pg.ItemSelected = myItem; // Select the item
pg.SelectedItemInfo = myItemInfo; // Select the item
#if (DEBUG)
pg.MyTabPanel.MyPanel.BackColor = SystemColors.Control;
pg.MyStepTabPanel.MyStepPanel.BackColor = SystemColors.Control;
#else
pg.MyTabPanel.MyPanel.BackColor = Color.White;
#endif
return pg;
}
internal void RemoveItem(DisplayTabItem myItem)
{
_MyPages.Remove(myItem.MyKey);
// Can I dispose the Panel
if(myItem.MyTabPanel!=null)
myItem.MyTabPanel.Dispose();
if (myItem.MyDSOTabPanel != null)
myItem.MyDSOTabPanel.CloseDSO();
components.Remove(myItem);
myItem.Dispose();
}
private DisplayTabItem OpenDSOTabPage(ItemInfo myItem)
/// <summary>
/// This opens a Word page based upon an itemInfo. Since a word document may be a library
/// document, the related DocID is used for the Word document.
/// </summary>
/// <param name="myItemInfo"></param>
/// <returns></returns>
private DisplayTabItem OpenDSOTabPage(ItemInfo myItemInfo)
{
DisplayTabItem pg = null;
EntryInfo myEntry = myItem.MyContent.MyEntry;
EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
string key = "Doc - " + myEntry.DocID;
if (_MyPages.ContainsKey(key)) // If Procedure Open use it
pg = _MyPages[key];
if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
pg = _MyDisplayTabItems[key];
else
{
if (DSOTabPanel.Count > 18)
if (DSOTabPanel.Count > 18) // Limit the number of open document pages to 18
{
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
return null;
}
pg = new DisplayTabItem(this.components, this, myItem,key); // Open a new Procedure Tab
_MyPages.Add(key, pg);
pg = new DisplayTabItem(this.components, this, myItemInfo,key); // Open a new document page
_MyDisplayTabItems.Add(key, pg);
}
SelectedTab = pg;
SelectedDisplayTabItem = pg;
return pg;
}
/// <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
{
private DisplayTabControl _MyTabControl;
private ItemInfo _MyItem;
public ItemInfo MyItem
{
get { return _MyItem; }
set { _MyItem = value; }
}
private StepTabPanel _MyTabPanel;
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private ItemInfo _MyItemInfo;
private StepTabPanel _MyStepTabPanel;
private string _MyKey;
private DSOTabPanel _MyDSOTabPanel;
#endregion
#region Properties
/// <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
{
get { return _MyKey; }
}
public StepTabPanel MyTabPanel
/// <summary>
/// Related StepTabPanel for a Step page
/// </summary>
public StepTabPanel MyStepTabPanel
{
get { return _MyTabPanel; }
set { _MyTabPanel = value; }
get { return _MyStepTabPanel; }
set { _MyStepTabPanel = value; }
}
private DSOTabPanel _MyDSOTabPanel;
/// <summary>
/// Related DSOTabPanle for a Word page
/// </summary>
public DSOTabPanel MyDSOTabPanel
{
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
public ItemInfo ItemSelected
/// <summary>
/// Current SelectedItemInfo for this page
/// </summary>
public ItemInfo SelectedItemInfo
{
get { return _MyTabPanel.ItemSelected; }
set { _MyTabPanel.ItemSelected = value; }
get { return _MyStepTabPanel.SelectedItemInfo; }
set { _MyStepTabPanel.SelectedItemInfo = value; }
}
public DisplayTabItem(IContainer container, DisplayTabControl myTabControl, ItemInfo myItem, string myKey)
#endregion
#region Constructors
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
{
_MyKey = myKey;
_MyTabControl = myTabControl;
_MyItem = myItem;
_MyDisplayTabControl = myDisplayTabControl;
_MyItemInfo = myItemInfo;
container.Add(this);
InitializeComponent();
this.Click += new EventHandler(DisplayTabItem_Click);
if (myItem.MyContent.MyEntry == null)
SetupDisplayTabPanel();
if (myItemInfo.MyContent.MyEntry == null)
SetupStepTabPanel();
else
SetupDSOPanel();
Name = string.Format("DisplayTabItem {0}", myItem.ItemID);
SetupDSOTabPanel();
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
}
void DisplayTabItem_Click(object sender, EventArgs e)
#endregion
#region Event Handlers
/// <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;
if(myTabItem == null)return;
StepTabPanel myTabPanel = myTabItem.MyTabPanel as StepTabPanel;
StepTabPanel myTabPanel = myTabItem.MyStepTabPanel as StepTabPanel;
if(myTabPanel == null) return;
_MyTabControl.OnItemSelectedChanged(this,new DisplayPanelEventArgs(MyTabPanel.SelectedItem,null));
_MyDisplayTabControl.OnItemSelectedChanged(this,new StepPanelEventArgs(MyStepTabPanel.SelectedStepItem,null));
}
private void SetupDisplayTabPanel()
#endregion
#region private Methods
/// <summary>
/// Creates and sets-up a StepTabPanel
/// </summary>
private void SetupStepTabPanel()
{
((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).BeginInit();
_MyTabControl.MyBar.SuspendLayout();
_MyTabPanel = new StepTabPanel(_MyTabControl);
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
_MyDisplayTabControl.MyBar.SuspendLayout();
_MyStepTabPanel = new StepTabPanel(_MyDisplayTabControl);
//
// tabItem
//
Control = _MyTabPanel;
Name = "tabItem Item " + _MyItem.ItemID;
Text = _MyItem.TabTitle;
Tooltip = _MyItem.TabToolTip;
Control = _MyStepTabPanel;
Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle;
Tooltip = _MyItemInfo.TabToolTip;
//
_MyTabControl.Controls.Add(_MyTabPanel);
_MyTabControl.MyBar.Items.Add(this);
_MyDisplayTabControl.Controls.Add(_MyStepTabPanel);
_MyDisplayTabControl.MyBar.Items.Add(this);
//
// tabPanel
//
_MyTabPanel.TabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).EndInit();
_MyTabControl.MyBar.ResumeLayout(false);
_MyStepTabPanel.MyDisplayTabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).EndInit();
_MyDisplayTabControl.MyBar.ResumeLayout(false);
}
private void SetupDSOPanel()
/// <summary>
/// Creates and sets-up a DSOTabPanel
/// </summary>
private void SetupDSOTabPanel()
{
EntryInfo myEntry = _MyItem.MyContent.MyEntry;
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyTabControl);
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl);
//
// tabItem
//
Control = _MyDSOTabPanel;
Name = "tabItem Item " + _MyItem.ItemID;
Text = _MyItem.TabTitle;
Tooltip = _MyItem.TabToolTip;
Name = "tabItem Item " + _MyItemInfo.ItemID;
Text = _MyItemInfo.TabTitle;
Tooltip = _MyItemInfo.TabToolTip;
//
_MyTabControl.Controls.Add(_MyDSOTabPanel);
_MyTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
this});
//
// tabPanel
//
_MyTabControl.SelectedTab = this;
_MyDSOTabPanel.TabItem = this;
_MyDisplayTabControl.SelectedDisplayTabItem = this;
_MyDSOTabPanel.MyDisplayTabItem = this;
}
#endregion
}
}

View File

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

View File

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

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

View File

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

View File

@ -11,125 +11,212 @@ namespace Volian.Controls.Library
{
public partial class StepTabPanel : DevComponents.DotNetBar.PanelDockContainer
{
private DisplayTabControl _MyTabControl;
public DisplayTabControl MyTabControl
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private StepTabRibbon _MyStepTabRibbon;
private StepPanel _MyStepPanel;
private DisplayTabItem _MyDisplayTabItem;
#endregion
#region Properties
/// <summary>
/// Container
/// </summary>
public DisplayTabControl MyDisplayTabControl
{
get { return _MyTabControl; }
set { _MyTabControl = value; }
get { return _MyDisplayTabControl; }
//set { _MyDisplayTabControl = value; }
}
private StepTabRibbon _MyTabRibbon;
private Volian.Controls.Library.StepPanel _MyPanel;
public Volian.Controls.Library.StepPanel MyPanel
/// <summary>
/// StepPanel contained in this control.
/// </summary>
public Volian.Controls.Library.StepPanel MyStepPanel
{
get { return _MyPanel; }
set { _MyPanel = value; }
get { return _MyStepPanel; }
//set { _MyStepPanel = value; }
}
private DisplayTabItem _TabItem;
public DisplayTabItem TabItem
/// <summary>
/// related DisplayTabItem
/// </summary>
public DisplayTabItem MyDisplayTabItem
{
get { return _TabItem; }
set { _TabItem = value; }
get { return _MyDisplayTabItem; }
set { _MyDisplayTabItem = value; }
}
public ItemInfo ItemSelected
/// <summary>
/// Currently Selected ItemInfo
/// </summary>
public ItemInfo SelectedItemInfo
{
get { return _MyPanel.ItemSelected; }
set { _MyPanel.ItemSelected = value; }
get { return _MyStepPanel.SelectedItemInfo; }
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; }
set { _MyPanel.MyItem = value; }
get { return _MyStepPanel.MyProcedureItemInfo; }
set { _MyStepPanel.MyProcedureItemInfo = value; }
}
public StepTabPanel(DisplayTabControl myTabControl)
#endregion
#region Contructors
public StepTabPanel(DisplayTabControl myDisplayTabControl)
{
_MyTabControl = myTabControl;
_MyDisplayTabControl = myDisplayTabControl;
InitializeComponent();
SetupDisplayTabPanel();
SetupDisplayPanel();
SetupDisplayTabRibbon();
SetupStepTabPanel();
SetupStepPanel();
SetupStepTabRibbon();
}
private void SetupDisplayTabRibbon()
#endregion
#region Private Methods - Setup
/// <summary>
/// Setup StepTabRibbon
/// </summary>
private void SetupStepTabRibbon()
{
_MyTabRibbon = new StepTabRibbon();
_MyTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
_MyTabRibbon.Location = new System.Drawing.Point(0, 0);
_MyTabRibbon.Name = "displayTabRibbon1";
_MyStepTabRibbon = new StepTabRibbon();
_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
_MyStepTabRibbon.Name = "displayTabRibbon1";
//_MyTabRibbon.MyDisplayRTB = null;
_MyTabRibbon.MyDisplayItem = null;
this.Controls.Add(_MyTabRibbon);
_MyStepTabRibbon.MyStepItem = null;
this.Controls.Add(_MyStepTabRibbon);
}
private void SetupDisplayTabPanel()
/// <summary>
/// Setup this within control
/// </summary>
private void SetupStepTabPanel()
{
Dock = System.Windows.Forms.DockStyle.Fill;
this.Enter += new EventHandler(DisplayTabPanel_Enter);
this.Enter += new EventHandler(StepTabPanel_Enter);
}
void DisplayTabPanel_Enter(object sender, EventArgs e)
{
//if (ItemSelected != null)
_MyPanel.ItemShow();
}
private void SetupDisplayPanel()
/// <summary>
/// Setup StepPanel
/// </summary>
private void SetupStepPanel()
{
//this.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
_MyPanel = new Volian.Controls.Library.StepPanel(this.components);
this.Controls.Add(_MyPanel);
_MyStepPanel = new Volian.Controls.Library.StepPanel(this.components);
this.Controls.Add(_MyStepPanel);
//
// _MyPanel
//
_MyPanel.AutoScroll = true;
_MyPanel.Dock = System.Windows.Forms.DockStyle.Fill;
_MyPanel.LinkClicked +=new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkClicked);
_MyPanel.LinkActiveChanged += new Volian.Controls.Library.DisplayPanelLinkEvent(_MyPanel_LinkActiveChanged);
_MyPanel.LinkInsertTran += new DisplayPanelLinkEvent(_MyPanel_LinkInsertTran);
_MyPanel.LinkInsertRO += new DisplayPanelLinkEvent(_MyPanel_LinkInsertRO);
_MyPanel.LinkModifyTran += new DisplayPanelLinkEvent(_MyPanel_LinkModifyTran);
_MyPanel.LinkModifyRO += new DisplayPanelLinkEvent(_MyPanel_LinkModifyRO);
_MyPanel.ItemClick +=new Volian.Controls.Library.DisplayPanelEvent(_MyPanel_ItemClick);
_MyPanel.AttachmentClicked += new Volian.Controls.Library.DisplayPanelAttachmentEvent(_MyPanel_AttachmentClicked);
_MyPanel.ItemSelectedChanged += new DisplayPanelEvent(_MyPanel_ItemSelectedChanged);
_MyStepPanel.AutoScroll = true;
_MyStepPanel.Dock = System.Windows.Forms.DockStyle.Fill;
_MyStepPanel.LinkClicked +=new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkClicked);
_MyStepPanel.LinkActiveChanged += new Volian.Controls.Library.StepPanelLinkEvent(_MyStepPanel_LinkActiveChanged);
_MyStepPanel.LinkInsertTran += new StepPanelLinkEvent(_MyStepPanel_LinkInsertTran);
_MyStepPanel.LinkInsertRO += new StepPanelLinkEvent(_MyStepPanel_LinkInsertRO);
_MyStepPanel.LinkModifyTran += new StepPanelLinkEvent(_MyStepPanel_LinkModifyTran);
_MyStepPanel.LinkModifyRO += new StepPanelLinkEvent(_MyStepPanel_LinkModifyRO);
_MyStepPanel.ItemClick +=new Volian.Controls.Library.StepPanelEvent(_MyStepPanel_ItemClick);
_MyStepPanel.AttachmentClicked += new Volian.Controls.Library.StepPanelAttachmentEvent(_MyStepPanel_AttachmentClicked);
_MyStepPanel.ItemSelectedChanged += new StepPanelEvent(_MyStepPanel_ItemSelectedChanged);
}
void _MyPanel_LinkActiveChanged(object sender, DisplayLinkEventArgs args)
#endregion
#region Event Handlers
/// <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);
}
void _MyPanel_LinkInsertTran(object sender, DisplayLinkEventArgs args)
//if (ItemSelected != null)
_MyStepPanel.ItemShow();
}
/// <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.MyDisplayItem = args.MyDisplayItem;
_MyTabControl.OnItemSelectedChanged(sender, args);
_MyStepTabRibbon.MyStepItem = args.MyStepItem;
_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
{
private StepItem _MyDisplayItem;
public StepItem MyDisplayItem
private StepItem _MyStepItem;
public StepItem MyStepItem
{
get { return _MyDisplayItem; }
get { return _MyStepItem; }
set
{
_MyDisplayItem = value;
_MyStepItem = value;
if (value != null)
{
_MyDisplayRTB = value.MyDisplayRTB;
_MyStepRTB = value.MyStepRTB;
}
}
}
private StepRTB _MyDisplayRTB;
public StepRTB MyDisplayRTB
private StepRTB _MyStepRTB;
public StepRTB MyStepRTB
{
get { return _MyDisplayRTB; }
get { return _MyStepRTB; }
set
{
_MyDisplayRTB = value;
_MyStepRTB = value;
if (value != null)
{
_ContextMenuBar.SetContextMenuEx(_MyDisplayRTB, btnCMRtfEdit);
_MyDisplayRTB.SelectionChanged += new EventHandler(MyDisplayRTB_SelectionChanged);
_MyDisplayRTB.Leave += new EventHandler(MyDisplayRTB_Leave);
_ContextMenuBar.SetContextMenuEx(_MyStepRTB, btnCMRtfEdit);
_MyStepRTB.SelectionChanged += new EventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.Leave += new EventHandler(MyStepRTB_Leave);
}
}
}
void MyDisplayRTB_Leave(object sender, EventArgs e)
void MyStepRTB_Leave(object sender, EventArgs e)
{
_MyDisplayRTB.SelectionChanged -= new EventHandler(MyDisplayRTB_SelectionChanged);
_MyDisplayRTB.Leave -= new EventHandler(MyDisplayRTB_Leave);
_MyStepRTB.SelectionChanged -= new EventHandler(MyStepRTB_SelectionChanged);
_MyStepRTB.Leave -= new EventHandler(MyStepRTB_Leave);
}
void MyDisplayRTB_SelectionChanged(object sender, EventArgs e)
void MyStepRTB_SelectionChanged(object sender, EventArgs e)
{
btnCMBold.Checked = btnBold.Checked = _MyDisplayRTB.SelectionFont.Bold;
btnCMItalics.Checked = btnItalics.Checked = _MyDisplayRTB.SelectionFont.Italic;
btnCMUnderline.Checked = btnUnderline.Checked = _MyDisplayRTB.SelectionFont.Underline;
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyDisplayRTB);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyDisplayRTB);
btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyDisplayRTB.SelectionLength > 0;
btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
btnCMCut.Enabled = btnCMCopy.Enabled = btnCut.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
}
public StepTabRibbon()
{
@ -85,73 +85,73 @@ namespace Volian.Controls.Library
private void btnSym_Click(object sender, EventArgs e)
{
DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender;
_MyDisplayRTB.InsertSymbol((string)b.Tag);
_MyStepRTB.InsertSymbol((string)b.Tag);
}
private void btnPaste_Click(object sender, EventArgs e)
{
IDataObject myDO = Clipboard.GetDataObject();
if (myDO.GetDataPresent("Rich Text Format"))
_MyDisplayRTB.SelectedRtf = myDO.GetData("Rich Text Format").ToString();
_MyStepRTB.SelectedRtf = myDO.GetData("Rich Text Format").ToString();
else if (myDO.GetDataPresent("Text"))
_MyDisplayRTB.SelectedText = myDO.GetData("Text").ToString();
_MyStepRTB.SelectedText = myDO.GetData("Text").ToString();
}
private void btnCut_Click(object sender, EventArgs e)
{
Clipboard.Clear();
DataObject myDO = new DataObject("Rich Text Format", _MyDisplayRTB.SelectedRtf);
DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
Clipboard.SetDataObject(myDO);
_MyDisplayRTB.SelectedText = "";
_MyStepRTB.SelectedText = "";
}
private void btnCopy_Click(object sender, EventArgs e)
{
Clipboard.Clear();
DataObject myDO = new DataObject("Rich Text Format", _MyDisplayRTB.SelectedRtf);
DataObject myDO = new DataObject("Rich Text Format", _MyStepRTB.SelectedRtf);
Clipboard.SetDataObject(myDO);
}
private void btnBold_Click(object sender, EventArgs e)
{
FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Bold;
_MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs);
btnCMBold.Checked = btnBold.Checked = _MyDisplayRTB.SelectionFont.Bold;
FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Bold;
_MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
btnCMBold.Checked = btnBold.Checked = _MyStepRTB.SelectionFont.Bold;
}
private void btnItalics_Click(object sender, EventArgs e)
{
FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Italic;
_MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs);
btnCMItalics.Checked = btnItalics.Checked = _MyDisplayRTB.SelectionFont.Italic;
FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Italic;
_MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
btnCMItalics.Checked = btnItalics.Checked = _MyStepRTB.SelectionFont.Italic;
}
private void btnUnderline_Click(object sender, EventArgs e)
{
FontStyle fs = _MyDisplayRTB.SelectionFont.Style ^ FontStyle.Underline;
_MyDisplayRTB.SelectionFont = new Font(_MyDisplayRTB.SelectionFont, fs);
btnCMUnderline.Checked = btnUnderline.Checked = _MyDisplayRTB.SelectionFont.Underline;
FontStyle fs = _MyStepRTB.SelectionFont.Style ^ FontStyle.Underline;
_MyStepRTB.SelectionFont = new Font(_MyStepRTB.SelectionFont, fs);
btnCMUnderline.Checked = btnUnderline.Checked = _MyStepRTB.SelectionFont.Underline;
}
private void btnSuperscript_Click(object sender, EventArgs e)
{
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyDisplayRTB), _MyDisplayRTB, _MyDisplayRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyDisplayRTB);
RTBAPI.ToggleSuperscript(!RTBAPI.IsSuperScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSuperscript.Checked = btnSuperscript.Checked = RTBAPI.IsSuperScript(_MyStepRTB);
}
private void btnSubscript_Click(object sender, EventArgs e)
{
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyDisplayRTB), _MyDisplayRTB, _MyDisplayRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyDisplayRTB);
RTBAPI.ToggleSubscript(!RTBAPI.IsSubScript(_MyStepRTB), _MyStepRTB, _MyStepRTB.SelectionLength == 0 ? RTBAPI.RTBSelection.SCF_DEFAULT : RTBAPI.RTBSelection.SCF_SELECTION);
btnCMSubscript.Checked = btnSubscript.Checked = RTBAPI.IsSubScript(_MyStepRTB);
}
private void btnUppercase_Click(object sender, EventArgs e)
{
_MyDisplayRTB.SetSelectedCase('U');
_MyStepRTB.SetSelectedCase('U');
}
private void btnLowercase_Click(object sender, EventArgs e)
{
_MyDisplayRTB.SetSelectedCase('l');
_MyStepRTB.SetSelectedCase('l');
}
private void btnTitleCase_Click(object sender, EventArgs e)
{
_MyDisplayRTB.SetSelectedCase('T');
_MyStepRTB.SetSelectedCase('T');
}
//public event DisplayRTBLinkEvent LinkInsertTran;
//private void OnLinkInsertTran(object sender, LinkClickedEventArgs args)
@ -164,12 +164,12 @@ namespace Volian.Controls.Library
// see if user is positioned 'on' a transition within the rtb, if so do a modify, otherwise,
// insert transition.
StepTabPanel tmp = Parent as StepTabPanel;
tmp.MyTabControl.OnLinkModifyTran(this, new DisplayLinkEventArgs(_MyDisplayItem, null));
tmp.MyDisplayTabControl.OnLinkModifyTran(this, new StepPanelLinkEventArgs(_MyStepItem, null));
}
private void btnInsHrdSpc_Click(object sender, EventArgs e)
{
_MyDisplayRTB.InsertSymbol(@"\u160?");
_MyStepRTB.InsertSymbol(@"\u160?");
}
private void btnInsRO_Click(object sender, EventArgs e)
@ -177,17 +177,17 @@ namespace Volian.Controls.Library
// see if user is positioned 'on' an RO within the rtb, if so do a modify, otherwise,
// insert transition.
StepTabPanel tmp = Parent as StepTabPanel;
tmp.MyTabControl.OnLinkModifyRO(this, new DisplayLinkEventArgs(_MyDisplayItem, null));
tmp.MyDisplayTabControl.OnLinkModifyRO(this, new StepPanelLinkEventArgs(_MyStepItem, null));
}
private void btnRedo_Click(object sender, EventArgs e)
{
_MyDisplayRTB.Redo();
_MyStepRTB.Redo();
}
private void btnUndo_Click(object sender, EventArgs e)
{
_MyDisplayRTB.Undo();
_MyStepRTB.Undo();
}
}
}

View File

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

View File

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

View File

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

View File

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