]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.40
authorfred <fred>
Tue, 26 Mar 2002 23:10:12 +0000 (23:10 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:10:12 +0000 (23:10 +0000)
18 files changed:
Documentation/user/properties.itely
input/test/asciscript5.ly [new file with mode: 0644]
input/test/lyrics.ly [new file with mode: 0644]
input/test/vertical-extent.ly [new file with mode: 0644]
lily/axis-group-engraver.cc
lily/axis-group-interface.cc
lily/dimension-cache.cc
lily/extender-spanner.cc
lily/hyphen-spanner.cc
lily/include/dimension-cache.hh
lily/include/score-element.hh
lily/lexer.ll
lily/paper-score.cc
lily/score-element.cc
lily/span-bar.cc
lily/volta-spanner.cc
ly/engraver.ly
scm/generic-property.scm

index ecfcfd0c50fedcf61cb249f29c09399a3eff9b44..36dbac92daa588975a7cace60b5cc0f615e81cf4 100644 (file)
@@ -13,6 +13,18 @@ generic properties. These are properties than can be plugged into the
 backend directly. See the init file @file{generic-property.scm} for
 details.  For internal use only.
 
+
+@item @code{XXXVerticalExtent}@indexcode{groupVerticalExtent}
+@propertytype{Interval: a cons of numbers}
+
+   Hard code the size of the vertical group in context XXX, example
+@example
+  \property Staff.StaffVerticalExtent = #(-5.0 . 5.0)
+@end example
+  The value is a cons of real numbers, that measure the extent in
+staff spaces
+   
+
 @cindex properties!Lyrics
 
 @table @samp
diff --git a/input/test/asciscript5.ly b/input/test/asciscript5.ly
new file mode 100644 (file)
index 0000000..cdc0727
--- /dev/null
@@ -0,0 +1,16 @@
+\include "paper-as5.ly"
+
+\score {
+       \notes\relative c''{
+               \time 4/4;
+               g1 a b c 
+               g2 a b c
+               g4 a b c
+       }
+       \paper {
+               \paper_as_five
+               \translator { \StaffContext barSize = #5 }
+       }
+
+}
+
diff --git a/input/test/lyrics.ly b/input/test/lyrics.ly
new file mode 100644 (file)
index 0000000..89146f1
--- /dev/null
@@ -0,0 +1,66 @@
+\version "1.3.5";
+
+$somewhat_long = \lyrics{
+       \property Lyrics . textStyle = "roman" 
+       AaaaaaA2
+       BbbbbbB2
+       CcccccC2 
+       DdddddD2
+       EeeeeeE2
+       FfffffF2
+}
+
+$rather_long = \lyrics{
+       \property Lyrics . textStyle = "roman" 
+       LLLLoooonggggg2 
+       Syyllllaaabbble2 
+       LLLLoooonggggg2 
+       Syyllllllaaabbble2
+       LLLLoooonggggg2 
+       Syyyylllaaabbble2
+}
+
+$quite_long = \lyrics{
+       \property Lyrics . textStyle = "roman"
+       LLLLLLLLLooooongggggggg2 
+       Syyyyyyyyyyyyylllllllaaaaaabbble2 
+       LLLLLLLLLooooongggggggg2 
+       Syyyyyyyyyyyyylllllllaaaaaabbble2
+       LLLLLLLLLooooongggggggg2 
+       Syyyyyyyyyyyyylllllllaaaaaabbble2
+}
+
+$somewhat_long_lyrics_staff = \context Lyrics = somewhat <
+       \$somewhat_long
+>
+
+$rather_long_lyrics_staff = \context Lyrics = rather <
+       \$rather_long
+>
+
+$quite_long_lyrics_staff = \context Lyrics = quite <
+       \$quite_long
+>
+
+melody = \notes
+\transpose c'{
+       c4 e4 g4 e4  c4 e4 g4 e4  c4 e4 g4 e4  c4 e4 g4 e4
+       c4 e4 g4 e4  c4 e4 g4 e4  c4 e4 g4 e4  c4 e4 g4 e4
+}
+
+$melodic_staff = \context Staff = mel <
+       \melody
+>
+
+\score
+{
+       <
+               \$melodic_staff
+               \$somewhat_long_lyrics_staff    
+%              \$rather_long_lyrics_staff      
+               \$quite_long_lyrics_staff       
+       >
+       \paper{
+%              castingalgorithm = \Wordwrap;   
+       }
+}
diff --git a/input/test/vertical-extent.ly b/input/test/vertical-extent.ly
new file mode 100644 (file)
index 0000000..b944b43
--- /dev/null
@@ -0,0 +1,7 @@
+
+\score {
+\notes \context Staff {
+  \property Staff.StaffVerticalExtent = #'(-15.0 . 15.0)
+  c1 \break c1 
+}
+}
index 69ea5fee61ac8a3be5ccae587e8e7ffe33304971..d6f881d6fc2d26ad0483d784965cd51a8882ff69 100644 (file)
@@ -10,6 +10,8 @@
 #include "spanner.hh"
 #include "paper-column.hh"
 #include "axis-group-interface.hh"
+#include "dimension-cache.hh"
+#include "engraver-group-engraver.hh"
 
 Axis_group_engraver::Axis_group_engraver ()
 {
@@ -35,6 +37,16 @@ Axis_group_engraver::get_spanner_p () const
 void
 Axis_group_engraver::do_removal_processing ()
 {
+  String name   = daddy_grav_l ()->type_str_ + "VerticalExtent";
+  SCM dims = get_property (name);
+  
+  if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
+      && gh_number_p (gh_cdr (dims)))
+    {
+      staffline_p_->dim_cache_[Y_AXIS]->set_extent_callback (&Score_element::preset_extent);
+      staffline_p_->set_elt_property ("extent-Y", dims);
+    }
+  
   staffline_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ());
   typeset_element (staffline_p_);
   staffline_p_ = 0;
index f15c84ca5ca1946da02f701a727bbdbbd2fef3bd..8cdb9ef67a2f7892d253b5bd50087be9114cb119 100644 (file)
@@ -98,8 +98,8 @@ Axis_group_interface::set_axes (Axis a1, Axis a2)
   if (a1 != Y_AXIS && a2 != Y_AXIS)
     elt_l_->set_empty (Y_AXIS);
   
-  elt_l_->dim_cache_[a1]->set_callback (Axis_group_interface::group_extent_callback);
-  elt_l_->dim_cache_[a2]->set_callback (Axis_group_interface::group_extent_callback);
+  elt_l_->dim_cache_[a1]->set_extent_callback (Axis_group_interface::group_extent_callback);
+  elt_l_->dim_cache_[a2]->set_extent_callback (Axis_group_interface::group_extent_callback);
 }
 
 Link_array<Score_element> 
