Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ffc8c1a8
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,发现更多精彩内容 >>
提交
ffc8c1a8
编写于
6月 12, 2018
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
several fixes and cleanup for native side
上级
f08cdae1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
96 addition
and
43 deletion
+96
-43
src/vs/workbench/browser/parts/menubar/media/menubarpart.css
src/vs/workbench/browser/parts/menubar/media/menubarpart.css
+0
-1
src/vs/workbench/browser/parts/menubar/menubar.contribution.ts
...s/workbench/browser/parts/menubar/menubar.contribution.ts
+3
-3
src/vs/workbench/browser/parts/menubar/menubarPart.ts
src/vs/workbench/browser/parts/menubar/menubarPart.ts
+93
-39
未找到文件。
src/vs/workbench/browser/parts/menubar/media/menubarpart.css
浏览文件 @
ffc8c1a8
...
...
@@ -29,7 +29,6 @@
position
:
relative
;
z-index
:
10
;
cursor
:
pointer
;
overflow
:
hidden
;
-webkit-app-region
:
no-drag
;
}
...
...
src/vs/workbench/browser/parts/menubar/menubar.contribution.ts
浏览文件 @
ffc8c1a8
...
...
@@ -812,16 +812,16 @@ function layoutMenuRegistration() {
MenuRegistry
.
appendMenuItem
(
MenuId
.
MenubarLayoutMenu
,
{
group
:
'
2_layouts
'
,
command
:
{
id
:
'
workbench.action.editorLayoutTwo
Columns
'
,
id
:
'
workbench.action.editorLayoutTwo
ByTwoGrid
'
,
title
:
nls
.
localize
({
key
:
'
miTwoByTwoGridEditorLayout
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Grid (2x2)
"
)
},
order
:
7
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
Menubar
View
Menu
,
{
MenuRegistry
.
appendMenuItem
(
MenuId
.
Menubar
Layout
Menu
,
{
group
:
'
2_layouts
'
,
command
:
{
id
:
'
workbench.action.editorLayoutTwo
ByTwoGrid
'
,
id
:
'
workbench.action.editorLayoutTwo
ColumnsRight
'
,
title
:
nls
.
localize
({
key
:
'
miTwoColumnsRightEditorLayout
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Two C&&olumns Right
"
)
},
order
:
8
...
...
src/vs/workbench/browser/parts/menubar/menubarPart.ts
浏览文件 @
ffc8c1a8
...
...
@@ -41,10 +41,10 @@ export class MenubarPart extends Part {
private
keys
=
[
'
files.autoSave
'
,
'
window.menuBarVisibility
'
,
//
'editor.multiCursorModifier',
//
'workbench.sideBar.location',
//
'workbench.statusBar.visible',
//
'workbench.activityBar.visible',
'
editor.multiCursorModifier
'
,
'
workbench.sideBar.location
'
,
'
workbench.statusBar.visible
'
,
'
workbench.activityBar.visible
'
,
'
window.enableMenuBarMnemonics
'
,
// 'window.nativeTabs'
];
...
...
@@ -152,59 +152,70 @@ export class MenubarPart extends Part {
return
enableMenuBarMnemonics
;
}
private
get
currentMultiCursorSetting
():
string
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
editor.multiCursorModifier
'
);
}
private
get
currentAutoSaveSetting
():
string
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
files.autoSave
'
);
}
private
get
currentSidebarPosition
():
string
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
workbench.sideBar.location
'
);
}
private
get
currentStatusBarVisibility
():
boolean
{
let
setting
=
this
.
configurationService
.
getValue
<
boolean
>
(
'
workbench.statusBar.visible
'
);
if
(
typeof
setting
!==
'
boolean
'
)
{
setting
=
true
;
}
return
setting
;
}
private
get
currentActivityBarVisibility
():
boolean
{
let
setting
=
this
.
configurationService
.
getValue
<
boolean
>
(
'
workbench.activityBar.visible
'
);
if
(
typeof
setting
!==
'
boolean
'
)
{
setting
=
true
;
}
return
setting
;
}
private
get
currentTitlebarStyleSetting
():
string
{
return
this
.
configurationService
.
getValue
<
string
>
(
'
window.titleBarStyle
'
);
}
private
onDidChangeFullscreen
():
void
{
this
.
updateStyles
();
}
private
onConfigurationUpdated
(
event
:
IConfigurationChangeEvent
):
void
{
if
(
this
.
keys
.
some
(
key
=>
event
.
affectsConfiguration
(
key
)))
{
this
.
setup
Custom
Menubar
();
this
.
setupMenubar
();
}
}
private
registerListeners
():
void
{
// Keep flag when app quits
// app.on('will-quit', () => {
// this.isQuitting = true;
// });
// // Listen to some events from window service to update menu
// this.historyMainService.onRecentlyOpenedChange(() => this.updateMenu());
// this.windowsMainService.onWindowsCountChanged(e => this.onWindowsCountChanged(e));
// this.windowsMainService.onActiveWindowChanged(() => this.updateWorkspaceMenuItems());
// this.windowsMainService.onWindowReady(() => this.updateWorkspaceMenuItems());
// this.windowsMainService.onWindowClose(() => this.updateWorkspaceMenuItems());
browser
.
onDidChangeFullscreen
(()
=>
this
.
onDidChangeFullscreen
());
// Listen to extension viewlets
// ipc.on('vscode:extensionViewlets', (event: any, rawExtensionViewlets: string) => {
// let extensionViewlets: IExtensionViewlet[] = [];
// try {
// extensionViewlets = JSON.parse(rawExtensionViewlets);
// } catch (error) {
// // Should not happen
// }
// if (extensionViewlets.length) {
// this.extensionViewlets = extensionViewlets;
// this.updateMenu();
// }
// });
// Update when auto save config changes
// Update when config changes
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
));
// Listen to update service
// this.updateService.onStateChange(() => this.
updateMenu
());
// this.updateService.onStateChange(() => this.
setupMenubar
());
// Listen to keybindings change
// this.keybindingsResolver.onKeybindingsChanged(() => this.scheduleUpdateMenu());
this
.
keybindingService
.
onDidUpdateKeybindings
(()
=>
this
.
setupMenubar
());
}
private
setupMenubar
():
void
{
if
(
this
.
currentTitlebarStyleSetting
===
'
custom
'
)
{
this
.
setupCustomMenubar
();
}
else
{
this
.
setupNativeMenubar
();
}
}
private
setupNativeMenubar
():
void
{
...
...
@@ -226,7 +237,7 @@ export class MenubarPart extends Part {
});
}
private
setCheckedStatus
(
action
:
IAction
)
{
private
setCheckedStatus
(
action
:
IAction
|
IMenubarMenuItemAction
)
{
switch
(
action
.
id
)
{
case
'
workbench.action.toggleAutoSave
'
:
action
.
checked
=
this
.
currentAutoSaveSetting
!==
'
off
'
;
...
...
@@ -237,7 +248,47 @@ export class MenubarPart extends Part {
}
}
private
calculateActionLabel
(
label
:
string
):
string
{
private
calculateActionLabel
(
action
:
IAction
|
IMenubarMenuItemAction
):
string
{
let
label
=
action
.
label
;
switch
(
action
.
id
)
{
case
'
workbench.action.toggleMultiCursorModifier
'
:
if
(
this
.
currentMultiCursorSetting
===
'
ctrlCmd
'
)
{
label
=
nls
.
localize
(
'
miMultiCursorAlt
'
,
"
Switch to Alt+Click for Multi-Cursor
"
);
}
else
{
label
=
isMacintosh
?
nls
.
localize
(
'
miMultiCursorCmd
'
,
"
Switch to Cmd+Click for Multi-Cursor
"
)
:
nls
.
localize
(
'
miMultiCursorCtrl
'
,
"
Switch to Ctrl+Click for Multi-Cursor
"
);
}
break
;
case
'
workbench.action.toggleSidebarPosition
'
:
if
(
this
.
currentSidebarPosition
!==
'
right
'
)
{
label
=
nls
.
localize
({
key
:
'
miMoveSidebarRight
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Move Side Bar Right
"
);
}
else
{
label
=
nls
.
localize
({
key
:
'
miMoveSidebarLeft
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Move Side Bar Left
"
);
}
break
;
case
'
workbench.action.toggleStatusbarVisibility
'
:
if
(
this
.
currentStatusBarVisibility
)
{
label
=
nls
.
localize
({
key
:
'
miHideStatusbar
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Hide Status Bar
"
);
}
else
{
label
=
nls
.
localize
({
key
:
'
miShowStatusbar
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Show Status Bar
"
);
}
break
;
case
'
workbench.action.toggleActivityBarVisibility
'
:
if
(
this
.
currentActivityBarVisibility
)
{
label
=
nls
.
localize
({
key
:
'
miHideActivityBar
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Hide &&Activity Bar
"
);
}
else
{
label
=
nls
.
localize
({
key
:
'
miShowActivityBar
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
Show &&Activity Bar
"
);
}
break
;
default
:
break
;
}
return
this
.
currentEnableMenuBarMnemonics
?
label
:
label
.
replace
(
/&&
(
.
)
/g
,
'
$1
'
);
}
...
...
@@ -279,7 +330,7 @@ export class MenubarPart extends Part {
const
[,
actions
]
=
group
;
actions
.
map
((
action
:
IAction
)
=>
{
action
.
label
=
this
.
calculateActionLabel
(
action
.
label
);
action
.
label
=
this
.
calculateActionLabel
(
action
);
this
.
setCheckedStatus
(
action
);
});
...
...
@@ -382,6 +433,9 @@ export class MenubarPart extends Part {
enabled
:
menuItemAction
.
enabled
};
this
.
setCheckedStatus
(
menubarMenuItem
);
menubarMenuItem
.
label
=
this
.
calculateActionLabel
(
menubarMenuItem
);
menubarMenu
.
items
.
push
(
menubarMenuItem
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录