提交 2971f550 编写于 作者: B Benjamin Pasero

grid - move title controls over to editor2

上级 86707d17
......@@ -26,9 +26,6 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { TabsTitleControl } from 'vs/workbench/browser/parts/editor/tabsTitleControl';
import { ITitleAreaControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { NoTabsTitleControl } from 'vs/workbench/browser/parts/editor/noTabsTitleControl';
import { IEditorStacksModel, IStacksModelChangeEvent, IEditorGroup, EditorOptions, TextEditorOptions, IEditorIdentifier, EditorInput } from 'vs/workbench/common/editor';
import { getCodeEditor } from 'vs/editor/browser/services/codeEditorService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
......@@ -40,6 +37,21 @@ import { ResourcesDropHandler, LocalSelectionTransfer, DraggedEditorIdentifier }
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
export class NoOpTitleAreaControl {
private container = document.createElement('div');
hasContext(): boolean { return false; }
allowDragging(element: HTMLElement): boolean { return false; }
getContainer(): HTMLElement { return this.container; }
setDragged(dragged: boolean): void { }
create(parent: HTMLElement): void { }
refresh(instant?: boolean): void { }
update(instant?: boolean): void { }
updateEditorActionsToolbar(): void { }
layout(dimension: DOM.Dimension): void { }
dispose(): void { }
setContext(group: IEditorGroup): void { }
}
export enum Rochade {
NONE,
......@@ -282,7 +294,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
// Title Control
if (titleControl) {
const usingTabs = (titleControl instanceof TabsTitleControl);
const usingTabs = (titleControl instanceof NoOpTitleAreaControl);
// Recreate title when tabs change
if (usingTabs !== this.tabOptions.showTabs) {
......@@ -1396,7 +1408,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
}
private createTitleControl(context: IEditorGroup, silo: Builder, container: Builder, instantiationService: IInstantiationService): void {
const titleAreaControl = instantiationService.createInstance<ITitleAreaControl>(this.tabOptions.showTabs ? TabsTitleControl : NoTabsTitleControl);
const titleAreaControl = instantiationService.createInstance<NoOpTitleAreaControl>(this.tabOptions.showTabs ? NoOpTitleAreaControl : NoOpTitleAreaControl);
titleAreaControl.create(container.getHTMLElement());
titleAreaControl.setContext(context);
titleAreaControl.refresh(true /* instant */);
......@@ -2230,7 +2242,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
return this.getFromContainer(position, EditorGroupsControl.PROGRESS_BAR_CONTROL_KEY);
}
private getTitleAreaControl(position: Position): ITitleAreaControl {
private getTitleAreaControl(position: Position): NoOpTitleAreaControl {
return this.getFromContainer(position, EditorGroupsControl.TITLE_AREA_CONTROL_KEY);
}
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><circle fill="#C5C5C5" cx="8" cy="8" r="4"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><circle fill="#424242" cx="8" cy="8" r="4"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="3 3 16 16" enable-background="new 3 3 16 16"><polygon fill="#e8e8e8" points="12.597,11.042 15.4,13.845 13.844,15.4 11.042,12.598 8.239,15.4 6.683,13.845 9.485,11.042 6.683,8.239 8.238,6.683 11.042,9.486 13.845,6.683 15.4,8.239"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="3 3 16 16" enable-background="new 3 3 16 16"><polygon fill="#424242" points="12.597,11.042 15.4,13.845 13.844,15.4 11.042,12.598 8.239,15.4 6.683,13.845 9.485,11.042 6.683,8.239 8.238,6.683 11.042,9.486 13.845,6.683 15.4,8.239"/></svg>
\ No newline at end of file
......@@ -100,13 +100,4 @@
.vs-dark .monaco-workbench > .part.editor > .content.horizontal-layout > .one-editor-silo > .container > .title .split-editor-action,
.hc-black .monaco-workbench > .part.editor > .content.horizontal-layout > .one-editor-silo > .container > .title .split-editor-action {
background: url('split-editor-horizontal-inverse.svg') center center no-repeat;
}
.monaco-workbench .show-group-editors-action {
background: url('stackview.svg') center center no-repeat;
}
.vs-dark .monaco-workbench .show-group-editors-action,
.hc-black .monaco-workbench .show-group-editors-action {
background: url('stackview-inverse.svg') center center no-repeat;
}
}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}.icon-vs-fg{fill:#2b282e}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 15H0V1h16v14z" id="outline" style="display: none;"/><path class="icon-vs-bg" d="M1 2v12h14V2H1zm13 11H2v-3h12v3zm0-5H2V5h12v3z" id="iconBg"/><g id="iconFg" style="display: none;"><path class="icon-vs-fg" d="M14 8H2V5h12v3zm0 2H2v3h12v-3z"/></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}.icon-vs-fg{fill:#f0eff1}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 15H0V1h16v14z" id="outline" style="display: none;"/><path class="icon-vs-bg" d="M1 2v12h14V2H1zm13 11H2v-3h12v3zm0-5H2V5h12v3z" id="iconBg"/><g id="iconFg" style="display: none;"><path class="icon-vs-fg" d="M14 8H2V5h12v3zm0 2H2v3h12v-3z"/></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -1 16 16" enable-background="new 0 -1 16 16"><path fill="#C5C5C5" d="M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -1 16 16" enable-background="new 0 -1 16 16"><path fill="#656565" d="M1 1v12h14v-12h-14zm1 3h4.999v8h-4.999v-8zm12 8h-5.001v-8h5.001v8z"/></svg>
\ No newline at end of file
......@@ -14,14 +14,13 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { addClass, addClasses, Dimension } from 'vs/base/browser/dom';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ITitleAreaControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { TabsTitleControl } from 'vs/workbench/browser/parts/editor/tabsTitleControl';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { attachProgressBarStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { editorBackground, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { Themable, EDITOR_GROUP_HEADER_TABS_BORDER, EDITOR_GROUP_HEADER_TABS_BACKGROUND } from 'vs/workbench/common/theme';
import { INextEditor, INextEditorGroup } from 'vs/workbench/services/editor/common/nextEditorGroupsService';
import { INextTitleAreaControl } from 'vs/workbench/browser/parts/editor2/nextTitleControl';
export class NextEditorGroupView extends Themable implements IView, INextEditorGroup {
......@@ -40,7 +39,7 @@ export class NextEditorGroupView extends Themable implements IView, INextEditorG
private _element: HTMLElement;
private container: HTMLElement;
private titleAreaControl: ITitleAreaControl;
private titleAreaControl: INextTitleAreaControl;
private progressBar: ProgressBar;
constructor(
......
......@@ -5,17 +5,17 @@
'use strict';
import 'vs/css!./media/notabstitle';
import 'vs/css!./media/nextNoTabsTitleControl';
import * as errors from 'vs/base/common/errors';
import { toResource } from 'vs/workbench/common/editor';
import * as DOM from 'vs/base/browser/dom';
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { NextTitleControl } from 'vs/workbench/browser/parts/editor2/nextTitleControl';
import { ResourceLabel } from 'vs/workbench/browser/labels';
import { Verbosity } from 'vs/platform/editor/common/editor';
import { TAB_ACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/browser/touch';
export class NoTabsTitleControl extends TitleControl {
export class NextNoTabsTitleControl extends NextTitleControl {
private titleContainer: HTMLElement;
private editorLabel: ResourceLabel;
......
......@@ -5,7 +5,7 @@
'use strict';
import 'vs/css!./media/tabstitle';
import 'vs/css!./media/nextTabsTitleControl';
import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import * as errors from 'vs/base/common/errors';
......@@ -28,7 +28,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IMenuService } from 'vs/platform/actions/common/actions';
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { NextTitleControl } from 'vs/workbench/browser/parts/editor2/nextTitleControl';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { IDisposable, dispose, combinedDisposable } from 'vs/base/common/lifecycle';
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
......@@ -50,7 +50,7 @@ interface IEditorInputLabel {
type AugmentedLabel = IEditorInputLabel & { editor: IEditorInput };
export class TabsTitleControl extends TitleControl {
export class NextTabsTitleControl extends NextTitleControl {
private titleContainer: HTMLElement;
private tabsContainer: HTMLElement;
private editorToolbarContainer: HTMLElement;
......
......@@ -5,7 +5,7 @@
'use strict';
import 'vs/css!./media/titlecontrol';
import 'vs/css!./media/nextTitleControl';
import * as nls from 'vs/nls';
import { prepareActions } from 'vs/workbench/browser/actions';
import { IAction, Action, IRunEvent } from 'vs/base/common/actions';
......@@ -43,7 +43,7 @@ export interface IToolbarActions {
secondary: IAction[];
}
export interface ITitleAreaControl {
export interface INextTitleAreaControl {
setContext(group: IEditorGroup): void;
hasContext(): boolean;
allowDragging(element: HTMLElement): boolean;
......@@ -57,7 +57,7 @@ export interface ITitleAreaControl {
dispose(): void;
}
export abstract class TitleControl extends Themable implements ITitleAreaControl {
export abstract class NextTitleControl extends Themable implements INextTitleAreaControl {
protected stacks: IEditorStacksModel;
protected context: IEditorGroup;
......
......@@ -1139,7 +1139,7 @@ export class Workbench implements IPartService {
const editorContainer = this.editorPart.getContainer();
if (visibleEditors === 0) {
this.editorsVisibleContext.reset();
this.editorBackgroundDelayer.trigger(() => DOM.addClass(editorContainer, 'empty2')); // TODO@grid reenable (find "empty2")
this.editorBackgroundDelayer.trigger(() => DOM.addClass(editorContainer, 'empty2')); // TODO@grid reenable (find "empty2") and move this into editorPart.ts!
} else {
this.editorsVisibleContext.set(true);
this.editorBackgroundDelayer.trigger(() => DOM.removeClass(editorContainer, 'empty2'));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册