index eb6f7c24a94472e5b38b932ddc9ce06e7d7dbf2f..ad4c630c0a38ad36fa5e10f12bdef3dff3a1d5ad 100644 (file)
@@ -136,7 +136,7 @@ Dimension_cache::get_dim () const
 }
 
 void
-Dimension_cache::set_callback (Dim_cache_callback c)
+Dimension_cache::set_extent_callback (Dim_cache_callback c)
 {
   extent_callback_l_ =c;
 }
index dd9e1a9bdda7adddec0bfeb55f083233940c8cb2..5f0a9d2dae2a6010831df169ced104a204e0c941 100644 (file)
@@ -24,7 +24,7 @@ Extender_spanner::Extender_spanner ()
   : Spanner ()
 {
   dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
-  dim_cache_[Y_AXIS]->set_callback (Dimension_cache::point_dimension_callback);
+  dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
 }
 
 
index 5f41e23d531623affc4198969311d9cb65bd794a..d1429698a349e7490cf061e27f1a1f7fe4c132d8 100644 (file)
@@ -27,7 +27,7 @@ Hyphen_spanner::Hyphen_spanner ()
 {
   dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
 
-  dim_cache_[Y_AXIS]->set_callback (Dimension_cache::point_dimension_callback);
+  dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
 }
 
 Molecule 
