Helios-KeyBindings.js 101 KB

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