]> git.donarmstrong.com Git - lilypond.git/commitdiff
Move Skyline_pair and Paper_system bindings into their own files.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 1 May 2008 19:44:21 +0000 (16:44 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 1 May 2008 19:44:21 +0000 (16:44 -0300)
15 files changed:
lily/align-interface.cc
lily/axis-group-interface.cc
lily/include/lily-proto.hh
lily/include/prob.hh
lily/include/skyline-pair.hh [new file with mode: 0644]
lily/include/skyline.hh
lily/paper-column.cc
lily/paper-system-scheme.cc [new file with mode: 0644]
lily/prob-scheme.cc
lily/separation-item.cc
lily/skyline-pair.cc [new file with mode: 0644]
lily/skyline.cc
lily/spacing-interface.cc
lily/spacing-spanner.cc
lily/system.cc

index daffa298fb1226d7c029034a81fa61aab3b2ebea..057e233f443d6522ddf4bddc5d74b7a515881dde 100644 (file)
@@ -7,16 +7,17 @@
 */
 
 #include "align-interface.hh"
-#include "spanner.hh"
-#include "item.hh"
 #include "axis-group-interface.hh"
-#include "pointer-group-interface.hh"
-#include "hara-kiri-group-spanner.hh"
 #include "grob-array.hh"
+#include "hara-kiri-group-spanner.hh"
 #include "international.hh"
+#include "item.hh"
+#include "paper-column.hh"
+#include "pointer-group-interface.hh"
+#include "spanner.hh"
+#include "skyline-pair.hh"
 #include "system.hh"
 #include "warn.hh"
-#include "paper-column.hh"
 
 /*
   TODO: for vertical spacing, should also include a rod & spring
index 121b0ba1596e0736fddb246db07ef2b502083db6..186205195a609543ac02d4c40896fe74d7819837 100644 (file)
@@ -18,6 +18,7 @@
 #include "paper-column.hh"
 #include "paper-score.hh"
 #include "separation-item.hh"
+#include "skyline-pair.hh"
 #include "stencil.hh"
 #include "system.hh"
 #include "warn.hh"
index 8de07c990bf4a316c9b9afbc292ff543de8f85af..e9a82a756b394d70952e356fb5d12a2ff2f95098 100644 (file)
@@ -154,6 +154,7 @@ class Simultaneous_music;
 class Simultaneous_music_iterator;
 class Skyline;
 class Skyline_entry;
+class Skyline_pair;
 class Slur_configuration;
 class Slur_score_state;
 class Source_file;
index b01fb4d42d6e8acc0ea9d389499c2c5f2ba037ca..635df370e1c533d17a6453f4e097ca7057e29188 100644 (file)
@@ -20,6 +20,7 @@
   formatted content of the grob is put into a
   Property_object. Page-breaking handles Property_object objects.
 */
+
 class Prob
 {
   DECLARE_SMOBS (Prob);
@@ -45,8 +46,12 @@ public:
   void instrumented_set_property (SCM, SCM, const char*, int, const char*);
   void internal_set_property (SCM sym, SCM val);
 };
+
 DECLARE_UNSMOB(Prob,prob);
+
 SCM ly_prob_set_property_x (SCM system, SCM sym, SCM value);
 SCM ly_prob_property (SCM system, SCM sym, SCM dfault);
 
+SCM ly_prob_type_p (SCM obj, SCM sym);
+  
 #endif /* PROPERTY_OBJECT_HH */
diff --git a/lily/include/skyline-pair.hh b/lily/include/skyline-pair.hh
new file mode 100644 (file)
index 0000000..4b57100
--- /dev/null
@@ -0,0 +1,35 @@
+/* 
+  skyline-pair.hh -- declare Skyline_pair
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2008 Han-Wen Nienhuys <hanwen@lilypond.org>
+  
+*/
+
+#ifndef SKYLINE_PAIR_HH
+#define SKYLINE_PAIR_HH
+
+#include "skyline.hh"
+
+class Skyline_pair
+{
+private:
+  Drul_array<Skyline> skylines_;
+
+  DECLARE_SIMPLE_SMOBS(Skyline_pair);
+public:
+  Skyline_pair ();
+  Skyline_pair (vector<Box> const &boxes, Real horizon_padding, Axis a);
+  Skyline_pair (Box const &, Real horizon_padding, Axis a);
+  void raise (Real);
+  void shift (Real);
+  void insert (Box const &, Real horizon_padding, Axis);
+  void merge (Skyline_pair const &other);
+  Skyline &operator [] (Direction d);
+  Skyline const &operator [] (Direction d) const;
+  bool is_empty () const;
+  void print () const;
+};
+
+#endif /* SKYLINE_PAIR_HH */
index 5dadbacaf736f6503cf7e444c4bc448324556ad1..312fae8265c8e9eda869aaaa83dde122f89ef4e6 100644 (file)
@@ -70,24 +70,5 @@ public:
   bool is_empty () const;
 };
 
