1
0

Helios-KeyBindings.deploy.js 43 KB

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