Fixed DSO Framer:

1. Open Properly if all tabs are closed
2. Open to a full window view
3. Set Current Item in the Tab Control
Fixed Display Panel so that when you click on an item in an inactive panel, the item clicked-on become the selected item.
This commit is contained in:
Rich 2008-01-11 22:00:54 +00:00
parent 04336831c3
commit c34c604c11
5 changed files with 80 additions and 316 deletions

View File

@ -19,6 +19,11 @@ namespace Volian.Controls.Library
private static int _Count = 0; private static int _Count = 0;
private DocumentInfo _MyDocument; private DocumentInfo _MyDocument;
private int _MyCount; private int _MyCount;
public static int Count
{
get { return _Count; }
set { _Count = value; }
}
private DisplayTabItem _TabItem; private DisplayTabItem _TabItem;
public DisplayTabItem TabItem public DisplayTabItem TabItem
{ {
@ -32,13 +37,11 @@ namespace Volian.Controls.Library
SetupDSOTabPanel(); SetupDSOTabPanel();
_MyDocument = documentInfo; _MyDocument = documentInfo;
SetupDSO(); SetupDSO();
} }
private void SetupDSOTabPanel()
private void SetupDSOTabPanel() {
{
Dock = System.Windows.Forms.DockStyle.Fill; Dock = System.Windows.Forms.DockStyle.Fill;
} }
public DocumentInfo DocumentInfo public DocumentInfo DocumentInfo
{ {
get { return _MyDocument; } get { return _MyDocument; }
@ -63,38 +66,30 @@ private void SetupDSOTabPanel()
_MyCount = _Count; _MyCount = _Count;
this._MyDSOFramer = new AxDSOFramer.AxFramerControl(); this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
//this.SuspendLayout();
this.Controls.Add(this._MyDSOFramer); this.Controls.Add(this._MyDSOFramer);
this.components.Add(this._MyDSOFramer); this.components.Add(this._MyDSOFramer);
this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill; this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
//this._MyDSOFramer.Enabled = true;
//this._MyDSOFramer.Location = new System.Drawing.Point(0, 0);
//this._MyDSOFramer.Name = "_DSOFramer";
//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")));
//this._MyDSOFramer.Size = new System.Drawing.Size(657, 453);
//this._MyDSOFramer.TabIndex = 0;
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
//this.ResumeLayout(false);
this._MyDSOFramer.EventsEnabled = true;
this._MyDSOFramer.Open(DSOFile.MyFile.FullName); this._MyDSOFramer.Open(DSOFile.MyFile.FullName);
this._MyDSOFramer.Menubar = false; this._MyDSOFramer.Menubar = false;
this._MyDSOFramer.Titlebar = false; this._MyDSOFramer.Titlebar = false;
//this._DSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoSetOnFirstOpen; //if (_MyCount < 20)
if (_MyCount < 20) // this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
this._MyDSOFramer.Invalidated += new InvalidateEventHandler(_DSOFramer_Invalidated);
this._MyDSOFramer.BeforeDocumentClosed += new AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEventHandler(_MyDSOFramer_BeforeDocumentClosed); this._MyDSOFramer.BeforeDocumentClosed += new AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEventHandler(_MyDSOFramer_BeforeDocumentClosed);
//this.Resize += new EventHandler(DSOTabPage_Resize); this._MyDSOFramer.OnSaveCompleted += new AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEventHandler(_MyDSOFramer_OnSaveCompleted);
this.Enter += new EventHandler(DSOTabPanel_Enter); this.Enter += new EventHandler(DSOTabPanel_Enter);
} }
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
{
DSOFile.SaveFile();
}
void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e) void _MyDSOFramer_BeforeDocumentClosed(object sender, AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEvent e)
{ {
try try
{ {
SaveDirty(); SaveDirty();
//if(SaveDirty()) e.cancel = true;
//throw new System.Data.DataException();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -105,8 +100,9 @@ private void SetupDSOTabPanel()
{ {
try try
{ {
_MyDSOFramer.EventsEnabled = true;
_MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow; _MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
_MyDSOFramer.Focus(); _MyTabControl.OnItemSelectedChanged(this, null);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -133,7 +129,7 @@ private void SetupDSOTabPanel()
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 " + this.Name, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) if (MessageBox.Show("Save changes to " + _TabItem.MyItem.TabTitle + "\r\n" + _TabItem.MyItem.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO(); return SaveDSO();
return false; return false;
} }
@ -145,6 +141,7 @@ private void SetupDSOTabPanel()
} }
public bool CloseDSO(bool force) public bool CloseDSO(bool force)
{ {
_MyLog.Debug("CloseDSO");
bool result = true; bool result = true;
try try
{ {
@ -153,6 +150,7 @@ private void SetupDSOTabPanel()
components.Remove(_MyDSOFramer); components.Remove(_MyDSOFramer);
_MyDSOFramer.Dispose(); _MyDSOFramer.Dispose();
_MyDSOFramer = null; _MyDSOFramer = null;
_Count--;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -161,16 +159,6 @@ private void SetupDSOTabPanel()
} }
return result; return result;
} }
void _DSOFramer_Invalidated(object sender, InvalidateEventArgs e)
{
//ConsoleWriteLine("_DSOFramer_Invalidated");
if (_MyCount >= 20)
_MyDSOFramer.Activate();
}
//void DSOTabPage_Resize(object sender, EventArgs e)
//{
// //_DSOFramer.Refresh();
//}
public void Activate() public void Activate()
{ {
try try
@ -178,7 +166,6 @@ private void SetupDSOTabPanel()
this._MyDSOFramer.Activate(); this._MyDSOFramer.Activate();
if (_MyCount < 20) if (_MyCount < 20)
this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow; this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
//this._DSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoSetOnFirstOpen;
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -28,32 +28,14 @@ namespace Volian.Controls.Library
Done = 16 Done = 16
} }
#endregion #endregion
//public delegate void vlnCSLARTBLinkEvent(object sender, vlnCSLARTBLinkEventArgs args);
public partial class DisplayItem : UserControl public partial class DisplayItem : UserControl
{ {
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);
#region Events #region Events
//public event vlnCSLARTBLinkEvent LinkClicked;
//private void OnLinkClicked(object sender, vlnCSLARTBLinkEventArgs args)
//{
// if (LinkClicked != null) LinkClicked(sender, args);
// else MessageBox.Show(args.LinkInfo.LinkText, "Unhandled Link Click", MessageBoxButtons.OK, MessageBoxIcon.Information);
//}
//public event vlnCSLARTBEvent BeforeExpand;
//private void OnBeforeExpand(object sender, EventArgs args)
//{
// if (BeforeExpand != null) BeforeExpand(sender, args);
//}
//public event vlnCSLARTBEvent BeforeColapse;
//private void OnBeforeColapse(object sender, EventArgs args)
//{
// if (BeforeColapse != null) BeforeColapse(sender, args);
//}
#endregion #endregion
#region Private Fields #region Private Fields
private bool _ChildrenLoaded=false; private bool _ChildrenLoaded=false;
private StepSectionLayoutData _Layout; private StepSectionLayoutData _Layout;
//private FormatInfo _ActiveFormat;
private DisplayPanel _Panel; private DisplayPanel _Panel;
private ChildRelation _Relation; private ChildRelation _Relation;
private bool _Loading = true; private bool _Loading = true;
@ -72,14 +54,10 @@ namespace Volian.Controls.Library
{ {
_MyItem = value; _MyItem = value;
int typ = (int) value.MyContent.Type; int typ = (int) value.MyContent.Type;
//TimeIt("f");
//TabFormat = TemporaryFormat.TabFormat(this);
//TimeIt("g");
if (typ >= 20000) if (typ >= 20000)
{ {
int stepType = typ % 10000; int stepType = typ % 10000;
_StepData = value.ActiveFormat.PlantFormat.FormatData.StepDataList[stepType]; _StepData = value.ActiveFormat.PlantFormat.FormatData.StepDataList[stepType];
//_StepData = _ActiveFormat.PlantFormat.FormatData.StepDataList[stepType];
} }
if (value.MyContent.Type == 20001) if (value.MyContent.Type == 20001)
Circle = true; Circle = true;
@ -87,14 +65,6 @@ namespace Volian.Controls.Library
CheckOff = true; CheckOff = true;
if ((value.ItemID % 25) == 0) if ((value.ItemID % 25) == 0)
ChangeBar = true; ChangeBar = true;
//if (value != null)
//{
// this.veRichTextBoxText.MyItem = value;
// //this.veRichTextBoxText.Text = _MyItem.MyContent.Text;
// //this.lblTab.Text = _MyItem.MyContent.Type < 20000 ? _MyItem.MyContent.Number : _MyItem.Ordinal.ToString();
// //this.lblTab.Text = _MyItem.ItemID.ToString();
// SetTab();
//}
} }
} }
private void SetText() private void SetText()
@ -102,7 +72,6 @@ namespace Volian.Controls.Library
if (_MyItem != null) if (_MyItem != null)
this._DisplayRTB.MyItem = _MyItem; this._DisplayRTB.MyItem = _MyItem;
} }
//private static int _ColS = 8 * 120;//TODO: _layout.ColS
private static int __WidthAdjust = 3; private static int __WidthAdjust = 3;
private DisplayItem _MyParent = null; private DisplayItem _MyParent = null;
public DisplayItem MyParent public DisplayItem MyParent
@ -113,14 +82,9 @@ namespace Volian.Controls.Library
_MyParent = value; _MyParent = value;
if (_MyParent != null) if (_MyParent != null)
{ {
//this.BackColor = Color.Red;
//TabFormat = TemporaryFormat.TabFormat(this);
switch (_Relation) switch (_Relation)
{ {
case ChildRelation.None: // Same as after case ChildRelation.None: // Same as after
//Location = new Point(_MyParent.Left + 20, _MyParent.Bottom);
//Width = _MyParent.Width - 20;
//break;
case ChildRelation.After: case ChildRelation.After:
// The size depends upon the parent type // The size depends upon the parent type
int iType = (int)_MyParent._Type; int iType = (int)_MyParent._Type;
@ -132,7 +96,6 @@ namespace Volian.Controls.Library
ItemWidth = _Panel.ToDisplay(_Layout.ColT) + _Panel.ToDisplay(_Layout.WidT); ItemWidth = _Panel.ToDisplay(_Layout.ColT) + _Panel.ToDisplay(_Layout.WidT);
break; break;
case 1: case 1:
//ItemWidth = _Panel.ToDisplay(_ColS) + _Panel.ToDisplay(_layout.WidSTableEdit, Convert.ToInt32(_layout.PMode)-1);
ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom); ItemLocation = new Point(_MyParent.ItemLocation.X + 20, _MyParent.Bottom);
int borderWidth = _DisplayRTB.Width - _DisplayRTB.ClientRectangle.Width; int borderWidth = _DisplayRTB.Width - _DisplayRTB.ClientRectangle.Width;
TextWidth = __WidthAdjust + borderWidth + _Panel.ToDisplay(_Layout.WidSTableEdit, Convert.ToInt32(_Layout.PMode) - 1); TextWidth = __WidthAdjust + borderWidth + _Panel.ToDisplay(_Layout.WidSTableEdit, Convert.ToInt32(_Layout.PMode) - 1);
@ -143,7 +106,6 @@ namespace Volian.Controls.Library
{ {
_DisplayRTB.Font = _StepData.Font.WindowsFont; _DisplayRTB.Font = _StepData.Font.WindowsFont;
ItemWidth = (int)TableWidth(_DisplayRTB.Font, _MyItem.MyContent.Text); ItemWidth = (int)TableWidth(_DisplayRTB.Font, _MyItem.MyContent.Text);
//ItemLocation = new Point(_MyParent.TextLeft, _MyParent.Bottom);
ItemLocation = new Point(50, _MyParent.Bottom); ItemLocation = new Point(50, _MyParent.Bottom);
ItemLocation = TableLocation(_MyParent, _Layout, ItemWidth); ItemLocation = TableLocation(_MyParent, _Layout, ItemWidth);
} }
@ -165,7 +127,6 @@ namespace Volian.Controls.Library
else else
{ {
TextLocation = new Point(_MyParent.TextLeft, _MyParent.BottomMost.Bottom); TextLocation = new Point(_MyParent.TextLeft, _MyParent.BottomMost.Bottom);
//ItemLocation = new Point(_MyParent.ItemLeft, _MyParent.BottomMost.Bottom);
} }
// Same size as the Parent // Same size as the Parent
TabFormat = ""; TabFormat = "";
@ -178,10 +139,8 @@ namespace Volian.Controls.Library
_Panel.Scrolling--; _Panel.Scrolling--;
// Could be a Caution or Note - Need to get WidT // Could be a Caution or Note - Need to get WidT
Width = _Panel.ToDisplay(_Layout.WidT); Width = _Panel.ToDisplay(_Layout.WidT);
//Width = _MyParent.Width - 20;
break; break;
} }
//veRichTextBoxText.ResizeForText();
} }
} }
} }
@ -194,8 +153,6 @@ namespace Volian.Controls.Library
foreach (string line in lines) foreach (string line in lines)
{ {
string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands
//if (line != line2)
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'{0}' <> '{1}'", line, line2);
SizeF siz = g.MeasureString(line2, fnt,pnt,StringFormat.GenericTypographic) ; SizeF siz = g.MeasureString(line2, fnt,pnt,StringFormat.GenericTypographic) ;
if (siz.Width+ _Panel.Settings.TableWidthAdjust > max) max = siz.Width + _Panel.Settings.TableWidthAdjust; if (siz.Width+ _Panel.Settings.TableWidthAdjust > max) max = siz.Width + _Panel.Settings.TableWidthAdjust;
} }
@ -234,7 +191,6 @@ namespace Volian.Controls.Library
get { return Width - lblTab.Left; } get { return Width - lblTab.Left; }
set set
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.Debug("ItemWidth");
Width = value + lblTab.Left; Width = value + lblTab.Left;
} }
} }
@ -243,7 +199,6 @@ namespace Volian.Controls.Library
get { return _DisplayRTB.Width; } get { return _DisplayRTB.Width; }
set set
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.Debug("TextWidth");
Width = value + lblTab.Left + lblTab.Width; Width = value + lblTab.Left + lblTab.Width;
} }
} }
@ -256,7 +211,7 @@ namespace Volian.Controls.Library
{ {
get { return Left + _DisplayRTB.Left; } get { return Left + _DisplayRTB.Left; }
} }
private string _TabFormat ; // Volian Property Snippet private string _TabFormat ;
public string TabFormat public string TabFormat
{ {
get { return _TabFormat; } get { return _TabFormat; }
@ -294,12 +249,10 @@ namespace Volian.Controls.Library
break; break;
} }
lblTab.Text = tabString; lblTab.Text = tabString;
//lblTab.Visible = (tabString != "");
lblTab.Width = tabString.Length * 8; lblTab.Width = tabString.Length * 8;
_DisplayRTB.Left = lblTab.Left + lblTab.Width;// +2; _DisplayRTB.Left = lblTab.Left + lblTab.Width;// +2;
_DisplayRTB.Width = Width - _DisplayRTB.Left; _DisplayRTB.Width = Width - _DisplayRTB.Left;
// TODO: Performance - SetToolTip(); // TODO: Performance - SetToolTip();
//// TIMING: vlnCSLARTB.TimeIt("TabFormat Done");
} }
} }
} }
@ -358,7 +311,6 @@ namespace Volian.Controls.Library
} }
} }
} }
//private delegate vlnCSLARTB FindNext();
public DisplayItem TopMost public DisplayItem TopMost
{ {
get get
@ -384,7 +336,6 @@ namespace Volian.Controls.Library
if ((Expanding != ExpandingStatus.No || Expanded) & _After != null) tmpa = _After[_After.Count - 1].BottomMost; if ((Expanding != ExpandingStatus.No || Expanded) & _After != null) tmpa = _After[_After.Count - 1].BottomMost;
if (tmpr == null) if (tmpr == null)
return tmpa; return tmpa;
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("Left {0}, Right {1}", tmpa.Bottom, tmpr.Bottom);
if (tmpa.Bottom >= tmpr.Bottom) if (tmpa.Bottom >= tmpr.Bottom)
return tmpa; return tmpa;
return tmpr; return tmpr;
@ -442,7 +393,6 @@ namespace Volian.Controls.Library
{ {
get { return _MyItem == null ? 0 : _MyItem.ItemID; } get { return _MyItem == null ? 0 : _MyItem.ItemID; }
} }
//private bool ShowMoves = false;
private bool _Moving = false; // Volian Property Snippet private bool _Moving = false; // Volian Property Snippet
public bool Moving public bool Moving
{ {
@ -478,6 +428,7 @@ namespace Volian.Controls.Library
this.Paint += new PaintEventHandler(vlnCSLARTB_Paint); this.Paint += new PaintEventHandler(vlnCSLARTB_Paint);
this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged); this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged);
_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter); _DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
if (item != null) if (item != null)
{ {
_Type = (int)item.MyContent.Type; _Type = (int)item.MyContent.Type;
@ -504,21 +455,16 @@ namespace Volian.Controls.Library
if(item != null)panel.ItemLookup.Add(item.ItemID, this); if(item != null)panel.ItemLookup.Add(item.ItemID, this);
_Relation = relationType; _Relation = relationType;
if(parent != null)RNOLevel = parent.RNOLevel; if(parent != null)RNOLevel = parent.RNOLevel;
//List<vlnCSLARTB> siblings;
//TimeIt("d");
if (item != null) if (item != null)
{ {
//FormatInfo fi = item.ActiveFormat;
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB before _Layout"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB before _Layout");
_Layout = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData; _Layout = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB _Layout"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB _Layout");
//_layout = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
if (parent != null) if (parent != null)
SeqLevel = parent.SeqLevel + ((relationType == ChildRelation.After || relationType == ChildRelation.Before) && TemporaryFormat.IsSequential(item) ? 1 : 0); SeqLevel = parent.SeqLevel + ((relationType == ChildRelation.After || relationType == ChildRelation.Before) && TemporaryFormat.IsSequential(item) ? 1 : 0);
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB seqLevel"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB seqLevel");
MyItem = item; MyItem = item;
} }
//TabFormat = TemporaryFormat.TabFormat(item,SeqLevel);
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB MyItem"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB MyItem");
switch (relationType) switch (relationType)
{ {
@ -537,7 +483,6 @@ namespace Volian.Controls.Library
} }
if (item != null) if (item != null)
{ {
//MyItem = item;
if (relationType == ChildRelation.None) if (relationType == ChildRelation.None)
{ {
if (_Type == 0 && _Layout != null) if (_Type == 0 && _Layout != null)
@ -545,16 +490,10 @@ namespace Volian.Controls.Library
Width = _Panel.ToDisplay(_Layout.WidT); Width = _Panel.ToDisplay(_Layout.WidT);
} }
} }
//if (item != null)
//{
// //int iType = ((int)item.MyContent.Type) / 10000;
//}
} }
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB Parent"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB Parent");
SetText(); SetText();
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB SetText"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB SetText");
//MyItem = item;
//TabFormat = TemporaryFormat.TabFormat(this);
if (item != null) if (item != null)
{ {
Name = string.Format("Item-{0}", item.ItemID); Name = string.Format("Item-{0}", item.ItemID);
@ -562,7 +501,6 @@ namespace Volian.Controls.Library
switch (_Type / 10000) switch (_Type / 10000)
{ {
case 1: case 1:
//CanExpand = (item.MyContent.ContentPartCount != 0);
CanExpand = true; CanExpand = true;
vlnExp.Attachment = (item.MyContent.ContentPartCount == 0); vlnExp.Attachment = (item.MyContent.ContentPartCount == 0);
break; break;
@ -573,7 +511,6 @@ namespace Volian.Controls.Library
CanExpand = false; CanExpand = false;
break; break;
} }
//CanExpand = (item.MyContent.ContentPartCount != 0);
if(expand && (item.MyContent.ContentPartCount != 0)) // If it should expand and it can expand if(expand && (item.MyContent.ContentPartCount != 0)) // If it should expand and it can expand
Expand(true); Expand(true);
else else
@ -582,15 +519,16 @@ namespace Volian.Controls.Library
Expand(true); Expand(true);
else // otherwise only expand one level else // otherwise only expand one level
Expand(false); Expand(false);
//BringToFront();
} }
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB before Controls Add"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB before Controls Add");
panel.Controls.Add(this); panel.Controls.Add(this);
_Loading = false; _Loading = false;
//TabFormat = "<number> ";
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add");
} }
void _DisplayRTB_MouseClick(object sender, MouseEventArgs e)
{
_DisplayRTB.Select();
}
void _DisplayRTB_Enter(object sender, EventArgs e) void _DisplayRTB_Enter(object sender, EventArgs e)
{ {
_Panel._ItemSelected = _MyItem; _Panel._ItemSelected = _MyItem;
@ -635,14 +573,12 @@ namespace Volian.Controls.Library
private void vlnCSLARTB_Paint(object sender, PaintEventArgs e) private void vlnCSLARTB_Paint(object sender, PaintEventArgs e)
{ {
Graphics g = e.Graphics; Graphics g = e.Graphics;
//g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawString(lblTab.Text, _DisplayRTB.Font, Brushes.Black ,new RectangleF(new PointF(_Panel.Settings.NumberLocationX,_Panel.Settings.NumberLocationY),_Panel.Settings.NumberSize), StringFormat.GenericDefault); g.DrawString(lblTab.Text, _DisplayRTB.Font, Brushes.Black ,new RectangleF(new PointF(_Panel.Settings.NumberLocationX,_Panel.Settings.NumberLocationY),_Panel.Settings.NumberSize), StringFormat.GenericDefault);
if (Circle) if (Circle)
{ {
Pen penC = new Pen(_Panel.Settings.CircleColor, _Panel.Settings.CircleWeight); Pen penC = new Pen(_Panel.Settings.CircleColor, _Panel.Settings.CircleWeight);
g.DrawArc(penC, lblTab.Left + 1, 0, _Panel.Settings.CircleDiameter, _Panel.Settings.CircleDiameter, 0F, 360F); g.DrawArc(penC, lblTab.Left + 1, 0, _Panel.Settings.CircleDiameter, _Panel.Settings.CircleDiameter, 0F, 360F);
//g.DrawString("\u20DE", _Panel.Settings.CircleFont, bluPen.Brush, lblTab.Left + _Panel.Settings.CircleXOffset, _Panel.Settings.CircleYOffset);
} }
if (CheckOff) if (CheckOff)
{ {
@ -692,19 +628,6 @@ namespace Volian.Controls.Library
public void AddChildBefore(ItemInfo item,bool expand) public void AddChildBefore(ItemInfo item,bool expand)
{ {
DisplayItem child = new DisplayItem(item, _Panel,this, ChildRelation.Before,expand); DisplayItem child = new DisplayItem(item, _Panel,this, ChildRelation.Before,expand);
//if (_Before == null)
//{
// _Before = new List<vlnCSLARTB>();
// _Before.Add(child);
// child.MyParent = this;
//}
//else
//{
// vlnCSLARTB lastChild = LastChild(_Before);
// _Before.Add(child);
// child.Previous = lastChild;
//}
//_Before.Add(child);
} }
public void AddChildBefore(ItemInfoList itemList, bool expand) public void AddChildBefore(ItemInfoList itemList, bool expand)
{ {
@ -715,17 +638,6 @@ namespace Volian.Controls.Library
public void AddChildRNO(ItemInfo item,bool expand) public void AddChildRNO(ItemInfo item,bool expand)
{ {
DisplayItem child = new DisplayItem(item, _Panel,this, ChildRelation.RNO,expand); DisplayItem child = new DisplayItem(item, _Panel,this, ChildRelation.RNO,expand);
//if (_RNO == null)
//{
// _RNO = new List<vlnCSLARTB>();
// _RNO.Add(child);
// child.MyParent = this;
//}
//else
//{
// child.Previous = LastChild(_RNO);
// _RNO.Add(child);
//}
} }
public void AddChildRNO(ItemInfoList itemList,bool expand) public void AddChildRNO(ItemInfoList itemList,bool expand)
{ {
@ -737,18 +649,6 @@ namespace Volian.Controls.Library
{ {
DisplayItem child = new DisplayItem(item, _Panel, this, ChildRelation.After,expand); DisplayItem child = new DisplayItem(item, _Panel, this, ChildRelation.After,expand);
child.RNOLevel = this.RNOLevel; child.RNOLevel = this.RNOLevel;
//if (_After == null)
//{
// _After = new List<vlnCSLARTB>();
// _After.Add(child);
// child.MyParent = this;
//}
//else
//{
// vlnCSLARTB lastChild=LastChild(_After);
// _After.Add(child);
// child.Previous = lastChild;
//}
} }
public void AddChildAfter(ItemInfoList itemList,bool expand) public void AddChildAfter(ItemInfoList itemList,bool expand)
{ {
@ -877,9 +777,6 @@ namespace Volian.Controls.Library
AddChildAfter(MyItem.Steps, expand); AddChildAfter(MyItem.Steps, expand);
AddChildAfter(MyItem.Tables, expand); AddChildAfter(MyItem.Tables, expand);
AddChildRNO(MyItem.RNOs, expand); AddChildRNO(MyItem.RNOs, expand);
//if (args.Mode == vlnExpanderMode.ExpandAll)
// ExpandChildren(args);
//_Panel.ResumeLayout();
if (!vlnExp.Expanded) if (!vlnExp.Expanded)
vlnExp.ShowExpanded(); vlnExp.ShowExpanded();
} }
@ -895,7 +792,6 @@ namespace Volian.Controls.Library
if (!_Loading && Expanding == ExpandingStatus.No) if (!_Loading && Expanding == ExpandingStatus.No)
Expand(_Type >= 20000); Expand(_Type >= 20000);
Cursor.Current = tmp; Cursor.Current = tmp;
//Expand(args.Mode == vlnExpanderMode.ExpandAll);
} }
private void ExpandChildren(List<DisplayItem> children) private void ExpandChildren(List<DisplayItem> children)
{ {
@ -922,8 +818,6 @@ namespace Volian.Controls.Library
{ {
get get
{ {
//if (this.MyID == _WatchFor)
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}", _WatchFor);
DisplayItem tmp = this; DisplayItem tmp = this;
if (tmp.Next == null && FirstSibling._Relation == ChildRelation.Before) if (tmp.Next == null && FirstSibling._Relation == ChildRelation.Before)
return UpOne; return UpOne;
@ -937,7 +831,6 @@ namespace Volian.Controls.Library
if (tmp.Expanding == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait if (tmp.Expanding == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait
return null; return null;
DisplayItem btm = tmp.BottomMost; DisplayItem btm = tmp.BottomMost;
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'BottomMost',{0},'{1}'", btm.MyID, btm.MyText);
if (this != btm) if (this != btm)
{ {
if (tmp.Next != null && tmp.Next.TopMost.Top != btm.Bottom) if (tmp.Next != null && tmp.Next.TopMost.Top != btm.Bottom)
@ -951,7 +844,6 @@ namespace Volian.Controls.Library
} }
if (tmp != null) if (tmp != null)
return tmp.Next.TopMost;// if no _After - check to see if there is a Next return tmp.Next.TopMost;// if no _After - check to see if there is a Next
//if (tmp != null) return tmp.Next;// if no _After - check to see if there is a Next
return null; return null;
} }
} }
@ -965,122 +857,38 @@ namespace Volian.Controls.Library
return null; return null;
} }
} }
//static int _WatchFor = 333;
private void AdjustLocation() private void AdjustLocation()
{ {
//if (this.MyID == _WatchFor)
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}",_WatchFor);
DisplayItem tmp = NextItem; DisplayItem tmp = NextItem;
if (tmp == null) return; if (tmp == null) return;
//if(tmp.Top > _Panel.Height && Bottom > _Panel.Height){
// if(Bottom - tmp.Top != 0)
// _Panel.AdjustOutOfRangeControls(Bottom - tmp.Top);
// return;
//}
if (tmp != null && !tmp.Moving && tmp.Top != Bottom ) if (tmp != null && !tmp.Moving && tmp.Top != Bottom )
{ {
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Adjust Location',{0},'Move',{1}", MyID, tmp.MyID);
//tmp.TopMost.Top = Bottom;
_Panel.Scrolling++; _Panel.Scrolling++;
tmp.Top = Bottom; tmp.Top = Bottom;
_Panel.Scrolling--; _Panel.Scrolling--;
} }
} }
//private void SetToolTip()
//{
// toolTip1.SetToolTip(veRichTextBoxText,
// string.Format("ID={0}, ItemLeft={1}, ItemWidth={2}, TextWidth={3}, Width={4}",MyID,ItemLeft,ItemWidth,TextWidth,Width));
//}
//private static double Seconds()
//{
// DateTime t = DateTime.Now;
// return ((t.Hour * 60.0) + t.Minute) * 60.0 + t.Second + (t.Millisecond / 1000.0);
//}
//private static DateTime tLast = DateTime.Now;
//private static Dictionary<string, long> dicTiming = new Dictionary<string, long>();
//public static void TimeIt(string p)
//{
// DateTime tNow = DateTime.Now;
// if (!dicTiming.ContainsKey(p)) dicTiming[p] = 0;
// dicTiming[p] += (tNow.Ticks - tLast.Ticks);
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\t{0}\t{1:0.000}", p, tNow - tLast);
// tLast = tNow;
//}
//public static void TimeItList()
//{
// //string sep = "\r\n";
// long total = 0;
// foreach (string s in dicTiming.Keys)
// {
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}\"{1}\"",sep, s);
// total += dicTiming[s];
// //sep = "\t";
// }
// //sep = "\r\n";
// foreach (string s in dicTiming.Keys)
// {
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0}{1}", sep, (dicTiming[s]*100)/total );
// //sep = "\t";
// long i = (dicTiming[s]*10000)/total;
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\"{0}\"\t{1}\t{2}\t\"{3}\"", s, dicTiming[s], ((float)i) / 100, "".PadRight((int)(i / 100), 'X'));
// }
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("\r\n{0:0.000}", tNow - tLast);
//}
//public static void TimeItSetup()
//{
// dicTiming = new Dictionary<string, long>();
// DateTime tNow = DateTime.Now;
// // Reset all Counts
// //if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("{0:0.000}", tNow - tLast);
// tLast = tNow;
//}
public IDisplayRTB TextBox public IDisplayRTB TextBox
{ {
get { return (IDisplayRTB)_DisplayRTB; } get { return (IDisplayRTB)_DisplayRTB; }
} }
private void vlnCSLARTB_Resize(object sender, EventArgs e) private void vlnCSLARTB_Resize(object sender, EventArgs e)
{ {
//return;
//TimeIt("ResizeStart");
if (_MyItem == null) return; if (_MyItem == null) return;
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Resize',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width);
//SetToolTip();
AdjustLocation(); AdjustLocation();
//TimeIt("ResizeEnd");
} }
private void vlnCSLARTB_Move(object sender, EventArgs e) private void vlnCSLARTB_Move(object sender, EventArgs e)
{ {
//return;
if (_Panel.Scrolling == 0) return; if (_Panel.Scrolling == 0) return;
//_MyLog.DebugFormat("'Move',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width);
if (_MyItem == null) return; if (_MyItem == null) return;
//if (_Panel.Scrolling) return;
if (Expanding == ExpandingStatus.Expanding) return; if (Expanding == ExpandingStatus.Expanding) return;
_Moving = true; _Moving = true;
//if (_Panel.Automatic == false) return;
DisplayItem tmp = (DisplayItem)sender; DisplayItem tmp = (DisplayItem)sender;
if (tmp._Previous == null && tmp._MyParent == null) if (tmp._Previous == null && tmp._MyParent == null)
{ {
//_Panel.Scrolling = true;
return; return;
} }
//if (ShowMoves)
//if (MyID == 367)
//{
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat(",{0},{1},{2},{3},'{4}'", MyID, tmp.MyID, Top, Left, e.GetType().Name);
// //ShowMoves = true;
//}
//SetToolTip();
AdjustLocation(); AdjustLocation();
//if (_After != null)
//{
// if (_After[0].TopMost.Top != Bottom)
// {
// if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Adjust After',{0},'{1}'", MyID, MyText);
// _After[0].TopMost.Top = Bottom;
// }
//}
if (_RNO != null) if (_RNO != null)
{ {
if (_RNO[0].TopMost.Top != Top) if (_RNO[0].TopMost.Top != Top)
@ -1105,11 +913,6 @@ namespace Volian.Controls.Library
_Moving = false; _Moving = false;
BottomMost.AdjustLocation(); BottomMost.AdjustLocation();
} }
//private void veRichTextBoxText_LinkClicked(object sender, LinkClickedEventArgs e)
//{
// //MessageBox.Show(e.LinkText);
// _Panel.OnLinkClicked(sender, new DisplayLinkEventArgs(this, e));
//}
void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e) void _DisplayRTB_LinkGoTo(object sender, System.Windows.Forms.LinkClickedEventArgs e)
{ {
_MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + e.LinkText); _MyLog.DebugFormat("_DisplayRTB_LinkGoTo " + e.LinkText);
@ -1127,9 +930,5 @@ namespace Volian.Controls.Library
{ {
_DisplayRTB.BackColor = _Panel.InactiveColor; _DisplayRTB.BackColor = _Panel.InactiveColor;
} }
private void veRichTextBoxText_Resize(object sender, EventArgs e)
{
//if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("'Resize Text',{0},{1},{2},{3},{4}", MyID, Top, Left, Height, Width);
}
} }
} }

