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

Commit

Permalink
Merge pull request #1717 from jbalsas/statusbar
Browse files Browse the repository at this point in the history
Statusbar for Brackets
  • Loading branch information
gruehle committed Oct 3, 2012
2 parents 238f3ec + f5d977a commit 4c7b775
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ define(function (require, exports, module) {
UpdateNotification = require("utils/UpdateNotification"),
UrlParams = require("utils/UrlParams").UrlParams,
NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
PreferencesManager = require("preferences/PreferencesManager");
PreferencesManager = require("preferences/PreferencesManager"),
StatusBar = require("widgets/Statusbar");

// Local variables
var params = new UrlParams(),
Expand Down
12 changes: 12 additions & 0 deletions src/htmlContent/main-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@
</div>
<div class="table-container"></div>
</div>

<div id="status-bar" class="statusbar">
<ul id="status-info" class="info" >
<span id="status-cursor"></span>
<span id="status-file"></span>
<span id="status-mode"></span>
<span id="status-tab"></span>
</ul>
<div id="busy-indicator">&#9719;</div>
<ul id="status-indicators" class="indicators">
</ul>
</div>
</div>

<!-- Hack to ensure that the code editor's web font is loaded early. -->
Expand Down
18 changes: 17 additions & 1 deletion src/language/JSLintUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ define(function (require, exports, module) {
EditorManager = require("editor/EditorManager"),
PreferencesManager = require("preferences/PreferencesManager"),
PerfUtils = require("utils/PerfUtils"),
Strings = require("strings");
Strings = require("strings"),
StringUtils = require("utils/StringUtils"),
AppInit = require("utils/AppInit"),
StatusBar = require("widgets/StatusBar");

/**
* @private
Expand Down Expand Up @@ -136,9 +139,15 @@ define(function (require, exports, module) {
.append($errorTable);
$lintResults.show();
$goldStar.hide();
if (JSLINT.errors.length === 1) {
StatusBar.updateIndicator(module.id, true, "jslint-errors", Strings.JSLINT_ERROR_INFORMATION);
} else {
StatusBar.updateIndicator(module.id, true, "jslint-errors", StringUtils.format(Strings.JSLINT_ERRORS_INFORMATION, JSLINT.errors.length));
}
} else {
$lintResults.hide();
$goldStar.show();
StatusBar.updateIndicator(module.id, true, "jslint-valid", Strings.JSLINT_NO_ERRORS);
}

PerfUtils.addMeasurement(perfTimerDOM);
Expand All @@ -148,6 +157,7 @@ define(function (require, exports, module) {
// both the results and the gold star
$lintResults.hide();
$goldStar.hide();
StatusBar.updateIndicator(module.id, true, "jslint-disabled", Strings.JSLINT_DISABLED);
}

EditorManager.resizeEditor();
Expand Down Expand Up @@ -208,6 +218,12 @@ define(function (require, exports, module) {
_prefs = PreferencesManager.getPreferenceStorage(module.id, { enabled: !!brackets.config.enable_jslint });
_setEnabled(_prefs.getValue("enabled"));

// Init StatusBar indicator
AppInit.htmlReady(function () {
StatusBar.addIndicator(module.id, $("#gold-star"), false);
});


// Define public API
exports.run = run;
exports.getEnabled = getEnabled;
Expand Down
10 changes: 10 additions & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ define({
"KEYBOARD_CTRL" : "Ctrl",
"KEYBOARD_SHIFT" : "Shift",
"KEYBOARD_SPACE" : "Space",

/**
* StatusBar strings
*/
"STATUSBAR_CURSOR_POSITION" : "Line {0}, Column {1}",
"STATUSBAR_TAB_SIZE" : "Tab Size {0}",
"STATUSBAR_LINE_COUNT" : "{0} Lines",

/**
* Command Name Constants
Expand Down Expand Up @@ -209,7 +216,10 @@ define({
// Strings for main-view.html
"EXPERIMENTAL_BUILD" : "Experimental Build",
"JSLINT_ERRORS" : "JSLint Errors",
"JSLINT_ERROR_INFORMATION" : "1 JSLint Error",
"JSLINT_ERRORS_INFORMATION" : "{0} JSLint Errors",
"JSLINT_NO_ERRORS" : "No JSLint errors - good job!",
"JSLINT_DISABLED" : "JSLint disabled or not working for the current file",
"SEARCH_RESULTS" : "Search Results",
"OK" : "OK",
"DONT_SAVE" : "Don't Save",
Expand Down
6 changes: 5 additions & 1 deletion src/search/FindInFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ define(function (require, exports, module) {
DocumentManager = require("document/DocumentManager"),
EditorManager = require("editor/EditorManager"),
FileIndexManager = require("project/FileIndexManager"),
KeyEvent = require("utils/KeyEvent");
KeyEvent = require("utils/KeyEvent"),
StatusBar = require("widgets/StatusBar");


var FIND_IN_FILES_MAX = 100;
Expand Down Expand Up @@ -297,6 +298,7 @@ define(function (require, exports, module) {
dialog.showDialog(initialString)
.done(function (query) {
if (query) {
StatusBar.showBusyIndicator(true);
var queryExpr = _getQueryRegExp(query);
FileIndexManager.getFileInfoList("all")
.done(function (fileListResult) {
Expand Down Expand Up @@ -325,9 +327,11 @@ define(function (require, exports, module) {
})
.done(function () {
_showSearchResults(searchResults, query);
StatusBar.hideBusyIndicator();
})
.fail(function () {
console.log("find in files failed.");
StatusBar.hideBusyIndicator();
});
});
}
Expand Down
62 changes: 58 additions & 4 deletions src/styles/brackets.less
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,51 @@ a, img {
z-index: @z-index-brackets-toolbar;
}

.busyCursor {
cursor: wait !important;
}

.statusbar {
height: 19px;
overflow: hidden;
background-color: lighten(@bc-grey, @bc-color-step-size*4);

.info {
float: left;
margin-left: 8px;
margin-top: 3px;

span {
color: @bc-grey;
padding-right: 15px;
vertical-align: middle;
}
}

.indicators {
overflow: hidden;
display: block;
float:right;
position: absolute;
right: 24px;
margin: 1px 0px 1px 0px;

.indicator {
margin-right: 2px;
margin-left: 2px;
color: @bc-grey;
}
}
}

#busy-indicator {
color: @bc-grey;
font-size: 1.4em;
display: inline-block;
float: right;
margin: 0px 8px 0px 0px;
}

#editor-holder {
.vbox;
.box-flex(1);
Expand Down Expand Up @@ -161,10 +206,19 @@ a, img {
display:none;
}

#gold-star {
display: none;
font-size: 1.2em;
color: #ffe13b;
.jslint-disabled {
font-size: 1em;
color: @bc-grey;
}

.jslint-errors {
font-size: 1em;
color: @bc-red;
}

.jslint-valid {
font-size: 1em;
color: lighten(@bc-yellow, @bc-color-step-size*2);
}

#toolbar-go-live {
Expand Down
Loading

0 comments on commit 4c7b775

Please sign in to comment.