Helios-KeyBindings.deploy.js 53 KB

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