Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
24da1f08
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
24da1f08
编写于
6月 08, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip: 2x2 grid
上级
4beda835
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
3 deletion
+60
-3
src/vs/base/browser/ui/grid/grid.ts
src/vs/base/browser/ui/grid/grid.ts
+5
-0
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+42
-1
src/vs/base/browser/ui/sash/sash.ts
src/vs/base/browser/ui/sash/sash.ts
+7
-1
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+6
-1
未找到文件。
src/vs/base/browser/ui/grid/grid.ts
浏览文件 @
24da1f08
...
...
@@ -343,6 +343,11 @@ export class Grid<T extends IView> implements IDisposable {
}
}
// TODO@joao: hack?
set2x2
():
void
{
this
.
gridview
.
set2x2
();
}
dispose
():
void
{
this
.
disposables
=
dispose
(
this
.
disposables
);
}
...
...
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
24da1f08
...
...
@@ -9,7 +9,7 @@ import 'vs/css!./gridview';
import
{
Event
,
anyEvent
,
Emitter
,
mapEvent
,
Relay
}
from
'
vs/base/common/event
'
;
import
{
Orientation
,
Sash
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
SplitView
,
IView
as
ISplitView
,
Sizing
,
ISplitViewStyles
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
import
{
empty
as
EmptyDisposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
empty
as
EmptyDisposable
,
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
$
,
append
}
from
'
vs/base/browser/dom
'
;
import
{
tail2
as
tail
}
from
'
vs/base/common/arrays
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
...
...
@@ -280,6 +280,19 @@ class BranchNode implements ISplitView, IDisposable {
this
.
_onDidChange
.
fire
();
}
// TODO@joao: hack?
set2x2
(
other
:
BranchNode
):
IDisposable
{
if
(
this
.
children
.
length
!==
2
||
other
.
children
.
length
!==
2
)
{
throw
new
Error
(
'
2x2 mode not allowed
'
);
}
const
mySash
=
this
.
splitview
.
sashes
[
0
];
const
otherSash
=
other
.
splitview
.
sashes
[
0
];
mySash
.
linkedSash
=
otherSash
;
otherSash
.
linkedSash
=
mySash
;
return
toDisposable
(()
=>
mySash
.
linkedSash
=
otherSash
.
linkedSash
=
undefined
);
}
dispose
():
void
{
for
(
const
child
of
this
.
children
)
{
child
.
dispose
();
...
...
@@ -401,6 +414,13 @@ export class GridView implements IDisposable {
private
onDidSashResetRelay
=
new
Relay
<
number
[]
>
();
readonly
onDidSashReset
:
Event
<
number
[]
>
=
this
.
onDidSashResetRelay
.
event
;
// this should be IDisposable| undefined instead
// that way we can expose a `is2x2: boolean` which can be used
// to determine a better auto sizing default for `addView`
// the 2x2 disposable should only be disposed when the base 2x2 grid goes away,
// not when views are added
private
disposable2x2
:
IDisposable
=
EmptyDisposable
;
private
get
root
():
BranchNode
{
return
this
.
_root
;
}
...
...
@@ -475,6 +495,9 @@ export class GridView implements IDisposable {
}
addView
(
view
:
IView
,
size
:
number
|
Sizing
,
location
:
number
[]):
void
{
this
.
disposable2x2
.
dispose
();
this
.
disposable2x2
=
EmptyDisposable
;
const
[
rest
,
index
]
=
tail
(
location
);
const
[
pathToParent
,
parent
]
=
this
.
getNode
(
rest
);
...
...
@@ -504,6 +527,9 @@ export class GridView implements IDisposable {
}
removeView
(
location
:
number
[],
sizing
?:
Sizing
):
IView
{
this
.
disposable2x2
.
dispose
();
this
.
disposable2x2
=
EmptyDisposable
;
const
[
rest
,
index
]
=
tail
(
location
);
const
[
pathToParent
,
parent
]
=
this
.
getNode
(
rest
);
...
...
@@ -684,6 +710,21 @@ export class GridView implements IDisposable {
return
this
.
getNode
(
rest
,
child
,
path
);
}
// TODO@joao: hack?
set2x2
():
void
{
if
(
this
.
root
.
children
.
length
!==
2
)
{
throw
new
Error
(
'
2x2 mode not allowed
'
);
}
const
[
first
,
second
]
=
this
.
root
.
children
;
if
(
!
(
first
instanceof
BranchNode
)
||
!
(
second
instanceof
BranchNode
))
{
throw
new
Error
(
'
2x2 mode not allowed
'
);
}
this
.
disposable2x2
=
first
.
set2x2
(
second
);
}
dispose
():
void
{
this
.
onDidSashResetRelay
.
dispose
();
this
.
root
.
dispose
();
...
...
src/vs/base/browser/ui/sash/sash.ts
浏览文件 @
24da1f08
...
...
@@ -96,6 +96,8 @@ export class Sash {
private
readonly
_onDidEnd
=
new
Emitter
<
void
>
();
readonly
onDidEnd
:
Event
<
void
>
=
this
.
_onDidEnd
.
event
;
linkedSash
:
Sash
|
undefined
=
undefined
;
private
orthogonalStartSashDisposables
:
IDisposable
[]
=
[];
private
_orthogonalStartSash
:
Sash
|
undefined
;
get
orthogonalStartSash
():
Sash
|
undefined
{
return
this
.
_orthogonalStartSash
;
}
...
...
@@ -178,6 +180,11 @@ export class Sash {
let
isMultisashResize
=
false
;
if
(
this
.
linkedSash
&&
!
(
e
as
any
).
__linkedSashEvent
)
{
(
e
as
any
).
__linkedSashEvent
=
true
;
this
.
linkedSash
.
onMouseDown
(
e
);
}
if
(
!
(
e
as
any
).
__orthogonalSashEvent
)
{
let
orthogonalSash
:
Sash
|
undefined
;
...
...
@@ -297,7 +304,6 @@ export class Sash {
const
startY
=
event
.
pageY
;
const
altKey
=
event
.
altKey
;
this
.
_onDidStart
.
fire
({
startX
:
startX
,
currentX
:
startX
,
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
24da1f08
...
...
@@ -22,7 +22,7 @@ import { IEditorGroupsAccessor, IEditorGroupView, IEditorPartOptions, getEditorP
import
{
EditorGroupView
}
from
'
vs/workbench/browser/parts/editor/editorGroupView
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
assign
,
equals
}
from
'
vs/base/common/objects
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
Scope
}
from
'
vs/workbench/common/memento
'
;
import
{
ISerializedEditorGroup
,
isSerializedEditorGroup
}
from
'
vs/workbench/common/editor/editorGroup
'
;
...
...
@@ -409,6 +409,11 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
if
(
gridHasFocus
)
{
this
.
_activeGroup
.
focus
();
}
// TODO@Joao: hack?
if
(
equals
(
layout
,
{
groups
:
[{
groups
:
[{},
{}]
},
{
groups
:
[{},
{}]
}]
}))
{
this
.
gridWidget
.
set2x2
();
}
}
addGroup
(
location
:
IEditorGroupView
|
GroupIdentifier
,
direction
:
GroupDirection
,
options
?:
IAddGroupOptions
):
IEditorGroupView
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录