1
0

Helios-KeyBindings.deploy.js 45 KB

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