Helios-KeyBindings.deploy.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359
  1. smalltalk.addPackage('Helios-KeyBindings');
  2. smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
  3. smalltalk.addMethod(
  4. "_applyOn_",
  5. smalltalk.method({
  6. selector: "applyOn:",
  7. fn: function (aKeyBinder){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBinding)})},
  10. messageSends: []}),
  11. smalltalk.HLBinding);
  12. smalltalk.addMethod(
  13. "_applyOn_then_",
  14. smalltalk.method({
  15. selector: "applyOn:then:",
  16. fn: function (aKeyBinder,aBlock){
  17. var self=this;
  18. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"applyOn:then:",{aKeyBinder:aKeyBinder,aBlock:aBlock},smalltalk.HLBinding)})},
  19. messageSends: []}),
  20. smalltalk.HLBinding);
  21. smalltalk.addMethod(
  22. "_atKey_",
  23. smalltalk.method({
  24. selector: "atKey:",
  25. fn: function (aKey){
  26. var self=this;
  27. return smalltalk.withContext(function($ctx1) { return nil;
  28. }, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBinding)})},
  29. messageSends: []}),
  30. smalltalk.HLBinding);
  31. smalltalk.addMethod(
  32. "_displayLabel",
  33. smalltalk.method({
  34. selector: "displayLabel",
  35. fn: function (){
  36. var self=this;
  37. return smalltalk.withContext(function($ctx1) { var $1;
  38. $1=_st(self)._label();
  39. return $1;
  40. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBinding)})},
  41. messageSends: ["label"]}),
  42. smalltalk.HLBinding);
  43. smalltalk.addMethod(
  44. "_isActive",
  45. smalltalk.method({
  46. selector: "isActive",
  47. fn: function (){
  48. var self=this;
  49. return smalltalk.withContext(function($ctx1) { var $1;
  50. $1=_st(self)._subclassResponsibility();
  51. return $1;
  52. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBinding)})},
  53. messageSends: ["subclassResponsibility"]}),
  54. smalltalk.HLBinding);
  55. smalltalk.addMethod(
  56. "_isFinal",
  57. smalltalk.method({
  58. selector: "isFinal",
  59. fn: function (){
  60. var self=this;
  61. return smalltalk.withContext(function($ctx1) { return false;
  62. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBinding)})},
  63. messageSends: []}),
  64. smalltalk.HLBinding);
  65. smalltalk.addMethod(
  66. "_key",
  67. smalltalk.method({
  68. selector: "key",
  69. fn: function (){
  70. var self=this;
  71. return smalltalk.withContext(function($ctx1) { var $1;
  72. $1=self["@key"];
  73. return $1;
  74. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLBinding)})},
  75. messageSends: []}),
  76. smalltalk.HLBinding);
  77. smalltalk.addMethod(
  78. "_key_",
  79. smalltalk.method({
  80. selector: "key:",
  81. fn: function (anInteger){
  82. var self=this;
  83. return smalltalk.withContext(function($ctx1) { self["@key"]=anInteger;
  84. return self}, function($ctx1) {$ctx1.fill(self,"key:",{anInteger:anInteger},smalltalk.HLBinding)})},
  85. messageSends: []}),
  86. smalltalk.HLBinding);
  87. smalltalk.addMethod(
  88. "_label",
  89. smalltalk.method({
  90. selector: "label",
  91. fn: function (){
  92. var self=this;
  93. return smalltalk.withContext(function($ctx1) { var $1;
  94. $1=self["@label"];
  95. return $1;
  96. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLBinding)})},
  97. messageSends: []}),
  98. smalltalk.HLBinding);
  99. smalltalk.addMethod(
  100. "_label_",
  101. smalltalk.method({
  102. selector: "label:",
  103. fn: function (aString){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) { self["@label"]=aString;
  106. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.HLBinding)})},
  107. messageSends: []}),
  108. smalltalk.HLBinding);
  109. smalltalk.addMethod(
  110. "_release",
  111. smalltalk.method({
  112. selector: "release",
  113. fn: function (){
  114. var self=this;
  115. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBinding)})},
  116. messageSends: []}),
  117. smalltalk.HLBinding);
  118. smalltalk.addMethod(
  119. "_renderActionFor_html_",
  120. smalltalk.method({
  121. selector: "renderActionFor:html:",
  122. fn: function (aBinder,html){
  123. var self=this;
  124. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$2;
  125. $1=_st(html)._span();
  126. _st($1)._class_("command");
  127. $2=_st($1)._with_((function(){
  128. return smalltalk.withContext(function($ctx2) { $3=_st(html)._span();
  129. _st($3)._class_("label");
  130. $4=_st($3)._with_(_st(_st(self)._shortcut())._asLowercase());
  131. $4;
  132. $5=_st(html)._a();
  133. _st($5)._class_("action");
  134. _st($5)._with_(_st(self)._displayLabel());
  135. $6=_st($5)._onClick_((function(){
  136. return smalltalk.withContext(function($ctx3) { return _st(aBinder)._applyBinding_(self);
  137. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  138. return $6;
  139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  140. return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBinding)})},
  141. messageSends: ["class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:"]}),
  142. smalltalk.HLBinding);
  143. smalltalk.addMethod(
  144. "_renderOn_html_",
  145. smalltalk.method({
  146. selector: "renderOn:html:",
  147. fn: function (aBindingHelper,html){
  148. var self=this;
  149. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBinding)})},
  150. messageSends: []}),
  151. smalltalk.HLBinding);
  152. smalltalk.addMethod(
  153. "_shortcut",
  154. smalltalk.method({
  155. selector: "shortcut",
  156. fn: function (){
  157. var self=this;
  158. return smalltalk.withContext(function($ctx1) { var $1;
  159. $1=_st((smalltalk.String || String))._fromCharCode_(_st(self)._key());
  160. return $1;
  161. }, function($ctx1) {$ctx1.fill(self,"shortcut",{},smalltalk.HLBinding)})},
  162. messageSends: ["fromCharCode:", "key"]}),
  163. smalltalk.HLBinding);
  164. smalltalk.addMethod(
  165. "_on_labelled_",
  166. smalltalk.method({
  167. selector: "on:labelled:",
  168. fn: function (anInteger,aString){
  169. var self=this;
  170. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  171. $2=_st(self)._new();
  172. _st($2)._key_(anInteger);
  173. _st($2)._label_(aString);
  174. $3=_st($2)._yourself();
  175. $1=$3;
  176. return $1;
  177. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBinding.klass)})},
  178. messageSends: ["key:", "new", "label:", "yourself"]}),
  179. smalltalk.HLBinding.klass);
  180. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['command'], 'Helios-KeyBindings');
  181. smalltalk.addMethod(
  182. "_applyOn_",
  183. smalltalk.method({
  184. selector: "applyOn:",
  185. fn: function (aKeyBinder){
  186. var self=this;
  187. return smalltalk.withContext(function($ctx1) { var $1;
  188. $1=_st(_st(self)._command())._isInputRequired();
  189. if(smalltalk.assert($1)){
  190. _st(aKeyBinder)._selectBinding_(_st(self)._inputBinding());
  191. } else {
  192. _st(_st(self)._command())._execute();
  193. };
  194. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingAction)})},
  195. messageSends: ["ifTrue:ifFalse:", "selectBinding:", "inputBinding", "execute", "command", "isInputRequired"]}),
  196. smalltalk.HLBindingAction);
  197. smalltalk.addMethod(
  198. "_command",
  199. smalltalk.method({
  200. selector: "command",
  201. fn: function (){
  202. var self=this;
  203. return smalltalk.withContext(function($ctx1) { var $1;
  204. $1=self["@command"];
  205. return $1;
  206. }, function($ctx1) {$ctx1.fill(self,"command",{},smalltalk.HLBindingAction)})},
  207. messageSends: []}),
  208. smalltalk.HLBindingAction);
  209. smalltalk.addMethod(
  210. "_command_",
  211. smalltalk.method({
  212. selector: "command:",
  213. fn: function (aCommand){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) { self["@command"]=aCommand;
  216. return self}, function($ctx1) {$ctx1.fill(self,"command:",{aCommand:aCommand},smalltalk.HLBindingAction)})},
  217. messageSends: []}),
  218. smalltalk.HLBindingAction);
  219. smalltalk.addMethod(
  220. "_inputBinding",
  221. smalltalk.method({
  222. selector: "inputBinding",
  223. fn: function (){
  224. var self=this;
  225. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$5,$1;
  226. $2=_st((smalltalk.HLBindingInput || HLBindingInput))._new();
  227. _st($2)._label_(_st(_st(self)._command())._inputLabel());
  228. _st($2)._ghostText_(_st(_st(self)._command())._displayLabel());
  229. _st($2)._callback_((function(val,errorBlock){
  230. return smalltalk.withContext(function($ctx2) { $3=_st(self)._command();
  231. _st($3)._input_(val);
  232. _st($3)._errorBlock_(errorBlock);
  233. $4=_st($3)._execute();
  234. return $4;
  235. }, function($ctx2) {$ctx2.fillBlock({val:val,errorBlock:errorBlock},$ctx1)})}));
  236. $5=_st($2)._yourself();
  237. $1=$5;
  238. return $1;
  239. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
  240. messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "callback:", "input:", "errorBlock:", "execute", "yourself"]}),
  241. smalltalk.HLBindingAction);
  242. smalltalk.addMethod(
  243. "_isActive",
  244. smalltalk.method({
  245. selector: "isActive",
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) { var $1;
  249. $1=_st(_st(self)._command())._isActive();
  250. return $1;
  251. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingAction)})},
  252. messageSends: ["isActive", "command"]}),
  253. smalltalk.HLBindingAction);
  254. smalltalk.addMethod(
  255. "_isFinal",
  256. smalltalk.method({
  257. selector: "isFinal",
  258. fn: function (){
  259. var self=this;
  260. return smalltalk.withContext(function($ctx1) { var $1;
  261. $1=_st(_st(_st(self)._command())._isInputRequired())._not();
  262. return $1;
  263. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingAction)})},
  264. messageSends: ["not", "isInputRequired", "command"]}),
  265. smalltalk.HLBindingAction);
  266. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  267. smalltalk.addMethod(
  268. "_activeBindings",
  269. smalltalk.method({
  270. selector: "activeBindings",
  271. fn: function (){
  272. var self=this;
  273. return smalltalk.withContext(function($ctx1) { var $1;
  274. $1=_st(_st(self)._bindings())._select_((function(each){
  275. return smalltalk.withContext(function($ctx2) { return _st(each)._isActive();
  276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  277. return $1;
  278. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  279. messageSends: ["select:", "isActive", "bindings"]}),
  280. smalltalk.HLBindingGroup);
  281. smalltalk.addMethod(
  282. "_add_",
  283. smalltalk.method({
  284. selector: "add:",
  285. fn: function (aBinding){
  286. var self=this;
  287. return smalltalk.withContext(function($ctx1) { var $1;
  288. $1=_st(_st(self)._bindings())._add_(aBinding);
  289. return $1;
  290. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},smalltalk.HLBindingGroup)})},
  291. messageSends: ["add:", "bindings"]}),
  292. smalltalk.HLBindingGroup);
  293. smalltalk.addMethod(
  294. "_addActionKey_labelled_callback_",
  295. smalltalk.method({
  296. selector: "addActionKey:labelled:callback:",
  297. fn: function (anInteger,aString,aBlock){
  298. var self=this;
  299. return smalltalk.withContext(function($ctx1) { var $1,$2;
  300. $1=_st((smalltalk.HLBindingAction || HLBindingAction))._on_labelled_(anInteger,aString);
  301. _st($1)._callback_(aBlock);
  302. $2=_st($1)._yourself();
  303. _st(self)._add_($2);
  304. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},smalltalk.HLBindingGroup)})},
  305. messageSends: ["add:", "callback:", "on:labelled:", "yourself"]}),
  306. smalltalk.HLBindingGroup);
  307. smalltalk.addMethod(
  308. "_addGroupKey_labelled_",
  309. smalltalk.method({
  310. selector: "addGroupKey:labelled:",
  311. fn: function (anInteger,aString){
  312. var self=this;
  313. return smalltalk.withContext(function($ctx1) { _st(self)._add_(_st((smalltalk.HLBindingGroup || 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. "_at_",
  319. smalltalk.method({
  320. selector: "at:",
  321. fn: function (aString){
  322. var self=this;
  323. return smalltalk.withContext(function($ctx1) { var $1;
  324. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  325. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._label()).__eq(aString);
  326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  327. return smalltalk.withContext(function($ctx2) { return nil;
  328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  329. return $1;
  330. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.HLBindingGroup)})},
  331. messageSends: ["detect:ifNone:", "=", "label", "bindings"]}),
  332. smalltalk.HLBindingGroup);
  333. smalltalk.addMethod(
  334. "_at_add_",
  335. smalltalk.method({
  336. selector: "at:add:",
  337. fn: function (aString,aBinding){
  338. var self=this;
  339. var binding;
  340. return smalltalk.withContext(function($ctx1) { var $1,$2;
  341. binding=_st(self)._at_(aString);
  342. $1=binding;
  343. if(($receiver = $1) == nil || $receiver == undefined){
  344. $2=self;
  345. return $2;
  346. } else {
  347. $1;
  348. };
  349. _st(binding)._add_(aBinding);
  350. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  351. messageSends: ["at:", "ifNil:", "add:"]}),
  352. smalltalk.HLBindingGroup);
  353. smalltalk.addMethod(
  354. "_atKey_",
  355. smalltalk.method({
  356. selector: "atKey:",
  357. fn: function (anInteger){
  358. var self=this;
  359. return smalltalk.withContext(function($ctx1) { var $1;
  360. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  361. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._key()).__eq(anInteger);
  362. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  363. return smalltalk.withContext(function($ctx2) { return nil;
  364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  365. return $1;
  366. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},smalltalk.HLBindingGroup)})},
  367. messageSends: ["detect:ifNone:", "=", "key", "bindings"]}),
  368. smalltalk.HLBindingGroup);
  369. smalltalk.addMethod(
  370. "_bindings",
  371. smalltalk.method({
  372. selector: "bindings",
  373. fn: function (){
  374. var self=this;
  375. return smalltalk.withContext(function($ctx1) { var $2,$1;
  376. $2=self["@bindings"];
  377. if(($receiver = $2) == nil || $receiver == undefined){
  378. self["@bindings"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  379. $1=self["@bindings"];
  380. } else {
  381. $1=$2;
  382. };
  383. return $1;
  384. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLBindingGroup)})},
  385. messageSends: ["ifNil:", "new"]}),
  386. smalltalk.HLBindingGroup);
  387. smalltalk.addMethod(
  388. "_displayLabel",
  389. smalltalk.method({
  390. selector: "displayLabel",
  391. fn: function (){
  392. var self=this;
  393. return smalltalk.withContext(function($ctx1) { var $1;
  394. $1=_st(smalltalk.HLBinding.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  395. return $1;
  396. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBindingGroup)})},
  397. messageSends: [",", "displayLabel"]}),
  398. smalltalk.HLBindingGroup);
  399. smalltalk.addMethod(
  400. "_isActive",
  401. smalltalk.method({
  402. selector: "isActive",
  403. fn: function (){
  404. var self=this;
  405. return smalltalk.withContext(function($ctx1) { var $1;
  406. $1=_st(_st(self)._activeBindings())._notEmpty();
  407. return $1;
  408. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  409. messageSends: ["notEmpty", "activeBindings"]}),
  410. smalltalk.HLBindingGroup);
  411. smalltalk.addMethod(
  412. "_release",
  413. smalltalk.method({
  414. selector: "release",
  415. fn: function (){
  416. var self=this;
  417. return smalltalk.withContext(function($ctx1) { _st(_st(self)._bindings())._do_((function(each){
  418. return smalltalk.withContext(function($ctx2) { return _st(each)._release();
  419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  420. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingGroup)})},
  421. messageSends: ["do:", "release", "bindings"]}),
  422. smalltalk.HLBindingGroup);
  423. smalltalk.addMethod(
  424. "_renderOn_html_",
  425. smalltalk.method({
  426. selector: "renderOn:html:",
  427. fn: function (aBindingHelper,html){
  428. var self=this;
  429. return smalltalk.withContext(function($ctx1) { var $1;
  430. $1=_st(self)._isActive();
  431. if(smalltalk.assert($1)){
  432. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  433. };
  434. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  435. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"]}),
  436. smalltalk.HLBindingGroup);
  437. smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'inputText', 'wrapper', 'binder', 'ghostText', 'isFinal'], 'Helios-KeyBindings');
  438. smalltalk.addMethod(
  439. "_applyOn_",
  440. smalltalk.method({
  441. selector: "applyOn:",
  442. fn: function (aKeyBinder){
  443. var self=this;
  444. return smalltalk.withContext(function($ctx1) { _st(self)._isFinal_(true);
  445. _st(self)._inputText_(_st(_st(_st(self)._input())._asJQuery())._val());
  446. _st(self)._evaluate_onError_(_st(self)._inputText(),(function(){
  447. return smalltalk.withContext(function($ctx2) { _st(self)._errorStatus();
  448. _st(self)._refresh();
  449. return _st(self)._isFinal_(false);
  450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  451. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
  452. messageSends: ["isFinal:", "inputText:", "val", "asJQuery", "input", "evaluate:onError:", "inputText", "errorStatus", "refresh"]}),
  453. smalltalk.HLBindingInput);
  454. smalltalk.addMethod(
  455. "_atKey_",
  456. smalltalk.method({
  457. selector: "atKey:",
  458. fn: function (aKey){
  459. var self=this;
  460. return smalltalk.withContext(function($ctx1) { var $1;
  461. $1=_st(aKey).__eq((13));
  462. if(! smalltalk.assert($1)){
  463. return nil;
  464. };
  465. return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
  466. messageSends: ["ifFalse:", "="]}),
  467. smalltalk.HLBindingInput);
  468. smalltalk.addMethod(
  469. "_callback",
  470. smalltalk.method({
  471. selector: "callback",
  472. fn: function (){
  473. var self=this;
  474. return smalltalk.withContext(function($ctx1) { var $2,$1;
  475. $2=self["@callback"];
  476. if(($receiver = $2) == nil || $receiver == undefined){
  477. self["@callback"]=(function(value){
  478. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})});
  479. $1=self["@callback"];
  480. } else {
  481. $1=$2;
  482. };
  483. return $1;
  484. }, function($ctx1) {$ctx1.fill(self,"callback",{},smalltalk.HLBindingInput)})},
  485. messageSends: ["ifNil:"]}),
  486. smalltalk.HLBindingInput);
  487. smalltalk.addMethod(
  488. "_callback_",
  489. smalltalk.method({
  490. selector: "callback:",
  491. fn: function (aBlock){
  492. var self=this;
  493. return smalltalk.withContext(function($ctx1) { self["@callback"]=aBlock;
  494. return self}, function($ctx1) {$ctx1.fill(self,"callback:",{aBlock:aBlock},smalltalk.HLBindingInput)})},
  495. messageSends: []}),
  496. smalltalk.HLBindingInput);
  497. smalltalk.addMethod(
  498. "_errorStatus",
  499. smalltalk.method({
  500. selector: "errorStatus",
  501. fn: function (){
  502. var self=this;
  503. return smalltalk.withContext(function($ctx1) { _st(self)._status_("error");
  504. return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},smalltalk.HLBindingInput)})},
  505. messageSends: ["status:"]}),
  506. smalltalk.HLBindingInput);
  507. smalltalk.addMethod(
  508. "_evaluate_",
  509. smalltalk.method({
  510. selector: "evaluate:",
  511. fn: function (aString){
  512. var self=this;
  513. return smalltalk.withContext(function($ctx1) { _st(_st(self)._callback())._value_(aString);
  514. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},smalltalk.HLBindingInput)})},
  515. messageSends: ["value:", "callback"]}),
  516. smalltalk.HLBindingInput);
  517. smalltalk.addMethod(
  518. "_evaluate_onError_",
  519. smalltalk.method({
  520. selector: "evaluate:onError:",
  521. fn: function (aString,aBlock){
  522. var self=this;
  523. return smalltalk.withContext(function($ctx1) { _st(_st(self)._callback())._value_value_(aString,aBlock);
  524. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:onError:",{aString:aString,aBlock:aBlock},smalltalk.HLBindingInput)})},
  525. messageSends: ["value:value:", "callback"]}),
  526. smalltalk.HLBindingInput);
  527. smalltalk.addMethod(
  528. "_ghostText",
  529. smalltalk.method({
  530. selector: "ghostText",
  531. fn: function (){
  532. var self=this;
  533. return smalltalk.withContext(function($ctx1) { var $1;
  534. $1=self["@ghostText"];
  535. return $1;
  536. }, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
  537. messageSends: []}),
  538. smalltalk.HLBindingInput);
  539. smalltalk.addMethod(
  540. "_ghostText_",
  541. smalltalk.method({
  542. selector: "ghostText:",
  543. fn: function (aText){
  544. var self=this;
  545. return smalltalk.withContext(function($ctx1) { self["@ghostText"]=aText;
  546. return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
  547. messageSends: []}),
  548. smalltalk.HLBindingInput);
  549. smalltalk.addMethod(
  550. "_input",
  551. smalltalk.method({
  552. selector: "input",
  553. fn: function (){
  554. var self=this;
  555. return smalltalk.withContext(function($ctx1) { var $1;
  556. $1=self["@input"];
  557. return $1;
  558. }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
  559. messageSends: []}),
  560. smalltalk.HLBindingInput);
  561. smalltalk.addMethod(
  562. "_inputText",
  563. smalltalk.method({
  564. selector: "inputText",
  565. fn: function (){
  566. var self=this;
  567. return smalltalk.withContext(function($ctx1) { var $2,$1;
  568. $2=self["@inputText"];
  569. if(($receiver = $2) == nil || $receiver == undefined){
  570. self["@inputText"]="";
  571. $1=self["@inputText"];
  572. } else {
  573. $1=$2;
  574. };
  575. return $1;
  576. }, function($ctx1) {$ctx1.fill(self,"inputText",{},smalltalk.HLBindingInput)})},
  577. messageSends: ["ifNil:"]}),
  578. smalltalk.HLBindingInput);
  579. smalltalk.addMethod(
  580. "_inputText_",
  581. smalltalk.method({
  582. selector: "inputText:",
  583. fn: function (aText){
  584. var self=this;
  585. return smalltalk.withContext(function($ctx1) { self["@inputText"]=aText;
  586. return self}, function($ctx1) {$ctx1.fill(self,"inputText:",{aText:aText},smalltalk.HLBindingInput)})},
  587. messageSends: []}),
  588. smalltalk.HLBindingInput);
  589. smalltalk.addMethod(
  590. "_isActive",
  591. smalltalk.method({
  592. selector: "isActive",
  593. fn: function (){
  594. var self=this;
  595. return smalltalk.withContext(function($ctx1) { return true;
  596. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingInput)})},
  597. messageSends: []}),
  598. smalltalk.HLBindingInput);
  599. smalltalk.addMethod(
  600. "_isFinal",
  601. smalltalk.method({
  602. selector: "isFinal",
  603. fn: function (){
  604. var self=this;
  605. return smalltalk.withContext(function($ctx1) { var $2,$1;
  606. $2=self["@isFinal"];
  607. if(($receiver = $2) == nil || $receiver == undefined){
  608. self["@isFinal"]=smalltalk.HLBinding.fn.prototype._isFinal.apply(_st(self), []);
  609. $1=self["@isFinal"];
  610. } else {
  611. $1=$2;
  612. };
  613. return $1;
  614. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
  615. messageSends: ["ifNil:", "isFinal"]}),
  616. smalltalk.HLBindingInput);
  617. smalltalk.addMethod(
  618. "_isFinal_",
  619. smalltalk.method({
  620. selector: "isFinal:",
  621. fn: function (aBoolean){
  622. var self=this;
  623. return smalltalk.withContext(function($ctx1) { self["@isFinal"]=aBoolean;
  624. return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
  625. messageSends: []}),
  626. smalltalk.HLBindingInput);
  627. smalltalk.addMethod(
  628. "_privateRenderOn_html_",
  629. smalltalk.method({
  630. selector: "privateRenderOn:html:",
  631. fn: function (aBinder,html){
  632. var self=this;
  633. return smalltalk.withContext(function($ctx1) { var $1,$2;
  634. $1=_st(html)._input();
  635. _st($1)._class_("controls");
  636. _st($1)._type_("text");
  637. _st($1)._placeholder_(_st(self)._ghostText());
  638. $2=_st($1)._with_(_st(self)._inputText());
  639. self["@input"]=$2;
  640. _st(_st(self["@input"])._asJQuery())._focus();
  641. return self}, function($ctx1) {$ctx1.fill(self,"privateRenderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
  642. messageSends: ["class:", "input", "type:", "placeholder:", "ghostText", "with:", "inputText", "focus", "asJQuery"]}),
  643. smalltalk.HLBindingInput);
  644. smalltalk.addMethod(
  645. "_refresh",
  646. smalltalk.method({
  647. selector: "refresh",
  648. fn: function (){
  649. var self=this;
  650. return smalltalk.withContext(function($ctx1) { var $1,$2;
  651. $1=self["@wrapper"];
  652. if(($receiver = $1) == nil || $receiver == undefined){
  653. $2=self;
  654. return $2;
  655. } else {
  656. $1;
  657. };
  658. _st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
  659. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
  660. messageSends: ["ifNil:", "class:", ",", "status"]}),
  661. smalltalk.HLBindingInput);
  662. smalltalk.addMethod(
  663. "_release",
  664. smalltalk.method({
  665. selector: "release",
  666. fn: function (){
  667. var self=this;
  668. return smalltalk.withContext(function($ctx1) { self["@status"]=nil;
  669. self["@wrapper"]=nil;
  670. self["@binder"]=nil;
  671. self["@inputText"]=nil;
  672. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingInput)})},
  673. messageSends: []}),
  674. smalltalk.HLBindingInput);
  675. smalltalk.addMethod(
  676. "_renderOn_html_",
  677. smalltalk.method({
  678. selector: "renderOn:html:",
  679. fn: function (aBinder,root){
  680. var self=this;
  681. return smalltalk.withContext(function($ctx1) { var $1;
  682. self["@binder"]=aBinder;
  683. $1=self["@wrapper"];
  684. if(($receiver = $1) == nil || $receiver == undefined){
  685. self["@wrapper"]=_st(root)._span();
  686. self["@wrapper"];
  687. } else {
  688. $1;
  689. };
  690. _st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
  691. _st((function(html){
  692. return smalltalk.withContext(function($ctx2) { return _st(self)._privateRenderOn_html_(self["@binder"],html);
  693. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
  694. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,root:root},smalltalk.HLBindingInput)})},
  695. messageSends: ["ifNil:", "span", "class:", ",", "status", "appendToJQuery:", "asJQuery", "privateRenderOn:html:"]}),
  696. smalltalk.HLBindingInput);
  697. smalltalk.addMethod(
  698. "_status",
  699. smalltalk.method({
  700. selector: "status",
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) { var $2,$1;
  704. $2=self["@status"];
  705. if(($receiver = $2) == nil || $receiver == undefined){
  706. self["@status"]="info";
  707. $1=self["@status"];
  708. } else {
  709. $1=$2;
  710. };
  711. return $1;
  712. }, function($ctx1) {$ctx1.fill(self,"status",{},smalltalk.HLBindingInput)})},
  713. messageSends: ["ifNil:"]}),
  714. smalltalk.HLBindingInput);
  715. smalltalk.addMethod(
  716. "_status_",
  717. smalltalk.method({
  718. selector: "status:",
  719. fn: function (aStatus){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) { self["@status"]=aStatus;
  722. return self}, function($ctx1) {$ctx1.fill(self,"status:",{aStatus:aStatus},smalltalk.HLBindingInput)})},
  723. messageSends: []}),
  724. smalltalk.HLBindingInput);
  725. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  726. smalltalk.addMethod(
  727. "_activate",
  728. smalltalk.method({
  729. selector: "activate",
  730. fn: function (){
  731. var self=this;
  732. return smalltalk.withContext(function($ctx1) { _st(_st(self)._helper())._show();
  733. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  734. messageSends: ["show", "helper"]}),
  735. smalltalk.HLKeyBinder);
  736. smalltalk.addMethod(
  737. "_activationKey",
  738. smalltalk.method({
  739. selector: "activationKey",
  740. fn: function (){
  741. var self=this;
  742. return smalltalk.withContext(function($ctx1) { return (32);
  743. }, function($ctx1) {$ctx1.fill(self,"activationKey",{},smalltalk.HLKeyBinder)})},
  744. messageSends: []}),
  745. smalltalk.HLKeyBinder);
  746. smalltalk.addMethod(
  747. "_activationKeyLabel",
  748. smalltalk.method({
  749. selector: "activationKeyLabel",
  750. fn: function (){
  751. var self=this;
  752. return smalltalk.withContext(function($ctx1) { return "ctrl + space";
  753. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{},smalltalk.HLKeyBinder)})},
  754. messageSends: []}),
  755. smalltalk.HLKeyBinder);
  756. smalltalk.addMethod(
  757. "_applyBinding_",
  758. smalltalk.method({
  759. selector: "applyBinding:",
  760. fn: function (aBinding){
  761. var self=this;
  762. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  763. $1=_st(aBinding)._isActive();
  764. if(! smalltalk.assert($1)){
  765. $2=self;
  766. return $2;
  767. };
  768. _st(self)._selectBinding_(aBinding);
  769. _st(aBinding)._applyOn_(self);
  770. $3=_st(aBinding)._isFinal();
  771. if(smalltalk.assert($3)){
  772. _st(self)._deactivate();
  773. };
  774. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  775. messageSends: ["ifFalse:", "isActive", "selectBinding:", "applyOn:", "ifTrue:", "deactivate", "isFinal"]}),
  776. smalltalk.HLKeyBinder);
  777. smalltalk.addMethod(
  778. "_bindings",
  779. smalltalk.method({
  780. selector: "bindings",
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) { var $2,$1;
  784. $2=self["@bindings"];
  785. if(($receiver = $2) == nil || $receiver == undefined){
  786. self["@bindings"]=_st(self)._defaultBindings();
  787. $1=self["@bindings"];
  788. } else {
  789. $1=$2;
  790. };
  791. return $1;
  792. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLKeyBinder)})},
  793. messageSends: ["ifNil:", "defaultBindings"]}),
  794. smalltalk.HLKeyBinder);
  795. smalltalk.addMethod(
  796. "_deactivate",
  797. smalltalk.method({
  798. selector: "deactivate",
  799. fn: function (){
  800. var self=this;
  801. return smalltalk.withContext(function($ctx1) { var $1;
  802. $1=self["@selectedBinding"];
  803. if(($receiver = $1) == nil || $receiver == undefined){
  804. $1;
  805. } else {
  806. _st(self["@selectedBinding"])._release();
  807. };
  808. self["@selectedBinding"]=nil;
  809. _st(_st(self)._helper())._hide();
  810. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},smalltalk.HLKeyBinder)})},
  811. messageSends: ["ifNotNil:", "release", "hide", "helper"]}),
  812. smalltalk.HLKeyBinder);
  813. smalltalk.addMethod(
  814. "_defaultBindings",
  815. smalltalk.method({
  816. selector: "defaultBindings",
  817. fn: function (){
  818. var self=this;
  819. var group;
  820. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  821. $1=_st((smalltalk.HLBindingGroup || HLBindingGroup))._new();
  822. _st($1)._addGroupKey_labelled_((86),"View");
  823. _st($1)._add_(_st(_st((smalltalk.HLCloseTabCommand || HLCloseTabCommand))._new())._asBinding());
  824. $2=_st($1)._yourself();
  825. group=$2;
  826. _st((smalltalk.HLOpenCommand || HLOpenCommand))._registerConcreteClassesOn_(group);
  827. $3=group;
  828. return $3;
  829. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  830. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "registerConcreteClassesOn:"]}),
  831. smalltalk.HLKeyBinder);
  832. smalltalk.addMethod(
  833. "_escapeKey",
  834. smalltalk.method({
  835. selector: "escapeKey",
  836. fn: function (){
  837. var self=this;
  838. return smalltalk.withContext(function($ctx1) { return (27);
  839. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{},smalltalk.HLKeyBinder)})},
  840. messageSends: []}),
  841. smalltalk.HLKeyBinder);
  842. smalltalk.addMethod(
  843. "_flushBindings",
  844. smalltalk.method({
  845. selector: "flushBindings",
  846. fn: function (){
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) { self["@bindings"]=nil;
  849. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{},smalltalk.HLKeyBinder)})},
  850. messageSends: []}),
  851. smalltalk.HLKeyBinder);
  852. smalltalk.addMethod(
  853. "_handleActiveKeyDown_",
  854. smalltalk.method({
  855. selector: "handleActiveKeyDown:",
  856. fn: function (event){
  857. var self=this;
  858. return smalltalk.withContext(function($ctx1) { var $1,$2;
  859. $1=_st(_st(_st(event)._which()).__eq(_st(self)._escapeKey()))._or_((function(){
  860. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  861. return smalltalk.withContext(function($ctx3) { return _st(event)._ctrlKey();
  862. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  864. if(smalltalk.assert($1)){
  865. _st(self)._deactivate();
  866. _st(event)._preventDefault();
  867. return false;
  868. };
  869. $2=_st(self)._handleBindingFor_(event);
  870. return $2;
  871. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  872. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"]}),
  873. smalltalk.HLKeyBinder);
  874. smalltalk.addMethod(
  875. "_handleBindingFor_",
  876. smalltalk.method({
  877. selector: "handleBindingFor:",
  878. fn: function (anEvent){
  879. var self=this;
  880. var binding;
  881. return smalltalk.withContext(function($ctx1) { var $1;
  882. binding=_st(_st(self)._selectedBinding())._atKey_(_st(anEvent)._which());
  883. $1=binding;
  884. if(($receiver = $1) == nil || $receiver == undefined){
  885. $1;
  886. } else {
  887. _st(self)._applyBinding_(binding);
  888. _st(anEvent)._preventDefault();
  889. return false;
  890. };
  891. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},smalltalk.HLKeyBinder)})},
  892. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"]}),
  893. smalltalk.HLKeyBinder);
  894. smalltalk.addMethod(
  895. "_handleInactiveKeyDown_",
  896. smalltalk.method({
  897. selector: "handleInactiveKeyDown:",
  898. fn: function (event){
  899. var self=this;
  900. return smalltalk.withContext(function($ctx1) { var $1,$2;
  901. $1=_st(_st(event)._which()).__eq(_st(self)._activationKey());
  902. if(smalltalk.assert($1)){
  903. $2=_st(event)._ctrlKey();
  904. if(smalltalk.assert($2)){
  905. _st(self)._activate();
  906. _st(event)._preventDefault();
  907. return false;
  908. };
  909. };
  910. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  911. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"]}),
  912. smalltalk.HLKeyBinder);
  913. smalltalk.addMethod(
  914. "_handleKeyDown_",
  915. smalltalk.method({
  916. selector: "handleKeyDown:",
  917. fn: function (event){
  918. var self=this;
  919. return smalltalk.withContext(function($ctx1) { var $2,$1;
  920. $2=_st(self)._isActive();
  921. if(smalltalk.assert($2)){
  922. $1=_st(self)._handleActiveKeyDown_(event);
  923. } else {
  924. $1=_st(self)._handleInactiveKeyDown_(event);
  925. };
  926. return $1;
  927. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  928. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"]}),
  929. smalltalk.HLKeyBinder);
  930. smalltalk.addMethod(
  931. "_helper",
  932. smalltalk.method({
  933. selector: "helper",
  934. fn: function (){
  935. var self=this;
  936. return smalltalk.withContext(function($ctx1) { var $1;
  937. $1=self["@helper"];
  938. return $1;
  939. }, function($ctx1) {$ctx1.fill(self,"helper",{},smalltalk.HLKeyBinder)})},
  940. messageSends: []}),
  941. smalltalk.HLKeyBinder);
  942. smalltalk.addMethod(
  943. "_initialize",
  944. smalltalk.method({
  945. selector: "initialize",
  946. fn: function (){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) { var $1,$2;
  949. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  950. self["@helper"]=_st((smalltalk.HLKeyBinderHelper || HLKeyBinderHelper))._on_(self);
  951. $1=self["@helper"];
  952. _st($1)._renderStart();
  953. $2=_st($1)._renderCog();
  954. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  955. messageSends: ["initialize", "on:", "renderStart", "renderCog"]}),
  956. smalltalk.HLKeyBinder);
  957. smalltalk.addMethod(
  958. "_isActive",
  959. smalltalk.method({
  960. selector: "isActive",
  961. fn: function (){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) { var $1;
  964. $1=_st(_st(_st(".").__comma(_st(_st(self)._helper())._cssClass()))._asJQuery())._is_(":visible");
  965. return $1;
  966. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  967. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"]}),
  968. smalltalk.HLKeyBinder);
  969. smalltalk.addMethod(
  970. "_selectBinding_",
  971. smalltalk.method({
  972. selector: "selectBinding:",
  973. fn: function (aBinding){
  974. var self=this;
  975. return smalltalk.withContext(function($ctx1) { self["@selectedBinding"]=aBinding;
  976. _st(_st(self)._helper())._refresh();
  977. return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  978. messageSends: ["refresh", "helper"]}),
  979. smalltalk.HLKeyBinder);
  980. smalltalk.addMethod(
  981. "_selectedBinding",
  982. smalltalk.method({
  983. selector: "selectedBinding",
  984. fn: function (){
  985. var self=this;
  986. return smalltalk.withContext(function($ctx1) { var $2,$1;
  987. $2=self["@selectedBinding"];
  988. if(($receiver = $2) == nil || $receiver == undefined){
  989. $1=_st(self)._bindings();
  990. } else {
  991. $1=$2;
  992. };
  993. return $1;
  994. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinder)})},
  995. messageSends: ["ifNil:", "bindings"]}),
  996. smalltalk.HLKeyBinder);
  997. smalltalk.addMethod(
  998. "_setupEvents",
  999. smalltalk.method({
  1000. selector: "setupEvents",
  1001. fn: function (){
  1002. var self=this;
  1003. return smalltalk.withContext(function($ctx1) { _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  1004. return smalltalk.withContext(function($ctx2) { return _st(self)._handleKeyDown_(event);
  1005. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  1006. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},smalltalk.HLKeyBinder)})},
  1007. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"]}),
  1008. smalltalk.HLKeyBinder);
  1009. smalltalk.addMethod(
  1010. "_systemIsMac",
  1011. smalltalk.method({
  1012. selector: "systemIsMac",
  1013. fn: function (){
  1014. var self=this;
  1015. return smalltalk.withContext(function($ctx1) { var $1;
  1016. $1=_st(_st(navigator)._platform())._match_("Mac");
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},smalltalk.HLKeyBinder)})},
  1019. messageSends: ["match:", "platform"]}),
  1020. smalltalk.HLKeyBinder);
  1021. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1022. smalltalk.addMethod(
  1023. "_cssClass",
  1024. smalltalk.method({
  1025. selector: "cssClass",
  1026. fn: function (){
  1027. var self=this;
  1028. return smalltalk.withContext(function($ctx1) { return "key_helper";
  1029. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLKeyBinderHelper)})},
  1030. messageSends: []}),
  1031. smalltalk.HLKeyBinderHelper);
  1032. smalltalk.addMethod(
  1033. "_hide",
  1034. smalltalk.method({
  1035. selector: "hide",
  1036. fn: function (){
  1037. var self=this;
  1038. return smalltalk.withContext(function($ctx1) { _st(_st(_st(".").__comma(_st(self)._cssClass()))._asJQuery())._remove();
  1039. _st(self)._showCog();
  1040. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1041. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"]}),
  1042. smalltalk.HLKeyBinderHelper);
  1043. smalltalk.addMethod(
  1044. "_hideCog",
  1045. smalltalk.method({
  1046. selector: "hideCog",
  1047. fn: function (){
  1048. var self=this;
  1049. return smalltalk.withContext(function($ctx1) { _st(_st("#cog-helper")._asJQuery())._hide();
  1050. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1051. messageSends: ["hide", "asJQuery"]}),
  1052. smalltalk.HLKeyBinderHelper);
  1053. smalltalk.addMethod(
  1054. "_keyBinder",
  1055. smalltalk.method({
  1056. selector: "keyBinder",
  1057. fn: function (){
  1058. var self=this;
  1059. return smalltalk.withContext(function($ctx1) { var $1;
  1060. $1=self["@keyBinder"];
  1061. return $1;
  1062. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{},smalltalk.HLKeyBinderHelper)})},
  1063. messageSends: []}),
  1064. smalltalk.HLKeyBinderHelper);
  1065. smalltalk.addMethod(
  1066. "_keyBinder_",
  1067. smalltalk.method({
  1068. selector: "keyBinder:",
  1069. fn: function (aKeyBinder){
  1070. var self=this;
  1071. return smalltalk.withContext(function($ctx1) { self["@keyBinder"]=aKeyBinder;
  1072. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper)})},
  1073. messageSends: []}),
  1074. smalltalk.HLKeyBinderHelper);
  1075. smalltalk.addMethod(
  1076. "_registerBindings",
  1077. smalltalk.method({
  1078. selector: "registerBindings",
  1079. fn: function (){
  1080. var self=this;
  1081. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},smalltalk.HLKeyBinderHelper)})},
  1082. messageSends: []}),
  1083. smalltalk.HLKeyBinderHelper);
  1084. smalltalk.addMethod(
  1085. "_renderBindingGroup_on_",
  1086. smalltalk.method({
  1087. selector: "renderBindingGroup:on:",
  1088. fn: function (aBindingGroup,html){
  1089. var self=this;
  1090. return smalltalk.withContext(function($ctx1) { _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1091. return smalltalk.withContext(function($ctx2) { return _st(_st(a)._key()).__lt(_st(b)._key());
  1092. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1093. return smalltalk.withContext(function($ctx2) { return _st(each)._renderActionFor_html_(_st(self)._keyBinder(),html);
  1094. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1095. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1096. messageSends: ["do:", "renderActionFor:html:", "keyBinder", "sorted:", "<", "key", "activeBindings"]}),
  1097. smalltalk.HLKeyBinderHelper);
  1098. smalltalk.addMethod(
  1099. "_renderBindingOn_",
  1100. smalltalk.method({
  1101. selector: "renderBindingOn:",
  1102. fn: function (html){
  1103. var self=this;
  1104. return smalltalk.withContext(function($ctx1) { _st(_st(self)._selectedBinding())._renderOn_html_(self,html);
  1105. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1106. messageSends: ["renderOn:html:", "selectedBinding"]}),
  1107. smalltalk.HLKeyBinderHelper);
  1108. smalltalk.addMethod(
  1109. "_renderCloseOn_",
  1110. smalltalk.method({
  1111. selector: "renderCloseOn:",
  1112. fn: function (html){
  1113. var self=this;
  1114. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1115. $1=_st(html)._a();
  1116. _st($1)._class_("close");
  1117. _st($1)._with_((function(){
  1118. return smalltalk.withContext(function($ctx2) { return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1119. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1120. $2=_st($1)._onClick_((function(){
  1121. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._keyBinder())._deactivate();
  1122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1123. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1124. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"]}),
  1125. smalltalk.HLKeyBinderHelper);
  1126. smalltalk.addMethod(
  1127. "_renderCog",
  1128. smalltalk.method({
  1129. selector: "renderCog",
  1130. fn: function (){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  1133. _st((function(html){
  1134. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1135. _st($1)._id_("cog-helper");
  1136. $2=_st($1)._with_((function(){
  1137. return smalltalk.withContext(function($ctx3) { $3=_st(html)._a();
  1138. _st($3)._with_((function(){
  1139. return smalltalk.withContext(function($ctx4) { return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1140. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1141. $4=_st($3)._onClick_((function(){
  1142. return smalltalk.withContext(function($ctx4) { return _st(_st(self)._keyBinder())._activate();
  1143. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1144. return $4;
  1145. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1146. return $2;
  1147. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1148. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1149. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"]}),
  1150. smalltalk.HLKeyBinderHelper);
  1151. smalltalk.addMethod(
  1152. "_renderContentOn_",
  1153. smalltalk.method({
  1154. selector: "renderContentOn:",
  1155. fn: function (html){
  1156. var self=this;
  1157. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  1158. $1=_st(html)._div();
  1159. _st($1)._class_(_st(self)._cssClass());
  1160. $2=_st($1)._with_((function(){
  1161. return smalltalk.withContext(function($ctx2) { $3=self;
  1162. _st($3)._renderSelectionOn_(html);
  1163. _st($3)._renderBindingOn_(html);
  1164. $4=_st($3)._renderCloseOn_(html);
  1165. return $4;
  1166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1167. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1168. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:", "renderCloseOn:"]}),
  1169. smalltalk.HLKeyBinderHelper);
  1170. smalltalk.addMethod(
  1171. "_renderSelectionOn_",
  1172. smalltalk.method({
  1173. selector: "renderSelectionOn:",
  1174. fn: function (html){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) { var $1,$3,$5,$4,$2;
  1177. $1=_st(html)._span();
  1178. _st($1)._class_("selected");
  1179. $3=$1;
  1180. $5=_st(_st(self)._selectedBinding())._label();
  1181. if(($receiver = $5) == nil || $receiver == undefined){
  1182. $4="Action";
  1183. } else {
  1184. $4=$5;
  1185. };
  1186. $2=_st($3)._with_($4);
  1187. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1188. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"]}),
  1189. smalltalk.HLKeyBinderHelper);
  1190. smalltalk.addMethod(
  1191. "_renderStart",
  1192. smalltalk.method({
  1193. selector: "renderStart",
  1194. fn: function (){
  1195. var self=this;
  1196. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1197. _st((function(html){
  1198. return smalltalk.withContext(function($ctx2) { $1=_st(html)._div();
  1199. _st($1)._id_("keybinding-start-helper");
  1200. $2=_st($1)._with_(_st(_st("Press ").__comma(_st(_st(self)._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1201. return $2;
  1202. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1203. _st((function(){
  1204. return smalltalk.withContext(function($ctx2) { return _st(_st(window)._jQuery_("#keybinding-start-helper"))._fadeOut_((1000));
  1205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1206. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{},smalltalk.HLKeyBinderHelper)})},
  1207. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:", "jQuery:"]}),
  1208. smalltalk.HLKeyBinderHelper);
  1209. smalltalk.addMethod(
  1210. "_selectedBinding",
  1211. smalltalk.method({
  1212. selector: "selectedBinding",
  1213. fn: function (){
  1214. var self=this;
  1215. return smalltalk.withContext(function($ctx1) { var $1;
  1216. $1=_st(_st(self)._keyBinder())._selectedBinding();
  1217. return $1;
  1218. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinderHelper)})},
  1219. messageSends: ["selectedBinding", "keyBinder"]}),
  1220. smalltalk.HLKeyBinderHelper);
  1221. smalltalk.addMethod(
  1222. "_show",
  1223. smalltalk.method({
  1224. selector: "show",
  1225. fn: function (){
  1226. var self=this;
  1227. return smalltalk.withContext(function($ctx1) { _st(self)._hideCog();
  1228. _st(self)._appendToJQuery_(_st("body")._asJQuery());
  1229. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1230. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"]}),
  1231. smalltalk.HLKeyBinderHelper);
  1232. smalltalk.addMethod(
  1233. "_showCog",
  1234. smalltalk.method({
  1235. selector: "showCog",
  1236. fn: function (){
  1237. var self=this;
  1238. return smalltalk.withContext(function($ctx1) { _st(_st("#cog-helper")._asJQuery())._show();
  1239. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1240. messageSends: ["show", "asJQuery"]}),
  1241. smalltalk.HLKeyBinderHelper);
  1242. smalltalk.addMethod(
  1243. "_on_",
  1244. smalltalk.method({
  1245. selector: "on:",
  1246. fn: function (aKeyBinder){
  1247. var self=this;
  1248. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1249. $2=_st(self)._new();
  1250. _st($2)._keyBinder_(aKeyBinder);
  1251. $3=_st($2)._yourself();
  1252. $1=$3;
  1253. return $1;
  1254. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper.klass)})},
  1255. messageSends: ["keyBinder:", "new", "yourself"]}),
  1256. smalltalk.HLKeyBinderHelper.klass);