1
0

Helios-KeyBindings.js 72 KB

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