Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Add a feature to toggle between panes in the core #10555 #12853

Merged
merged 20 commits into from
Oct 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
08a46b3
Added the feature to toggle between panes as requested by petetnt in …
arthur801031 Oct 26, 2016
2f793e7
Added the feature to toggle between panes as requested by petetnt in …
arthur801031 Oct 26, 2016
fc5a114
Bumping version Number to 1.9
shubhsnov Oct 26, 2016
b092dea
Merge pull request #12855 from adobe/adobe/shubham/VersionUpdate
swmitra Oct 26, 2016
0b63bc7
Edited the files and added a unit test for this feature as requested …
arthur801031 Oct 27, 2016
ce4350b
Edited the files and added a unit test for this feature as requested …
arthur801031 Oct 27, 2016
e099010
Removed duplicate/unnecessary code in Pane.js
arthur801031 Oct 27, 2016
77a8f4b
Removed additional duplicate/unnecessary code in Pane.js
arthur801031 Oct 27, 2016
4289bd5
Edited 'should switch pane when alt-w is pressed' function in MainVie…
arthur801031 Oct 27, 2016
8211931
Revert package.json and src/config.json to previous commit
arthur801031 Oct 27, 2016
40586ae
Added the feature to toggle between panes as requested by petetnt in …
arthur801031 Oct 26, 2016
569698f
Added the feature to toggle between panes as requested by petetnt in …
arthur801031 Oct 26, 2016
8823a85
Edited the files and added a unit test for this feature as requested …
arthur801031 Oct 27, 2016
567668a
Removed duplicate/unnecessary code in Pane.js
arthur801031 Oct 27, 2016
77ee794
Removed additional duplicate/unnecessary code in Pane.js
arthur801031 Oct 27, 2016
88b333e
Edited 'should switch pane when alt-w is pressed' function in MainVie…
arthur801031 Oct 27, 2016
717d13e
Revert package.json and src/config.json to previous commit
arthur801031 Oct 27, 2016
0848104
Modified test code to test CMD_SWITCH_PANE_FOCUS
arthur801031 Oct 28, 2016
954f39c
Modified test code to test CMD_SWITCH_PANE_FOCUS
arthur801031 Oct 28, 2016
8e5d581
Removed unnecessary code in MainViewManager-test.js
arthur801031 Oct 28, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Brackets",
"version": "1.8.0-0",
"apiVersion": "1.8.0",
"version": "1.9.0-0",
"apiVersion": "1.9.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase against master so we don't have these duplicate files, git fetch upstream master && git rebase upstream/master.

