@@ -13,7 +13,7 @@ import { IUntypedEditorInput, pathsToEditors } from 'vs/workbench/common/editor'
13
13
import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput' ;
14
14
import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart' ;
15
15
import { PanelPart } from 'vs/workbench/browser/parts/panel/panelPart' ;
16
- import { Position , Parts , PanelOpensMaximizedOptions , IWorkbenchLayoutService , positionFromString , positionToString , panelOpensMaximizedFromString , PanelAlignment } from 'vs/workbench/services/layout/browser/layoutService' ;
16
+ import { Position , Parts , PanelOpensMaximizedOptions , IWorkbenchLayoutService , positionToString , panelOpensMaximizedFromString , PanelAlignment } from 'vs/workbench/services/layout/browser/layoutService' ;
17
17
import { IWorkspaceContextService , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
18
18
import { IStorageService , StorageScope , WillSaveStateReason } from 'vs/platform/storage/common/storage' ;
19
19
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -116,9 +116,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
116
116
private readonly _onDidChangeWindowMaximized = this . _register ( new Emitter < boolean > ( ) ) ;
117
117
readonly onDidChangeWindowMaximized = this . _onDidChangeWindowMaximized . event ;
118
118
119
- private readonly _onDidChangePanelPosition = this . _register ( new Emitter < string > ( ) ) ;
120
- readonly onDidChangePanelPosition = this . _onDidChangePanelPosition . event ;
121
-
122
119
private readonly _onDidChangePartVisibility = this . _register ( new Emitter < void > ( ) ) ;
123
120
readonly onDidChangePartVisibility = this . _onDidChangePartVisibility . event ;
124
121
@@ -428,10 +425,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
428
425
this . setSideBarPosition ( change . value as Position ) ;
429
426
}
430
427
431
- if ( change . key === LayoutStateKeys . PANEL_POSITION ) {
432
- this . setPanelPosition ( change . value as Position ) ;
433
- }
434
-
435
428
if ( change . key === LayoutStateKeys . PANEL_ALIGNMENT ) {
436
429
this . setPanelAlignment ( change . value as PanelAlignment ) ;
437
430
}
@@ -990,18 +983,15 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
990
983
}
991
984
992
985
getMaximumEditorDimensions ( ) : Dimension {
993
- const panelPosition = this . getPanelPosition ( ) ;
994
- const isColumn = panelPosition === Position . RIGHT || panelPosition === Position . LEFT ;
995
986
const takenWidth =
996
987
( this . isVisible ( Parts . ACTIVITYBAR_PART ) ? this . activityBarPartView . minimumWidth : 0 ) +
997
988
( this . isVisible ( Parts . SIDEBAR_PART ) ? this . sideBarPartView . minimumWidth : 0 ) +
998
- ( this . isVisible ( Parts . PANEL_PART ) && isColumn ? this . panelPartView . minimumWidth : 0 ) +
999
989
( this . isVisible ( Parts . AUXILIARYBAR_PART ) ? this . auxiliaryBarPartView . minimumWidth : 0 ) ;
1000
990
1001
991
const takenHeight =
1002
992
( this . isVisible ( Parts . TITLEBAR_PART ) ? this . titleBarPartView . minimumHeight : 0 ) +
1003
993
( this . isVisible ( Parts . STATUSBAR_PART ) ? this . statusBarPartView . minimumHeight : 0 ) +
1004
- ( this . isVisible ( Parts . PANEL_PART ) && ! isColumn ? this . panelPartView . minimumHeight : 0 ) ;
994
+ ( this . isVisible ( Parts . PANEL_PART ) ? this . panelPartView . minimumHeight : 0 ) ;
1005
995
1006
996
const availableWidth = this . dimension . width - takenWidth ;
1007
997
const availableHeight = this . dimension . height - takenHeight ;
@@ -1224,7 +1214,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1224
1214
// Panel Size
1225
1215
const panelSize = this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_HIDDEN )
1226
1216
? this . workbenchGrid . getViewCachedVisibleSize ( this . panelPartView )
1227
- : ( this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_POSITION ) === Position . BOTTOM ? this . workbenchGrid . getViewSize ( this . panelPartView ) . height : this . workbenchGrid . getViewSize ( this . panelPartView ) . width ) ;
1217
+ : this . workbenchGrid . getViewSize ( this . panelPartView ) . height ;
1228
1218
this . stateModel . setInitializationValue ( LayoutStateKeys . PANEL_SIZE , panelSize as number ) ;
1229
1219
1230
1220
// Auxiliary Bar Size
@@ -1317,8 +1307,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1317
1307
1318
1308
this . workbenchGrid . resizeView ( this . panelPartView ,
1319
1309
{
1320
- width : viewSize . width + ( this . getPanelPosition ( ) !== Position . BOTTOM ? sizeChangePxWidth : 0 ) ,
1321
- height : viewSize . height + ( this . getPanelPosition ( ) !== Position . BOTTOM ? 0 : sizeChangePxHeight )
1310
+ width : viewSize . width ,
1311
+ height : viewSize . height + sizeChangePxHeight
1322
1312
} ) ;
1323
1313
1324
1314
break ;
@@ -1500,11 +1490,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1500
1490
}
1501
1491
1502
1492
setPanelAlignment ( alignment : PanelAlignment , skipLayout ?: boolean ) : void {
1503
- // Panel alignment only applies to a panel in the bottom position
1504
- if ( this . getPanelPosition ( ) !== Position . BOTTOM ) {
1505
- return ;
1506
- }
1507
-
1508
1493
this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_ALIGNMENT , alignment ) ;
1509
1494
1510
1495
this . adjustPartPositions ( this . getSideBarPosition ( ) , alignment ) ;
@@ -1586,23 +1571,18 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1586
1571
1587
1572
toggleMaximizedPanel ( ) : void {
1588
1573
const size = this . workbenchGrid . getViewSize ( this . panelPartView ) ;
1589
- const panelPosition = this . getPanelPosition ( ) ;
1590
1574
const isMaximized = this . isPanelMaximized ( ) ;
1591
1575
if ( ! isMaximized ) {
1592
1576
if ( this . isVisible ( Parts . PANEL_PART ) ) {
1593
- if ( panelPosition === Position . BOTTOM ) {
1594
- this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_HEIGHT , size . height ) ;
1595
- } else {
1596
- this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_WIDTH , size . width ) ;
1597
- }
1577
+ this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_HEIGHT , size . height ) ;
1598
1578
}
1599
1579
1600
1580
this . setEditorHidden ( true ) ;
1601
1581
} else {
1602
1582
this . setEditorHidden ( false ) ;
1603
1583
this . workbenchGrid . resizeView ( this . panelPartView , {
1604
- width : panelPosition === Position . BOTTOM ? size . width : this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_WIDTH ) ,
1605
- height : panelPosition === Position . BOTTOM ? this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_HEIGHT ) : size . height
1584
+ width : size . width ,
1585
+ height : this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_HEIGHT )
1606
1586
} ) ;
1607
1587
}
1608
1588
this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_WAS_LAST_MAXIMIZED , ! isMaximized ) ;
@@ -1727,62 +1707,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1727
1707
this . configurationService . updateValue ( 'window.menuBarVisibility' , newVisibilityValue ) ;
1728
1708
}
1729
1709
1730
- getPanelPosition ( ) : Position {
1731
- return this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_POSITION ) ;
1732
- }
1733
-
1734
- setPanelPosition ( position : Position ) : void {
1735
- if ( ! this . isVisible ( Parts . PANEL_PART ) ) {
1736
- this . setPanelHidden ( false ) ;
1737
- }
1738
-
1739
- const panelPart = this . getPart ( Parts . PANEL_PART ) ;
1740
- const oldPositionValue = positionToString ( this . getPanelPosition ( ) ) ;
1741
- const newPositionValue = positionToString ( position ) ;
1742
-
1743
- this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_POSITION , position ) ;
1744
-
1745
- // Adjust CSS
1746
- const panelContainer = assertIsDefined ( panelPart . getContainer ( ) ) ;
1747
- panelContainer . classList . remove ( oldPositionValue ) ;
1748
- panelContainer . classList . add ( newPositionValue ) ;
1749
-
1750
- // Update Styles
1751
- panelPart . updateStyles ( ) ;
1752
-
1753
- // Layout
1754
- const size = this . workbenchGrid . getViewSize ( this . panelPartView ) ;
1755
- const sideBarSize = this . workbenchGrid . getViewSize ( this . sideBarPartView ) ;
1756
-
1757
- const editorHidden = ! this . isVisible ( Parts . EDITOR_PART ) ;
1758
-
1759
- // Save last non-maximized size for panel before move
1760
- if ( newPositionValue !== oldPositionValue && ! editorHidden ) {
1761
-
1762
- // Save the current size of the panel for the new orthogonal direction
1763
- // If moving down, save the width of the panel
1764
- // Otherwise, save the height of the panel
1765
- if ( position === Position . BOTTOM ) {
1766
- this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_WIDTH , size . width ) ;
1767
- } else if ( positionFromString ( oldPositionValue ) === Position . BOTTOM ) {
1768
- this . stateModel . setRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_HEIGHT , size . height ) ;
1769
- }
1770
- }
1771
-
1772
- if ( position === Position . BOTTOM ) {
1773
- this . workbenchGrid . moveView ( this . panelPartView , editorHidden ? size . height : this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_HEIGHT ) , this . editorPartView , Direction . Down ) ;
1774
- } else if ( position === Position . RIGHT ) {
1775
- this . workbenchGrid . moveView ( this . panelPartView , editorHidden ? size . width : this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_WIDTH ) , this . editorPartView , Direction . Right ) ;
1776
- } else {
1777
- this . workbenchGrid . moveView ( this . panelPartView , editorHidden ? size . width : this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_LAST_NON_MAXIMIZED_WIDTH ) , this . editorPartView , Direction . Left ) ;
1778
- }
1779
-
1780
- // Reset sidebar to original size before shifting the panel
1781
- this . workbenchGrid . resizeView ( this . sideBarPartView , sideBarSize ) ;
1782
-
1783
- this . _onDidChangePanelPosition . fire ( newPositionValue ) ;
1784
- }
1785
-
1786
1710
isWindowMaximized ( ) {
1787
1711
return this . windowState . runtime . maximized ;
1788
1712
}
@@ -1868,64 +1792,44 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
1868
1792
const panelSize = this . stateModel . getInitializationValue ( LayoutStateKeys . PANEL_SIZE ) ? 0 : nodes . panel . size ;
1869
1793
1870
1794
const result = [ ] as ISerializedNode [ ] ;
1871
- if ( this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_POSITION ) !== Position . BOTTOM ) {
1872
- result . push ( nodes . editor ) ;
1873
- nodes . editor . size = availableWidth - activityBarSize - sideBarSize - panelSize - auxiliaryBarSize ;
1874
- if ( this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_POSITION ) === Position . RIGHT ) {
1875
- result . push ( nodes . panel ) ;
1876
- } else {
1877
- result . splice ( 0 , 0 , nodes . panel ) ;
1878
- }
1795
+ const panelAlignment = this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_ALIGNMENT ) ;
1796
+ const sideBarPosition = this . stateModel . getRuntimeValue ( LayoutStateKeys . SIDEBAR_POSITON ) ;
1797
+ const sideBarNextToEditor = ! ( panelAlignment === 'center' || ( sideBarPosition === Position . LEFT && panelAlignment === 'right' ) || ( sideBarPosition === Position . RIGHT && panelAlignment === 'left' ) ) ;
1798
+ const auxiliaryBarNextToEditor = ! ( panelAlignment === 'center' || ( sideBarPosition === Position . RIGHT && panelAlignment === 'right' ) || ( sideBarPosition === Position . LEFT && panelAlignment === 'left' ) ) ;
1879
1799
1880
- if ( this . stateModel . getRuntimeValue ( LayoutStateKeys . SIDEBAR_POSITON ) === Position . LEFT ) {
1881
- result . push ( nodes . auxiliaryBar ) ;
1800
+ const editorSectionWidth = availableWidth - activityBarSize - ( sideBarNextToEditor ? 0 : sideBarSize ) - ( auxiliaryBarNextToEditor ? 0 : auxiliaryBarSize ) ;
1801
+ result . push ( {
1802
+ type : 'branch' ,
1803
+ data : [ this . arrangeEditorNodes ( {
1804
+ editor : nodes . editor ,
1805
+ sideBar : sideBarNextToEditor ? nodes . sideBar : undefined ,
1806
+ auxiliaryBar : auxiliaryBarNextToEditor ? nodes . auxiliaryBar : undefined
1807
+ } , availableHeight - panelSize , editorSectionWidth ) , nodes . panel ] ,
1808
+ size : editorSectionWidth
1809
+ } ) ;
1810
+
1811
+ if ( ! sideBarNextToEditor ) {
1812
+ if ( sideBarPosition === Position . LEFT ) {
1882
1813
result . splice ( 0 , 0 , nodes . sideBar ) ;
1883
- result . splice ( 0 , 0 , nodes . activityBar ) ;
1884
1814
} else {
1885
- result . splice ( 0 , 0 , nodes . auxiliaryBar ) ;
1886
1815
result . push ( nodes . sideBar ) ;
1887
- result . push ( nodes . activityBar ) ;
1888
- }
1889
- } else {
1890
- const panelAlignment = this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_ALIGNMENT ) ;
1891
- const sideBarPosition = this . stateModel . getRuntimeValue ( LayoutStateKeys . SIDEBAR_POSITON ) ;
1892
- const sideBarNextToEditor = ! ( panelAlignment === 'center' || ( sideBarPosition === Position . LEFT && panelAlignment === 'right' ) || ( sideBarPosition === Position . RIGHT && panelAlignment === 'left' ) ) ;
1893
- const auxiliaryBarNextToEditor = ! ( panelAlignment === 'center' || ( sideBarPosition === Position . RIGHT && panelAlignment === 'right' ) || ( sideBarPosition === Position . LEFT && panelAlignment === 'left' ) ) ;
1894
-
1895
- const editorSectionWidth = availableWidth - activityBarSize - ( sideBarNextToEditor ? 0 : sideBarSize ) - ( auxiliaryBarNextToEditor ? 0 : auxiliaryBarSize ) ;
1896
- result . push ( {
1897
- type : 'branch' ,
1898
- data : [ this . arrangeEditorNodes ( {
1899
- editor : nodes . editor ,
1900
- sideBar : sideBarNextToEditor ? nodes . sideBar : undefined ,
1901
- auxiliaryBar : auxiliaryBarNextToEditor ? nodes . auxiliaryBar : undefined
1902
- } , availableHeight - panelSize , editorSectionWidth ) , nodes . panel ] ,
1903
- size : editorSectionWidth
1904
- } ) ;
1905
-
1906
- if ( ! sideBarNextToEditor ) {
1907
- if ( sideBarPosition === Position . LEFT ) {
1908
- result . splice ( 0 , 0 , nodes . sideBar ) ;
1909
- } else {
1910
- result . push ( nodes . sideBar ) ;
1911
- }
1912
- }
1913
-
1914
- if ( ! auxiliaryBarNextToEditor ) {
1915
- if ( sideBarPosition === Position . RIGHT ) {
1916
- result . splice ( 0 , 0 , nodes . auxiliaryBar ) ;
1917
- } else {
1918
- result . push ( nodes . auxiliaryBar ) ;
1919
- }
1920
1816
}
1817
+ }
1921
1818
1922
- if ( sideBarPosition === Position . LEFT ) {
1923
- result . splice ( 0 , 0 , nodes . activityBar ) ;
1819
+ if ( ! auxiliaryBarNextToEditor ) {
1820
+ if ( sideBarPosition === Position . RIGHT ) {
1821
+ result . splice ( 0 , 0 , nodes . auxiliaryBar ) ;
1924
1822
} else {
1925
- result . push ( nodes . activityBar ) ;
1823
+ result . push ( nodes . auxiliaryBar ) ;
1926
1824
}
1927
1825
}
1928
1826
1827
+ if ( sideBarPosition === Position . LEFT ) {
1828
+ result . splice ( 0 , 0 , nodes . activityBar ) ;
1829
+ } else {
1830
+ result . push ( nodes . activityBar ) ;
1831
+ }
1832
+
1929
1833
return result ;
1930
1834
}
1931
1835
@@ -2027,7 +1931,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2027
1931
panelVisible : boolean ;
2028
1932
statusbarVisible : boolean ;
2029
1933
sideBarPosition : string ;
2030
- panelPosition : string ;
2031
1934
} ;
2032
1935
2033
1936
type StartupLayoutEventClassification = {
@@ -2037,7 +1940,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2037
1940
panelVisible : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' , isMeasurement : true } ;
2038
1941
statusbarVisible : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' , isMeasurement : true } ;
2039
1942
sideBarPosition : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' ; } ;
2040
- panelPosition : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' ; } ;
2041
1943
} ;
2042
1944
2043
1945
const layoutDescriptor : StartupLayoutEvent = {
@@ -2047,7 +1949,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2047
1949
panelVisible : ! this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_HIDDEN ) ,
2048
1950
statusbarVisible : ! this . stateModel . getRuntimeValue ( LayoutStateKeys . STATUSBAR_HIDDEN ) ,
2049
1951
sideBarPosition : positionToString ( this . stateModel . getRuntimeValue ( LayoutStateKeys . SIDEBAR_POSITON ) ) ,
2050
- panelPosition : positionToString ( this . stateModel . getRuntimeValue ( LayoutStateKeys . PANEL_POSITION ) ) ,
2051
1952
} ;
2052
1953
2053
1954
this . telemetryService . publicLog2 < StartupLayoutEvent , StartupLayoutEventClassification > ( 'startupLayout' , layoutDescriptor ) ;
0 commit comments