Helios-KeyBindings.deploy.js 45 KB

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