提交 ca76092b 编写于 作者: J Joao Moreno

delete Grid.View

上级 cfdc5898
......@@ -8,9 +8,7 @@ import { Orientation } from 'vs/base/browser/ui/sash/sash';
import { Disposable } from 'vs/base/common/lifecycle';
import { tail2 as tail, equals } from 'vs/base/common/arrays';
import { orthogonal, IView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize } from './gridview';
import { Event, Emitter } from 'vs/base/common/event';
import { $ } from 'vs/base/browser/dom';
import { LayoutPriority } from 'vs/base/browser/ui/splitview/splitview';
import { Event } from 'vs/base/common/event';
export { Orientation, Sizing as GridViewSizing } from './gridview';
......@@ -187,7 +185,7 @@ export interface IGridOptions {
proportionalLayout?: boolean;
}
export class Grid<T extends IView> extends Disposable {
export class Grid<T extends IView = IView> extends Disposable {
protected gridview: GridView;
private views = new Map<T, HTMLElement>();
......@@ -644,63 +642,3 @@ export function createSerializedGrid(gridDescriptor: GridDescriptor): ISerialize
height: height || 1
};
}
export class View implements IView {
readonly element = $('.grid-view-view');
private visible = false;
private width: number | undefined;
private height: number | undefined;
private orientation: Orientation = Orientation.HORIZONTAL;
get minimumWidth(): number { return this.visible ? this.view.minimumWidth : 0; }
get maximumWidth(): number { return this.visible ? this.view.maximumWidth : (this.orientation === Orientation.HORIZONTAL ? 0 : Number.POSITIVE_INFINITY); }
get minimumHeight(): number { return this.visible ? this.view.minimumHeight : 0; }
get maximumHeight(): number { return this.visible ? this.view.maximumHeight : (this.orientation === Orientation.VERTICAL ? 0 : Number.POSITIVE_INFINITY); }
private onDidChangeVisibility = new Emitter<{ width: number; height: number; } | undefined>();
readonly onDidChange: Event<{ width: number; height: number; } | undefined>;
get priority(): LayoutPriority | undefined { return this.view.priority; }
get snap(): boolean | undefined { return this.view.snap; }
constructor(private view: IView) {
this.show();
this.onDidChange = Event.any(this.onDidChangeVisibility.event, Event.filter(view.onDidChange, () => this.visible));
}
show(): void {
if (this.visible) {
return;
}
this.visible = true;
this.element.appendChild(this.view.element);
this.onDidChangeVisibility.fire(typeof this.width === 'number' ? { width: this.width, height: this.height! } : undefined);
}
hide(): void {
if (!this.visible) {
return;
}
this.visible = false;
this.element.removeChild(this.view.element);
this.onDidChangeVisibility.fire(undefined);
}
layout(width: number, height: number, orientation: Orientation): void {
this.orientation = orientation;
if (!this.visible) {
return;
}
this.view.layout(width, height, orientation);
this.width = width;
this.height = height;
}
}
\ No newline at end of file
......@@ -27,13 +27,14 @@ import { IWindowService, MenuBarVisibility, getTitleBarStyle } from 'vs/platform
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { Sizing, Direction, Grid, View } from 'vs/base/browser/ui/grid/grid';
import { Sizing, Direction, Grid } from 'vs/base/browser/ui/grid/grid';
import { WorkbenchLegacyLayout } from 'vs/workbench/browser/legacyLayout';
import { IDimension } from 'vs/platform/layout/browser/layoutService';
import { Part } from 'vs/workbench/browser/part';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
import { IFileService } from 'vs/platform/files/common/files';
import { IView } from 'vs/base/browser/ui/grid/gridview';
enum Settings {
MENUBAR_VISIBLE = 'window.menuBarVisibility',
......@@ -87,16 +88,16 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private parts: Map<string, Part> = new Map<string, Part>();
private workbenchGrid: Grid<View> | WorkbenchLegacyLayout;
private workbenchGrid: Grid | WorkbenchLegacyLayout;
private disposed: boolean;
private titleBarPartView: View;
private activityBarPartView: View;
private sideBarPartView: View;
private panelPartView: View;
private editorPartView: View;
private statusBarPartView: View;
private titleBarPartView: IView;
private activityBarPartView: IView;
private sideBarPartView: IView;
private panelPartView: IView;
private editorPartView: IView;
private statusBarPartView: IView;
private environmentService: IWorkbenchEnvironmentService;
private configurationService: IConfigurationService;
......@@ -701,12 +702,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
if (this.configurationService.getValue('workbench.useExperimentalGridLayout')) {
// Create view wrappers for all parts
this.titleBarPartView = new View(titleBar);
this.sideBarPartView = new View(sideBar);
this.activityBarPartView = new View(activityBar);
this.editorPartView = new View(editorPart);
this.panelPartView = new View(panelPart);
this.statusBarPartView = new View(statusBar);
this.titleBarPartView = titleBar;
this.sideBarPartView = sideBar;
this.activityBarPartView = activityBar;
this.editorPartView = editorPart;
this.panelPartView = panelPart;
this.statusBarPartView = statusBar;
this.workbenchGrid = new Grid(this.editorPartView, { proportionalLayout: false });
......@@ -789,52 +790,52 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
// Hide parts
if (this.state.panel.hidden) {
this.panelPartView.hide();
this.workbenchGrid.setViewVisible(this.panelPartView, false);
}
if (this.state.statusBar.hidden) {
this.statusBarPartView.hide();
this.workbenchGrid.setViewVisible(this.statusBarPartView, false);
}
if (!this.isVisible(Parts.TITLEBAR_PART)) {
this.titleBarPartView.hide();
if (titlebarInGrid && !this.isVisible(Parts.TITLEBAR_PART)) {
this.workbenchGrid.setViewVisible(this.titleBarPartView, false);
}
if (this.state.activityBar.hidden) {
this.activityBarPartView.hide();
this.workbenchGrid.setViewVisible(this.activityBarPartView, false);
}
if (this.state.sideBar.hidden) {
this.sideBarPartView.hide();
this.workbenchGrid.setViewVisible(this.sideBarPartView, false);
}
if (this.state.editor.hidden) {
this.editorPartView.hide();
this.workbenchGrid.setViewVisible(this.editorPartView, false);
}
// Show visible parts
if (!this.state.editor.hidden) {
this.editorPartView.show();
this.workbenchGrid.setViewVisible(this.editorPartView, true);
}
if (!this.state.statusBar.hidden) {
this.statusBarPartView.show();
this.workbenchGrid.setViewVisible(this.statusBarPartView, true);
}
if (this.isVisible(Parts.TITLEBAR_PART)) {
this.titleBarPartView.show();
this.workbenchGrid.setViewVisible(this.titleBarPartView, true);
}
if (!this.state.activityBar.hidden) {
this.activityBarPartView.show();
this.workbenchGrid.setViewVisible(this.activityBarPartView, true);
}
if (!this.state.sideBar.hidden) {
this.sideBarPartView.show();
this.workbenchGrid.setViewVisible(this.sideBarPartView, true);
}
if (!this.state.panel.hidden) {
this.panelPartView.show();
this.workbenchGrid.setViewVisible(this.panelPartView, true);
}
}
......
......@@ -59,6 +59,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
readonly maximumHeight: number = Number.POSITIVE_INFINITY;
readonly priority: LayoutPriority = LayoutPriority.Low;
readonly snap = true;
//#endregion
......
......@@ -47,6 +47,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
readonly maximumHeight: number = Number.POSITIVE_INFINITY;
readonly priority: LayoutPriority = LayoutPriority.Low;
readonly snap = true;
//#endregion
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册