Helios-KeyBindings.js 61 KB

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