Helios-KeyBindings.deploy.js 42 KB

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