提交 48af04a0 编写于 作者: I isidor

take out panel icons in activity bar

上级 dbf130cd
......@@ -11,20 +11,13 @@ import {TPromise} from 'vs/base/common/winjs.base';
import {Builder, $} from 'vs/base/browser/builder';
import {Action} from 'vs/base/common/actions';
import errors = require('vs/base/common/errors');
import {IWorkbenchEditorConfiguration} from 'vs/workbench/common/editor';
import {ActionsOrientation, ActionBar, IActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
import {Registry} from 'vs/platform/platform';
import {IComposite} from 'vs/workbench/common/composite';
import {IPanel} from 'vs/workbench/common/panel';
import {ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions, Viewlet} from 'vs/workbench/browser/viewlet';
import {CompositeDescriptor} from 'vs/workbench/browser/composite';
import {Panel, PanelRegistry, Extensions as PanelExtensions, PanelDescriptor} from 'vs/workbench/browser/panel';
import {ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions} from 'vs/workbench/browser/viewlet';
import {Part} from 'vs/workbench/browser/part';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ActivityAction, ActivityActionItem} from 'vs/workbench/browser/parts/activitybar/activityAction';
import {TogglePanelAction} from 'vs/workbench/browser/parts/panel/panelPart';
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {IPanelService} from 'vs/workbench/services/panel/common/panelService';
import {IActivityService, IBadge} from 'vs/workbench/services/activity/common/activityService';
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
......@@ -33,20 +26,15 @@ import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
export class ActivitybarPart extends Part implements IActivityService {
public _serviceBrand: any;
private viewletSwitcherBar: ActionBar;
private panelSwitcherBar: ActionBar;
private activityActionItems: { [actionId: string]: IActionItem; };
private compositeIdToActions: { [compositeId: string]: ActivityAction; };
private panelActions: ActivityAction[];
private togglePanelAction: TogglePanelAction;
constructor(
id: string,
@IViewletService private viewletService: IViewletService,
@IPanelService private panelService: IPanelService,
@IKeybindingService private keybindingService: IKeybindingService,
@IInstantiationService private instantiationService: IInstantiationService,
@IPartService private partService: IPartService,
@IConfigurationService protected configurationService: IConfigurationService
@IPartService private partService: IPartService
) {
super(id);
......@@ -60,20 +48,9 @@ export class ActivitybarPart extends Part implements IActivityService {
// Activate viewlet action on opening of a viewlet
this.toUnbind.push(this.viewletService.onDidViewletOpen(viewlet => this.onActiveCompositeChanged(viewlet)));
this.toUnbind.push(this.panelService.onDidPanelOpen(panel => this.onActivePanelChanged(panel)));
// Deactivate viewlet action on close
this.toUnbind.push(this.viewletService.onDidViewletClose(viewlet => this.onCompositeClosed(viewlet)));
this.toUnbind.push(this.panelService.onDidPanelClose(panel => this.onPanelClosed(panel)));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationUpdated(e.config)));
}
private onConfigurationUpdated(config: IWorkbenchEditorConfiguration): void {
if (this.panelSwitcherBar) {
config.workbench.panels.showInSidebar ? this.panelSwitcherBar.getContainer().show() : this.panelSwitcherBar.getContainer().hide();
}
}
private onActiveCompositeChanged(composite: IComposite): void {
......@@ -82,31 +59,15 @@ export class ActivitybarPart extends Part implements IActivityService {
}
}
private onActivePanelChanged(panel: IPanel): void {
this.updatePanelSwitcher();
this.onActiveCompositeChanged(panel);
}
private onCompositeClosed(composite: IComposite): void {
if (this.compositeIdToActions[composite.getId()]) {
this.compositeIdToActions[composite.getId()].deactivate();
}
}
private onPanelClosed(panel: IPanel): void {
this.updatePanelSwitcher();
this.onCompositeClosed(panel);
}
public showActivity(compositeId: string, badge: IBadge, clazz?: string): void {
const action = this.compositeIdToActions[compositeId];
if (action) {
if (action instanceof PanelActivityAction && this.partService.isPanelHidden()) {
// while the panel badges are hidden we show the badge on the parent action which is visible
this.togglePanelAction.setBadge(badge);
return;
}
action.setBadge(badge);
if (clazz) {
action.class = clazz;
......@@ -124,7 +85,6 @@ export class ActivitybarPart extends Part implements IActivityService {
// Top Actionbar with action items for each viewlet action
this.createViewletSwitcher($result.clone());
this.createPanelSwitcher($result.clone());
return $result;
}
......@@ -146,69 +106,15 @@ export class ActivitybarPart extends Part implements IActivityService {
this.viewletSwitcherBar.push(viewletActions, { label: true, icon: true });
}
private createPanelSwitcher(div: Builder): void {
// Composite switcher is on top
this.panelSwitcherBar = new ActionBar(div, {
actionItemProvider: (action: Action) => this.activityActionItems[action.id],
orientation: ActionsOrientation.VERTICAL,
ariaLabel: nls.localize('activityBarPanelAriaLabel', "Active Panel Switcher")
});
this.panelSwitcherBar.getContainer().addClass('position-bottom');
if (!this.configurationService.lookup('workbench.panels.showInSidebar').value) {
this.panelSwitcherBar.getContainer().hide();
}
// Build Viewlet Actions in correct order
const allPanels = (<PanelRegistry>Registry.as(PanelExtensions.Panels)).getPanels();
this.togglePanelAction = this.instantiationService.createInstance(TogglePanelAction, TogglePanelAction.ID, TogglePanelAction.LABEL);
this.activityActionItems[this.togglePanelAction.id] = new ActivityActionItem(this.togglePanelAction, TogglePanelAction.LABEL, this.getKeybindingLabel(TogglePanelAction.ID));
this.panelActions = allPanels.sort((p1, p2) => p1.order - p2.order).map(panel => this.toAction(panel));
// Add both viewlet and panel actions to the switcher
this.updatePanelSwitcher();
}
private updatePanelSwitcher(): void {
this.panelSwitcherBar.clear();
this.togglePanelAction.class = this.partService.isPanelHidden() ? 'panel' : 'panel expanded';
const actions: ActivityAction[] = [];
if (!this.partService.isPanelHidden()) {
actions.push(...this.panelActions);
}
actions.push(this.togglePanelAction);
this.panelSwitcherBar.push(actions, { label: true, icon: true });
// TODO@Isidor fix this aweful badge(r) hacks
if (!this.partService.isPanelHidden()) {
if (!this.panelActions[0].getBadge()) {
this.panelActions[0].setBadge(this.togglePanelAction.getBadge());
} else {
this.panelActions[0].setBadge(this.panelActions[0].getBadge());
}
this.togglePanelAction.setBadge(null);
} else {
this.togglePanelAction.setBadge(this.panelActions[0].getBadge());
if (this.panelActions[0].getBadge()) {
this.panelActions[0].setBadge(null);
}
}
}
private toAction(composite: CompositeDescriptor<Viewlet | Panel>): ActivityAction {
private toAction(composite: ViewletDescriptor): ActivityAction {
const activeViewlet = this.viewletService.getActiveViewlet();
const activePanel = this.panelService.getActivePanel();
const action = composite instanceof ViewletDescriptor ? this.instantiationService.createInstance(ViewletActivityAction, composite.id + '.activity-bar-action', composite)
: this.instantiationService.createInstance(PanelActivityAction, (<PanelDescriptor>composite).id + '.activity-bar-action', composite);
const action = this.instantiationService.createInstance(ViewletActivityAction, composite.id + '.activity-bar-action', composite);
this.activityActionItems[action.id] = new ActivityActionItem(action, composite.name, this.getKeybindingLabel(composite.id));
this.compositeIdToActions[composite.id] = action;
// Mark active viewlet and panel action as active
if (activeViewlet && activeViewlet.getId() === composite.id || activePanel && activePanel.getId() === composite.id) {
// Mark active viewlet as active
if (activeViewlet && activeViewlet.getId() === composite.id) {
action.activate();
}
......@@ -230,15 +136,6 @@ export class ActivitybarPart extends Part implements IActivityService {
this.viewletSwitcherBar = null;
}
if (this.panelSwitcherBar) {
this.panelSwitcherBar.dispose();
this.panelSwitcherBar = null;
}
if (this.togglePanelAction) {
this.togglePanelAction.dispose();
}
super.dispose();
}
}
......@@ -278,17 +175,3 @@ class ViewletActivityAction extends ActivityAction {
return TPromise.as(true);
}
}
class PanelActivityAction extends ActivityAction {
constructor(
id: string, private panel: PanelDescriptor,
@IPanelService private panelService: IPanelService
) {
super(id, panel.name, panel.cssClass);
}
public run(): TPromise<any> {
return this.panelService.openPanel(this.panel.id, true).then(() => this.activate());
}
}
......@@ -3,12 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench > .activitybar .monaco-action-bar .action-label.panel {
background: url('panel.svg') center center no-repeat;
background-position: 50% !important;
background-size: 32px;
}
.monaco-workbench > .activitybar .monaco-action-bar .action-label.panel.expanded {
transform: rotate(180deg);
}
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-white{fill:#ffffff}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><path class="icon-white" d="M16 29C8.832 29 3 23.168 3 16S8.832 3 16 3s13 5.832 13 13-5.832 13-13 13zm0-24C9.935 5 5 9.935 5 16s4.935 11 11 11 11-4.935 11-11S22.065 5 16 5zm6.707 13.293L16 11.586l-6.707 6.707 1.414 1.414L16 14.414l5.293 5.293 1.414-1.414z" id="iconBg"/></svg>
\ No newline at end of file
......@@ -884,9 +884,6 @@ export interface IWorkbenchEditorConfiguration {
enablePreview: boolean;
enablePreviewFromQuickOpen: boolean;
openPositioning: string;
},
panels: {
showInSidebar: boolean
}
};
}
......
......@@ -109,11 +109,6 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'description': nls.localize('openDefaultSettings', "Controls if opening settings also opens an editor showing all default settings."),
'default': true
},
'workbench.panels.showInSidebar': {
'type': 'boolean',
'description': nls.localize('panelsShowInSidebar', "Controls if panel icons are shown in the sidebar below the viewlet icons."),
'default': false
}
}
});
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-white{fill:#ffffff}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-white" d="M16 2C8.28 2 2 8.28 2 16s6.28 14 14 14 14-6.28 14-14S23.72 2 16 2zm0 25.979C9.383 27.979 4 22.605 4 16 4 9.395 9.383 4.021 16 4.021S28 9.395 28 16c0 6.605-5.383 11.979-12 11.979zm-6-6.959h12v-10H10v10zm1-8.52l9.399 7.52h-3.497c.058-.126.044-.345.044-.494V17.898l-3.404-2.724h-.947c-.217 0-.595-.042-.595.175v.766h.471v-.471h1.436c-.524.86-.569 1.815-.027 2.357.707.707 1.617.617 2.477.093l.12 1.556h-.471v.37H11V12.5zm10 7.039l-9.399-7.52h3.221l-.003.25 1.065.017-.039 1.87c-.175.044-.35.115-.525.199l2.594 2.075c.016-.051.038-.103.051-.154l1.87-.039.017 1.065.39-.005v-.92c0-.217-.104-.492-.321-.492h-1.575l-.311-.262c-.002-.039-.011-.078-.016-.117.412-.11.715-.426.715-.875 0-.068-.014-.172-.027-.172l1.036-.015-.03-.501-1.292-.06c-.028 0-.231-.189-.231-.189-.038-.038-.069-.083-.069-.11V12.35h-.471v1.051c0-.013-.097-.02-.165-.02-.449 0-.762.307-.871.719-.038-.005-.076-.012-.115-.015l-.261-.31v-1.574c0-.076-.04-.133-.093-.181H21v7.519z"/></g></svg>
\ No newline at end of file
......@@ -5,13 +5,6 @@
/* Debug repl */
/* Activity Bar */
.monaco-workbench > .activitybar .monaco-action-bar .action-label.repl {
background: url('repl-panel.svg') center center no-repeat;
background-position: 50% !important;
background-size: 32px;
}
.monaco-workbench .repl {
height: 100%;
position: relative;
......
......@@ -3,13 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Activity Bar */
.monaco-workbench > .activitybar .monaco-action-bar .action-label.markersPanel {
background: url('markers.svg') center center no-repeat;
background-position: 50% !important;
background-size: 32px;
}
.monaco-action-bar .action-item.markers-panel-action-filter {
max-width: 400px;
min-width: 100px;
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-white{fill:#ffffff}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-white" d="M16 2C8.28 2 2 8.28 2 16s6.28 14 14 14 14-6.28 14-14S23.72 2 16 2zm0 25.979C9.383 27.979 4 22.605 4 16 4 9.395 9.383 4.021 16 4.021S28 9.395 28 16c0 6.605-5.383 11.979-12 11.979zM17 18h-2v-7h2v7zm0 4h-2v-2h2v2z"/></g></svg>
\ No newline at end of file
......@@ -3,14 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Activity Bar */
.monaco-workbench > .activitybar .monaco-action-bar .action-label.output {
background: url('output.svg') center center no-repeat;
background-position: 50% !important;
background-size: 32px;
}
.monaco-workbench .output-action.clear-output {
background: url('clear_output.svg') center center no-repeat;
}
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-white{fill:#ffffff}</style><path class="icon-canvas-transparent" d="M32 32H0V0h32v32z" id="canvas"/><g id="iconBg"><path class="icon-white" d="M16 2C8.28 2 2 8.28 2 16s6.28 14 14 14 14-6.28 14-14S23.72 2 16 2zm0 25.979C9.383 27.979 4 22.605 4 16 4 9.395 9.383 4.021 16 4.021S28 9.395 28 16c0 6.605-5.383 11.979-12 11.979zM12 11v9h7v1h-8V10h8v1h-7zm8 2h-6v-1h6v1zm2 3h-6v-1h6v1zm-3 3h-4v-1h4v1z"/></g></svg>
\ No newline at end of file
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Activity Bar */
.monaco-workbench > .activitybar .monaco-action-bar .action-label.terminal {
background: url('terminal.svg') center center no-repeat;
background-position: 50% !important;
background-size: 32px;
}
.monaco-workbench .panel.integrated-terminal {
align-content: flex-start;
align-items: baseline;
display: flex;
flex-direction: column;
background-color: transparent!important;
color: #333;
-webkit-user-select: initial;
overflow: hidden; /* prevents the terminal output being incorrectly placed over the title */
}
.vs-dark .monaco-workbench .panel.integrated-terminal { color: #CCC; }
.hc-black .monaco-workbench .panel.integrated-terminal { color: #FFF; }
.monaco-workbench .panel.integrated-terminal .terminal-outer-container {
height: 100%;
padding: 0 20px;
width: 100%;
}
.monaco-workbench .panel.integrated-terminal .terminal-wrapper {
display: none;
}
.monaco-workbench .panel.integrated-terminal .terminal-wrapper.active {
display: block;
position: absolute;
bottom: 0;
}
/* Terminal actions */
/* Light theme */
.monaco-workbench .terminal-action.kill { background: url('kill.svg') center center no-repeat; }
.monaco-workbench .terminal-action.new { background: url('new.svg') center center no-repeat; }
/* Dark theme / HC theme */
.vs-dark .monaco-workbench .terminal-action.kill, .hc-black .monaco-workbench .terminal-action.kill { background: url('kill-inverse.svg') center center no-repeat; }
.vs-dark .monaco-workbench .terminal-action.new, .hc-black .monaco-workbench .terminal-action.new { background: url('new-inverse.svg') center center no-repeat; }
.vs-dark .monaco-workbench.mac .panel.integrated-terminal .xterm-rows,
.hc-black .monaco-workbench.mac .panel.integrated-terminal .xterm-rows {
cursor: -webkit-image-set(url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII=') 1x, url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC') 2x) 5 8, text;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册