"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
Expand Down
1 change: 1 addition & 0 deletions src/command/Commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ define(function (require, exports, module) {
exports.CMD_SPLITVIEW_NONE = "cmd.splitViewNone"; // SidebarView.js _handleSplitNone()
exports.CMD_SPLITVIEW_VERTICAL = "cmd.splitViewVertical"; // SidebarView.js _handleSplitVertical()
exports.CMD_SPLITVIEW_HORIZONTAL = "cmd.splitViewHorizontal"; // SidebarView.js _handleSplitHorizontal()
exports.CMD_SWITCH_PANE_FOCUS = "cmd.switchPaneFocus"; // MainViewManager.js _switchPaneFocus()

// File shell callbacks - string must MATCH string in native code (appshell/command_callbacks.h)
exports.HELP_ABOUT = "help.about"; // HelpCommandHandlers.js _handleAboutDialog()
Expand Down
4 changes: 2 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"healthDataServerURL": "https://healthdev.brackets.io/healthDataLog"
},
"name": "Brackets",
"version": "1.8.0-0",
"apiVersion": "1.8.0",
"version": "1.9.0-0",
"apiVersion": "1.9.0",
"homepage": "http://brackets.io",
"issues": {
"url": "http://github.com/adobe/brackets/issues"
Expand Down
1 change: 1 addition & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ define({
"CMD_SHOW_IN_EXPLORER" : "Show in Explorer",
"CMD_SHOW_IN_FINDER" : "Show in Finder",
"CMD_SHOW_IN_OS" : "Show in OS",
"CMD_SWITCH_PANE_FOCUS" : "Switch Pane Focus",

// Help menu commands
"HELP_MENU" : "Help",
Expand Down
25 changes: 22 additions & 3 deletions src/view/MainViewManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ define(function (require, exports, module) {
AsyncUtils = require("utils/Async"),
ViewUtils = require("utils/ViewUtils"),
Resizer = require("utils/Resizer"),
Pane = require("view/Pane").Pane;
Pane = require("view/Pane").Pane,
KeyBindingManager = brackets.getModule("command/KeyBindingManager");

/**
* Preference setting name for the MainView Saved State
Expand Down Expand Up @@ -844,6 +845,19 @@ define(function (require, exports, module) {
return result.promise();
}

/**
* Switch between panes
*/
function switchPaneFocus() {
var $firstPane = $('#first-pane'), $secondPane = $('#second-pane');
if($firstPane.hasClass('active-pane')) {
$secondPane.click();
}
else {
$firstPane.click();
}
}

/**
* DocumentManager.pathDeleted Event handler to remove a file
* from the MRU list
Expand Down Expand Up @@ -1616,6 +1630,10 @@ define(function (require, exports, module) {
// get an event handler for workspace events and we don't listen
// to the event before we've been initialized
WorkspaceManager.on("workspaceUpdateLayout", _updateLayout);

// Listen to key Alt-W to toggle between panes
CommandManager.register(Strings.CMD_SWITCH_PANE_FOCUS, Commands.CMD_SWITCH_PANE_FOCUS, switchPaneFocus);
KeyBindingManager.addBinding(Commands.CMD_SWITCH_PANE_FOCUS, {key: 'Alt-W'});
}

/**
Expand Down Expand Up @@ -1658,8 +1676,8 @@ define(function (require, exports, module) {

return result;
}


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change as it's only unintentional whitespace modification.

/**
* Setup a ready event to initialize ourself
*/
Expand Down Expand Up @@ -1729,6 +1747,7 @@ define(function (require, exports, module) {

exports.getAllOpenFiles = getAllOpenFiles;
exports.focusActivePane = focusActivePane;
exports.switchPaneFocus = switchPaneFocus;

// Layout
exports.setLayoutScheme = setLayoutScheme;
Expand Down
28 changes: 28 additions & 0 deletions test/spec/MainViewManager-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,34 @@ define(function (require, exports, module) {
expect(MainViewManager.getLayoutScheme()).toEqual({rows: 1, columns: 1});
});
});
it("should switch pane when Commands.CMD_SWITCH_PANE_FOCUS is called", function () {
runs(function () {
MainViewManager.setLayoutScheme(1, 2);
});
runs(function () {
$('#first-pane').click();
CommandManager.execute(Commands.CMD_SWITCH_PANE_FOCUS);
expect(MainViewManager.getActivePaneId()).toEqual("second-pane");
});
runs(function () {
$('#second-pane').click();
CommandManager.execute(Commands.CMD_SWITCH_PANE_FOCUS);
expect(MainViewManager.getActivePaneId()).toEqual("first-pane");
});
runs(function () {
MainViewManager.setLayoutScheme(2, 1);
});
runs(function () {
$('#first-pane').click();
CommandManager.execute(Commands.CMD_SWITCH_PANE_FOCUS);
expect(MainViewManager.getActivePaneId()).toEqual("second-pane");
});
runs(function () {
$('#second-pane').click();
CommandManager.execute(Commands.CMD_SWITCH_PANE_FOCUS);
expect(MainViewManager.getActivePaneId()).toEqual("first-pane");
});
});
it("should activate pane when editor gains focus", function () {
var editors = {},
handler = function (e, doc, editor, paneId) {
Expand Down