index e110041d0bb55b168b4f693d218d460cd614ba7a..f40337564c2c44c830f1b4c2c15fdf150a1d183d 100644 (file)
@@ -45,7 +45,7 @@ public:
   static Interval point_dimension_callback (Dimension_cache const* );
   Axis axis () const;
   Real get_offset () const;
-  void set_callback (Dim_cache_callback);
+  void set_extent_callback (Dim_cache_callback);
   Dimension_cache * parent_l_;
 
   Score_element *element_l () const { return elt_l_; }
index 51893560cc6222f9c07bf073c7f00fcba7e7f9be..f1818787357d269bb82003ab37f08a720ebb28e0 100644 (file)
@@ -126,6 +126,8 @@ public:
   void add_dependency (Score_element*);    
   virtual Line_of_score * line_l () const;
   bool linked_b () const;
+
+
   VIRTUAL_COPY_CONS(Score_element);
  
   /**
@@ -150,6 +152,9 @@ public:
   /// do calculations before determining horizontal spacing
   virtual void before_line_breaking ();
 
+  static Interval preset_extent (Dimension_cache const*);
+  static Interval molecule_extent (Dimension_cache const*);
+
 protected:
 
   /**
@@ -158,8 +163,7 @@ protected:
   virtual ~Score_element ();
   
   virtual void output_processing ();
-  static Interval molecule_extent (Dimension_cache const*);
-
+  
   /// do printing of derived info.
   virtual void do_print () const;
   /// generate the molecule    
index b567746c3667af61fe8be53ffa06bb3881ea4d88..cbe754c5c38ea7518cc8e29e52a07dba6fd9c3a0 100644 (file)
@@ -511,7 +511,7 @@ My_lily_lexer::scan_bare_word (String str)
                    yylval.pitch->set_spot (Input (source_file_l (), 
                      here_ch_C ()));
                     return (YYSTATE == notes) ? NOTENAME_PITCH : TONICNAME_PITCH;
-               } else if ((pitch = scm_hashq_ref (pitchname_tab_, sym, SCM_BOOL_F))!= SCM_BOOL_F)
+               } else if ((pitch = scm_hashq_ref (chordmodifier_tab_, sym, SCM_BOOL_F))!= SCM_BOOL_F)
                {
                    yylval.pitch = new Musical_pitch (pitch);
                    yylval.pitch->set_spot (Input (source_file_l (), 
index 7da992836495008b0d06e3fec7cd40c214808890..247b5fecad48cc0d1b4c9cf2231d0e6cf4a2fd26 100644 (file)
@@ -187,7 +187,6 @@ Paper_score::process ()
   */
   line_l_->output_lines ();
 
