Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
329d38e6
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,发现更多精彩内容 >>
提交
329d38e6
编写于
6月 15, 2018
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fallback to old menubar when using macOS or native title
上级
8c5a4fd4
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
31 addition
and
11 deletion
+31
-11
src/vs/base/browser/ui/actionbar/actionbar.ts
src/vs/base/browser/ui/actionbar/actionbar.ts
+3
-1
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+10
-0
src/vs/platform/menubar/electron-main/menubarService.ts
src/vs/platform/menubar/electron-main/menubarService.ts
+5
-1
src/vs/workbench/browser/parts/menubar/menubarPart.ts
src/vs/workbench/browser/parts/menubar/menubarPart.ts
+13
-9
未找到文件。
src/vs/base/browser/ui/actionbar/actionbar.ts
浏览文件 @
329d38e6
...
...
@@ -278,7 +278,9 @@ export class ActionItem extends BaseActionItem {
public
_updateLabel
():
void
{
if
(
this
.
options
.
label
)
{
let
label
=
this
.
getAction
().
label
;
if
(
label
)
{
label
=
label
.
replace
(
BaseActionItem
.
MNEMONIC_REGEX
,
'
<u>$1</u>
'
);
}
this
.
$e
.
innerHtml
(
label
);
}
}
...
...
src/vs/code/electron-main/app.ts
浏览文件 @
329d38e6
...
...
@@ -63,6 +63,8 @@ import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver';
import
{
IMenubarService
}
from
'
vs/platform/menubar/common/menubar
'
;
import
{
MenubarService
}
from
'
vs/platform/menubar/electron-main/menubarService
'
;
import
{
MenubarChannel
}
from
'
vs/platform/menubar/common/menubarIpc
'
;
// TODO@sbatten: Remove after conversion to new dynamic menubar
import
{
CodeMenu
}
from
'
vs/code/electron-main/menus
'
;
export
class
CodeApplication
{
...
...
@@ -493,6 +495,14 @@ export class CodeApplication {
}
}
// TODO@sbatten: Remove when menu is converted
// Install Menu
const
instantiationService
=
accessor
.
get
(
IInstantiationService
);
const
configurationService
=
accessor
.
get
(
IConfigurationService
);
if
(
platform
.
isMacintosh
||
configurationService
.
getValue
<
string
>
(
'
window.titleBarStyle
'
)
!==
'
custom
'
)
{
instantiationService
.
createInstance
(
CodeMenu
);
}
// Jump List
this
.
historyMainService
.
updateWindowsJumpList
();
this
.
historyMainService
.
onRecentlyOpenedChange
(()
=>
this
.
historyMainService
.
updateWindowsJumpList
());
...
...
src/vs/platform/menubar/electron-main/menubarService.ts
浏览文件 @
329d38e6
...
...
@@ -10,6 +10,7 @@ import { Menubar } from 'vs/code/electron-main/menubar';
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
export
class
MenubarService
implements
IMenubarService
{
_serviceBrand
:
any
;
...
...
@@ -21,8 +22,11 @@ export class MenubarService implements IMenubarService {
@
ILogService
private
logService
:
ILogService
)
{
// Install Menu
// TODO@sbatten: Remove if block
if
(
isMacintosh
&&
isWindows
)
{
this
.
_menubar
=
this
.
instantiationService
.
createInstance
(
Menubar
);
}
}
updateMenubar
(
windowId
:
number
,
menus
:
IMenubarData
):
TPromise
<
void
>
{
this
.
logService
.
trace
(
'
menubarService#updateMenubar
'
,
windowId
);
...
...
src/vs/workbench/browser/parts/menubar/menubarPart.ts
浏览文件 @
329d38e6
...
...
@@ -144,13 +144,14 @@ export class MenubarPart extends Part {
}
});
for
(
let
topLevelMenuName
of
Object
.
keys
(
this
.
topLevelMenus
))
{
this
.
topLevelMenus
[
topLevelMenuName
].
onDidChange
(()
=>
this
.
setupNativeMenubar
());
}
this
.
_onVisibilityChange
=
new
Emitter
<
Dimension
>
();
this
.
setupNativeMenubar
();
if
(
isMacintosh
||
this
.
currentTitlebarStyleSetting
!==
'
custom
'
)
{
for
(
let
topLevelMenuName
of
Object
.
keys
(
this
.
topLevelMenus
))
{
this
.
topLevelMenus
[
topLevelMenuName
].
onDidChange
(()
=>
this
.
setupMenubar
());
}
this
.
setupMenubar
();
}
this
.
isFocused
=
false
;
...
...
@@ -247,7 +248,7 @@ export class MenubarPart extends Part {
}
}
if
(
this
.
currentEnableMenuBarMnemonics
)
{
if
(
this
.
currentEnableMenuBarMnemonics
&&
this
.
customMenus
)
{
this
.
customMenus
.
forEach
(
customMenu
=>
{
let
child
=
customMenu
.
titleElement
.
child
();
if
(
child
)
{
...
...
@@ -276,7 +277,7 @@ export class MenubarPart extends Part {
}
private
setupMenubar
():
void
{
if
(
this
.
currentTitlebarStyleSetting
===
'
custom
'
)
{
if
(
!
isMacintosh
&&
this
.
currentTitlebarStyleSetting
===
'
custom
'
)
{
this
.
setupCustomMenubar
();
}
else
{
this
.
setupNativeMenubar
();
...
...
@@ -284,8 +285,11 @@ export class MenubarPart extends Part {
}
private
setupNativeMenubar
():
void
{
// TODO@sbatten: Remove once native menubar is ready
if
(
isMacintosh
&&
isWindows
)
{
this
.
menubarService
.
updateMenubar
(
this
.
windowService
.
getCurrentWindowId
(),
this
.
getMenubarMenus
());
}
}
private
registerMnemonic
(
menuIndex
:
number
,
keyCode
:
KeyCode
):
void
{
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
...
...
@@ -699,7 +703,7 @@ export class MenubarPart extends Part {
// Build the menubar
if
(
this
.
container
)
{
this
.
setup
Custom
Menubar
();
this
.
setupMenubar
();
}
return
this
.
container
.
getHTMLElement
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录