Helios-KeyBindings.js 100 KB

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