Helios-KeyBindings.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428
  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.addMethod(
  325. "_on_labelled_activeBlock_",
  326. smalltalk.method({
  327. selector: "on:labelled:activeBlock:",
  328. category: 'instance creation',
  329. fn: function (anInteger,aString,aBlock){
  330. var self=this;
  331. var instance;
  332. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  333. instance=smalltalk.HLBinding.klass.fn.prototype._on_labelled_.apply(_st(self), [anInteger,aString]);
  334. $2=instance;
  335. _st($2)._activeBlock_(aBlock);
  336. $3=_st($2)._yourself();
  337. $1=$3;
  338. return $1;
  339. }, function($ctx1) {$ctx1.fill(self,"on:labelled:activeBlock:",{anInteger:anInteger,aString:aString,aBlock:aBlock,instance:instance},smalltalk.HLBindingAction.klass)})},
  340. args: ["anInteger", "aString", "aBlock"],
  341. source: "on: anInteger labelled: aString activeBlock: aBlock\x0a\x09| instance |\x0a\x09\x0a\x09instance := super on: anInteger labelled: aString.\x0a\x09^ instance \x0a\x09\x09activeBlock: aBlock;\x0a\x09\x09yourself",
  342. messageSends: ["on:labelled:", "activeBlock:", "yourself"],
  343. referencedClasses: []
  344. }),
  345. smalltalk.HLBindingAction.klass);
  346. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  347. smalltalk.addMethod(
  348. "_activeBindings",
  349. smalltalk.method({
  350. selector: "activeBindings",
  351. category: 'accessing',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) { var $1;
  355. $1=_st(_st(self)._bindings())._select_((function(each){
  356. return smalltalk.withContext(function($ctx2) { return _st(each)._isActive();
  357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  358. return $1;
  359. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  360. args: [],
  361. source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
  362. messageSends: ["select:", "isActive", "bindings"],
  363. referencedClasses: []
  364. }),
  365. smalltalk.HLBindingGroup);
  366. smalltalk.addMethod(
  367. "_add_",
  368. smalltalk.method({
  369. selector: "add:",
  370. category: 'accessing',
  371. fn: function (aBinding){
  372. var self=this;
  373. return smalltalk.withContext(function($ctx1) { var $1;
  374. $1=_st(_st(self)._bindings())._add_(aBinding);
  375. return $1;
  376. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding}, smalltalk.HLBindingGroup)})},
  377. args: ["aBinding"],
  378. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  379. messageSends: ["add:", "bindings"],
  380. referencedClasses: []
  381. }),
  382. smalltalk.HLBindingGroup);
  383. smalltalk.addMethod(
  384. "_addActionKey_labelled_callback_",
  385. smalltalk.method({
  386. selector: "addActionKey:labelled:callback:",
  387. category: 'accessing',
  388. fn: function (anInteger,aString,aBlock){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) { var $1,$2;
  391. $1=_st((smalltalk.HLBindingAction || HLBindingAction))._on_labelled_(anInteger,aString);
  392. _st($1)._callback_(aBlock);
  393. $2=_st($1)._yourself();
  394. _st(self)._add_($2);
  395. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock}, smalltalk.HLBindingGroup)})},
  396. args: ["anInteger", "aString", "aBlock"],
  397. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  398. messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
  399. referencedClasses: ["HLBindingAction"]
  400. }),
  401. smalltalk.HLBindingGroup);
  402. smalltalk.addMethod(
  403. "_addActionKey_labelled_command_",
  404. smalltalk.method({
  405. selector: "addActionKey:labelled:command:",
  406. category: 'accessing',
  407. fn: function (anInteger,aString,aCommand){
  408. var self=this;
  409. return smalltalk.withContext(function($ctx1) { var $1,$2;
  410. $1=_st((smalltalk.HLBindingAction || HLBindingAction))._on_labelled_(anInteger,aString);
  411. _st($1)._command_(aCommand);
  412. $2=_st($1)._yourself();
  413. _st(self)._add_($2);
  414. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:command:",{anInteger:anInteger,aString:aString,aCommand:aCommand}, smalltalk.HLBindingGroup)})},
  415. args: ["anInteger", "aString", "aCommand"],
  416. source: "addActionKey: anInteger labelled: aString command: aCommand\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09command: aCommand;\x0a yourself)",
  417. messageSends: ["add:", "command:", "on:labelled:", "yourself"],
  418. referencedClasses: ["HLBindingAction"]
  419. }),
  420. smalltalk.HLBindingGroup);
  421. smalltalk.addMethod(
  422. "_addGroupKey_labelled_",
  423. smalltalk.method({
  424. selector: "addGroupKey:labelled:",
  425. category: 'accessing',
  426. fn: function (anInteger,aString){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) { _st(self)._add_(_st((smalltalk.HLBindingGroup || HLBindingGroup))._on_labelled_(anInteger,aString));
  429. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString}, smalltalk.HLBindingGroup)})},
  430. args: ["anInteger", "aString"],
  431. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  432. messageSends: ["add:", "on:labelled:"],
  433. referencedClasses: ["HLBindingGroup"]
  434. }),
  435. smalltalk.HLBindingGroup);
  436. smalltalk.addMethod(
  437. "_applyOn_",
  438. smalltalk.method({
  439. selector: "applyOn:",
  440. category: 'actions',
  441. fn: function (aKeyBinder){
  442. var self=this;
  443. return smalltalk.withContext(function($ctx1) { var $1,$2;
  444. $1=_st(self)._isActive();
  445. if(! smalltalk.assert($1)){
  446. $2=self;
  447. return $2;
  448. };
  449. _st(aKeyBinder)._applyBindingGroup_(self);
  450. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingGroup)})},
  451. args: ["aKeyBinder"],
  452. source: "applyOn: aKeyBinder\x0a\x09self isActive ifFalse: [ ^ self ].\x0a\x09\x0a\x09aKeyBinder applyBindingGroup: self",
  453. messageSends: ["ifFalse:", "isActive", "applyBindingGroup:"],
  454. referencedClasses: []
  455. }),
  456. smalltalk.HLBindingGroup);
  457. smalltalk.addMethod(
  458. "_at_",
  459. smalltalk.method({
  460. selector: "at:",
  461. category: 'accessing',
  462. fn: function (aString){
  463. var self=this;
  464. return smalltalk.withContext(function($ctx1) { var $1;
  465. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  466. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._label()).__eq(aString);
  467. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  468. return smalltalk.withContext(function($ctx2) { return nil;
  469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  470. return $1;
  471. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString}, smalltalk.HLBindingGroup)})},
  472. args: ["aString"],
  473. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  474. messageSends: ["detect:ifNone:", "=", "label", "bindings"],
  475. referencedClasses: []
  476. }),
  477. smalltalk.HLBindingGroup);
  478. smalltalk.addMethod(
  479. "_at_add_",
  480. smalltalk.method({
  481. selector: "at:add:",
  482. category: 'accessing',
  483. fn: function (aString,aBinding){
  484. var self=this;
  485. var binding;
  486. return smalltalk.withContext(function($ctx1) { var $1,$2;
  487. binding=_st(self)._at_(aString);
  488. $1=binding;
  489. if(($receiver = $1) == nil || $receiver == undefined){
  490. $2=self;
  491. return $2;
  492. } else {
  493. $1;
  494. };
  495. _st(binding)._add_(aBinding);
  496. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  497. args: ["aString", "aBinding"],
  498. 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",
  499. messageSends: ["at:", "ifNil:", "add:"],
  500. referencedClasses: []
  501. }),
  502. smalltalk.HLBindingGroup);
  503. smalltalk.addMethod(
  504. "_atKey_",
  505. smalltalk.method({
  506. selector: "atKey:",
  507. category: 'accessing',
  508. fn: function (anInteger){
  509. var self=this;
  510. return smalltalk.withContext(function($ctx1) { var $1;
  511. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  512. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._key()).__eq(anInteger);
  513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  514. return smalltalk.withContext(function($ctx2) { return nil;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  516. return $1;
  517. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger}, smalltalk.HLBindingGroup)})},
  518. args: ["anInteger"],
  519. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  520. messageSends: ["detect:ifNone:", "=", "key", "bindings"],
  521. referencedClasses: []
  522. }),
  523. smalltalk.HLBindingGroup);
  524. smalltalk.addMethod(
  525. "_bindings",
  526. smalltalk.method({
  527. selector: "bindings",
  528. category: 'accessing',
  529. fn: function (){
  530. var self=this;
  531. return smalltalk.withContext(function($ctx1) { var $2,$1;
  532. $2=self["@bindings"];
  533. if(($receiver = $2) == nil || $receiver == undefined){
  534. self["@bindings"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  535. $1=self["@bindings"];
  536. } else {
  537. $1=$2;
  538. };
  539. return $1;
  540. }, function($ctx1) {$ctx1.fill(self,"bindings",{}, smalltalk.HLBindingGroup)})},
  541. args: [],
  542. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  543. messageSends: ["ifNil:", "new"],
  544. referencedClasses: ["OrderedCollection"]
  545. }),
  546. smalltalk.HLBindingGroup);
  547. smalltalk.addMethod(
  548. "_displayLabel",
  549. smalltalk.method({
  550. selector: "displayLabel",
  551. category: 'accessing',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) { var $1;
  555. $1=_st(smalltalk.HLBinding.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  556. return $1;
  557. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{}, smalltalk.HLBindingGroup)})},
  558. args: [],
  559. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  560. messageSends: [",", "displayLabel"],
  561. referencedClasses: []
  562. }),
  563. smalltalk.HLBindingGroup);
  564. smalltalk.addMethod(
  565. "_isActive",
  566. smalltalk.method({
  567. selector: "isActive",
  568. category: 'testing',
  569. fn: function (){
  570. var self=this;
  571. return smalltalk.withContext(function($ctx1) { var $1;
  572. $1=_st(_st(self)._activeBindings())._notEmpty();
  573. return $1;
  574. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  575. args: [],
  576. source: "isActive\x0a\x09^ self activeBindings notEmpty",
  577. messageSends: ["notEmpty", "activeBindings"],
  578. referencedClasses: []
  579. }),
  580. smalltalk.HLBindingGroup);
  581. smalltalk.addMethod(
  582. "_isBindingGroup",
  583. smalltalk.method({
  584. selector: "isBindingGroup",
  585. category: 'testing',
  586. fn: function (){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) { return true;
  589. }, function($ctx1) {$ctx1.fill(self,"isBindingGroup",{}, smalltalk.HLBindingGroup)})},
  590. args: [],
  591. source: "isBindingGroup\x0a\x09^ true",
  592. messageSends: [],
  593. referencedClasses: []
  594. }),
  595. smalltalk.HLBindingGroup);
  596. smalltalk.addMethod(
  597. "_renderOn_html_",
  598. smalltalk.method({
  599. selector: "renderOn:html:",
  600. category: 'rendering',
  601. fn: function (aBindingHelper,html){
  602. var self=this;
  603. return smalltalk.withContext(function($ctx1) { var $1;
  604. $1=_st(self)._isActive();
  605. if(smalltalk.assert($1)){
  606. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  607. };
  608. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  609. args: ["aBindingHelper", "html"],
  610. source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
  611. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"],
  612. referencedClasses: []
  613. }),
  614. smalltalk.HLBindingGroup);
  615. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  616. smalltalk.addMethod(
  617. "_activate",
  618. smalltalk.method({
  619. selector: "activate",
  620. category: 'actions',
  621. fn: function (){
  622. var self=this;
  623. return smalltalk.withContext(function($ctx1) { _st(_st(self)._helper())._show();
  624. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  625. args: [],
  626. source: "activate\x0a\x09self helper show",
  627. messageSends: ["show", "helper"],
  628. referencedClasses: []
  629. }),
  630. smalltalk.HLKeyBinder);
  631. smalltalk.addMethod(
  632. "_activationKey",
  633. smalltalk.method({
  634. selector: "activationKey",
  635. category: 'accessing',
  636. fn: function (){
  637. var self=this;
  638. return smalltalk.withContext(function($ctx1) { return (32);
  639. }, function($ctx1) {$ctx1.fill(self,"activationKey",{}, smalltalk.HLKeyBinder)})},
  640. args: [],
  641. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  642. messageSends: [],
  643. referencedClasses: []
  644. }),
  645. smalltalk.HLKeyBinder);
  646. smalltalk.addMethod(
  647. "_activationKeyLabel",
  648. smalltalk.method({
  649. selector: "activationKeyLabel",
  650. category: 'accessing',
  651. fn: function (){
  652. var self=this;
  653. return smalltalk.withContext(function($ctx1) { return "ctrl + space";
  654. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{}, smalltalk.HLKeyBinder)})},
  655. args: [],
  656. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  657. messageSends: [],
  658. referencedClasses: []
  659. }),
  660. smalltalk.HLKeyBinder);
  661. smalltalk.addMethod(
  662. "_applyBinding_",
  663. smalltalk.method({
  664. selector: "applyBinding:",
  665. category: 'actions',
  666. fn: function (aBinding){
  667. var self=this;
  668. return smalltalk.withContext(function($ctx1) { _st(aBinding)._applyOn_(self);
  669. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding}, smalltalk.HLKeyBinder)})},
  670. args: ["aBinding"],
  671. source: "applyBinding: aBinding\x0a aBinding applyOn: self",
  672. messageSends: ["applyOn:"],
  673. referencedClasses: []
  674. }),
  675. smalltalk.HLKeyBinder);
  676. smalltalk.addMethod(
  677. "_applyBindingAction_",
  678. smalltalk.method({
  679. selector: "applyBindingAction:",
  680. category: 'actions',
  681. fn: function (aBinding){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) { _st(_st(aBinding)._callback())._value();
  684. _st(self)._deactivate();
  685. return self}, function($ctx1) {$ctx1.fill(self,"applyBindingAction:",{aBinding:aBinding}, smalltalk.HLKeyBinder)})},
  686. args: ["aBinding"],
  687. source: "applyBindingAction: aBinding\x0a aBinding callback value.\x0a\x09self deactivate",
  688. messageSends: ["value", "callback", "deactivate"],
  689. referencedClasses: []
  690. }),
  691. smalltalk.HLKeyBinder);
  692. smalltalk.addMethod(
  693. "_applyBindingGroup_",
  694. smalltalk.method({
  695. selector: "applyBindingGroup:",
  696. category: 'actions',
  697. fn: function (aBinding){
  698. var self=this;
  699. return smalltalk.withContext(function($ctx1) { self["@selectedBinding"]=aBinding;
  700. _st(_st(self)._helper())._refresh();
  701. return self}, function($ctx1) {$ctx1.fill(self,"applyBindingGroup:",{aBinding:aBinding}, smalltalk.HLKeyBinder)})},
  702. args: ["aBinding"],
  703. source: "applyBindingGroup: aBinding\x0a selectedBinding := aBinding.\x0a self helper refresh",
  704. messageSends: ["refresh", "helper"],
  705. referencedClasses: []
  706. }),
  707. smalltalk.HLKeyBinder);
  708. smalltalk.addMethod(
  709. "_bindings",
  710. smalltalk.method({
  711. selector: "bindings",
  712. category: 'accessing',
  713. fn: function (){
  714. var self=this;
  715. return smalltalk.withContext(function($ctx1) { var $2,$1;
  716. $2=self["@bindings"];
  717. if(($receiver = $2) == nil || $receiver == undefined){
  718. self["@bindings"]=_st(self)._defaultBindings();
  719. $1=self["@bindings"];
  720. } else {
  721. $1=$2;
  722. };
  723. return $1;
  724. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLKeyBinder)})},
  725. args: [],
  726. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
  727. messageSends: ["ifNil:", "defaultBindings"],
  728. referencedClasses: []
  729. }),
  730. smalltalk.HLKeyBinder);
  731. smalltalk.addMethod(
  732. "_deactivate",
  733. smalltalk.method({
  734. selector: "deactivate",
  735. category: 'actions',
  736. fn: function (){
  737. var self=this;
  738. return smalltalk.withContext(function($ctx1) { self["@selectedBinding"]=nil;
  739. _st(_st(self)._helper())._hide();
  740. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},smalltalk.HLKeyBinder)})},
  741. args: [],
  742. source: "deactivate\x0a selectedBinding := nil.\x0a\x09self helper hide",
  743. messageSends: ["hide", "helper"],
  744. referencedClasses: []
  745. }),
  746. smalltalk.HLKeyBinder);
  747. smalltalk.addMethod(
  748. "_defaultBindings",
  749. smalltalk.method({
  750. selector: "defaultBindings",
  751. category: 'defaults',
  752. fn: function (){
  753. var self=this;
  754. var group;
  755. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  756. $1=_st((smalltalk.HLBindingGroup || HLBindingGroup))._new();
  757. _st($1)._addGroupKey_labelled_((86),"View");
  758. _st($1)._add_(_st(_st((smalltalk.HLCloseTabCommand || HLCloseTabCommand))._new())._asBinding());
  759. $2=_st($1)._yourself();
  760. group=$2;
  761. _st((smalltalk.HLOpenCommand || HLOpenCommand))._registerConcreteClassesOn_(group);
  762. $3=group;
  763. return $3;
  764. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  765. args: [],
  766. source: "defaultBindings\x0a\x09| group |\x0a\x09\x0a\x09group := HLBindingGroup new\x0a\x09\x09addGroupKey: 86 labelled: 'View';\x0a\x09\x09add: HLCloseTabCommand new asBinding;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09HLOpenCommand registerConcreteClassesOn: group.\x0a\x09\x09\x09\x09\x0a\x09^ group",
  767. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "registerConcreteClassesOn:"],
  768. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLOpenCommand"]
  769. }),
  770. smalltalk.HLKeyBinder);
  771. smalltalk.addMethod(
  772. "_escapeKey",
  773. smalltalk.method({
  774. selector: "escapeKey",
  775. category: 'accessing',
  776. fn: function (){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) { return (27);
  779. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{}, smalltalk.HLKeyBinder)})},
  780. args: [],
  781. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  782. messageSends: [],
  783. referencedClasses: []
  784. }),
  785. smalltalk.HLKeyBinder);
  786. smalltalk.addMethod(
  787. "_flushBindings",
  788. smalltalk.method({
  789. selector: "flushBindings",
  790. category: 'actions',
  791. fn: function (){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) { self["@bindings"]=nil;
  794. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{}, smalltalk.HLKeyBinder)})},
  795. args: [],
  796. source: "flushBindings\x0a\x09bindings := nil",
  797. messageSends: [],
  798. referencedClasses: []
  799. }),
  800. smalltalk.HLKeyBinder);
  801. smalltalk.addMethod(
  802. "_handleActiveKeyDown_",
  803. smalltalk.method({
  804. selector: "handleActiveKeyDown:",
  805. category: 'events',
  806. fn: function (event){
  807. var self=this;
  808. return smalltalk.withContext(function($ctx1) { var $1,$2;
  809. $1=_st(_st(_st(event)._which()).__eq(_st(self)._escapeKey()))._or_((function(){
  810. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  811. return smalltalk.withContext(function($ctx3) { return _st(event)._ctrlKey();
  812. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  814. if(smalltalk.assert($1)){
  815. _st(self)._deactivate();
  816. _st(event)._preventDefault();
  817. return false;
  818. };
  819. $2=_st(self)._handleBindingFor_(event);
  820. return $2;
  821. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  822. args: ["event"],
  823. 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",
  824. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  825. referencedClasses: []
  826. }),
  827. smalltalk.HLKeyBinder);
  828. smalltalk.addMethod(
  829. "_handleBindingFor_",
  830. smalltalk.method({
  831. selector: "handleBindingFor:",
  832. category: 'events',
  833. fn: function (anEvent){
  834. var self=this;
  835. var binding;
  836. return smalltalk.withContext(function($ctx1) { var $1;
  837. binding=_st(_st(self)._selectedBinding())._atKey_(_st(anEvent)._which());
  838. $1=binding;
  839. if(($receiver = $1) == nil || $receiver == undefined){
  840. $1;
  841. } else {
  842. _st(self)._applyBinding_(binding);
  843. _st(anEvent)._preventDefault();
  844. return false;
  845. };
  846. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding}, smalltalk.HLKeyBinder)})},
  847. args: ["anEvent"],
  848. 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 ]",
  849. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  850. referencedClasses: []
  851. }),
  852. smalltalk.HLKeyBinder);
  853. smalltalk.addMethod(
  854. "_handleInactiveKeyDown_",
  855. smalltalk.method({
  856. selector: "handleInactiveKeyDown:",
  857. category: 'events',
  858. fn: function (event){
  859. var self=this;
  860. return smalltalk.withContext(function($ctx1) { var $1,$2;
  861. $1=_st(_st(event)._which()).__eq(_st(self)._activationKey());
  862. if(smalltalk.assert($1)){
  863. $2=_st(event)._ctrlKey();
  864. if(smalltalk.assert($2)){
  865. _st(self)._activate();
  866. _st(event)._preventDefault();
  867. return false;
  868. };
  869. };
  870. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  871. args: ["event"],
  872. 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 ] ]",
  873. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  874. referencedClasses: []
  875. }),
  876. smalltalk.HLKeyBinder);
  877. smalltalk.addMethod(
  878. "_handleKeyDown_",
  879. smalltalk.method({
  880. selector: "handleKeyDown:",
  881. category: 'events',
  882. fn: function (event){
  883. var self=this;
  884. return smalltalk.withContext(function($ctx1) { var $2,$1;
  885. $2=_st(self)._isActive();
  886. if(smalltalk.assert($2)){
  887. $1=_st(self)._handleActiveKeyDown_(event);
  888. } else {
  889. $1=_st(self)._handleInactiveKeyDown_(event);
  890. };
  891. return $1;
  892. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event}, smalltalk.HLKeyBinder)})},
  893. args: ["event"],
  894. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  895. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  896. referencedClasses: []
  897. }),
  898. smalltalk.HLKeyBinder);
  899. smalltalk.addMethod(
  900. "_helper",
  901. smalltalk.method({
  902. selector: "helper",
  903. category: 'accessing',
  904. fn: function (){
  905. var self=this;
  906. return smalltalk.withContext(function($ctx1) { var $1;
  907. $1=self["@helper"];
  908. return $1;
  909. }, function($ctx1) {$ctx1.fill(self,"helper",{}, smalltalk.HLKeyBinder)})},
  910. args: [],
  911. source: "helper\x0a\x09^ helper",
  912. messageSends: [],
  913. referencedClasses: []
  914. }),
  915. smalltalk.HLKeyBinder);
  916. smalltalk.addMethod(
  917. "_initialize",
  918. smalltalk.method({
  919. selector: "initialize",
  920. category: 'initialization',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) { var $1,$2;
  924. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  925. self["@helper"]=_st((smalltalk.HLKeyBinderHelper || HLKeyBinderHelper))._on_(self);
  926. $1=self["@helper"];
  927. _st($1)._renderStart();
  928. $2=_st($1)._renderCog();
  929. self["@active"]=false;
  930. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  931. args: [],
  932. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper \x09\x0a\x09\x09renderStart;\x0a\x09\x09renderCog.\x0a active := false",
  933. messageSends: ["initialize", "on:", "renderStart", "renderCog"],
  934. referencedClasses: ["HLKeyBinderHelper"]
  935. }),
  936. smalltalk.HLKeyBinder);
  937. smalltalk.addMethod(
  938. "_isActive",
  939. smalltalk.method({
  940. selector: "isActive",
  941. category: 'testing',
  942. fn: function (){
  943. var self=this;
  944. return smalltalk.withContext(function($ctx1) { var $1;
  945. $1=_st(_st(_st(".").__comma(_st(_st(self)._helper())._cssClass()))._asJQuery())._is_(":visible");
  946. return $1;
  947. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  948. args: [],
  949. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  950. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"],
  951. referencedClasses: []
  952. }),
  953. smalltalk.HLKeyBinder);
  954. smalltalk.addMethod(
  955. "_selectedBinding",
  956. smalltalk.method({
  957. selector: "selectedBinding",
  958. category: 'accessing',
  959. fn: function (){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) { var $2,$1;
  962. $2=self["@selectedBinding"];
  963. if(($receiver = $2) == nil || $receiver == undefined){
  964. $1=_st(self)._bindings();
  965. } else {
  966. $1=$2;
  967. };
  968. return $1;
  969. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{}, smalltalk.HLKeyBinder)})},
  970. args: [],
  971. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  972. messageSends: ["ifNil:", "bindings"],
  973. referencedClasses: []
  974. }),
  975. smalltalk.HLKeyBinder);
  976. smalltalk.addMethod(
  977. "_setupEvents",
  978. smalltalk.method({
  979. selector: "setupEvents",
  980. category: 'events',
  981. fn: function (){
  982. var self=this;
  983. return smalltalk.withContext(function($ctx1) { _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  984. return smalltalk.withContext(function($ctx2) { return _st(self)._handleKeyDown_(event);
  985. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  986. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{}, smalltalk.HLKeyBinder)})},
  987. args: [],
  988. source: "setupEvents\x0a\x09(window jQuery: 'body') keydown: [ :event | self handleKeyDown: event ]",
  989. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"],
  990. referencedClasses: []
  991. }),
  992. smalltalk.HLKeyBinder);
  993. smalltalk.addMethod(
  994. "_systemIsMac",
  995. smalltalk.method({
  996. selector: "systemIsMac",
  997. category: 'testing',
  998. fn: function (){
  999. var self=this;
  1000. return smalltalk.withContext(function($ctx1) { var $1;
  1001. $1=_st(_st(navigator)._platform())._match_("Mac");
  1002. return $1;
  1003. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{}, smalltalk.HLKeyBinder)})},
  1004. args: [],
  1005. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1006. messageSends: ["match:", "platform"],
  1007. referencedClasses: []
  1008. }),
  1009. smalltalk.HLKeyBinder);
  1010. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1011. smalltalk.addMethod(
  1012. "_cssClass",
  1013. smalltalk.method({
  1014. selector: "cssClass",
  1015. category: 'accessing',
  1016. fn: function (){
  1017. var self=this;
  1018. return smalltalk.withContext(function($ctx1) { return "key_helper";
  1019. }, function($ctx1) {$ctx1.fill(self,"cssClass",{}, smalltalk.HLKeyBinderHelper)})},
  1020. args: [],
  1021. source: "cssClass\x0a\x09^ 'key_helper'",
  1022. messageSends: [],
  1023. referencedClasses: []
  1024. }),
  1025. smalltalk.HLKeyBinderHelper);
  1026. smalltalk.addMethod(
  1027. "_hide",
  1028. smalltalk.method({
  1029. selector: "hide",
  1030. category: 'actions',
  1031. fn: function (){
  1032. var self=this;
  1033. return smalltalk.withContext(function($ctx1) { _st(_st(_st(".").__comma(_st(self)._cssClass()))._asJQuery())._remove();
  1034. _st(self)._showCog();
  1035. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1036. args: [],
  1037. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09self showCog",
  1038. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"],
  1039. referencedClasses: []
  1040. }),
  1041. smalltalk.HLKeyBinderHelper);
  1042. smalltalk.addMethod(
  1043. "_hideCog",
  1044. smalltalk.method({
  1045. selector: "hideCog",
  1046. category: 'actions',
  1047. fn: function (){
  1048. var self=this;
  1049. return smalltalk.withContext(function($ctx1) { _st(_st("#cog-helper")._asJQuery())._hide();
  1050. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1051. args: [],
  1052. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  1053. messageSends: ["hide", "asJQuery"],
  1054. referencedClasses: []
  1055. }),
  1056. smalltalk.HLKeyBinderHelper);
  1057. smalltalk.addMethod(
  1058. "_keyBinder",
  1059. smalltalk.method({
  1060. selector: "keyBinder",
  1061. category: 'accessing',
  1062. fn: function (){
  1063. var self=this;
  1064. return smalltalk.withContext(function($ctx1) { var $1;
  1065. $1=self["@keyBinder"];
  1066. return $1;
  1067. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{}, smalltalk.HLKeyBinderHelper)})},
  1068. args: [],
  1069. source: "keyBinder\x0a\x09^ keyBinder",
  1070. messageSends: [],
  1071. referencedClasses: []
  1072. }),
  1073. smalltalk.HLKeyBinderHelper);
  1074. smalltalk.addMethod(
  1075. "_keyBinder_",
  1076. smalltalk.method({
  1077. selector: "keyBinder:",
  1078. category: 'accessing',
  1079. fn: function (aKeyBinder){
  1080. var self=this;
  1081. return smalltalk.withContext(function($ctx1) { self["@keyBinder"]=aKeyBinder;
  1082. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder}, smalltalk.HLKeyBinderHelper)})},
  1083. args: ["aKeyBinder"],
  1084. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  1085. messageSends: [],
  1086. referencedClasses: []
  1087. }),
  1088. smalltalk.HLKeyBinderHelper);
  1089. smalltalk.addMethod(
  1090. "_registerBindings",
  1091. smalltalk.method({
  1092. selector: "registerBindings",
  1093. category: 'keyBindings',
  1094. fn: function (){
  1095. var self=this;
  1096. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{}, smalltalk.HLKeyBinderHelper)})},
  1097. args: [],
  1098. source: "registerBindings\x0a\x09\x22Do nothing\x22",
  1099. messageSends: [],
  1100. referencedClasses: []
  1101. }),
  1102. smalltalk.HLKeyBinderHelper);
  1103. smalltalk.addMethod(
  1104. "_renderBindingGroup_on_",
  1105. smalltalk.method({
  1106. selector: "renderBindingGroup:on:",
  1107. category: 'rendering',
  1108. fn: function (aBindingGroup,html){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$2;
  1111. _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1112. return smalltalk.withContext(function($ctx2) { return _st(_st(a)._key()).__lt(_st(b)._key());
  1113. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1114. return smalltalk.withContext(function($ctx2) { $1=_st(html)._span();
  1115. _st($1)._class_("command");
  1116. $2=_st($1)._with_((function(){
  1117. return smalltalk.withContext(function($ctx3) { $3=_st(html)._span();
  1118. _st($3)._class_("label");
  1119. $4=_st($3)._with_(_st(_st(each)._shortcut())._asLowercase());
  1120. $4;
  1121. $5=_st(html)._a();
  1122. _st($5)._class_("action");
  1123. _st($5)._with_(_st(each)._displayLabel());
  1124. $6=_st($5)._onClick_((function(){
  1125. return smalltalk.withContext(function($ctx4) { return _st(_st(self)._keyBinder())._applyBinding_(each);
  1126. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1127. return $6;
  1128. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1129. return $2;
  1130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1131. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1132. args: ["aBindingGroup", "html"],
  1133. 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 ] ] ]",
  1134. messageSends: ["do:", "class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:", "keyBinder", "sorted:", "<", "key", "activeBindings"],
  1135. referencedClasses: []
  1136. }),
  1137. smalltalk.HLKeyBinderHelper);
  1138. smalltalk.addMethod(
  1139. "_renderBindingOn_",
  1140. smalltalk.method({
  1141. selector: "renderBindingOn:",
  1142. category: 'rendering',
  1143. fn: function (html){
  1144. var self=this;
  1145. return smalltalk.withContext(function($ctx1) { _st(_st(self)._selectedBinding())._renderOn_html_(self,html);
  1146. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  1147. args: ["html"],
  1148. source: "renderBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  1149. messageSends: ["renderOn:html:", "selectedBinding"],
  1150. referencedClasses: []
  1151. }),
  1152. smalltalk.HLKeyBinderHelper);
  1153. smalltalk.addMethod(
  1154. "_renderCloseOn_",
  1155. smalltalk.method({
  1156. selector: "renderCloseOn:",
  1157. category: 'rendering',
  1158. fn: function (html){
  1159. var self=this;
  1160. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1161. $1=_st(html)._a();
  1162. _st($1)._class_("close");
  1163. _st($1)._with_((function(){
  1164. return smalltalk.withContext(function($ctx2) { return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1166. $2=_st($1)._onClick_((function(){
  1167. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._keyBinder())._deactivate();
  1168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1169. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1170. args: ["html"],
  1171. 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 ]",
  1172. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"],
  1173. referencedClasses: []
  1174. }),
  1175. smalltalk.HLKeyBinderHelper);
  1176. smalltalk.addMethod(
  1177. "_renderCog",
  1178. smalltalk.method({
  1179. selector: "renderCog",
  1180. category: 'rendering',
  1181. fn: function (){
  1182. var self=this;
  1183. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  1184. _st((function(html){
  1185. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1186. _st($1)._id_("cog-helper");
  1187. $2=_st($1)._with_((function(){
  1188. return smalltalk.withContext(function($ctx3) { $3=_st(html)._a();
  1189. _st($3)._with_((function(){
  1190. return smalltalk.withContext(function($ctx4) { return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1191. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1192. $4=_st($3)._onClick_((function(){
  1193. return smalltalk.withContext(function($ctx4) { return _st(_st(self)._keyBinder())._activate();
  1194. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1195. return $4;
  1196. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1197. return $2;
  1198. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1199. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1200. args: [],
  1201. 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",
  1202. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"],
  1203. referencedClasses: []
  1204. }),
  1205. smalltalk.HLKeyBinderHelper);
  1206. smalltalk.addMethod(
  1207. "_renderContentOn_",
  1208. smalltalk.method({
  1209. selector: "renderContentOn:",
  1210. category: 'rendering',
  1211. fn: function (html){
  1212. var self=this;
  1213. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  1214. $1=_st(html)._div();
  1215. _st($1)._class_(_st(self)._cssClass());
  1216. $2=_st($1)._with_((function(){
  1217. return smalltalk.withContext(function($ctx2) { $3=self;
  1218. _st($3)._renderSelectionOn_(html);
  1219. _st($3)._renderBindingOn_(html);
  1220. $4=_st($3)._renderCloseOn_(html);
  1221. return $4;
  1222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1223. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1224. args: ["html"],
  1225. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderSelectionOn:html;\x0a \x09renderBindingOn: html;\x0a\x09\x09\x09renderCloseOn: html ]",
  1226. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:", "renderCloseOn:"],
  1227. referencedClasses: []
  1228. }),
  1229. smalltalk.HLKeyBinderHelper);
  1230. smalltalk.addMethod(
  1231. "_renderSelectionOn_",
  1232. smalltalk.method({
  1233. selector: "renderSelectionOn:",
  1234. category: 'rendering',
  1235. fn: function (html){
  1236. var self=this;
  1237. return smalltalk.withContext(function($ctx1) { var $1,$3,$5,$4,$2;
  1238. $1=_st(html)._span();
  1239. _st($1)._class_("selected");
  1240. $3=$1;
  1241. $5=_st(_st(self)._selectedBinding())._label();
  1242. if(($receiver = $5) == nil || $receiver == undefined){
  1243. $4="Action";
  1244. } else {
  1245. $4=$5;
  1246. };
  1247. $2=_st($3)._with_($4);
  1248. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html}, smalltalk.HLKeyBinderHelper)})},
  1249. args: ["html"],
  1250. source: "renderSelectionOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  1251. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  1252. referencedClasses: []
  1253. }),
  1254. smalltalk.HLKeyBinderHelper);
  1255. smalltalk.addMethod(
  1256. "_renderStart",
  1257. smalltalk.method({
  1258. selector: "renderStart",
  1259. category: 'rendering',
  1260. fn: function (){
  1261. var self=this;
  1262. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1263. _st((function(html){
  1264. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1265. _st($1)._id_("keybinding-start-helper");
  1266. $2=_st($1)._with_(_st(_st("Press ").__comma(_st(_st(self)._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1267. return $2;
  1268. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1269. _st((function(){
  1270. return smalltalk.withContext(function($ctx2) { return _st(_st(window)._jQuery_("#keybinding-start-helper"))._fadeOut_((1000));
  1271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1272. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{}, smalltalk.HLKeyBinderHelper)})},
  1273. args: [],
  1274. 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",
  1275. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:", "jQuery:"],
  1276. referencedClasses: []
  1277. }),
  1278. smalltalk.HLKeyBinderHelper);
  1279. smalltalk.addMethod(
  1280. "_selectedBinding",
  1281. smalltalk.method({
  1282. selector: "selectedBinding",
  1283. category: 'accessing',
  1284. fn: function (){
  1285. var self=this;
  1286. return smalltalk.withContext(function($ctx1) { var $1;
  1287. $1=_st(_st(self)._keyBinder())._selectedBinding();
  1288. return $1;
  1289. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{}, smalltalk.HLKeyBinderHelper)})},
  1290. args: [],
  1291. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1292. messageSends: ["selectedBinding", "keyBinder"],
  1293. referencedClasses: []
  1294. }),
  1295. smalltalk.HLKeyBinderHelper);
  1296. smalltalk.addMethod(
  1297. "_show",
  1298. smalltalk.method({
  1299. selector: "show",
  1300. category: 'actions',
  1301. fn: function (){
  1302. var self=this;
  1303. return smalltalk.withContext(function($ctx1) { _st(self)._hideCog();
  1304. _st(self)._appendToJQuery_(_st("body")._asJQuery());
  1305. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1306. args: [],
  1307. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1308. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"],
  1309. referencedClasses: []
  1310. }),
  1311. smalltalk.HLKeyBinderHelper);
  1312. smalltalk.addMethod(
  1313. "_showCog",
  1314. smalltalk.method({
  1315. selector: "showCog",
  1316. category: 'actions',
  1317. fn: function (){
  1318. var self=this;
  1319. return smalltalk.withContext(function($ctx1) { _st(_st("#cog-helper")._asJQuery())._show();
  1320. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1321. args: [],
  1322. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  1323. messageSends: ["show", "asJQuery"],
  1324. referencedClasses: []
  1325. }),
  1326. smalltalk.HLKeyBinderHelper);
  1327. smalltalk.addMethod(
  1328. "_on_",
  1329. smalltalk.method({
  1330. selector: "on:",
  1331. category: 'instance creation',
  1332. fn: function (aKeyBinder){
  1333. var self=this;
  1334. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1335. $2=_st(self)._new();
  1336. _st($2)._keyBinder_(aKeyBinder);
  1337. $3=_st($2)._yourself();
  1338. $1=$3;
  1339. return $1;
  1340. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder}, smalltalk.HLKeyBinderHelper.klass)})},
  1341. args: ["aKeyBinder"],
  1342. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1343. messageSends: ["keyBinder:", "new", "yourself"],
  1344. referencedClasses: []
  1345. }),
  1346. smalltalk.HLKeyBinderHelper.klass);