Helios-KeyBindings.js 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790
  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)._callback_((function(val){
  307. return smalltalk.withContext(function($ctx2) { $3=_st(self)._command();
  308. _st($3)._input_(val);
  309. $4=_st($3)._execute();
  310. return $4;
  311. }, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1)})}));
  312. $5=_st($2)._yourself();
  313. $1=$5;
  314. return $1;
  315. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
  316. args: [],
  317. source: "inputBinding\x0a\x09^ HLBindingInput new\x0a\x09\x09label: self command inputLabel;\x0a\x09\x09ghostText: self command displayLabel;\x0a\x09\x09callback: [ :val | \x0a\x09\x09\x09self command \x0a\x09\x09\x09\x09input: val;\x0a\x09\x09\x09\x09execute ];\x0a\x09\x09yourself",
  318. messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "callback:", "input:", "execute", "yourself"],
  319. referencedClasses: ["HLBindingInput"]
  320. }),
  321. smalltalk.HLBindingAction);
  322. smalltalk.addMethod(
  323. "_isActive",
  324. smalltalk.method({
  325. selector: "isActive",
  326. category: 'testing',
  327. fn: function (){
  328. var self=this;
  329. return smalltalk.withContext(function($ctx1) { var $1;
  330. $1=_st(_st(self)._command())._isActive();
  331. return $1;
  332. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingAction)})},
  333. args: [],
  334. source: "isActive\x0a\x09^ self command isActive",
  335. messageSends: ["isActive", "command"],
  336. referencedClasses: []
  337. }),
  338. smalltalk.HLBindingAction);
  339. smalltalk.addMethod(
  340. "_isFinal",
  341. smalltalk.method({
  342. selector: "isFinal",
  343. category: 'testing',
  344. fn: function (){
  345. var self=this;
  346. return smalltalk.withContext(function($ctx1) { var $1;
  347. $1=_st(_st(_st(self)._command())._isInputRequired())._not();
  348. return $1;
  349. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingAction)})},
  350. args: [],
  351. source: "isFinal\x0a\x09^ self command isInputRequired not",
  352. messageSends: ["not", "isInputRequired", "command"],
  353. referencedClasses: []
  354. }),
  355. smalltalk.HLBindingAction);
  356. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  357. smalltalk.addMethod(
  358. "_activeBindings",
  359. smalltalk.method({
  360. selector: "activeBindings",
  361. category: 'accessing',
  362. fn: function (){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) { var $1;
  365. $1=_st(_st(self)._bindings())._select_((function(each){
  366. return smalltalk.withContext(function($ctx2) { return _st(each)._isActive();
  367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  368. return $1;
  369. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  370. args: [],
  371. source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
  372. messageSends: ["select:", "isActive", "bindings"],
  373. referencedClasses: []
  374. }),
  375. smalltalk.HLBindingGroup);
  376. smalltalk.addMethod(
  377. "_add_",
  378. smalltalk.method({
  379. selector: "add:",
  380. category: 'accessing',
  381. fn: function (aBinding){
  382. var self=this;
  383. return smalltalk.withContext(function($ctx1) { var $1;
  384. $1=_st(_st(self)._bindings())._add_(aBinding);
  385. return $1;
  386. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},smalltalk.HLBindingGroup)})},
  387. args: ["aBinding"],
  388. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  389. messageSends: ["add:", "bindings"],
  390. referencedClasses: []
  391. }),
  392. smalltalk.HLBindingGroup);
  393. smalltalk.addMethod(
  394. "_addActionKey_labelled_callback_",
  395. smalltalk.method({
  396. selector: "addActionKey:labelled:callback:",
  397. category: 'accessing',
  398. fn: function (anInteger,aString,aBlock){
  399. var self=this;
  400. return smalltalk.withContext(function($ctx1) { var $1,$2;
  401. $1=_st((smalltalk.HLBindingAction || HLBindingAction))._on_labelled_(anInteger,aString);
  402. _st($1)._callback_(aBlock);
  403. $2=_st($1)._yourself();
  404. _st(self)._add_($2);
  405. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},smalltalk.HLBindingGroup)})},
  406. args: ["anInteger", "aString", "aBlock"],
  407. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  408. messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
  409. referencedClasses: ["HLBindingAction"]
  410. }),
  411. smalltalk.HLBindingGroup);
  412. smalltalk.addMethod(
  413. "_addGroupKey_labelled_",
  414. smalltalk.method({
  415. selector: "addGroupKey:labelled:",
  416. category: 'accessing',
  417. fn: function (anInteger,aString){
  418. var self=this;
  419. return smalltalk.withContext(function($ctx1) { _st(self)._add_(_st((smalltalk.HLBindingGroup || HLBindingGroup))._on_labelled_(anInteger,aString));
  420. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBindingGroup)})},
  421. args: ["anInteger", "aString"],
  422. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  423. messageSends: ["add:", "on:labelled:"],
  424. referencedClasses: ["HLBindingGroup"]
  425. }),
  426. smalltalk.HLBindingGroup);
  427. smalltalk.addMethod(
  428. "_at_",
  429. smalltalk.method({
  430. selector: "at:",
  431. category: 'accessing',
  432. fn: function (aString){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) { var $1;
  435. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  436. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._label()).__eq(aString);
  437. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  438. return smalltalk.withContext(function($ctx2) { return nil;
  439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  440. return $1;
  441. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.HLBindingGroup)})},
  442. args: ["aString"],
  443. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  444. messageSends: ["detect:ifNone:", "=", "label", "bindings"],
  445. referencedClasses: []
  446. }),
  447. smalltalk.HLBindingGroup);
  448. smalltalk.addMethod(
  449. "_at_add_",
  450. smalltalk.method({
  451. selector: "at:add:",
  452. category: 'accessing',
  453. fn: function (aString,aBinding){
  454. var self=this;
  455. var binding;
  456. return smalltalk.withContext(function($ctx1) { var $1,$2;
  457. binding=_st(self)._at_(aString);
  458. $1=binding;
  459. if(($receiver = $1) == nil || $receiver == undefined){
  460. $2=self;
  461. return $2;
  462. } else {
  463. $1;
  464. };
  465. _st(binding)._add_(aBinding);
  466. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  467. args: ["aString", "aBinding"],
  468. 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",
  469. messageSends: ["at:", "ifNil:", "add:"],
  470. referencedClasses: []
  471. }),
  472. smalltalk.HLBindingGroup);
  473. smalltalk.addMethod(
  474. "_atKey_",
  475. smalltalk.method({
  476. selector: "atKey:",
  477. category: 'accessing',
  478. fn: function (anInteger){
  479. var self=this;
  480. return smalltalk.withContext(function($ctx1) { var $1;
  481. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  482. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._key()).__eq(anInteger);
  483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  484. return smalltalk.withContext(function($ctx2) { return nil;
  485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  486. return $1;
  487. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},smalltalk.HLBindingGroup)})},
  488. args: ["anInteger"],
  489. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  490. messageSends: ["detect:ifNone:", "=", "key", "bindings"],
  491. referencedClasses: []
  492. }),
  493. smalltalk.HLBindingGroup);
  494. smalltalk.addMethod(
  495. "_bindings",
  496. smalltalk.method({
  497. selector: "bindings",
  498. category: 'accessing',
  499. fn: function (){
  500. var self=this;
  501. return smalltalk.withContext(function($ctx1) { var $2,$1;
  502. $2=self["@bindings"];
  503. if(($receiver = $2) == nil || $receiver == undefined){
  504. self["@bindings"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  505. $1=self["@bindings"];
  506. } else {
  507. $1=$2;
  508. };
  509. return $1;
  510. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLBindingGroup)})},
  511. args: [],
  512. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  513. messageSends: ["ifNil:", "new"],
  514. referencedClasses: ["OrderedCollection"]
  515. }),
  516. smalltalk.HLBindingGroup);
  517. smalltalk.addMethod(
  518. "_displayLabel",
  519. smalltalk.method({
  520. selector: "displayLabel",
  521. category: 'accessing',
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) { var $1;
  525. $1=_st(smalltalk.HLBinding.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  526. return $1;
  527. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBindingGroup)})},
  528. args: [],
  529. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  530. messageSends: [",", "displayLabel"],
  531. referencedClasses: []
  532. }),
  533. smalltalk.HLBindingGroup);
  534. smalltalk.addMethod(
  535. "_isActive",
  536. smalltalk.method({
  537. selector: "isActive",
  538. category: 'testing',
  539. fn: function (){
  540. var self=this;
  541. return smalltalk.withContext(function($ctx1) { var $1;
  542. $1=_st(_st(self)._activeBindings())._notEmpty();
  543. return $1;
  544. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  545. args: [],
  546. source: "isActive\x0a\x09^ self activeBindings notEmpty",
  547. messageSends: ["notEmpty", "activeBindings"],
  548. referencedClasses: []
  549. }),
  550. smalltalk.HLBindingGroup);
  551. smalltalk.addMethod(
  552. "_release",
  553. smalltalk.method({
  554. selector: "release",
  555. category: 'actions',
  556. fn: function (){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) { _st(_st(self)._bindings())._do_((function(each){
  559. return smalltalk.withContext(function($ctx2) { return _st(each)._release();
  560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  561. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingGroup)})},
  562. args: [],
  563. source: "release\x0a\x09self bindings do: [ :each | each release ]",
  564. messageSends: ["do:", "release", "bindings"],
  565. referencedClasses: []
  566. }),
  567. smalltalk.HLBindingGroup);
  568. smalltalk.addMethod(
  569. "_renderOn_html_",
  570. smalltalk.method({
  571. selector: "renderOn:html:",
  572. category: 'rendering',
  573. fn: function (aBindingHelper,html){
  574. var self=this;
  575. return smalltalk.withContext(function($ctx1) { var $1;
  576. $1=_st(self)._isActive();
  577. if(smalltalk.assert($1)){
  578. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  579. };
  580. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  581. args: ["aBindingHelper", "html"],
  582. source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
  583. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"],
  584. referencedClasses: []
  585. }),
  586. smalltalk.HLBindingGroup);
  587. smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'inputText', 'wrapper', 'binder', 'ghostText', 'isFinal'], 'Helios-KeyBindings');
  588. smalltalk.addMethod(
  589. "_applyOn_",
  590. smalltalk.method({
  591. selector: "applyOn:",
  592. category: 'actions',
  593. fn: function (aKeyBinder){
  594. var self=this;
  595. return smalltalk.withContext(function($ctx1) { _st(self)._isFinal_(true);
  596. _st(self)._inputText_(_st(_st(_st(self)._input())._asJQuery())._val());
  597. _st(self)._evaluate_(_st(self)._inputText());
  598. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
  599. args: ["aKeyBinder"],
  600. source: "applyOn: aKeyBinder\x0a\x0a\x09self isFinal: true.\x0a\x09self inputText: self input asJQuery val.\x0a\x09self evaluate: self inputText",
  601. messageSends: ["isFinal:", "inputText:", "val", "asJQuery", "input", "evaluate:", "inputText"],
  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. "_errorStatus",
  665. smalltalk.method({
  666. selector: "errorStatus",
  667. category: 'actions',
  668. fn: function (){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) { _st(self)._status_("error");
  671. _st(self)._refresh();
  672. return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},smalltalk.HLBindingInput)})},
  673. args: [],
  674. source: "errorStatus\x0a\x09self status: 'error'.\x0a\x09self refresh",
  675. messageSends: ["status:", "refresh"],
  676. referencedClasses: []
  677. }),
  678. smalltalk.HLBindingInput);
  679. smalltalk.addMethod(
  680. "_evaluate_",
  681. smalltalk.method({
  682. selector: "evaluate:",
  683. category: 'actions',
  684. fn: function (aString){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) { _st((function(){
  687. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._callback())._value_(aString);
  688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(ex){
  689. return smalltalk.withContext(function($ctx2) { _st(self)._errorStatus();
  690. return _st(self)._isFinal_(false);
  691. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  692. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},smalltalk.HLBindingInput)})},
  693. args: ["aString"],
  694. source: "evaluate: aString\x0a\x09\x0a\x09[ self callback value: aString ]\x0a\x09on: Error\x0a\x09do: [:ex | \x0a\x09\x09self errorStatus.\x0a\x09\x09self isFinal: false ].",
  695. messageSends: ["on:do:", "errorStatus", "isFinal:", "value:", "callback"],
  696. referencedClasses: ["Error"]
  697. }),
  698. smalltalk.HLBindingInput);
  699. smalltalk.addMethod(
  700. "_ghostText",
  701. smalltalk.method({
  702. selector: "ghostText",
  703. category: 'accessing',
  704. fn: function (){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) { var $1;
  707. $1=self["@ghostText"];
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
  710. args: [],
  711. source: "ghostText\x0a\x09^ ghostText",
  712. messageSends: [],
  713. referencedClasses: []
  714. }),
  715. smalltalk.HLBindingInput);
  716. smalltalk.addMethod(
  717. "_ghostText_",
  718. smalltalk.method({
  719. selector: "ghostText:",
  720. category: 'accessing',
  721. fn: function (aText){
  722. var self=this;
  723. return smalltalk.withContext(function($ctx1) { self["@ghostText"]=aText;
  724. return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
  725. args: ["aText"],
  726. source: "ghostText: aText\x0a\x09ghostText := aText",
  727. messageSends: [],
  728. referencedClasses: []
  729. }),
  730. smalltalk.HLBindingInput);
  731. smalltalk.addMethod(
  732. "_input",
  733. smalltalk.method({
  734. selector: "input",
  735. category: 'accessing',
  736. fn: function (){
  737. var self=this;
  738. return smalltalk.withContext(function($ctx1) { var $1;
  739. $1=self["@input"];
  740. return $1;
  741. }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
  742. args: [],
  743. source: "input\x0a\x09^ input",
  744. messageSends: [],
  745. referencedClasses: []
  746. }),
  747. smalltalk.HLBindingInput);
  748. smalltalk.addMethod(
  749. "_inputText",
  750. smalltalk.method({
  751. selector: "inputText",
  752. category: 'accessing',
  753. fn: function (){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) { var $2,$1;
  756. $2=self["@inputText"];
  757. if(($receiver = $2) == nil || $receiver == undefined){
  758. self["@inputText"]="";
  759. $1=self["@inputText"];
  760. } else {
  761. $1=$2;
  762. };
  763. return $1;
  764. }, function($ctx1) {$ctx1.fill(self,"inputText",{},smalltalk.HLBindingInput)})},
  765. args: [],
  766. source: "inputText\x0a\x09^ inputText ifNil: [ inputText := '' ].",
  767. messageSends: ["ifNil:"],
  768. referencedClasses: []
  769. }),
  770. smalltalk.HLBindingInput);
  771. smalltalk.addMethod(
  772. "_inputText_",
  773. smalltalk.method({
  774. selector: "inputText:",
  775. category: 'accessing',
  776. fn: function (aText){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) { self["@inputText"]=aText;
  779. return self}, function($ctx1) {$ctx1.fill(self,"inputText:",{aText:aText},smalltalk.HLBindingInput)})},
  780. args: ["aText"],
  781. source: "inputText: aText\x0a\x09inputText := aText",
  782. messageSends: [],
  783. referencedClasses: []
  784. }),
  785. smalltalk.HLBindingInput);
  786. smalltalk.addMethod(
  787. "_isActive",
  788. smalltalk.method({
  789. selector: "isActive",
  790. category: 'testing',
  791. fn: function (){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) { return true;
  794. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingInput)})},
  795. args: [],
  796. source: "isActive\x0a\x09^ true",
  797. messageSends: [],
  798. referencedClasses: []
  799. }),
  800. smalltalk.HLBindingInput);
  801. smalltalk.addMethod(
  802. "_isFinal",
  803. smalltalk.method({
  804. selector: "isFinal",
  805. category: 'testing',
  806. fn: function (){
  807. var self=this;
  808. return smalltalk.withContext(function($ctx1) { var $2,$1;
  809. $2=self["@isFinal"];
  810. if(($receiver = $2) == nil || $receiver == undefined){
  811. self["@isFinal"]=smalltalk.HLBinding.fn.prototype._isFinal.apply(_st(self), []);
  812. $1=self["@isFinal"];
  813. } else {
  814. $1=$2;
  815. };
  816. return $1;
  817. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
  818. args: [],
  819. source: "isFinal\x0a\x09^ isFinal ifNil: [ isFinal := super isFinal ]",
  820. messageSends: ["ifNil:", "isFinal"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.HLBindingInput);
  824. smalltalk.addMethod(
  825. "_isFinal_",
  826. smalltalk.method({
  827. selector: "isFinal:",
  828. category: 'testing',
  829. fn: function (aBoolean){
  830. var self=this;
  831. return smalltalk.withContext(function($ctx1) { self["@isFinal"]=aBoolean;
  832. return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
  833. args: ["aBoolean"],
  834. source: "isFinal: aBoolean\x0a\x09isFinal := aBoolean",
  835. messageSends: [],
  836. referencedClasses: []
  837. }),
  838. smalltalk.HLBindingInput);
  839. smalltalk.addMethod(
  840. "_privateRenderOn_html_",
  841. smalltalk.method({
  842. selector: "privateRenderOn:html:",
  843. category: 'rendering',
  844. fn: function (aBinder,html){
  845. var self=this;
  846. return smalltalk.withContext(function($ctx1) { var $1,$2;
  847. $1=_st(html)._input();
  848. _st($1)._class_("controls");
  849. _st($1)._type_("text");
  850. _st($1)._placeholder_(_st(self)._ghostText());
  851. $2=_st($1)._with_(_st(self)._inputText());
  852. self["@input"]=$2;
  853. _st(_st(self["@input"])._asJQuery())._focus();
  854. return self}, function($ctx1) {$ctx1.fill(self,"privateRenderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
  855. args: ["aBinder", "html"],
  856. source: "privateRenderOn: aBinder html: html\x0a\x09input := html input\x0a\x09\x09class: 'controls';\x0a\x09\x09type: 'text';\x0a\x09\x09placeholder: self ghostText;\x0a\x09\x09with: self inputText.\x0a\x09\x09\x09\x0a\x09input asJQuery focus",
  857. messageSends: ["class:", "input", "type:", "placeholder:", "ghostText", "with:", "inputText", "focus", "asJQuery"],
  858. referencedClasses: []
  859. }),
  860. smalltalk.HLBindingInput);
  861. smalltalk.addMethod(
  862. "_refresh",
  863. smalltalk.method({
  864. selector: "refresh",
  865. category: 'rendering',
  866. fn: function (){
  867. var self=this;
  868. return smalltalk.withContext(function($ctx1) { var $1,$2;
  869. $1=self["@wrapper"];
  870. if(($receiver = $1) == nil || $receiver == undefined){
  871. $2=self;
  872. return $2;
  873. } else {
  874. $1;
  875. };
  876. _st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
  877. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
  878. args: [],
  879. source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a \x0a\x09wrapper class: 'control-group ', self status.",
  880. messageSends: ["ifNil:", "class:", ",", "status"],
  881. referencedClasses: []
  882. }),
  883. smalltalk.HLBindingInput);
  884. smalltalk.addMethod(
  885. "_release",
  886. smalltalk.method({
  887. selector: "release",
  888. category: 'actions',
  889. fn: function (){
  890. var self=this;
  891. return smalltalk.withContext(function($ctx1) { self["@status"]=nil;
  892. self["@wrapper"]=nil;
  893. self["@binder"]=nil;
  894. self["@inputText"]=nil;
  895. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingInput)})},
  896. args: [],
  897. source: "release\x0a\x09status := nil.\x0a\x09wrapper := nil.\x0a\x09binder := nil.\x0a\x09inputText := nil",
  898. messageSends: [],
  899. referencedClasses: []
  900. }),
  901. smalltalk.HLBindingInput);
  902. smalltalk.addMethod(
  903. "_renderOn_html_",
  904. smalltalk.method({
  905. selector: "renderOn:html:",
  906. category: 'rendering',
  907. fn: function (aBinder,root){
  908. var self=this;
  909. return smalltalk.withContext(function($ctx1) { var $1;
  910. self["@binder"]=aBinder;
  911. $1=self["@wrapper"];
  912. if(($receiver = $1) == nil || $receiver == undefined){
  913. self["@wrapper"]=_st(root)._span();
  914. self["@wrapper"];
  915. } else {
  916. $1;
  917. };
  918. _st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
  919. _st((function(html){
  920. return smalltalk.withContext(function($ctx2) { return _st(self)._privateRenderOn_html_(self["@binder"],html);
  921. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
  922. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,root:root},smalltalk.HLBindingInput)})},
  923. args: ["aBinder", "root"],
  924. source: "renderOn: aBinder html: root\x0a\x09binder := aBinder.\x0a\x09wrapper ifNil: [ wrapper := root span ].\x0a\x09\x0a\x09wrapper class: 'control-group ', self status.\x0a\x09\x0a\x09[:html | self privateRenderOn: binder html: html ] appendToJQuery: wrapper asJQuery",
  925. messageSends: ["ifNil:", "span", "class:", ",", "status", "appendToJQuery:", "asJQuery", "privateRenderOn:html:"],
  926. referencedClasses: []
  927. }),
  928. smalltalk.HLBindingInput);
  929. smalltalk.addMethod(
  930. "_status",
  931. smalltalk.method({
  932. selector: "status",
  933. category: 'accessing',
  934. fn: function (){
  935. var self=this;
  936. return smalltalk.withContext(function($ctx1) { var $2,$1;
  937. $2=self["@status"];
  938. if(($receiver = $2) == nil || $receiver == undefined){
  939. self["@status"]="info";
  940. $1=self["@status"];
  941. } else {
  942. $1=$2;
  943. };
  944. return $1;
  945. }, function($ctx1) {$ctx1.fill(self,"status",{},smalltalk.HLBindingInput)})},
  946. args: [],
  947. source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
  948. messageSends: ["ifNil:"],
  949. referencedClasses: []
  950. }),
  951. smalltalk.HLBindingInput);
  952. smalltalk.addMethod(
  953. "_status_",
  954. smalltalk.method({
  955. selector: "status:",
  956. category: 'accessing',
  957. fn: function (aStatus){
  958. var self=this;
  959. return smalltalk.withContext(function($ctx1) { self["@status"]=aStatus;
  960. return self}, function($ctx1) {$ctx1.fill(self,"status:",{aStatus:aStatus},smalltalk.HLBindingInput)})},
  961. args: ["aStatus"],
  962. source: "status: aStatus\x0a\x09status := aStatus",
  963. messageSends: [],
  964. referencedClasses: []
  965. }),
  966. smalltalk.HLBindingInput);
  967. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  968. smalltalk.addMethod(
  969. "_activate",
  970. smalltalk.method({
  971. selector: "activate",
  972. category: 'actions',
  973. fn: function (){
  974. var self=this;
  975. return smalltalk.withContext(function($ctx1) { _st(_st(self)._helper())._show();
  976. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  977. args: [],
  978. source: "activate\x0a\x09self helper show",
  979. messageSends: ["show", "helper"],
  980. referencedClasses: []
  981. }),
  982. smalltalk.HLKeyBinder);
  983. smalltalk.addMethod(
  984. "_activationKey",
  985. smalltalk.method({
  986. selector: "activationKey",
  987. category: 'accessing',
  988. fn: function (){
  989. var self=this;
  990. return smalltalk.withContext(function($ctx1) { return (32);
  991. }, function($ctx1) {$ctx1.fill(self,"activationKey",{},smalltalk.HLKeyBinder)})},
  992. args: [],
  993. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  994. messageSends: [],
  995. referencedClasses: []
  996. }),
  997. smalltalk.HLKeyBinder);
  998. smalltalk.addMethod(
  999. "_activationKeyLabel",
  1000. smalltalk.method({
  1001. selector: "activationKeyLabel",
  1002. category: 'accessing',
  1003. fn: function (){
  1004. var self=this;
  1005. return smalltalk.withContext(function($ctx1) { return "ctrl + space";
  1006. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{},smalltalk.HLKeyBinder)})},
  1007. args: [],
  1008. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  1009. messageSends: [],
  1010. referencedClasses: []
  1011. }),
  1012. smalltalk.HLKeyBinder);
  1013. smalltalk.addMethod(
  1014. "_applyBinding_",
  1015. smalltalk.method({
  1016. selector: "applyBinding:",
  1017. category: 'actions',
  1018. fn: function (aBinding){
  1019. var self=this;
  1020. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1021. $1=_st(aBinding)._isActive();
  1022. if(! smalltalk.assert($1)){
  1023. $2=self;
  1024. return $2;
  1025. };
  1026. _st(self)._selectBinding_(aBinding);
  1027. _st(aBinding)._applyOn_(self);
  1028. $3=_st(aBinding)._isFinal();
  1029. if(smalltalk.assert($3)){
  1030. _st(self)._deactivate();
  1031. };
  1032. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1033. args: ["aBinding"],
  1034. 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 ]",
  1035. messageSends: ["ifFalse:", "isActive", "selectBinding:", "applyOn:", "ifTrue:", "deactivate", "isFinal"],
  1036. referencedClasses: []
  1037. }),
  1038. smalltalk.HLKeyBinder);
  1039. smalltalk.addMethod(
  1040. "_bindings",
  1041. smalltalk.method({
  1042. selector: "bindings",
  1043. category: 'accessing',
  1044. fn: function (){
  1045. var self=this;
  1046. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1047. $2=self["@bindings"];
  1048. if(($receiver = $2) == nil || $receiver == undefined){
  1049. self["@bindings"]=_st(self)._defaultBindings();
  1050. $1=self["@bindings"];
  1051. } else {
  1052. $1=$2;
  1053. };
  1054. return $1;
  1055. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLKeyBinder)})},
  1056. args: [],
  1057. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
  1058. messageSends: ["ifNil:", "defaultBindings"],
  1059. referencedClasses: []
  1060. }),
  1061. smalltalk.HLKeyBinder);
  1062. smalltalk.addMethod(
  1063. "_deactivate",
  1064. smalltalk.method({
  1065. selector: "deactivate",
  1066. category: 'actions',
  1067. fn: function (){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) { var $1;
  1070. $1=self["@selectedBinding"];
  1071. if(($receiver = $1) == nil || $receiver == undefined){
  1072. $1;
  1073. } else {
  1074. _st(self["@selectedBinding"])._release();
  1075. };
  1076. self["@selectedBinding"]=nil;
  1077. _st(_st(self)._helper())._hide();
  1078. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},smalltalk.HLKeyBinder)})},
  1079. args: [],
  1080. source: "deactivate\x0a\x09selectedBinding ifNotNil: [ selectedBinding release ].\x0a selectedBinding := nil.\x0a\x09self helper hide",
  1081. messageSends: ["ifNotNil:", "release", "hide", "helper"],
  1082. referencedClasses: []
  1083. }),
  1084. smalltalk.HLKeyBinder);
  1085. smalltalk.addMethod(
  1086. "_defaultBindings",
  1087. smalltalk.method({
  1088. selector: "defaultBindings",
  1089. category: 'defaults',
  1090. fn: function (){
  1091. var self=this;
  1092. var group;
  1093. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1094. $1=_st((smalltalk.HLBindingGroup || HLBindingGroup))._new();
  1095. _st($1)._addGroupKey_labelled_((86),"View");
  1096. _st($1)._add_(_st(_st((smalltalk.HLCloseTabCommand || HLCloseTabCommand))._new())._asBinding());
  1097. $2=_st($1)._yourself();
  1098. group=$2;
  1099. _st((smalltalk.HLOpenCommand || HLOpenCommand))._registerConcreteClassesOn_(group);
  1100. $3=group;
  1101. return $3;
  1102. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  1103. args: [],
  1104. 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",
  1105. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "registerConcreteClassesOn:"],
  1106. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLOpenCommand"]
  1107. }),
  1108. smalltalk.HLKeyBinder);
  1109. smalltalk.addMethod(
  1110. "_escapeKey",
  1111. smalltalk.method({
  1112. selector: "escapeKey",
  1113. category: 'accessing',
  1114. fn: function (){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) { return (27);
  1117. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{},smalltalk.HLKeyBinder)})},
  1118. args: [],
  1119. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  1120. messageSends: [],
  1121. referencedClasses: []
  1122. }),
  1123. smalltalk.HLKeyBinder);
  1124. smalltalk.addMethod(
  1125. "_flushBindings",
  1126. smalltalk.method({
  1127. selector: "flushBindings",
  1128. category: 'actions',
  1129. fn: function (){
  1130. var self=this;
  1131. return smalltalk.withContext(function($ctx1) { self["@bindings"]=nil;
  1132. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{},smalltalk.HLKeyBinder)})},
  1133. args: [],
  1134. source: "flushBindings\x0a\x09bindings := nil",
  1135. messageSends: [],
  1136. referencedClasses: []
  1137. }),
  1138. smalltalk.HLKeyBinder);
  1139. smalltalk.addMethod(
  1140. "_handleActiveKeyDown_",
  1141. smalltalk.method({
  1142. selector: "handleActiveKeyDown:",
  1143. category: 'events',
  1144. fn: function (event){
  1145. var self=this;
  1146. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1147. $1=_st(_st(_st(event)._which()).__eq(_st(self)._escapeKey()))._or_((function(){
  1148. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  1149. return smalltalk.withContext(function($ctx3) { return _st(event)._ctrlKey();
  1150. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1152. if(smalltalk.assert($1)){
  1153. _st(self)._deactivate();
  1154. _st(event)._preventDefault();
  1155. return false;
  1156. };
  1157. $2=_st(self)._handleBindingFor_(event);
  1158. return $2;
  1159. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1160. args: ["event"],
  1161. 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",
  1162. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  1163. referencedClasses: []
  1164. }),
  1165. smalltalk.HLKeyBinder);
  1166. smalltalk.addMethod(
  1167. "_handleBindingFor_",
  1168. smalltalk.method({
  1169. selector: "handleBindingFor:",
  1170. category: 'events',
  1171. fn: function (anEvent){
  1172. var self=this;
  1173. var binding;
  1174. return smalltalk.withContext(function($ctx1) { var $1;
  1175. binding=_st(_st(self)._selectedBinding())._atKey_(_st(anEvent)._which());
  1176. $1=binding;
  1177. if(($receiver = $1) == nil || $receiver == undefined){
  1178. $1;
  1179. } else {
  1180. _st(self)._applyBinding_(binding);
  1181. _st(anEvent)._preventDefault();
  1182. return false;
  1183. };
  1184. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},smalltalk.HLKeyBinder)})},
  1185. args: ["anEvent"],
  1186. 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 ]",
  1187. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  1188. referencedClasses: []
  1189. }),
  1190. smalltalk.HLKeyBinder);
  1191. smalltalk.addMethod(
  1192. "_handleInactiveKeyDown_",
  1193. smalltalk.method({
  1194. selector: "handleInactiveKeyDown:",
  1195. category: 'events',
  1196. fn: function (event){
  1197. var self=this;
  1198. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1199. $1=_st(_st(event)._which()).__eq(_st(self)._activationKey());
  1200. if(smalltalk.assert($1)){
  1201. $2=_st(event)._ctrlKey();
  1202. if(smalltalk.assert($2)){
  1203. _st(self)._activate();
  1204. _st(event)._preventDefault();
  1205. return false;
  1206. };
  1207. };
  1208. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1209. args: ["event"],
  1210. source: "handleInactiveKeyDown: event\x0a event which = self activationKey ifTrue: [\x0a \x09\x09event ctrlKey ifTrue: [\x0a\x09\x09\x09\x09\x09self activate. \x0a \x09\x09 event preventDefault. \x0a \x09^ false ] ]",
  1211. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  1212. referencedClasses: []
  1213. }),
  1214. smalltalk.HLKeyBinder);
  1215. smalltalk.addMethod(
  1216. "_handleKeyDown_",
  1217. smalltalk.method({
  1218. selector: "handleKeyDown:",
  1219. category: 'events',
  1220. fn: function (event){
  1221. var self=this;
  1222. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1223. $2=_st(self)._isActive();
  1224. if(smalltalk.assert($2)){
  1225. $1=_st(self)._handleActiveKeyDown_(event);
  1226. } else {
  1227. $1=_st(self)._handleInactiveKeyDown_(event);
  1228. };
  1229. return $1;
  1230. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1231. args: ["event"],
  1232. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  1233. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  1234. referencedClasses: []
  1235. }),
  1236. smalltalk.HLKeyBinder);
  1237. smalltalk.addMethod(
  1238. "_helper",
  1239. smalltalk.method({
  1240. selector: "helper",
  1241. category: 'accessing',
  1242. fn: function (){
  1243. var self=this;
  1244. return smalltalk.withContext(function($ctx1) { var $1;
  1245. $1=self["@helper"];
  1246. return $1;
  1247. }, function($ctx1) {$ctx1.fill(self,"helper",{},smalltalk.HLKeyBinder)})},
  1248. args: [],
  1249. source: "helper\x0a\x09^ helper",
  1250. messageSends: [],
  1251. referencedClasses: []
  1252. }),
  1253. smalltalk.HLKeyBinder);
  1254. smalltalk.addMethod(
  1255. "_initialize",
  1256. smalltalk.method({
  1257. selector: "initialize",
  1258. category: 'initialization',
  1259. fn: function (){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1262. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  1263. self["@helper"]=_st((smalltalk.HLKeyBinderHelper || HLKeyBinderHelper))._on_(self);
  1264. $1=self["@helper"];
  1265. _st($1)._renderStart();
  1266. $2=_st($1)._renderCog();
  1267. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  1268. args: [],
  1269. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper \x09\x0a\x09\x09renderStart;\x0a\x09\x09renderCog",
  1270. messageSends: ["initialize", "on:", "renderStart", "renderCog"],
  1271. referencedClasses: ["HLKeyBinderHelper"]
  1272. }),
  1273. smalltalk.HLKeyBinder);
  1274. smalltalk.addMethod(
  1275. "_isActive",
  1276. smalltalk.method({
  1277. selector: "isActive",
  1278. category: 'testing',
  1279. fn: function (){
  1280. var self=this;
  1281. return smalltalk.withContext(function($ctx1) { var $1;
  1282. $1=_st(_st(_st(".").__comma(_st(_st(self)._helper())._cssClass()))._asJQuery())._is_(":visible");
  1283. return $1;
  1284. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  1285. args: [],
  1286. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  1287. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"],
  1288. referencedClasses: []
  1289. }),
  1290. smalltalk.HLKeyBinder);
  1291. smalltalk.addMethod(
  1292. "_selectBinding_",
  1293. smalltalk.method({
  1294. selector: "selectBinding:",
  1295. category: 'actions',
  1296. fn: function (aBinding){
  1297. var self=this;
  1298. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1299. $1=_st(aBinding).__eq(self["@selectedBinding"]);
  1300. if(smalltalk.assert($1)){
  1301. $2=self;
  1302. return $2;
  1303. };
  1304. self["@selectedBinding"]=aBinding;
  1305. _st(_st(self)._helper())._refresh();
  1306. return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1307. args: ["aBinding"],
  1308. source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
  1309. messageSends: ["ifTrue:", "=", "refresh", "helper"],
  1310. referencedClasses: []
  1311. }),
  1312. smalltalk.HLKeyBinder);
  1313. smalltalk.addMethod(
  1314. "_selectedBinding",
  1315. smalltalk.method({
  1316. selector: "selectedBinding",
  1317. category: 'accessing',
  1318. fn: function (){
  1319. var self=this;
  1320. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1321. $2=self["@selectedBinding"];
  1322. if(($receiver = $2) == nil || $receiver == undefined){
  1323. $1=_st(self)._bindings();
  1324. } else {
  1325. $1=$2;
  1326. };
  1327. return $1;
  1328. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinder)})},
  1329. args: [],
  1330. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  1331. messageSends: ["ifNil:", "bindings"],
  1332. referencedClasses: []
  1333. }),
  1334. smalltalk.HLKeyBinder);
  1335. smalltalk.addMethod(
  1336. "_setupEvents",
  1337. smalltalk.method({
  1338. selector: "setupEvents",
  1339. category: 'events',
  1340. fn: function (){
  1341. var self=this;
  1342. return smalltalk.withContext(function($ctx1) { _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  1343. return smalltalk.withContext(function($ctx2) { return _st(self)._handleKeyDown_(event);
  1344. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  1345. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},smalltalk.HLKeyBinder)})},
  1346. args: [],
  1347. source: "setupEvents\x0a\x09(window jQuery: 'body') keydown: [ :event | self handleKeyDown: event ]",
  1348. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"],
  1349. referencedClasses: []
  1350. }),
  1351. smalltalk.HLKeyBinder);
  1352. smalltalk.addMethod(
  1353. "_systemIsMac",
  1354. smalltalk.method({
  1355. selector: "systemIsMac",
  1356. category: 'testing',
  1357. fn: function (){
  1358. var self=this;
  1359. return smalltalk.withContext(function($ctx1) { var $1;
  1360. $1=_st(_st(navigator)._platform())._match_("Mac");
  1361. return $1;
  1362. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},smalltalk.HLKeyBinder)})},
  1363. args: [],
  1364. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1365. messageSends: ["match:", "platform"],
  1366. referencedClasses: []
  1367. }),
  1368. smalltalk.HLKeyBinder);
  1369. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1370. smalltalk.addMethod(
  1371. "_cssClass",
  1372. smalltalk.method({
  1373. selector: "cssClass",
  1374. category: 'accessing',
  1375. fn: function (){
  1376. var self=this;
  1377. return smalltalk.withContext(function($ctx1) { return "key_helper";
  1378. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLKeyBinderHelper)})},
  1379. args: [],
  1380. source: "cssClass\x0a\x09^ 'key_helper'",
  1381. messageSends: [],
  1382. referencedClasses: []
  1383. }),
  1384. smalltalk.HLKeyBinderHelper);
  1385. smalltalk.addMethod(
  1386. "_hide",
  1387. smalltalk.method({
  1388. selector: "hide",
  1389. category: 'actions',
  1390. fn: function (){
  1391. var self=this;
  1392. return smalltalk.withContext(function($ctx1) { _st(_st(_st(".").__comma(_st(self)._cssClass()))._asJQuery())._remove();
  1393. _st(self)._showCog();
  1394. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1395. args: [],
  1396. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09self showCog",
  1397. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"],
  1398. referencedClasses: []
  1399. }),
  1400. smalltalk.HLKeyBinderHelper);
  1401. smalltalk.addMethod(
  1402. "_hideCog",
  1403. smalltalk.method({
  1404. selector: "hideCog",
  1405. category: 'actions',
  1406. fn: function (){
  1407. var self=this;
  1408. return smalltalk.withContext(function($ctx1) { _st(_st("#cog-helper")._asJQuery())._hide();
  1409. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1410. args: [],
  1411. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  1412. messageSends: ["hide", "asJQuery"],
  1413. referencedClasses: []
  1414. }),
  1415. smalltalk.HLKeyBinderHelper);
  1416. smalltalk.addMethod(
  1417. "_keyBinder",
  1418. smalltalk.method({
  1419. selector: "keyBinder",
  1420. category: 'accessing',
  1421. fn: function (){
  1422. var self=this;
  1423. return smalltalk.withContext(function($ctx1) { var $1;
  1424. $1=self["@keyBinder"];
  1425. return $1;
  1426. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{},smalltalk.HLKeyBinderHelper)})},
  1427. args: [],
  1428. source: "keyBinder\x0a\x09^ keyBinder",
  1429. messageSends: [],
  1430. referencedClasses: []
  1431. }),
  1432. smalltalk.HLKeyBinderHelper);
  1433. smalltalk.addMethod(
  1434. "_keyBinder_",
  1435. smalltalk.method({
  1436. selector: "keyBinder:",
  1437. category: 'accessing',
  1438. fn: function (aKeyBinder){
  1439. var self=this;
  1440. return smalltalk.withContext(function($ctx1) { self["@keyBinder"]=aKeyBinder;
  1441. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper)})},
  1442. args: ["aKeyBinder"],
  1443. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  1444. messageSends: [],
  1445. referencedClasses: []
  1446. }),
  1447. smalltalk.HLKeyBinderHelper);
  1448. smalltalk.addMethod(
  1449. "_registerBindings",
  1450. smalltalk.method({
  1451. selector: "registerBindings",
  1452. category: 'keyBindings',
  1453. fn: function (){
  1454. var self=this;
  1455. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},smalltalk.HLKeyBinderHelper)})},
  1456. args: [],
  1457. source: "registerBindings\x0a\x09\x22Do nothing\x22",
  1458. messageSends: [],
  1459. referencedClasses: []
  1460. }),
  1461. smalltalk.HLKeyBinderHelper);
  1462. smalltalk.addMethod(
  1463. "_renderBindingGroup_on_",
  1464. smalltalk.method({
  1465. selector: "renderBindingGroup:on:",
  1466. category: 'rendering',
  1467. fn: function (aBindingGroup,html){
  1468. var self=this;
  1469. return smalltalk.withContext(function($ctx1) { _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1470. return smalltalk.withContext(function($ctx2) { return _st(_st(a)._key()).__lt(_st(b)._key());
  1471. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1472. return smalltalk.withContext(function($ctx2) { return _st(each)._renderActionFor_html_(_st(self)._keyBinder(),html);
  1473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1474. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1475. args: ["aBindingGroup", "html"],
  1476. 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 ]",
  1477. messageSends: ["do:", "renderActionFor:html:", "keyBinder", "sorted:", "<", "key", "activeBindings"],
  1478. referencedClasses: []
  1479. }),
  1480. smalltalk.HLKeyBinderHelper);
  1481. smalltalk.addMethod(
  1482. "_renderBindingOn_",
  1483. smalltalk.method({
  1484. selector: "renderBindingOn:",
  1485. category: 'rendering',
  1486. fn: function (html){
  1487. var self=this;
  1488. return smalltalk.withContext(function($ctx1) { _st(_st(self)._selectedBinding())._renderOn_html_(self,html);
  1489. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1490. args: ["html"],
  1491. source: "renderBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  1492. messageSends: ["renderOn:html:", "selectedBinding"],
  1493. referencedClasses: []
  1494. }),
  1495. smalltalk.HLKeyBinderHelper);
  1496. smalltalk.addMethod(
  1497. "_renderCloseOn_",
  1498. smalltalk.method({
  1499. selector: "renderCloseOn:",
  1500. category: 'rendering',
  1501. fn: function (html){
  1502. var self=this;
  1503. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1504. $1=_st(html)._a();
  1505. _st($1)._class_("close");
  1506. _st($1)._with_((function(){
  1507. return smalltalk.withContext(function($ctx2) { return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1509. $2=_st($1)._onClick_((function(){
  1510. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._keyBinder())._deactivate();
  1511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1512. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1513. args: ["html"],
  1514. 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 ]",
  1515. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"],
  1516. referencedClasses: []
  1517. }),
  1518. smalltalk.HLKeyBinderHelper);
  1519. smalltalk.addMethod(
  1520. "_renderCog",
  1521. smalltalk.method({
  1522. selector: "renderCog",
  1523. category: 'rendering',
  1524. fn: function (){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  1527. _st((function(html){
  1528. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1529. _st($1)._id_("cog-helper");
  1530. $2=_st($1)._with_((function(){
  1531. return smalltalk.withContext(function($ctx3) { $3=_st(html)._a();
  1532. _st($3)._with_((function(){
  1533. return smalltalk.withContext(function($ctx4) { return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1534. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1535. $4=_st($3)._onClick_((function(){
  1536. return smalltalk.withContext(function($ctx4) { return _st(_st(self)._keyBinder())._activate();
  1537. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1538. return $4;
  1539. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1540. return $2;
  1541. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1542. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1543. args: [],
  1544. 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",
  1545. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"],
  1546. referencedClasses: []
  1547. }),
  1548. smalltalk.HLKeyBinderHelper);
  1549. smalltalk.addMethod(
  1550. "_renderContentOn_",
  1551. smalltalk.method({
  1552. selector: "renderContentOn:",
  1553. category: 'rendering',
  1554. fn: function (html){
  1555. var self=this;
  1556. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  1557. $1=_st(html)._div();
  1558. _st($1)._class_(_st(self)._cssClass());
  1559. $2=_st($1)._with_((function(){
  1560. return smalltalk.withContext(function($ctx2) { $3=self;
  1561. _st($3)._renderSelectionOn_(html);
  1562. _st($3)._renderBindingOn_(html);
  1563. $4=_st($3)._renderCloseOn_(html);
  1564. return $4;
  1565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1566. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1567. args: ["html"],
  1568. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderSelectionOn:html;\x0a \x09renderBindingOn: html;\x0a\x09\x09\x09renderCloseOn: html ]",
  1569. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:", "renderCloseOn:"],
  1570. referencedClasses: []
  1571. }),
  1572. smalltalk.HLKeyBinderHelper);
  1573. smalltalk.addMethod(
  1574. "_renderSelectionOn_",
  1575. smalltalk.method({
  1576. selector: "renderSelectionOn:",
  1577. category: 'rendering',
  1578. fn: function (html){
  1579. var self=this;
  1580. return smalltalk.withContext(function($ctx1) { var $1,$3,$5,$4,$2;
  1581. $1=_st(html)._span();
  1582. _st($1)._class_("selected");
  1583. $3=$1;
  1584. $5=_st(_st(self)._selectedBinding())._label();
  1585. if(($receiver = $5) == nil || $receiver == undefined){
  1586. $4="Action";
  1587. } else {
  1588. $4=$5;
  1589. };
  1590. $2=_st($3)._with_($4);
  1591. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1592. args: ["html"],
  1593. source: "renderSelectionOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  1594. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  1595. referencedClasses: []
  1596. }),
  1597. smalltalk.HLKeyBinderHelper);
  1598. smalltalk.addMethod(
  1599. "_renderStart",
  1600. smalltalk.method({
  1601. selector: "renderStart",
  1602. category: 'rendering',
  1603. fn: function (){
  1604. var self=this;
  1605. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1606. _st((function(html){
  1607. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1608. _st($1)._id_("keybinding-start-helper");
  1609. $2=_st($1)._with_(_st(_st("Press ").__comma(_st(_st(self)._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1610. return $2;
  1611. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1612. _st((function(){
  1613. return smalltalk.withContext(function($ctx2) { return _st(_st(window)._jQuery_("#keybinding-start-helper"))._fadeOut_((1000));
  1614. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1615. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{},smalltalk.HLKeyBinderHelper)})},
  1616. args: [],
  1617. source: "renderStart\x0a\x09[ :html |\x0a\x09\x09html div \x0a\x09\x09\x09id: 'keybinding-start-helper';\x0a\x09\x09\x09with: 'Press ', self keyBinder activationKeyLabel, ' to start' ] appendToJQuery: 'body' asJQuery.\x0a\x09\x0a\x09[ (window jQuery: '#keybinding-start-helper') fadeOut: 1000 ] \x0a\x09\x09valueWithTimeout: 2000",
  1618. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:", "jQuery:"],
  1619. referencedClasses: []
  1620. }),
  1621. smalltalk.HLKeyBinderHelper);
  1622. smalltalk.addMethod(
  1623. "_selectedBinding",
  1624. smalltalk.method({
  1625. selector: "selectedBinding",
  1626. category: 'accessing',
  1627. fn: function (){
  1628. var self=this;
  1629. return smalltalk.withContext(function($ctx1) { var $1;
  1630. $1=_st(_st(self)._keyBinder())._selectedBinding();
  1631. return $1;
  1632. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinderHelper)})},
  1633. args: [],
  1634. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1635. messageSends: ["selectedBinding", "keyBinder"],
  1636. referencedClasses: []
  1637. }),
  1638. smalltalk.HLKeyBinderHelper);
  1639. smalltalk.addMethod(
  1640. "_show",
  1641. smalltalk.method({
  1642. selector: "show",
  1643. category: 'actions',
  1644. fn: function (){
  1645. var self=this;
  1646. return smalltalk.withContext(function($ctx1) { _st(self)._hideCog();
  1647. _st(self)._appendToJQuery_(_st("body")._asJQuery());
  1648. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1649. args: [],
  1650. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1651. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"],
  1652. referencedClasses: []
  1653. }),
  1654. smalltalk.HLKeyBinderHelper);
  1655. smalltalk.addMethod(
  1656. "_showCog",
  1657. smalltalk.method({
  1658. selector: "showCog",
  1659. category: 'actions',
  1660. fn: function (){
  1661. var self=this;
  1662. return smalltalk.withContext(function($ctx1) { _st(_st("#cog-helper")._asJQuery())._show();
  1663. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1664. args: [],
  1665. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  1666. messageSends: ["show", "asJQuery"],
  1667. referencedClasses: []
  1668. }),
  1669. smalltalk.HLKeyBinderHelper);
  1670. smalltalk.addMethod(
  1671. "_on_",
  1672. smalltalk.method({
  1673. selector: "on:",
  1674. category: 'instance creation',
  1675. fn: function (aKeyBinder){
  1676. var self=this;
  1677. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1678. $2=_st(self)._new();
  1679. _st($2)._keyBinder_(aKeyBinder);
  1680. $3=_st($2)._yourself();
  1681. $1=$3;
  1682. return $1;
  1683. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper.klass)})},
  1684. args: ["aKeyBinder"],
  1685. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1686. messageSends: ["keyBinder:", "new", "yourself"],
  1687. referencedClasses: []
  1688. }),
  1689. smalltalk.HLKeyBinderHelper.klass);