1
0

Helios-KeyBindings.js 100 KB

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