Helios-KeyBindings.deploy.js 56 KB

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