Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2ec11ee0
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,发现更多精彩内容 >>
提交
2ec11ee0
编写于
6月 15, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BaseEditor with dimension constraints
上级
1d9150ca
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
53 addition
and
12 deletion
+53
-12
src/vs/base/browser/ui/grid/gridview.ts
src/vs/base/browser/ui/grid/gridview.ts
+1
-1
src/vs/workbench/browser/parts/editor/baseEditor.ts
src/vs/workbench/browser/parts/editor/baseEditor.ts
+6
-0
src/vs/workbench/browser/parts/editor/editor.ts
src/vs/workbench/browser/parts/editor/editor.ts
+2
-2
src/vs/workbench/browser/parts/editor/editorControl.ts
src/vs/workbench/browser/parts/editor/editorControl.ts
+15
-2
src/vs/workbench/browser/parts/editor/editorGroupView.ts
src/vs/workbench/browser/parts/editor/editorGroupView.ts
+9
-7
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+20
-0
未找到文件。
src/vs/base/browser/ui/grid/gridview.ts
浏览文件 @
2ec11ee0
...
...
@@ -363,7 +363,7 @@ class LeafNode implements ISplitView, IDisposable {
}
get
onDidChange
():
Event
<
number
>
{
return
mapEvent
(
this
.
view
.
onDidChange
,
this
.
orientation
===
Orientation
.
HORIZONTAL
?
({
width
})
=>
width
:
({
height
})
=>
height
);
return
mapEvent
(
this
.
view
.
onDidChange
,
this
.
orientation
===
Orientation
.
HORIZONTAL
?
e
=>
e
&&
e
.
width
:
e
=>
e
&&
e
.
height
);
}
set
orthogonalStartSash
(
sash
:
Sash
)
{
...
...
src/vs/workbench/browser/parts/editor/baseEditor.ts
浏览文件 @
2ec11ee0
...
...
@@ -16,6 +16,7 @@ import { LRUCache } from 'vs/base/common/map';
import
URI
from
'
vs/base/common/uri
'
;
import
{
once
}
from
'
vs/base/common/event
'
;
import
{
isEmptyObject
}
from
'
vs/base/common/types
'
;
import
{
DEFAULT_EDITOR_MIN_DIMENSIONS
,
DEFAULT_EDITOR_MAX_DIMENSIONS
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
/**
* The base class of editors in the workbench. Editors register themselves for specific editor inputs.
...
...
@@ -39,6 +40,11 @@ export abstract class BaseEditor extends Panel implements IEditor {
private
_options
:
EditorOptions
;
private
_group
:
IEditorGroup
;
readonly
minimumWidth
:
number
=
DEFAULT_EDITOR_MIN_DIMENSIONS
.
width
;
readonly
maximumWidth
:
number
=
DEFAULT_EDITOR_MAX_DIMENSIONS
.
width
;
readonly
minimumHeight
:
number
=
DEFAULT_EDITOR_MIN_DIMENSIONS
.
height
;
readonly
maximumHeight
:
number
=
DEFAULT_EDITOR_MAX_DIMENSIONS
.
height
;
constructor
(
id
:
string
,
telemetryService
:
ITelemetryService
,
...
...
src/vs/workbench/browser/parts/editor/editor.ts
浏览文件 @
2ec11ee0
...
...
@@ -21,8 +21,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
export
const
EDITOR_TITLE_HEIGHT
=
35
;
export
const
EDITOR_MIN_DIMENSIONS
=
new
Dimension
(
220
,
70
);
export
const
EDITOR_MAX_DIMENSIONS
=
new
Dimension
(
Number
.
POSITIVE_INFINITY
,
Number
.
POSITIVE_INFINITY
);
export
const
DEFAULT_
EDITOR_MIN_DIMENSIONS
=
new
Dimension
(
220
,
70
);
export
const
DEFAULT_
EDITOR_MAX_DIMENSIONS
=
new
Dimension
(
Number
.
POSITIVE_INFINITY
,
Number
.
POSITIVE_INFINITY
);
export
interface
IEditorPartOptions
extends
IWorkbenchEditorPartConfiguration
{
iconTheme
?:
string
;
...
...
src/vs/workbench/browser/parts/editor/editorControl.ts
浏览文件 @
2ec11ee0
...
...
@@ -34,6 +34,14 @@ export class EditorControl extends Disposable {
private
dimension
:
Dimension
;
private
editorOperation
:
LongRunningOperation
;
get
minimumWidth
():
number
{
return
this
.
_activeControl
?
this
.
_activeControl
.
minimumWidth
:
0
;
}
get
minimumHeight
():
number
{
return
this
.
_activeControl
?
this
.
_activeControl
.
minimumHeight
:
0
;
}
get
maximumWidth
():
number
{
return
this
.
_activeControl
?
this
.
_activeControl
.
maximumWidth
:
Number
.
POSITIVE_INFINITY
;
}
get
maximumHeight
():
number
{
return
this
.
_activeControl
?
this
.
_activeControl
.
maximumHeight
:
Number
.
POSITIVE_INFINITY
;
}
private
_onDidChange
=
new
Emitter
<
{
width
:
number
;
height
:
number
;
}
>
();
readonly
onDidChange
:
Event
<
{
width
:
number
;
height
:
number
;
}
>
=
this
.
_onDidChange
.
event
;
private
_activeControl
:
BaseEditor
;
private
controls
:
BaseEditor
[]
=
[];
...
...
@@ -49,6 +57,11 @@ export class EditorControl extends Disposable {
this
.
editorOperation
=
this
.
_register
(
new
LongRunningOperation
(
progressService
));
}
private
setActiveControl
(
activeControl
:
BaseEditor
)
{
this
.
_activeControl
=
activeControl
;
this
.
_onDidChange
.
fire
();
}
get
activeControl
():
BaseEditor
{
return
this
.
_activeControl
;
}
...
...
@@ -77,7 +90,7 @@ export class EditorControl extends Disposable {
const
control
=
this
.
doCreateEditorControl
(
descriptor
);
// Remember editor as active
this
.
_activeControl
=
control
;
this
.
setActiveControl
(
control
)
;
// Show editor
this
.
parent
.
appendChild
(
control
.
getContainer
());
...
...
@@ -196,7 +209,7 @@ export class EditorControl extends Disposable {
this
.
_activeControl
.
setVisible
(
false
,
this
.
groupView
);
// Clear active control
this
.
_activeControl
=
null
;
this
.
setActiveControl
(
null
)
;
// Clear focus listener
this
.
activeControlFocusListener
=
dispose
(
this
.
activeControlFocusListener
);
...
...
src/vs/workbench/browser/parts/editor/editorGroupView.ts
浏览文件 @
2ec11ee0
...
...
@@ -9,7 +9,7 @@ import 'vs/css!./media/editorgroupview';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
EditorGroup
,
IEditorOpenOptions
,
EditorCloseEvent
,
ISerializedEditorGroup
,
isSerializedEditorGroup
}
from
'
vs/workbench/common/editor/editorGroup
'
;
import
{
EditorInput
,
EditorOptions
,
GroupIdentifier
,
ConfirmResult
,
SideBySideEditorInput
,
CloseDirection
,
IEditorCloseEvent
,
EditorGroupActiveEditorDirtyContext
}
from
'
vs/workbench/common/editor
'
;
import
{
Event
,
Emitter
,
once
}
from
'
vs/base/common/event
'
;
import
{
Event
,
Emitter
,
once
,
Relay
}
from
'
vs/base/common/event
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
addClass
,
addClasses
,
Dimension
,
trackFocus
,
toggleClass
,
removeClass
,
addDisposableListener
,
EventType
,
EventHelper
,
findParentWithClass
,
clearNode
,
isAncestor
}
from
'
vs/base/browser/dom
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
...
...
@@ -34,7 +34,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
RunOnceWorker
}
from
'
vs/base/common/async
'
;
import
{
EventType
as
TouchEventType
,
GestureEvent
}
from
'
vs/base/browser/touch
'
;
import
{
TitleControl
}
from
'
vs/workbench/browser/parts/editor/titleControl
'
;
import
{
IEditorGroupsAccessor
,
IEditorGroupView
,
IEditorPartOptionsChangeEvent
,
EDITOR_TITLE_HEIGHT
,
EDITOR_MIN_DIMENSIONS
,
EDITOR_MAX_DIMENSIONS
,
getActiveTextEditorOptions
,
IEditorOpeningEvent
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditorGroupsAccessor
,
IEditorGroupView
,
IEditorPartOptionsChangeEvent
,
EDITOR_TITLE_HEIGHT
,
getActiveTextEditorOptions
,
IEditorOpeningEvent
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
join
}
from
'
vs/base/common/paths
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
...
...
@@ -197,6 +197,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Editor control
this
.
editorControl
=
this
.
_register
(
this
.
scopedInstantiationService
.
createInstance
(
EditorControl
,
this
.
editorContainer
,
this
));
this
.
_onDidChange
.
input
=
this
.
editorControl
.
onDidChange
;
// Track Focus
this
.
doTrackFocus
();
...
...
@@ -1330,12 +1331,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
readonly
element
:
HTMLElement
=
document
.
createElement
(
'
div
'
);
readonly
minimumWidth
=
EDITOR_MIN_DIMENSIONS
.
width
;
readonly
minimumHeight
=
EDITOR_MIN_DIMENSIONS
.
height
;
readonly
maximumWidth
=
EDITOR_MAX_DIMENSIONS
.
width
;
readonly
maximumHeight
=
EDITOR_MAX_DIMENSIONS
.
height
;
get
minimumWidth
():
number
{
return
this
.
editorControl
.
minimumWidth
;
}
get
minimumHeight
():
number
{
return
this
.
editorControl
.
minimumHeight
;
}
get
maximumWidth
():
number
{
return
this
.
editorControl
.
maximumWidth
;
}
get
maximumHeight
():
number
{
return
this
.
editorControl
.
maximumHeight
;
}
get
onDidChange
()
{
return
Event
.
None
;
}
// only needed if minimum sizes ever change
private
_onDidChange
=
new
Relay
<
{
width
:
number
;
height
:
number
;
}
>
();
readonly
onDidChange
:
Event
<
{
width
:
number
;
height
:
number
;
}
>
=
this
.
_onDidChange
.
event
;
layout
(
width
:
number
,
height
:
number
):
void
{
this
.
dimension
=
new
Dimension
(
width
,
height
);
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
2ec11ee0
...
...
@@ -58,6 +58,26 @@ export interface IEditor {
*/
group
:
IEditorGroup
;
/**
* The minimum width of this editor.
*/
readonly
minimumWidth
:
number
;
/**
* The maximum width of this editor.
*/
readonly
maximumWidth
:
number
;
/**
* The minimum height of this editor.
*/
readonly
minimumHeight
:
number
;
/**
* The maximum height of this editor.
*/
readonly
maximumHeight
:
number
;
/**
* Returns the unique identifier of this editor.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录