Helios-KeyBindings.js 76 KB

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