Skip to content

Commit

Permalink
Merge pull request supercollider#5223 from supercollider/3.11
Browse files Browse the repository at this point in the history
Merge 3.11 into develop
  • Loading branch information
mossheim authored Oct 28, 2020
2 parents cc56c99 + be1f81b commit 157218e
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 114 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,56 @@ Release dates of 3.x versions:
- 3.10: 2018-11-24
- 3.11: 2020-03-08

3.11.2 (TBD)
============

We are now providing a "legacy macOS" binary that supports macOS 10.10 and above. It can be found where you normally
download SuperCollider ([#5190](https://github.com/supercollider/supercollider/pull/5190)).

### General: Fixed

In the help browser, Shift-Enter now evaluates code again! ([#4883](https://github.com/supercollider/supercollider/pull/4883))

Fixed faulty deployment of macOS app bundle due to bug in Qt utility
([#5187](https://github.com/supercollider/supercollider/pull/5187)).

Fixed support for Portaudio in build system with CMake 3.18
([#5206](https://github.com/supercollider/supercollider/pull/5206)).

Fixed support for building shared libscsynth on macOS and Linux
([#5215](https://github.com/supercollider/supercollider/pull/5215)).

General documentation improvements ([#5131](https://github.com/supercollider/supercollider/pull/5131), [#5136](https://github.com/supercollider/supercollider/pull/5136), [#5137](https://github.com/supercollider/supercollider/pull/5137), [#5141](https://github.com/supercollider/supercollider/pull/5141), [#5142](https://github.com/supercollider/supercollider/pull/5142), [#5173](https://github.com/supercollider/supercollider/pull/5173), [#5203](https://github.com/supercollider/supercollider/pull/5203)).

### General: Removed

Removed some unused code for old Android support ([#4975](https://github.com/supercollider/supercollider/pull/4975)).

### Class library: Fixed

Fixed a bug in Pfindur where the last event of the pattern could become "Rest-less"
([#5113](https://github.com/supercollider/supercollider/pull/5113)).

SynthDesc and SynthDescLib now restore metadata for SynthDefs
([#5122](https://github.com/supercollider/supercollider/pull/5122)).

Fixed an issue in output formatting for UnitTest:assertFloatEquals
([#5135](https://github.com/supercollider/supercollider/pull/5135)).

Pattern:record no longer ignores header and sample formats provided as arguments
([#5031](https://github.com/supercollider/supercollider/pull/5031)).

Pseg:embedInStream now returns 'inval' to match other patterns
([#5145](https://github.com/supercollider/supercollider/pull/5145)).

ProxySpace:copy also rebuilds the ProxySpace to copy referenced objects
([#5192](https://github.com/supercollider/supercollider/pull/5192)).

### Servers: Fixed

Supernova now correctly handles `/s_getn` with a control name instead of index
([#5182](https://github.com/supercollider/supercollider/pull/5182)).

3.11.1 (2020-08-19)
===================

Expand Down
14 changes: 4 additions & 10 deletions HelpSource/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ const init = () => {
lineWrapping: true,
viewportMargin: Infinity,
extraKeys: {
'Shift-Enter': evalLine
// noop: prevent both codemirror and the browser to handle Shift-Enter
'Shift-Enter': ()=>{},
// prevent only codemirror to handle Ctrl+D
'Ctrl-D': false
}
})

Expand All @@ -59,15 +62,6 @@ const init = () => {

}

const evalLine = () => {
// If we are not running in the SC IDE, do nothing.
if (!window.IDE) {
return;
}
// Ask IDE to eval line. Calls back to `selectLine()`
window.IDE.evaluateLine();
}

/* returns the code selection, line or region */
const selectRegion = (options = { flash: true }) => {
let range = window.getSelection().getRangeAt(0)
Expand Down
5 changes: 5 additions & 0 deletions QtCollider/factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

QC_DECLARE_QWIDGET_FACTORY(QLabel);

#ifdef SC_USE_QTWEBENGINE
# include "widgets/QcWebView.h"
QC_DECLARE_QWIDGET_FACTORY(WebView);
#endif

static void doLoadFactories() {
QC_ADD_FACTORY(QcDefaultWidget);
QC_ADD_FACTORY(QcHLayoutWidget);
Expand Down
56 changes: 28 additions & 28 deletions QtCollider/widgets/QcWebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

# include "QcWebView.h"
# include "../widgets/web_page.hpp"
# include "../QcWidgetFactory.h"
# include <QWebEnginePage>
# include <QWebEngineSettings>
# include <QWebEngineContextMenuData>
Expand All @@ -35,13 +34,10 @@
# include <QStyle>
# include <QWebEngineCallback>

QC_DECLARE_QWIDGET_FACTORY(WebView);

namespace QtCollider {

WebView::WebView(QWidget* parent): QWebEngineView(parent), _interpretSelection(false), _editable(false) {
WebView::WebView(QWidget* parent): QWebEngineView(parent), _editable(false) {
QtCollider::WebPage* page = new WebPage(this);
page->setDelegateReload(true);
setPage(page);
connectPage(page);

Expand All @@ -55,9 +51,7 @@ WebView::WebView(QWidget* parent): QWebEngineView(parent), _interpretSelection(f
page->action(QWebEnginePage::Paste)->setShortcut(QKeySequence::Paste);
page->action(QWebEnginePage::Reload)->setShortcut(QKeySequence::Refresh);

connect(this, SIGNAL(interpret(QString)), qApp, SLOT(interpret(QString)), Qt::QueuedConnection);

connect(this, SIGNAL(loadFinished(bool)), this, SLOT(updateEditable(bool)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(pageLoaded(bool)));
}

void WebView::connectPage(QtCollider::WebPage* page) {
Expand Down Expand Up @@ -159,7 +153,8 @@ void WebView::toPlainText(QcCallback* cb) const {
void WebView::runJavaScript(const QString& script, QcCallback* cb) {
if (page()) {
if (cb) {
page()->runJavaScript(script, cb->asFunctor());
// convert QVariant to string until we deal with QVariants
page()->runJavaScript(script, [cb](const QVariant& t) { cb->call(t.toString()); });
} else {
page()->runJavaScript(script, [](const QVariant&) {});
}
Expand Down Expand Up @@ -228,29 +223,34 @@ void WebView::contextMenuEvent(QContextMenuEvent* event) {
menu.exec(event->globalPos());
}

void WebView::keyPressEvent(QKeyEvent* e) {
int key = e->key();
int mods = e->modifiers();

if (_interpretSelection
&& (key == Qt::Key_Enter || (key == Qt::Key_Return && mods & (Qt::ControlModifier | Qt::ShiftModifier)))) {
QString selection = selectedText();
if (!selection.isEmpty()) {
Q_EMIT(interpret(selection));
return;
}
// webView's renderer keypresses don't arrive to webView
// duplicate them
bool WebView::eventFilter(QObject* obj, QEvent* event) {
if (event->type() == QEvent::KeyPress) {
// takes ownership of newEvent
QApplication::postEvent(this, new QKeyEvent(*static_cast<QKeyEvent*>(event)));
}

QWebEngineView::keyPressEvent(e);
event->ignore();
return false;
}

void WebView::updateEditable(bool ok) {
if (ok) {
if (_editable) {
page()->runJavaScript("document.documentElement.contentEditable = true");
} else {
page()->runJavaScript("document.documentElement.contentEditable = false");
}
// stop keypresses here to avoid duplicates in parents
bool WebView::event(QEvent* ev) {
if (ev->type() == QEvent::KeyPress)
return true;

return QWebEngineView::event(ev);
}

void WebView::pageLoaded(bool ok) { this->focusProxy()->installEventFilter(this); }

void WebView::setEditable(bool b) {
_editable = b;
if (_editable) {
page()->runJavaScript("document.documentElement.contentEditable = true");
} else {
page()->runJavaScript("document.documentElement.contentEditable = false");
}
}

Expand Down
22 changes: 7 additions & 15 deletions QtCollider/widgets/QcWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WebView : public QWebEngineView {

public:
Q_INVOKABLE void setFontFamily(int genericFontFamily, const QString& fontFamily);
Q_INVOKABLE void triggerPageAction(int action, bool checked);
Q_INVOKABLE void triggerPageAction(int action, bool checked = false);
Q_INVOKABLE QAction* pageAction(QWebEnginePage::WebAction) const;

// QWebEnginePage forwards
Expand All @@ -58,13 +58,12 @@ class WebView : public QWebEngineView {
Q_INVOKABLE void navigate(const QString& url);

public Q_SLOTS:
void findText(const QString& searchText, bool reversed, QtCollider::QcCallback* cb);
void findText(const QString& searchText, bool reversed, QtCollider::QcCallback* cb = nullptr);

Q_SIGNALS:
void linkActivated(const QString&, int, bool);
void jsConsoleMsg(const QString&, int, const QString&);
void reloadTriggered(const QString&);
void interpret(const QString& code);

// QWebEnginePage forwards
void linkHovered(const QString& url);
Expand Down Expand Up @@ -99,16 +98,9 @@ public Q_SLOTS:
bool delegateReload() const;
void setDelegateReload(bool);

Q_PROPERTY(bool enterInterpretsSelection READ interpretSelection WRITE setInterpretSelection);
bool interpretSelection() const { return _interpretSelection; }
void setInterpretSelection(bool b) { _interpretSelection = b; }

Q_PROPERTY(bool editable READ editable WRITE setEditable);
bool editable() const { return _editable; }
void setEditable(bool b) {
_editable = b;
updateEditable(true);
}
void setEditable(bool b);

// QWebEnginePage properties
Q_PROPERTY(QString requestedUrl READ requestedUrl)
Expand Down Expand Up @@ -140,19 +132,19 @@ public Q_SLOTS:
inline static QUrl urlFromString(const QString& str) { return QUrl::fromUserInput(str); }

protected:
virtual void keyPressEvent(QKeyEvent*);
virtual void contextMenuEvent(QContextMenuEvent*);
void contextMenuEvent(QContextMenuEvent*) override;
bool event(QEvent* ev) override;
bool eventFilter(QObject* obj, QEvent* event) override;

public Q_SLOTS:
void onPageReload();
void onRenderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus, int);
void onLinkClicked(const QUrl&, QWebEnginePage::NavigationType, bool);
void updateEditable(bool);
void pageLoaded(bool);

private:
void connectPage(QtCollider::WebPage* page);

bool _interpretSelection;
bool _editable;
};

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ See the [Raspberry Pi](README_RASPBERRY_PI.md) and [BeagleBone Black](README_BEA

SuperCollider is tested with:
- Windows 10 (32- and 64-bit) and MSVC 2017
- macOS 10.13 and Xcode 9.4
- macOS 10.13 with Xcode 9.4 and Xcode 10.1
- Ubuntu 14.04 and gcc 4.9

SuperCollider is known to support these platforms:
- Windows Vista, 7, 8, and 10
- macOS 10.13-10.15
- Ubuntu 14.04-18.04

We also provide a legacy macOS binary for macOS 10.10 and above using Qt 5.9.

SuperCollider has guaranteed support for:
- Windows 10
- MSVC 2017, 2019
Expand Down
24 changes: 21 additions & 3 deletions SCClassLibrary/Common/GUI/Base/QWebView.sc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WebView : View {

var <onLoadFinished, <onLoadFailed, <onLoadProgress, <onLoadStarted, <onLinkActivated, <onLinkHovered, <onReloadTriggered, <onJavaScriptMsg,
<onSelectionChanged, <onTitleChanged, <onUrlChanged, <onScrollPositionChanged, <onContentsSizeChanged, <onAudioMutedChanged,
<onRecentlyAudibleChanged;
<onRecentlyAudibleChanged, <enterInterpretsSelection = false;

*qtClass { ^'QtCollider::WebView'; }

Expand Down Expand Up @@ -107,6 +107,7 @@ WebView : View {
onReloadTriggered = func;
}

// this function is called by a javascript callback: see enterInterpretsSelection below
onInterpret {
|code|
code.interpret();
Expand Down Expand Up @@ -223,8 +224,25 @@ WebView : View {
url { ^this.getProperty('url') }
url_ { |url| this.setProperty('url', url) }

enterInterpretsSelection { ^this.getProperty('enterInterpretsSelection') }
enterInterpretsSelection_ { |b| this.setProperty('enterInterpretsSelection', b) }
enterInterpretsSelection_ { |b|
enterInterpretsSelection = b;
if(enterInterpretsSelection) {
this.keyDownAction = { |view, char, mods, u, keycode, key|
// 01000004 is Qt's keycode for Enter, needed on Mac
if((char == Char.ret).or(key == 0x01000004)){
case
{ mods.isShift } {
view.runJavaScript("selectLine()", this.onInterpret(_));
}
{ mods.isCtrl || mods.isCmd }{
view.runJavaScript("selectRegion()", this.onInterpret(_));
}
}
};
}{
this.keyDownAction = {}
}
}

editable { ^this.getProperty('editable') }
editable_ { |b| this.setProperty('editable', b) }
Expand Down
25 changes: 10 additions & 15 deletions SCClassLibrary/Common/GUI/tools/HelpBrowser.sc
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ HelpBrowser {
.resize_(1)
.string_(str)
.value_(openNewWin)
.action_({ |b| openNewWin = b.value; webView.overrideNavigation = openNewWin; });
.action_({ |b| openNewWin = b.value; });
} {
str = "Open links in same window";
w = str.bounds.width + 5;
Button.new( window, Rect(x, y, w, h) )
.resize_(1)
.states_([[str],["Open links in new window"]])
.value_(openNewWin.asInteger)
.action_({ |b| openNewWin = b.value.asBoolean; webView.overrideNavigation = openNewWin; });
.action_({ |b| openNewWin = b.value.asBoolean; });
};

x = 0;
Expand Down Expand Up @@ -223,6 +223,8 @@ HelpBrowser {
{ "Monospace" }
));

webView.overrideNavigation = true;

webView.onLoadFinished = {
this.stopAnim;
window.name = "SuperCollider Help: %".format(webView.title);
Expand All @@ -233,16 +235,13 @@ HelpBrowser {
webView.onLinkActivated = {|wv, url|
var redirected, newPath, oldPath;
redirected = this.redirectTextFile(url);

if (not(redirected)) {
if(openNewWin) {
#newPath, oldPath = [url,webView.url].collect {|x|
if(x.notEmpty) {x.findRegexp("(^\\w+://)?([^#]+)(#.*)?")[1..].flop[1][1]}
};

#newPath, oldPath = [url,webView.url].collect {|x|
if(x.notEmpty) {x.findRegexp("(^\\w+://)?([^#]+)(#.*)?")[1..].flop[1][1]}
};
if(newPath!=oldPath) {
HelpBrowser.new(newWin:true).goTo(url);

if(newPath != oldPath && openNewWin) {
HelpBrowser.new(newWin:openNewWin).goTo(url);
} {
this.goTo(url);
};
Expand Down Expand Up @@ -272,11 +271,7 @@ HelpBrowser {
};

webView.enterInterpretsSelection = true;
webView.keyDownAction = { arg view, char, mods;
if( (char.ascii == 13) && (mods.isCtrl || mods.isCmd || mods.isShift) ) {
view.tryPerform(\evaluateJavaScript,"selectLine()");
};
};

window.view.keyDownAction = { arg view, char, mods, uni, kcode, key;
var keyPlus, keyZero, keyMinus, keyEquals, keyF;
var modifier, zoomIn;
Expand Down
4 changes: 2 additions & 2 deletions SCVersion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

set(SC_VERSION_MAJOR 3)
set(SC_VERSION_MINOR 11)
set(SC_VERSION_PATCH 1)
set(SC_VERSION_TWEAK "")
set(SC_VERSION_PATCH 2)
set(SC_VERSION_TWEAK "-rc1")
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH}${SC_VERSION_TWEAK})

# Note: these are provided for backwards compatibility only. In the main project, PROJECT_VERSION_PATCH
Expand Down
Loading

0 comments on commit 157218e

Please sign in to comment.