From 68bac6858b66c38786b368fbdf75e230ab117033 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 25 Apr 2018 10:54:09 +0200 Subject: [PATCH] grid - some feedback wip --- .../parts/editor2/nextEditorGroupView.ts | 33 +++++++++++++------ .../browser/parts/editor2/nextEditorPart.ts | 15 +++++++-- .../editor/common/nextEditorPartService.ts | 2 ++ 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts b/src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts index 1dcf9a354b5..65957af9d91 100644 --- a/src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts @@ -35,6 +35,8 @@ export class NextEditorGroupView extends Themable implements IView { private group: EditorGroup; + private dimension: Dimension; + private _element: HTMLElement; private container: HTMLElement; @@ -52,6 +54,14 @@ export class NextEditorGroupView extends Themable implements IView { this.group.label = `Group <${this.group.id}>`; } + get id(): GroupIdentifier { + return this.group.id; + } + + get element(): HTMLElement { + return this._element; + } + openEditor(input: EditorInput, options?: EditorOptions): INextEditor { // Update model @@ -66,13 +76,7 @@ export class NextEditorGroupView extends Themable implements IView { return Object.create(null); // TODO@grid implement } - get element(): HTMLElement { - return this._element; - } - - get id(): GroupIdentifier { - return this.group.id; - } + //#region Themable Implementation protected updateStyles(): void { super.updateStyles(); @@ -92,6 +96,10 @@ export class NextEditorGroupView extends Themable implements IView { // TODO@grid Editor container border } + //#endregion + + //#region IView implementation + render(container: HTMLElement): void { // TODO@grid simplify containers by flattening the hierarchy more? @@ -138,9 +146,14 @@ export class NextEditorGroupView extends Themable implements IView { this.updateStyles(); } - layout(size: number, orientation: Orientation): void { + layout(size: number): void { + this.dimension = new Dimension(size, -1); // TODO@grid need full dimension here - // Layout title - // this.titleAreaControl.layout(new Dimension(size, NextEditorGroupView.EDITOR_TITLE_HEIGHT)); + // Layout title if present + if (this.titleAreaControl) { + this.titleAreaControl.layout(new Dimension(this.dimension.width, NextEditorGroupView.EDITOR_TITLE_HEIGHT)); + } } + + //#endregion } \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/editor2/nextEditorPart.ts b/src/vs/workbench/browser/parts/editor2/nextEditorPart.ts index 3255777a470..db6de286079 100644 --- a/src/vs/workbench/browser/parts/editor2/nextEditorPart.ts +++ b/src/vs/workbench/browser/parts/editor2/nextEditorPart.ts @@ -45,7 +45,7 @@ export class NextEditorPart extends Part implements INextEditorPartService { this._onLayout = this._register(new Emitter()); - this.createGrid(); + this.doCreateGridView(); } //#region Service Implementation @@ -62,6 +62,17 @@ export class NextEditorPart extends Part implements INextEditorPartService { return this._groups.get(identifier); } + // addGroup(index?: number): INextEditorGroup { + // const activeLocation = this.groupToLocation.get(this._activeGroup.id); + // const parentLocation = activeLocation.slice(0, activeLocation.length - 1); + + // if (typeof index !== 'number') { + // index = activeLocation[activeLocation.length - 1] + 1; + // } + + // return this.doCreateGroup([...parentLocation, index]); + // } + //#endregion //#region Grid Controller @@ -97,7 +108,7 @@ export class NextEditorPart extends Part implements INextEditorPartService { return this._onLayout.event; } - private createGrid(): void { + private doCreateGridView(): void { // Container this.gridContainer = document.createElement('div'); diff --git a/src/vs/workbench/services/editor/common/nextEditorPartService.ts b/src/vs/workbench/services/editor/common/nextEditorPartService.ts index 9e4a70b3011..d1c79f6b3ff 100644 --- a/src/vs/workbench/services/editor/common/nextEditorPartService.ts +++ b/src/vs/workbench/services/editor/common/nextEditorPartService.ts @@ -40,5 +40,7 @@ export interface INextEditorPartService { readonly activeGroup: INextEditorGroup; readonly groups: INextEditorGroup[]; + // addGroup(group: GroupIdentifier, direction: SplitDirection): INextEditorGroup; + getGroup(identifier: GroupIdentifier): INextEditorGroup; } \ No newline at end of file -- GitLab