Skip to content

Commit

Permalink
aux window renames (#203775)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Jan 30, 2024
1 parent 74ef67b commit 860f38b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/actions/layoutActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/b
import { ToggleAuxiliaryBarAction } from 'vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions';
import { TogglePanelAction } from 'vs/workbench/browser/parts/panel/panelActions';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { AuxiliaryBarVisibleContext, PanelAlignmentContext, PanelVisibleContext, SideBarVisibleContext, FocusedViewContext, InEditorZenModeContext, IsCenteredLayoutContext, MainEditorAreaVisibleContext, IsMainWindowFullscreenContext, PanelPositionContext, IsAuxiliaryWindowFocusedContext, TitleBarStyleContext } from 'vs/workbench/common/contextkeys';
import { AuxiliaryBarVisibleContext, PanelAlignmentContext, PanelVisibleContext, SideBarVisibleContext, FocusedViewContext, InEditorZenModeContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, IsMainWindowFullscreenContext, PanelPositionContext, IsAuxiliaryWindowFocusedContext, TitleBarStyleContext } from 'vs/workbench/common/contextkeys';
import { Codicon } from 'vs/base/common/codicons';
import { ThemeIcon } from 'vs/base/common/themables';
import { DisposableStore } from 'vs/base/common/lifecycle';
Expand Down Expand Up @@ -88,7 +88,7 @@ registerAction2(class extends Action2 {
precondition: IsAuxiliaryWindowFocusedContext.toNegated(),
category: Categories.View,
f1: true,
toggled: IsCenteredLayoutContext,
toggled: IsMainEditorCenteredLayoutContext,
menu: [{
id: MenuId.MenubarAppearanceMenu,
group: '1_toggle_view',
Expand Down Expand Up @@ -1388,7 +1388,7 @@ const AlignPanelActions: CustomizeLayoutItem[] = [
const MiscLayoutOptions: CustomizeLayoutItem[] = [
CreateOptionLayoutItem('workbench.action.toggleFullScreen', IsMainWindowFullscreenContext, localize('fullscreen', "Full Screen"), fullscreenIcon),
CreateOptionLayoutItem('workbench.action.toggleZenMode', InEditorZenModeContext, localize('zenMode', "Zen Mode"), zenModeIcon),
CreateOptionLayoutItem('workbench.action.toggleCenteredLayout', IsCenteredLayoutContext, localize('centeredLayout', "Centered Layout"), centerLayoutIcon),
CreateOptionLayoutItem('workbench.action.toggleCenteredLayout', IsMainEditorCenteredLayoutContext, localize('centeredLayout', "Centered Layout"), centerLayoutIcon),
];

const LayoutContextKeySet = new Set<string>();
Expand Down
10 changes: 5 additions & 5 deletions src/vs/workbench/browser/contextkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey, setConstant as setConstantContextKey } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext, IsMobileContext } from 'vs/platform/contextkey/common/contextkeys';
import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, MainEditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, ActiveEditorCanToggleReadonlyContext, applyAvailableEditorIds, TitleBarVisibleContext, TitleBarStyleContext, MultipleEditorGroupsContext, IsAuxiliaryWindowFocusedContext, ActiveCompareEditorOriginalWriteableContext } from 'vs/workbench/common/contextkeys';
import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, EmbedderIdentifierContext, EditorTabsVisibleContext, IsMainEditorCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, MainEditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsMainWindowFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, TemporaryWorkspaceContext, ActiveEditorCanToggleReadonlyContext, applyAvailableEditorIds, TitleBarVisibleContext, TitleBarStyleContext, MultipleEditorGroupsContext, IsAuxiliaryWindowFocusedContext, ActiveCompareEditorOriginalWriteableContext } from 'vs/workbench/common/contextkeys';
import { TEXT_DIFF_EDITOR_ID, EditorInputCapabilities, SIDE_BY_SIDE_EDITOR_ID, EditorResourceAccessor, SideBySideEditor } from 'vs/workbench/common/editor';
import { trackFocus, addDisposableListener, EventType, onDidRegisterWindow, getActiveWindow } from 'vs/base/browser/dom';
import { preferredSideBySideGroupDirection, GroupDirection, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
Expand Down Expand Up @@ -71,7 +71,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
private inZenModeContext: IContextKey<boolean>;
private isMainWindowFullscreenContext: IContextKey<boolean>;
private isAuxiliaryWindowFocusedContext: IContextKey<boolean>;
private isCenteredLayoutContext: IContextKey<boolean>;
private isMainEditorCenteredLayoutContext: IContextKey<boolean>;
private sideBarVisibleContext: IContextKey<boolean>;
private mainEditorAreaVisibleContext: IContextKey<boolean>;
private panelPositionContext: IContextKey<string>;
Expand Down Expand Up @@ -195,8 +195,8 @@ export class WorkbenchContextKeysHandler extends Disposable {
// Zen Mode
this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService);

// Centered Layout
this.isCenteredLayoutContext = IsCenteredLayoutContext.bindTo(this.contextKeyService);
// Centered Layout (Main Editor)
this.isMainEditorCenteredLayoutContext = IsMainEditorCenteredLayoutContext.bindTo(this.contextKeyService);

// Editor Area
this.mainEditorAreaVisibleContext = MainEditorAreaVisibleContext.bindTo(this.contextKeyService);
Expand Down Expand Up @@ -266,7 +266,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
this.isMainWindowFullscreenContext.set(isFullscreen(mainWindow));
}
}));
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onDidChangeMainEditorCenteredLayout(centered => this.isMainEditorCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));

