DELETED, // to catch malloc mistakes.
};
- Status status;
+ Status status_;
public:
PScore *pscore_l_;
Interval height() const;
virtual void translate_x(Real);
virtual void translate_y(Real);
+ Status status() const;
/**
translate the symbol. The symbol does not have to be created yet.
void unlink();
void unlink_all();
+ void substitute_dependency(Score_elem*,Score_elem*);
void remove_dependency(Score_elem*);
/**
add a dependency. It may be the 0 pointer, in which case, it is ignored.
virtual Item * item() { return 0; }
virtual Line_of_score * line_l() const;
SCORE_ELEM_CLONE(Score_elem);
+ Score_elem* dependency(int) const;
+ Score_elem* dependent(int) const;
+ int dependent_size() const;
+ int dependency_size() const;
+
+ /// no dimension, translation is noop
+ bool empty_b_;
+ /// do not print anything black
+ bool transparent_b_;
protected:
virtual Interval do_height()const;
virtual void handle_broken_dependencies();
virtual void handle_prebroken_dependencies();
- Score_elem* dependency(int) const;
- Score_elem* dependent(int) const;
- int dependent_size() const;
- int dependency_size() const;
- /// no dimension, translation is noop
- bool empty_b_;
- /// do not print anything black
- bool transparent_b_;
};
String
Score_elem::TeX_string() const
{
- assert( status > POSTCALCED);
+ assert( status_ > POSTCALCED);
if (transparent_b_ )
return "";
String s( "\\placebox{%}{%}{%}");
copy_edges_out(s);
x_group_element_i_ = 0;
y_group_element_i_ = 0;
- status = s.status;
+ status_ = s.status_;
assert(!s.output);
output = 0;
pscore_l_ = s.pscore_l_;
Score_elem::~Score_elem()
{
// some paranoia to prevent weird segv's
- assert(status < DELETED);
+ assert(status_ < DELETED);
delete output;
- status = DELETED;
+ status_ = DELETED;
output = 0;
assert(!x_group_element_i_ && !y_group_element_i_);
}
pscore_l_=0;
offset_ = Offset(0,0);
output = 0;
- status = ORPHAN;
+ status_ = ORPHAN;
}
void
Score_elem::add_processing()
{
- if (status >= VIRGIN)
+ if (status_ >= VIRGIN)
return;
- status = VIRGIN;
+ status_ = VIRGIN;
do_add_processing();
}
void
Score_elem::pre_processing()
{
- if (status >= PRECALCED )
+ if (status_ >= PRECALCED )
return;
- assert(status != PRECALCING); // cyclic dependency
- status = PRECALCING;
+ assert(status_ != PRECALCING); // cyclic dependency
+ status_ = PRECALCING;
for (int i=0; i < dependency_size(); i++)
dependency(i)->pre_processing();
do_pre_processing();
- status = PRECALCED;
+ status_ = PRECALCED;
}
void
Score_elem::breakable_col_processing()
{
- if (status >= PREBROKEN )
+ if (status_ >= PREBROKEN )
return;
- assert(status != PREBREAKING); // cyclic dependency
- status = PREBREAKING;
+ assert(status_ != PREBREAKING); // cyclic dependency
+ status_ = PREBREAKING;
for (int i=0; i < dependency_size(); i++)
dependency(i)->breakable_col_processing();
do_breakable_col_processing();
- status = PREBROKEN;
+ status_ = PREBROKEN;
}
void
Score_elem::break_processing()
{
- if (status >= BROKEN )
+ if (status_ >= BROKEN )
return;
- assert(status != BREAKING); // cyclic dependency
- status = BREAKING;
+ assert(status_ != BREAKING); // cyclic dependency
+ status_ = BREAKING;
for (int i=0; i < dependency_size(); i++)
dependency(i)->break_processing();
do_break_processing();
- status = BROKEN;
+ status_ = BROKEN;
}
void
void
Score_elem::post_processing()
{
- if (status >= POSTCALCED)
+ if (status_ >= POSTCALCED)
return;
- assert(status != POSTCALCING);// cyclic dependency
- status=POSTCALCING;
+ assert(status_ != POSTCALCING);// cyclic dependency
+ status_=POSTCALCING;
for (int i=0; i < dependency_size(); i++)
dependency(i)->post_processing();
do_post_processing();
- status=POSTCALCED;
+ status_=POSTCALCED;
+}
+
+Score_elem::Status
+Score_elem::status()const
+{
+ return status_;
}
void
Score_elem::molecule_processing()
{
- if (status >= OUTPUT)
+ if (status_ >= OUTPUT)
return;
- status = OUTPUT; // do it only once.
+ status_ = OUTPUT; // do it only once.
for (int i=0; i < dependency_size(); i++)
dependency(i)->molecule_processing();
}
void
Score_elem::do_substitute_dependent(Score_elem*,Score_elem*)
-{}
+{
+}
IMPLEMENT_STATIC_NAME(Score_elem);
Score_elem::remove_dependency(Score_elem*e)
{
remove_edge_out(e);
- e->do_substitute_dependent(this, 0);
- do_substitute_dependency(e, 0);
+ substitute_dependency(e, 0);
}
void
{
Directed_graph_node::add(e);
}
-
+void
+Score_elem::substitute_dependency(Score_elem* old, Score_elem* new_l)
+{
+ do_substitute_dependency(old,new_l);
+ old->do_substitute_dependent(this, 0);
+}
void
Score_elem::handle_broken_dependencies()
if (elt->spanner()) {
Spanner * sp = elt->spanner();
Spanner * broken = sp->find_broken_piece(line);
- do_substitute_dependency(sp, broken);
+ substitute_dependency(sp, broken);
add_dependency(broken);
} else if (elt->item() && elt->item()->pcol_l_->breakpoint_b()
&& elt->item()->break_status_i() == 0) {
Item * my_item = elt->item()->find_prebroken_piece(line);
- do_substitute_dependency( elt, my_item);
+ substitute_dependency( elt, my_item);
if (my_item)
add_dependency( my_item);
}
/* Reset this. If we are a (broken) copy of a spanner, then
break_processing() was not called on us (and we are not breaking). */
- if (status < BROKEN)
- status = BROKEN;
+ if (status_ < BROKEN)
+ status_ = BROKEN;
}
/*
/*
see comment at handle_broken_dependencies()
*/
- if (status < PREBROKEN)
- status = PREBROKEN;
+ if (status_ < PREBROKEN)
+ status_ = PREBROKEN;
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "dimen.hh"
#include "span-bar.hh"
#include "lookup.hh"
#include "symbol.hh"
}
spanning_l_arr_.substitute( bold , b);
+}
+/*
+ A no-op if not yet output: the span_bar slavish follows what it spans
+ */
+void
+Span_bar::translate_y(Real y)
+{
+ if (status() == OUTPUT)
+ Score_elem::translate_y(y);
}
void
}
+Interval
+Span_bar::do_width() const
+{
+ return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x; // ugh
+}
void
Span_bar::do_pre_processing()
{
transparent_b_ = true;
empty_b_ =true;
} else {
- type_str_ = spanning_l_arr_[0]->type_str_;
+ if (type_str_ == "")
+ type_str_ = spanning_l_arr_[0]->type_str_;
if (type_str_ =="") {
transparent_b_=true;
empty_b_ = true;
}
}
+Symbol
+Span_bar::get_bar_sym(Real dy) const
+{
+ return paper()->lookup_l()->bar(type_str_, dy);
+}
+
Molecule*
Span_bar::brew_molecule_p()const
{
Interval y;
for (int i=0; i < spanning_l_arr_.size(); i++)
y.unite( spanning_l_arr_[i]->height() );
- Symbol s = paper()->lookup_l()->bar(type_str_, y.length());
+ Symbol s = get_bar_sym(y.length());
Molecule*output = new Molecule(Atom(s));
output->translate_y ( y[-1] );