mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-26 01:38:40 +01:00
grid - some centered layout cleanup
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-workbench > .part.editor > .content .centered-view-layout {
|
||||
.centered-view-layout {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -143,13 +143,6 @@ export abstract class BaseEditor extends Panel implements IEditor {
|
||||
this._group = group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses can set this to false if it does not make sense to center editor input.
|
||||
*/
|
||||
supportsCenteredLayout(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected getEditorMemento<T>(storageService: IStorageService, editorGroupService: IEditorGroupsService, key: string, limit: number = 10): IEditorMemento<T> {
|
||||
const mementoKey = `${this.getId()}${key}`;
|
||||
|
||||
|
||||
@@ -116,10 +116,6 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
public supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public clearInput(): void {
|
||||
|
||||
// Clear Meta
|
||||
|
||||
@@ -89,13 +89,13 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
private mostRecentActiveGroups: GroupIdentifier[] = [];
|
||||
|
||||
private container: HTMLElement;
|
||||
private centeredLayoutWidget: CenteredViewLayout;
|
||||
private gridWidget: SerializableGrid<IEditorGroupView>;
|
||||
|
||||
private _whenRestored: TPromise<void>;
|
||||
private whenRestoredComplete: TValueCallback<void>;
|
||||
|
||||
private previousUIState: IEditorPartUIState;
|
||||
private centeredViewLayout: CenteredViewLayout;
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -708,7 +708,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
|
||||
const separatorBorderStyle = { separatorBorder: this.gridSeparatorBorder };
|
||||
this.gridWidget.style(separatorBorderStyle);
|
||||
this.centeredViewLayout.styles(separatorBorderStyle);
|
||||
this.centeredLayoutWidget.styles(separatorBorderStyle);
|
||||
}
|
||||
|
||||
createContentArea(parent: HTMLElement): HTMLElement {
|
||||
@@ -720,7 +720,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
|
||||
// Grid control with center layout
|
||||
this.doCreateGridControl();
|
||||
this.centeredViewLayout = new CenteredViewLayout(this.container, this.getGridAsView(), this.globalMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]);
|
||||
this.centeredLayoutWidget = this._register(new CenteredViewLayout(this.container, this.getGridAsView(), this.globalMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]));
|
||||
|
||||
// Drop support
|
||||
this._register(this.instantiationService.createInstance(EditorDropTarget, this, this.container));
|
||||
@@ -741,11 +741,11 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
}
|
||||
|
||||
centerLayout(active: boolean): void {
|
||||
this.centeredViewLayout.activate(active);
|
||||
this.centeredLayoutWidget.activate(active);
|
||||
}
|
||||
|
||||
isLayoutCentered(): boolean {
|
||||
return this.centeredViewLayout.isActive();
|
||||
return this.centeredLayoutWidget.isActive();
|
||||
}
|
||||
|
||||
private doCreateGridControl(): void {
|
||||
@@ -801,6 +801,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
}
|
||||
|
||||
private doCreateGridControlWithState(serializedGrid: ISerializedGrid, activeGroupId: GroupIdentifier, editorGroupViewsToReuse?: IEditorGroupView[]): void {
|
||||
|
||||
// Determine group views to reuse if any
|
||||
let reuseGroupViews: IEditorGroupView[];
|
||||
if (editorGroupViewsToReuse) {
|
||||
@@ -839,9 +840,10 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
this.gridWidget = gridWidget;
|
||||
|
||||
if (gridWidget) {
|
||||
if (this.centeredViewLayout) {
|
||||
this.centeredViewLayout.resetView(this.getGridAsView());
|
||||
if (this.centeredLayoutWidget) {
|
||||
this.centeredLayoutWidget.resetView(this.getGridAsView());
|
||||
}
|
||||
|
||||
this._onDidSizeConstraintsChange.input = gridWidget.onDidChange;
|
||||
}
|
||||
|
||||
@@ -999,7 +1001,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
|
||||
// Layout Grid
|
||||
try {
|
||||
this.centeredViewLayout.layout(this.dimension.width, this.dimension.height);
|
||||
this.centeredLayoutWidget.layout(this.dimension.width, this.dimension.height);
|
||||
} catch (error) {
|
||||
this.gridError(error);
|
||||
}
|
||||
@@ -1024,7 +1026,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
this.memento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY] = uiState;
|
||||
}
|
||||
}
|
||||
this.globalMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY] = this.centeredViewLayout.state;
|
||||
|
||||
// Persist centered view state
|
||||
this.globalMemento[EditorPart.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY] = this.centeredLayoutWidget.state;
|
||||
|
||||
// Forward to all groups
|
||||
this.groupViews.forEach(group => group.shutdown());
|
||||
@@ -1042,7 +1046,6 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
|
||||
if (this.gridWidget) {
|
||||
this.gridWidget.dispose();
|
||||
}
|
||||
this.centeredViewLayout.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content .editor-group-container.centered > .title .title-label {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-label a,
|
||||
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label a {
|
||||
text-decoration: none;
|
||||
|
||||
@@ -151,10 +151,6 @@ export class SideBySideEditor extends BaseEditor {
|
||||
return this.detailsEditor;
|
||||
}
|
||||
|
||||
supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
private updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
|
||||
if (!newInput.matches(oldInput)) {
|
||||
if (oldInput) {
|
||||
|
||||
@@ -163,10 +163,6 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
private restoreTextDiffEditorViewState(input: EditorInput): boolean {
|
||||
if (input instanceof DiffEditorInput) {
|
||||
const resource = this.toDiffEditorViewStateResource(input);
|
||||
|
||||
@@ -205,10 +205,6 @@ export class PreferencesEditor extends BaseEditor {
|
||||
super.clearInput();
|
||||
}
|
||||
|
||||
public supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
|
||||
this.sideBySidePreferencesWidget.setEditorVisible(visible, group);
|
||||
super.setEditorVisible(visible, group);
|
||||
@@ -1053,10 +1049,6 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
|
||||
this.getControl().layout(dimension);
|
||||
}
|
||||
|
||||
public supportsCenteredLayout(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected getAriaLabel(): string {
|
||||
return nls.localize('preferencesAriaLabel', "Default preferences. Readonly text editor.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user