Helios-KeyBindings.deploy.js 56 KB

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