]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.25
authorfred <fred>
Tue, 26 Mar 2002 22:45:35 +0000 (22:45 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:45:35 +0000 (22:45 +0000)
lily/include/bezier-bow.hh
lily/include/lookup.hh
lily/include/note-head.hh
lily/note-head.cc
lily/score-element.cc
lily/volta-spanner.cc

index 903088deced18597bc78fe0dafa7a4ec2b3481d1..93a453359c2ca856eb345f04d2a87ad922627f1a 100644 (file)
@@ -41,8 +41,6 @@ public:
 
   Real vertical_offset_needed () const;
   
-
-  SCM ugly_scm () const;
   Bezier_bow (Array<Offset> points, Direction dir);
   void calculate ();
   Bezier get_curve () const;
index d86f04e62a353da967b97d914b35385f5f265940..2a227470fed0d3ed23510f278459e844e8983b8f 100644 (file)
 class Lookup
 {
 public:
+  String font_name_;
+  Adobe_font_metric * afm_l_;
+
+
   Lookup ();
   Lookup (Lookup const&);
 
   Molecule simple_bar (String s, Real w, Paper_def*) const;
   Molecule afm_find (String, bool warn=true) const;
   Molecule bar (String, Real height, Paper_def*) const;
-  Molecule beam (Real, Real, Real) const;
-  Molecule dashed_slur (Bezier, Real thick, Real dash) const;
-  Molecule ledger_line (Interval) const;
-  Molecule fill (Box b) const;
-  Molecule filledbox (Box b) const;  
   Molecule accordion (SCM arg, Real interline_f) const;
-  Molecule slur (Bezier controls, Real cthick, Real thick) const;
-  Molecule text (String style, String text, Paper_def*) const;
-  Molecule staff_brace (Real dy, int) const;
-  Molecule staff_bracket (Real height, Paper_def* paper_l) const;
-  Molecule volta (Real h, Real w,  Real thick,  bool vert_start, bool vert_end) const;
-  Molecule special_time_signature (String, int,int, Paper_def*) const;
-  Molecule time_signature (int n,int d, Paper_def*) const;
 
-  String font_name_;
-  Adobe_font_metric * afm_l_;
+  static Molecule frame (Box b, Real thick);
+  static Molecule slur (Bezier controls, Real cthick, Real thick) ;
+  static Molecule beam (Real, Real, Real) ;
+  static Molecule dashed_slur (Bezier, Real thick, Real dash) ;
+  static Molecule fill (Box b) ;
+  static Molecule filledbox (Box b) ;  
+  static Molecule text (String style, String text, Paper_def*) ;
+  static Molecule staff_brace (Real dy, int) ;
+  static Molecule staff_bracket (Real height, Paper_def* paper_l) ;
 };
 
 #endif // LOOKUP_HH
index 17f2a977f28f3c28d08ed41f38937e017d49b748..25fdda52b49739298e18a3cbd2cd43cb6dcfd1b8 100644 (file)
@@ -19,6 +19,8 @@ class Note_head : public Rhythmic_head
 {
 public:
   static int compare (Note_head * const &a, Note_head *const &b) ;
+
+  Molecule ledger_line (Interval) const;
 protected:
   
   virtual void do_pre_processing();
index f1b3bf192d658b1ef9971ce0447dcbab8947ed38..d7da247660a90f0b37a419021e636ae9bbe7b97f 100644 (file)
 
 
 
+/*
+  build a ledger line for small pieces.
+ */
+Molecule
+Note_head::ledger_line (Interval xwid) const
+{
+  Drul_array<Molecule> endings;
+  endings[LEFT] = lookup_l()->afm_find ("noteheads-ledgerending");
+  Molecule * e = &endings[LEFT];
+  endings[RIGHT] = *e;
+  
+  Real thick = e->dim_[Y_AXIS].length();
+  Real len = e->dim_[X_AXIS].length () - thick;
+
+  Molecule total;
+  Direction d = LEFT;
+  do {
+    endings[d].translate_axis (xwid[d] - endings[d].dim_[X_AXIS][d], X_AXIS);
+    total.add_molecule (endings[d]);    
+  } while ((flip(&d)) != LEFT);
+
+  Real xpos = xwid [LEFT] + len;
+
+  while (xpos + len + thick /2 <= xwid[RIGHT])
+    {
+      e->translate_axis (len, X_AXIS);
+      total.add_molecule (*e);
+      xpos += len;
+    }
+
+  return total;
+}
+
 
 void
 Note_head::do_pre_processing ()
@@ -76,9 +109,8 @@ Note_head::do_brew_molecule_p() const
       Interval hd = out->dim_[X_AXIS];
       Real hw = hd.length ()/4;
       
-      Molecule ledger
-       = lookup_l ()->ledger_line  (Interval (hd[LEFT] - hw,
-                                              hd[RIGHT] + hw));
+      Molecule ledger (ledger_line  (Interval (hd[LEFT] - hw,
+                                              hd[RIGHT] + hw)));
       
       int parity =  abs(int (p)) % 2;
       
index 7bbf22594dcc22889d9bfe2a1cb727698277beab..768f07f7c71a84f3f30e742188f2de1ba0f39bc4 100644 (file)
@@ -80,7 +80,8 @@ Score_element::Score_element (Score_element const&s)
   /*
     should protect because smobify_self () might trigger GC.
    */
-  element_property_alist_ = scm_protect_object (ly_deep_copy (s.element_property_alist_));
+  SCM onstack = ly_deep_copy (s.element_property_alist_);
+  element_property_alist_ = onstack;
 
   output_p_ =0;
   status_i_ = s.status_i_;
@@ -639,7 +640,6 @@ Score_element::print_smob (SCM s, SCM port, scm_print_state *)
 void
 Score_element::do_smobify_self ()
 {
-  scm_unprotect_object (element_property_alist_); // ugh
 }
 
 SCM
index 9ea8b7a2c7ed547c3b48c25960a6c8ee0caa0c20..6258b17008f142d414fc23ced7e59b64515953e4 100644 (file)
@@ -19,6 +19,8 @@
 #include "stem.hh"
 #include "dimension-cache.hh"
 #include "group-interface.hh"
+#include "atom.hh"
+
 
 Volta_spanner::Volta_spanner ()
 {
@@ -65,8 +67,20 @@ Volta_spanner::do_brew_molecule_p () const
   Real dx = half_staff_space;
   Real w = spanner_length() - dx - get_broken_left_end_align ();
   Real h = paper_l()->get_var ("volta_spanner_height");
-  Molecule volta (lookup_l ()->volta (h, w, t, no_vertical_start, no_vertical_end));
 
+  Molecule volta; 
+
+  Atom *at = new Atom(gh_list (ly_symbol2scm ("volta"),
+                    gh_double2scm (h),
+                    gh_double2scm (w),
+                    gh_double2scm (t),
+                    gh_int2scm (no_vertical_start),
+                    gh_int2scm (no_vertical_end),
+                    SCM_UNDEFINED));
+
+  volta.dim_[Y_AXIS] = Interval (- h/2, h/2);
+  volta.dim_[X_AXIS] = Interval (0, w);
+  volta.add_atom (at->self_scm_);
   
   Molecule num (lookup_l ()->text ("volta",
                                   ly_scm2string (get_elt_property("text")),