123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836 |
- smalltalk.addPackage('Helios-Workspace');
- smalltalk.addClass('HLCodeModel', smalltalk.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
- smalltalk.addMethod(
- "_announcer",
- smalltalk.method({
- selector: "announcer",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@announcer"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
- $1=self["@announcer"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeModel)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_defaultReceiver",
- smalltalk.method({
- selector: "defaultReceiver",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st((smalltalk.DoIt || DoIt))._new();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{}, smalltalk.HLCodeModel)})},
- messageSends: ["new"]}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_doIt_",
- smalltalk.method({
- selector: "doIt:",
- fn: function (someCode){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(_st(self)._environment())._eval_on_(someCode,_st(self)._receiver());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"doIt:",{someCode:someCode}, smalltalk.HLCodeModel)})},
- messageSends: ["eval:on:", "receiver", "environment"]}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_environment",
- smalltalk.method({
- selector: "environment",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@environment"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLCodeModel)})},
- messageSends: ["ifNil:", "environment", "current"]}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_environment_",
- smalltalk.method({
- selector: "environment:",
- fn: function (anEnvironment){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self["@environment"]=anEnvironment;
- return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel)})},
- messageSends: []}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_receiver",
- smalltalk.method({
- selector: "receiver",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@receiver"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@receiver"]=_st(self)._defaultReceiver();
- $1=self["@receiver"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeModel)})},
- messageSends: ["ifNil:", "defaultReceiver"]}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_receiver_",
- smalltalk.method({
- selector: "receiver:",
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self["@receiver"]=anObject;
- return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeModel)})},
- messageSends: []}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_subscribe_",
- smalltalk.method({
- selector: "subscribe:",
- fn: function (aWidget){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(aWidget)._subscribeTo_(_st(self)._announcer());
- return self}, function($ctx1) {$ctx1.fill(self,"subscribe:",{aWidget:aWidget}, smalltalk.HLCodeModel)})},
- messageSends: ["subscribeTo:", "announcer"]}),
- smalltalk.HLCodeModel);
- smalltalk.addMethod(
- "_on_",
- smalltalk.method({
- selector: "on:",
- fn: function (anEnvironment){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._environment_(anEnvironment);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel.klass)})},
- messageSends: ["environment:", "new", "yourself"]}),
- smalltalk.HLCodeModel.klass);
- smalltalk.addClass('HLCodeWidget', smalltalk.HLWidget, ['model', 'wrapper', 'code', 'editor'], 'Helios-Workspace');
- smalltalk.addMethod(
- "_announcer",
- smalltalk.method({
- selector: "announcer",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(_st(self)._model())._announcer();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["announcer", "model"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_clear",
- smalltalk.method({
- selector: "clear",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._contents_("");
- return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["contents:"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_contents",
- smalltalk.method({
- selector: "contents",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(self["@editor"])._getValue();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["getValue"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_contents_",
- smalltalk.method({
- selector: "contents:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self["@editor"])._setValue_(aString);
- return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
- messageSends: ["setValue:"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_currentLine",
- smalltalk.method({
- selector: "currentLine",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["getLine:", "line", "getCursor"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_currentLineOrSelection",
- smalltalk.method({
- selector: "currentLineOrSelection",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=_st(self["@editor"])._somethingSelected();
- if(smalltalk.assert($2)){
- $1=_st(self)._selection();
- } else {
- $1=_st(self)._currentLine();
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_doIt",
- smalltalk.method({
- selector: "doIt",
- fn: function (){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
var $1;
- _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
- result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
- _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
- $1=result;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
- messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_editor",
- smalltalk.method({
- selector: "editor",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=self["@editor"];
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
- messageSends: []}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_focus",
- smalltalk.method({
- selector: "focus",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(_st(self)._editor())._focus();
- return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["focus", "editor"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_inspectIt",
- smalltalk.method({
- selector: "inspectIt",
- fn: function (){
- var self=this;
- var newInspector;
- return smalltalk.withContext(function($ctx1) {
_st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
- newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
- _st(newInspector)._open();
- return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
- messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_makeInspectorOn_",
- smalltalk.method({
- selector: "makeInspectorOn:",
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$3,$1;
- $2=_st((smalltalk.HLInspector || HLInspector))._new();
- _st($2)._inspect_(anObject);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
- messageSends: ["inspect:", "new", "yourself"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_model",
- smalltalk.method({
- selector: "model",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@model"];
- if(($receiver = $2) == nil || $receiver == undefined){
- _st(self)._model_(_st((smalltalk.HLCodeModel || HLCodeModel))._new());
- $1=self["@model"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["ifNil:", "model:", "new"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_model_",
- smalltalk.method({
- selector: "model:",
- fn: function (aModel){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self["@model"]=aModel;
- return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
- messageSends: []}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_observeWrapper",
- smalltalk.method({
- selector: "observeWrapper",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self["@wrapper"])._onKeyDown_((function(e){
- return smalltalk.withContext(function($ctx2) {
return _st(self)._onKeyDown_(e);
- }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
- return self}, function($ctx1) {$ctx1.fill(self,"observeWrapper",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["onKeyDown:"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_onDoIt",
- smalltalk.method({
- selector: "onDoIt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._doIt();
- return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["doIt"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_onInspectIt",
- smalltalk.method({
- selector: "onInspectIt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._inspectIt();
- return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["inspectIt"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_onKeyDown_",
- smalltalk.method({
- selector: "onKeyDown:",
- fn: function (anEvent){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
if(anEvent.ctrlKey) {
- if(anEvent.keyCode === 80) { //ctrl+p
- self._onPrintIt();
- anEvent.preventDefault();
- return false;
- }
- if(anEvent.keyCode === 68) { //ctrl+d
- self._onDoIt();
- anEvent.preventDefault();
- return false;
- }
- if(anEvent.keyCode === 73) { //ctrl+i
- self._onInspectIt();
- anEvent.preventDefault();
- return false;
- }
- };
- return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLCodeWidget)})},
- messageSends: []}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_onPrintIt",
- smalltalk.method({
- selector: "onPrintIt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(self)._printIt();
- return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["printIt"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_print_",
- smalltalk.method({
- selector: "print:",
- fn: function (aString){
- var self=this;
- var start,stop,currentLine;
- return smalltalk.withContext(function($ctx1) {
currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
- start=_st((smalltalk.HashedCollection || HashedCollection))._new();
- _st(start)._at_put_("line",currentLine);
- _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
- _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
- return smalltalk.withContext(function($ctx2) {
_st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
- return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
- stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
- _st(stop)._at_put_("line",currentLine);
- _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
- _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
- _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
- _st(self["@editor"])._setSelection_end_(stop,start);
- return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
- messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_printIt",
- smalltalk.method({
- selector: "printIt",
- fn: function (){
- var self=this;
- var result;
- return smalltalk.withContext(function($ctx1) {
result=_st(self)._doIt();
- _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
- _st(self)._print_(_st(result)._printString());
- _st(self)._focus();
- return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
- messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_receiver",
- smalltalk.method({
- selector: "receiver",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(_st(self)._model())._receiver();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["receiver", "model"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_receiver_",
- smalltalk.method({
- selector: "receiver:",
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(_st(self)._model())._receiver_(anObject);
- return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
- messageSends: ["receiver:", "model"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_renderContentOn_",
- smalltalk.method({
- selector: "renderContentOn:",
- fn: function (html){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self["@code"]=_st(html)._textarea();
- _st(self)._setEditorOn_(_st(self["@code"])._element());
- _st(self)._observeWrapper();
- return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
- messageSends: ["textarea", "setEditorOn:", "element", "observeWrapper"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_selection",
- smalltalk.method({
- selector: "selection",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(self["@editor"])._getSelection();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["getSelection"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_selectionEnd",
- smalltalk.method({
- selector: "selectionEnd",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(_st(self["@code"])._element())._selectionEnd();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["selectionEnd", "element"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_selectionEnd_",
- smalltalk.method({
- selector: "selectionEnd:",
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(_st(self["@code"])._element())._selectionEnd_(anInteger);
- return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
- messageSends: ["selectionEnd:", "element"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_selectionStart",
- smalltalk.method({
- selector: "selectionStart",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1;
- $1=_st(_st(self["@code"])._element())._selectionStart();
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
- messageSends: ["selectionStart", "element"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_selectionStart_",
- smalltalk.method({
- selector: "selectionStart:",
- fn: function (anInteger){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(_st(self["@code"])._element())._selectionStart_(anInteger);
- return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
- messageSends: ["selectionStart:", "element"]}),
- smalltalk.HLCodeWidget);
- smalltalk.addMethod(
- "_setEditorOn_",
- smalltalk.method({
- selector: "setEditorOn:",
- fn: function (aTextarea){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
- theme: 'amber',
- lineNumbers: true,
- enterMode: 'flat',
- matchBrackets: true,
- electricChars: false
- });
- return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
- messageSends: []}),
- smalltalk.HLCodeWidget);
- smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
- smalltalk.addMethod(
- "_onKeyDown_",
- smalltalk.method({
- selector: "onKeyDown:",
- fn: function (anEvent){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $1,$2,$3;
- $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
- if(! smalltalk.assert($1)){
- return false;
- };
- $2=_st(anEvent)._ctrlKey();
- if(smalltalk.assert($2)){
- $3=_st(_st(anEvent)._keyCode()).__eq((83));
- if(smalltalk.assert($3)){
- _st(self)._onSave();
- _st(anEvent)._preventDefault();
- return false;
- };
- };
- return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
- messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"]}),
- smalltalk.HLSourceCodeWidget);
- smalltalk.addMethod(
- "_onSave",
- smalltalk.method({
- selector: "onSave",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
- messageSends: []}),
- smalltalk.HLSourceCodeWidget);
- smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
- smalltalk.addMethod(
- "_codeWidget",
- smalltalk.method({
- selector: "codeWidget",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$3,$4,$1;
- $2=self["@codeWidget"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
- _st($3)._model_(_st(_st(self)._model())._code());
- $4=_st($3)._yourself();
- self["@codeWidget"]=$4;
- $1=self["@codeWidget"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
- messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"]}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_model",
- smalltalk.method({
- selector: "model",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@model"];
- if(($receiver = $2) == nil || $receiver == undefined){
- _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
- $1=self["@model"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
- messageSends: ["ifNil:", "model:", "new"]}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_model_",
- smalltalk.method({
- selector: "model:",
- fn: function (aModel){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self["@model"]=aModel;
- _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
- _st(self)._observeCodeWidget();
- return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
- messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"]}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_observeCodeWidget",
- smalltalk.method({
- selector: "observeCodeWidget",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
- messageSends: []}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_onDoIt",
- smalltalk.method({
- selector: "onDoIt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
- messageSends: []}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_onInspectIt",
- smalltalk.method({
- selector: "onInspectIt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
- messageSends: []}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_onPrintIt",
- smalltalk.method({
- selector: "onPrintIt",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
- messageSends: []}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_renderContentOn_",
- smalltalk.method({
- selector: "renderContentOn:",
- fn: function (html){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
_st(html)._with_(_st(self)._codeWidget());
- return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
- messageSends: ["with:", "codeWidget"]}),
- smalltalk.HLWorkspace);
- smalltalk.addMethod(
- "_canBeOpenAsTab",
- smalltalk.method({
- selector: "canBeOpenAsTab",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return true;
- }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
- messageSends: []}),
- smalltalk.HLWorkspace.klass);
- smalltalk.addMethod(
- "_tabLabel",
- smalltalk.method({
- selector: "tabLabel",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return "Workspace";
- }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
- messageSends: []}),
- smalltalk.HLWorkspace.klass);
- smalltalk.addMethod(
- "_tabPriority",
- smalltalk.method({
- selector: "tabPriority",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
return (10);
- }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
- messageSends: []}),
- smalltalk.HLWorkspace.klass);
- smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
- smalltalk.addMethod(
- "_announcer",
- smalltalk.method({
- selector: "announcer",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@announcer"];
- if(($receiver = $2) == nil || $receiver == undefined){
- self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
- $1=self["@announcer"];
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
- messageSends: ["ifNil:", "new"]}),
- smalltalk.HLWorkspaceModel);
- smalltalk.addMethod(
- "_code",
- smalltalk.method({
- selector: "code",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@code"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
- messageSends: ["ifNil:", "on:", "environment"]}),
- smalltalk.HLWorkspaceModel);
- smalltalk.addMethod(
- "_environment",
- smalltalk.method({
- selector: "environment",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$1;
- $2=self["@environment"];
- if(($receiver = $2) == nil || $receiver == undefined){
- $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
- } else {
- $1=$2;
- };
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
- messageSends: ["ifNil:", "environment", "current"]}),
- smalltalk.HLWorkspaceModel);
- smalltalk.addMethod(
- "_environment_",
- smalltalk.method({
- selector: "environment:",
- fn: function (anEnvironment){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
self["@environment"]=anEnvironment;
- return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
- messageSends: []}),
- smalltalk.HLWorkspaceModel);
- smalltalk.addMethod(
- "_onKeyDown_",
- smalltalk.method({
- selector: "onKeyDown:",
- fn: function (anEvent){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
if(anEvent.ctrlKey) {
- if(anEvent.keyCode === 80) { //ctrl+p
- self._printIt();
- anEvent.preventDefault();
- return false;
- }
- if(anEvent.keyCode === 68) { //ctrl+d
- self._doIt();
- anEvent.preventDefault();
- return false;
- }
- if(anEvent.keyCode === 73) { //ctrl+i
- self._inspectIt();
- anEvent.preventDefault();
- return false;
- }
- };
- return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
- messageSends: []}),
- smalltalk.HLWorkspaceModel);
- smalltalk.addMethod(
- "_on_",
- smalltalk.method({
- selector: "on:",
- fn: function (anEnvironment){
- var self=this;
- return smalltalk.withContext(function($ctx1) {
var $2,$3,$1;
- $2=_st(self)._new();
- _st($2)._environment_(anEnvironment);
- $3=_st($2)._yourself();
- $1=$3;
- return $1;
- }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
- messageSends: ["environment:", "new", "yourself"]}),
- smalltalk.HLWorkspaceModel.klass);
|