Helios-KeyBindings.js 36 KB

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