1
0

Helios-KeyBindings.js 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928
  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. category: 'actions',
  7. fn: function (aKeyBinder){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) {
  10. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBinding)})},
  11. args: ["aKeyBinder"],
  12. source: "applyOn: aKeyBinder",
  13. messageSends: [],
  14. referencedClasses: []
  15. }),
  16. smalltalk.HLBinding);
  17. smalltalk.addMethod(
  18. smalltalk.method({
  19. selector: "atKey:",
  20. category: 'accessing',
  21. fn: function (aKey){
  22. var self=this;
  23. return smalltalk.withContext(function($ctx1) {
  24. return nil;
  25. }, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBinding)})},
  26. args: ["aKey"],
  27. source: "atKey: aKey\x0a\x09^ nil",
  28. messageSends: [],
  29. referencedClasses: []
  30. }),
  31. smalltalk.HLBinding);
  32. smalltalk.addMethod(
  33. smalltalk.method({
  34. selector: "displayLabel",
  35. category: 'accessing',
  36. fn: function (){
  37. var self=this;
  38. return smalltalk.withContext(function($ctx1) {
  39. var $1;
  40. $1=_st(self)._label();
  41. return $1;
  42. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBinding)})},
  43. args: [],
  44. source: "displayLabel\x0a\x09^ self label",
  45. messageSends: ["label"],
  46. referencedClasses: []
  47. }),
  48. smalltalk.HLBinding);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "isActive",
  52. category: 'testing',
  53. fn: function (){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) {
  56. var $1;
  57. $1=_st(self)._subclassResponsibility();
  58. return $1;
  59. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBinding)})},
  60. args: [],
  61. source: "isActive\x0a\x09^ self subclassResponsibility",
  62. messageSends: ["subclassResponsibility"],
  63. referencedClasses: []
  64. }),
  65. smalltalk.HLBinding);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "isFinal",
  69. category: 'testing',
  70. fn: function (){
  71. var self=this;
  72. return smalltalk.withContext(function($ctx1) {
  73. return false;
  74. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBinding)})},
  75. args: [],
  76. source: "isFinal\x0a\x09\x22 Answer true if the receiver is the final binding of a sequence \x22\x0a\x09\x0a\x09^ false",
  77. messageSends: [],
  78. referencedClasses: []
  79. }),
  80. smalltalk.HLBinding);
  81. smalltalk.addMethod(
  82. smalltalk.method({
  83. selector: "key",
  84. category: 'accessing',
  85. fn: function (){
  86. var self=this;
  87. return smalltalk.withContext(function($ctx1) {
  88. var $1;
  89. $1=self["@key"];
  90. return $1;
  91. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLBinding)})},
  92. args: [],
  93. source: "key\x0a\x09^ key",
  94. messageSends: [],
  95. referencedClasses: []
  96. }),
  97. smalltalk.HLBinding);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "key:",
  101. category: 'accessing',
  102. fn: function (anInteger){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) {
  105. self["@key"]=anInteger;
  106. return self}, function($ctx1) {$ctx1.fill(self,"key:",{anInteger:anInteger},smalltalk.HLBinding)})},
  107. args: ["anInteger"],
  108. source: "key: anInteger\x0a\x09key := anInteger",
  109. messageSends: [],
  110. referencedClasses: []
  111. }),
  112. smalltalk.HLBinding);
  113. smalltalk.addMethod(
  114. smalltalk.method({
  115. selector: "label",
  116. category: 'accessing',
  117. fn: function (){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) {
  120. var $1;
  121. $1=self["@label"];
  122. return $1;
  123. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLBinding)})},
  124. args: [],
  125. source: "label\x0a\x09^ label",
  126. messageSends: [],
  127. referencedClasses: []
  128. }),
  129. smalltalk.HLBinding);
  130. smalltalk.addMethod(
  131. smalltalk.method({
  132. selector: "label:",
  133. category: 'accessing',
  134. fn: function (aString){
  135. var self=this;
  136. return smalltalk.withContext(function($ctx1) {
  137. self["@label"]=aString;
  138. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.HLBinding)})},
  139. args: ["aString"],
  140. source: "label: aString\x0a\x09label := aString",
  141. messageSends: [],
  142. referencedClasses: []
  143. }),
  144. smalltalk.HLBinding);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "release",
  148. category: 'actions',
  149. fn: function (){
  150. var self=this;
  151. return smalltalk.withContext(function($ctx1) {
  152. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBinding)})},
  153. args: [],
  154. source: "release",
  155. messageSends: [],
  156. referencedClasses: []
  157. }),
  158. smalltalk.HLBinding);
  159. smalltalk.addMethod(
  160. smalltalk.method({
  161. selector: "renderActionFor:html:",
  162. category: 'rendering',
  163. fn: function (aBinder,html){
  164. var self=this;
  165. return smalltalk.withContext(function($ctx1) {
  166. var $1,$3,$4,$5,$6,$2;
  167. $1=_st(html)._span();
  168. _st($1)._class_("command");
  169. $2=_st($1)._with_((function(){
  170. return smalltalk.withContext(function($ctx2) {
  171. $3=_st(html)._span();
  172. _st($3)._class_("label");
  173. $4=_st($3)._with_(_st(_st(self)._shortcut())._asLowercase());
  174. $4;
  175. $5=_st(html)._a();
  176. _st($5)._class_("action");
  177. _st($5)._with_(_st(self)._displayLabel());
  178. $6=_st($5)._onClick_((function(){
  179. return smalltalk.withContext(function($ctx3) {
  180. return _st(aBinder)._applyBinding_(self);
  181. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  182. return $6;
  183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  184. return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBinding)})},
  185. args: ["aBinder", "html"],
  186. source: "renderActionFor: aBinder html: html\x0a\x09html span class: 'command'; with: [\x0a\x09\x09html span \x0a\x09\x09\x09class: 'label'; \x0a\x09\x09\x09with: self shortcut asLowercase.\x0a \x09\x09html a \x0a \x09class: 'action'; \x0a with: self displayLabel;\x0a \x09\x09\x09onClick: [ aBinder applyBinding: self ] ]",
  187. messageSends: ["class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:"],
  188. referencedClasses: []
  189. }),
  190. smalltalk.HLBinding);
  191. smalltalk.addMethod(
  192. smalltalk.method({
  193. selector: "renderOn:html:",
  194. category: 'rendering',
  195. fn: function (aBindingHelper,html){
  196. var self=this;
  197. return smalltalk.withContext(function($ctx1) {
  198. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBinding)})},
  199. args: ["aBindingHelper", "html"],
  200. source: "renderOn: aBindingHelper html: html",
  201. messageSends: [],
  202. referencedClasses: []
  203. }),
  204. smalltalk.HLBinding);
  205. smalltalk.addMethod(
  206. smalltalk.method({
  207. selector: "shortcut",
  208. category: 'accessing',
  209. fn: function (){
  210. var self=this;
  211. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  212. return smalltalk.withContext(function($ctx1) {
  213. var $1;
  214. $1=_st($String())._fromCharCode_(_st(self)._key());
  215. return $1;
  216. }, function($ctx1) {$ctx1.fill(self,"shortcut",{},smalltalk.HLBinding)})},
  217. args: [],
  218. source: "shortcut\x0a\x09^ String fromCharCode: self key",
  219. messageSends: ["fromCharCode:", "key"],
  220. referencedClasses: ["String"]
  221. }),
  222. smalltalk.HLBinding);
  223. smalltalk.addMethod(
  224. smalltalk.method({
  225. selector: "on:labelled:",
  226. category: 'instance creation',
  227. fn: function (anInteger,aString){
  228. var self=this;
  229. return smalltalk.withContext(function($ctx1) {
  230. var $2,$3,$1;
  231. $2=_st(self)._new();
  232. _st($2)._key_(anInteger);
  233. _st($2)._label_(aString);
  234. $3=_st($2)._yourself();
  235. $1=$3;
  236. return $1;
  237. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBinding.klass)})},
  238. args: ["anInteger", "aString"],
  239. source: "on: anInteger labelled: aString\x0a\x09^ self new\x0a \x09key: anInteger;\x0a label: aString;\x0a yourself",
  240. messageSends: ["key:", "new", "label:", "yourself"],
  241. referencedClasses: []
  242. }),
  243. smalltalk.HLBinding.klass);
  244. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['command'], 'Helios-KeyBindings');
  245. smalltalk.addMethod(
  246. smalltalk.method({
  247. selector: "applyOn:",
  248. category: 'actions',
  249. fn: function (aKeyBinder){
  250. var self=this;
  251. return smalltalk.withContext(function($ctx1) {
  252. var $1;
  253. $1=_st(_st(self)._command())._isInputRequired();
  254. if(smalltalk.assert($1)){
  255. _st(aKeyBinder)._selectBinding_(_st(self)._inputBinding());
  256. } else {
  257. _st(_st(self)._command())._execute();
  258. };
  259. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingAction)})},
  260. args: ["aKeyBinder"],
  261. source: "applyOn: aKeyBinder\x0a\x09self command isInputRequired\x0a\x09\x09ifTrue: [ aKeyBinder selectBinding: self inputBinding ]\x0a\x09\x09ifFalse: [ self command execute ]",
  262. messageSends: ["ifTrue:ifFalse:", "selectBinding:", "inputBinding", "execute", "command", "isInputRequired"],
  263. referencedClasses: []
  264. }),
  265. smalltalk.HLBindingAction);
  266. smalltalk.addMethod(
  267. smalltalk.method({
  268. selector: "command",
  269. category: 'accessing',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) {
  273. var $1;
  274. $1=self["@command"];
  275. return $1;
  276. }, function($ctx1) {$ctx1.fill(self,"command",{},smalltalk.HLBindingAction)})},
  277. args: [],
  278. source: "command\x0a\x09^ command",
  279. messageSends: [],
  280. referencedClasses: []
  281. }),
  282. smalltalk.HLBindingAction);
  283. smalltalk.addMethod(
  284. smalltalk.method({
  285. selector: "command:",
  286. category: 'accessing',
  287. fn: function (aCommand){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) {
  290. self["@command"]=aCommand;
  291. return self}, function($ctx1) {$ctx1.fill(self,"command:",{aCommand:aCommand},smalltalk.HLBindingAction)})},
  292. args: ["aCommand"],
  293. source: "command: aCommand\x0a\x09command := aCommand",
  294. messageSends: [],
  295. referencedClasses: []
  296. }),
  297. smalltalk.HLBindingAction);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "inputBinding",
  301. category: 'accessing',
  302. fn: function (){
  303. var self=this;
  304. function $HLBindingInput(){return smalltalk.HLBindingInput||(typeof HLBindingInput=="undefined"?nil:HLBindingInput)}
  305. return smalltalk.withContext(function($ctx1) {
  306. var $2,$3,$4,$5,$1;
  307. $2=_st($HLBindingInput())._new();
  308. _st($2)._label_(_st(_st(self)._command())._inputLabel());
  309. _st($2)._ghostText_(_st(_st(self)._command())._displayLabel());
  310. _st($2)._defaultValue_(_st(_st(self)._command())._defaultInput());
  311. _st($2)._inputCompletion_(_st(_st(self)._command())._inputCompletion());
  312. _st($2)._callback_((function(val){
  313. return smalltalk.withContext(function($ctx2) {
  314. $3=_st(self)._command();
  315. _st($3)._input_(val);
  316. $4=_st($3)._execute();
  317. return $4;
  318. }, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1)})}));
  319. $5=_st($2)._yourself();
  320. $1=$5;
  321. return $1;
  322. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
  323. args: [],
  324. source: "inputBinding\x0a\x09^ HLBindingInput new\x0a\x09\x09label: self command inputLabel;\x0a\x09\x09ghostText: self command displayLabel;\x0a\x09\x09defaultValue: self command defaultInput;\x0a\x09\x09inputCompletion: self command inputCompletion;\x0a\x09\x09callback: [ :val | \x0a\x09\x09\x09self command \x0a\x09\x09\x09\x09input: val;\x0a\x09\x09\x09\x09execute ];\x0a\x09\x09yourself",
  325. messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "execute", "yourself"],
  326. referencedClasses: ["HLBindingInput"]
  327. }),
  328. smalltalk.HLBindingAction);
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "isActive",
  332. category: 'testing',
  333. fn: function (){
  334. var self=this;
  335. return smalltalk.withContext(function($ctx1) {
  336. var $1;
  337. $1=_st(_st(self)._command())._isActive();
  338. return $1;
  339. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingAction)})},
  340. args: [],
  341. source: "isActive\x0a\x09^ self command isActive",
  342. messageSends: ["isActive", "command"],
  343. referencedClasses: []
  344. }),
  345. smalltalk.HLBindingAction);
  346. smalltalk.addMethod(
  347. smalltalk.method({
  348. selector: "isFinal",
  349. category: 'testing',
  350. fn: function (){
  351. var self=this;
  352. return smalltalk.withContext(function($ctx1) {
  353. var $1;
  354. $1=_st(_st(_st(self)._command())._isInputRequired())._not();
  355. return $1;
  356. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingAction)})},
  357. args: [],
  358. source: "isFinal\x0a\x09^ self command isInputRequired not",
  359. messageSends: ["not", "isInputRequired", "command"],
  360. referencedClasses: []
  361. }),
  362. smalltalk.HLBindingAction);
  363. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  364. smalltalk.addMethod(
  365. smalltalk.method({
  366. selector: "activeBindings",
  367. category: 'accessing',
  368. fn: function (){
  369. var self=this;
  370. return smalltalk.withContext(function($ctx1) {
  371. var $1;
  372. $1=_st(_st(self)._bindings())._select_((function(each){
  373. return smalltalk.withContext(function($ctx2) {
  374. return _st(each)._isActive();
  375. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  376. return $1;
  377. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  378. args: [],
  379. source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
  380. messageSends: ["select:", "isActive", "bindings"],
  381. referencedClasses: []
  382. }),
  383. smalltalk.HLBindingGroup);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "add:",
  387. category: 'accessing',
  388. fn: function (aBinding){
  389. var self=this;
  390. return smalltalk.withContext(function($ctx1) {
  391. var $1;
  392. $1=_st(_st(self)._bindings())._add_(aBinding);
  393. return $1;
  394. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},smalltalk.HLBindingGroup)})},
  395. args: ["aBinding"],
  396. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  397. messageSends: ["add:", "bindings"],
  398. referencedClasses: []
  399. }),
  400. smalltalk.HLBindingGroup);
  401. smalltalk.addMethod(
  402. smalltalk.method({
  403. selector: "addActionKey:labelled:callback:",
  404. category: 'accessing',
  405. fn: function (anInteger,aString,aBlock){
  406. var self=this;
  407. function $HLBindingAction(){return smalltalk.HLBindingAction||(typeof HLBindingAction=="undefined"?nil:HLBindingAction)}
  408. return smalltalk.withContext(function($ctx1) {
  409. var $1,$2;
  410. $1=_st($HLBindingAction())._on_labelled_(anInteger,aString);
  411. _st($1)._callback_(aBlock);
  412. $2=_st($1)._yourself();
  413. _st(self)._add_($2);
  414. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},smalltalk.HLBindingGroup)})},
  415. args: ["anInteger", "aString", "aBlock"],
  416. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  417. messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
  418. referencedClasses: ["HLBindingAction"]
  419. }),
  420. smalltalk.HLBindingGroup);
  421. smalltalk.addMethod(
  422. smalltalk.method({
  423. selector: "addGroupKey:labelled:",
  424. category: 'accessing',
  425. fn: function (anInteger,aString){
  426. var self=this;
  427. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  428. return smalltalk.withContext(function($ctx1) {
  429. _st(self)._add_(_st($HLBindingGroup())._on_labelled_(anInteger,aString));
  430. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBindingGroup)})},
  431. args: ["anInteger", "aString"],
  432. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  433. messageSends: ["add:", "on:labelled:"],
  434. referencedClasses: ["HLBindingGroup"]
  435. }),
  436. smalltalk.HLBindingGroup);
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "at:",
  440. category: 'accessing',
  441. fn: function (aString){
  442. var self=this;
  443. return smalltalk.withContext(function($ctx1) {
  444. var $1;
  445. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  446. return smalltalk.withContext(function($ctx2) {
  447. return _st(_st(each)._label()).__eq(aString);
  448. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  449. return smalltalk.withContext(function($ctx2) {
  450. return nil;
  451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  452. return $1;
  453. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.HLBindingGroup)})},
  454. args: ["aString"],
  455. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  456. messageSends: ["detect:ifNone:", "=", "label", "bindings"],
  457. referencedClasses: []
  458. }),
  459. smalltalk.HLBindingGroup);
  460. smalltalk.addMethod(
  461. smalltalk.method({
  462. selector: "at:add:",
  463. category: 'accessing',
  464. fn: function (aString,aBinding){
  465. var self=this;
  466. var binding;
  467. return smalltalk.withContext(function($ctx1) {
  468. var $1,$2;
  469. binding=_st(self)._at_(aString);
  470. $1=binding;
  471. if(($receiver = $1) == nil || $receiver == undefined){
  472. $2=self;
  473. return $2;
  474. } else {
  475. $1;
  476. };
  477. _st(binding)._add_(aBinding);
  478. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  479. args: ["aString", "aBinding"],
  480. source: "at: aString add: aBinding\x0a\x09| binding |\x0a\x09\x0a\x09binding := self at: aString.\x0a\x09binding ifNil: [ ^ self ].\x0a\x09\x09\x0a\x09binding add: aBinding",
  481. messageSends: ["at:", "ifNil:", "add:"],
  482. referencedClasses: []
  483. }),
  484. smalltalk.HLBindingGroup);
  485. smalltalk.addMethod(
  486. smalltalk.method({
  487. selector: "atKey:",
  488. category: 'accessing',
  489. fn: function (anInteger){
  490. var self=this;
  491. return smalltalk.withContext(function($ctx1) {
  492. var $1;
  493. $1=_st(_st(self)._bindings())._detect_ifNone_((function(each){
  494. return smalltalk.withContext(function($ctx2) {
  495. return _st(_st(each)._key()).__eq(anInteger);
  496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  497. return smalltalk.withContext(function($ctx2) {
  498. return nil;
  499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  500. return $1;
  501. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},smalltalk.HLBindingGroup)})},
  502. args: ["anInteger"],
  503. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  504. messageSends: ["detect:ifNone:", "=", "key", "bindings"],
  505. referencedClasses: []
  506. }),
  507. smalltalk.HLBindingGroup);
  508. smalltalk.addMethod(
  509. smalltalk.method({
  510. selector: "bindings",
  511. category: 'accessing',
  512. fn: function (){
  513. var self=this;
  514. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  515. return smalltalk.withContext(function($ctx1) {
  516. var $2,$1;
  517. $2=self["@bindings"];
  518. if(($receiver = $2) == nil || $receiver == undefined){
  519. self["@bindings"]=_st($OrderedCollection())._new();
  520. $1=self["@bindings"];
  521. } else {
  522. $1=$2;
  523. };
  524. return $1;
  525. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLBindingGroup)})},
  526. args: [],
  527. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  528. messageSends: ["ifNil:", "new"],
  529. referencedClasses: ["OrderedCollection"]
  530. }),
  531. smalltalk.HLBindingGroup);
  532. smalltalk.addMethod(
  533. smalltalk.method({
  534. selector: "displayLabel",
  535. category: 'accessing',
  536. fn: function (){
  537. var self=this;
  538. return smalltalk.withContext(function($ctx1) {
  539. var $1;
  540. $1=_st(smalltalk.HLBinding.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  541. return $1;
  542. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBindingGroup)})},
  543. args: [],
  544. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  545. messageSends: [",", "displayLabel"],
  546. referencedClasses: []
  547. }),
  548. smalltalk.HLBindingGroup);
  549. smalltalk.addMethod(
  550. smalltalk.method({
  551. selector: "isActive",
  552. category: 'testing',
  553. fn: function (){
  554. var self=this;
  555. return smalltalk.withContext(function($ctx1) {
  556. var $1;
  557. $1=_st(_st(self)._activeBindings())._notEmpty();
  558. return $1;
  559. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  560. args: [],
  561. source: "isActive\x0a\x09^ self activeBindings notEmpty",
  562. messageSends: ["notEmpty", "activeBindings"],
  563. referencedClasses: []
  564. }),
  565. smalltalk.HLBindingGroup);
  566. smalltalk.addMethod(
  567. smalltalk.method({
  568. selector: "release",
  569. category: 'actions',
  570. fn: function (){
  571. var self=this;
  572. return smalltalk.withContext(function($ctx1) {
  573. _st(_st(self)._bindings())._do_((function(each){
  574. return smalltalk.withContext(function($ctx2) {
  575. return _st(each)._release();
  576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  577. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingGroup)})},
  578. args: [],
  579. source: "release\x0a\x09self bindings do: [ :each | each release ]",
  580. messageSends: ["do:", "release", "bindings"],
  581. referencedClasses: []
  582. }),
  583. smalltalk.HLBindingGroup);
  584. smalltalk.addMethod(
  585. smalltalk.method({
  586. selector: "renderOn:html:",
  587. category: 'rendering',
  588. fn: function (aBindingHelper,html){
  589. var self=this;
  590. return smalltalk.withContext(function($ctx1) {
  591. var $1;
  592. $1=_st(self)._isActive();
  593. if(smalltalk.assert($1)){
  594. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  595. };
  596. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  597. args: ["aBindingHelper", "html"],
  598. source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
  599. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"],
  600. referencedClasses: []
  601. }),
  602. smalltalk.HLBindingGroup);
  603. smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'wrapper', 'binder', 'ghostText', 'isFinal', 'message', 'messageTag', 'inputCompletion', 'defaultValue'], 'Helios-KeyBindings');
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "applyOn:",
  607. category: 'actions',
  608. fn: function (aKeyBinder){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. _st(self)._isFinal_(true);
  612. _st(self)._evaluate_(_st(_st(_st(self)._input())._asJQuery())._val());
  613. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
  614. args: ["aKeyBinder"],
  615. source: "applyOn: aKeyBinder\x0a\x09self isFinal: true.\x0a\x09self evaluate: self input asJQuery val",
  616. messageSends: ["isFinal:", "evaluate:", "val", "asJQuery", "input"],
  617. referencedClasses: []
  618. }),
  619. smalltalk.HLBindingInput);
  620. smalltalk.addMethod(
  621. smalltalk.method({
  622. selector: "atKey:",
  623. category: 'accessing',
  624. fn: function (aKey){
  625. var self=this;
  626. return smalltalk.withContext(function($ctx1) {
  627. var $1;
  628. $1=_st(aKey).__eq((13));
  629. if(! smalltalk.assert($1)){
  630. return nil;
  631. };
  632. return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
  633. args: ["aKey"],
  634. source: "atKey: aKey\x0a\x09aKey = 13 ifFalse: [ ^ nil ]",
  635. messageSends: ["ifFalse:", "="],
  636. referencedClasses: []
  637. }),
  638. smalltalk.HLBindingInput);
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "callback",
  642. category: 'accessing',
  643. fn: function (){
  644. var self=this;
  645. return smalltalk.withContext(function($ctx1) {
  646. var $2,$1;
  647. $2=self["@callback"];
  648. if(($receiver = $2) == nil || $receiver == undefined){
  649. self["@callback"]=(function(value){
  650. return smalltalk.withContext(function($ctx2) {
  651. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})});
  652. $1=self["@callback"];
  653. } else {
  654. $1=$2;
  655. };
  656. return $1;
  657. }, function($ctx1) {$ctx1.fill(self,"callback",{},smalltalk.HLBindingInput)})},
  658. args: [],
  659. source: "callback\x0a\x09^ callback ifNil: [ callback := [ :value | ] ]",
  660. messageSends: ["ifNil:"],
  661. referencedClasses: []
  662. }),
  663. smalltalk.HLBindingInput);
  664. smalltalk.addMethod(
  665. smalltalk.method({
  666. selector: "callback:",
  667. category: 'accessing',
  668. fn: function (aBlock){
  669. var self=this;
  670. return smalltalk.withContext(function($ctx1) {
  671. self["@callback"]=aBlock;
  672. return self}, function($ctx1) {$ctx1.fill(self,"callback:",{aBlock:aBlock},smalltalk.HLBindingInput)})},
  673. args: ["aBlock"],
  674. source: "callback: aBlock\x0a\x09callback := aBlock",
  675. messageSends: [],
  676. referencedClasses: []
  677. }),
  678. smalltalk.HLBindingInput);
  679. smalltalk.addMethod(
  680. smalltalk.method({
  681. selector: "clearStatus",
  682. category: 'actions',
  683. fn: function (){
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) {
  686. _st(self)._status_("info");
  687. _st(self)._message_("");
  688. _st(self)._refresh();
  689. return self}, function($ctx1) {$ctx1.fill(self,"clearStatus",{},smalltalk.HLBindingInput)})},
  690. args: [],
  691. source: "clearStatus\x0a\x09self status: 'info'.\x0a\x09self message: ''.\x0a\x09self refresh",
  692. messageSends: ["status:", "message:", "refresh"],
  693. referencedClasses: []
  694. }),
  695. smalltalk.HLBindingInput);
  696. smalltalk.addMethod(
  697. smalltalk.method({
  698. selector: "defaultValue",
  699. category: 'accessing',
  700. fn: function (){
  701. var self=this;
  702. return smalltalk.withContext(function($ctx1) {
  703. var $2,$1;
  704. $2=self["@defaultValue"];
  705. if(($receiver = $2) == nil || $receiver == undefined){
  706. $1="";
  707. } else {
  708. $1=$2;
  709. };
  710. return $1;
  711. }, function($ctx1) {$ctx1.fill(self,"defaultValue",{},smalltalk.HLBindingInput)})},
  712. args: [],
  713. source: "defaultValue\x0a\x09^ defaultValue ifNil: [ '' ]",
  714. messageSends: ["ifNil:"],
  715. referencedClasses: []
  716. }),
  717. smalltalk.HLBindingInput);
  718. smalltalk.addMethod(
  719. smalltalk.method({
  720. selector: "defaultValue:",
  721. category: 'accessing',
  722. fn: function (aString){
  723. var self=this;
  724. return smalltalk.withContext(function($ctx1) {
  725. self["@defaultValue"]=aString;
  726. return self}, function($ctx1) {$ctx1.fill(self,"defaultValue:",{aString:aString},smalltalk.HLBindingInput)})},
  727. args: ["aString"],
  728. source: "defaultValue: aString\x0a\x09defaultValue := aString",
  729. messageSends: [],
  730. referencedClasses: []
  731. }),
  732. smalltalk.HLBindingInput);
  733. smalltalk.addMethod(
  734. smalltalk.method({
  735. selector: "errorStatus",
  736. category: 'actions',
  737. fn: function (){
  738. var self=this;
  739. return smalltalk.withContext(function($ctx1) {
  740. _st(self)._status_("error");
  741. _st(self)._refresh();
  742. return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},smalltalk.HLBindingInput)})},
  743. args: [],
  744. source: "errorStatus\x0a\x09self status: 'error'.\x0a\x09self refresh",
  745. messageSends: ["status:", "refresh"],
  746. referencedClasses: []
  747. }),
  748. smalltalk.HLBindingInput);
  749. smalltalk.addMethod(
  750. smalltalk.method({
  751. selector: "evaluate:",
  752. category: 'actions',
  753. fn: function (aString){
  754. var self=this;
  755. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  756. return smalltalk.withContext(function($ctx1) {
  757. _st((function(){
  758. return smalltalk.withContext(function($ctx2) {
  759. return _st(_st(self)._callback())._value_(aString);
  760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  761. return smalltalk.withContext(function($ctx2) {
  762. _st(_st(_st(self)._input())._asJQuery())._one_do_("keydown",(function(){
  763. return smalltalk.withContext(function($ctx3) {
  764. return _st(self)._clearStatus();
  765. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  766. _st(self)._message_(_st(ex)._messageText());
  767. _st(self)._errorStatus();
  768. return _st(self)._isFinal_(false);
  769. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  770. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},smalltalk.HLBindingInput)})},
  771. args: ["aString"],
  772. source: "evaluate: aString\x0a\x09\x0a\x09[ self callback value: aString ]\x0a\x09on: Error\x0a\x09do: [:ex |\x0a\x09\x09self input asJQuery \x0a\x09\x09\x09one: 'keydown' \x0a\x09\x09\x09do: [ self clearStatus ].\x0a\x09\x09self message: ex messageText.\x0a\x09\x09self errorStatus.\x0a\x09\x09self isFinal: false ].",
  773. messageSends: ["on:do:", "one:do:", "clearStatus", "asJQuery", "input", "message:", "messageText", "errorStatus", "isFinal:", "value:", "callback"],
  774. referencedClasses: ["Error"]
  775. }),
  776. smalltalk.HLBindingInput);
  777. smalltalk.addMethod(
  778. smalltalk.method({
  779. selector: "ghostText",
  780. category: 'accessing',
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) {
  784. var $1;
  785. $1=self["@ghostText"];
  786. return $1;
  787. }, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
  788. args: [],
  789. source: "ghostText\x0a\x09^ ghostText",
  790. messageSends: [],
  791. referencedClasses: []
  792. }),
  793. smalltalk.HLBindingInput);
  794. smalltalk.addMethod(
  795. smalltalk.method({
  796. selector: "ghostText:",
  797. category: 'accessing',
  798. fn: function (aText){
  799. var self=this;
  800. return smalltalk.withContext(function($ctx1) {
  801. self["@ghostText"]=aText;
  802. return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
  803. args: ["aText"],
  804. source: "ghostText: aText\x0a\x09ghostText := aText",
  805. messageSends: [],
  806. referencedClasses: []
  807. }),
  808. smalltalk.HLBindingInput);
  809. smalltalk.addMethod(
  810. smalltalk.method({
  811. selector: "input",
  812. category: 'accessing',
  813. fn: function (){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. var $1;
  817. $1=self["@input"];
  818. return $1;
  819. }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
  820. args: [],
  821. source: "input\x0a\x09^ input",
  822. messageSends: [],
  823. referencedClasses: []
  824. }),
  825. smalltalk.HLBindingInput);
  826. smalltalk.addMethod(
  827. smalltalk.method({
  828. selector: "inputCompletion",
  829. category: 'accessing',
  830. fn: function (){
  831. var self=this;
  832. return smalltalk.withContext(function($ctx1) {
  833. var $2,$1;
  834. $2=self["@inputCompletion"];
  835. if(($receiver = $2) == nil || $receiver == undefined){
  836. $1=[];
  837. } else {
  838. $1=$2;
  839. };
  840. return $1;
  841. }, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},smalltalk.HLBindingInput)})},
  842. args: [],
  843. source: "inputCompletion\x0a\x09^ inputCompletion ifNil: [ #() ]",
  844. messageSends: ["ifNil:"],
  845. referencedClasses: []
  846. }),
  847. smalltalk.HLBindingInput);
  848. smalltalk.addMethod(
  849. smalltalk.method({
  850. selector: "inputCompletion:",
  851. category: 'accessing',
  852. fn: function (aCollection){
  853. var self=this;
  854. return smalltalk.withContext(function($ctx1) {
  855. self["@inputCompletion"]=aCollection;
  856. return self}, function($ctx1) {$ctx1.fill(self,"inputCompletion:",{aCollection:aCollection},smalltalk.HLBindingInput)})},
  857. args: ["aCollection"],
  858. source: "inputCompletion: aCollection\x0a\x09inputCompletion := aCollection",
  859. messageSends: [],
  860. referencedClasses: []
  861. }),
  862. smalltalk.HLBindingInput);
  863. smalltalk.addMethod(
  864. smalltalk.method({
  865. selector: "isActive",
  866. category: 'testing',
  867. fn: function (){
  868. var self=this;
  869. return smalltalk.withContext(function($ctx1) {
  870. return true;
  871. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingInput)})},
  872. args: [],
  873. source: "isActive\x0a\x09^ true",
  874. messageSends: [],
  875. referencedClasses: []
  876. }),
  877. smalltalk.HLBindingInput);
  878. smalltalk.addMethod(
  879. smalltalk.method({
  880. selector: "isFinal",
  881. category: 'testing',
  882. fn: function (){
  883. var self=this;
  884. return smalltalk.withContext(function($ctx1) {
  885. var $2,$1;
  886. $2=self["@isFinal"];
  887. if(($receiver = $2) == nil || $receiver == undefined){
  888. self["@isFinal"]=smalltalk.HLBinding.fn.prototype._isFinal.apply(_st(self), []);
  889. $1=self["@isFinal"];
  890. } else {
  891. $1=$2;
  892. };
  893. return $1;
  894. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
  895. args: [],
  896. source: "isFinal\x0a\x09^ isFinal ifNil: [ isFinal := super isFinal ]",
  897. messageSends: ["ifNil:", "isFinal"],
  898. referencedClasses: []
  899. }),
  900. smalltalk.HLBindingInput);
  901. smalltalk.addMethod(
  902. smalltalk.method({
  903. selector: "isFinal:",
  904. category: 'testing',
  905. fn: function (aBoolean){
  906. var self=this;
  907. return smalltalk.withContext(function($ctx1) {
  908. self["@isFinal"]=aBoolean;
  909. return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
  910. args: ["aBoolean"],
  911. source: "isFinal: aBoolean\x0a\x09isFinal := aBoolean",
  912. messageSends: [],
  913. referencedClasses: []
  914. }),
  915. smalltalk.HLBindingInput);
  916. smalltalk.addMethod(
  917. smalltalk.method({
  918. selector: "message",
  919. category: 'accessing',
  920. fn: function (){
  921. var self=this;
  922. return smalltalk.withContext(function($ctx1) {
  923. var $2,$1;
  924. $2=self["@message"];
  925. if(($receiver = $2) == nil || $receiver == undefined){
  926. self["@message"]="";
  927. $1=self["@message"];
  928. } else {
  929. $1=$2;
  930. };
  931. return $1;
  932. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.HLBindingInput)})},
  933. args: [],
  934. source: "message\x0a\x09^ message ifNil: [ message := '' ]",
  935. messageSends: ["ifNil:"],
  936. referencedClasses: []
  937. }),
  938. smalltalk.HLBindingInput);
  939. smalltalk.addMethod(
  940. smalltalk.method({
  941. selector: "message:",
  942. category: 'accessing',
  943. fn: function (aString){
  944. var self=this;
  945. return smalltalk.withContext(function($ctx1) {
  946. self["@message"]=aString;
  947. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aString:aString},smalltalk.HLBindingInput)})},
  948. args: ["aString"],
  949. source: "message: aString\x0a\x09message := aString",
  950. messageSends: [],
  951. referencedClasses: []
  952. }),
  953. smalltalk.HLBindingInput);
  954. smalltalk.addMethod(
  955. smalltalk.method({
  956. selector: "refresh",
  957. category: 'rendering',
  958. fn: function (){
  959. var self=this;
  960. return smalltalk.withContext(function($ctx1) {
  961. var $1,$2;
  962. $1=self["@wrapper"];
  963. if(($receiver = $1) == nil || $receiver == undefined){
  964. $2=self;
  965. return $2;
  966. } else {
  967. $1;
  968. };
  969. _st(self["@wrapper"])._class_(_st(self)._status());
  970. _st(self["@messageTag"])._contents_(_st(self)._message());
  971. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
  972. args: [],
  973. source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a \x0a\x09wrapper class: self status.\x0a\x09messageTag contents: self message",
  974. messageSends: ["ifNil:", "class:", "status", "contents:", "message"],
  975. referencedClasses: []
  976. }),
  977. smalltalk.HLBindingInput);
  978. smalltalk.addMethod(
  979. smalltalk.method({
  980. selector: "release",
  981. category: 'actions',
  982. fn: function (){
  983. var self=this;
  984. return smalltalk.withContext(function($ctx1) {
  985. self["@status"]=nil;
  986. self["@wrapper"]=nil;
  987. self["@binder"]=nil;
  988. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingInput)})},
  989. args: [],
  990. source: "release\x0a\x09status := nil.\x0a\x09wrapper := nil.\x0a\x09binder := nil",
  991. messageSends: [],
  992. referencedClasses: []
  993. }),
  994. smalltalk.HLBindingInput);
  995. smalltalk.addMethod(
  996. smalltalk.method({
  997. selector: "renderOn:html:",
  998. category: 'rendering',
  999. fn: function (aBinder,html){
  1000. var self=this;
  1001. return smalltalk.withContext(function($ctx1) {
  1002. var $1,$2,$4,$5,$6,$7,$3;
  1003. self["@binder"]=aBinder;
  1004. $1=self["@wrapper"];
  1005. if(($receiver = $1) == nil || $receiver == undefined){
  1006. self["@wrapper"]=_st(html)._span();
  1007. self["@wrapper"];
  1008. } else {
  1009. $1;
  1010. };
  1011. $2=self["@wrapper"];
  1012. _st($2)._class_(_st(self)._status());
  1013. $3=_st($2)._with_((function(){
  1014. return smalltalk.withContext(function($ctx2) {
  1015. $4=_st(html)._input();
  1016. _st($4)._placeholder_(_st(self)._ghostText());
  1017. _st($4)._value_(_st(self)._defaultValue());
  1018. $5=_st($4)._yourself();
  1019. self["@input"]=$5;
  1020. self["@input"];
  1021. _st(_st(self["@input"])._asJQuery())._typeahead_(smalltalk.HashedCollection._fromPairs_([_st("source").__minus_gt(_st(self)._inputCompletion())]));
  1022. $6=_st(html)._span();
  1023. _st($6)._class_("help-inline");
  1024. _st($6)._with_(_st(self)._message());
  1025. $7=_st($6)._yourself();
  1026. self["@messageTag"]=$7;
  1027. return self["@messageTag"];
  1028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1029. _st((function(){
  1030. return smalltalk.withContext(function($ctx2) {
  1031. return _st(_st(self["@input"])._asJQuery())._focus();
  1032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((10));
  1033. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
  1034. args: ["aBinder", "html"],
  1035. source: "renderOn: aBinder html: html\x0a\x09binder := aBinder.\x0a\x09wrapper ifNil: [ wrapper := html span ].\x0a\x0a\x09wrapper \x0a\x09\x09class: self status;\x0a\x09\x09with: [\x0a\x09\x09\x09input := html input\x0a\x09\x09\x09\x09placeholder: self ghostText;\x0a\x09\x09\x09\x09value: self defaultValue;\x0a\x09\x09\x09\x09yourself.\x0a\x09\x09\x09input asJQuery \x0a\x09\x09\x09\x09typeahead: #{ 'source' -> self inputCompletion }.\x0a\x09\x09\x09messageTag := (html span\x0a\x09\x09\x09\x09class: 'help-inline';\x0a\x09\x09\x09\x09with: self message;\x0a\x09\x09\x09\x09yourself) ].\x0a\x09\x0a\x09\x22Evaluate with a timeout to ensure focus.\x0a\x09Commands can be executed from a menu, clicking on the menu to\x0a\x09evaluate the command would give it the focus otherwise\x22\x0a\x09\x0a\x09[ input asJQuery focus ] valueWithTimeout: 10",
  1036. messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "ghostText", "input", "value:", "defaultValue", "yourself", "typeahead:", "->", "inputCompletion", "asJQuery", "message", "valueWithTimeout:", "focus"],
  1037. referencedClasses: []
  1038. }),
  1039. smalltalk.HLBindingInput);
  1040. smalltalk.addMethod(
  1041. smalltalk.method({
  1042. selector: "status",
  1043. category: 'accessing',
  1044. fn: function (){
  1045. var self=this;
  1046. return smalltalk.withContext(function($ctx1) {
  1047. var $2,$1;
  1048. $2=self["@status"];
  1049. if(($receiver = $2) == nil || $receiver == undefined){
  1050. self["@status"]="info";
  1051. $1=self["@status"];
  1052. } else {
  1053. $1=$2;
  1054. };
  1055. return $1;
  1056. }, function($ctx1) {$ctx1.fill(self,"status",{},smalltalk.HLBindingInput)})},
  1057. args: [],
  1058. source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
  1059. messageSends: ["ifNil:"],
  1060. referencedClasses: []
  1061. }),
  1062. smalltalk.HLBindingInput);
  1063. smalltalk.addMethod(
  1064. smalltalk.method({
  1065. selector: "status:",
  1066. category: 'accessing',
  1067. fn: function (aStatus){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) {
  1070. self["@status"]=aStatus;
  1071. return self}, function($ctx1) {$ctx1.fill(self,"status:",{aStatus:aStatus},smalltalk.HLBindingInput)})},
  1072. args: ["aStatus"],
  1073. source: "status: aStatus\x0a\x09status := aStatus",
  1074. messageSends: [],
  1075. referencedClasses: []
  1076. }),
  1077. smalltalk.HLBindingInput);
  1078. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  1079. smalltalk.addMethod(
  1080. smalltalk.method({
  1081. selector: "activate",
  1082. category: 'actions',
  1083. fn: function (){
  1084. var self=this;
  1085. return smalltalk.withContext(function($ctx1) {
  1086. _st(_st(self)._helper())._show();
  1087. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  1088. args: [],
  1089. source: "activate\x0a\x09self helper show",
  1090. messageSends: ["show", "helper"],
  1091. referencedClasses: []
  1092. }),
  1093. smalltalk.HLKeyBinder);
  1094. smalltalk.addMethod(
  1095. smalltalk.method({
  1096. selector: "activationKey",
  1097. category: 'accessing',
  1098. fn: function (){
  1099. var self=this;
  1100. return smalltalk.withContext(function($ctx1) {
  1101. var $1;
  1102. $1=(32);
  1103. return $1;
  1104. }, function($ctx1) {$ctx1.fill(self,"activationKey",{},smalltalk.HLKeyBinder)})},
  1105. args: [],
  1106. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  1107. messageSends: [],
  1108. referencedClasses: []
  1109. }),
  1110. smalltalk.HLKeyBinder);
  1111. smalltalk.addMethod(
  1112. smalltalk.method({
  1113. selector: "activationKeyLabel",
  1114. category: 'accessing',
  1115. fn: function (){
  1116. var self=this;
  1117. return smalltalk.withContext(function($ctx1) {
  1118. return "ctrl + space";
  1119. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{},smalltalk.HLKeyBinder)})},
  1120. args: [],
  1121. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  1122. messageSends: [],
  1123. referencedClasses: []
  1124. }),
  1125. smalltalk.HLKeyBinder);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "applyBinding:",
  1129. category: 'actions',
  1130. fn: function (aBinding){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) {
  1133. var $1,$2,$3;
  1134. $1=_st(aBinding)._isActive();
  1135. if(! smalltalk.assert($1)){
  1136. $2=self;
  1137. return $2;
  1138. };
  1139. _st(self)._selectBinding_(aBinding);
  1140. _st(aBinding)._applyOn_(self);
  1141. $3=_st(aBinding)._isFinal();
  1142. if(smalltalk.assert($3)){
  1143. _st(self)._deactivate();
  1144. };
  1145. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1146. args: ["aBinding"],
  1147. source: "applyBinding: aBinding\x0a\x09aBinding isActive ifFalse: [ ^ self ].\x0a\x09\x0a\x09self selectBinding: aBinding.\x0a aBinding applyOn: self.\x0a\x09\x0a\x09aBinding isFinal ifTrue: [ self deactivate ]",
  1148. messageSends: ["ifFalse:", "isActive", "selectBinding:", "applyOn:", "ifTrue:", "deactivate", "isFinal"],
  1149. referencedClasses: []
  1150. }),
  1151. smalltalk.HLKeyBinder);
  1152. smalltalk.addMethod(
  1153. smalltalk.method({
  1154. selector: "bindings",
  1155. category: 'accessing',
  1156. fn: function (){
  1157. var self=this;
  1158. return smalltalk.withContext(function($ctx1) {
  1159. var $2,$1;
  1160. $2=self["@bindings"];
  1161. if(($receiver = $2) == nil || $receiver == undefined){
  1162. self["@bindings"]=_st(self)._defaultBindings();
  1163. $1=self["@bindings"];
  1164. } else {
  1165. $1=$2;
  1166. };
  1167. return $1;
  1168. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLKeyBinder)})},
  1169. args: [],
  1170. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
  1171. messageSends: ["ifNil:", "defaultBindings"],
  1172. referencedClasses: []
  1173. }),
  1174. smalltalk.HLKeyBinder);
  1175. smalltalk.addMethod(
  1176. smalltalk.method({
  1177. selector: "deactivate",
  1178. category: 'actions',
  1179. fn: function (){
  1180. var self=this;
  1181. return smalltalk.withContext(function($ctx1) {
  1182. var $1;
  1183. $1=self["@selectedBinding"];
  1184. if(($receiver = $1) == nil || $receiver == undefined){
  1185. $1;
  1186. } else {
  1187. _st(self["@selectedBinding"])._release();
  1188. };
  1189. self["@selectedBinding"]=nil;
  1190. _st(_st(self)._helper())._hide();
  1191. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},smalltalk.HLKeyBinder)})},
  1192. args: [],
  1193. source: "deactivate\x0a\x09selectedBinding ifNotNil: [ selectedBinding release ].\x0a selectedBinding := nil.\x0a\x09self helper hide",
  1194. messageSends: ["ifNotNil:", "release", "hide", "helper"],
  1195. referencedClasses: []
  1196. }),
  1197. smalltalk.HLKeyBinder);
  1198. smalltalk.addMethod(
  1199. smalltalk.method({
  1200. selector: "defaultBindings",
  1201. category: 'defaults',
  1202. fn: function (){
  1203. var self=this;
  1204. var group;
  1205. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  1206. function $HLCloseTabCommand(){return smalltalk.HLCloseTabCommand||(typeof HLCloseTabCommand=="undefined"?nil:HLCloseTabCommand)}
  1207. function $HLOpenCommand(){return smalltalk.HLOpenCommand||(typeof HLOpenCommand=="undefined"?nil:HLOpenCommand)}
  1208. return smalltalk.withContext(function($ctx1) {
  1209. var $1,$2,$3;
  1210. $1=_st($HLBindingGroup())._new();
  1211. _st($1)._addGroupKey_labelled_((86),"View");
  1212. _st($1)._add_(_st(_st($HLCloseTabCommand())._new())._asBinding());
  1213. $2=_st($1)._yourself();
  1214. group=$2;
  1215. _st($HLOpenCommand())._registerConcreteClassesOn_(group);
  1216. $3=group;
  1217. return $3;
  1218. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  1219. args: [],
  1220. source: "defaultBindings\x0a\x09| group |\x0a\x09\x0a\x09group := HLBindingGroup new\x0a\x09\x09addGroupKey: 86 labelled: 'View';\x0a\x09\x09add: HLCloseTabCommand new asBinding;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09HLOpenCommand registerConcreteClassesOn: group.\x0a\x09\x09\x09\x09\x0a\x09^ group",
  1221. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "registerConcreteClassesOn:"],
  1222. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLOpenCommand"]
  1223. }),
  1224. smalltalk.HLKeyBinder);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "escapeKey",
  1228. category: 'accessing',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. var $1;
  1233. $1=(27);
  1234. return $1;
  1235. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{},smalltalk.HLKeyBinder)})},
  1236. args: [],
  1237. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  1238. messageSends: [],
  1239. referencedClasses: []
  1240. }),
  1241. smalltalk.HLKeyBinder);
  1242. smalltalk.addMethod(
  1243. smalltalk.method({
  1244. selector: "flushBindings",
  1245. category: 'actions',
  1246. fn: function (){
  1247. var self=this;
  1248. return smalltalk.withContext(function($ctx1) {
  1249. self["@bindings"]=nil;
  1250. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{},smalltalk.HLKeyBinder)})},
  1251. args: [],
  1252. source: "flushBindings\x0a\x09bindings := nil",
  1253. messageSends: [],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.HLKeyBinder);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "handleActiveKeyDown:",
  1260. category: 'events',
  1261. fn: function (event){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. var $1,$2;
  1265. $1=_st(_st(_st(event)._which()).__eq(_st(self)._escapeKey()))._or_((function(){
  1266. return smalltalk.withContext(function($ctx2) {
  1267. return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  1268. return smalltalk.withContext(function($ctx3) {
  1269. return _st(event)._ctrlKey();
  1270. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1272. if(smalltalk.assert($1)){
  1273. _st(self)._deactivate();
  1274. _st(event)._preventDefault();
  1275. return false;
  1276. };
  1277. $2=_st(self)._handleBindingFor_(event);
  1278. return $2;
  1279. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1280. args: ["event"],
  1281. source: "handleActiveKeyDown: event\x0a\x0a\x09\x22ESC or ctrl+g deactivate the keyBinder\x22\x0a\x09(event which = self escapeKey or: [\x0a\x09\x09event which = 71 and: [ event ctrlKey ] ])\x0a \x09ifTrue: [ \x0a \x09self deactivate.\x0a\x09\x09\x09\x09event preventDefault.\x0a\x09\x09\x09\x09^ false ].\x0a \x0a \x22Handle the keybinding\x22\x0a ^ self handleBindingFor: event",
  1282. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  1283. referencedClasses: []
  1284. }),
  1285. smalltalk.HLKeyBinder);
  1286. smalltalk.addMethod(
  1287. smalltalk.method({
  1288. selector: "handleBindingFor:",
  1289. category: 'events',
  1290. fn: function (anEvent){
  1291. var self=this;
  1292. var binding;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. var $1;
  1295. binding=_st(_st(self)._selectedBinding())._atKey_(_st(anEvent)._which());
  1296. $1=binding;
  1297. if(($receiver = $1) == nil || $receiver == undefined){
  1298. $1;
  1299. } else {
  1300. _st(self)._applyBinding_(binding);
  1301. _st(anEvent)._preventDefault();
  1302. return false;
  1303. };
  1304. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},smalltalk.HLKeyBinder)})},
  1305. args: ["anEvent"],
  1306. source: "handleBindingFor: anEvent\x0a\x09| binding |\x0a binding := self selectedBinding atKey: anEvent which.\x0a \x0a binding ifNotNil: [ \x0a \x09self applyBinding: binding.\x0a\x09\x09anEvent preventDefault.\x0a\x09\x09^ false ]",
  1307. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  1308. referencedClasses: []
  1309. }),
  1310. smalltalk.HLKeyBinder);
  1311. smalltalk.addMethod(
  1312. smalltalk.method({
  1313. selector: "handleInactiveKeyDown:",
  1314. category: 'events',
  1315. fn: function (event){
  1316. var self=this;
  1317. return smalltalk.withContext(function($ctx1) {
  1318. var $1,$2;
  1319. $1=_st(_st(event)._which()).__eq(_st(self)._activationKey());
  1320. if(smalltalk.assert($1)){
  1321. $2=_st(event)._ctrlKey();
  1322. if(smalltalk.assert($2)){
  1323. _st(self)._activate();
  1324. _st(event)._preventDefault();
  1325. return false;
  1326. };
  1327. };
  1328. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1329. args: ["event"],
  1330. source: "handleInactiveKeyDown: event\x0a\x09event which = self activationKey ifTrue: [\x0a \x09event ctrlKey ifTrue: [\x0a\x09\x09\x09self activate. \x0a event preventDefault. \x0a ^ false ] ]",
  1331. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  1332. referencedClasses: []
  1333. }),
  1334. smalltalk.HLKeyBinder);
  1335. smalltalk.addMethod(
  1336. smalltalk.method({
  1337. selector: "handleKeyDown:",
  1338. category: 'events',
  1339. fn: function (event){
  1340. var self=this;
  1341. return smalltalk.withContext(function($ctx1) {
  1342. var $2,$1;
  1343. $2=_st(self)._isActive();
  1344. if(smalltalk.assert($2)){
  1345. $1=_st(self)._handleActiveKeyDown_(event);
  1346. } else {
  1347. $1=_st(self)._handleInactiveKeyDown_(event);
  1348. };
  1349. return $1;
  1350. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1351. args: ["event"],
  1352. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  1353. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  1354. referencedClasses: []
  1355. }),
  1356. smalltalk.HLKeyBinder);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "helper",
  1360. category: 'accessing',
  1361. fn: function (){
  1362. var self=this;
  1363. return smalltalk.withContext(function($ctx1) {
  1364. var $1;
  1365. $1=self["@helper"];
  1366. return $1;
  1367. }, function($ctx1) {$ctx1.fill(self,"helper",{},smalltalk.HLKeyBinder)})},
  1368. args: [],
  1369. source: "helper\x0a\x09^ helper",
  1370. messageSends: [],
  1371. referencedClasses: []
  1372. }),
  1373. smalltalk.HLKeyBinder);
  1374. smalltalk.addMethod(
  1375. smalltalk.method({
  1376. selector: "initialize",
  1377. category: 'initialization',
  1378. fn: function (){
  1379. var self=this;
  1380. function $HLKeyBinderHelper(){return smalltalk.HLKeyBinderHelper||(typeof HLKeyBinderHelper=="undefined"?nil:HLKeyBinderHelper)}
  1381. return smalltalk.withContext(function($ctx1) {
  1382. var $1,$2;
  1383. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  1384. self["@helper"]=_st($HLKeyBinderHelper())._on_(self);
  1385. $1=self["@helper"];
  1386. _st($1)._renderStart();
  1387. $2=_st($1)._renderCog();
  1388. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  1389. args: [],
  1390. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper \x09\x0a\x09\x09renderStart;\x0a\x09\x09renderCog",
  1391. messageSends: ["initialize", "on:", "renderStart", "renderCog"],
  1392. referencedClasses: ["HLKeyBinderHelper"]
  1393. }),
  1394. smalltalk.HLKeyBinder);
  1395. smalltalk.addMethod(
  1396. smalltalk.method({
  1397. selector: "isActive",
  1398. category: 'testing',
  1399. fn: function (){
  1400. var self=this;
  1401. return smalltalk.withContext(function($ctx1) {
  1402. var $1;
  1403. $1=_st(_st(_st(".").__comma(_st(_st(self)._helper())._cssClass()))._asJQuery())._is_(":visible");
  1404. return $1;
  1405. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  1406. args: [],
  1407. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  1408. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"],
  1409. referencedClasses: []
  1410. }),
  1411. smalltalk.HLKeyBinder);
  1412. smalltalk.addMethod(
  1413. smalltalk.method({
  1414. selector: "selectBinding:",
  1415. category: 'actions',
  1416. fn: function (aBinding){
  1417. var self=this;
  1418. return smalltalk.withContext(function($ctx1) {
  1419. var $1,$2;
  1420. $1=_st(aBinding).__eq(self["@selectedBinding"]);
  1421. if(smalltalk.assert($1)){
  1422. $2=self;
  1423. return $2;
  1424. };
  1425. self["@selectedBinding"]=aBinding;
  1426. _st(_st(self)._helper())._refresh();
  1427. return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1428. args: ["aBinding"],
  1429. source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
  1430. messageSends: ["ifTrue:", "=", "refresh", "helper"],
  1431. referencedClasses: []
  1432. }),
  1433. smalltalk.HLKeyBinder);
  1434. smalltalk.addMethod(
  1435. smalltalk.method({
  1436. selector: "selectedBinding",
  1437. category: 'accessing',
  1438. fn: function (){
  1439. var self=this;
  1440. return smalltalk.withContext(function($ctx1) {
  1441. var $2,$1;
  1442. $2=self["@selectedBinding"];
  1443. if(($receiver = $2) == nil || $receiver == undefined){
  1444. $1=_st(self)._bindings();
  1445. } else {
  1446. $1=$2;
  1447. };
  1448. return $1;
  1449. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinder)})},
  1450. args: [],
  1451. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  1452. messageSends: ["ifNil:", "bindings"],
  1453. referencedClasses: []
  1454. }),
  1455. smalltalk.HLKeyBinder);
  1456. smalltalk.addMethod(
  1457. smalltalk.method({
  1458. selector: "setupEvents",
  1459. category: 'events',
  1460. fn: function (){
  1461. var self=this;
  1462. return smalltalk.withContext(function($ctx1) {
  1463. _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  1464. return smalltalk.withContext(function($ctx2) {
  1465. return _st(self)._handleKeyDown_(event);
  1466. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  1467. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},smalltalk.HLKeyBinder)})},
  1468. args: [],
  1469. source: "setupEvents\x0a\x09(window jQuery: 'body') keydown: [ :event | self handleKeyDown: event ]",
  1470. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"],
  1471. referencedClasses: []
  1472. }),
  1473. smalltalk.HLKeyBinder);
  1474. smalltalk.addMethod(
  1475. smalltalk.method({
  1476. selector: "systemIsMac",
  1477. category: 'testing',
  1478. fn: function (){
  1479. var self=this;
  1480. return smalltalk.withContext(function($ctx1) {
  1481. var $1;
  1482. $1=_st(_st(navigator)._platform())._match_("Mac");
  1483. return $1;
  1484. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},smalltalk.HLKeyBinder)})},
  1485. args: [],
  1486. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1487. messageSends: ["match:", "platform"],
  1488. referencedClasses: []
  1489. }),
  1490. smalltalk.HLKeyBinder);
  1491. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1492. smalltalk.addMethod(
  1493. smalltalk.method({
  1494. selector: "cssClass",
  1495. category: 'accessing',
  1496. fn: function (){
  1497. var self=this;
  1498. return smalltalk.withContext(function($ctx1) {
  1499. return "key_helper";
  1500. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLKeyBinderHelper)})},
  1501. args: [],
  1502. source: "cssClass\x0a\x09^ 'key_helper'",
  1503. messageSends: [],
  1504. referencedClasses: []
  1505. }),
  1506. smalltalk.HLKeyBinderHelper);
  1507. smalltalk.addMethod(
  1508. smalltalk.method({
  1509. selector: "hide",
  1510. category: 'actions',
  1511. fn: function (){
  1512. var self=this;
  1513. return smalltalk.withContext(function($ctx1) {
  1514. _st(_st(_st(".").__comma(_st(self)._cssClass()))._asJQuery())._remove();
  1515. _st(self)._showCog();
  1516. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1517. args: [],
  1518. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09self showCog",
  1519. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"],
  1520. referencedClasses: []
  1521. }),
  1522. smalltalk.HLKeyBinderHelper);
  1523. smalltalk.addMethod(
  1524. smalltalk.method({
  1525. selector: "hideCog",
  1526. category: 'actions',
  1527. fn: function (){
  1528. var self=this;
  1529. return smalltalk.withContext(function($ctx1) {
  1530. _st(_st("#cog-helper")._asJQuery())._hide();
  1531. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1532. args: [],
  1533. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  1534. messageSends: ["hide", "asJQuery"],
  1535. referencedClasses: []
  1536. }),
  1537. smalltalk.HLKeyBinderHelper);
  1538. smalltalk.addMethod(
  1539. smalltalk.method({
  1540. selector: "keyBinder",
  1541. category: 'accessing',
  1542. fn: function (){
  1543. var self=this;
  1544. return smalltalk.withContext(function($ctx1) {
  1545. var $1;
  1546. $1=self["@keyBinder"];
  1547. return $1;
  1548. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{},smalltalk.HLKeyBinderHelper)})},
  1549. args: [],
  1550. source: "keyBinder\x0a\x09^ keyBinder",
  1551. messageSends: [],
  1552. referencedClasses: []
  1553. }),
  1554. smalltalk.HLKeyBinderHelper);
  1555. smalltalk.addMethod(
  1556. smalltalk.method({
  1557. selector: "keyBinder:",
  1558. category: 'accessing',
  1559. fn: function (aKeyBinder){
  1560. var self=this;
  1561. return smalltalk.withContext(function($ctx1) {
  1562. self["@keyBinder"]=aKeyBinder;
  1563. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper)})},
  1564. args: ["aKeyBinder"],
  1565. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  1566. messageSends: [],
  1567. referencedClasses: []
  1568. }),
  1569. smalltalk.HLKeyBinderHelper);
  1570. smalltalk.addMethod(
  1571. smalltalk.method({
  1572. selector: "registerBindings",
  1573. category: 'keyBindings',
  1574. fn: function (){
  1575. var self=this;
  1576. return smalltalk.withContext(function($ctx1) {
  1577. return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},smalltalk.HLKeyBinderHelper)})},
  1578. args: [],
  1579. source: "registerBindings\x0a\x09\x22Do nothing\x22",
  1580. messageSends: [],
  1581. referencedClasses: []
  1582. }),
  1583. smalltalk.HLKeyBinderHelper);
  1584. smalltalk.addMethod(
  1585. smalltalk.method({
  1586. selector: "renderBindingGroup:on:",
  1587. category: 'rendering',
  1588. fn: function (aBindingGroup,html){
  1589. var self=this;
  1590. return smalltalk.withContext(function($ctx1) {
  1591. _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1592. return smalltalk.withContext(function($ctx2) {
  1593. return _st(_st(a)._key()).__lt(_st(b)._key());
  1594. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1595. return smalltalk.withContext(function($ctx2) {
  1596. return _st(each)._renderActionFor_html_(_st(self)._keyBinder(),html);
  1597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1598. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1599. args: ["aBindingGroup", "html"],
  1600. source: "renderBindingGroup: aBindingGroup on: html\x0a\x09(aBindingGroup activeBindings \x0a \x09sorted: [ :a :b | a key < b key ])\x0a do: [ :each | each renderActionFor: self keyBinder html: html ]",
  1601. messageSends: ["do:", "renderActionFor:html:", "keyBinder", "sorted:", "<", "key", "activeBindings"],
  1602. referencedClasses: []
  1603. }),
  1604. smalltalk.HLKeyBinderHelper);
  1605. smalltalk.addMethod(
  1606. smalltalk.method({
  1607. selector: "renderBindingOn:",
  1608. category: 'rendering',
  1609. fn: function (html){
  1610. var self=this;
  1611. return smalltalk.withContext(function($ctx1) {
  1612. _st(_st(self)._selectedBinding())._renderOn_html_(self,html);
  1613. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1614. args: ["html"],
  1615. source: "renderBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  1616. messageSends: ["renderOn:html:", "selectedBinding"],
  1617. referencedClasses: []
  1618. }),
  1619. smalltalk.HLKeyBinderHelper);
  1620. smalltalk.addMethod(
  1621. smalltalk.method({
  1622. selector: "renderCloseOn:",
  1623. category: 'rendering',
  1624. fn: function (html){
  1625. var self=this;
  1626. return smalltalk.withContext(function($ctx1) {
  1627. var $1,$2;
  1628. $1=_st(html)._a();
  1629. _st($1)._class_("close");
  1630. _st($1)._with_((function(){
  1631. return smalltalk.withContext(function($ctx2) {
  1632. return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1634. $2=_st($1)._onClick_((function(){
  1635. return smalltalk.withContext(function($ctx2) {
  1636. return _st(_st(self)._keyBinder())._deactivate();
  1637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1638. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1639. args: ["html"],
  1640. source: "renderCloseOn: html\x0a\x09html a\x0a\x09\x09class: 'close';\x0a\x09\x09with: [ (html tag: 'i') class: 'icon-remove' ];\x0a\x09\x09onClick: [ self keyBinder deactivate ]",
  1641. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"],
  1642. referencedClasses: []
  1643. }),
  1644. smalltalk.HLKeyBinderHelper);
  1645. smalltalk.addMethod(
  1646. smalltalk.method({
  1647. selector: "renderCog",
  1648. category: 'rendering',
  1649. fn: function (){
  1650. var self=this;
  1651. return smalltalk.withContext(function($ctx1) {
  1652. var $1,$3,$4,$2;
  1653. _st((function(html){
  1654. return smalltalk.withContext(function($ctx2) {
  1655. $1=_st(html)._div();
  1656. _st($1)._id_("cog-helper");
  1657. $2=_st($1)._with_((function(){
  1658. return smalltalk.withContext(function($ctx3) {
  1659. $3=_st(html)._a();
  1660. _st($3)._with_((function(){
  1661. return smalltalk.withContext(function($ctx4) {
  1662. return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1663. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1664. $4=_st($3)._onClick_((function(){
  1665. return smalltalk.withContext(function($ctx4) {
  1666. return _st(_st(self)._keyBinder())._activate();
  1667. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  1668. return $4;
  1669. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1670. return $2;
  1671. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1672. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1673. args: [],
  1674. source: "renderCog\x0a\x09[ :html |\x0a\x09\x09html \x0a\x09\x09\x09div id: 'cog-helper'; \x0a\x09\x09\x09with: [\x0a\x09\x09\x09\x09html a \x0a\x09\x09\x09\x09\x09with: [ (html tag: 'i') class: 'icon-cog' ];\x0a\x09\x09\x09\x09\x09onClick: [ self keyBinder activate ] ] ]\x0a\x09\x09appendToJQuery: 'body' asJQuery",
  1675. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"],
  1676. referencedClasses: []
  1677. }),
  1678. smalltalk.HLKeyBinderHelper);
  1679. smalltalk.addMethod(
  1680. smalltalk.method({
  1681. selector: "renderContentOn:",
  1682. category: 'rendering',
  1683. fn: function (html){
  1684. var self=this;
  1685. return smalltalk.withContext(function($ctx1) {
  1686. var $1,$3,$4,$2;
  1687. $1=_st(html)._div();
  1688. _st($1)._class_(_st(self)._cssClass());
  1689. $2=_st($1)._with_((function(){
  1690. return smalltalk.withContext(function($ctx2) {
  1691. $3=self;
  1692. _st($3)._renderSelectionOn_(html);
  1693. _st($3)._renderBindingOn_(html);
  1694. $4=_st($3)._renderCloseOn_(html);
  1695. return $4;
  1696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1697. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1698. args: ["html"],
  1699. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderSelectionOn:html;\x0a \x09renderBindingOn: html;\x0a\x09\x09\x09renderCloseOn: html ]",
  1700. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:", "renderCloseOn:"],
  1701. referencedClasses: []
  1702. }),
  1703. smalltalk.HLKeyBinderHelper);
  1704. smalltalk.addMethod(
  1705. smalltalk.method({
  1706. selector: "renderSelectionOn:",
  1707. category: 'rendering',
  1708. fn: function (html){
  1709. var self=this;
  1710. return smalltalk.withContext(function($ctx1) {
  1711. var $1,$3,$5,$4,$2;
  1712. $1=_st(html)._span();
  1713. _st($1)._class_("selected");
  1714. $3=$1;
  1715. $5=_st(_st(self)._selectedBinding())._label();
  1716. if(($receiver = $5) == nil || $receiver == undefined){
  1717. $4="Action";
  1718. } else {
  1719. $4=$5;
  1720. };
  1721. $2=_st($3)._with_($4);
  1722. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1723. args: ["html"],
  1724. source: "renderSelectionOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  1725. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  1726. referencedClasses: []
  1727. }),
  1728. smalltalk.HLKeyBinderHelper);
  1729. smalltalk.addMethod(
  1730. smalltalk.method({
  1731. selector: "renderStart",
  1732. category: 'rendering',
  1733. fn: function (){
  1734. var self=this;
  1735. return smalltalk.withContext(function($ctx1) {
  1736. var $1,$2;
  1737. _st(_st(window)._jQuery_("#helper"))._remove();
  1738. _st((function(html){
  1739. return smalltalk.withContext(function($ctx2) {
  1740. $1=_st(html)._div();
  1741. _st($1)._id_("helper");
  1742. $2=_st($1)._with_(_st(_st("Press ").__comma(_st(_st(self)._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1743. return $2;
  1744. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st("body")._asJQuery());
  1745. _st((function(){
  1746. return smalltalk.withContext(function($ctx2) {
  1747. return _st(_st(window)._jQuery_("#helper"))._fadeOut_((1000));
  1748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1749. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{},smalltalk.HLKeyBinderHelper)})},
  1750. args: [],
  1751. source: "renderStart\x0a\x09(window jQuery: '#helper') remove.\x0a\x0a\x09[ :html |\x0a\x09\x09html div \x0a\x09\x09\x09id: 'helper';\x0a\x09\x09\x09with: 'Press ', self keyBinder activationKeyLabel, ' to start' ] appendToJQuery: 'body' asJQuery.\x0a\x09\x0a\x09[ (window jQuery: '#helper') fadeOut: 1000 ] \x0a\x09\x09valueWithTimeout: 2000",
  1752. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:"],
  1753. referencedClasses: []
  1754. }),
  1755. smalltalk.HLKeyBinderHelper);
  1756. smalltalk.addMethod(
  1757. smalltalk.method({
  1758. selector: "selectedBinding",
  1759. category: 'accessing',
  1760. fn: function (){
  1761. var self=this;
  1762. return smalltalk.withContext(function($ctx1) {
  1763. var $1;
  1764. $1=_st(_st(self)._keyBinder())._selectedBinding();
  1765. return $1;
  1766. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinderHelper)})},
  1767. args: [],
  1768. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1769. messageSends: ["selectedBinding", "keyBinder"],
  1770. referencedClasses: []
  1771. }),
  1772. smalltalk.HLKeyBinderHelper);
  1773. smalltalk.addMethod(
  1774. smalltalk.method({
  1775. selector: "show",
  1776. category: 'actions',
  1777. fn: function (){
  1778. var self=this;
  1779. return smalltalk.withContext(function($ctx1) {
  1780. _st(self)._hideCog();
  1781. _st(self)._appendToJQuery_(_st("body")._asJQuery());
  1782. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1783. args: [],
  1784. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1785. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"],
  1786. referencedClasses: []
  1787. }),
  1788. smalltalk.HLKeyBinderHelper);
  1789. smalltalk.addMethod(
  1790. smalltalk.method({
  1791. selector: "showCog",
  1792. category: 'actions',
  1793. fn: function (){
  1794. var self=this;
  1795. return smalltalk.withContext(function($ctx1) {
  1796. _st(_st("#cog-helper")._asJQuery())._show();
  1797. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1798. args: [],
  1799. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  1800. messageSends: ["show", "asJQuery"],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.HLKeyBinderHelper);
  1804. smalltalk.addMethod(
  1805. smalltalk.method({
  1806. selector: "on:",
  1807. category: 'instance creation',
  1808. fn: function (aKeyBinder){
  1809. var self=this;
  1810. return smalltalk.withContext(function($ctx1) {
  1811. var $2,$3,$1;
  1812. $2=_st(self)._new();
  1813. _st($2)._keyBinder_(aKeyBinder);
  1814. $3=_st($2)._yourself();
  1815. $1=$3;
  1816. return $1;
  1817. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper.klass)})},
  1818. args: ["aKeyBinder"],
  1819. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1820. messageSends: ["keyBinder:", "new", "yourself"],
  1821. referencedClasses: []
  1822. }),
  1823. smalltalk.HLKeyBinderHelper.klass);