Helios-KeyBindings.js 100 KB

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