Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
59e53464
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,发现更多精彩内容 >>
提交
59e53464
编写于
10月 07, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Write window zoom configuration to settings (fixes #13334)
上级
1a15210f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
56 addition
and
27 deletion
+56
-27
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+56
-27
未找到文件。
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
59e53464
...
...
@@ -18,12 +18,12 @@ import product from 'vs/platform/product';
import
pkg
from
'
vs/platform/package
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
IWindowConfiguration
}
from
'
vs/workbench/electron-browser/common
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IConfigurationEditingService
,
ConfigurationTarget
}
from
'
vs/workbench/services/configuration/common/configurationEditing
'
;
import
{
IExtensionManagementService
,
LocalExtensionType
,
ILocalExtension
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
I
ConfigurationService
}
from
'
vs/platform
/configuration/common/configuration
'
;
import
{
I
WorkspaceConfigurationService
}
from
'
vs/workbench/services
/configuration/common/configuration
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
...
...
@@ -205,44 +205,82 @@ export class ToggleDevToolsAction extends Action {
}
}
export
class
ZoomInAction
extends
Action
{
export
abstract
class
BaseZoomAction
extends
Action
{
private
static
SETTING_KEY
=
'
window.zoomLevel
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IWorkspaceConfigurationService
private
configurationService
:
IWorkspaceConfigurationService
,
@
IConfigurationEditingService
private
configurationEditingService
:
IConfigurationEditingService
)
{
super
(
id
,
label
);
}
protected
setConfiguredZoomLevel
(
level
:
number
):
void
{
let
target
=
ConfigurationTarget
.
USER
;
if
(
typeof
this
.
configurationService
.
lookup
(
BaseZoomAction
.
SETTING_KEY
).
workspace
===
'
number
'
)
{
target
=
ConfigurationTarget
.
WORKSPACE
;
}
this
.
configurationEditingService
.
writeConfiguration
(
target
,
{
key
:
BaseZoomAction
.
SETTING_KEY
,
value
:
level
}).
done
(
null
,
error
=>
{
// Fallback to apply on window
webFrame
.
setZoomLevel
(
level
);
browser
.
setZoomLevel
(
level
);
// Ensure others can listen to zoom level changes
// Inform user
this
.
messageService
.
show
(
Severity
.
Error
,
error
);
});
}
}
export
class
ZoomInAction
extends
BaseZoomAction
{
public
static
ID
=
'
workbench.action.zoomIn
'
;
public
static
LABEL
=
nls
.
localize
(
'
zoomIn
'
,
"
Zoom In
"
);
constructor
(
id
:
string
,
label
:
string
)
{
super
(
id
,
label
);
constructor
(
id
:
string
,
label
:
string
,
@
IMessageService
messageService
:
IMessageService
,
@
IWorkspaceConfigurationService
configurationService
:
IWorkspaceConfigurationService
,
@
IConfigurationEditingService
configurationEditingService
:
IConfigurationEditingService
)
{
super
(
id
,
label
,
messageService
,
configurationService
,
configurationEditingService
);
}
public
run
():
TPromise
<
boolean
>
{
webFrame
.
setZoomLevel
(
webFrame
.
getZoomLevel
()
+
1
);
browser
.
setZoomLevel
(
webFrame
.
getZoomLevel
());
// Ensure others can listen to zoom level changes
this
.
setConfiguredZoomLevel
(
webFrame
.
getZoomLevel
()
+
1
);
return
TPromise
.
as
(
true
);
}
}
export
class
ZoomOutAction
extends
Action
{
export
class
ZoomOutAction
extends
BaseZoom
Action
{
public
static
ID
=
'
workbench.action.zoomOut
'
;
public
static
LABEL
=
nls
.
localize
(
'
zoomOut
'
,
"
Zoom Out
"
);
constructor
(
id
:
string
,
label
:
string
label
:
string
,
@
IMessageService
messageService
:
IMessageService
,
@
IWorkspaceConfigurationService
configurationService
:
IWorkspaceConfigurationService
,
@
IConfigurationEditingService
configurationEditingService
:
IConfigurationEditingService
)
{
super
(
id
,
label
);
super
(
id
,
label
,
messageService
,
configurationService
,
configurationEditingService
);
}
public
run
():
TPromise
<
boolean
>
{
webFrame
.
setZoomLevel
(
webFrame
.
getZoomLevel
()
-
1
);
browser
.
setZoomLevel
(
webFrame
.
getZoomLevel
());
// Ensure others can listen to zoom level changes
this
.
setConfiguredZoomLevel
(
webFrame
.
getZoomLevel
()
-
1
);
return
TPromise
.
as
(
true
);
}
}
export
class
ZoomResetAction
extends
Action
{
export
class
ZoomResetAction
extends
BaseZoom
Action
{
public
static
ID
=
'
workbench.action.zoomReset
'
;
public
static
LABEL
=
nls
.
localize
(
'
zoomReset
'
,
"
Reset Zoom
"
);
...
...
@@ -250,27 +288,18 @@ export class ZoomResetAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
@
IMessageService
messageService
:
IMessageService
,
@
IWorkspaceConfigurationService
configurationService
:
IWorkspaceConfigurationService
,
@
IConfigurationEditingService
configurationEditingService
:
IConfigurationEditingService
)
{
super
(
id
,
label
);
super
(
id
,
label
,
messageService
,
configurationService
,
configurationEditingService
);
}
public
run
():
TPromise
<
boolean
>
{
const
level
=
this
.
getConfiguredZoomLevel
();
webFrame
.
setZoomLevel
(
level
);
browser
.
setZoomLevel
(
webFrame
.
getZoomLevel
());
// Ensure others can listen to zoom level changes
this
.
setConfiguredZoomLevel
(
0
);
return
TPromise
.
as
(
true
);
}
private
getConfiguredZoomLevel
():
number
{
const
windowConfig
=
this
.
configurationService
.
getConfiguration
<
IWindowConfiguration
>
();
if
(
windowConfig
.
window
&&
typeof
windowConfig
.
window
.
zoomLevel
===
'
number
'
)
{
return
windowConfig
.
window
.
zoomLevel
;
}
return
0
;
// default
}
}
/* Copied from loader.ts */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录