-class Skyline_pair
-{
-private:
-  Drul_array<Skyline> skylines_;
-
-  DECLARE_SIMPLE_SMOBS(Skyline_pair);
-public:
-  Skyline_pair ();
-  Skyline_pair (vector<Box> const &boxes, Real horizon_padding, Axis a);
-  Skyline_pair (Box const &, Real horizon_padding, Axis a);
-  void raise (Real);
-  void shift (Real);
-  void insert (Box const &, Real horizon_padding, Axis);
-  void merge (Skyline_pair const &other);
-  Skyline &operator [] (Direction d);
-  Skyline const &operator [] (Direction d) const;
-  bool is_empty () const;
-};
-
 #endif /* SKYLINE_HH */
 
index 8c9e0aea4eec10a8607358dc777557f795834a72..0eb40d1b97a48c8297ff378de172d65de6cd5072 100644 (file)
@@ -8,23 +8,24 @@
 
 #include "paper-column.hh"
 
-#include "break-align-interface.hh"
-#include "moment.hh"
-#include "paper-score.hh"
-#include "warn.hh"
 #include "axis-group-interface.hh"
-#include "spaceable-grob.hh"
-#include "text-interface.hh"
-#include "lookup.hh"
+#include "break-align-interface.hh"
 #include "font-interface.hh"
-#include "output-def.hh"
-#include "pointer-group-interface.hh"
 #include "grob-array.hh"
-#include "system.hh"
-#include "spring.hh"
 #include "lookup.hh"
+#include "lookup.hh"
+#include "moment.hh"
+#include "output-def.hh"
+#include "paper-score.hh"
+#include "pointer-group-interface.hh"
 #include "separation-item.hh"
+#include "skyline-pair.hh"
+#include "spaceable-grob.hh"
+#include "spring.hh"
 #include "string-convert.hh"
+#include "system.hh"
+#include "text-interface.hh"
+#include "warn.hh"
 
 Grob *
 Paper_column::clone () const
diff --git a/lily/paper-system-scheme.cc b/lily/paper-system-scheme.cc
new file mode 100644 (file)
index 0000000..6935110
--- /dev/null
@@ -0,0 +1,44 @@
+/* 
+  paper-system-scheme.cc -- implement Paper_system bindings.
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2008 Han-Wen Nienhuys <hanwen@lilypond.org>
+  
+*/
+
+#include "prob.hh"
+
+#include "skyline-pair.hh"
+  
+LY_DEFINE (ly_paper_system_p, "ly:paper-system?",
+         1, 0, 0, (SCM obj),
+         "Type predicate.")
+{
+  return ly_prob_type_p (obj, ly_symbol2scm ("paper-system"));
+}
+
+LY_DEFINE (ly_paper_system_minimum_distance, "ly:paper-system-minimum-distance",
+          2, 0, 0, (SCM sys1, SCM sys2),
+          "Measure the minimum distance between these two paper-systems,"
+          " using their stored skylines if possible and falling back to"
+          " their extents otherwise.")
+{
+  Real ret = 0;
+  Prob *p1 = unsmob_prob (sys1);
+  Prob *p2 = unsmob_prob (sys2);
+  Skyline_pair *sky1 = Skyline_pair::unsmob (p1->get_property ("vertical-skylines"));
+  Skyline_pair *sky2 = Skyline_pair::unsmob (p2->get_property ("vertical-skylines"));
+
+  if (sky1 && sky2)
+    ret = (*sky1)[DOWN].distance ((*sky2)[UP]);
+  else
+    {
+      Stencil *s1 = unsmob_stencil (p1->get_property ("stencil"));
+      Stencil *s2 = unsmob_stencil (p2->get_property ("stencil"));
+      Interval iv1 = s1->extent (Y_AXIS);
+      Interval iv2 = s2->extent (Y_AXIS);
+      ret = iv2[UP] - iv1[DOWN];
+    }
+  return scm_from_double (ret);
+}
index 8c5d640ad0d3b5d9501c57c8f800d723504df8b3..52b32b96f5b78c58ee413128bd9fa88340804d9a 100644 (file)
@@ -7,7 +7,6 @@
 */
 
 #include "prob.hh"
