Helios-KeyBindings.js 101 KB

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