1
0

Helios-KeyBindings.js 102 KB

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