Helios-KeyBindings.js 101 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193
  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. $core.addPackage("Helios-KeyBindings");
  5. ($core.packageDescriptors||$core.packages)["Helios-KeyBindings"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Helios-KeyBindings"].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. $self["@input"];
  1235. $9=$recv($self["@input"])._asJQuery();
  1236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1237. $ctx2.sendIdx["asJQuery"]=2;
  1238. //>>excludeEnd("ctx");
  1239. $recv($9)._typeahead_($globals.HashedCollection._newFromPairs_(["source",$self._inputCompletion()]));
  1240. $10=$recv(html)._span();
  1241. $recv($10)._class_("help-inline");
  1242. $recv($10)._with_($self._message());
  1243. $self["@messageTag"]=$recv($10)._yourself();
  1244. return $self["@messageTag"];
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1247. //>>excludeEnd("ctx");
  1248. }));
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. $ctx1.sendIdx["with:"]=1;
  1251. //>>excludeEnd("ctx");
  1252. $recv((function(){
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. return $core.withContext(function($ctx2) {
  1255. //>>excludeEnd("ctx");
  1256. $11=$recv($self["@input"])._asJQuery();
  1257. $recv($11)._focus();
  1258. return $recv($11)._select();
  1259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  1261. //>>excludeEnd("ctx");
  1262. }))._fork();
  1263. return self;
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. }, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},$globals.HLBindingActionInputWidget)});
  1266. //>>excludeEnd("ctx");
  1267. },
  1268. //>>excludeStart("ide", pragmas.excludeIdeData);
  1269. args: ["html"],
  1270. 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",
  1271. referencedClasses: [],
  1272. //>>excludeEnd("ide");
  1273. messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "input", "ghostText", "value:", "defaultValue", "onKeyDown:", "yourself", "ifTrue:", "=", "which", "evaluate:", "val", "asJQuery", "typeahead:", "inputCompletion", "message", "fork", "focus", "select"]
  1274. }),
  1275. $globals.HLBindingActionInputWidget);
  1276. $core.addMethod(
  1277. $core.method({
  1278. selector: "status",
  1279. protocol: "accessing",
  1280. fn: function (){
  1281. var self=this,$self=this;
  1282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1283. return $core.withContext(function($ctx1) {
  1284. //>>excludeEnd("ctx");
  1285. var $1,$receiver;
  1286. $1=$self["@status"];
  1287. if(($receiver = $1) == null || $receiver.a$nil){
  1288. $self["@status"]="info";
  1289. return $self["@status"];
  1290. } else {
  1291. return $1;
  1292. }
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.HLBindingActionInputWidget)});
  1295. //>>excludeEnd("ctx");
  1296. },
  1297. //>>excludeStart("ide", pragmas.excludeIdeData);
  1298. args: [],
  1299. source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
  1300. referencedClasses: [],
  1301. //>>excludeEnd("ide");
  1302. messageSends: ["ifNil:"]
  1303. }),
  1304. $globals.HLBindingActionInputWidget);
  1305. $core.addMethod(
  1306. $core.method({
  1307. selector: "status:",
  1308. protocol: "accessing",
  1309. fn: function (aStatus){
  1310. var self=this,$self=this;
  1311. $self["@status"]=aStatus;
  1312. return self;
  1313. },
  1314. //>>excludeStart("ide", pragmas.excludeIdeData);
  1315. args: ["aStatus"],
  1316. source: "status: aStatus\x0a\x09status := aStatus",
  1317. referencedClasses: [],
  1318. //>>excludeEnd("ide");
  1319. messageSends: []
  1320. }),
  1321. $globals.HLBindingActionInputWidget);
  1322. $core.addClass("HLKeyBinder", $globals.Object, ["modifierKey", "helper", "bindings", "selectedBinding"], "Helios-KeyBindings");
  1323. //>>excludeStart("ide", pragmas.excludeIdeData);
  1324. $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.";
  1325. //>>excludeEnd("ide");
  1326. $core.addMethod(
  1327. $core.method({
  1328. selector: "activate",
  1329. protocol: "actions",
  1330. fn: function (){
  1331. var self=this,$self=this;
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. return $core.withContext(function($ctx1) {
  1334. //>>excludeEnd("ctx");
  1335. $recv($self._helper())._show();
  1336. return self;
  1337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1338. }, function($ctx1) {$ctx1.fill(self,"activate",{},$globals.HLKeyBinder)});
  1339. //>>excludeEnd("ctx");
  1340. },
  1341. //>>excludeStart("ide", pragmas.excludeIdeData);
  1342. args: [],
  1343. source: "activate\x0a\x09self helper show",
  1344. referencedClasses: [],
  1345. //>>excludeEnd("ide");
  1346. messageSends: ["show", "helper"]
  1347. }),
  1348. $globals.HLKeyBinder);
  1349. $core.addMethod(
  1350. $core.method({
  1351. selector: "activateSpotlight",
  1352. protocol: "actions",
  1353. fn: function (){
  1354. var self=this,$self=this;
  1355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1356. return $core.withContext(function($ctx1) {
  1357. //>>excludeEnd("ctx");
  1358. return $recv(".spotlight"._asJQuery())._focus();
  1359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1360. }, function($ctx1) {$ctx1.fill(self,"activateSpotlight",{},$globals.HLKeyBinder)});
  1361. //>>excludeEnd("ctx");
  1362. },
  1363. //>>excludeStart("ide", pragmas.excludeIdeData);
  1364. args: [],
  1365. source: "activateSpotlight\x0a\x09^ '.spotlight' asJQuery focus",
  1366. referencedClasses: [],
  1367. //>>excludeEnd("ide");
  1368. messageSends: ["focus", "asJQuery"]
  1369. }),
  1370. $globals.HLKeyBinder);
  1371. $core.addMethod(
  1372. $core.method({
  1373. selector: "activationKey",
  1374. protocol: "accessing",
  1375. fn: function (){
  1376. var self=this,$self=this;
  1377. return (32);
  1378. },
  1379. //>>excludeStart("ide", pragmas.excludeIdeData);
  1380. args: [],
  1381. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  1382. referencedClasses: [],
  1383. //>>excludeEnd("ide");
  1384. messageSends: []
  1385. }),
  1386. $globals.HLKeyBinder);
  1387. $core.addMethod(
  1388. $core.method({
  1389. selector: "activationKeyLabel",
  1390. protocol: "accessing",
  1391. fn: function (){
  1392. var self=this,$self=this;
  1393. return "ctrl + space";
  1394. },
  1395. //>>excludeStart("ide", pragmas.excludeIdeData);
  1396. args: [],
  1397. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  1398. referencedClasses: [],
  1399. //>>excludeEnd("ide");
  1400. messageSends: []
  1401. }),
  1402. $globals.HLKeyBinder);
  1403. $core.addMethod(
  1404. $core.method({
  1405. selector: "applyBinding:",
  1406. protocol: "actions",
  1407. fn: function (aBinding){
  1408. var self=this,$self=this;
  1409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1410. return $core.withContext(function($ctx1) {
  1411. //>>excludeEnd("ctx");
  1412. var $1;
  1413. $1=$recv(aBinding)._isActive();
  1414. if(!$core.assert($1)){
  1415. return self;
  1416. }
  1417. $self._selectBinding_(aBinding);
  1418. $recv(aBinding)._apply();
  1419. return self;
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. }, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},$globals.HLKeyBinder)});
  1422. //>>excludeEnd("ctx");
  1423. },
  1424. //>>excludeStart("ide", pragmas.excludeIdeData);
  1425. args: ["aBinding"],
  1426. source: "applyBinding: aBinding\x0a\x09aBinding isActive ifFalse: [ ^ self ].\x0a\x09\x0a\x09self selectBinding: aBinding.\x0a aBinding apply",
  1427. referencedClasses: [],
  1428. //>>excludeEnd("ide");
  1429. messageSends: ["ifFalse:", "isActive", "selectBinding:", "apply"]
  1430. }),
  1431. $globals.HLKeyBinder);
  1432. $core.addMethod(
  1433. $core.method({
  1434. selector: "bindings",
  1435. protocol: "accessing",
  1436. fn: function (){
  1437. var self=this,$self=this;
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. return $core.withContext(function($ctx1) {
  1440. //>>excludeEnd("ctx");
  1441. var $1,$receiver;
  1442. $1=$self["@bindings"];
  1443. if(($receiver = $1) == null || $receiver.a$nil){
  1444. $self["@bindings"]=$self._defaultBindings();
  1445. return $self["@bindings"];
  1446. } else {
  1447. return $1;
  1448. }
  1449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1450. }, function($ctx1) {$ctx1.fill(self,"bindings",{},$globals.HLKeyBinder)});
  1451. //>>excludeEnd("ctx");
  1452. },
  1453. //>>excludeStart("ide", pragmas.excludeIdeData);
  1454. args: [],
  1455. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
  1456. referencedClasses: [],
  1457. //>>excludeEnd("ide");
  1458. messageSends: ["ifNil:", "defaultBindings"]
  1459. }),
  1460. $globals.HLKeyBinder);
  1461. $core.addMethod(
  1462. $core.method({
  1463. selector: "deactivate",
  1464. protocol: "actions",
  1465. fn: function (){
  1466. var self=this,$self=this;
  1467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1468. return $core.withContext(function($ctx1) {
  1469. //>>excludeEnd("ctx");
  1470. var $1,$receiver;
  1471. $1=$self["@selectedBinding"];
  1472. if(($receiver = $1) == null || $receiver.a$nil){
  1473. $1;
  1474. } else {
  1475. $recv($self["@selectedBinding"])._release();
  1476. }
  1477. $self["@selectedBinding"]=nil;
  1478. $recv($self._helper())._hide();
  1479. return self;
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. }, function($ctx1) {$ctx1.fill(self,"deactivate",{},$globals.HLKeyBinder)});
  1482. //>>excludeEnd("ctx");
  1483. },
  1484. //>>excludeStart("ide", pragmas.excludeIdeData);
  1485. args: [],
  1486. source: "deactivate\x0a\x09selectedBinding ifNotNil: [ selectedBinding release ].\x0a selectedBinding := nil.\x0a\x09self helper hide",
  1487. referencedClasses: [],
  1488. //>>excludeEnd("ide");
  1489. messageSends: ["ifNotNil:", "release", "hide", "helper"]
  1490. }),
  1491. $globals.HLKeyBinder);
  1492. $core.addMethod(
  1493. $core.method({
  1494. selector: "defaultBindings",
  1495. protocol: "defaults",
  1496. fn: function (){
  1497. var self=this,$self=this;
  1498. var group;
  1499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1500. return $core.withContext(function($ctx1) {
  1501. //>>excludeEnd("ctx");
  1502. var $1,$3,$2;
  1503. $1=$recv($globals.HLBindingGroup)._new();
  1504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1505. $ctx1.sendIdx["new"]=1;
  1506. //>>excludeEnd("ctx");
  1507. $3=$recv($globals.HLCloseTabCommand)._new();
  1508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1509. $ctx1.sendIdx["new"]=2;
  1510. //>>excludeEnd("ctx");
  1511. $2=$recv($3)._asBinding();
  1512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1513. $ctx1.sendIdx["asBinding"]=1;
  1514. //>>excludeEnd("ctx");
  1515. $recv($1)._add_($2);
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. $ctx1.sendIdx["add:"]=1;
  1518. //>>excludeEnd("ctx");
  1519. $recv($1)._add_($recv($recv($globals.HLSwitchTabCommand)._new())._asBinding());
  1520. group=$recv($1)._yourself();
  1521. $recv($globals.HLOpenCommand)._registerConcreteClassesOn_(group);
  1522. return group;
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},$globals.HLKeyBinder)});
  1525. //>>excludeEnd("ctx");
  1526. },
  1527. //>>excludeStart("ide", pragmas.excludeIdeData);
  1528. args: [],
  1529. 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",
  1530. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLSwitchTabCommand", "HLOpenCommand"],
  1531. //>>excludeEnd("ide");
  1532. messageSends: ["add:", "new", "asBinding", "yourself", "registerConcreteClassesOn:"]
  1533. }),
  1534. $globals.HLKeyBinder);
  1535. $core.addMethod(
  1536. $core.method({
  1537. selector: "escapeKey",
  1538. protocol: "accessing",
  1539. fn: function (){
  1540. var self=this,$self=this;
  1541. return (27);
  1542. },
  1543. //>>excludeStart("ide", pragmas.excludeIdeData);
  1544. args: [],
  1545. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  1546. referencedClasses: [],
  1547. //>>excludeEnd("ide");
  1548. messageSends: []
  1549. }),
  1550. $globals.HLKeyBinder);
  1551. $core.addMethod(
  1552. $core.method({
  1553. selector: "flushBindings",
  1554. protocol: "actions",
  1555. fn: function (){
  1556. var self=this,$self=this;
  1557. $self["@bindings"]=nil;
  1558. return self;
  1559. },
  1560. //>>excludeStart("ide", pragmas.excludeIdeData);
  1561. args: [],
  1562. source: "flushBindings\x0a\x09bindings := nil",
  1563. referencedClasses: [],
  1564. //>>excludeEnd("ide");
  1565. messageSends: []
  1566. }),
  1567. $globals.HLKeyBinder);
  1568. $core.addMethod(
  1569. $core.method({
  1570. selector: "handleActiveKeyDown:",
  1571. protocol: "events",
  1572. fn: function (event){
  1573. var self=this,$self=this;
  1574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1575. return $core.withContext(function($ctx1) {
  1576. //>>excludeEnd("ctx");
  1577. var $3,$2,$6,$5,$4,$1;
  1578. $3=$recv(event)._which();
  1579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1580. $ctx1.sendIdx["which"]=1;
  1581. //>>excludeEnd("ctx");
  1582. $2=$recv($3).__eq($self._escapeKey());
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. $ctx1.sendIdx["="]=1;
  1585. //>>excludeEnd("ctx");
  1586. $1=$recv($2)._or_((function(){
  1587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1588. return $core.withContext(function($ctx2) {
  1589. //>>excludeEnd("ctx");
  1590. $6=$recv(event)._which();
  1591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1592. $ctx2.sendIdx["which"]=2;
  1593. //>>excludeEnd("ctx");
  1594. $5=$recv($6).__eq((71));
  1595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1596. $ctx2.sendIdx["="]=2;
  1597. //>>excludeEnd("ctx");
  1598. $4=$recv($5)._or_((function(){
  1599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1600. return $core.withContext(function($ctx3) {
  1601. //>>excludeEnd("ctx");
  1602. return $recv($recv(event)._which()).__eq($self._activationKey());
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1605. //>>excludeEnd("ctx");
  1606. }));
  1607. return $recv($4)._and_((function(){
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. return $core.withContext(function($ctx3) {
  1610. //>>excludeEnd("ctx");
  1611. return $recv(event)._ctrlKey();
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  1614. //>>excludeEnd("ctx");
  1615. }));
  1616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1617. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1618. //>>excludeEnd("ctx");
  1619. }));
  1620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1621. $ctx1.sendIdx["or:"]=1;
  1622. //>>excludeEnd("ctx");
  1623. if($core.assert($1)){
  1624. $self._deactivate();
  1625. $recv(event)._preventDefault();
  1626. return false;
  1627. }
  1628. return $self._handleBindingFor_(event);
  1629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1630. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},$globals.HLKeyBinder)});
  1631. //>>excludeEnd("ctx");
  1632. },
  1633. //>>excludeStart("ide", pragmas.excludeIdeData);
  1634. args: ["event"],
  1635. 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",
  1636. referencedClasses: [],
  1637. //>>excludeEnd("ide");
  1638. messageSends: ["ifTrue:", "or:", "=", "which", "escapeKey", "and:", "activationKey", "ctrlKey", "deactivate", "preventDefault", "handleBindingFor:"]
  1639. }),
  1640. $globals.HLKeyBinder);
  1641. $core.addMethod(
  1642. $core.method({
  1643. selector: "handleBindingFor:",
  1644. protocol: "events",
  1645. fn: function (anEvent){
  1646. var self=this,$self=this;
  1647. var binding;
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. return $core.withContext(function($ctx1) {
  1650. //>>excludeEnd("ctx");
  1651. var $1,$receiver;
  1652. binding=$recv($self._selectedBinding())._atKey_($recv(anEvent)._which());
  1653. $1=binding;
  1654. if(($receiver = $1) == null || $receiver.a$nil){
  1655. $1;
  1656. } else {
  1657. $self._applyBinding_(binding);
  1658. $recv(anEvent)._preventDefault();
  1659. return false;
  1660. }
  1661. return self;
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. }, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},$globals.HLKeyBinder)});
  1664. //>>excludeEnd("ctx");
  1665. },
  1666. //>>excludeStart("ide", pragmas.excludeIdeData);
  1667. args: ["anEvent"],
  1668. 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 ]",
  1669. referencedClasses: [],
  1670. //>>excludeEnd("ide");
  1671. messageSends: ["atKey:", "selectedBinding", "which", "ifNotNil:", "applyBinding:", "preventDefault"]
  1672. }),
  1673. $globals.HLKeyBinder);
  1674. $core.addMethod(
  1675. $core.method({
  1676. selector: "handleInactiveKeyDown:",
  1677. protocol: "events",
  1678. fn: function (event){
  1679. var self=this,$self=this;
  1680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1681. return $core.withContext(function($ctx1) {
  1682. //>>excludeEnd("ctx");
  1683. var $2,$1,$3,$4,$5;
  1684. $2=$recv(event)._which();
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. $ctx1.sendIdx["which"]=1;
  1687. //>>excludeEnd("ctx");
  1688. $1=$recv($2).__eq($self._activationKey());
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. $ctx1.sendIdx["="]=1;
  1691. //>>excludeEnd("ctx");
  1692. if($core.assert($1)){
  1693. $3=$recv(event)._ctrlKey();
  1694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1695. $ctx1.sendIdx["ctrlKey"]=1;
  1696. //>>excludeEnd("ctx");
  1697. if($core.assert($3)){
  1698. $self._activate();
  1699. $recv(event)._preventDefault();
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. $ctx1.sendIdx["preventDefault"]=1;
  1702. //>>excludeEnd("ctx");
  1703. return false;
  1704. }
  1705. }
  1706. $4=$recv($recv(event)._which()).__eq($self._spotlightActivationKey());
  1707. if($core.assert($4)){
  1708. $5=$recv(event)._ctrlKey();
  1709. if($core.assert($5)){
  1710. $self._activateSpotlight();
  1711. $recv(event)._preventDefault();
  1712. return false;
  1713. }
  1714. }
  1715. return self;
  1716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1717. }, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},$globals.HLKeyBinder)});
  1718. //>>excludeEnd("ctx");
  1719. },
  1720. //>>excludeStart("ide", pragmas.excludeIdeData);
  1721. args: ["event"],
  1722. 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 ] ]",
  1723. referencedClasses: [],
  1724. //>>excludeEnd("ide");
  1725. messageSends: ["ifTrue:", "=", "which", "activationKey", "ctrlKey", "activate", "preventDefault", "spotlightActivationKey", "activateSpotlight"]
  1726. }),
  1727. $globals.HLKeyBinder);
  1728. $core.addMethod(
  1729. $core.method({
  1730. selector: "handleKeyDown:",
  1731. protocol: "events",
  1732. fn: function (event){
  1733. var self=this,$self=this;
  1734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1735. return $core.withContext(function($ctx1) {
  1736. //>>excludeEnd("ctx");
  1737. var $1;
  1738. $1=$self._isActive();
  1739. if($core.assert($1)){
  1740. return $self._handleActiveKeyDown_(event);
  1741. } else {
  1742. return $self._handleInactiveKeyDown_(event);
  1743. }
  1744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1745. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},$globals.HLKeyBinder)});
  1746. //>>excludeEnd("ctx");
  1747. },
  1748. //>>excludeStart("ide", pragmas.excludeIdeData);
  1749. args: ["event"],
  1750. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  1751. referencedClasses: [],
  1752. //>>excludeEnd("ide");
  1753. messageSends: ["ifTrue:ifFalse:", "isActive", "handleActiveKeyDown:", "handleInactiveKeyDown:"]
  1754. }),
  1755. $globals.HLKeyBinder);
  1756. $core.addMethod(
  1757. $core.method({
  1758. selector: "helper",
  1759. protocol: "accessing",
  1760. fn: function (){
  1761. var self=this,$self=this;
  1762. return $self["@helper"];
  1763. },
  1764. //>>excludeStart("ide", pragmas.excludeIdeData);
  1765. args: [],
  1766. source: "helper\x0a\x09^ helper",
  1767. referencedClasses: [],
  1768. //>>excludeEnd("ide");
  1769. messageSends: []
  1770. }),
  1771. $globals.HLKeyBinder);
  1772. $core.addMethod(
  1773. $core.method({
  1774. selector: "initialize",
  1775. protocol: "initialization",
  1776. fn: function (){
  1777. var self=this,$self=this;
  1778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1779. return $core.withContext(function($ctx1) {
  1780. //>>excludeEnd("ctx");
  1781. (
  1782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1783. $ctx1.supercall = true,
  1784. //>>excludeEnd("ctx");
  1785. ($globals.HLKeyBinder.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  1786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1787. $ctx1.supercall = false;
  1788. //>>excludeEnd("ctx");;
  1789. $self["@helper"]=$recv($globals.HLKeyBinderHelperWidget)._on_(self);
  1790. return self;
  1791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1792. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.HLKeyBinder)});
  1793. //>>excludeEnd("ctx");
  1794. },
  1795. //>>excludeStart("ide", pragmas.excludeIdeData);
  1796. args: [],
  1797. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelperWidget on: self",
  1798. referencedClasses: ["HLKeyBinderHelperWidget"],
  1799. //>>excludeEnd("ide");
  1800. messageSends: ["initialize", "on:"]
  1801. }),
  1802. $globals.HLKeyBinder);
  1803. $core.addMethod(
  1804. $core.method({
  1805. selector: "isActive",
  1806. protocol: "testing",
  1807. fn: function (){
  1808. var self=this,$self=this;
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. return $core.withContext(function($ctx1) {
  1811. //>>excludeEnd("ctx");
  1812. return $recv($recv(".".__comma($recv($self._helper())._cssClass()))._asJQuery())._is_(":visible");
  1813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1814. }, function($ctx1) {$ctx1.fill(self,"isActive",{},$globals.HLKeyBinder)});
  1815. //>>excludeEnd("ctx");
  1816. },
  1817. //>>excludeStart("ide", pragmas.excludeIdeData);
  1818. args: [],
  1819. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  1820. referencedClasses: [],
  1821. //>>excludeEnd("ide");
  1822. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"]
  1823. }),
  1824. $globals.HLKeyBinder);
  1825. $core.addMethod(
  1826. $core.method({
  1827. selector: "selectBinding:",
  1828. protocol: "actions",
  1829. fn: function (aBinding){
  1830. var self=this,$self=this;
  1831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1832. return $core.withContext(function($ctx1) {
  1833. //>>excludeEnd("ctx");
  1834. var $1;
  1835. $1=$recv(aBinding).__eq($self["@selectedBinding"]);
  1836. if($core.assert($1)){
  1837. return self;
  1838. }
  1839. $self["@selectedBinding"]=aBinding;
  1840. $recv($self._helper())._refresh();
  1841. return self;
  1842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1843. }, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},$globals.HLKeyBinder)});
  1844. //>>excludeEnd("ctx");
  1845. },
  1846. //>>excludeStart("ide", pragmas.excludeIdeData);
  1847. args: ["aBinding"],
  1848. source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
  1849. referencedClasses: [],
  1850. //>>excludeEnd("ide");
  1851. messageSends: ["ifTrue:", "=", "refresh", "helper"]
  1852. }),
  1853. $globals.HLKeyBinder);
  1854. $core.addMethod(
  1855. $core.method({
  1856. selector: "selectedBinding",
  1857. protocol: "accessing",
  1858. fn: function (){
  1859. var self=this,$self=this;
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. return $core.withContext(function($ctx1) {
  1862. //>>excludeEnd("ctx");
  1863. var $1,$receiver;
  1864. $1=$self["@selectedBinding"];
  1865. if(($receiver = $1) == null || $receiver.a$nil){
  1866. return $self._bindings();
  1867. } else {
  1868. return $1;
  1869. }
  1870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1871. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},$globals.HLKeyBinder)});
  1872. //>>excludeEnd("ctx");
  1873. },
  1874. //>>excludeStart("ide", pragmas.excludeIdeData);
  1875. args: [],
  1876. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  1877. referencedClasses: [],
  1878. //>>excludeEnd("ide");
  1879. messageSends: ["ifNil:", "bindings"]
  1880. }),
  1881. $globals.HLKeyBinder);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "setupEvents",
  1885. protocol: "events",
  1886. fn: function (){
  1887. var self=this,$self=this;
  1888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1889. return $core.withContext(function($ctx1) {
  1890. //>>excludeEnd("ctx");
  1891. $recv("body"._asJQuery())._keydown_((function(event){
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. return $core.withContext(function($ctx2) {
  1894. //>>excludeEnd("ctx");
  1895. return $self._handleKeyDown_(event);
  1896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1897. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1,1)});
  1898. //>>excludeEnd("ctx");
  1899. }));
  1900. return self;
  1901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1902. }, function($ctx1) {$ctx1.fill(self,"setupEvents",{},$globals.HLKeyBinder)});
  1903. //>>excludeEnd("ctx");
  1904. },
  1905. //>>excludeStart("ide", pragmas.excludeIdeData);
  1906. args: [],
  1907. source: "setupEvents\x0a\x09'body' asJQuery keydown: [ :event | self handleKeyDown: event ]",
  1908. referencedClasses: [],
  1909. //>>excludeEnd("ide");
  1910. messageSends: ["keydown:", "asJQuery", "handleKeyDown:"]
  1911. }),
  1912. $globals.HLKeyBinder);
  1913. $core.addMethod(
  1914. $core.method({
  1915. selector: "spotlightActivationKey",
  1916. protocol: "accessing",
  1917. fn: function (){
  1918. var self=this,$self=this;
  1919. return (70);
  1920. },
  1921. //>>excludeStart("ide", pragmas.excludeIdeData);
  1922. args: [],
  1923. source: "spotlightActivationKey\x0a\x09\x22f\x22\x0a\x09^ 70",
  1924. referencedClasses: [],
  1925. //>>excludeEnd("ide");
  1926. messageSends: []
  1927. }),
  1928. $globals.HLKeyBinder);
  1929. $core.addMethod(
  1930. $core.method({
  1931. selector: "systemIsMac",
  1932. protocol: "testing",
  1933. fn: function (){
  1934. var self=this,$self=this;
  1935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1936. return $core.withContext(function($ctx1) {
  1937. //>>excludeEnd("ctx");
  1938. return $recv($recv(navigator)._platform())._match_("Mac");
  1939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1940. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},$globals.HLKeyBinder)});
  1941. //>>excludeEnd("ctx");
  1942. },
  1943. //>>excludeStart("ide", pragmas.excludeIdeData);
  1944. args: [],
  1945. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1946. referencedClasses: [],
  1947. //>>excludeEnd("ide");
  1948. messageSends: ["match:", "platform"]
  1949. }),
  1950. $globals.HLKeyBinder);
  1951. $globals.HLKeyBinder.a$cls.iVarNames = ["current"];
  1952. $core.addMethod(
  1953. $core.method({
  1954. selector: "current",
  1955. protocol: "instance creation",
  1956. fn: function (){
  1957. var self=this,$self=this;
  1958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1959. return $core.withContext(function($ctx1) {
  1960. //>>excludeEnd("ctx");
  1961. var $1,$receiver;
  1962. $1=$self["@current"];
  1963. if(($receiver = $1) == null || $receiver.a$nil){
  1964. $self["@current"]=(
  1965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1966. $ctx1.supercall = true,
  1967. //>>excludeEnd("ctx");
  1968. ($globals.HLKeyBinder.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  1969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1970. $ctx1.supercall = false;
  1971. //>>excludeEnd("ctx");;
  1972. return $self["@current"];
  1973. } else {
  1974. return $1;
  1975. }
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.HLKeyBinder.a$cls)});
  1978. //>>excludeEnd("ctx");
  1979. },
  1980. //>>excludeStart("ide", pragmas.excludeIdeData);
  1981. args: [],
  1982. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  1983. referencedClasses: [],
  1984. //>>excludeEnd("ide");
  1985. messageSends: ["ifNil:", "new"]
  1986. }),
  1987. $globals.HLKeyBinder.a$cls);
  1988. $core.addMethod(
  1989. $core.method({
  1990. selector: "new",
  1991. protocol: "instance creation",
  1992. fn: function (){
  1993. var self=this,$self=this;
  1994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1995. return $core.withContext(function($ctx1) {
  1996. //>>excludeEnd("ctx");
  1997. $self._shouldNotImplement();
  1998. return self;
  1999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2000. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.HLKeyBinder.a$cls)});
  2001. //>>excludeEnd("ctx");
  2002. },
  2003. //>>excludeStart("ide", pragmas.excludeIdeData);
  2004. args: [],
  2005. source: "new\x0a\x09self shouldNotImplement",
  2006. referencedClasses: [],
  2007. //>>excludeEnd("ide");
  2008. messageSends: ["shouldNotImplement"]
  2009. }),
  2010. $globals.HLKeyBinder.a$cls);
  2011. $core.addClass("HLKeyBinderHelperWidget", $globals.HLWidget, ["keyBinder"], "Helios-KeyBindings");
  2012. //>>excludeStart("ide", pragmas.excludeIdeData);
  2013. $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:`.";
  2014. //>>excludeEnd("ide");
  2015. $core.addMethod(
  2016. $core.method({
  2017. selector: "cssClass",
  2018. protocol: "accessing",
  2019. fn: function (){
  2020. var self=this,$self=this;
  2021. return "key_helper";
  2022. },
  2023. //>>excludeStart("ide", pragmas.excludeIdeData);
  2024. args: [],
  2025. source: "cssClass\x0a\x09^ 'key_helper'",
  2026. referencedClasses: [],
  2027. //>>excludeEnd("ide");
  2028. messageSends: []
  2029. }),
  2030. $globals.HLKeyBinderHelperWidget);
  2031. $core.addMethod(
  2032. $core.method({
  2033. selector: "deactivate",
  2034. protocol: "actions",
  2035. fn: function (){
  2036. var self=this,$self=this;
  2037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2038. return $core.withContext(function($ctx1) {
  2039. //>>excludeEnd("ctx");
  2040. $recv($self._keyBinder())._deactivate();
  2041. return self;
  2042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2043. }, function($ctx1) {$ctx1.fill(self,"deactivate",{},$globals.HLKeyBinderHelperWidget)});
  2044. //>>excludeEnd("ctx");
  2045. },
  2046. //>>excludeStart("ide", pragmas.excludeIdeData);
  2047. args: [],
  2048. source: "deactivate\x0a\x09self keyBinder deactivate",
  2049. referencedClasses: [],
  2050. //>>excludeEnd("ide");
  2051. messageSends: ["deactivate", "keyBinder"]
  2052. }),
  2053. $globals.HLKeyBinderHelperWidget);
  2054. $core.addMethod(
  2055. $core.method({
  2056. selector: "hide",
  2057. protocol: "actions",
  2058. fn: function (){
  2059. var self=this,$self=this;
  2060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2061. return $core.withContext(function($ctx1) {
  2062. //>>excludeEnd("ctx");
  2063. var $1;
  2064. $1=$recv(".".__comma($self._cssClass()))._asJQuery();
  2065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2066. $ctx1.sendIdx["asJQuery"]=1;
  2067. //>>excludeEnd("ctx");
  2068. $recv($1)._remove();
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. $ctx1.sendIdx["remove"]=1;
  2071. //>>excludeEnd("ctx");
  2072. $recv(".helper_overlay"._asJQuery())._remove();
  2073. $self._showCog();
  2074. return self;
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. }, function($ctx1) {$ctx1.fill(self,"hide",{},$globals.HLKeyBinderHelperWidget)});
  2077. //>>excludeEnd("ctx");
  2078. },
  2079. //>>excludeStart("ide", pragmas.excludeIdeData);
  2080. args: [],
  2081. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09'.helper_overlay' asJQuery remove.\x0a\x09self showCog",
  2082. referencedClasses: [],
  2083. //>>excludeEnd("ide");
  2084. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"]
  2085. }),
  2086. $globals.HLKeyBinderHelperWidget);
  2087. $core.addMethod(
  2088. $core.method({
  2089. selector: "hideCog",
  2090. protocol: "actions",
  2091. fn: function (){
  2092. var self=this,$self=this;
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. return $core.withContext(function($ctx1) {
  2095. //>>excludeEnd("ctx");
  2096. $recv("#cog-helper"._asJQuery())._hide();
  2097. return self;
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. }, function($ctx1) {$ctx1.fill(self,"hideCog",{},$globals.HLKeyBinderHelperWidget)});
  2100. //>>excludeEnd("ctx");
  2101. },
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: [],
  2104. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  2105. referencedClasses: [],
  2106. //>>excludeEnd("ide");
  2107. messageSends: ["hide", "asJQuery"]
  2108. }),
  2109. $globals.HLKeyBinderHelperWidget);
  2110. $core.addMethod(
  2111. $core.method({
  2112. selector: "keyBinder",
  2113. protocol: "accessing",
  2114. fn: function (){
  2115. var self=this,$self=this;
  2116. return $self["@keyBinder"];
  2117. },
  2118. //>>excludeStart("ide", pragmas.excludeIdeData);
  2119. args: [],
  2120. source: "keyBinder\x0a\x09^ keyBinder",
  2121. referencedClasses: [],
  2122. //>>excludeEnd("ide");
  2123. messageSends: []
  2124. }),
  2125. $globals.HLKeyBinderHelperWidget);
  2126. $core.addMethod(
  2127. $core.method({
  2128. selector: "keyBinder:",
  2129. protocol: "accessing",
  2130. fn: function (aKeyBinder){
  2131. var self=this,$self=this;
  2132. $self["@keyBinder"]=aKeyBinder;
  2133. return self;
  2134. },
  2135. //>>excludeStart("ide", pragmas.excludeIdeData);
  2136. args: ["aKeyBinder"],
  2137. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  2138. referencedClasses: [],
  2139. //>>excludeEnd("ide");
  2140. messageSends: []
  2141. }),
  2142. $globals.HLKeyBinderHelperWidget);
  2143. $core.addMethod(
  2144. $core.method({
  2145. selector: "mainId",
  2146. protocol: "accessing",
  2147. fn: function (){
  2148. var self=this,$self=this;
  2149. return "binding-helper-main";
  2150. },
  2151. //>>excludeStart("ide", pragmas.excludeIdeData);
  2152. args: [],
  2153. source: "mainId\x0a\x09^ 'binding-helper-main'",
  2154. referencedClasses: [],
  2155. //>>excludeEnd("ide");
  2156. messageSends: []
  2157. }),
  2158. $globals.HLKeyBinderHelperWidget);
  2159. $core.addMethod(
  2160. $core.method({
  2161. selector: "renderBindingActionFor:on:",
  2162. protocol: "rendering",
  2163. fn: function (aBinding,html){
  2164. var self=this,$self=this;
  2165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2166. return $core.withContext(function($ctx1) {
  2167. //>>excludeEnd("ctx");
  2168. var $1,$3,$4,$5,$2;
  2169. $1=$recv(html)._span();
  2170. $recv($1)._class_("command");
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. $ctx1.sendIdx["class:"]=1;
  2173. //>>excludeEnd("ctx");
  2174. $2=$recv($1)._with_((function(){
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. return $core.withContext(function($ctx2) {
  2177. //>>excludeEnd("ctx");
  2178. $3=$recv(html)._strong();
  2179. $recv($3)._class_("label");
  2180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2181. $ctx2.sendIdx["class:"]=2;
  2182. //>>excludeEnd("ctx");
  2183. $4=$recv($3)._with_($recv($recv(aBinding)._shortcut())._asLowercase());
  2184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2185. $ctx2.sendIdx["with:"]=2;
  2186. //>>excludeEnd("ctx");
  2187. $4;
  2188. $5=$recv(html)._a();
  2189. $recv($5)._class_("action");
  2190. $recv($5)._with_($recv(aBinding)._displayLabel());
  2191. return $recv($5)._onClick_((function(){
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. return $core.withContext(function($ctx3) {
  2194. //>>excludeEnd("ctx");
  2195. return $recv($self._keyBinder())._applyBinding_(aBinding);
  2196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2197. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  2198. //>>excludeEnd("ctx");
  2199. }));
  2200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2202. //>>excludeEnd("ctx");
  2203. }));
  2204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2205. $ctx1.sendIdx["with:"]=1;
  2206. //>>excludeEnd("ctx");
  2207. return self;
  2208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2209. }, function($ctx1) {$ctx1.fill(self,"renderBindingActionFor:on:",{aBinding:aBinding,html:html},$globals.HLKeyBinderHelperWidget)});
  2210. //>>excludeEnd("ctx");
  2211. },
  2212. //>>excludeStart("ide", pragmas.excludeIdeData);
  2213. args: ["aBinding", "html"],
  2214. 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 ] ]",
  2215. referencedClasses: [],
  2216. //>>excludeEnd("ide");
  2217. messageSends: ["class:", "span", "with:", "strong", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:", "keyBinder"]
  2218. }),
  2219. $globals.HLKeyBinderHelperWidget);
  2220. $core.addMethod(
  2221. $core.method({
  2222. selector: "renderBindingGroup:on:",
  2223. protocol: "rendering",
  2224. fn: function (aBindingGroup,html){
  2225. var self=this,$self=this;
  2226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2227. return $core.withContext(function($ctx1) {
  2228. //>>excludeEnd("ctx");
  2229. var $1;
  2230. $recv($recv($recv(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  2231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2232. return $core.withContext(function($ctx2) {
  2233. //>>excludeEnd("ctx");
  2234. $1=$recv(a)._key();
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. $ctx2.sendIdx["key"]=1;
  2237. //>>excludeEnd("ctx");
  2238. return $recv($1).__lt($recv(b)._key());
  2239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2240. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  2241. //>>excludeEnd("ctx");
  2242. })))._do_((function(each){
  2243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2244. return $core.withContext(function($ctx2) {
  2245. //>>excludeEnd("ctx");
  2246. return $self._renderBindingActionFor_on_(each,html);
  2247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2249. //>>excludeEnd("ctx");
  2250. }));
  2251. return self;
  2252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2253. }, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},$globals.HLKeyBinderHelperWidget)});
  2254. //>>excludeEnd("ctx");
  2255. },
  2256. //>>excludeStart("ide", pragmas.excludeIdeData);
  2257. args: ["aBindingGroup", "html"],
  2258. 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 ]",
  2259. referencedClasses: [],
  2260. //>>excludeEnd("ide");
  2261. messageSends: ["do:", "sorted:", "activeBindings", "<", "key", "renderBindingActionFor:on:"]
  2262. }),
  2263. $globals.HLKeyBinderHelperWidget);
  2264. $core.addMethod(
  2265. $core.method({
  2266. selector: "renderCloseOn:",
  2267. protocol: "rendering",
  2268. fn: function (html){
  2269. var self=this,$self=this;
  2270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2271. return $core.withContext(function($ctx1) {
  2272. //>>excludeEnd("ctx");
  2273. var $1;
  2274. $1=$recv(html)._a();
  2275. $recv($1)._class_("close");
  2276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2277. $ctx1.sendIdx["class:"]=1;
  2278. //>>excludeEnd("ctx");
  2279. $recv($1)._with_((function(){
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx2) {
  2282. //>>excludeEnd("ctx");
  2283. return $recv($recv(html)._tag_("i"))._class_("glyphicon glyphicon-remove");
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2286. //>>excludeEnd("ctx");
  2287. }));
  2288. $recv($1)._onClick_((function(){
  2289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2290. return $core.withContext(function($ctx2) {
  2291. //>>excludeEnd("ctx");
  2292. return $recv($self._keyBinder())._deactivate();
  2293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2295. //>>excludeEnd("ctx");
  2296. }));
  2297. return self;
  2298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2299. }, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2300. //>>excludeEnd("ctx");
  2301. },
  2302. //>>excludeStart("ide", pragmas.excludeIdeData);
  2303. args: ["html"],
  2304. 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 ]",
  2305. referencedClasses: [],
  2306. //>>excludeEnd("ide");
  2307. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"]
  2308. }),
  2309. $globals.HLKeyBinderHelperWidget);
  2310. $core.addMethod(
  2311. $core.method({
  2312. selector: "renderContentOn:",
  2313. protocol: "rendering",
  2314. fn: function (html){
  2315. var self=this,$self=this;
  2316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2317. return $core.withContext(function($ctx1) {
  2318. //>>excludeEnd("ctx");
  2319. var $1,$2,$4,$3;
  2320. $1=$recv(html)._div();
  2321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2322. $ctx1.sendIdx["div"]=1;
  2323. //>>excludeEnd("ctx");
  2324. $recv($1)._id_("overlay");
  2325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2326. $ctx1.sendIdx["id:"]=1;
  2327. //>>excludeEnd("ctx");
  2328. $recv($1)._class_("helper_overlay");
  2329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2330. $ctx1.sendIdx["class:"]=1;
  2331. //>>excludeEnd("ctx");
  2332. $recv($1)._onClick_((function(){
  2333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2334. return $core.withContext(function($ctx2) {
  2335. //>>excludeEnd("ctx");
  2336. return $self._deactivate();
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2339. //>>excludeEnd("ctx");
  2340. }));
  2341. $2=$recv(html)._div();
  2342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2343. $ctx1.sendIdx["div"]=2;
  2344. //>>excludeEnd("ctx");
  2345. $recv($2)._class_($self._cssClass());
  2346. $3=$recv($2)._with_((function(){
  2347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2348. return $core.withContext(function($ctx2) {
  2349. //>>excludeEnd("ctx");
  2350. $self._renderLabelOn_(html);
  2351. $4=$recv(html)._div();
  2352. $recv($4)._id_($self._mainId());
  2353. $recv($4)._with_((function(){
  2354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2355. return $core.withContext(function($ctx3) {
  2356. //>>excludeEnd("ctx");
  2357. return $self._renderSelectedBindingOn_(html);
  2358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2359. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  2360. //>>excludeEnd("ctx");
  2361. }));
  2362. return $self._renderCloseOn_(html);
  2363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2365. //>>excludeEnd("ctx");
  2366. }));
  2367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2368. $ctx1.sendIdx["with:"]=1;
  2369. //>>excludeEnd("ctx");
  2370. $recv(":focus"._asJQuery())._blur();
  2371. return self;
  2372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2373. }, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2374. //>>excludeEnd("ctx");
  2375. },
  2376. //>>excludeStart("ide", pragmas.excludeIdeData);
  2377. args: ["html"],
  2378. 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",
  2379. referencedClasses: [],
  2380. //>>excludeEnd("ide");
  2381. messageSends: ["id:", "div", "class:", "onClick:", "deactivate", "cssClass", "with:", "renderLabelOn:", "mainId", "renderSelectedBindingOn:", "renderCloseOn:", "blur", "asJQuery"]
  2382. }),
  2383. $globals.HLKeyBinderHelperWidget);
  2384. $core.addMethod(
  2385. $core.method({
  2386. selector: "renderLabelOn:",
  2387. protocol: "rendering",
  2388. fn: function (html){
  2389. var self=this,$self=this;
  2390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2391. return $core.withContext(function($ctx1) {
  2392. //>>excludeEnd("ctx");
  2393. var $1,$3,$2,$receiver;
  2394. $1=$recv(html)._span();
  2395. $recv($1)._class_("selected");
  2396. $3=$recv($self._selectedBinding())._label();
  2397. if(($receiver = $3) == null || $receiver.a$nil){
  2398. $2="Action";
  2399. } else {
  2400. $2=$3;
  2401. }
  2402. $recv($1)._with_($2);
  2403. return self;
  2404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2405. }, function($ctx1) {$ctx1.fill(self,"renderLabelOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2406. //>>excludeEnd("ctx");
  2407. },
  2408. //>>excludeStart("ide", pragmas.excludeIdeData);
  2409. args: ["html"],
  2410. source: "renderLabelOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  2411. referencedClasses: [],
  2412. //>>excludeEnd("ide");
  2413. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"]
  2414. }),
  2415. $globals.HLKeyBinderHelperWidget);
  2416. $core.addMethod(
  2417. $core.method({
  2418. selector: "renderSelectedBindingOn:",
  2419. protocol: "rendering",
  2420. fn: function (html){
  2421. var self=this,$self=this;
  2422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2423. return $core.withContext(function($ctx1) {
  2424. //>>excludeEnd("ctx");
  2425. $recv($self._selectedBinding())._renderOn_html_(self,html);
  2426. return self;
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. }, function($ctx1) {$ctx1.fill(self,"renderSelectedBindingOn:",{html:html},$globals.HLKeyBinderHelperWidget)});
  2429. //>>excludeEnd("ctx");
  2430. },
  2431. //>>excludeStart("ide", pragmas.excludeIdeData);
  2432. args: ["html"],
  2433. source: "renderSelectedBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  2434. referencedClasses: [],
  2435. //>>excludeEnd("ide");
  2436. messageSends: ["renderOn:html:", "selectedBinding"]
  2437. }),
  2438. $globals.HLKeyBinderHelperWidget);
  2439. $core.addMethod(
  2440. $core.method({
  2441. selector: "selectedBinding",
  2442. protocol: "accessing",
  2443. fn: function (){
  2444. var self=this,$self=this;
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. return $core.withContext(function($ctx1) {
  2447. //>>excludeEnd("ctx");
  2448. return $recv($self._keyBinder())._selectedBinding();
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},$globals.HLKeyBinderHelperWidget)});
  2451. //>>excludeEnd("ctx");
  2452. },
  2453. //>>excludeStart("ide", pragmas.excludeIdeData);
  2454. args: [],
  2455. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  2456. referencedClasses: [],
  2457. //>>excludeEnd("ide");
  2458. messageSends: ["selectedBinding", "keyBinder"]
  2459. }),
  2460. $globals.HLKeyBinderHelperWidget);
  2461. $core.addMethod(
  2462. $core.method({
  2463. selector: "show",
  2464. protocol: "actions",
  2465. fn: function (){
  2466. var self=this,$self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. $self._hideCog();
  2471. $self._appendToJQuery_("body"._asJQuery());
  2472. return self;
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. }, function($ctx1) {$ctx1.fill(self,"show",{},$globals.HLKeyBinderHelperWidget)});
  2475. //>>excludeEnd("ctx");
  2476. },
  2477. //>>excludeStart("ide", pragmas.excludeIdeData);
  2478. args: [],
  2479. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  2480. referencedClasses: [],
  2481. //>>excludeEnd("ide");
  2482. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"]
  2483. }),
  2484. $globals.HLKeyBinderHelperWidget);
  2485. $core.addMethod(
  2486. $core.method({
  2487. selector: "showCog",
  2488. protocol: "actions",
  2489. fn: function (){
  2490. var self=this,$self=this;
  2491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2492. return $core.withContext(function($ctx1) {
  2493. //>>excludeEnd("ctx");
  2494. $recv("#cog-helper"._asJQuery())._show();
  2495. return self;
  2496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2497. }, function($ctx1) {$ctx1.fill(self,"showCog",{},$globals.HLKeyBinderHelperWidget)});
  2498. //>>excludeEnd("ctx");
  2499. },
  2500. //>>excludeStart("ide", pragmas.excludeIdeData);
  2501. args: [],
  2502. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  2503. referencedClasses: [],
  2504. //>>excludeEnd("ide");
  2505. messageSends: ["show", "asJQuery"]
  2506. }),
  2507. $globals.HLKeyBinderHelperWidget);
  2508. $core.addMethod(
  2509. $core.method({
  2510. selector: "showWidget:",
  2511. protocol: "actions",
  2512. fn: function (aWidget){
  2513. var self=this,$self=this;
  2514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2515. return $core.withContext(function($ctx1) {
  2516. //>>excludeEnd("ctx");
  2517. var $3,$2,$1;
  2518. $3=$self._mainId();
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. $ctx1.sendIdx["mainId"]=1;
  2521. //>>excludeEnd("ctx");
  2522. $2="#".__comma($3);
  2523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2524. $ctx1.sendIdx[","]=1;
  2525. //>>excludeEnd("ctx");
  2526. $1=$recv($2)._asJQuery();
  2527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2528. $ctx1.sendIdx["asJQuery"]=1;
  2529. //>>excludeEnd("ctx");
  2530. $recv($1)._empty();
  2531. $recv(aWidget)._appendToJQuery_($recv("#".__comma($self._mainId()))._asJQuery());
  2532. return self;
  2533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2534. }, function($ctx1) {$ctx1.fill(self,"showWidget:",{aWidget:aWidget},$globals.HLKeyBinderHelperWidget)});
  2535. //>>excludeEnd("ctx");
  2536. },
  2537. //>>excludeStart("ide", pragmas.excludeIdeData);
  2538. args: ["aWidget"],
  2539. 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",
  2540. referencedClasses: [],
  2541. //>>excludeEnd("ide");
  2542. messageSends: ["empty", "asJQuery", ",", "mainId", "appendToJQuery:"]
  2543. }),
  2544. $globals.HLKeyBinderHelperWidget);
  2545. $core.addMethod(
  2546. $core.method({
  2547. selector: "on:",
  2548. protocol: "instance creation",
  2549. fn: function (aKeyBinder){
  2550. var self=this,$self=this;
  2551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2552. return $core.withContext(function($ctx1) {
  2553. //>>excludeEnd("ctx");
  2554. var $1;
  2555. $1=$self._new();
  2556. $recv($1)._keyBinder_(aKeyBinder);
  2557. return $recv($1)._yourself();
  2558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2559. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},$globals.HLKeyBinderHelperWidget.a$cls)});
  2560. //>>excludeEnd("ctx");
  2561. },
  2562. //>>excludeStart("ide", pragmas.excludeIdeData);
  2563. args: ["aKeyBinder"],
  2564. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  2565. referencedClasses: [],
  2566. //>>excludeEnd("ide");
  2567. messageSends: ["keyBinder:", "new", "yourself"]
  2568. }),
  2569. $globals.HLKeyBinderHelperWidget.a$cls);
  2570. $core.addClass("HLRepeatedKeyDownHandler", $globals.Object, ["repeatInterval", "delay", "interval", "keyBindings", "widget", "keyDown"], "Helios-KeyBindings");
  2571. //>>excludeStart("ide", pragmas.excludeIdeData);
  2572. $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.";
  2573. //>>excludeEnd("ide");
  2574. $core.addMethod(
  2575. $core.method({
  2576. selector: "bindKeys",
  2577. protocol: "binding",
  2578. fn: function (){
  2579. var self=this,$self=this;
  2580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2581. return $core.withContext(function($ctx1) {
  2582. //>>excludeEnd("ctx");
  2583. $recv($self._widget())._bindKeyDown_keyUp_((function(e){
  2584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2585. return $core.withContext(function($ctx2) {
  2586. //>>excludeEnd("ctx");
  2587. return $self._handleKeyDown_(e);
  2588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2589. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)});
  2590. //>>excludeEnd("ctx");
  2591. }),(function(e){
  2592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2593. return $core.withContext(function($ctx2) {
  2594. //>>excludeEnd("ctx");
  2595. return $self._handleKeyUp();
  2596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2597. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,2)});
  2598. //>>excludeEnd("ctx");
  2599. }));
  2600. return self;
  2601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2602. }, function($ctx1) {$ctx1.fill(self,"bindKeys",{},$globals.HLRepeatedKeyDownHandler)});
  2603. //>>excludeEnd("ctx");
  2604. },
  2605. //>>excludeStart("ide", pragmas.excludeIdeData);
  2606. args: [],
  2607. source: "bindKeys\x0a\x09self widget \x0a\x09\x09bindKeyDown: [ :e | self handleKeyDown: e ] \x0a\x09\x09keyUp: [ :e | self handleKeyUp ]",
  2608. referencedClasses: [],
  2609. //>>excludeEnd("ide");
  2610. messageSends: ["bindKeyDown:keyUp:", "widget", "handleKeyDown:", "handleKeyUp"]
  2611. }),
  2612. $globals.HLRepeatedKeyDownHandler);
  2613. $core.addMethod(
  2614. $core.method({
  2615. selector: "defaultRepeatInterval",
  2616. protocol: "defaults",
  2617. fn: function (){
  2618. var self=this,$self=this;
  2619. return (70);
  2620. },
  2621. //>>excludeStart("ide", pragmas.excludeIdeData);
  2622. args: [],
  2623. source: "defaultRepeatInterval\x0a\x09^ 70",
  2624. referencedClasses: [],
  2625. //>>excludeEnd("ide");
  2626. messageSends: []
  2627. }),
  2628. $globals.HLRepeatedKeyDownHandler);
  2629. $core.addMethod(
  2630. $core.method({
  2631. selector: "handleEvent:forKey:action:",
  2632. protocol: "events handling",
  2633. fn: function (anEvent,anInteger,aBlock){
  2634. var self=this,$self=this;
  2635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2636. return $core.withContext(function($ctx1) {
  2637. //>>excludeEnd("ctx");
  2638. var $1;
  2639. $1=$recv($recv($recv(anEvent)._which()).__eq(anInteger))._and_((function(){
  2640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2641. return $core.withContext(function($ctx2) {
  2642. //>>excludeEnd("ctx");
  2643. return $recv($self._isKeyDown())._not();
  2644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2646. //>>excludeEnd("ctx");
  2647. }));
  2648. if($core.assert($1)){
  2649. $self._whileKeyDownDo_(aBlock);
  2650. }
  2651. return self;
  2652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2653. }, function($ctx1) {$ctx1.fill(self,"handleEvent:forKey:action:",{anEvent:anEvent,anInteger:anInteger,aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2654. //>>excludeEnd("ctx");
  2655. },
  2656. //>>excludeStart("ide", pragmas.excludeIdeData);
  2657. args: ["anEvent", "anInteger", "aBlock"],
  2658. source: "handleEvent: anEvent forKey: anInteger action: aBlock\x0a\x09(anEvent which = anInteger and: [ self isKeyDown not ])\x0a\x09\x09ifTrue: [ self whileKeyDownDo: aBlock ]",
  2659. referencedClasses: [],
  2660. //>>excludeEnd("ide");
  2661. messageSends: ["ifTrue:", "and:", "=", "which", "not", "isKeyDown", "whileKeyDownDo:"]
  2662. }),
  2663. $globals.HLRepeatedKeyDownHandler);
  2664. $core.addMethod(
  2665. $core.method({
  2666. selector: "handleKeyDown:",
  2667. protocol: "events handling",
  2668. fn: function (anEvent){
  2669. var self=this,$self=this;
  2670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2671. return $core.withContext(function($ctx1) {
  2672. //>>excludeEnd("ctx");
  2673. $recv($self._keyBindings())._keysAndValuesDo_((function(key,action){
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. return $core.withContext(function($ctx2) {
  2676. //>>excludeEnd("ctx");
  2677. return $self._handleEvent_forKey_action_(anEvent,key,action);
  2678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2679. }, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1,1)});
  2680. //>>excludeEnd("ctx");
  2681. }));
  2682. return self;
  2683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2684. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{anEvent:anEvent},$globals.HLRepeatedKeyDownHandler)});
  2685. //>>excludeEnd("ctx");
  2686. },
  2687. //>>excludeStart("ide", pragmas.excludeIdeData);
  2688. args: ["anEvent"],
  2689. source: "handleKeyDown: anEvent\x0a\x09self keyBindings keysAndValuesDo: [ :key :action | \x0a\x09\x09self handleEvent: anEvent forKey: key action: action ]",
  2690. referencedClasses: [],
  2691. //>>excludeEnd("ide");
  2692. messageSends: ["keysAndValuesDo:", "keyBindings", "handleEvent:forKey:action:"]
  2693. }),
  2694. $globals.HLRepeatedKeyDownHandler);
  2695. $core.addMethod(
  2696. $core.method({
  2697. selector: "handleKeyUp",
  2698. protocol: "events handling",
  2699. fn: function (){
  2700. var self=this,$self=this;
  2701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2702. return $core.withContext(function($ctx1) {
  2703. //>>excludeEnd("ctx");
  2704. var $1,$2,$3,$receiver;
  2705. $1=$self._isKeyDown();
  2706. if($core.assert($1)){
  2707. $self["@keyDown"]=false;
  2708. $self["@keyDown"];
  2709. $2=$self["@interval"];
  2710. if(($receiver = $2) == null || $receiver.a$nil){
  2711. $2;
  2712. } else {
  2713. $recv($self["@interval"])._clearInterval();
  2714. }
  2715. $3=$self["@delay"];
  2716. if(($receiver = $3) == null || $receiver.a$nil){
  2717. $3;
  2718. } else {
  2719. $recv($self["@delay"])._clearTimeout();
  2720. }
  2721. }
  2722. return self;
  2723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2724. }, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},$globals.HLRepeatedKeyDownHandler)});
  2725. //>>excludeEnd("ctx");
  2726. },
  2727. //>>excludeStart("ide", pragmas.excludeIdeData);
  2728. args: [],
  2729. source: "handleKeyUp\x0a\x09self isKeyDown ifTrue: [\x0a\x09\x09keyDown := false.\x0a\x09\x09interval ifNotNil: [ interval clearInterval ].\x0a\x09\x09delay ifNotNil: [ delay clearTimeout ] ]",
  2730. referencedClasses: [],
  2731. //>>excludeEnd("ide");
  2732. messageSends: ["ifTrue:", "isKeyDown", "ifNotNil:", "clearInterval", "clearTimeout"]
  2733. }),
  2734. $globals.HLRepeatedKeyDownHandler);
  2735. $core.addMethod(
  2736. $core.method({
  2737. selector: "isKeyDown",
  2738. protocol: "testing",
  2739. fn: function (){
  2740. var self=this,$self=this;
  2741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2742. return $core.withContext(function($ctx1) {
  2743. //>>excludeEnd("ctx");
  2744. var $1,$receiver;
  2745. $1=$self["@keyDown"];
  2746. if(($receiver = $1) == null || $receiver.a$nil){
  2747. return false;
  2748. } else {
  2749. return $1;
  2750. }
  2751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2752. }, function($ctx1) {$ctx1.fill(self,"isKeyDown",{},$globals.HLRepeatedKeyDownHandler)});
  2753. //>>excludeEnd("ctx");
  2754. },
  2755. //>>excludeStart("ide", pragmas.excludeIdeData);
  2756. args: [],
  2757. source: "isKeyDown\x0a\x09^ keyDown ifNil: [ false ]",
  2758. referencedClasses: [],
  2759. //>>excludeEnd("ide");
  2760. messageSends: ["ifNil:"]
  2761. }),
  2762. $globals.HLRepeatedKeyDownHandler);
  2763. $core.addMethod(
  2764. $core.method({
  2765. selector: "keyBindings",
  2766. protocol: "accessing",
  2767. fn: function (){
  2768. var self=this,$self=this;
  2769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2770. return $core.withContext(function($ctx1) {
  2771. //>>excludeEnd("ctx");
  2772. var $1,$receiver;
  2773. $1=$self["@keyBindings"];
  2774. if(($receiver = $1) == null || $receiver.a$nil){
  2775. $self["@keyBindings"]=$recv($globals.Dictionary)._new();
  2776. return $self["@keyBindings"];
  2777. } else {
  2778. return $1;
  2779. }
  2780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2781. }, function($ctx1) {$ctx1.fill(self,"keyBindings",{},$globals.HLRepeatedKeyDownHandler)});
  2782. //>>excludeEnd("ctx");
  2783. },
  2784. //>>excludeStart("ide", pragmas.excludeIdeData);
  2785. args: [],
  2786. source: "keyBindings\x0a\x09^ keyBindings ifNil: [ keyBindings := Dictionary new ]",
  2787. referencedClasses: ["Dictionary"],
  2788. //>>excludeEnd("ide");
  2789. messageSends: ["ifNil:", "new"]
  2790. }),
  2791. $globals.HLRepeatedKeyDownHandler);
  2792. $core.addMethod(
  2793. $core.method({
  2794. selector: "rebindKeys",
  2795. protocol: "binding",
  2796. fn: function (){
  2797. var self=this,$self=this;
  2798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2799. return $core.withContext(function($ctx1) {
  2800. //>>excludeEnd("ctx");
  2801. $self._unbindKeys();
  2802. $self._bindKeys();
  2803. return self;
  2804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2805. }, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},$globals.HLRepeatedKeyDownHandler)});
  2806. //>>excludeEnd("ctx");
  2807. },
  2808. //>>excludeStart("ide", pragmas.excludeIdeData);
  2809. args: [],
  2810. source: "rebindKeys\x0a\x09self \x0a\x09\x09unbindKeys;\x0a\x09\x09bindKeys",
  2811. referencedClasses: [],
  2812. //>>excludeEnd("ide");
  2813. messageSends: ["unbindKeys", "bindKeys"]
  2814. }),
  2815. $globals.HLRepeatedKeyDownHandler);
  2816. $core.addMethod(
  2817. $core.method({
  2818. selector: "repeatInterval",
  2819. protocol: "accessing",
  2820. fn: function (){
  2821. var self=this,$self=this;
  2822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2823. return $core.withContext(function($ctx1) {
  2824. //>>excludeEnd("ctx");
  2825. var $1,$receiver;
  2826. $1=$self["@repeatInterval"];
  2827. if(($receiver = $1) == null || $receiver.a$nil){
  2828. return $self._defaultRepeatInterval();
  2829. } else {
  2830. return $1;
  2831. }
  2832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2833. }, function($ctx1) {$ctx1.fill(self,"repeatInterval",{},$globals.HLRepeatedKeyDownHandler)});
  2834. //>>excludeEnd("ctx");
  2835. },
  2836. //>>excludeStart("ide", pragmas.excludeIdeData);
  2837. args: [],
  2838. source: "repeatInterval\x0a\x09^ repeatInterval ifNil: [ self defaultRepeatInterval ]",
  2839. referencedClasses: [],
  2840. //>>excludeEnd("ide");
  2841. messageSends: ["ifNil:", "defaultRepeatInterval"]
  2842. }),
  2843. $globals.HLRepeatedKeyDownHandler);
  2844. $core.addMethod(
  2845. $core.method({
  2846. selector: "repeatInterval:",
  2847. protocol: "accessing",
  2848. fn: function (anInteger){
  2849. var self=this,$self=this;
  2850. $self["@repeatInterval"]=anInteger;
  2851. return self;
  2852. },
  2853. //>>excludeStart("ide", pragmas.excludeIdeData);
  2854. args: ["anInteger"],
  2855. source: "repeatInterval: anInteger\x0a\x09repeatInterval := anInteger",
  2856. referencedClasses: [],
  2857. //>>excludeEnd("ide");
  2858. messageSends: []
  2859. }),
  2860. $globals.HLRepeatedKeyDownHandler);
  2861. $core.addMethod(
  2862. $core.method({
  2863. selector: "startRepeatingAction:",
  2864. protocol: "actions",
  2865. fn: function (aBlock){
  2866. var self=this,$self=this;
  2867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2868. return $core.withContext(function($ctx1) {
  2869. //>>excludeEnd("ctx");
  2870. var $1;
  2871. return $recv((function(){
  2872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2873. return $core.withContext(function($ctx2) {
  2874. //>>excludeEnd("ctx");
  2875. $1=$recv($self._widget())._hasFocus();
  2876. if($core.assert($1)){
  2877. return $recv(aBlock)._value();
  2878. } else {
  2879. return $self._handleKeyUp();
  2880. }
  2881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2883. //>>excludeEnd("ctx");
  2884. }))._valueWithInterval_($self._repeatInterval());
  2885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2886. }, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2887. //>>excludeEnd("ctx");
  2888. },
  2889. //>>excludeStart("ide", pragmas.excludeIdeData);
  2890. args: ["aBlock"],
  2891. source: "startRepeatingAction: aBlock\x0a\x09^ [ (self widget hasFocus)\x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self handleKeyUp ] ] valueWithInterval: self repeatInterval",
  2892. referencedClasses: [],
  2893. //>>excludeEnd("ide");
  2894. messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "hasFocus", "widget", "value", "handleKeyUp", "repeatInterval"]
  2895. }),
  2896. $globals.HLRepeatedKeyDownHandler);
  2897. $core.addMethod(
  2898. $core.method({
  2899. selector: "unbindKeys",
  2900. protocol: "binding",
  2901. fn: function (){
  2902. var self=this,$self=this;
  2903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2904. return $core.withContext(function($ctx1) {
  2905. //>>excludeEnd("ctx");
  2906. $recv($self._widget())._unbindKeyDownKeyUp();
  2907. return self;
  2908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2909. }, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},$globals.HLRepeatedKeyDownHandler)});
  2910. //>>excludeEnd("ctx");
  2911. },
  2912. //>>excludeStart("ide", pragmas.excludeIdeData);
  2913. args: [],
  2914. source: "unbindKeys\x0a\x09self widget unbindKeyDownKeyUp",
  2915. referencedClasses: [],
  2916. //>>excludeEnd("ide");
  2917. messageSends: ["unbindKeyDownKeyUp", "widget"]
  2918. }),
  2919. $globals.HLRepeatedKeyDownHandler);
  2920. $core.addMethod(
  2921. $core.method({
  2922. selector: "whileKeyDown:do:",
  2923. protocol: "actions",
  2924. fn: function (aKey,aBlock){
  2925. var self=this,$self=this;
  2926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2927. return $core.withContext(function($ctx1) {
  2928. //>>excludeEnd("ctx");
  2929. $recv($self._keyBindings())._at_put_(aKey,aBlock);
  2930. return self;
  2931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2932. }, function($ctx1) {$ctx1.fill(self,"whileKeyDown:do:",{aKey:aKey,aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2933. //>>excludeEnd("ctx");
  2934. },
  2935. //>>excludeStart("ide", pragmas.excludeIdeData);
  2936. args: ["aKey", "aBlock"],
  2937. source: "whileKeyDown: aKey do: aBlock\x0a\x09self keyBindings at: aKey put: aBlock",
  2938. referencedClasses: [],
  2939. //>>excludeEnd("ide");
  2940. messageSends: ["at:put:", "keyBindings"]
  2941. }),
  2942. $globals.HLRepeatedKeyDownHandler);
  2943. $core.addMethod(
  2944. $core.method({
  2945. selector: "whileKeyDownDo:",
  2946. protocol: "events handling",
  2947. fn: function (aBlock){
  2948. var self=this,$self=this;
  2949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2950. return $core.withContext(function($ctx1) {
  2951. //>>excludeEnd("ctx");
  2952. $self["@keyDown"]=true;
  2953. $recv(aBlock)._value();
  2954. $self["@delay"]=$recv((function(){
  2955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2956. return $core.withContext(function($ctx2) {
  2957. //>>excludeEnd("ctx");
  2958. $self["@interval"]=$self._startRepeatingAction_(aBlock);
  2959. return $self["@interval"];
  2960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2962. //>>excludeEnd("ctx");
  2963. }))._valueWithTimeout_((300));
  2964. return self;
  2965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2966. }, function($ctx1) {$ctx1.fill(self,"whileKeyDownDo:",{aBlock:aBlock},$globals.HLRepeatedKeyDownHandler)});
  2967. //>>excludeEnd("ctx");
  2968. },
  2969. //>>excludeStart("ide", pragmas.excludeIdeData);
  2970. args: ["aBlock"],
  2971. source: "whileKeyDownDo: aBlock\x0a\x09keyDown := true.\x0a\x09aBlock value.\x0a\x09delay := [ interval := self startRepeatingAction: aBlock ] \x0a\x09\x09valueWithTimeout: 300",
  2972. referencedClasses: [],
  2973. //>>excludeEnd("ide");
  2974. messageSends: ["value", "valueWithTimeout:", "startRepeatingAction:"]
  2975. }),
  2976. $globals.HLRepeatedKeyDownHandler);
  2977. $core.addMethod(
  2978. $core.method({
  2979. selector: "widget",
  2980. protocol: "accessing",
  2981. fn: function (){
  2982. var self=this,$self=this;
  2983. return $self["@widget"];
  2984. },
  2985. //>>excludeStart("ide", pragmas.excludeIdeData);
  2986. args: [],
  2987. source: "widget\x0a\x09^ widget",
  2988. referencedClasses: [],
  2989. //>>excludeEnd("ide");
  2990. messageSends: []
  2991. }),
  2992. $globals.HLRepeatedKeyDownHandler);
  2993. $core.addMethod(
  2994. $core.method({
  2995. selector: "widget:",
  2996. protocol: "accessing",
  2997. fn: function (aWidget){
  2998. var self=this,$self=this;
  2999. $self["@widget"]=aWidget;
  3000. return self;
  3001. },
  3002. //>>excludeStart("ide", pragmas.excludeIdeData);
  3003. args: ["aWidget"],
  3004. source: "widget: aWidget\x0a\x09widget := aWidget",
  3005. referencedClasses: [],
  3006. //>>excludeEnd("ide");
  3007. messageSends: []
  3008. }),
  3009. $globals.HLRepeatedKeyDownHandler);
  3010. $core.addMethod(
  3011. $core.method({
  3012. selector: "on:",
  3013. protocol: "instance creation",
  3014. fn: function (aWidget){
  3015. var self=this,$self=this;
  3016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3017. return $core.withContext(function($ctx1) {
  3018. //>>excludeEnd("ctx");
  3019. var $1;
  3020. $1=$self._new();
  3021. $recv($1)._widget_(aWidget);
  3022. return $recv($1)._yourself();
  3023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3024. }, function($ctx1) {$ctx1.fill(self,"on:",{aWidget:aWidget},$globals.HLRepeatedKeyDownHandler.a$cls)});
  3025. //>>excludeEnd("ctx");
  3026. },
  3027. //>>excludeStart("ide", pragmas.excludeIdeData);
  3028. args: ["aWidget"],
  3029. source: "on: aWidget\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09yourself",
  3030. referencedClasses: [],
  3031. //>>excludeEnd("ide");
  3032. messageSends: ["widget:", "new", "yourself"]
  3033. }),
  3034. $globals.HLRepeatedKeyDownHandler.a$cls);
  3035. });