Helios-KeyBindings.deploy.js 45 KB

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