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

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