]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
c63e38b4ecbf41dfd69abb762dd9e258e07fdffd
[lilypond.git] / lily / clef-item.cc
1 /*
2   clef-item.cc -- implement Clef_item
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include <ctype.h>
10 #include "clef-item.hh"
11 #include "string.hh"
12 #include "molecule.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15 #include "text-item.hh"
16 #include "paper-score.hh"
17 #include "dimension-cache.hh"
18 #include "side-position-interface.hh"
19
20 void
21 Clef_item::do_pre_processing()
22 {
23   SCM style_sym =get_elt_property ("style");
24   String style;
25   if (gh_string_p (style_sym))
26     style = ly_scm2string (style_sym);
27
28   SCM glyph = get_elt_property ("glyph");
29   if (gh_string_p (glyph))
30     {
31       String s = ly_scm2string (glyph);
32         
33       if (break_status_dir() != RIGHT && style != "fullSizeChanges")
34         {
35           s += "_change";
36         }
37       s = "clefs-" +  s;
38       set_elt_property ("glyph", ly_str02scm (s.ch_C()));
39     }
40   
41   if (style == "transparent")   // UGH. JUNKME
42     {
43       set_elt_property ("transparent", SCM_BOOL_T);
44       set_empty (X_AXIS);
45     }
46 }
47
48
49 void
50 Clef_item::do_add_processing ()
51 {
52   if (!break_status_dir ())     // broken stuff takes care of their own texts
53     {
54       Text_item *g =0;
55
56       SCM octave_dir = remove_elt_property ("octave-dir");
57       if (isdir_b (octave_dir))
58         {
59           g = new Text_item;
60           Side_position_interface spi (g);
61           spi.set_axis (Y_AXIS);
62           
63           pscore_l_->typeset_element (g);
64       
65           g->set_elt_property ("text", ly_str02scm ( "8"));
66           g->set_elt_property ("style", gh_str02scm ("italic"));
67           g->set_parent (this, Y_AXIS);
68           g->set_parent (this, X_AXIS);   
69           g->set_elt_property ("direction", octave_dir);
70           
71           add_dependency (g);   // just to be sure.
72           SCM my_vis = get_elt_property ("visibility-lambda");
73           if (gh_procedure_p (my_vis))
74             g->set_elt_property ("visibility-lambda", my_vis);
75                         
76         }
77
78     }
79 }
80
81