Helios-KeyBindings.js 101 KB

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