Helios-KeyBindings.js 73 KB

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