Helios-KeyBindings.deploy.js 56 KB

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