1
0

Helios-KeyBindings.deploy.js 45 KB

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