Helios-KeyBindings.js 60 KB

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