almost done

This commit is contained in:
Peter Cottle 2013-01-01 14:49:03 -08:00
parent 0d6f2516cb
commit 69235f4b37
6 changed files with 10 additions and 32 deletions

View file

@ -8872,7 +8872,6 @@ var init = function(){
// we always want to focus the text area to collect input
var focusTextArea = function() {
console.log('focusing text area');
$('#commandTextField').focus();
};
focusTextArea();
@ -8923,15 +8922,8 @@ function UI() {
el: $('#commandLineHistory'),
collection: this.commandCollection
});
$('#commandTextField').focus();
eventBaton.stealBaton('windowFocus', this.onWindowFocus, this);
}
UI.prototype.onWindowFocus = function() {
this.commandPromptView.focus();
};
exports.getEvents = function() {
return events;
};
@ -14211,7 +14203,6 @@ var MultiView = Backbone.View.extend({
// first we stop listening to keyboard and give that back to UI, which
// other views will take if they need to
this.keyboardListener.mute();
require('../app').getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
setTimeout(_.bind(function() {
_.each(this.childViews, function(childView) {
@ -14224,7 +14215,6 @@ var MultiView = Backbone.View.extend({
start: function() {
// steal the window focus baton
require('../app').getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
this.showViewIndex(this.currentIndex);
},
@ -14288,7 +14278,6 @@ var init = function(){
// we always want to focus the text area to collect input
var focusTextArea = function() {
console.log('focusing text area');
$('#commandTextField').focus();
};
focusTextArea();
@ -14339,15 +14328,8 @@ function UI() {
el: $('#commandLineHistory'),
collection: this.commandCollection
});
$('#commandTextField').focus();
eventBaton.stealBaton('windowFocus', this.onWindowFocus, this);
}
UI.prototype.onWindowFocus = function() {
this.commandPromptView.focus();
};
exports.getEvents = function() {
return events;
};
@ -17953,7 +17935,6 @@ var MultiView = Backbone.View.extend({
// first we stop listening to keyboard and give that back to UI, which
// other views will take if they need to
this.keyboardListener.mute();
require('../app').getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
setTimeout(_.bind(function() {
_.each(this.childViews, function(childView) {
@ -17966,7 +17947,6 @@ var MultiView = Backbone.View.extend({
start: function() {
// steal the window focus baton
require('../app').getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
this.showViewIndex(this.currentIndex);
},

View file

@ -23,7 +23,6 @@ var init = function(){
// we always want to focus the text area to collect input
var focusTextArea = function() {
console.log('focusing text area');
$('#commandTextField').focus();
};
focusTextArea();
@ -74,15 +73,8 @@ function UI() {
el: $('#commandLineHistory'),
collection: this.commandCollection
});
$('#commandTextField').focus();
eventBaton.stealBaton('windowFocus', this.onWindowFocus, this);
}
UI.prototype.onWindowFocus = function() {
this.commandPromptView.focus();
};
exports.getEvents = function() {
return events;
};

View file

@ -54,7 +54,7 @@ EventBaton.prototype.releaseBaton = function(name, func, context) {
}, this);
if (!found) {
throw new Error('did not find that function');
throw new Error('did not find that function', func, context, name, arguments);
}
this.eventMap[name] = newListeners;
};

View file

@ -126,11 +126,19 @@ var ModalView = Backbone.View.extend({
console.warn('stealing keyboard');
Main.getEventBaton().stealBaton('keydown', this.onKeyDown, this);
Main.getEventBaton().stealBaton('keyup', this.onKeyUp, this);
Main.getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
$('#commandTextField').blur();
},
releaseKeyboard: function() {
Main.getEventBaton().releaseBaton('keydown', this.onKeyDown, this);
Main.getEventBaton().releaseBaton('keyup', this.onKeyUp, this);
Main.getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
},
onWindowFocus: function(e) {
console.log('window focus doing nothing', e);
},
onKeyDown: function(e) {

View file

@ -124,7 +124,6 @@ var MultiView = Backbone.View.extend({
// first we stop listening to keyboard and give that back to UI, which
// other views will take if they need to
this.keyboardListener.mute();
require('../app').getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
setTimeout(_.bind(function() {
_.each(this.childViews, function(childView) {
@ -137,7 +136,6 @@ var MultiView = Backbone.View.extend({
start: function() {
// steal the window focus baton
require('../app').getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
this.showViewIndex(this.currentIndex);
},

View file

@ -12,7 +12,6 @@ Commands
========
[ ] move command creation outside of the command view so multiple things
can be responsible for specifying the waterfall associated with a command!
[ ] then refactor keyboard input and UI.listen() to that event system
[ ] multiple things can process!!!
[ ] sip from buffer with post-command hooks. ideally the git engine
knows nothing about the level being played
@ -35,6 +34,7 @@ Big Bugs to fix:
Done things:
(I only started this on Dec 17th 2012 to get a better sense of what was done)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[x] then refactor keyboard input and UI.listen() to that event system
[x] make some kind of "single listener" event system... will make keyboard stuff easy
because then you just steal and release for modals and such
[x] text input from the commandPromptView must flow down into