summaryrefslogtreecommitdiff
path: root/line.cc
diff options
context:
space:
mode:
Diffstat (limited to 'line.cc')
-rw-r--r--line.cc101
1 files changed, 53 insertions, 48 deletions
diff --git a/line.cc b/line.cc
index a6e0f7c68a..293214dc30 100644
--- a/line.cc
+++ b/line.cc
@@ -1,19 +1,27 @@
#include "line.hh"
#include "dimen.hh"
+#include "spanner.hh"
#include "symbol.hh"
#include "paper.hh"
#include "pcol.hh"
#include "pscore.hh"
+static String
+make_vbox(Interval i)
+{
+
+ String s("\\vbox to ");
+ s += print_dimen(i.length());
+ s += "{\\vskip "+print_dimen(i.max)+" ";
+ return s;
+}
+
+
String
Line_of_staff::TeXstring() const
{
- String s("%line_of_staff\n\\vbox to ");
- s += print_dimen(maxheight() ) +"{";
-
- //make some room
- s += vstrut(base);
-
+ String s("%line_of_staff\n");
+ s+=make_vbox(height());
// the staff itself: eg lines, accolades
s += "\\hbox{";
{
@@ -28,7 +36,8 @@ Line_of_staff::TeXstring() const
lastpos = cc->hpos;
// moveover
- s +=String( "\\kern ") + print_dimen(delta);
+ if (delta)
+ s +=String( "\\kern ") + print_dimen(delta);
// now output the items.
@@ -46,44 +55,8 @@ Line_of_staff::TeXstring() const
return s;
}
-String
-Line_of_score::TeXstring() const
-{
- String s("\\vbox{");
- for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++){
- s += sc->TeXstring();
- if ((sc+1).ok())
- s+= "\\interstaffline\n";
- }
- s += "}";
- return s;
-}
-
-/// testing this entry
-Line_of_score::Line_of_score(svec<const PCol *> sv,
- const PScore *ps)
-{
- score = ps;
- for (int i=0; i< sv.sz(); i++) {
- PCol *p=(PCol *) sv[i];
- cols.bottom().add(p);
- p->line=this;
- }
-
- for (PCursor<PStaff*> sc(score->staffs); sc.ok(); sc++)
- staffs.bottom().add(new Line_of_staff(this, sc));
-}
-/** construct a line with the named columns. Make the line field
- in each column point to this
-
- #sv# isn't really const!!
- */
-
Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
{
- // [don't know how to calc dimensions yet.]
- height = 0.0;
- base =0.0;
scor=sc;
pstaff_=st;
@@ -101,8 +74,8 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
}
-Real
-Line_of_staff::maxheight() const
+Interval
+Line_of_staff::height() const
{
Interval y;
{
@@ -113,8 +86,6 @@ Line_of_staff::maxheight() const
// all items in the current line & staff.
for (; cc.ok(); cc++) {
-
-
for (PCursor<const Item *> ic(cc->its); ic.ok(); ic++) {
if (ic->pstaff_ == pstaff_) {
y.unite(ic->height());
@@ -126,7 +97,41 @@ Line_of_staff::maxheight() const
assert(false);
}
}
- return y.max;
+ return y;
+}
+
+
+/****************************************************************/
+String
+Line_of_score::TeXstring() const
+{
+ String s("\\vbox{%<- line of score\n");
+ for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++){
+ s += sc->TeXstring();
+ if ((sc+1).ok())
+ s+= "\\interstaffline\n";
+ }
+ s += "}";
+ return s;
}
+/// testing this entry
+Line_of_score::Line_of_score(svec<const PCol *> sv,
+ const PScore *ps)
+{
+ score = ps;
+ for (int i=0; i< sv.sz(); i++) {
+ PCol *p=(PCol *) sv[i];
+ cols.bottom().add(p);
+ p->line=this;
+ }
+
+ for (PCursor<PStaff*> sc(score->staffs); sc.ok(); sc++)
+ staffs.bottom().add(new Line_of_staff(this, sc));
+}
+/** construct a line with the named columns. Make the line field
+ in each column point to this
+
+ #sv# isn't really const!!
+ */