/*
clef-item.cc -- implement Clef_item
- source file of the LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include <ctype.h>
#include "clef-item.hh"
#include "string.hh"
#include "molecule.hh"
#include "paper-def.hh"
#include "lookup.hh"
-#include "clef-reg.hh"
+#include "clef-engraver.hh"
+#include "g-text-item.hh"
+#include "p-score.hh"
+void
+Clef_item::do_pre_processing()
+{
+ dim_cache_[Y_AXIS].translate (paper()->internote_f () * y_position_i_);
+
+ bool b= (break_status_dir() != RIGHT);
+ change_b_ = b;
+ if (default_b_)
+ {
+ set_empty(b);
+ transparent_b_ = b;
+ }
+}
+/*
+ FIXME
+*/
Clef_item::Clef_item()
{
- change = true;
- read("violin");
+ breakable_b_ =true;
+ default_b_ = false;
+ change_b_ = true;
+ octave_dir_ = CENTER;
+ symbol_ = "treble";
+ y_position_i_ = -2;
}
void
-Clef_item::read(String t)
-{
- type = t;
- if (type == "violin")
- y_off = 2;
- if (type == "alto")
- y_off = 4;
- if (type == "tenor")
- y_off = 6;
- if (type == "bass")
- y_off = 6;
-}
-void
-Clef_item::read(Clef_register const &k)
+Clef_item::do_add_processing ()
{
- read(k.clef_type_str_);
+ if (!break_status_dir_ // broken stuff takes care of their own texts
+ && octave_dir_)
+ {
+ G_text_item *g = new G_text_item;
+ pscore_l_->typeset_element (g);
+
+ g->text_str_ = "8";
+ g->style_str_ = "italic";
+ g->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS];
+ g->dim_cache_[X_AXIS].parent_l_ = &dim_cache_[X_AXIS];
+ add_dependency (g); // just to be sure.
+
+ Real r = do_height ()[octave_dir_] + g->extent (Y_AXIS)[-octave_dir_];
+ g->dim_cache_[Y_AXIS].set_offset (r);
+ }
+
}
+
+
+
+
Molecule*
-Clef_item::brew_molecule_p()const
+Clef_item::do_brew_molecule_p() const
{
- String t = type;
- if (change)
- t += "_change";
- Symbol s = paper()->lookup_l()->clef(t);
- Molecule*output = new Molecule(Atom(s));
- output->translate(Offset(0, paper()->internote() * y_off));
- return output;
+ String t = symbol_;
+ if (change_b_)
+ t += "_change";
+ // Atom s = lookup_l ()-> text ("roman", to_str (break_status_dir ()));
+
+ Atom s = lookup_l ()->clef (t);
+ Molecule*output = new Molecule (Atom (s));
+ return output;
}
-IMPLEMENT_STATIC_NAME(Clef_item);
+
+