Helios-KeyBindings.js 73 KB

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