From: Han-Wen Nienhuys Date: Thu, 21 Jul 2005 01:11:50 +0000 (+0000) Subject: * lily/output-def-scheme.cc (LY_DEFINE): take default argument. X-Git-Tag: release/2.7.3~30 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bce34ce896e5f7a2e80460b0051f740facd1a1d1;p=lilypond.git * lily/output-def-scheme.cc (LY_DEFINE): take default argument. * lily/output-def.cc (lookup_variable): return SCM_UNDEFINED if undefined. * Documentation/user/global.itely (Page formatting): document horizontalshift. * scm/page-layout.scm (default-page-music-height): horizontalshift: new variable, shift all systems by horizontalshift to the right, to make space for instrument names. * scm/paper.scm (set-paper-dimension-variables): add horizontalshift * lily/input-scheme.cc (LY_DEFINE): take format commands. --- diff --git a/ChangeLog b/ChangeLog index 365f3186c0..ddd484e918 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-07-21 Han-Wen Nienhuys + + * lily/output-def-scheme.cc (LY_DEFINE): take default argument. + + * lily/output-def.cc (lookup_variable): return SCM_UNDEFINED if undefined. + + * Documentation/user/global.itely (Page formatting): document + horizontalshift. + + * scm/page-layout.scm (default-page-music-height): + horizontalshift: new variable, shift all systems by + horizontalshift to the right, to make space for instrument names. + + * scm/paper.scm (set-paper-dimension-variables): add horizontalshift + + * lily/input-scheme.cc (LY_DEFINE): take format commands. 2005-07-20 Han-Wen Nienhuys @@ -10,6 +26,8 @@ * lily/include/paper-column.hh (class Paper_column): add non-static get_rank() member. + * VERSION: release 2.7.1 + * scm/framework-null.scm: new file, used for benchmarking. 2005-07-20 Heikki Junes diff --git a/Documentation/user/global.itely b/Documentation/user/global.itely index aa3a0e3ad8..7ab893f2fd 100644 --- a/Documentation/user/global.itely +++ b/Documentation/user/global.itely @@ -315,6 +315,14 @@ top-most of the next system. Increasing this will put systems whose bounding boxes almost touch farther apart. + +@item horizontalshift +All systems (including titles and system separators) are shifted by +this amount to the right. Page markup, such as headers and footers are +not affected by this. The purpose of this variable is to make space +for instrument names at the left. + + @item aftertitlespace Amount of space between the title and the first system. diff --git a/VERSION b/VERSION index 01f3dcadba..d07bd920b4 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=7 -PATCH_LEVEL=1 +PATCH_LEVEL=2 MY_PATCH_LEVEL= diff --git a/lily/font-interface.cc b/lily/font-interface.cc index c9400629ae..fe258a86dc 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -34,6 +34,8 @@ Font_interface::music_font_alist_chain (Grob *g) { SCM defaults = g->get_layout ()->lookup_variable (ly_symbol2scm ("font-defaults")); + if (defaults == SCM_UNDEFINED) + defaults = SCM_EOL; return g->get_property_alist_chain (defaults); } @@ -42,6 +44,8 @@ Font_interface::text_font_alist_chain (Grob *g) { SCM defaults = g->get_layout ()->lookup_variable (ly_symbol2scm ("text-font-defaults")); + if (defaults == SCM_UNDEFINED) + defaults = SCM_EOL; return g->get_property_alist_chain (defaults); } diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index 929a0dbaa7..07ac9dd820 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -93,9 +93,12 @@ LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain", SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); if (global == SCM_UNDEFINED) - global - = sc->get_layout ()->lookup_variable (ly_symbol2scm ("font-defaults")); - + { + global = sc->get_layout ()->lookup_variable (ly_symbol2scm ("font-defaults")); + if (global == SCM_UNDEFINED) + global = SCM_EOL; + } + return sc->get_property_alist_chain (global); } diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc index 51432ff9b9..b38b6a999b 100644 --- a/lily/input-scheme.cc +++ b/lily/input-scheme.cc @@ -18,14 +18,16 @@ LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0, return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F; } -LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 0, (SCM sip, SCM msg), - "Print @var{msg} as a GNU compliant error message, pointing to the" - "location in @var{sip}.\n") +LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM rest), + "Print @var{msg} as a GNU compliant error message, pointing to the " + "location in @var{sip}. @var{msg} is interpreted similar to @code{format}'s argument\n") { Input *ip = unsmob_input (sip); SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string"); + msg = scm_simple_format (SCM_BOOL_F, msg, rest); + String m = ly_scm2string (msg); ip->message (m); diff --git a/lily/output-def-scheme.cc b/lily/output-def-scheme.cc index 9e56fb79bb..f71e15926f 100644 --- a/lily/output-def-scheme.cc +++ b/lily/output-def-scheme.cc @@ -15,15 +15,24 @@ #include "context-def.hh" LY_DEFINE (ly_layout_lookup, "ly:output-def-lookup", - 2, 0, 0, (SCM pap, SCM sym), + 2, 1, 0, (SCM pap, SCM sym, SCM def), "Lookup @var{sym} in @var{pap}. " - "Return the value or @code{'()} if undefined.") + "Return the value or @var{def} (which defaults to @code{'()}) if undefined.") { Output_def *op = unsmob_output_def (pap); SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Output_def"); SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); + + SCM answer = op->lookup_variable (sym); + if (answer == SCM_UNDEFINED) + { + if (def == SCM_UNDEFINED) + def = SCM_EOL; + + answer = def; + } - return op->lookup_variable (sym); + return answer; } LY_DEFINE (ly_output_def_scope, "ly:output-def-scope", diff --git a/lily/output-def.cc b/lily/output-def.cc index 0010d69b4f..c3f1955b76 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -114,7 +114,7 @@ Output_def::lookup_variable (SCM sym) const if (parent_) return parent_->lookup_variable (sym); - return SCM_EOL; + return SCM_UNDEFINED; } SCM diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 08590f2f89..5b3f01a566 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -84,7 +84,8 @@ create offsets. (vsize (ly:output-def-lookup layout 'vsize)) (hsize (ly:output-def-lookup layout 'hsize)) - + + (system-xoffset (ly:output-def-lookup layout 'horizontalshift 0.0)) (system-separator-markup (ly:output-def-lookup layout 'systemSeparatorMarkup)) (system-separator-stencil (if (markup? system-separator-markup) (interpret-markup layout @@ -93,53 +94,57 @@ create offsets. #f)) (lmargin (ly:output-def-lookup layout 'leftmargin)) (leftmargin (if lmargin - lmargin - (/ (- hsize - (ly:output-def-lookup layout 'linewidth)) 2))) - - (rightmargin (ly:output-def-lookup layout 'rightmargin)) - (bottom-edge (- vsize - (ly:output-def-lookup layout 'bottommargin))) - - (head (page-headfoot layout scopes number 'make-header 'headsep UP last?)) - (foot (page-headfoot layout scopes number 'make-footer 'footsep DOWN last?)) - - (head-height (if (ly:stencil? head) - (interval-length (ly:stencil-extent head Y)) - 0.0)) - - (height-proc (ly:output-def-lookup layout 'page-music-height)) - - (page-stencil (ly:make-stencil '() - (cons leftmargin hsize) - (cons (- topmargin) 0))) - (last-system #f) - (last-y 0.0) - (add-to-page (lambda (stencil y) - (set! page-stencil - (ly:stencil-add page-stencil - (ly:stencil-translate-axis stencil - (- 0 head-height y topmargin) Y))))) - (add-system - (lambda (stencil-position) - (let* ((system (car stencil-position)) - (stencil (ly:paper-system-stencil system)) - (y (cadr stencil-position)) - (is-title (ly:paper-system-title? - (car stencil-position)))) - (add-to-page stencil y) - (if (and (ly:stencil? system-separator-stencil) - last-system - (not (ly:paper-system-title? system)) - (not (ly:paper-system-title? last-system))) - (add-to-page - system-separator-stencil - (average (- last-y - (car (ly:paper-system-staff-extents last-system))) - (- y - (cdr (ly:paper-system-staff-extents system)))))) - (set! last-system system) - (set! last-y y))))) + lmargin + (/ (- hsize + (ly:output-def-lookup layout 'linewidth)) 2))) + + (rightmargin (ly:output-def-lookup layout 'rightmargin)) + (bottom-edge (- vsize + (ly:output-def-lookup layout 'bottommargin))) + + (head (page-headfoot layout scopes number 'make-header 'headsep UP last?)) + (foot (page-headfoot layout scopes number 'make-footer 'footsep DOWN last?)) + + (head-height (if (ly:stencil? head) + (interval-length (ly:stencil-extent head Y)) + 0.0)) + + (height-proc (ly:output-def-lookup layout 'page-music-height)) + + (page-stencil (ly:make-stencil '() + (cons leftmargin hsize) + (cons (- topmargin) 0))) + (last-system #f) + (last-y 0.0) + (add-to-page (lambda (stencil y) + (set! page-stencil + (ly:stencil-add page-stencil + (ly:stencil-translate stencil + (cons + system-xoffset + (- 0 head-height y topmargin)) + + ))))) + (add-system + (lambda (stencil-position) + (let* ((system (car stencil-position)) + (stencil (ly:paper-system-stencil system)) + (y (cadr stencil-position)) + (is-title (ly:paper-system-title? + (car stencil-position)))) + (add-to-page stencil y) + (if (and (ly:stencil? system-separator-stencil) + last-system + (not (ly:paper-system-title? system)) + (not (ly:paper-system-title? last-system))) + (add-to-page + system-separator-stencil + (average (- last-y + (car (ly:paper-system-staff-extents last-system))) + (- y + (cdr (ly:paper-system-staff-extents system)))))) + (set! last-system system) + (set! last-y y))))) (if #f (display (list diff --git a/scm/paper.scm b/scm/paper.scm index 932da61bbc..d0d3a56a71 100644 --- a/scm/paper.scm +++ b/scm/paper.scm @@ -8,7 +8,7 @@ (module-define! mod 'dimension-variables '(pt mm cm in staffheight staff-space betweensystemspace betweensystempadding - linewidth indent hsize vsize + linewidth indent hsize vsize horizontalshift staffspace linethickness ledgerlinethickness blotdiameter interscoreline leftmargin rightmargin)))