Helios-KeyBindings.js 58 KB

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