public void ShowPropertiesWindow() { if (mPropertiesToolWindowInfo != null) { if (!mPropertiesToolWindowInfo.IsDisposed) { return; } } PropertiesToolWindow window = new PropertiesToolWindow(this); mPropertiesToolWindowInfo = AddToolWindow(window); mPropertiesToolWindowInfo.ShowContextMenuButton = false; if (mPackExplorerToolWindowInfo != null) { if (!mPackExplorerToolWindowInfo.IsDisposed) { mDockContainer.DockForm(mPropertiesToolWindowInfo, mPackExplorerToolWindowInfo, DockStyle.Bottom, zDockMode.Inner); return; } } mDockContainer.DockForm(mPropertiesToolWindowInfo, DockStyle.Right, zDockMode.Inner); }
void Initialize() { // Start Page Form SPF = (StartPageForm)FormCreator(FormStyle.StartPage, 0, 0, 725, 390, this.BackColor, "Start Page"); DFI01 = DockContainer01Panel.Add(SPF, zAllowedDock.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d001")); DFI01.ShowContextMenuButton = false; //DFI01.ShowCloseButton = false; DFI01.ShowFormAutoPanel(); DockContainer01Panel.DockForm(DFI01, DockStyle.Fill, zDockMode.Inner); //Details Form DF = (DetailsForm)FormCreator(FormStyle.Details, 0, 0, 300, 300, this.BackColor, "Details View"); DFI03 = DockContainer01Panel.Add(DF, zAllowedDock.All, new Guid("096b52a7-5f4b-44ee-ab77-9830ec717002")); DFI03.ShowContextMenuButton = true; DockContainer01Panel.DockForm(DFI03, DockStyle.Right, zDockMode.Inner); //Histogram Form HF = (HistogramForm)FormCreator(FormStyle.Histogram, 0, 0, 300, 300, Color.White, "Histogram View"); DFI02 = DockContainer01Panel.Add(HF, zAllowedDock.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d001")); DFI02.ShowContextMenuButton = true; DockContainer01Panel.DockForm(DFI02, DFI03, DockStyle.Bottom, zDockMode.Outer); //Paint Handle Form //PHF = (PaintHandlerForm)FormCreator(FormStyle.PaintHandleForm, 0, 0, 725, 390, Color.FromArgb(45, 45, 48), "Untiteled"); //DFI04 = DockContainer01Panel.Add(PHF, zAllowedDock.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d001")); //DFI04.ShowContextMenuButton = false; //DockContainer01Panel.DockForm(DFI04, DFI01, DockStyle.Fill, zDockMode.Inner); }
/// <summary> /// Add form to guider /// </summary> /// <param name="form">form to guide</param> /// <param name="allowedDock">allowed dock</param> /// <param name="formIdentifier">identifier of the form added</param> /// <returns>object that encapsulates relevant information for the guided form</returns> public DockableFormInfo Add(Form form, DockAllowed allowedDock, Guid formIdentifier) { if (GetFormInfo(form) != null) { throw new ArgumentException("Err"); } // Should set the border as None to prevent Microsoft bug in TextBox: // TextBox on Form with TopLevel = False and FormBorderStyle != None doesn't process Click event form.FormBorderStyle = FormBorderStyle.None; Rectangle bounds = form.Bounds; DockableFormInfo info = new DockableFormInfo(form, allowedDock, formIdentifier); info.ExplicitDisposing += OnInfoDisposing; info.SelectedChanged += OnFormSelectedChanged; info.ShowAutoPanel += OnShowFormAutoPanel; _dockableForms.Add(info); FormsTabbedView view = CreateFormsTabbedView(bounds.Size, null); view.Add(info); _layout.CreateFloatingContainer(view, bounds); return(info); }
private void Intialize() { _svgMainFiles = new WorkArea(); _svgMainFiles.PageChanged += OnPageSelectionChanged; _svgMainFiles.ToolDone += OnToolDone; _svgMainFiles.ItemsSelected += SvgMainFilesItemsSelected; _toolBox = new ToolBox { Size = new Size(113, 165) }; _toolBox.ToolSelectionChanged += ToolSelectionChanged; _svgProperties = new WorkSpaceControlBox(); _svgProperties.ZoomChange += OnZoomChanged; _svgProperties.GridOptionChange += GridOptionChaged; _svgProperties.WorkAreaOptionChange += SvgPropertiesWorkAreaOptionChange; _infoFilesMain = _docker.Add(_svgMainFiles, zAllowedDock.Fill, new Guid("b6e1e171-d1e0-47cd-a683-5937b682cde9")); _infoFilesMain.ShowCloseButton = false; _infoToolbar = _docker.Add(_toolBox, zAllowedDock.All, new Guid("b6e1e171-d1e0-47cd-a683-5937b682cde9")); _infoToolbar.ShowCloseButton = false; _infoDocumentProperties = _docker.Add(_svgProperties, zAllowedDock.All, new Guid("b6e1e171-d1e0-47cd-a683-5937b682cde9")); _infoDocumentProperties.ShowCloseButton = false; _shapeProperties = new shapeProperties(); _shapeProperties.PropertyChanged += ShapePropertiesPropertyChanged; _infoShapeProperties = _docker.Add(_shapeProperties, zAllowedDock.All, new Guid("b6e1e171-d1e0-47cd-a683-5937b682cde9")); _infoShapeProperties.ShowCloseButton = false; }
/// <summary> /// Occurs when tab button is removed /// </summary> /// <param name="button">button removed</param> protected override void OnButtonRemoved(UnitButton button) { Form page = (Form)button.Page; page.FormClosing -= OnPageClosing; page.FormClosed -= OnPageClosed; page.ParentChanged -= OnPageParentChanged; PagesPanel.Remove(page); DockableFormInfo info = null; for (int index = _cachedInfos.Count - 1; index >= 0; index--) { if (_cachedInfos[index].Button == button) { info = _cachedInfos[index]; _cachedInfos.RemoveAt(index); info.ExplicitDisposing -= OnInfoDisposing; info.SelectedChanged -= OnInfoSelectedChanged; break; } } EventHandler <FormEventArgs> handler = FormRemoved; if (handler != null) { FormEventArgs args = new FormEventArgs(page, info.Id); handler(this, args); } }
/// <summary> /// Set the height of a form docked: top or bottom or fill /// </summary> /// <param name="info">info identifing the form</param> /// <param name="newHeight">new height value</param> public void SetHeight(DockableFormInfo info, int newHeight) { int delta = newHeight - info.DockableForm.Height; if (delta == 0) { return; } DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm); List <DockingContainer> hierarchy = new List <DockingContainer>(); List <int> modifiers = new List <int>(); hierarchy.Add(container); modifiers.Add(delta); DockingContainer containerParent = container.Parent as DockingContainer; while (containerParent != null) { hierarchy.Add(containerParent); modifiers.Add(containerParent.Height - container.Height + delta); container = containerParent; containerParent = containerParent.Parent as DockingContainer; } for (int index = hierarchy.Count - 1; index >= 0; index--) { hierarchy[index].Height += modifiers[index]; } }
/// <summary> /// Add a new tab page /// </summary> /// <param name="pageInfo">tab page info</param> public void Add(DockableFormInfo pageInfo) { if (pageInfo.AllowedDock != AllowedDock && AllowedDock != DockAllowed.Unknown) { throw new InvalidOperationException("Err"); } pageInfo.DockableForm.SetBounds(-15000, 0, PagesPanel.Width, PagesPanel.Height); pageInfo.DockableForm.Dock = DockStyle.None; PagesPanel.Add(pageInfo.DockableForm); _cachedInfos.Add(pageInfo); pageInfo.ExplicitDisposing += OnInfoDisposing; pageInfo.SelectedChanged += OnInfoSelectedChanged; pageInfo.HostContainerDock = HostContainerDock; pageInfo.DockableForm.FormClosing += OnPageClosing; pageInfo.DockableForm.FormClosed += OnPageClosed; pageInfo.DockableForm.ParentChanged += OnPageParentChanged; AddButton(pageInfo.Button); IsFocused = true; }
private void Intialize() { _svgMainFiles = new WorkArea(); _svgMainFiles.PageChanged += OnPageSelectionChanged; _svgMainFiles.ToolDone += OnToolDone; _svgMainFiles.ItemsSelected += SvgMainFilesItemsSelected; _toolBox = new ToolBox { Size = new Size(113, 165) }; _toolBox.ToolSelectionChanged += ToolSelectionChanged; _svgProperties = new WorkSpaceControlBox(); _svgProperties.ZoomChange += OnZoomChanged; _svgProperties.GridOptionChange += GridOptionChaged; _svgProperties.WorkAreaOptionChange += SvgPropertiesWorkAreaOptionChange; _infoFilesMain = _docker.Add(_svgMainFiles, zAllowedDock.Fill, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d001")); _infoFilesMain.ShowCloseButton = false; _infoToolbar = _docker.Add(_toolBox, zAllowedDock.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d002")); _infoToolbar.ShowCloseButton = false; _infoDocumentProperties = _docker.Add(_svgProperties, zAllowedDock.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d003")); _infoDocumentProperties.ShowCloseButton = false; _shapeProperties = new shapeProperties(); _shapeProperties.PropertyChanged += ShapePropertiesPropertyChanged; _infoShapeProperties = _docker.Add(_shapeProperties, zAllowedDock.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d004")); _infoShapeProperties.ShowCloseButton = false; }
/// <summary> /// Occurs when info is selected /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arguments</param> private void OnInfoSelectedChanged(object sender, EventArgs e) { DockableFormInfo info = (DockableFormInfo)sender; if (info.IsSelected) { SelectedIndex = GetPageIndex(info.DockableForm); } }
/// <summary> /// Remove the form /// </summary> /// <param name="info">info about form to remove</param> public void Remove(DockableFormInfo info) { if (info == null) { return; } FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm); if (view != null) { if (view.Count == 1 && view.IsDocked) { _layout.Undock(view); } if (view.Count == 1) { _host.Remove(view.Parent); DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm); container.SetModeEmpty(); view.Remove(info); } else { if (view.Remove(info) == false) { if (SelectedFormInfo == info) { SelectedFormInfo = null; } return; } } } if (SelectedFormInfo == info) { SelectedFormInfo = null; } _dockableForms.Remove(info); info.SelectedChanged -= OnFormSelectedChanged; info.ShowAutoPanel -= OnShowFormAutoPanel; info.ExplicitDisposing -= OnInfoDisposing; if (info.IsAutoHideMode) { _autohide.ArrangeAutoButtonsPanels(); } info.Dispose(); }
private void ViewForm2_Click(object sender, EventArgs e) { if (insertToolStripMenuItem.Checked) { f2 = dockContainer1.Add(new Form2(), zAllowedDock.Left, new Guid("00000000-0000-0000-0000-000000000002")); } else { dockContainer1.Remove(f2); } }
/// <summary> /// Set auto-hide mode /// </summary> /// <param name="info">info of the form to set</param> /// <param name="autoHide">flag indicating if should set auto-hide (true) or unset it</param> public void SetAutoHide(DockableFormInfo info, bool autoHide) { if (autoHide && info.IsAutoHideMode == false) { _autohide.SetAutoHideMode(HierarchyUtility.GetTabbedView(info.DockableForm)); } else if (autoHide == false && info.IsAutoHideMode) { _autohide.UnsetAutoHideMode(HierarchyUtility.GetTabbedView(info.DockableForm)); } }
/// <summary> /// Occurs when tab button is added /// </summary> /// <param name="button">button added</param> protected override void OnButtonAdded(UnitButton button) { EventHandler <FormEventArgs> handler = FormAdded; if (handler != null) { DockableFormInfo info = GetPageInfo((Form)button.Page); FormEventArgs args = new FormEventArgs(info.DockableForm, info.Id); handler(this, args); } }
/// <summary> /// Occurs when pages context menu button was clicked /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arguments</param> private void OnPagesContextMenuClick(object sender, EventArgs e) { EventHandler <FormEventArgs> handler = ContextMenuClick; if (handler != null) { DockableFormInfo info = GetPageInfo(PagesPanel.GetFormAt(SelectedIndex)); FormEventArgs args = new FormEventArgs(info.DockableForm, info.Id); handler(this, args); } }
private void ViewForm3_Click(object sender, EventArgs e) { if (foToolStripMenuItem.Checked) { f3 = dockContainer1.Add(F3, zAllowedDock.Right, new Guid("00000000-0000-0000-0000-000000000003")); //dockContainer1.SetAutoHide(dockContainer1.GetFormInfo(f3.Id),true); } else { dockContainer1.Remove(f3); } }
/// <summary> /// Dock a form previously added to guider over another form previously added to guider /// </summary> /// <param name="info">info about the form to dock</param> /// <param name="infoOver">info about form over which to dock</param> /// <param name="dock">how to dock</param> /// <param name="mode">were to dock</param> public void DockOver(DockableFormInfo info, DockableFormInfo infoOver, DockStyle dock, DockableMode mode) { DockingContainer containerToDock = HierarchyUtility.GetClosestDockableContainer(info.DockableForm); DockingContainer containerWhereToDock = null; if (infoOver != null) { containerWhereToDock = HierarchyUtility.GetClosestDockableContainer(infoOver.DockableForm); } _layout.DockControl(containerToDock, containerWhereToDock, dock, mode); }
/// <summary> /// Occurs after selected index was set /// </summary> /// <param name="e">event argument</param> protected override void OnSelectedIndexSet(EventArgs e) { DockableFormInfo info = GetPageInfoAt(SelectedIndex); if (info != null) { info.IsSelected = true; SelectedForm = info.DockableForm; } Invalidate(); base.OnSelectedIndexSet(e); }
/// <summary> /// Occurs when the page is closing /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnPageClosing(object sender, FormClosingEventArgs e) { EventHandler <DockableFormClosingEventArgs> handler = FormClosing; if (handler != null) { DockableFormInfo info = GetPageInfo((Form)sender); DockableFormClosingEventArgs args = new DockableFormClosingEventArgs(info.DockableForm, info.Id); args.Cancel = false; handler(this, args); e.Cancel = args.Cancel; } }
/// <summary> /// Apply select /// </summary> public override void Apply() { Hide(); if (SelectedIndex >= 0 && SelectedIndex < Forms.Length) { DockableFormInfo info = Forms[SelectedIndex]; info.IsSelected = true; if (info.IsAutoHideMode) { info.ShowFormAutoPanel(); } } }
private void Intialize() { _svgMainFiles = new WorkArea(); _svgMainFiles.PageChanged += OnPageSelectionChanged; _svgMainFiles.ToolDone += OnToolDone; _svgMainFiles.ItemsSelected += SvgMainFilesItemsSelected; _toolBox = new ToolBox { Size = new Size(113, 165) }; _toolBox.ToolSelectionChanged += ToolSelectionChanged; _svgProperties = new WorkSpaceControlBox(); _svgProperties.ZoomChange += OnZoomChanged; _svgProperties.GridOptionChange += GridOptionChaged; _svgProperties.WorkAreaOptionChange += SvgPropertiesWorkAreaOptionChange; _infoFilesMain = _docker.Add(_svgMainFiles, DockAllowed.Fill, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d001")); _infoFilesMain.ShowCloseButton = false; _infoToolbar = _docker.Add(_toolBox, DockAllowed.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d002")); _infoToolbar.ShowCloseButton = false; _infoDocumentProperties = _docker.Add(_svgProperties, DockAllowed.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d003")); _infoDocumentProperties.ShowCloseButton = false; _shapeProperties = new ShapeProperties(); _shapeProperties.PropertyChanged += ShapePropertiesPropertyChanged; _infoShapeProperties = _docker.Add(_shapeProperties, DockAllowed.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d004")); _infoShapeProperties.ShowCloseButton = false; //2019.7.30添加时间timer 用于tick timer.Interval = 35; timer.Tick += new EventHandler(Tick); timer.Enabled = true; _modelBox = new ModelBox(); _infoModelbar = _docker.Add(_modelBox, DockAllowed.All, new Guid("a6402b80-2ebd-4fd3-8930-024a6201d005")); _infoModelbar.ShowCloseButton = false; _modelBox.ToolSelectionChanged += ToolSelectionChanged; TestInit(); }
/// <summary> /// Occurs when the page is closed /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnPageClosed(object sender, FormClosedEventArgs e) { DockableFormInfo info = GetPageInfo((Form)sender); Guid id = info.Id; Form form = info.DockableForm; UnitButton button = GetButton(form); button.Dispose(); EventHandler <FormEventArgs> handler = FormClosed; if (handler != null) { FormEventArgs args = new FormEventArgs(form, id); handler(this, args); } }
public DockableFormInfo[] GetAllToolWindows() { List <DockableFormInfo> dfis = new List <DockableFormInfo>(); for (int i = 0; i < mDockContainer.Count; i++) { DockableFormInfo dfi = mDockContainer.GetFormInfoAt(i); if (dfi.IsDisposed) { continue; } dfis.Add(dfi); } return(dfis.ToArray()); }
/// <summary> /// Undock view /// </summary> /// <param name="view">view to undock</param> /// <param name="hintBounds">hint bounds</param> private void Undock(Form formToUndock, Rectangle hintBounds) { FormsTabbedView view = HierarchyUtility.GetTabbedView(formToUndock); if (view.Count == 1) { _layout.Undock(view, hintBounds); } else { DockableFormInfo info = GetFormInfo(formToUndock); FormsTabbedView newView = CreateFormsTabbedView(info.DockableForm.Size, null); newView.Add(info); _layout.CreateFloatingContainer(newView, hintBounds); } }
private void AddLevelWindow(Level level) { LevelToolWindow ltw = new LevelToolWindow(this, level); DockableFormInfo dfi = AddToolWindow(ltw); DockableFormInfo oldfi = mDockContainer.GetFormInfo(mLastFocusedLevel); if (oldfi == null) { mDockContainer.DockForm(dfi, DockStyle.Fill, zDockMode.Inner); } else { mDockContainer.DockForm(dfi, oldfi, DockStyle.Fill, zDockMode.Inner); } mLevelToolWindowInfos.Add(dfi); mLastFocusedLevel = ltw; }
private static void DockUndockForm(DockContainer dockContainer, Form form, Guid guid) { DockableFormInfo formInfo = dockContainer.GetFormInfo(guid); //Add if (formInfo == null) { formInfo = dockContainer.Add(form, zAllowedDock.All, guid); dockContainer.DockForm(formInfo, DockStyle.Left, zDockMode.Inner); } //Remove else { Form dummy = formInfo.DockableForm; dockContainer.Undock(formInfo, new Rectangle(Point.Empty, new Size(100, 300))); dockContainer.Remove(formInfo); dummy.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; dummy.TopLevel = true; } }
/// <summary> /// Move all the pages to given view /// </summary> /// <param name="view">view where to move the pages</param> /// <returns>moved pages</returns> public DockableFormInfo[] MovePagesTo(FormsTabbedView view) { List <DockableFormInfo> movedPages = new List <DockableFormInfo>(); if (view == this) { return(movedPages.ToArray()); } for (int index = _cachedInfos.Count - 1; index >= 0; index--) { DockableFormInfo info = _cachedInfos[index]; Remove(info); view.Add(info); movedPages.Add(info); } return(movedPages.ToArray()); }
/// <summary> /// Occurs when IsSelected property of a form is changed /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnFormSelectedChanged(object sender, EventArgs e) { DockableFormInfo info = (DockableFormInfo)sender; if (info.IsSelected) { SelectedFormInfo = info; } FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm); if (view != null) { if (view.SelectedForm != null) { DockableFormInfo topFormInfo = GetFormInfo(view.SelectedForm); view.PagesPanel.ShowCloseButton = topFormInfo.ShowCloseButton; view.PagesPanel.ShowContextMenuButton = topFormInfo.ShowContextMenuButton; } } }
public void ShowEntryListWindow() { if (mEntryListToolWindowInfo != null) { if (!mEntryListToolWindowInfo.IsDisposed) { return; } } EntryListToolWindow window = new EntryListToolWindow(this); mEntryListToolWindowInfo = AddToolWindow(window); mEntryListToolWindowInfo.ShowContextMenuButton = false; //if (mEntryListToolWindowInfo != null) { // if (!mEntryListToolWindowInfo.IsDisposed) { // mDockContainer.DockForm(mEntryListToolWindowInfo, DockStyle.Left, zDockMode.Outer); // } //} mDockContainer.DockForm(mEntryListToolWindowInfo, DockStyle.Left, zDockMode.Inner); }
/// <summary> /// Undock form /// </summary> /// <param name="info">info about form to undock</param> /// <param name="hintBounds">hint bounds</param> public void Undock(DockableFormInfo info, Rectangle hintBounds) { Undock(info.DockableForm, hintBounds); }
/// <summary> /// Remove an existing tab page /// </summary> /// <param name="pageInfo">page info to be removed</param> public bool Remove(DockableFormInfo pageInfo) { return(RemoveButton(pageInfo.Button)); }