Helios-KeyBindings.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  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(self)._defaulBindings();
  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 := self defaulBindings ]",
  521. messageSends: ["ifNil:", "defaulBindings"],
  522. referencedClasses: []
  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. "_defaulBindings",
  544. smalltalk.method({
  545. selector: "defaulBindings",
  546. category: 'accessing',
  547. fn: function (){
  548. var self=this;
  549. var group;
  550. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  551. $1=_st((smalltalk.HLBindingGroup || HLBindingGroup))._new();
  552. _st($1)._addGroupKey_labelled_((79),"Open");
  553. _st($1)._addGroupKey_labelled_((86),"View");
  554. _st($1)._add_(_st(_st((smalltalk.HLCloseTabCommand || HLCloseTabCommand))._new())._asBinding());
  555. $2=_st($1)._yourself();
  556. group=$2;
  557. _st(_st((smalltalk.HLOpenCommand || HLOpenCommand))._allSubclasses())._do_((function(each){
  558. return smalltalk.withContext(function($ctx2) { return _st(_st(group)._at_(_st(each)._bindingGroup()))._add_(_st(_st(each)._new())._asBinding());
  559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  560. $3=group;
  561. return $3;
  562. }, function($ctx1) {$ctx1.fill(self,"defaulBindings",{group:group}, smalltalk.HLKeyBinder)})},
  563. args: [],
  564. 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",
  565. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "do:", "at:", "bindingGroup", "allSubclasses"],
  566. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLOpenCommand"]
  567. }),
  568. smalltalk.HLKeyBinder);
  569. smalltalk.addMethod(
  570. "_escapeKey",
  571. smalltalk.method({
  572. selector: "escapeKey",
  573. category: 'accessing',
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) { return (27);
  577. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{}, smalltalk.HLKeyBinder)})},
  578. args: [],
  579. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  580. messageSends: [],
  581. referencedClasses: []
  582. }),
  583. smalltalk.HLKeyBinder);
  584. smalltalk.addMethod(
  585. "_flushBindings",
  586. smalltalk.method({
  587. selector: "flushBindings",
  588. category: 'actions',
  589. fn: function (){
  590. var self=this;
  591. return smalltalk.withContext(function($ctx1) { self["@bindings"]=nil;
  592. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{}, smalltalk.HLKeyBinder)})},
  593. args: [],
  594. source: "flushBindings\x0a\x09bindings := nil",
  595. messageSends: [],
  596. referencedClasses: []
  597. }),
  598. smalltalk.HLKeyBinder);
  599. smalltalk.addMethod(
  600. "_handleActiveKeyDown_",
  601. smalltalk.method({
  602. selector: "handleActiveKeyDown:",
  603. category: 'events',
  604. fn: function (event){
  605. var self=this;
  606. return smalltalk.withContext(function($ctx1) { var $1,$2;
  607. $1=_st(_st(_st(event)._which()).__eq(_st(self)._escapeKey()))._or_((function(){
  608. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  609. return smalltalk.withContext(function($ctx3) { return _st(event)._ctrlKey();
  610. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  612. if(smalltalk.assert($1)){
  613. _st(self)._deactivate();
  614. _st(event)._preventDefault();
  615. return false;
  616. };
  617. $2=_st(self)._handleBindingFor_(event);
  618. return $2;
  619. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  620. args: ["event"],
  621. 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",
  622. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  623. referencedClasses: []
  624. }),
  625. smalltalk.HLKeyBinder);
  626. smalltalk.addMethod(
  627. "_handleBindingFor_",
  628. smalltalk.method({
  629. selector: "handleBindingFor:",
  630. category: 'events',
  631. fn: function (anEvent){
  632. var self=this;
  633. var binding;
  634. return smalltalk.withContext(function($ctx1) { var $1;
  635. binding=_st(_st(self)._selectedBinding())._atKey_(_st(anEvent)._which());
  636. $1=binding;
  637. if(($receiver = $1) == nil || $receiver == undefined){
  638. $1;
  639. } else {
  640. _st(self)._applyBinding_(binding);
  641. _st(anEvent)._preventDefault();
  642. return false;
  643. };
  644. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding}, smalltalk.HLKeyBinder)})},
  645. args: ["anEvent"],
  646. 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 ]",
  647. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  648. referencedClasses: []
  649. }),
  650. smalltalk.HLKeyBinder);
  651. smalltalk.addMethod(
  652. "_handleInactiveKeyDown_",
  653. smalltalk.method({
  654. selector: "handleInactiveKeyDown:",
  655. category: 'events',
  656. fn: function (event){
  657. var self=this;
  658. return smalltalk.withContext(function($ctx1) { var $1,$2;
  659. $1=_st(_st(event)._which()).__eq(_st(self)._activationKey());
  660. if(smalltalk.assert($1)){
  661. $2=_st(event)._ctrlKey();
  662. if(smalltalk.assert($2)){
  663. _st(self)._activate();
  664. _st(event)._preventDefault();
  665. return false;
  666. };
  667. };
  668. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  669. args: ["event"],
  670. 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 ] ]",
  671. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  672. referencedClasses: []
  673. }),
  674. smalltalk.HLKeyBinder);
  675. smalltalk.addMethod(
  676. "_handleKeyDown_",
  677. smalltalk.method({
  678. selector: "handleKeyDown:",
  679. category: 'events',
  680. fn: function (event){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) { var $2,$1;
  683. $2=_st(self)._isActive();
  684. if(smalltalk.assert($2)){
  685. $1=_st(self)._handleActiveKeyDown_(event);
  686. } else {
  687. $1=_st(self)._handleInactiveKeyDown_(event);
  688. };
  689. return $1;
  690. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  691. args: ["event"],
  692. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  693. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.HLKeyBinder);
  697. smalltalk.addMethod(
  698. "_helper",
  699. smalltalk.method({
  700. selector: "helper",
  701. category: 'accessing',
  702. fn: function (){
  703. var self=this;
  704. return smalltalk.withContext(function($ctx1) { var $1;
  705. $1=self["@helper"];
  706. return $1;
  707. }, function($ctx1) {$ctx1.fill(self,"helper",{}, smalltalk.HLKeyBinder)})},
  708. args: [],
  709. source: "helper\x0a\x09^ helper",
  710. messageSends: [],
  711. referencedClasses: []
  712. }),
  713. smalltalk.HLKeyBinder);
  714. smalltalk.addMethod(
  715. "_initialize",
  716. smalltalk.method({
  717. selector: "initialize",
  718. category: 'initialization',
  719. fn: function (){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  722. self["@helper"]=_st((smalltalk.HLKeyBinderHelper || HLKeyBinderHelper))._on_(self);
  723. _st(self["@helper"])._renderStart();
  724. self["@active"]=false;
  725. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLKeyBinder)})},
  726. args: [],
  727. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper renderStart.\x0a active := false",
  728. messageSends: ["initialize", "on:", "renderStart"],
  729. referencedClasses: ["HLKeyBinderHelper"]
  730. }),
  731. smalltalk.HLKeyBinder);
  732. smalltalk.addMethod(
  733. "_isActive",
  734. smalltalk.method({
  735. selector: "isActive",
  736. category: 'testing',
  737. fn: function (){
  738. var self=this;
  739. return smalltalk.withContext(function($ctx1) { var $2,$1;
  740. $2=self["@active"];
  741. if(($receiver = $2) == nil || $receiver == undefined){
  742. $1=false;
  743. } else {
  744. $1=$2;
  745. };
  746. return $1;
  747. }, function($ctx1) {$ctx1.fill(self,"isActive",{}, smalltalk.HLKeyBinder)})},
  748. args: [],
  749. source: "isActive\x0a\x09^ active ifNil: [ false ]",
  750. messageSends: ["ifNil:"],
  751. referencedClasses: []
  752. }),
  753. smalltalk.HLKeyBinder);
  754. smalltalk.addMethod(
  755. "_selectedBinding",
  756. smalltalk.method({
  757. selector: "selectedBinding",
  758. category: 'accessing',
  759. fn: function (){
  760. var self=this;
  761. return smalltalk.withContext(function($ctx1) { var $2,$1;
  762. $2=self["@selectedBinding"];
  763. if(($receiver = $2) == nil || $receiver == undefined){
  764. $1=_st(self)._bindings();
  765. } else {
  766. $1=$2;
  767. };
  768. return $1;
  769. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{}, smalltalk.HLKeyBinder)})},
  770. args: [],
  771. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  772. messageSends: ["ifNil:", "bindings"],
  773. referencedClasses: []
  774. }),
  775. smalltalk.HLKeyBinder);
  776. smalltalk.addMethod(
  777. "_setupEvents",
  778. smalltalk.method({
  779. selector: "setupEvents",
  780. category: 'events',
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) { _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  784. return smalltalk.withContext(function($ctx2) { return _st(self)._handleKeyDown_(event);
  785. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  786. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{}, smalltalk.HLKeyBinder)})},
  787. args: [],
  788. source: "setupEvents\x0a\x09(window jQuery: 'body') keydown: [ :event | self handleKeyDown: event ]",
  789. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"],
  790. referencedClasses: []
  791. }),
  792. smalltalk.HLKeyBinder);
  793. smalltalk.addMethod(
  794. "_systemIsMac",
  795. smalltalk.method({
  796. selector: "systemIsMac",
  797. category: 'testing',
  798. fn: function (){
  799. var self=this;
  800. return smalltalk.withContext(function($ctx1) { var $1;
  801. $1=_st(_st(navigator)._platform())._match_("Mac");
  802. return $1;
  803. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{}, smalltalk.HLKeyBinder)})},
  804. args: [],
  805. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  806. messageSends: ["match:", "platform"],
  807. referencedClasses: []
  808. }),
  809. smalltalk.HLKeyBinder);
  810. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  811. smalltalk.addMethod(
  812. "_cssClass",
  813. smalltalk.method({
  814. selector: "cssClass",
  815. category: 'accessing',
  816. fn: function (){
  817. var self=this;
  818. return smalltalk.withContext(function($ctx1) { return "key_helper";
  819. }, function($ctx1) {$ctx1.fill(self,"cssClass",{}, smalltalk.HLKeyBinderHelper)})},
  820. args: [],
  821. source: "cssClass\x0a\x09^ 'key_helper'",
  822. messageSends: [],
  823. referencedClasses: []
  824. }),
  825. smalltalk.HLKeyBinderHelper);
  826. smalltalk.addMethod(
  827. "_hide",
  828. smalltalk.method({
  829. selector: "hide",
  830. category: 'actions',
  831. fn: function (){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) { _st(_st(_st(".").__comma(_st(self)._cssClass()))._asJQuery())._remove();
  834. return self}, function($ctx1) {$ctx1.fill(self,"hide",{}, smalltalk.HLKeyBinderHelper)})},
  835. args: [],
  836. source: "hide\x0a\x09('.', self cssClass) asJQuery remove",
  837. messageSends: ["remove", "asJQuery", ",", "cssClass"],
  838. referencedClasses: []
  839. }),
  840. smalltalk.HLKeyBinderHelper);
  841. smalltalk.addMethod(
  842. "_keyBinder",
  843. smalltalk.method({
  844. selector: "keyBinder",
  845. category: 'accessing',
  846. fn: function (){
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) { var $1;
  849. $1=self["@keyBinder"];
  850. return $1;
  851. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{}, smalltalk.HLKeyBinderHelper)})},
  852. args: [],
  853. source: "keyBinder\x0a\x09^ keyBinder",
  854. messageSends: [],
  855. referencedClasses: []
  856. }),
  857. smalltalk.HLKeyBinderHelper);
  858. smalltalk.addMethod(
  859. "_keyBinder_",
  860. smalltalk.method({
  861. selector: "keyBinder:",
  862. category: 'accessing',
  863. fn: function (aKeyBinder){
  864. var self=this;
  865. return smalltalk.withContext(function($ctx1) { self["@keyBinder"]=aKeyBinder;
  866. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder}, smalltalk.HLKeyBinderHelper)})},
  867. args: ["aKeyBinder"],
  868. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  869. messageSends: [],
  870. referencedClasses: []
  871. }),
  872. smalltalk.HLKeyBinderHelper);
  873. smalltalk.addMethod(
  874. "_registerBindings",
  875. smalltalk.method({
  876. selector: "registerBindings",
  877. category: 'keyBindings',
  878. fn: function (){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{}, smalltalk.HLKeyBinderHelper)})},
  881. args: [],
  882. source: "registerBindings\x0a\x09\x22Do nothing\x22",
  883. messageSends: [],
  884. referencedClasses: []
  885. }),
  886. smalltalk.HLKeyBinderHelper);
  887. smalltalk.addMethod(
  888. "_renderBindingGroup_on_",
  889. smalltalk.method({
  890. selector: "renderBindingGroup:on:",
  891. category: 'rendering',
  892. fn: function (aBindingGroup,html){
  893. var self=this;
  894. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$2;
  895. _st(_st(_st(aBindingGroup)._bindings())._sorted_((function(a,b){
  896. return smalltalk.withContext(function($ctx2) { return _st(_st(a)._key()).__lt(_st(b)._key());
  897. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  898. return smalltalk.withContext(function($ctx2) { $1=_st(html)._span();
  899. _st($1)._class_("command");
  900. $2=_st($1)._with_((function(){
  901. return smalltalk.withContext(function($ctx3) { $3=_st(html)._span();
  902. _st($3)._class_("label");
  903. $4=_st($3)._with_(_st(_st(each)._shortcut())._asLowercase());
  904. $4;
  905. $5=_st(html)._a();
  906. _st($5)._class_("action");
  907. _st($5)._with_(_st(each)._label());
  908. $6=_st($5)._onClick_((function(){
  909. return smalltalk.withContext(function($ctx4) { return _st(_st(self)._keyBinder())._applyBinding_(each);
  910. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  911. return $6;
  912. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  913. return $2;
  914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  915. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html}, smalltalk.HLKeyBinderHelper)})},
  916. args: ["aBindingGroup", "html"],
  917. 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 ] ] ]",
  918. messageSends: ["do:", "class:", "span", "with:", "asLowercase", "shortcut", "a", "label", "onClick:", "applyBinding:", "keyBinder", "sorted:", "<", "key", "bindings"],
  919. referencedClasses: []
  920. }),
  921. smalltalk.HLKeyBinderHelper);
  922. smalltalk.addMethod(
  923. "_renderBindingOn_",
  924. smalltalk.method({
  925. selector: "renderBindingOn:",
  926. category: 'rendering',
  927. fn: function (html){
  928. var self=this;
  929. return smalltalk.withContext(function($ctx1) { _st(_st(self)._selectedBinding())._renderOn_html_(self,html);
  930. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  931. args: ["html"],
  932. source: "renderBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  933. messageSends: ["renderOn:html:", "selectedBinding"],
  934. referencedClasses: []
  935. }),
  936. smalltalk.HLKeyBinderHelper);
  937. smalltalk.addMethod(
  938. "_renderContentOn_",
  939. smalltalk.method({
  940. selector: "renderContentOn:",
  941. category: 'rendering',
  942. fn: function (html){
  943. var self=this;
  944. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  945. $1=_st(html)._div();
  946. _st($1)._class_(_st(self)._cssClass());
  947. $2=_st($1)._with_((function(){
  948. return smalltalk.withContext(function($ctx2) { $3=self;
  949. _st($3)._renderSelectionOn_(html);
  950. $4=_st($3)._renderBindingOn_(html);
  951. return $4;
  952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  953. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  954. args: ["html"],
  955. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderSelectionOn:html;\x0a \x09renderBindingOn: html ]",
  956. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:"],
  957. referencedClasses: []
  958. }),
  959. smalltalk.HLKeyBinderHelper);
  960. smalltalk.addMethod(
  961. "_renderSelectionOn_",
  962. smalltalk.method({
  963. selector: "renderSelectionOn:",
  964. category: 'rendering',
  965. fn: function (html){
  966. var self=this;
  967. return smalltalk.withContext(function($ctx1) { var $1,$3,$5,$4,$2;
  968. $1=_st(html)._span();
  969. _st($1)._class_("selected");
  970. $3=$1;
  971. $5=_st(_st(self)._selectedBinding())._label();
  972. if(($receiver = $5) == nil || $receiver == undefined){
  973. $4="Action";
  974. } else {
  975. $4=$5;
  976. };
  977. $2=_st($3)._with_($4);
  978. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  979. args: ["html"],
  980. source: "renderSelectionOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  981. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  982. referencedClasses: []
  983. }),
  984. smalltalk.HLKeyBinderHelper);
  985. smalltalk.addMethod(
  986. "_renderStart",
  987. smalltalk.method({
  988. selector: "renderStart",
  989. category: 'rendering',
  990. fn: function (){
  991. var self=this;
  992. return smalltalk.withContext(function($ctx1) { var $1,$2;
  993. _st((function(html){
  994. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  995. _st($1)._id_("keybinding-start-helper");
  996. $2=_st($1)._with_(_st(_st("Press ").__comma(_st(_st(self)._keyBinder())._activationKeyLabel())).__comma(" to start"));
  997. return $2;
  998. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  999. _st((function(){
  1000. return smalltalk.withContext(function($ctx2) { return _st(_st(window)._jQuery_("#keybinding-start-helper"))._fadeOut_((1000));
  1001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1002. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{}, smalltalk.HLKeyBinderHelper)})},
  1003. args: [],
  1004. 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",
  1005. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:", "jQuery:"],
  1006. referencedClasses: []
  1007. }),
  1008. smalltalk.HLKeyBinderHelper);
  1009. smalltalk.addMethod(
  1010. "_selectedBinding",
  1011. smalltalk.method({
  1012. selector: "selectedBinding",
  1013. category: 'accessing',
  1014. fn: function (){
  1015. var self=this;
  1016. return smalltalk.withContext(function($ctx1) { var $1;
  1017. $1=_st(_st(self)._keyBinder())._selectedBinding();
  1018. return $1;
  1019. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{}, smalltalk.HLKeyBinderHelper)})},
  1020. args: [],
  1021. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1022. messageSends: ["selectedBinding", "keyBinder"],
  1023. referencedClasses: []
  1024. }),
  1025. smalltalk.HLKeyBinderHelper);
  1026. smalltalk.addMethod(
  1027. "_show",
  1028. smalltalk.method({
  1029. selector: "show",
  1030. category: 'actions',
  1031. fn: function (){
  1032. var self=this;
  1033. return smalltalk.withContext(function($ctx1) { _st(self)._appendToJQuery_(_st("body")._asJQuery());
  1034. return self}, function($ctx1) {$ctx1.fill(self,"show",{}, smalltalk.HLKeyBinderHelper)})},
  1035. args: [],
  1036. source: "show\x0a\x09self appendToJQuery: 'body' asJQuery",
  1037. messageSends: ["appendToJQuery:", "asJQuery"],
  1038. referencedClasses: []
  1039. }),
  1040. smalltalk.HLKeyBinderHelper);
  1041. smalltalk.addMethod(
  1042. "_on_",
  1043. smalltalk.method({
  1044. selector: "on:",
  1045. category: 'instance creation',
  1046. fn: function (aKeyBinder){
  1047. var self=this;
  1048. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1049. $2=_st(self)._new();
  1050. _st($2)._keyBinder_(aKeyBinder);
  1051. $3=_st($2)._yourself();
  1052. $1=$3;
  1053. return $1;
  1054. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder}, smalltalk.HLKeyBinderHelper.klass)})},
  1055. args: ["aKeyBinder"],
  1056. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1057. messageSends: ["keyBinder:", "new", "yourself"],
  1058. referencedClasses: []
  1059. }),
  1060. smalltalk.HLKeyBinderHelper.klass);