提交 334bd170 编写于 作者: M Martin Aeschlimann

Rename theme to colortheme

上级 1449af5f
......@@ -119,7 +119,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
this.sidebarWidth = this.storageService.getInteger(WorkbenchLayout.sashXWidthSettingsKey, StorageScope.GLOBAL, -1);
this.panelHeight = this.storageService.getInteger(WorkbenchLayout.sashYHeightSettingsKey, StorageScope.GLOBAL, 0);
this.toUnbind.push(themeService.onDidThemeChange(_ => this.relayout()));
this.toUnbind.push(themeService.onDidColorThemeChange(_ => this.relayout()));
this.toUnbind.push(editorGroupService.onEditorsChanged(() => this.onEditorsChanged()));
this.registerSashListeners();
......
......@@ -55,7 +55,7 @@ export abstract class BaseTextEditor extends BaseEditor {
this.toUnbind.push(this._eventService.addListener2(WorkbenchEventType.WORKBENCH_OPTIONS_CHANGED, _ => this.handleConfigurationChangeEvent()));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.handleConfigurationChangeEvent(e.config)));
this.toUnbind.push(_themeService.onDidThemeChange(_ => this.handleConfigurationChangeEvent()));
this.toUnbind.push(_themeService.onDidColorThemeChange(_ => this.handleConfigurationChangeEvent()));
}
public get instantiationService(): IInstantiationService {
......@@ -110,7 +110,7 @@ export abstract class BaseTextEditor extends BaseEditor {
overviewRulerLanes: 3,
glyphMargin: true,
lineNumbersMinChars: 3,
theme: this._themeService.getTheme()
theme: this._themeService.getColorTheme()
};
// Always mixin editor options from the context into our set to allow for override
......
......@@ -197,7 +197,7 @@ export class WorkbenchShell {
windowSize: windowSize,
emptyWorkbench: !this.contextService.getWorkspace(),
customKeybindingsCount,
theme: this.themeService.getTheme(),
theme: this.themeService.getColorTheme(),
language: platform.language
});
......
......@@ -90,7 +90,7 @@ export class Repl extends Panel {
}
}
}));
this.toDispose.push(this.themeService.onDidThemeChange(e => this.replInput.updateOptions(this.getReplInputOptions())));
this.toDispose.push(this.themeService.onDidColorThemeChange(e => this.replInput.updateOptions(this.getReplInputOptions())));
}
private onReplElementsUpdated(): void {
......@@ -227,7 +227,7 @@ export class Repl extends Panel {
lineDecorationsWidth: 0,
scrollBeyondLastLine: false,
lineHeight: 21,
theme: this.themeService.getTheme()
theme: this.themeService.getColorTheme()
};
// Always mixin editor options from the context into our set to allow for override
......
......@@ -181,11 +181,11 @@ export class ExtensionEditor extends BaseEditor {
document.querySelector('.monaco-editor-background')
);
webview.style(this.themeService.getTheme());
webview.style(this.themeService.getColorTheme());
webview.contents = [renderBody(body)];
const linkListener = webview.onDidClickLink(link => shell.openExternal(link.toString()));
const themeListener = this.themeService.onDidThemeChange(themeId => webview.style(themeId));
const themeListener = this.themeService.onDidColorThemeChange(themeId => webview.style(themeId));
this.transientDisposables.push(webview, linkListener, themeListener);
})
.then(null, () => null)
......
......@@ -110,8 +110,8 @@ export class HtmlPreviewPart extends BaseEditor {
this._webviewDisposables = dispose(this._webviewDisposables);
this._webview = undefined;
} else {
this._themeChangeSubscription = this._themeService.onDidThemeChange(themeId => this.webview.style(themeId));
this.webview.style(this._themeService.getTheme());
this._themeChangeSubscription = this._themeService.onDidColorThemeChange(themeId => this.webview.style(themeId));
this.webview.style(this._themeService.getColorTheme());
if (this._hasValidModel()) {
this._modelChangeSubscription = this._model.onDidChangeContent(() => this.webview.contents = this._model.getLinesContent());
......
......@@ -221,7 +221,7 @@ export class TerminalPanel extends Panel {
this.onTerminalInstanceExit.bind(this));
this.terminalInstances.push(terminalInstance);
this.setActiveTerminal(this.terminalInstances.length - 1);
this.toDispose.push(this.themeService.onDidThemeChange(this.updateTheme.bind(this)));
this.toDispose.push(this.themeService.onDidColorThemeChange(this.updateTheme.bind(this)));
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(this.updateConfig.bind(this)));
this.updateTheme();
this.updateConfig();
......@@ -253,7 +253,7 @@ export class TerminalPanel extends Panel {
private updateTheme(themeId?: string): void {
if (!themeId) {
themeId = this.themeService.getTheme();
themeId = this.themeService.getColorTheme();
}
let baseThemeId = getBaseThemeId(themeId);
......
......@@ -38,8 +38,8 @@ class SelectThemeAction extends Action {
}
run(): TPromise<void> {
return this.themeService.getThemes().then(themes => {
const currentThemeId = this.themeService.getTheme();
return this.themeService.getColorThemes().then(themes => {
const currentThemeId = this.themeService.getColorTheme();
const currentTheme = themes.filter(theme => theme.id === currentThemeId)[0];
const picks: IPickOpenEntry[] = themes
......@@ -47,7 +47,7 @@ class SelectThemeAction extends Action {
.sort((t1, t2) => t1.label.localeCompare(t2.label));
const selectTheme = (theme, broadcast) => {
this.themeService.setTheme(theme.id, broadcast)
this.themeService.setColorTheme(theme.id, broadcast)
.done(null, err => this.messageService.show(Severity.Info, localize('problemChangingTheme', "Problem loading theme: {0}", err.message)));
};
......
......@@ -82,7 +82,7 @@ class Snapper {
public appendThemeInformation(data: Data[]) : TPromise<Data[]> {
let currentTheme = this.themeService.getTheme();
let currentTheme = this.themeService.getColorTheme();
let getThemeName = (id: string) => {
let part = 'vscode-theme-defaults-themes-';
......@@ -93,11 +93,11 @@ class Snapper {
return void 0;
};
return this.themeService.getThemes().then(themeDatas => {
return this.themeService.getColorThemes().then(themeDatas => {
let defaultThemes = themeDatas.filter(themeData => !!getThemeName(themeData.id));
return TPromise.join(defaultThemes.map(defaultTheme => {
let themeId = defaultTheme.id;
return this.themeService.setTheme(themeId, false).then(success => {
return this.themeService.setColorTheme(themeId, false).then(success => {
if (success) {
let testNode = this.getTestNode(themeId);
let themeName = getThemeName(themeId);
......@@ -108,7 +108,7 @@ class Snapper {
});
}));
}).then(_ => {
return this.themeService.setTheme(currentTheme, false).then(_ => {
return this.themeService.setColorTheme(currentTheme, false).then(_ => {
return data;
});
});
......
......@@ -12,10 +12,10 @@ export let IThemeService = createDecorator<IThemeService>('themeService');
export interface IThemeService {
_serviceBrand: any;
setTheme(themeId: string, broadcastToAllWindows: boolean): TPromise<boolean>;
getTheme(): string;
getThemes(): TPromise<IThemeData[]>;
onDidThemeChange: Event<string>;
setColorTheme(themeId: string, broadcastToAllWindows: boolean): TPromise<boolean>;
getColorTheme(): string;
getColorThemes(): TPromise<IThemeData[]>;
onDidColorThemeChange: Event<string>;
}
export interface IThemeData {
......
......@@ -122,12 +122,12 @@ export class ThemeService implements IThemeService {
windowService.onBroadcast(e => {
if (e.channel === THEME_CHANNEL && typeof e.payload === 'string') {
this.setTheme(e.payload, false);
this.setColorTheme(e.payload, false);
}
});
}
public get onDidThemeChange(): Event<string> {
public get onDidColorThemeChange(): Event<string> {
return this.onThemeChange.event;
}
......@@ -139,10 +139,10 @@ export class ThemeService implements IThemeService {
themeId = DEFAULT_THEME_ID;
this.storageService.store(THEME_PREF, themeId, StorageScope.GLOBAL);
}
return this.setTheme(themeId, false);
return this.setColorTheme(themeId, false);
}
public setTheme(themeId: string, broadcastToAllWindows: boolean) : TPromise<boolean> {
public setColorTheme(themeId: string, broadcastToAllWindows: boolean) : TPromise<boolean> {
if (!themeId) {
return TPromise.as(false);
}
......@@ -177,12 +177,12 @@ export class ThemeService implements IThemeService {
return this.applyThemeCSS(themeId, DEFAULT_THEME_ID, onApply);
}
public getTheme() {
public getColorTheme() {
return this.currentTheme || this.storageService.get(THEME_PREF, StorageScope.GLOBAL, DEFAULT_THEME_ID);
}
private loadTheme(themeId: string, defaultId?: string): TPromise<IInternalThemeData> {
return this.getThemes().then(allThemes => {
return this.getColorThemes().then(allThemes => {
let themes = allThemes.filter(t => t.id === themeId);
if (themes.length > 0) {
return <IInternalThemeData> themes[0];
......@@ -206,7 +206,7 @@ export class ThemeService implements IThemeService {
});
}
public getThemes(): TPromise<IThemeData[]> {
public getColorThemes(): TPromise<IThemeData[]> {
return this.extensionService.onReady().then(isReady => {
return this.knownThemes;
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册