Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e5dd57a1
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,体验更适合开发者的 AI 搜索 >>
提交
e5dd57a1
编写于
10月 21, 2019
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add helper function for menubarvisibility
fixes #82907
上级
49607f98
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
29 deletion
+43
-29
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+2
-7
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+11
-0
src/vs/workbench/browser/actions/layoutActions.ts
src/vs/workbench/browser/actions/layoutActions.ts
+5
-3
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+3
-4
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+7
-5
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+2
-2
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+13
-8
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
e5dd57a1
...
...
@@ -14,7 +14,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
parseArgs
,
OPTIONS
}
from
'
vs/platform/environment/node/argv
'
;
import
product
from
'
vs/platform/product/common/product
'
;
import
{
IWindowSettings
,
MenuBarVisibility
,
IWindowConfiguration
,
ReadyState
,
getTitleBarStyle
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowSettings
,
MenuBarVisibility
,
IWindowConfiguration
,
ReadyState
,
getTitleBarStyle
,
getMenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
Disposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
isLinux
,
isMacintosh
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ICodeWindow
,
IWindowState
,
WindowMode
}
from
'
vs/platform/windows/electron-main/windows
'
;
...
...
@@ -936,12 +936,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
private
getMenuBarVisibility
():
MenuBarVisibility
{
const
windowConfig
=
this
.
configurationService
.
getValue
<
IWindowSettings
>
(
'
window
'
);
if
(
!
windowConfig
||
!
windowConfig
.
menuBarVisibility
)
{
return
'
default
'
;
}
let
menuBarVisibility
=
windowConfig
.
menuBarVisibility
;
let
menuBarVisibility
=
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
,
!!
this
.
config
?.
extensionDevelopmentPath
);
if
([
'
visible
'
,
'
toggle
'
,
'
hidden
'
].
indexOf
(
menuBarVisibility
)
<
0
)
{
menuBarVisibility
=
'
default
'
;
}
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
e5dd57a1
...
...
@@ -65,6 +65,17 @@ export function isFileToOpen(uriToOpen: IWindowOpenable): uriToOpen is IFileToOp
export
type
MenuBarVisibility
=
'
default
'
|
'
visible
'
|
'
toggle
'
|
'
hidden
'
|
'
compact
'
;
export
function
getMenuBarVisibility
(
configurationService
:
IConfigurationService
,
environment
:
IEnvironmentService
,
isExtensionDevelopment
=
environment
.
isExtensionDevelopment
):
MenuBarVisibility
{
const
titleBarStyle
=
getTitleBarStyle
(
configurationService
,
environment
,
isExtensionDevelopment
);
const
menuBarVisibility
=
configurationService
.
getValue
<
MenuBarVisibility
>
(
'
window.menuBarVisibility
'
);
if
(
titleBarStyle
===
'
native
'
&&
menuBarVisibility
===
'
compact
'
)
{
return
'
default
'
;
}
else
{
return
menuBarVisibility
;
}
}
export
interface
IWindowsConfiguration
{
window
:
IWindowSettings
;
}
...
...
src/vs/workbench/browser/actions/layoutActions.ts
浏览文件 @
e5dd57a1
...
...
@@ -16,13 +16,14 @@ import { IEditorGroupsService, GroupOrientation } from 'vs/workbench/services/ed
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
KeyMod
,
KeyCode
,
KeyChord
}
from
'
vs/base/common/keyCodes
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
get
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
isWindows
,
isLinux
,
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
IsMacNativeContext
}
from
'
vs/workbench/browser/contextkeys
'
;
import
{
KeybindingsRegistry
,
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
InEditorZenModeContext
,
IsCenteredLayoutContext
,
EditorAreaVisibleContext
}
from
'
vs/workbench/common/editor
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
SideBarVisibleContext
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
Extensions
.
WorkbenchActions
);
const
viewCategory
=
nls
.
localize
(
'
view
'
,
"
View
"
);
...
...
@@ -413,13 +414,14 @@ export class ToggleMenuBarAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
)
{
super
(
id
,
label
);
}
run
():
Promise
<
void
>
{
let
currentVisibilityValue
=
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
ToggleMenuBarAction
.
menuBarVisibilityKey
);
let
currentVisibilityValue
=
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
);
if
(
typeof
currentVisibilityValue
!==
'
string
'
)
{
currentVisibilityValue
=
'
default
'
;
}
...
...
src/vs/workbench/browser/layout.ts
浏览文件 @
e5dd57a1
...
...
@@ -23,7 +23,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import
{
ITitleService
}
from
'
vs/workbench/services/title/common/titleService
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
LifecyclePhase
,
StartupKind
,
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
}
from
'
vs/platform/windows/common/windows
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
,
getMenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IHostService
}
from
'
vs/workbench/services/host/browser/host
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IEditorService
,
IResourceEditor
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -40,7 +40,6 @@ import { assertIsDefined } from 'vs/base/common/types';
import
{
INotificationService
,
NotificationsFilter
}
from
'
vs/platform/notification/common/notification
'
;
enum
Settings
{
MENUBAR_VISIBLE
=
'
window.menuBarVisibility
'
,
ACTIVITYBAR_VISIBLE
=
'
workbench.activityBar.visible
'
,
STATUSBAR_VISIBLE
=
'
workbench.statusBar.visible
'
,
...
...
@@ -326,7 +325,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
// Menubar visibility
const
newMenubarVisibility
=
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
Settings
.
MENUBAR_VISIBLE
);
const
newMenubarVisibility
=
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
);
this
.
setMenubarVisibility
(
newMenubarVisibility
,
!!
skipLayout
);
}
...
...
@@ -373,7 +372,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this
.
state
.
fullscreen
=
isFullscreen
();
// Menubar visibility
this
.
state
.
menuBar
.
visibility
=
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
Settings
.
MENUBAR_VISIBLE
);
this
.
state
.
menuBar
.
visibility
=
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
);
// Activity bar visibility
this
.
state
.
activityBar
.
hidden
=
!
this
.
configurationService
.
getValue
<
string
>
(
Settings
.
ACTIVITYBAR_VISIBLE
);
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
e5dd57a1
...
...
@@ -36,8 +36,9 @@ import { Schemas } from 'vs/base/common/network';
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
CustomMenubarControl
}
from
'
vs/workbench/browser/parts/titlebar/menubarControl
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
get
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
interface
ICachedViewlet
{
id
:
string
;
...
...
@@ -89,7 +90,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
@
IViewsService
private
readonly
viewsService
:
IViewsService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IWorkbenchEnvironmentService
workbenchEnvironmentService
:
IWorkbenchEnvironmentService
@
IWorkbenchEnvironmentService
workbenchEnvironmentService
:
IWorkbenchEnvironmentService
,
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
)
{
super
(
Parts
.
ACTIVITYBAR_PART
,
{
hasTitle
:
false
},
themeService
,
storageService
,
layoutService
);
...
...
@@ -112,7 +114,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
getCompositePinnedAction
:
(
compositeId
:
string
)
=>
this
.
getCompositeActions
(
compositeId
).
pinnedAction
,
getOnCompositeClickAction
:
(
compositeId
:
string
)
=>
this
.
instantiationService
.
createInstance
(
ToggleViewletAction
,
assertIsDefined
(
this
.
viewletService
.
getViewlet
(
compositeId
))),
getContextMenuActions
:
()
=>
{
const
menuBarVisibility
=
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
'
window.menuBarVisibility
'
);
const
menuBarVisibility
=
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
);
const
actions
=
[];
if
(
menuBarVisibility
===
'
compact
'
||
(
menuBarVisibility
===
'
hidden
'
&&
isWeb
))
{
...
...
@@ -157,7 +159,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Register for configuration changes
this
.
_register
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
affectsConfiguration
(
'
window.menuBarVisibility
'
))
{
if
(
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
'
window.menuBarVisibility
'
)
===
'
compact
'
)
{
if
(
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
)
===
'
compact
'
)
{
this
.
installMenubar
();
}
else
{
this
.
uninstallMenubar
();
...
...
@@ -244,7 +246,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
parent
.
appendChild
(
this
.
content
);
// Install menubar if compact
if
(
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
'
window.menuBarVisibility
'
)
===
'
compact
'
)
{
if
(
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
)
===
'
compact
'
)
{
this
.
installMenubar
();
}
...
...
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
e5dd57a1
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
IMenuService
,
MenuId
,
IMenu
,
SubmenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
registerThemingParticipant
,
ITheme
,
ICssStyleCollector
,
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
,
IWindowOpenable
}
from
'
vs/platform/windows/common/windows
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
,
IWindowOpenable
,
getMenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
...
...
@@ -472,7 +472,7 @@ export class CustomMenubarControl extends MenubarControl {
}
private
get
currentMenubarVisibility
():
MenuBarVisibility
{
return
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
'
window.menuBarVisibility
'
);
return
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
);
}
private
get
currentDisableMenuBarAltFocus
():
boolean
{
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
e5dd57a1
...
...
@@ -8,7 +8,7 @@ import * as resources from 'vs/base/common/resources';
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
ITitleService
,
ITitleProperties
}
from
'
vs/workbench/services/title/common/titleService
'
;
import
{
getZoomFactor
}
from
'
vs/base/browser/browser
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
}
from
'
vs/platform/windows/common/windows
'
;
import
{
MenuBarVisibility
,
getTitleBarStyle
,
getMenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
...
...
@@ -77,6 +77,7 @@ export class TitlebarPart extends Part implements ITitleService {
private
menubar
?:
HTMLElement
;
private
resizer
:
HTMLElement
|
undefined
;
private
lastLayoutDimensions
:
Dimension
|
undefined
;
private
titleBarStyle
:
'
native
'
|
'
custom
'
;
private
pendingTitle
:
string
|
undefined
;
...
...
@@ -110,6 +111,8 @@ export class TitlebarPart extends Part implements ITitleService {
this
.
contextMenu
=
this
.
_register
(
menuService
.
createMenu
(
MenuId
.
TitleBarContext
,
contextKeyService
));
this
.
titleBarStyle
=
getTitleBarStyle
(
this
.
configurationService
,
this
.
environmentService
);
this
.
registerListeners
();
}
...
...
@@ -138,11 +141,13 @@ export class TitlebarPart extends Part implements ITitleService {
this
.
titleUpdater
.
schedule
();
}
if
(
event
.
affectsConfiguration
(
'
window.menuBarVisibility
'
))
{
if
(
this
.
currentMenubarVisibility
===
'
compact
'
)
{
this
.
uninstallMenubar
();
}
else
{
this
.
installMenubar
();
if
(
this
.
titleBarStyle
!==
'
native
'
)
{
if
(
event
.
affectsConfiguration
(
'
window.menuBarVisibility
'
))
{
if
(
this
.
currentMenubarVisibility
===
'
compact
'
)
{
this
.
uninstallMenubar
();
}
else
{
this
.
installMenubar
();
}
}
}
...
...
@@ -385,7 +390,7 @@ export class TitlebarPart extends Part implements ITitleService {
// Menubar: install a custom menu bar depending on configuration
// and when not in activity bar
if
(
getTitleBarStyle
(
this
.
configurationService
,
this
.
environmentService
)
!==
'
native
'
if
(
this
.
titleBarStyle
!==
'
native
'
&&
(
!
isMacintosh
||
isWeb
)
&&
this
.
currentMenubarVisibility
!==
'
compact
'
)
{
this
.
installMenubar
();
...
...
@@ -567,7 +572,7 @@ export class TitlebarPart extends Part implements ITitleService {
}
private
get
currentMenubarVisibility
():
MenuBarVisibility
{
return
this
.
configurationService
.
getValue
<
MenuBarVisibility
>
(
'
window.menuBarVisibility
'
);
return
getMenuBarVisibility
(
this
.
configurationService
,
this
.
environmentService
);
}
updateLayout
(
dimension
:
Dimension
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录