Helios-KeyBindings.js 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233
  1. define(["smalltalk","nil","_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Helios-KeyBindings');
  3. smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "applyOn:",
  7. category: 'actions',
  8. fn: function (aKeyBinder){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBinding)})},
  12. args: ["aKeyBinder"],
  13. source: "applyOn: aKeyBinder",
  14. messageSends: [],
  15. referencedClasses: []
  16. }),
  17. smalltalk.HLBinding);
  18. smalltalk.addMethod(
  19. smalltalk.method({
  20. selector: "atKey:",
  21. category: 'accessing',
  22. fn: function (aKey){
  23. var self=this;
  24. return smalltalk.withContext(function($ctx1) {
  25. return nil;
  26. }, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBinding)})},
  27. args: ["aKey"],
  28. source: "atKey: aKey\x0a\x09^ nil",
  29. messageSends: [],
  30. referencedClasses: []
  31. }),
  32. smalltalk.HLBinding);
  33. smalltalk.addMethod(
  34. smalltalk.method({
  35. selector: "displayLabel",
  36. category: 'accessing',
  37. fn: function (){
  38. var self=this;
  39. return smalltalk.withContext(function($ctx1) {
  40. var $1;
  41. $1=self._label();
  42. return $1;
  43. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBinding)})},
  44. args: [],
  45. source: "displayLabel\x0a\x09^ self label",
  46. messageSends: ["label"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.HLBinding);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "isActive",
  53. category: 'testing',
  54. fn: function (){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. var $1;
  58. $1=self._subclassResponsibility();
  59. return $1;
  60. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBinding)})},
  61. args: [],
  62. source: "isActive\x0a\x09^ self subclassResponsibility",
  63. messageSends: ["subclassResponsibility"],
  64. referencedClasses: []
  65. }),
  66. smalltalk.HLBinding);
  67. smalltalk.addMethod(
  68. smalltalk.method({
  69. selector: "isFinal",
  70. category: 'testing',
  71. fn: function (){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) {
  74. return false;
  75. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBinding)})},
  76. args: [],
  77. source: "isFinal\x0a\x09\x22 Answer true if the receiver is the final binding of a sequence \x22\x0a\x09\x0a\x09^ false",
  78. messageSends: [],
  79. referencedClasses: []
  80. }),
  81. smalltalk.HLBinding);
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "key",
  85. category: 'accessing',
  86. fn: function (){
  87. var self=this;
  88. return smalltalk.withContext(function($ctx1) {
  89. var $1;
  90. $1=self["@key"];
  91. return $1;
  92. }, function($ctx1) {$ctx1.fill(self,"key",{},smalltalk.HLBinding)})},
  93. args: [],
  94. source: "key\x0a\x09^ key",
  95. messageSends: [],
  96. referencedClasses: []
  97. }),
  98. smalltalk.HLBinding);
  99. smalltalk.addMethod(
  100. smalltalk.method({
  101. selector: "key:",
  102. category: 'accessing',
  103. fn: function (anInteger){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) {
  106. self["@key"]=anInteger;
  107. return self}, function($ctx1) {$ctx1.fill(self,"key:",{anInteger:anInteger},smalltalk.HLBinding)})},
  108. args: ["anInteger"],
  109. source: "key: anInteger\x0a\x09key := anInteger",
  110. messageSends: [],
  111. referencedClasses: []
  112. }),
  113. smalltalk.HLBinding);
  114. smalltalk.addMethod(
  115. smalltalk.method({
  116. selector: "label",
  117. category: 'accessing',
  118. fn: function (){
  119. var self=this;
  120. return smalltalk.withContext(function($ctx1) {
  121. var $1;
  122. $1=self["@label"];
  123. return $1;
  124. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.HLBinding)})},
  125. args: [],
  126. source: "label\x0a\x09^ label",
  127. messageSends: [],
  128. referencedClasses: []
  129. }),
  130. smalltalk.HLBinding);
  131. smalltalk.addMethod(
  132. smalltalk.method({
  133. selector: "label:",
  134. category: 'accessing',
  135. fn: function (aString){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) {
  138. self["@label"]=aString;
  139. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.HLBinding)})},
  140. args: ["aString"],
  141. source: "label: aString\x0a\x09label := aString",
  142. messageSends: [],
  143. referencedClasses: []
  144. }),
  145. smalltalk.HLBinding);
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "release",
  149. category: 'actions',
  150. fn: function (){
  151. var self=this;
  152. return smalltalk.withContext(function($ctx1) {
  153. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBinding)})},
  154. args: [],
  155. source: "release",
  156. messageSends: [],
  157. referencedClasses: []
  158. }),
  159. smalltalk.HLBinding);
  160. smalltalk.addMethod(
  161. smalltalk.method({
  162. selector: "renderActionFor:html:",
  163. category: 'rendering',
  164. fn: function (aBinder,html){
  165. var self=this;
  166. return smalltalk.withContext(function($ctx1) {
  167. var $1,$3,$4,$5,$6,$2;
  168. $1=_st(html)._span();
  169. _st($1)._class_("command");
  170. $2=_st($1)._with_((function(){
  171. return smalltalk.withContext(function($ctx2) {
  172. $3=_st(html)._span();
  173. _st($3)._class_("label");
  174. $4=_st($3)._with_(_st(self._shortcut())._asLowercase());
  175. $4;
  176. $5=_st(html)._a();
  177. _st($5)._class_("action");
  178. _st($5)._with_(self._displayLabel());
  179. $6=_st($5)._onClick_((function(){
  180. return smalltalk.withContext(function($ctx3) {
  181. return _st(aBinder)._applyBinding_(self);
  182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  183. return $6;
  184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  185. return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBinding)})},
  186. args: ["aBinder", "html"],
  187. source: "renderActionFor: aBinder html: html\x0a\x09html span class: 'command'; with: [\x0a\x09\x09html span \x0a\x09\x09\x09class: 'label'; \x0a\x09\x09\x09with: self shortcut asLowercase.\x0a \x09\x09html a \x0a \x09class: 'action'; \x0a with: self displayLabel;\x0a \x09\x09\x09onClick: [ aBinder applyBinding: self ] ]",
  188. messageSends: ["class:", "span", "with:", "asLowercase", "shortcut", "a", "displayLabel", "onClick:", "applyBinding:"],
  189. referencedClasses: []
  190. }),
  191. smalltalk.HLBinding);
  192. smalltalk.addMethod(
  193. smalltalk.method({
  194. selector: "renderOn:html:",
  195. category: 'rendering',
  196. fn: function (aBindingHelper,html){
  197. var self=this;
  198. return smalltalk.withContext(function($ctx1) {
  199. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBinding)})},
  200. args: ["aBindingHelper", "html"],
  201. source: "renderOn: aBindingHelper html: html",
  202. messageSends: [],
  203. referencedClasses: []
  204. }),
  205. smalltalk.HLBinding);
  206. smalltalk.addMethod(
  207. smalltalk.method({
  208. selector: "shortcut",
  209. category: 'accessing',
  210. fn: function (){
  211. var self=this;
  212. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  213. return smalltalk.withContext(function($ctx1) {
  214. var $1;
  215. $1=_st($String())._fromCharCode_(self._key());
  216. return $1;
  217. }, function($ctx1) {$ctx1.fill(self,"shortcut",{},smalltalk.HLBinding)})},
  218. args: [],
  219. source: "shortcut\x0a\x09^ String fromCharCode: self key",
  220. messageSends: ["fromCharCode:", "key"],
  221. referencedClasses: ["String"]
  222. }),
  223. smalltalk.HLBinding);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "on:labelled:",
  227. category: 'instance creation',
  228. fn: function (anInteger,aString){
  229. var self=this;
  230. return smalltalk.withContext(function($ctx1) {
  231. var $2,$3,$1;
  232. $2=self._new();
  233. _st($2)._key_(anInteger);
  234. _st($2)._label_(aString);
  235. $3=_st($2)._yourself();
  236. $1=$3;
  237. return $1;
  238. }, function($ctx1) {$ctx1.fill(self,"on:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBinding.klass)})},
  239. args: ["anInteger", "aString"],
  240. source: "on: anInteger labelled: aString\x0a\x09^ self new\x0a \x09key: anInteger;\x0a label: aString;\x0a yourself",
  241. messageSends: ["key:", "new", "label:", "yourself"],
  242. referencedClasses: []
  243. }),
  244. smalltalk.HLBinding.klass);
  245. smalltalk.addClass('HLBindingAction', smalltalk.HLBinding, ['command'], 'Helios-KeyBindings');
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "applyOn:",
  249. category: 'actions',
  250. fn: function (aKeyBinder){
  251. var self=this;
  252. return smalltalk.withContext(function($ctx1) {
  253. var $1;
  254. $1=_st(self._command())._isInputRequired();
  255. if(smalltalk.assert($1)){
  256. _st(aKeyBinder)._selectBinding_(self._inputBinding());
  257. } else {
  258. _st(self._command())._execute();
  259. };
  260. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingAction)})},
  261. args: ["aKeyBinder"],
  262. source: "applyOn: aKeyBinder\x0a\x09self command isInputRequired\x0a\x09\x09ifTrue: [ aKeyBinder selectBinding: self inputBinding ]\x0a\x09\x09ifFalse: [ self command execute ]",
  263. messageSends: ["ifTrue:ifFalse:", "selectBinding:", "inputBinding", "execute", "command", "isInputRequired"],
  264. referencedClasses: []
  265. }),
  266. smalltalk.HLBindingAction);
  267. smalltalk.addMethod(
  268. smalltalk.method({
  269. selector: "command",
  270. category: 'accessing',
  271. fn: function (){
  272. var self=this;
  273. return smalltalk.withContext(function($ctx1) {
  274. var $1;
  275. $1=self["@command"];
  276. return $1;
  277. }, function($ctx1) {$ctx1.fill(self,"command",{},smalltalk.HLBindingAction)})},
  278. args: [],
  279. source: "command\x0a\x09^ command",
  280. messageSends: [],
  281. referencedClasses: []
  282. }),
  283. smalltalk.HLBindingAction);
  284. smalltalk.addMethod(
  285. smalltalk.method({
  286. selector: "command:",
  287. category: 'accessing',
  288. fn: function (aCommand){
  289. var self=this;
  290. return smalltalk.withContext(function($ctx1) {
  291. self["@command"]=aCommand;
  292. return self}, function($ctx1) {$ctx1.fill(self,"command:",{aCommand:aCommand},smalltalk.HLBindingAction)})},
  293. args: ["aCommand"],
  294. source: "command: aCommand\x0a\x09command := aCommand",
  295. messageSends: [],
  296. referencedClasses: []
  297. }),
  298. smalltalk.HLBindingAction);
  299. smalltalk.addMethod(
  300. smalltalk.method({
  301. selector: "inputBinding",
  302. category: 'accessing',
  303. fn: function (){
  304. var self=this;
  305. function $HLBindingInput(){return smalltalk.HLBindingInput||(typeof HLBindingInput=="undefined"?nil:HLBindingInput)}
  306. return smalltalk.withContext(function($ctx1) {
  307. var $2,$3,$4,$5,$1;
  308. $2=_st($HLBindingInput())._new();
  309. _st($2)._label_(_st(self._command())._inputLabel());
  310. _st($2)._ghostText_(_st(self._command())._displayLabel());
  311. _st($2)._defaultValue_(_st(self._command())._defaultInput());
  312. _st($2)._inputCompletion_(_st(self._command())._inputCompletion());
  313. _st($2)._callback_((function(val){
  314. return smalltalk.withContext(function($ctx2) {
  315. $3=self._command();
  316. _st($3)._input_(val);
  317. $4=_st($3)._execute();
  318. return $4;
  319. }, function($ctx2) {$ctx2.fillBlock({val:val},$ctx1)})}));
  320. $5=_st($2)._yourself();
  321. $1=$5;
  322. return $1;
  323. }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
  324. args: [],
  325. 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",
  326. messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "defaultValue:", "defaultInput", "inputCompletion:", "inputCompletion", "callback:", "input:", "execute", "yourself"],
  327. referencedClasses: ["HLBindingInput"]
  328. }),
  329. smalltalk.HLBindingAction);
  330. smalltalk.addMethod(
  331. smalltalk.method({
  332. selector: "isActive",
  333. category: 'testing',
  334. fn: function (){
  335. var self=this;
  336. return smalltalk.withContext(function($ctx1) {
  337. var $1;
  338. $1=_st(self._command())._isActive();
  339. return $1;
  340. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingAction)})},
  341. args: [],
  342. source: "isActive\x0a\x09^ self command isActive",
  343. messageSends: ["isActive", "command"],
  344. referencedClasses: []
  345. }),
  346. smalltalk.HLBindingAction);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "isFinal",
  350. category: 'testing',
  351. fn: function (){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) {
  354. var $1;
  355. $1=_st(_st(self._command())._isInputRequired())._not();
  356. return $1;
  357. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingAction)})},
  358. args: [],
  359. source: "isFinal\x0a\x09^ self command isInputRequired not",
  360. messageSends: ["not", "isInputRequired", "command"],
  361. referencedClasses: []
  362. }),
  363. smalltalk.HLBindingAction);
  364. smalltalk.addClass('HLBindingGroup', smalltalk.HLBinding, ['bindings'], 'Helios-KeyBindings');
  365. smalltalk.addMethod(
  366. smalltalk.method({
  367. selector: "activeBindings",
  368. category: 'accessing',
  369. fn: function (){
  370. var self=this;
  371. return smalltalk.withContext(function($ctx1) {
  372. var $1;
  373. $1=_st(self._bindings())._select_((function(each){
  374. return smalltalk.withContext(function($ctx2) {
  375. return _st(each)._isActive();
  376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  377. return $1;
  378. }, function($ctx1) {$ctx1.fill(self,"activeBindings",{},smalltalk.HLBindingGroup)})},
  379. args: [],
  380. source: "activeBindings\x0a\x09^ self bindings select: [ :each | each isActive ]",
  381. messageSends: ["select:", "isActive", "bindings"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.HLBindingGroup);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "add:",
  388. category: 'accessing',
  389. fn: function (aBinding){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st(self._bindings())._add_(aBinding);
  394. return $1;
  395. }, function($ctx1) {$ctx1.fill(self,"add:",{aBinding:aBinding},smalltalk.HLBindingGroup)})},
  396. args: ["aBinding"],
  397. source: "add: aBinding\x0a\x09^ self bindings add: aBinding",
  398. messageSends: ["add:", "bindings"],
  399. referencedClasses: []
  400. }),
  401. smalltalk.HLBindingGroup);
  402. smalltalk.addMethod(
  403. smalltalk.method({
  404. selector: "addActionKey:labelled:callback:",
  405. category: 'accessing',
  406. fn: function (anInteger,aString,aBlock){
  407. var self=this;
  408. function $HLBindingAction(){return smalltalk.HLBindingAction||(typeof HLBindingAction=="undefined"?nil:HLBindingAction)}
  409. return smalltalk.withContext(function($ctx1) {
  410. var $1,$2;
  411. $1=_st($HLBindingAction())._on_labelled_(anInteger,aString);
  412. _st($1)._callback_(aBlock);
  413. $2=_st($1)._yourself();
  414. self._add_($2);
  415. return self}, function($ctx1) {$ctx1.fill(self,"addActionKey:labelled:callback:",{anInteger:anInteger,aString:aString,aBlock:aBlock},smalltalk.HLBindingGroup)})},
  416. args: ["anInteger", "aString", "aBlock"],
  417. source: "addActionKey: anInteger labelled: aString callback: aBlock\x0a\x09self add: ((HLBindingAction on: anInteger labelled: aString)\x0a \x09callback: aBlock;\x0a yourself)",
  418. messageSends: ["add:", "callback:", "on:labelled:", "yourself"],
  419. referencedClasses: ["HLBindingAction"]
  420. }),
  421. smalltalk.HLBindingGroup);
  422. smalltalk.addMethod(
  423. smalltalk.method({
  424. selector: "addGroupKey:labelled:",
  425. category: 'accessing',
  426. fn: function (anInteger,aString){
  427. var self=this;
  428. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  429. return smalltalk.withContext(function($ctx1) {
  430. self._add_(_st($HLBindingGroup())._on_labelled_(anInteger,aString));
  431. return self}, function($ctx1) {$ctx1.fill(self,"addGroupKey:labelled:",{anInteger:anInteger,aString:aString},smalltalk.HLBindingGroup)})},
  432. args: ["anInteger", "aString"],
  433. source: "addGroupKey: anInteger labelled: aString\x0a\x09self add: (HLBindingGroup on: anInteger labelled: aString)",
  434. messageSends: ["add:", "on:labelled:"],
  435. referencedClasses: ["HLBindingGroup"]
  436. }),
  437. smalltalk.HLBindingGroup);
  438. smalltalk.addMethod(
  439. smalltalk.method({
  440. selector: "at:",
  441. category: 'accessing',
  442. fn: function (aString){
  443. var self=this;
  444. return smalltalk.withContext(function($ctx1) {
  445. var $1;
  446. $1=_st(self._bindings())._detect_ifNone_((function(each){
  447. return smalltalk.withContext(function($ctx2) {
  448. return _st(_st(each)._label()).__eq(aString);
  449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  450. return smalltalk.withContext(function($ctx2) {
  451. return nil;
  452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  453. return $1;
  454. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.HLBindingGroup)})},
  455. args: ["aString"],
  456. source: "at: aString\x0a\x09^ self bindings \x0a \x09detect: [ :each | each label = aString ]\x0a \x09ifNone: [ nil ]",
  457. messageSends: ["detect:ifNone:", "=", "label", "bindings"],
  458. referencedClasses: []
  459. }),
  460. smalltalk.HLBindingGroup);
  461. smalltalk.addMethod(
  462. smalltalk.method({
  463. selector: "at:add:",
  464. category: 'accessing',
  465. fn: function (aString,aBinding){
  466. var self=this;
  467. var binding;
  468. return smalltalk.withContext(function($ctx1) {
  469. var $1,$2;
  470. binding=self._at_(aString);
  471. $1=binding;
  472. if(($receiver = $1) == nil || $receiver == undefined){
  473. $2=self;
  474. return $2;
  475. } else {
  476. $1;
  477. };
  478. _st(binding)._add_(aBinding);
  479. return self}, function($ctx1) {$ctx1.fill(self,"at:add:",{aString:aString,aBinding:aBinding,binding:binding},smalltalk.HLBindingGroup)})},
  480. args: ["aString", "aBinding"],
  481. 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",
  482. messageSends: ["at:", "ifNil:", "add:"],
  483. referencedClasses: []
  484. }),
  485. smalltalk.HLBindingGroup);
  486. smalltalk.addMethod(
  487. smalltalk.method({
  488. selector: "atKey:",
  489. category: 'accessing',
  490. fn: function (anInteger){
  491. var self=this;
  492. return smalltalk.withContext(function($ctx1) {
  493. var $1;
  494. $1=_st(self._bindings())._detect_ifNone_((function(each){
  495. return smalltalk.withContext(function($ctx2) {
  496. return _st(_st(each)._key()).__eq(anInteger);
  497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  498. return smalltalk.withContext(function($ctx2) {
  499. return nil;
  500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  501. return $1;
  502. }, function($ctx1) {$ctx1.fill(self,"atKey:",{anInteger:anInteger},smalltalk.HLBindingGroup)})},
  503. args: ["anInteger"],
  504. source: "atKey: anInteger\x0a\x09^ self bindings \x0a \x09detect: [ :each | each key = anInteger ]\x0a \x09ifNone: [ nil ]",
  505. messageSends: ["detect:ifNone:", "=", "key", "bindings"],
  506. referencedClasses: []
  507. }),
  508. smalltalk.HLBindingGroup);
  509. smalltalk.addMethod(
  510. smalltalk.method({
  511. selector: "bindings",
  512. category: 'accessing',
  513. fn: function (){
  514. var self=this;
  515. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  516. return smalltalk.withContext(function($ctx1) {
  517. var $2,$1;
  518. $2=self["@bindings"];
  519. if(($receiver = $2) == nil || $receiver == undefined){
  520. self["@bindings"]=_st($OrderedCollection())._new();
  521. $1=self["@bindings"];
  522. } else {
  523. $1=$2;
  524. };
  525. return $1;
  526. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLBindingGroup)})},
  527. args: [],
  528. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := OrderedCollection new ]",
  529. messageSends: ["ifNil:", "new"],
  530. referencedClasses: ["OrderedCollection"]
  531. }),
  532. smalltalk.HLBindingGroup);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "displayLabel",
  536. category: 'accessing',
  537. fn: function (){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) {
  540. var $1;
  541. $1=_st(smalltalk.HLBindingGroup.superclass.fn.prototype._displayLabel.apply(_st(self), [])).__comma("...");
  542. return $1;
  543. }, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLBindingGroup)})},
  544. args: [],
  545. source: "displayLabel\x0a\x09^ super displayLabel, '...'",
  546. messageSends: [",", "displayLabel"],
  547. referencedClasses: []
  548. }),
  549. smalltalk.HLBindingGroup);
  550. smalltalk.addMethod(
  551. smalltalk.method({
  552. selector: "isActive",
  553. category: 'testing',
  554. fn: function (){
  555. var self=this;
  556. return smalltalk.withContext(function($ctx1) {
  557. var $1;
  558. $1=_st(self._activeBindings())._notEmpty();
  559. return $1;
  560. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingGroup)})},
  561. args: [],
  562. source: "isActive\x0a\x09^ self activeBindings notEmpty",
  563. messageSends: ["notEmpty", "activeBindings"],
  564. referencedClasses: []
  565. }),
  566. smalltalk.HLBindingGroup);
  567. smalltalk.addMethod(
  568. smalltalk.method({
  569. selector: "release",
  570. category: 'actions',
  571. fn: function (){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) {
  574. _st(self._bindings())._do_((function(each){
  575. return smalltalk.withContext(function($ctx2) {
  576. return _st(each)._release();
  577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  578. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingGroup)})},
  579. args: [],
  580. source: "release\x0a\x09self bindings do: [ :each | each release ]",
  581. messageSends: ["do:", "release", "bindings"],
  582. referencedClasses: []
  583. }),
  584. smalltalk.HLBindingGroup);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "renderOn:html:",
  588. category: 'rendering',
  589. fn: function (aBindingHelper,html){
  590. var self=this;
  591. return smalltalk.withContext(function($ctx1) {
  592. var $1;
  593. $1=self._isActive();
  594. if(smalltalk.assert($1)){
  595. _st(aBindingHelper)._renderBindingGroup_on_(self,html);
  596. };
  597. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBindingHelper:aBindingHelper,html:html},smalltalk.HLBindingGroup)})},
  598. args: ["aBindingHelper", "html"],
  599. source: "renderOn: aBindingHelper html: html\x0a\x09self isActive ifTrue: [\x0a\x09\x09aBindingHelper renderBindingGroup: self on: html ]",
  600. messageSends: ["ifTrue:", "renderBindingGroup:on:", "isActive"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.HLBindingGroup);
  604. smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'wrapper', 'binder', 'ghostText', 'isFinal', 'message', 'messageTag', 'inputCompletion', 'defaultValue'], 'Helios-KeyBindings');
  605. smalltalk.addMethod(
  606. smalltalk.method({
  607. selector: "applyOn:",
  608. category: 'actions',
  609. fn: function (aKeyBinder){
  610. var self=this;
  611. return smalltalk.withContext(function($ctx1) {
  612. self._isFinal_(true);
  613. self._evaluate_(_st(_st(self._input())._asJQuery())._val());
  614. return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
  615. args: ["aKeyBinder"],
  616. source: "applyOn: aKeyBinder\x0a\x09self isFinal: true.\x0a\x09self evaluate: self input asJQuery val",
  617. messageSends: ["isFinal:", "evaluate:", "val", "asJQuery", "input"],
  618. referencedClasses: []
  619. }),
  620. smalltalk.HLBindingInput);
  621. smalltalk.addMethod(
  622. smalltalk.method({
  623. selector: "atKey:",
  624. category: 'accessing',
  625. fn: function (aKey){
  626. var self=this;
  627. return smalltalk.withContext(function($ctx1) {
  628. var $1;
  629. $1=_st(aKey).__eq((13));
  630. if(! smalltalk.assert($1)){
  631. return nil;
  632. };
  633. return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
  634. args: ["aKey"],
  635. source: "atKey: aKey\x0a\x09aKey = 13 ifFalse: [ ^ nil ]",
  636. messageSends: ["ifFalse:", "="],
  637. referencedClasses: []
  638. }),
  639. smalltalk.HLBindingInput);
  640. smalltalk.addMethod(
  641. smalltalk.method({
  642. selector: "callback",
  643. category: 'accessing',
  644. fn: function (){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) {
  647. var $2,$1;
  648. $2=self["@callback"];
  649. if(($receiver = $2) == nil || $receiver == undefined){
  650. self["@callback"]=(function(value){
  651. return smalltalk.withContext(function($ctx2) {
  652. }, function($ctx2) {$ctx2.fillBlock({value:value},$ctx1)})});
  653. $1=self["@callback"];
  654. } else {
  655. $1=$2;
  656. };
  657. return $1;
  658. }, function($ctx1) {$ctx1.fill(self,"callback",{},smalltalk.HLBindingInput)})},
  659. args: [],
  660. source: "callback\x0a\x09^ callback ifNil: [ callback := [ :value | ] ]",
  661. messageSends: ["ifNil:"],
  662. referencedClasses: []
  663. }),
  664. smalltalk.HLBindingInput);
  665. smalltalk.addMethod(
  666. smalltalk.method({
  667. selector: "callback:",
  668. category: 'accessing',
  669. fn: function (aBlock){
  670. var self=this;
  671. return smalltalk.withContext(function($ctx1) {
  672. self["@callback"]=aBlock;
  673. return self}, function($ctx1) {$ctx1.fill(self,"callback:",{aBlock:aBlock},smalltalk.HLBindingInput)})},
  674. args: ["aBlock"],
  675. source: "callback: aBlock\x0a\x09callback := aBlock",
  676. messageSends: [],
  677. referencedClasses: []
  678. }),
  679. smalltalk.HLBindingInput);
  680. smalltalk.addMethod(
  681. smalltalk.method({
  682. selector: "clearStatus",
  683. category: 'actions',
  684. fn: function (){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) {
  687. self._status_("info");
  688. self._message_("");
  689. self._refresh();
  690. return self}, function($ctx1) {$ctx1.fill(self,"clearStatus",{},smalltalk.HLBindingInput)})},
  691. args: [],
  692. source: "clearStatus\x0a\x09self status: 'info'.\x0a\x09self message: ''.\x0a\x09self refresh",
  693. messageSends: ["status:", "message:", "refresh"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.HLBindingInput);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "defaultValue",
  700. category: 'accessing',
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) {
  704. var $2,$1;
  705. $2=self["@defaultValue"];
  706. if(($receiver = $2) == nil || $receiver == undefined){
  707. $1="";
  708. } else {
  709. $1=$2;
  710. };
  711. return $1;
  712. }, function($ctx1) {$ctx1.fill(self,"defaultValue",{},smalltalk.HLBindingInput)})},
  713. args: [],
  714. source: "defaultValue\x0a\x09^ defaultValue ifNil: [ '' ]",
  715. messageSends: ["ifNil:"],
  716. referencedClasses: []
  717. }),
  718. smalltalk.HLBindingInput);
  719. smalltalk.addMethod(
  720. smalltalk.method({
  721. selector: "defaultValue:",
  722. category: 'accessing',
  723. fn: function (aString){
  724. var self=this;
  725. return smalltalk.withContext(function($ctx1) {
  726. self["@defaultValue"]=aString;
  727. return self}, function($ctx1) {$ctx1.fill(self,"defaultValue:",{aString:aString},smalltalk.HLBindingInput)})},
  728. args: ["aString"],
  729. source: "defaultValue: aString\x0a\x09defaultValue := aString",
  730. messageSends: [],
  731. referencedClasses: []
  732. }),
  733. smalltalk.HLBindingInput);
  734. smalltalk.addMethod(
  735. smalltalk.method({
  736. selector: "errorStatus",
  737. category: 'actions',
  738. fn: function (){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) {
  741. self._status_("error");
  742. self._refresh();
  743. return self}, function($ctx1) {$ctx1.fill(self,"errorStatus",{},smalltalk.HLBindingInput)})},
  744. args: [],
  745. source: "errorStatus\x0a\x09self status: 'error'.\x0a\x09self refresh",
  746. messageSends: ["status:", "refresh"],
  747. referencedClasses: []
  748. }),
  749. smalltalk.HLBindingInput);
  750. smalltalk.addMethod(
  751. smalltalk.method({
  752. selector: "evaluate:",
  753. category: 'actions',
  754. fn: function (aString){
  755. var self=this;
  756. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  757. return smalltalk.withContext(function($ctx1) {
  758. _st((function(){
  759. return smalltalk.withContext(function($ctx2) {
  760. return _st(self._callback())._value_(aString);
  761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_($Error(),(function(ex){
  762. return smalltalk.withContext(function($ctx2) {
  763. _st(_st(self._input())._asJQuery())._one_do_("keydown",(function(){
  764. return smalltalk.withContext(function($ctx3) {
  765. return self._clearStatus();
  766. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  767. self._message_(_st(ex)._messageText());
  768. self._errorStatus();
  769. return self._isFinal_(false);
  770. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1)})}));
  771. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:",{aString:aString},smalltalk.HLBindingInput)})},
  772. args: ["aString"],
  773. source: "evaluate: aString\x0a\x09\x0a\x09[ self callback value: aString ]\x0a\x09on: Error\x0a\x09do: [:ex |\x0a\x09\x09self input asJQuery \x0a\x09\x09\x09one: 'keydown' \x0a\x09\x09\x09do: [ self clearStatus ].\x0a\x09\x09self message: ex messageText.\x0a\x09\x09self errorStatus.\x0a\x09\x09self isFinal: false ].",
  774. messageSends: ["on:do:", "one:do:", "clearStatus", "asJQuery", "input", "message:", "messageText", "errorStatus", "isFinal:", "value:", "callback"],
  775. referencedClasses: ["Error"]
  776. }),
  777. smalltalk.HLBindingInput);
  778. smalltalk.addMethod(
  779. smalltalk.method({
  780. selector: "ghostText",
  781. category: 'accessing',
  782. fn: function (){
  783. var self=this;
  784. return smalltalk.withContext(function($ctx1) {
  785. var $1;
  786. $1=self["@ghostText"];
  787. return $1;
  788. }, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
  789. args: [],
  790. source: "ghostText\x0a\x09^ ghostText",
  791. messageSends: [],
  792. referencedClasses: []
  793. }),
  794. smalltalk.HLBindingInput);
  795. smalltalk.addMethod(
  796. smalltalk.method({
  797. selector: "ghostText:",
  798. category: 'accessing',
  799. fn: function (aText){
  800. var self=this;
  801. return smalltalk.withContext(function($ctx1) {
  802. self["@ghostText"]=aText;
  803. return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
  804. args: ["aText"],
  805. source: "ghostText: aText\x0a\x09ghostText := aText",
  806. messageSends: [],
  807. referencedClasses: []
  808. }),
  809. smalltalk.HLBindingInput);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "input",
  813. category: 'accessing',
  814. fn: function (){
  815. var self=this;
  816. return smalltalk.withContext(function($ctx1) {
  817. var $1;
  818. $1=self["@input"];
  819. return $1;
  820. }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
  821. args: [],
  822. source: "input\x0a\x09^ input",
  823. messageSends: [],
  824. referencedClasses: []
  825. }),
  826. smalltalk.HLBindingInput);
  827. smalltalk.addMethod(
  828. smalltalk.method({
  829. selector: "inputCompletion",
  830. category: 'accessing',
  831. fn: function (){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) {
  834. var $2,$1;
  835. $2=self["@inputCompletion"];
  836. if(($receiver = $2) == nil || $receiver == undefined){
  837. $1=[];
  838. } else {
  839. $1=$2;
  840. };
  841. return $1;
  842. }, function($ctx1) {$ctx1.fill(self,"inputCompletion",{},smalltalk.HLBindingInput)})},
  843. args: [],
  844. source: "inputCompletion\x0a\x09^ inputCompletion ifNil: [ #() ]",
  845. messageSends: ["ifNil:"],
  846. referencedClasses: []
  847. }),
  848. smalltalk.HLBindingInput);
  849. smalltalk.addMethod(
  850. smalltalk.method({
  851. selector: "inputCompletion:",
  852. category: 'accessing',
  853. fn: function (aCollection){
  854. var self=this;
  855. return smalltalk.withContext(function($ctx1) {
  856. self["@inputCompletion"]=aCollection;
  857. return self}, function($ctx1) {$ctx1.fill(self,"inputCompletion:",{aCollection:aCollection},smalltalk.HLBindingInput)})},
  858. args: ["aCollection"],
  859. source: "inputCompletion: aCollection\x0a\x09inputCompletion := aCollection",
  860. messageSends: [],
  861. referencedClasses: []
  862. }),
  863. smalltalk.HLBindingInput);
  864. smalltalk.addMethod(
  865. smalltalk.method({
  866. selector: "isActive",
  867. category: 'testing',
  868. fn: function (){
  869. var self=this;
  870. return smalltalk.withContext(function($ctx1) {
  871. return true;
  872. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLBindingInput)})},
  873. args: [],
  874. source: "isActive\x0a\x09^ true",
  875. messageSends: [],
  876. referencedClasses: []
  877. }),
  878. smalltalk.HLBindingInput);
  879. smalltalk.addMethod(
  880. smalltalk.method({
  881. selector: "isFinal",
  882. category: 'testing',
  883. fn: function (){
  884. var self=this;
  885. return smalltalk.withContext(function($ctx1) {
  886. var $2,$1;
  887. $2=self["@isFinal"];
  888. if(($receiver = $2) == nil || $receiver == undefined){
  889. self["@isFinal"]=smalltalk.HLBindingInput.superclass.fn.prototype._isFinal.apply(_st(self), []);
  890. $1=self["@isFinal"];
  891. } else {
  892. $1=$2;
  893. };
  894. return $1;
  895. }, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
  896. args: [],
  897. source: "isFinal\x0a\x09^ isFinal ifNil: [ isFinal := super isFinal ]",
  898. messageSends: ["ifNil:", "isFinal"],
  899. referencedClasses: []
  900. }),
  901. smalltalk.HLBindingInput);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "isFinal:",
  905. category: 'testing',
  906. fn: function (aBoolean){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. self["@isFinal"]=aBoolean;
  910. return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
  911. args: ["aBoolean"],
  912. source: "isFinal: aBoolean\x0a\x09isFinal := aBoolean",
  913. messageSends: [],
  914. referencedClasses: []
  915. }),
  916. smalltalk.HLBindingInput);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "message",
  920. category: 'accessing',
  921. fn: function (){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. var $2,$1;
  925. $2=self["@message"];
  926. if(($receiver = $2) == nil || $receiver == undefined){
  927. self["@message"]="";
  928. $1=self["@message"];
  929. } else {
  930. $1=$2;
  931. };
  932. return $1;
  933. }, function($ctx1) {$ctx1.fill(self,"message",{},smalltalk.HLBindingInput)})},
  934. args: [],
  935. source: "message\x0a\x09^ message ifNil: [ message := '' ]",
  936. messageSends: ["ifNil:"],
  937. referencedClasses: []
  938. }),
  939. smalltalk.HLBindingInput);
  940. smalltalk.addMethod(
  941. smalltalk.method({
  942. selector: "message:",
  943. category: 'accessing',
  944. fn: function (aString){
  945. var self=this;
  946. return smalltalk.withContext(function($ctx1) {
  947. self["@message"]=aString;
  948. return self}, function($ctx1) {$ctx1.fill(self,"message:",{aString:aString},smalltalk.HLBindingInput)})},
  949. args: ["aString"],
  950. source: "message: aString\x0a\x09message := aString",
  951. messageSends: [],
  952. referencedClasses: []
  953. }),
  954. smalltalk.HLBindingInput);
  955. smalltalk.addMethod(
  956. smalltalk.method({
  957. selector: "refresh",
  958. category: 'rendering',
  959. fn: function (){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) {
  962. var $1,$2;
  963. $1=self["@wrapper"];
  964. if(($receiver = $1) == nil || $receiver == undefined){
  965. $2=self;
  966. return $2;
  967. } else {
  968. $1;
  969. };
  970. _st(self["@wrapper"])._class_(self._status());
  971. _st(self["@messageTag"])._contents_(self._message());
  972. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
  973. args: [],
  974. source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a \x0a\x09wrapper class: self status.\x0a\x09messageTag contents: self message",
  975. messageSends: ["ifNil:", "class:", "status", "contents:", "message"],
  976. referencedClasses: []
  977. }),
  978. smalltalk.HLBindingInput);
  979. smalltalk.addMethod(
  980. smalltalk.method({
  981. selector: "release",
  982. category: 'actions',
  983. fn: function (){
  984. var self=this;
  985. return smalltalk.withContext(function($ctx1) {
  986. self["@status"]=nil;
  987. self["@wrapper"]=nil;
  988. self["@binder"]=nil;
  989. return self}, function($ctx1) {$ctx1.fill(self,"release",{},smalltalk.HLBindingInput)})},
  990. args: [],
  991. source: "release\x0a\x09status := nil.\x0a\x09wrapper := nil.\x0a\x09binder := nil",
  992. messageSends: [],
  993. referencedClasses: []
  994. }),
  995. smalltalk.HLBindingInput);
  996. smalltalk.addMethod(
  997. smalltalk.method({
  998. selector: "renderOn:html:",
  999. category: 'rendering',
  1000. fn: function (aBinder,html){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) {
  1003. var $1,$2,$4,$5,$6,$7,$3;
  1004. self["@binder"]=aBinder;
  1005. $1=self["@wrapper"];
  1006. if(($receiver = $1) == nil || $receiver == undefined){
  1007. self["@wrapper"]=_st(html)._span();
  1008. self["@wrapper"];
  1009. } else {
  1010. $1;
  1011. };
  1012. $2=self["@wrapper"];
  1013. _st($2)._class_(self._status());
  1014. $3=_st($2)._with_((function(){
  1015. return smalltalk.withContext(function($ctx2) {
  1016. $4=_st(html)._input();
  1017. _st($4)._placeholder_(self._ghostText());
  1018. _st($4)._value_(self._defaultValue());
  1019. $5=_st($4)._yourself();
  1020. self["@input"]=$5;
  1021. self["@input"];
  1022. _st(_st(self["@input"])._asJQuery())._typeahead_(smalltalk.HashedCollection._from_(["source".__minus_gt(self._inputCompletion())]));
  1023. $6=_st(html)._span();
  1024. _st($6)._class_("help-inline");
  1025. _st($6)._with_(self._message());
  1026. $7=_st($6)._yourself();
  1027. self["@messageTag"]=$7;
  1028. return self["@messageTag"];
  1029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1030. _st((function(){
  1031. return smalltalk.withContext(function($ctx2) {
  1032. return _st(_st(self["@input"])._asJQuery())._focus();
  1033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((10));
  1034. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
  1035. args: ["aBinder", "html"],
  1036. source: "renderOn: aBinder html: html\x0a\x09binder := aBinder.\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\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 ] valueWithTimeout: 10",
  1037. messageSends: ["ifNil:", "span", "class:", "status", "with:", "placeholder:", "ghostText", "input", "value:", "defaultValue", "yourself", "typeahead:", "->", "inputCompletion", "asJQuery", "message", "valueWithTimeout:", "focus"],
  1038. referencedClasses: []
  1039. }),
  1040. smalltalk.HLBindingInput);
  1041. smalltalk.addMethod(
  1042. smalltalk.method({
  1043. selector: "status",
  1044. category: 'accessing',
  1045. fn: function (){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) {
  1048. var $2,$1;
  1049. $2=self["@status"];
  1050. if(($receiver = $2) == nil || $receiver == undefined){
  1051. self["@status"]="info";
  1052. $1=self["@status"];
  1053. } else {
  1054. $1=$2;
  1055. };
  1056. return $1;
  1057. }, function($ctx1) {$ctx1.fill(self,"status",{},smalltalk.HLBindingInput)})},
  1058. args: [],
  1059. source: "status\x0a\x09^ status ifNil: [ status := 'info' ]",
  1060. messageSends: ["ifNil:"],
  1061. referencedClasses: []
  1062. }),
  1063. smalltalk.HLBindingInput);
  1064. smalltalk.addMethod(
  1065. smalltalk.method({
  1066. selector: "status:",
  1067. category: 'accessing',
  1068. fn: function (aStatus){
  1069. var self=this;
  1070. return smalltalk.withContext(function($ctx1) {
  1071. self["@status"]=aStatus;
  1072. return self}, function($ctx1) {$ctx1.fill(self,"status:",{aStatus:aStatus},smalltalk.HLBindingInput)})},
  1073. args: ["aStatus"],
  1074. source: "status: aStatus\x0a\x09status := aStatus",
  1075. messageSends: [],
  1076. referencedClasses: []
  1077. }),
  1078. smalltalk.HLBindingInput);
  1079. smalltalk.addClass('HLKeyBinder', smalltalk.Object, ['modifierKey', 'helper', 'bindings', 'selectedBinding'], 'Helios-KeyBindings');
  1080. smalltalk.addMethod(
  1081. smalltalk.method({
  1082. selector: "activate",
  1083. category: 'actions',
  1084. fn: function (){
  1085. var self=this;
  1086. return smalltalk.withContext(function($ctx1) {
  1087. _st(self._helper())._show();
  1088. return self}, function($ctx1) {$ctx1.fill(self,"activate",{},smalltalk.HLKeyBinder)})},
  1089. args: [],
  1090. source: "activate\x0a\x09self helper show",
  1091. messageSends: ["show", "helper"],
  1092. referencedClasses: []
  1093. }),
  1094. smalltalk.HLKeyBinder);
  1095. smalltalk.addMethod(
  1096. smalltalk.method({
  1097. selector: "activationKey",
  1098. category: 'accessing',
  1099. fn: function (){
  1100. var self=this;
  1101. return smalltalk.withContext(function($ctx1) {
  1102. return (32);
  1103. }, function($ctx1) {$ctx1.fill(self,"activationKey",{},smalltalk.HLKeyBinder)})},
  1104. args: [],
  1105. source: "activationKey\x0a\x09\x22SPACE\x22\x0a\x09^ 32",
  1106. messageSends: [],
  1107. referencedClasses: []
  1108. }),
  1109. smalltalk.HLKeyBinder);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "activationKeyLabel",
  1113. category: 'accessing',
  1114. fn: function (){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) {
  1117. return "ctrl + space";
  1118. }, function($ctx1) {$ctx1.fill(self,"activationKeyLabel",{},smalltalk.HLKeyBinder)})},
  1119. args: [],
  1120. source: "activationKeyLabel\x0a\x09^ 'ctrl + space'",
  1121. messageSends: [],
  1122. referencedClasses: []
  1123. }),
  1124. smalltalk.HLKeyBinder);
  1125. smalltalk.addMethod(
  1126. smalltalk.method({
  1127. selector: "applyBinding:",
  1128. category: 'actions',
  1129. fn: function (aBinding){
  1130. var self=this;
  1131. return smalltalk.withContext(function($ctx1) {
  1132. var $1,$2,$3;
  1133. $1=_st(aBinding)._isActive();
  1134. if(! smalltalk.assert($1)){
  1135. $2=self;
  1136. return $2;
  1137. };
  1138. self._selectBinding_(aBinding);
  1139. _st(aBinding)._applyOn_(self);
  1140. $3=_st(aBinding)._isFinal();
  1141. if(smalltalk.assert($3)){
  1142. self._deactivate();
  1143. };
  1144. return self}, function($ctx1) {$ctx1.fill(self,"applyBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1145. args: ["aBinding"],
  1146. source: "applyBinding: aBinding\x0a\x09aBinding isActive ifFalse: [ ^ self ].\x0a\x09\x0a\x09self selectBinding: aBinding.\x0a aBinding applyOn: self.\x0a\x09\x0a\x09aBinding isFinal ifTrue: [ self deactivate ]",
  1147. messageSends: ["ifFalse:", "isActive", "selectBinding:", "applyOn:", "ifTrue:", "deactivate", "isFinal"],
  1148. referencedClasses: []
  1149. }),
  1150. smalltalk.HLKeyBinder);
  1151. smalltalk.addMethod(
  1152. smalltalk.method({
  1153. selector: "bindings",
  1154. category: 'accessing',
  1155. fn: function (){
  1156. var self=this;
  1157. return smalltalk.withContext(function($ctx1) {
  1158. var $2,$1;
  1159. $2=self["@bindings"];
  1160. if(($receiver = $2) == nil || $receiver == undefined){
  1161. self["@bindings"]=self._defaultBindings();
  1162. $1=self["@bindings"];
  1163. } else {
  1164. $1=$2;
  1165. };
  1166. return $1;
  1167. }, function($ctx1) {$ctx1.fill(self,"bindings",{},smalltalk.HLKeyBinder)})},
  1168. args: [],
  1169. source: "bindings\x0a\x09^ bindings ifNil: [ bindings := self defaultBindings ]",
  1170. messageSends: ["ifNil:", "defaultBindings"],
  1171. referencedClasses: []
  1172. }),
  1173. smalltalk.HLKeyBinder);
  1174. smalltalk.addMethod(
  1175. smalltalk.method({
  1176. selector: "deactivate",
  1177. category: 'actions',
  1178. fn: function (){
  1179. var self=this;
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. $1=self["@selectedBinding"];
  1183. if(($receiver = $1) == nil || $receiver == undefined){
  1184. $1;
  1185. } else {
  1186. _st(self["@selectedBinding"])._release();
  1187. };
  1188. self["@selectedBinding"]=nil;
  1189. _st(self._helper())._hide();
  1190. return self}, function($ctx1) {$ctx1.fill(self,"deactivate",{},smalltalk.HLKeyBinder)})},
  1191. args: [],
  1192. source: "deactivate\x0a\x09selectedBinding ifNotNil: [ selectedBinding release ].\x0a selectedBinding := nil.\x0a\x09self helper hide",
  1193. messageSends: ["ifNotNil:", "release", "hide", "helper"],
  1194. referencedClasses: []
  1195. }),
  1196. smalltalk.HLKeyBinder);
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "defaultBindings",
  1200. category: 'defaults',
  1201. fn: function (){
  1202. var self=this;
  1203. var group;
  1204. function $HLBindingGroup(){return smalltalk.HLBindingGroup||(typeof HLBindingGroup=="undefined"?nil:HLBindingGroup)}
  1205. function $HLCloseTabCommand(){return smalltalk.HLCloseTabCommand||(typeof HLCloseTabCommand=="undefined"?nil:HLCloseTabCommand)}
  1206. function $HLOpenCommand(){return smalltalk.HLOpenCommand||(typeof HLOpenCommand=="undefined"?nil:HLOpenCommand)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $1,$2,$3;
  1209. $1=_st($HLBindingGroup())._new();
  1210. _st($1)._addGroupKey_labelled_((86),"View");
  1211. _st($1)._add_(_st(_st($HLCloseTabCommand())._new())._asBinding());
  1212. $2=_st($1)._yourself();
  1213. group=$2;
  1214. _st($HLOpenCommand())._registerConcreteClassesOn_(group);
  1215. $3=group;
  1216. return $3;
  1217. }, function($ctx1) {$ctx1.fill(self,"defaultBindings",{group:group},smalltalk.HLKeyBinder)})},
  1218. args: [],
  1219. source: "defaultBindings\x0a\x09| group |\x0a\x09\x0a\x09group := HLBindingGroup new\x0a\x09\x09addGroupKey: 86 labelled: 'View';\x0a\x09\x09add: HLCloseTabCommand new asBinding;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09HLOpenCommand registerConcreteClassesOn: group.\x0a\x09\x09\x09\x09\x0a\x09^ group",
  1220. messageSends: ["addGroupKey:labelled:", "new", "add:", "asBinding", "yourself", "registerConcreteClassesOn:"],
  1221. referencedClasses: ["HLBindingGroup", "HLCloseTabCommand", "HLOpenCommand"]
  1222. }),
  1223. smalltalk.HLKeyBinder);
  1224. smalltalk.addMethod(
  1225. smalltalk.method({
  1226. selector: "escapeKey",
  1227. category: 'accessing',
  1228. fn: function (){
  1229. var self=this;
  1230. return smalltalk.withContext(function($ctx1) {
  1231. return (27);
  1232. }, function($ctx1) {$ctx1.fill(self,"escapeKey",{},smalltalk.HLKeyBinder)})},
  1233. args: [],
  1234. source: "escapeKey\x0a\x09\x22ESC\x22\x0a\x09^ 27",
  1235. messageSends: [],
  1236. referencedClasses: []
  1237. }),
  1238. smalltalk.HLKeyBinder);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "flushBindings",
  1242. category: 'actions',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self["@bindings"]=nil;
  1247. return self}, function($ctx1) {$ctx1.fill(self,"flushBindings",{},smalltalk.HLKeyBinder)})},
  1248. args: [],
  1249. source: "flushBindings\x0a\x09bindings := nil",
  1250. messageSends: [],
  1251. referencedClasses: []
  1252. }),
  1253. smalltalk.HLKeyBinder);
  1254. smalltalk.addMethod(
  1255. smalltalk.method({
  1256. selector: "handleActiveKeyDown:",
  1257. category: 'events',
  1258. fn: function (event){
  1259. var self=this;
  1260. return smalltalk.withContext(function($ctx1) {
  1261. var $1,$2;
  1262. $1=_st(_st(_st(event)._which()).__eq(self._escapeKey()))._or_((function(){
  1263. return smalltalk.withContext(function($ctx2) {
  1264. return _st(_st(_st(event)._which()).__eq((71)))._and_((function(){
  1265. return smalltalk.withContext(function($ctx3) {
  1266. return _st(event)._ctrlKey();
  1267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  1268. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1269. if(smalltalk.assert($1)){
  1270. self._deactivate();
  1271. _st(event)._preventDefault();
  1272. return false;
  1273. };
  1274. $2=self._handleBindingFor_(event);
  1275. return $2;
  1276. }, function($ctx1) {$ctx1.fill(self,"handleActiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1277. args: ["event"],
  1278. source: "handleActiveKeyDown: event\x0a\x0a\x09\x22ESC or ctrl+g deactivate the keyBinder\x22\x0a\x09(event which = self escapeKey or: [\x0a\x09\x09event which = 71 and: [ event ctrlKey ] ])\x0a \x09ifTrue: [ \x0a \x09self deactivate.\x0a\x09\x09\x09\x09event preventDefault.\x0a\x09\x09\x09\x09^ false ].\x0a \x0a \x22Handle the keybinding\x22\x0a ^ self handleBindingFor: event",
  1279. messageSends: ["ifTrue:", "deactivate", "preventDefault", "or:", "and:", "ctrlKey", "=", "which", "escapeKey", "handleBindingFor:"],
  1280. referencedClasses: []
  1281. }),
  1282. smalltalk.HLKeyBinder);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "handleBindingFor:",
  1286. category: 'events',
  1287. fn: function (anEvent){
  1288. var self=this;
  1289. var binding;
  1290. return smalltalk.withContext(function($ctx1) {
  1291. var $1;
  1292. binding=_st(self._selectedBinding())._atKey_(_st(anEvent)._which());
  1293. $1=binding;
  1294. if(($receiver = $1) == nil || $receiver == undefined){
  1295. $1;
  1296. } else {
  1297. self._applyBinding_(binding);
  1298. _st(anEvent)._preventDefault();
  1299. return false;
  1300. };
  1301. return self}, function($ctx1) {$ctx1.fill(self,"handleBindingFor:",{anEvent:anEvent,binding:binding},smalltalk.HLKeyBinder)})},
  1302. args: ["anEvent"],
  1303. 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 ]",
  1304. messageSends: ["atKey:", "which", "selectedBinding", "ifNotNil:", "applyBinding:", "preventDefault"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.HLKeyBinder);
  1308. smalltalk.addMethod(
  1309. smalltalk.method({
  1310. selector: "handleInactiveKeyDown:",
  1311. category: 'events',
  1312. fn: function (event){
  1313. var self=this;
  1314. return smalltalk.withContext(function($ctx1) {
  1315. var $1,$2;
  1316. $1=_st(_st(event)._which()).__eq(self._activationKey());
  1317. if(smalltalk.assert($1)){
  1318. $2=_st(event)._ctrlKey();
  1319. if(smalltalk.assert($2)){
  1320. self._activate();
  1321. _st(event)._preventDefault();
  1322. return false;
  1323. };
  1324. };
  1325. return self}, function($ctx1) {$ctx1.fill(self,"handleInactiveKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1326. args: ["event"],
  1327. source: "handleInactiveKeyDown: event\x0a\x09event which = self activationKey ifTrue: [\x0a \x09event ctrlKey ifTrue: [\x0a\x09\x09\x09self activate. \x0a event preventDefault. \x0a ^ false ] ]",
  1328. messageSends: ["ifTrue:", "activate", "preventDefault", "ctrlKey", "=", "activationKey", "which"],
  1329. referencedClasses: []
  1330. }),
  1331. smalltalk.HLKeyBinder);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "handleKeyDown:",
  1335. category: 'events',
  1336. fn: function (event){
  1337. var self=this;
  1338. return smalltalk.withContext(function($ctx1) {
  1339. var $2,$1;
  1340. $2=self._isActive();
  1341. if(smalltalk.assert($2)){
  1342. $1=self._handleActiveKeyDown_(event);
  1343. } else {
  1344. $1=self._handleInactiveKeyDown_(event);
  1345. };
  1346. return $1;
  1347. }, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{event:event},smalltalk.HLKeyBinder)})},
  1348. args: ["event"],
  1349. source: "handleKeyDown: event\x0a\x09^ self isActive\x0a \x09ifTrue: [ self handleActiveKeyDown: event ]\x0a \x09ifFalse: [ self handleInactiveKeyDown: event ]",
  1350. messageSends: ["ifTrue:ifFalse:", "handleActiveKeyDown:", "handleInactiveKeyDown:", "isActive"],
  1351. referencedClasses: []
  1352. }),
  1353. smalltalk.HLKeyBinder);
  1354. smalltalk.addMethod(
  1355. smalltalk.method({
  1356. selector: "helper",
  1357. category: 'accessing',
  1358. fn: function (){
  1359. var self=this;
  1360. return smalltalk.withContext(function($ctx1) {
  1361. var $1;
  1362. $1=self["@helper"];
  1363. return $1;
  1364. }, function($ctx1) {$ctx1.fill(self,"helper",{},smalltalk.HLKeyBinder)})},
  1365. args: [],
  1366. source: "helper\x0a\x09^ helper",
  1367. messageSends: [],
  1368. referencedClasses: []
  1369. }),
  1370. smalltalk.HLKeyBinder);
  1371. smalltalk.addMethod(
  1372. smalltalk.method({
  1373. selector: "initialize",
  1374. category: 'initialization',
  1375. fn: function (){
  1376. var self=this;
  1377. function $HLKeyBinderHelper(){return smalltalk.HLKeyBinderHelper||(typeof HLKeyBinderHelper=="undefined"?nil:HLKeyBinderHelper)}
  1378. return smalltalk.withContext(function($ctx1) {
  1379. var $1,$2;
  1380. smalltalk.HLKeyBinder.superclass.fn.prototype._initialize.apply(_st(self), []);
  1381. self["@helper"]=_st($HLKeyBinderHelper())._on_(self);
  1382. $1=self["@helper"];
  1383. _st($1)._renderStart();
  1384. $2=_st($1)._renderCog();
  1385. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLKeyBinder)})},
  1386. args: [],
  1387. source: "initialize\x0a\x09super initialize.\x0a\x09helper := HLKeyBinderHelper on: self.\x0a\x09helper \x09\x0a\x09\x09renderStart;\x0a\x09\x09renderCog",
  1388. messageSends: ["initialize", "on:", "renderStart", "renderCog"],
  1389. referencedClasses: ["HLKeyBinderHelper"]
  1390. }),
  1391. smalltalk.HLKeyBinder);
  1392. smalltalk.addMethod(
  1393. smalltalk.method({
  1394. selector: "isActive",
  1395. category: 'testing',
  1396. fn: function (){
  1397. var self=this;
  1398. return smalltalk.withContext(function($ctx1) {
  1399. var $1;
  1400. $1=_st(_st(".".__comma(_st(self._helper())._cssClass()))._asJQuery())._is_(":visible");
  1401. return $1;
  1402. }, function($ctx1) {$ctx1.fill(self,"isActive",{},smalltalk.HLKeyBinder)})},
  1403. args: [],
  1404. source: "isActive\x0a\x09^ ('.', self helper cssClass) asJQuery is: ':visible'",
  1405. messageSends: ["is:", "asJQuery", ",", "cssClass", "helper"],
  1406. referencedClasses: []
  1407. }),
  1408. smalltalk.HLKeyBinder);
  1409. smalltalk.addMethod(
  1410. smalltalk.method({
  1411. selector: "selectBinding:",
  1412. category: 'actions',
  1413. fn: function (aBinding){
  1414. var self=this;
  1415. return smalltalk.withContext(function($ctx1) {
  1416. var $1,$2;
  1417. $1=_st(aBinding).__eq(self["@selectedBinding"]);
  1418. if(smalltalk.assert($1)){
  1419. $2=self;
  1420. return $2;
  1421. };
  1422. self["@selectedBinding"]=aBinding;
  1423. _st(self._helper())._refresh();
  1424. return self}, function($ctx1) {$ctx1.fill(self,"selectBinding:",{aBinding:aBinding},smalltalk.HLKeyBinder)})},
  1425. args: ["aBinding"],
  1426. source: "selectBinding: aBinding\x0a\x09aBinding = selectedBinding ifTrue: [ ^ self ].\x0a\x09\x0a\x09selectedBinding := aBinding.\x0a\x09self helper refresh",
  1427. messageSends: ["ifTrue:", "=", "refresh", "helper"],
  1428. referencedClasses: []
  1429. }),
  1430. smalltalk.HLKeyBinder);
  1431. smalltalk.addMethod(
  1432. smalltalk.method({
  1433. selector: "selectedBinding",
  1434. category: 'accessing',
  1435. fn: function (){
  1436. var self=this;
  1437. return smalltalk.withContext(function($ctx1) {
  1438. var $2,$1;
  1439. $2=self["@selectedBinding"];
  1440. if(($receiver = $2) == nil || $receiver == undefined){
  1441. $1=self._bindings();
  1442. } else {
  1443. $1=$2;
  1444. };
  1445. return $1;
  1446. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinder)})},
  1447. args: [],
  1448. source: "selectedBinding\x0a\x09^ selectedBinding ifNil: [ self bindings ]",
  1449. messageSends: ["ifNil:", "bindings"],
  1450. referencedClasses: []
  1451. }),
  1452. smalltalk.HLKeyBinder);
  1453. smalltalk.addMethod(
  1454. smalltalk.method({
  1455. selector: "setupEvents",
  1456. category: 'events',
  1457. fn: function (){
  1458. var self=this;
  1459. return smalltalk.withContext(function($ctx1) {
  1460. _st(_st(window)._jQuery_("body"))._keydown_((function(event){
  1461. return smalltalk.withContext(function($ctx2) {
  1462. return self._handleKeyDown_(event);
  1463. }, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
  1464. return self}, function($ctx1) {$ctx1.fill(self,"setupEvents",{},smalltalk.HLKeyBinder)})},
  1465. args: [],
  1466. source: "setupEvents\x0a\x09(window jQuery: 'body') keydown: [ :event | self handleKeyDown: event ]",
  1467. messageSends: ["keydown:", "handleKeyDown:", "jQuery:"],
  1468. referencedClasses: []
  1469. }),
  1470. smalltalk.HLKeyBinder);
  1471. smalltalk.addMethod(
  1472. smalltalk.method({
  1473. selector: "systemIsMac",
  1474. category: 'testing',
  1475. fn: function (){
  1476. var self=this;
  1477. return smalltalk.withContext(function($ctx1) {
  1478. var $1;
  1479. $1=_st(_st(navigator)._platform())._match_("Mac");
  1480. return $1;
  1481. }, function($ctx1) {$ctx1.fill(self,"systemIsMac",{},smalltalk.HLKeyBinder)})},
  1482. args: [],
  1483. source: "systemIsMac\x0a\x09^ navigator platform match: 'Mac'",
  1484. messageSends: ["match:", "platform"],
  1485. referencedClasses: []
  1486. }),
  1487. smalltalk.HLKeyBinder);
  1488. smalltalk.addClass('HLKeyBinderHelper', smalltalk.HLWidget, ['keyBinder'], 'Helios-KeyBindings');
  1489. smalltalk.addMethod(
  1490. smalltalk.method({
  1491. selector: "cssClass",
  1492. category: 'accessing',
  1493. fn: function (){
  1494. var self=this;
  1495. return smalltalk.withContext(function($ctx1) {
  1496. return "key_helper";
  1497. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLKeyBinderHelper)})},
  1498. args: [],
  1499. source: "cssClass\x0a\x09^ 'key_helper'",
  1500. messageSends: [],
  1501. referencedClasses: []
  1502. }),
  1503. smalltalk.HLKeyBinderHelper);
  1504. smalltalk.addMethod(
  1505. smalltalk.method({
  1506. selector: "hide",
  1507. category: 'actions',
  1508. fn: function (){
  1509. var self=this;
  1510. return smalltalk.withContext(function($ctx1) {
  1511. _st(_st(".".__comma(self._cssClass()))._asJQuery())._remove();
  1512. self._showCog();
  1513. return self}, function($ctx1) {$ctx1.fill(self,"hide",{},smalltalk.HLKeyBinderHelper)})},
  1514. args: [],
  1515. source: "hide\x0a\x09('.', self cssClass) asJQuery remove.\x0a\x09self showCog",
  1516. messageSends: ["remove", "asJQuery", ",", "cssClass", "showCog"],
  1517. referencedClasses: []
  1518. }),
  1519. smalltalk.HLKeyBinderHelper);
  1520. smalltalk.addMethod(
  1521. smalltalk.method({
  1522. selector: "hideCog",
  1523. category: 'actions',
  1524. fn: function (){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) {
  1527. _st("#cog-helper"._asJQuery())._hide();
  1528. return self}, function($ctx1) {$ctx1.fill(self,"hideCog",{},smalltalk.HLKeyBinderHelper)})},
  1529. args: [],
  1530. source: "hideCog\x0a\x09'#cog-helper' asJQuery hide",
  1531. messageSends: ["hide", "asJQuery"],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.HLKeyBinderHelper);
  1535. smalltalk.addMethod(
  1536. smalltalk.method({
  1537. selector: "keyBinder",
  1538. category: 'accessing',
  1539. fn: function (){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) {
  1542. var $1;
  1543. $1=self["@keyBinder"];
  1544. return $1;
  1545. }, function($ctx1) {$ctx1.fill(self,"keyBinder",{},smalltalk.HLKeyBinderHelper)})},
  1546. args: [],
  1547. source: "keyBinder\x0a\x09^ keyBinder",
  1548. messageSends: [],
  1549. referencedClasses: []
  1550. }),
  1551. smalltalk.HLKeyBinderHelper);
  1552. smalltalk.addMethod(
  1553. smalltalk.method({
  1554. selector: "keyBinder:",
  1555. category: 'accessing',
  1556. fn: function (aKeyBinder){
  1557. var self=this;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. self["@keyBinder"]=aKeyBinder;
  1560. return self}, function($ctx1) {$ctx1.fill(self,"keyBinder:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper)})},
  1561. args: ["aKeyBinder"],
  1562. source: "keyBinder: aKeyBinder\x0a\x09keyBinder := aKeyBinder",
  1563. messageSends: [],
  1564. referencedClasses: []
  1565. }),
  1566. smalltalk.HLKeyBinderHelper);
  1567. smalltalk.addMethod(
  1568. smalltalk.method({
  1569. selector: "registerBindings",
  1570. category: 'keyBindings',
  1571. fn: function (){
  1572. var self=this;
  1573. return smalltalk.withContext(function($ctx1) {
  1574. return self}, function($ctx1) {$ctx1.fill(self,"registerBindings",{},smalltalk.HLKeyBinderHelper)})},
  1575. args: [],
  1576. source: "registerBindings\x0a\x09\x22Do nothing\x22",
  1577. messageSends: [],
  1578. referencedClasses: []
  1579. }),
  1580. smalltalk.HLKeyBinderHelper);
  1581. smalltalk.addMethod(
  1582. smalltalk.method({
  1583. selector: "renderBindingGroup:on:",
  1584. category: 'rendering',
  1585. fn: function (aBindingGroup,html){
  1586. var self=this;
  1587. return smalltalk.withContext(function($ctx1) {
  1588. _st(_st(_st(aBindingGroup)._activeBindings())._sorted_((function(a,b){
  1589. return smalltalk.withContext(function($ctx2) {
  1590. return _st(_st(a)._key()).__lt(_st(b)._key());
  1591. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  1592. return smalltalk.withContext(function($ctx2) {
  1593. return _st(each)._renderActionFor_html_(self._keyBinder(),html);
  1594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1595. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingGroup:on:",{aBindingGroup:aBindingGroup,html:html},smalltalk.HLKeyBinderHelper)})},
  1596. args: ["aBindingGroup", "html"],
  1597. source: "renderBindingGroup: aBindingGroup on: html\x0a\x09(aBindingGroup activeBindings \x0a \x09sorted: [ :a :b | a key < b key ])\x0a do: [ :each | each renderActionFor: self keyBinder html: html ]",
  1598. messageSends: ["do:", "renderActionFor:html:", "keyBinder", "sorted:", "<", "key", "activeBindings"],
  1599. referencedClasses: []
  1600. }),
  1601. smalltalk.HLKeyBinderHelper);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "renderBindingOn:",
  1605. category: 'rendering',
  1606. fn: function (html){
  1607. var self=this;
  1608. return smalltalk.withContext(function($ctx1) {
  1609. _st(self._selectedBinding())._renderOn_html_(self,html);
  1610. return self}, function($ctx1) {$ctx1.fill(self,"renderBindingOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1611. args: ["html"],
  1612. source: "renderBindingOn: html\x0a\x09self selectedBinding renderOn: self html: html",
  1613. messageSends: ["renderOn:html:", "selectedBinding"],
  1614. referencedClasses: []
  1615. }),
  1616. smalltalk.HLKeyBinderHelper);
  1617. smalltalk.addMethod(
  1618. smalltalk.method({
  1619. selector: "renderCloseOn:",
  1620. category: 'rendering',
  1621. fn: function (html){
  1622. var self=this;
  1623. return smalltalk.withContext(function($ctx1) {
  1624. var $1,$2;
  1625. $1=_st(html)._a();
  1626. _st($1)._class_("close");
  1627. _st($1)._with_((function(){
  1628. return smalltalk.withContext(function($ctx2) {
  1629. return _st(_st(html)._tag_("i"))._class_("icon-remove");
  1630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1631. $2=_st($1)._onClick_((function(){
  1632. return smalltalk.withContext(function($ctx2) {
  1633. return _st(self._keyBinder())._deactivate();
  1634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1635. return self}, function($ctx1) {$ctx1.fill(self,"renderCloseOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1636. args: ["html"],
  1637. 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 ]",
  1638. messageSends: ["class:", "a", "with:", "tag:", "onClick:", "deactivate", "keyBinder"],
  1639. referencedClasses: []
  1640. }),
  1641. smalltalk.HLKeyBinderHelper);
  1642. smalltalk.addMethod(
  1643. smalltalk.method({
  1644. selector: "renderCog",
  1645. category: 'rendering',
  1646. fn: function (){
  1647. var self=this;
  1648. return smalltalk.withContext(function($ctx1) {
  1649. var $1,$3,$4,$2;
  1650. _st((function(html){
  1651. return smalltalk.withContext(function($ctx2) {
  1652. $1=_st(html)._div();
  1653. _st($1)._id_("cog-helper");
  1654. $2=_st($1)._with_((function(){
  1655. return smalltalk.withContext(function($ctx3) {
  1656. $3=_st(html)._a();
  1657. _st($3)._with_((function(){
  1658. return smalltalk.withContext(function($ctx4) {
  1659. return _st(_st(html)._tag_("i"))._class_("icon-cog");
  1660. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  1661. $4=_st($3)._onClick_((function(){
  1662. return smalltalk.withContext(function($ctx4) {
  1663. return _st(self._keyBinder())._activate();
  1664. }, function($ctx4) {$ctx4.fillBlock({},$ctx3)})}));
  1665. return $4;
  1666. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  1667. return $2;
  1668. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_("body"._asJQuery());
  1669. return self}, function($ctx1) {$ctx1.fill(self,"renderCog",{},smalltalk.HLKeyBinderHelper)})},
  1670. args: [],
  1671. source: "renderCog\x0a\x09[ :html |\x0a\x09\x09html \x0a\x09\x09\x09div id: 'cog-helper'; \x0a\x09\x09\x09with: [\x0a\x09\x09\x09\x09html a \x0a\x09\x09\x09\x09\x09with: [ (html tag: 'i') class: 'icon-cog' ];\x0a\x09\x09\x09\x09\x09onClick: [ self keyBinder activate ] ] ]\x0a\x09\x09appendToJQuery: 'body' asJQuery",
  1672. messageSends: ["appendToJQuery:", "asJQuery", "id:", "div", "with:", "class:", "tag:", "a", "onClick:", "activate", "keyBinder"],
  1673. referencedClasses: []
  1674. }),
  1675. smalltalk.HLKeyBinderHelper);
  1676. smalltalk.addMethod(
  1677. smalltalk.method({
  1678. selector: "renderContentOn:",
  1679. category: 'rendering',
  1680. fn: function (html){
  1681. var self=this;
  1682. return smalltalk.withContext(function($ctx1) {
  1683. var $1,$3,$4,$2;
  1684. $1=_st(html)._div();
  1685. _st($1)._class_(self._cssClass());
  1686. $2=_st($1)._with_((function(){
  1687. return smalltalk.withContext(function($ctx2) {
  1688. $3=self;
  1689. _st($3)._renderSelectionOn_(html);
  1690. _st($3)._renderBindingOn_(html);
  1691. $4=_st($3)._renderCloseOn_(html);
  1692. return $4;
  1693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1694. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1695. args: ["html"],
  1696. source: "renderContentOn: html\x0a\x09html div class: self cssClass; with: [\x0a \x09self \x0a \x09renderSelectionOn:html;\x0a \x09renderBindingOn: html;\x0a\x09\x09\x09renderCloseOn: html ]",
  1697. messageSends: ["class:", "cssClass", "div", "with:", "renderSelectionOn:", "renderBindingOn:", "renderCloseOn:"],
  1698. referencedClasses: []
  1699. }),
  1700. smalltalk.HLKeyBinderHelper);
  1701. smalltalk.addMethod(
  1702. smalltalk.method({
  1703. selector: "renderSelectionOn:",
  1704. category: 'rendering',
  1705. fn: function (html){
  1706. var self=this;
  1707. return smalltalk.withContext(function($ctx1) {
  1708. var $1,$3,$5,$4,$2;
  1709. $1=_st(html)._span();
  1710. _st($1)._class_("selected");
  1711. $3=$1;
  1712. $5=_st(self._selectedBinding())._label();
  1713. if(($receiver = $5) == nil || $receiver == undefined){
  1714. $4="Action";
  1715. } else {
  1716. $4=$5;
  1717. };
  1718. $2=_st($3)._with_($4);
  1719. return self}, function($ctx1) {$ctx1.fill(self,"renderSelectionOn:",{html:html},smalltalk.HLKeyBinderHelper)})},
  1720. args: ["html"],
  1721. source: "renderSelectionOn: html\x0a\x09\x09html span \x0a \x09class: 'selected'; \x0a with: (self selectedBinding label ifNil: [ 'Action' ])",
  1722. messageSends: ["class:", "span", "with:", "ifNil:", "label", "selectedBinding"],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.HLKeyBinderHelper);
  1726. smalltalk.addMethod(
  1727. smalltalk.method({
  1728. selector: "renderStart",
  1729. category: 'rendering',
  1730. fn: function (){
  1731. var self=this;
  1732. return smalltalk.withContext(function($ctx1) {
  1733. var $1,$2;
  1734. _st(_st(window)._jQuery_("#helper"))._remove();
  1735. _st((function(html){
  1736. return smalltalk.withContext(function($ctx2) {
  1737. $1=_st(html)._div();
  1738. _st($1)._id_("helper");
  1739. $2=_st($1)._with_(_st("Press ".__comma(_st(self._keyBinder())._activationKeyLabel())).__comma(" to start"));
  1740. return $2;
  1741. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_("body"._asJQuery());
  1742. _st((function(){
  1743. return smalltalk.withContext(function($ctx2) {
  1744. return _st(_st(window)._jQuery_("#helper"))._fadeOut_((1000));
  1745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((2000));
  1746. return self}, function($ctx1) {$ctx1.fill(self,"renderStart",{},smalltalk.HLKeyBinderHelper)})},
  1747. args: [],
  1748. source: "renderStart\x0a\x09(window jQuery: '#helper') remove.\x0a\x0a\x09[ :html |\x0a\x09\x09html div \x0a\x09\x09\x09id: 'helper';\x0a\x09\x09\x09with: 'Press ', self keyBinder activationKeyLabel, ' to start' ] appendToJQuery: 'body' asJQuery.\x0a\x09\x0a\x09[ (window jQuery: '#helper') fadeOut: 1000 ] \x0a\x09\x09valueWithTimeout: 2000",
  1749. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery", "id:", "div", "with:", ",", "activationKeyLabel", "keyBinder", "valueWithTimeout:", "fadeOut:"],
  1750. referencedClasses: []
  1751. }),
  1752. smalltalk.HLKeyBinderHelper);
  1753. smalltalk.addMethod(
  1754. smalltalk.method({
  1755. selector: "selectedBinding",
  1756. category: 'accessing',
  1757. fn: function (){
  1758. var self=this;
  1759. return smalltalk.withContext(function($ctx1) {
  1760. var $1;
  1761. $1=_st(self._keyBinder())._selectedBinding();
  1762. return $1;
  1763. }, function($ctx1) {$ctx1.fill(self,"selectedBinding",{},smalltalk.HLKeyBinderHelper)})},
  1764. args: [],
  1765. source: "selectedBinding\x0a\x09^ self keyBinder selectedBinding",
  1766. messageSends: ["selectedBinding", "keyBinder"],
  1767. referencedClasses: []
  1768. }),
  1769. smalltalk.HLKeyBinderHelper);
  1770. smalltalk.addMethod(
  1771. smalltalk.method({
  1772. selector: "show",
  1773. category: 'actions',
  1774. fn: function (){
  1775. var self=this;
  1776. return smalltalk.withContext(function($ctx1) {
  1777. self._hideCog();
  1778. self._appendToJQuery_("body"._asJQuery());
  1779. return self}, function($ctx1) {$ctx1.fill(self,"show",{},smalltalk.HLKeyBinderHelper)})},
  1780. args: [],
  1781. source: "show\x0a\x09self hideCog.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1782. messageSends: ["hideCog", "appendToJQuery:", "asJQuery"],
  1783. referencedClasses: []
  1784. }),
  1785. smalltalk.HLKeyBinderHelper);
  1786. smalltalk.addMethod(
  1787. smalltalk.method({
  1788. selector: "showCog",
  1789. category: 'actions',
  1790. fn: function (){
  1791. var self=this;
  1792. return smalltalk.withContext(function($ctx1) {
  1793. _st("#cog-helper"._asJQuery())._show();
  1794. return self}, function($ctx1) {$ctx1.fill(self,"showCog",{},smalltalk.HLKeyBinderHelper)})},
  1795. args: [],
  1796. source: "showCog\x0a\x09'#cog-helper' asJQuery show",
  1797. messageSends: ["show", "asJQuery"],
  1798. referencedClasses: []
  1799. }),
  1800. smalltalk.HLKeyBinderHelper);
  1801. smalltalk.addMethod(
  1802. smalltalk.method({
  1803. selector: "on:",
  1804. category: 'instance creation',
  1805. fn: function (aKeyBinder){
  1806. var self=this;
  1807. return smalltalk.withContext(function($ctx1) {
  1808. var $2,$3,$1;
  1809. $2=self._new();
  1810. _st($2)._keyBinder_(aKeyBinder);
  1811. $3=_st($2)._yourself();
  1812. $1=$3;
  1813. return $1;
  1814. }, function($ctx1) {$ctx1.fill(self,"on:",{aKeyBinder:aKeyBinder},smalltalk.HLKeyBinderHelper.klass)})},
  1815. args: ["aKeyBinder"],
  1816. source: "on: aKeyBinder\x0a\x09^ self new\x0a \x09keyBinder: aKeyBinder;\x0a yourself",
  1817. messageSends: ["keyBinder:", "new", "yourself"],
  1818. referencedClasses: []
  1819. }),
  1820. smalltalk.HLKeyBinderHelper.klass);
  1821. smalltalk.addClass('HLRepeatingKeyBindingHandler', smalltalk.Object, ['repeatInterval', 'delay', 'interval', 'keyBindings', 'widget', 'isKeyCurrentlyPressed'], 'Helios-KeyBindings');
  1822. smalltalk.HLRepeatingKeyBindingHandler.comment="##Usage\x0a\x0a (HLRepeatingKeyBindingHandler forWidget: aWidget)\x0a whileKeyPressed: keyCode do: [xxxx];\x0a whileKeyPressed: anotherKey do: [yyy];\x0a rebind\x0a\x0aPerforms an action on a key press, waits for 300 ms and then preforms the action every repeatInterval ms until the button is released";
  1823. smalltalk.addMethod(
  1824. smalltalk.method({
  1825. selector: "bindKeys",
  1826. category: 'actions',
  1827. fn: function (){
  1828. var self=this;
  1829. return smalltalk.withContext(function($ctx1) {
  1830. _st(self["@widget"])._bindKeyDown_up_((function(e){
  1831. return smalltalk.withContext(function($ctx2) {
  1832. return self._handleKeyDown_(e);
  1833. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}),(function(e){
  1834. return smalltalk.withContext(function($ctx2) {
  1835. return self._handleKeyUp_(e);
  1836. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  1837. return self}, function($ctx1) {$ctx1.fill(self,"bindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1838. args: [],
  1839. source: "bindKeys\x0a\x09widget bindKeyDown: [ :e | self handleKeyDown: e ] up: [ :e | self handleKeyUp: e ]",
  1840. messageSends: ["bindKeyDown:up:", "handleKeyDown:", "handleKeyUp:"],
  1841. referencedClasses: []
  1842. }),
  1843. smalltalk.HLRepeatingKeyBindingHandler);
  1844. smalltalk.addMethod(
  1845. smalltalk.method({
  1846. selector: "delayBeforeStartingRepeatWithAction:",
  1847. category: 'actions',
  1848. fn: function (action){
  1849. var self=this;
  1850. return smalltalk.withContext(function($ctx1) {
  1851. var $1;
  1852. $1=_st((function(){
  1853. return smalltalk.withContext(function($ctx2) {
  1854. self["@interval"]=self._startRepeatingAction_(action);
  1855. return self["@interval"];
  1856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithTimeout_((300));
  1857. return $1;
  1858. }, function($ctx1) {$ctx1.fill(self,"delayBeforeStartingRepeatWithAction:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  1859. args: ["action"],
  1860. source: "delayBeforeStartingRepeatWithAction: action\x0a\x09^ [ interval := self startRepeatingAction: action ] valueWithTimeout: 300",
  1861. messageSends: ["valueWithTimeout:", "startRepeatingAction:"],
  1862. referencedClasses: []
  1863. }),
  1864. smalltalk.HLRepeatingKeyBindingHandler);
  1865. smalltalk.addMethod(
  1866. smalltalk.method({
  1867. selector: "handleKeyDown:",
  1868. category: 'events-processing',
  1869. fn: function (e){
  1870. var self=this;
  1871. return smalltalk.withContext(function($ctx1) {
  1872. _st(self["@keyBindings"])._keysAndValuesDo_((function(key,action){
  1873. return smalltalk.withContext(function($ctx2) {
  1874. return self._ifKey_wasPressedIn_thenDo_(key,e,action);
  1875. }, function($ctx2) {$ctx2.fillBlock({key:key,action:action},$ctx1)})}));
  1876. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyDown:",{e:e},smalltalk.HLRepeatingKeyBindingHandler)})},
  1877. args: ["e"],
  1878. source: "handleKeyDown: e\x0a\x09 keyBindings keysAndValuesDo: [ :key :action | \x0a\x09\x09self ifKey: key wasPressedIn: e thenDo: action ]",
  1879. messageSends: ["keysAndValuesDo:", "ifKey:wasPressedIn:thenDo:"],
  1880. referencedClasses: []
  1881. }),
  1882. smalltalk.HLRepeatingKeyBindingHandler);
  1883. smalltalk.addMethod(
  1884. smalltalk.method({
  1885. selector: "handleKeyUp",
  1886. category: 'actions',
  1887. fn: function (){
  1888. var self=this;
  1889. return smalltalk.withContext(function($ctx1) {
  1890. var $1,$2;
  1891. self["@isKeyCurrentlyPressed"]=false;
  1892. $1=self["@interval"];
  1893. if(($receiver = $1) == nil || $receiver == undefined){
  1894. $1;
  1895. } else {
  1896. _st(self["@interval"])._clearInterval();
  1897. };
  1898. $2=self["@delay"];
  1899. if(($receiver = $2) == nil || $receiver == undefined){
  1900. $2;
  1901. } else {
  1902. _st(self["@delay"])._clearTimeout();
  1903. };
  1904. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1905. args: [],
  1906. source: "handleKeyUp\x0a\x09isKeyCurrentlyPressed := false.\x0a\x09interval ifNotNil: [ interval clearInterval ].\x0a\x09delay ifNotNil: [ delay clearTimeout ]",
  1907. messageSends: ["ifNotNil:", "clearInterval", "clearTimeout"],
  1908. referencedClasses: []
  1909. }),
  1910. smalltalk.HLRepeatingKeyBindingHandler);
  1911. smalltalk.addMethod(
  1912. smalltalk.method({
  1913. selector: "handleKeyUp:",
  1914. category: 'events-processing',
  1915. fn: function (e){
  1916. var self=this;
  1917. return smalltalk.withContext(function($ctx1) {
  1918. var $1;
  1919. $1=self["@isKeyCurrentlyPressed"];
  1920. if(smalltalk.assert($1)){
  1921. self._handleKeyUp();
  1922. };
  1923. return self}, function($ctx1) {$ctx1.fill(self,"handleKeyUp:",{e:e},smalltalk.HLRepeatingKeyBindingHandler)})},
  1924. args: ["e"],
  1925. source: "handleKeyUp: e\x0a\x09isKeyCurrentlyPressed\x0a\x09\x09ifTrue: [ self handleKeyUp ] ",
  1926. messageSends: ["ifTrue:", "handleKeyUp"],
  1927. referencedClasses: []
  1928. }),
  1929. smalltalk.HLRepeatingKeyBindingHandler);
  1930. smalltalk.addMethod(
  1931. smalltalk.method({
  1932. selector: "ifKey:wasPressedIn:thenDo:",
  1933. category: 'events-processing',
  1934. fn: function (key,e,action){
  1935. var self=this;
  1936. return smalltalk.withContext(function($ctx1) {
  1937. var $1;
  1938. $1=_st(_st(_st(e)._which()).__eq(key))._and_((function(){
  1939. return smalltalk.withContext(function($ctx2) {
  1940. return _st(self["@isKeyCurrentlyPressed"]).__eq(false);
  1941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1942. if(smalltalk.assert($1)){
  1943. self._whileTheKeyIsPressedDo_(action);
  1944. };
  1945. return self}, function($ctx1) {$ctx1.fill(self,"ifKey:wasPressedIn:thenDo:",{key:key,e:e,action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  1946. args: ["key", "e", "action"],
  1947. source: "ifKey: key wasPressedIn: e thenDo: action\x0a\x09(e which = key and: [ isKeyCurrentlyPressed = false ])\x0a\x09\x09ifTrue: [ self whileTheKeyIsPressedDo: action ]",
  1948. messageSends: ["ifTrue:", "whileTheKeyIsPressedDo:", "and:", "=", "which"],
  1949. referencedClasses: []
  1950. }),
  1951. smalltalk.HLRepeatingKeyBindingHandler);
  1952. smalltalk.addMethod(
  1953. smalltalk.method({
  1954. selector: "initialize",
  1955. category: 'initialization',
  1956. fn: function (){
  1957. var self=this;
  1958. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1959. return smalltalk.withContext(function($ctx1) {
  1960. smalltalk.HLRepeatingKeyBindingHandler.superclass.fn.prototype._initialize.apply(_st(self), []);
  1961. self["@keyBindings"]=_st($Dictionary())._new();
  1962. self["@isKeyCurrentlyPressed"]=false;
  1963. self["@repeatInterval"]=(70);
  1964. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1965. args: [],
  1966. source: "initialize \x0a\x09super initialize.\x0a\x09keyBindings := Dictionary new.\x0a\x09isKeyCurrentlyPressed := false.\x0a\x09repeatInterval := 70.",
  1967. messageSends: ["initialize", "new"],
  1968. referencedClasses: ["Dictionary"]
  1969. }),
  1970. smalltalk.HLRepeatingKeyBindingHandler);
  1971. smalltalk.addMethod(
  1972. smalltalk.method({
  1973. selector: "rebindKeys",
  1974. category: 'actions',
  1975. fn: function (){
  1976. var self=this;
  1977. return smalltalk.withContext(function($ctx1) {
  1978. var $1,$2;
  1979. $1=self;
  1980. _st($1)._unbindKeys();
  1981. $2=_st($1)._bindKeys();
  1982. return self}, function($ctx1) {$ctx1.fill(self,"rebindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  1983. args: [],
  1984. source: "rebindKeys\x0a\x09self unbindKeys;\x0a\x09\x09bindKeys",
  1985. messageSends: ["unbindKeys", "bindKeys"],
  1986. referencedClasses: []
  1987. }),
  1988. smalltalk.HLRepeatingKeyBindingHandler);
  1989. smalltalk.addMethod(
  1990. smalltalk.method({
  1991. selector: "repeatInterval:",
  1992. category: 'accessing',
  1993. fn: function (aMillisecondIntegerValue){
  1994. var self=this;
  1995. return smalltalk.withContext(function($ctx1) {
  1996. self["@repeatInterval"]=aMillisecondIntegerValue;
  1997. return self}, function($ctx1) {$ctx1.fill(self,"repeatInterval:",{aMillisecondIntegerValue:aMillisecondIntegerValue},smalltalk.HLRepeatingKeyBindingHandler)})},
  1998. args: ["aMillisecondIntegerValue"],
  1999. source: "repeatInterval: aMillisecondIntegerValue \x0a\x09repeatInterval := aMillisecondIntegerValue",
  2000. messageSends: [],
  2001. referencedClasses: []
  2002. }),
  2003. smalltalk.HLRepeatingKeyBindingHandler);
  2004. smalltalk.addMethod(
  2005. smalltalk.method({
  2006. selector: "startRepeatingAction:",
  2007. category: 'actions',
  2008. fn: function (action){
  2009. var self=this;
  2010. return smalltalk.withContext(function($ctx1) {
  2011. var $2,$1;
  2012. $1=_st((function(){
  2013. return smalltalk.withContext(function($ctx2) {
  2014. $2=_st(self["@widget"])._hasFocus();
  2015. if(smalltalk.assert($2)){
  2016. return _st(action)._value();
  2017. } else {
  2018. return self._handleKeyUp();
  2019. };
  2020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._valueWithInterval_(self["@repeatInterval"]);
  2021. return $1;
  2022. }, function($ctx1) {$ctx1.fill(self,"startRepeatingAction:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  2023. args: ["action"],
  2024. source: "startRepeatingAction: action\x0a\x09^ [ (widget hasFocus)\x0a\x09\x09ifTrue: [ action value ]\x0a\x09\x09ifFalse: [ self handleKeyUp ] ] valueWithInterval: repeatInterval",
  2025. messageSends: ["valueWithInterval:", "ifTrue:ifFalse:", "value", "handleKeyUp", "hasFocus"],
  2026. referencedClasses: []
  2027. }),
  2028. smalltalk.HLRepeatingKeyBindingHandler);
  2029. smalltalk.addMethod(
  2030. smalltalk.method({
  2031. selector: "unbindKeys",
  2032. category: 'actions',
  2033. fn: function (){
  2034. var self=this;
  2035. return smalltalk.withContext(function($ctx1) {
  2036. _st(self["@widget"])._unbindKeyDownUp();
  2037. return self}, function($ctx1) {$ctx1.fill(self,"unbindKeys",{},smalltalk.HLRepeatingKeyBindingHandler)})},
  2038. args: [],
  2039. source: "unbindKeys\x0a\x09widget unbindKeyDownUp",
  2040. messageSends: ["unbindKeyDownUp"],
  2041. referencedClasses: []
  2042. }),
  2043. smalltalk.HLRepeatingKeyBindingHandler);
  2044. smalltalk.addMethod(
  2045. smalltalk.method({
  2046. selector: "whileKeyPressed:do:",
  2047. category: 'accessing',
  2048. fn: function (aKey,aBlock){
  2049. var self=this;
  2050. return smalltalk.withContext(function($ctx1) {
  2051. _st(self["@keyBindings"])._at_put_(aKey,aBlock);
  2052. return self}, function($ctx1) {$ctx1.fill(self,"whileKeyPressed:do:",{aKey:aKey,aBlock:aBlock},smalltalk.HLRepeatingKeyBindingHandler)})},
  2053. args: ["aKey", "aBlock"],
  2054. source: "whileKeyPressed: aKey do: aBlock\x0a\x09keyBindings at: aKey put: aBlock",
  2055. messageSends: ["at:put:"],
  2056. referencedClasses: []
  2057. }),
  2058. smalltalk.HLRepeatingKeyBindingHandler);
  2059. smalltalk.addMethod(
  2060. smalltalk.method({
  2061. selector: "whileTheKeyIsPressedDo:",
  2062. category: 'events-processing',
  2063. fn: function (action){
  2064. var self=this;
  2065. return smalltalk.withContext(function($ctx1) {
  2066. self["@isKeyCurrentlyPressed"]=true;
  2067. _st(action)._value();
  2068. self["@delay"]=self._delayBeforeStartingRepeatWithAction_(action);
  2069. return self}, function($ctx1) {$ctx1.fill(self,"whileTheKeyIsPressedDo:",{action:action},smalltalk.HLRepeatingKeyBindingHandler)})},
  2070. args: ["action"],
  2071. source: "whileTheKeyIsPressedDo: action\x0a\x09isKeyCurrentlyPressed := true.\x0a\x09action value.\x0a\x09delay := self delayBeforeStartingRepeatWithAction: action",
  2072. messageSends: ["value", "delayBeforeStartingRepeatWithAction:"],
  2073. referencedClasses: []
  2074. }),
  2075. smalltalk.HLRepeatingKeyBindingHandler);
  2076. smalltalk.addMethod(
  2077. smalltalk.method({
  2078. selector: "widget:",
  2079. category: 'accessing',
  2080. fn: function (aWidget){
  2081. var self=this;
  2082. return smalltalk.withContext(function($ctx1) {
  2083. self["@widget"]=aWidget;
  2084. return self}, function($ctx1) {$ctx1.fill(self,"widget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBindingHandler)})},
  2085. args: ["aWidget"],
  2086. source: "widget: aWidget\x0a\x09widget := aWidget",
  2087. messageSends: [],
  2088. referencedClasses: []
  2089. }),
  2090. smalltalk.HLRepeatingKeyBindingHandler);
  2091. smalltalk.addMethod(
  2092. smalltalk.method({
  2093. selector: "forWidget:",
  2094. category: 'instance-creation',
  2095. fn: function (aWidget){
  2096. var self=this;
  2097. return smalltalk.withContext(function($ctx1) {
  2098. var $2,$3,$1;
  2099. $2=self._new();
  2100. _st($2)._widget_(aWidget);
  2101. $3=_st($2)._yourself();
  2102. $1=$3;
  2103. return $1;
  2104. }, function($ctx1) {$ctx1.fill(self,"forWidget:",{aWidget:aWidget},smalltalk.HLRepeatingKeyBindingHandler.klass)})},
  2105. args: ["aWidget"],
  2106. source: "forWidget: aWidget\x0a\x09^self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09yourself",
  2107. messageSends: ["widget:", "new", "yourself"],
  2108. referencedClasses: []
  2109. }),
  2110. smalltalk.HLRepeatingKeyBindingHandler.klass);
  2111. });