提交 b0c79f44 编写于 作者: B Benjamin Pasero

status bar clean up

上级 838ead77
......@@ -534,10 +534,10 @@ export class VSCodeMenu {
let fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsManager.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsManager.getWindowCount() > 0 });
let toggleMenuBar = this.createMenuItem(nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar"), 'workbench.action.toggleMenuBar');
let splitEditor = this.createMenuItem(nls.localize({ key: 'miSplitEditor', comment: ['&& denotes a mnemonic'] }, "Split &&Editor"), 'workbench.action.splitEditor');
let toggleStatusbar = this.createMenuItem(nls.localize({ key: 'miToggleStatusbar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Status Bar"), 'workbench.action.toggleStatusbarVisibility');
let toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility');
let moveSidebar = this.createMenuItem(nls.localize({ key: 'miMoveSidebar', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar"), 'workbench.action.toggleSidebarPosition');
let togglePanel = this.createMenuItem(nls.localize({ key: 'miTogglePanel', comment: ['&& denotes a mnemonic'] }, "Toggle &&Panel"), 'workbench.action.togglePanel');
let toggleStatusbar = this.createMenuItem(nls.localize({ key: 'miToggleStatusbar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Status Bar"), 'workbench.action.toggleStatusbarVisibility');
const toggleWordWrap = this.createMenuItem(nls.localize({ key: 'miToggleWordWrap', comment: ['&& denotes a mnemonic'] }, "Toggle &&Word Wrap"), 'editor.action.toggleWordWrap');
const toggleRenderWhitespace = this.createMenuItem(nls.localize({ key: 'miToggleRenderWhitespace', comment: ['&& denotes a mnemonic'] }, "Toggle &&Render Whitespace"), 'editor.action.toggleRenderWhitespace');
......@@ -557,10 +557,10 @@ export class VSCodeMenu {
platform.isWindows || platform.isLinux ? toggleMenuBar : void 0,
__separator__(),
splitEditor,
toggleStatusbar,
togglePanel,
toggleSidebar,
moveSidebar,
toggleSidebar,
togglePanel,
toggleStatusbar,
__separator__(),
toggleWordWrap,
toggleRenderWhitespace,
......
......@@ -12,11 +12,11 @@ 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';
const ID = 'workbench.action.toggleStatusbarVisibility';
const LABEL = nls.localize('toggleStatusbar', "Toggle Status Bar Visibility");
export class ToggleStatusbarVisibilityAction extends Action {
public static ID = 'workbench.action.toggleStatusbarVisibility';
public static LABEL = nls.localize('toggleStatusbar', "Toggle Status Bar Visibility");
constructor(id: string, label: string, @IPartService private partService: IPartService) {
super(id, label);
......@@ -32,4 +32,4 @@ export class ToggleStatusbarVisibilityAction extends Action {
}
let registry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleStatusbarVisibilityAction, ID, LABEL), 'View: Toggle Status Bar Visibility', nls.localize('view', "View"));
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleStatusbarVisibilityAction, ToggleStatusbarVisibilityAction.ID, ToggleStatusbarVisibilityAction.LABEL), 'View: Toggle Status Bar Visibility', nls.localize('view', "View"));
\ No newline at end of file
......@@ -273,6 +273,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
const panelStyle = this.panel.getContainer().getComputedStyle();
const editorStyle = this.editor.getContainer().getComputedStyle();
const activitybarStyle = this.activitybar.getContainer().getComputedStyle();
const statusbarStyle = this.statusbar.getContainer().getComputedStyle();
this.computedStyles = {
activitybar: {
......@@ -292,14 +293,9 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
},
statusbar: {
height: 0
height: parseInt(statusbarStyle.getPropertyValue('height'), 10) || 18
}
};
if (this.statusbar) {
const statusbarStyle = this.statusbar.getContainer().getComputedStyle();
this.computedStyles.statusbar.height = parseInt(statusbarStyle.getPropertyValue('height'), 10) || 18;
}
}
public layout(forceStyleReCompute?: boolean): void {
......@@ -331,11 +327,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
sidebarWidth = this.workbenchSize.width / 5;
this.sidebarWidth = sidebarWidth;
}
let statusbarHeight = isStatusbarHidden ? 0 : this.computedStyles.statusbar.height;
if (this.statusbar) {
let statusbarStyle = this.statusbar.getContainer().getHTMLElement().style;
statusbarStyle.display = isStatusbarHidden ? 'none' : null;
}
this.sidebarHeight = this.workbenchSize.height - statusbarHeight;
let sidebarSize = new Dimension(sidebarWidth, this.sidebarHeight);
......@@ -387,6 +380,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
if (visibleEditorCount > 1) {
editorMinWidth *= visibleEditorCount;
}
if (editorSize.width < editorMinWidth) {
let diff = editorMinWidth - editorSize.width;
editorSize.width = editorMinWidth;
......@@ -451,9 +445,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
}
// Statusbar Part
if (this.statusbar) {
this.statusbar.getContainer().position(this.workbenchSize.height - statusbarHeight);
}
this.statusbar.getContainer().position(this.workbenchSize.height - statusbarHeight);
// Quick open
this.quickopen.layout(this.workbenchSize);
......@@ -468,9 +460,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
this.panel.layout(panelDimension);
// Propagate to Context View
if (this.contextViewService) {
this.contextViewService.layout();
}
this.contextViewService.layout();
}
private getWorkbenchArea(): Dimension {
......@@ -503,8 +493,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
}
public getHorizontalSashTop(sash: Sash): number {
// Horizontal sash should be a bit lower than the editor area, thus add 2px #5524
return 2 + (this.partService.isPanelHidden() ? this.sidebarHeight : this.sidebarHeight - this.panelHeight);
return 2 + (this.partService.isPanelHidden() ? this.sidebarHeight : this.sidebarHeight - this.panelHeight); // Horizontal sash should be a bit lower than the editor area, thus add 2px #5524
}
public getHorizontalSashLeft(sash: Sash): number {
......@@ -521,4 +510,4 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
this.toUnbind = null;
}
}
}
}
\ No newline at end of file
......@@ -412,8 +412,6 @@ export class Workbench implements IPartService {
}
private initSettings(): void {
// Statusbar visibility
this.statusBarHidden = this.storageService.getBoolean(Workbench.statusbarHiddenSettingKey, StorageScope.WORKSPACE, false);
// Sidebar visibility
this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE, false);
......@@ -436,6 +434,9 @@ export class Workbench implements IPartService {
// Sidebar position
let rawPosition = this.storageService.get(Workbench.sidebarPositionSettingKey, StorageScope.GLOBAL, 'left');
this.sideBarPosition = (rawPosition === 'left') ? Position.LEFT : Position.RIGHT;
// Statusbar visibility
this.statusBarHidden = this.storageService.getBoolean(Workbench.statusbarHiddenSettingKey, StorageScope.WORKSPACE, false);
}
/**
......@@ -477,10 +478,6 @@ export class Workbench implements IPartService {
container = this.editorPart.getContainer();
break;
case Parts.STATUSBAR_PART:
if (!this.statusbarPart) {
return false; // could be disabled by options
}
container = this.statusbarPart.getContainer();
break;
}
......@@ -489,14 +486,13 @@ export class Workbench implements IPartService {
}
public isVisible(part: Parts): boolean {
if (part === Parts.SIDEBAR_PART) {
return !this.sideBarHidden;
}
if (part === Parts.PANEL_PART) {
return !this.panelHidden;
}
if (part === Parts.STATUSBAR_PART) {
return !this.statusBarHidden;
switch (part) {
case Parts.SIDEBAR_PART:
return !this.sideBarHidden;
case Parts.PANEL_PART:
return !this.panelHidden;
case Parts.STATUSBAR_PART:
return !this.statusBarHidden;
}
return true; // any other part cannot be hidden
......@@ -513,6 +509,7 @@ export class Workbench implements IPartService {
if (!skipLayout) {
this.workbenchLayout.layout(true);
}
this.storageService.store(Workbench.statusbarHiddenSettingKey, hidden ? 'true' : 'false', StorageScope.WORKSPACE);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册