Helios-KeyBindings.js 100 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192
  1. define("helios/Helios-KeyBindings", ["amber/boot", "amber_core/Kernel-Objects", "helios/Helios-Core"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Helios-KeyBindings');
  4. $core.packages["Helios-KeyBindings"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Helios-KeyBindings"].transport = {"type":"amd","amdNamespace":"helios"};
  6. $core.addClass('HLBinding', $globals.Object, ['key', 'label'], 'Helios-KeyBindings');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.HLBinding.comment="I am the abstract representation of a keybinding in Helios. My instances hold a key (integer value) and a label. \x0a\x0aBindings are built into a tree of keys, so pressing a key may result in more key choices (for example, to open a workspace, 'o' is pressed first then 'w' is pressed).\x0a\x0aBinding action handling and selection is handled by the `current` instance of `HLKeyBinder`.\x0a\x0aSubclasses implement specific behavior like evaluating actions or (sub-)grouping other bindings.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "apply",
  13. protocol: 'actions',
  14. fn: function (){
  15. var self=this;
  16. return self;
  17. },
  18. //>>excludeStart("ide", pragmas.excludeIdeData);
  19. args: [],
  20. source: "apply",
  21. referencedClasses: [],
  22. //>>excludeEnd("ide");
  23. messageSends: []
  24. }),
  25. $globals.HLBinding);
  26. $core.addMethod(
  27. $core.method({
  28. selector: "atKey:",
  29. protocol: 'accessing',
  30. fn: function (aKey){
  31. var self=this;
  32. return nil;
  33. },
  34. //>>excludeStart("ide", pragmas.excludeIdeData);
  35. args: ["aKey"],
  36. source: "atKey: aKey\x0a\x09\x22Answer the sub-binding at key aKey.\x0a\x09Always answer nil here. See HLBindingGroup for more.\x22\x0a\x09\x0a\x09^ nil",
  37. referencedClasses: [],
  38. //>>excludeEnd("ide");
  39. messageSends: []
  40. }),
  41. $globals.HLBinding);
  42. $core.addMethod(
  43. $core.method({
  44. selector: "displayLabel",
  45. protocol: 'accessing',
  46. fn: function (){
  47. var self=this;
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. return $core.withContext(function($ctx1) {
  50. //>>excludeEnd("ctx");
  51. return self._label();
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},$globals.HLBinding)});
  54. //>>excludeEnd("ctx");
  55. },
  56. //>>excludeStart("ide", pragmas.excludeIdeData);
  57. args: [],
  58. source: "displayLabel\x0a\x09^ self label",
  59. referencedClasses: [],
  60. //>>excludeEnd("ide");
  61. messageSends: ["label"]
  62. }),
  63. $globals.HLBinding);
  64. $core.addMethod(
  65. $core.method({
  66. selector: "isActive",
  67. protocol: 'testing',
  68. fn: function (){
  69. var self=this;
  70. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71. return $core.withContext(function($ctx1) {
  72. //>>excludeEnd("ctx");
  73. return self._subclassResponsibility();
  74. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75. }, function($ctx1) {$ctx1.fill(self,"isActive",{},$globals.HLBinding)});
  76. //>>excludeEnd("ctx");
  77. },
  78. //>>excludeStart("ide", pragmas.excludeIdeData);
  79. args: [],
  80. source: "isActive\x0a\x09^ self subclassResponsibility",
  81. referencedClasses: [],
  82. //>>excludeEnd("ide");
  83. messageSends: ["subclassResponsibility"]
  84. }),
  85. $globals.HLBinding);
  86. $core.addMethod(
  87. $core.method({
  88. selector: "key",
  89. protocol: 'accessing',
  90. fn: function (){
  91. var self=this;
  92. return self["@key"];
  93. },
  94. //>>excludeStart("ide", pragmas.excludeIdeData);
  95. args: [],
  96. source: "key\x0a\x09^ key",
  97. referencedClasses: [],
  98. //>>excludeEnd("ide");
  99. messageSends: []
  100. }),
  101. $globals.HLBinding);
  102. $core.addMethod(
  103. $core.method({
  104. selector: "key:",
  105. protocol: 'accessing',
  106. fn: function (anInteger){
  107. var self=this;
  108. self["@key"]=anInteger;
  109. return self;
  110. },
  111. //>>excludeStart("ide", pragmas.excludeIdeData);
  112. args: ["anInteger"],
  113. source: "key: anInteger\x0a\x09key := anInteger",
  114. referencedClasses: [],
  115. //>>excludeEnd("ide");
  116. messageSends: []
  117. }),
  118. $globals.HLBinding);
  119. $core.addMethod(
  120. $core.method({
  121. selector: "label",
  122. protocol: 'accessing',
  123. fn: function (){
  124. var self=this;
  125. return self["@label"];
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: [],
  129. source: "label\x0a\x09^ label",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: []
  133. }),
  134. $globals.HLBinding);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "label:",
  138. protocol: 'accessing',
  139. fn: function (aString){
  140. var self=this;
  141. self["@label"]=aString;
  142. return self;
  143. },
  144. //>>excludeStart("ide", pragmas.excludeIdeData);
  145. args: ["aString"],
  146. source: "label: aString\x0a\x09label := aString",
  147. referencedClasses: [],
  148. //>>excludeEnd("ide");
  149. messageSends: []
  150. }),
  151. $globals.HLBinding);
  152. $core.addMethod(
  153. $core.method({
  154. selector: "release",
  155. protocol: 'actions',
  156. fn: function (){
  157. var self=this;
  158. return self;
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: [],
  162. source: "release",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: []
  166. }),
  167. $globals.HLBinding);
  168. $core.addMethod(
  169. $core.method({
  170. selector: "renderOn:html:",
  171. protocol: 'rendering',
  172. fn: function (aBindingHelper,html){
  173. var self=this;
  174. return self;
  175. },
  176. //>>excludeStart("ide", pragmas.excludeIdeData);
  177. args: ["aBindingHelper", "html"],
  178. source: "renderOn: aBindingHelper html: html",
  179. referencedClasses: [],
  180. //>>excludeEnd("ide");
  181. messageSends: []
  182. }),
  183. $globals.HLBinding);
  184. $core.addMethod(
  185. $core.method({
  186. selector: "shortcut",
  187. protocol: 'accessing',
  188. fn: function (){
  189. var self=this;
  190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  191. return $core.withContext(function($ctx1) {
  192. //>>excludeEnd("ctx");
  193. return $recv($globals.String)._fromCharCode_(self._key());
  194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  195. }, function($ctx1) {$ctx1.fill(self,"shortcut",{},$globals.HLBinding)});
  196. //>>excludeEnd("ctx");
  197. },
  198. //>>excludeStart("ide", pragmas.excludeIdeData);
  199. args: [],
  200. source: "shortcut\x0a\x09^ String fromCharCode: self key",
  201. referencedClasses: ["String"],
  202. //>>excludeEnd("ide");
  203. messageSends: ["fromCharCode:", "key"]
  204. }),
  205. $globals.HLBinding);
  206. $core.addMethod(
  207. $core.method({
  208. selector: "on:labelled:",
  209. protocol: 'instance creation',
  210. fn: function (anInteger,aString){
  211. var self=this;
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. return $core.withContext(function($ctx1) {
  214. //>>excludeEnd("ctx");
  215. var $1;
  216. $1=self._new();
  217. $recv($1)._key_(anInteger);
  218. $recv($1)._label_(aString);
  219. return $recv($1)._yourself();
  220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  221. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},$globals.HLBinding.klass)});
  222. //>>excludeEnd("ctx");
  223. },
  224. //>>excludeStart("ide", pragmas.excludeIdeData);
  225. args: ["anInteger", "aString"],
  226. source: "on: anInteger labelled: aString\x0a\x09^ self new\x0a \x09key: anInteger;\x0a label: aString;\x0a yourself",
  227. referencedClasses: [],
  228. //>>excludeEnd("ide");
  229. messageSends: ["key:", "new", "label:", "yourself"]
  230. }),
  231. $globals.HLBinding.klass);
  232. $core.addClass('HLBindingAction', $globals.HLBinding, ['command'], 'Helios-KeyBindings');
  233. //>>excludeStart("ide", pragmas.excludeIdeData);
  234. $globals.HLBindingAction.comment="My instances are the leafs of the binding tree. They evaluate actions through commands, instances of concrete subclasses of `HLCommand`.\x0a\x0aThe `#apply` methods is used to evaluate the `command`. If the command requires user input, an `inputWidget` will be displayed to the user.";
  235. //>>excludeEnd("ide");
  236. $core.addMethod(
  237. $core.method({
  238. selector: "apply",
  239. protocol: 'actions',
  240. fn: function (){
  241. var self=this;
  242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  243. return $core.withContext(function($ctx1) {
  244. //>>excludeEnd("ctx");
  245. var $1;
  246. $1=$recv(self._command())._isInputRequired();
  247. if($core.assert($1)){
  248. $recv($recv($recv($globals.HLKeyBinder)._current())._helper())._showWidget_(self._inputWidget());
  249. } else {
  250. self._executeCommand();
  251. };
  252. return self;
  253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  254. }, function($ctx1) {$ctx1.fill(self,"apply",{},$globals.HLBindingAction)});
  255. //>>excludeEnd("ctx");
  256. },
  257. //>>excludeStart("ide", pragmas.excludeIdeData);
  258. args: [],
  259. source: "apply\x0a\x09self command isInputRequired\x0a\x09\x09ifTrue: [ HLKeyBinder current helper showWidget: self inputWidget ]\x0a\x09\x09ifFalse: [ self executeCommand ]",
  260. referencedClasses: ["HLKeyBinder"],
  261. //>>excludeEnd("ide");
  262. messageSends: ["ifTrue:ifFalse:", "isInputRequired", "command", "showWidget:", "helper", "current", "inputWidget", "executeCommand"]
  263. }),
  264. $globals.HLBindingAction);
  265. $core.addMethod(
  266. $core.method({
  267. selector: "command",
  268. protocol: 'accessing',
  269. fn: function (){
  270. var self=this;
  271. return self["@command"];
  272. },
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "command\x0a\x09^ command",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. messageSends: []
  279. }),
  280. $globals.HLBindingAction);
  281. $core.addMethod(
  282. $core.method({
  283. selector: "command:",
  284. protocol: 'accessing',
  285. fn: function (aCommand){
  286. var self=this;
  287. self["@command"]=aCommand;
  288. return self;
  289. },
  290. //>>excludeStart("ide", pragmas.excludeIdeData);
  291. args: ["aCommand"],
  292. source: "command: aCommand\x0a\x09command := aCommand",
  293. referencedClasses: [],
  294. //>>excludeEnd("ide");
  295. messageSends: []
  296. }),
  297. $globals.HLBindingAction);
  298. $core.addMethod(
  299. $core.method({
  300. selector: "executeCommand",
  301. protocol: 'actions',
  302. fn: function (){
  303. var self=this;
  304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  305. return $core.withContext(function($ctx1) {
  306. //>>excludeEnd("ctx");
  307. $recv(self._command())._execute();
  308. $recv($recv($globals.HLKeyBinder)._current())._deactivate();
  309. return self;
  310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  311. }, function($ctx1) {$ctx1.fill(self,"executeCommand",{},$globals.HLBindingAction)});
  312. //>>excludeEnd("ctx");
  313. },
  314. //>>excludeStart("ide", pragmas.excludeIdeData);
  315. args: [],
  316. source: "executeCommand\x0a\x09self command execute.\x0a\x09HLKeyBinder current deactivate",
  317. referencedClasses: ["HLKeyBinder"],
  318. //>>excludeEnd("ide");
  319. messageSends: ["execute", "command", "deactivate", "current"]
  320. }),
  321. $globals.HLBindingAction);
  322. $core.addMethod(
  323. $core.method({
  324. selector: "input:",
  325. protocol: 'accessing',
  326. fn: function (aString){
  327. var self=this;
  328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  329. return $core.withContext(function($ctx1) {
  330. //>>excludeEnd("ctx");
  331. $recv(self._command())._input_(aString);
  332. return self;
  333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  334. }, function($ctx1) {$ctx1.fill(self,"input:",{aString:aString},$globals.HLBindingAction)});
  335. //>>excludeEnd("ctx");
  336. },
  337. //>>excludeStart("ide", pragmas.excludeIdeData);
  338. args: ["aString"],
  339. source: "input: aString\x0a\x09self command input: aString",
  340. referencedClasses: [],
  341. //>>excludeEnd("ide");
  342. messageSends: ["input:", "command"]
  343. }),
  344. $globals.HLBindingAction);
  345. $core.addMethod(
  346. $core.method({
  347. selector: "inputBinding",
  348. protocol: 'accessing',
  349. fn: function (){
  350. var self=this;
  351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  352. return $core.withContext(function($ctx1) {
  353. //>>excludeEnd("ctx");
  354. var $1,$3,$2,$5,$4,$7,$6,$9,$8,$10;
  355. $1=$recv($globals.HLBindingInput)._new();
  356. $3=self._command();
  357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  358. $ctx1.sendIdx["command"]=1;
  359. //>>excludeEnd("ctx");
  360. $2=$recv($3)._inputLabel();
  361. $recv($1)._label_($2);
  362. $5=self._command();
  363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  364. $ctx1.sendIdx["command"]=2;
  365. //>>excludeEnd("ctx");
  366. $4=$recv($5)._displayLabel();
  367. $recv($1)._ghostText_($4);
  368. $7=self._command();
  369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  370. $ctx1.sendIdx["command"]=3;
  371. //>>excludeEnd("ctx");
  372. $6=$recv($7)._defaultInput();
  373. $recv($1)._defaultValue_($6);
  374. $9=self._command();
  375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  376. $ctx1.sendIdx["command"]=4;
  377. //>>excludeEnd("ctx");
  378. $8=$recv($9)._inputCompletion();
  379. $recv($1)._inputCompletion_($8);
  380. $recv($1)._callback_((function(val){
  381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  382. return $core.withContext(function($ctx2) {
  383. //>>excludeEnd("ctx");
  384. $10=self._command();
  385. $recv($10)._input_(val);
  386. return $recv($10)._execute();
  387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  388. }, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1,1)});
  389. //>>excludeEnd("ctx");
  390. }));
  391. return $recv($1)._yourself();
  392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  393. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},$globals.HLBindingAction)});
  394. //>>excludeEnd("ctx");
  395. },
  396. //>>excludeStart("ide", pragmas.excludeIdeData);
  397. args: [],
  398. 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",
  399. referencedClasses: ["HLBindingInput"],
  400. //>>excludeEnd("ide");
  401. messageSends: ["label:", "new", "inputLabel", "command", "ghostText:", "displayLabel", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "execute", "yourself"]
  402. }),
  403. $globals.HLBindingAction);
  404. $core.addMethod(
  405. $core.method({
  406. selector: "inputWidget",
  407. protocol: 'accessing',
  408. fn: function (){
  409. var self=this;
  410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  411. return $core.withContext(function($ctx1) {
  412. //>>excludeEnd("ctx");
  413. var $1,$3,$2,$5,$4;
  414. $1=$recv($globals.HLBindingActionInputWidget)._new();
  415. $3=self._command();
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. $ctx1.sendIdx["command"]=1;
  418. //>>excludeEnd("ctx");
  419. $2=$recv($3)._displayLabel();
  420. $recv($1)._ghostText_($2);
  421. $5=self._command();
  422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  423. $ctx1.sendIdx["command"]=2;
  424. //>>excludeEnd("ctx");
  425. $4=$recv($5)._defaultInput();
  426. $recv($1)._defaultValue_($4);
  427. $recv($1)._inputCompletion_($recv(self._command())._inputCompletion());
  428. $recv($1)._callback_((function(value){
  429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  430. return $core.withContext(function($ctx2) {
  431. //>>excludeEnd("ctx");
  432. self._input_(value);
  433. return self._executeCommand();
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1,1)});
  436. //>>excludeEnd("ctx");
  437. }));
  438. return $recv($1)._yourself();
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. }, function($ctx1) {$ctx1.fill(self,"inputWidget",{},$globals.HLBindingAction)});
  441. //>>excludeEnd("ctx");
  442. },
  443. //>>excludeStart("ide", pragmas.excludeIdeData);
  444. args: [],
  445. 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",
  446. referencedClasses: ["HLBindingActionInputWidget"],
  447. //>>excludeEnd("ide");
  448. messageSends: ["ghostText:", "new", "displayLabel", "command", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "executeCommand", "yourself"]
  449. }),
  450. $globals.HLBindingAction);
  451. $core.addMethod(
  452. $core.method({
  453. selector: "isActive",
  454. protocol: 'testing',
  455. fn: function (){
  456. var self=this;
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. return $core.withContext(function($ctx1) {
  459. //>>excludeEnd("ctx");
  460. return $recv(self._command())._isActive();
  461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  462. }, function($ctx1) {$ctx1.fill(self,"isActive",{},$globals.HLBindingAction)});
  463. //>>excludeEnd("ctx");
  464. },
  465. //>>excludeStart("ide", pragmas.excludeIdeData);
  466. args: [],
  467. source: "isActive\x0a\x09^ self command isActive",
  468. referencedClasses: [],
  469. //>>excludeEnd("ide");
  470. messageSends: ["isActive", "command"]
  471. }),
  472. $globals.HLBindingAction);
  473. $core.addClass('HLBindingGroup', $globals.HLBinding, ['bindings'], 'Helios-KeyBindings');
  474. //>>excludeStart("ide", pragmas.excludeIdeData);
  475. $globals.HLBindingGroup.comment="My instances hold other bindings, either actions or groups, and do not have actions by themselves.\x0a\x0aChildren are accessed with `atKey:` and added with the `add*` methods.";
  476. //>>excludeEnd("ide");
  477. $core.addMethod(
  478. $core.method({
  479. selector: "activeBindings",
  480. protocol: 'accessing',
  481. fn: function (){
  482. var self=this;
  483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  484. return $core.withContext(function($ctx1) {
  485. //>>excludeEnd("ctx");
  486. return $recv(self._bindings())._select_((function(each){
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx2) {
  489. //>>excludeEnd("ctx");
  490. return $recv(each)._isActive();
  491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  493. //>>excludeEnd("ctx");
  494. }));
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},$globals.HLBindingGroup)});
  497. //>>excludeEnd("ctx");
  498. },
  499. //>>excludeStart("ide", pragmas.excludeIdeData);
  500. args: [],
  501. source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
  502. referencedClasses: [],
  503. //>>excludeEnd("ide");
  504. messageSends: ["select:", "bindings", "isActive"]
  505. }),
  506. $globals.HLBindingGroup);
  507. $core.addMethod(
  508. $core.method({
  509. selector: "add:",
  510. protocol: 'adding',
  511. fn: function (aBinding){
  512. var self=this;
  513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  514. return $core.withContext(function($ctx1) {
  515. //>>excludeEnd("ctx");
  516. return $recv(self._bindings())._add_(aBinding);
  517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  518. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},$globals.HLBindingGroup)});
  519. //>>excludeEnd("ctx");
  520. },
  521. //>>excludeStart("ide", pragmas.excludeIdeData);
  522. args: ["aBinding"],
  523. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  524. referencedClasses: [],
  525. //>>excludeEnd("ide");
  526. messageSends: ["add:", "bindings"]
  527. }),
  528. $globals.HLBindingGroup);
  529. $core.addMethod(
  530. $core.method({
  531. selector: "addActionKey:labelled:callback:",
  532. protocol: 'adding',
  533. fn: function (anInteger,aString,aBlock){
  534. var self=this;
  535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  536. return $core.withContext(function($ctx1) {
  537. //>>excludeEnd("ctx");
  538. var $2,$1;
  539. $2=$recv($globals.HLBindingAction)._on_labelled_(anInteger,aString);
  540. $recv($2)._callback_(aBlock);
  541. $1=$recv($2)._yourself();
  542. self._add_($1);
  543. return self;
  544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  545. }, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},$globals.HLBindingGroup)});
  546. //>>excludeEnd("ctx");
  547. },
  548. //>>excludeStart("ide", pragmas.excludeIdeData);
  549. args: ["anInteger", "aString", "aBlock"],
  550. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  551. referencedClasses: ["HLBindingAction"],
  552. //>>excludeEnd("ide");
  553. messageSends: ["add:", "callback:", "on:labelled:", "yourself"]
  554. }),
  555. $globals.HLBindingGroup);
  556. $core.addMethod(
  557. $core.method({
  558. selector: "addGroupKey:labelled:",
  559. protocol: 'add',
  560. fn: function (anInteger,aString){
  561. var self=this;
  562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  563. return $core.withContext(function($ctx1) {
  564. //>>excludeEnd("ctx");
  565. self._add_($recv($globals.HLBindingGroup)._on_labelled_(anInteger,aString));
  566. return self;
  567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  568. }, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},$globals.HLBindingGroup)});
  569. //>>excludeEnd("ctx");
  570. },
  571. //>>excludeStart("ide", pragmas.excludeIdeData);
  572. args: ["anInteger", "aString"],
  573. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  574. referencedClasses: ["HLBindingGroup"],
  575. //>>excludeEnd("ide");
  576. messageSends: ["add:", "on:labelled:"]
  577. }),
  578. $globals.HLBindingGroup);
  579. $core.addMethod(
  580. $core.method({
  581. selector: "at:",
  582. protocol: 'accessing',
  583. fn: function (aString){
  584. var self=this;
  585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  586. return $core.withContext(function($ctx1) {
  587. //>>excludeEnd("ctx");
  588. return $recv(self._bindings())._detect_ifNone_((function(each){
  589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  590. return $core.withContext(function($ctx2) {
  591. //>>excludeEnd("ctx");
  592. return $recv($recv(each)._label()).__eq(aString);
  593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  595. //>>excludeEnd("ctx");
  596. }),(function(){
  597. return nil;
  598. }));
  599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  600. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.HLBindingGroup)});
  601. //>>excludeEnd("ctx");
  602. },
  603. //>>excludeStart("ide", pragmas.excludeIdeData);
  604. args: ["aString"],
  605. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  606. referencedClasses: [],
  607. //>>excludeEnd("ide");
  608. messageSends: ["detect:ifNone:", "bindings", "=", "label"]
  609. }),
  610. $globals.HLBindingGroup);
  611. $core.addMethod(
  612. $core.method({
  613. selector: "at:add:",
  614. protocol: 'accessing',
  615. fn: function (aString,aBinding){
  616. var self=this;
  617. var binding;
  618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  619. return $core.withContext(function($ctx1) {
  620. //>>excludeEnd("ctx");
  621. var $1,$receiver;
  622. binding=self._at_(aString);
  623. $1=binding;
  624. if(($receiver = $1) == null || $receiver.isNil){
  625. return self;
  626. } else {
  627. $1;
  628. };
  629. $recv(binding)._add_(aBinding);
  630. return self;
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},$globals.HLBindingGroup)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: ["aString", "aBinding"],
  637. 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",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: ["at:", "ifNil:", "add:"]
  641. }),
  642. $globals.HLBindingGroup);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "atKey:",
  646. protocol: 'accessing',
  647. fn: function (anInteger){
  648. var self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. return $recv(self._bindings())._detect_ifNone_((function(each){
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. return $core.withContext(function($ctx2) {
  655. //>>excludeEnd("ctx");
  656. return $recv($recv(each)._key()).__eq(anInteger);
  657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  658. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  659. //>>excludeEnd("ctx");
  660. }),(function(){
  661. return nil;
  662. }));
  663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  664. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},$globals.HLBindingGroup)});
  665. //>>excludeEnd("ctx");
  666. },
  667. //>>excludeStart("ide", pragmas.excludeIdeData);
  668. args: ["anInteger"],
  669. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  670. referencedClasses: [],
  671. //>>excludeEnd("ide");
  672. messageSends: ["detect:ifNone:", "bindings", "=", "key"]
  673. }),
  674. $globals.HLBindingGroup);
  675. $core.addMethod(
  676. $core.method({
  677. selector: "bindings",
  678. protocol: 'accessing',
  679. fn: function (){
  680. var self=this;
  681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  682. return $core.withContext(function($ctx1) {
  683. //>>excludeEnd("ctx");
  684. var $1,$receiver;
  685. $1=self["@bindings"];
  686. if(($receiver = $1) == null || $receiver.isNil){
  687. self["@bindings"]=$recv($globals.OrderedCollection)._new();
  688. return self["@bindings"];
  689. } else {
  690. return $1;
  691. };
  692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  693. }, function($ctx1) {$ctx1.fill(self,"bindings",{},$globals.HLBindingGroup)});
  694. //>>excludeEnd("ctx");
  695. },
  696. //>>excludeStart("ide", pragmas.excludeIdeData);
  697. args: [],
  698. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  699. referencedClasses: ["OrderedCollection"],
  700. //>>excludeEnd("ide");
  701. messageSends: ["ifNil:", "new"]
  702. }),
  703. $globals.HLBindingGroup);
  704. $core.addMethod(
  705. $core.method({
  706. selector: "displayLabel",
  707. protocol: 'accessing',
  708. fn: function (){
  709. var self=this;
  710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  711. return $core.withContext(function($ctx1) {
  712. //>>excludeEnd("ctx");
  713. var $1;
  714. $1=(
  715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  716. $ctx1.supercall = true,
  717. //>>excludeEnd("ctx");
  718. ($globals.HLBindingGroup.superclass||$boot.dnu).fn.prototype._displayLabel.apply($recv(self), []));
  719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  720. $ctx1.supercall = false;
  721. //>>excludeEnd("ctx");;
  722. return $recv($1).__comma("...");
  723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  724. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},$globals.HLBindingGroup)});
  725. //>>excludeEnd("ctx");
  726. },
  727. //>>excludeStart("ide", pragmas.excludeIdeData);
  728. args: [],
  729. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  730. referencedClasses: [],
  731. //>>excludeEnd("ide");
  732. messageSends: [",", "displayLabel"]
  733. }),
  734. $globals.HLBindingGroup);
  735. $core.addMethod(
  736. $core.method({
  737. selector: "isActive",
  738. protocol: 'testing',
  739. fn: function (){
  740. var self=this;
  741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  742. return $core.withContext(function($ctx1) {
  743. //>>excludeEnd("ctx");
  744. return $recv(self._activeBindings())._notEmpty();
  745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  746. }, function($ctx1) {$ctx1.fill(self,"isActive",{},$globals.HLBindingGroup)});
  747. //>>excludeEnd("ctx");
  748. },
  749. //>>excludeStart("ide", pragmas.excludeIdeData);
  750. args: [],
  751. source: "isActive\x0a\x09^ self activeBindings notEmpty",
  752. referencedClasses: [],
  753. //>>excludeEnd("ide");
  754. messageSends: ["notEmpty", "activeBindings"]
  755. }),
  756. $globals.HLBindingGroup);
  757. $core.addMethod(
  758. $core.method({
  759. selector: "release",
  760. protocol: 'actions',
  761. fn: function (){
  762. var self=this;
  763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  764. return $core.withContext(function($ctx1) {
  765. //>>excludeEnd("ctx");
  766. $recv(self._bindings())._do_((function(each){
  767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  768. return $core.withContext(function($ctx2) {
  769. //>>excludeEnd("ctx");
  770. return $recv(each)._release();
  771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  773. //>>excludeEnd("ctx");
  774. }));
  775. return self;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. }, function($ctx1) {$ctx1.fill(self,"release",{},$globals.HLBindingGroup)});
  778. //>>excludeEnd("ctx");
  779. },
  780. //>>excludeStart("ide", pragmas.excludeIdeData);
  781. args: [],
  782. source: "release\x0a\x09self bindings do: [ :each | each release ]",
  783. referencedClasses: [],
  784. //>>excludeEnd("ide");
  785. messageSends: ["do:", "bindings", "release"]
  786. }),
  787. $globals.HLBindingGroup);
  788. $core.addMethod(
  789. $core.method({
  790. selector: "renderOn:html:",
  791. protocol: 'rendering',
  792. fn: function (aBindingHelper,html){
  793. var self=this;
  794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  795. return $core.withContext(function($ctx1) {
  796. //>>excludeEnd("ctx");
  797. var $1;
  798. $1=self._isActive();
  799. if($core.assert($1)){
  800. $recv(aBindingHelper)._renderBindingGroup_on_(self,html);
  801. };
  802. return self;
  803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  804. }, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},$globals.HLBindingGroup)});
  805. //>>excludeEnd("ctx");
  806. },
  807. //>>excludeStart("ide", pragmas.excludeIdeData);
  808. args: ["aBindingHelper", "html"],
  809. source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
  810. referencedClasses: [],
  811. //>>excludeEnd("ide");
  812. messageSends: ["ifTrue:", "isActive", "renderBindingGroup:on:"]
  813. }),
  814. $globals.HLBindingGroup);
  815. $core.addClass('HLBindingActionInputWidget', $globals.HLWidget, ['input', 'callback', 'status', 'wrapper', 'ghostText', 'message', 'inputCompletion', 'defaultValue', 'messageTag'], 'Helios-KeyBindings');
  816. //>>excludeStart("ide", pragmas.excludeIdeData);
  817. $globals.HLBindingActionInputWidget.comment="My instances are built when a `HLBindingAction` that requires user input is applied.";
  818. //>>excludeEnd("ide");
  819. $core.addMethod(
  820. $core.method({
  821. selector: "callback",
  822. protocol: 'accessing',
  823. fn: function (){
  824. var self=this;
  825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  826. return $core.withContext(function($ctx1) {
  827. //>>excludeEnd("ctx");
  828. var $1,$receiver;
  829. $1=self["@callback"];
  830. if(($receiver = $1) == null || $receiver.isNil){
  831. self["@callback"]=(function(value){
  832. });
  833. return self["@callback"];
  834. } else {
  835. return $1;
  836. };
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. }, function($ctx1) {$ctx1.fill(self,"callback",{},$globals.HLBindingActionInputWidget)});
  839. //>>excludeEnd("ctx");
  840. },
  841. //>>excludeStart("ide", pragmas.excludeIdeData);
  842. args: [],
  843. source: "callback\x0a\x09^ callback ifNil: [ callback := [ :value | ] ]",
  844. referencedClasses: [],
  845. //>>excludeEnd("ide");
  846. messageSends: ["ifNil:"]
  847. }),
  848. $globals.HLBindingActionInputWidget);
  849. $core.addMethod(
  850. $core.method({
  851. selector: "callback:",
  852. protocol: 'accessing',
  853. fn: function (aBlock){
  854. var self=this;
  855. self["@callback"]=aBlock;
  856. return self;
  857. },
  858. //>>excludeStart("ide", pragmas.excludeIdeData);
  859. args: ["aBlock"],
  860. source: "callback: aBlock\x0a\x09callback := aBlock",
  861. referencedClasses: [],
  862. //>>excludeEnd("ide");
  863. messageSends: []
  864. }),
  865. $globals.HLBindingActionInputWidget);
  866. $core.addMethod(
  867. $core.method({
  868. selector: "clearStatus",
  869. protocol: 'actions',
  870. fn: function (){
  871. var self=this;
  872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  873. return $core.withContext(function($ctx1) {
  874. //>>excludeEnd("ctx");
  875. self._status_("info");
  876. self._message_("");
  877. self._refresh();
  878. return self;
  879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  880. }, function($ctx1) {$ctx1.fill(self,"clearStatus",{},$globals.HLBindingActionInputWidget)});
  881. //>>excludeEnd("ctx");
  882. },
  883. //>>excludeStart("ide", pragmas.excludeIdeData);
  884. args: [],
  885. source: "clearStatus\x0a\x09self status: 'info'.\x0a\x09self message: ''.\x0a\x09self refresh",
  886. referencedClasses: [],
  887. //>>excludeEnd("ide");
  888. messageSends: ["status:", "message:", "refresh"]
  889. }),
  890. $globals.HLBindingActionInputWidget);
  891. $core.addMethod(
  892. $core.method({
  893. selector: "defaultValue",
  894. protocol: 'accessing',
  895. fn: function (){
  896. var self=this;
  897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  898. return $core.withContext(function($ctx1) {
  899. //>>excludeEnd("ctx");
  900. var $1,$receiver;
  901. $1=self["@defaultValue"];
  902. if(($receiver = $1) == null || $receiver.isNil){
  903. return "";
  904. } else {
  905. return $1;
  906. };
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. }, function($ctx1) {$ctx1.fill(self,"defaultValue",{},$globals.HLBindingActionInputWidget)});
  909. //>>excludeEnd("ctx");
  910. },
  911. //>>excludeStart("ide", pragmas.excludeIdeData);
  912. args: [],
  913. source: "defaultValue\x0a\x09^ defaultValue ifNil: [ '' ]",
  914. referencedClasses: [],
  915. //>>excludeEnd("ide");
  916. messageSends: ["ifNil:"]
  917. }),
  918. $globals.HLBindingActionInputWidget);
  919. $core.addMethod(
  920. $core.method({
  921. selector: "defaultValue:",
  922. protocol: 'accessing',
  923. fn: function (aString){
  924. var self=this;
  925. self["@defaultValue"]=aString;
  926. return self;
  927. },
  928. //>>excludeStart("ide", pragmas.excludeIdeData);
  929. args: ["aString"],
  930. source: "defaultValue: aString\x0a\x09defaultValue := aString",
  931. referencedClasses: [],
  932. //>>excludeEnd("ide");
  933. messageSends: []
  934. }),
  935. $globals.HLBindingActionInputWidget);
  936. $core.addMethod(
  937. $core.method({
  938. selector: "errorStatus",
  939. protocol: 'actions',
  940. fn: function (){
  941. var self=this;
  942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  943. return $core.withContext(function($ctx1) {
  944. //>>excludeEnd("ctx");
  945. self._status_("error");
  946. self._refresh();
  947. return self;
  948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  949. }, function($ctx1) {$ctx1.fill(self,"errorStatus",{},$globals.HLBindingActionInputWidget)});
  950. //>>excludeEnd("ctx");
  951. },
  952. //>>excludeStart("ide", pragmas.excludeIdeData);
  953. args: [],
  954. source: "errorStatus\x0a\x09self status: 'error'.\x0a\x09self refresh",
  955. referencedClasses: [],
  956. //>>excludeEnd("ide");
  957. messageSends: ["status:", "refresh"]
  958. }),
  959. $globals.HLBindingActionInputWidget);
  960. $core.addMethod(
  961. $core.method({
  962. selector: "evaluate:",
  963. protocol: 'actions',
  964. fn: function (aString){
  965. var self=this;
  966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  967. return $core.withContext(function($ctx1) {
  968. //>>excludeEnd("ctx");
  969. $recv((function(){
  970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  971. return $core.withContext(function($ctx2) {
  972. //>>excludeEnd("ctx");
  973. return $recv(self._callback())._value_(aString);
  974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  976. //>>excludeEnd("ctx");
  977. }))._on_do_($globals.Error,(function(ex){
  978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  979. return $core.withContext(function($ctx2) {
  980. //>>excludeEnd("ctx");
  981. $recv($recv(self._input())._asJQuery())._one_do_("keydown",(function(){
  982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  983. return $core.withContext(function($ctx3) {
  984. //>>excludeEnd("ctx");
  985. return self._clearStatus();
  986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  987. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  988. //>>excludeEnd("ctx");
  989. }));
  990. self._message_($recv(ex)._messageText());
  991. return self._errorStatus();
  992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  993. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  994. //>>excludeEnd("ctx");
  995. }));
  996. return self;
  997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  998. }, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},$globals.HLBindingActionInputWidget)});
  999. //>>excludeEnd("ctx");
  1000. },
  1001. //>>excludeStart("ide", pragmas.excludeIdeData);
  1002. args: ["aString"],
  1003. 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 ]",
  1004. referencedClasses: ["Error"],
  1005. //>>excludeEnd("ide");
  1006. messageSends: ["on:do:", "value:", "callback", "one:do:", "asJQuery", "input", "clearStatus", "message:", "messageText", "errorStatus"]
  1007. }),
  1008. $globals.HLBindingActionInputWidget);
  1009. $core.addMethod(
  1010. $core.method({
  1011. selector: "ghostText",
  1012. protocol: 'accessing',
  1013. fn: function (){
  1014. var self=this;
  1015. return self["@ghostText"];
  1016. },
  1017. //>>excludeStart("ide", pragmas.excludeIdeData);
  1018. args: [],
  1019. source: "ghostText\x0a\x09^ ghostText",
  1020. referencedClasses: [],
  1021. //>>excludeEnd("ide");
  1022. messageSends: []
  1023. }),
  1024. $globals.HLBindingActionInputWidget);
  1025. $core.addMethod(
  1026. $core.method({
  1027. selector: "ghostText:",
  1028. protocol: 'accessing',
  1029. fn: function (aText){
  1030. var self=this;
  1031. self["@ghostText"]=aText;
  1032. return self;
  1033. },
  1034. //>>excludeStart("ide", pragmas.excludeIdeData);
  1035. args: ["aText"],
  1036. source: "ghostText: aText\x0a\x09ghostText := aText",
  1037. referencedClasses: [],
  1038. //>>excludeEnd("ide");
  1039. messageSends: []
  1040. }),
  1041. $globals.HLBindingActionInputWidget);
  1042. $core.addMethod(
  1043. $core.method({
  1044. selector: "input",
  1045. protocol: 'accessing',
  1046. fn: function (){
  1047. var self=this;
  1048. return self["@input"];
  1049. },
  1050. //>>excludeStart("ide", pragmas.excludeIdeData);
  1051. args: [],
  1052. source: "input\x0a\x09^ input",
  1053. referencedClasses: [],
  1054. //>>excludeEnd("ide");
  1055. messageSends: []
  1056. }),
  1057. $globals.HLBindingActionInputWidget);
  1058. $core.addMethod(
  1059. $core.method({
  1060. selector: "inputCompletion",
  1061. protocol: 'accessing',
  1062. fn: function (){
  1063. var self=this;
  1064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1065. return $core.withContext(function($ctx1) {
  1066. //>>excludeEnd("ctx");
  1067. var $1,$receiver;
  1068. $1=self["@inputCompletion"];
  1069. if(($receiver = $1) == null || $receiver.isNil){
  1070. return [];
  1071. } else {
  1072. return $1;
  1073. };
  1074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1075. }, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},$globals.HLBindingActionInputWidget)});
  1076. //>>excludeEnd("ctx");
  1077. },
  1078. //>>excludeStart("ide", pragmas.excludeIdeData);
  1079. args: [],
  1080. source: "inputCompletion\x0a\x09^ inputCompletion ifNil: [ #() ]",
  1081. referencedClasses: [],
  1082. //>>excludeEnd("ide");
  1083. messageSends: ["ifNil:"]
  1084. }),
  1085. $globals.HLBindingActionInputWidget);
  1086. $core.addMethod(
  1087. $core.method({
  1088. selector: "inputCompletion:",
  1089. protocol: 'accessing',
  1090. fn: function (aCollection){
  1091. var self=this;
  1092. self["@inputCompletion"]=aCollection;
  1093. return self;
  1094. },
  1095. //>>excludeStart("ide", pragmas.excludeIdeData);
  1096. args: ["aCollection"],
  1097. source: "inputCompletion: aCollection\x0a\x09inputCompletion := aCollection",
  1098. referencedClasses: [],
  1099. //>>excludeEnd("ide");
  1100. messageSends: []
  1101. }),
  1102. $globals.HLBindingActionInputWidget);
  1103. $core.addMethod(
  1104. $core.method({
  1105. selector: "message",
  1106. protocol: 'accessing',
  1107. fn: function (){
  1108. var self=this;
  1109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1110. return $core.withContext(function($ctx1) {
  1111. //>>excludeEnd("ctx");
  1112. var $1,$receiver;
  1113. $1=self["@message"];
  1114. if(($receiver = $1) == null || $receiver.isNil){
  1115. self["@message"]="";
  1116. return self["@message"];
  1117. } else {
  1118. return $1;
  1119. };
  1120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1121. }, function($ctx1) {$ctx1.fill(self,"message",{},$globals.HLBindingActionInputWidget)});
  1122. //>>excludeEnd("ctx");
  1123. },
  1124. //>>excludeStart("ide", pragmas.excludeIdeData);
  1125. args: [],
  1126. source: "message\x0a\x09^ message ifNil: [ message := '' ]",
  1127. referencedClasses: [],
  1128. //>>excludeEnd("ide");
  1129. messageSends: ["ifNil:"]
  1130. }),
  1131. $globals.HLBindingActionInputWidget);
  1132. $core.addMethod(
  1133. $core.method({
  1134. selector: "message:",
  1135. protocol: 'accessing',
  1136. fn: function (aString){
  1137. var self=this;
  1138. self["@message"]=aString;
  1139. return self;
  1140. },
  1141. //>>excludeStart("ide", pragmas.excludeIdeData);
  1142. args: ["aString"],
  1143. source: "message: aString\x0a\x09message := aString",
  1144. referencedClasses: [],
  1145. //>>excludeEnd("ide");
  1146. messageSends: []
  1147. }),
  1148. $globals.HLBindingActionInputWidget);
  1149. $core.addMethod(
  1150. $core.method({
  1151. selector: "refresh",
  1152. protocol: 'actions',
  1153. fn: function (){
  1154. var self=this;
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. return $core.withContext(function($ctx1) {
  1157. //>>excludeEnd("ctx");
  1158. var $1,$receiver;
  1159. $1=self["@wrapper"];
  1160. if(($receiver = $1) == null || $receiver.isNil){
  1161. return self;
  1162. } else {
  1163. $1;
  1164. };
  1165. $recv(self["@wrapper"])._class_(self._status());
  1166. $recv(self["@messageTag"])._contents_(self._message());
  1167. return self;
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. }, function($ctx1) {$ctx1.fill(self,"refresh",{},$globals.HLBindingActionInputWidget)});
  1170. //>>excludeEnd("ctx");
  1171. },
  1172. //>>excludeStart("ide", pragmas.excludeIdeData);
  1173. args: [],
  1174. source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a \x0a\x09wrapper class: self status.\x0a\x09messageTag contents: self message",
  1175. referencedClasses: [],
  1176. //>>excludeEnd("ide");
  1177. messageSends: ["ifNil:", "class:", "status", "contents:", "message"]
  1178. }),
  1179. $globals.HLBindingActionInputWidget);
  1180. $core.addMethod(
  1181. $core.method({
  1182. selector: "renderOn:",
  1183. protocol: 'rendering',
  1184. fn: function (html){
  1185. var self=this;
  1186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1187. return $core.withContext(function($ctx1) {
  1188. //>>excludeEnd("ctx");
  1189. var $1,$2,$4,$6,$8,$7,$5,$9,$10,$3,$11,$receiver;
  1190. $1=self["@wrapper"];
  1191. if(($receiver = $1) == null || $receiver.isNil){
  1192. self["@wrapper"]=$recv(html)._span();
  1193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1194. $ctx1.sendIdx["span"]=1;
  1195. //>>excludeEnd("ctx");
  1196. self["@wrapper"];
  1197. } else {
  1198. $1;
  1199. };
  1200. $2=self["@wrapper"];
  1201. $recv($2)._class_(self._status());
  1202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1203. $ctx1.sendIdx["class:"]=1;
  1204. //>>excludeEnd("ctx");
  1205. $3=$recv($2)._with_((function(){
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. return $core.withContext(function($ctx2) {
  1208. //>>excludeEnd("ctx");
  1209. $4=$recv(html)._input();
  1210. $recv($4)._placeholder_(self._ghostText());
  1211. $recv($4)._value_(self._defaultValue());
  1212. $5=$recv((function(event){
  1213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1214. return $core.withContext(function($ctx3) {
  1215. //>>excludeEnd("ctx");
  1216. $6=$recv($recv(event)._which()).__eq((13));
  1217. if($core.assert($6)){
  1218. $8=$recv(self["@input"])._asJQuery();
  1219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1220. $ctx3.sendIdx["asJQuery"]=1;
  1221. //>>excludeEnd("ctx");
  1222. $7=$recv($8)._val();
  1223. return self._evaluate_($7);
  1224. };
  1225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1226. }, function($ctx3) {$ctx3.fillBlock({event:event},$ctx2,3)});
  1227. //>>excludeEnd("ctx");
  1228. }))._yourself();
  1229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1230. $ctx2.sendIdx["yourself"]=1;
  1231. //>>excludeEnd("ctx");
  1232. self["@input"]=$recv($4)._onKeyDown_($5);
  1233. self["@input"];
  1234. $9=$recv(self["@input"])._asJQuery();
  1235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1236. $ctx2.sendIdx["asJQuery"]=2;
  1237. //>>excludeEnd("ctx");
  1238. $recv($9)._typeahead_($globals.HashedCollection._newFromPairs_(["source",self._inputCompletion()]));
  1239. $10=$recv(html)._span();
  1240. $recv($10)._class_("help-inline");
  1241. $recv($10)._with_(self._message());
  1242. self["@messageTag"]=$recv($10)._yourself();
  1243. return self["@messageTag"];
  1244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1246. //>>excludeEnd("ctx");
  1247. }));
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. $ctx1.sendIdx["with:"]=1;
  1250. //>>excludeEnd("ctx");
  1251. $recv((function(){
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. return $core.withContext(function($ctx2) {
  1254. //>>excludeEnd("ctx");
  1255. $11=$recv(self["@input"])._asJQuery();
  1256. $recv($11)._focus();
  1257. return $recv($11)._select();
  1258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1259. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  1260. //>>excludeEnd("ctx");
  1261. }))._fork();
  1262. return self;
  1263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1264. }, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},$globals.HLBindingActionInputWidget)});
  1265. //>>excludeEnd("ctx");
  1266. },
  1267. //>>excludeStart("ide", pragmas.excludeIdeData);
  1268. args: ["html"],
  1269. 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; select ] fork",
  1270. referencedClasses: [],
  1271. //>>excludeEnd("ide");
  1272. messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "input", "ghostText", "value:", "defaultValue", "onKeyDown:", "yourself", "ifTrue:", "=", "which", "evaluate:", "val", "asJQuery", "typeahead:", "inputCompletion", "message", "fork", "focus", "select"]
  1273. }),
  1274. $globals.HLBindingActionInputWidget);
  1275. $core.addMethod(
  1276. $core.method({
  1277. selector: "status",
  1278. protocol: 'accessing',
  1279. fn: function (){
  1280. var self=this;
  1281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1282. return $core.withContext(function($ctx1) {
  1283. //>>excludeEnd("ctx");
  1284. var $1,$receiver;
  1285. $1=self["@status"];
  1286. if(($receiver = $1) == null || $receiver.isNil){
  1287. self["@status"]="info";
  1288. return self["@status"];
  1289. } else {
  1290. return $1;
  1291. };
  1292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1293. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.HLBindingActionInputWidget)});
  1294. //>>excludeEnd("ctx");
  1295. },
  1296. //>>excludeStart("ide", pragmas.excludeIdeData);
  1297. args: [],
  1298. source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
  1299. referencedClasses: [],
  1300. //>>excludeEnd("ide");
  1301. messageSends: ["ifNil:"]
  1302. }),
  1303. $globals.HLBindingActionInputWidget);
  1304. $core.addMethod(
  1305. $core.method({
  1306. selector: "status:",
  1307. protocol: 'accessing',
  1308. fn: function (aStatus){
  1309. var self=this;
  1310. self["@status"]=aStatus;
  1311. return self;
  1312. },
  1313. //>>excludeStart("ide", pragmas.excludeIdeData);
  1314. args: ["aStatus"],
  1315. source: "status: aStatus\x0a\x09status := aStatus",
  1316. referencedClasses: [],
  1317. //>>excludeEnd("ide");
  1318. messageSends: []
  1319. }),
  1320. $globals.HLBindingActionInputWidget);
  1321. $core.addClass('HLKeyBinder', $globals.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  1322. //>>excludeStart("ide", pragmas.excludeIdeData);
  1323. $globals.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.";
  1324. //>>excludeEnd("ide");
  1325. $core.addMethod(
  1326. $core.method({
  1327. selector: "activate",
  1328. protocol: 'actions',
  1329. fn: function (){
  1330. var self=this;
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. return $core.withContext(function($ctx1) {
  1333. //>>excludeEnd("ctx");
  1334. $recv(self._helper())._show();
  1335. return self;
  1336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1337. }, function($ctx1) {$ctx1.fill(self,"activate",{},$globals.HLKeyBinder)});
  1338. //>>excludeEnd("ctx");
  1339. },
  1340. //>>excludeStart("ide", pragmas.excludeIdeData);
  1341. args: [],
  1342. source: "activate\x0a\x09self helper show",
  1343. referencedClasses: [],
  1344. //>>excludeEnd("ide");
  1345. messageSends: ["show", "helper"]
  1346. }),
  1347. $globals.HLKeyBinder);
  1348. $core.addMethod(
  1349. $core.method({
  1350. selector: "activateSpotlight",
  1351. protocol: 'actions',
  1352. fn: function (){
  1353. var self=this;
  1354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1355. return $core.withContext(function($ctx1) {
  1356. //>>excludeEnd("ctx");
  1357. return $recv(".spotlight"._asJQuery())._focus();
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. }, function($ctx1) {$ctx1.fill(self,"activateSpotlight",{},$globals.HLKeyBinder)});
  1360. //>>excludeEnd("ctx");
  1361. },
  1362. //>>excludeStart("ide", pragmas.excludeIdeData);
  1363. args: [],
  1364. source: "activateSpotlight\x0a\x09^ '.spotlight' asJQuery focus",
  1365. referencedClasses: [],
  1366. //>>excludeEnd("ide");
  1367. messageSends: ["focus", "asJQuery"]
  1368. }),
  1369. $globals.HLKeyBinder);
  1370. $core.addMethod(
  1371. $core.method({
  1372. selector: "activationKey",
  1373. protocol: 'accessing',
  1374. fn: function (){
  1375. var self=this;
  1376. return (32);
  1377. },
  1378. //>>excludeStart("ide", pragmas.excludeIdeData);
  1379. args: [],
  1380. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  1381. referencedClasses: [],
  1382. //>>excludeEnd("ide");
  1383. messageSends: []
  1384. }),
  1385. $globals.HLKeyBinder);
  1386. $core.addMethod(
  1387. $core.method({
  1388. selector: "activationKeyLabel",
  1389. protocol: 'accessing',
  1390. fn: function (){
  1391. var self=this;
  1392. return "ctrl + space";
  1393. },
  1394. //>>excludeStart("ide", pragmas.excludeIdeData);
  1395. args: [],
  1396. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  1397. referencedClasses: [],
  1398. //>>excludeEnd("ide");
  1399. messageSends: []
  1400. }),
  1401. $globals.HLKeyBinder);
  1402. $core.addMethod(
  1403. $core.method({
  1404. selector: "applyBinding:",
  1405. protocol: 'actions',
  1406. fn: function (aBinding){
  1407. var self=this;
  1408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1409. return $core.withContext(function($ctx1) {
  1410. //>>excludeEnd("ctx");
  1411. var $1;
  1412. $1=$recv(aBinding)._isActive();
  1413. if(!$core.assert($1)){
  1414. return self;
  1415. };
  1416. self._selectBinding_(aBinding);
  1417. $recv(aBinding)._apply();
  1418. return self;
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. }, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},$globals.HLKeyBinder)});
  1421. //>>excludeEnd("ctx");
  1422. },
  1423. //>>excludeStart("ide", pragmas.excludeIdeData);
  1424. args: ["aBinding"],
  1425. source: "applyBinding: aBinding\x0a\x09aBinding isActive ifFalse: [ ^ self ].\x0a\x09\x0a\x09self selectBinding: aBinding.\x0a aBinding apply",
  1426. referencedClasses: [],
  1427. //>>excludeEnd("ide");
  1428. messageSends: ["ifFalse:", "isActive", "selectBinding:", "apply"]
  1429. }),
  1430. $globals.HLKeyBinder);
  1431. $core.addMethod(
  1432. $core.method({
  1433. selector: "bindings",
  1434. protocol: 'accessing',
  1435. fn: function (){
  1436. var self=this;
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx1) {
  1439. //>>excludeEnd("ctx");
  1440. var $1,$receiver;
  1441. $1=self["@bindings"];
  1442. if(($receiver = $1) == null || $receiver.isNil){
  1443. self["@bindings"]=self._defaultBindings();
  1444. return self["@bindings"];
  1445. } else {
  1446. return $1;
  1447. };
  1448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1449. }, function($ctx1) {$ctx1.fill(self,"bindings",{},$globals.HLKeyBinder)});
  1450. //>>excludeEnd("ctx");
  1451. },
  1452. //>>excludeStart("ide", pragmas.excludeIdeData);
  1453. args: [],
  1454. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
  1455. referencedClasses: [],
  1456. //>>excludeEnd("ide");
  1457. messageSends: ["ifNil:", "defaultBindings"]
  1458. }),
  1459. $globals.HLKeyBinder);
  1460. $core.addMethod(
  1461. $core.method({
  1462. selector: "deactivate",
  1463. protocol: 'actions',
  1464. fn: function (){
  1465. var self=this;
  1466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1467. return $core.withContext(function($ctx1) {
  1468. //>>excludeEnd("ctx");
  1469. var $1,$receiver;
  1470. $1=self["@selectedBinding"];
  1471. if(($receiver = $1) == null || $receiver.isNil){
  1472. $1;
  1473. } else {
  1474. $recv(self["@selectedBinding"])._release();
  1475. };
  1476. self["@selectedBinding"]=nil;
  1477. $recv(self._helper())._hide();
  1478. return self;
  1479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1480. }, function($ctx1) {$ctx1.fill(self,"deactivate",{},$globals.HLKeyBinder)});
  1481. //>>excludeEnd("ctx");
  1482. },
  1483. //>>excludeStart("ide", pragmas.excludeIdeData);
  1484. args: [],
  1485. source: "deactivate\x0a\x09selectedBinding ifNotNil: [ selectedBinding release ].\x0a selectedBinding := nil.\x0a\x09self helper hide",
  1486. referencedClasses: [],
  1487. //>>excludeEnd("ide");
  1488. messageSends: ["ifNotNil:", "release", "hide", "helper"]
  1489. }),
  1490. $globals.HLKeyBinder);
  1491. $core.addMethod(
  1492. $core.method({
  1493. selector: "defaultBindings",
  1494. protocol: 'defaults',
  1495. fn: function (){
  1496. var self=this;
  1497. var group;
  1498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1499. return $core.withContext(function($ctx1) {
  1500. //>>excludeEnd("ctx");
  1501. var $1,$3,$2;
  1502. $1=$recv($globals.HLBindingGroup)._new();
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. $ctx1.sendIdx["new"]=1;
  1505. //>>excludeEnd("ctx");
  1506. $3=$recv($globals.HLCloseTabCommand)._new();
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. $ctx1.sendIdx["new"]=2;
  1509. //>>excludeEnd("ctx");
  1510. $2=$recv($3)._asBinding();
  1511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1512. $ctx1.sendIdx["asBinding"]=1;
  1513. //>>excludeEnd("ctx");
  1514. $recv($1)._add_($2);
  1515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1516. $ctx1.sendIdx["add:"]=1;
  1517. //>>excludeEnd("ctx");
  1518. $recv($1)._add_($recv($recv($globals.HLSwitchTabCommand)._new())._asBinding());
  1519. group=$recv($1)._yourself();
  1520. $recv($globals.HLOpenCommand)._registerConcreteClassesOn_(group);
  1521. return group;
  1522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1523. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},$globals.HLKeyBinder)});
  1524. //>>excludeEnd("ctx");
  1525. },
  1526. //>>excludeStart("ide", pragmas.excludeIdeData);
  1527. args: [],
  1528. 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",
  1529. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLSwitchTabCommand", "HLOpenCommand"],
  1530. //>>excludeEnd("ide");
  1531. messageSends: ["add:", "new", "asBinding", "yourself", "registerConcreteClassesOn:"]
  1532. }),
  1533. $globals.HLKeyBinder);
  1534. $core.addMethod(
  1535. $core.method({
  1536. selector: "escapeKey",
  1537. protocol: 'accessing',
  1538. fn: function (){
  1539. var self=this;
  1540. return (27);
  1541. },
  1542. //>>excludeStart("ide", pragmas.excludeIdeData);
  1543. args: [],
  1544. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  1545. referencedClasses: [],
  1546. //>>excludeEnd("ide");
  1547. messageSends: []
  1548. }),
  1549. $globals.HLKeyBinder);
  1550. $core.addMethod(
  1551. $core.method({
  1552. selector: "flushBindings",
  1553. protocol: 'actions',
  1554. fn: function (){
  1555. var self=this;
  1556. self["@bindings"]=nil;
  1557. return self;
  1558. },
  1559. //>>excludeStart("ide", pragmas.excludeIdeData);
  1560. args: [],
  1561. source: "flushBindings\x0a\x09bindings := nil",
  1562. referencedClasses: [],
  1563. //>>excludeEnd("ide");
  1564. messageSends: []
  1565. }),
  1566. $globals.HLKeyBinder);
  1567. $core.addMethod(
  1568. $core.method({
  1569. selector: "handleActiveKeyDown:",
  1570. protocol: 'events',
  1571. fn: function (event){
  1572. var self=this;
  1573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1574. return $core.withContext(function($ctx1) {
  1575. //>>excludeEnd("ctx");
  1576. var $3,$2,$6,$5,$4,$1;
  1577. $3=$recv(event)._which();
  1578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1579. $ctx1.sendIdx["which"]=1;
  1580. //>>excludeEnd("ctx");
  1581. $2=$recv($3).__eq(self._escapeKey());
  1582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1583. $ctx1.sendIdx["="]=1;
  1584. //>>excludeEnd("ctx");
  1585. $1=$recv($2)._or_((function(){
  1586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1587. return $core.withContext(function($ctx2) {
  1588. //>>excludeEnd("ctx");
  1589. $6=$recv(event)._which();
  1590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1591. $ctx2.sendIdx["which"]=2;
  1592. //>>excludeEnd("ctx");
  1593. $5=$recv($6).__eq((71));
  1594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1595. $ctx2.sendIdx["="]=2;
  1596. //>>excludeEnd("ctx");
  1597. $4=$recv($5)._or_((function(){
  1598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1599. return $core.withContext(function($ctx3) {
  1600. //>>excludeEnd("ctx");
  1601. return $recv($recv(event)._which()).__eq(self._activationKey());
  1602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1603. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1604. //>>excludeEnd("ctx");
  1605. }));
  1606. return $recv($4)._and_((function(){
  1607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1608. return $core.withContext(function($ctx3) {
  1609. //>>excludeEnd("ctx");
  1610. return $recv(event)._ctrlKey();
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1613. //>>excludeEnd("ctx");
  1614. }));
  1615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1617. //>>excludeEnd("ctx");
  1618. }));
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. $ctx1.sendIdx["or:"]=1;
  1621. //>>excludeEnd("ctx");
  1622. if($core.assert($1)){
  1623. self._deactivate();
  1624. $recv(event)._preventDefault();
  1625. return false;
  1626. };
  1627. return self._handleBindingFor_(event);
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},$globals.HLKeyBinder)});
  1630. //>>excludeEnd("ctx");
  1631. },
  1632. //>>excludeStart("ide", pragmas.excludeIdeData);
  1633. args: ["event"],
  1634. source: "handleActiveKeyDown: event\x0a\x0a\x09\x22ESC, ctrl+g ctrl+space deactivate the keyBinder\x22\x0a\x09(event which = self escapeKey or: [\x0a\x09\x09(event which = 71 or: [ event which = self activationKey ]) \x0a\x09\x09\x09and: [ event ctrlKey ] ])\x0a \x09\x09ifTrue: [ \x0a \x09\x09\x09self deactivate.\x0a\x09\x09\x09\x09\x09event preventDefault.\x0a\x09\x09\x09\x09\x09^ false ].\x0a \x0a \x22Handle the keybinding\x22\x0a ^ self handleBindingFor: event",
  1635. referencedClasses: [],
  1636. //>>excludeEnd("ide");
  1637. messageSends: ["ifTrue:", "or:", "=", "which", "escapeKey", "and:", "activationKey", "ctrlKey", "deactivate", "preventDefault", "handleBindingFor:"]
  1638. }),
  1639. $globals.HLKeyBinder);
  1640. $core.addMethod(
  1641. $core.method({
  1642. selector: "handleBindingFor:",
  1643. protocol: 'events',
  1644. fn: function (anEvent){
  1645. var self=this;
  1646. var binding;
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. return $core.withContext(function($ctx1) {
  1649. //>>excludeEnd("ctx");
  1650. var $1,$receiver;
  1651. binding=$recv(self._selectedBinding())._atKey_($recv(anEvent)._which());
  1652. $1=binding;
  1653. if(($receiver = $1) == null || $receiver.isNil){
  1654. $1;
  1655. } else {
  1656. self._applyBinding_(binding);
  1657. $recv(anEvent)._preventDefault();
  1658. return false;
  1659. };
  1660. return self;
  1661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1662. }, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},$globals.HLKeyBinder)});
  1663. //>>excludeEnd("ctx");
  1664. },
  1665. //>>excludeStart("ide", pragmas.excludeIdeData);
  1666. args: ["anEvent"],
  1667. 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 ]",
  1668. referencedClasses: [],
  1669. //>>excludeEnd("ide");
  1670. messageSends: ["atKey:", "selectedBinding", "which", "ifNotNil:", "applyBinding:", "preventDefault"]
  1671. }),
  1672. $globals.HLKeyBinder);
  1673. $core.addMethod(
  1674. $core.method({
  1675. selector: "handleInactiveKeyDown:",
  1676. protocol: 'events',
  1677. fn: function (event){
  1678. var self=this;
  1679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1680. return $core.withContext(function($ctx1) {
  1681. //>>excludeEnd("ctx");
  1682. var $2,$1,$3,$4,$5;
  1683. $2=$recv(event)._which();
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. $ctx1.sendIdx["which"]=1;
  1686. //>>excludeEnd("ctx");
  1687. $1=$recv($2).__eq(self._activationKey());
  1688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1689. $ctx1.sendIdx["="]=1;
  1690. //>>excludeEnd("ctx");
  1691. if($core.assert($1)){
  1692. $3=$recv(event)._ctrlKey();
  1693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1694. $ctx1.sendIdx["ctrlKey"]=1;
  1695. //>>excludeEnd("ctx");
  1696. if($core.assert($3)){
  1697. self._activate();
  1698. $recv(event)._preventDefault();
  1699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1700. $ctx1.sendIdx["preventDefault"]=1;
  1701. //>>excludeEnd("ctx");
  1702. return false;
  1703. };
  1704. };
  1705. $4=$recv($recv(event)._which()).__eq(self._spotlightActivationKey());
  1706. if($core.assert($4)){
  1707. $5=$recv(event)._ctrlKey();
  1708. if($core.assert($5)){
  1709. self._activateSpotlight();
  1710. $recv(event)._preventDefault();
  1711. return false;
  1712. };
  1713. };
  1714. return self;
  1715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1716. }, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},$globals.HLKeyBinder)});
  1717. //>>excludeEnd("ctx");
  1718. },
  1719. //>>excludeStart("ide", pragmas.excludeIdeData);
  1720. args: ["event"],
  1721. source: "handleInactiveKeyDown: event\x0a\x09event which = self activationKey ifTrue: [\x0a \x09event ctrlKey ifTrue: [\x0a\x09\x09\x09self activate. \x0a event preventDefault. \x0a ^ false ] ].\x0a\x09\x09\x09\x0a\x09event which = self spotlightActivationKey ifTrue: [\x0a \x09event ctrlKey ifTrue: [\x0a\x09\x09\x09self activateSpotlight. \x0a event preventDefault. \x0a ^ false ] ]",
  1722. referencedClasses: [],
  1723. //>>excludeEnd("ide");
  1724. messageSends: ["ifTrue:", "=", "which", "activationKey", "ctrlKey", "activate", "preventDefault", "spotlightActivationKey", "activateSpotlight"]
  1725. }),
  1726. $globals.HLKeyBinder);
  1727. $core.addMethod(
  1728. $core.method({
  1729. selector: "handleKeyDown:",
  1730. protocol: 'events',
  1731. fn: function (event){
  1732. var self=this;
  1733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1734. return $core.withContext(function($ctx1) {
  1735. //>>excludeEnd("ctx");
  1736. var $1;
  1737. $1=self._isActive();
  1738. if($core.assert($1)){
  1739. return self._handleActiveKeyDown_(event);
  1740. } else {
  1741. return self._handleInactiveKeyDown_(event);
  1742. };
  1743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1744. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},$globals.HLKeyBinder)});
  1745. //>>excludeEnd("ctx");
  1746. },
  1747. //>>excludeStart("ide", pragmas.excludeIdeData);
  1748. args: ["event"],
  1749. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  1750. referencedClasses: [],
  1751. //>>excludeEnd("ide");
  1752. messageSends: ["ifTrue:ifFalse:", "isActive", "handleActiveKeyDown:", "handleInactiveKeyDown:"]
  1753. }),
  1754. $globals.HLKeyBinder);
  1755. $core.addMethod(
  1756. $core.method({
  1757. selector: "helper",
  1758. protocol: 'accessing',
  1759. fn: function (){
  1760. var self=this;
  1761. return self["@helper"];
  1762. },
  1763. //>>excludeStart("ide", pragmas.excludeIdeData);
  1764. args: [],
  1765. source: "helper\x0a\x09^ helper",
  1766. referencedClasses: [],
  1767. //>>excludeEnd("ide");
  1768. messageSends: []
  1769. }),
  1770. $globals.HLKeyBinder);
  1771. $core.addMethod(
  1772. $core.method({
  1773. selector: "initialize",
  1774. protocol: 'initialization',
  1775. fn: function (){
  1776. var self=this;
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. return $core.withContext(function($ctx1) {
  1779. //>>excludeEnd("ctx");
  1780. (
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. $ctx1.supercall = true,
  1783. //>>excludeEnd("ctx");
  1784. ($globals.HLKeyBinder.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  1785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1786. $ctx1.supercall = false;
  1787. //>>excludeEnd("ctx");;
  1788. self["@helper"]=$recv($globals.HLKeyBinderHelperWidget)._on_(self);
  1789. return self;
  1790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1791. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.HLKeyBinder)});
  1792. //>>excludeEnd("ctx");
  1793. },
  1794. //>>excludeStart("ide", pragmas.excludeIdeData);
  1795. args: [],
  1796. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelperWidget on: self",
  1797. referencedClasses: ["HLKeyBinderHelperWidget"],
  1798. //>>excludeEnd("ide");
  1799. messageSends: ["initialize", "on:"]
  1800. }),
  1801. $globals.HLKeyBinder);
  1802. $core.addMethod(
  1803. $core.method({
  1804. selector: "isActive",
  1805. protocol: 'testing',
  1806. fn: function (){
  1807. var self=this;
  1808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1809. return $core.withContext(function($ctx1) {
  1810. //>>excludeEnd("ctx");
  1811. return $recv($recv(".".__comma($recv(self._helper())._cssClass()))._asJQuery())._is_(":visible");
  1812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1813. }, function($ctx1) {$ctx1.fill(self,"isActive",{},$globals.HLKeyBinder)});
  1814. //>>excludeEnd("ctx");
  1815. },
  1816. //>>excludeStart("ide", pragmas.excludeIdeData);
  1817. args: [],
  1818. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  1819. referencedClasses: [],
  1820. //>>excludeEnd("ide");
  1821. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"]
  1822. }),
  1823. $globals.HLKeyBinder);
  1824. $core.addMethod(
  1825. $core.method({
  1826. selector: "selectBinding:",
  1827. protocol: 'actions',
  1828. fn: function (aBinding){
  1829. var self=this;
  1830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1831. return $core.withContext(function($ctx1) {
  1832. //>>excludeEnd("ctx");
  1833. var $1;
  1834. $1=$recv(aBinding).__eq(self["@selectedBinding"]);
  1835. if($core.assert($1)){
  1836. return self;
  1837. };
  1838. self["@selectedBinding"]=aBinding;
  1839. $recv(self._helper())._refresh();
  1840. return self;
  1841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1842. }, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},$globals.HLKeyBinder)});
  1843. //>>excludeEnd("ctx");
  1844. },
  1845. //>>excludeStart("ide", pragmas.excludeIdeData);
  1846. args: ["aBinding"],
  1847. source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
  1848. referencedClasses: [],
  1849. //>>excludeEnd("ide");
  1850. messageSends: ["ifTrue:", "=", "refresh", "helper"]
  1851. }),
  1852. $globals.HLKeyBinder);
  1853. $core.addMethod(
  1854. $core.method({
  1855. selector: "selectedBinding",
  1856. protocol: 'accessing',
  1857. fn: function (){
  1858. var self=this;
  1859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1860. return $core.withContext(function($ctx1) {
  1861. //>>excludeEnd("ctx");
  1862. var $1,$receiver;
  1863. $1=self["@selectedBinding"];
  1864. if(($receiver = $1) == null || $receiver.isNil){
  1865. return self._bindings();
  1866. } else {
  1867. return $1;
  1868. };
  1869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1870. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},$globals.HLKeyBinder)});
  1871. //>>excludeEnd("ctx");
  1872. },
  1873. //>>excludeStart("ide", pragmas.excludeIdeData);
  1874. args: [],
  1875. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  1876. referencedClasses: [],
  1877. //>>excludeEnd("ide");
  1878. messageSends: ["ifNil:", "bindings"]
  1879. }),
  1880. $globals.HLKeyBinder);
  1881. $core.addMethod(
  1882. $core.method({
  1883. selector: "setupEvents",
  1884. protocol: 'events',
  1885. fn: function (){
  1886. var self=this;
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. return $core.withContext(function($ctx1) {
  1889. //>>excludeEnd("ctx");
  1890. $recv("body"._asJQuery())._keydown_((function(event){
  1891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1892. return $core.withContext(function($ctx2) {
  1893. //>>excludeEnd("ctx");
  1894. return self._handleKeyDown_(event);
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,1)});
  1897. //>>excludeEnd("ctx");
  1898. }));
  1899. return self;
  1900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1901. }, function($ctx1) {$ctx1.fill(self,"setupEvents",{},$globals.HLKeyBinder)});
  1902. //>>excludeEnd("ctx");
  1903. },
  1904. //>>excludeStart("ide", pragmas.excludeIdeData);
  1905. args: [],
  1906. source: "setupEvents\x0a\x09'body' asJQuery keydown: [ :event | self handleKeyDown: event ]",
  1907. referencedClasses: [],
  1908. //>>excludeEnd("ide");
  1909. messageSends: ["keydown:", "asJQuery", "handleKeyDown:"]
  1910. }),
  1911. $globals.HLKeyBinder);
  1912. $core.addMethod(
  1913. $core.method({
  1914. selector: "spotlightActivationKey",
  1915. protocol: 'accessing',
  1916. fn: function (){
  1917. var self=this;
  1918. return (70);
  1919. },
  1920. //>>excludeStart("ide", pragmas.excludeIdeData);
  1921. args: [],
  1922. source: "spotlightActivationKey\x0a\x09\x22f\x22\x0a\x09^ 70",
  1923. referencedClasses: [],
  1924. //>>excludeEnd("ide");
  1925. messageSends: []
  1926. }),
  1927. $globals.HLKeyBinder);
  1928. $core.addMethod(
  1929. $core.method({
  1930. selector: "systemIsMac",
  1931. protocol: 'testing',
  1932. fn: function (){
  1933. var self=this;
  1934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1935. return $core.withContext(function($ctx1) {
  1936. //>>excludeEnd("ctx");
  1937. return $recv($recv(navigator)._platform())._match_("Mac");
  1938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1939. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},$globals.HLKeyBinder)});
  1940. //>>excludeEnd("ctx");
  1941. },
  1942. //>>excludeStart("ide", pragmas.excludeIdeData);
  1943. args: [],
  1944. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1945. referencedClasses: [],
  1946. //>>excludeEnd("ide");
  1947. messageSends: ["match:", "platform"]
  1948. }),
  1949. $globals.HLKeyBinder);
  1950. $globals.HLKeyBinder.klass.iVarNames = ['current'];
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "current",
  1954. protocol: 'instance creation',
  1955. fn: function (){
  1956. var self=this;
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. return $core.withContext(function($ctx1) {
  1959. //>>excludeEnd("ctx");
  1960. var $1,$receiver;
  1961. $1=self["@current"];
  1962. if(($receiver = $1) == null || $receiver.isNil){
  1963. self["@current"]=(
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. $ctx1.supercall = true,
  1966. //>>excludeEnd("ctx");
  1967. ($globals.HLKeyBinder.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. $ctx1.supercall = false;
  1970. //>>excludeEnd("ctx");;
  1971. return self["@current"];
  1972. } else {
  1973. return $1;
  1974. };
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.HLKeyBinder.klass)});
  1977. //>>excludeEnd("ctx");
  1978. },
  1979. //>>excludeStart("ide", pragmas.excludeIdeData);
  1980. args: [],
  1981. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  1982. referencedClasses: [],
  1983. //>>excludeEnd("ide");
  1984. messageSends: ["ifNil:", "new"]
  1985. }),
  1986. $globals.HLKeyBinder.klass);
  1987. $core.addMethod(
  1988. $core.method({
  1989. selector: "new",
  1990. protocol: 'instance creation',
  1991. fn: function (){
  1992. var self=this;
  1993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1994. return $core.withContext(function($ctx1) {
  1995. //>>excludeEnd("ctx");
  1996. self._shouldNotImplement();
  1997. return self;
  1998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1999. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.HLKeyBinder.klass)});
  2000. //>>excludeEnd("ctx");
  2001. },
  2002. //>>excludeStart("ide", pragmas.excludeIdeData);
  2003. args: [],
  2004. source: "new\x0a\x09self shouldNotImplement",
  2005. referencedClasses: [],
  2006. //>>excludeEnd("ide");
  2007. messageSends: ["shouldNotImplement"]
  2008. }),
  2009. $globals.HLKeyBinder.klass);
  2010. $core.addClass('HLKeyBinderHelperWidget', $globals.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  2011. //>>excludeStart("ide", pragmas.excludeIdeData);
  2012. $globals.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:`.";
  2013. //>>excludeEnd("ide");
  2014. $core.addMethod(
  2015. $core.method({
  2016. selector: "cssClass",
  2017. protocol: 'accessing',
  2018. fn: function (){
  2019. var self=this;
  2020. return "key_helper";
  2021. },
  2022. //>>excludeStart("ide", pragmas.excludeIdeData);
  2023. args: [],
  2024. source: "cssClass\x0a\x09^ 'key_helper'",
  2025. referencedClasses: [],
  2026. //>>excludeEnd("ide");
  2027. messageSends: []
  2028. }),
  2029. $globals.HLKeyBinderHelperWidget);
  2030. $core.addMethod(
  2031. $core.method({
  2032. selector: "deactivate",
  2033. protocol: 'actions',
  2034. fn: function (){
  2035. var self=this;
  2036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2037. return $core.withContext(function($ctx1) {
  2038. //>>excludeEnd("ctx");
  2039. $recv(self._keyBinder())._deactivate();
  2040. return self;
  2041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2042. }, function($ctx1) {$ctx1.fill(self,"deactivate",{},$globals.HLKeyBinderHelperWidget)});
  2043. //>>excludeEnd("ctx");
  2044. },
  2045. //>>excludeStart("ide", pragmas.excludeIdeData);
  2046. args: [],
  2047. source: "deactivate\x0a\x09self keyBinder deactivate",
  2048. referencedClasses: [],
  2049. //>>excludeEnd("ide");
  2050. messageSends: ["deactivate", "keyBinder"]
  2051. }),
  2052. $globals.HLKeyBinderHelperWidget);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "hide",
  2056. protocol: 'actions',
  2057. fn: function (){
  2058. var self=this;
  2059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2060. return $core.withContext(function($ctx1) {
  2061. //>>excludeEnd("ctx");
  2062. var $1;
  2063. $1=$recv(".".__comma(self._cssClass()))._asJQuery();
  2064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2065. $ctx1.sendIdx["asJQuery"]=1;
  2066. //>>excludeEnd("ctx");
  2067. $recv($1)._remove();
  2068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2069. $ctx1.sendIdx["remove"]=1;
  2070. //>>excludeEnd("ctx");
  2071. $recv(".helper_overlay"._asJQuery())._remove();
  2072. self._showCog();
  2073. return self;
  2074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2075. }, function($ctx1) {$ctx1.fill(self,"hide",{},$globals.HLKeyBinderHelperWidget)});
  2076. //>>excludeEnd("ctx");
  2077. },
  2078. //>>excludeStart("ide", pragmas.excludeIdeData);
  2079. args: [],
  2080. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09'.helper_overlay' asJQuery remove.\x0a\x09self showCog",
  2081. referencedClasses: [],
  2082. //>>excludeEnd("ide");
  2083. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"]
  2084. }),
  2085. $globals.HLKeyBinderHelperWidget);
  2086. $core.addMethod(
  2087. $core.method({
  2088. selector: "hideCog",
  2089. protocol: 'actions',
  2090. fn: function (){
  2091. var self=this;
  2092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2093. return $core.withContext(function($ctx1) {
  2094. //>>excludeEnd("ctx");
  2095. $recv("#cog-helper"._asJQuery())._hide();
  2096. return self;
  2097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2098. }, function($ctx1) {$ctx1.fill(self,"hideCog",{},$globals.HLKeyBinderHelperWidget)});
  2099. //>>excludeEnd("ctx");
  2100. },
  2101. //>>excludeStart("ide", pragmas.excludeIdeData);
  2102. args: [],
  2103. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  2104. referencedClasses: [],
  2105. //>>excludeEnd("ide");
  2106. messageSends: ["hide", "asJQuery"]
  2107. }),
  2108. $globals.HLKeyBinderHelperWidget);
  2109. $core.addMethod(
  2110. $core.method({
  2111. selector: "keyBinder",
  2112. protocol: 'accessing',
  2113. fn: function (){
  2114. var self=this;
  2115. return self["@keyBinder"];
  2116. },
  2117. //>>excludeStart("ide", pragmas.excludeIdeData);
  2118. args: [],
  2119. source: "keyBinder\x0a\x09^ keyBinder",
  2120. referencedClasses: [],
  2121. //>>excludeEnd("ide");
  2122. messageSends: []
  2123. }),
  2124. $globals.HLKeyBinderHelperWidget);
  2125. $core.addMethod(
  2126. $core.method({
  2127. selector: "keyBinder:",
  2128. protocol: 'accessing',
  2129. fn: function (aKeyBinder){
  2130. var self=this;
  2131. self["@keyBinder"]=aKeyBinder;
  2132. return self;
  2133. },
  2134. //>>excludeStart("ide", pragmas.excludeIdeData);
  2135. args: ["aKeyBinder"],
  2136. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  2137. referencedClasses: [],
  2138. //>>excludeEnd("ide");
  2139. messageSends: []
  2140. }),
  2141. $globals.HLKeyBinderHelperWidget);
  2142. $core.addMethod(
  2143. $core.method({
  2144. selector: "mainId",
  2145. protocol: 'accessing',
  2146. fn: function (){
  2147. var self=this;
  2148. return "binding-helper-main";
  2149. },
  2150. //>>excludeStart("ide", pragmas.excludeIdeData);
  2151. args: [],
  2152. source: "mainId\x0a\x09^ 'binding-helper-main'",
  2153. referencedClasses: [],
  2154. //>>excludeEnd("ide");
  2155. messageSends: []
  2156. }),
  2157. $globals.HLKeyBinderHelperWidget);
  2158. $core.addMethod(
  2159. $core.method({
  2160. selector: "renderBindingActionFor:on:",
  2161. protocol: 'rendering',
  2162. fn: function (aBinding,html){
  2163. var self=this;
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. return $core.withContext(function($ctx1) {
  2166. //>>excludeEnd("ctx");
  2167. var $1,$3,$4,$5,$2;
  2168. $1=$recv(html)._span();
  2169. $recv($1)._class_("command");
  2170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2171. $ctx1.sendIdx["class:"]=1;
  2172. //>>excludeEnd("ctx");
  2173. $2=$recv($1)._with_((function(){
  2174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2175. return $core.withContext(function($ctx2) {
  2176. //>>excludeEnd("ctx");
  2177. $3=$recv(html)._strong();
  2178. $recv($3)._class_("label");
  2179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2180. $ctx2.sendIdx["class:"]=2;
  2181. //>>excludeEnd("ctx");
  2182. $4=$recv($3)._with_($recv($recv(aBinding)._shortcut())._asLowercase());
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. $ctx2.sendIdx["with:"]=2;
  2185. //>>excludeEnd("ctx");
  2186. $4;
  2187. $5=$recv(html)._a();
  2188. $recv($5)._class_("action");
  2189. $recv($5)._with_($recv(aBinding)._displayLabel());
  2190. return $recv($5)._onClick_((function(){
  2191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2192. return $core.withContext(function($ctx3) {
  2193. //>>excludeEnd("ctx");
  2194. return $recv(self._keyBinder())._applyBinding_(aBinding);
  2195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2196. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2197. //>>excludeEnd("ctx");
  2198. }));
  2199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2201. //>>excludeEnd("ctx");
  2202. }));
  2203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2204. $ctx1.sendIdx["with:"]=1;
  2205. //>>excludeEnd("ctx");
  2206. return self;
  2207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2208. }, function($ctx1) {$ctx1.fill(self,"renderBindingActionFor:on:",{aBinding:aBinding,html:html},$globals.HLKeyBinderHelperWidget)});
  2209. //>>excludeEnd("ctx");
  2210. },
  2211. //>>excludeStart("ide", pragmas.excludeIdeData);
  2212. args: ["aBinding", "html"],
  2213. source: "renderBindingActionFor: aBinding on: html\x0a\x09html span class: 'command'; with: [\x0a\x09\x09html strong \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 ] ]",
  2214. referencedClasses: [],
  2215. //>>excludeEnd("ide");
  2216. messageSends: ["class:", "span", "with:", "strong", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:", "keyBinder"]
  2217. }),
  2218. $globals.HLKeyBinderHelperWidget);
  2219. $core.addMethod(
  2220. $core.method({
  2221. selector: "renderBindingGroup:on:",
  2222. protocol: 'rendering',
  2223. fn: function (aBindingGroup,html){
  2224. var self=this;
  2225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2226. return $core.withContext(function($ctx1) {
  2227. //>>excludeEnd("ctx");
  2228. var $1;
  2229. $recv($recv($recv(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  2230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2231. return $core.withContext(function($ctx2) {
  2232. //>>excludeEnd("ctx");
  2233. $1=$recv(a)._key();
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. $ctx2.sendIdx["key"]=1;
  2236. //>>excludeEnd("ctx");
  2237. return $recv($1).__lt($recv(b)._key());
  2238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2239. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  2240. //>>excludeEnd("ctx");
  2241. })))._do_((function(each){
  2242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2243. return $core.withContext(function($ctx2) {
  2244. //>>excludeEnd("ctx");
  2245. return self._renderBindingActionFor_on_(each,html);
  2246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2248. //>>excludeEnd("ctx");
  2249. }));
  2250. return self;
  2251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2252. }, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},$globals.HLKeyBinderHelperWidget)});
  2253. //>>excludeEnd("ctx");
  2254. },
  2255. //>>excludeStart("ide", pragmas.excludeIdeData);
  2256. args: ["aBindingGroup", "html"],
  2257. 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 ]",
  2258. referencedClasses: [],
  2259. //>>excludeEnd("ide");
  2260. messageSends: ["do:", "sorted:", "activeBindings", "<", "key", "renderBindingActionFor:on:"]
  2261. }),
  2262. $globals.HLKeyBinderHelperWidget);
  2263. $core.addMethod(
  2264. $core.method({
  2265. selector: "renderCloseOn:",
  2266. protocol: 'rendering',
  2267. fn: function (html){
  2268. var self=this;
  2269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2270. return $core.withContext(function($ctx1) {
  2271. //>>excludeEnd("ctx");
  2272. var $1;
  2273. $1=$recv(html)._a();
  2274. $recv($1)._class_("close");
  2275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2276. $ctx1.sendIdx["class:"]=1;
  2277. //>>excludeEnd("ctx");
  2278. $recv($1)._with_((function(){
  2279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2280. return $core.withContext(function($ctx2) {
  2281. //>>excludeEnd("ctx");
  2282. return $recv($recv(html)._tag_("i"))._class_("glyphicon glyphicon-remove");
  2283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2285. //>>excludeEnd("ctx");
  2286. }));
  2287. $recv($1)._onClick_((function(){
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. return $core.withContext(function($ctx2) {
  2290. //>>excludeEnd("ctx");
  2291. return $recv(self._keyBinder())._deactivate();
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2294. //>>excludeEnd("ctx");
  2295. }));
  2296. return self;
  2297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2298. }, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2299. //>>excludeEnd("ctx");
  2300. },
  2301. //>>excludeStart("ide", pragmas.excludeIdeData);
  2302. args: ["html"],
  2303. source: "renderCloseOn: html\x0a\x09html a\x0a\x09\x09class: 'close';\x0a\x09\x09with: [ (html tag: 'i') class: 'glyphicon glyphicon-remove' ];\x0a\x09\x09onClick: [ self keyBinder deactivate ]",
  2304. referencedClasses: [],
  2305. //>>excludeEnd("ide");
  2306. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"]
  2307. }),
  2308. $globals.HLKeyBinderHelperWidget);
  2309. $core.addMethod(
  2310. $core.method({
  2311. selector: "renderContentOn:",
  2312. protocol: 'rendering',
  2313. fn: function (html){
  2314. var self=this;
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. return $core.withContext(function($ctx1) {
  2317. //>>excludeEnd("ctx");
  2318. var $1,$2,$4,$3;
  2319. $1=$recv(html)._div();
  2320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2321. $ctx1.sendIdx["div"]=1;
  2322. //>>excludeEnd("ctx");
  2323. $recv($1)._id_("overlay");
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. $ctx1.sendIdx["id:"]=1;
  2326. //>>excludeEnd("ctx");
  2327. $recv($1)._class_("helper_overlay");
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. $ctx1.sendIdx["class:"]=1;
  2330. //>>excludeEnd("ctx");
  2331. $recv($1)._onClick_((function(){
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. return $core.withContext(function($ctx2) {
  2334. //>>excludeEnd("ctx");
  2335. return self._deactivate();
  2336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2338. //>>excludeEnd("ctx");
  2339. }));
  2340. $2=$recv(html)._div();
  2341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2342. $ctx1.sendIdx["div"]=2;
  2343. //>>excludeEnd("ctx");
  2344. $recv($2)._class_(self._cssClass());
  2345. $3=$recv($2)._with_((function(){
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. return $core.withContext(function($ctx2) {
  2348. //>>excludeEnd("ctx");
  2349. self._renderLabelOn_(html);
  2350. $4=$recv(html)._div();
  2351. $recv($4)._id_(self._mainId());
  2352. $recv($4)._with_((function(){
  2353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2354. return $core.withContext(function($ctx3) {
  2355. //>>excludeEnd("ctx");
  2356. return self._renderSelectedBindingOn_(html);
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  2359. //>>excludeEnd("ctx");
  2360. }));
  2361. return self._renderCloseOn_(html);
  2362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2364. //>>excludeEnd("ctx");
  2365. }));
  2366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2367. $ctx1.sendIdx["with:"]=1;
  2368. //>>excludeEnd("ctx");
  2369. $recv(":focus"._asJQuery())._blur();
  2370. return self;
  2371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2372. }, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2373. //>>excludeEnd("ctx");
  2374. },
  2375. //>>excludeStart("ide", pragmas.excludeIdeData);
  2376. args: ["html"],
  2377. source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09id: 'overlay';\x0a\x09\x09class: 'helper_overlay';\x0a\x09\x09onClick: [ self deactivate ].\x0a\x09\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 ].\x0a\x09\x09\x0a\x09':focus' asJQuery blur",
  2378. referencedClasses: [],
  2379. //>>excludeEnd("ide");
  2380. messageSends: ["id:", "div", "class:", "onClick:", "deactivate", "cssClass", "with:", "renderLabelOn:", "mainId", "renderSelectedBindingOn:", "renderCloseOn:", "blur", "asJQuery"]
  2381. }),
  2382. $globals.HLKeyBinderHelperWidget);
  2383. $core.addMethod(
  2384. $core.method({
  2385. selector: "renderLabelOn:",
  2386. protocol: 'rendering',
  2387. fn: function (html){
  2388. var self=this;
  2389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2390. return $core.withContext(function($ctx1) {
  2391. //>>excludeEnd("ctx");
  2392. var $1,$3,$2,$receiver;
  2393. $1=$recv(html)._span();
  2394. $recv($1)._class_("selected");
  2395. $3=$recv(self._selectedBinding())._label();
  2396. if(($receiver = $3) == null || $receiver.isNil){
  2397. $2="Action";
  2398. } else {
  2399. $2=$3;
  2400. };
  2401. $recv($1)._with_($2);
  2402. return self;
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. }, function($ctx1) {$ctx1.fill(self,"renderLabelOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2405. //>>excludeEnd("ctx");
  2406. },
  2407. //>>excludeStart("ide", pragmas.excludeIdeData);
  2408. args: ["html"],
  2409. source: "renderLabelOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  2410. referencedClasses: [],
  2411. //>>excludeEnd("ide");
  2412. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"]
  2413. }),
  2414. $globals.HLKeyBinderHelperWidget);
  2415. $core.addMethod(
  2416. $core.method({
  2417. selector: "renderSelectedBindingOn:",
  2418. protocol: 'rendering',
  2419. fn: function (html){
  2420. var self=this;
  2421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2422. return $core.withContext(function($ctx1) {
  2423. //>>excludeEnd("ctx");
  2424. $recv(self._selectedBinding())._renderOn_html_(self,html);
  2425. return self;
  2426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2427. }, function($ctx1) {$ctx1.fill(self,"renderSelectedBindingOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2428. //>>excludeEnd("ctx");
  2429. },
  2430. //>>excludeStart("ide", pragmas.excludeIdeData);
  2431. args: ["html"],
  2432. source: "renderSelectedBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  2433. referencedClasses: [],
  2434. //>>excludeEnd("ide");
  2435. messageSends: ["renderOn:html:", "selectedBinding"]
  2436. }),
  2437. $globals.HLKeyBinderHelperWidget);
  2438. $core.addMethod(
  2439. $core.method({
  2440. selector: "selectedBinding",
  2441. protocol: 'accessing',
  2442. fn: function (){
  2443. var self=this;
  2444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2445. return $core.withContext(function($ctx1) {
  2446. //>>excludeEnd("ctx");
  2447. return $recv(self._keyBinder())._selectedBinding();
  2448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2449. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},$globals.HLKeyBinderHelperWidget)});
  2450. //>>excludeEnd("ctx");
  2451. },
  2452. //>>excludeStart("ide", pragmas.excludeIdeData);
  2453. args: [],
  2454. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  2455. referencedClasses: [],
  2456. //>>excludeEnd("ide");
  2457. messageSends: ["selectedBinding", "keyBinder"]
  2458. }),
  2459. $globals.HLKeyBinderHelperWidget);
  2460. $core.addMethod(
  2461. $core.method({
  2462. selector: "show",
  2463. protocol: 'actions',
  2464. fn: function (){
  2465. var self=this;
  2466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2467. return $core.withContext(function($ctx1) {
  2468. //>>excludeEnd("ctx");
  2469. self._hideCog();
  2470. self._appendToJQuery_("body"._asJQuery());
  2471. return self;
  2472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2473. }, function($ctx1) {$ctx1.fill(self,"show",{},$globals.HLKeyBinderHelperWidget)});
  2474. //>>excludeEnd("ctx");
  2475. },
  2476. //>>excludeStart("ide", pragmas.excludeIdeData);
  2477. args: [],
  2478. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  2479. referencedClasses: [],
  2480. //>>excludeEnd("ide");
  2481. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"]
  2482. }),
  2483. $globals.HLKeyBinderHelperWidget);
  2484. $core.addMethod(
  2485. $core.method({
  2486. selector: "showCog",
  2487. protocol: 'actions',
  2488. fn: function (){
  2489. var self=this;
  2490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2491. return $core.withContext(function($ctx1) {
  2492. //>>excludeEnd("ctx");
  2493. $recv("#cog-helper"._asJQuery())._show();
  2494. return self;
  2495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2496. }, function($ctx1) {$ctx1.fill(self,"showCog",{},$globals.HLKeyBinderHelperWidget)});
  2497. //>>excludeEnd("ctx");
  2498. },
  2499. //>>excludeStart("ide", pragmas.excludeIdeData);
  2500. args: [],
  2501. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  2502. referencedClasses: [],
  2503. //>>excludeEnd("ide");
  2504. messageSends: ["show", "asJQuery"]
  2505. }),
  2506. $globals.HLKeyBinderHelperWidget);
  2507. $core.addMethod(
  2508. $core.method({
  2509. selector: "showWidget:",
  2510. protocol: 'actions',
  2511. fn: function (aWidget){
  2512. var self=this;
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. return $core.withContext(function($ctx1) {
  2515. //>>excludeEnd("ctx");
  2516. var $3,$2,$1;
  2517. $3=self._mainId();
  2518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2519. $ctx1.sendIdx["mainId"]=1;
  2520. //>>excludeEnd("ctx");
  2521. $2="#".__comma($3);
  2522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2523. $ctx1.sendIdx[","]=1;
  2524. //>>excludeEnd("ctx");
  2525. $1=$recv($2)._asJQuery();
  2526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2527. $ctx1.sendIdx["asJQuery"]=1;
  2528. //>>excludeEnd("ctx");
  2529. $recv($1)._empty();
  2530. $recv(aWidget)._appendToJQuery_($recv("#".__comma(self._mainId()))._asJQuery());
  2531. return self;
  2532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2533. }, function($ctx1) {$ctx1.fill(self,"showWidget:",{aWidget:aWidget},$globals.HLKeyBinderHelperWidget)});
  2534. //>>excludeEnd("ctx");
  2535. },
  2536. //>>excludeStart("ide", pragmas.excludeIdeData);
  2537. args: ["aWidget"],
  2538. 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",
  2539. referencedClasses: [],
  2540. //>>excludeEnd("ide");
  2541. messageSends: ["empty", "asJQuery", ",", "mainId", "appendToJQuery:"]
  2542. }),
  2543. $globals.HLKeyBinderHelperWidget);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "on:",
  2547. protocol: 'instance creation',
  2548. fn: function (aKeyBinder){
  2549. var self=this;
  2550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2551. return $core.withContext(function($ctx1) {
  2552. //>>excludeEnd("ctx");
  2553. var $1;
  2554. $1=self._new();
  2555. $recv($1)._keyBinder_(aKeyBinder);
  2556. return $recv($1)._yourself();
  2557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2558. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},$globals.HLKeyBinderHelperWidget.klass)});
  2559. //>>excludeEnd("ctx");
  2560. },
  2561. //>>excludeStart("ide", pragmas.excludeIdeData);
  2562. args: ["aKeyBinder"],
  2563. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  2564. referencedClasses: [],
  2565. //>>excludeEnd("ide");
  2566. messageSends: ["keyBinder:", "new", "yourself"]
  2567. }),
  2568. $globals.HLKeyBinderHelperWidget.klass);
  2569. $core.addClass('HLRepeatedKeyDownHandler', $globals.Object, ['repeatInterval', 'delay', 'interval', 'keyBindings', 'widget', 'keyDown'], 'Helios-KeyBindings');
  2570. //>>excludeStart("ide", pragmas.excludeIdeData);
  2571. $globals.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.";
  2572. //>>excludeEnd("ide");
  2573. $core.addMethod(
  2574. $core.method({
  2575. selector: "bindKeys",
  2576. protocol: 'binding',
  2577. fn: function (){
  2578. var self=this;
  2579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2580. return $core.withContext(function($ctx1) {
  2581. //>>excludeEnd("ctx");
  2582. $recv(self._widget())._bindKeyDown_keyUp_((function(e){
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. return $core.withContext(function($ctx2) {
  2585. //>>excludeEnd("ctx");
  2586. return self._handleKeyDown_(e);
  2587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2588. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)});
  2589. //>>excludeEnd("ctx");
  2590. }),(function(e){
  2591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2592. return $core.withContext(function($ctx2) {
  2593. //>>excludeEnd("ctx");
  2594. return self._handleKeyUp();
  2595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2596. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,2)});
  2597. //>>excludeEnd("ctx");
  2598. }));
  2599. return self;
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. }, function($ctx1) {$ctx1.fill(self,"bindKeys",{},$globals.HLRepeatedKeyDownHandler)});
  2602. //>>excludeEnd("ctx");
  2603. },
  2604. //>>excludeStart("ide", pragmas.excludeIdeData);
  2605. args: [],
  2606. source: "bindKeys\x0a\x09self widget \x0a\x09\x09bindKeyDown: [ :e | self handleKeyDown: e ] \x0a\x09\x09keyUp: [ :e | self handleKeyUp ]",
  2607. referencedClasses: [],
  2608. //>>excludeEnd("ide");
  2609. messageSends: ["bindKeyDown:keyUp:", "widget", "handleKeyDown:", "handleKeyUp"]
  2610. }),
  2611. $globals.HLRepeatedKeyDownHandler);
  2612. $core.addMethod(
  2613. $core.method({
  2614. selector: "defaultRepeatInterval",
  2615. protocol: 'defaults',
  2616. fn: function (){
  2617. var self=this;
  2618. return (70);
  2619. },
  2620. //>>excludeStart("ide", pragmas.excludeIdeData);
  2621. args: [],
  2622. source: "defaultRepeatInterval\x0a\x09^ 70",
  2623. referencedClasses: [],
  2624. //>>excludeEnd("ide");
  2625. messageSends: []
  2626. }),
  2627. $globals.HLRepeatedKeyDownHandler);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "handleEvent:forKey:action:",
  2631. protocol: 'events handling',
  2632. fn: function (anEvent,anInteger,aBlock){
  2633. var self=this;
  2634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2635. return $core.withContext(function($ctx1) {
  2636. //>>excludeEnd("ctx");
  2637. var $1;
  2638. $1=$recv($recv($recv(anEvent)._which()).__eq(anInteger))._and_((function(){
  2639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2640. return $core.withContext(function($ctx2) {
  2641. //>>excludeEnd("ctx");
  2642. return $recv(self._isKeyDown())._not();
  2643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2644. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2645. //>>excludeEnd("ctx");
  2646. }));
  2647. if($core.assert($1)){
  2648. self._whileKeyDownDo_(aBlock);
  2649. };
  2650. return self;
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. }, function($ctx1) {$ctx1.fill(self,"handleEvent:forKey:action:",{anEvent:anEvent,anInteger:anInteger,aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2653. //>>excludeEnd("ctx");
  2654. },
  2655. //>>excludeStart("ide", pragmas.excludeIdeData);
  2656. args: ["anEvent", "anInteger", "aBlock"],
  2657. source: "handleEvent: anEvent forKey: anInteger action: aBlock\x0a\x09(anEvent which = anInteger and: [ self isKeyDown not ])\x0a\x09\x09ifTrue: [ self whileKeyDownDo: aBlock ]",
  2658. referencedClasses: [],
  2659. //>>excludeEnd("ide");
  2660. messageSends: ["ifTrue:", "and:", "=", "which", "not", "isKeyDown", "whileKeyDownDo:"]
  2661. }),
  2662. $globals.HLRepeatedKeyDownHandler);
  2663. $core.addMethod(
  2664. $core.method({
  2665. selector: "handleKeyDown:",
  2666. protocol: 'events handling',
  2667. fn: function (anEvent){
  2668. var self=this;
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. return $core.withContext(function($ctx1) {
  2671. //>>excludeEnd("ctx");
  2672. $recv(self._keyBindings())._keysAndValuesDo_((function(key,action){
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. return $core.withContext(function($ctx2) {
  2675. //>>excludeEnd("ctx");
  2676. return self._handleEvent_forKey_action_(anEvent,key,action);
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. }, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1,1)});
  2679. //>>excludeEnd("ctx");
  2680. }));
  2681. return self;
  2682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2683. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{anEvent:anEvent},$globals.HLRepeatedKeyDownHandler)});
  2684. //>>excludeEnd("ctx");
  2685. },
  2686. //>>excludeStart("ide", pragmas.excludeIdeData);
  2687. args: ["anEvent"],
  2688. source: "handleKeyDown: anEvent\x0a\x09self keyBindings keysAndValuesDo: [ :key :action | \x0a\x09\x09self handleEvent: anEvent forKey: key action: action ]",
  2689. referencedClasses: [],
  2690. //>>excludeEnd("ide");
  2691. messageSends: ["keysAndValuesDo:", "keyBindings", "handleEvent:forKey:action:"]
  2692. }),
  2693. $globals.HLRepeatedKeyDownHandler);
  2694. $core.addMethod(
  2695. $core.method({
  2696. selector: "handleKeyUp",
  2697. protocol: 'events handling',
  2698. fn: function (){
  2699. var self=this;
  2700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2701. return $core.withContext(function($ctx1) {
  2702. //>>excludeEnd("ctx");
  2703. var $1,$2,$3,$receiver;
  2704. $1=self._isKeyDown();
  2705. if($core.assert($1)){
  2706. self["@keyDown"]=false;
  2707. self["@keyDown"];
  2708. $2=self["@interval"];
  2709. if(($receiver = $2) == null || $receiver.isNil){
  2710. $2;
  2711. } else {
  2712. $recv(self["@interval"])._clearInterval();
  2713. };
  2714. $3=self["@delay"];
  2715. if(($receiver = $3) == null || $receiver.isNil){
  2716. $3;
  2717. } else {
  2718. $recv(self["@delay"])._clearTimeout();
  2719. };
  2720. };
  2721. return self;
  2722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2723. }, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},$globals.HLRepeatedKeyDownHandler)});
  2724. //>>excludeEnd("ctx");
  2725. },
  2726. //>>excludeStart("ide", pragmas.excludeIdeData);
  2727. args: [],
  2728. source: "handleKeyUp\x0a\x09self isKeyDown ifTrue: [\x0a\x09\x09keyDown := false.\x0a\x09\x09interval ifNotNil: [ interval clearInterval ].\x0a\x09\x09delay ifNotNil: [ delay clearTimeout ] ]",
  2729. referencedClasses: [],
  2730. //>>excludeEnd("ide");
  2731. messageSends: ["ifTrue:", "isKeyDown", "ifNotNil:", "clearInterval", "clearTimeout"]
  2732. }),
  2733. $globals.HLRepeatedKeyDownHandler);
  2734. $core.addMethod(
  2735. $core.method({
  2736. selector: "isKeyDown",
  2737. protocol: 'testing',
  2738. fn: function (){
  2739. var self=this;
  2740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2741. return $core.withContext(function($ctx1) {
  2742. //>>excludeEnd("ctx");
  2743. var $1,$receiver;
  2744. $1=self["@keyDown"];
  2745. if(($receiver = $1) == null || $receiver.isNil){
  2746. return false;
  2747. } else {
  2748. return $1;
  2749. };
  2750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2751. }, function($ctx1) {$ctx1.fill(self,"isKeyDown",{},$globals.HLRepeatedKeyDownHandler)});
  2752. //>>excludeEnd("ctx");
  2753. },
  2754. //>>excludeStart("ide", pragmas.excludeIdeData);
  2755. args: [],
  2756. source: "isKeyDown\x0a\x09^ keyDown ifNil: [ false ]",
  2757. referencedClasses: [],
  2758. //>>excludeEnd("ide");
  2759. messageSends: ["ifNil:"]
  2760. }),
  2761. $globals.HLRepeatedKeyDownHandler);
  2762. $core.addMethod(
  2763. $core.method({
  2764. selector: "keyBindings",
  2765. protocol: 'accessing',
  2766. fn: function (){
  2767. var self=this;
  2768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2769. return $core.withContext(function($ctx1) {
  2770. //>>excludeEnd("ctx");
  2771. var $1,$receiver;
  2772. $1=self["@keyBindings"];
  2773. if(($receiver = $1) == null || $receiver.isNil){
  2774. self["@keyBindings"]=$recv($globals.Dictionary)._new();
  2775. return self["@keyBindings"];
  2776. } else {
  2777. return $1;
  2778. };
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. }, function($ctx1) {$ctx1.fill(self,"keyBindings",{},$globals.HLRepeatedKeyDownHandler)});
  2781. //>>excludeEnd("ctx");
  2782. },
  2783. //>>excludeStart("ide", pragmas.excludeIdeData);
  2784. args: [],
  2785. source: "keyBindings\x0a\x09^ keyBindings ifNil: [ keyBindings := Dictionary new ]",
  2786. referencedClasses: ["Dictionary"],
  2787. //>>excludeEnd("ide");
  2788. messageSends: ["ifNil:", "new"]
  2789. }),
  2790. $globals.HLRepeatedKeyDownHandler);
  2791. $core.addMethod(
  2792. $core.method({
  2793. selector: "rebindKeys",
  2794. protocol: 'binding',
  2795. fn: function (){
  2796. var self=this;
  2797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2798. return $core.withContext(function($ctx1) {
  2799. //>>excludeEnd("ctx");
  2800. self._unbindKeys();
  2801. self._bindKeys();
  2802. return self;
  2803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2804. }, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},$globals.HLRepeatedKeyDownHandler)});
  2805. //>>excludeEnd("ctx");
  2806. },
  2807. //>>excludeStart("ide", pragmas.excludeIdeData);
  2808. args: [],
  2809. source: "rebindKeys\x0a\x09self \x0a\x09\x09unbindKeys;\x0a\x09\x09bindKeys",
  2810. referencedClasses: [],
  2811. //>>excludeEnd("ide");
  2812. messageSends: ["unbindKeys", "bindKeys"]
  2813. }),
  2814. $globals.HLRepeatedKeyDownHandler);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "repeatInterval",
  2818. protocol: 'accessing',
  2819. fn: function (){
  2820. var self=this;
  2821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2822. return $core.withContext(function($ctx1) {
  2823. //>>excludeEnd("ctx");
  2824. var $1,$receiver;
  2825. $1=self["@repeatInterval"];
  2826. if(($receiver = $1) == null || $receiver.isNil){
  2827. return self._defaultRepeatInterval();
  2828. } else {
  2829. return $1;
  2830. };
  2831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2832. }, function($ctx1) {$ctx1.fill(self,"repeatInterval",{},$globals.HLRepeatedKeyDownHandler)});
  2833. //>>excludeEnd("ctx");
  2834. },
  2835. //>>excludeStart("ide", pragmas.excludeIdeData);
  2836. args: [],
  2837. source: "repeatInterval\x0a\x09^ repeatInterval ifNil: [ self defaultRepeatInterval ]",
  2838. referencedClasses: [],
  2839. //>>excludeEnd("ide");
  2840. messageSends: ["ifNil:", "defaultRepeatInterval"]
  2841. }),
  2842. $globals.HLRepeatedKeyDownHandler);
  2843. $core.addMethod(
  2844. $core.method({
  2845. selector: "repeatInterval:",
  2846. protocol: 'accessing',
  2847. fn: function (anInteger){
  2848. var self=this;
  2849. self["@repeatInterval"]=anInteger;
  2850. return self;
  2851. },
  2852. //>>excludeStart("ide", pragmas.excludeIdeData);
  2853. args: ["anInteger"],
  2854. source: "repeatInterval: anInteger\x0a\x09repeatInterval := anInteger",
  2855. referencedClasses: [],
  2856. //>>excludeEnd("ide");
  2857. messageSends: []
  2858. }),
  2859. $globals.HLRepeatedKeyDownHandler);
  2860. $core.addMethod(
  2861. $core.method({
  2862. selector: "startRepeatingAction:",
  2863. protocol: 'actions',
  2864. fn: function (aBlock){
  2865. var self=this;
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. return $core.withContext(function($ctx1) {
  2868. //>>excludeEnd("ctx");
  2869. var $1;
  2870. return $recv((function(){
  2871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2872. return $core.withContext(function($ctx2) {
  2873. //>>excludeEnd("ctx");
  2874. $1=$recv(self._widget())._hasFocus();
  2875. if($core.assert($1)){
  2876. return $recv(aBlock)._value();
  2877. } else {
  2878. return self._handleKeyUp();
  2879. };
  2880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2882. //>>excludeEnd("ctx");
  2883. }))._valueWithInterval_(self._repeatInterval());
  2884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2885. }, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2886. //>>excludeEnd("ctx");
  2887. },
  2888. //>>excludeStart("ide", pragmas.excludeIdeData);
  2889. args: ["aBlock"],
  2890. source: "startRepeatingAction: aBlock\x0a\x09^ [ (self widget hasFocus)\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self handleKeyUp ] ] valueWithInterval: self repeatInterval",
  2891. referencedClasses: [],
  2892. //>>excludeEnd("ide");
  2893. messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "hasFocus", "widget", "value", "handleKeyUp", "repeatInterval"]
  2894. }),
  2895. $globals.HLRepeatedKeyDownHandler);
  2896. $core.addMethod(
  2897. $core.method({
  2898. selector: "unbindKeys",
  2899. protocol: 'binding',
  2900. fn: function (){
  2901. var self=this;
  2902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2903. return $core.withContext(function($ctx1) {
  2904. //>>excludeEnd("ctx");
  2905. $recv(self._widget())._unbindKeyDownKeyUp();
  2906. return self;
  2907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2908. }, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},$globals.HLRepeatedKeyDownHandler)});
  2909. //>>excludeEnd("ctx");
  2910. },
  2911. //>>excludeStart("ide", pragmas.excludeIdeData);
  2912. args: [],
  2913. source: "unbindKeys\x0a\x09self widget unbindKeyDownKeyUp",
  2914. referencedClasses: [],
  2915. //>>excludeEnd("ide");
  2916. messageSends: ["unbindKeyDownKeyUp", "widget"]
  2917. }),
  2918. $globals.HLRepeatedKeyDownHandler);
  2919. $core.addMethod(
  2920. $core.method({
  2921. selector: "whileKeyDown:do:",
  2922. protocol: 'actions',
  2923. fn: function (aKey,aBlock){
  2924. var self=this;
  2925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2926. return $core.withContext(function($ctx1) {
  2927. //>>excludeEnd("ctx");
  2928. $recv(self._keyBindings())._at_put_(aKey,aBlock);
  2929. return self;
  2930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2931. }, function($ctx1) {$ctx1.fill(self,"whileKeyDown:do:",{aKey:aKey,aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2932. //>>excludeEnd("ctx");
  2933. },
  2934. //>>excludeStart("ide", pragmas.excludeIdeData);
  2935. args: ["aKey", "aBlock"],
  2936. source: "whileKeyDown: aKey do: aBlock\x0a\x09self keyBindings at: aKey put: aBlock",
  2937. referencedClasses: [],
  2938. //>>excludeEnd("ide");
  2939. messageSends: ["at:put:", "keyBindings"]
  2940. }),
  2941. $globals.HLRepeatedKeyDownHandler);
  2942. $core.addMethod(
  2943. $core.method({
  2944. selector: "whileKeyDownDo:",
  2945. protocol: 'events handling',
  2946. fn: function (aBlock){
  2947. var self=this;
  2948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2949. return $core.withContext(function($ctx1) {
  2950. //>>excludeEnd("ctx");
  2951. self["@keyDown"]=true;
  2952. $recv(aBlock)._value();
  2953. self["@delay"]=$recv((function(){
  2954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2955. return $core.withContext(function($ctx2) {
  2956. //>>excludeEnd("ctx");
  2957. self["@interval"]=self._startRepeatingAction_(aBlock);
  2958. return self["@interval"];
  2959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2961. //>>excludeEnd("ctx");
  2962. }))._valueWithTimeout_((300));
  2963. return self;
  2964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2965. }, function($ctx1) {$ctx1.fill(self,"whileKeyDownDo:",{aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2966. //>>excludeEnd("ctx");
  2967. },
  2968. //>>excludeStart("ide", pragmas.excludeIdeData);
  2969. args: ["aBlock"],
  2970. source: "whileKeyDownDo: aBlock\x0a\x09keyDown := true.\x0a\x09aBlock value.\x0a\x09delay := [ interval := self startRepeatingAction: aBlock ] \x0a\x09\x09valueWithTimeout: 300",
  2971. referencedClasses: [],
  2972. //>>excludeEnd("ide");
  2973. messageSends: ["value", "valueWithTimeout:", "startRepeatingAction:"]
  2974. }),
  2975. $globals.HLRepeatedKeyDownHandler);
  2976. $core.addMethod(
  2977. $core.method({
  2978. selector: "widget",
  2979. protocol: 'accessing',
  2980. fn: function (){
  2981. var self=this;
  2982. return self["@widget"];
  2983. },
  2984. //>>excludeStart("ide", pragmas.excludeIdeData);
  2985. args: [],
  2986. source: "widget\x0a\x09^ widget",
  2987. referencedClasses: [],
  2988. //>>excludeEnd("ide");
  2989. messageSends: []
  2990. }),
  2991. $globals.HLRepeatedKeyDownHandler);
  2992. $core.addMethod(
  2993. $core.method({
  2994. selector: "widget:",
  2995. protocol: 'accessing',
  2996. fn: function (aWidget){
  2997. var self=this;
  2998. self["@widget"]=aWidget;
  2999. return self;
  3000. },
  3001. //>>excludeStart("ide", pragmas.excludeIdeData);
  3002. args: ["aWidget"],
  3003. source: "widget: aWidget\x0a\x09widget := aWidget",
  3004. referencedClasses: [],
  3005. //>>excludeEnd("ide");
  3006. messageSends: []
  3007. }),
  3008. $globals.HLRepeatedKeyDownHandler);
  3009. $core.addMethod(
  3010. $core.method({
  3011. selector: "on:",
  3012. protocol: 'instance creation',
  3013. fn: function (aWidget){
  3014. var self=this;
  3015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3016. return $core.withContext(function($ctx1) {
  3017. //>>excludeEnd("ctx");
  3018. var $1;
  3019. $1=self._new();
  3020. $recv($1)._widget_(aWidget);
  3021. return $recv($1)._yourself();
  3022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3023. }, function($ctx1) {$ctx1.fill(self,"on:",{aWidget:aWidget},$globals.HLRepeatedKeyDownHandler.klass)});
  3024. //>>excludeEnd("ctx");
  3025. },
  3026. //>>excludeStart("ide", pragmas.excludeIdeData);
  3027. args: ["aWidget"],
  3028. source: "on: aWidget\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09yourself",
  3029. referencedClasses: [],
  3030. //>>excludeEnd("ide");
  3031. messageSends: ["widget:", "new", "yourself"]
  3032. }),
  3033. $globals.HLRepeatedKeyDownHandler.klass);
  3034. });