1
0

Helios-KeyBindings.js 56 KB

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