-#include "skyline.hh"
 
 LY_DEFINE (ly_prob_set_property_x, "ly:prob-set-property!",
           2, 1, 0, (SCM obj, SCM sym, SCM value),
@@ -76,36 +75,3 @@ LY_DEFINE (ly_make_prob, "ly:make-prob",
   
   return pr->unprotect ();
 }
-
-  
-LY_DEFINE (ly_paper_system_p, "ly:paper-system?",
-         1, 0, 0, (SCM obj),
-         "Type predicate.")
-{
-  return ly_prob_type_p (obj, ly_symbol2scm ("paper-system"));
-}
-
-LY_DEFINE (ly_paper_system_minimum_distance, "ly:paper-system-minimum-distance",
-          2, 0, 0, (SCM sys1, SCM sys2),
-          "Measure the minimum distance between these two paper-systems,"
-          " using their stored skylines if possible and falling back to"
-          " their extents otherwise.")
-{
-  Real ret = 0;
-  Prob *p1 = unsmob_prob (sys1);
-  Prob *p2 = unsmob_prob (sys2);
-  Skyline_pair *sky1 = Skyline_pair::unsmob (p1->get_property ("vertical-skylines"));
-  Skyline_pair *sky2 = Skyline_pair::unsmob (p2->get_property ("vertical-skylines"));
-
-  if (sky1 && sky2)
-    ret = (*sky1)[DOWN].distance ((*sky2)[UP]);
-  else
-    {
-      Stencil *s1 = unsmob_stencil (p1->get_property ("stencil"));
-      Stencil *s2 = unsmob_stencil (p2->get_property ("stencil"));
-      Interval iv1 = s1->extent (Y_AXIS);
-      Interval iv2 = s2->extent (Y_AXIS);
-      ret = iv2[UP] - iv1[DOWN];
-    }
-  return scm_from_double (ret);
-}
index 5c9eb9ef10439826317203c17eee4547fc60988e..8e48cf5cccc137f26b09626ee764fef7b53681bc 100644 (file)
@@ -8,15 +8,15 @@
 
 #include "separation-item.hh"
 
+#include "accidental-placement.hh"
 #include "axis-group-interface.hh"
 #include "lookup.hh"
 #include "note-head.hh"
-#include "stencil.hh"
-#include "skyline.hh"
 #include "paper-column.hh"
-#include "warn.hh"
 #include "pointer-group-interface.hh"
-#include "accidental-placement.hh"
+#include "skyline-pair.hh"
+#include "stencil.hh"
+#include "warn.hh"
 
 void
 Separation_item::add_item (Grob *s, Item *i)
diff --git a/lily/skyline-pair.cc b/lily/skyline-pair.cc
new file mode 100644 (file)
index 0000000..4ce4458
--- /dev/null
@@ -0,0 +1,97 @@
+/* 
+  skyline-pair.cc -- implement Skyline_pair
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2008 Han-Wen Nienhuys <hanwen@lilypond.org>
+  
+*/
+
+#include "skyline-pair.hh"
+
+#include "ly-smobs.icc"
+
+Skyline_pair::Skyline_pair ()
+  : skylines_ (Skyline (DOWN), Skyline (UP))
+{
+}
+
+Skyline_pair::Skyline_pair (vector<Box> const &boxes, Real padding, Axis a)
+  : skylines_ (Skyline (boxes, padding, a, DOWN), Skyline (boxes, padding, a, UP))
+{
+}
+
+Skyline_pair::Skyline_pair (Box const &b, Real padding, Axis a)
+  : skylines_ (Skyline (b, padding, a, DOWN), Skyline (b, padding, a, UP))
+{
+}
+
+void
+Skyline_pair::raise (Real r)
+{
+  skylines_[UP].raise (r);
+  skylines_[DOWN].raise (r);
+}
+
+void
+Skyline_pair::shift (Real r)
+{
+  skylines_[UP].shift (r);
+  skylines_[DOWN].shift (r);
+}
+
+void
+Skyline_pair::insert (Box const &b, Real padding, Axis a)
+{
+  skylines_[UP].insert (b, padding, a);
+  skylines_[DOWN].insert (b, padding, a);
+}
+
+void
+Skyline_pair::merge (Skyline_pair const &other)
+{
+  skylines_[UP].merge (other[UP]);
+  skylines_[DOWN].merge (other[DOWN]);
+}
+
+
+bool
+Skyline_pair::is_empty () const
+{
+  return skylines_[UP].is_empty ()
+    && skylines_[DOWN].is_empty ();
+}
+
+Skyline&
+Skyline_pair::operator [] (Direction d)
+{
+  return skylines_[d];
+}
+
+Skyline const&
+Skyline_pair::operator [] (Direction d) const
+{
+  return skylines_[d];
+}
+
+IMPLEMENT_SIMPLE_SMOBS (Skyline_pair);
+IMPLEMENT_TYPE_P (Skyline_pair, "ly:skyline-pair?");
+IMPLEMENT_DEFAULT_EQUAL_P (Skyline_pair);
+
+
+
+SCM
+Skyline_pair::mark_smob (SCM)
+{
+  return SCM_EOL;
+}
+
+int
+Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
+{
+  Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
+  (void) r;
+
+  scm_puts ("#<Skyline-pair>", port);
+  return 1;
+}
index e0139a68668ecc46f4a7682bed85abb8812c1786..5297f6359ab91ea58642e9f552eca313031217ac 100644 (file)
@@ -541,67 +541,6 @@ Skyline::is_empty () const
   return b.end_ == infinity_f && b.y_intercept_ == -infinity_f;
 }
 
