1 ;------------------------------------------------------------------;
2 ; opus_libre -- 50-loadthemes.scm ;
4 ; (c) 2008-2011 Valentin Villenave <valentin@villenave.net> ;
6 ; opus_libre is a free framework for GNU LilyPond: you may ;
7 ; redistribute it and/or modify it under the terms of the GNU ;
8 ; General Public License as published by the Free Software ;
9 ; Foundation, either version 3 of the License, or (at your option) ;
10 ; any later version. ;
11 ; This program is distributed WITHOUT ANY WARRANTY; without ;
12 ; even the implied warranty of MERCHANTABILITY or FITNESS FOR A ;
13 ; PARTICULAR PURPOSE. You should have received a copy of the GNU ;
14 ; General Public License along with this program (typically in the ;
15 ; share/doc/ directory). If not, see http://www.gnu.org/licenses/ ;
17 ;------------------------------------------------------------------;
20 (scm-load "liblayout.scm")
22 (define-public (include-ly dir . hidden?)
23 "Include all LilyPond code found in DIR, recursively.
24 If HIDDEN is set, also load hidden or temporary files."
25 (let* ((regx (if (false-or-null? hidden?)
26 "/[^\\._][^/]*\\.i?ly$"
28 (ly-files (find-files dir regx #t)))
30 (if (string-ci=? conf:local-ly-score
31 (string-take-right x (string-length conf:local-ly-score)))
32 (ly:debug-message "Skipping local score file: ~a..." x)
33 (ly:parser-include-string (format #f "\\include \"~a\"" x))))
37 (include-ly conf:layout-dir))
40 ;; "Load the default "theme" (that provides basic layout)
41 ;; then overload user-specified themes (if any) on top of
43 (let* ((default-theme (string-append conf:themes-dir "/" conf:default-theme))
44 (user-theme (if (defined-string? 'theme)
45 (ly:parser-lookup 'theme)
51 (ly:debug-message "Loading theme in ~a..." dir)
54 (ly:debug-message "Theme directory not found: ~a."
56 (include-theme-dir default-theme)
58 (if (not (equal? user-theme conf:default-theme))
60 (string-append conf:themes-dir "/" user-theme))))))