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

View file

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

View file

@ -54,7 +54,7 @@ EventBaton.prototype.releaseBaton = function(name, func, context) {
}, this); }, this);
if (!found) { 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; this.eventMap[name] = newListeners;
}; };

View file

@ -126,11 +126,19 @@ var ModalView = Backbone.View.extend({
console.warn('stealing keyboard'); console.warn('stealing keyboard');
Main.getEventBaton().stealBaton('keydown', this.onKeyDown, this); Main.getEventBaton().stealBaton('keydown', this.onKeyDown, this);
Main.getEventBaton().stealBaton('keyup', this.onKeyUp, this); Main.getEventBaton().stealBaton('keyup', this.onKeyUp, this);
Main.getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
$('#commandTextField').blur();
}, },
releaseKeyboard: function() { releaseKeyboard: function() {
Main.getEventBaton().releaseBaton('keydown', this.onKeyDown, this); Main.getEventBaton().releaseBaton('keydown', this.onKeyDown, this);
Main.getEventBaton().releaseBaton('keyup', this.onKeyUp, 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) { 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 // first we stop listening to keyboard and give that back to UI, which
// other views will take if they need to // other views will take if they need to
this.keyboardListener.mute(); this.keyboardListener.mute();
require('../app').getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
setTimeout(_.bind(function() { setTimeout(_.bind(function() {
_.each(this.childViews, function(childView) { _.each(this.childViews, function(childView) {
@ -137,7 +136,6 @@ var MultiView = Backbone.View.extend({
start: function() { start: function() {
// steal the window focus baton // steal the window focus baton
require('../app').getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
this.showViewIndex(this.currentIndex); this.showViewIndex(this.currentIndex);
}, },

View file

@ -12,7 +12,6 @@ Commands
======== ========
[ ] move command creation outside of the command view so multiple things [ ] move command creation outside of the command view so multiple things
can be responsible for specifying the waterfall associated with a command! 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!!! [ ] multiple things can process!!!
[ ] sip from buffer with post-command hooks. ideally the git engine [ ] sip from buffer with post-command hooks. ideally the git engine
knows nothing about the level being played knows nothing about the level being played
@ -35,6 +34,7 @@ Big Bugs to fix:
Done things: Done things:
(I only started this on Dec 17th 2012 to get a better sense of what was done) (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 [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 because then you just steal and release for modals and such
[x] text input from the commandPromptView must flow down into [x] text input from the commandPromptView must flow down into