1
0

Helios-KeyBindings.js 61 KB

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