Helios-KeyBindings.js 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Helios-KeyBindings');
  3. smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "applyOn:",
  7. category: 'actions',
  8. fn: function (aKeyBinder){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBinding)})},
  12. args: ["aKeyBinder"],
  13. source: "applyOn: aKeyBinder",
  14. messageSends: [],
  15. referencedClasses: []
  16. }),
  17. smalltalk.HLBinding);
  18. smalltalk.addMethod(
  19. smalltalk.method({
  20. selector: "atKey:",
  21. category: 'accessing',
  22. fn: function (aKey){
  23. var self=this;
  24. return smalltalk.withContext(function($ctx1) {
  25. return nil;
  26. }, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBinding)})},
  27. args: ["aKey"],
  28. source: "atKey: aKey\x0a\x09^ nil",
  29. messageSends: [],
  30. referencedClasses: []
  31. }),
  32. smalltalk.HLBinding);
  33. smalltalk.addMethod(
  34. smalltalk.method({
  35. selector: "displayLabel",
  36. category: 'accessing',
  37. fn: function (){
  38. var self=this;
  39. return smalltalk.withContext(function($ctx1) {
  40. var $1;
  41. $1=self._label();
  42. return $1;
  43. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBinding)})},
  44. args: [],
  45. source: "displayLabel\x0a\x09^ self label",
  46. messageSends: ["label"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.HLBinding);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "isActive",
  53. category: 'testing',
  54. fn: function (){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. var $1;
  58. $1=self._subclassResponsibility();
  59. return $1;
  60. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBinding)})},
  61. args: [],
  62. source: "isActive\x0a\x09^ self subclassResponsibility",
  63. messageSends: ["subclassResponsibility"],
  64. referencedClasses: []
  65. }),
  66. smalltalk.HLBinding);
  67. smalltalk.addMethod(
  68. smalltalk.method({
  69. selector: "isFinal",
  70. category: 'testing',
  71. fn: function (){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) {
  74. return false;
  75. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBinding)})},
  76. args: [],
  77. source: "isFinal\x0a\x09\x22 Answer true if the receiver is the final binding of a sequence \x22\x0a\x09\x0a\x09^ false",
  78. messageSends: [],
  79. referencedClasses: []
  80. }),
  81. smalltalk.HLBinding);
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "key",
  85. category: 'accessing',
  86. fn: function (){
  87. var self=this;
  88. return smalltalk.withContext(function($ctx1) {
  89. var $1;
  90. $1=self["@key"];
  91. return $1;
  92. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLBinding)})},
  93. args: [],
  94. source: "key\x0a\x09^ key",
  95. messageSends: [],
  96. referencedClasses: []
  97. }),
  98. smalltalk.HLBinding);
  99. smalltalk.addMethod(
  100. smalltalk.method({
  101. selector: "key:",
  102. category: 'accessing',
  103. fn: function (anInteger){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) {
  106. self["@key"]=anInteger;
  107. return self}, function($ctx1) {$ctx1.fill(self,"key:",{anInteger:anInteger},smalltalk.HLBinding)})},
  108. args: ["anInteger"],
  109. source: "key: anInteger\x0a\x09key := anInteger",
  110. messageSends: [],
  111. referencedClasses: []
  112. }),
  113. smalltalk.HLBinding);
  114. smalltalk.addMethod(
  115. smalltalk.method({
  116. selector: "label",
  117. category: 'accessing',
  118. fn: function (){
  119. var self=this;
  120. return smalltalk.withContext(function($ctx1) {
  121. var $1;
  122. $1=self["@label"];
  123. return $1;
  124. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLBinding)})},
  125. args: [],
  126. source: "label\x0a\x09^ label",
  127. messageSends: [],
  128. referencedClasses: []
  129. }),
  130. smalltalk.HLBinding);
  131. smalltalk.addMethod(
  132. smalltalk.method({
  133. selector: "label:",
  134. category: 'accessing',
  135. fn: function (aString){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) {
  138. self["@label"]=aString;
  139. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.HLBinding)})},
  140. args: ["aString"],
  141. source: "label: aString\x0a\x09label := aString",
  142. messageSends: [],
  143. referencedClasses: []
  144. }),
  145. smalltalk.HLBinding);
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "release",
  149. category: 'actions',
  150. fn: function (){
  151. var self=this;
  152. return smalltalk.withContext(function($ctx1) {
  153. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBinding)})},
  154. args: [],
  155. source: "release",
  156. messageSends: [],
  157. referencedClasses: []
  158. }),
  159. smalltalk.HLBinding);
  160. smalltalk.addMethod(
  161. smalltalk.method({
  162. selector: "renderActionFor:html:",
  163. category: 'rendering',
  164. fn: function (aBinder,html){
  165. var self=this;
  166. return smalltalk.withContext(function($ctx1) {
  167. var $1,$3,$4,$5,$6,$2;
  168. $1=_st(html)._span();
  169. _st($1)._class_("command");
  170. $2=_st($1)._with_((function(){
  171. return smalltalk.withContext(function($ctx2) {
  172. $3=_st(html)._span();
  173. _st($3)._class_("label");
  174. $4=_st($3)._with_(_st(self._shortcut())._asLowercase());
  175. $4;
  176. $5=_st(html)._a();
  177. _st($5)._class_("action");
  178. _st($5)._with_(self._displayLabel());
  179. $6=_st($5)._onClick_((function(){
  180. return smalltalk.withContext(function($ctx3) {
  181. return _st(aBinder)._applyBinding_(self);
  182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  183. return $6;
  184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  185. return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBinding)})},
  186. args: ["aBinder", "html"],
  187. 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 ] ]",
  188. messageSends: ["class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:"],
  189. referencedClasses: []
  190. }),
  191. smalltalk.HLBinding);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "renderOn:html:",
  195. category: 'rendering',
  196. fn: function (aBindingHelper,html){
  197. var self=this;
  198. return smalltalk.withContext(function($ctx1) {
  199. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBinding)})},
  200. args: ["aBindingHelper", "html"],
  201. source: "renderOn: aBindingHelper html: html",
  202. messageSends: [],
  203. referencedClasses: []
  204. }),
  205. smalltalk.HLBinding);
  206. smalltalk.addMethod(
  207. smalltalk.method({
  208. selector: "shortcut",
  209. category: 'accessing',
  210. fn: function (){
  211. var self=this;
  212. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  213. return smalltalk.withContext(function($ctx1) {
  214. var $1;
  215. $1=_st($String())._fromCharCode_(self._key());
  216. return $1;
  217. }, function($ctx1) {$ctx1.fill(self,"shortcut",{},smalltalk.HLBinding)})},
  218. args: [],
  219. source: "shortcut\x0a\x09^ String fromCharCode: self key",
  220. messageSends: ["fromCharCode:", "key"],
  221. referencedClasses: ["String"]
  222. }),
  223. smalltalk.HLBinding);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "on:labelled:",
  227. category: 'instance creation',
  228. fn: function (anInteger,aString){
  229. var self=this;
  230. return smalltalk.withContext(function($ctx1) {
  231. var $2,$3,$1;
  232. $2=self._new();
  233. _st($2)._key_(anInteger);
  234. _st($2)._label_(aString);
  235. $3=_st($2)._yourself();
  236. $1=$3;
  237. return $1;
  238. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBinding.klass)})},
  239. args: ["anInteger", "aString"],
  240. source: "on: anInteger labelled: aString\x0a\x09^ self new\x0a \x09key: anInteger;\x0a label: aString;\x0a yourself",
  241. messageSends: ["key:", "new", "label:", "yourself"],
  242. referencedClasses: []
  243. }),
  244. smalltalk.HLBinding.klass);
  245. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['command'], 'Helios-KeyBindings');
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "applyOn:",
  249. category: 'actions',
  250. fn: function (aKeyBinder){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. var $1;
  254. $1=_st(self._command())._isInputRequired();
  255. if(smalltalk.assert($1)){
  256. _st(aKeyBinder)._selectBinding_(self._inputBinding());
  257. } else {
  258. _st(self._command())._execute();
  259. };
  260. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingAction)})},
  261. args: ["aKeyBinder"],
  262. source: "applyOn: aKeyBinder\x0a\x09self command isInputRequired\x0a\x09\x09ifTrue: [ aKeyBinder selectBinding: self inputBinding ]\x0a\x09\x09ifFalse: [ self command execute ]",
  263. messageSends: ["ifTrue:ifFalse:", "selectBinding:", "inputBinding", "execute", "command", "isInputRequired"],
  264. referencedClasses: []
  265. }),
  266. smalltalk.HLBindingAction);
  267. smalltalk.addMethod(
  268. smalltalk.method({
  269. selector: "command",
  270. category: 'accessing',
  271. fn: function (){
  272. var self=this;
  273. return smalltalk.withContext(function($ctx1) {
  274. var $1;
  275. $1=self["@command"];
  276. return $1;
  277. }, function($ctx1) {$ctx1.fill(self,"command",{},smalltalk.HLBindingAction)})},
  278. args: [],
  279. source: "command\x0a\x09^ command",
  280. messageSends: [],
  281. referencedClasses: []
  282. }),
  283. smalltalk.HLBindingAction);
  284. smalltalk.addMethod(
  285. smalltalk.method({
  286. selector: "command:",
  287. category: 'accessing',
  288. fn: function (aCommand){
  289. var self=this;
  290. return smalltalk.withContext(function($ctx1) {
  291. self["@command"]=aCommand;
  292. return self}, function($ctx1) {$ctx1.fill(self,"command:",{aCommand:aCommand},smalltalk.HLBindingAction)})},
  293. args: ["aCommand"],
  294. source: "command: aCommand\x0a\x09command := aCommand",
  295. messageSends: [],
  296. referencedClasses: []
  297. }),
  298. smalltalk.HLBindingAction);
  299. smalltalk.addMethod(
  300. smalltalk.method({
  301. selector: "inputBinding",
  302. category: 'accessing',
  303. fn: function (){
  304. var self=this;
  305. function $HLBindingInput(){return smalltalk.HLBindingInput||(typeof HLBindingInput=="undefined"?nil:HLBindingInput)}
  306. return smalltalk.withContext(function($ctx1) {
  307. var $2,$3,$4,$5,$1;
  308. $2=_st($HLBindingInput())._new();
  309. _st($2)._label_(_st(self._command())._inputLabel());
  310. _st($2)._ghostText_(_st(self._command())._displayLabel());
  311. _st($2)._defaultValue_(_st(self._command())._defaultInput());
  312. _st($2)._inputCompletion_(_st(self._command())._inputCompletion());
  313. _st($2)._callback_((function(val){
  314. return smalltalk.withContext(function($ctx2) {
  315. $3=self._command();
  316. _st($3)._input_(val);
  317. $4=_st($3)._execute();
  318. return $4;
  319. }, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1)})}));
  320. $5=_st($2)._yourself();
  321. $1=$5;
  322. return $1;
  323. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
  324. args: [],
  325. 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",
  326. messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "execute", "yourself"],
  327. referencedClasses: ["HLBindingInput"]
  328. }),
  329. smalltalk.HLBindingAction);
  330. smalltalk.addMethod(
  331. smalltalk.method({
  332. selector: "isActive",
  333. category: 'testing',
  334. fn: function (){
  335. var self=this;
  336. return smalltalk.withContext(function($ctx1) {
  337. var $1;
  338. $1=_st(self._command())._isActive();
  339. return $1;
  340. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingAction)})},
  341. args: [],
  342. source: "isActive\x0a\x09^ self command isActive",
  343. messageSends: ["isActive", "command"],
  344. referencedClasses: []
  345. }),
  346. smalltalk.HLBindingAction);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "isFinal",
  350. category: 'testing',
  351. fn: function (){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) {
  354. var $1;
  355. $1=_st(_st(self._command())._isInputRequired())._not();
  356. return $1;
  357. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingAction)})},
  358. args: [],
  359. source: "isFinal\x0a\x09^ self command isInputRequired not",
  360. messageSends: ["not", "isInputRequired", "command"],
  361. referencedClasses: []
  362. }),
  363. smalltalk.HLBindingAction);
  364. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  365. smalltalk.addMethod(
  366. smalltalk.method({
  367. selector: "activeBindings",
  368. category: 'accessing',
  369. fn: function (){
  370. var self=this;
  371. return smalltalk.withContext(function($ctx1) {
  372. var $1;
  373. $1=_st(self._bindings())._select_((function(each){
  374. return smalltalk.withContext(function($ctx2) {
  375. return _st(each)._isActive();
  376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  377. return $1;
  378. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  379. args: [],
  380. source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
  381. messageSends: ["select:", "isActive", "bindings"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.HLBindingGroup);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "add:",
  388. category: 'accessing',
  389. fn: function (aBinding){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st(self._bindings())._add_(aBinding);
  394. return $1;
  395. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},smalltalk.HLBindingGroup)})},
  396. args: ["aBinding"],
  397. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  398. messageSends: ["add:", "bindings"],
  399. referencedClasses: []
  400. }),
  401. smalltalk.HLBindingGroup);
  402. smalltalk.addMethod(
  403. smalltalk.method({
  404. selector: "addActionKey:labelled:callback:",
  405. category: 'accessing',
  406. fn: function (anInteger,aString,aBlock){
  407. var self=this;
  408. function $HLBindingAction(){return smalltalk.HLBindingAction||(typeof HLBindingAction=="undefined"?nil:HLBindingAction)}
  409. return smalltalk.withContext(function($ctx1) {
  410. var $1,$2;
  411. $1=_st($HLBindingAction())._on_labelled_(anInteger,aString);
  412. _st($1)._callback_(aBlock);
  413. $2=_st($1)._yourself();
  414. self._add_($2);
  415. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},smalltalk.HLBindingGroup)})},
  416. args: ["anInteger", "aString", "aBlock"],
  417. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  418. messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
  419. referencedClasses: ["HLBindingAction"]
  420. }),
  421. smalltalk.HLBindingGroup);
  422. smalltalk.addMethod(
  423. smalltalk.method({
  424. selector: "addGroupKey:labelled:",
  425. category: 'accessing',
  426. fn: function (anInteger,aString){
  427. var self=this;
  428. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  429. return smalltalk.withContext(function($ctx1) {
  430. self._add_(_st($HLBindingGroup())._on_labelled_(anInteger,aString));
  431. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBindingGroup)})},
  432. args: ["anInteger", "aString"],
  433. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  434. messageSends: ["add:", "on:labelled:"],
  435. referencedClasses: ["HLBindingGroup"]
  436. }),
  437. smalltalk.HLBindingGroup);
  438. smalltalk.addMethod(
  439. smalltalk.method({
  440. selector: "at:",
  441. category: 'accessing',
  442. fn: function (aString){
  443. var self=this;
  444. return smalltalk.withContext(function($ctx1) {
  445. var $1;
  446. $1=_st(self._bindings())._detect_ifNone_((function(each){
  447. return smalltalk.withContext(function($ctx2) {
  448. return _st(_st(each)._label()).__eq(aString);
  449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  450. return smalltalk.withContext(function($ctx2) {
  451. return nil;
  452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  453. return $1;
  454. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.HLBindingGroup)})},
  455. args: ["aString"],
  456. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  457. messageSends: ["detect:ifNone:", "=", "label", "bindings"],
  458. referencedClasses: []
  459. }),
  460. smalltalk.HLBindingGroup);
  461. smalltalk.addMethod(
  462. smalltalk.method({
  463. selector: "at:add:",
  464. category: 'accessing',
  465. fn: function (aString,aBinding){
  466. var self=this;
  467. var binding;
  468. return smalltalk.withContext(function($ctx1) {
  469. var $1,$2;
  470. binding=self._at_(aString);
  471. $1=binding;
  472. if(($receiver = $1) == nil || $receiver == undefined){
  473. $2=self;
  474. return $2;
  475. } else {
  476. $1;
  477. };
  478. _st(binding)._add_(aBinding);
  479. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  480. args: ["aString", "aBinding"],
  481. 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",
  482. messageSends: ["at:", "ifNil:", "add:"],
  483. referencedClasses: []
  484. }),
  485. smalltalk.HLBindingGroup);
  486. smalltalk.addMethod(
  487. smalltalk.method({
  488. selector: "atKey:",
  489. category: 'accessing',
  490. fn: function (anInteger){
  491. var self=this;
  492. return smalltalk.withContext(function($ctx1) {
  493. var $1;
  494. $1=_st(self._bindings())._detect_ifNone_((function(each){
  495. return smalltalk.withContext(function($ctx2) {
  496. return _st(_st(each)._key()).__eq(anInteger);
  497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  498. return smalltalk.withContext(function($ctx2) {
  499. return nil;
  500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  501. return $1;
  502. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},smalltalk.HLBindingGroup)})},
  503. args: ["anInteger"],
  504. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  505. messageSends: ["detect:ifNone:", "=", "key", "bindings"],
  506. referencedClasses: []
  507. }),
  508. smalltalk.HLBindingGroup);
  509. smalltalk.addMethod(
  510. smalltalk.method({
  511. selector: "bindings",
  512. category: 'accessing',
  513. fn: function (){
  514. var self=this;
  515. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  516. return smalltalk.withContext(function($ctx1) {
  517. var $2,$1;
  518. $2=self["@bindings"];
  519. if(($receiver = $2) == nil || $receiver == undefined){
  520. self["@bindings"]=_st($OrderedCollection())._new();
  521. $1=self["@bindings"];
  522. } else {
  523. $1=$2;
  524. };
  525. return $1;
  526. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLBindingGroup)})},
  527. args: [],
  528. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  529. messageSends: ["ifNil:", "new"],
  530. referencedClasses: ["OrderedCollection"]
  531. }),
  532. smalltalk.HLBindingGroup);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "displayLabel",
  536. category: 'accessing',
  537. fn: function (){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) {
  540. var $1;
  541. $1=_st(smalltalk.HLBindingGroup.superclass.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  542. return $1;
  543. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBindingGroup)})},
  544. args: [],
  545. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  546. messageSends: [",", "displayLabel"],
  547. referencedClasses: []
  548. }),
  549. smalltalk.HLBindingGroup);
  550. smalltalk.addMethod(
  551. smalltalk.method({
  552. selector: "isActive",
  553. category: 'testing',
  554. fn: function (){
  555. var self=this;
  556. return smalltalk.withContext(function($ctx1) {
  557. var $1;
  558. $1=_st(self._activeBindings())._notEmpty();
  559. return $1;
  560. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  561. args: [],
  562. source: "isActive\x0a\x09^ self activeBindings notEmpty",
  563. messageSends: ["notEmpty", "activeBindings"],
  564. referencedClasses: []
  565. }),
  566. smalltalk.HLBindingGroup);
  567. smalltalk.addMethod(
  568. smalltalk.method({
  569. selector: "release",
  570. category: 'actions',
  571. fn: function (){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) {
  574. _st(self._bindings())._do_((function(each){
  575. return smalltalk.withContext(function($ctx2) {
  576. return _st(each)._release();
  577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  578. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingGroup)})},
  579. args: [],
  580. source: "release\x0a\x09self bindings do: [ :each | each release ]",
  581. messageSends: ["do:", "release", "bindings"],
  582. referencedClasses: []
  583. }),
  584. smalltalk.HLBindingGroup);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "renderOn:html:",
  588. category: 'rendering',
  589. fn: function (aBindingHelper,html){
  590. var self=this;
  591. return smalltalk.withContext(function($ctx1) {
  592. var $1;
  593. $1=self._isActive();
  594. if(smalltalk.assert($1)){
  595. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  596. };
  597. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  598. args: ["aBindingHelper", "html"],
  599. source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
  600. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.HLBindingGroup);
  604. smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'wrapper', 'binder', 'ghostText', 'isFinal', 'message', 'messageTag', 'inputCompletion', 'defaultValue'], 'Helios-KeyBindings');
  605. smalltalk.addMethod(
  606. smalltalk.method({
  607. selector: "applyOn:",
  608. category: 'actions',
  609. fn: function (aKeyBinder){
  610. var self=this;
  611. return smalltalk.withContext(function($ctx1) {
  612. self._isFinal_(true);
  613. self._evaluate_(_st(_st(self._input())._asJQuery())._val());
  614. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
  615. args: ["aKeyBinder"],
  616. source: "applyOn: aKeyBinder\x0a\x09self isFinal: true.\x0a\x09self evaluate: self input asJQuery val",
  617. messageSends: ["isFinal:", "evaluate:", "val", "asJQuery", "input"],
  618. referencedClasses: []
  619. }),
  620. smalltalk.HLBindingInput);
  621. smalltalk.addMethod(
  622. smalltalk.method({
  623. selector: "atKey:",
  624. category: 'accessing',
  625. fn: function (aKey){
  626. var self=this;
  627. return smalltalk.withContext(function($ctx1) {
  628. var $1;
  629. $1=_st(aKey).__eq((13));
  630. if(! smalltalk.assert($1)){
  631. return nil;
  632. };
  633. return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
  634. args: ["aKey"],
  635. source: "atKey: aKey\x0a\x09aKey = 13 ifFalse: [ ^ nil ]",
  636. messageSends: ["ifFalse:", "="],
  637. referencedClasses: []
  638. }),
  639. smalltalk.HLBindingInput);
  640. smalltalk.addMethod(
  641. smalltalk.method({
  642. selector: "callback",
  643. category: 'accessing',
  644. fn: function (){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) {
  647. var $2,$1;
  648. $2=self["@callback"];
  649. if(($receiver = $2) == nil || $receiver == undefined){
  650. self["@callback"]=(function(value){
  651. return smalltalk.withContext(function($ctx2) {
  652. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})});
  653. $1=self["@callback"];
  654. } else {
  655. $1=$2;
  656. };
  657. return $1;
  658. }, function($ctx1) {$ctx1.fill(self,"callback",{},smalltalk.HLBindingInput)})},
  659. args: [],
  660. source: "callback\x0a\x09^ callback ifNil: [ callback := [ :value | ] ]",
  661. messageSends: ["ifNil:"],
  662. referencedClasses: []
  663. }),
  664. smalltalk.HLBindingInput);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "callback:",
  668. category: 'accessing',
  669. fn: function (aBlock){
  670. var self=this;
  671. return smalltalk.withContext(function($ctx1) {
  672. self["@callback"]=aBlock;
  673. return self}, function($ctx1) {$ctx1.fill(self,"callback:",{aBlock:aBlock},smalltalk.HLBindingInput)})},
  674. args: ["aBlock"],
  675. source: "callback: aBlock\x0a\x09callback := aBlock",
  676. messageSends: [],
  677. referencedClasses: []
  678. }),
  679. smalltalk.HLBindingInput);
  680. smalltalk.addMethod(
  681. smalltalk.method({
  682. selector: "clearStatus",
  683. category: 'actions',
  684. fn: function (){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) {
  687. self._status_("info");
  688. self._message_("");
  689. self._refresh();
  690. return self}, function($ctx1) {$ctx1.fill(self,"clearStatus",{},smalltalk.HLBindingInput)})},
  691. args: [],
  692. source: "clearStatus\x0a\x09self status: 'info'.\x0a\x09self message: ''.\x0a\x09self refresh",
  693. messageSends: ["status:", "message:", "refresh"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.HLBindingInput);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "defaultValue",
  700. category: 'accessing',
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) {
  704. var $2,$1;
  705. $2=self["@defaultValue"];
  706. if(($receiver = $2) == nil || $receiver == undefined){
  707. $1="";
  708. } else {
  709. $1=$2;
  710. };
  711. return $1;
  712. }, function($ctx1) {$ctx1.fill(self,"defaultValue",{},smalltalk.HLBindingInput)})},
  713. args: [],
  714. source: "defaultValue\x0a\x09^ defaultValue ifNil: [ '' ]",
  715. messageSends: ["ifNil:"],
  716. referencedClasses: []
  717. }),
  718. smalltalk.HLBindingInput);
  719. smalltalk.addMethod(
  720. smalltalk.method({
  721. selector: "defaultValue:",
  722. category: 'accessing',
  723. fn: function (aString){
  724. var self=this;
  725. return smalltalk.withContext(function($ctx1) {
  726. self["@defaultValue"]=aString;
  727. return self}, function($ctx1) {$ctx1.fill(self,"defaultValue:",{aString:aString},smalltalk.HLBindingInput)})},
  728. args: ["aString"],
  729. source: "defaultValue: aString\x0a\x09defaultValue := aString",
  730. messageSends: [],
  731. referencedClasses: []
  732. }),
  733. smalltalk.HLBindingInput);
  734. smalltalk.addMethod(
  735. smalltalk.method({
  736. selector: "errorStatus",
  737. category: 'actions',
  738. fn: function (){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) {
  741. self._status_("error");
  742. self._refresh();
  743. return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},smalltalk.HLBindingInput)})},
  744. args: [],
  745. source: "errorStatus\x0a\x09self status: 'error'.\x0a\x09self refresh",
  746. messageSends: ["status:", "refresh"],
  747. referencedClasses: []
  748. }),
  749. smalltalk.HLBindingInput);
  750. smalltalk.addMethod(
  751. smalltalk.method({
  752. selector: "evaluate:",
  753. category: 'actions',
  754. fn: function (aString){
  755. var self=this;
  756. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  757. return smalltalk.withContext(function($ctx1) {
  758. _st((function(){
  759. return smalltalk.withContext(function($ctx2) {
  760. return _st(self._callback())._value_(aString);
  761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  762. return smalltalk.withContext(function($ctx2) {
  763. _st(_st(self._input())._asJQuery())._one_do_("keydown",(function(){
  764. return smalltalk.withContext(function($ctx3) {
  765. return self._clearStatus();
  766. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  767. self._message_(_st(ex)._messageText());
  768. self._errorStatus();
  769. return self._isFinal_(false);
  770. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  771. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},smalltalk.HLBindingInput)})},
  772. args: ["aString"],
  773. 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 ].",
  774. messageSends: ["on:do:", "one:do:", "clearStatus", "asJQuery", "input", "message:", "messageText", "errorStatus", "isFinal:", "value:", "callback"],
  775. referencedClasses: ["Error"]
  776. }),
  777. smalltalk.HLBindingInput);
  778. smalltalk.addMethod(
  779. smalltalk.method({
  780. selector: "ghostText",
  781. category: 'accessing',
  782. fn: function (){
  783. var self=this;
  784. return smalltalk.withContext(function($ctx1) {
  785. var $1;
  786. $1=self["@ghostText"];
  787. return $1;
  788. }, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
  789. args: [],
  790. source: "ghostText\x0a\x09^ ghostText",
  791. messageSends: [],
  792. referencedClasses: []
  793. }),
  794. smalltalk.HLBindingInput);
  795. smalltalk.addMethod(
  796. smalltalk.method({
  797. selector: "ghostText:",
  798. category: 'accessing',
  799. fn: function (aText){
  800. var self=this;
  801. return smalltalk.withContext(function($ctx1) {
  802. self["@ghostText"]=aText;
  803. return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
  804. args: ["aText"],
  805. source: "ghostText: aText\x0a\x09ghostText := aText",
  806. messageSends: [],
  807. referencedClasses: []
  808. }),
  809. smalltalk.HLBindingInput);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "input",
  813. category: 'accessing',
  814. fn: function (){
  815. var self=this;
  816. return smalltalk.withContext(function($ctx1) {
  817. var $1;
  818. $1=self["@input"];
  819. return $1;
  820. }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
  821. args: [],
  822. source: "input\x0a\x09^ input",
  823. messageSends: [],
  824. referencedClasses: []
  825. }),
  826. smalltalk.HLBindingInput);
  827. smalltalk.addMethod(
  828. smalltalk.method({
  829. selector: "inputCompletion",
  830. category: 'accessing',
  831. fn: function (){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) {
  834. var $2,$1;
  835. $2=self["@inputCompletion"];
  836. if(($receiver = $2) == nil || $receiver == undefined){
  837. $1=[];
  838. } else {
  839. $1=$2;
  840. };
  841. return $1;
  842. }, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},smalltalk.HLBindingInput)})},
  843. args: [],
  844. source: "inputCompletion\x0a\x09^ inputCompletion ifNil: [ #() ]",
  845. messageSends: ["ifNil:"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.HLBindingInput);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "inputCompletion:",
  852. category: 'accessing',
  853. fn: function (aCollection){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. self["@inputCompletion"]=aCollection;
  857. return self}, function($ctx1) {$ctx1.fill(self,"inputCompletion:",{aCollection:aCollection},smalltalk.HLBindingInput)})},
  858. args: ["aCollection"],
  859. source: "inputCompletion: aCollection\x0a\x09inputCompletion := aCollection",
  860. messageSends: [],
  861. referencedClasses: []
  862. }),
  863. smalltalk.HLBindingInput);
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "isActive",
  867. category: 'testing',
  868. fn: function (){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) {
  871. return true;
  872. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingInput)})},
  873. args: [],
  874. source: "isActive\x0a\x09^ true",
  875. messageSends: [],
  876. referencedClasses: []
  877. }),
  878. smalltalk.HLBindingInput);
  879. smalltalk.addMethod(
  880. smalltalk.method({
  881. selector: "isFinal",
  882. category: 'testing',
  883. fn: function (){
  884. var self=this;
  885. return smalltalk.withContext(function($ctx1) {
  886. var $2,$1;
  887. $2=self["@isFinal"];
  888. if(($receiver = $2) == nil || $receiver == undefined){
  889. self["@isFinal"]=smalltalk.HLBindingInput.superclass.fn.prototype._isFinal.apply(_st(self), []);
  890. $1=self["@isFinal"];
  891. } else {
  892. $1=$2;
  893. };
  894. return $1;
  895. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
  896. args: [],
  897. source: "isFinal\x0a\x09^ isFinal ifNil: [ isFinal := super isFinal ]",
  898. messageSends: ["ifNil:", "isFinal"],
  899. referencedClasses: []
  900. }),
  901. smalltalk.HLBindingInput);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "isFinal:",
  905. category: 'testing',
  906. fn: function (aBoolean){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. self["@isFinal"]=aBoolean;
  910. return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
  911. args: ["aBoolean"],
  912. source: "isFinal: aBoolean\x0a\x09isFinal := aBoolean",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.HLBindingInput);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "message",
  920. category: 'accessing',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. var $2,$1;
  925. $2=self["@message"];
  926. if(($receiver = $2) == nil || $receiver == undefined){
  927. self["@message"]="";
  928. $1=self["@message"];
  929. } else {
  930. $1=$2;
  931. };
  932. return $1;
  933. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.HLBindingInput)})},
  934. args: [],
  935. source: "message\x0a\x09^ message ifNil: [ message := '' ]",
  936. messageSends: ["ifNil:"],
  937. referencedClasses: []
  938. }),
  939. smalltalk.HLBindingInput);
  940. smalltalk.addMethod(
  941. smalltalk.method({
  942. selector: "message:",
  943. category: 'accessing',
  944. fn: function (aString){
  945. var self=this;
  946. return smalltalk.withContext(function($ctx1) {
  947. self["@message"]=aString;
  948. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aString:aString},smalltalk.HLBindingInput)})},
  949. args: ["aString"],
  950. source: "message: aString\x0a\x09message := aString",
  951. messageSends: [],
  952. referencedClasses: []
  953. }),
  954. smalltalk.HLBindingInput);
  955. smalltalk.addMethod(
  956. smalltalk.method({
  957. selector: "refresh",
  958. category: 'rendering',
  959. fn: function (){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) {
  962. var $1,$2;
  963. $1=self["@wrapper"];
  964. if(($receiver = $1) == nil || $receiver == undefined){
  965. $2=self;
  966. return $2;
  967. } else {
  968. $1;
  969. };
  970. _st(self["@wrapper"])._class_(self._status());
  971. _st(self["@messageTag"])._contents_(self._message());
  972. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
  973. args: [],
  974. source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a \x0a\x09wrapper class: self status.\x0a\x09messageTag contents: self message",
  975. messageSends: ["ifNil:", "class:", "status", "contents:", "message"],
  976. referencedClasses: []
  977. }),
  978. smalltalk.HLBindingInput);
  979. smalltalk.addMethod(
  980. smalltalk.method({
  981. selector: "release",
  982. category: 'actions',
  983. fn: function (){
  984. var self=this;
  985. return smalltalk.withContext(function($ctx1) {
  986. self["@status"]=nil;
  987. self["@wrapper"]=nil;
  988. self["@binder"]=nil;
  989. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingInput)})},
  990. args: [],
  991. source: "release\x0a\x09status := nil.\x0a\x09wrapper := nil.\x0a\x09binder := nil",
  992. messageSends: [],
  993. referencedClasses: []
  994. }),
  995. smalltalk.HLBindingInput);
  996. smalltalk.addMethod(
  997. smalltalk.method({
  998. selector: "renderOn:html:",
  999. category: 'rendering',
  1000. fn: function (aBinder,html){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) {
  1003. var $1,$2,$4,$5,$6,$7,$3;
  1004. self["@binder"]=aBinder;
  1005. $1=self["@wrapper"];
  1006. if(($receiver = $1) == nil || $receiver == undefined){
  1007. self["@wrapper"]=_st(html)._span();
  1008. self["@wrapper"];
  1009. } else {
  1010. $1;
  1011. };
  1012. $2=self["@wrapper"];
  1013. _st($2)._class_(self._status());
  1014. $3=_st($2)._with_((function(){
  1015. return smalltalk.withContext(function($ctx2) {
  1016. $4=_st(html)._input();
  1017. _st($4)._placeholder_(self._ghostText());
  1018. _st($4)._value_(self._defaultValue());
  1019. $5=_st($4)._yourself();
  1020. self["@input"]=$5;
  1021. self["@input"];
  1022. _st(_st(self["@input"])._asJQuery())._typeahead_(smalltalk.HashedCollection._from_(["source".__minus_gt(self._inputCompletion())]));
  1023. $6=_st(html)._span();
  1024. _st($6)._class_("help-inline");
  1025. _st($6)._with_(self._message());
  1026. $7=_st($6)._yourself();
  1027. self["@messageTag"]=$7;
  1028. return self["@messageTag"];
  1029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1030. _st((function(){
  1031. return smalltalk.withContext(function($ctx2) {
  1032. return _st(_st(self["@input"])._asJQuery())._focus();
  1033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((10));
  1034. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
  1035. args: ["aBinder", "html"],
  1036. 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",
  1037. messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "ghostText", "input", "value:", "defaultValue", "yourself", "typeahead:", "->", "inputCompletion", "asJQuery", "message", "valueWithTimeout:", "focus"],
  1038. referencedClasses: []
  1039. }),
  1040. smalltalk.HLBindingInput);
  1041. smalltalk.addMethod(
  1042. smalltalk.method({
  1043. selector: "status",
  1044. category: 'accessing',
  1045. fn: function (){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) {
  1048. var $2,$1;
  1049. $2=self["@status"];
  1050. if(($receiver = $2) == nil || $receiver == undefined){
  1051. self["@status"]="info";
  1052. $1=self["@status"];
  1053. } else {
  1054. $1=$2;
  1055. };
  1056. return $1;
  1057. }, function($ctx1) {$ctx1.fill(self,"status",{},smalltalk.HLBindingInput)})},
  1058. args: [],
  1059. source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
  1060. messageSends: ["ifNil:"],
  1061. referencedClasses: []
  1062. }),
  1063. smalltalk.HLBindingInput);
  1064. smalltalk.addMethod(
  1065. smalltalk.method({
  1066. selector: "status:",
  1067. category: 'accessing',
  1068. fn: function (aStatus){
  1069. var self=this;
  1070. return smalltalk.withContext(function($ctx1) {
  1071. self["@status"]=aStatus;
  1072. return self}, function($ctx1) {$ctx1.fill(self,"status:",{aStatus:aStatus},smalltalk.HLBindingInput)})},
  1073. args: ["aStatus"],
  1074. source: "status: aStatus\x0a\x09status := aStatus",
  1075. messageSends: [],
  1076. referencedClasses: []
  1077. }),
  1078. smalltalk.HLBindingInput);
  1079. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  1080. smalltalk.HLKeyBinder.comment="My current instance keeps keybindings for Helios actions.";
  1081. smalltalk.addMethod(
  1082. smalltalk.method({
  1083. selector: "activate",
  1084. category: 'actions',
  1085. fn: function (){
  1086. var self=this;
  1087. return smalltalk.withContext(function($ctx1) {
  1088. _st(self._helper())._show();
  1089. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  1090. args: [],
  1091. source: "activate\x0a\x09self helper show",
  1092. messageSends: ["show", "helper"],
  1093. referencedClasses: []
  1094. }),
  1095. smalltalk.HLKeyBinder);
  1096. smalltalk.addMethod(
  1097. smalltalk.method({
  1098. selector: "activationKey",
  1099. category: 'accessing',
  1100. fn: function (){
  1101. var self=this;
  1102. return smalltalk.withContext(function($ctx1) {
  1103. return (32);
  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. self._selectBinding_(aBinding);
  1140. _st(aBinding)._applyOn_(self);
  1141. $3=_st(aBinding)._isFinal();
  1142. if(smalltalk.assert($3)){
  1143. 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"]=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(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 $HLCloseTabCommand(){return smalltalk.HLCloseTabCommand||(typeof HLCloseTabCommand=="undefined"?nil:HLCloseTabCommand)}
  1206. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  1207. function $HLSwitchTabCommand(){return smalltalk.HLSwitchTabCommand||(typeof HLSwitchTabCommand=="undefined"?nil:HLSwitchTabCommand)}
  1208. function $HLOpenCommand(){return smalltalk.HLOpenCommand||(typeof HLOpenCommand=="undefined"?nil:HLOpenCommand)}
  1209. return smalltalk.withContext(function($ctx1) {
  1210. var $1,$2,$3;
  1211. $1=_st($HLBindingGroup())._new();
  1212. _st($1)._add_(_st(_st($HLCloseTabCommand())._new())._asBinding());
  1213. _st($1)._add_(_st(_st($HLSwitchTabCommand())._new())._asBinding());
  1214. $2=_st($1)._yourself();
  1215. group=$2;
  1216. _st($HLOpenCommand())._registerConcreteClassesOn_(group);
  1217. $3=group;
  1218. return $3;
  1219. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  1220. args: [],
  1221. source: "defaultBindings\x0a\x09| group |\x0a\x09\x0a\x09group := HLBindingGroup new\x0a\x09\x09add: HLCloseTabCommand new asBinding;\x0a\x09\x09add: HLSwitchTabCommand new asBinding;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09HLOpenCommand registerConcreteClassesOn: group.\x0a\x09\x09\x09\x09\x0a\x09^ group",
  1222. messageSends: ["add:", "asBinding", "new", "yourself", "registerConcreteClassesOn:"],
  1223. referencedClasses: ["HLCloseTabCommand", "HLBindingGroup", "HLSwitchTabCommand", "HLOpenCommand"]
  1224. }),
  1225. smalltalk.HLKeyBinder);
  1226. smalltalk.addMethod(
  1227. smalltalk.method({
  1228. selector: "escapeKey",
  1229. category: 'accessing',
  1230. fn: function (){
  1231. var self=this;
  1232. return smalltalk.withContext(function($ctx1) {
  1233. return (27);
  1234. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{},smalltalk.HLKeyBinder)})},
  1235. args: [],
  1236. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  1237. messageSends: [],
  1238. referencedClasses: []
  1239. }),
  1240. smalltalk.HLKeyBinder);
  1241. smalltalk.addMethod(
  1242. smalltalk.method({
  1243. selector: "flushBindings",
  1244. category: 'actions',
  1245. fn: function (){
  1246. var self=this;
  1247. return smalltalk.withContext(function($ctx1) {
  1248. self["@bindings"]=nil;
  1249. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{},smalltalk.HLKeyBinder)})},
  1250. args: [],
  1251. source: "flushBindings\x0a\x09bindings := nil",
  1252. messageSends: [],
  1253. referencedClasses: []
  1254. }),
  1255. smalltalk.HLKeyBinder);
  1256. smalltalk.addMethod(
  1257. smalltalk.method({
  1258. selector: "handleActiveKeyDown:",
  1259. category: 'events',
  1260. fn: function (event){
  1261. var self=this;
  1262. return smalltalk.withContext(function($ctx1) {
  1263. var $1,$2;
  1264. $1=_st(_st(_st(event)._which()).__eq(self._escapeKey()))._or_((function(){
  1265. return smalltalk.withContext(function($ctx2) {
  1266. return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  1267. return smalltalk.withContext(function($ctx3) {
  1268. return _st(event)._ctrlKey();
  1269. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  1270. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1271. if(smalltalk.assert($1)){
  1272. self._deactivate();
  1273. _st(event)._preventDefault();
  1274. return false;
  1275. };
  1276. $2=self._handleBindingFor_(event);
  1277. return $2;
  1278. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1279. args: ["event"],
  1280. 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",
  1281. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  1282. referencedClasses: []
  1283. }),
  1284. smalltalk.HLKeyBinder);
  1285. smalltalk.addMethod(
  1286. smalltalk.method({
  1287. selector: "handleBindingFor:",
  1288. category: 'events',
  1289. fn: function (anEvent){
  1290. var self=this;
  1291. var binding;
  1292. return smalltalk.withContext(function($ctx1) {
  1293. var $1;
  1294. binding=_st(self._selectedBinding())._atKey_(_st(anEvent)._which());
  1295. $1=binding;
  1296. if(($receiver = $1) == nil || $receiver == undefined){
  1297. $1;
  1298. } else {
  1299. self._applyBinding_(binding);
  1300. _st(anEvent)._preventDefault();
  1301. return false;
  1302. };
  1303. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},smalltalk.HLKeyBinder)})},
  1304. args: ["anEvent"],
  1305. 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 ]",
  1306. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  1307. referencedClasses: []
  1308. }),
  1309. smalltalk.HLKeyBinder);
  1310. smalltalk.addMethod(
  1311. smalltalk.method({
  1312. selector: "handleInactiveKeyDown:",
  1313. category: 'events',
  1314. fn: function (event){
  1315. var self=this;
  1316. return smalltalk.withContext(function($ctx1) {
  1317. var $1,$2;
  1318. $1=_st(_st(event)._which()).__eq(self._activationKey());
  1319. if(smalltalk.assert($1)){
  1320. $2=_st(event)._ctrlKey();
  1321. if(smalltalk.assert($2)){
  1322. self._activate();
  1323. _st(event)._preventDefault();
  1324. return false;
  1325. };
  1326. };
  1327. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1328. args: ["event"],
  1329. source: "handleInactiveKeyDown: event\x0a\x09event which = self activationKey ifTrue: [\x0a \x09event ctrlKey ifTrue: [\x0a\x09\x09\x09self activate. \x0a event preventDefault. \x0a ^ false ] ]",
  1330. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.HLKeyBinder);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "handleKeyDown:",
  1337. category: 'events',
  1338. fn: function (event){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. var $2,$1;
  1342. $2=self._isActive();
  1343. if(smalltalk.assert($2)){
  1344. $1=self._handleActiveKeyDown_(event);
  1345. } else {
  1346. $1=self._handleInactiveKeyDown_(event);
  1347. };
  1348. return $1;
  1349. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1350. args: ["event"],
  1351. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  1352. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  1353. referencedClasses: []
  1354. }),
  1355. smalltalk.HLKeyBinder);
  1356. smalltalk.addMethod(
  1357. smalltalk.method({
  1358. selector: "helper",
  1359. category: 'accessing',
  1360. fn: function (){
  1361. var self=this;
  1362. return smalltalk.withContext(function($ctx1) {
  1363. var $1;
  1364. $1=self["@helper"];
  1365. return $1;
  1366. }, function($ctx1) {$ctx1.fill(self,"helper",{},smalltalk.HLKeyBinder)})},
  1367. args: [],
  1368. source: "helper\x0a\x09^ helper",
  1369. messageSends: [],
  1370. referencedClasses: []
  1371. }),
  1372. smalltalk.HLKeyBinder);
  1373. smalltalk.addMethod(
  1374. smalltalk.method({
  1375. selector: "initialize",
  1376. category: 'initialization',
  1377. fn: function (){
  1378. var self=this;
  1379. function $HLKeyBinderHelper(){return smalltalk.HLKeyBinderHelper||(typeof HLKeyBinderHelper=="undefined"?nil:HLKeyBinderHelper)}
  1380. return smalltalk.withContext(function($ctx1) {
  1381. var $1,$2;
  1382. smalltalk.HLKeyBinder.superclass.fn.prototype._initialize.apply(_st(self), []);
  1383. self["@helper"]=_st($HLKeyBinderHelper())._on_(self);
  1384. $1=self["@helper"];
  1385. _st($1)._renderStart();
  1386. $2=_st($1)._renderCog();
  1387. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  1388. args: [],
  1389. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper \x09\x0a\x09\x09renderStart;\x0a\x09\x09renderCog",
  1390. messageSends: ["initialize", "on:", "renderStart", "renderCog"],
  1391. referencedClasses: ["HLKeyBinderHelper"]
  1392. }),
  1393. smalltalk.HLKeyBinder);
  1394. smalltalk.addMethod(
  1395. smalltalk.method({
  1396. selector: "isActive",
  1397. category: 'testing',
  1398. fn: function (){
  1399. var self=this;
  1400. return smalltalk.withContext(function($ctx1) {
  1401. var $1;
  1402. $1=_st(_st(".".__comma(_st(self._helper())._cssClass()))._asJQuery())._is_(":visible");
  1403. return $1;
  1404. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  1405. args: [],
  1406. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  1407. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"],
  1408. referencedClasses: []
  1409. }),
  1410. smalltalk.HLKeyBinder);
  1411. smalltalk.addMethod(
  1412. smalltalk.method({
  1413. selector: "selectBinding:",
  1414. category: 'actions',
  1415. fn: function (aBinding){
  1416. var self=this;
  1417. return smalltalk.withContext(function($ctx1) {
  1418. var $1,$2;
  1419. $1=_st(aBinding).__eq(self["@selectedBinding"]);
  1420. if(smalltalk.assert($1)){
  1421. $2=self;
  1422. return $2;
  1423. };
  1424. self["@selectedBinding"]=aBinding;
  1425. _st(self._helper())._refresh();
  1426. return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1427. args: ["aBinding"],
  1428. source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
  1429. messageSends: ["ifTrue:", "=", "refresh", "helper"],
  1430. referencedClasses: []
  1431. }),
  1432. smalltalk.HLKeyBinder);
  1433. smalltalk.addMethod(
  1434. smalltalk.method({
  1435. selector: "selectedBinding",
  1436. category: 'accessing',
  1437. fn: function (){
  1438. var self=this;
  1439. return smalltalk.withContext(function($ctx1) {
  1440. var $2,$1;
  1441. $2=self["@selectedBinding"];
  1442. if(($receiver = $2) == nil || $receiver == undefined){
  1443. $1=self._bindings();
  1444. } else {
  1445. $1=$2;
  1446. };
  1447. return $1;
  1448. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinder)})},
  1449. args: [],
  1450. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  1451. messageSends: ["ifNil:", "bindings"],
  1452. referencedClasses: []
  1453. }),
  1454. smalltalk.HLKeyBinder);
  1455. smalltalk.addMethod(
  1456. smalltalk.method({
  1457. selector: "setupEvents",
  1458. category: 'events',
  1459. fn: function (){
  1460. var self=this;
  1461. return smalltalk.withContext(function($ctx1) {
  1462. _st("body"._asJQuery())._keydown_((function(event){
  1463. return smalltalk.withContext(function($ctx2) {
  1464. return self._handleKeyDown_(event);
  1465. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  1466. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},smalltalk.HLKeyBinder)})},
  1467. args: [],
  1468. source: "setupEvents\x0a\x09'body' asJQuery keydown: [ :event | self handleKeyDown: event ]",
  1469. messageSends: ["keydown:", "handleKeyDown:", "asJQuery"],
  1470. referencedClasses: []
  1471. }),
  1472. smalltalk.HLKeyBinder);
  1473. smalltalk.addMethod(
  1474. smalltalk.method({
  1475. selector: "systemIsMac",
  1476. category: 'testing',
  1477. fn: function (){
  1478. var self=this;
  1479. return smalltalk.withContext(function($ctx1) {
  1480. var $1;
  1481. $1=_st(_st(navigator)._platform())._match_("Mac");
  1482. return $1;
  1483. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},smalltalk.HLKeyBinder)})},
  1484. args: [],
  1485. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1486. messageSends: ["match:", "platform"],
  1487. referencedClasses: []
  1488. }),
  1489. smalltalk.HLKeyBinder);
  1490. smalltalk.HLKeyBinder.klass.iVarNames = ['current'];
  1491. smalltalk.addMethod(
  1492. smalltalk.method({
  1493. selector: "current",
  1494. category: 'instance creation',
  1495. fn: function (){
  1496. var self=this;
  1497. return smalltalk.withContext(function($ctx1) {
  1498. var $2,$1;
  1499. $2=self["@current"];
  1500. if(($receiver = $2) == nil || $receiver == undefined){
  1501. self["@current"]=smalltalk.HLKeyBinder.klass.superclass.fn.prototype._new.apply(_st(self), []);
  1502. $1=self["@current"];
  1503. } else {
  1504. $1=$2;
  1505. };
  1506. return $1;
  1507. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.HLKeyBinder.klass)})},
  1508. args: [],
  1509. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  1510. messageSends: ["ifNil:", "new"],
  1511. referencedClasses: []
  1512. }),
  1513. smalltalk.HLKeyBinder.klass);
  1514. smalltalk.addMethod(
  1515. smalltalk.method({
  1516. selector: "new",
  1517. category: 'instance creation',
  1518. fn: function (){
  1519. var self=this;
  1520. return smalltalk.withContext(function($ctx1) {
  1521. self._shouldNotImplement();
  1522. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.HLKeyBinder.klass)})},
  1523. args: [],
  1524. source: "new\x0a\x09self shouldNotImplement",
  1525. messageSends: ["shouldNotImplement"],
  1526. referencedClasses: []
  1527. }),
  1528. smalltalk.HLKeyBinder.klass);
  1529. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1530. smalltalk.HLKeyBinderHelper.comment="I am the widget responsible for displaying active keybindings in a bar at the bottom of the window. Each keybinding is an instance of `HLBinding`. \x0a\x0aRendering is done through a double dispatch, see `#renderSelectedBindingOn:`.";
  1531. smalltalk.addMethod(
  1532. smalltalk.method({
  1533. selector: "cssClass",
  1534. category: 'accessing',
  1535. fn: function (){
  1536. var self=this;
  1537. return smalltalk.withContext(function($ctx1) {
  1538. return "key_helper";
  1539. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLKeyBinderHelper)})},
  1540. args: [],
  1541. source: "cssClass\x0a\x09^ 'key_helper'",
  1542. messageSends: [],
  1543. referencedClasses: []
  1544. }),
  1545. smalltalk.HLKeyBinderHelper);
  1546. smalltalk.addMethod(
  1547. smalltalk.method({
  1548. selector: "hide",
  1549. category: 'actions',
  1550. fn: function (){
  1551. var self=this;
  1552. return smalltalk.withContext(function($ctx1) {
  1553. _st(_st(".".__comma(self._cssClass()))._asJQuery())._remove();
  1554. self._showCog();
  1555. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1556. args: [],
  1557. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09self showCog",
  1558. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"],
  1559. referencedClasses: []
  1560. }),
  1561. smalltalk.HLKeyBinderHelper);
  1562. smalltalk.addMethod(
  1563. smalltalk.method({
  1564. selector: "hideCog",
  1565. category: 'actions',
  1566. fn: function (){
  1567. var self=this;
  1568. return smalltalk.withContext(function($ctx1) {
  1569. _st("#cog-helper"._asJQuery())._hide();
  1570. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1571. args: [],
  1572. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  1573. messageSends: ["hide", "asJQuery"],
  1574. referencedClasses: []
  1575. }),
  1576. smalltalk.HLKeyBinderHelper);
  1577. smalltalk.addMethod(
  1578. smalltalk.method({
  1579. selector: "keyBinder",
  1580. category: 'accessing',
  1581. fn: function (){
  1582. var self=this;
  1583. return smalltalk.withContext(function($ctx1) {
  1584. var $1;
  1585. $1=self["@keyBinder"];
  1586. return $1;
  1587. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{},smalltalk.HLKeyBinderHelper)})},
  1588. args: [],
  1589. source: "keyBinder\x0a\x09^ keyBinder",
  1590. messageSends: [],
  1591. referencedClasses: []
  1592. }),
  1593. smalltalk.HLKeyBinderHelper);
  1594. smalltalk.addMethod(
  1595. smalltalk.method({
  1596. selector: "keyBinder:",
  1597. category: 'accessing',
  1598. fn: function (aKeyBinder){
  1599. var self=this;
  1600. return smalltalk.withContext(function($ctx1) {
  1601. self["@keyBinder"]=aKeyBinder;
  1602. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper)})},
  1603. args: ["aKeyBinder"],
  1604. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  1605. messageSends: [],
  1606. referencedClasses: []
  1607. }),
  1608. smalltalk.HLKeyBinderHelper);
  1609. smalltalk.addMethod(
  1610. smalltalk.method({
  1611. selector: "renderBindingActionFor:on:",
  1612. category: 'rendering',
  1613. fn: function (aBinding,html){
  1614. var self=this;
  1615. return smalltalk.withContext(function($ctx1) {
  1616. var $1,$3,$4,$5,$6,$2;
  1617. $1=_st(html)._span();
  1618. _st($1)._class_("command");
  1619. $2=_st($1)._with_((function(){
  1620. return smalltalk.withContext(function($ctx2) {
  1621. $3=_st(html)._span();
  1622. _st($3)._class_("label");
  1623. $4=_st($3)._with_(_st(_st(aBinding)._shortcut())._asLowercase());
  1624. $4;
  1625. $5=_st(html)._a();
  1626. _st($5)._class_("action");
  1627. _st($5)._with_(_st(aBinding)._displayLabel());
  1628. $6=_st($5)._onClick_((function(){
  1629. return smalltalk.withContext(function($ctx3) {
  1630. return _st(self._keyBinder())._applyBinding_(aBinding);
  1631. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  1632. return $6;
  1633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1634. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingActionFor:on:",{aBinding:aBinding,html:html},smalltalk.HLKeyBinderHelper)})},
  1635. args: ["aBinding", "html"],
  1636. source: "renderBindingActionFor: aBinding on: html\x0a\x09html span class: 'command'; with: [\x0a\x09\x09html span \x0a\x09\x09\x09class: 'label'; \x0a\x09\x09\x09with: aBinding shortcut asLowercase.\x0a \x09\x09html a \x0a \x09class: 'action'; \x0a with: aBinding displayLabel;\x0a \x09\x09\x09onClick: [ self keyBinder applyBinding: aBinding ] ]",
  1637. messageSends: ["class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:", "keyBinder"],
  1638. referencedClasses: []
  1639. }),
  1640. smalltalk.HLKeyBinderHelper);
  1641. smalltalk.addMethod(
  1642. smalltalk.method({
  1643. selector: "renderBindingGroup:on:",
  1644. category: 'rendering',
  1645. fn: function (aBindingGroup,html){
  1646. var self=this;
  1647. return smalltalk.withContext(function($ctx1) {
  1648. _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1649. return smalltalk.withContext(function($ctx2) {
  1650. return _st(_st(a)._key()).__lt(_st(b)._key());
  1651. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1652. return smalltalk.withContext(function($ctx2) {
  1653. return self._renderBindingActionFor_on_(each,html);
  1654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1655. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1656. args: ["aBindingGroup", "html"],
  1657. source: "renderBindingGroup: aBindingGroup on: html\x0a\x09(aBindingGroup activeBindings \x0a \x09sorted: [ :a :b | a key < b key ])\x0a do: [ :each | self renderBindingActionFor: each on: html ]",
  1658. messageSends: ["do:", "renderBindingActionFor:on:", "sorted:", "<", "key", "activeBindings"],
  1659. referencedClasses: []
  1660. }),
  1661. smalltalk.HLKeyBinderHelper);
  1662. smalltalk.addMethod(
  1663. smalltalk.method({
  1664. selector: "renderCloseOn:",
  1665. category: 'rendering',
  1666. fn: function (html){
  1667. var self=this;
  1668. return smalltalk.withContext(function($ctx1) {
  1669. var $1,$2;
  1670. $1=_st(html)._a();
  1671. _st($1)._class_("close");
  1672. _st($1)._with_((function(){
  1673. return smalltalk.withContext(function($ctx2) {
  1674. return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1676. $2=_st($1)._onClick_((function(){
  1677. return smalltalk.withContext(function($ctx2) {
  1678. return _st(self._keyBinder())._deactivate();
  1679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1680. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1681. args: ["html"],
  1682. 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 ]",
  1683. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"],
  1684. referencedClasses: []
  1685. }),
  1686. smalltalk.HLKeyBinderHelper);
  1687. smalltalk.addMethod(
  1688. smalltalk.method({
  1689. selector: "renderCog",
  1690. category: 'rendering',
  1691. fn: function (){
  1692. var self=this;
  1693. return smalltalk.withContext(function($ctx1) {
  1694. var $1,$3,$4,$2;
  1695. _st((function(html){
  1696. return smalltalk.withContext(function($ctx2) {
  1697. $1=_st(html)._div();
  1698. _st($1)._id_("cog-helper");
  1699. $2=_st($1)._with_((function(){
  1700. return smalltalk.withContext(function($ctx3) {
  1701. $3=_st(html)._a();
  1702. _st($3)._with_((function(){
  1703. return smalltalk.withContext(function($ctx4) {
  1704. return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1705. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  1706. $4=_st($3)._onClick_((function(){
  1707. return smalltalk.withContext(function($ctx4) {
  1708. return _st(self._keyBinder())._activate();
  1709. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  1710. return $4;
  1711. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  1712. return $2;
  1713. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_("body"._asJQuery());
  1714. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1715. args: [],
  1716. 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",
  1717. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"],
  1718. referencedClasses: []
  1719. }),
  1720. smalltalk.HLKeyBinderHelper);
  1721. smalltalk.addMethod(
  1722. smalltalk.method({
  1723. selector: "renderContentOn:",
  1724. category: 'rendering',
  1725. fn: function (html){
  1726. var self=this;
  1727. return smalltalk.withContext(function($ctx1) {
  1728. var $1,$3,$4,$2;
  1729. $1=_st(html)._div();
  1730. _st($1)._class_(self._cssClass());
  1731. $2=_st($1)._with_((function(){
  1732. return smalltalk.withContext(function($ctx2) {
  1733. $3=self;
  1734. _st($3)._renderLabelOn_(html);
  1735. _st($3)._renderSelectedBindingOn_(html);
  1736. $4=_st($3)._renderCloseOn_(html);
  1737. return $4;
  1738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1739. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1740. args: ["html"],
  1741. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderLabelOn:html;\x0a \x09renderSelectedBindingOn: html;\x0a\x09\x09\x09renderCloseOn: html ]",
  1742. messageSends: ["class:", "cssClass", "div", "with:", "renderLabelOn:", "renderSelectedBindingOn:", "renderCloseOn:"],
  1743. referencedClasses: []
  1744. }),
  1745. smalltalk.HLKeyBinderHelper);
  1746. smalltalk.addMethod(
  1747. smalltalk.method({
  1748. selector: "renderLabelOn:",
  1749. category: 'rendering',
  1750. fn: function (html){
  1751. var self=this;
  1752. return smalltalk.withContext(function($ctx1) {
  1753. var $1,$3,$5,$4,$2;
  1754. $1=_st(html)._span();
  1755. _st($1)._class_("selected");
  1756. $3=$1;
  1757. $5=_st(self._selectedBinding())._label();
  1758. if(($receiver = $5) == nil || $receiver == undefined){
  1759. $4="Action";
  1760. } else {
  1761. $4=$5;
  1762. };
  1763. $2=_st($3)._with_($4);
  1764. return self}, function($ctx1) {$ctx1.fill(self,"renderLabelOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1765. args: ["html"],
  1766. source: "renderLabelOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  1767. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  1768. referencedClasses: []
  1769. }),
  1770. smalltalk.HLKeyBinderHelper);
  1771. smalltalk.addMethod(
  1772. smalltalk.method({
  1773. selector: "renderSelectedBindingOn:",
  1774. category: 'rendering',
  1775. fn: function (html){
  1776. var self=this;
  1777. return smalltalk.withContext(function($ctx1) {
  1778. _st(self._selectedBinding())._renderOn_html_(self,html);
  1779. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectedBindingOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1780. args: ["html"],
  1781. source: "renderSelectedBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html\x0a\x09",
  1782. messageSends: ["renderOn:html:", "selectedBinding"],
  1783. referencedClasses: []
  1784. }),
  1785. smalltalk.HLKeyBinderHelper);
  1786. smalltalk.addMethod(
  1787. smalltalk.method({
  1788. selector: "renderStart",
  1789. category: 'rendering',
  1790. fn: function (){
  1791. var self=this;
  1792. return smalltalk.withContext(function($ctx1) {
  1793. var $1,$2;
  1794. _st("#helper"._asJQuery())._remove();
  1795. _st((function(html){
  1796. return smalltalk.withContext(function($ctx2) {
  1797. $1=_st(html)._div();
  1798. _st($1)._id_("helper");
  1799. $2=_st($1)._with_(_st("Press ".__comma(_st(self._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1800. return $2;
  1801. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_("body"._asJQuery());
  1802. _st((function(){
  1803. return smalltalk.withContext(function($ctx2) {
  1804. return _st("#helper"._asJQuery())._fadeOut_((1000));
  1805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1806. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{},smalltalk.HLKeyBinderHelper)})},
  1807. args: [],
  1808. source: "renderStart\x0a\x09'#helper' asJQuery 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[ '#helper' asJQuery fadeOut: 1000 ] \x0a\x09\x09valueWithTimeout: 2000",
  1809. messageSends: ["remove", "asJQuery", "appendToJQuery:", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:"],
  1810. referencedClasses: []
  1811. }),
  1812. smalltalk.HLKeyBinderHelper);
  1813. smalltalk.addMethod(
  1814. smalltalk.method({
  1815. selector: "selectedBinding",
  1816. category: 'accessing',
  1817. fn: function (){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) {
  1820. var $1;
  1821. $1=_st(self._keyBinder())._selectedBinding();
  1822. return $1;
  1823. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinderHelper)})},
  1824. args: [],
  1825. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1826. messageSends: ["selectedBinding", "keyBinder"],
  1827. referencedClasses: []
  1828. }),
  1829. smalltalk.HLKeyBinderHelper);
  1830. smalltalk.addMethod(
  1831. smalltalk.method({
  1832. selector: "show",
  1833. category: 'actions',
  1834. fn: function (){
  1835. var self=this;
  1836. return smalltalk.withContext(function($ctx1) {
  1837. self._hideCog();
  1838. self._appendToJQuery_("body"._asJQuery());
  1839. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1840. args: [],
  1841. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1842. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"],
  1843. referencedClasses: []
  1844. }),
  1845. smalltalk.HLKeyBinderHelper);
  1846. smalltalk.addMethod(
  1847. smalltalk.method({
  1848. selector: "showCog",
  1849. category: 'actions',
  1850. fn: function (){
  1851. var self=this;
  1852. return smalltalk.withContext(function($ctx1) {
  1853. _st("#cog-helper"._asJQuery())._show();
  1854. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1855. args: [],
  1856. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  1857. messageSends: ["show", "asJQuery"],
  1858. referencedClasses: []
  1859. }),
  1860. smalltalk.HLKeyBinderHelper);
  1861. smalltalk.addMethod(
  1862. smalltalk.method({
  1863. selector: "on:",
  1864. category: 'instance creation',
  1865. fn: function (aKeyBinder){
  1866. var self=this;
  1867. return smalltalk.withContext(function($ctx1) {
  1868. var $2,$3,$1;
  1869. $2=self._new();
  1870. _st($2)._keyBinder_(aKeyBinder);
  1871. $3=_st($2)._yourself();
  1872. $1=$3;
  1873. return $1;
  1874. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper.klass)})},
  1875. args: ["aKeyBinder"],
  1876. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1877. messageSends: ["keyBinder:", "new", "yourself"],
  1878. referencedClasses: []
  1879. }),
  1880. smalltalk.HLKeyBinderHelper.klass);
  1881. smalltalk.addClass('HLRepeatedKeyDownHandler', smalltalk.Object, ['repeatInterval', 'delay', 'interval', 'keyBindings', 'widget', 'keyDown'], 'Helios-KeyBindings');
  1882. smalltalk.HLRepeatedKeyDownHandler.comment="I am responsible for handling repeated key down actions for widgets.\x0a\x0a##Usage\x0a\x0a (self on: aWidget)\x0a whileKeyDown: 38 do: aBlock;\x0a whileKeyDown: 40 do: anotherBlock;\x0a bindKeys\x0a\x0aI perform an action block on a key press, wait for 300 ms and then preform the same action block every `repeatInterval` milliseconds until the key is released.";
  1883. smalltalk.addMethod(
  1884. smalltalk.method({
  1885. selector: "bindKeys",
  1886. category: 'binding',
  1887. fn: function (){
  1888. var self=this;
  1889. return smalltalk.withContext(function($ctx1) {
  1890. _st(self._widget())._bindKeyDown_keyUp_((function(e){
  1891. return smalltalk.withContext(function($ctx2) {
  1892. return self._handleKeyDown_(e);
  1893. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}),(function(e){
  1894. return smalltalk.withContext(function($ctx2) {
  1895. return self._handleKeyUp();
  1896. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  1897. return self}, function($ctx1) {$ctx1.fill(self,"bindKeys",{},smalltalk.HLRepeatedKeyDownHandler)})},
  1898. args: [],
  1899. source: "bindKeys\x0a\x09self widget \x0a\x09\x09bindKeyDown: [ :e | self handleKeyDown: e ] \x0a\x09\x09keyUp: [ :e | self handleKeyUp ]",
  1900. messageSends: ["bindKeyDown:keyUp:", "handleKeyDown:", "handleKeyUp", "widget"],
  1901. referencedClasses: []
  1902. }),
  1903. smalltalk.HLRepeatedKeyDownHandler);
  1904. smalltalk.addMethod(
  1905. smalltalk.method({
  1906. selector: "defaultRepeatInterval",
  1907. category: 'defaults',
  1908. fn: function (){
  1909. var self=this;
  1910. return smalltalk.withContext(function($ctx1) {
  1911. return (70);
  1912. }, function($ctx1) {$ctx1.fill(self,"defaultRepeatInterval",{},smalltalk.HLRepeatedKeyDownHandler)})},
  1913. args: [],
  1914. source: "defaultRepeatInterval\x0a\x09^ 70",
  1915. messageSends: [],
  1916. referencedClasses: []
  1917. }),
  1918. smalltalk.HLRepeatedKeyDownHandler);
  1919. smalltalk.addMethod(
  1920. smalltalk.method({
  1921. selector: "handleEvent:forKey:action:",
  1922. category: 'events handling',
  1923. fn: function (anEvent,anInteger,aBlock){
  1924. var self=this;
  1925. return smalltalk.withContext(function($ctx1) {
  1926. var $1;
  1927. $1=_st(_st(_st(anEvent)._which()).__eq(anInteger))._and_((function(){
  1928. return smalltalk.withContext(function($ctx2) {
  1929. return _st(self._isKeyDown())._not();
  1930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1931. if(smalltalk.assert($1)){
  1932. self._whileKeyDownDo_(aBlock);
  1933. };
  1934. return self}, function($ctx1) {$ctx1.fill(self,"handleEvent:forKey:action:",{anEvent:anEvent,anInteger:anInteger,aBlock:aBlock},smalltalk.HLRepeatedKeyDownHandler)})},
  1935. args: ["anEvent", "anInteger", "aBlock"],
  1936. source: "handleEvent: anEvent forKey: anInteger action: aBlock\x0a\x09(anEvent which = anInteger and: [ self isKeyDown not ])\x0a\x09\x09ifTrue: [ self whileKeyDownDo: aBlock ]",
  1937. messageSends: ["ifTrue:", "whileKeyDownDo:", "and:", "not", "isKeyDown", "=", "which"],
  1938. referencedClasses: []
  1939. }),
  1940. smalltalk.HLRepeatedKeyDownHandler);
  1941. smalltalk.addMethod(
  1942. smalltalk.method({
  1943. selector: "handleKeyDown:",
  1944. category: 'events handling',
  1945. fn: function (anEvent){
  1946. var self=this;
  1947. return smalltalk.withContext(function($ctx1) {
  1948. _st(self._keyBindings())._keysAndValuesDo_((function(key,action){
  1949. return smalltalk.withContext(function($ctx2) {
  1950. return self._handleEvent_forKey_action_(anEvent,key,action);
  1951. }, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1)})}));
  1952. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{anEvent:anEvent},smalltalk.HLRepeatedKeyDownHandler)})},
  1953. args: ["anEvent"],
  1954. source: "handleKeyDown: anEvent\x0a\x09self keyBindings keysAndValuesDo: [ :key :action | \x0a\x09\x09self handleEvent: anEvent forKey: key action: action ]",
  1955. messageSends: ["keysAndValuesDo:", "handleEvent:forKey:action:", "keyBindings"],
  1956. referencedClasses: []
  1957. }),
  1958. smalltalk.HLRepeatedKeyDownHandler);
  1959. smalltalk.addMethod(
  1960. smalltalk.method({
  1961. selector: "handleKeyUp",
  1962. category: 'events handling',
  1963. fn: function (){
  1964. var self=this;
  1965. return smalltalk.withContext(function($ctx1) {
  1966. var $1,$2,$3;
  1967. $1=self._isKeyDown();
  1968. if(smalltalk.assert($1)){
  1969. self["@keyDown"]=false;
  1970. self["@keyDown"];
  1971. $2=self["@interval"];
  1972. if(($receiver = $2) == nil || $receiver == undefined){
  1973. $2;
  1974. } else {
  1975. _st(self["@interval"])._clearInterval();
  1976. };
  1977. $3=self["@delay"];
  1978. if(($receiver = $3) == nil || $receiver == undefined){
  1979. $3;
  1980. } else {
  1981. _st(self["@delay"])._clearTimeout();
  1982. };
  1983. };
  1984. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},smalltalk.HLRepeatedKeyDownHandler)})},
  1985. args: [],
  1986. source: "handleKeyUp\x0a\x09self isKeyDown ifTrue: [\x0a\x09\x09keyDown := false.\x0a\x09\x09interval ifNotNil: [ interval clearInterval ].\x0a\x09\x09delay ifNotNil: [ delay clearTimeout ] ]",
  1987. messageSends: ["ifTrue:", "ifNotNil:", "clearInterval", "clearTimeout", "isKeyDown"],
  1988. referencedClasses: []
  1989. }),
  1990. smalltalk.HLRepeatedKeyDownHandler);
  1991. smalltalk.addMethod(
  1992. smalltalk.method({
  1993. selector: "isKeyDown",
  1994. category: 'testing',
  1995. fn: function (){
  1996. var self=this;
  1997. return smalltalk.withContext(function($ctx1) {
  1998. var $2,$1;
  1999. $2=self["@keyDown"];
  2000. if(($receiver = $2) == nil || $receiver == undefined){
  2001. $1=false;
  2002. } else {
  2003. $1=$2;
  2004. };
  2005. return $1;
  2006. }, function($ctx1) {$ctx1.fill(self,"isKeyDown",{},smalltalk.HLRepeatedKeyDownHandler)})},
  2007. args: [],
  2008. source: "isKeyDown\x0a\x09^ keyDown ifNil: [ false ]",
  2009. messageSends: ["ifNil:"],
  2010. referencedClasses: []
  2011. }),
  2012. smalltalk.HLRepeatedKeyDownHandler);
  2013. smalltalk.addMethod(
  2014. smalltalk.method({
  2015. selector: "keyBindings",
  2016. category: 'accessing',
  2017. fn: function (){
  2018. var self=this;
  2019. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2020. return smalltalk.withContext(function($ctx1) {
  2021. var $2,$1;
  2022. $2=self["@keyBindings"];
  2023. if(($receiver = $2) == nil || $receiver == undefined){
  2024. self["@keyBindings"]=_st($Dictionary())._new();
  2025. $1=self["@keyBindings"];
  2026. } else {
  2027. $1=$2;
  2028. };
  2029. return $1;
  2030. }, function($ctx1) {$ctx1.fill(self,"keyBindings",{},smalltalk.HLRepeatedKeyDownHandler)})},
  2031. args: [],
  2032. source: "keyBindings\x0a\x09^ keyBindings ifNil: [ keyBindings := Dictionary new ]",
  2033. messageSends: ["ifNil:", "new"],
  2034. referencedClasses: ["Dictionary"]
  2035. }),
  2036. smalltalk.HLRepeatedKeyDownHandler);
  2037. smalltalk.addMethod(
  2038. smalltalk.method({
  2039. selector: "rebindKeys",
  2040. category: 'binding',
  2041. fn: function (){
  2042. var self=this;
  2043. return smalltalk.withContext(function($ctx1) {
  2044. var $1,$2;
  2045. $1=self;
  2046. _st($1)._unbindKeys();
  2047. $2=_st($1)._bindKeys();
  2048. return self}, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},smalltalk.HLRepeatedKeyDownHandler)})},
  2049. args: [],
  2050. source: "rebindKeys\x0a\x09self \x0a\x09\x09unbindKeys;\x0a\x09\x09bindKeys",
  2051. messageSends: ["unbindKeys", "bindKeys"],
  2052. referencedClasses: []
  2053. }),
  2054. smalltalk.HLRepeatedKeyDownHandler);
  2055. smalltalk.addMethod(
  2056. smalltalk.method({
  2057. selector: "repeatInterval",
  2058. category: 'accessing',
  2059. fn: function (){
  2060. var self=this;
  2061. return smalltalk.withContext(function($ctx1) {
  2062. var $2,$1;
  2063. $2=self["@repeatInterval"];
  2064. if(($receiver = $2) == nil || $receiver == undefined){
  2065. $1=self._defaultRepeatInterval();
  2066. } else {
  2067. $1=$2;
  2068. };
  2069. return $1;
  2070. }, function($ctx1) {$ctx1.fill(self,"repeatInterval",{},smalltalk.HLRepeatedKeyDownHandler)})},
  2071. args: [],
  2072. source: "repeatInterval\x0a\x09^ repeatInterval ifNil: [ self defaultRepeatInterval ]",
  2073. messageSends: ["ifNil:", "defaultRepeatInterval"],
  2074. referencedClasses: []
  2075. }),
  2076. smalltalk.HLRepeatedKeyDownHandler);
  2077. smalltalk.addMethod(
  2078. smalltalk.method({
  2079. selector: "repeatInterval:",
  2080. category: 'accessing',
  2081. fn: function (anInteger){
  2082. var self=this;
  2083. return smalltalk.withContext(function($ctx1) {
  2084. self["@repeatInterval"]=anInteger;
  2085. return self}, function($ctx1) {$ctx1.fill(self,"repeatInterval:",{anInteger:anInteger},smalltalk.HLRepeatedKeyDownHandler)})},
  2086. args: ["anInteger"],
  2087. source: "repeatInterval: anInteger\x0a\x09repeatInterval := anInteger",
  2088. messageSends: [],
  2089. referencedClasses: []
  2090. }),
  2091. smalltalk.HLRepeatedKeyDownHandler);
  2092. smalltalk.addMethod(
  2093. smalltalk.method({
  2094. selector: "startRepeatingAction:",
  2095. category: 'actions',
  2096. fn: function (aBlock){
  2097. var self=this;
  2098. return smalltalk.withContext(function($ctx1) {
  2099. var $2,$1;
  2100. $1=_st((function(){
  2101. return smalltalk.withContext(function($ctx2) {
  2102. $2=_st(self._widget())._hasFocus();
  2103. if(smalltalk.assert($2)){
  2104. return _st(aBlock)._value();
  2105. } else {
  2106. return self._handleKeyUp();
  2107. };
  2108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithInterval_(self._repeatInterval());
  2109. return $1;
  2110. }, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{aBlock:aBlock},smalltalk.HLRepeatedKeyDownHandler)})},
  2111. args: ["aBlock"],
  2112. source: "startRepeatingAction: aBlock\x0a\x09^ [ (self widget hasFocus)\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self handleKeyUp ] ] valueWithInterval: self repeatInterval",
  2113. messageSends: ["valueWithInterval:", "repeatInterval", "ifTrue:ifFalse:", "value", "handleKeyUp", "hasFocus", "widget"],
  2114. referencedClasses: []
  2115. }),
  2116. smalltalk.HLRepeatedKeyDownHandler);
  2117. smalltalk.addMethod(
  2118. smalltalk.method({
  2119. selector: "unbindKeys",
  2120. category: 'binding',
  2121. fn: function (){
  2122. var self=this;
  2123. return smalltalk.withContext(function($ctx1) {
  2124. _st(self._widget())._unbindKeyDownKeyUp();
  2125. return self}, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},smalltalk.HLRepeatedKeyDownHandler)})},
  2126. args: [],
  2127. source: "unbindKeys\x0a\x09self widget unbindKeyDownKeyUp",
  2128. messageSends: ["unbindKeyDownKeyUp", "widget"],
  2129. referencedClasses: []
  2130. }),
  2131. smalltalk.HLRepeatedKeyDownHandler);
  2132. smalltalk.addMethod(
  2133. smalltalk.method({
  2134. selector: "whileKeyDown:do:",
  2135. category: 'actions',
  2136. fn: function (aKey,aBlock){
  2137. var self=this;
  2138. return smalltalk.withContext(function($ctx1) {
  2139. _st(self._keyBindings())._at_put_(aKey,aBlock);
  2140. return self}, function($ctx1) {$ctx1.fill(self,"whileKeyDown:do:",{aKey:aKey,aBlock:aBlock},smalltalk.HLRepeatedKeyDownHandler)})},
  2141. args: ["aKey", "aBlock"],
  2142. source: "whileKeyDown: aKey do: aBlock\x0a\x09self keyBindings at: aKey put: aBlock",
  2143. messageSends: ["at:put:", "keyBindings"],
  2144. referencedClasses: []
  2145. }),
  2146. smalltalk.HLRepeatedKeyDownHandler);
  2147. smalltalk.addMethod(
  2148. smalltalk.method({
  2149. selector: "whileKeyDownDo:",
  2150. category: 'events handling',
  2151. fn: function (aBlock){
  2152. var self=this;
  2153. return smalltalk.withContext(function($ctx1) {
  2154. self["@keyDown"]=true;
  2155. _st(aBlock)._value();
  2156. self["@delay"]=_st((function(){
  2157. return smalltalk.withContext(function($ctx2) {
  2158. self["@interval"]=self._startRepeatingAction_(aBlock);
  2159. return self["@interval"];
  2160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((300));
  2161. return self}, function($ctx1) {$ctx1.fill(self,"whileKeyDownDo:",{aBlock:aBlock},smalltalk.HLRepeatedKeyDownHandler)})},
  2162. args: ["aBlock"],
  2163. source: "whileKeyDownDo: aBlock\x0a\x09keyDown := true.\x0a\x09aBlock value.\x0a\x09delay := [ interval := self startRepeatingAction: aBlock ] \x0a\x09\x09valueWithTimeout: 300",
  2164. messageSends: ["value", "valueWithTimeout:", "startRepeatingAction:"],
  2165. referencedClasses: []
  2166. }),
  2167. smalltalk.HLRepeatedKeyDownHandler);
  2168. smalltalk.addMethod(
  2169. smalltalk.method({
  2170. selector: "widget",
  2171. category: 'accessing',
  2172. fn: function (){
  2173. var self=this;
  2174. return smalltalk.withContext(function($ctx1) {
  2175. var $1;
  2176. $1=self["@widget"];
  2177. return $1;
  2178. }, function($ctx1) {$ctx1.fill(self,"widget",{},smalltalk.HLRepeatedKeyDownHandler)})},
  2179. args: [],
  2180. source: "widget\x0a\x09^ widget",
  2181. messageSends: [],
  2182. referencedClasses: []
  2183. }),
  2184. smalltalk.HLRepeatedKeyDownHandler);
  2185. smalltalk.addMethod(
  2186. smalltalk.method({
  2187. selector: "widget:",
  2188. category: 'accessing',
  2189. fn: function (aWidget){
  2190. var self=this;
  2191. return smalltalk.withContext(function($ctx1) {
  2192. self["@widget"]=aWidget;
  2193. return self}, function($ctx1) {$ctx1.fill(self,"widget:",{aWidget:aWidget},smalltalk.HLRepeatedKeyDownHandler)})},
  2194. args: ["aWidget"],
  2195. source: "widget: aWidget\x0a\x09widget := aWidget",
  2196. messageSends: [],
  2197. referencedClasses: []
  2198. }),
  2199. smalltalk.HLRepeatedKeyDownHandler);
  2200. smalltalk.addMethod(
  2201. smalltalk.method({
  2202. selector: "on:",
  2203. category: 'instance creation',
  2204. fn: function (aWidget){
  2205. var self=this;
  2206. return smalltalk.withContext(function($ctx1) {
  2207. var $2,$3,$1;
  2208. $2=self._new();
  2209. _st($2)._widget_(aWidget);
  2210. $3=_st($2)._yourself();
  2211. $1=$3;
  2212. return $1;
  2213. }, function($ctx1) {$ctx1.fill(self,"on:",{aWidget:aWidget},smalltalk.HLRepeatedKeyDownHandler.klass)})},
  2214. args: ["aWidget"],
  2215. source: "on: aWidget\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09yourself",
  2216. messageSends: ["widget:", "new", "yourself"],
  2217. referencedClasses: []
  2218. }),
  2219. smalltalk.HLRepeatedKeyDownHandler.klass);
  2220. })(global_smalltalk,global_nil,global__st);