Helios-KeyBindings.js 101 KB

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