提交 74aa49a2 编写于 作者: S Sanders Lauture

Fixes and cleanup

Fix bug where activity bar would be visible on startup even if it was set
to be hidden
Fix bug where settings would not reflect activity bar visibility
上级 611c4427
......@@ -558,9 +558,9 @@ export class VSCodeMenu {
let activityBarLabel: string;
if (this.currentActivityBarVisible) {
activityBarLabel = 'Show Activity Bar';
activityBarLabel = nls.localize({ key: 'miHideActivityBar', comment: ['&& denotes a mnemonic'] }, "&&Hide Activity Bar");
} else {
activityBarLabel = 'Hide Activity Bar';
activityBarLabel = nls.localize({ key: 'miShowActivityBar', comment: ['&& denotes a mnemonic'] }, "&&Show Activity Bar");
}
const toggleActivtyBar = this.createMenuItem(activityBarLabel, 'workbench.action.toggleActivityBarVisibility');
......
......@@ -19,7 +19,7 @@ export class ToggleActivityBarVisibilityAction extends Action {
public static ID = 'workbench.action.toggleActivityBarVisibility';
public static LABEL = nls.localize('toggleActivityBar', "Toggle Activity Bar Visibility");
private static activityBarVisibleKey = 'workbench.activitybar.visible';
private static activityBarVisibleKey = 'workbench.activityBar.visible';
constructor(
id: string,
......
......@@ -59,6 +59,7 @@ export interface ILayoutOptions {
*/
export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider {
private static activityBarWidthSettingsKey = 'workbench.activityBar.width';
private static sashXWidthSettingsKey = 'workbench.sidebar.width';
private static sashYHeightSettingsKey = 'workbench.panel.height';
......@@ -76,6 +77,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
private workbenchSize: Dimension;
private sashX: Sash;
private sashY: Sash;
private activityBarWidth: number;
private startSidebarWidth: number;
private sidebarWidth: number;
private sidebarHeight: number;
......@@ -129,6 +131,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
orientation: Orientation.HORIZONTAL
});
let isActivityBarHidden = this.partService.isActivityBarHidden();
this.activityBarWidth = isActivityBarHidden ? 0 : this.storageService.getInteger(WorkbenchLayout.activityBarWidthSettingsKey, StorageScope.GLOBAL, 50);
this.sidebarWidth = this.storageService.getInteger(WorkbenchLayout.sashXWidthSettingsKey, StorageScope.GLOBAL, -1);
this.panelHeight = this.storageService.getInteger(WorkbenchLayout.sashYHeightSettingsKey, StorageScope.GLOBAL, 0);
......@@ -168,7 +172,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
if (newSashWidth + HIDE_SIDEBAR_WIDTH_THRESHOLD < this.computedStyles.sidebar.minWidth) {
let dragCompensation = DEFAULT_MIN_SIDEBAR_PART_WIDTH - HIDE_SIDEBAR_WIDTH_THRESHOLD;
this.partService.setSideBarHidden(true);
startX = (sidebarPosition === Position.LEFT) ? Math.max(this.computedStyles.activitybar.minWidth, e.currentX - dragCompensation) : Math.min(e.currentX + dragCompensation, this.workbenchSize.width - this.computedStyles.activitybar.minWidth);
startX = (sidebarPosition === Position.LEFT) ? Math.max(this.activityBarWidth, e.currentX - dragCompensation) : Math.min(e.currentX + dragCompensation, this.workbenchSize.width - this.activityBarWidth);
this.sidebarWidth = this.startSidebarWidth; // when restoring sidebar, restore to the sidebar width we started from
}
......@@ -444,6 +448,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
panelDimension.height = Math.max(DEFAULT_MIN_PANEL_PART_HEIGHT, panelDimension.height);
}
if (!isActivityBarHidden) {
this.activityBarWidth = activityBarSize.width;
this.storageService.store(WorkbenchLayout.activityBarWidthSettingsKey, this.activityBarWidth, StorageScope.GLOBAL);
}
if (!isSidebarHidden) {
this.sidebarWidth = sidebarSize.width;
this.storageService.store(WorkbenchLayout.sashXWidthSettingsKey, this.sidebarWidth, StorageScope.GLOBAL);
......
......@@ -121,7 +121,7 @@ configurationRegistry.registerConfiguration({
'default': true,
'description': nls.localize('statusBarVisibility', "Controls the visibility of the status bar at the bottom of the workbench.")
},
'workbench.activitybar.visible': {
'workbench.activityBar.visible': {
'type': 'boolean',
'default': true,
'description': nls.localize('activityBarVisibility', "Controls the visibility of the activity bar on the left side of the workbench.")
......
......@@ -113,7 +113,7 @@ export class Workbench implements IPartService {
private static sidebarPositionConfigurationKey = 'workbench.sideBar.location';
private static statusbarVisibleConfigurationKey = 'workbench.statusBar.visible';
private static activityBarVisibleConfigurationKey = 'workbench.activitybar.visible';
private static activityBarVisibleConfigurationKey = 'workbench.activityBar.visible';
public _serviceBrand: any;
......@@ -789,6 +789,9 @@ export class Workbench implements IPartService {
if (this.panelHidden) {
this.workbench.addClass('nopanel');
}
if (this.activityBarHidden) {
this.workbench.addClass('noactivitybar');
}
// Apply no-workspace state as CSS class
if (!this.workbenchParams.workspace) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册