-Skyline_pair::Skyline_pair ()
-  : skylines_ (Skyline (DOWN), Skyline (UP))
-{
-}
-
-Skyline_pair::Skyline_pair (vector<Box> const &boxes, Real padding, Axis a)
-  : skylines_ (Skyline (boxes, padding, a, DOWN), Skyline (boxes, padding, a, UP))
-{
-}
-
-Skyline_pair::Skyline_pair (Box const &b, Real padding, Axis a)
-  : skylines_ (Skyline (b, padding, a, DOWN), Skyline (b, padding, a, UP))
-{
-}
-
-void
-Skyline_pair::raise (Real r)
-{
-  skylines_[UP].raise (r);
-  skylines_[DOWN].raise (r);
-}
-
-void
-Skyline_pair::shift (Real r)
-{
-  skylines_[UP].shift (r);
-  skylines_[DOWN].shift (r);
-}
-
-void
-Skyline_pair::insert (Box const &b, Real padding, Axis a)
-{
-  skylines_[UP].insert (b, padding, a);
-  skylines_[DOWN].insert (b, padding, a);
-}
-
-void
-Skyline_pair::merge (Skyline_pair const &other)
-{
-  skylines_[UP].merge (other[UP]);
-  skylines_[DOWN].merge (other[DOWN]);
-}
-
-bool
-Skyline_pair::is_empty () const
-{
-  return skylines_[UP].is_empty ()
-    && skylines_[DOWN].is_empty ();
-}
-
-Skyline&
-Skyline_pair::operator [] (Direction d)
-{
-  return skylines_[d];
-}
-
-Skyline const&
-Skyline_pair::operator [] (Direction d) const
-{
-  return skylines_[d];
-}
 
 /****************************************************************/
 
@@ -610,10 +549,6 @@ IMPLEMENT_SIMPLE_SMOBS (Skyline);
 IMPLEMENT_TYPE_P (Skyline, "ly:skyline?");
 IMPLEMENT_DEFAULT_EQUAL_P (Skyline);
 
-IMPLEMENT_SIMPLE_SMOBS (Skyline_pair);
-IMPLEMENT_TYPE_P (Skyline_pair, "ly:skyline-pair?");
-IMPLEMENT_DEFAULT_EQUAL_P (Skyline_pair);
-
 SCM
 Skyline::mark_smob (SCM)
 {
@@ -631,19 +566,3 @@ Skyline::print_smob (SCM s, SCM port, scm_print_state *)
 
   return 1;
 }
-
-SCM
-Skyline_pair::mark_smob (SCM)
-{
-  return SCM_EOL;
-}
-
-int
-Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
-{
-  Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
-  (void) r;
-
-  scm_puts ("#<Skyline-pair>", port);
-  return 1;
-}
index 2033cfcac43898dfc6b68e3dbb87d6aca6847501..d494c318c5ef820ca7759264c30c9a0f880c3842 100644 (file)
@@ -17,6 +17,7 @@
 #include "paper-column.hh"
 #include "separation-item.hh"
 #include "skyline.hh"
+#include "skyline-pair.hh"
 #include "system.hh"
 
 /* return the right-pointing skyline of the left-items and the left-pointing
index e580e33267cda1879fa665b22c7d2aaa0c4820dd..74e54e7eac7d308672ecb44e73e8704c37244656 100644 (file)
@@ -21,6 +21,7 @@
 #include "paper-score.hh"
 #include "pointer-group-interface.hh"
 #include "separation-item.hh"
+#include "skyline-pair.hh"
 #include "spaceable-grob.hh"
 #include "spacing-interface.hh"
 #include "staff-spacing.hh"
index a2ad71ece35dc8cb8df9e1c4e1b691972b4faa5a..6143d7acb051f2380762c61dc5bdc2a229d259dd 100644 (file)
 #include "axis-group-interface.hh"
 #include "grob-array.hh"
 #include "international.hh"
+#include "lookup.hh"
 #include "main.hh"
 #include "output-def.hh"
 #include "paper-column.hh"
 #include "paper-score.hh"
 #include "paper-system.hh"
 #include "pointer-group-interface.hh"
+#include "skyline-pair.hh"
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
-#include "lookup.hh"
 
 extern bool debug_skylines;