Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
98e0b5b6
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,发现更多精彩内容 >>
提交
98e0b5b6
编写于
6月 15, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editorPart: plugin centeredViewLayout
上级
a86d0e59
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
37 deletion
+42
-37
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+36
-2
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+6
-35
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
98e0b5b6
...
...
@@ -34,6 +34,7 @@ import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/
import
{
EditorDropTarget
}
from
'
vs/workbench/browser/parts/editor/editorDropTarget
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
CenteredViewLayout
}
from
'
vs/base/browser/ui/centered/centeredViewLayout
'
;
interface
IEditorPartUIState
{
serializedGrid
:
ISerializedGrid
;
...
...
@@ -85,6 +86,8 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
private
whenRestoredComplete
:
TValueCallback
<
void
>
;
private
previousUIState
:
IEditorPartUIState
;
private
parentElement
:
HTMLElement
;
private
centeredViewLayout
:
CenteredViewLayout
;
constructor
(
id
:
string
,
...
...
@@ -695,11 +698,12 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
createContentArea
(
parent
:
HTMLElement
):
HTMLElement
{
// Grid control
this
.
parentElement
=
parent
;
this
.
doCreateGridControl
();
// Container
addClass
(
this
.
gridWidget
.
element
,
'
content
'
);
par
ent
.
appendChild
(
this
.
gridWidget
.
element
);
this
.
parentElem
ent
.
appendChild
(
this
.
gridWidget
.
element
);
// Drop support
...
...
@@ -708,6 +712,29 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
return
this
.
gridWidget
.
element
;
}
centerLayout
(
active
:
boolean
):
void
{
if
(
!
active
&&
this
.
centeredViewLayout
)
{
this
.
parentElement
.
removeChild
(
this
.
centeredViewLayout
.
element
);
this
.
parentElement
.
appendChild
(
this
.
gridWidget
.
element
);
this
.
centeredViewLayout
.
dispose
();
this
.
centeredViewLayout
=
undefined
;
}
if
(
active
)
{
this
.
centeredViewLayout
=
new
CenteredViewLayout
(
this
.
parentElement
,
{
element
:
this
.
gridWidget
.
element
,
layout
:
size
=>
this
.
gridWidget
.
layout
(
size
,
this
.
dimension
?
this
.
dimension
.
height
:
this
.
gridWidget
.
maximumHeight
),
minimumSize
:
this
.
gridWidget
.
minimumWidth
,
maximumSize
:
this
.
gridWidget
.
maximumWidth
,
onDidChange
:
Event
.
None
});
}
}
isLayoutCentered
():
boolean
{
return
!!
this
.
centeredViewLayout
;
}
private
doCreateGridControl
():
void
{
// Grid Widget (with previous UI state)
...
...
@@ -947,7 +974,11 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
// Layout Grid
try
{
this
.
gridWidget
.
layout
(
this
.
dimension
.
width
,
this
.
dimension
.
height
);
if
(
this
.
centeredViewLayout
)
{
this
.
centeredViewLayout
.
layout
(
this
.
dimension
.
width
);
}
else
{
this
.
gridWidget
.
layout
(
this
.
dimension
.
width
,
this
.
dimension
.
height
);
}
}
catch
(
error
)
{
this
.
gridError
(
error
);
}
...
...
@@ -989,6 +1020,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
if
(
this
.
gridWidget
)
{
this
.
gridWidget
=
dispose
(
this
.
gridWidget
);
}
if
(
this
.
centeredViewLayout
)
{
this
.
centeredViewLayout
=
dispose
(
this
.
centeredViewLayout
);
}
super
.
dispose
();
}
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
98e0b5b6
...
...
@@ -108,7 +108,7 @@ import { registerWindowDriver } from 'vs/platform/driver/electron-browser/driver
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
PreferencesService
}
from
'
vs/workbench/services/preferences/browser/preferencesService
'
;
import
{
IEditorService
,
IResourceEditor
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorGroupsService
,
GroupDirection
,
preferredSideBySideGroupDirection
,
GroupOrientation
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
IEditorGroupsService
,
GroupDirection
,
preferredSideBySideGroupDirection
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
EditorService
}
from
'
vs/workbench/services/editor/browser/editorService
'
;
import
{
IExtensionUrlHandler
,
ExtensionUrlHandler
}
from
'
vs/platform/url/electron-browser/inactiveExtensionUrlHandler
'
;
import
{
WorkbenchThemeService
}
from
'
vs/workbench/services/themes/electron-browser/workbenchThemeService
'
;
...
...
@@ -218,7 +218,6 @@ export class Workbench extends Disposable implements IPartService {
private
panelPosition
:
Position
;
private
panelHidden
:
boolean
;
private
zenMode
:
IZenMode
;
private
centeredEditorLayoutActive
:
boolean
;
private
fontAliasing
:
FontAliasingOption
;
private
hasInitialFilesToOpen
:
boolean
;
...
...
@@ -692,7 +691,7 @@ export class Workbench extends Disposable implements IPartService {
// Restore Forced Editor Center Mode
if
(
this
.
storageService
.
getBoolean
(
Workbench
.
centeredEditorLayoutActiveStorageKey
,
StorageScope
.
WORKSPACE
,
false
))
{
this
.
center
edEditorLayoutActive
=
true
;
this
.
center
EditorLayout
(
true
)
;
}
const
onRestored
=
(
error
?:
Error
):
IWorkbenchStartedInfo
=>
{
...
...
@@ -846,9 +845,6 @@ export class Workbench extends Disposable implements IPartService {
wasPanelVisible
:
false
,
transitionDisposeables
:
[]
};
// Centered Editor Layout
this
.
centeredEditorLayoutActive
=
false
;
}
private
setPanelPositionFromStorageOrConfig
()
{
...
...
@@ -1247,39 +1243,14 @@ export class Workbench extends Disposable implements IPartService {
}
isEditorLayoutCentered
():
boolean
{
return
this
.
centeredEditorLayoutActive
;
return
this
.
editorPart
.
isLayoutCentered
()
;
}
// TODO@ben support centered editor layout using empty groups or not? functionality missing:
// - resize sashes left and right in sync
// - IEditorInput.supportsCenteredEditorLayout() no longer supported
// - should we just allow to enter layout even if groups > 1? what does it then mean to be
// actively in centered editor layout though?
centerEditorLayout
(
active
:
boolean
,
skipLayout
?:
boolean
):
void
{
this
.
centeredEditorLayoutActive
=
active
;
this
.
storageService
.
store
(
Workbench
.
centeredEditorLayoutActiveStorageKey
,
this
.
centeredEditorLayoutActive
,
StorageScope
.
WORKSPACE
);
this
.
storageService
.
store
(
Workbench
.
centeredEditorLayoutActiveStorageKey
,
active
,
StorageScope
.
WORKSPACE
);
// Enter Centered Editor Layout
if
(
active
)
{
if
(
this
.
editorGroupService
.
count
===
1
)
{
const
activeGroup
=
this
.
editorGroupService
.
activeGroup
;
this
.
editorGroupService
.
addGroup
(
activeGroup
,
GroupDirection
.
LEFT
);
this
.
editorGroupService
.
addGroup
(
activeGroup
,
GroupDirection
.
RIGHT
);
this
.
editorGroupService
.
applyLayout
({
groups
:
[{
size
:
0.2
},
{
size
:
0.6
},
{
size
:
0.2
}],
orientation
:
GroupOrientation
.
HORIZONTAL
});
}
}
// Leave Centered Editor Layout
else
{
if
(
this
.
editorGroupService
.
count
===
3
)
{
this
.
editorGroupService
.
groups
.
forEach
(
group
=>
{
if
(
group
.
count
===
0
)
{
this
.
editorGroupService
.
removeGroup
(
group
);
}
});
}
}
this
.
editorPart
.
centerLayout
(
active
);
if
(
!
skipLayout
)
{
this
.
layout
();
...
...
@@ -1460,4 +1431,4 @@ export class Workbench extends Disposable implements IPartService {
}
//#endregion
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录