Helios-KeyBindings.js 47 KB

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