1
0

Helios-KeyBindings.deploy.js 45 KB

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