mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { EventType, addDisposableListener, addClass, removeClass, isAncestor, getClientArea, Dimension, toggleClass, position, size } from 'vs/base/browser/dom';
|
||||
import { EventType, addDisposableListener, addClass, removeClass, isAncestor, getClientArea, Dimension, toggleClass, position, size, IDimension } from 'vs/base/browser/dom';
|
||||
import { onDidChangeFullscreen, isFullscreen } from 'vs/base/browser/browser';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -27,10 +27,9 @@ import { MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility } from 'vs/pl
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { SerializableGrid, ISerializableView, ISerializedGrid, Orientation, ISerializedNode, ISerializedLeafNode, Direction, IViewSize } from 'vs/base/browser/ui/grid/grid';
|
||||
import { IDimension } from 'vs/platform/layout/browser/layoutService';
|
||||
import { Part } from 'vs/workbench/browser/part';
|
||||
import { IStatusbarService } from 'vs/workbench/services/statusbar/common/statusbar';
|
||||
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
|
||||
@@ -118,6 +117,19 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
private _container: HTMLElement = document.createElement('div');
|
||||
get container(): HTMLElement { return this._container; }
|
||||
|
||||
get offset() {
|
||||
return {
|
||||
top: (() => {
|
||||
let offset = 0;
|
||||
if (this.isVisible(Parts.TITLEBAR_PART)) {
|
||||
offset = this.getPart(Parts.TITLEBAR_PART).maximumHeight;
|
||||
}
|
||||
|
||||
return offset;
|
||||
})()
|
||||
};
|
||||
}
|
||||
|
||||
private parts: Map<string, Part> = new Map<string, Part>();
|
||||
|
||||
private workbenchGrid!: SerializableGrid<ISerializableView>;
|
||||
@@ -173,7 +185,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
centered: false,
|
||||
restoreCentered: false,
|
||||
restoreEditors: false,
|
||||
editorsToOpen: [] as Promise<IResourceEditor[]> | IResourceEditor[]
|
||||
editorsToOpen: [] as Promise<IResourceEditorInputType[]> | IResourceEditorInputType[]
|
||||
},
|
||||
|
||||
panel: {
|
||||
@@ -274,7 +286,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
}
|
||||
|
||||
// Theme changes
|
||||
this._register(this.themeService.onThemeChange(theme => this.updateStyles()));
|
||||
this._register(this.themeService.onDidColorThemeChange(theme => this.updateStyles()));
|
||||
|
||||
// Window focus changes
|
||||
this._register(this.hostService.onDidChangeFocus(e => this.onWindowFocusChanged(e)));
|
||||
@@ -403,7 +415,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
return;
|
||||
}
|
||||
|
||||
const theme = this.themeService.getTheme();
|
||||
const theme = this.themeService.getColorTheme();
|
||||
|
||||
const activeBorder = theme.getColor(WINDOW_ACTIVE_BORDER);
|
||||
const inactiveBorder = theme.getColor(WINDOW_INACTIVE_BORDER);
|
||||
@@ -514,7 +526,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
|
||||
}
|
||||
|
||||
private resolveEditorsToOpen(fileService: IFileService): Promise<IResourceEditor[]> | IResourceEditor[] {
|
||||
private resolveEditorsToOpen(fileService: IFileService): Promise<IResourceEditorInputType[]> | IResourceEditorInputType[] {
|
||||
const configuration = this.environmentService.configuration;
|
||||
const hasInitialFilesToOpen = this.hasInitialFilesToOpen();
|
||||
|
||||
@@ -650,17 +662,12 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
return true; // any other part cannot be hidden
|
||||
}
|
||||
|
||||
getDimension(part: Parts): Dimension | undefined {
|
||||
return this.getPart(part).dimension;
|
||||
focus(): void {
|
||||
this.editorGroupService.activeGroup.focus();
|
||||
}
|
||||
|
||||
getTitleBarOffset(): number {
|
||||
let offset = 0;
|
||||
if (this.isVisible(Parts.TITLEBAR_PART)) {
|
||||
offset = this.getPart(Parts.TITLEBAR_PART).maximumHeight;
|
||||
}
|
||||
|
||||
return offset;
|
||||
getDimension(part: Parts): Dimension | undefined {
|
||||
return this.getPart(part).dimension;
|
||||
}
|
||||
|
||||
getMaximumEditorDimensions(): Dimension {
|
||||
@@ -685,10 +692,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
getWorkbenchElement(): HTMLElement {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
toggleZenMode(skipLayout?: boolean, restoring = false): void {
|
||||
this.state.zenMode.active = !this.state.zenMode.active;
|
||||
this.state.zenMode.transitionDisposables.clear();
|
||||
@@ -707,22 +710,22 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
editor.updateOptions({ lineNumbers });
|
||||
};
|
||||
|
||||
const editorWidgetSet = this.state.zenMode.editorWidgetSet;
|
||||
const editorControlSet = this.state.zenMode.editorWidgetSet;
|
||||
if (!lineNumbers) {
|
||||
// Reset line numbers on all editors visible and non-visible
|
||||
for (const editor of editorWidgetSet) {
|
||||
for (const editor of editorControlSet) {
|
||||
setEditorLineNumbers(editor);
|
||||
}
|
||||
editorWidgetSet.clear();
|
||||
editorControlSet.clear();
|
||||
} else {
|
||||
this.editorService.visibleTextEditorWidgets.forEach(editor => {
|
||||
if (!editorWidgetSet.has(editor)) {
|
||||
editorWidgetSet.add(editor);
|
||||
this.state.zenMode.transitionDisposables.add(editor.onDidDispose(() => {
|
||||
editorWidgetSet.delete(editor);
|
||||
this.editorService.visibleTextEditorControls.forEach(editorControl => {
|
||||
if (!editorControlSet.has(editorControl)) {
|
||||
editorControlSet.add(editorControl);
|
||||
this.state.zenMode.transitionDisposables.add(editorControl.onDidDispose(() => {
|
||||
editorControlSet.delete(editorControl);
|
||||
}));
|
||||
}
|
||||
setEditorLineNumbers(editor);
|
||||
setEditorLineNumbers(editorControl);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -806,7 +809,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
// Status bar and activity bar visibility come from settings -> update their visibility.
|
||||
this.doUpdateLayoutConfiguration(true);
|
||||
|
||||
this.editorGroupService.activeGroup.focus();
|
||||
this.focus();
|
||||
if (this.state.zenMode.setNotificationsFilter) {
|
||||
this.notificationService.setFilter(NotificationsFilter.OFF);
|
||||
}
|
||||
@@ -1090,7 +1093,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||
if (this.hasFocus(Parts.PANEL_PART) && activePanel) {
|
||||
activePanel.focus();
|
||||
} else {
|
||||
this.editorGroupService.activeGroup.focus();
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user