* lily/music-iterator.cc (quit, do_quit): new function: break link
[lilypond.git] / lily / system-start-delimiter-engraver.cc
blob88646057f179036777e561962b9f2e67d258ff14
1 /*
2 system-start-delimiter-engraver.cc -- implement System_start_delimiter_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "system-start-delimiter.hh"
11 #include "engraver.hh"
12 #include "staff-symbol.hh"
13 #include "group-interface.hh"
14 #include "paper-column.hh"
15 #include "paper-def.hh"
16 #include "spanner.hh"
18 class System_start_delimiter_engraver : public Engraver
20 public:
21 TRANSLATOR_DECLARATIONS(System_start_delimiter_engraver);
23 protected:
24 Spanner * delim_;
25 virtual void acknowledge_grob (Grob_info);
26 virtual void initialize ();
27 virtual void finalize ();
32 void
33 System_start_delimiter_engraver::acknowledge_grob (Grob_info inf)
35 if (Staff_symbol::has_interface (inf.grob_))
38 don't add as Axis_group_interface::add_element (delim_,),
39 because that would set the parent as well */
41 Pointer_group_interface::add_grob (delim_, ly_symbol2scm ("elements"), inf.grob_);
43 else if (System_start_delimiter::has_interface (inf.grob_))
45 SCM gl = inf.grob_->get_grob_property ("glyph");
46 SCM my_gl = delim_->get_grob_property ("glyph");
49 UGH UGH
51 if (gh_string_p (gl) && gh_equal_p (gl, scm_makfrom0str ("brace"))
52 && gh_string_p (my_gl) && gh_equal_p (my_gl, scm_makfrom0str ("bracket")))
53 inf.grob_->translate_axis (-0.8, X_AXIS); // ugh
54 else if (gh_string_p (gl) && gh_equal_p (gl, scm_makfrom0str ("bracket"))
55 && gh_string_p (my_gl) && gh_equal_p (my_gl, scm_makfrom0str ("bracket")))
57 inf.grob_->translate_axis ( -0.8, X_AXIS); // ugh
58 inf.grob_->set_grob_property ("arch-height",
59 gh_double2scm(gh_scm2double(inf.grob_->get_grob_property
60 ("arch-height"))+0.5));
65 System_start_delimiter_engraver::System_start_delimiter_engraver ()
67 delim_ = 0;
70 void
71 System_start_delimiter_engraver::initialize ()
73 SCM delim_name =get_property ("systemStartDelimiter");
74 delim_ = new Spanner (internal_get_property (delim_name));
76 delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
77 announce_grob (delim_, SCM_EOL);
80 void
81 System_start_delimiter_engraver::finalize ()
83 delim_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
84 typeset_grob (delim_);
87 ENTER_DESCRIPTION(System_start_delimiter_engraver,
88 /* descr */ "Creates a system start delimiter (ie. SystemStart@{Bar,Brace,Bracket@} spanner",
89 /* creats*/ "SystemStartBar SystemStartBrace SystemStartBracket",
90 /* acks */ "system-start-delimiter-interface staff-symbol-interface",
91 /* reads */ "systemStartDelimiter",
92 /* write */ "");