2 var <stringColor, <font, <editable;
3 var <autohidesScrollers, <hasHorizontalScroller, <hasVerticalScroller, <textBounds;
4 var <usesTabToFocusNextView=true, <enterInterpretsSelection=true;
7 mouseUp {arg x, y, modifiers, buttonNumber, clickCount, clickPos;
8 mouseUpAction.value(this, x, y, modifiers, buttonNumber, clickCount, clickPos); }
10 doLinkAction { arg url, description;
11 linkAction.value(this, url, description);
15 ^this.getProperty(\string);
19 ^this.setString(str, -1);
23 ^this.getProperty(\selectedString);
27 this.setProperty(\selectedString, str);
31 ^this.getProperty(\selectedRangeLocation);
35 ^this.getProperty(\selectedRange);
39 ^this.getProperty(\path);
42 stringColor_ {arg color;
44 this.setStringColor(color,-1, 0);
47 setStringColor{arg color, rangeStart = -1, rangeSize = 0;
48 this.setProperty(\setTextColor, [color,rangeStart, rangeSize]);
52 this.setProperty(\setSyntaxColors);
57 this.setFont(font, -1, 0)
60 setFont{| font, rangestart = -1, rangesize=0|
61 this.setProperty(\setFont, [font, rangestart, rangesize]);
64 usesAutoInOutdent_{|bool|
65 this.setProperty(\setUsesAutoInOutdent, bool);
68 setString{|string, rangestart=0, rangesize=0|
69 this.setProperty(\insertStringInRange, [string, rangestart, rangesize]);
74 this.setProperty(\setEditable, bool);
80 usesTabToFocusNextView_{|bool|
81 usesTabToFocusNextView=bool;
82 this.setProperty(\usesTabToFocusNextView, bool);
84 enterInterpretsSelection_{|bool|
85 enterInterpretsSelection=bool;
86 this.setProperty(\enterExecutesSelection, bool);
88 autohidesScrollers_{|bool|
89 autohidesScrollers = bool;
90 this.setProperty(\setAutohidesScrollers, bool);
92 hasHorizontalScroller_{|bool|
93 hasHorizontalScroller = bool;
94 this.setProperty(\setHasHorizontalScroller, bool);
96 hasVerticalScroller_{|bool|
97 hasVerticalScroller = bool;
98 this.setProperty(\setHasVerticalScroller, bool);
103 this.setProperty(\textBounds, rect);
107 if ( path.contains( "SC://"), {
108 path = Help.findHelpFile( path.asRelativePath( "SC:/") );
111 if ( path.contains( "://" ).not, {
112 if ( path.first.asString != "/" ) { path = String.scDir +/+ path; };
113 path = "file://"++path;
115 path = path.replace(" ", "%20");
116 this.setProperty(\open, path);
119 *paletteExample{ arg parent, bounds;
120 ^this.new(parent, bounds).string_("The quick brown fox jumps over the lazy dog.");
124 SCMovieView : SCView{
125 var <rate, <loopMode, <muted, <path, <editable;
129 0 Playback runs forward and backward between both endpoints.
130 1 Restarts playback at beginning when end is reached.
131 2 Playback stops when end is reached.
135 this.setProperty(\start);
139 this.setProperty(\stop);
144 this.setProperty(\setMovie, moviePath);
149 this.setProperty(\setMuted, bool);
152 playSelectionOnly_{|bool|
153 this.setProperty(\setPlaysSelectionOnly, bool);
158 this.setProperty(\setRate, ratein);
163 this.setProperty(\setLoopMode, mode);
167 this.setProperty(\gotoEnd);
170 this.setProperty(\stepForward);
174 this.setProperty(\stepBack);
178 this.setProperty(\gotoBeginning);
182 this.setProperty(\setCurrentTime, time);
186 //"SCMovieView-currentTime is not implemented".warn;
187 ^this.getProperty(\getCurrentTime);
192 this.setProperty(\setEditable, bool);
195 showControllerAndAdjustSize{|show, adjust|
196 this.setProperty(\showControllerAndAdjustSize, [show, adjust]);
199 resizeWithMagnification{|size|
200 this.setProperty(\resizeWithMagnification, size)
204 this.setProperty(\copy);
207 this.setProperty(\clear);
210 this.setProperty(\cut);
213 this.setProperty(\paste);
216 *paletteExample{ arg parent, bounds;
217 ^this.new(parent, bounds).path_("Help/GUI/Cocoa-GUI/SCImage/flowers2.jpg");
224 var <>onLoadFinished, <>onLoadFailed, <onLinkActivated, <enterInterpretsSelection=true;
227 if ( path.contains( "SC://"), {
228 path = Help.findHelpFile( path.asRelativePath( "SC:/") );
231 if ( path.contains( "://" ).not, {
232 if ( path.first.asString != "/" ) { path = String.scDir +/+ path; };
233 path = "file://"++path;
235 path = path.replace(" ", "%20");
236 this.setProperty(\url, path);
239 url { ^this.getProperty(\url);}
241 title { ^this.getProperty(\title);}
243 forward { this.setProperty(\forward);}
245 back { this.setProperty(\back);}
247 reload { this.setProperty(\reload);}
249 didLoad { onLoadFinished.value(this); }
251 didFail { onLoadFailed.value(this); }
253 // Get the displayed content in html form.
254 html { ^this.getProperty(\html); }
257 html_ { arg htmlString;
258 this.setProperty(\html, htmlString);
261 editable_ { arg bool;
262 this.setProperty(\editable, bool);
265 selectedText { ^this.getProperty(\selectedText); }
267 // Try to extract plain text from html content and return it.
268 plainText { ^this.getProperty(\plainText); }
270 onLinkActivated_{|func|
271 onLinkActivated = func;
272 this.setProperty(\handleLinks, func.isNil);
275 linkActivated {|linkString| onLinkActivated.value(this, linkString) }
277 findText { arg string, reverse = false;
278 this.setProperty( \findText, [string, reverse] );
281 enterInterpretsSelection_{|bool|
282 enterInterpretsSelection=bool;
283 this.setProperty(\enterExecutesSelection, bool);
286 setFontFamily { arg generic, specific;
287 this.setProperty(\fontFamily, [generic, specific]);
290 *paletteExample{ arg parent, bounds;
291 ^this.new(parent, bounds).url_("http://supercollider.sourceforge.net");