Helios-KeyBindings.js 101 KB

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