mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -49,9 +49,10 @@ interface PartLayoutInfo {
|
||||
*/
|
||||
export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider {
|
||||
|
||||
private static sashXOneWidthSettingsKey = 'workbench.sidebar.width';
|
||||
private static sashXTwoWidthSettingsKey = 'workbench.panel.width';
|
||||
private static sashYHeightSettingsKey = 'workbench.panel.height';
|
||||
private static readonly sashXOneWidthSettingsKey = 'workbench.sidebar.width';
|
||||
private static readonly sashXTwoWidthSettingsKey = 'workbench.panel.width';
|
||||
private static readonly sashYHeightSettingsKey = 'workbench.panel.height';
|
||||
private static readonly panelSizeBeforeMaximizedKey = 'workbench.panel.sizeBeforeMaximized';
|
||||
|
||||
private parent: Builder;
|
||||
private workbenchContainer: Builder;
|
||||
@@ -108,7 +109,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
this.statusbar = parts.statusbar;
|
||||
this.quickopen = quickopen;
|
||||
this.toUnbind = [];
|
||||
this.panelSizeBeforeMaximized = 0;
|
||||
this.panelSizeBeforeMaximized = this.storageService.getInteger(WorkbenchLayout.panelSizeBeforeMaximizedKey, StorageScope.GLOBAL, 0);
|
||||
this.panelMaximized = false;
|
||||
|
||||
this.sashXOne = new Sash(this.workbenchContainer.getHTMLElement(), this, {
|
||||
@@ -236,27 +237,27 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
let startPanelHeight: number;
|
||||
let startPanelWidth: number;
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('start', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXOne.onDidStart((e: ISashEvent) => {
|
||||
startSidebarWidth = this.sidebarWidth;
|
||||
startX = e.startX;
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('start', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashY.onDidStart((e: ISashEvent) => {
|
||||
startPanelHeight = this.panelHeight;
|
||||
startY = e.startY;
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('start', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidStart((e: ISashEvent) => {
|
||||
startPanelWidth = this.panelWidth;
|
||||
startXTwo = e.startX;
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('change', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXOne.onDidChange((e: ISashEvent) => {
|
||||
let doLayout = false;
|
||||
let sidebarPosition = this.partService.getSideBarPosition();
|
||||
let isSidebarVisible = this.partService.isVisible(Parts.SIDEBAR_PART);
|
||||
let newSashWidth = (sidebarPosition === Position.LEFT) ? startSidebarWidth + e.currentX - startX : startSidebarWidth - e.currentX + startX;
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
|
||||
// Sidebar visible
|
||||
if (isSidebarVisible) {
|
||||
@@ -291,11 +292,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('change', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashY.onDidChange((e: ISashEvent) => {
|
||||
let doLayout = false;
|
||||
let isPanelVisible = this.partService.isVisible(Parts.PANEL_PART);
|
||||
let newSashHeight = startPanelHeight - (e.currentY - startY);
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
|
||||
// Panel visible
|
||||
if (isPanelVisible) {
|
||||
@@ -329,11 +330,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('change', (e: ISashEvent) => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidChange((e: ISashEvent) => {
|
||||
let doLayout = false;
|
||||
let isPanelVisible = this.partService.isVisible(Parts.PANEL_PART);
|
||||
let newSashWidth = startPanelWidth - (e.currentX - startXTwo);
|
||||
let promise = TPromise.as<void>(null);
|
||||
let promise = TPromise.wrap<void>(null);
|
||||
|
||||
// Panel visible
|
||||
if (isPanelVisible) {
|
||||
@@ -367,25 +368,25 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
}
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('end', () => {
|
||||
this.toUnbind.push(this.sashXOne.onDidEnd(() => {
|
||||
this.storageService.store(WorkbenchLayout.sashXOneWidthSettingsKey, this.sidebarWidth, StorageScope.GLOBAL);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('end', () => {
|
||||
this.toUnbind.push(this.sashY.onDidEnd(() => {
|
||||
this.storageService.store(WorkbenchLayout.sashYHeightSettingsKey, this.panelHeight, StorageScope.GLOBAL);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('end', () => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidEnd(() => {
|
||||
this.storageService.store(WorkbenchLayout.sashXTwoWidthSettingsKey, this.panelWidth, StorageScope.GLOBAL);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashY.addListener('reset', () => {
|
||||
this.toUnbind.push(this.sashY.onDidReset(() => {
|
||||
this.panelHeight = this.sidebarHeight * DEFAULT_PANEL_SIZE_COEFFICIENT;
|
||||
this.storageService.store(WorkbenchLayout.sashYHeightSettingsKey, this.panelHeight, StorageScope.GLOBAL);
|
||||
this.layout();
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXOne.addListener('reset', () => {
|
||||
this.toUnbind.push(this.sashXOne.onDidReset(() => {
|
||||
let activeViewlet = this.viewletService.getActiveViewlet();
|
||||
let optimalWidth = activeViewlet && activeViewlet.getOptimalWidth();
|
||||
this.sidebarWidth = optimalWidth || 0;
|
||||
@@ -393,7 +394,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
this.partService.setSideBarHidden(false).done(() => this.layout(), errors.onUnexpectedError);
|
||||
}));
|
||||
|
||||
this.toUnbind.push(this.sashXTwo.addListener('reset', () => {
|
||||
this.toUnbind.push(this.sashXTwo.onDidReset(() => {
|
||||
this.panelWidth = (this.workbenchSize.width - this.sidebarWidth - this.activitybarWidth) * DEFAULT_PANEL_SIZE_COEFFICIENT;
|
||||
this.storageService.store(WorkbenchLayout.sashXTwoWidthSettingsKey, this.panelWidth, StorageScope.GLOBAL);
|
||||
this.layout();
|
||||
@@ -501,6 +502,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
this.panelSizeBeforeMaximized = panelWidth;
|
||||
}
|
||||
}
|
||||
this.storageService.store(WorkbenchLayout.panelSizeBeforeMaximizedKey, this.panelSizeBeforeMaximized, StorageScope.GLOBAL);
|
||||
const panelDimension = new Dimension(panelWidth, panelHeight);
|
||||
|
||||
// Editor
|
||||
@@ -680,7 +682,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
return this.workbenchSize.width - this.sidebarWidth - this.activitybarWidth;
|
||||
}
|
||||
|
||||
return this.workbenchSize.width - this.panelWidth - (sidebarPosition === Position.RIGHT ? this.sidebarWidth + this.activitybarWidth : 0);
|
||||
return this.workbenchSize.width - (this.partService.isVisible(Parts.PANEL_PART) ? this.panelWidth : 0) - (sidebarPosition === Position.RIGHT ? this.sidebarWidth + this.activitybarWidth : 0);
|
||||
}
|
||||
|
||||
public getVerticalSashHeight(sash: Sash): number {
|
||||
@@ -710,7 +712,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
|
||||
// change part size along the main axis
|
||||
public resizePart(part: Parts, sizeChange: number): void {
|
||||
const visibleEditors = this.editorService.getVisibleEditors().length;
|
||||
const panelPosition = this.partService.getPanelPosition();
|
||||
const sizeChangePxWidth = this.workbenchSize.width * (sizeChange / 100);
|
||||
const sizeChangePxHeight = this.workbenchSize.height * (sizeChange / 100);
|
||||
|
||||
@@ -720,24 +722,37 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||
case Parts.SIDEBAR_PART:
|
||||
this.sidebarWidth = this.sidebarWidth + sizeChangePxWidth; // Sidebar can not become smaller than MIN_PART_WIDTH
|
||||
|
||||
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < visibleEditors * MIN_EDITOR_PART_WIDTH)) {
|
||||
this.sidebarWidth = (this.workbenchSize.width - visibleEditors * MIN_EDITOR_PART_WIDTH);
|
||||
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < this.editorCountForWidth * MIN_EDITOR_PART_WIDTH)) {
|
||||
this.sidebarWidth = (this.workbenchSize.width - this.editorCountForWidth * MIN_EDITOR_PART_WIDTH);
|
||||
}
|
||||
|
||||
doLayout = true;
|
||||
break;
|
||||
case Parts.PANEL_PART:
|
||||
this.panelHeight = this.panelHeight + sizeChangePxHeight;
|
||||
this.panelWidth = this.panelWidth + sizeChangePxWidth;
|
||||
if (panelPosition === Position.BOTTOM) {
|
||||
this.panelHeight = this.panelHeight + sizeChangePxHeight;
|
||||
} else if (panelPosition === Position.RIGHT) {
|
||||
this.panelWidth = this.panelWidth + sizeChangePxWidth;
|
||||
}
|
||||
|
||||
doLayout = true;
|
||||
break;
|
||||
case Parts.EDITOR_PART:
|
||||
// If we have one editor we can cheat and resize sidebar with the negative delta
|
||||
const visibleEditorCount = this.editorService.getVisibleEditors().length;
|
||||
// If the sidebar is not visible and panel is, resize panel main axis with negative Delta
|
||||
if (this.editorCountForWidth === 1) {
|
||||
if (this.partService.isVisible(Parts.SIDEBAR_PART)) {
|
||||
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
|
||||
doLayout = true;
|
||||
} else if (this.partService.isVisible(Parts.PANEL_PART)) {
|
||||
if (panelPosition === Position.BOTTOM) {
|
||||
this.panelHeight = this.panelHeight - sizeChangePxHeight;
|
||||
} else if (panelPosition === Position.RIGHT) {
|
||||
this.panelWidth = this.panelWidth - sizeChangePxWidth;
|
||||
}
|
||||
doLayout = true;
|
||||
}
|
||||
|
||||
if (visibleEditorCount === 1) {
|
||||
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
|
||||
doLayout = true;
|
||||
} else {
|
||||
const stacks = this.editorGroupService.getStacksModel();
|
||||
const activeGroup = stacks.positionOfGroup(stacks.activeGroup);
|
||||
|
||||
Reference in New Issue
Block a user