-
   SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ());
   gh_set_cdr_x (before_output,
                gh_cons  (gh_list (ly_symbol2scm ("define-fonts"),
@@ -243,7 +242,7 @@ Paper_score::fixup_refpoints ()
        {
          Score_element * se = unsmob_element (e);
          se->fixup_refpoint ();
-
+             
          if (!dynamic_cast<Line_of_score*> (se) && !se->parent_l (Y_AXIS))
            {
              programming_error ("No parent!");
index 49de87c7428ff66dccefd488dfe1832744a2b619..342270343cf79fec7cf77f165d2ea804e6a51ed1 100644 (file)
@@ -27,7 +27,6 @@
 #include "dimension-cache.hh"
 #include "side-position-interface.hh"
 #include "item.hh"
-
 /*
 TODO:
 
@@ -44,8 +43,8 @@ Score_element::Score_element()
   // junkme.
   used_b_ = false;
 
-  dim_cache_[X_AXIS]->set_callback (molecule_extent);
-  dim_cache_[Y_AXIS]->set_callback (molecule_extent); 
+  dim_cache_[X_AXIS]->set_extent_callback (molecule_extent);
+  dim_cache_[Y_AXIS]->set_extent_callback (molecule_extent); 
   used_b_ = false;
   pscore_l_=0;
   lookup_l_ =0;
@@ -135,11 +134,31 @@ Score_element::set_elt_property (String k, SCM v)
 }
 
 Interval
-Score_element::molecule_extent(Dimension_cache const *c)
+Score_element::molecule_extent (Dimension_cache const *c)
 {
   Score_element *s = dynamic_cast<Score_element*>(c->element_l());
   Molecule m = s->do_brew_molecule();
-  return   m.extent()[c->axis ()];
+  return m.extent()[c->axis ()];
+}
+
+Interval
+Score_element::preset_extent (Dimension_cache const *c)
+{
+  Score_element *s = dynamic_cast<Score_element*>(c->element_l());
+  SCM ext = s->get_elt_property ((c->axis () == X_AXIS)
+                                ? "extent-X"
+                                : "extent-Y");
+  
+  if (gh_pair_p (ext))
+    {
+      Real l = gh_scm2double (gh_car (ext));
+      Real r = gh_scm2double (gh_cdr (ext));
+      l *= s->paper_l ()->get_var ("staffspace");
+      r *= s->paper_l ()->get_var ("staffspace");
+      return Interval (l, r);
+    }
+  
+  return Interval ();
 }
 
 
@@ -555,7 +574,7 @@ Score_element::fixup_refpoint ()
       if (!parent)
        continue;
       
-      if (parent->line_l () != line_l ())
+      if (parent->line_l () != line_l () && line_l ())
        {
          Score_element * newparent = parent->find_broken_piece (line_l ());
          set_parent (newparent, ax);
index d16081928e05ef99ccc6aa6dd639420610667e32..ac458ad177d0343ae111a6121d53d29ada22a2cd 100644 (file)
@@ -152,7 +152,7 @@ Span_bar::get_bar_size () const
 Span_bar::Span_bar ()
 {
   group (this).set_interface ();
-  dim_cache_[X_AXIS]->set_callback (width_callback);
-  dim_cache_[Y_AXIS]->set_callback (height_callback);  
+  dim_cache_[X_AXIS]->set_extent_callback (width_callback);
+  dim_cache_[Y_AXIS]->set_extent_callback (height_callback);  
 }
 
index 79c1829824e7790865a5a3b41f5fa460133ed544..b9467fb08144dab54c17aed5d3d83d6b80051e2f 100644 (file)
 
 Volta_spanner::Volta_spanner ()
 {
-  //dim_cache_ [Y_AXIS]->set_callback (dim_callback);
   set_elt_property ("bars", SCM_EOL);
   side_position (this).set_axis (Y_AXIS);
   directional_element (this).set (UP);
 }
 
+
+/*
+  this is too complicated. Yet another version of side-positioning,
+  badly implemented.  */
 Molecule 
 Volta_spanner::do_brew_molecule () const
 {
index 4d867868af2193a6c93f3d243a87559578a02869..571ca885ede83d425b92e7872aa7f202e0f71340 100644 (file)
@@ -255,7 +255,7 @@ LyricsContext = \translator {
        \type "Engraver_group_engraver";
        \name Lyrics;
        \consists Vertical_align_engraver;%need this for getting folded repeats right.
-
+       Generic_property_list = #generic-lyrics-properties
        \consists "Property_engraver";
        \consistsend "Axis_group_engraver";
        
index 358e1f3a71f4f1ddda7f2decf9b0f8ca870e4b35..554408caffd6325f867686baa9272a921c5e1d73 100644 (file)
        ))
 )
 
+
+
+
+
+;;;;;;;;;;
+;; don't forget to add these to the Generic_property_list property in
+;; engraver.ly
+
 (define generic-voice-properties
   (list
    generic-stem-properties
 (define generic-lyrics-properties
   (list generic-text-properties
   )
-  
 )