1
0

Helios-KeyBindings.js 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  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) { _st(self)._subclassResponsibility();
  11. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder}, smalltalk.HLBinding)})},
  12. args: ["aKeyBinder"],
  13. source: "applyOn: aKeyBinder\x0a\x09self subclassResponsibility",
  14. messageSends: ["subclassResponsibility"],
  15. referencedClasses: []
  16. }),
  17. smalltalk.HLBinding);
  18. smalltalk.addMethod(
  19. "_displayLabel",
  20. smalltalk.method({
  21. selector: "displayLabel",
  22. category: 'accessing',
  23. fn: function (){
  24. var self=this;
  25. return smalltalk.withContext(function($ctx1) { var $1;
  26. $1=_st(self)._label();
  27. return $1;
  28. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{}, smalltalk.HLBinding)})},
  29. args: [],
  30. source: "displayLabel\x0a\x09^ self label",
  31. messageSends: ["label"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.HLBinding);
  35. smalltalk.addMethod(
  36. "_isBindingAction",
  37. smalltalk.method({
  38. selector: "isBindingAction",
  39. category: 'testing',
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx1) { return false;
  43. }, function($ctx1) {$ctx1.fill(self,"isBindingAction",{}, smalltalk.HLBinding)})},
  44. args: [],
  45. source: "isBindingAction\x0a\x09^ false",
  46. messageSends: [],
  47. referencedClasses: []
  48. }),
  49. smalltalk.HLBinding);
  50. smalltalk.addMethod(
  51. "_isBindingGroup",
  52. smalltalk.method({
  53. selector: "isBindingGroup",
  54. category: 'testing',
  55. fn: function (){
  56. var self=this;
  57. return smalltalk.withContext(function($ctx1) { return false;
  58. }, function($ctx1) {$ctx1.fill(self,"isBindingGroup",{}, smalltalk.HLBinding)})},
  59. args: [],
  60. source: "isBindingGroup\x0a\x09^ false",
  61. messageSends: [],
  62. referencedClasses: []
  63. }),
  64. smalltalk.HLBinding);
  65. smalltalk.addMethod(
  66. "_key",
  67. smalltalk.method({
  68. selector: "key",
  69. category: 'accessing',
  70. fn: function (){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) { var $1;
  73. $1=self["@key"];
  74. return $1;
  75. }, function($ctx1) {$ctx1.fill(self,"key",{}, smalltalk.HLBinding)})},
  76. args: [],
  77. source: "key\x0a\x09^ key",
  78. messageSends: [],
  79. referencedClasses: []
  80. }),
  81. smalltalk.HLBinding);
  82. smalltalk.addMethod(
  83. "_key_",
  84. smalltalk.method({
  85. selector: "key:",
  86. category: 'accessing',
  87. fn: function (anInteger){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) { self["@key"]=anInteger;
  90. return self}, function($ctx1) {$ctx1.fill(self,"key:",{anInteger:anInteger}, smalltalk.HLBinding)})},
  91. args: ["anInteger"],
  92. source: "key: anInteger\x0a\x09key := anInteger",
  93. messageSends: [],
  94. referencedClasses: []
  95. }),
  96. smalltalk.HLBinding);
  97. smalltalk.addMethod(
  98. "_label",
  99. smalltalk.method({
  100. selector: "label",
  101. category: 'accessing',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) { var $1;
  105. $1=self["@label"];
  106. return $1;
  107. }, function($ctx1) {$ctx1.fill(self,"label",{}, smalltalk.HLBinding)})},
  108. args: [],
  109. source: "label\x0a\x09^ label",
  110. messageSends: [],
  111. referencedClasses: []
  112. }),
  113. smalltalk.HLBinding);
  114. smalltalk.addMethod(
  115. "_label_",
  116. smalltalk.method({
  117. selector: "label:",
  118. category: 'accessing',
  119. fn: function (aString){
  120. var self=this;
  121. return smalltalk.withContext(function($ctx1) { self["@label"]=aString;
  122. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString}, smalltalk.HLBinding)})},
  123. args: ["aString"],
  124. source: "label: aString\x0a\x09label := aString",
  125. messageSends: [],
  126. referencedClasses: []
  127. }),
  128. smalltalk.HLBinding);
  129. smalltalk.addMethod(
  130. "_renderOn_html_",
  131. smalltalk.method({
  132. selector: "renderOn:html:",
  133. category: 'rendering',
  134. fn: function (aBindingHelper,html){
  135. var self=this;
  136. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html}, smalltalk.HLBinding)})},
  137. args: ["aBindingHelper", "html"],
  138. source: "renderOn: aBindingHelper html: html",
  139. messageSends: [],
  140. referencedClasses: []
  141. }),
  142. smalltalk.HLBinding);
  143. smalltalk.addMethod(
  144. "_shortcut",
  145. smalltalk.method({
  146. selector: "shortcut",
  147. category: 'accessing',
  148. fn: function (){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) { var $1;
  151. $1=_st((smalltalk.String || String))._fromCharCode_(_st(self)._key());
  152. return $1;
  153. }, function($ctx1) {$ctx1.fill(self,"shortcut",{}, smalltalk.HLBinding)})},
  154. args: [],
  155. source: "shortcut\x0a\x09^ String fromCharCode: self key",
  156. messageSends: ["fromCharCode:", "key"],
  157. referencedClasses: ["String"]
  158. }),
  159. smalltalk.HLBinding);
  160. smalltalk.addMethod(
  161. "_on_labelled_",
  162. smalltalk.method({
  163. selector: "on:labelled:",
  164. category: 'instance creation',
  165. fn: function (anInteger,aString){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  168. $2=_st(self)._new();
  169. _st($2)._key_(anInteger);
  170. _st($2)._label_(aString);
  171. $3=_st($2)._yourself();
  172. $1=$3;
  173. return $1;
  174. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString}, smalltalk.HLBinding.klass)})},
  175. args: ["anInteger", "aString"],
  176. source: "on: anInteger labelled: aString\x0a\x09^ self new\x0a \x09key: anInteger;\x0a label: aString;\x0a yourself",
  177. messageSends: ["key:", "new", "label:", "yourself"],
  178. referencedClasses: []
  179. }),
  180. smalltalk.HLBinding.klass);
  181. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['callback'], 'Helios-KeyBindings');
  182. smalltalk.addMethod(
  183. "_applyOn_",
  184. smalltalk.method({
  185. selector: "applyOn:",
  186. category: 'actions',
  187. fn: function (aKeyBinder){
  188. var self=this;
  189. return smalltalk.withContext(function($ctx1) { _st(aKeyBinder)._applyBindingAction_(self);
  190. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder}, smalltalk.HLBindingAction)})},
  191. args: ["aKeyBinder"],
  192. source: "applyOn: aKeyBinder\x0a\x09aKeyBinder applyBindingAction: self",
  193. messageSends: ["applyBindingAction:"],
  194. referencedClasses: []
  195. }),
  196. smalltalk.HLBindingAction);
  197. smalltalk.addMethod(
  198. "_callback",
  199. smalltalk.method({
  200. selector: "callback",
  201. category: 'accessing',
  202. fn: function (){
  203. var self=this;
  204. return smalltalk.withContext(function($ctx1) { var $1;
  205. $1=self["@callback"];
  206. return $1;
  207. }, function($ctx1) {$ctx1.fill(self,"callback",{}, smalltalk.HLBindingAction)})},
  208. args: [],
  209. source: "callback\x0a\x09^ callback",
  210. messageSends: [],
  211. referencedClasses: []
  212. }),
  213. smalltalk.HLBindingAction);
  214. smalltalk.addMethod(
  215. "_callback_",
  216. smalltalk.method({
  217. selector: "callback:",
  218. category: 'accessing',
  219. fn: function (aBlock){
  220. var self=this;
  221. return smalltalk.withContext(function($ctx1) { self["@callback"]=aBlock;
  222. return self}, function($ctx1) {$ctx1.fill(self,"callback:",{aBlock:aBlock}, smalltalk.HLBindingAction)})},
  223. args: ["aBlock"],
  224. source: "callback: aBlock\x0a\x09callback := aBlock",
  225. messageSends: [],
  226. referencedClasses: []
  227. }),
  228. smalltalk.HLBindingAction);
  229. smalltalk.addMethod(
  230. "_isBindingAction",
  231. smalltalk.method({
  232. selector: "isBindingAction",
  233. category: 'testing',
  234. fn: function (){
  235. var self=this;
  236. return smalltalk.withContext(function($ctx1) { return true;
  237. }, function($ctx1) {$ctx1.fill(self,"isBindingAction",{}, smalltalk.HLBindingAction)})},
  238. args: [],
  239. source: "isBindingAction\x0a\x09^ true",
  240. messageSends: [],
  241. referencedClasses: []
  242. }),
  243. smalltalk.HLBindingAction);
  244. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  245. smalltalk.addMethod(
  246. "_add_",
  247. smalltalk.method({
  248. selector: "add:",
  249. category: 'accessing',
  250. fn: function (aBinding){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) { var $1;
  253. $1=_st(_st(self)._bindings())._add_(aBinding);
  254. return $1;
  255. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding}, smalltalk.HLBindingGroup)})},
  256. args: ["aBinding"],
  257. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  258. messageSends: ["add:", "bindings"],
  259. referencedClasses: []
  260. }),
  261. smalltalk.HLBindingGroup);
  262. smalltalk.addMethod(
  263. "_addActionKey_labelled_callback_",
  264. smalltalk.method({
  265. selector: "addActionKey:labelled:callback:",
  266. category: 'accessing',
  267. fn: function (anInteger,aString,aBlock){
  268. var self=this;
  269. return smalltalk.withContext(function($ctx1) { var $1,$2;
  270. $1=_st((smalltalk.HLBindingAction || HLBindingAction))._on_labelled_(anInteger,aString);
  271. _st($1)._callback_(aBlock);
  272. $2=_st($1)._yourself();
  273. _st(self)._add_($2);
  274. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock}, smalltalk.HLBindingGroup)})},
  275. args: ["anInteger", "aString", "aBlock"],
  276. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  277. messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
  278. referencedClasses: ["HLBindingAction"]
  279. }),
  280. smalltalk.HLBindingGroup);
  281. smalltalk.addMethod(
  282. "_addActionKey_labelled_command_",
  283. smalltalk.method({
  284. selector: "addActionKey:labelled:command:",
  285. category: 'accessing',
  286. fn: function (anInteger,aString,aCommand){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) { var $1,$2;
  289. $1=_st((smalltalk.HLBindingAction || HLBindingAction))._on_labelled_(anInteger,aString);
  290. _st($1)._command_(aCommand);
  291. $2=_st($1)._yourself();
  292. _st(self)._add_($2);
  293. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:command:",{anInteger:anInteger,aString:aString,aCommand:aCommand}, smalltalk.HLBindingGroup)})},
  294. args: ["anInteger", "aString", "aCommand"],
  295. source: "addActionKey: anInteger labelled: aString command: aCommand\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09command: aCommand;\x0a yourself)",
  296. messageSends: ["add:", "command:", "on:labelled:", "yourself"],
  297. referencedClasses: ["HLBindingAction"]
  298. }),
  299. smalltalk.HLBindingGroup);
  300. smalltalk.addMethod(
  301. "_addGroupKey_labelled_",
  302. smalltalk.method({
  303. selector: "addGroupKey:labelled:",
  304. category: 'accessing',
  305. fn: function (anInteger,aString){
  306. var self=this;
  307. return smalltalk.withContext(function($ctx1) { _st(self)._add_(_st((smalltalk.HLBindingGroup || HLBindingGroup))._on_labelled_(anInteger,aString));
  308. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString}, smalltalk.HLBindingGroup)})},
  309. args: ["anInteger", "aString"],
  310. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  311. messageSends: ["add:", "on:labelled:"],
  312. referencedClasses: ["HLBindingGroup"]
  313. }),
  314. smalltalk.HLBindingGroup);
  315. smalltalk.addMethod(
  316. "_applyOn_",
  317. smalltalk.method({
  318. selector: "applyOn:",
  319. category: 'actions',
  320. fn: function (aKeyBinder){
  321. var self=this;
  322. return smalltalk.withContext(function($ctx1) { _st(aKeyBinder)._applyBindingGroup_(self);
  323. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder}, smalltalk.HLBindingGroup)})},
  324. args: ["aKeyBinder"],
  325. source: "applyOn: aKeyBinder\x0a\x09aKeyBinder applyBindingGroup: self",
  326. messageSends: ["applyBindingGroup:"],
  327. referencedClasses: []
  328. }),
  329. smalltalk.HLBindingGroup);
  330. smalltalk.addMethod(
  331. "_at_",
  332. smalltalk.method({
  333. selector: "at:",
  334. category: 'accessing',
  335. fn: function (aString){
  336. var self=this;
  337. return smalltalk.withContext(function($ctx1) { var $1;
  338. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  339. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._label()).__eq(aString);
  340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  341. return smalltalk.withContext(function($ctx2) { return nil;
  342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  343. return $1;
  344. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString}, smalltalk.HLBindingGroup)})},
  345. args: ["aString"],
  346. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  347. messageSends: ["detect:ifNone:", "=", "label", "bindings"],
  348. referencedClasses: []
  349. }),
  350. smalltalk.HLBindingGroup);
  351. smalltalk.addMethod(
  352. "_atKey_",
  353. smalltalk.method({
  354. selector: "atKey:",
  355. category: 'accessing',
  356. fn: function (anInteger){
  357. var self=this;
  358. return smalltalk.withContext(function($ctx1) { var $1;
  359. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  360. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._key()).__eq(anInteger);
  361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  362. return smalltalk.withContext(function($ctx2) { return nil;
  363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  364. return $1;
  365. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger}, smalltalk.HLBindingGroup)})},
  366. args: ["anInteger"],
  367. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  368. messageSends: ["detect:ifNone:", "=", "key", "bindings"],
  369. referencedClasses: []
  370. }),
  371. smalltalk.HLBindingGroup);
  372. smalltalk.addMethod(
  373. "_bindings",
  374. smalltalk.method({
  375. selector: "bindings",
  376. category: 'accessing',
  377. fn: function (){
  378. var self=this;
  379. return smalltalk.withContext(function($ctx1) { var $2,$1;
  380. $2=self["@bindings"];
  381. if(($receiver = $2) == nil || $receiver == undefined){
  382. self["@bindings"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  383. $1=self["@bindings"];
  384. } else {
  385. $1=$2;
  386. };
  387. return $1;
  388. }, function($ctx1) {$ctx1.fill(self,"bindings",{}, smalltalk.HLBindingGroup)})},
  389. args: [],
  390. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  391. messageSends: ["ifNil:", "new"],
  392. referencedClasses: ["OrderedCollection"]
  393. }),
  394. smalltalk.HLBindingGroup);
  395. smalltalk.addMethod(
  396. "_displayLabel",
  397. smalltalk.method({
  398. selector: "displayLabel",
  399. category: 'accessing',
  400. fn: function (){
  401. var self=this;
  402. return smalltalk.withContext(function($ctx1) { var $1;
  403. $1=_st(smalltalk.HLBinding.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  404. return $1;
  405. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{}, smalltalk.HLBindingGroup)})},
  406. args: [],
  407. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  408. messageSends: [",", "displayLabel"],
  409. referencedClasses: []
  410. }),
  411. smalltalk.HLBindingGroup);
  412. smalltalk.addMethod(
  413. "_isBindingGroup",
  414. smalltalk.method({
  415. selector: "isBindingGroup",
  416. category: 'testing',
  417. fn: function (){
  418. var self=this;
  419. return smalltalk.withContext(function($ctx1) { return true;
  420. }, function($ctx1) {$ctx1.fill(self,"isBindingGroup",{}, smalltalk.HLBindingGroup)})},
  421. args: [],
  422. source: "isBindingGroup\x0a\x09^ true",
  423. messageSends: [],
  424. referencedClasses: []
  425. }),
  426. smalltalk.HLBindingGroup);
  427. smalltalk.addMethod(
  428. "_renderOn_html_",
  429. smalltalk.method({
  430. selector: "renderOn:html:",
  431. category: 'rendering',
  432. fn: function (aBindingHelper,html){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) { _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  435. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html}, smalltalk.HLBindingGroup)})},
  436. args: ["aBindingHelper", "html"],
  437. source: "renderOn: aBindingHelper html: html\x0a\x09aBindingHelper renderBindingGroup: self on: html",
  438. messageSends: ["renderBindingGroup:on:"],
  439. referencedClasses: []
  440. }),
  441. smalltalk.HLBindingGroup);
  442. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'active', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  443. smalltalk.addMethod(
  444. "_activate",
  445. smalltalk.method({
  446. selector: "activate",
  447. category: 'actions',
  448. fn: function (){
  449. var self=this;
  450. return smalltalk.withContext(function($ctx1) { self["@active"]=true;
  451. _st(_st(self)._helper())._show();
  452. return self}, function($ctx1) {$ctx1.fill(self,"activate",{}, smalltalk.HLKeyBinder)})},
  453. args: [],
  454. source: "activate\x0a\x09active := true.\x0a\x09self helper show",
  455. messageSends: ["show", "helper"],
  456. referencedClasses: []
  457. }),
  458. smalltalk.HLKeyBinder);
  459. smalltalk.addMethod(
  460. "_activationKey",
  461. smalltalk.method({
  462. selector: "activationKey",
  463. category: 'accessing',
  464. fn: function (){
  465. var self=this;
  466. return smalltalk.withContext(function($ctx1) { return (32);
  467. }, function($ctx1) {$ctx1.fill(self,"activationKey",{}, smalltalk.HLKeyBinder)})},
  468. args: [],
  469. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  470. messageSends: [],
  471. referencedClasses: []
  472. }),
  473. smalltalk.HLKeyBinder);
  474. smalltalk.addMethod(
  475. "_activationKeyLabel",
  476. smalltalk.method({
  477. selector: "activationKeyLabel",
  478. category: 'accessing',
  479. fn: function (){
  480. var self=this;
  481. return smalltalk.withContext(function($ctx1) { return "ctrl + space";
  482. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{}, smalltalk.HLKeyBinder)})},
  483. args: [],
  484. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  485. messageSends: [],
  486. referencedClasses: []
  487. }),
  488. smalltalk.HLKeyBinder);
  489. smalltalk.addMethod(
  490. "_applyBinding_",
  491. smalltalk.method({
  492. selector: "applyBinding:",
  493. category: 'actions',
  494. fn: function (aBinding){
  495. var self=this;
  496. return smalltalk.withContext(function($ctx1) { _st(aBinding)._applyOn_(self);
  497. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding}, smalltalk.HLKeyBinder)})},
  498. args: ["aBinding"],
  499. source: "applyBinding: aBinding\x0a aBinding applyOn: self",
  500. messageSends: ["applyOn:"],
  501. referencedClasses: []
  502. }),
  503. smalltalk.HLKeyBinder);
  504. smalltalk.addMethod(
  505. "_applyBindingAction_",
  506. smalltalk.method({
  507. selector: "applyBindingAction:",
  508. category: 'actions',
  509. fn: function (aBinding){
  510. var self=this;
  511. return smalltalk.withContext(function($ctx1) { _st(_st(aBinding)._callback())._value();
  512. _st(self)._deactivate();
  513. return self}, function($ctx1) {$ctx1.fill(self,"applyBindingAction:",{aBinding:aBinding}, smalltalk.HLKeyBinder)})},
  514. args: ["aBinding"],
  515. source: "applyBindingAction: aBinding\x0a aBinding callback value.\x0a\x09self deactivate",
  516. messageSends: ["value", "callback", "deactivate"],
  517. referencedClasses: []
  518. }),
  519. smalltalk.HLKeyBinder);
  520. smalltalk.addMethod(
  521. "_applyBindingGroup_",
  522. smalltalk.method({
  523. selector: "applyBindingGroup:",
  524. category: 'actions',
  525. fn: function (aBinding){
  526. var self=this;
  527. return smalltalk.withContext(function($ctx1) { self["@selectedBinding"]=aBinding;
  528. _st(_st(self)._helper())._refresh();
  529. return self}, function($ctx1) {$ctx1.fill(self,"applyBindingGroup:",{aBinding:aBinding}, smalltalk.HLKeyBinder)})},
  530. args: ["aBinding"],
  531. source: "applyBindingGroup: aBinding\x0a selectedBinding := aBinding.\x0a self helper refresh",
  532. messageSends: ["refresh", "helper"],
  533. referencedClasses: []
  534. }),
  535. smalltalk.HLKeyBinder);
  536. smalltalk.addMethod(
  537. "_bindings",
  538. smalltalk.method({
  539. selector: "bindings",
  540. category: 'accessing',
  541. fn: function (){
  542. var self=this;
  543. return smalltalk.withContext(function($ctx1) { var $2,$1;
  544. $2=self["@bindings"];
  545. if(($receiver = $2) == nil || $receiver == undefined){
  546. self["@bindings"]=_st(self)._defaulBindings();
  547. $1=self["@bindings"];
  548. } else {
  549. $1=$2;
  550. };
  551. return $1;
  552. }, function($ctx1) {$ctx1.fill(self,"bindings",{}, smalltalk.HLKeyBinder)})},
  553. args: [],
  554. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaulBindings ]",
  555. messageSends: ["ifNil:", "defaulBindings"],
  556. referencedClasses: []
  557. }),
  558. smalltalk.HLKeyBinder);
  559. smalltalk.addMethod(
  560. "_deactivate",
  561. smalltalk.method({
  562. selector: "deactivate",
  563. category: 'actions',
  564. fn: function (){
  565. var self=this;
  566. return smalltalk.withContext(function($ctx1) { self["@active"]=false;
  567. self["@selectedBinding"]=nil;
  568. _st(_st(self)._helper())._hide();
  569. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{}, smalltalk.HLKeyBinder)})},
  570. args: [],
  571. source: "deactivate\x0a\x09active := false.\x0a selectedBinding := nil.\x0a\x09self helper hide",
  572. messageSends: ["hide", "helper"],
  573. referencedClasses: []
  574. }),
  575. smalltalk.HLKeyBinder);
  576. smalltalk.addMethod(
  577. "_defaulBindings",
  578. smalltalk.method({
  579. selector: "defaulBindings",
  580. category: 'accessing',
  581. fn: function (){
  582. var self=this;
  583. var group;
  584. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  585. $1=_st((smalltalk.HLBindingGroup || HLBindingGroup))._new();
  586. _st($1)._addGroupKey_labelled_((79),"Open");
  587. _st($1)._addGroupKey_labelled_((86),"View");
  588. _st($1)._add_(_st(_st((smalltalk.HLCloseTabCommand || HLCloseTabCommand))._new())._asBinding());
  589. $2=_st($1)._yourself();
  590. group=$2;
  591. _st(_st((smalltalk.HLOpenCommand || HLOpenCommand))._allSubclasses())._do_((function(each){
  592. return smalltalk.withContext(function($ctx2) { return _st(_st(group)._at_(_st(each)._bindingGroup()))._add_(_st(_st(each)._new())._asBinding());
  593. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  594. $3=group;
  595. return $3;
  596. }, function($ctx1) {$ctx1.fill(self,"defaulBindings",{group:group}, smalltalk.HLKeyBinder)})},
  597. args: [],
  598. source: "defaulBindings\x0a\x09| group |\x0a\x09\x0a\x09group := HLBindingGroup new\x0a\x09\x09addGroupKey: 79 labelled: 'Open';\x0a\x09\x09addGroupKey: 86 labelled: 'View';\x0a\x09\x09add: HLCloseTabCommand new asBinding;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09HLOpenCommand allSubclasses do: [ :each | \x0a\x09\x09(group at: each bindingGroup) \x0a \x09\x09\x09add: each new asBinding ].\x0a\x09\x09\x09\x09\x0a\x09^ group",
  599. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "do:", "at:", "bindingGroup", "allSubclasses"],
  600. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLOpenCommand"]
  601. }),
  602. smalltalk.HLKeyBinder);
  603. smalltalk.addMethod(
  604. "_escapeKey",
  605. smalltalk.method({
  606. selector: "escapeKey",
  607. category: 'accessing',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) { return (27);
  611. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{}, smalltalk.HLKeyBinder)})},
  612. args: [],
  613. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  614. messageSends: [],
  615. referencedClasses: []
  616. }),
  617. smalltalk.HLKeyBinder);
  618. smalltalk.addMethod(
  619. "_flushBindings",
  620. smalltalk.method({
  621. selector: "flushBindings",
  622. category: 'actions',
  623. fn: function (){
  624. var self=this;
  625. return smalltalk.withContext(function($ctx1) { self["@bindings"]=nil;
  626. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{}, smalltalk.HLKeyBinder)})},
  627. args: [],
  628. source: "flushBindings\x0a\x09bindings := nil",
  629. messageSends: [],
  630. referencedClasses: []
  631. }),
  632. smalltalk.HLKeyBinder);
  633. smalltalk.addMethod(
  634. "_handleActiveKeyDown_",
  635. smalltalk.method({
  636. selector: "handleActiveKeyDown:",
  637. category: 'events',
  638. fn: function (event){
  639. var self=this;
  640. return smalltalk.withContext(function($ctx1) { var $1,$2;
  641. $1=_st(_st(_st(event)._which()).__eq(_st(self)._escapeKey()))._or_((function(){
  642. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  643. return smalltalk.withContext(function($ctx3) { return _st(event)._ctrlKey();
  644. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  646. if(smalltalk.assert($1)){
  647. _st(self)._deactivate();
  648. _st(event)._preventDefault();
  649. return false;
  650. };
  651. $2=_st(self)._handleBindingFor_(event);
  652. return $2;
  653. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  654. args: ["event"],
  655. 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",
  656. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  657. referencedClasses: []
  658. }),
  659. smalltalk.HLKeyBinder);
  660. smalltalk.addMethod(
  661. "_handleBindingFor_",
  662. smalltalk.method({
  663. selector: "handleBindingFor:",
  664. category: 'events',
  665. fn: function (anEvent){
  666. var self=this;
  667. var binding;
  668. return smalltalk.withContext(function($ctx1) { var $1;
  669. binding=_st(_st(self)._selectedBinding())._atKey_(_st(anEvent)._which());
  670. $1=binding;
  671. if(($receiver = $1) == nil || $receiver == undefined){
  672. $1;
  673. } else {
  674. _st(self)._applyBinding_(binding);
  675. _st(anEvent)._preventDefault();
  676. return false;
  677. };
  678. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding}, smalltalk.HLKeyBinder)})},
  679. args: ["anEvent"],
  680. 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 ]",
  681. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  682. referencedClasses: []
  683. }),
  684. smalltalk.HLKeyBinder);
  685. smalltalk.addMethod(
  686. "_handleInactiveKeyDown_",
  687. smalltalk.method({
  688. selector: "handleInactiveKeyDown:",
  689. category: 'events',
  690. fn: function (event){
  691. var self=this;
  692. return smalltalk.withContext(function($ctx1) { var $1,$2;
  693. $1=_st(_st(event)._which()).__eq(_st(self)._activationKey());
  694. if(smalltalk.assert($1)){
  695. $2=_st(event)._ctrlKey();
  696. if(smalltalk.assert($2)){
  697. _st(self)._activate();
  698. _st(event)._preventDefault();
  699. return false;
  700. };
  701. };
  702. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  703. args: ["event"],
  704. 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 ] ]",
  705. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  706. referencedClasses: []
  707. }),
  708. smalltalk.HLKeyBinder);
  709. smalltalk.addMethod(
  710. "_handleKeyDown_",
  711. smalltalk.method({
  712. selector: "handleKeyDown:",
  713. category: 'events',
  714. fn: function (event){
  715. var self=this;
  716. return smalltalk.withContext(function($ctx1) { var $2,$1;
  717. $2=_st(self)._isActive();
  718. if(smalltalk.assert($2)){
  719. $1=_st(self)._handleActiveKeyDown_(event);
  720. } else {
  721. $1=_st(self)._handleInactiveKeyDown_(event);
  722. };
  723. return $1;
  724. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  725. args: ["event"],
  726. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  727. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  728. referencedClasses: []
  729. }),
  730. smalltalk.HLKeyBinder);
  731. smalltalk.addMethod(
  732. "_helper",
  733. smalltalk.method({
  734. selector: "helper",
  735. category: 'accessing',
  736. fn: function (){
  737. var self=this;
  738. return smalltalk.withContext(function($ctx1) { var $1;
  739. $1=self["@helper"];
  740. return $1;
  741. }, function($ctx1) {$ctx1.fill(self,"helper",{}, smalltalk.HLKeyBinder)})},
  742. args: [],
  743. source: "helper\x0a\x09^ helper",
  744. messageSends: [],
  745. referencedClasses: []
  746. }),
  747. smalltalk.HLKeyBinder);
  748. smalltalk.addMethod(
  749. "_initialize",
  750. smalltalk.method({
  751. selector: "initialize",
  752. category: 'initialization',
  753. fn: function (){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  756. self["@helper"]=_st((smalltalk.HLKeyBinderHelper || HLKeyBinderHelper))._on_(self);
  757. _st(self["@helper"])._renderStart();
  758. self["@active"]=false;
  759. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLKeyBinder)})},
  760. args: [],
  761. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper renderStart.\x0a active := false",
  762. messageSends: ["initialize", "on:", "renderStart"],
  763. referencedClasses: ["HLKeyBinderHelper"]
  764. }),
  765. smalltalk.HLKeyBinder);
  766. smalltalk.addMethod(
  767. "_isActive",
  768. smalltalk.method({
  769. selector: "isActive",
  770. category: 'testing',
  771. fn: function (){
  772. var self=this;
  773. return smalltalk.withContext(function($ctx1) { var $2,$1;
  774. $2=self["@active"];
  775. if(($receiver = $2) == nil || $receiver == undefined){
  776. $1=false;
  777. } else {
  778. $1=$2;
  779. };
  780. return $1;
  781. }, function($ctx1) {$ctx1.fill(self,"isActive",{}, smalltalk.HLKeyBinder)})},
  782. args: [],
  783. source: "isActive\x0a\x09^ active ifNil: [ false ]",
  784. messageSends: ["ifNil:"],
  785. referencedClasses: []
  786. }),
  787. smalltalk.HLKeyBinder);
  788. smalltalk.addMethod(
  789. "_selectedBinding",
  790. smalltalk.method({
  791. selector: "selectedBinding",
  792. category: 'accessing',
  793. fn: function (){
  794. var self=this;
  795. return smalltalk.withContext(function($ctx1) { var $2,$1;
  796. $2=self["@selectedBinding"];
  797. if(($receiver = $2) == nil || $receiver == undefined){
  798. $1=_st(self)._bindings();
  799. } else {
  800. $1=$2;
  801. };
  802. return $1;
  803. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{}, smalltalk.HLKeyBinder)})},
  804. args: [],
  805. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  806. messageSends: ["ifNil:", "bindings"],
  807. referencedClasses: []
  808. }),
  809. smalltalk.HLKeyBinder);
  810. smalltalk.addMethod(
  811. "_setupEvents",
  812. smalltalk.method({
  813. selector: "setupEvents",
  814. category: 'events',
  815. fn: function (){
  816. var self=this;
  817. return smalltalk.withContext(function($ctx1) { _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  818. return smalltalk.withContext(function($ctx2) { return _st(self)._handleKeyDown_(event);
  819. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  820. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{}, smalltalk.HLKeyBinder)})},
  821. args: [],
  822. source: "setupEvents\x0a\x09(window jQuery: 'body') keydown: [ :event | self handleKeyDown: event ]",
  823. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"],
  824. referencedClasses: []
  825. }),
  826. smalltalk.HLKeyBinder);
  827. smalltalk.addMethod(
  828. "_systemIsMac",
  829. smalltalk.method({
  830. selector: "systemIsMac",
  831. category: 'testing',
  832. fn: function (){
  833. var self=this;
  834. return smalltalk.withContext(function($ctx1) { var $1;
  835. $1=_st(_st(navigator)._platform())._match_("Mac");
  836. return $1;
  837. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{}, smalltalk.HLKeyBinder)})},
  838. args: [],
  839. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  840. messageSends: ["match:", "platform"],
  841. referencedClasses: []
  842. }),
  843. smalltalk.HLKeyBinder);
  844. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  845. smalltalk.addMethod(
  846. "_cssClass",
  847. smalltalk.method({
  848. selector: "cssClass",
  849. category: 'accessing',
  850. fn: function (){
  851. var self=this;
  852. return smalltalk.withContext(function($ctx1) { return "key_helper";
  853. }, function($ctx1) {$ctx1.fill(self,"cssClass",{}, smalltalk.HLKeyBinderHelper)})},
  854. args: [],
  855. source: "cssClass\x0a\x09^ 'key_helper'",
  856. messageSends: [],
  857. referencedClasses: []
  858. }),
  859. smalltalk.HLKeyBinderHelper);
  860. smalltalk.addMethod(
  861. "_hide",
  862. smalltalk.method({
  863. selector: "hide",
  864. category: 'actions',
  865. fn: function (){
  866. var self=this;
  867. return smalltalk.withContext(function($ctx1) { _st(_st(_st(".").__comma(_st(self)._cssClass()))._asJQuery())._remove();
  868. return self}, function($ctx1) {$ctx1.fill(self,"hide",{}, smalltalk.HLKeyBinderHelper)})},
  869. args: [],
  870. source: "hide\x0a\x09('.', self cssClass) asJQuery remove",
  871. messageSends: ["remove", "asJQuery", ",", "cssClass"],
  872. referencedClasses: []
  873. }),
  874. smalltalk.HLKeyBinderHelper);
  875. smalltalk.addMethod(
  876. "_keyBinder",
  877. smalltalk.method({
  878. selector: "keyBinder",
  879. category: 'accessing',
  880. fn: function (){
  881. var self=this;
  882. return smalltalk.withContext(function($ctx1) { var $1;
  883. $1=self["@keyBinder"];
  884. return $1;
  885. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{}, smalltalk.HLKeyBinderHelper)})},
  886. args: [],
  887. source: "keyBinder\x0a\x09^ keyBinder",
  888. messageSends: [],
  889. referencedClasses: []
  890. }),
  891. smalltalk.HLKeyBinderHelper);
  892. smalltalk.addMethod(
  893. "_keyBinder_",
  894. smalltalk.method({
  895. selector: "keyBinder:",
  896. category: 'accessing',
  897. fn: function (aKeyBinder){
  898. var self=this;
  899. return smalltalk.withContext(function($ctx1) { self["@keyBinder"]=aKeyBinder;
  900. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder}, smalltalk.HLKeyBinderHelper)})},
  901. args: ["aKeyBinder"],
  902. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  903. messageSends: [],
  904. referencedClasses: []
  905. }),
  906. smalltalk.HLKeyBinderHelper);
  907. smalltalk.addMethod(
  908. "_registerBindings",
  909. smalltalk.method({
  910. selector: "registerBindings",
  911. category: 'keyBindings',
  912. fn: function (){
  913. var self=this;
  914. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{}, smalltalk.HLKeyBinderHelper)})},
  915. args: [],
  916. source: "registerBindings\x0a\x09\x22Do nothing\x22",
  917. messageSends: [],
  918. referencedClasses: []
  919. }),
  920. smalltalk.HLKeyBinderHelper);
  921. smalltalk.addMethod(
  922. "_renderBindingGroup_on_",
  923. smalltalk.method({
  924. selector: "renderBindingGroup:on:",
  925. category: 'rendering',
  926. fn: function (aBindingGroup,html){
  927. var self=this;
  928. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$2;
  929. _st(_st(_st(aBindingGroup)._bindings())._sorted_((function(a,b){
  930. return smalltalk.withContext(function($ctx2) { return _st(_st(a)._key()).__lt(_st(b)._key());
  931. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  932. return smalltalk.withContext(function($ctx2) { $1=_st(html)._span();
  933. _st($1)._class_("command");
  934. $2=_st($1)._with_((function(){
  935. return smalltalk.withContext(function($ctx3) { $3=_st(html)._span();
  936. _st($3)._class_("label");
  937. $4=_st($3)._with_(_st(_st(each)._shortcut())._asLowercase());
  938. $4;
  939. $5=_st(html)._a();
  940. _st($5)._class_("action");
  941. _st($5)._with_(_st(each)._displayLabel());
  942. $6=_st($5)._onClick_((function(){
  943. return smalltalk.withContext(function($ctx4) { return _st(_st(self)._keyBinder())._applyBinding_(each);
  944. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  945. return $6;
  946. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  947. return $2;
  948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  949. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html}, smalltalk.HLKeyBinderHelper)})},
  950. args: ["aBindingGroup", "html"],
  951. source: "renderBindingGroup: aBindingGroup on: html\x0a\x09(aBindingGroup bindings \x0a \x09sorted: [ :a :b | a key < b key ])\x0a do: [ :each |\x0a\x09\x09\x09html span class: 'command'; with: [\x0a\x09\x09\x09\x09html span class: 'label'; with: each shortcut asLowercase.\x0a \x09\x09\x09\x09html a \x0a \x09class: 'action'; \x0a with: each displayLabel;\x0a \x09\x09\x09\x09\x09onClick: [ self keyBinder applyBinding: each ] ] ]",
  952. messageSends: ["do:", "class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:", "keyBinder", "sorted:", "<", "key", "bindings"],
  953. referencedClasses: []
  954. }),
  955. smalltalk.HLKeyBinderHelper);
  956. smalltalk.addMethod(
  957. "_renderBindingOn_",
  958. smalltalk.method({
  959. selector: "renderBindingOn:",
  960. category: 'rendering',
  961. fn: function (html){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) { _st(_st(self)._selectedBinding())._renderOn_html_(self,html);
  964. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  965. args: ["html"],
  966. source: "renderBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  967. messageSends: ["renderOn:html:", "selectedBinding"],
  968. referencedClasses: []
  969. }),
  970. smalltalk.HLKeyBinderHelper);
  971. smalltalk.addMethod(
  972. "_renderContentOn_",
  973. smalltalk.method({
  974. selector: "renderContentOn:",
  975. category: 'rendering',
  976. fn: function (html){
  977. var self=this;
  978. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  979. $1=_st(html)._div();
  980. _st($1)._class_(_st(self)._cssClass());
  981. $2=_st($1)._with_((function(){
  982. return smalltalk.withContext(function($ctx2) { $3=self;
  983. _st($3)._renderSelectionOn_(html);
  984. $4=_st($3)._renderBindingOn_(html);
  985. return $4;
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  987. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  988. args: ["html"],
  989. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderSelectionOn:html;\x0a \x09renderBindingOn: html ]",
  990. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:"],
  991. referencedClasses: []
  992. }),
  993. smalltalk.HLKeyBinderHelper);
  994. smalltalk.addMethod(
  995. "_renderSelectionOn_",
  996. smalltalk.method({
  997. selector: "renderSelectionOn:",
  998. category: 'rendering',
  999. fn: function (html){
  1000. var self=this;
  1001. return smalltalk.withContext(function($ctx1) { var $1,$3,$5,$4,$2;
  1002. $1=_st(html)._span();
  1003. _st($1)._class_("selected");
  1004. $3=$1;
  1005. $5=_st(_st(self)._selectedBinding())._label();
  1006. if(($receiver = $5) == nil || $receiver == undefined){
  1007. $4="Action";
  1008. } else {
  1009. $4=$5;
  1010. };
  1011. $2=_st($3)._with_($4);
  1012. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  1013. args: ["html"],
  1014. source: "renderSelectionOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  1015. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.HLKeyBinderHelper);
  1019. smalltalk.addMethod(
  1020. "_renderStart",
  1021. smalltalk.method({
  1022. selector: "renderStart",
  1023. category: 'rendering',
  1024. fn: function (){
  1025. var self=this;
  1026. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1027. _st((function(html){
  1028. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1029. _st($1)._id_("keybinding-start-helper");
  1030. $2=_st($1)._with_(_st(_st("Press ").__comma(_st(_st(self)._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1031. return $2;
  1032. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1033. _st((function(){
  1034. return smalltalk.withContext(function($ctx2) { return _st(_st(window)._jQuery_("#keybinding-start-helper"))._fadeOut_((1000));
  1035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1036. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{}, smalltalk.HLKeyBinderHelper)})},
  1037. args: [],
  1038. 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",
  1039. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:", "jQuery:"],
  1040. referencedClasses: []
  1041. }),
  1042. smalltalk.HLKeyBinderHelper);
  1043. smalltalk.addMethod(
  1044. "_selectedBinding",
  1045. smalltalk.method({
  1046. selector: "selectedBinding",
  1047. category: 'accessing',
  1048. fn: function (){
  1049. var self=this;
  1050. return smalltalk.withContext(function($ctx1) { var $1;
  1051. $1=_st(_st(self)._keyBinder())._selectedBinding();
  1052. return $1;
  1053. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{}, smalltalk.HLKeyBinderHelper)})},
  1054. args: [],
  1055. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1056. messageSends: ["selectedBinding", "keyBinder"],
  1057. referencedClasses: []
  1058. }),
  1059. smalltalk.HLKeyBinderHelper);
  1060. smalltalk.addMethod(
  1061. "_show",
  1062. smalltalk.method({
  1063. selector: "show",
  1064. category: 'actions',
  1065. fn: function (){
  1066. var self=this;
  1067. return smalltalk.withContext(function($ctx1) { _st(self)._appendToJQuery_(_st("body")._asJQuery());
  1068. return self}, function($ctx1) {$ctx1.fill(self,"show",{}, smalltalk.HLKeyBinderHelper)})},
  1069. args: [],
  1070. source: "show\x0a\x09self appendToJQuery: 'body' asJQuery",
  1071. messageSends: ["appendToJQuery:", "asJQuery"],
  1072. referencedClasses: []
  1073. }),
  1074. smalltalk.HLKeyBinderHelper);
  1075. smalltalk.addMethod(
  1076. "_on_",
  1077. smalltalk.method({
  1078. selector: "on:",
  1079. category: 'instance creation',
  1080. fn: function (aKeyBinder){
  1081. var self=this;
  1082. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1083. $2=_st(self)._new();
  1084. _st($2)._keyBinder_(aKeyBinder);
  1085. $3=_st($2)._yourself();
  1086. $1=$3;
  1087. return $1;
  1088. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder}, smalltalk.HLKeyBinderHelper.klass)})},
  1089. args: ["aKeyBinder"],
  1090. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1091. messageSends: ["keyBinder:", "new", "yourself"],
  1092. referencedClasses: []
  1093. }),
  1094. smalltalk.HLKeyBinderHelper.klass);