]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-def.cc
release: 1.3.40
[lilypond.git] / lily / paper-def.cc
index 2fedfe4b32ca35c1e63618b7eaea966d371fb9a2..9234da4d1c89b793c002e1932b9f34d50a487b54 100644 (file)
@@ -3,10 +3,11 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include <math.h>
+
 #include "all-font-metrics.hh"
 #include "string.hh"
 #include "misc.hh"
 
 Paper_def::Paper_def ()
 {
-  lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
-  lookup_p_tab_p_->hash_func_ = int_hash;
+  lookup_p_tab_p_ = new map<int, Lookup*>;
 }
 
 
 Paper_def::~Paper_def ()
 {
-  for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
+  for (map<int,Lookup*>::const_iterator ai = lookup_p_tab_p_->begin();
+       ai != lookup_p_tab_p_->end (); ai++)
     {
-      delete ai.val ();
+      delete (*ai).second;
     }
   
   delete lookup_p_tab_p_;
@@ -45,13 +46,13 @@ Paper_def::Paper_def (Paper_def const&s)
   : Music_output_def (s)
 {
   shape_int_a_ = s.shape_int_a_;
-  lookup_p_tab_p_ = new Hash_table<int, Lookup*>;
-  lookup_p_tab_p_->hash_func_ = int_hash;
+  lookup_p_tab_p_ = new map<int, Lookup*>;
   
-  for (Hash_table_iter<int, Lookup*> ai(*s.lookup_p_tab_p_); ai.ok (); ai++)
+  for (map<int,Lookup*>::const_iterator ai = s.lookup_p_tab_p_->begin();
+       ai != s.lookup_p_tab_p_->end (); ai++)
     {
-      Lookup * l = new Lookup (*ai.val ());
-      set_lookup (ai.key(), l);
+      Lookup * l = new Lookup (* (*ai).second);
+      set_lookup ((*ai).first, l);      
     }
 }
 
@@ -81,7 +82,7 @@ Paper_def::get_realvar (SCM s) const
 Interval
 Paper_def::line_dimensions_int (int n) const
 {
-  SCM s = default_properties_ [ly_symbol2scm ("margin-shape")];
+  SCM s = default_properties_.get (ly_symbol2scm ("margin-shape"));
   if (!gh_pair_p (s))
     {
       Real lw =  get_var ("linewidth");
@@ -109,45 +110,21 @@ Paper_def::line_dimensions_int (int n) const
                   gh_scm2double (gh_cdr (pair)));
 }
 
-Real
-Paper_def::length_mom_to_dist (Moment d,Real k) const
-{
-  return arithmetic_spacing (d,k);
-}
-
-
-/**
-  Get the measure wide constant for arithmetic spacing.
-
-  @see
-  John S. Gourlay. ``Spacing a Line of Music,'' Technical Report
-  OSU-CISRC-10/87-TR35, Department of Computer and Information Science,
-  The Ohio State University, 1987.
-
-  */
-Real
-Paper_def::arithmetic_constant (Moment d) const
-{
-  return get_var ("arithmetic_basicspace") - log_2 (Moment (1,8) <? d);
-}
-
-Real
-Paper_def::arithmetic_spacing (Moment d ,Real k) const
-{
-  return (log_2 (d) + k)* get_var ("arithmetic_multiplier");
-}
-
 void
 Paper_def::set_lookup (int i, Lookup*l)
 {
-  if (lookup_p_tab_p_->elem_b (i))
+  map<int,Lookup*> :: const_iterator it (lookup_p_tab_p_->find (i));
+  if (it != lookup_p_tab_p_->end ())
     {
-      delete lookup_p_tab_p_->elem (i);
+      delete (*it).second;
     }
   (*lookup_p_tab_p_)[i] = l;
 }
 
 
+/*
+  junkme.
+ */
 Real
 Paper_def::interbeam_f (int multiplicity_i) const
 {
@@ -164,12 +141,12 @@ Paper_def::print () const
 #ifndef NPRINT
   Music_output_def::print ();
   DEBUG_OUT << "Paper {";
-
-  for (Hash_table_iter<int, Lookup*> ai(*lookup_p_tab_p_); ai.ok (); ai++)
+  for (map<int,Lookup*>::const_iterator ai = lookup_p_tab_p_->begin();
+       ai != lookup_p_tab_p_->end (); ai++)
     {
-      DEBUG_OUT << "Lookup: " << ai.key () << " = " << ai.val ()->font_name_ << '\n';
+      DEBUG_OUT << "Lookup: " << (*ai).first
+               << " = " << (*ai).second->font_name_ << '\n';
     }
-
   DEBUG_OUT << "}\n";
 #endif
 }