Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6594eeb4
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
6594eeb4
编写于
1月 14, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
layout of panel first steps
上级
d0e6a5ce
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
9 deletion
+40
-9
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+40
-9
未找到文件。
src/vs/workbench/browser/layout.ts
浏览文件 @
6594eeb4
...
...
@@ -18,6 +18,7 @@ import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
const
DEFAULT_MIN_PART_WIDTH
=
170
;
const
DEFAULT_MIN_PANEL_PART_WIDTH
=
170
;
const
HIDE_SIDEBAR_WIDTH_THRESHOLD
=
50
;
const
LAYOUT_RELATED_PREFERENCES
=
[
...
...
@@ -41,6 +42,7 @@ export class LayoutOptions {
interface
ComputedStyles
{
activitybar
:
{
minWidth
:
number
;
};
sidebar
:
{
minWidth
:
number
;
};
panelPart
:
{
minHeight
:
number
;
}
editor
:
{
minWidth
:
number
;
};
statusbar
:
{
height
:
number
;
};
}
...
...
@@ -51,6 +53,7 @@ interface ComputedStyles {
export
class
WorkbenchLayout
implements
IVerticalSashLayoutProvider
{
private
static
sashWidthSettingsKey
=
'
workbench.sidebar.width
'
;
private
static
panelPartHeightKey
=
'
workbench.panelpart.height
'
;
private
parent
:
Builder
;
private
workbenchContainer
:
Builder
;
...
...
@@ -68,6 +71,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
private
sash
:
Sash
;
private
startSidebarWidth
:
number
;
private
sidebarWidth
:
number
;
private
panelPartHeight
:
number
;
// Take parts as an object bag since instatation service does not have typings for constructors with 9+ arguments
constructor
(
...
...
@@ -105,6 +109,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
});
this
.
sidebarWidth
=
this
.
storageService
.
getInteger
(
WorkbenchLayout
.
sashWidthSettingsKey
,
StorageScope
.
GLOBAL
,
-
1
);
this
.
panelPartHeight
=
this
.
storageService
.
getInteger
(
WorkbenchLayout
.
panelPartHeightKey
,
StorageScope
.
GLOBAL
,
0
);
this
.
registerListeners
();
this
.
registerSashListeners
();
...
...
@@ -187,6 +192,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
this
.
computeStyle
();
this
.
editor
.
getLayout
().
computeStyle
();
this
.
sidebar
.
getLayout
().
computeStyle
();
this
.
panelPart
.
getLayout
().
computeStyle
();
// Trigger Layout
this
.
layout
();
...
...
@@ -194,9 +200,10 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
}
private
computeStyle
():
void
{
let
sidebarStyle
=
this
.
sidebar
.
getContainer
().
getComputedStyle
();
let
editorStyle
=
this
.
editor
.
getContainer
().
getComputedStyle
();
let
activitybarStyle
=
this
.
activitybar
.
getContainer
().
getComputedStyle
();
const
sidebarStyle
=
this
.
sidebar
.
getContainer
().
getComputedStyle
();
const
panelPartStyle
=
this
.
panelPart
.
getContainer
().
getComputedStyle
();
const
editorStyle
=
this
.
editor
.
getContainer
().
getComputedStyle
();
const
activitybarStyle
=
this
.
activitybar
.
getContainer
().
getComputedStyle
();
this
.
computedStyles
=
{
activitybar
:
{
...
...
@@ -207,6 +214,10 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
minWidth
:
parseInt
(
sidebarStyle
.
getPropertyValue
(
'
min-width
'
),
10
)
||
DEFAULT_MIN_PART_WIDTH
},
panelPart
:
{
minHeight
:
parseInt
(
panelPartStyle
.
getPropertyValue
(
'
min-height
'
),
10
)
||
DEFAULT_MIN_PANEL_PART_WIDTH
},
editor
:
{
minWidth
:
parseInt
(
editorStyle
.
getPropertyValue
(
'
min-width
'
),
10
)
||
DEFAULT_MIN_PART_WIDTH
},
...
...
@@ -217,7 +228,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
};
if
(
this
.
statusbar
)
{
le
t
statusbarStyle
=
this
.
statusbar
.
getContainer
().
getComputedStyle
();
cons
t
statusbarStyle
=
this
.
statusbar
.
getContainer
().
getComputedStyle
();
this
.
computedStyles
.
statusbar
.
height
=
parseInt
(
statusbarStyle
.
getPropertyValue
(
'
height
'
),
10
)
||
18
;
}
}
...
...
@@ -227,6 +238,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
this
.
computeStyle
();
this
.
editor
.
getLayout
().
computeStyle
();
this
.
sidebar
.
getLayout
().
computeStyle
();
this
.
panelPart
.
getLayout
().
computeStyle
();
}
if
(
!
this
.
computedStyles
)
{
...
...
@@ -235,8 +247,9 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
this
.
workbenchSize
=
this
.
getWorkbenchArea
();
let
isSidebarHidden
=
this
.
partService
.
isSideBarHidden
();
let
sidebarPosition
=
this
.
partService
.
getSideBarPosition
();
const
isSidebarHidden
=
this
.
partService
.
isSideBarHidden
();
const
isPanelPartHidden
=
this
.
partService
.
isPanelPartHidden
();
const
sidebarPosition
=
this
.
partService
.
getSideBarPosition
();
// Sidebar
let
sidebarWidth
:
number
;
...
...
@@ -255,6 +268,17 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
let
activityBarMinWidth
=
this
.
computedStyles
.
activitybar
.
minWidth
;
let
activityBarSize
=
new
Dimension
(
activityBarMinWidth
,
sidebarSize
.
height
);
// Panel part
let
panelHeight
:
number
;
if
(
isPanelPartHidden
)
{
panelHeight
=
0
;
}
else
if
(
this
.
panelPartHeight
>
0
)
{
panelHeight
=
Math
.
max
(
this
.
computedStyles
.
panelPart
.
minHeight
,
this
.
panelPartHeight
);
}
else
{
panelHeight
=
sidebarSize
.
height
*
0.4
;
}
const
panelDimension
=
new
Dimension
(
this
.
workbenchSize
.
width
-
sidebarSize
.
width
-
activityBarSize
.
width
,
panelHeight
);
// Editor
let
editorSize
=
{
width
:
0
,
...
...
@@ -263,7 +287,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
remainderRight
:
0
};
let
editorDimension
=
new
Dimension
(
this
.
workbenchSize
.
width
-
sidebarSize
.
width
-
activityBarSize
.
width
,
sidebarSize
.
height
);
let
editorDimension
=
new
Dimension
(
panelDimension
.
width
,
sidebarSize
.
height
-
panelDimension
.
height
);
editorSize
.
width
=
editorDimension
.
width
;
editorSize
.
height
=
this
.
editorHeight
=
editorDimension
.
height
;
...
...
@@ -298,6 +322,11 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
this
.
storageService
.
store
(
WorkbenchLayout
.
sashWidthSettingsKey
,
this
.
sidebarWidth
,
StorageScope
.
GLOBAL
);
}
if
(
!
isPanelPartHidden
)
{
this
.
panelPartHeight
=
panelDimension
.
height
;
this
.
storageService
.
store
(
WorkbenchLayout
.
panelPartHeightKey
,
this
.
panelPartHeight
,
StorageScope
.
GLOBAL
);
}
// Workbench
this
.
workbenchContainer
.
position
(
this
.
options
.
margin
.
top
,
this
.
options
.
margin
.
right
,
this
.
options
.
margin
.
bottom
,
this
.
options
.
margin
.
left
,
'
relative
'
)
...
...
@@ -308,11 +337,13 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider {
this
.
workbenchContainer
.
getHTMLElement
().
scrollTop
=
0
;
}
// Editor Part
// Editor Part
and Panel part
this
.
editor
.
getContainer
().
size
(
editorSize
.
width
,
editorSize
.
height
);
this
.
panelPart
.
getContainer
().
size
(
panelDimension
.
width
,
panelDimension
.
height
);
// TODO@Isidor absolutly position the panel part container
if
(
isSidebarHidden
)
{
this
.
editor
.
getContainer
().
position
(
0
,
editorSize
.
remainderRight
,
0
,
editorSize
.
remainderLeft
);
this
.
editor
.
getContainer
().
position
(
0
,
editorSize
.
remainderRight
,
panelDimension
.
height
,
editorSize
.
remainderLeft
);
}
else
if
(
sidebarPosition
===
Position
.
LEFT
)
{
this
.
editor
.
getContainer
().
position
(
0
,
0
,
0
,
sidebarSize
.
width
+
activityBarSize
.
width
);
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录