2
0

Helios-KeyBindings.deploy.js 56 KB

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