Skip to content

Commit

Permalink
Merge remote-tracking branch 'adobe/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zaggino committed Nov 7, 2016
2 parents 98dab1a + 150c657 commit 3b0dd9e
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"author": "Brackets Team <[email protected]>",
"license": "MIT",
"homepage": "http://brackets.io",
"version": "1.8.4",
"apiVersion": "1.8.0",
"version": "1.9.0",
"apiVersion": "1.9.0",
"issues": {
"url": "https://github.com/zaggino/brackets-electron/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 @@ -158,6 +158,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
2 changes: 1 addition & 1 deletion src/extensions/default/InlineColorEditor/ColorEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ define(function (require, exports, module) {

// Update gradients in color square & opacity slider
this.$selectionBase.css("background-color", colorObject.toHexString());
this.$opacityGradient.css("background-image", "-webkit-gradient(linear, 0% 0%, 0% 100%, from(" + hueColor + "), to(transparent))");
this.$opacityGradient.css("background-image", "linear-gradient(" + hueColor + ", transparent)");

// Update slider thumb positions
this.$hueSelector.css("bottom", (this._hsv.h / 360 * 100) + "%");
Expand Down
6 changes: 3 additions & 3 deletions src/extensions/default/InlineColorEditor/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@
float: left;
}
.color-editor section .color-selection-field .saturation-gradient {
background-image: -webkit-gradient(linear, 0% 50%, 100% 50%, from(#fff), to(rgba(255,255,255,0)));
background-image: linear-gradient(to left, hsla(0,0%,100%,0), #fff);
}
.color-editor section .color-selection-field .luminosity-gradient {
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000));
background-image: linear-gradient(hsla(0,0%,100%,0), #000);
}
.color-editor section .color-selection-field .selector-base {
width: 12px;
Expand Down Expand Up @@ -200,7 +200,7 @@
margin-right: 0px;
}
.color-editor section .hue-slider {
background-image: -webkit-linear-gradient(top, #f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
background-image: linear-gradient(#f00, #f0f, #00f, #0ff, #0f0, #ff0, #f00);
}
.color-editor section footer {
font-size: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<div class="filename"><span/></div>
<img style="display: block; margin: 20px auto; opacity: 0;"/>
</div>
<div class="inline-image-viewer">
<div class="filename"><span /></div>
<img class="image" />
</div>
4 changes: 3 additions & 1 deletion src/extensions/samples/InlineImageViewer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define(function (require, exports, module) {

// Brackets modules
var EditorManager = brackets.getModule("editor/EditorManager"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
ProjectManager = brackets.getModule("project/ProjectManager");

// Local modules
Expand All @@ -45,7 +46,7 @@ define(function (require, exports, module) {

// If the pos is at the beginning of a name, token will be the
// preceding whitespace or dot. In that case, try the next pos.
if (!/\S/.match(token.string) || token.string === ".") {
if (!/\S/.test(token.string) || token.string === ".") {
token = hostEditor._codeMirror.getTokenAt({line: pos.line, ch: pos.ch + 1}, true);
}

Expand Down Expand Up @@ -128,5 +129,6 @@ define(function (require, exports, module) {
return result.promise();
}

ExtensionUtils.loadStyleSheet(module, "style.css");
EditorManager.registerInlineEditProvider(inlineImageViewerProvider);
});
11 changes: 11 additions & 0 deletions src/extensions/samples/InlineImageViewer/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.inline-image-viewer .filename {
text-align: right;
padding-right: 1.5em;
line-height: 32px;
}

.inline-image-viewer .image {
display: block;
margin: 0 auto;
opacity: 0;
}
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;
}


/**
* 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

0 comments on commit 3b0dd9e

Please sign in to comment.