提交 d8f9a916 编写于 作者: I isidor

Revert "zen mode -> focus mode"

This reverts commit e51299d9.
上级 04f89500
......@@ -539,7 +539,7 @@ export class VSCodeMenu {
const commands = this.createMenuItem(nls.localize({ key: 'miCommandPalette', comment: ['&& denotes a mnemonic'] }, "&&Command Palette..."), 'workbench.action.showCommands');
const fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsService.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsService.getWindowCount() > 0 });
const toggleFocusMode = this.createMenuItem(nls.localize('miToggleFocusMode', "Toggle Focus Mode"), 'workbench.action.toggleFocusMode', this.windowsService.getWindowCount() > 0);
const toggleZenMode = this.createMenuItem(nls.localize('miToggleZenMode', "Toggle Zen Mode"), 'workbench.action.toggleZenMode', this.windowsService.getWindowCount() > 0);
const toggleMenuBar = this.createMenuItem(nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar"), 'workbench.action.toggleMenuBar');
const splitEditor = this.createMenuItem(nls.localize({ key: 'miSplitEditor', comment: ['&& denotes a mnemonic'] }, "Split &&Editor"), 'workbench.action.splitEditor');
const toggleEditorLayout = this.createMenuItem(nls.localize({ key: 'miToggleEditorLayout', comment: ['&& denotes a mnemonic'] }, "Toggle Editor Group &&Layout"), 'workbench.action.toggleEditorGroupLayout');
......@@ -595,7 +595,7 @@ export class VSCodeMenu {
integratedTerminal,
__separator__(),
fullscreen,
toggleFocusMode,
toggleZenMode,
platform.isWindows || platform.isLinux ? toggleMenuBar : void 0,
__separator__(),
splitEditor,
......
......@@ -89,7 +89,7 @@ export interface IWindowSettings {
openFilesInNewWindow: boolean;
reopenFolders: 'all' | 'one' | 'none';
restoreFullscreen: boolean;
fullScreenFocusMode: boolean;
fullScreenZenMode: boolean;
zoomLevel: number;
titleBarStyle: 'native' | 'custom';
}
......@@ -294,7 +294,7 @@ export class TestPartService implements IPartService {
}
public toggleFocusMode(): void { }
public toggleZenMode(): void { }
}
export class TestEventService extends EventEmitter implements IEventService {
......
......@@ -12,10 +12,10 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
class ToggleFocusMode extends Action {
class ToggleZenMode extends Action {
public static ID = 'workbench.action.toggleFocusMode';
public static LABEL = nls.localize('toggle', "Toggle Focus Mode");
public static ID = 'workbench.action.toggleZenMode';
public static LABEL = nls.localize('toggleZenMode', "Toggle Zen Mode");
constructor(
id: string,
......@@ -27,10 +27,10 @@ class ToggleFocusMode extends Action {
}
public run(): TPromise<any> {
this.partService.toggleFocusMode();
this.partService.toggleZenMode();
return TPromise.as(null);
}
}
let registry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleFocusMode, ToggleFocusMode.ID, ToggleFocusMode.LABEL, { primary: KeyMod.Shift | KeyCode.F11, mac: { primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_F } }), 'Toggle Focus Mode');
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleZenMode, ToggleZenMode.ID, ToggleZenMode.LABEL, { primary: KeyMod.Shift | KeyCode.F11, mac: { primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_F } }), 'View: Toggle Zen Mode', nls.localize('view', "View"));
......@@ -20,7 +20,7 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
import { CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions';
import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
import { CloseEditorAction, KeybindingsReferenceAction, ReportIssueAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseFolderAction, CloseWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction } from 'vs/workbench/electron-browser/actions';
import { MessagesVisibleContext, NoEditorsVisibleContext, InFocusModeContext } from 'vs/workbench/electron-browser/workbench';
import { MessagesVisibleContext, NoEditorsVisibleContext, InZenModeContext } from 'vs/workbench/electron-browser/workbench';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
const closeEditorOrWindowKeybindings: IKeybindings = { primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] } };
......@@ -77,13 +77,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'workbench.action.exitFocusMode',
id: 'workbench.action.exitZenMode',
weight: CommonEditorRegistry.commandWeight(-1000),
handler(accessor: ServicesAccessor, configurationOrName: any) {
const partService = accessor.get(IPartService);
partService.toggleFocusMode();
partService.toggleZenMode();
},
when: InFocusModeContext,
when: InZenModeContext,
primary: KeyChord(KeyCode.Escape, KeyCode.Escape)
});
......@@ -173,10 +173,10 @@ let properties: { [path: string]: IJSONSchema; } = {
'default': false,
'description': nls.localize('restoreFullscreen', "Controls if a window should restore to full screen mode if it was exited in full screen mode.")
},
'window.fullScreenFocusMode': {
'window.fullScreenZenMode': {
'type': 'boolean',
'default': true,
'description': nls.localize('fullScreenFocusMode', "Controls if focus mode should transition the workbench to full screen mode automatically.")
'description': nls.localize('fullScreenZenMode', "Controls if zen mode should transition the workbench to full screen mode automatically.")
},
'window.zoomLevel': {
'type': 'number',
......
......@@ -25,7 +25,7 @@ import 'vs/workbench/browser/actions/toggleStatusbarVisibility';
import 'vs/workbench/browser/actions/toggleSidebarVisibility';
import 'vs/workbench/browser/actions/toggleSidebarPosition';
import 'vs/workbench/browser/actions/toggleEditorLayout';
import 'vs/workbench/browser/actions/toggleFocusMode';
import 'vs/workbench/browser/actions/toggleZenMode';
import 'vs/workbench/parts/settings/browser/openSettings.contribution';
import 'vs/workbench/browser/actions/configureLocale';
......
......@@ -93,7 +93,7 @@ import { IWindowConfiguration } from 'vs/workbench/electron-browser/common';
export const MessagesVisibleContext = new RawContextKey<boolean>('globalMessageVisible', false);
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
export const InFocusModeContext = new RawContextKey<boolean>('inFocusMode', false);
export const InZenModeContext = new RawContextKey<boolean>('inZenMode', false);
export const NoEditorsVisibleContext: ContextKeyExpr = EditorsVisibleContext.toNegated();
interface WorkbenchParams {
......@@ -168,9 +168,9 @@ export class Workbench implements IPartService {
private editorBackgroundDelayer: Delayer<void>;
private messagesVisibleContext: IContextKey<boolean>;
private editorsVisibleContext: IContextKey<boolean>;
private inFocusMode: IContextKey<boolean>;
private inZenMode: IContextKey<boolean>;
private hasFilesToCreateOpenOrDiff: boolean;
private focusMode: {
private zenMode: {
active: boolean;
transitionedToFullScreen: boolean;
isPartVisible: { [part: string]: boolean };
......@@ -246,7 +246,7 @@ export class Workbench implements IPartService {
// Contexts
this.messagesVisibleContext = MessagesVisibleContext.bindTo(this.contextKeyService);
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
this.inFocusMode = InFocusModeContext.bindTo(this.contextKeyService);
this.inZenMode = InZenModeContext.bindTo(this.contextKeyService);
// Register Listeners
this.registerListeners();
......@@ -532,8 +532,8 @@ export class Workbench implements IPartService {
const activityBarVisible = this.configurationService.lookup<string>(Workbench.activityBarVisibleConfigurationKey).value;
this.activityBarHidden = !activityBarVisible;
// Focus mode
this.focusMode = {
// Zen mode
this.zenMode = {
active: false,
isPartVisible: {},
transitionedToFullScreen: false
......@@ -594,18 +594,18 @@ export class Workbench implements IPartService {
}
public isVisible(part: Parts): boolean {
const checkFocusMode = (part: Parts) => !this.focusMode.active || this.focusMode.isPartVisible[part.toString()];
const checkZenMode = (part: Parts) => !this.zenMode.active || this.zenMode.isPartVisible[part.toString()];
switch (part) {
case Parts.TITLEBAR_PART:
return this.getCustomTitleBarStyle() && !browser.isFullscreen();
case Parts.SIDEBAR_PART:
return !this.sideBarHidden && checkFocusMode(Parts.SIDEBAR_PART);
return !this.sideBarHidden && checkZenMode(Parts.SIDEBAR_PART);
case Parts.PANEL_PART:
return !this.panelHidden && checkFocusMode(Parts.PANEL_PART);
return !this.panelHidden && checkZenMode(Parts.PANEL_PART);
case Parts.STATUSBAR_PART:
return !this.statusBarHidden && checkFocusMode(Parts.STATUSBAR_PART);
return !this.statusBarHidden && checkZenMode(Parts.STATUSBAR_PART);
case Parts.ACTIVITYBAR_PART:
return !this.activityBarHidden && checkFocusMode(Parts.ACTIVITYBAR_PART);
return !this.activityBarHidden && checkZenMode(Parts.ACTIVITYBAR_PART);
}
return true; // any other part cannot be hidden
......@@ -642,8 +642,8 @@ export class Workbench implements IPartService {
}
private setStatusBarHidden(hidden: boolean, skipLayout?: boolean): void {
if (this.focusMode.active) {
this.focusMode.isPartVisible[Parts.STATUSBAR_PART.toString()] = !hidden;
if (this.zenMode.active) {
this.zenMode.isPartVisible[Parts.STATUSBAR_PART.toString()] = !hidden;
}
this.statusBarHidden = hidden;
......@@ -655,8 +655,8 @@ export class Workbench implements IPartService {
}
public setActivityBarHidden(hidden: boolean, skipLayout?: boolean): void {
if (this.focusMode.active) {
this.focusMode.isPartVisible[Parts.ACTIVITYBAR_PART.toString()] = !hidden;
if (this.zenMode.active) {
this.zenMode.isPartVisible[Parts.ACTIVITYBAR_PART.toString()] = !hidden;
}
this.activityBarHidden = hidden;
......@@ -668,8 +668,8 @@ export class Workbench implements IPartService {
}
public setSideBarHidden(hidden: boolean, skipLayout?: boolean): void {
if (this.focusMode.active) {
this.focusMode.isPartVisible[Parts.SIDEBAR_PART.toString()] = !hidden;
if (this.zenMode.active) {
this.zenMode.isPartVisible[Parts.SIDEBAR_PART.toString()] = !hidden;
}
this.sideBarHidden = hidden;
......@@ -715,8 +715,8 @@ export class Workbench implements IPartService {
}
public setPanelHidden(hidden: boolean, skipLayout?: boolean): void {
if (this.focusMode.active) {
this.focusMode.isPartVisible[Parts.PANEL_PART.toString()] = !hidden;
if (this.zenMode.active) {
this.zenMode.isPartVisible[Parts.PANEL_PART.toString()] = !hidden;
}
this.panelHidden = hidden;
......@@ -838,8 +838,8 @@ export class Workbench implements IPartService {
this.addClass('fullscreen');
} else {
this.removeClass('fullscreen');
if (this.focusMode.transitionedToFullScreen && this.focusMode.active) {
this.toggleFocusMode();
if (this.zenMode.transitionedToFullScreen && this.zenMode.active) {
this.toggleZenMode();
}
}
......@@ -1056,17 +1056,17 @@ export class Workbench implements IPartService {
this.storageService.store(Workbench.sidebarRestoreSettingKey, 'true', StorageScope.WORKSPACE);
}
public toggleFocusMode(): void {
this.focusMode.active = !this.focusMode.active;
this.inFocusMode.set(this.focusMode.active);
Object.keys(this.focusMode.isPartVisible).forEach(key => this.focusMode.isPartVisible[key] = false);
// Check if focus mode transitioned to full screen and if now we are out of focus mode -> we need to go out of full screen
let toggleFullScreen = !this.focusMode.active && this.focusMode.transitionedToFullScreen && browser.isFullscreen();
public toggleZenMode(): void {
this.zenMode.active = !this.zenMode.active;
this.inZenMode.set(this.zenMode.active);
Object.keys(this.zenMode.isPartVisible).forEach(key => this.zenMode.isPartVisible[key] = false);
// Check if zen mode transitioned to full screen and if now we are out of zen mode -> we need to go out of full screen
let toggleFullScreen = !this.zenMode.active && this.zenMode.transitionedToFullScreen && browser.isFullscreen();
if (this.focusMode.active) {
if (this.zenMode.active) {
const windowConfig = this.configurationService.getConfiguration<IWindowConfiguration>();
toggleFullScreen = !browser.isFullscreen() && windowConfig.window.fullScreenFocusMode;
this.focusMode.transitionedToFullScreen = toggleFullScreen;
toggleFullScreen = !browser.isFullscreen() && windowConfig.window.fullScreenZenMode;
this.zenMode.transitionedToFullScreen = toggleFullScreen;
}
(toggleFullScreen ? this.windowService.toggleFullScreen() : TPromise.as(null))
......
......@@ -119,7 +119,7 @@ export interface IPartService {
setRestoreSidebar(): void;
/**
* Toggles the workbench in and out of focus mode - parts get hidden and window goes fullscreen.
* Toggles the workbench in and out of zen mode - parts get hidden and window goes fullscreen.
*/
toggleFocusMode(): void;
toggleZenMode(): void;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册