1
0

Helios-KeyBindings.js 36 KB

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