Helios-KeyBindings.deploy.js 56 KB

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