View File

@ -61,7 +61,6 @@ namespace Volian.Controls.Library
this._DisplayRTB.TabIndex = 2; this._DisplayRTB.TabIndex = 2;
this._DisplayRTB.Text = ""; this._DisplayRTB.Text = "";
this._DisplayRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.EDIT; this._DisplayRTB.VwMode = VEPROMS.CSLA.Library.E_ViewMode.EDIT;
this._DisplayRTB.Resize += new System.EventHandler(this.veRichTextBoxText_Resize);
this._DisplayRTB.Enter += new System.EventHandler(this.veRichTextBoxText_Enter); this._DisplayRTB.Enter += new System.EventHandler(this.veRichTextBoxText_Enter);
this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo); this._DisplayRTB.LinkGoTo += new Volian.Controls.Library.DisplayRTBLinkEvent(this._DisplayRTB_LinkGoTo);
this._DisplayRTB.Leave += new System.EventHandler(this.veRichTextBoxText_Leave); this._DisplayRTB.Leave += new System.EventHandler(this.veRichTextBoxText_Leave);

View File

@ -36,22 +36,14 @@ namespace Volian.Controls.Library
Dock = DockStyle.Fill; Dock = DockStyle.Fill;
dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
_MyPages = new Dictionary<string, DisplayTabItem>(); _MyPages = new Dictionary<string, DisplayTabItem>();
//dotNetBarManager1.DockTabClosing += new DevComponents.DotNetBar.DockTabClosingEventHandler(dotNetBarManager1_DockTabClosing);
//_MyBar.DockTabControl.CloseButtonOnTabsAlwaysDisplayed = true;
SetupBar(_MyBar); SetupBar(_MyBar);
dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff); dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff);
} }
void dotNetBarManager1_BarTearOff(object sender, EventArgs e) void dotNetBarManager1_BarTearOff(object sender, EventArgs e)
{ {
Bar myBar = sender as Bar; Bar myBar = sender as Bar;
//SetupBar(myBar);
myBar.Enter += new EventHandler(myBar_Enter); myBar.Enter += new EventHandler(myBar_Enter);
} }
//private void ShowPG(object myObject)
//{
//frmPropGridTest tmp = new frmPropGridTest(myObject);
//tmp.Show();
//}
private void SetupBar(Bar myBar) private void SetupBar(Bar myBar)
{ {
if (myBar.DockTabControl != null) if (myBar.DockTabControl != null)
@ -60,31 +52,39 @@ namespace Volian.Controls.Library
myBar.DockTabControl.CloseButtonVisible = false; myBar.DockTabControl.CloseButtonVisible = false;
myBar.DockTabControl.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right; myBar.DockTabControl.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right;
myBar.DockTabControl.Width = ClientRectangle.Width; myBar.DockTabControl.Width = ClientRectangle.Width;
//ShowPG(myBar);
//ShowPG(myBar.DockTabControl);
} }
myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing); myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing);
if (!myBar.Visible) if (!myBar.Visible)
myBar.Visible = true; myBar.Visible = true;
myBar.RecalcLayout(); myBar.RecalcLayout();
} }
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);
} }
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); _RemovedItems.Add((DisplayTabItem)e.DockContainerItem);
//RemoveItem((DisplayTabItem)e.DockContainerItem); DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem;
if (myTabItem != null)
{
if (myTabItem.MyDSOTabPanel != null)
{
myTabItem.MyDSOTabPanel.CloseDSO();
}
}
if (((Bar)sender).Items.Count == 1)// Remove bar if last item is closed... if (((Bar)sender).Items.Count == 1)// Remove bar if last item is closed...
{ {
dotNetBarManager1.Bars.Remove((Bar)sender); Bar bar = sender as Bar;
ActivateRemainingTab(); if (bar != null)
{
if(dotNetBarManager1.Bars.Contains(bar.Name))
dotNetBarManager1.Bars.Remove(bar);
ActivateRemainingTab();
}
} }
} }
private void ActivateRemainingTab() private void ActivateRemainingTab()
@ -93,39 +93,16 @@ namespace Volian.Controls.Library
{ {
if (myBar.DockSide == eDockSide.Document && myBar.Visible) if (myBar.DockSide == eDockSide.Document && myBar.Visible)
{ {
myBar.SelectedDockContainerItem.Selected = true; if (myBar.SelectedDockContainerItem != null)
{
myBar.SelectedDockContainerItem.Selected = true;
}
} }
} }
// No Document Tabs Remaining - need to raise OnItemSelectedChanged // No Document Tabs Remaining - need to raise OnItemSelectedChanged
OnItemSelectedChanged(this, null); OnItemSelectedChanged(this, null);
} }
private Bar GetFirstDocumentBar() private int _UniqueBarCount;
{
foreach (Bar b in dotNetBarManager1.Bars)
{
if (b.DockSide == eDockSide.Document && b.Visible)
return b;
}
// If no documents bars found, create new one
//_UniqueBarCount++;
Bar bar = BarUtilities.CreateDocumentBar();
//bar.DockTabClosing += new DockTabClosingEventHandler(DocumentBar_DockTabClosing);
//bar.Name = "barDocuments" + m_UniqueBarCount.ToString();
fillDocDockSite.GetDocumentUIManager().Dock(bar);
SetupBar(bar);
return bar;
}
//void dotNetBarManager1_DockTabClosing(object sender, DevComponents.DotNetBar.DockTabClosingEventArgs e)
//{
// e.RemoveDockTab = true;
// _RemovedItems.Add((DisplayTabItem)e.DockContainerItem);
// //RemoveItem((DisplayTabItem)e.DockContainerItem);
// if (((Bar)sender).Items.Count == 1) // Remove bar if last item is closed...
// dotNetBarManager1.Bars.Remove((Bar)sender);
//}
public DevComponents.DotNetBar.Bar MyBar public DevComponents.DotNetBar.Bar MyBar
{ {
get { return _MyBar; } get { return _MyBar; }
@ -136,16 +113,19 @@ namespace Volian.Controls.Library
set set
{ {
if (value != null) if (value != null)
{
value.Focus();
value.Selected = true; value.Selected = true;
}
} }
} }
public DisplayTabItem OpenItem(ItemInfo myItem) public DisplayTabItem OpenItem(ItemInfo myItem)
{ {
while (_RemovedItems.Count > 0) while (_RemovedItems.Count > 0)
{ {
DisplayTabItem tabItem = _RemovedItems[0]; DisplayTabItem myTabItem = _RemovedItems[0];
_RemovedItems.RemoveAt(0); _RemovedItems.RemoveAt(0);
RemoveItem(tabItem); RemoveItem(myTabItem);
} }
_MyBar = GetParentBar(myItem); _MyBar = GetParentBar(myItem);
if (myItem.MyContent.MyEntry == null) if (myItem.MyContent.MyEntry == null)
@ -153,7 +133,6 @@ namespace Volian.Controls.Library
else else
return OpenDSOTabPage(myItem); return OpenDSOTabPage(myItem);
} }
private Bar GetParentBar(ItemInfo myItem) private Bar GetParentBar(ItemInfo myItem)
{ {
Bar myBar = null; Bar myBar = null;
@ -161,23 +140,23 @@ namespace Volian.Controls.Library
{ {
if (b.DockSide == eDockSide.Document && b.Visible) if (b.DockSide == eDockSide.Document && b.Visible)
{ {
myBar = b; if(myBar == null)myBar = b;
foreach (object itm in myBar.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.MyTabPanel != null)
if (myTabItem.MyTabPanel.MyItem.ItemID == myItem.MyProcedure.ItemID) if (myTabItem.MyTabPanel.MyItem.ItemID == myItem.MyProcedure.ItemID)
return myBar; return b;
} }
} }
} }
if (myBar == null) if (myBar == null)
{ {
// If no documents bars found, create new one // If no documents bars found, create new one
//_UniqueBarCount++; _UniqueBarCount++;
myBar = BarUtilities.CreateDocumentBar(); myBar = BarUtilities.CreateDocumentBar();
//bar.DockTabClosing += new DockTabClosingEventHandler(DocumentBar_DockTabClosing); myBar.DockTabClosing +=new DockTabClosingEventHandler(myBar_DockTabClosing);
//bar.Name = "barDocuments" + m_UniqueBarCount.ToString(); myBar.Name = "barDocuments" + _UniqueBarCount.ToString();
fillDocDockSite.GetDocumentUIManager().Dock(myBar); fillDocDockSite.GetDocumentUIManager().Dock(myBar);
SetupBar(myBar); SetupBar(myBar);
} }
@ -192,15 +171,14 @@ namespace Volian.Controls.Library
{ {
pg = _MyPages[key]; pg = _MyPages[key];
pg.Selected = true; pg.Selected = true;
//SelectedTab = pg; SelectedTab = pg;
} }
else else
{ {
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
//_MyBar.Items.Add(pg);
_MyPages.Add(key, pg); _MyPages.Add(key, pg);
pg.Selected = true; pg.Selected = true;
//SelectedTab = pg; SelectedTab = pg;
pg.MyTabPanel.MyItem = proc; pg.MyTabPanel.MyItem = proc;
} }
Application.DoEvents(); Application.DoEvents();
@ -216,8 +194,10 @@ namespace Volian.Controls.Library
{ {
_MyPages.Remove(myItem.MyKey); _MyPages.Remove(myItem.MyKey);
// Can I dispose the Panel // Can I dispose the Panel
myItem.MyTabPanel.Dispose(); if(myItem.MyTabPanel!=null)
//myItem.Name = null; myItem.MyTabPanel.Dispose();
if (myItem.MyDSOTabPanel != null)
myItem.MyDSOTabPanel.CloseDSO();
components.Remove(myItem); components.Remove(myItem);
myItem.Dispose(); myItem.Dispose();
} }
@ -230,6 +210,11 @@ namespace Volian.Controls.Library
pg = _MyPages[key]; pg = _MyPages[key];
else else
{ {
if (DSOTabPanel.Count > 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 pg = new DisplayTabItem(this.components, this, myItem,key); // Open a new Procedure Tab
_MyPages.Add(key, pg); _MyPages.Add(key, pg);
} }

View File

@ -12,6 +12,12 @@ namespace Volian.Controls.Library
{ {
private DisplayTabControl _MyTabControl; private DisplayTabControl _MyTabControl;
private ItemInfo _MyItem; private ItemInfo _MyItem;
public ItemInfo MyItem
{
get { return _MyItem; }
set { _MyItem = value; }
}
private DisplayTabPanel _MyTabPanel; private DisplayTabPanel _MyTabPanel;
private string _MyKey; private string _MyKey;
public string MyKey public string MyKey
@ -24,6 +30,11 @@ namespace Volian.Controls.Library
set { _MyTabPanel = value; } set { _MyTabPanel = value; }
} }
private DSOTabPanel _MyDSOTabPanel; private DSOTabPanel _MyDSOTabPanel;
public DSOTabPanel MyDSOTabPanel
{
get { return _MyDSOTabPanel; }
set { _MyDSOTabPanel = value; }
}
public ItemInfo ItemSelected public ItemInfo ItemSelected
{ {
get { return _MyTabPanel.ItemSelected; } get { return _MyTabPanel.ItemSelected; }
@ -41,9 +52,7 @@ namespace Volian.Controls.Library
SetupDisplayPanel(); SetupDisplayPanel();
else else
SetupDSOPanel(); SetupDSOPanel();
this.Disposed+=new EventHandler(DisplayTabItem_Disposed); Name = string.Format("DisplayTabItem {0}", myItem.ItemID);
//_MyTabPanel.HandleDestroyed += new EventHandler(_MyTabPanel_HandleDestroyed);
//_MyTabPanel.Disposed += new EventHandler(_MyTabPanel_Disposed);
} }
void DisplayTabItem_Click(object sender, EventArgs e) void DisplayTabItem_Click(object sender, EventArgs e)
{ {
@ -54,18 +63,6 @@ namespace Volian.Controls.Library
if(myTabPanel == null) return; if(myTabPanel == null) return;
_MyTabControl.OnItemSelectedChanged(this,new DisplayPanelEventArgs(MyTabPanel.SelectedItem,null)); _MyTabControl.OnItemSelectedChanged(this,new DisplayPanelEventArgs(MyTabPanel.SelectedItem,null));
} }
//void _MyTabPanel_Disposed(object sender, EventArgs e)
//{
// Console.WriteLine("_MyTabPanel_Disposed");
//}
//void _MyTabPanel_HandleDestroyed(object sender, EventArgs e)
//{
// Console.WriteLine("_MyTabPanel_HandleDestroyed");
//}
void DisplayTabItem_Disposed(object sender, EventArgs e)
{
Console.WriteLine("DisplayTabItem_Disposed");
}
private void SetupDisplayPanel() private void SetupDisplayPanel()
{ {
((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).BeginInit();
@ -81,14 +78,12 @@ namespace Volian.Controls.Library
// //
_MyTabControl.Controls.Add(_MyTabPanel); _MyTabControl.Controls.Add(_MyTabPanel);
_MyTabControl.MyBar.Items.Add(this); _MyTabControl.MyBar.Items.Add(this);
// TODO: Cleanup _MyTabControl.Tabs.Add(this);
// //
// tabPanel // tabPanel
// //
_MyTabPanel.TabItem = this; _MyTabPanel.TabItem = this;
((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(_MyTabControl.MyBar)).EndInit();
_MyTabControl.MyBar.ResumeLayout(false); _MyTabControl.MyBar.ResumeLayout(false);
//_MyTabPanel.MyItem = _MyItem;
} }
private void SetupDSOPanel() private void SetupDSOPanel()
{ {
@ -110,7 +105,6 @@ namespace Volian.Controls.Library
// //
_MyTabControl.SelectedTab = this; _MyTabControl.SelectedTab = this;
_MyDSOTabPanel.TabItem = this; _MyDSOTabPanel.TabItem = this;
//_MyTabControl.SetToolTip(this, "Header", "Footer", "Body");
} }
} }
} }