this._register(this.layoutService.onDidChangePanelAlignment(alignment => this.panelAlignmentContext.set(alignment)));
Expand Down
24 changes: 12 additions & 12 deletions src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private readonly _onDidChangeZenMode = this._register(new Emitter<boolean>());
readonly onDidChangeZenMode = this._onDidChangeZenMode.event;

private readonly _onDidChangeCenteredLayout = this._register(new Emitter<boolean>());
readonly onDidChangeCenteredLayout = this._onDidChangeCenteredLayout.event;
private readonly _onDidChangeMainEditorCenteredLayout = this._register(new Emitter<boolean>());
readonly onDidChangeMainEditorCenteredLayout = this._onDidChangeMainEditorCenteredLayout.event;

private readonly _onDidChangePanelAlignment = this._register(new Emitter<PanelAlignment>());
readonly onDidChangePanelAlignment = this._onDidChangePanelAlignment.event;
Expand Down Expand Up @@ -338,7 +338,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this._register(this.editorGroupService.mainPart.onDidActivateGroup(showEditorIfHidden));

// Revalidate center layout when active editor changes: diff editor quits centered mode.
this._register(this.mainPartEditorService.onDidActiveEditorChange(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED))));
this._register(this.mainPartEditorService.onDidActiveEditorChange(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))));
});

// Configuration changes
Expand Down Expand Up @@ -371,9 +371,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this._register(onDidChangeFullscreen(windowId => this.onFullscreenChanged(windowId)));

// Group changes
this._register(this.editorGroupService.mainPart.onDidAddGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED))));
this._register(this.editorGroupService.mainPart.onDidRemoveGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED))));
this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED))));
this._register(this.editorGroupService.mainPart.onDidAddGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))));
this._register(this.editorGroupService.mainPart.onDidRemoveGroup(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))));
this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(() => this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED))));

// Prevent workbench from scrolling #55456
this._register(addDisposableListener(this.mainContainer, EventType.SCROLL, () => this.mainContainer.scrollTop = 0));
Expand Down Expand Up @@ -511,7 +511,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi

// Centered Layout
this.editorGroupService.whenRestored.then(() => {
this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED), skipLayout);
this.centerMainEditorLayout(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED), skipLayout);
});
}

Expand Down Expand Up @@ -1069,7 +1069,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}

// Restore Main Editor Center Mode
if (this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED)) {
if (this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED)) {
this.centerMainEditorLayout(true, true);
}

Expand Down Expand Up @@ -1631,11 +1631,11 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}

