Skip to content

Commit f07a64f

Browse files
committed
Add base for statusbar
1 parent 557fc08 commit f07a64f

16 files changed

Lines changed: 148 additions & 12 deletions

File tree

addons/cb.files.editor/views/file.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ define([
8181
'flags': "disabled"
8282
});
8383

84+
// Statusbar
85+
this.editorStatusCommand = new Command({}, {
86+
'title': "Line 1, Column 1",
87+
'type': "label"
88+
});
89+
this.tab.statusbar.add(this.editorStatusCommand);
90+
8491
// Tab menu
8592
this.tab.menu.menuSection([
8693
{
@@ -181,6 +188,7 @@ define([
181188
this.editor.getSession().selection.on('changeCursor', function(){
182189
var cursor = that.editor.getSession().getSelection().getCursor();
183190
that.sync.updateUserCursor(cursor.column, cursor.row);
191+
that.editorStatusCommand.set("title", "Line "+(cursor.row+1)+", Column "+(cursor.column+1));
184192
});
185193

186194
var $doc = this.editor.session.doc;

addons/cb.theme.dark/main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ define([
3434
}
3535
},
3636

37+
// Statusbar
38+
statusbar: {
39+
'background': bgDarker,
40+
'color': colorDark,
41+
'border-color': "#111",
42+
43+
button: {
44+
'border-color': bgNormal
45+
}
46+
},
47+
3748
// Lateral bar panels
3849
lateralbar: {
3950
'background': bgDark,

client/core/app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ define([
1313
'core/files',
1414
'core/commands/toolbar',
1515
'core/commands/menu',
16+
'core/commands/statusbar',
1617
'core/commands/palette',
1718
'core/tabs',
1819
'core/panels',
@@ -24,7 +25,7 @@ define([
2425
'core/search/tags',
2526
'core/search/addons'
2627
], function (hr, url, dialogs, alerts, loading, GridView, templateFile,
27-
box, session, addons, box, files, commands, menu, palette, tabs, panels, operations, localfs, themes) {
28+
box, session, addons, box, files, commands, menu, statusbar, palette, tabs, panels, operations, localfs, themes) {
2829

2930
// Define base application
3031
var Application = hr.Application.extend({
@@ -128,6 +129,10 @@ box, session, addons, box, files, commands, menu, palette, tabs, panels, operati
128129
// Add menu
129130
menu.$el.appendTo(this.$(".cb-menubar"));
130131
menu.render();
132+
133+
// Add statusbar
134+
statusbar.$el.appendTo(this.$(".cb-statusbar"));
135+
statusbar.render();
131136

132137
// Add commands
133138
commands.$el.appendTo(this.$(".cb-commands"));

client/core/commands/statusbar.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
define([
2+
'hr/utils',
3+
'hr/hr',
4+
'views/commands/statusbar'
5+
], function (_, hr, StatusbarView) {
6+
// Collection for all statusbar commands
7+
var statusbar = new StatusbarView();
8+
9+
// Feedback
10+
statusbar.register("statusbar.sendfeedback", {
11+
title: "Send Feedback",
12+
position: 5,
13+
offline: false,
14+
search: false
15+
}, function() {
16+
window.open("https://github.com/FriendCode/codebox/issues");
17+
});
18+
19+
return statusbar;
20+
});

client/core/themes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ define([
8383
'menubar': ".cb-menubar",
8484
'menubar button': ".cb-menubar .cb-commands-menubar .menu-command-item>.btn",
8585

86+
// statusbar
87+
'statusbar': ".cb-statusbar",
88+
'statusbar button': ".cb-statusbar .cb-commands-menubar .menu-command-item>.btn",
89+
8690
// lateral bar
8791
'lateralbar': ".cb-lateralbar",
8892
'lateralbar commands': ".cb-lateralbar .lateral-commands",

client/resources/stylesheets/main.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@import "ui/alert.less";
1616
@import "ui/loading.less";
1717
@import "ui/menubar.less";
18+
@import "ui/statusbar.less";
1819
@import "ui/lateralbar.less";
1920
@import "ui/operations.less";
2021
@import "ui/body.less";

client/resources/stylesheets/ui/body.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
.cb-body {
33
position: absolute;
44
top: @codeboxMenubarHeight;
5-
left: @codeboxToolbarWidth;
5+
bottom: @codeboxStatusbarHeight;
6+
left: @codeboxToolbarWidth;
67
right: 0px;
7-
bottom: 0px;
88
z-index: 10;
99
background: @codeboxBodyBackground;
1010
.transition(left @lateralTransitionSpeed);

client/resources/stylesheets/ui/lateralbar.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
position: absolute;
44
top: @codeboxMenubarHeight;
55
left: 0px;
6-
bottom: 0px;
6+
bottom: @codeboxStatusbarHeight;
77
width: @codeboxToolbarWidth;
88
.transition(width @lateralTransitionSpeed);
99
.user-select(none);

client/resources/stylesheets/ui/menubar.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
top: 0px;
44
right: 0px;
55
left: 0px;
6-
height: @codeboxMenubarHeight+1;
6+
height: @codeboxMenubarHeight;
77
border-bottom: 1px solid #ccc;
88
z-index: 1000;
99

@@ -17,7 +17,7 @@
1717
margin: 0px 4px;
1818
cursor: default;
1919
position: relative;
20-
height: 26px;
20+
height: @codeboxMenubarHeight - 1;
2121
color: inherit;
2222

2323
& > .btn {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.cb-statusbar {
2+
position: fixed;
3+
bottom: 0px;
4+
right: 0px;
5+
left: 0px;
6+
height: @codeboxStatusbarHeight;
7+
border-top: 1px solid #ccc;
8+
z-index: 1000;
9+
10+
.cb-commands-menubar {
11+
margin: 0px;
12+
padding: 0px;
13+
list-style: none;
14+
font-size: 13px;
15+
16+
.menu-item {
17+
color: inherit;
18+
margin: 0px 4px;
19+
cursor: default;
20+
position: relative;
21+
height: @codeboxStatusbarHeight - 1;
22+
color: inherit;
23+
float: right;
24+
display: inline-block;
25+
26+
&.menu-item-label {
27+
float: left;
28+
padding: 3px 3px;
29+
}
30+
31+
& > a {
32+
border-radius: 0px;
33+
background: transparent;
34+
padding: 1px 8px;
35+
cursor: default;
36+
color: inherit;
37+
-webkit-font-smoothing: antialiased;
38+
border: 1px solid transparent;
39+
border-top: 0px;
40+
border-bottom: 0px;
41+
display: inline-block;
42+
}
43+
44+
&:hover {
45+
& > a {
46+
background: rgba(0,0,0,0.10);
47+
text-decoration: none;
48+
}
49+
}
50+
51+
&.disabled {
52+
opacity: 0.4;
53+
}
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)