|
@@ -1457,7 +1457,7 @@ messageSends: ["keyBinder:", "new", "yourself"]}),
|
|
smalltalk.HLKeyBinderHelper.klass);
|
|
smalltalk.HLKeyBinderHelper.klass);
|
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('HLRepeatingKeyBinderForWidget', smalltalk.Object, ['repeatInterval', 'delay', 'interval', 'keysWithActions', 'widget', 'isKeyCurrentlyPressed'], 'Helios-KeyBindings');
|
|
|
|
|
|
+smalltalk.addClass('HLRepeatingKeyBindingHandler', smalltalk.Object, ['repeatInterval', 'delay', 'interval', 'keyBindings', 'widget', 'isKeyCurrentlyPressed'], 'Helios-KeyBindings');
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "bindKeys",
|
|
selector: "bindKeys",
|
|
@@ -1471,9 +1471,9 @@ return self._handleKeyDown_(e);
|
|
return smalltalk.withContext(function($ctx2) {
|
|
return smalltalk.withContext(function($ctx2) {
|
|
return self._handleKeyUp_(e);
|
|
return self._handleKeyUp_(e);
|
|
}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
|
|
}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"bindKeys",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"bindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
messageSends: ["bindKeyDown:up:", "handleKeyDown:", "handleKeyUp:"]}),
|
|
messageSends: ["bindKeyDown:up:", "handleKeyDown:", "handleKeyUp:"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1490,7 +1490,7 @@ return self["@interval"];
|
|
return $1;
|
|
return $1;
|
|
}, function($ctx1) {$ctx1.fill(self,"delayBeforeStartingRepeatWithAction:",{action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
}, function($ctx1) {$ctx1.fill(self,"delayBeforeStartingRepeatWithAction:",{action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: ["valueWithTimeout:", "startRepeatingAction:"]}),
|
|
messageSends: ["valueWithTimeout:", "startRepeatingAction:"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1498,13 +1498,37 @@ selector: "handleKeyDown:",
|
|
fn: function (e){
|
|
fn: function (e){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(self["@keysWithActions"])._keysAndValuesDo_((function(key,action){
|
|
|
|
|
|
+_st(self["@keyBindings"])._keysAndValuesDo_((function(key,action){
|
|
return smalltalk.withContext(function($ctx2) {
|
|
return smalltalk.withContext(function($ctx2) {
|
|
return self._ifKey_wasPressedIn_thenDo_(key,e,action);
|
|
return self._ifKey_wasPressedIn_thenDo_(key,e,action);
|
|
}, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1)})}));
|
|
}, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1)})}));
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{e:e},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{e:e},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
messageSends: ["keysAndValuesDo:", "ifKey:wasPressedIn:thenDo:"]}),
|
|
messageSends: ["keysAndValuesDo:", "ifKey:wasPressedIn:thenDo:"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
+
|
|
|
|
+smalltalk.addMethod(
|
|
|
|
+smalltalk.method({
|
|
|
|
+selector: "handleKeyUp",
|
|
|
|
+fn: function (){
|
|
|
|
+var self=this;
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
|
+var $1,$2;
|
|
|
|
+self["@isKeyCurrentlyPressed"]=false;
|
|
|
|
+$1=self["@interval"];
|
|
|
|
+if(($receiver = $1) == nil || $receiver == undefined){
|
|
|
|
+$1;
|
|
|
|
+} else {
|
|
|
|
+_st(self["@interval"])._clearInterval();
|
|
|
|
+};
|
|
|
|
+$2=self["@delay"];
|
|
|
|
+if(($receiver = $2) == nil || $receiver == undefined){
|
|
|
|
+$2;
|
|
|
|
+} else {
|
|
|
|
+_st(self["@delay"])._clearTimeout();
|
|
|
|
+};
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
|
|
+messageSends: ["ifNotNil:", "clearInterval", "clearTimeout"]}),
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1515,11 +1539,11 @@ return smalltalk.withContext(function($ctx1) {
|
|
var $1;
|
|
var $1;
|
|
$1=self["@isKeyCurrentlyPressed"];
|
|
$1=self["@isKeyCurrentlyPressed"];
|
|
if(smalltalk.assert($1)){
|
|
if(smalltalk.assert($1)){
|
|
-self._resetKeypressActive();
|
|
|
|
|
|
+self._handleKeyUp();
|
|
};
|
|
};
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp:",{e:e},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
-messageSends: ["ifTrue:", "resetKeypressActive"]}),
|
|
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp:",{e:e},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
|
|
+messageSends: ["ifTrue:", "handleKeyUp"]}),
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1537,7 +1561,7 @@ self._whileTheKeyIsPressedDo_(action);
|
|
};
|
|
};
|
|
return self}, function($ctx1) {$ctx1.fill(self,"ifKey:wasPressedIn:thenDo:",{key:key,e:e,action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"ifKey:wasPressedIn:thenDo:",{key:key,e:e,action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: ["ifTrue:", "whileTheKeyIsPressedDo:", "and:", "=", "which"]}),
|
|
messageSends: ["ifTrue:", "whileTheKeyIsPressedDo:", "and:", "=", "which"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1547,12 +1571,12 @@ var self=this;
|
|
function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
|
|
function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
|
|
smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
|
|
-self["@keysWithActions"]=_st($Dictionary())._new();
|
|
|
|
|
|
+self["@keyBindings"]=_st($Dictionary())._new();
|
|
self["@isKeyCurrentlyPressed"]=false;
|
|
self["@isKeyCurrentlyPressed"]=false;
|
|
self["@repeatInterval"]=(70);
|
|
self["@repeatInterval"]=(70);
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
messageSends: ["initialize", "new"]}),
|
|
messageSends: ["initialize", "new"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1566,7 +1590,7 @@ _st($1)._unbindKeys();
|
|
$2=_st($1)._bindKeys();
|
|
$2=_st($1)._bindKeys();
|
|
return self}, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: ["unbindKeys", "bindKeys"]}),
|
|
messageSends: ["unbindKeys", "bindKeys"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1577,31 +1601,7 @@ return smalltalk.withContext(function($ctx1) {
|
|
self["@repeatInterval"]=aMillisecondIntegerValue;
|
|
self["@repeatInterval"]=aMillisecondIntegerValue;
|
|
return self}, function($ctx1) {$ctx1.fill(self,"repeatInterval:",{aMillisecondIntegerValue:aMillisecondIntegerValue},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"repeatInterval:",{aMillisecondIntegerValue:aMillisecondIntegerValue},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: []}),
|
|
messageSends: []}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
-
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "resetKeypressActive",
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-var $1,$2;
|
|
|
|
-self["@isKeyCurrentlyPressed"]=false;
|
|
|
|
-$1=self["@interval"];
|
|
|
|
-if(($receiver = $1) == nil || $receiver == undefined){
|
|
|
|
-$1;
|
|
|
|
-} else {
|
|
|
|
-_st(self["@interval"])._clearInterval();
|
|
|
|
-};
|
|
|
|
-$2=self["@delay"];
|
|
|
|
-if(($receiver = $2) == nil || $receiver == undefined){
|
|
|
|
-$2;
|
|
|
|
-} else {
|
|
|
|
-_st(self["@delay"])._clearTimeout();
|
|
|
|
-};
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"resetKeypressActive",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
-messageSends: ["ifNotNil:", "clearInterval", "clearTimeout"]}),
|
|
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1616,13 +1616,13 @@ $2=_st(self["@widget"])._hasFocus();
|
|
if(smalltalk.assert($2)){
|
|
if(smalltalk.assert($2)){
|
|
return _st(action)._value();
|
|
return _st(action)._value();
|
|
} else {
|
|
} else {
|
|
-return self._resetKeypressActive();
|
|
|
|
|
|
+return self._handleKeyUp();
|
|
};
|
|
};
|
|
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithInterval_(self["@repeatInterval"]);
|
|
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithInterval_(self["@repeatInterval"]);
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
-messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "value", "resetKeypressActive", "hasFocus"]}),
|
|
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
|
|
+messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "value", "handleKeyUp", "hasFocus"]}),
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1633,18 +1633,18 @@ return smalltalk.withContext(function($ctx1) {
|
|
_st(self["@widget"])._unbindKeyDownUp();
|
|
_st(self["@widget"])._unbindKeyDownUp();
|
|
return self}, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: ["unbindKeyDownUp"]}),
|
|
messageSends: ["unbindKeyDownUp"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "whileKeyPressed:doAction:",
|
|
|
|
|
|
+selector: "whileKeyPressed:do:",
|
|
fn: function (aKey,aBlock){
|
|
fn: function (aKey,aBlock){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
-_st(self["@keysWithActions"])._at_put_(aKey,aBlock);
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"whileKeyPressed:doAction:",{aKey:aKey,aBlock:aBlock},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
|
|
|
|
+_st(self["@keyBindings"])._at_put_(aKey,aBlock);
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"whileKeyPressed:do:",{aKey:aKey,aBlock:aBlock},smalltalk.HLRepeatingKeyBindingHandler)})},
|
|
messageSends: ["at:put:"]}),
|
|
messageSends: ["at:put:"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1657,7 +1657,7 @@ _st(action)._value();
|
|
self["@delay"]=self._delayBeforeStartingRepeatWithAction_(action);
|
|
self["@delay"]=self._delayBeforeStartingRepeatWithAction_(action);
|
|
return self}, function($ctx1) {$ctx1.fill(self,"whileTheKeyIsPressedDo:",{action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"whileTheKeyIsPressedDo:",{action:action},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: ["value", "delayBeforeStartingRepeatWithAction:"]}),
|
|
messageSends: ["value", "delayBeforeStartingRepeatWithAction:"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
@@ -1668,12 +1668,12 @@ return smalltalk.withContext(function($ctx1) {
|
|
self["@widget"]=aWidget;
|
|
self["@widget"]=aWidget;
|
|
return self}, function($ctx1) {$ctx1.fill(self,"widget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"widget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBinderForWidget)})},
|
|
messageSends: []}),
|
|
messageSends: []}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler);
|
|
|
|
|
|
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
-selector: "newWithWidget:",
|
|
|
|
|
|
+selector: "forWidget:",
|
|
fn: function (aWidget){
|
|
fn: function (aWidget){
|
|
var self=this;
|
|
var self=this;
|
|
return smalltalk.withContext(function($ctx1) {
|
|
return smalltalk.withContext(function($ctx1) {
|
|
@@ -1683,8 +1683,8 @@ _st($2)._widget_(aWidget);
|
|
$3=_st($2)._yourself();
|
|
$3=_st($2)._yourself();
|
|
$1=$3;
|
|
$1=$3;
|
|
return $1;
|
|
return $1;
|
|
-}, function($ctx1) {$ctx1.fill(self,"newWithWidget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBinderForWidget.klass)})},
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"forWidget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBindingHandler.klass)})},
|
|
messageSends: ["widget:", "new", "yourself"]}),
|
|
messageSends: ["widget:", "new", "yourself"]}),
|
|
-smalltalk.HLRepeatingKeyBinderForWidget.klass);
|
|
|
|
|
|
+smalltalk.HLRepeatingKeyBindingHandler.klass);
|
|
|
|
|
|
|
|
|