diff --git a/src/vs/platform/editor/common/editor.ts b/src/vs/platform/editor/common/editor.ts index 2258b5ed91b15d127c83a0a709966991d2bb63a2..2bebb45e399e4550c3a781f1891935d0fab4cc05 100644 --- a/src/vs/platform/editor/common/editor.ts +++ b/src/vs/platform/editor/common/editor.ts @@ -111,17 +111,17 @@ export interface IEditor { */ export enum Position { - /** Opens the editor in the LEFT most position replacing the input currently showing */ - LEFT = 0, + /** Opens the editor in the first position replacing the input currently showing */ + ONE = 0, - /** Opens the editor in the CENTER position replacing the input currently showing */ - CENTER = 1, + /** Opens the editor in the second position replacing the input currently showing */ + TWO = 1, - /** Opens the editor in the RIGHT most position replacing the input currently showing */ - RIGHT = 2 + /** Opens the editor in the third most position replacing the input currently showing */ + THREE = 2 } -export const POSITIONS = [Position.LEFT, Position.CENTER, Position.RIGHT]; +export const POSITIONS = [Position.ONE, Position.TWO, Position.THREE]; export enum Direction { LEFT, diff --git a/src/vs/workbench/browser/actions/openSettings.ts b/src/vs/workbench/browser/actions/openSettings.ts index 41f45a8f822de930ffe437df34627cf2d5348a72..3f169a76db7175231d09b4cfb46e3cd1f20a59f8 100644 --- a/src/vs/workbench/browser/actions/openSettings.ts +++ b/src/vs/workbench/browser/actions/openSettings.ts @@ -74,12 +74,12 @@ export class BaseTwoEditorsAction extends Action { return this.createIfNotExists(editableResource, defaultEditableContents).then(() => { return this.editorService.createInput({ resource: editableResource }).then(typedRightHandEditableInput => { const editors = [ - { input: leftHandDefaultInput, position: Position.LEFT, options: { pinned: true } }, - { input: typedRightHandEditableInput, position: Position.CENTER, options: { pinned: true } } + { input: leftHandDefaultInput, position: Position.ONE, options: { pinned: true } }, + { input: typedRightHandEditableInput, position: Position.TWO, options: { pinned: true } } ]; return this.editorService.openEditors(editors).then(() => { - this.editorGroupService.focusGroup(Position.CENTER); + this.editorGroupService.focusGroup(Position.TWO); }); }); }); @@ -153,7 +153,7 @@ export class OpenGlobalSettingsAction extends BaseOpenSettingsAction { const editorCount = this.editorService.getVisibleEditors().length; return this.editorService.createInput({ resource: this.contextService.toResource(WORKSPACE_CONFIG_DEFAULT_PATH) }).then(typedInput => { - return this.editorService.openEditor(typedInput, { pinned: true }, editorCount === 2 ? Position.RIGHT : editorCount === 1 ? Position.CENTER : void 0); + return this.editorService.openEditor(typedInput, { pinned: true }, editorCount === 2 ? Position.THREE : editorCount === 1 ? Position.TWO : void 0); }); }), new Action('neverShowAgain', nls.localize('neverShowAgain', "Don't show again"), null, true, () => { diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index 3d6897c75e924cb666679f174313f87fcbaf5e25..aaea1ae9aeedda94ef49aace3b62d62c94195789 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -72,24 +72,24 @@ export class SplitEditorAction extends Action { // Open split editor to the right of left one case 1: - targetPosition = Position.CENTER; + targetPosition = Position.TWO; break; // Special case two editors opened case 2: // Continue splitting to the right - if (editorToSplit.position === Position.CENTER) { - targetPosition = Position.RIGHT; + if (editorToSplit.position === Position.TWO) { + targetPosition = Position.THREE; } // Push the center group to the right to make room for the splitted input - else if (editorToSplit.position === Position.LEFT) { + else if (editorToSplit.position === Position.ONE) { options.preserveFocus = true; - return this.editorService.openEditor(editorToSplit.input, options, Position.RIGHT).then(() => { - this.editorGroupService.moveGroup(Position.RIGHT, Position.CENTER); - this.editorGroupService.focusGroup(Position.CENTER); + return this.editorService.openEditor(editorToSplit.input, options, Position.THREE).then(() => { + this.editorGroupService.moveGroup(Position.THREE, Position.TWO); + this.editorGroupService.focusGroup(Position.TWO); }); } } @@ -179,8 +179,8 @@ export class FocusFirstGroupAction extends Action { // Find left editor and focus it const editors = this.editorService.getVisibleEditors(); for (let editor of editors) { - if (editor.position === Position.LEFT) { - this.editorGroupService.focusGroup(Position.LEFT); + if (editor.position === Position.ONE) { + this.editorGroupService.focusGroup(Position.ONE); return TPromise.as(true); } @@ -193,10 +193,10 @@ export class FocusFirstGroupAction extends Action { // For now only support to open files from history to the side if (input instanceof EditorInput) { if (!!getUntitledOrFileResource(input)) { - return this.editorService.openEditor(input, null, Position.LEFT); + return this.editorService.openEditor(input, null, Position.ONE); } } else { - return this.editorService.openEditor(input as IResourceInput, Position.LEFT); + return this.editorService.openEditor(input as IResourceInput, Position.ONE); } } @@ -293,11 +293,11 @@ export class FocusSecondGroupAction extends BaseFocusSideGroupAction { } protected getReferenceEditorSide(): Position { - return Position.LEFT; + return Position.ONE; } protected getTargetEditorSide(): Position { - return Position.CENTER; + return Position.TWO; } } @@ -317,11 +317,11 @@ export class FocusThirdGroupAction extends BaseFocusSideGroupAction { } protected getReferenceEditorSide(): Position { - return Position.CENTER; + return Position.TWO; } protected getTargetEditorSide(): Position { - return Position.RIGHT; + return Position.THREE; } } @@ -349,9 +349,9 @@ export class FocusPreviousGroup extends Action { // Find the next position to the left - let nextPosition: Position = Position.LEFT; - if (activeEditor.position === Position.RIGHT) { - nextPosition = Position.CENTER; + let nextPosition: Position = Position.ONE; + if (activeEditor.position === Position.THREE) { + nextPosition = Position.TWO; } // Focus next position if provided @@ -377,9 +377,9 @@ export class FocusNextGroup extends Action { super(id, label); this.navigateActions = []; - this.navigateActions[Position.LEFT] = instantiationService.createInstance(FocusFirstGroupAction, FocusFirstGroupAction.ID, FocusFirstGroupAction.LABEL); - this.navigateActions[Position.CENTER] = instantiationService.createInstance(FocusSecondGroupAction, FocusSecondGroupAction.ID, FocusSecondGroupAction.LABEL); - this.navigateActions[Position.RIGHT] = instantiationService.createInstance(FocusThirdGroupAction, FocusThirdGroupAction.ID, FocusThirdGroupAction.LABEL); + this.navigateActions[Position.ONE] = instantiationService.createInstance(FocusFirstGroupAction, FocusFirstGroupAction.ID, FocusFirstGroupAction.LABEL); + this.navigateActions[Position.TWO] = instantiationService.createInstance(FocusSecondGroupAction, FocusSecondGroupAction.ID, FocusSecondGroupAction.LABEL); + this.navigateActions[Position.THREE] = instantiationService.createInstance(FocusThirdGroupAction, FocusThirdGroupAction.ID, FocusThirdGroupAction.LABEL); } public run(event?: any): TPromise { @@ -388,11 +388,11 @@ export class FocusNextGroup extends Action { let nextPosition: Position; const activeEditor = this.editorService.getActiveEditor(); if (!activeEditor) { - nextPosition = Position.LEFT; - } else if (activeEditor.position === Position.LEFT) { - nextPosition = Position.CENTER; - } else if (activeEditor.position === Position.CENTER) { - nextPosition = Position.RIGHT; + nextPosition = Position.ONE; + } else if (activeEditor.position === Position.ONE) { + nextPosition = Position.TWO; + } else if (activeEditor.position === Position.TWO) { + nextPosition = Position.THREE; } // Run the action for the target next position @@ -419,7 +419,7 @@ export class OpenToSideAction extends Action { private updateEnablement(): void { const activeEditor = this.editorService.getActiveEditor(); - this.enabled = (!activeEditor || activeEditor.position !== Position.RIGHT); + this.enabled = (!activeEditor || activeEditor.position !== Position.THREE); } public run(context: any): TPromise { @@ -676,13 +676,13 @@ export class MoveGroupLeftAction extends Action { let position = context ? this.editorGroupService.getStacksModel().positionOfGroup(context.group) : null; if (typeof position !== 'number') { const activeEditor = this.editorService.getActiveEditor(); - if (activeEditor && (activeEditor.position === Position.CENTER || activeEditor.position === Position.RIGHT)) { + if (activeEditor && (activeEditor.position === Position.TWO || activeEditor.position === Position.THREE)) { position = activeEditor.position; } } if (typeof position === 'number') { - const newPosition = (position === Position.CENTER) ? Position.LEFT : Position.CENTER; + const newPosition = (position === Position.TWO) ? Position.ONE : Position.TWO; // Move group this.editorGroupService.moveGroup(position, newPosition); @@ -712,13 +712,13 @@ export class MoveGroupRightAction extends Action { const activeEditor = this.editorService.getActiveEditor(); const editors = this.editorService.getVisibleEditors(); - if ((editors.length === 2 && activeEditor.position === Position.LEFT) || (editors.length === 3 && activeEditor.position !== Position.RIGHT)) { + if ((editors.length === 2 && activeEditor.position === Position.ONE) || (editors.length === 3 && activeEditor.position !== Position.THREE)) { position = activeEditor.position; } } if (typeof position === 'number') { - const newPosition = (position === Position.LEFT) ? Position.CENTER : Position.RIGHT; + const newPosition = (position === Position.ONE) ? Position.TWO : Position.THREE; // Move group this.editorGroupService.moveGroup(position, newPosition); @@ -1014,9 +1014,9 @@ export class ShowEditorsInGroupAction extends Action { } switch (stacks.positionOfGroup(context.group)) { - case Position.CENTER: + case Position.TWO: return this.quickOpenService.show((groupCount === 2) ? NAVIGATE_IN_RIGHT_GROUP_PREFIX : NAVIGATE_IN_CENTER_GROUP_PREFIX); - case Position.RIGHT: + case Position.THREE: return this.quickOpenService.show(NAVIGATE_IN_RIGHT_GROUP_PREFIX); } @@ -1057,9 +1057,9 @@ export class BaseQuickOpenEditorInGroupAction extends Action { const count = stacks.groups.length; let prefix = NAVIGATE_IN_LEFT_GROUP_PREFIX; - if (activePosition === Position.CENTER && count === 3) { + if (activePosition === Position.TWO && count === 3) { prefix = NAVIGATE_IN_CENTER_GROUP_PREFIX; - } else if (activePosition === Position.RIGHT || (activePosition === Position.CENTER && count === 2)) { + } else if (activePosition === Position.THREE || (activePosition === Position.TWO && count === 2)) { prefix = NAVIGATE_IN_RIGHT_GROUP_PREFIX; } @@ -1238,7 +1238,7 @@ export class MoveEditorToLeftGroupAction extends Action { public run(): TPromise { const activeEditor = this.editorService.getActiveEditor(); - if (activeEditor && activeEditor.position !== Position.LEFT) { + if (activeEditor && activeEditor.position !== Position.ONE) { this.editorGroupService.moveEditor(activeEditor.input, activeEditor.position, activeEditor.position - 1); } @@ -1262,7 +1262,7 @@ export class MoveEditorToRightGroupAction extends Action { public run(): TPromise { const activeEditor = this.editorService.getActiveEditor(); - if (activeEditor && activeEditor.position !== Position.RIGHT) { + if (activeEditor && activeEditor.position !== Position.THREE) { this.editorGroupService.moveEditor(activeEditor.input, activeEditor.position, activeEditor.position + 1); } diff --git a/src/vs/workbench/browser/parts/editor/editorCommands.ts b/src/vs/workbench/browser/parts/editor/editorCommands.ts index af33b2377d095b7a0d7033bcf932d5643e080363..2e075651dcded3829dbc574783853bc06cb80866 100644 --- a/src/vs/workbench/browser/parts/editor/editorCommands.ts +++ b/src/vs/workbench/browser/parts/editor/editorCommands.ts @@ -127,13 +127,13 @@ function moveActiveEditorToGroup(args: ActiveEditorMoveArguments, activeEditor: newPosition = newPosition + 1; break; case ActiveEditorMovePositioning.FIRST: - newPosition = Position.LEFT; + newPosition = Position.ONE; break; case ActiveEditorMovePositioning.LAST: - newPosition = Position.RIGHT; + newPosition = Position.THREE; break; case ActiveEditorMovePositioning.CENTER: - newPosition = Position.CENTER; + newPosition = Position.TWO; break; case ActiveEditorMovePositioning.POSITION: newPosition = args.value - 1; diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 3a20916611c235727f8f2d0d000abaa98b165a74..0f176c701ffa23b81ee19a444aae3bad774707a2 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -204,7 +204,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService } // Opened to the side - if (position !== Position.LEFT) { + if (position !== Position.ONE) { this.telemetryService.publicLog('workbenchSideEditorOpened', { position: position }); } @@ -915,13 +915,13 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService } private doOpenEditors(editors: { input: EditorInput, position: Position, options?: EditorOptions }[], activePosition?: number, ratio?: number[]): TPromise { - const leftEditors = editors.filter(e => e.position === Position.LEFT); - const centerEditors = editors.filter(e => e.position === Position.CENTER); - const rightEditors = editors.filter(e => e.position === Position.RIGHT); + const leftEditors = editors.filter(e => e.position === Position.ONE); + const centerEditors = editors.filter(e => e.position === Position.TWO); + const rightEditors = editors.filter(e => e.position === Position.THREE); - const leftGroup = this.stacks.groupAt(Position.LEFT); - const centerGroup = this.stacks.groupAt(Position.CENTER); - const rightGroup = this.stacks.groupAt(Position.RIGHT); + const leftGroup = this.stacks.groupAt(Position.ONE); + const centerGroup = this.stacks.groupAt(Position.TWO); + const rightGroup = this.stacks.groupAt(Position.THREE); // Compute the imaginary count if we const all editors open as the way requested const leftCount = leftEditors.length + (leftGroup ? leftGroup.count : 0); @@ -938,7 +938,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService // Validate active input if (typeof activePosition !== 'number') { - activePosition = Position.LEFT; + activePosition = Position.ONE; } // Validate ratios @@ -1173,7 +1173,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService const visibleEditors = this.getVisibleEditors(); const activeEditor = this.getActiveEditor(); if (visibleEditors.length === 0 || !activeEditor) { - return Position.LEFT; // can only be LEFT + return Position.ONE; // can only be LEFT } // Respect option to reveal an editor if it is already visible @@ -1193,17 +1193,17 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService if (types.isUndefinedOrNull(arg1) || arg1 === false) { const lastActivePosition = this.sideBySideControl.getActivePosition(); - return lastActivePosition || Position.LEFT; + return lastActivePosition || Position.ONE; } // Position is sideBySide: Find position relative to active editor if (arg1 === true) { switch (activeEditor.position) { - case Position.LEFT: - return Position.CENTER; - case Position.CENTER: - return Position.RIGHT; - case Position.RIGHT: + case Position.ONE: + return Position.TWO; + case Position.TWO: + return Position.THREE; + case Position.THREE: return null; // Cannot open to the side of the right most editor } @@ -1211,8 +1211,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService } // Position is provided, validate it - if (arg1 === Position.RIGHT && visibleEditors.length === 1) { - return Position.CENTER; + if (arg1 === Position.THREE && visibleEditors.length === 1) { + return Position.TWO; } return arg1; @@ -1260,15 +1260,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService if (types.isUndefinedOrNull(arg2)) { const rochade = arg1; switch (rochade) { - case Rochade.CENTER_TO_LEFT: - this.rochade(Position.CENTER, Position.LEFT); + case Rochade.TWO_TO_ONE: + this.rochade(Position.TWO, Position.ONE); break; - case Rochade.RIGHT_TO_CENTER: - this.rochade(Position.RIGHT, Position.CENTER); + case Rochade.THREE_TO_TWO: + this.rochade(Position.THREE, Position.TWO); break; - case Rochade.CENTER_AND_RIGHT_TO_LEFT: - this.rochade(Position.CENTER, Position.LEFT); - this.rochade(Position.RIGHT, Position.CENTER); + case Rochade.TWO_AND_THREE_TO_ONE: + this.rochade(Position.TWO, Position.ONE); + this.rochade(Position.THREE, Position.TWO); } } else { const from = arg1; @@ -1329,20 +1329,20 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService // LEFT | CENTER | RIGHT if (groups.length > 2) { - this.stacks.renameGroup(this.stacks.groupAt(Position.LEFT), EditorPart.GROUP_LEFT_LABEL); - this.stacks.renameGroup(this.stacks.groupAt(Position.CENTER), EditorPart.GROUP_CENTER_LABEL); - this.stacks.renameGroup(this.stacks.groupAt(Position.RIGHT), EditorPart.GROUP_RIGHT_LABEL); + this.stacks.renameGroup(this.stacks.groupAt(Position.ONE), EditorPart.GROUP_LEFT_LABEL); + this.stacks.renameGroup(this.stacks.groupAt(Position.TWO), EditorPart.GROUP_CENTER_LABEL); + this.stacks.renameGroup(this.stacks.groupAt(Position.THREE), EditorPart.GROUP_RIGHT_LABEL); } // LEFT | RIGHT else if (groups.length > 1) { - this.stacks.renameGroup(this.stacks.groupAt(Position.LEFT), EditorPart.GROUP_LEFT_LABEL); - this.stacks.renameGroup(this.stacks.groupAt(Position.CENTER), EditorPart.GROUP_RIGHT_LABEL); + this.stacks.renameGroup(this.stacks.groupAt(Position.ONE), EditorPart.GROUP_LEFT_LABEL); + this.stacks.renameGroup(this.stacks.groupAt(Position.TWO), EditorPart.GROUP_RIGHT_LABEL); } // LEFT else { - this.stacks.renameGroup(this.stacks.groupAt(Position.LEFT), EditorPart.GROUP_LEFT_LABEL); + this.stacks.renameGroup(this.stacks.groupAt(Position.ONE), EditorPart.GROUP_LEFT_LABEL); } } } diff --git a/src/vs/workbench/browser/parts/editor/editorPicker.ts b/src/vs/workbench/browser/parts/editor/editorPicker.ts index d2afc71aa7b9c55459289cf3e88cb0a6dd77b4f8..bb4346c69cf490e543313e90e4f8f5e06f8b16b1 100644 --- a/src/vs/workbench/browser/parts/editor/editorPicker.ts +++ b/src/vs/workbench/browser/parts/editor/editorPicker.ts @@ -217,7 +217,7 @@ export abstract class EditorGroupPicker extends BaseEditorPicker { export class LeftEditorGroupPicker extends EditorGroupPicker { protected getPosition(): Position { - return Position.LEFT; + return Position.ONE; } } @@ -226,7 +226,7 @@ export class CenterEditorGroupPicker extends EditorGroupPicker { protected getPosition(): Position { const stacks = this.editorGroupService.getStacksModel(); - return stacks.groups.length > 2 ? Position.CENTER : -1; // with 2 groups open, the center one is not available + return stacks.groups.length > 2 ? Position.TWO : -1; // with 2 groups open, the center one is not available } } @@ -235,7 +235,7 @@ export class RightEditorGroupPicker extends EditorGroupPicker { protected getPosition(): Position { const stacks = this.editorGroupService.getStacksModel(); - return stacks.groups.length > 2 ? Position.RIGHT : Position.CENTER; + return stacks.groups.length > 2 ? Position.THREE : Position.TWO; } } diff --git a/src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts b/src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts index 8412db6fe5fc2ddd04cec9af163cc26be2d39b94..1e82c92e67f28925dea4a4c52bdf524d8ef77054 100644 --- a/src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts +++ b/src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts @@ -39,9 +39,9 @@ import { extractResources } from 'vs/base/browser/dnd'; export enum Rochade { NONE, - CENTER_TO_LEFT, - RIGHT_TO_CENTER, - CENTER_AND_RIGHT_TO_LEFT + TWO_TO_ONE, + THREE_TO_TWO, + TWO_AND_THREE_TO_ONE } export enum ProgressState { @@ -364,9 +364,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } // Adjust layout: [] -> []|[!] - else if (position === Position.CENTER && this.sashOne.isHidden() && this.sashTwo.isHidden() && this.dimension) { - this.silosSize[Position.LEFT] = this.totalSize / 2; - this.silosSize[Position.CENTER] = this.totalSize - this.silosSize[Position.LEFT]; + else if (position === Position.TWO && this.sashOne.isHidden() && this.sashTwo.isHidden() && this.dimension) { + this.silosSize[Position.ONE] = this.totalSize / 2; + this.silosSize[Position.TWO] = this.totalSize - this.silosSize[Position.ONE]; this.sashOne.show(); this.sashOne.layout(); @@ -375,10 +375,10 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } // Adjust layout: []|[] -> []|[]|[!] - else if (position === Position.RIGHT && this.sashTwo.isHidden() && this.dimension) { - this.silosSize[Position.LEFT] = this.totalSize / 3; - this.silosSize[Position.CENTER] = this.totalSize / 3; - this.silosSize[Position.RIGHT] = this.totalSize - this.silosSize[Position.LEFT] - this.silosSize[Position.CENTER]; + else if (position === Position.THREE && this.sashTwo.isHidden() && this.dimension) { + this.silosSize[Position.ONE] = this.totalSize / 3; + this.silosSize[Position.TWO] = this.totalSize / 3; + this.silosSize[Position.THREE] = this.totalSize - this.silosSize[Position.ONE] - this.silosSize[Position.TWO]; this.sashOne.layout(); this.sashTwo.show(); @@ -490,8 +490,8 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti const visibleEditorCount = this.getVisibleEditorCount(); - const hasCenter = !!this.visibleEditors[Position.CENTER]; - const hasRight = !!this.visibleEditors[Position.RIGHT]; + const hasCenter = !!this.visibleEditors[Position.TWO]; + const hasRight = !!this.visibleEditors[Position.THREE]; // If editor is not showing for position, return if (editor !== this.visibleEditors[position]) { @@ -519,16 +519,16 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti // Adjust layout: []|[x] -> [] or [x]|[] -> [] else if (hasCenter && !hasRight) { - this.silosSize[Position.LEFT] = this.totalSize; - this.silosSize[Position.CENTER] = 0; + this.silosSize[Position.ONE] = this.totalSize; + this.silosSize[Position.TWO] = 0; this.sashOne.hide(); this.sashTwo.hide(); // Move CENTER to LEFT ([x]|[] -> []) - if (position === Position.LEFT) { - this.rochade(Position.CENTER, Position.LEFT); - result = Rochade.CENTER_TO_LEFT; + if (position === Position.ONE) { + this.rochade(Position.TWO, Position.ONE); + result = Rochade.TWO_TO_ONE; } this.layoutContainers(); @@ -536,24 +536,24 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti // Adjust layout: []|[]|[x] -> [ ]|[ ] or []|[x]|[] -> [ ]|[ ] or [x]|[]|[] -> [ ]|[ ] else if (hasCenter && hasRight) { - this.silosSize[Position.LEFT] = this.totalSize / 2; - this.silosSize[Position.CENTER] = this.totalSize - this.silosSize[Position.LEFT]; - this.silosSize[Position.RIGHT] = 0; + this.silosSize[Position.ONE] = this.totalSize / 2; + this.silosSize[Position.TWO] = this.totalSize - this.silosSize[Position.ONE]; + this.silosSize[Position.THREE] = 0; this.sashOne.layout(); this.sashTwo.hide(); // Move RIGHT to CENTER ([]|[x]|[] -> [ ]|[ ]) - if (position === Position.CENTER) { - this.rochade(Position.RIGHT, Position.CENTER); - result = Rochade.RIGHT_TO_CENTER; + if (position === Position.TWO) { + this.rochade(Position.THREE, Position.TWO); + result = Rochade.THREE_TO_TWO; } // Move RIGHT to CENTER and CENTER to LEFT ([x]|[]|[] -> [ ]|[ ]) - else if (position === Position.LEFT) { - this.rochade(Position.CENTER, Position.LEFT); - this.rochade(Position.RIGHT, Position.CENTER); - result = Rochade.CENTER_AND_RIGHT_TO_LEFT; + else if (position === Position.ONE) { + this.rochade(Position.TWO, Position.ONE); + this.rochade(Position.THREE, Position.TWO); + result = Rochade.TWO_AND_THREE_TO_ONE; } this.layoutContainers(); @@ -570,14 +570,14 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti if (layoutAndRochade) { let newActivePosition: Position; switch (position) { - case Position.LEFT: - newActivePosition = hasCenter ? Position.LEFT : null; + case Position.ONE: + newActivePosition = hasCenter ? Position.ONE : null; break; - case Position.CENTER: - newActivePosition = Position.LEFT; + case Position.TWO: + newActivePosition = Position.ONE; break; - case Position.RIGHT: - newActivePosition = Position.CENTER; + case Position.THREE: + newActivePosition = Position.TWO; break; } @@ -678,37 +678,37 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti let newCenterPosition: Position; let newRightPosition: Position; - if (from === Position.LEFT) { - newLeftPosition = Position.RIGHT; - newCenterPosition = Position.LEFT; - newRightPosition = Position.CENTER; + if (from === Position.ONE) { + newLeftPosition = Position.THREE; + newCenterPosition = Position.ONE; + newRightPosition = Position.TWO; } else { - newLeftPosition = Position.CENTER; - newCenterPosition = Position.RIGHT; - newRightPosition = Position.LEFT; + newLeftPosition = Position.TWO; + newCenterPosition = Position.THREE; + newRightPosition = Position.ONE; } // Move containers to new position - const containerPos1 = this.silos[Position.LEFT].child(); + const containerPos1 = this.silos[Position.ONE].child(); containerPos1.appendTo(this.silos[newLeftPosition]); - const containerPos2 = this.silos[Position.CENTER].child(); + const containerPos2 = this.silos[Position.TWO].child(); containerPos2.appendTo(this.silos[newCenterPosition]); - const containerPos3 = this.silos[Position.RIGHT].child(); + const containerPos3 = this.silos[Position.THREE].child(); containerPos3.appendTo(this.silos[newRightPosition]); // Inform Editors - this.visibleEditors[Position.LEFT].changePosition(newLeftPosition); - this.visibleEditors[Position.CENTER].changePosition(newCenterPosition); - this.visibleEditors[Position.RIGHT].changePosition(newRightPosition); + this.visibleEditors[Position.ONE].changePosition(newLeftPosition); + this.visibleEditors[Position.TWO].changePosition(newCenterPosition); + this.visibleEditors[Position.THREE].changePosition(newRightPosition); // Update last active position accordingly - if (this.lastActivePosition === Position.LEFT) { + if (this.lastActivePosition === Position.ONE) { this.doSetActive(this.lastActiveEditor, newLeftPosition); - } else if (this.lastActivePosition === Position.CENTER) { + } else if (this.lastActivePosition === Position.TWO) { this.doSetActive(this.lastActiveEditor, newCenterPosition); - } else if (this.lastActivePosition === Position.RIGHT) { + } else if (this.lastActivePosition === Position.THREE) { this.doSetActive(this.lastActiveEditor, newRightPosition); } } @@ -801,7 +801,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti this.enableDropTarget(this.parent.getHTMLElement()); // Silo One - this.silos[Position.LEFT] = $(this.parent).div({ class: 'one-editor-silo editor-left monaco-editor-background' }); + this.silos[Position.ONE] = $(this.parent).div({ class: 'one-editor-silo editor-left monaco-editor-background' }); // Sash One this.sashOne = new Sash(this.parent.getHTMLElement(), this, { baseSize: 5, orientation: this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL }); @@ -812,7 +812,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti this.sashOne.hide(); // Silo Two - this.silos[Position.CENTER] = $(this.parent).div({ class: 'one-editor-silo editor-center monaco-editor-background' }); + this.silos[Position.TWO] = $(this.parent).div({ class: 'one-editor-silo editor-center monaco-editor-background' }); // Sash Two this.sashTwo = new Sash(this.parent.getHTMLElement(), this, { baseSize: 5, orientation: this.layoutVertically ? Orientation.VERTICAL : Orientation.HORIZONTAL }); @@ -823,7 +823,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti this.sashTwo.hide(); // Silo Three - this.silos[Position.RIGHT] = $(this.parent).div({ class: 'one-editor-silo editor-right monaco-editor-background' }); + this.silos[Position.THREE] = $(this.parent).div({ class: 'one-editor-silo editor-right monaco-editor-background' }); // For each position POSITIONS.forEach(position => { @@ -901,7 +901,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti const groupService = $this.editorGroupService; const splitEditor = (typeof splitTo === 'number'); // TODO@Ben ugly split code should benefit from empty group support once available! - const freeGroup = (stacks.groups.length === 1) ? Position.CENTER : Position.RIGHT; + const freeGroup = (stacks.groups.length === 1) ? Position.TWO : Position.THREE; // Check for transfer from title control const draggedEditor = TitleControl.getDraggedEditor(); @@ -985,14 +985,14 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti else if (!isCopy && draggedEditor && draggedEditor.group.count === 1) { const positionOfDraggedEditor = stacks.positionOfGroup(draggedEditor.group); switch (positionOfDraggedEditor) { - case Position.LEFT: - if (position === Position.CENTER && isOverSplitRightOrBottom) { - splitTarget = Position.CENTER; // allow to move single editor from LEFT to CENTER + case Position.ONE: + if (position === Position.TWO && isOverSplitRightOrBottom) { + splitTarget = Position.TWO; // allow to move single editor from LEFT to CENTER } break; - case Position.CENTER: - if (position === Position.LEFT && isOverSplitLeftOrUp) { - splitTarget = Position.LEFT; // allow to move single editor from CENTER to LEFT + case Position.TWO: + if (position === Position.ONE && isOverSplitLeftOrUp) { + splitTarget = Position.ONE; // allow to move single editor from CENTER to LEFT } break; default: @@ -1003,9 +1003,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti // Any other case, check for mouse position else { if (isOverSplitRightOrBottom) { - splitTarget = (position === Position.LEFT) ? Position.CENTER : Position.RIGHT; + splitTarget = (position === Position.ONE) ? Position.TWO : Position.THREE; } else if (isOverSplitLeftOrUp) { - splitTarget = (position === Position.LEFT) ? Position.LEFT : Position.CENTER; + splitTarget = (position === Position.ONE) ? Position.ONE : Position.TWO; } } @@ -1079,7 +1079,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti this.toDispose.push(DOM.addDisposableListener(node, DOM.EventType.DROP, (e: DragEvent) => { if (e.target === node) { DOM.EventHelper.stop(e, true); - onDrop(e, Position.LEFT); + onDrop(e, Position.ONE); } else { DOM.removeClass(node, 'dropfeedback'); } @@ -1213,28 +1213,28 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti switch (position) { // [ ! ]|[ ]: Moves only to the right/bottom but not outside of dimension to the right/bottom - case Position.LEFT: { - newPos = Math.max(-1 /* 1px border accomodation */, Math.min(diffPos, this.totalSize - this.silosSize[Position.LEFT])); + case Position.ONE: { + newPos = Math.max(-1 /* 1px border accomodation */, Math.min(diffPos, this.totalSize - this.silosSize[Position.ONE])); break; } - case Position.CENTER: { + case Position.TWO: { // [ ]|[ ! ]: Moves only to the left/top but not outside of dimension to the left/top if (visibleEditorCount === 2) { - newPos = Math.min(this.silosSize[Position.LEFT], Math.max(-1 /* 1px border accomodation */, this.silosSize[Position.LEFT] + diffPos)); + newPos = Math.min(this.silosSize[Position.ONE], Math.max(-1 /* 1px border accomodation */, this.silosSize[Position.ONE] + diffPos)); } // [ ]|[ ! ]|[ ]: Moves to left/top and right/bottom but not outside of dimensions on both sides else { - newPos = Math.min(this.totalSize - this.silosSize[Position.CENTER], Math.max(-1 /* 1px border accomodation */, this.silosSize[Position.LEFT] + diffPos)); + newPos = Math.min(this.totalSize - this.silosSize[Position.TWO], Math.max(-1 /* 1px border accomodation */, this.silosSize[Position.ONE] + diffPos)); } break; } // [ ]|[ ]|[ ! ]: Moves to the right/bottom but not outside of dimension on the left/top side - case Position.RIGHT: { - newPos = Math.min(this.silosSize[Position.LEFT] + this.silosSize[Position.CENTER], Math.max(-1 /* 1px border accomodation */, this.silosSize[Position.LEFT] + this.silosSize[Position.CENTER] + diffPos)); + case Position.THREE: { + newPos = Math.min(this.silosSize[Position.ONE] + this.silosSize[Position.TWO], Math.max(-1 /* 1px border accomodation */, this.silosSize[Position.ONE] + this.silosSize[Position.TWO] + diffPos)); break; } } @@ -1249,48 +1249,48 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti // Live drag Feedback const moveTo: Position = this.findMoveTarget(position, diffPos); switch (position) { - case Position.LEFT: { - if (moveTo === Position.LEFT || moveTo === null) { - this.posSilo(Position.CENTER, `${this.silosSize[Position.LEFT]}px`, 'auto'); - this.posSilo(Position.RIGHT, 'auto', 0); - } else if (moveTo === Position.CENTER) { - this.posSilo(Position.CENTER, 0, 'auto'); - this.silos[Position.CENTER].addClass('draggedunder'); - this.posSilo(Position.RIGHT, 'auto', 0); - } else if (moveTo === Position.RIGHT) { - this.posSilo(Position.CENTER, 0, 'auto'); - this.posSilo(Position.RIGHT, 'auto', `${this.silosSize[Position.LEFT]}px`); - this.silos[Position.RIGHT].addClass('draggedunder'); + case Position.ONE: { + if (moveTo === Position.ONE || moveTo === null) { + this.posSilo(Position.TWO, `${this.silosSize[Position.ONE]}px`, 'auto'); + this.posSilo(Position.THREE, 'auto', 0); + } else if (moveTo === Position.TWO) { + this.posSilo(Position.TWO, 0, 'auto'); + this.silos[Position.TWO].addClass('draggedunder'); + this.posSilo(Position.THREE, 'auto', 0); + } else if (moveTo === Position.THREE) { + this.posSilo(Position.TWO, 0, 'auto'); + this.posSilo(Position.THREE, 'auto', `${this.silosSize[Position.ONE]}px`); + this.silos[Position.THREE].addClass('draggedunder'); } break; } - case Position.CENTER: { - if (moveTo === Position.LEFT) { - this.posSilo(Position.LEFT, `${this.silosSize[Position.CENTER]}px`, 'auto'); - this.silos[Position.LEFT].addClass('draggedunder'); - } else if (moveTo === Position.CENTER || moveTo === null) { - this.posSilo(Position.LEFT, 0, 'auto'); - this.posSilo(Position.RIGHT, 'auto', 0); - } else if (moveTo === Position.RIGHT) { - this.posSilo(Position.RIGHT, 'auto', `${this.silosSize[Position.CENTER]}px`); - this.silos[Position.RIGHT].addClass('draggedunder'); - this.posSilo(Position.LEFT, 0, 'auto'); + case Position.TWO: { + if (moveTo === Position.ONE) { + this.posSilo(Position.ONE, `${this.silosSize[Position.TWO]}px`, 'auto'); + this.silos[Position.ONE].addClass('draggedunder'); + } else if (moveTo === Position.TWO || moveTo === null) { + this.posSilo(Position.ONE, 0, 'auto'); + this.posSilo(Position.THREE, 'auto', 0); + } else if (moveTo === Position.THREE) { + this.posSilo(Position.THREE, 'auto', `${this.silosSize[Position.TWO]}px`); + this.silos[Position.THREE].addClass('draggedunder'); + this.posSilo(Position.ONE, 0, 'auto'); } break; } - case Position.RIGHT: { - if (moveTo === Position.LEFT) { - this.posSilo(Position.LEFT, `${this.silosSize[Position.RIGHT]}px`, 'auto'); - this.silos[Position.LEFT].addClass('draggedunder'); - } else if (moveTo === Position.CENTER) { - this.posSilo(Position.LEFT, 0, 'auto'); - this.posSilo(Position.CENTER, `${this.silosSize[Position.LEFT] + this.silosSize[Position.RIGHT]}px`, 'auto'); - this.silos[Position.CENTER].addClass('draggedunder'); - } else if (moveTo === Position.RIGHT || moveTo === null) { - this.posSilo(Position.LEFT, 0, 'auto'); - this.posSilo(Position.CENTER, `${this.silosSize[Position.LEFT]}px`, 'auto'); + case Position.THREE: { + if (moveTo === Position.ONE) { + this.posSilo(Position.ONE, `${this.silosSize[Position.THREE]}px`, 'auto'); + this.silos[Position.ONE].addClass('draggedunder'); + } else if (moveTo === Position.TWO) { + this.posSilo(Position.ONE, 0, 'auto'); + this.posSilo(Position.TWO, `${this.silosSize[Position.ONE] + this.silosSize[Position.THREE]}px`, 'auto'); + this.silos[Position.TWO].addClass('draggedunder'); + } else if (moveTo === Position.THREE || moveTo === null) { + this.posSilo(Position.ONE, 0, 'auto'); + this.posSilo(Position.TWO, `${this.silosSize[Position.ONE]}px`, 'auto'); } break; } @@ -1321,9 +1321,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti this.silos[position].removeClass('dragging'); POSITIONS.forEach(p => this.silos[p].removeClass('draggedunder')); - this.posSilo(Position.LEFT, 0, 'auto'); - this.posSilo(Position.CENTER, 'auto', 'auto'); - this.posSilo(Position.RIGHT, 'auto', 0); + this.posSilo(Position.ONE, 0, 'auto'); + this.posSilo(Position.TWO, 'auto', 'auto'); + this.posSilo(Position.THREE, 'auto', 0); // Find move target const mouseUpEvent = new StandardMouseEvent(e); @@ -1362,60 +1362,60 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti const visibleEditorCount = this.getVisibleEditorCount(); switch (position) { - case Position.LEFT: { + case Position.ONE: { // [ ! ]|[] -> []|[ ! ] - if (visibleEditorCount === 2 && (diffPos >= this.silosSize[Position.LEFT] / 2 || diffPos >= this.silosSize[Position.CENTER] / 2)) { - return Position.CENTER; + if (visibleEditorCount === 2 && (diffPos >= this.silosSize[Position.ONE] / 2 || diffPos >= this.silosSize[Position.TWO] / 2)) { + return Position.TWO; } // [ ! ]|[]|[] -> []|[]|[ ! ] - if (visibleEditorCount === 3 && (diffPos >= this.silosSize[Position.LEFT] / 2 + this.silosSize[Position.CENTER] || diffPos >= this.silosSize[Position.RIGHT] / 2 + this.silosSize[Position.CENTER])) { - return Position.RIGHT; + if (visibleEditorCount === 3 && (diffPos >= this.silosSize[Position.ONE] / 2 + this.silosSize[Position.TWO] || diffPos >= this.silosSize[Position.THREE] / 2 + this.silosSize[Position.TWO])) { + return Position.THREE; } // [ ! ]|[]|[] -> []|[ ! ]|[] - if (visibleEditorCount === 3 && (diffPos >= this.silosSize[Position.LEFT] / 2 || diffPos >= this.silosSize[Position.CENTER] / 2)) { - return Position.CENTER; + if (visibleEditorCount === 3 && (diffPos >= this.silosSize[Position.ONE] / 2 || diffPos >= this.silosSize[Position.TWO] / 2)) { + return Position.TWO; } break; } - case Position.CENTER: { + case Position.TWO: { if (visibleEditorCount === 2 && diffPos > 0) { return null; // Return early since CENTER cannot be moved to the RIGHT unless there is a RIGHT position } // []|[ ! ] -> [ ! ]|[] - if (visibleEditorCount === 2 && (Math.abs(diffPos) >= this.silosSize[Position.CENTER] / 2 || Math.abs(diffPos) >= this.silosSize[Position.LEFT] / 2)) { - return Position.LEFT; + if (visibleEditorCount === 2 && (Math.abs(diffPos) >= this.silosSize[Position.TWO] / 2 || Math.abs(diffPos) >= this.silosSize[Position.ONE] / 2)) { + return Position.ONE; } // []|[ ! ]|[] -> [ ! ]|[]|[] - if (visibleEditorCount === 3 && ((diffPos < 0 && Math.abs(diffPos) >= this.silosSize[Position.CENTER] / 2) || (diffPos < 0 && Math.abs(diffPos) >= this.silosSize[Position.LEFT] / 2))) { - return Position.LEFT; + if (visibleEditorCount === 3 && ((diffPos < 0 && Math.abs(diffPos) >= this.silosSize[Position.TWO] / 2) || (diffPos < 0 && Math.abs(diffPos) >= this.silosSize[Position.ONE] / 2))) { + return Position.ONE; } // []|[ ! ]|[] -> []|[]|[ ! ] - if (visibleEditorCount === 3 && ((diffPos > 0 && Math.abs(diffPos) >= this.silosSize[Position.CENTER] / 2) || (diffPos > 0 && Math.abs(diffPos) >= this.silosSize[Position.RIGHT] / 2))) { - return Position.RIGHT; + if (visibleEditorCount === 3 && ((diffPos > 0 && Math.abs(diffPos) >= this.silosSize[Position.TWO] / 2) || (diffPos > 0 && Math.abs(diffPos) >= this.silosSize[Position.THREE] / 2))) { + return Position.THREE; } break; } - case Position.RIGHT: { + case Position.THREE: { if (diffPos > 0) { return null; // Return early since RIGHT cannot be moved more to the RIGHT } // []|[]|[ ! ] -> [ ! ]|[]|[] - if (Math.abs(diffPos) >= this.silosSize[Position.RIGHT] / 2 + this.silosSize[Position.CENTER] || Math.abs(diffPos) >= this.silosSize[Position.LEFT] / 2 + this.silosSize[Position.CENTER]) { - return Position.LEFT; + if (Math.abs(diffPos) >= this.silosSize[Position.THREE] / 2 + this.silosSize[Position.TWO] || Math.abs(diffPos) >= this.silosSize[Position.ONE] / 2 + this.silosSize[Position.TWO]) { + return Position.ONE; } // []|[]|[ ! ] -> []|[ ! ]|[] - if (Math.abs(diffPos) >= this.silosSize[Position.RIGHT] / 2 || Math.abs(diffPos) >= this.silosSize[Position.CENTER] / 2) { - return Position.CENTER; + if (Math.abs(diffPos) >= this.silosSize[Position.THREE] / 2 || Math.abs(diffPos) >= this.silosSize[Position.TWO] / 2) { + return Position.TWO; } break; } @@ -1434,11 +1434,11 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } private onSashOneDragStart(): void { - this.startSiloOneSize = this.silosSize[Position.LEFT]; + this.startSiloOneSize = this.silosSize[Position.ONE]; } private onSashOneDrag(e: ISashEvent): void { - let oldSiloOneSize = this.silosSize[Position.LEFT]; + let oldSiloOneSize = this.silosSize[Position.ONE]; let diffSize = this.layoutVertically ? (e.currentX - e.startX) : (e.currentY - e.startY); let newSiloOneSize = this.startSiloOneSize + diffSize; @@ -1465,8 +1465,8 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti newSiloOneSize = this.totalSize - this.minSize; } - this.silosSize[Position.LEFT] = newSiloOneSize; - this.silosSize[Position.CENTER] = this.totalSize - newSiloOneSize; + this.silosSize[Position.ONE] = newSiloOneSize; + this.silosSize[Position.TWO] = this.totalSize - newSiloOneSize; } // Side-by-Side-by-Side @@ -1478,22 +1478,22 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } // [ ]|[!]|[ ] : center side can not get smaller than the minimal editor size - else if (this.totalSize - newSiloOneSize - this.silosSize[Position.RIGHT] < this.minSize) { + else if (this.totalSize - newSiloOneSize - this.silosSize[Position.THREE] < this.minSize) { // [ ]|[ ]|[!] : right/bottom side can not get smaller than the minimal editor size - if (this.totalSize - newSiloOneSize - this.silosSize[Position.CENTER] < this.minSize) { + if (this.totalSize - newSiloOneSize - this.silosSize[Position.TWO] < this.minSize) { newSiloOneSize = this.totalSize - (2 * this.minSize); - this.silosSize[Position.CENTER] = this.silosSize[Position.RIGHT] = this.minSize; + this.silosSize[Position.TWO] = this.silosSize[Position.THREE] = this.minSize; } // [ ]|[ ]|[-> ] : right/bottom side can snap into minimized - else if (this.totalSize - newSiloOneSize - this.silosSize[Position.CENTER] - this.snapToMinimizeThresholdSize <= this.minSize) { - this.silosSize[Position.RIGHT] = this.minSize; + else if (this.totalSize - newSiloOneSize - this.silosSize[Position.TWO] - this.snapToMinimizeThresholdSize <= this.minSize) { + this.silosSize[Position.THREE] = this.minSize; } // [ ]|[ ]|[ ] : right/bottom side shrinks else { - this.silosSize[Position.RIGHT] = this.silosSize[Position.RIGHT] - (newSiloOneSize - oldSiloOneSize); + this.silosSize[Position.THREE] = this.silosSize[Position.THREE] - (newSiloOneSize - oldSiloOneSize); } this.sashTwo.layout(); @@ -1505,12 +1505,12 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } // [ ]|[-> ]|[ ] : center side can snap into minimized - else if (this.totalSize - this.silosSize[Position.RIGHT] - newSiloOneSize - this.snapToMinimizeThresholdSize <= this.minSize) { - newSiloOneSize = this.totalSize - this.silosSize[Position.RIGHT] - this.minSize; + else if (this.totalSize - this.silosSize[Position.THREE] - newSiloOneSize - this.snapToMinimizeThresholdSize <= this.minSize) { + newSiloOneSize = this.totalSize - this.silosSize[Position.THREE] - this.minSize; } - this.silosSize[Position.LEFT] = newSiloOneSize; - this.silosSize[Position.CENTER] = this.totalSize - this.silosSize[Position.LEFT] - this.silosSize[Position.RIGHT]; + this.silosSize[Position.ONE] = newSiloOneSize; + this.silosSize[Position.TWO] = this.totalSize - this.silosSize[Position.ONE] - this.silosSize[Position.THREE]; } // Pass on to containers @@ -1524,16 +1524,16 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } private onSashOneReset(): void { - this.centerSash(Position.LEFT, Position.CENTER); + this.centerSash(Position.ONE, Position.TWO); this.sashOne.layout(); } private onSashTwoDragStart(): void { - this.startSiloThreeSize = this.silosSize[Position.RIGHT]; + this.startSiloThreeSize = this.silosSize[Position.THREE]; } private onSashTwoDrag(e: ISashEvent): void { - let oldSiloThreeSize = this.silosSize[Position.RIGHT]; + let oldSiloThreeSize = this.silosSize[Position.THREE]; let diffSize = this.layoutVertically ? (-e.currentX + e.startX) : (-e.currentY + e.startY); let newSiloThreeSize = this.startSiloThreeSize + diffSize; @@ -1543,22 +1543,22 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } // [ ]|[!]|[ ] : center side can not get smaller than the minimal editor size - else if (this.totalSize - newSiloThreeSize - this.silosSize[Position.LEFT] < this.minSize) { + else if (this.totalSize - newSiloThreeSize - this.silosSize[Position.ONE] < this.minSize) { // [!]|[ ]|[ ] : left/top side can not get smaller than the minimal editor size - if (this.totalSize - newSiloThreeSize - this.silosSize[Position.CENTER] < this.minSize) { + if (this.totalSize - newSiloThreeSize - this.silosSize[Position.TWO] < this.minSize) { newSiloThreeSize = this.totalSize - (2 * this.minSize); - this.silosSize[Position.LEFT] = this.silosSize[Position.CENTER] = this.minSize; + this.silosSize[Position.ONE] = this.silosSize[Position.TWO] = this.minSize; } // [ <-]|[ ]|[ ] : left/top side can snap into minimized - else if (this.totalSize - newSiloThreeSize - this.silosSize[Position.CENTER] - this.snapToMinimizeThresholdSize <= this.minSize) { - this.silosSize[Position.LEFT] = this.minSize; + else if (this.totalSize - newSiloThreeSize - this.silosSize[Position.TWO] - this.snapToMinimizeThresholdSize <= this.minSize) { + this.silosSize[Position.ONE] = this.minSize; } // [ ]|[ ]|[ ] : left/top side shrinks else { - this.silosSize[Position.LEFT] = this.silosSize[Position.LEFT] - (newSiloThreeSize - oldSiloThreeSize); + this.silosSize[Position.ONE] = this.silosSize[Position.ONE] - (newSiloThreeSize - oldSiloThreeSize); } this.sashOne.layout(); @@ -1570,12 +1570,12 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } // [ ]|[ <-]|[ ] : center side can snap into minimized - else if (this.totalSize - this.silosSize[Position.LEFT] - newSiloThreeSize - this.snapToMinimizeThresholdSize <= this.minSize) { - newSiloThreeSize = this.totalSize - this.silosSize[Position.LEFT] - this.minSize; + else if (this.totalSize - this.silosSize[Position.ONE] - newSiloThreeSize - this.snapToMinimizeThresholdSize <= this.minSize) { + newSiloThreeSize = this.totalSize - this.silosSize[Position.ONE] - this.minSize; } - this.silosSize[Position.RIGHT] = newSiloThreeSize; - this.silosSize[Position.CENTER] = this.totalSize - this.silosSize[Position.LEFT] - this.silosSize[Position.RIGHT]; + this.silosSize[Position.THREE] = newSiloThreeSize; + this.silosSize[Position.TWO] = this.totalSize - this.silosSize[Position.ONE] - this.silosSize[Position.THREE]; this.layoutContainers(); } @@ -1588,7 +1588,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } private onSashTwoReset(): void { - this.centerSash(Position.CENTER, Position.RIGHT); + this.centerSash(Position.TWO, Position.THREE); this.sashTwo.layout(); } @@ -1598,7 +1598,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } public getVerticalSashLeft(sash: Sash): number { - return sash === this.sashOne ? this.silosSize[Position.LEFT] : this.silosSize[Position.CENTER] + this.silosSize[Position.LEFT]; + return sash === this.sashOne ? this.silosSize[Position.ONE] : this.silosSize[Position.TWO] + this.silosSize[Position.ONE]; } public getVerticalSashHeight(sash: Sash): number { @@ -1606,7 +1606,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti } public getHorizontalSashTop(sash: Sash): number { - return sash === this.sashOne ? this.silosSize[Position.LEFT] : this.silosSize[Position.CENTER] + this.silosSize[Position.LEFT]; + return sash === this.sashOne ? this.silosSize[Position.ONE] : this.silosSize[Position.TWO] + this.silosSize[Position.ONE]; } public getHorizontalSashLeft(sash: Sash): number { @@ -1686,7 +1686,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti }); if (positionToGive === null) { - positionToGive = Position.LEFT; // maybe all are minimized, so give LEFT the extra size + positionToGive = Position.ONE; // maybe all are minimized, so give LEFT the extra size } this.silosSize[positionToGive] -= overflow; @@ -1727,9 +1727,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti }); if (this.layoutVertically) { - this.silos[Position.CENTER].position(0, null, null, this.silosSize[Position.LEFT]); + this.silos[Position.TWO].position(0, null, null, this.silosSize[Position.ONE]); } else { - this.silos[Position.CENTER].position(this.silosSize[Position.LEFT], null, null, 0); + this.silos[Position.TWO].position(this.silosSize[Position.ONE], null, null, 0); } // Visibility diff --git a/src/vs/workbench/electron-browser/integration.ts b/src/vs/workbench/electron-browser/integration.ts index ba1f70c12810e3bcfbdf7d778a02ce3c364c4d21..c5b11e1d9ad9f6fa8fc90cba15f629bfaa9760fa 100644 --- a/src/vs/workbench/electron-browser/integration.ts +++ b/src/vs/workbench/electron-browser/integration.ts @@ -257,7 +257,7 @@ export class ElectronIntegration { return this.editorService.openEditors(resources.map((r, index) => { return { input: r, - position: activeEditor ? activeEditor.position : Position.LEFT + position: activeEditor ? activeEditor.position : Position.ONE }; })); }); diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 8fc45ce1e2223c2aefceb5bbf10c7d73422cdd5d..0b96c5e423514646f0461b30044e35f4015bb525 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -20,6 +20,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage'; import { Registry } from 'vs/platform/platform'; import { isWindows, isLinux } from 'vs/base/common/platform'; import { IOptions } from 'vs/workbench/common/options'; +import { Position as EditorPosition } from 'vs/platform/editor/common/editor'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; import { IEditorRegistry, Extensions as EditorExtensions, TextEditorOptions, EditorInput, EditorOptions } from 'vs/workbench/common/editor'; @@ -248,7 +249,7 @@ export class Workbench implements IPartService { return { input: inputWithOptions.input, options: inputWithOptions.options, - position: Position.LEFT + position: EditorPosition.ONE }; }); diff --git a/src/vs/workbench/parts/extensions/electron-browser/dependenciesViewer.ts b/src/vs/workbench/parts/extensions/electron-browser/dependenciesViewer.ts index 50b78944d6785d8f6dc05d434fe8cca20e5d8dee..6df43cc01be2c7b49703085bd4d919bc2777bc08 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/dependenciesViewer.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/dependenciesViewer.ts @@ -217,7 +217,7 @@ class OpenExtensionToSideAction extends Action { private updateEnablement(): void { const activeEditor = this.editorService.getActiveEditor(); - this.enabled = (!activeEditor || activeEditor.position !== Position.RIGHT); + this.enabled = (!activeEditor || activeEditor.position !== Position.THREE); } run(context: { extension: IExtension }): TPromise { diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts index 3cbb475730d9ad292d6a72f6d4cb0da1767f0d18..a25a19f226fd97a658f24525e6eb871bbf67520c 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.ts @@ -1175,7 +1175,7 @@ export class OpenToSideAction extends Action { private updateEnablement(): void { const activeEditor = this.editorService.getActiveEditor(); - this.enabled = (!activeEditor || activeEditor.position !== Position.RIGHT); + this.enabled = (!activeEditor || activeEditor.position !== Position.THREE); } public run(): TPromise { diff --git a/src/vs/workbench/parts/files/electron-browser/dirtyFilesTracker.ts b/src/vs/workbench/parts/files/electron-browser/dirtyFilesTracker.ts index 47a3caccbc8e0ab6374e23b44c69239e7fc11819..b0bd17d7111ef13f6537df14eb87565ea831de9f 100644 --- a/src/vs/workbench/parts/files/electron-browser/dirtyFilesTracker.ts +++ b/src/vs/workbench/parts/files/electron-browser/dirtyFilesTracker.ts @@ -104,7 +104,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution { this.pendingDirtyResources = []; const activeEditor = this.editorService.getActiveEditor(); - const activePosition = activeEditor ? activeEditor.position : Position.LEFT; + const activePosition = activeEditor ? activeEditor.position : Position.ONE; // Open this.editorService.openEditors(dirtyNotOpenedResources.map(resource => { diff --git a/src/vs/workbench/test/browser/services.test.ts b/src/vs/workbench/test/browser/services.test.ts index 01dc2a40b2626a60cd24da457e89920621c90af0..2a651ef71a77ad42f90210279639f977f85a331b 100644 --- a/src/vs/workbench/test/browser/services.test.ts +++ b/src/vs/workbench/test/browser/services.test.ts @@ -290,7 +290,7 @@ suite('Workbench UI Services', () => { assert(service.getVisibleEditors()[0] === editor); }); - service.openEditor(activeInput, null, Position.LEFT).then((editor) => { + service.openEditor(activeInput, null, Position.ONE).then((editor) => { assert.strictEqual(openedEditorInput, activeInput); assert.strictEqual(openedEditorOptions, null); assert.strictEqual(editor, activeEditor); diff --git a/src/vs/workbench/test/common/editor/editorStacksModel.test.ts b/src/vs/workbench/test/common/editor/editorStacksModel.test.ts index 75f713806baf7bbbd68bbf7a6230581df00a4f0e..d0cc082ff8d2e5228b640a25fa68ae9c66ccf5b7 100644 --- a/src/vs/workbench/test/common/editor/editorStacksModel.test.ts +++ b/src/vs/workbench/test/common/editor/editorStacksModel.test.ts @@ -296,9 +296,9 @@ suite('Editor Stacks Model', () => { const group2 = model.openGroup('second'); const group3 = model.openGroup('third'); - assert.equal(Position.LEFT, model.positionOfGroup(group1)); - assert.equal(Position.CENTER, model.positionOfGroup(group2)); - assert.equal(Position.RIGHT, model.positionOfGroup(group3)); + assert.equal(Position.ONE, model.positionOfGroup(group1)); + assert.equal(Position.TWO, model.positionOfGroup(group2)); + assert.equal(Position.THREE, model.positionOfGroup(group3)); }); test('Groups - Rename Group', function () {