Helios-KeyBindings.js 60 KB

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