Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
de73b280
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
de73b280
编写于
2月 15, 2017
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[theme] store baseTheme in storage
上级
acdb4e94
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
26 addition
and
21 deletion
+26
-21
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+11
-12
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+7
-1
src/vs/workbench/services/themes/electron-browser/themeService.ts
...orkbench/services/themes/electron-browser/themeService.ts
+8
-8
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
de73b280
...
@@ -9,6 +9,7 @@ import * as path from 'path';
...
@@ -9,6 +9,7 @@ import * as path from 'path';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
nls
=
require
(
'
vs/nls
'
);
import
{
IStorageService
}
from
'
vs/code/electron-main/storage
'
;
import
{
shell
,
screen
,
BrowserWindow
,
systemPreferences
,
app
}
from
'
electron
'
;
import
{
shell
,
screen
,
BrowserWindow
,
systemPreferences
,
app
}
from
'
electron
'
;
import
{
TPromise
,
TValueCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
,
TValueCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
IEnvironmentService
,
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
,
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
...
@@ -20,6 +21,7 @@ import { getCommonHTTPHeaders } from 'vs/platform/environment/node/http';
...
@@ -20,6 +21,7 @@ import { getCommonHTTPHeaders } from 'vs/platform/environment/node/http';
import
{
IWindowSettings
,
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowSettings
,
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
export
interface
IWindowState
{
export
interface
IWindowState
{
width
?:
number
;
width
?:
number
;
height
?:
number
;
height
?:
number
;
...
@@ -134,6 +136,8 @@ export interface IVSCodeWindow {
...
@@ -134,6 +136,8 @@ export interface IVSCodeWindow {
export
class
VSCodeWindow
implements
IVSCodeWindow
{
export
class
VSCodeWindow
implements
IVSCodeWindow
{
public
static
baseThemeStorageKey
=
'
baseTheme
'
;
private
static
MIN_WIDTH
=
200
;
private
static
MIN_WIDTH
=
200
;
private
static
MIN_HEIGHT
=
120
;
private
static
MIN_HEIGHT
=
120
;
...
@@ -160,7 +164,8 @@ export class VSCodeWindow implements IVSCodeWindow {
...
@@ -160,7 +164,8 @@ export class VSCodeWindow implements IVSCodeWindow {
config
:
IWindowCreationOptions
,
config
:
IWindowCreationOptions
,
@
ILogService
private
logService
:
ILogService
,
@
ILogService
private
logService
:
ILogService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IStorageService
private
storageService
:
IStorageService
)
{
)
{
this
.
options
=
config
;
this
.
options
=
config
;
this
.
_lastFocusTime
=
-
1
;
this
.
_lastFocusTime
=
-
1
;
...
@@ -174,9 +179,9 @@ export class VSCodeWindow implements IVSCodeWindow {
...
@@ -174,9 +179,9 @@ export class VSCodeWindow implements IVSCodeWindow {
this
.
restoreWindowState
(
config
.
state
);
this
.
restoreWindowState
(
config
.
state
);
// For VS theme we can show directly because background is white
// For VS theme we can show directly because background is white
const
themeId
=
this
.
configurationService
.
lookup
<
string
>
(
'
workbench.colorTheme
'
).
value
;
const
baseTheme
=
this
.
storageService
.
getItem
<
string
>
(
VSCodeWindow
.
baseThemeStorageKey
)
;
const
usesLightTheme
=
/^l-/
.
test
(
themeId
)
;
const
usesLightTheme
=
'
vs
'
===
baseTheme
;
const
usesHighContrastTheme
=
/^hc-/
.
test
(
themeId
)
||
(
platform
.
isWindows
&&
systemPreferences
.
isInvertedColorScheme
());
const
usesHighContrastTheme
=
'
hc-black
'
===
baseTheme
||
(
platform
.
isWindows
&&
systemPreferences
.
isInvertedColorScheme
());
// in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below)
// in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below)
const
isFullscreenOrMaximized
=
(
this
.
currentWindowMode
===
WindowMode
.
Maximized
||
this
.
currentWindowMode
===
WindowMode
.
Fullscreen
);
const
isFullscreenOrMaximized
=
(
this
.
currentWindowMode
===
WindowMode
.
Maximized
||
this
.
currentWindowMode
===
WindowMode
.
Fullscreen
);
...
@@ -503,14 +508,8 @@ export class VSCodeWindow implements IVSCodeWindow {
...
@@ -503,14 +508,8 @@ export class VSCodeWindow implements IVSCodeWindow {
windowConfiguration
.
accessibilitySupport
=
app
.
isAccessibilitySupportEnabled
();
windowConfiguration
.
accessibilitySupport
=
app
.
isAccessibilitySupportEnabled
();
// background color
// background color
const
themeId
=
this
.
configurationService
.
lookup
<
string
>
(
'
workbench.colorTheme
'
).
value
;
const
baseTheme
=
this
.
storageService
.
getItem
<
string
>
(
VSCodeWindow
.
baseThemeStorageKey
,
'
vs-dark
'
);
if
(
themeId
[
0
]
===
'
h
'
)
{
windowConfiguration
.
baseTheme
=
baseTheme
;
windowConfiguration
.
baseTheme
=
'
hc-black
'
;
}
else
if
(
themeId
[
0
]
===
'
l
'
)
{
windowConfiguration
.
baseTheme
=
'
vs
'
;
}
else
{
windowConfiguration
.
baseTheme
=
'
vs-dark
'
;
}
// Perf Counters
// Perf Counters
windowConfiguration
.
perfStartTime
=
global
.
perfStartTime
;
windowConfiguration
.
perfStartTime
=
global
.
perfStartTime
;
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
de73b280
...
@@ -289,6 +289,11 @@ export class WindowsManager implements IWindowsMainService {
...
@@ -289,6 +289,11 @@ export class WindowsManager implements IWindowsMainService {
}
}
private
onBroadcast
(
event
:
string
,
payload
:
any
):
void
{
private
onBroadcast
(
event
:
string
,
payload
:
any
):
void
{
// Theme changes
if
(
event
===
'
vscode:changeBaseTheme
'
&&
typeof
payload
===
'
string
'
)
{
this
.
storageService
.
setItem
(
VSCodeWindow
.
baseThemeStorageKey
,
payload
);
}
}
}
public
reload
(
win
:
VSCodeWindow
,
cli
?:
ParsedArgs
):
void
{
public
reload
(
win
:
VSCodeWindow
,
cli
?:
ParsedArgs
):
void
{
...
@@ -788,7 +793,8 @@ export class WindowsManager implements IWindowsMainService {
...
@@ -788,7 +793,8 @@ export class WindowsManager implements IWindowsMainService {
},
},
this
.
logService
,
this
.
logService
,
this
.
environmentService
,
this
.
environmentService
,
this
.
configurationService
this
.
configurationService
,
this
.
storageService
);
);
WindowsManager
.
WINDOWS
.
push
(
vscodeWindow
);
WindowsManager
.
WINDOWS
.
push
(
vscodeWindow
);
...
...
src/vs/workbench/services/themes/electron-browser/themeService.ts
浏览文件 @
de73b280
...
@@ -15,6 +15,7 @@ import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/platform/exten
...
@@ -15,6 +15,7 @@ import { ExtensionsRegistry, ExtensionMessageCollector } from 'vs/platform/exten
import
{
IThemeService
,
IThemeSetting
,
IColorTheme
,
IFileIconTheme
,
VS_LIGHT_THEME
,
VS_DARK_THEME
,
VS_HC_THEME
,
COLOR_THEME_SETTING
,
ICON_THEME_SETTING
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
IThemeService
,
IThemeSetting
,
IColorTheme
,
IFileIconTheme
,
VS_LIGHT_THEME
,
VS_DARK_THEME
,
VS_HC_THEME
,
COLOR_THEME_SETTING
,
ICON_THEME_SETTING
}
from
'
vs/workbench/services/themes/common/themeService
'
;
import
{
EditorStylesContribution
,
SearchViewStylesContribution
,
TerminalStylesContribution
}
from
'
vs/workbench/services/themes/electron-browser/stylesContributions
'
;
import
{
EditorStylesContribution
,
SearchViewStylesContribution
,
TerminalStylesContribution
}
from
'
vs/workbench/services/themes/electron-browser/stylesContributions
'
;
import
{
getBaseThemeId
,
getSyntaxThemeId
,
isDarkTheme
,
isLightTheme
}
from
'
vs/platform/theme/common/themes
'
;
import
{
getBaseThemeId
,
getSyntaxThemeId
,
isDarkTheme
,
isLightTheme
}
from
'
vs/platform/theme/common/themes
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
...
@@ -35,7 +36,7 @@ import pfs = require('vs/base/node/pfs');
...
@@ -35,7 +36,7 @@ import pfs = require('vs/base/node/pfs');
// implementation
// implementation
const
DEFAULT_THEME_ID
=
'
vs-dark vscode-theme-defaults-themes-dark_plus-json
'
;
const
DEFAULT_THEME_ID
=
'
vs-dark vscode-theme-defaults-themes-dark_plus-json
'
;
const
DEFAULT_THEME_NAME
=
'
d-Dark+ (default dark)
'
;
const
DEFAULT_THEME_NAME
=
'
Default Dark+
'
;
const
defaultBaseTheme
=
getBaseThemeId
(
DEFAULT_THEME_ID
);
const
defaultBaseTheme
=
getBaseThemeId
(
DEFAULT_THEME_ID
);
...
@@ -220,12 +221,6 @@ let defaultThemeColors: { [baseTheme: string]: IThemeSetting[] } = {
...
@@ -220,12 +221,6 @@ let defaultThemeColors: { [baseTheme: string]: IThemeSetting[] } = {
],
],
};
};
const
settingsIdPrefix
=
{
[
VS_DARK_THEME
]:
'
d-
'
,
[
VS_LIGHT_THEME
]:
'
l-
'
,
[
VS_HC_THEME
]:
'
hc-
'
,
};
export
class
ThemeService
implements
IThemeService
{
export
class
ThemeService
implements
IThemeService
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
...
@@ -242,6 +237,7 @@ export class ThemeService implements IThemeService {
...
@@ -242,6 +237,7 @@ export class ThemeService implements IThemeService {
container
:
HTMLElement
,
container
:
HTMLElement
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IWindowIPCService
private
windowService
:
IWindowIPCService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
IConfigurationEditingService
private
configurationEditingService
:
IConfigurationEditingService
,
@
IConfigurationEditingService
private
configurationEditingService
:
IConfigurationEditingService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
...
@@ -394,6 +390,10 @@ export class ThemeService implements IThemeService {
...
@@ -394,6 +390,10 @@ export class ThemeService implements IThemeService {
this
.
onColorThemeChange
.
fire
(
this
.
currentColorTheme
);
this
.
onColorThemeChange
.
fire
(
this
.
currentColorTheme
);
if
(
settingsTarget
===
ConfigurationTarget
.
USER
)
{
this
.
windowService
.
broadcast
({
channel
:
'
vscode:changeBaseTheme
'
,
payload
:
newTheme
.
getBaseThemeId
()
});
}
return
this
.
writeColorThemeConfiguration
(
settingsTarget
);
return
this
.
writeColorThemeConfiguration
(
settingsTarget
);
};
};
...
@@ -485,7 +485,7 @@ export class ThemeService implements IThemeService {
...
@@ -485,7 +485,7 @@ export class ThemeService implements IThemeService {
let
themeData
=
new
ColorThemeData
();
let
themeData
=
new
ColorThemeData
();
themeData
.
id
=
`
${
baseTheme
}
${
themeSelector
}
`
;
themeData
.
id
=
`
${
baseTheme
}
${
themeSelector
}
`
;
themeData
.
label
=
theme
.
label
||
Paths
.
basename
(
theme
.
path
);
themeData
.
label
=
theme
.
label
||
Paths
.
basename
(
theme
.
path
);
themeData
.
settingsId
=
settingsIdPrefix
[
baseTheme
]
+
(
theme
.
id
||
themeData
.
label
)
;
themeData
.
settingsId
=
theme
.
id
||
themeData
.
label
;
themeData
.
description
=
theme
.
description
;
themeData
.
description
=
theme
.
description
;
themeData
.
path
=
normalizedAbsolutePath
;
themeData
.
path
=
normalizedAbsolutePath
;
themeData
.
extensionData
=
extensionData
;
themeData
.
extensionData
=
extensionData
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录