2 newTextWindow { arg title="Untitled", makeListener=false;
3 Document.new(title, this, makeListener);
6 openHTMLFile{ arg selectionStart=0, selectionLength=0;
9 if (Platform.openHTMLFileAction.notNil) {
10 Platform.openHTMLFileAction.value(this, selectionStart, selectionLength);
14 webView = \QWebView.asClass;
16 webView = webView.new;
22 this.openDocument(selectionStart, selectionLength)
25 openDocument { arg selectionStart=0, selectionLength=0;
27 if(Document.implementationClass.notNil) {
28 Document.open(this, selectionStart, selectionLength);
32 ideClass = \ScIDE.asClass;
33 if ( ideClass.notNil ) {
34 if ( this.endsWith(".sc") || this.endsWith(".scd") ) {
35 ideClass.open(this, selectionStart, selectionLength);
44 this.drawAtPoint(Point(0,0), Font.default, Color.black);
46 drawAtPoint { arg point, font, color;
48 { this.prDrawAtPoint( point, font, color ) }
49 { Pen.stringAtPoint( this, point, font, color ) }
51 drawInRect { arg rect, font, color;
53 { this.prDrawInRect( rect, font, color ) }
54 { Pen.stringInRect( this, rect, font, color ) }
56 prDrawAtPoint { arg point, font, color;
60 prDrawInRect { arg rect, font, color;
64 drawCenteredIn { arg rect, font, color;
66 { this.drawAtPoint(this.bounds( font ).centerIn(rect), font, color) }
67 { Pen.stringCenteredIn( this, rect, font, color ) }
69 drawLeftJustIn { arg rect, font, color;
73 bounds = this.bounds( font );
74 pos = bounds.centerIn(rect);
75 pos.x = rect.left + 2;
76 this.drawAtPoint(pos, font, color);
78 { Pen.stringLeftJustIn( this, rect, font, color ) }
80 drawRightJustIn { arg rect, font, color;
84 bounds = this.bounds( font );
85 pos = bounds.centerIn(rect);
86 pos.x = rect.right - 2 - bounds.width;
87 this.drawAtPoint(pos, font, color);
89 { Pen.stringRightJustIn( this, rect, font, color ) }
93 if(GUI.id === \swing,{
94 // since Swing is not in svn and can't be easily updated
95 // let's put this temporary hack/if-statement here
96 // rather than pollute everybody else's code with hacks/if-statements
97 font = font ?? { Font.default };
98 ^Rect(0, 0, this.size * font.size * 0.52146, font.size * 1.25)
99 // width in Helvetica approx = string size * font size * 0.52146
100 // 0.52146 is average of all 32-127 ascii characters widths
102 ^GUI.stringBounds(this, font)
105 prBounds { arg rect, font;
107 ^this.primitiveFailed
112 ^SCDoc.findHelpFile(this);
120 if (Platform.openHelpFileAction.notNil) {
121 Platform.openHelpFileAction.value(this)
123 HelpBrowser.openHelpFor(this);
129 openDocument { arg selectionStart=0, selectionLength=0;
130 ^this.asString.openDocument(selectionStart, selectionLength)