Browse Source

read example scripts from .scm file (~alextee/zrythm-feature#253), add tests for them

agpl_proxy
Alexandros Theodotou 2 years ago
parent
commit
02c7674cdf
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 3
      data/meson.build
  2. 2
      data/scripts/README
  3. 54
      data/scripts/create-geonkick-with-fx-track.scm
  4. 28
      data/scripts/create-midi-track-with-notes.scm
  5. 4
      data/scripts/hello-world.scm
  6. 32
      data/scripts/meson.build
  7. 21
      data/scripts/print-all-tracks.scm
  8. 2
      doc/dev/meson.build
  9. 0
      doc/user/_static/css/custom_css.scss
  10. 15
      doc/user/_static/css/meson.build
  11. 11
      doc/user/_static/img/meson.build
  12. 4
      doc/user/_static/js/meson.build
  13. 15
      doc/user/_static/meson.build
  14. 17
      doc/user/appendix/meson.build
  15. 11
      doc/user/chords-and-scales/meson.build
  16. 4
      doc/user/conf.py.in
  17. 0
      doc/user/configuration/device-setup.rst
  18. 4
      doc/user/configuration/intro.rst
  19. 13
      doc/user/configuration/meson.build
  20. 0
      doc/user/configuration/preferences.rst
  21. 10
      doc/user/contributing/meson.build
  22. 10
      doc/user/credits/meson.build
  23. 17
      doc/user/editing/clip-editors/meson.build
  24. 18
      doc/user/editing/meson.build
  25. 16
      doc/user/editing/timeline/meson.build
  26. 12
      doc/user/exporting/meson.build
  27. 14
      doc/user/getting-started/meson.build
  28. 10
      doc/user/glossary/meson.build
  29. 10
      doc/user/invoking-from-command-line/meson.build
  30. 2470
      doc/user/locale/af_ZA/LC_MESSAGES/zrythm-manual.po
  31. 2470
      doc/user/locale/ar/LC_MESSAGES/zrythm-manual.po
  32. 662
      doc/user/locale/de/LC_MESSAGES/zrythm-manual.po
  33. 697
      doc/user/locale/el/LC_MESSAGES/zrythm-manual.po
  34. 659
      doc/user/locale/en_GB/LC_MESSAGES/zrythm-manual.po
  35. 659
      doc/user/locale/es/LC_MESSAGES/zrythm-manual.po
  36. 2470
      doc/user/locale/fa/LC_MESSAGES/zrythm-manual.po
  37. 662
      doc/user/locale/fr/LC_MESSAGES/zrythm-manual.po
  38. 659
      doc/user/locale/gl/LC_MESSAGES/zrythm-manual.po
  39. 2470
      doc/user/locale/hi/LC_MESSAGES/zrythm-manual.po
  40. 656
      doc/user/locale/it/LC_MESSAGES/zrythm-manual.po
  41. 727
      doc/user/locale/ja/LC_MESSAGES/zrythm-manual.po
  42. 2470
      doc/user/locale/ko/LC_MESSAGES/zrythm-manual.po
  43. 22
      doc/user/locale/meson.build
  44. 662
      doc/user/locale/nb_NO/LC_MESSAGES/zrythm-manual.po
  45. 656
      doc/user/locale/nl/LC_MESSAGES/zrythm-manual.po
  46. 2470
      doc/user/locale/pl/LC_MESSAGES/zrythm-manual.po
  47. 700
      doc/user/locale/pt/LC_MESSAGES/zrythm-manual.po
  48. 659
      doc/user/locale/pt_BR/LC_MESSAGES/zrythm-manual.po
  49. 673
      doc/user/locale/ru/LC_MESSAGES/zrythm-manual.po
  50. 656
      doc/user/locale/sv/LC_MESSAGES/zrythm-manual.po
  51. 662
      doc/user/locale/zh_CN/LC_MESSAGES/zrythm-manual.po
  52. 656
      doc/user/locale/zh_TW/LC_MESSAGES/zrythm-manual.po
  53. 167
      doc/user/meson.build
  54. 12
      doc/user/mixing/meson.build
  55. 10
      doc/user/modulators/meson.build
  56. 15
      doc/user/playback-and-recording/meson.build
  57. 12
      doc/user/plugins-files/audio-midi-files/meson.build
  58. 13
      doc/user/plugins-files/meson.build
  59. 15
      doc/user/plugins-files/plugins/meson.build
  60. 13
      doc/user/projects/meson.build
  61. 14
      doc/user/routing/meson.build
  62. 0
      doc/user/scripting/api/copy_guile_docs.sh
  63. 17
      doc/user/scripting/api/guile_gen_texi_docs.sh
  64. 80
      doc/user/scripting/api/meson.build
  65. 12
      doc/user/scripting/examples.rst.in
  66. 35
      doc/user/scripting/meson.build
  67. 13
      doc/user/theming/meson.build
  68. 29
      doc/user/tracks/meson.build
  69. 10
      doc/user/user-media/meson.build
  70. 17
      doc/user/zrythm-interface/meson.build
  71. 2
      git-packaging-hooks/commit-msg
  72. 1
      git-packaging-hooks/common.sh.inc
  73. 3
      inc/settings/settings.h
  74. 6
      inc/zrythm.h
  75. 31
      meson.build
  76. 4
      po/meson.build
  77. 17
      scripts/gen-gschema.scm
  78. 7
      scripts/meson.build
  79. 43
      src/gui/widgets/preferences.c
  80. 80
      src/gui/widgets/scripting_window.c
  81. 2
      src/guile/meson.build
  82. 4
      src/meson.build
  83. 1
      src/settings/settings.c
  84. 11
      src/zrythm.c
  85. 73
      tests/guile/script_runner.c
  86. 200
      tests/meson.build

3
data/meson.build

@ -130,4 +130,5 @@ install_data ( @@ -130,4 +130,5 @@ install_data (
install_dir: themesdir,
rename: prog_name_lowercase + '-theme.css')
subdir('windows')
subdir ('scripts')
subdir ('windows')

2
data/scripts/README

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
All scripts in this directory are in the public
domain (CC-0).

54
data/scripts/create-geonkick-with-fx-track.scm

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
;;; Create Geonkick with FX track
(use-modules
(actions create-tracks-action)
(actions port-connection-action)
(actions undo-manager)
(audio channel)
(audio port)
(audio track-processor)
(audio tracklist)
(audio track)
(plugins plugin)
(plugins plugin-manager))
(define zrythm-script
(lambda ()
(let*
((action
(create-tracks-action-new-with-plugin
;; track type (0 = instrument)
0
;; plugin to add
(plugin-manager-find-plugin-from-uri
"http://geontime.com/geonkick")
;; track pos to insert at
4
;; number of tracks to create
1)))
(undo-manager-perform action))
(let*
((action
(create-tracks-action-new-audio-fx
;; track pos to insert at
5
;; number of tracks to create
1)))
(undo-manager-perform action))
(let*
((geonkick-track (tracklist-get-track-at-pos 4))
(geonkick-channel (track-get-channel geonkick-track))
(geonkick (channel-get-instrument geonkick-channel))
(geonkick-mono-out (plugin-get-out-port geonkick 1))
(fx-track (tracklist-get-track-at-pos 5))
(fx-processor (track-get-processor fx-track))
(fx-stereo-in (track-processor-get-stereo-in fx-processor))
(fx-stereo-in-l (stereo-ports-get-port fx-stereo-in #t))
(fx-stereo-in-r (stereo-ports-get-port fx-stereo-in #f))
(action-1
(port-connection-action-new-connect
geonkick-mono-out fx-stereo-in-l))
(action-2
(port-connection-action-new-connect
geonkick-mono-out fx-stereo-in-r)))
(undo-manager-perform action-1)
(undo-manager-perform action-2)
(track-set-muted geonkick-track #t))))

28
data/scripts/create-midi-track-with-notes.scm

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
;;; Create MIDI track with notes
(use-modules (audio track)
(audio midi-note)
(audio midi-region)
(audio position)
(audio tracklist)
(project)
(zrythm))
(define zrythm-script
(lambda ()
(let* ((prj (zrythm-get-project))
(tracklist (project-get-tracklist prj))
(track-slot 3)
(track (midi-track-new track-slot "my midi track"))
(r-start-pos (position-new 1 1 1 0 0))
(r-end-pos (position-new 4 1 1 0 0))
(region (midi-region-new r-start-pos r-end-pos track-slot 0 0))
(mn-start-pos (position-new 2 1 1 0 0))
(mn-end-pos (position-new 3 1 1 0 0))
(note (midi-note-new region mn-start-pos mn-end-pos 80 90)))
(for-each
(lambda (pitch)
(let ((note (midi-note-new region mn-start-pos mn-end-pos pitch 90)))
(midi-region-add-midi-note region note)))
'(56 60 63))
(tracklist-insert-track tracklist track
track-slot)
(track-add-lane-region track region 0))))

4
data/scripts/hello-world.scm

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
;;; Hello world
(define zrythm-script
(lambda ()
(display "Hello, World!")))

32
data/scripts/meson.build

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
# Copyright (C) 2021 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of Zrythm
#
# Zrythm is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Zrythm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
data_script_filenames = [
# FIXME test fails
#'create-geonkick-with-fx-track.scm',
'create-midi-track-with-notes.scm',
'hello-world.scm',
'print-all-tracks.scm',
]
data_scripts = files (data_script_filenames)
foreach script : data_scripts
install_data (
script,
install_dir: scriptsdir)
endforeach

21
data/scripts/print-all-tracks.scm

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
;;; Print all tracks
;;;
;;; This is an example GNU Guile script using modules provided by Zrythm.
;;; See https://www.gnu.org/software/guile/ for more info about GNU Guile.
;;; See https://manual.zrythm.org/en/scripting/intro.html for more info
;;; about scripting in Zrythm.
(use-modules (audio track)
(audio tracklist)
(project)
(zrythm))
(define zrythm-script
(lambda ()
(let* ((prj (zrythm-get-project))
(tracklist (project-get-tracklist prj))
(num-tracks (tracklist-get-num-tracks tracklist)))
(let loop ((i 0))
(when (< i num-tracks)
(let ((track (tracklist-get-track-at-pos tracklist i)))
(display (track-get-name track))
(newline))
(loop (+ i 1)))))))

2
doc/dev/meson.build

@ -28,7 +28,7 @@ doxyfile_mcss = configure_file ( @@ -28,7 +28,7 @@ doxyfile_mcss = configure_file (
)
extra_dev_docs = files([
meson.source_root() / 'CONTRIBUTING.md',
meson_src_root / 'CONTRIBUTING.md',
'mainpage.h',
'cyaml_schemas.h',
'gtk_tips.md',

0
doc/user/custom_css.scss → doc/user/_static/css/custom_css.scss

15
doc/user/_static/css/meson.build

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
custom_css_target = custom_target (
'custom-css',
input: 'custom_css.scss',
output: 'custom.css',
command: [
sass, '@INPUT@', '@OUTPUT@',
]
)
run_target (
'manual_compile_css',
command : [
'echo', 'Compiled custom CSS',
],
depends: custom_css_target)

11
doc/user/_static/img/meson.build

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
c = run_command ([
'find', '.', '-name', '*.png',
])
png_files = c.stdout().strip().split('\n')
foreach f : png_files
configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

4
doc/user/_static/js/meson.build

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
configure_file (
copy: true,
input: 'bootstrap.min.js',
output: '@PLAINNAME@')

15
doc/user/_static/meson.build

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
copy_files = [
'favicon.ico',
'z.svg',
]
foreach f : copy_files
configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach
subdir ('css')
subdir ('img')
subdir ('js')

17
doc/user/appendix/meson.build

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
copy_files = [
'environment.rst',
'files-and-directories.rst',
'gnu-free-documentation-license.rst',
'intro.rst',
'menu-actions.rst',
'meson.build',
'shortcut-keys.rst',
'troubleshooting.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

11
doc/user/chords-and-scales/meson.build

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
copy_files = [
'intro.rst',
'overview.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

4
doc/user/conf.py → doc/user/conf.py.in

@ -30,7 +30,7 @@ author = 'The Zrythm contributors' @@ -30,7 +30,7 @@ author = 'The Zrythm contributors'
from subprocess import check_output
# The full version, including alpha/beta/rc tags
release = '1.0.0-alpha.12.0.1'
release = '@VERSION@'
# The short X.Y version
version = release[:-4]
@ -94,7 +94,7 @@ html_static_path = ['_static'] @@ -94,7 +94,7 @@ html_static_path = ['_static']
# a list of builtin themes.
#
# html_theme_path = ['./_themes']
html_theme_path = ['.']
html_theme_path = ['@HTML_THEME_PATH@']
html_theme = 'sphinx_zrythm_theme'
html_last_updated_fmt = ''

0
doc/user/configuration/device-setup/intro.rst → doc/user/configuration/device-setup.rst

4
doc/user/configuration/intro.rst

@ -10,6 +10,6 @@ Configuration @@ -10,6 +10,6 @@ Configuration
.. toctree::
:maxdepth: 4
preferences/intro
device-setup/intro
preferences
device-setup
additional-settings

13
doc/user/configuration/meson.build

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
copy_files = [
'additional-settings.rst',
'device-setup.rst',
'intro.rst',
'preferences.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

0
doc/user/configuration/preferences/intro.rst → doc/user/configuration/preferences.rst

10
doc/user/contributing/meson.build

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

10
doc/user/credits/meson.build

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

17
doc/user/editing/clip-editors/meson.build

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
copy_files = [
'audio-editor.rst',
'automation-editor.rst',
'chord-editor.rst',
'intro.rst',
'overview.rst',
'piano-roll.rst',
'ruler.rst',
'toolbar.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

18
doc/user/editing/meson.build

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
copy_files = [
'common-operations.rst',
'edit-tools.rst',
'intro.rst',
'overview.rst',
'quantization.rst',
'snapping-grid-options.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach
subdir ('clip-editors')
subdir ('timeline')

16
doc/user/editing/timeline/meson.build

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
copy_files = [
'arranger.rst',
'event-viewer.rst',
'intro.rst',
'overview.rst',
'ruler.rst',
'toolbar.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

12
doc/user/exporting/meson.build

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
copy_files = [
'audio-and-midi.rst',
'intro.rst',
'routing-graph.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

14
doc/user/getting-started/meson.build

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
copy_files = [
'getting-plugins.rst',
'intro.rst',
'installation.rst',
'running-zrythm.rst',
'system-requirements.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

10
doc/user/glossary/meson.build

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

10
doc/user/invoking-from-command-line/meson.build

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

2470
doc/user/locale/af_ZA/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

2470
doc/user/locale/ar/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

662
doc/user/locale/de/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

697
doc/user/locale/el/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

659
doc/user/locale/en_GB/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

659
doc/user/locale/es/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

2470
doc/user/locale/fa/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

662
doc/user/locale/fr/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

659
doc/user/locale/gl/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

2470
doc/user/locale/hi/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

656
doc/user/locale/it/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

727
doc/user/locale/ja/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

2470
doc/user/locale/ko/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

22
doc/user/locale/meson.build

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
# Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of Zrythm
#
@ -16,12 +16,32 @@ @@ -16,12 +16,32 @@
# along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
# Test PO files for errors.
# copy locales to builddir
copy_locales_targets = []
# note: if this fails, run the manual_gettext
# target to generate missing .po files
foreach lang, lang_str : locales
if msgfmt.found () and lang != 'en'
po_file = 'zrythm-manual.po'
po_file_parent = lang / 'LC_MESSAGES'
po_file_path = lang / 'LC_MESSAGES' / po_file
# copy to build dir
copy_locales_targets += custom_target (
'copy ' + lang + ' messages',
output: 'copy_' + lang + '_messages',
command: [
'mkdir', '-p',
meson.current_build_dir () / po_file_parent,
'&&',
'cp',
meson.current_source_dir () / po_file_path,
meson.current_build_dir () / po_file_path,
'&&', 'touch', '@OUTPUT@',
],
)
if fs.exists (po_file_path)
test (
'user-manual-' + lang + '-po',

662
doc/user/locale/nb_NO/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

656
doc/user/locale/nl/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

2470
doc/user/locale/pl/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

700
doc/user/locale/pt/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

659
doc/user/locale/pt_BR/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

673
doc/user/locale/ru/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

656
doc/user/locale/sv/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

662
doc/user/locale/zh_CN/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

656
doc/user/locale/zh_TW/LC_MESSAGES/zrythm-manual.po

File diff suppressed because it is too large Load Diff

167
doc/user/meson.build

@ -27,109 +27,6 @@ if get_option ('strict_sphinx_opts') @@ -27,109 +27,6 @@ if get_option ('strict_sphinx_opts')
sphinx_build_opts = '-E -W -T'
endif
# used to only create guile docs when possible,
# otherwise reuse what is already there
can_make_guile_docs = guile_dep.found () and get_option ('guile_snarf_docs_path') != ''
# Create custom targets (each API .rst file) and save
# them in guile_docs
guile_docs = []
if can_make_guile_docs
foreach snarfable_src : guile_snarfable_srcs
split_by_dot = snarfable_src.split('.')
without_ext = ''
foreach sp : split_by_dot
if sp == split_by_dot[split_by_dot.length() - 2]
without_ext += sp
elif sp != split_by_dot[split_by_dot.length() - 1]
without_ext += sp + '.'
endif
endforeach
base_file = ' '.join(without_ext.split (
meson.source_root ())[1].split('/'))
base_file = base_file.split('src guile ')[1]
rst_file = base_file + '.rst'
texi_file = '-'.join (base_file.split ('_')) + '.texi'
texi_doc = custom_target (
texi_file,
output: texi_file,
input: [
snarfable_src,
meson.source_root () / 'scripts' / 'guile_gen_texi_docs.sh',
],
command: [
'@INPUT1@',
get_option ('guile_snarf_docs_path'),
guile_dep.name(), '@INPUT0@',
meson.build_root () / '@OUTPUT@',
meson.build_root () / '@PRIVATE_DIR@',
guild.full_path (),
'-I' + meson.source_root () / 'inc',
],
)
rst_doc = custom_target (
rst_file,
output: rst_file,
input: [
texi_doc,
meson.build_root () / 'scripts' / 'guile-gen-docs.scm',
],
command: [
'@INPUT1@',
guile_dep.name(),
meson.build_root () / '@INPUT0@',
meson.build_root () / '@OUTPUT@',
meson.build_root () / '@PRIVATE_DIR@',
],
)
guile_docs += rst_doc
endforeach
endif
# copy the Guile API docs to scripting/api in the
# source code (note: this edits rst source code)
copy_guile_docs_sh = configure_file (
output: 'copy_guile_docs.sh',
input: 'copy_guile_docs.sh',
configuration: {
'BASH': bash.full_path (),
'GUILE_DOCS_SRCDIR': meson.current_build_dir (),
'GUILE_DOCS_DESTDIR': meson.current_source_dir () / 'scripting' / 'api',
})
copy_guile_docs_target = custom_target (
'guile_localized_docs',
output: 'guile_localized_docs',
input: copy_guile_docs_sh,
command: '@INPUT@',
depends: [
guile_docs,
])
custom_css_target = custom_target (
'custom-css',
input: [
'custom_css.scss',
],
output: 'custom_css_created',
command: [
'mkdir', '-p',
meson.current_source_dir () / '_static/css',
'&&',
sass, '@INPUT@',
meson.current_source_dir () / '_static/css/custom.css',
'&&', 'touch', '@OUTPUT@' ]
)
run_target (
'manual_compile_css',
command : [
'echo', 'Compiled custom CSS',
],
depends: custom_css_target)
src_rst_files = files ([
'index.rst',
])
rtd_theme_files = files ([
'sphinx_zrythm_theme/layout.html',
'sphinx_zrythm_theme/search.html',
@ -142,10 +39,48 @@ run_sphinx_build = configure_file ( @@ -142,10 +39,48 @@ run_sphinx_build = configure_file (
'BASH': bash.full_path (),
})
c = run_command ([
'find', '.', '-name', '*.rst',
])
rst_files = c.stdout().strip().split('\n')
subdir ('locale')
index_rst = configure_file (
copy: true,
input: 'index.rst',
output: '@PLAINNAME@')
rst_files = [ index_rst ]
subdir ('_static')
subdir ('appendix')
subdir ('chords-and-scales')
subdir ('configuration')
subdir ('contributing')
subdir ('credits')
subdir ('editing')
subdir ('exporting')
subdir ('getting-started')
subdir ('glossary')
subdir ('invoking-from-command-line')
subdir ('mixing')
subdir ('modulators')
subdir ('playback-and-recording')
subdir ('plugins-files')
subdir ('projects')
subdir ('routing')
subdir ('scripting')
subdir ('theming')
subdir ('tracks')
subdir ('user-media')
subdir ('zrythm-interface')
conf_py = configure_file (
output: 'conf.py',
input: 'conf.py.in',
configuration: {
'VERSION': meson.project_version (),
'HTML_THEME_PATH': meson.current_source_dir (),
})
generated_rst_files = [
scripting_examples_rst,
]
# create run targets for each lang/format combination
# and custom targets for each language for html
@ -165,11 +100,14 @@ foreach lang, lang_str : locales @@ -165,11 +100,14 @@ foreach lang, lang_str : locales
run_sphinx_build,
sphinx_build.full_path(),
sphinx_build_opts,
lang, format, meson.current_source_dir (),
lang, format, meson.current_build_dir (),
output_dir,
]
deps = [ custom_css_target ]
deps = [
custom_css_target,
copy_locales_targets,
]
if can_make_guile_docs
deps += copy_guile_docs_target
endif
@ -183,9 +121,9 @@ foreach lang, lang_str : locales @@ -183,9 +121,9 @@ foreach lang, lang_str : locales
html_manual = custom_target (
name,
depend_files: [
'conf.py', src_rst_files,
conf_py, rst_files,
rtd_theme_files,
rst_files,
generated_rst_files,
],
output: name,
command: [ command, '@OUTPUT@', ],
@ -214,10 +152,11 @@ manual_gettext_gen_pot = custom_target ( @@ -214,10 +152,11 @@ manual_gettext_gen_pot = custom_target (
command: [
sphinx_build,
'-M', 'gettext',
meson.current_source_dir (),
meson.current_build_dir (),
sphinx_builddir,
],
depends: can_make_guile_docs ? copy_guile_docs_target : [],
depend_files: rst_files,
)
sphinx_intl_update_targets = []
@ -298,7 +237,7 @@ bundle_manual_target = custom_target ( @@ -298,7 +237,7 @@ bundle_manual_target = custom_target (
bundle_manual_sh,
],
command: [
'@INPUT0@', locales_str,
bundle_manual_sh, locales_str,
meson.current_build_dir () / '_rendered',
sphinx_builddir, '@OUTPUT@',
'@PRIVATE_DIR@',
@ -333,5 +272,3 @@ run_target ( @@ -333,5 +272,3 @@ run_target (
)
endif
subdir ('locale')

12
doc/user/mixing/meson.build

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
copy_files = [
'intro.rst',
'overview.rst',
'routing.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

10
doc/user/modulators/meson.build

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

15
doc/user/playback-and-recording/meson.build

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
copy_files = [
'bpm-and-time-signatures.rst',
'intro.rst',
'loop-points-and-markers.rst',
'overview.rst',
'recording.rst',
'transport-controls.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

12
doc/user/plugins-files/audio-midi-files/meson.build

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
copy_files = [
'file-browser.rst',
'intro.rst',
'overview.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

13
doc/user/plugins-files/meson.build

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach
subdir ('audio-midi-files')
subdir ('plugins')

15
doc/user/plugins-files/plugins/meson.build

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
copy_files = [
'inspector-page.rst',
'intro.rst',
'plugin-browser.rst',
'plugin-info.rst',
'plugin-window.rst',
'scanning.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

13
doc/user/projects/meson.build

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
copy_files = [
'intro.rst',
'project-info.rst',
'project-management-and-compatibility.rst',
'saving-loading.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

14
doc/user/routing/meson.build

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
copy_files = [
'control-room.rst',
'inserts-sends.rst',
'intro.rst',
'making-connections.rst',
'ports.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

0
doc/user/copy_guile_docs.sh → doc/user/scripting/api/copy_guile_docs.sh

17
scripts/guile_gen_texi_docs.sh → doc/user/scripting/api/guile_gen_texi_docs.sh

@ -33,15 +33,22 @@ OTHER_INCLUDES=$7 @@ -33,15 +33,22 @@ OTHER_INCLUDES=$7
input_file_base=$(basename $INPUT_FILE)
input_file_base_noext=$(echo "$input_file_base" | cut -f 1 -d '.')
cd $(dirname $GUILE_SNARF_DOCS_BIN)
mkdir -p "$PRIVATE_DIR"
# change to abs paths
output_file="`pwd`/$OUTPUT_FILE"
private_dir="`pwd`/$PRIVATE_DIR"
pushd $(dirname $GUILE_SNARF_DOCS_BIN)
mkdir -p "$private_dir"
# snarf docs out of the C file into a doc file
echo "Snarfing docs out of <$INPUT_FILE> to <$private_dir/$input_file_base_noext.doc>"
$GUILE_SNARF_DOCS_BIN -o \
"$PRIVATE_DIR/$input_file_base_noext.doc" \
"$private_dir/$input_file_base_noext.doc" \
$INPUT_FILE -- \
"$OTHER_INCLUDES" \
$(pkg-config --cflags-only-I $GUILE_PKGCONF_NAME)
# convert to texi
cat "$PRIVATE_DIR/$input_file_base_noext.doc" | \
echo "Converting <$private_dir/$input_file_base_noext.doc> to <$output_file>"
cat "$private_dir/$input_file_base_noext.doc" | \
$GUILD_BIN snarf-check-and-output-texi > \
"$OUTPUT_FILE"
"$output_file"
popd

80
doc/user/scripting/api/meson.build

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
# used to only create guile docs when possible,
# otherwise reuse what is already there
can_make_guile_docs = guile_dep.found () and get_option ('guile_snarf_docs_path') != ''
# Create custom targets (each API .rst file) and save
# them in guile_docs
guile_docs = []
if can_make_guile_docs
gen_texi_docs_sh = find_program (
'guile_gen_texi_docs.sh')
foreach snarfable_src : guile_snarfable_srcs
split_by_dot = snarfable_src.split('.')
without_ext = ''
foreach sp : split_by_dot
if sp == split_by_dot[split_by_dot.length() - 2]
without_ext += sp
elif sp != split_by_dot[split_by_dot.length() - 1]
without_ext += sp + '.'
endif
endforeach
base_file = ' '.join(without_ext.split (
meson_src_root)[1].split('/'))
base_file = base_file.split('src guile ')[1]
rst_file = base_file + '.rst'
texi_file = '-'.join (base_file.split ('_')) + '.texi'
texi_doc = configure_file (
output: texi_file,
command: [
gen_texi_docs_sh,
get_option ('guile_snarf_docs_path'),
guile_dep.name(), snarfable_src,
texi_file, texi_file + '.p',
guild.full_path (),
'-I' + meson_src_root / 'inc',
],
)
rst_doc = configure_file (
output: rst_file,
input: texi_doc,
command: [
guile_gen_docs_scm,
guile_dep.name(),
meson.current_build_dir () / texi_file,
meson.current_build_dir () / rst_file,
meson.current_build_dir () / rst_file + '.p',
],
)
rst_files += rst_doc
guile_docs += rst_doc
endforeach
endif
# copy the Guile API docs to /api in the
# source code (note: this edits rst source code)
copy_guile_docs_sh = configure_file (
output: 'copy_guile_docs.sh',
input: 'copy_guile_docs.sh',
configuration: {
'BASH': bash.full_path (),
'GUILE_DOCS_SRCDIR': meson.current_build_dir (),
'GUILE_DOCS_DESTDIR': meson.current_source_dir (),
})
copy_guile_docs_target = custom_target (
'guile_localized_docs',
output: 'guile_localized_docs',
command: copy_guile_docs_sh,
depend_files: [
guile_docs,
])
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

12
doc/user/scripting/examples.rst.in

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
.. This is part of the Zrythm Manual.
Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
See the file index.rst for copying conditions.
Examples
========
The following examples are in the public domain
(`CC 0 <https://creativecommons.org/publicdomain/zero/1.0/>`_).
Feel free to copy and modify them.
@SCRIPTS@

35
doc/user/scripting/meson.build

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
script_contents = ''
foreach script : data_script_filenames
path = meson_src_root / 'data/scripts' / script
content = fs.read (path)
content_lines = content.split ('\n')
title = content_lines[0].substring (4)
script_contents += title + '\n'
script_contents += '-------------------------------------------------------------------------------'
script_contents += '\n\n'
script_contents += '.. code-block:: scheme\n\n'
foreach line : content.split('\n')
script_contents += ' ' + line + '\n'
endforeach
script_contents += '\n'
endforeach
scripting_examples_rst = configure_file (
output: 'examples.rst',
input: 'examples.rst.in',
configuration: { 'SCRIPTS': script_contents })
copy_files = [
'intro.rst',
'overview.rst',
'scripting-interface.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach
subdir ('api')

13
doc/user/theming/meson.build

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
copy_files = [
'css.rst',
'icon-themes.rst',
'intro.rst',
'overview.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

29
doc/user/tracks/meson.build

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
copy_files = [
'audio-track.rst',
'bus-track-audio.rst',
'chord-track.rst',
'group-track-audio.rst',
'inspector-page.rst',
'intro.rst',
'master-track.rst',
'modulator-track.rst',
'tempo-track.rst',
'track-types.rst',
'automation.rst',
'bus-track-midi.rst',
'creating-tracks.rst',
'group-track-midi.rst',
'instrument-track.rst',
'marker-track.rst',
'midi-track.rst',
'overview.rst',
'track-operations.rst',
'track-visibility.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

10
doc/user/user-media/meson.build

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
copy_files = [
'intro.rst',
]
foreach f : copy_files
rst_files += configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

17
doc/user/zrythm-interface/meson.build

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
copy_files = [
'bottom-panel.rst',
'intro.rst',
'left-panel.rst',
'main-toolbar.rst',
'right-panel.rst',
'timeline.rst',
'transport-bar.rst',
'zrythm-interface-overview.rst',
]
foreach f : copy_files
configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach

2
git-packaging-hooks/commit-msg vendored

@ -43,8 +43,6 @@ then (($IS_EMPTY_COMMIT_MSG)) && TraceError "empty commit message - aborting com @@ -43,8 +43,6 @@ then (($IS_EMPTY_COMMIT_MSG)) && TraceError "empty commit message - aborting com
#sed --in-place "s/^AC_INIT(.*$/AC_INIT($ac_init_params)/" $VERSION_FILE
sed --in-place "21s/ version: '.*$/ version: '$VERSION',/" $VERSION_FILE
sed --in-place "4s/\[\([^]]*\)\]/\[$VERSION\]/" CHANGELOG.md
# FIXME use version from meson
sed --in-place "s/release = '.*$/release = '$VERSION'/" $USER_MANUAL_CONF_FILE
TraceStage "completed staging-specific pre-commit hooks"
elif (($IS_PACKAGING_BRANCH))

1
git-packaging-hooks/common.sh.inc vendored

@ -41,7 +41,6 @@ function init() @@ -41,7 +41,6 @@ function init()
# files to modify
readonly VERSION_FILE=meson.build
readonly CHANGELOG_FILE=CHANGELOG.md
readonly USER_MANUAL_CONF_FILE=doc/user/conf.py
# detect commit to staging or packaging branch
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

3
inc/settings/settings.h

@ -68,6 +68,8 @@ @@ -68,6 +68,8 @@
SETTINGS->preferences_projects_general
#define S_P_UI_GENERAL \
SETTINGS->preferences_ui_general
#define S_P_SCRIPTING_GENERAL \
SETTINGS->preferences_scripting_general
/* ---- end preferences ---- */
@ -101,6 +103,7 @@ typedef struct Settings @@ -101,6 +103,7 @@ typedef struct Settings
GSettings * preferences_plugins_paths;
GSettings * preferences_projects_general;
GSettings * preferences_ui_general;
GSettings * preferences_scripting_general;
/**
* UI memory.

6
inc/zrythm.h

@ -95,6 +95,9 @@ typedef enum ZrythmDirType @@ -95,6 +95,9 @@ typedef enum ZrythmDirType
/** Samples. */
ZRYTHM_DIR_SYSTEM_SAMPLESDIR,
/** Scripts. */
ZRYTHM_DIR_SYSTEM_SCRIPTSDIR,
/** Themes. */
ZRYTHM_DIR_SYSTEM_THEMESDIR,
@ -115,6 +118,9 @@ typedef enum ZrythmDirType @@ -115,6 +118,9 @@ typedef enum ZrythmDirType
ZRYTHM_DIR_USER_TEMPLATES,
ZRYTHM_DIR_USER_THEMES,
/** User scripts. */
ZRYTHM_DIR_USER_SCRIPTS,
/** Log files. */
ZRYTHM_DIR_USER_LOG,

31
meson.build

@ -19,7 +19,7 @@ project ( @@ -19,7 +19,7 @@ project (
'zrythm', ['c', 'cpp'],
version: '1.0.0-alpha.12.0.1',
license: 'AGPL-3-or-later',
meson_version: '>= 0.55.0',
meson_version: '>= 0.57.0',
default_options: [
'warning_level=2',
'buildtype=debugoptimized',
@ -27,6 +27,9 @@ project ( @@ -27,6 +27,9 @@ project (
],
)
meson_src_root = meson.current_source_dir ()
meson_build_root = meson.current_build_dir ()
prog_name = get_option ('program_name')
prog_name_lowercase = prog_name.to_lower()
@ -49,6 +52,7 @@ fontsdir = datadir / 'fonts' / prog_name_lowercase @@ -49,6 +52,7 @@ fontsdir = datadir / 'fonts' / prog_name_lowercase
zrythmdatadir = datadir / prog_name_lowercase
themesdir = zrythmdatadir / 'themes'
samplesdir = zrythmdatadir / 'samples'
scriptsdir = zrythmdatadir / 'scripts'
docdir = datadir / 'doc' / prog_name_lowercase
sourceviewstylesdir = zrythmdatadir / 'sourceview-styles'
@ -166,11 +170,9 @@ if get_option ('installer_ver') @@ -166,11 +170,9 @@ if get_option ('installer_ver')
cdata.set ('INSTALLER_VER', 1)
endif
cdata.set (
'MESON_SOURCE_ROOT',
meson.source_root ())
'MESON_SOURCE_ROOT', meson_src_root)
cdata.set (
'MESON_BUILD_ROOT',
meson.build_root ())
'MESON_BUILD_ROOT', meson_build_root)
cdata.set_quoted (
'ISSUE_TRACKER_URL',
'https://sr.ht/~alextee/zrythm/trackers')
@ -209,8 +211,8 @@ all_inc = [ @@ -209,8 +211,8 @@ all_inc = [
suil_inc,
]
resources_dir = meson.source_root () / 'resources'
data_dir = meson.source_root () / 'data'
resources_dir = meson_src_root / 'resources'
data_dir = meson_src_root / 'data'
cc = meson.get_compiler ('c')
@ -1033,6 +1035,21 @@ else @@ -1033,6 +1035,21 @@ else
zrythm_deps += x11_dep
endif
# copy doc files to build dir
root_doc_files = [
'HACKING.md',
'AUTHORS',
'TRANSLATORS',
'THANKS',
'INSTALL.md',
]
foreach f : root_doc_files
configure_file (
copy: true,
input: f,
output: '@PLAINNAME@')
endforeach
# create config.h
tmp_h = configure_file (
output: 'tmp.h',

4
po/meson.build

@ -25,7 +25,7 @@ add_project_arguments ( @@ -25,7 +25,7 @@ add_project_arguments (
i18n.gettext (
meson.project_name(),
args: [
'--directory=' + meson.source_root(),
'--directory=' + meson_src_root,
'--msgid-bugs-address=https://redmine.zrythm.org/projects/zrythm/issues/new',
'--add-comments',
'--keyword=__',
@ -36,7 +36,7 @@ i18n.gettext ( @@ -36,7 +36,7 @@ i18n.gettext (
collect_translatables = run_target (
'collect-translatables',
command: [
meson.source_root () / 'scripts' / 'collect_translatables.sh',
meson_src_root / 'scripts/collect_translatables.sh',
],
)

17
scripts/gen-gschema.scm

@ -909,6 +909,23 @@ Args: @@ -909,6 +909,23 @@ Args:
)) ;; dsp/pan
))) ;; dsp
(preferences-category-print
(make-preferences-category
"scripting"
(list
(make-schema
"general"
(list
(make-schema-key
"info" "ai" "[6,0]"
"Scripting" "General")
(make-schema-key
"default-script" "s" "print-all-tracks.scm"
"Default script"
"The default script to use in the scripting window.")
)) ;; scripting/general
))) ;; scripting
(display "</schemalist>"))))))
(apply main (program-arguments))

7
scripts/meson.build

@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
scripts_conf = {
'SCRIPTS_DIR': meson.current_build_dir (),
'MESON_BUILD_ROOT': meson.build_root (),
'MESON_SOURCE_ROOT': meson.source_root (),
'MESON_BUILD_ROOT': meson_build_root,
'MESON_SOURCE_ROOT': meson_src_root,
}
if os_windows
scripts_conf += { 'GUILE': 'guile' }
@ -53,6 +53,9 @@ foreach script : src_scripts @@ -53,6 +53,9 @@ foreach script : src_scripts
configuration: scripts_conf,
)
endif
if script.endswith ('guile-gen-docs.scm')
guile_gen_docs_scm = res
endif
endforeach