Helios-KeyBindings.deploy.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692
  1. define("amber/Helios-KeyBindings", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Helios-KeyBindings');
  3. smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "applyOn:",
  7. fn: function (aKeyBinder){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) {
  10. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBinding)})},
  11. messageSends: []}),
  12. smalltalk.HLBinding);
  13. smalltalk.addMethod(
  14. smalltalk.method({
  15. selector: "atKey:",
  16. fn: function (aKey){
  17. var self=this;
  18. return smalltalk.withContext(function($ctx1) {
  19. return nil;
  20. }, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBinding)})},
  21. messageSends: []}),
  22. smalltalk.HLBinding);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "displayLabel",
  26. fn: function (){
  27. var self=this;
  28. return smalltalk.withContext(function($ctx1) {
  29. var $1;
  30. $1=self._label();
  31. return $1;
  32. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBinding)})},
  33. messageSends: ["label"]}),
  34. smalltalk.HLBinding);
  35. smalltalk.addMethod(
  36. smalltalk.method({
  37. selector: "isActive",
  38. fn: function (){
  39. var self=this;
  40. return smalltalk.withContext(function($ctx1) {
  41. var $1;
  42. $1=self._subclassResponsibility();
  43. return $1;
  44. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBinding)})},
  45. messageSends: ["subclassResponsibility"]}),
  46. smalltalk.HLBinding);
  47. smalltalk.addMethod(
  48. smalltalk.method({
  49. selector: "isFinal",
  50. fn: function (){
  51. var self=this;
  52. return smalltalk.withContext(function($ctx1) {
  53. return false;
  54. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBinding)})},
  55. messageSends: []}),
  56. smalltalk.HLBinding);
  57. smalltalk.addMethod(
  58. smalltalk.method({
  59. selector: "key",
  60. fn: function (){
  61. var self=this;
  62. return smalltalk.withContext(function($ctx1) {
  63. var $1;
  64. $1=self["@key"];
  65. return $1;
  66. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLBinding)})},
  67. messageSends: []}),
  68. smalltalk.HLBinding);
  69. smalltalk.addMethod(
  70. smalltalk.method({
  71. selector: "key:",
  72. fn: function (anInteger){
  73. var self=this;
  74. return smalltalk.withContext(function($ctx1) {
  75. self["@key"]=anInteger;
  76. return self}, function($ctx1) {$ctx1.fill(self,"key:",{anInteger:anInteger},smalltalk.HLBinding)})},
  77. messageSends: []}),
  78. smalltalk.HLBinding);
  79. smalltalk.addMethod(
  80. smalltalk.method({
  81. selector: "label",
  82. fn: function (){
  83. var self=this;
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1;
  86. $1=self["@label"];
  87. return $1;
  88. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLBinding)})},
  89. messageSends: []}),
  90. smalltalk.HLBinding);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "label:",
  94. fn: function (aString){
  95. var self=this;
  96. return smalltalk.withContext(function($ctx1) {
  97. self["@label"]=aString;
  98. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.HLBinding)})},
  99. messageSends: []}),
  100. smalltalk.HLBinding);
  101. smalltalk.addMethod(
  102. smalltalk.method({
  103. selector: "release",
  104. fn: function (){
  105. var self=this;
  106. return smalltalk.withContext(function($ctx1) {
  107. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBinding)})},
  108. messageSends: []}),
  109. smalltalk.HLBinding);
  110. smalltalk.addMethod(
  111. smalltalk.method({
  112. selector: "renderActionFor:html:",
  113. fn: function (aBinder,html){
  114. var self=this;
  115. return smalltalk.withContext(function($ctx1) {
  116. var $1,$3,$4,$5,$6,$2;
  117. $1=_st(html)._span();
  118. _st($1)._class_("command");
  119. $2=_st($1)._with_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. $3=_st(html)._span();
  122. _st($3)._class_("label");
  123. $4=_st($3)._with_(_st(self._shortcut())._asLowercase());
  124. $4;
  125. $5=_st(html)._a();
  126. _st($5)._class_("action");
  127. _st($5)._with_(self._displayLabel());
  128. $6=_st($5)._onClick_((function(){
  129. return smalltalk.withContext(function($ctx3) {
  130. return _st(aBinder)._applyBinding_(self);
  131. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  132. return $6;
  133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  134. return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBinding)})},
  135. messageSends: ["class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:"]}),
  136. smalltalk.HLBinding);
  137. smalltalk.addMethod(
  138. smalltalk.method({
  139. selector: "renderOn:html:",
  140. fn: function (aBindingHelper,html){
  141. var self=this;
  142. return smalltalk.withContext(function($ctx1) {
  143. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBinding)})},
  144. messageSends: []}),
  145. smalltalk.HLBinding);
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "shortcut",
  149. fn: function (){
  150. var self=this;
  151. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  152. return smalltalk.withContext(function($ctx1) {
  153. var $1;
  154. $1=_st($String())._fromCharCode_(self._key());
  155. return $1;
  156. }, function($ctx1) {$ctx1.fill(self,"shortcut",{},smalltalk.HLBinding)})},
  157. messageSends: ["fromCharCode:", "key"]}),
  158. smalltalk.HLBinding);
  159. smalltalk.addMethod(
  160. smalltalk.method({
  161. selector: "on:labelled:",
  162. fn: function (anInteger,aString){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) {
  165. var $2,$3,$1;
  166. $2=self._new();
  167. _st($2)._key_(anInteger);
  168. _st($2)._label_(aString);
  169. $3=_st($2)._yourself();
  170. $1=$3;
  171. return $1;
  172. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBinding.klass)})},
  173. messageSends: ["key:", "new", "label:", "yourself"]}),
  174. smalltalk.HLBinding.klass);
  175. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['command'], 'Helios-KeyBindings');
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "applyOn:",
  179. fn: function (aKeyBinder){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) {
  182. var $1;
  183. $1=_st(self._command())._isInputRequired();
  184. if(smalltalk.assert($1)){
  185. _st(aKeyBinder)._selectBinding_(self._inputBinding());
  186. } else {
  187. _st(self._command())._execute();
  188. };
  189. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingAction)})},
  190. messageSends: ["ifTrue:ifFalse:", "selectBinding:", "inputBinding", "execute", "command", "isInputRequired"]}),
  191. smalltalk.HLBindingAction);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "command",
  195. fn: function (){
  196. var self=this;
  197. return smalltalk.withContext(function($ctx1) {
  198. var $1;
  199. $1=self["@command"];
  200. return $1;
  201. }, function($ctx1) {$ctx1.fill(self,"command",{},smalltalk.HLBindingAction)})},
  202. messageSends: []}),
  203. smalltalk.HLBindingAction);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "command:",
  207. fn: function (aCommand){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self["@command"]=aCommand;
  211. return self}, function($ctx1) {$ctx1.fill(self,"command:",{aCommand:aCommand},smalltalk.HLBindingAction)})},
  212. messageSends: []}),
  213. smalltalk.HLBindingAction);
  214. smalltalk.addMethod(
  215. smalltalk.method({
  216. selector: "inputBinding",
  217. fn: function (){
  218. var self=this;
  219. function $HLBindingInput(){return smalltalk.HLBindingInput||(typeof HLBindingInput=="undefined"?nil:HLBindingInput)}
  220. return smalltalk.withContext(function($ctx1) {
  221. var $2,$3,$4,$5,$1;
  222. $2=_st($HLBindingInput())._new();
  223. _st($2)._label_(_st(self._command())._inputLabel());
  224. _st($2)._ghostText_(_st(self._command())._displayLabel());
  225. _st($2)._defaultValue_(_st(self._command())._defaultInput());
  226. _st($2)._inputCompletion_(_st(self._command())._inputCompletion());
  227. _st($2)._callback_((function(val){
  228. return smalltalk.withContext(function($ctx2) {
  229. $3=self._command();
  230. _st($3)._input_(val);
  231. $4=_st($3)._execute();
  232. return $4;
  233. }, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1)})}));
  234. $5=_st($2)._yourself();
  235. $1=$5;
  236. return $1;
  237. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
  238. messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "execute", "yourself"]}),
  239. smalltalk.HLBindingAction);
  240. smalltalk.addMethod(
  241. smalltalk.method({
  242. selector: "isActive",
  243. fn: function (){
  244. var self=this;
  245. return smalltalk.withContext(function($ctx1) {
  246. var $1;
  247. $1=_st(self._command())._isActive();
  248. return $1;
  249. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingAction)})},
  250. messageSends: ["isActive", "command"]}),
  251. smalltalk.HLBindingAction);
  252. smalltalk.addMethod(
  253. smalltalk.method({
  254. selector: "isFinal",
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) {
  258. var $1;
  259. $1=_st(_st(self._command())._isInputRequired())._not();
  260. return $1;
  261. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingAction)})},
  262. messageSends: ["not", "isInputRequired", "command"]}),
  263. smalltalk.HLBindingAction);
  264. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  265. smalltalk.addMethod(
  266. smalltalk.method({
  267. selector: "activeBindings",
  268. fn: function (){
  269. var self=this;
  270. return smalltalk.withContext(function($ctx1) {
  271. var $1;
  272. $1=_st(self._bindings())._select_((function(each){
  273. return smalltalk.withContext(function($ctx2) {
  274. return _st(each)._isActive();
  275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  276. return $1;
  277. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  278. messageSends: ["select:", "isActive", "bindings"]}),
  279. smalltalk.HLBindingGroup);
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: "add:",
  283. fn: function (aBinding){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. var $1;
  287. $1=_st(self._bindings())._add_(aBinding);
  288. return $1;
  289. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},smalltalk.HLBindingGroup)})},
  290. messageSends: ["add:", "bindings"]}),
  291. smalltalk.HLBindingGroup);
  292. smalltalk.addMethod(
  293. smalltalk.method({
  294. selector: "addActionKey:labelled:callback:",
  295. fn: function (anInteger,aString,aBlock){
  296. var self=this;
  297. function $HLBindingAction(){return smalltalk.HLBindingAction||(typeof HLBindingAction=="undefined"?nil:HLBindingAction)}
  298. return smalltalk.withContext(function($ctx1) {
  299. var $1,$2;
  300. $1=_st($HLBindingAction())._on_labelled_(anInteger,aString);
  301. _st($1)._callback_(aBlock);
  302. $2=_st($1)._yourself();
  303. self._add_($2);
  304. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},smalltalk.HLBindingGroup)})},
  305. messageSends: ["add:", "callback:", "on:labelled:", "yourself"]}),
  306. smalltalk.HLBindingGroup);
  307. smalltalk.addMethod(
  308. smalltalk.method({
  309. selector: "addGroupKey:labelled:",
  310. fn: function (anInteger,aString){
  311. var self=this;
  312. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  313. return smalltalk.withContext(function($ctx1) {
  314. self._add_(_st($HLBindingGroup())._on_labelled_(anInteger,aString));
  315. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBindingGroup)})},
  316. messageSends: ["add:", "on:labelled:"]}),
  317. smalltalk.HLBindingGroup);
  318. smalltalk.addMethod(
  319. smalltalk.method({
  320. selector: "at:",
  321. fn: function (aString){
  322. var self=this;
  323. return smalltalk.withContext(function($ctx1) {
  324. var $1;
  325. $1=_st(self._bindings())._detect_ifNone_((function(each){
  326. return smalltalk.withContext(function($ctx2) {
  327. return _st(_st(each)._label()).__eq(aString);
  328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  329. return smalltalk.withContext(function($ctx2) {
  330. return nil;
  331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  332. return $1;
  333. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.HLBindingGroup)})},
  334. messageSends: ["detect:ifNone:", "=", "label", "bindings"]}),
  335. smalltalk.HLBindingGroup);
  336. smalltalk.addMethod(
  337. smalltalk.method({
  338. selector: "at:add:",
  339. fn: function (aString,aBinding){
  340. var self=this;
  341. var binding;
  342. return smalltalk.withContext(function($ctx1) {
  343. var $1,$2;
  344. binding=self._at_(aString);
  345. $1=binding;
  346. if(($receiver = $1) == nil || $receiver == undefined){
  347. $2=self;
  348. return $2;
  349. } else {
  350. $1;
  351. };
  352. _st(binding)._add_(aBinding);
  353. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  354. messageSends: ["at:", "ifNil:", "add:"]}),
  355. smalltalk.HLBindingGroup);
  356. smalltalk.addMethod(
  357. smalltalk.method({
  358. selector: "atKey:",
  359. fn: function (anInteger){
  360. var self=this;
  361. return smalltalk.withContext(function($ctx1) {
  362. var $1;
  363. $1=_st(self._bindings())._detect_ifNone_((function(each){
  364. return smalltalk.withContext(function($ctx2) {
  365. return _st(_st(each)._key()).__eq(anInteger);
  366. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  367. return smalltalk.withContext(function($ctx2) {
  368. return nil;
  369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  370. return $1;
  371. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},smalltalk.HLBindingGroup)})},
  372. messageSends: ["detect:ifNone:", "=", "key", "bindings"]}),
  373. smalltalk.HLBindingGroup);
  374. smalltalk.addMethod(
  375. smalltalk.method({
  376. selector: "bindings",
  377. fn: function (){
  378. var self=this;
  379. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  380. return smalltalk.withContext(function($ctx1) {
  381. var $2,$1;
  382. $2=self["@bindings"];
  383. if(($receiver = $2) == nil || $receiver == undefined){
  384. self["@bindings"]=_st($OrderedCollection())._new();
  385. $1=self["@bindings"];
  386. } else {
  387. $1=$2;
  388. };
  389. return $1;
  390. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLBindingGroup)})},
  391. messageSends: ["ifNil:", "new"]}),
  392. smalltalk.HLBindingGroup);
  393. smalltalk.addMethod(
  394. smalltalk.method({
  395. selector: "displayLabel",
  396. fn: function (){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) {
  399. var $1;
  400. $1=_st(smalltalk.HLBindingGroup.superclass.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  401. return $1;
  402. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBindingGroup)})},
  403. messageSends: [",", "displayLabel"]}),
  404. smalltalk.HLBindingGroup);
  405. smalltalk.addMethod(
  406. smalltalk.method({
  407. selector: "isActive",
  408. fn: function (){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) {
  411. var $1;
  412. $1=_st(self._activeBindings())._notEmpty();
  413. return $1;
  414. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  415. messageSends: ["notEmpty", "activeBindings"]}),
  416. smalltalk.HLBindingGroup);
  417. smalltalk.addMethod(
  418. smalltalk.method({
  419. selector: "release",
  420. fn: function (){
  421. var self=this;
  422. return smalltalk.withContext(function($ctx1) {
  423. _st(self._bindings())._do_((function(each){
  424. return smalltalk.withContext(function($ctx2) {
  425. return _st(each)._release();
  426. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  427. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingGroup)})},
  428. messageSends: ["do:", "release", "bindings"]}),
  429. smalltalk.HLBindingGroup);
  430. smalltalk.addMethod(
  431. smalltalk.method({
  432. selector: "renderOn:html:",
  433. fn: function (aBindingHelper,html){
  434. var self=this;
  435. return smalltalk.withContext(function($ctx1) {
  436. var $1;
  437. $1=self._isActive();
  438. if(smalltalk.assert($1)){
  439. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  440. };
  441. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  442. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"]}),
  443. smalltalk.HLBindingGroup);
  444. smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'wrapper', 'binder', 'ghostText', 'isFinal', 'message', 'messageTag', 'inputCompletion', 'defaultValue'], 'Helios-KeyBindings');
  445. smalltalk.addMethod(
  446. smalltalk.method({
  447. selector: "applyOn:",
  448. fn: function (aKeyBinder){
  449. var self=this;
  450. return smalltalk.withContext(function($ctx1) {
  451. self._isFinal_(true);
  452. self._evaluate_(_st(_st(self._input())._asJQuery())._val());
  453. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
  454. messageSends: ["isFinal:", "evaluate:", "val", "asJQuery", "input"]}),
  455. smalltalk.HLBindingInput);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "atKey:",
  459. fn: function (aKey){
  460. var self=this;
  461. return smalltalk.withContext(function($ctx1) {
  462. var $1;
  463. $1=_st(aKey).__eq((13));
  464. if(! smalltalk.assert($1)){
  465. return nil;
  466. };
  467. return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
  468. messageSends: ["ifFalse:", "="]}),
  469. smalltalk.HLBindingInput);
  470. smalltalk.addMethod(
  471. smalltalk.method({
  472. selector: "callback",
  473. fn: function (){
  474. var self=this;
  475. return smalltalk.withContext(function($ctx1) {
  476. var $2,$1;
  477. $2=self["@callback"];
  478. if(($receiver = $2) == nil || $receiver == undefined){
  479. self["@callback"]=(function(value){
  480. return smalltalk.withContext(function($ctx2) {
  481. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})});
  482. $1=self["@callback"];
  483. } else {
  484. $1=$2;
  485. };
  486. return $1;
  487. }, function($ctx1) {$ctx1.fill(self,"callback",{},smalltalk.HLBindingInput)})},
  488. messageSends: ["ifNil:"]}),
  489. smalltalk.HLBindingInput);
  490. smalltalk.addMethod(
  491. smalltalk.method({
  492. selector: "callback:",
  493. fn: function (aBlock){
  494. var self=this;
  495. return smalltalk.withContext(function($ctx1) {
  496. self["@callback"]=aBlock;
  497. return self}, function($ctx1) {$ctx1.fill(self,"callback:",{aBlock:aBlock},smalltalk.HLBindingInput)})},
  498. messageSends: []}),
  499. smalltalk.HLBindingInput);
  500. smalltalk.addMethod(
  501. smalltalk.method({
  502. selector: "clearStatus",
  503. fn: function (){
  504. var self=this;
  505. return smalltalk.withContext(function($ctx1) {
  506. self._status_("info");
  507. self._message_("");
  508. self._refresh();
  509. return self}, function($ctx1) {$ctx1.fill(self,"clearStatus",{},smalltalk.HLBindingInput)})},
  510. messageSends: ["status:", "message:", "refresh"]}),
  511. smalltalk.HLBindingInput);
  512. smalltalk.addMethod(
  513. smalltalk.method({
  514. selector: "defaultValue",
  515. fn: function (){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) {
  518. var $2,$1;
  519. $2=self["@defaultValue"];
  520. if(($receiver = $2) == nil || $receiver == undefined){
  521. $1="";
  522. } else {
  523. $1=$2;
  524. };
  525. return $1;
  526. }, function($ctx1) {$ctx1.fill(self,"defaultValue",{},smalltalk.HLBindingInput)})},
  527. messageSends: ["ifNil:"]}),
  528. smalltalk.HLBindingInput);
  529. smalltalk.addMethod(
  530. smalltalk.method({
  531. selector: "defaultValue:",
  532. fn: function (aString){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) {
  535. self["@defaultValue"]=aString;
  536. return self}, function($ctx1) {$ctx1.fill(self,"defaultValue:",{aString:aString},smalltalk.HLBindingInput)})},
  537. messageSends: []}),
  538. smalltalk.HLBindingInput);
  539. smalltalk.addMethod(
  540. smalltalk.method({
  541. selector: "errorStatus",
  542. fn: function (){
  543. var self=this;
  544. return smalltalk.withContext(function($ctx1) {
  545. self._status_("error");
  546. self._refresh();
  547. return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},smalltalk.HLBindingInput)})},
  548. messageSends: ["status:", "refresh"]}),
  549. smalltalk.HLBindingInput);
  550. smalltalk.addMethod(
  551. smalltalk.method({
  552. selector: "evaluate:",
  553. fn: function (aString){
  554. var self=this;
  555. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  556. return smalltalk.withContext(function($ctx1) {
  557. _st((function(){
  558. return smalltalk.withContext(function($ctx2) {
  559. return _st(self._callback())._value_(aString);
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  561. return smalltalk.withContext(function($ctx2) {
  562. _st(_st(self._input())._asJQuery())._one_do_("keydown",(function(){
  563. return smalltalk.withContext(function($ctx3) {
  564. return self._clearStatus();
  565. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  566. self._message_(_st(ex)._messageText());
  567. self._errorStatus();
  568. return self._isFinal_(false);
  569. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  570. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},smalltalk.HLBindingInput)})},
  571. messageSends: ["on:do:", "one:do:", "clearStatus", "asJQuery", "input", "message:", "messageText", "errorStatus", "isFinal:", "value:", "callback"]}),
  572. smalltalk.HLBindingInput);
  573. smalltalk.addMethod(
  574. smalltalk.method({
  575. selector: "ghostText",
  576. fn: function (){
  577. var self=this;
  578. return smalltalk.withContext(function($ctx1) {
  579. var $1;
  580. $1=self["@ghostText"];
  581. return $1;
  582. }, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
  583. messageSends: []}),
  584. smalltalk.HLBindingInput);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "ghostText:",
  588. fn: function (aText){
  589. var self=this;
  590. return smalltalk.withContext(function($ctx1) {
  591. self["@ghostText"]=aText;
  592. return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
  593. messageSends: []}),
  594. smalltalk.HLBindingInput);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "input",
  598. fn: function (){
  599. var self=this;
  600. return smalltalk.withContext(function($ctx1) {
  601. var $1;
  602. $1=self["@input"];
  603. return $1;
  604. }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
  605. messageSends: []}),
  606. smalltalk.HLBindingInput);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "inputCompletion",
  610. fn: function (){
  611. var self=this;
  612. return smalltalk.withContext(function($ctx1) {
  613. var $2,$1;
  614. $2=self["@inputCompletion"];
  615. if(($receiver = $2) == nil || $receiver == undefined){
  616. $1=[];
  617. } else {
  618. $1=$2;
  619. };
  620. return $1;
  621. }, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},smalltalk.HLBindingInput)})},
  622. messageSends: ["ifNil:"]}),
  623. smalltalk.HLBindingInput);
  624. smalltalk.addMethod(
  625. smalltalk.method({
  626. selector: "inputCompletion:",
  627. fn: function (aCollection){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) {
  630. self["@inputCompletion"]=aCollection;
  631. return self}, function($ctx1) {$ctx1.fill(self,"inputCompletion:",{aCollection:aCollection},smalltalk.HLBindingInput)})},
  632. messageSends: []}),
  633. smalltalk.HLBindingInput);
  634. smalltalk.addMethod(
  635. smalltalk.method({
  636. selector: "isActive",
  637. fn: function (){
  638. var self=this;
  639. return smalltalk.withContext(function($ctx1) {
  640. return true;
  641. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingInput)})},
  642. messageSends: []}),
  643. smalltalk.HLBindingInput);
  644. smalltalk.addMethod(
  645. smalltalk.method({
  646. selector: "isFinal",
  647. fn: function (){
  648. var self=this;
  649. return smalltalk.withContext(function($ctx1) {
  650. var $2,$1;
  651. $2=self["@isFinal"];
  652. if(($receiver = $2) == nil || $receiver == undefined){
  653. self["@isFinal"]=smalltalk.HLBindingInput.superclass.fn.prototype._isFinal.apply(_st(self), []);
  654. $1=self["@isFinal"];
  655. } else {
  656. $1=$2;
  657. };
  658. return $1;
  659. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
  660. messageSends: ["ifNil:", "isFinal"]}),
  661. smalltalk.HLBindingInput);
  662. smalltalk.addMethod(
  663. smalltalk.method({
  664. selector: "isFinal:",
  665. fn: function (aBoolean){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) {
  668. self["@isFinal"]=aBoolean;
  669. return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
  670. messageSends: []}),
  671. smalltalk.HLBindingInput);
  672. smalltalk.addMethod(
  673. smalltalk.method({
  674. selector: "message",
  675. fn: function (){
  676. var self=this;
  677. return smalltalk.withContext(function($ctx1) {
  678. var $2,$1;
  679. $2=self["@message"];
  680. if(($receiver = $2) == nil || $receiver == undefined){
  681. self["@message"]="";
  682. $1=self["@message"];
  683. } else {
  684. $1=$2;
  685. };
  686. return $1;
  687. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.HLBindingInput)})},
  688. messageSends: ["ifNil:"]}),
  689. smalltalk.HLBindingInput);
  690. smalltalk.addMethod(
  691. smalltalk.method({
  692. selector: "message:",
  693. fn: function (aString){
  694. var self=this;
  695. return smalltalk.withContext(function($ctx1) {
  696. self["@message"]=aString;
  697. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aString:aString},smalltalk.HLBindingInput)})},
  698. messageSends: []}),
  699. smalltalk.HLBindingInput);
  700. smalltalk.addMethod(
  701. smalltalk.method({
  702. selector: "refresh",
  703. fn: function (){
  704. var self=this;
  705. return smalltalk.withContext(function($ctx1) {
  706. var $1,$2;
  707. $1=self["@wrapper"];
  708. if(($receiver = $1) == nil || $receiver == undefined){
  709. $2=self;
  710. return $2;
  711. } else {
  712. $1;
  713. };
  714. _st(self["@wrapper"])._class_(self._status());
  715. _st(self["@messageTag"])._contents_(self._message());
  716. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
  717. messageSends: ["ifNil:", "class:", "status", "contents:", "message"]}),
  718. smalltalk.HLBindingInput);
  719. smalltalk.addMethod(
  720. smalltalk.method({
  721. selector: "release",
  722. fn: function (){
  723. var self=this;
  724. return smalltalk.withContext(function($ctx1) {
  725. self["@status"]=nil;
  726. self["@wrapper"]=nil;
  727. self["@binder"]=nil;
  728. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingInput)})},
  729. messageSends: []}),
  730. smalltalk.HLBindingInput);
  731. smalltalk.addMethod(
  732. smalltalk.method({
  733. selector: "renderOn:html:",
  734. fn: function (aBinder,html){
  735. var self=this;
  736. return smalltalk.withContext(function($ctx1) {
  737. var $1,$2,$4,$5,$6,$7,$3;
  738. self["@binder"]=aBinder;
  739. $1=self["@wrapper"];
  740. if(($receiver = $1) == nil || $receiver == undefined){
  741. self["@wrapper"]=_st(html)._span();
  742. self["@wrapper"];
  743. } else {
  744. $1;
  745. };
  746. $2=self["@wrapper"];
  747. _st($2)._class_(self._status());
  748. $3=_st($2)._with_((function(){
  749. return smalltalk.withContext(function($ctx2) {
  750. $4=_st(html)._input();
  751. _st($4)._placeholder_(self._ghostText());
  752. _st($4)._value_(self._defaultValue());
  753. $5=_st($4)._yourself();
  754. self["@input"]=$5;
  755. self["@input"];
  756. _st(_st(self["@input"])._asJQuery())._typeahead_(smalltalk.HashedCollection._from_(["source".__minus_gt(self._inputCompletion())]));
  757. $6=_st(html)._span();
  758. _st($6)._class_("help-inline");
  759. _st($6)._with_(self._message());
  760. $7=_st($6)._yourself();
  761. self["@messageTag"]=$7;
  762. return self["@messageTag"];
  763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  764. _st((function(){
  765. return smalltalk.withContext(function($ctx2) {
  766. return _st(_st(self["@input"])._asJQuery())._focus();
  767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((10));
  768. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
  769. messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "ghostText", "input", "value:", "defaultValue", "yourself", "typeahead:", "->", "inputCompletion", "asJQuery", "message", "valueWithTimeout:", "focus"]}),
  770. smalltalk.HLBindingInput);
  771. smalltalk.addMethod(
  772. smalltalk.method({
  773. selector: "status",
  774. fn: function (){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) {
  777. var $2,$1;
  778. $2=self["@status"];
  779. if(($receiver = $2) == nil || $receiver == undefined){
  780. self["@status"]="info";
  781. $1=self["@status"];
  782. } else {
  783. $1=$2;
  784. };
  785. return $1;
  786. }, function($ctx1) {$ctx1.fill(self,"status",{},smalltalk.HLBindingInput)})},
  787. messageSends: ["ifNil:"]}),
  788. smalltalk.HLBindingInput);
  789. smalltalk.addMethod(
  790. smalltalk.method({
  791. selector: "status:",
  792. fn: function (aStatus){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) {
  795. self["@status"]=aStatus;
  796. return self}, function($ctx1) {$ctx1.fill(self,"status:",{aStatus:aStatus},smalltalk.HLBindingInput)})},
  797. messageSends: []}),
  798. smalltalk.HLBindingInput);
  799. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  800. smalltalk.addMethod(
  801. smalltalk.method({
  802. selector: "activate",
  803. fn: function (){
  804. var self=this;
  805. return smalltalk.withContext(function($ctx1) {
  806. _st(self._helper())._show();
  807. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  808. messageSends: ["show", "helper"]}),
  809. smalltalk.HLKeyBinder);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "activationKey",
  813. fn: function (){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. return (32);
  817. }, function($ctx1) {$ctx1.fill(self,"activationKey",{},smalltalk.HLKeyBinder)})},
  818. messageSends: []}),
  819. smalltalk.HLKeyBinder);
  820. smalltalk.addMethod(
  821. smalltalk.method({
  822. selector: "activationKeyLabel",
  823. fn: function (){
  824. var self=this;
  825. return smalltalk.withContext(function($ctx1) {
  826. return "ctrl + space";
  827. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{},smalltalk.HLKeyBinder)})},
  828. messageSends: []}),
  829. smalltalk.HLKeyBinder);
  830. smalltalk.addMethod(
  831. smalltalk.method({
  832. selector: "applyBinding:",
  833. fn: function (aBinding){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) {
  836. var $1,$2,$3;
  837. $1=_st(aBinding)._isActive();
  838. if(! smalltalk.assert($1)){
  839. $2=self;
  840. return $2;
  841. };
  842. self._selectBinding_(aBinding);
  843. _st(aBinding)._applyOn_(self);
  844. $3=_st(aBinding)._isFinal();
  845. if(smalltalk.assert($3)){
  846. self._deactivate();
  847. };
  848. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  849. messageSends: ["ifFalse:", "isActive", "selectBinding:", "applyOn:", "ifTrue:", "deactivate", "isFinal"]}),
  850. smalltalk.HLKeyBinder);
  851. smalltalk.addMethod(
  852. smalltalk.method({
  853. selector: "bindings",
  854. fn: function (){
  855. var self=this;
  856. return smalltalk.withContext(function($ctx1) {
  857. var $2,$1;
  858. $2=self["@bindings"];
  859. if(($receiver = $2) == nil || $receiver == undefined){
  860. self["@bindings"]=self._defaultBindings();
  861. $1=self["@bindings"];
  862. } else {
  863. $1=$2;
  864. };
  865. return $1;
  866. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLKeyBinder)})},
  867. messageSends: ["ifNil:", "defaultBindings"]}),
  868. smalltalk.HLKeyBinder);
  869. smalltalk.addMethod(
  870. smalltalk.method({
  871. selector: "deactivate",
  872. fn: function (){
  873. var self=this;
  874. return smalltalk.withContext(function($ctx1) {
  875. var $1;
  876. $1=self["@selectedBinding"];
  877. if(($receiver = $1) == nil || $receiver == undefined){
  878. $1;
  879. } else {
  880. _st(self["@selectedBinding"])._release();
  881. };
  882. self["@selectedBinding"]=nil;
  883. _st(self._helper())._hide();
  884. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},smalltalk.HLKeyBinder)})},
  885. messageSends: ["ifNotNil:", "release", "hide", "helper"]}),
  886. smalltalk.HLKeyBinder);
  887. smalltalk.addMethod(
  888. smalltalk.method({
  889. selector: "defaultBindings",
  890. fn: function (){
  891. var self=this;
  892. var group;
  893. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  894. function $HLCloseTabCommand(){return smalltalk.HLCloseTabCommand||(typeof HLCloseTabCommand=="undefined"?nil:HLCloseTabCommand)}
  895. function $HLOpenCommand(){return smalltalk.HLOpenCommand||(typeof HLOpenCommand=="undefined"?nil:HLOpenCommand)}
  896. return smalltalk.withContext(function($ctx1) {
  897. var $1,$2,$3;
  898. $1=_st($HLBindingGroup())._new();
  899. _st($1)._addGroupKey_labelled_((86),"View");
  900. _st($1)._add_(_st(_st($HLCloseTabCommand())._new())._asBinding());
  901. $2=_st($1)._yourself();
  902. group=$2;
  903. _st($HLOpenCommand())._registerConcreteClassesOn_(group);
  904. $3=group;
  905. return $3;
  906. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  907. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "registerConcreteClassesOn:"]}),
  908. smalltalk.HLKeyBinder);
  909. smalltalk.addMethod(
  910. smalltalk.method({
  911. selector: "escapeKey",
  912. fn: function (){
  913. var self=this;
  914. return smalltalk.withContext(function($ctx1) {
  915. return (27);
  916. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{},smalltalk.HLKeyBinder)})},
  917. messageSends: []}),
  918. smalltalk.HLKeyBinder);
  919. smalltalk.addMethod(
  920. smalltalk.method({
  921. selector: "flushBindings",
  922. fn: function (){
  923. var self=this;
  924. return smalltalk.withContext(function($ctx1) {
  925. self["@bindings"]=nil;
  926. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{},smalltalk.HLKeyBinder)})},
  927. messageSends: []}),
  928. smalltalk.HLKeyBinder);
  929. smalltalk.addMethod(
  930. smalltalk.method({
  931. selector: "handleActiveKeyDown:",
  932. fn: function (event){
  933. var self=this;
  934. return smalltalk.withContext(function($ctx1) {
  935. var $1,$2;
  936. $1=_st(_st(_st(event)._which()).__eq(self._escapeKey()))._or_((function(){
  937. return smalltalk.withContext(function($ctx2) {
  938. return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  939. return smalltalk.withContext(function($ctx3) {
  940. return _st(event)._ctrlKey();
  941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  943. if(smalltalk.assert($1)){
  944. self._deactivate();
  945. _st(event)._preventDefault();
  946. return false;
  947. };
  948. $2=self._handleBindingFor_(event);
  949. return $2;
  950. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  951. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"]}),
  952. smalltalk.HLKeyBinder);
  953. smalltalk.addMethod(
  954. smalltalk.method({
  955. selector: "handleBindingFor:",
  956. fn: function (anEvent){
  957. var self=this;
  958. var binding;
  959. return smalltalk.withContext(function($ctx1) {
  960. var $1;
  961. binding=_st(self._selectedBinding())._atKey_(_st(anEvent)._which());
  962. $1=binding;
  963. if(($receiver = $1) == nil || $receiver == undefined){
  964. $1;
  965. } else {
  966. self._applyBinding_(binding);
  967. _st(anEvent)._preventDefault();
  968. return false;
  969. };
  970. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},smalltalk.HLKeyBinder)})},
  971. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"]}),
  972. smalltalk.HLKeyBinder);
  973. smalltalk.addMethod(
  974. smalltalk.method({
  975. selector: "handleInactiveKeyDown:",
  976. fn: function (event){
  977. var self=this;
  978. return smalltalk.withContext(function($ctx1) {
  979. var $1,$2;
  980. $1=_st(_st(event)._which()).__eq(self._activationKey());
  981. if(smalltalk.assert($1)){
  982. $2=_st(event)._ctrlKey();
  983. if(smalltalk.assert($2)){
  984. self._activate();
  985. _st(event)._preventDefault();
  986. return false;
  987. };
  988. };
  989. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  990. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"]}),
  991. smalltalk.HLKeyBinder);
  992. smalltalk.addMethod(
  993. smalltalk.method({
  994. selector: "handleKeyDown:",
  995. fn: function (event){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) {
  998. var $2,$1;
  999. $2=self._isActive();
  1000. if(smalltalk.assert($2)){
  1001. $1=self._handleActiveKeyDown_(event);
  1002. } else {
  1003. $1=self._handleInactiveKeyDown_(event);
  1004. };
  1005. return $1;
  1006. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1007. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"]}),
  1008. smalltalk.HLKeyBinder);
  1009. smalltalk.addMethod(
  1010. smalltalk.method({
  1011. selector: "helper",
  1012. fn: function (){
  1013. var self=this;
  1014. return smalltalk.withContext(function($ctx1) {
  1015. var $1;
  1016. $1=self["@helper"];
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"helper",{},smalltalk.HLKeyBinder)})},
  1019. messageSends: []}),
  1020. smalltalk.HLKeyBinder);
  1021. smalltalk.addMethod(
  1022. smalltalk.method({
  1023. selector: "initialize",
  1024. fn: function (){
  1025. var self=this;
  1026. function $HLKeyBinderHelper(){return smalltalk.HLKeyBinderHelper||(typeof HLKeyBinderHelper=="undefined"?nil:HLKeyBinderHelper)}
  1027. return smalltalk.withContext(function($ctx1) {
  1028. var $1,$2;
  1029. smalltalk.HLKeyBinder.superclass.fn.prototype._initialize.apply(_st(self), []);
  1030. self["@helper"]=_st($HLKeyBinderHelper())._on_(self);
  1031. $1=self["@helper"];
  1032. _st($1)._renderStart();
  1033. $2=_st($1)._renderCog();
  1034. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  1035. messageSends: ["initialize", "on:", "renderStart", "renderCog"]}),
  1036. smalltalk.HLKeyBinder);
  1037. smalltalk.addMethod(
  1038. smalltalk.method({
  1039. selector: "isActive",
  1040. fn: function (){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) {
  1043. var $1;
  1044. $1=_st(_st(".".__comma(_st(self._helper())._cssClass()))._asJQuery())._is_(":visible");
  1045. return $1;
  1046. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  1047. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"]}),
  1048. smalltalk.HLKeyBinder);
  1049. smalltalk.addMethod(
  1050. smalltalk.method({
  1051. selector: "selectBinding:",
  1052. fn: function (aBinding){
  1053. var self=this;
  1054. return smalltalk.withContext(function($ctx1) {
  1055. var $1,$2;
  1056. $1=_st(aBinding).__eq(self["@selectedBinding"]);
  1057. if(smalltalk.assert($1)){
  1058. $2=self;
  1059. return $2;
  1060. };
  1061. self["@selectedBinding"]=aBinding;
  1062. _st(self._helper())._refresh();
  1063. return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1064. messageSends: ["ifTrue:", "=", "refresh", "helper"]}),
  1065. smalltalk.HLKeyBinder);
  1066. smalltalk.addMethod(
  1067. smalltalk.method({
  1068. selector: "selectedBinding",
  1069. fn: function (){
  1070. var self=this;
  1071. return smalltalk.withContext(function($ctx1) {
  1072. var $2,$1;
  1073. $2=self["@selectedBinding"];
  1074. if(($receiver = $2) == nil || $receiver == undefined){
  1075. $1=self._bindings();
  1076. } else {
  1077. $1=$2;
  1078. };
  1079. return $1;
  1080. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinder)})},
  1081. messageSends: ["ifNil:", "bindings"]}),
  1082. smalltalk.HLKeyBinder);
  1083. smalltalk.addMethod(
  1084. smalltalk.method({
  1085. selector: "setupEvents",
  1086. fn: function (){
  1087. var self=this;
  1088. return smalltalk.withContext(function($ctx1) {
  1089. _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  1090. return smalltalk.withContext(function($ctx2) {
  1091. return self._handleKeyDown_(event);
  1092. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  1093. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},smalltalk.HLKeyBinder)})},
  1094. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"]}),
  1095. smalltalk.HLKeyBinder);
  1096. smalltalk.addMethod(
  1097. smalltalk.method({
  1098. selector: "systemIsMac",
  1099. fn: function (){
  1100. var self=this;
  1101. return smalltalk.withContext(function($ctx1) {
  1102. var $1;
  1103. $1=_st(_st(navigator)._platform())._match_("Mac");
  1104. return $1;
  1105. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},smalltalk.HLKeyBinder)})},
  1106. messageSends: ["match:", "platform"]}),
  1107. smalltalk.HLKeyBinder);
  1108. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1109. smalltalk.addMethod(
  1110. smalltalk.method({
  1111. selector: "cssClass",
  1112. fn: function (){
  1113. var self=this;
  1114. return smalltalk.withContext(function($ctx1) {
  1115. return "key_helper";
  1116. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLKeyBinderHelper)})},
  1117. messageSends: []}),
  1118. smalltalk.HLKeyBinderHelper);
  1119. smalltalk.addMethod(
  1120. smalltalk.method({
  1121. selector: "hide",
  1122. fn: function (){
  1123. var self=this;
  1124. return smalltalk.withContext(function($ctx1) {
  1125. _st(_st(".".__comma(self._cssClass()))._asJQuery())._remove();
  1126. self._showCog();
  1127. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1128. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"]}),
  1129. smalltalk.HLKeyBinderHelper);
  1130. smalltalk.addMethod(
  1131. smalltalk.method({
  1132. selector: "hideCog",
  1133. fn: function (){
  1134. var self=this;
  1135. return smalltalk.withContext(function($ctx1) {
  1136. _st("#cog-helper"._asJQuery())._hide();
  1137. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1138. messageSends: ["hide", "asJQuery"]}),
  1139. smalltalk.HLKeyBinderHelper);
  1140. smalltalk.addMethod(
  1141. smalltalk.method({
  1142. selector: "keyBinder",
  1143. fn: function (){
  1144. var self=this;
  1145. return smalltalk.withContext(function($ctx1) {
  1146. var $1;
  1147. $1=self["@keyBinder"];
  1148. return $1;
  1149. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{},smalltalk.HLKeyBinderHelper)})},
  1150. messageSends: []}),
  1151. smalltalk.HLKeyBinderHelper);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "keyBinder:",
  1155. fn: function (aKeyBinder){
  1156. var self=this;
  1157. return smalltalk.withContext(function($ctx1) {
  1158. self["@keyBinder"]=aKeyBinder;
  1159. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper)})},
  1160. messageSends: []}),
  1161. smalltalk.HLKeyBinderHelper);
  1162. smalltalk.addMethod(
  1163. smalltalk.method({
  1164. selector: "registerBindings",
  1165. fn: function (){
  1166. var self=this;
  1167. return smalltalk.withContext(function($ctx1) {
  1168. return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},smalltalk.HLKeyBinderHelper)})},
  1169. messageSends: []}),
  1170. smalltalk.HLKeyBinderHelper);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "renderBindingGroup:on:",
  1174. fn: function (aBindingGroup,html){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) {
  1177. _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1178. return smalltalk.withContext(function($ctx2) {
  1179. return _st(_st(a)._key()).__lt(_st(b)._key());
  1180. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1181. return smalltalk.withContext(function($ctx2) {
  1182. return _st(each)._renderActionFor_html_(self._keyBinder(),html);
  1183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1184. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1185. messageSends: ["do:", "renderActionFor:html:", "keyBinder", "sorted:", "<", "key", "activeBindings"]}),
  1186. smalltalk.HLKeyBinderHelper);
  1187. smalltalk.addMethod(
  1188. smalltalk.method({
  1189. selector: "renderBindingOn:",
  1190. fn: function (html){
  1191. var self=this;
  1192. return smalltalk.withContext(function($ctx1) {
  1193. _st(self._selectedBinding())._renderOn_html_(self,html);
  1194. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1195. messageSends: ["renderOn:html:", "selectedBinding"]}),
  1196. smalltalk.HLKeyBinderHelper);
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "renderCloseOn:",
  1200. fn: function (html){
  1201. var self=this;
  1202. return smalltalk.withContext(function($ctx1) {
  1203. var $1,$2;
  1204. $1=_st(html)._a();
  1205. _st($1)._class_("close");
  1206. _st($1)._with_((function(){
  1207. return smalltalk.withContext(function($ctx2) {
  1208. return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1210. $2=_st($1)._onClick_((function(){
  1211. return smalltalk.withContext(function($ctx2) {
  1212. return _st(self._keyBinder())._deactivate();
  1213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1214. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1215. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"]}),
  1216. smalltalk.HLKeyBinderHelper);
  1217. smalltalk.addMethod(
  1218. smalltalk.method({
  1219. selector: "renderCog",
  1220. fn: function (){
  1221. var self=this;
  1222. return smalltalk.withContext(function($ctx1) {
  1223. var $1,$3,$4,$2;
  1224. _st((function(html){
  1225. return smalltalk.withContext(function($ctx2) {
  1226. $1=_st(html)._div();
  1227. _st($1)._id_("cog-helper");
  1228. $2=_st($1)._with_((function(){
  1229. return smalltalk.withContext(function($ctx3) {
  1230. $3=_st(html)._a();
  1231. _st($3)._with_((function(){
  1232. return smalltalk.withContext(function($ctx4) {
  1233. return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1234. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  1235. $4=_st($3)._onClick_((function(){
  1236. return smalltalk.withContext(function($ctx4) {
  1237. return _st(self._keyBinder())._activate();
  1238. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  1239. return $4;
  1240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  1241. return $2;
  1242. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_("body"._asJQuery());
  1243. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1244. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"]}),
  1245. smalltalk.HLKeyBinderHelper);
  1246. smalltalk.addMethod(
  1247. smalltalk.method({
  1248. selector: "renderContentOn:",
  1249. fn: function (html){
  1250. var self=this;
  1251. return smalltalk.withContext(function($ctx1) {
  1252. var $1,$3,$4,$2;
  1253. $1=_st(html)._div();
  1254. _st($1)._class_(self._cssClass());
  1255. $2=_st($1)._with_((function(){
  1256. return smalltalk.withContext(function($ctx2) {
  1257. $3=self;
  1258. _st($3)._renderSelectionOn_(html);
  1259. _st($3)._renderBindingOn_(html);
  1260. $4=_st($3)._renderCloseOn_(html);
  1261. return $4;
  1262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1263. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1264. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:", "renderCloseOn:"]}),
  1265. smalltalk.HLKeyBinderHelper);
  1266. smalltalk.addMethod(
  1267. smalltalk.method({
  1268. selector: "renderSelectionOn:",
  1269. fn: function (html){
  1270. var self=this;
  1271. return smalltalk.withContext(function($ctx1) {
  1272. var $1,$3,$5,$4,$2;
  1273. $1=_st(html)._span();
  1274. _st($1)._class_("selected");
  1275. $3=$1;
  1276. $5=_st(self._selectedBinding())._label();
  1277. if(($receiver = $5) == nil || $receiver == undefined){
  1278. $4="Action";
  1279. } else {
  1280. $4=$5;
  1281. };
  1282. $2=_st($3)._with_($4);
  1283. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1284. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"]}),
  1285. smalltalk.HLKeyBinderHelper);
  1286. smalltalk.addMethod(
  1287. smalltalk.method({
  1288. selector: "renderStart",
  1289. fn: function (){
  1290. var self=this;
  1291. return smalltalk.withContext(function($ctx1) {
  1292. var $1,$2;
  1293. _st(_st(window)._jQuery_("#helper"))._remove();
  1294. _st((function(html){
  1295. return smalltalk.withContext(function($ctx2) {
  1296. $1=_st(html)._div();
  1297. _st($1)._id_("helper");
  1298. $2=_st($1)._with_(_st("Press ".__comma(_st(self._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1299. return $2;
  1300. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_("body"._asJQuery());
  1301. _st((function(){
  1302. return smalltalk.withContext(function($ctx2) {
  1303. return _st(_st(window)._jQuery_("#helper"))._fadeOut_((1000));
  1304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1305. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{},smalltalk.HLKeyBinderHelper)})},
  1306. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:"]}),
  1307. smalltalk.HLKeyBinderHelper);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "selectedBinding",
  1311. fn: function (){
  1312. var self=this;
  1313. return smalltalk.withContext(function($ctx1) {
  1314. var $1;
  1315. $1=_st(self._keyBinder())._selectedBinding();
  1316. return $1;
  1317. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinderHelper)})},
  1318. messageSends: ["selectedBinding", "keyBinder"]}),
  1319. smalltalk.HLKeyBinderHelper);
  1320. smalltalk.addMethod(
  1321. smalltalk.method({
  1322. selector: "show",
  1323. fn: function (){
  1324. var self=this;
  1325. return smalltalk.withContext(function($ctx1) {
  1326. self._hideCog();
  1327. self._appendToJQuery_("body"._asJQuery());
  1328. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1329. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"]}),
  1330. smalltalk.HLKeyBinderHelper);
  1331. smalltalk.addMethod(
  1332. smalltalk.method({
  1333. selector: "showCog",
  1334. fn: function (){
  1335. var self=this;
  1336. return smalltalk.withContext(function($ctx1) {
  1337. _st("#cog-helper"._asJQuery())._show();
  1338. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1339. messageSends: ["show", "asJQuery"]}),
  1340. smalltalk.HLKeyBinderHelper);
  1341. smalltalk.addMethod(
  1342. smalltalk.method({
  1343. selector: "on:",
  1344. fn: function (aKeyBinder){
  1345. var self=this;
  1346. return smalltalk.withContext(function($ctx1) {
  1347. var $2,$3,$1;
  1348. $2=self._new();
  1349. _st($2)._keyBinder_(aKeyBinder);
  1350. $3=_st($2)._yourself();
  1351. $1=$3;
  1352. return $1;
  1353. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper.klass)})},
  1354. messageSends: ["keyBinder:", "new", "yourself"]}),
  1355. smalltalk.HLKeyBinderHelper.klass);
  1356. smalltalk.addClass('HLRepeatingKeyBindingHandler', smalltalk.Object, ['repeatInterval', 'delay', 'interval', 'keyBindings', 'widget', 'isKeyCurrentlyPressed'], 'Helios-KeyBindings');
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "bindKeys",
  1360. fn: function (){
  1361. var self=this;
  1362. return smalltalk.withContext(function($ctx1) {
  1363. _st(self["@widget"])._bindKeyDown_up_((function(e){
  1364. return smalltalk.withContext(function($ctx2) {
  1365. return self._handleKeyDown_(e);
  1366. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}),(function(e){
  1367. return smalltalk.withContext(function($ctx2) {
  1368. return self._handleKeyUp_(e);
  1369. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  1370. return self}, function($ctx1) {$ctx1.fill(self,"bindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1371. messageSends: ["bindKeyDown:up:", "handleKeyDown:", "handleKeyUp:"]}),
  1372. smalltalk.HLRepeatingKeyBindingHandler);
  1373. smalltalk.addMethod(
  1374. smalltalk.method({
  1375. selector: "delayBeforeStartingRepeatWithAction:",
  1376. fn: function (action){
  1377. var self=this;
  1378. return smalltalk.withContext(function($ctx1) {
  1379. var $1;
  1380. $1=_st((function(){
  1381. return smalltalk.withContext(function($ctx2) {
  1382. self["@interval"]=self._startRepeatingAction_(action);
  1383. return self["@interval"];
  1384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((300));
  1385. return $1;
  1386. }, function($ctx1) {$ctx1.fill(self,"delayBeforeStartingRepeatWithAction:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  1387. messageSends: ["valueWithTimeout:", "startRepeatingAction:"]}),
  1388. smalltalk.HLRepeatingKeyBindingHandler);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "handleKeyDown:",
  1392. fn: function (e){
  1393. var self=this;
  1394. return smalltalk.withContext(function($ctx1) {
  1395. _st(self["@keyBindings"])._keysAndValuesDo_((function(key,action){
  1396. return smalltalk.withContext(function($ctx2) {
  1397. return self._ifKey_wasPressedIn_thenDo_(key,e,action);
  1398. }, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1)})}));
  1399. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{e:e},smalltalk.HLRepeatingKeyBindingHandler)})},
  1400. messageSends: ["keysAndValuesDo:", "ifKey:wasPressedIn:thenDo:"]}),
  1401. smalltalk.HLRepeatingKeyBindingHandler);
  1402. smalltalk.addMethod(
  1403. smalltalk.method({
  1404. selector: "handleKeyUp",
  1405. fn: function (){
  1406. var self=this;
  1407. return smalltalk.withContext(function($ctx1) {
  1408. var $1,$2;
  1409. self["@isKeyCurrentlyPressed"]=false;
  1410. $1=self["@interval"];
  1411. if(($receiver = $1) == nil || $receiver == undefined){
  1412. $1;
  1413. } else {
  1414. _st(self["@interval"])._clearInterval();
  1415. };
  1416. $2=self["@delay"];
  1417. if(($receiver = $2) == nil || $receiver == undefined){
  1418. $2;
  1419. } else {
  1420. _st(self["@delay"])._clearTimeout();
  1421. };
  1422. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1423. messageSends: ["ifNotNil:", "clearInterval", "clearTimeout"]}),
  1424. smalltalk.HLRepeatingKeyBindingHandler);
  1425. smalltalk.addMethod(
  1426. smalltalk.method({
  1427. selector: "handleKeyUp:",
  1428. fn: function (e){
  1429. var self=this;
  1430. return smalltalk.withContext(function($ctx1) {
  1431. var $1;
  1432. $1=self["@isKeyCurrentlyPressed"];
  1433. if(smalltalk.assert($1)){
  1434. self._handleKeyUp();
  1435. };
  1436. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp:",{e:e},smalltalk.HLRepeatingKeyBindingHandler)})},
  1437. messageSends: ["ifTrue:", "handleKeyUp"]}),
  1438. smalltalk.HLRepeatingKeyBindingHandler);
  1439. smalltalk.addMethod(
  1440. smalltalk.method({
  1441. selector: "ifKey:wasPressedIn:thenDo:",
  1442. fn: function (key,e,action){
  1443. var self=this;
  1444. return smalltalk.withContext(function($ctx1) {
  1445. var $1;
  1446. $1=_st(_st(_st(e)._which()).__eq(key))._and_((function(){
  1447. return smalltalk.withContext(function($ctx2) {
  1448. return _st(self["@isKeyCurrentlyPressed"]).__eq(false);
  1449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1450. if(smalltalk.assert($1)){
  1451. self._whileTheKeyIsPressedDo_(action);
  1452. };
  1453. return self}, function($ctx1) {$ctx1.fill(self,"ifKey:wasPressedIn:thenDo:",{key:key,e:e,action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  1454. messageSends: ["ifTrue:", "whileTheKeyIsPressedDo:", "and:", "=", "which"]}),
  1455. smalltalk.HLRepeatingKeyBindingHandler);
  1456. smalltalk.addMethod(
  1457. smalltalk.method({
  1458. selector: "initialize",
  1459. fn: function (){
  1460. var self=this;
  1461. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1462. return smalltalk.withContext(function($ctx1) {
  1463. smalltalk.HLRepeatingKeyBindingHandler.superclass.fn.prototype._initialize.apply(_st(self), []);
  1464. self["@keyBindings"]=_st($Dictionary())._new();
  1465. self["@isKeyCurrentlyPressed"]=false;
  1466. self["@repeatInterval"]=(70);
  1467. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1468. messageSends: ["initialize", "new"]}),
  1469. smalltalk.HLRepeatingKeyBindingHandler);
  1470. smalltalk.addMethod(
  1471. smalltalk.method({
  1472. selector: "rebindKeys",
  1473. fn: function (){
  1474. var self=this;
  1475. return smalltalk.withContext(function($ctx1) {
  1476. var $1,$2;
  1477. $1=self;
  1478. _st($1)._unbindKeys();
  1479. $2=_st($1)._bindKeys();
  1480. return self}, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1481. messageSends: ["unbindKeys", "bindKeys"]}),
  1482. smalltalk.HLRepeatingKeyBindingHandler);
  1483. smalltalk.addMethod(
  1484. smalltalk.method({
  1485. selector: "repeatInterval:",
  1486. fn: function (aMillisecondIntegerValue){
  1487. var self=this;
  1488. return smalltalk.withContext(function($ctx1) {
  1489. self["@repeatInterval"]=aMillisecondIntegerValue;
  1490. return self}, function($ctx1) {$ctx1.fill(self,"repeatInterval:",{aMillisecondIntegerValue:aMillisecondIntegerValue},smalltalk.HLRepeatingKeyBindingHandler)})},
  1491. messageSends: []}),
  1492. smalltalk.HLRepeatingKeyBindingHandler);
  1493. smalltalk.addMethod(
  1494. smalltalk.method({
  1495. selector: "startRepeatingAction:",
  1496. fn: function (action){
  1497. var self=this;
  1498. return smalltalk.withContext(function($ctx1) {
  1499. var $2,$1;
  1500. $1=_st((function(){
  1501. return smalltalk.withContext(function($ctx2) {
  1502. $2=_st(self["@widget"])._hasFocus();
  1503. if(smalltalk.assert($2)){
  1504. return _st(action)._value();
  1505. } else {
  1506. return self._handleKeyUp();
  1507. };
  1508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithInterval_(self["@repeatInterval"]);
  1509. return $1;
  1510. }, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  1511. messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "value", "handleKeyUp", "hasFocus"]}),
  1512. smalltalk.HLRepeatingKeyBindingHandler);
  1513. smalltalk.addMethod(
  1514. smalltalk.method({
  1515. selector: "unbindKeys",
  1516. fn: function (){
  1517. var self=this;
  1518. return smalltalk.withContext(function($ctx1) {
  1519. _st(self["@widget"])._unbindKeyDownUp();
  1520. return self}, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1521. messageSends: ["unbindKeyDownUp"]}),
  1522. smalltalk.HLRepeatingKeyBindingHandler);
  1523. smalltalk.addMethod(
  1524. smalltalk.method({
  1525. selector: "whileKeyPressed:do:",
  1526. fn: function (aKey,aBlock){
  1527. var self=this;
  1528. return smalltalk.withContext(function($ctx1) {
  1529. _st(self["@keyBindings"])._at_put_(aKey,aBlock);
  1530. return self}, function($ctx1) {$ctx1.fill(self,"whileKeyPressed:do:",{aKey:aKey,aBlock:aBlock},smalltalk.HLRepeatingKeyBindingHandler)})},
  1531. messageSends: ["at:put:"]}),
  1532. smalltalk.HLRepeatingKeyBindingHandler);
  1533. smalltalk.addMethod(
  1534. smalltalk.method({
  1535. selector: "whileTheKeyIsPressedDo:",
  1536. fn: function (action){
  1537. var self=this;
  1538. return smalltalk.withContext(function($ctx1) {
  1539. self["@isKeyCurrentlyPressed"]=true;
  1540. _st(action)._value();
  1541. self["@delay"]=self._delayBeforeStartingRepeatWithAction_(action);
  1542. return self}, function($ctx1) {$ctx1.fill(self,"whileTheKeyIsPressedDo:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  1543. messageSends: ["value", "delayBeforeStartingRepeatWithAction:"]}),
  1544. smalltalk.HLRepeatingKeyBindingHandler);
  1545. smalltalk.addMethod(
  1546. smalltalk.method({
  1547. selector: "widget:",
  1548. fn: function (aWidget){
  1549. var self=this;
  1550. return smalltalk.withContext(function($ctx1) {
  1551. self["@widget"]=aWidget;
  1552. return self}, function($ctx1) {$ctx1.fill(self,"widget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBindingHandler)})},
  1553. messageSends: []}),
  1554. smalltalk.HLRepeatingKeyBindingHandler);
  1555. smalltalk.addMethod(
  1556. smalltalk.method({
  1557. selector: "forWidget:",
  1558. fn: function (aWidget){
  1559. var self=this;
  1560. return smalltalk.withContext(function($ctx1) {
  1561. var $2,$3,$1;
  1562. $2=self._new();
  1563. _st($2)._widget_(aWidget);
  1564. $3=_st($2)._yourself();
  1565. $1=$3;
  1566. return $1;
  1567. }, function($ctx1) {$ctx1.fill(self,"forWidget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBindingHandler.klass)})},
  1568. messageSends: ["widget:", "new", "yourself"]}),
  1569. smalltalk.HLRepeatingKeyBindingHandler.klass);
  1570. });