Helios-KeyBindings.deploy.js 53 KB

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