#ifndef SCRIPTDEF_HH
#define SCRIPTDEF_HH
#include "string.hh"
+#include "general-script-def.hh"
/** The characteristics of a certain kind of accent. It is not the
accent itself. */
-struct Script_def {
+class Script_def : public General_script_def {
+ /// invert if below staff?
+ bool invertsym_b_;
+ String symidx;
+
/// on the other side of the stem?
int rel_stem_dir_i_;
/// follow the ball inside staff?
bool inside_staff_b_;
- /// invert if below staff?
- bool invertsym_b_;
- String symidx;
+public:
+ virtual int staff_dir_i()const;
+ virtual int rel_stem_dir_i()const;
+ virtual int priority_i()const;
+ virtual bool inside_b()const;
+ virtual Atom get_atom(Paper_def* p, int dir_i_)const;
+ NAME_MEMBERS();
- /* *************** */
- int compare(Script_def const &);
+ virtual bool do_equal_b(General_script_def const &)const;
void print() const;
- Script_def(String, bool, int, int ,bool);
+ Script_def();
+ void set_from_input(String, bool, int, int ,bool);
+protected:
+ VIRTUAL_COPY_CONS(Script_def,General_script_def)
+
};
+
+
+
#endif // SCRIPTDEF_HH
class Text_spanner : public Spanner {
public:
Directional_spanner * support;
- Text_def spec;
+ General_script_def * spec_p_;
Offset text_off_;
- NAME_MEMBERS(Text_spanner);
+ NAME_MEMBERS();
void set_support(Directional_spanner*);
Text_spanner();
protected:
SPANNER_CLONE(Text_spanner)
-
+ ~Text_spanner();
virtual void do_substitute_dependency(Score_elem*,Score_elem*);
virtual void do_pre_processing();
virtual void do_post_processing();
#include "molecule.hh"
#include "lookup.hh"
-Text_item::Text_item(Text_def *tdef_l, int d)
+Text_item::Text_item(General_script_def*tdef_l, int d)
{
dir_i_ = d;
fat_b_ = false;
- tdef_p_ = new Text_def(*tdef_l);
+ tdef_p_ = tdef_l->clone();
pos_i_ =0;
}
-Text_def*
-Text_item::tdef_l()
-{
- return tdef_p_;
-}
-
Text_item::~Text_item()
{
delete tdef_p_;
void
Text_item::set_default_index()
{
- pos_i_ = get_position_i(tdef_p_->create_atom().extent().y );
+ pos_i_ = get_position_i(
+ tdef_p_->get_atom(paper(), dir_i_).extent().y );
}
void
{
if (!dir_i_)
dir_i_ = -1;
- tdef_p_->pdef_l_ = paper();
}
void
Molecule*
Text_item::brew_molecule_p() const
{
- Atom a(tdef_p_->create_atom());
-
- if ( fat_b_)
- a.sym.dim.x = tdef_p_->width();
+ Atom a(tdef_p_->get_atom(paper(), dir_i_));
+/*
+ if ( fat_b_)
+ a.sym.dim.x = tdef_p_->width(paper());
+ */
Molecule* mol_p = new Molecule(a);
if(dir_i_<0 ) // should do something better anyway.
#include "text-def.hh"
#include "debug.hh"
#include "paper-def.hh"
-
+#include "symbol.hh"
void
Text_spanner::Text_spanner()
{
+ spec_p_ = 0;
support = 0;
}
void
Text_spanner::do_print() const
{
- spec.print();
+ spec_p_->print();
}
void
Text_spanner::do_post_processing()
{
- switch(spec.align_i_) {
- case 0:
- text_off_ = support->center() +
- Offset(0,support->dir_i_ * paper()->internote_f() * 4); // todo
- break;
- default:
- assert(false);
- break;
- }
+ text_off_ = support->center() +
+ Offset(0,support->dir_i_ * paper()->internote_f() * 4); // todo
}
Molecule*
Text_spanner::brew_molecule_p() const
{
- Atom tsym (spec.create_atom());
+ Atom tsym (spec_p_->get_atom(paper(),0));
tsym.translate(text_off_);
Molecule*output = new Molecule;
right_col_l_ = support->right_col_l_;
left_col_l_ = support->left_col_l_;
assert(left_col_l_ && right_col_l_);
- spec.pdef_l_ = paper();
}
Interval
support = (Directional_spanner*) n->spanner();
}
+
+Text_spanner::~Text_spanner()
+{
+ delete spec_p_;
+}