\notes \relative c'' \context GrandStaff <
\context Staff = up { c4 c4 }
\context Staff = down { \property Staff. staffLineLeading = #5.5 c4
- <c8 d f g>
+ [<c8 d f g>
+ e]
+ [f c']
}
>
}
void
Beam::set_direction (Direction d)
{
- set_direction ( d);
+ Directional_spanner::set_direction (d);
for (int i=0; i <stems_.size (); i++)
{
Stem *s = stems_[i];
void
Clef_item::do_pre_processing()
{
- translate_axis (y_position_i_ * staff_line_leading_f () / 2.0, Y_AXIS);
+ Staff_symbol_referencer::do_pre_processing();
SCM style_sym =get_elt_property ("style");
String style;
if (style_sym != SCM_UNDEFINED)
set_elt_property ("breakable", SCM_BOOL_T);
symbol_ = "treble";
- y_position_i_ = -2;
+ set_position(-2);
}
void
set_direction (get_default_dir());
}
-Directional_spanner::Directional_spanner()
-{
- set_direction (CENTER);
-}
Offset
Directional_spanner::center () const
int
Dot_column::compare (Dots * const &d1, Dots * const &d2)
{
- return d1->position_i_ - d2->position_i_;
+ return int (d1->position_f () - d2->position_f ());
}
void
for (int i=0; i < dot_l_arr_.size (); i++)
{
for (int j=0; j < taken_posns.size (); j++)
- if (taken_posns[j] == dot_l_arr_[i]->position_i_)
+ if (taken_posns[j] == (int) dot_l_arr_[i]->position_f ())
conflicts++;
- taken_posns.push (dot_l_arr_[i]->position_i_);
- s.unite (Slice (dot_l_arr_[i]->position_i_,dot_l_arr_[i]->position_i_));
+ taken_posns.push ((int)dot_l_arr_[i]->position_f ());
+ s.unite (Slice ((int)dot_l_arr_[i]->position_f (),
+ (int)dot_l_arr_[i]->position_f ()));
}
if (!conflicts)
for (int i=0; i <dot_l_arr_.size (); pos += 2, i++)
{
- dot_l_arr_[i]->position_i_ = pos;
+ dot_l_arr_[i]->set_position(pos);
}
}
Dots::Dots ()
{
dots_i_ =0;
- position_i_ =0;
resolve_dir_ =CENTER;
}
{
Molecule *out = new Molecule;
Molecule fill = lookup_l ()->fill (Box (Interval (0,0),
- Interval (0,0)));
+ Interval (0,0)));
out->add_molecule (fill);
Molecule d = lookup_l ()->dots ();
#include "item.hh"
#include "staff-symbol-referencer.hh"
#include "parray.hh"
+#include "directional-element.hh"
-class Breathing_sign : public Item, public Staff_symbol_referencer {
+class Breathing_sign : public Item,
+ public Staff_symbol_referencer,
+ public Directional_element
+{
public:
VIRTUAL_COPY_CONS(Score_element);
Breathing_sign ();
void set_vertical_position (Direction);
- void set_direction (Direction d ) { dir_ = d; }
- Direction get_direction () const { return dir_; }
protected:
virtual void do_post_processing ();
virtual Molecule* do_brew_molecule_p () const;
-
-private:
- Direction dir_;
};
+
+
#endif // BREATHING_SIGN_HH
public:
String symbol_;
- int y_position_i_;
VIRTUAL_COPY_CONS(Score_element);
Clef_item();
#define DIRECTIONALSPANNER_HH
#include "spanner.hh"
+#include "directional-element.hh"
/** a spanner which can be pointing "up" or "down".
JUNKME?
*/
-class Directional_spanner : public Spanner{
- /// -1 below heads, +1 above heads.
- Direction dir_;
-
+class Directional_spanner : public Spanner, public Directional_element {
public:
- Directional_spanner();
-
- void set_direction (Direction d ) { dir_ = d; }
- Direction get_direction () const { return dir_; }
/// offset of "center" relative to left-column/0-pos of staff
virtual Offset center() const;
virtual void do_post_processing ();
public:
int dots_i_;
- int position_i_;
Direction resolve_dir_;
Dots ();
virtual ~Paper_def ();
Array<Interval> shape_int_a_;
+ /*
+ JUNKME
+ */
Real get_realvar (SCM symbol) const;
Real get_var (String id) const;
class Rest : public Rhythmic_head
{
public:
- Rest ();
void add_dots (Dots*);
protected:
virtual void do_add_processing ();
public:
Stem * stem_l_;
int balltype_i_;
- int position_i_;
Dots * dots_l_;
Rhythmic_head ();
int dots_i ()const;
- virtual Real position_f () const;
protected:
virtual void do_post_processing ();
- virtual void do_pre_processing ();
+
virtual void do_print () const;
virtual void do_substitute_element_pointer (Score_element*,Score_element*);
};
A bar that is on a staff.
Ugh. Entita non multiplicandum ...
*/
-class Staff_bar : public Bar , public Staff_symbol_referencer
+class Staff_bar : public Bar, public Staff_symbol_referencer
{
public:
+ virtual void do_pre_processing ();
VIRTUAL_COPY_CONS(Score_element);
virtual Real get_bar_size () const;
};
#include "spanner.hh"
#include "item.hh"
#include "staff-symbol-referencer.hh"
+#include "directional-element.hh"
/**
Position myself next to a set of elements. Configurable in axis
Amount of extra space to add.
*/
-class Staff_side_element : public Staff_symbol_referencer
+class Staff_side_element : public Staff_symbol_referencer,
+ public Directional_element
{
void position_self ();
- Direction dir_;
+
public:
Score_element * to_position_l_;
- void set_direction (Direction d ) { dir_ = d; }
- Direction get_direction () const { return dir_; }
-
Link_array<Score_element> support_l_arr_;
Axis axis_;
{
protected:
Staff_symbol * staff_sym_l_;
-
+ int position_i_;
public:
Staff_symbol_referencer ();
+ void set_position (int);
+
void set_staff_symbol (Staff_symbol*);
/**
Leading are the lead strips between the sticks (lines) of
Staff_symbol * staff_symbol_l () const;
int lines_i () const;
virtual void do_substitute_element_pointer (Score_element*,Score_element*);
-
+ virtual void do_pre_processing ();
virtual Real position_f () const;
};
#include "moment.hh"
#include "molecule.hh"
#include "staff-symbol-referencer.hh"
+#include "directional-element.hh"
/**the rule attached to the ball.
takes care of:
*/
// todo: remove baseclass Staff_symbol_referencer, since stem
// can be across a staff.
-class Stem : public Item, public Staff_symbol_referencer {
+class Stem : public Item, public Staff_symbol_referencer,
+ public Directional_element
+{
/**extent of the stem (positions).
fractional, since Beam has to adapt them.
*/
Drul_array<Real> yextent_drul_;
- /// direction stem (that's me)
- Direction dir_;
-
public:
- void set_direction (Direction d);
- Direction get_direction () const { return dir_; }
Link_array<Note_head> head_l_arr_;
Link_array<Rest> rest_l_arr_;
if (balltype_i_ > 2)
balltype_i_ = 2;
if (dots_l_) // move into Rhythmic_head?
- dots_l_->position_i_ = int (position_f ());
+ dots_l_->set_position(int (position_f ()));
}
String type;
- SCM style =get_elt_property ("style");
+ SCM style = get_elt_property ("style");
if (style != SCM_UNDEFINED)
{
type = ly_scm2string (style);
announce_element (Score_element_info (d,0));
dot_p_arr_.push (d);
}
- note_p->position_i_ = note_req_l->pitch_.steps ();
+ note_p->set_position(note_req_l->pitch_.steps ());
/*
TODO: transparent note heads.
if (a_off.length () > 100 CM)
{
- warning (_f ("improbable offset for object type: `%s'", nm));
+ programming_error ("improbable offset for object");
Axis a =X_AXIS;
while (a < NO_AXES)
{
- if (abs(a_off[a]) > 50 CM)
- a_off[a] = 50 CM;
+ if (abs(a_off[a]) > 30 CM)
+ a_off[a] = 30 CM;
incr (a);
}
}
void
Paper_outputter::start_line (Real height)
{
+ if (height > 50 CM)
+ {
+ programming_error ("Improbable system height");
+ height = 50 CM;
+ }
SCM scm = gh_list (ly_symbol ("start-line"),
gh_double2scm (height),
SCM_UNDEFINED);
{
if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
{
- nh->position_i_ =0;
+ nh->set_position(0);
}
}
Rest::do_add_processing ()
{
if (balltype_i_ == 0)
- position_i_ += 2;
+ position_i_ += 2; // guh.
Rhythmic_head::do_add_processing ();
}
Rest::do_post_processing ()
{
Rhythmic_head::do_post_processing ();
- if (dots_l_ && balltype_i_ > 4)
+ if (dots_l_
+ && balltype_i_ > 4) // UGH.
{
- dots_l_->position_i_ += 3;
+ /*
+ UGH.
+ */
if (balltype_i_ == 7)
- dots_l_->position_i_++;
+ dots_l_->set_position (4);
+ else
+ dots_l_->set_position (3);
}
}
-Rest::Rest ()
-{
- position_i_ =0;
-}
Molecule *
Rest::do_brew_molecule_p () const
if (balltype_i_ == 0 || balltype_i_ == 1)
ledger_b = abs(position_f () - (2* balltype_i_ - 1)) > lines_i ();
-
String style;
{
if (dots_l_)
{
- dots_l_->position_i_ = int (position_f ());
+ dots_l_->set_position(int (position_f ()));
}
}
-void
-Rhythmic_head::do_pre_processing ()
-{
- translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS);
- position_i_ = 0;
-}
-
-Real
-Rhythmic_head::position_f () const
-{
- return position_i_ + Staff_symbol_referencer::position_f ();
-}
-
void
Rhythmic_head::add_dots (Dots *dot_l)
dots_l_ =0;
balltype_i_ =0;
stem_l_ =0;
- position_i_ =0;
}
void
bool err = false;
Real correction = 0.0;
- Real ssc = paper_l ()->get_realvar(ly_symbol ("stemSpacingCorrection"));
+ Real ssc = paper_l ()->get_var("stemSpacingCorrection");
if (d1 && d2)
return (lines_i () -1) * staff_line_leading_f ();
}
+void
+Staff_bar::do_pre_processing ()
+{
+ Bar::do_pre_processing ();
+ Staff_symbol_referencer::do_pre_processing ();
+}
Staff_symbol_referencer::Staff_symbol_referencer ()
{
staff_sym_l_ =0;
+ position_i_ =0;
}
void
Real
Staff_symbol_referencer::position_f () const
{
- if (!staff_sym_l_ )
- return 0;
+ Real p = position_i_;
+ if (staff_sym_l_ )
+ {
+ Graphical_element * c = common_refpoint (staff_sym_l_, Y_AXIS);
+ Real y = relative_coordinate (c, Y_AXIS) - staff_sym_l_->relative_coordinate (c, Y_AXIS);
+
+ p += 2.0 * y / staff_line_leading_f ();
+ }
+ return p;
+}
+
- Graphical_element * c = common_refpoint (staff_sym_l_, Y_AXIS);
- Real y = relative_coordinate (c, Y_AXIS) - staff_sym_l_->relative_coordinate (c, Y_AXIS);
- return 2.0 * y / staff_line_leading_f ();
+void
+Staff_symbol_referencer::do_pre_processing ()
+{
+ translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS);
+ position_i_ =0;
}
+
+void
+Staff_symbol_referencer::set_position (int p)
+{
+ /*
+ UGH. Use position_f() as well.
+ */
+ position_i_ = p;
+
+}