Skip to content

Commit

Permalink
Changed to Ace editor for Android and updated User Guide (#102).
Browse files Browse the repository at this point in the history
  • Loading branch information
gogins committed Aug 22, 2019
1 parent 60d27b5 commit 1e9bce2
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 754 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ set(CPACK_GENERATOR TGZ; DEB)
set(CPACK_PACKAGE_CONTACT "${CPACK_DEBIAN_PACKAGE_MAINTAINER}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_NAME "csound-extended-dev")
set(CPACK_PACKAGE_VERSION "1.3.4")
set(CPACK_PACKAGE_VERSION "1.3.5")
# set(CPACK_STRIP_FILES "YES")

set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/copyright.txt")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":CsoundAndroid" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../CsoundApplication" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.root.project.path="$MODULE_DIR$/../CsoundApplication" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

908 changes: 194 additions & 714 deletions CsoundForAndroid/CsoundForAndroid/CsoundApplication/.idea/workspace.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":CsoundApplication" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand All @@ -8,7 +8,7 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_BUILD_VARIANT" value="release" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
Expand Down Expand Up @@ -111,6 +111,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/validate_signing_config" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 28 Platform (1)" jdkType="Android SDK" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title></title>
<meta name="generator" content="LibreOffice 6.0.7.3 (Linux)"/>
<meta name="created" content="2013-06-11T00:00:00.020113632"/>
<meta name="changed" content="2019-08-19T20:59:04.585585460"/>
<meta name="changed" content="2019-08-22T14:29:58.891197245"/>
<meta name="created" content="00:00:00">
<meta name="created" content="00:00:00">
<style type="text/css">
Expand Down Expand Up @@ -33,7 +33,7 @@ <h1 class="western" align="center" style="margin-top: 0.08in; margin-bottom: 0in
<p align="center" style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
<i><b>Michael Gogins</b></i></p>
<p align="center" style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
<i><b>19 August 2019</b></i></p>
<i><b>22 August 2019</b></i></p>
<p align="center" style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
<br/>

Expand All @@ -58,8 +58,9 @@ <h1 class="western" style="line-height: 115%">Changes in This Version</h1>
CsoundOboe C++ class.</p>
<li/>
<p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
The app now has a built-in text editor based on CodeMirror. The
editor includes find and replace functions.</p>
The app now has a built-in text editor based on Ace, replacing
CodeMirror. The editor includes find and replace functions. The
editor now has specific modes for .csd files and .html files.</p>
<li/>
<p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
The user interface is tabbed for instantly switching between editing
Expand Down Expand Up @@ -133,9 +134,11 @@ <h1 class="western" style="margin-top: 0.08in; margin-bottom: 0in; line-height:
<ul>
<li/>
<p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
<i><b>Editor</b></i><span style="font-variant: normal"></span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">Provides
a built-in text editor based on CodeMirror, with find and replace
functionality.</span></span></span></p>
<i><b>Editor</b></i><span style="font-variant: normal"></span><span style="font-variant: normal"><font size="3" style="font-size: 12pt"><span style="font-style: normal"><span style="font-weight: normal">Provides
a built-in text editor based on </span></span></font></span><span style="font-variant: normal"><font size="3" style="font-size: 12pt"><span style="font-style: normal"><span style="font-weight: normal">Ace</span></span></font></span><span style="font-variant: normal"><font size="3" style="font-size: 12pt"><span style="font-style: normal"><span style="font-weight: normal">,
with find and replace functionalit</span></span></font></span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">y.
</span></span></span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">Press
Ctrl-F to invoke the find and replace dialog.</span></span></span></p>
<li/>
<p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
<i><b>Messages</b></i><span style="font-variant: normal"></span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">Shows
Expand All @@ -149,9 +152,10 @@ <h1 class="western" style="margin-top: 0.08in; margin-bottom: 0in; line-height:
<p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
<i><b>Widgets</b></i><span style="font-variant: normal">
</span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">Provides
a predefined set of </span></span></span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">9</span></span></span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">
sliders, 5 buttons, and a trackpad that send updates to predefined
Csound control channels. These widgets are backwards compatible with
a predefined set of 9</span></span></span><span style="font-variant: normal">
</span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">sliders,
5 buttons, and a trackpad that send updates to predefined Csound
control channels. These widgets are backwards compatible with
previous versions of the Csound for Android app.</span></span></span></p>
<li/>
<p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 115%">
Expand Down Expand Up @@ -202,18 +206,13 @@ <h1 class="western" style="margin-top: 0.08in; margin-bottom: 0in; line-height:
which should be a valid Linux pathname in the user's storage
filesystem.</font>
</p>
<li/>
<p><font face="Liberation Serif, serif"><i><b>Find... </b></i>
Search for a string of text in the editor.</font></p>
<li/>
<p><font face="Liberation Serif, serif"><i><b>Replace…</b></i>
– Replace a string of text in the editor.</font></p>
</ul>
<ul>
<li/>
<p><i><b>Examples</b></i> – Opens a submenu with various
built-in example pieces. These are saved in your device's external
public storage Music directory, and then run.</p>
<p style="margin-top: 0.04in; margin-bottom: 0.12in"><i><b>Examples</b></i>
– Opens a submenu with various built-in example pieces. These are
saved in your device's external public storage Music directory, and
then run.</p>
<li/>
<p style="line-height: 115%"><i><b>User guide</b></i>
Opens this basic user guide.</p>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@
editor.session.setMode("ace/mode/csound_document");
editor.setTheme("ace/theme/cobalt");

var setCodeMirrorText = function(mode) {
var setEmbeddedEditorText = function(mode) {
try {
var text = csoundApp.getCsoundText();
editor.session.setMode(mode);
editor.setValue(text);
editor.clearSelection();
return 'setCodeMirrorText';
return 'setEmbeddedEditorText';
} catch (e) {
return e.description;
}
};
var getCodeMirrorText = function() {
var getEmbeddedEditorText = function() {
try {
var text = editor.getValue();
csoundApp.setCsoundText(text);
return 'getCodeMirrorText ' + text;
return 'getEmbeddedEditorText ' + text;
} catch (e) {
return e.description;
}
}
var getCodeMirrorTextAndRun = function() {
var getEmbeddedEditorTextAndRun = function() {
try {
var text = editor.getValue();
csoundApp.setCsoundText(text);
return 'getCodeMirrorTextAndRun' + text;
return 'getEmbeddedEditorTextAndRun' + text;
} catch (e) {
return e.description;
}
}
var getCodeMirrorTextAndSave = function() {
var getEmbeddedEditorTextAndSave = function() {
try {
var text = codemirror_editor.getDoc().getValue();
csoundApp.setCsoundText(text);
return 'getCodeMirrorTextAndSave ' + text;
return 'getEmbeddedEditorTextAndSave ' + text;
} catch (e) {
return e.description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public void onCreate(Bundle savedInstanceState) {
editor.getSettings().setDisplayZoomControls(false);
editor.setWebViewClient(new CsoundWebViewClient());
editor.addJavascriptInterface(this, "csoundApp");
editor.loadUrl("file:///android_asset/codemirror_editor.html");
editor.loadUrl("file:///android_asset/embedded_editor.html");
editor.setBackgroundColor(0);
// Add slider handlers.
for (int i = 0; i < 9; i++) {
Expand Down Expand Up @@ -1106,23 +1106,23 @@ public void setEditorText(String text, String extension) {
if (extension.compareToIgnoreCase("html") == 0) {
mode = "ace/mode/html";
}
String snippet = "setCodeMirrorText(\"" + mode + "\");";
String snippet = "setEmbeddedEditorText(\"" + mode + "\");";
editor.evaluateJavascript(snippet, this);
}

public void getEditorText() {
Log.i("Csound:", "getEditorText...");
editor.evaluateJavascript("getCodeMirrorText();", this);
editor.evaluateJavascript("getEmbeddedEditorText();", this);
}

public void getEditorTextAndRun() {
Log.i("Csound:", "getEditorTextAndRun...");
editor.evaluateJavascript("getCodeMirrorTextAndRun();", this);
editor.evaluateJavascript("getEmbeddedEditorTextAndRun();", this);
}

public void getEditorTextAndSave() {
Log.i("Csound:", "getEditorTextAndSave...");
editor.evaluateJavascript("getCodeMirrorTextAndSave();", this);
editor.evaluateJavascript("getEmbeddedEditorTextAndSave();", this);
}

@JavascriptInterface
Expand Down Expand Up @@ -1200,9 +1200,9 @@ public void onTabReselected(Tab tab) {

@Override
public void onReceiveValue(String value) {
if (value.contains("getCodeMirrorTextAndRun")) {
if (value.contains("getEmbeddedEditorTextAndRun")) {
render();
} else if (value.contains("getCodeMirrorTextAndSave")) {
} else if (value.contains("getEmbeddedEditorTextAndSave")) {
saveTextToUri(code, csound_uri);
}
}
Expand Down
2 changes: 1 addition & 1 deletion CsoundForAndroid/CsoundForAndroid/CsoundForAndroid.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="CsoundForAndroid" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/CsoundApplication" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.root.project.path="$MODULE_DIR$/CsoundApplication" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down

0 comments on commit 1e9bce2

Please sign in to comment.