Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Feature dockpanel refactor #155

Merged
merged 71 commits into from
Nov 3, 2016
Merged

Feature dockpanel refactor #155

merged 71 commits into from
Nov 3, 2016

Conversation

sccolbert
Copy link
Member

@sccolbert sccolbert commented Nov 3, 2016

The API is largely the same.

Summary of breaking changes:

  • The layout-changed message has been replaced by an explicit call to layout.init().
  • EmptyIterator.instance is replaced with empty() for consistency with other iterators.
  • Removed the deactivate-request message and related methods/handlers.
  • Made removeWidget an abstract method on Layout.
  • The showOverlay and findDropTarget methods of DockPanel are now private.
  • The zone property of the IOverlayGeometry interface has been removed.

Summary of additions:

  • New iterators: once, repeat, and chain.
  • Acontains iterator search function.
  • Public functionality in the box engine for adjusting a sizer.
  • Added the tabActivateRequested signal to TabBar.
  • New DockLayout class.
  • The DockPanel now accepts an IRenderer for creating tab bars and handles.
  • There are new methods on DockPanel for creating iterators over widgets, tab bars, and handles.

Summary of behavioral changes:

  • There is now a drop zone on top of the tab bars.
  • There is no more center drop zone on a widget.
  • You must hold shift while dragging to activate the border drop zones.
  • Clicking on a tab now activates the widget, even if the tab is already current.

Summary of style-related changes:

  • The DockPanel is now flat. It has four subcontrols: p-DockPanel-tabBar, p-DockPanel-widget, p-DockPanel-handle, and p-DockPanel-overlay.
  • The old subcontrols p-DockPanel-tabPanel and p-DockPanel-splitPanel are gone.

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of all but the main dock panel file.

@@ -321,6 +330,8 @@ function main(): void {

Widget.attach(bar, document.body);
Widget.attach(main, document.body);

(window as any).dock = dock;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentionally left in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -617,6 +610,7 @@ class SplitLayout extends PanelLayout {
if (this.parent) this.parent.update();
}

// TODO rename this to `moveHandle`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these TODOs intended for another PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -655,21 +649,26 @@ class SplitLayout extends PanelLayout {

// Prevent widget resizing unless needed.
each(this._sizers, sizer => {
// TODO is this check actually necessary?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

*
* This signal is emitted even if the clicked tab is the current tab.
*/
tabActivateRequested: ISignal<TabBar, TabBar.ITabActivateRequestedArgs>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this signal also contained the original event (or at least the button and the client position), we could use it for #104.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to avoid emitting events as signals. The signal should have semantic meaning, rather than eventful meaning.

protected init(): void {
super.init();
let index = 0;
each(this, widget => { this.attachWidget(index++, widget); });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose not to use enumerate here? Performance?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

expect(layout.removeWidgetAt(0)).to.be(widget);
let layout = new LogPanelLayout();
widget.layout = layout;
expect(layout.methods.indexOf('init')).to.not.be(-1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(layout.methods).to.contain('init'); reads a little nicer.

let widgets = [new LogWidget(), new LogWidget(), new LogWidget()];
each(widgets, w => { layout.addWidget(w); });
parent.layout = layout;
expect(layout.methods.indexOf('init')).to.not.be(-1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto for this one and a few more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will save test cleanup for another PR

@sccolbert sccolbert merged commit bf3a069 into master Nov 3, 2016
@jasongrout
Copy link
Member

There is no more center drop zone on a widget.

I was just getting used to this. VS Code is nice in that it lets you either drag to a tab bar or drag to the middle. I've noticed it feels quite a bit faster to drag to the middle (once I got used to it...)

@sccolbert sccolbert deleted the feature-dockpanel-refactor branch February 15, 2017 02:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants