]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/define-context-properties.scm:
authorJoe Neeman <joeneeman@gmail.com>
Tue, 9 May 2006 02:15:57 +0000 (02:15 +0000)
committerJoe Neeman <joeneeman@gmail.com>
Tue, 9 May 2006 02:15:57 +0000 (02:15 +0000)
* scm/define-grob-properties.scm:
* scm/define-grobs.scm:
* scm/define-music-display-methods.scm:
* scm/define-music-properties.scm:
* scm/define-music-types.scm:
* scm/music-functions.scm:
* ly/declarations-init.ly:
* lily/include/constrained-breaking.hh:
* lily/system.cc:
* lily/spaceable-grob.cc:
* lily/simple-spacer.cc:
* lily/paper-score.cc:
* lily/paper-column.cc:
* lily/paper-column-engraver.cc:
* lily/item.cc:
* lily/gourlay-breaking.cc:
* lily/constrained-breaking.cc:
* python/convertrules.py:
Change "penalty", "page-penalty" and "breakable" to "line-break-penalty",
"page-break-penalty" and "line-break-permission".
Add "page-break-permission", "page-turn-permission" and "page-turn-penalty".
Replace BreakEvent with LineBreakEvent, PageBreakEvent and PageTurnEvent.

* lily/bar-engraver.cc:
* lily/beam-engraver.cc:
* lily/forbid-break-engraver.cc:
* lily/ligature-engraver.cc:
* lily/paper-column-engraver.cc:
* lily/percent-repeat-engraver.cc:
* lily/score-engraver.cc:
* lily/score-engraver.hh:
* lily/paper-column-engraver.hh:
Inter-engraver communication regarding line breaks is done through context
properties (Score.forbidBreak) instead of function calls.

41 files changed:
ChangeLog
lily/bar-engraver.cc
lily/beam-engraver.cc
lily/break-algorithm.cc
lily/break-align-engraver.cc
lily/constrained-breaking.cc
lily/engraver.cc
lily/forbid-break-engraver.cc
lily/gourlay-breaking.cc
lily/include/break-algorithm.hh
lily/include/constrained-breaking.hh
lily/include/engraver.hh
lily/include/item.hh
lily/include/paper-column-engraver.hh
lily/include/paper-column.hh
lily/include/score-engraver.hh
lily/item.cc
lily/ligature-engraver.cc
lily/note-spacing.cc
lily/paper-column-engraver.cc
lily/paper-column.cc
lily/paper-score.cc
lily/percent-repeat-engraver.cc
lily/score-engraver.cc
lily/script-column-engraver.cc
lily/separating-line-group-engraver.cc
lily/simple-spacer.cc
lily/spaceable-grob.cc
lily/spacing-basic.cc
lily/spacing-determine-loose-columns.cc
lily/spacing-spanner.cc
lily/system.cc
ly/declarations-init.ly
python/convertrules.py
scm/define-context-properties.scm
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/define-music-display-methods.scm
scm/define-music-properties.scm
scm/define-music-types.scm
scm/music-functions.scm

index 8b2269b2fd5a5355b8fb06c7135415b1a1754349..e2930ecca4a406f28eec28d168cb202fa7a37c2f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2006-05-09  Joe Neeman  <joeneeman@gmail.com>
+
+       * scm/define-context-properties.scm:
+       * scm/define-grob-properties.scm:
+       * scm/define-grobs.scm:
+       * scm/define-music-display-methods.scm:
+       * scm/define-music-properties.scm:
+       * scm/define-music-types.scm:
+       * scm/music-functions.scm:
+       * ly/declarations-init.ly:
+       * lily/include/constrained-breaking.hh:
+       * lily/system.cc:
+       * lily/spaceable-grob.cc:
+       * lily/simple-spacer.cc:
+       * lily/paper-score.cc:
+       * lily/paper-column.cc:
+       * lily/paper-column-engraver.cc:
+       * lily/item.cc:
+       * lily/gourlay-breaking.cc:
+       * lily/constrained-breaking.cc:
+       * python/convertrules.py:
+       Change "penalty", "page-penalty" and "breakable" to "line-break-penalty",
+       "page-break-penalty" and "line-break-permission".
+       Add "page-break-permission", "page-turn-permission" and "page-turn-penalty".
+       Replace BreakEvent with LineBreakEvent, PageBreakEvent and PageTurnEvent.
+
+       * lily/bar-engraver.cc:
+       * lily/beam-engraver.cc:
+       * lily/forbid-break-engraver.cc:
+       * lily/ligature-engraver.cc:
+       * lily/paper-column-engraver.cc:
+       * lily/percent-repeat-engraver.cc:
+       * lily/score-engraver.cc:
+       * lily/score-engraver.hh:
+       * lily/paper-column-engraver.hh:
+       Inter-engraver communication regarding line breaks is done through context
+       properties (Score.forbidBreak) instead of function calls.
+
 2006-05-08  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
        * VERSION (PACKAGE_NAME): release 2.9.4
index af7d39929e325dda69a7b13cd454ac46ce45a4b4..29151650094cdc1ccdc03539b88c8dba3e588afe 100644 (file)
@@ -8,6 +8,8 @@
 */
 
 #include "bar-line.hh"
+#include "context.hh"
+#include "score-context.hh"
 #include "score-engraver.hh"
 #include "warn.hh"
 #include "item.hh"
@@ -89,8 +91,7 @@ void
 Bar_engraver::stop_translation_timestep ()
 {
   if (!bar_)
-    /* guh. Use properties! */
-    get_score_engraver ()->forbid_breaks ();
+    context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
   else
     typeset_bar ();
 }
@@ -101,4 +102,4 @@ ADD_TRANSLATOR (Bar_engraver,
                /* create */ "BarLine",
                /* accept */ "",
                /* read */ "whichBar",
-               /* write */ "");
+               /* write */ "forbidBreak");
index d0ee1903d012c52b901d04693c756d7d44ed3ed9..eb6284380a2627217ac9ce50ceb46f60177fedd0 100644 (file)
@@ -15,7 +15,7 @@
 #include "international.hh"
 #include "item.hh"
 #include "rest.hh"
-#include "score-engraver.hh"
+#include "score-context.hh"
 #include "spanner.hh"
 #include "stem.hh"
 #include "warn.hh"
@@ -127,7 +127,7 @@ void
 Beam_engraver::process_music ()
 {
   if (beam_ && !to_boolean (get_property ("allowBeamBreak")))
-    get_score_engraver ()->forbid_breaks ();
+    context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
 
   if (start_ev_)
     {
@@ -282,7 +282,7 @@ ADD_TRANSLATOR (Beam_engraver,
                /* create */ "Beam",
                /* accept */ "beam-event",
                /* read */ "beamMelismaBusy beatLength subdivideBeams",
-               /* write */ "");
+               /* write */ "forbidBreak");
 
 class Grace_beam_engraver : public Beam_engraver
 {
index 0817ae0540fce0beb3c7cc5a6ffe1fc18a45dbb6..d784b594f48c68de45340575485c7d7709f35508 100644 (file)
 #include "cpu-timer.hh"
 #include "simple-spacer.hh"
 
-vector<Grob*>
-Break_algorithm::find_breaks () const
-{
-  vector<Grob*> all = pscore_->root_system ()->columns ();
-  vector<Grob*> retval;
-
-  for (vsize i = 0; i < all.size (); i++)
-    {
-      Item *it = dynamic_cast<Item*> (all[i]);
-      if (Item::is_breakable (all[i])
-         && (i == 0 || it->find_prebroken_piece (LEFT))
-         && (i == all.size () - 1 || it->find_prebroken_piece (RIGHT)))
-       retval.push_back (all[i]);
-    }
-
-  return retval;
-}
-
 Break_algorithm::Break_algorithm ()
 {
   pscore_ = 0;
index e4ea7caf81f2376670caba08981d7d02ce6d22cb..e6a7935c568c5283aeed26671cf39a7b1ec39c73 100644 (file)
@@ -63,9 +63,7 @@ Break_align_engraver::acknowledge_break_aligned (Grob_info inf)
       if (item->get_parent (X_AXIS))
        return;
 
-      SCM bp = item->get_property ("breakable");
-      bool breakable = (to_boolean (bp));
-      if (!breakable)
+      if (!Item::is_non_musical (item))
        return;
 
       SCM align_name = item->get_property ("break-align-symbol");
index 816c52fc066e71d9fb9bc1bc241868fc6daf3f6d..3996856cbd4769d21d2aba9a66399d5550c3587a 100644 (file)
@@ -172,7 +172,7 @@ Constrained_breaking::resize (vsize systems)
              bool last = j == breaks_.size () - 1;
              bool ragged = ragged_right || (last && ragged_last);
               int k = i*lines_rank_ + j;
-             SCM pen = all_[breaks_[j]]->get_property ("penalty");
+             SCM pen = all_[breaks_[j]]->get_property ("line-break-penalty");
              if (scm_is_number (pen))
                lines_[k].break_penalty_ = scm_to_double (pen);
 
index b756d742dcad8c2d829729c84b55e297738e6c98..f17a211afc392127047458d769f48b8febe3cb6a 100644 (file)
@@ -50,12 +50,6 @@ Engraver::Engraver ()
 {
 }
 
-Score_engraver *
-Engraver::get_score_engraver () const
-{
-  return dynamic_cast<Score_engraver *> (get_score_context ()->implementation ());
-}
-
 #include "translator.icc"
 
 ADD_TRANSLATOR (Engraver,
index 9599d8e28fd1c72b71e2d398b34d62a119ff0ca7..14471e8ec62b944102fe12d516b5725760a8dd91 100644 (file)
@@ -5,13 +5,14 @@
 
   (c) 2002--_2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
-#include "rhythmic-head.hh"
+#include "duration.hh"
 #include "grob.hh"
-#include "score-engraver.hh"
+#include "engraver.hh"
 #include "input.hh"
-#include "pitch.hh"
-#include "duration.hh"
 #include "moment.hh"
+#include "pitch.hh"
+#include "rhythmic-head.hh"
+#include "score-context.hh"
 
 #include "translator.icc"
 
@@ -42,7 +43,7 @@ Forbid_line_break_engraver::start_translation_timestep ()
     {
       Grob *g = unsmob_grob (scm_cdar (busy));
       if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")))
-       get_score_engraver ()->forbid_breaks ();
+        context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
       busy = scm_cdr (busy);
     }
 }
@@ -53,4 +54,4 @@ ADD_TRANSLATOR (Forbid_line_break_engraver,
                /* create */ "",
                /* accept */ "",
                /* read */ "busyGrobs",
-               /* write */ "");
+               /* write */ "forbidBreak");
index 06233738e8889cfecf4933c05bfa1d6d283bf745..8599a6a57c58665047b5a533cd4510d5d25f11fd 100644 (file)
@@ -226,7 +226,7 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev,
   Grob *pc = this_one.cols_.back ();
   if (pc->original ())
     {
-      SCM pen = pc->get_property ("penalty");
+      SCM pen = pc->get_property ("line-break-penalty");
       if (scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000)
        break_penalties += scm_to_double (pen);
     }
index e3cf8c115a8f2caa832d82b236b39a924e911d6a..54385d8af633f1ad175913ff429c2085701d8da6 100644 (file)
@@ -23,7 +23,6 @@ protected:
   Paper_score *pscore_;
   Real linewidth_;
 
-  vector<Grob*> find_breaks () const;
   void solve_line (Column_x_positions *) const;
   bool feasible (vector<Grob*> const &) const;
 
index a475a9ef15c0b8950616a06b96969bd11631a78c..8f2a4de2effeea35c0e0fc030069d39d01e5cecf 100644 (file)
 #define CONSTRAINED_BREAKING_HH
 
 #include "break-algorithm.hh"
-
-enum Fordfor {
-  FORBID = -1,
-  DEFAULT = 0,
-  FORCE = 1
-};
+#include "lily-guile.hh"
 
 struct Line_details {
   Real force_;
@@ -25,9 +20,9 @@ struct Line_details {
   Real space_;    /* spring length (stretches over extent_ but not over padding_) */
   Real inverse_hooke_;
 
-  Fordfor line_break_;
-  Fordfor page_break_;
-  Fordfor page_turn_;
+  SCM break_permission_;
+  SCM page_permission_;
+  SCM turn_permission_;
   Real break_penalty_;
   Real page_penalty_;
   Real turn_penalty_;
@@ -39,9 +34,9 @@ struct Line_details {
     padding_ = 0;
     space_ = 0;
     inverse_hooke_ = 1;
-    line_break_ = DEFAULT;
-    page_break_ = DEFAULT;
-    page_turn_ = DEFAULT;
+    break_permission_ = ly_symbol2scm ("allow");
+    page_permission_ = ly_symbol2scm ("allow");
+    turn_permission_ = ly_symbol2scm ("allow");
     break_penalty_ = 0;
     page_penalty_ = 0;
     turn_penalty_ = 0;
index 02698a021346e257ada2440f93647e389f521235..d4330f93541adbb90a01e26ec632f9c99c9c9b7a 100644 (file)
@@ -38,7 +38,6 @@ public:
   */
   void announce_grob (Grob *, SCM cause);
 
-  Score_engraver *get_score_engraver () const;
   /**
      override other ctor
   */
index 0c001af69468b97bf3385b8cdaa62d964314f6f5..9d1f2e73f66aeb5d29347667d8f62e942e83516c 100644 (file)
@@ -28,7 +28,7 @@ public:
 
   virtual Grob *clone (int count) const;
 
-  static bool is_breakable (Grob *);
+  static bool is_non_musical (Grob *);
   bool is_broken () const;
 
   Direction break_status_dir () const;
index c35a6a2e51d1282c590036b377d570e525775ff3..f850613bdd628385db62b70d3c09f6f51325ff60 100644 (file)
@@ -30,16 +30,17 @@ protected:
   DECLARE_ACKNOWLEDGER (staff_spacing);
 
   System *system_;
-  Music *break_event_;
+  vector<Music*> break_events_;
   int breaks_;                 // used for stat printing
   Paper_column *command_column_;
   Paper_column *musical_column_;
   vector<Item*> items_;
   bool first_;
   Moment last_moment_;
+
+  Moment last_breakable_moment_;
+  Paper_column *last_breakable_column_;
 public:
-  // ug.h 
-  void forbid_breaks ();
 };
 
 #endif /* PAPER_COLUMN_ENGRAVER_HH */
index 4d4c5ac588b95c8cb10c8f2eb37de2d9de3a88e0..6ef3daacc4cdf60e2061d2c942afff5941fb0459 100644 (file)
@@ -41,6 +41,7 @@ public:
   static bool is_musical (Grob *);
   static Moment when_mom (Grob *);
   static bool is_used (Grob *);
+  static bool is_breakable (Grob *);
 };
 
 #endif // PAPER_COLUMN_HH
index aa23392888653ddf553e11bfc94f75a93ab39bd3..76571145367474c2e03ba6d68168656967222f8c 100644 (file)
@@ -42,7 +42,6 @@ protected:
 
 public:
   Score_engraver ();
-  void forbid_breaks ();
   virtual SCM get_output ();
 };
 
index c1069e87bf39f288442eff01530ff5bc479a87fa..f4760eb2fd564bdb5d4555fa7592520a2e7fd679 100644 (file)
@@ -37,16 +37,13 @@ Item::Item (Item const &s, int copy_count)
 }
 
 bool
-Item::is_breakable (Grob *me)
+Item::is_non_musical (Grob *me)
 {
   if (me->original ())
     return false;
 
-  if (!dynamic_cast<Item *> (me))
-    me->programming_error ("only items can be breakable.");
-
   Item *i = dynamic_cast<Item *> (me->get_parent (X_AXIS));
-  return (i) ? Item::is_breakable (i) : to_boolean (me->get_property ("breakable"));
+  return i ? Item::is_non_musical (i) : to_boolean (me->get_property ("non-musical"));
 }
 
 Paper_column *
@@ -96,7 +93,7 @@ Item::discretionary_processing ()
   if (is_broken ())
     return;
 
-  if (Item::is_breakable (this))
+  if (Item::is_non_musical (this))
     copy_breakable_items ();
 }
 
@@ -210,4 +207,8 @@ ADD_INTERFACE (Item,
               "  end-of-line-invisible      no      yes    yes\n"
               "  center-invisible           yes      no    yes\n"
               "@end example\n",
-              "no-spacing-rods break-visibility breakable")
+
+              /* properties */
+              "break-visibility "
+              "no-spacing-rods "
+              "non-musical")
index 0cb04c2c365a22175145c8846d715e497443a76f..87db230110abe864de513ea2742c408a577b63f2 100644 (file)
@@ -12,7 +12,7 @@
 #include "international.hh"
 #include "note-head.hh"
 #include "rest.hh"
-#include "score-engraver.hh"
+#include "score-context.hh"
 #include "spanner.hh"
 #include "warn.hh"
 
@@ -117,7 +117,7 @@ Ligature_engraver::process_music ()
   if (ligature_)
     {
       // TODO: maybe forbid breaks only if not transcribing
-      get_score_engraver ()->forbid_breaks ();
+      context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
     }
 
   if (events_drul_[START])
index c5bbb8e67d8d0582ab41afe35953d2a9699c5d30..8586cc5f4cd209d6dd508117795eb587d61600d3 100644 (file)
@@ -158,8 +158,7 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
     we drop it.
    */
   if (!extents[RIGHT].is_empty ()
-      && (Item::is_breakable (right_col)
-         || right_col->original ()))
+      && (Paper_column::is_breakable (right_col)))
     {
       /*
        This is for the situation
index 517d1c565333b3188f440bd1bdd056d432db71a8..603a5b19671147c3aff4361d4d9ef1c9699d5607 100644 (file)
@@ -14,6 +14,7 @@
 #include "note-spacing.hh"
 #include "pointer-group-interface.hh"
 #include "context.hh"
+#include "score-context.hh"
 #include "axis-group-interface.hh"
 #include "warn.hh"
 
@@ -25,9 +26,10 @@ Paper_column_engraver::Paper_column_engraver ()
   command_column_ = 0;
   musical_column_ = 0;
   breaks_ = 0;
-  break_event_ = 0;
   system_ = 0;
   first_ = true;
+  last_breakable_column_ = 0;
+  last_breakable_moment_ = Moment (-1);
 }
 
 void
@@ -38,7 +40,7 @@ Paper_column_engraver::finalize ()
 
   if (command_column_)
     {
-      command_column_->set_property ("breakable", SCM_BOOL_T);
+      command_column_->set_property ("line-break-permission", ly_symbol2scm ("allow"));
       system_->set_bound (RIGHT, command_column_);
     }
 }
@@ -66,7 +68,7 @@ Paper_column_engraver::initialize ()
   make_columns ();
 
   system_->set_bound (LEFT, command_column_);
-  command_column_->set_property ("breakable", SCM_BOOL_T);
+  command_column_->set_property ("line-break-permission", ly_symbol2scm ("allow"));
 }
 
 void
@@ -106,17 +108,10 @@ Paper_column_engraver::set_columns (Paper_column *new_command,
   system_->add_column (musical_column_);
 }
 
-void
-Paper_column_engraver::forbid_breaks ()
-{
-  if (command_column_ && !first_)
-    command_column_->set_property ("breakable", SCM_EOL);
-}
-
 bool
 Paper_column_engraver::try_music (Music *m)
 {
-  break_event_ = m;
+  break_events_.push_back (m);
 
   return true;
 }
@@ -124,28 +119,36 @@ Paper_column_engraver::try_music (Music *m)
 void
 Paper_column_engraver::process_music ()
 {
-  if (break_event_)
+  for (vsize i = 0; i < break_events_.size (); i++)
     {
-      SCM pen = command_column_->get_property ("penalty");
-      Real total_penalty = scm_is_number (pen) ? scm_to_double (pen) : 0.0;
-
-      SCM mpen = break_event_->get_property ("penalty");
-      if (scm_is_number (mpen))
-       total_penalty += scm_to_double (mpen);
-
-      command_column_->set_property ("penalty", scm_from_double (total_penalty));
-
-      /* ugh.  arbitrary, hardcoded */
-      if (total_penalty > 10000.0)
-       forbid_breaks ();
+      string prefix;
+      SCM name = break_events_[i]->get_property ("name");
+      if (name == ly_symbol2scm ("LineBreakEvent"))
+       prefix = "line-break";
+      else if (name == ly_symbol2scm ("PageBreakEvent"))
+       prefix = "page-break";
+      else if (name == ly_symbol2scm ("PageTurnEvent"))
+       prefix = "page-turn";
+      else
+       {
+         programming_error ("Paper_column_engraver doesn't know about this break-event");
+         return;
+       }
+      string perm_str = prefix + "-permission";
+      string pen_str = prefix + "-penalty";
 
-      SCM page_pen = command_column_->get_property ("page-penalty");
-      Real total_pp = scm_is_number (page_pen) ? scm_to_double (page_pen) : 0.0;
-      SCM mpage_pen = break_event_->get_property ("page-penalty");
-      if (scm_is_number (mpage_pen))
-       total_pp += scm_to_double (mpage_pen);
+      SCM cur_pen = command_column_->get_property (pen_str.c_str ());
+      SCM pen = break_events_[i]->get_property ("break-penalty");
+      SCM perm = break_events_[i]->get_property ("break-permission");
 
-      command_column_->set_property ("page-penalty", scm_from_double (total_pp));
+      if (scm_is_number (pen))
+       {
+         Real new_pen = robust_scm2double (cur_pen, 0.0) + scm_to_double (pen);
+         command_column_->set_property (pen_str.c_str (), scm_from_double (new_pen));
+         command_column_->set_property (perm_str.c_str (), ly_symbol2scm ("allow"));
+       }
+      else
+       command_column_->set_property (perm_str.c_str (), perm);
     }
 
   bool start_of_measure = (last_moment_.main_part_ != now_mom ().main_part_
@@ -175,21 +178,40 @@ Paper_column_engraver::stop_translation_timestep ()
       if (!elem->get_parent (X_AXIS)
          || !unsmob_grob (elem->get_object ("axis-group-parent-X")))
        {
-         bool br = to_boolean (elem->get_property ("breakable"));
+         bool br = Item::is_non_musical (elem);
          Axis_group_interface::add_element (br ? command_column_ : musical_column_, elem);
        }
     }
   items_.clear ();
 
-  if (to_boolean (command_column_->get_property ("breakable")))
+  if (to_boolean (get_property ("forbidBreak")))
+    command_column_->set_property ("line-break-permission", SCM_EOL);
+  else if (Paper_column::is_breakable (command_column_))
     {
       breaks_++;
+      last_breakable_column_ = command_column_;
+      last_breakable_moment_ = now_mom ();
       if (! (breaks_%8))
        progress_indication ("[" + to_string (breaks_) + "]");
     }
 
+  SCM page_br = get_property ("allowPageTurn");
+  if (scm_is_pair (page_br) && last_breakable_moment_ >= Rational (0))
+    {
+      SCM pen = scm_cdr (page_br);
+      Moment *m = unsmob_moment (scm_car (page_br));
+      if (m && scm_is_number (pen) && *m <= last_breakable_moment_)
+       {
+         last_breakable_column_->set_property ("page-turn-permission", ly_symbol2scm ("allow"));
+         last_breakable_column_->set_property ("page-turn-penalty", pen);
+       }
+    }
+
+  context ()->get_score_context ()->unset_property ( ly_symbol2scm ("forbidBreak"));
+  context ()->get_score_context ()->unset_property ( ly_symbol2scm ("allowPageTurn"));
+
   first_ = false;
-  break_event_ = 0;
+  break_events_.clear ();
 }
 
 void
@@ -210,9 +232,9 @@ ADD_TRANSLATOR (Paper_column_engraver,
                /* doc */ "Takes care of generating columns."
                "\n\n "
                "This engraver decides whether a column is breakable. The default is "
-               "that a column is always breakable. However, when every Bar_engraver "
-               "that does not have a barline at a certain point will call "
-               "Score_engraver::forbid_breaks to stop linebreaks.  In practice, this "
+               "that a column is always breakable. However, every Bar_engraver "
+               "that does not have a barline at a certain point will set forbidBreaks "
+                "in the score context to stop linebreaks.  In practice, this "
                "means that you can make a breakpoint by creating a barline (assuming "
                "that there are no beams or notes that prevent a breakpoint.) ",
                
@@ -221,7 +243,11 @@ ADD_TRANSLATOR (Paper_column_engraver,
                "NonMusicalPaperColumn",
                
                /* accept */ "break-event",
-               /* read */ "",
+               /* read */
+                "forbidBreak "
+                "allowPageTurn",
                /* write */
+                "forbidBreak "
+                "allowPageTurn "
                "currentCommandColumn "
                "currentMusicalColumn");
index 6fa9ee6ab7152d90474c6facb4ed75e2e1fadb96..525dca36b89fca5d7ee639d354f3d774b8d956fd 100644 (file)
@@ -95,7 +95,7 @@ Paper_column::is_used (Grob *me)
   if (bbm.size ())
     return true;
   
-  if (Item::is_breakable (me))
+  if (Paper_column::is_breakable (me))
     return true;
 
   if (to_boolean (me->get_property ("used")))
@@ -103,6 +103,12 @@ Paper_column::is_used (Grob *me)
   return false;
 }
 
+bool
+Paper_column::is_breakable (Grob *me)
+{
+  return scm_is_symbol (me->get_property ("line-break-permission"));
+}
+
 /*
   Print a vertical line and  the rank number, to aid debugging.
 */
@@ -193,7 +199,12 @@ ADD_INTERFACE (Paper_column,
               "between-cols "
               "bounded-by-me "
               "line-break-system-details "
-              "page-penalty "
+              "line-break-penalty "
+              "line-break-permission "
+              "page-break-penalty "
+              "page-break-permission "
+              "page-turn-penalty "
+              "page-turn-permission "
               "shortest-playing-duration "
               "shortest-starter-duration "
               "used "
index ae22721264628a5c100cc6bcef58e68ae5364e55..8dfbc38939b4f1c8a57ed4d1137d6adf88045a2f 100644 (file)
@@ -69,7 +69,7 @@ Paper_score::find_break_indices () const
   for (vsize i = 0; i < all.size (); i++)
     {
       Item *it = dynamic_cast<Item*> (all[i]);
-      if (Item::is_breakable (all[i])
+      if (Paper_column::is_breakable (all[i])
          && (i == 0 || it->find_prebroken_piece (LEFT))
          && (i == all.size () - 1 || it->find_prebroken_piece (RIGHT)))
        retval.push_back (i);
@@ -119,8 +119,8 @@ Paper_score::process ()
 
      doubly, also done in Score_engraver */
   vector<Grob*> pc (system_->columns ());
-  pc[0]->set_property ("breakable", SCM_BOOL_T);
-  pc.back ()->set_property ("breakable", SCM_BOOL_T);
+  pc[0]->set_property ("line-break-permission", ly_symbol2scm ("allow"));
+  pc.back ()->set_property ("line-break-permission", ly_symbol2scm ("allow"));
 
   system_->pre_processing ();
 }
index 112d1668fbb5dc7a505fe88dc61cc4671b0302be..e1671a57de6097a9151eabe396d700d62334f2d6 100644 (file)
@@ -16,6 +16,7 @@
 #include "misc.hh"
 #include "percent-repeat-iterator.hh"
 #include "repeated-music.hh"
+#include "score-context.hh"
 #include "side-position-interface.hh"
 #include "spanner.hh"
 #include "warn.hh"
@@ -187,13 +188,8 @@ Percent_repeat_engraver::process_music ()
              double_percent_counter_->set_parent (double_percent_, X_AXIS);
            }
          
-         /*
-           forbid breaks on a % line. Should forbid all breaks, really.
-
-           Ugh. Why can't this be regular communication between
-           contexts?
-         */
-         get_score_engraver ()->forbid_breaks ();
+         /* forbid breaks on a % line. Should forbid all breaks, really. */
+         context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
        }
       next_moment_ = next_moment_ + body_length_;
       next_moment_.grace_part_ = Rational (0);
@@ -276,4 +272,5 @@ ADD_TRANSLATOR (Percent_repeat_engraver,
                "currentCommandColumn "
                "countPercentRepeats",
 
-               /* write */ "");
+               /* write */
+    "forbidBreak");
index a91b39b33f74805065e6a85c434aa19a44336074..9566a43558021880cd770761e2d03b3d5437ade8 100644 (file)
@@ -136,20 +136,6 @@ Score_engraver::get_output ()
   return o->self_scm ();
 }
 
-/*
-  UGH UGH
-*/
-void
-Score_engraver::forbid_breaks ()
-{
-  for (SCM s = simple_trans_list_; scm_is_pair (s); s = scm_cdr (s))
-    {
-      Translator *tr = unsmob_translator (scm_car (s));
-      if (Paper_column_engraver *pce = dynamic_cast<Paper_column_engraver *> (tr))
-       pce->forbid_breaks ();
-    }
-}
-
 bool
 Score_engraver::try_music (Music *m)
 {
@@ -163,9 +149,9 @@ ADD_TRANSLATOR_GROUP (Score_engraver,
                      /* doc */ "Top level engraver. Takes care of generating columns and the complete  system (ie. System) "
                      "\n\n "
                      "This engraver decides whether a column is breakable. The default is "
-                     "that a column is always breakable. However, when every Bar_engraver "
-                     "that does not have a barline at a certain point will call "
-                     "Score_engraver::forbid_breaks to stop linebreaks.  In practice, this "
+                     "that a column is always breakable. However, every Bar_engraver "
+                     "that does not have a barline at a certain point will set "
+                      "forbidBreaks to stop linebreaks.  In practice, this "
                      "means that you can make a breakpoint by creating a barline (assuming "
                      "that there are no beams or notes that prevent a breakpoint.) ",
                      /* create */
index b445c6a6821ddfb4e3f3fd71ff0ee379b0f1eb6f..cdaf056322106338da839e19a655c3ff56638f96 100644 (file)
@@ -53,7 +53,7 @@ Script_column_engraver::acknowledge_side_position (Grob_info inf)
   Item *thing = dynamic_cast<Item *> (inf.grob ());
   if (thing)
     {
-      if (!Item::is_breakable (thing))
+      if (!Item::is_non_musical (thing))
        scripts_.push_back (thing);
     }
 }
index 8a7821a1025e3c5110d3c2a370293ff6a1a9ee33..9eb889e14ca8f631afddd2d02930971c8e701377 100644 (file)
@@ -123,7 +123,7 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i)
       return;
     }
 
-  bool ib = Item::is_breakable (it);
+  bool ib = Item::is_non_musical (it);
   Item *&p_ref_ (ib ? break_item_
                 : musical_item_);
 
@@ -133,7 +133,7 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i)
 
       if (ib)
        {
-         p_ref_->set_property ("breakable", SCM_BOOL_T);
+         p_ref_->set_property ("non-musical", SCM_BOOL_T);
          context ()->set_property ("breakableSeparationItem", p_ref_->self_scm ());
        }
 
index 83e2978556a5f45887cd43bc3d9c407bc27d5fc8..0c595f1d94b165c66a652ef31918f843f1892f67 100644 (file)
@@ -342,7 +342,7 @@ next_line_ending_column (vector<Grob*> const &list, vsize starting)
   vsize i = starting + 1;
   for (; i < list.size ()
         && is_loose (list[i])
-        && !Item::is_breakable (list[i]);
+        && !Paper_column::is_breakable (list[i]);
        i++)
     ;
   return dynamic_cast<Item*> (list[i])->find_prebroken_piece (LEFT);
@@ -516,17 +516,11 @@ get_line_configuration (vector<Grob*>const &columns,
   /*
     Check if breaking constraints are met.
   */
-  int sz = ret.cols_.size ();
-  for (int i = sz; i--;)
+  for (vsize i = 1; i < ret.cols_.size () - 1; i++)
     {
-      SCM p = ret.cols_[i]->get_property ("penalty");
-      if (scm_is_number (p))
-       {
-         if (scm_to_double (p) < -9999)
-           ret.satisfies_constraints_ = ret.satisfies_constraints_ && (i == 0 || i == sz -1);
-         if (scm_to_double (p) > 9999)
-           ret.satisfies_constraints_ = ret.satisfies_constraints_ && ! (i == 0 || i == sz -1);
-       }
+      SCM p = ret.cols_[i]->get_property ("line-break-permission");
+      if (p == ly_symbol2scm ("force"))
+       ret.satisfies_constraints_ = false;
     }
 
   return ret;
index d19eb13a3c1ab64de95d663d7740b52dcfbff832..96313acf4abd4629f8806a6d87f9ee9f9a94e553 100644 (file)
@@ -122,6 +122,12 @@ Spaceable_grob::remove_interface (Grob *me)
 
 ADD_INTERFACE (Spaceable_grob, "spaceable-grob-interface",
               "A layout object that takes part in the spacing problem. ",
-              "measure-length spacing-wishes penalty minimum-distances ideal-distances "
-              "keep-inside-line left-neighbors right-neighbors");
+              /* properties */
+              "ideal-distances "
+              "keep-inside-line "
+              "left-neighbors "
+              "measure-length "
+              "minimum-distances "
+              "right-neighbors "
+              "spacing-wishes");
 
index 2c43f54a9e1244edc112c2b0a2805804698aab63..659d3f8b8e8c2a24660dafd5c424f7a50de2667f 100644 (file)
@@ -93,8 +93,7 @@ Spacing_spanner::standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
     }
   while (flip (&d) != LEFT);
 
-  if ((l->is_breakable (l) || l->original ())
-      && (r->is_breakable (r) || r->original ()))
+  if (Paper_column::is_breakable (l) && Paper_column::is_breakable (r))
     {
       Moment *dt = unsmob_moment (l->get_property ("measure-length"));
       Moment mlen (1);
index 951cc8b12ef23ae72d3fe6750ad6ea3ca0afbc22..34f4c97214c50bab299e42aa6f13717abef1d32d 100644 (file)
@@ -37,7 +37,7 @@ is_loose_column (Grob *l, Grob *c, Grob *r, Spacing_options const *options)
     return true;
 
   if (Paper_column::is_musical (c)
-      || Item::is_breakable (c))
+      || Paper_column::is_breakable (c))
     return false;
 
   extract_grob_set (c, "right-neighbors", rns);
@@ -87,8 +87,8 @@ is_loose_column (Grob *l, Grob *c, Grob *r, Spacing_options const *options)
     some cases (two isolated, consecutive clef changes) won't be
     nicely folded, but hey, then don't do that.
   */
-  if (! ((Paper_column::is_musical (l_neighbor) || Item::is_breakable (l_neighbor))
-        && (Paper_column::is_musical (r_neighbor) || Item::is_breakable (r_neighbor))))
+  if (! ((Paper_column::is_musical (l_neighbor) || Paper_column::is_breakable (l_neighbor))
+        && (Paper_column::is_musical (r_neighbor) || Paper_column::is_breakable (r_neighbor))))
     return false;
 
   /*
@@ -305,7 +305,7 @@ Spacing_spanner::set_implicit_neighbor_columns (vector<Grob*> const &cols)
   for (vsize i = 0; i < cols.size (); i++)
     {
       Item *it = dynamic_cast<Item *> (cols[i]);
-      if (!Item::is_breakable (it) && !Paper_column::is_musical (it))
+      if (!Paper_column::is_breakable (it) && !Paper_column::is_musical (it))
        continue;
 
       // it->breakable || it->musical
index c5cf8f50650c9844a94c58d1b79a83403601805e..4c301b6a648ff2cd293e8237b201695863d669cc 100644 (file)
@@ -115,7 +115,7 @@ Spacing_spanner::find_shortest (Grob *me, vector<Grob*> const &cols)
          shortest_in_measure = min (shortest_in_measure, this_shortest.main_part_);
        }
       else if (!shortest_in_measure.is_infinity ()
-              && Item::is_breakable (cols[i]))
+              && Paper_column::is_breakable (cols[i]))
        {
          vsize j = 0;
          for (; j < durations.size (); j++)
index 5493772f1902b53d8e1a29ddb51255f8138d20fe..7e78eb2a119e561d4c87ac61dcfd1ff5308598d3 100644 (file)
@@ -124,7 +124,7 @@ System::get_paper_systems ()
            Kill no longer needed grobs.
          */
          Item *it = dynamic_cast<Item *> (g);
-         if (it && Item::is_breakable (it))
+         if (it && Item::is_non_musical (it))
            {
              it->find_prebroken_piece (LEFT)->suicide ();
              it->find_prebroken_piece (RIGHT)->suicide ();
@@ -375,8 +375,15 @@ System::get_paper_system ()
   SCM prop_init = left_bound->get_property ("line-break-system-details");
   Prob *pl = make_paper_system (prop_init);
   paper_system_set_stencil (pl, sys_stencil);
-  pl->set_property ("penalty",
-                   left_bound->get_property ("page-penalty"));
+
+  /* backwards-compatibility hack for the old page-breaker */
+  SCM turn_perm = left_bound->get_property ("page-break-permission");
+  if (!scm_is_symbol (turn_perm))
+    pl->set_property ("penalty", scm_from_double (10001.0));
+  else if (turn_perm == ly_symbol2scm ("force"))
+    pl->set_property ("penalty", scm_from_double (-10001.0));
+  else
+    pl->set_property ("penalty", scm_from_double (0.0));
   
   if (!scm_is_pair (pl->get_property ("refpoint-Y-extent")))
     {
@@ -417,7 +424,7 @@ System::broken_col_range (Item const *left, Item const *right) const
         && cols[i] != right)
     {
       Paper_column *c = dynamic_cast<Paper_column *> (cols[i]);
-      if (Item::is_breakable (c) && !c->system_)
+      if (Paper_column::is_breakable (c) && !c->system_)
        ret.push_back (c);
       i++;
     }
@@ -436,7 +443,7 @@ System::columns () const
 
   while (last_breakable--)
     {
-      if (Item::is_breakable (ro_columns [last_breakable]))
+      if (Paper_column::is_breakable (ro_columns [last_breakable]))
        break;
     }
 
index f60c9f4578ba2004ecfe1bbebffe7aefc4711291..5a322c2af7ac54496015b5da27c8dd9eb40b2278 100644 (file)
@@ -35,10 +35,18 @@ center = #0
 %% try \once \set Score.allowBeamBreak = ##t
 
 %% rather name \newline, \pageBreak ?
-break = #(make-event-chord (list (make-penalty-music -10001 0)))
-noBreak = #(make-event-chord (list (make-penalty-music 10001 0)))
-pageBreak = #(make-event-chord (list (make-penalty-music -10001 -10001)))
-noPageBreak = #(make-event-chord (list (make-penalty-music 0 10001)))
+break = #(make-event-chord (list (make-music 'LineBreakEvent 'break-permission 'force)))
+noBreak = #(make-event-chord (list (make-music 'LineBreakEvent 'break-permission '())))
+pageBreak = #(make-event-chord (list
+                               (make-music 'LineBreakEvent 'break-permission 'force)
+                               (make-music 'PageBreakEvent 'break-permission 'force)))
+noPageBreak = #(make-event-chord (list (make-music 'PageBreakEvent 'break-permission '())))
+pageTurn = #(make-event-chord (list
+                               (make-music 'LineBreakEvent 'break-permission 'force)
+                               (make-music 'PageBreakEvent 'break-permission 'force)
+                               (make-music 'PageTurnEvent 'break-permission 'force)))
+noPageTurn = #(make-event-chord (list (make-music 'PageTurnEvent 'break-permission '())))
+
 stopStaff = #(make-event-chord (list (make-span-event 'StaffSpanEvent STOP)))
 startStaff = #(make-event-chord (list (make-span-event 'StaffSpanEvent START)))
 
index 4c0465785a5182d44daa2d81c3d0bcf29aa6e29d..40e6bfba4e904c97f0bdfcd830f9c64c801d169d 100644 (file)
@@ -2781,3 +2781,11 @@ def conv (str):
 
 conversions.append (((2, 7, 40), conv,
                    "rehearsalMarkAlignSymbol/barNumberAlignSymbol -> break-align-symbol"))
+
+
+def conv (str):
+    str = re.sub ('page-penalty', 'page-break-penalty')
+    str = re.sub ('([^-])penalty', '\1break-penalty')
+    return str
+
+conversions.append (((2, 9, 4), conv, """(page-)penalty -> (page-)break-penalty"""))
index 2b8c36fb8101dd6209be9f8997d03cbe5622ed11..4c0a71305bd166ca1cc05658c3d4505b2da2db05 100644 (file)
@@ -32,6 +32,8 @@
                                 "If true, then the accidentals are aligned in bass figure context.")
 
      (allowBeamBreak ,boolean? "If true allow line breaks for beams over bar lines.")
+     (allowPageTurn ,pair? "In the form (moment-start . penalty). Allow a page turn
+at the most recent breakpoint if it was after moment-start.")
      (associatedVoice ,string? "Name of the
 @code{Voice} that has the melody for this @code{Lyrics} line.")
      (autoBeamSettings ,list? "Specifies
@@ -220,6 +222,8 @@ switches by a thin line")
      (fontSize ,number?
               "The relative size of all grobs in a context. ")
 
+     (forbidBreak ,boolean? "If set to ##t, prevent a line break at this point.")
+
      (fingeringOrientations ,list?
                            "List of symbols, containing
 @samp{left}, @samp{right}, @samp{up} and/or @samp{down}. This list
index 1c43db7cfc093a3a93d18a72c463346144eeedf1..ba1def6f73346027cf503b5f8b5c47522c59d234 100644 (file)
@@ -111,8 +111,6 @@ tuplet bracket.")
      (break-visibility ,vector? "A vector of 3 booleans, #(end-of-line unbroken begin-of-line).
 #t means visible, #f means killed.")
 
-     (breakable ,boolean? "Can this object appear at a line break,
-like clefs and bar lines?")
      (c0-position ,integer? "An integer indicating the position of
 middle C.")
      (cautionary-style ,symbol? "How to print cautionary
@@ -317,21 +315,31 @@ easy-notation note heads.")
 spacing constraints.")
      (no-stem-extend ,boolean? "If set, notes with ledger lines do not
 get stems extending to the middle staff line.")
+     (non-musical ,boolean? "True if the grob belongs in a NonMusicalPaperColumn.")
      (number-type ,symbol? "Type of numbers to use in label.  Choices
 include @code{roman-lower}, @code{roman-upper}, and @code{arabic}.")
      (packed-spacing ,boolean? "If set, the notes are spaced as
 tightly as possible.")
      (padding ,ly:dimension? "Add this much extra space between
 objects that are next to each other.")
-     (page-penalty ,number? "Penalty for page break at
-this column.  10000 or more means forbid linebreak, -10000 or less
-means force page break.  Other values influence page breaking decisions
-as a real penalty.")
-     (penalty ,number? "Penalty for line break at
-this column.  10000 or more means forbid line break, -10000 or less
-means force line break.  Other values influence line breaking decisions
-as a real penalty.")
-
+     (page-break-permission ,symbol? "Instructs the page breaker on whether to
+put a page break at this column. Can be 'force, or 'allow.")
+     (page-turn-permission ,symbol? "Instructs the page breaker on whether to
+put a page turn at this column. Can be 'force, or 'allow.")
+     (line-break-permission ,symbol? "Instructs the line breaker on whether to
+put a line break at this column. Can be 'force, or 'allow.")
+     (page-break-penalty ,number? "Penalty for page break at
+this column. This affects the choices of the page breaker; it will avoid a page
+break at a column with a positive penalty and prefer a page break at a column
+with a negative penalty.")
+     (page-turn-penalty ,number? "Penalty for a page turn at this column.
+This affects the choices of the page breaker; it will avoid a page
+turn at a column with a positive penalty and prefer a page turn at a column
+with a negative penalty.")
+     (line-break-penalty ,number? "Penalty for a line break at this column.
+This affects the choices of the line breaker; it will avoid a line
+break at a column with a positive penalty and prefer a line break at a column
+with a negative penalty.")
      (positions ,pair?
                "Pair of staff coordinates @code{(@var{left}
 . @var{right})}, where both @var{left} and @var{right} are in the
index 0414fabb1d83ee729372c51459fb38d7970d4cbc..6c5c5231232d7b328cf9ae66dd1ab6aac096d43a 100644 (file)
@@ -74,7 +74,7 @@
                        (staff-bar . (extra-space . 0.0))
                        (time-signature . (extra-space . 0.0))
                        (first-note . (fixed-space . 0.0))))
-       (breakable . #t)
+       (non-musical . #t)
        (break-align-symbol . ambitus)
        (break-visibility . ,begin-of-line-visible)
        (meta . ((class . Item)
        (glyph . "|")
        (layer . 0)
        (break-visibility . ,all-visible)
-       (breakable . #t)
+       (non-musical . #t)
 
        (stencil . ,ly:bar-line::print)
        (glyph-name . ,bar-line::calc-glyph-name)
     (BarNumber
      . (
        (stencil . ,ly:text-interface::print)
-       (breakable . #t)
+       (non-musical . #t)
        (break-visibility . ,begin-of-line-visible)
        (padding . 1.0)
        (direction . ,UP)
 
     (BreakAlignment
      . (
-       (breakable . #t)
+       (non-musical . #t)
        (stacking-dir . 1)
        (positioning-done . ,ly:break-align-interface::calc-positioning-done)
        (X-extent . ,ly:axis-group-interface::width)
     (BreathingSign
      . (
        (break-align-symbol . breathing-sign)
-       (breakable . #t)
+       (non-musical . #t)
        (space-alist . (
                        (ambitus . (extra-space . 2.0))
                        (custos . (minimum-space . 1.0))
      . (
        (stencil . ,ly:clef::print)
        (glyph-name . ,ly:clef::calc-glyph-name)
-       (breakable . #t)
+       (non-musical . #t)
        (font-family . music)
        (break-align-symbol . clef)
        (break-visibility . ,begin-of-line-visible)
     (Custos
      . (
        (break-align-symbol . custos)
-       (breakable . #t)
+       (non-musical . #t)
        (stencil . ,ly:custos::print)
        (break-visibility . ,end-of-line-visible)
        (style . vaticana)
     (DoublePercentRepeat
      . (
        (stencil . ,ly:percent-repeat-item-interface::double-percent)
-       (breakable . #t)
+       (non-musical . #t)
        (slope . 1.0)
        (font-encoding . fetaMusic)
        (width . 2.0)
        (style . line)
        (gap . 0.5)
        (zigzag-width . 0.75)
-       (breakable . #t)
+       (non-musical . #t)
        (X-extent . #f)
        (Y-extent . #f)
        (stencil . ,ly:line-spanner::print)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (break-align-symbol . key-cancellation)
        (break-visibility . ,begin-of-line-invisible)
-       (breakable . #t)
+       (non-musical . #t)
        (meta . ((class . Item)
                 (interfaces . (key-signature-interface
                                font-interface
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (break-align-symbol . key-signature)
        (break-visibility . ,begin-of-line-visible)
-       (breakable . #t)
+       (non-musical . #t)
        (meta . ((class . Item)
                 (interfaces . (key-signature-interface
                                font-interface
      . (
        (break-align-symbol . left-edge)
        (X-extent . (0 . 0))
-       (breakable . #t)
+       (non-musical . #t)
        (break-visibility . ,center-invisible)
        (space-alist . (
                        (custos . (extra-space . 0.0))
        (X-extent . ,ly:axis-group-interface::width)
        ;;                    (stencil . ,ly:paper-column::print)
        
-       (breakable . #t)
+       (non-musical . #t)
 
        ;; debugging stuff: print column number.
        ;;               (font-size . -6) (font-name . "sans")  (Y-extent . #f)
        (Y-offset . ,ly:side-position-interface::y-aligned-side)
        (self-alignment-X . 0)
        (direction . ,UP)
-       (breakable . #t)
+       (non-musical . #t)
        (font-size . 2)
        (baseline-skip . 2)
        (break-visibility . ,end-of-line-invisible)
        (break-align-symbol . staff-bar)
        (Y-extent . ())
        (layer . 0)
-       (breakable . #t)
+       (non-musical . #t)
        (stencil . ,ly:span-bar::print)
        (bar-size . ,ly:span-bar::calc-bar-size)
        (X-extent . ,ly:span-bar::width)
 
     (StaffSpacing
      . (
-       (breakable . #t)
+       (non-musical . #t)
        (stem-spacing-correction . 0.4)
        (meta . ((class . Item)
                 (interfaces . (spacing-interface
                        (first-note . (fixed-space . 2.0))
                        (right-edge . (extra-space . 0.5))
                        (staff-bar . (minimum-space . 2.0))))
-       (breakable . #t)
+       (non-musical . #t)
        (style . C)
        (meta . ((class . Item)
                 (interfaces . (time-signature-interface
      . (
        (style . line)
        (gap . 0.5)
-       (breakable . #t)
+       (non-musical . #t)
        (X-extent . #f)
        (Y-extent . #f)
        (stencil . ,ly:line-spanner::print)
index d098725d91b73d8d3f6cd0dbf46c02b5f361c0f2..f1264da40650bc3a884c6da85ad86ce87fd84db5 100644 (file)
@@ -585,8 +585,21 @@ Otherwise, return #f."
 (define-display-method BarCheck (check)
   (format #f "|~a" (new-line->lily-string)))
 
-(define-display-method BreakEvent (br)
-  "\\break") ;; TODO: use page-penalty, penalty properties?
+;; TODO: also display something when there is a penalty?
+(define-display-method LineBreakEvent (br)
+  (if (eq? (ly:music-property br 'break-permission) 'forbid)
+      ("\\noBreak")
+      ("\\break")))
+
+(define-display-method PageBreakEvent (br)
+  (if (eq? (ly:music-property br 'break-permission) 'forbid)
+      ("\\noPageBreak")
+      ("\\pageBreak")))
+
+(define-display-method PageTurnEvent (br)
+  (if (eq? (ly:music-property br 'break-permission) 'forbid)
+      ("\\noPageTurn")
+      ("\\pageTurn")))
 
 (define-display-method PesOrFlexaEvent (expr)
   "\\~")
index 0286f9923fd7a36baa9963ec321ea98b5aecdba1..bb0e4e4dfe58020c1ce410e3c098ad2077e566bc 100644 (file)
@@ -32,6 +32,8 @@ TODO: consider making type into symbol ")
      (augmented ,boolean? "This figure is for an augmented figured bass (with +) sign.")
      (associated-context ,string? "Name of the Voice context associated with this \\newaddlyrics section")
      (bass ,boolean? "Set if this note is a bass note in a chord")
+     (break-penalty ,number? "Penalty for line break hint.")
+     (break-permission ,symbol? "Whether to allow, forbid or force a line break.")
      (cautionary ,boolean? "If set, this alteration needs cautionary accidental")
      (change-to-id ,string? "name of the context to change to ")
      (change-to-type ,symbol? "type of the context to change to.")
@@ -39,8 +41,7 @@ TODO: consider making type into symbol ")
      (context-id ,string? "name of context")
      (context-type ,symbol?  "type of context")
      (create-new ,boolean? "Create a fresh context.") 
-     (descend-only ,boolean? "If set, this @code{\\context} will only
-descend in the context tree.")
+     (descend-only ,boolean? "If set, this @code{\\context} will only descend in the context tree.")
      (denominator ,integer? "denominator in a time signature")
      (digit ,integer? "digit for fingering")
      (diminished ,boolean? "This bass figure should be slashed.")
@@ -58,19 +59,14 @@ descend in the context tree.")
      (label ,markup? "label of a mark.")
      (last-pitch ,ly:pitch? "The last pitch after relativization.")
      (length ,ly:moment? "The duration of this music")
-     (length-callback ,procedure? "How to compute the duration of this music. This property
-can only be defined as initializer in @file{define-music-types.scm}.")
+     (length-callback ,procedure? "How to compute the duration of this music. This property can only be defined as initializer in @file{define-music-types.scm}.")
      (name ,symbol? "Name of this music object")
      (no-continuation ,boolean? "If set, disallow continuation lines")
      (numerator ,integer? "numerator of a time signature")
      (once ,boolean? "Apply this operation only during one time step?")
-     (octavation ,integer?
-                "This pitch was octavated by how many octaves?
-For chord inversions, this is negative.")
+     (octavation ,integer? "This pitch was octavated by how many octaves? For chord inversions, this is negative.")
      (origin ,ly:input-location? "where was this piece of music defined?")
      (parenthesize ,boolean? "Enclose resulting objects in parentheses?")
-     (page-penalty ,number? "Penalty for page break hint.")
-     (penalty ,number? "Penalty for line break hint.")
      (pitch ,ly:pitch? "the pitch of this note")
      (pitch-alist ,list? "list of pitches jointly forming the scale of a key signature")
      (pop-first ,boolean? "Do a revert before we try to do a override on some grob property.")
index a05283c9c3b6eea450531a60571fd623edea1a78..2192dc33663e77170b606c63514c40559e7107c5 100644 (file)
@@ -94,7 +94,7 @@ c8-[ c c-] c8")
     (BreakEvent
      . (
        (description .  "Create a line break, Syntax: \\break or page break, Syntax: \\pagebreak.")
-
+       
        (types . (general-music break-event event))
        ))
     (BreathingSignEvent
@@ -233,7 +233,11 @@ Syntax: @var{note}\\laissezVibrer.")
        (span-type . ligature)
        (types . (general-music span-event ligature-event event))
        ))
-    
+    (LineBreakEvent
+     . (
+       (description .  "Allow, forbid or force a line break.")
+       (types . (general-music break-event event))
+       ))
     (OldLyricCombineMusic
      . (
        (description .  "Align lyrics to the start of notes.
@@ -350,6 +354,16 @@ SYNTAX
        (types . (general-music layout-instruction))
        (iterator-ctor . ,ly:push-property-iterator::constructor)
        ))
+    (PageBreakEvent
+     . (
+       (description .  "Allow, forbid or force a page break.")
+       (types . (general-music break-event event))
+       ))
+    (PageTurnEvent
+     . (
+       (description .  "Allow, forbid or force a page turn.")
+       (types . (general-music break-event event))
+       ))
     (PartCombineMusic
      . (
        (description .  "Combine two parts on a staff, either merged or
index deba74c08c8f81ad899cb51894f2754bc5c885da..3aa4de0dac1286005c9f1d6c095af36c9812498c 100644 (file)
@@ -472,11 +472,6 @@ of beat groupings "
 (define-public (set-time-signature num den . rest)
   (ly:export (apply make-time-signature-set `(,num ,den . ,rest))))
 
-(define-safe-public (make-penalty-music pen page-pen)
-  (make-music 'BreakEvent
-             'penalty pen
-             'page-penalty page-pen))
-
 (define-safe-public (make-articulation name)
   (make-music 'ArticulationEvent
              'articulation-type name))