1
0

Helios-KeyBindings.js 61 KB

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