Helios-KeyBindings.js 78 KB

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