isMainEditorLayoutCentered(): boolean {
return this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED);
return this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED);
}

centerMainEditorLayout(active: boolean, skipLayout?: boolean): void {
this.stateModel.setRuntimeValue(LayoutStateKeys.EDITOR_CENTERED, active);
this.stateModel.setRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED, active);

const activeMainEditor = this.mainPartEditorService.activeEditor;

Expand All @@ -1662,7 +1662,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
}

this._onDidChangeCenteredLayout.fire(this.stateModel.getRuntimeValue(LayoutStateKeys.EDITOR_CENTERED));
this._onDidChangeMainEditorCenteredLayout.fire(this.stateModel.getRuntimeValue(LayoutStateKeys.MAIN_EDITOR_CENTERED));
}

resizePart(part: Parts, sizeChangeWidth: number, sizeChangeHeight: number): void {
Expand Down Expand Up @@ -2550,7 +2550,7 @@ class InitializationStateKey<T extends StorageKeyType> extends WorkbenchLayoutSt
const LayoutStateKeys = {

// Editor
EDITOR_CENTERED: new RuntimeStateKey<boolean>('editor.centered', StorageScope.WORKSPACE, StorageTarget.MACHINE, false),
MAIN_EDITOR_CENTERED: new RuntimeStateKey<boolean>('editor.centered', StorageScope.WORKSPACE, StorageTarget.MACHINE, false),

// Zen Mode
ZEN_MODE_ACTIVE: new RuntimeStateKey<boolean>('zenMode.active', StorageScope.WORKSPACE, StorageTarget.MACHINE, false),
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/common/contextkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const IsAuxiliaryEditorPartContext = new RawContextKey<boolean>('isAuxili
// Editor Layout Context Keys
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false, localize('editorIsOpen', "Whether an editor is open"));
export const InEditorZenModeContext = new RawContextKey<boolean>('inZenMode', false, localize('inZenMode', "Whether Zen mode is enabled"));
export const IsCenteredLayoutContext = new RawContextKey<boolean>('isCenteredLayout', false, localize('isCenteredLayout', "Whether centered layout is enabled"));
export const IsMainEditorCenteredLayoutContext = new RawContextKey<boolean>('isCenteredLayout', false, localize('isMainEditorCenteredLayout', "Whether centered layout is enabled for the main editor"));
export const SplitEditorsVertically = new RawContextKey<boolean>('splitEditorsVertically', false, localize('splitEditorsVertically', "Whether editors split vertically"));
export const MainEditorAreaVisibleContext = new RawContextKey<boolean>('mainEditorAreaVisible', true, localize('mainEditorAreaVisible', "Whether the editor area in the main window is visible"));
export const EditorTabsVisibleContext = new RawContextKey<boolean>('editorTabsVisible', true, localize('editorTabsVisible', "Whether editor tabs are visible"));
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/services/layout/browser/layoutService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ export interface IWorkbenchLayoutService extends ILayoutService {
readonly onDidChangeWindowMaximized: Event<{ readonly windowId: number; readonly maximized: boolean }>;

/**
* Emits when centered layout is enabled or disabled.
* Emits when main editor centered layout is enabled or disabled.
*/
readonly onDidChangeCenteredLayout: Event<boolean>;
readonly onDidChangeMainEditorCenteredLayout: Event<boolean>;

/*
* Emit when panel position changes.
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/test/browser/workbenchTestServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export class TestLayoutService implements IWorkbenchLayoutService {
activeContainer: HTMLElement = mainWindow.document.body;

onDidChangeZenMode: Event<boolean> = Event.None;
onDidChangeCenteredLayout: Event<boolean> = Event.None;
onDidChangeMainEditorCenteredLayout: Event<boolean> = Event.None;
onDidChangeWindowMaximized: Event<{ windowId: number; maximized: boolean }> = Event.None;
onDidChangePanelPosition: Event<string> = Event.None;
onDidChangePanelAlignment: Event<PanelAlignment> = Event.None;
Expand Down

0 comments on commit 860f38b

Please sign in to comment.