1
0

Helios-KeyBindings.js 100 KB

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