* lily/grob.cc (Grob): take key argument in ctor.
* lily/lilypond-key.cc (do_compare): new file.
* lily/object-key.cc (Object_key): new file.
* lily/include/object-key.hh (class Object_key): new file.
* lily/include/lilypond-key.hh (class Lilypond_context_key): new file.
+2004-11-14 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/context.cc (Context): take key argument in ctor.
+
+ * lily/grob.cc (Grob): take key argument in ctor.
+
+ * lily/lilypond-key.cc (do_compare): new file.
+
+ * lily/object-key.cc (Object_key): new file.
+
+ * lily/include/object-key.hh (class Object_key): new file.
+
+ * lily/include/lilypond-key.hh (class Lilypond_context_key): new file.
+
2004-11-13 Graham Percival <gperlist@shaw.ca>
* Documentation/user/lilypond-book.itely: add small warning about
Grob *a
= make_item_from_properties (accidentals_[i].origin_trans_,
ly_symbol2scm ("Accidental"),
- note->self_scm ());
+ note->self_scm (),
+ "Accidental"
+ );
a->set_parent (support, Y_AXIS);
if (!accidental_placement_)
if (to_boolean (get_property ("skipTypesetting")))
return 0;
- Spanner *beam = new Spanner (beam_settings_);
+ Spanner *beam = new Spanner (beam_settings_, get_grob_key ("Beam"));
for (int i = 0; i < stems_->size (); i++)
{
/*
{
align_ = make_item ("BreakAlignment", SCM_EOL);
-
-
Context*origin = inf.origin_contexts (this)[0];
- left_edge_ = make_item_from_properties (origin->implementation (),
- ly_symbol2scm ("LeftEdge"),
- SCM_EOL
- );
+ left_edge_ = make_item_from_properties (dynamic_cast<Engraver*> (origin->implementation ()),
+ ly_symbol2scm ("LeftEdge"),
+ SCM_EOL,
+ "LeftEdge");
add_to_group (left_edge_->get_property ("break-align-symbol"),
left_edge_);
}
Context *
-Context_def::instantiate (SCM ops)
+Context_def::instantiate (SCM ops, Object_key const *key)
{
Context *tg = 0;
if (context_name_ == ly_symbol2scm ("Score"))
- tg = new Score_context ();
+ tg = new Score_context (key);
else
- tg = new Context ();
+ tg = new Context (key);
tg->definition_ = self_scm ();
}
Item *
-make_item_from_properties (Translator *tr, SCM x, SCM cause)
+make_item_from_properties (Engraver *tr, SCM x, SCM cause, const char * name)
{
Context *context = tr->context ();
SCM props = updated_grob_properties (context, x);
- Item *it = new Item (props);
+
+ Object_key const*key = tr->get_grob_key (name);
+ Item *it = new Item (props, key);
+ scm_gc_unprotect_object (key->self_scm ());
+
#ifdef TWEAK
Grob_selector::register_grob (context, it);
#endif
}
Spanner*
-make_spanner_from_properties (Translator *tr, SCM x, SCM cause)
+make_spanner_from_properties (Engraver *tr, SCM x, SCM cause, const char *name)
{
Context *tg = tr->context ();
SCM props = updated_grob_properties (tg, x);
- Spanner *it = new Spanner (props);
+ Spanner *it = new Spanner (props, tr->get_grob_key (name));
dynamic_cast<Engraver*>(tr)->announce_grob (it, cause);
*/
+#include "object-key.hh"
#include "context-def.hh"
#include "context-selector.hh"
#include "context.hh"
#include "score-context.hh"
#include "translator-group.hh"
#include "warn.hh"
+#include "lilypond-key.hh"
bool
Context::is_removable () const
}
}
-Context::Context ()
+Object_key const*
+Context::get_key () const
{
+ return key_;
+}
+
+Context::Context (Object_key const* key)
+{
+ key_ = key;
daddy_context_ = 0;
init_ = false;
aliases_ = SCM_EOL;
{
SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
- Context * new_group
- = path[i]->instantiate (ops);
-
+ String this_id = "";
if (i == path.size () -1)
{
- new_group->id_string_ = id;
+ this_id = id;
}
-
+
+ Object_key * key = new Lilypond_context_key (current->get_key(),
+ now_mom(),
+ ly_symbol2string (path[i]->get_context_name()),
+ this_id);
+
+ Context * new_group
+ = path[i]->instantiate (ops, key);
+ scm_gc_unprotect_object (key->self_scm ());
+
+ new_group->id_string_ = this_id;
current->add_context (new_group);
apply_property_operations (new_group, ops);
SCM nm = default_child_context_name ();
SCM st = find_context_def (get_output_def (), nm);
+ String name = ly_symbol2string (nm);
Context_def *t = unsmob_context_def (st);
if (!t)
{
- warning (_f ("can't find or create: `%s'", ly_symbol2string (nm).to_str0 ()));
+ warning (_f ("can't find or create: `%s'", name.to_str0 ()));
t = unsmob_context_def (this->definition_);
}
- Context *tg = t->instantiate (SCM_EOL);
+
+ Object_key *key = new Lilypond_context_key (get_key(),
+ now_mom(),
+ name,
+ "");
+
+ Context *tg = t->instantiate (SCM_EOL, key);
add_context (tg);
if (!tg->is_bottom_context ())
return tg->get_default_interpreter ();
Context::mark_smob (SCM sm)
{
Context *me = (Context*) SCM_CELL_WORD_1 (sm);
-
+ scm_gc_mark (me->key_->self_scm ());
scm_gc_mark (me->context_list_);
scm_gc_mark (me->aliases_);
scm_gc_mark (me->definition_);
#include "item.hh"
#include "context.hh"
#include "score-context.hh"
+#include "lilypond-key.hh"
Engraver_group_engraver*
Engraver::get_daddy_engraver () const
}
+Object_key const*
+Engraver::get_grob_key (String name) const
+{
+ Object_key * k = new Lilypond_grob_key (context()->get_key(),
+ now_mom(),
+ name);
+
+ return k;
+}
+
+
ENTER_DESCRIPTION (Engraver,
"", "",
"",
#include "score-context.hh"
#include "context-def.hh"
#include "output-def.hh"
-#include "grace-fixup.hh"
+#include "lilypond-key.hh"
Global_context::Global_context (Output_def *o, Moment final)
+ : Context (new Lilypond_context_key(0,
+ Moment(0),
+ "Global", ""))
{
+ scm_gc_unprotect_object (key_->self_scm());
+
output_def_ = o;
final_mom_ = final;
definition_ = find_context_def (o, ly_symbol2scm ("Global"));
if (!get_score_context ())
{
- SCM key = ly_symbol2scm ("Score");
- Context_def * t = unsmob_context_def (find_context_def (get_output_def (), key));
+ SCM sym = ly_symbol2scm ("Score");
+ Context_def * t = unsmob_context_def (find_context_def (get_output_def (), sym));
if (!t)
error (_f ("can't find `%s' context", "Score"));
- Context *c = t->instantiate (SCM_EOL);
+ Object_key *key = new Lilypond_context_key (get_key(), now_mom(),
+ "Score", "");
+ Context *c = t->instantiate (SCM_EOL, key);
add_context (c);
+ scm_gc_unprotect_object (key->self_scm());
Score_context *sc = dynamic_cast<Score_context*> (c);
sc->prepare (w);
#include "ly-smobs.icc"
+Grob *
+Grob::clone (int count) const
+{
+ return new Grob (*this, count);
+}
+
/* TODO:
- remove dynamic_cast<Spanner,Item> and put this code into respective
#define HASH_SIZE 3
#define INFINITY_MSG "Infinity or NaN encountered"
-Grob::Grob (SCM basicprops)
+Grob::Grob (SCM basicprops,
+ Object_key const* key)
{
+ key_ = key;
/* FIXME: default should be no callback. */
self_scm_ = SCM_EOL;
pscore_= 0;
}
}
-Grob::Grob (Grob const &s)
+Grob::Grob (Grob const &s, int copy_index)
: dim_cache_ (s.dim_cache_)
{
+ key_ = new Copied_key (s.key_, copy_index);
original_ = (Grob*) &s;
self_scm_ = SCM_EOL;
pscore_ = 0;
smobify_self ();
+ scm_gc_unprotect_object (key_->self_scm ());
}
Grob::~Grob ()
/*
VIRTUAL STUBS
-
*/
void
Grob::do_break_processing ()
{
}
+
+
bool
Grob::internal_has_interface (SCM k)
{
Link_array<Context_def> path_to_acceptable_context (SCM type_string,
Output_def*) const;
- Context * instantiate (SCM extra_ops);
+ Context * instantiate (SCM extra_ops, Object_key const*);
SCM to_alist () const;
static SCM make_scm ();
bool init_;
protected:
+ Object_key const * key_;
Context * daddy_context_;
SCM definition_;
SCM properties_scm_;
String id_string_;
friend class Context_def;
+
public:
+ Object_key const *get_key () const;
String id_string () const { return id_string_; }
SCM children_contexts () const { return context_list_; }
SCM default_child_context_name () const;
Translator_group* implementation () const;
Context *get_parent_context () const;
- Context ();
-
+ Context (Object_key const*);
+
/* properties: */
void execute_pushpop_property (SCM prop, SCM sym, SCM val);
SCM internal_get_property (SCM name_sym) const;
Context *get_voice_to_lyrics (Context *lyrics);
Grob *get_current_note_head (Context *voice);
Grob *get_current_rest (Context *voice);
-Context *unsmob_context (SCM);
-
DECLARE_UNSMOB(Context, context);
#endif /* CONTEXT_HH */
virtual void announce_grob (Grob_info);
Engraver_group_engraver*get_daddy_engraver () const;
-
+
public:
+ Object_key const * get_grob_key (String name) const;
+
/**
Announce element. Default: pass on to daddy. Utility
*/
TRANSLATOR_DECLARATIONS(Engraver);
};
-#define make_item(x,cause) make_item_from_properties (this, ly_symbol2scm (x), cause)
-#define make_spanner(x,cause) make_spanner_from_properties (this, ly_symbol2scm (x), cause)
-Item* make_item_from_properties (Translator * tg, SCM x, SCM cause);
-Spanner* make_spanner_from_properties (Translator * tg, SCM x, SCM cause);
+#define make_item(x,cause) make_item_from_properties (this, ly_symbol2scm (x), cause, x)
+#define make_spanner(x,cause) make_spanner_from_properties (this, ly_symbol2scm (x), cause, x)
+Item* make_item_from_properties (Engraver * tg, SCM x, SCM cause, const char *name);
+Spanner* make_spanner_from_properties (Engraver * tg, SCM x, SCM cause, const char*name);
#include "smobs.hh"
#include "dimension-cache.hh"
#include "grob-interface.hh"
+#include "object-key.hh"
/**
- for administration of what was done already
- */
+ for administration of what was done already
+*/
enum Grob_status {
ORPHAN=0, // not yet added to Paper_score
PRECALCING,
private:
DECLARE_SMOBS (Grob, foo);
void init ();
-
protected:
+ Object_key const * key_;
SCM immutable_property_alist_;
SCM mutable_property_alist_;
char status_;
public:
+ Object_key const *get_key () const;
+
Grob *original_;
/* TODO: junk this member. */
Dimension_cache dim_cache_[NO_AXES];
- Grob (SCM basic_props);
- Grob (Grob const&);
- VIRTUAL_COPY_CONSTRUCTOR (Grob, Grob);
+ Grob (SCM basic_props, Object_key const *);
+ Grob (Grob const&, int copy_count);
+
+ virtual Grob *clone (int count) const;
DECLARE_SCHEME_CALLBACK (stencil_extent, (SCM smob, SCM axis));
String name () const;
Drul_array<Item*> broken_to_drul_;
public:
- Item (SCM);
- Item (Item const &);
- VIRTUAL_COPY_CONSTRUCTOR (Grob, Item);
+ Item (SCM, Object_key const*);
+ Item (Item const &, int count);
+
+ virtual Grob *clone (int count) const;
static bool is_breakable (Grob *);
bool is_broken () const;
class Ligature_bracket_engraver;
class Ligature_engraver;
class Lily_lexer;
+class Lilypond_context_key;
+class Lilypond_grob_key;
class Line_group_engraver_group;
class Lookup;
class Lyric_combine_music;
class Music_wrapper_iterator;
class Note_performer;
class Output_def;
-class Output_def;
-class Output_def;
+class Object_key;
class Output_property;
class Page;
class Paper_book;
--- /dev/null
+/*
+ lilypond-key.hh -- declare Lilypond_{grob,context}_key
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef LILYPOND_KEY_HH
+#define LILYPOND_KEY_HH
+
+#include "object-key.hh"
+#include "lily-proto.hh"
+#include "moment.hh"
+#include "string.hh"
+
+class Lilypond_grob_key : public Object_key
+{
+ Object_key const *context_;
+ Moment creation_moment_;
+ String grob_name_;
+
+ // FIXME: need to figure out smart solution for
+ // the problem of creating
+ // many equally named grobs at the same time.
+
+ // int ambiguity_count_;
+public:
+ Lilypond_grob_key(Object_key const*context,
+ Moment start,
+ String name);
+protected:
+ virtual int get_type () const;
+ virtual void derived_mark () const;
+ virtual int do_compare (Object_key const* a) const;
+};
+
+class Lilypond_context_key : public Object_key
+{
+ Object_key const *parent_context_;
+ Moment start_moment_;
+ String context_name_;
+ String id_;
+
+ // see above.
+ // int ambiguity_count_;
+public:
+ Lilypond_context_key (Object_key const * parent,
+ Moment start,
+ String type,
+ String id);
+ // int count);
+protected:
+ virtual int get_type () const;
+ virtual int do_compare (Object_key const* a) const;
+ virtual void derived_mark () const;
+};
+
+
+#endif /* LILYPOND_KEY_HH */
+
--- /dev/null
+/*
+ object-key.hh -- declare Object_key
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef OBJECT_KEY_HH
+#define OBJECT_KEY_HH
+
+#include "smobs.hh"
+
+/*
+ Object_keys are read-only values, suitable for storing references to
+ transient objects (such as grobs or contexts) on disk.
+
+ In the future, they might also act as handles for external processes
+ requesting notation to be drawn.
+ */
+class Object_key
+{
+ DECLARE_SMOBS(Object_key,);
+
+protected:
+ Object_key();
+ virtual void derived_mark () const;
+ virtual int get_type () const;
+ virtual int do_compare (Object_key const * other) const;
+public:
+ int compare (Object_key const *other) const;
+};
+
+enum Object_key_type {
+ GENERAL_KEY,
+ GROB_KEY,
+ CONTEXT_KEY,
+ COPIED_KEY,
+};
+
+class Copied_key : public Object_key
+{
+
+private:
+ Object_key const * original_;
+ int copy_count_;
+protected:
+ virtual void derived_mark () const;
+ virtual int get_type () const;
+ virtual int do_compare (Object_key const * other) const;
+public:
+ Copied_key (Object_key const*, int);
+};
+
+DECLARE_UNSMOB(Object_key, key);
+
+#endif /* OBJECT_KEY_HH */
/// if lines are broken then this column is in #line#
System *system_;
- Paper_column (SCM);
- VIRTUAL_COPY_CONSTRUCTOR (Grob, Paper_column);
+ Paper_column (SCM, Object_key const*);
+ Paper_column (Paper_column const&, int count);
+
+ virtual Grob *clone (int count) const;
static bool has_interface (Grob*);
virtual void do_break_processing ();
class Score_context : public Context
{
public:
+ Score_context (Object_key const*);
+
virtual Music_output *get_output ();
virtual void prepare (Moment);
virtual void finish ();
void set_bound (Direction d, Grob*);
Item *get_bound (Direction d) const;
- Spanner (SCM);
- Spanner (Spanner const &);
+ Spanner (SCM, Object_key const*);
+ Spanner (Spanner const &, int copy_count);
bool is_broken () const;
void do_break ();
Real spanner_length () const;
protected:
void set_my_columns ();
-
- VIRTUAL_COPY_CONSTRUCTOR (Grob, Spanner);
+ virtual Grob *clone (int count) const;
virtual void do_break_processing ();
};
SCM get_line ();
SCM get_lines ();
- System (SCM);
+ System (SCM, Object_key const*);
+ System (System const&, int);
+ virtual Grob *clone (int count) const;
+
int element_count () const;
int spanner_count () const;
void pre_processing ();
protected:
- VIRTUAL_COPY_CONSTRUCTOR (Grob, System);
};
#endif /* SYSTEM_HH */
#include "system.hh"
#include "group-interface.hh"
-Item::Item (SCM s)
- : Grob (s)
+
+Grob *
+Item::clone (int count) const
+{
+ return new Item (*this, count);
+}
+
+
+Item::Item (SCM s, Object_key const *key)
+ : Grob (s, key)
{
broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0;
Group_interface::add_thing (this, ly_symbol2scm ("interfaces"), ly_symbol2scm ("item-interface"));
/**
Item copy ctor. Copy nothing: everything should be a elt property
or a special purpose pointer (such as broken_to_drul_[]) */
-Item::Item (Item const &s)
- : Grob (s)
+Item::Item (Item const &s, int copy_count)
+ : Grob (s, copy_count)
{
broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =0;
}
Item::copy_breakable_items ()
{
Drul_array<Item *> new_copies;
- Direction i=LEFT;
+ Direction i = LEFT;
+ int count = 0;
do
{
- Grob * dolly = clone ();
+ Grob * dolly = clone (count ++);
Item * item = dynamic_cast<Item*> (dolly);
pscore_->system_->typeset_grob (item);
new_copies[i] =item;
String
ly_scm2string (SCM str)
{
+ assert (scm_is_string (str));
return String ((Byte*)scm_i_string_chars (str),
(int) scm_i_string_length (str));
}
--- /dev/null
+/*
+ lilypond-key.cc -- implement Lilypond_{grob,context}_key
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+
+#include "object-key.hh"
+#include "lilypond-key.hh"
+
+Lilypond_grob_key::Lilypond_grob_key (Object_key const *context,
+ Moment start,
+ String name)
+ // int ambiguity_count,
+{
+ context_ = context;
+ creation_moment_ = start;
+ grob_name_ = name;
+ // ambiguity_count_ = ambiguity_count;
+}
+
+void
+Lilypond_grob_key::derived_mark () const
+{
+ scm_gc_mark (context_->self_scm ());
+}
+
+int
+Lilypond_grob_key::do_compare (Object_key const* key) const
+{
+ Lilypond_grob_key const * other = dynamic_cast<Lilypond_grob_key const*> (key);
+ int c;
+
+ c = context_->compare (other->context_);
+ if (c)
+ return c;
+
+ c = Moment::compare (creation_moment_, other->creation_moment_);
+ if (c)
+ return c;
+
+ c = String::compare (grob_name_, other->grob_name_);
+ if (c)
+ return c;
+#if 0
+ c = sign (ambiguity_count_ - other->ambiguity_count_);
+ if (c)
+ return c;
+#endif
+
+ return 0;
+}
+
+
+int
+Lilypond_grob_key::get_type () const
+{
+ return GROB_KEY;
+}
+
+/****************************************************************/
+
+
+void
+Lilypond_context_key::derived_mark () const
+{
+ if (parent_context_)
+ scm_gc_mark (parent_context_->self_scm ());
+}
+
+Lilypond_context_key::Lilypond_context_key (Object_key const *parent,
+ Moment start,
+ String type,
+ String id
+ // int count
+ )
+{
+ parent_context_ = parent;
+ start_moment_ = start;
+ context_name_ = type;
+ id_ = id;
+}
+
+
+int
+Lilypond_context_key::do_compare (Object_key const *key) const
+{
+ Lilypond_context_key const * other
+ = dynamic_cast<Lilypond_context_key const*> (key);
+
+ int c;
+ if (parent_context_)
+ {
+ c = parent_context_->compare (other->parent_context_);
+ if (c)
+ return c;
+ }
+
+ c = Moment::compare (start_moment_, other->start_moment_);
+ if (c)
+ return c;
+
+ c = String::compare (context_name_, other->context_name_);
+ if (c)
+ return c;
+
+ c = String::compare (id_, other->id_);
+ if (c)
+ return c;
+
+#if 0
+ c = sign (ambiguity_count_ - other->ambiguity_count_);
+ if (c)
+ return c;
+#endif
+
+ return 0;
+}
+
+int
+Lilypond_context_key::get_type () const
+{
+ return CONTEXT_KEY;
+}
--- /dev/null
+/*
+ object-key.cc -- implement Object_key
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+
+#include "object-key.hh"
+#include "ly-smobs.icc"
+
+SCM
+Object_key::mark_smob (SCM key)
+{
+ Object_key* k = (Object_key*) SCM_CELL_WORD_1 (key);
+ k->derived_mark();
+ return SCM_EOL;
+}
+
+void
+Object_key::derived_mark () const
+{
+
+}
+
+Object_key::~Object_key()
+{
+}
+
+int
+Object_key::get_type () const
+{
+ return GENERAL_KEY;
+}
+
+int
+Object_key::print_smob (SCM smob, SCM port, scm_print_state*)
+{
+ return 1;
+}
+
+Object_key::Object_key ()
+{
+ smobify_self ();
+}
+
+int
+Object_key::compare (Object_key const *other) const
+{
+ if (this == other)
+ return 0;
+
+ int c = sign (get_type () - other->get_type());
+ if (c)
+ return c;
+ else
+ return do_compare (other);
+}
+
+IMPLEMENT_SMOBS (Object_key);
+
+SCM
+Object_key::equal_p (SCM a , SCM b)
+{
+ Object_key *ka = unsmob_key (a);
+ Object_key *kb = unsmob_key (b);
+
+ return (ka->compare (kb)) ? SCM_BOOL_F : SCM_BOOL_T;
+}
+
+int
+Object_key::do_compare (Object_key const *other) const
+{
+ return 0;
+}
+
+/****************************************************************/
+
+Copied_key::Copied_key (Object_key const* key, int count)
+{
+ copy_count_ = count;
+ original_ = key;
+}
+
+int
+Copied_key::get_type () const
+{
+ return COPIED_KEY;
+}
+
+int
+Copied_key::do_compare (Object_key const *key) const
+{
+ Copied_key const *other = dynamic_cast<Copied_key const*> (key);
+
+ int c = original_->compare (other->original_);
+ if (c)
+ return c;
+
+ return sign (copy_count_ - other->copy_count_);
+}
+
+void
+Copied_key::derived_mark () const
+{
+ scm_gc_mark (original_->self_scm ());
+}
+Grob *
+Paper_column::clone (int count) const
+{
+ return new Paper_column (*this, count);
+}
+
+
ADD_INTERFACE (Paper_column, "paper-column-interface",
"@code{Paper_column} objects form the top-most X-parents for items. "
" The are two types of columns: musical columns, where are attached to, and "
return (Paper_column*) (this);
}
-Paper_column::Paper_column (SCM l)
- : Item (l) // guh.?
+Paper_column::Paper_column (SCM l, Object_key const*key)
+ : Item (l, key) // guh.?
{
system_ = 0;
rank_ = -1;
}
+
+Paper_column::Paper_column (Paper_column const& src, int count)
+ : Item (src, count)
+{
+ system_ = 0;
+ rank_ = count;
+}
+
+
Moment
Paper_column::when_mom (Grob *me)
{
return s->get_output ();
}
+
+Score_context::Score_context (Object_key const *key)
+ : Context (key)
+{
+}
SCM nmp
= updated_grob_properties (context (),
ly_symbol2scm ("NonMusicalPaperColumn"));
+
+ Object_key const *key1 = get_grob_key ("NonMusicalPaperColumn");
+
SCM pc = updated_grob_properties (context (),
ly_symbol2scm ("PaperColumn"));
-
- set_columns (new Paper_column (nmp), new Paper_column (pc));
+ Object_key const *key2 = get_grob_key ("PaperColumn");
+ set_columns (new Paper_column (nmp, key1), new Paper_column (pc, key2));
+
+
+ scm_gc_unprotect_object (key1->self_scm());
+ scm_gc_unprotect_object (key2->self_scm());
Grob_info i1;
i1.grob_ = command_column_;
SCM props = updated_grob_properties (context (), ly_symbol2scm ("System"));
- pscore_->typeset_line (new System (props));
+ Object_key const *sys_key = get_grob_key ("System");
+ pscore_->typeset_line (new System (props, sys_key));
+ scm_gc_unprotect_object (sys_key->self_scm ());
make_columns ();
system_ = pscore_->system_;
#include "system.hh"
#include "group-interface.hh"
+
+
+Grob *
+Spanner::clone (int count) const
+{
+ return new Spanner (*this, count);
+}
+
void
Spanner::do_break_processing ()
{
programming_error ("no broken bound");
else if (bound->get_system ())
{
- Spanner * span = dynamic_cast<Spanner*> (clone ());
+ Spanner * span = dynamic_cast<Spanner*> (clone (broken_intos_.size ()));
span->set_bound (LEFT, bound);
span->set_bound (RIGHT, bound);
continue;
}
- Spanner *span = dynamic_cast<Spanner*> (clone ());
+ Spanner *span = dynamic_cast<Spanner*> (clone (broken_intos_.size ()));
span->set_bound (LEFT,bounds[LEFT]);
span->set_bound (RIGHT,bounds[RIGHT]);
}
}
-Spanner::Spanner (SCM s)
- : Grob (s)
+Spanner::Spanner (SCM s, Object_key const*key)
+ : Grob (s, key)
{
break_index_ = 0;
spanned_drul_[LEFT]=0;
Group_interface::add_thing (this, ly_symbol2scm ("interfaces"), ly_symbol2scm ("spanner-interface"));
}
-Spanner::Spanner (Spanner const &s)
- : Grob (s)
+Spanner::Spanner (Spanner const &s, int count)
+ : Grob (s, count)
{
spanned_drul_[LEFT] = spanned_drul_[RIGHT] =0;
}
if (!delim_)
{
SCM delim_name =get_property ("systemStartDelimiter");
- delim_ = make_spanner_from_properties (this, delim_name, SCM_EOL);
+ delim_ = make_spanner_from_properties (this, delim_name, SCM_EOL,
+ ly_symbol2string (delim_name).to_str0());
delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
#include "paper-book.hh"
#include "paper-system.hh"
-System::System (SCM s)
- : Spanner (s)
+
+System::System (System const &src, int count)
+ : Spanner (src, count)
+{
+ rank_ = 0;
+}
+
+System::System (SCM s, Object_key const*key)
+ : Spanner (s, key)
{
rank_ = 0;
}
+
+Grob *
+System::clone (int count) const
+{
+ return new System (*this, count);
+}
+
+
int
System::element_count () const
{
{
for (int i = 0; i < breaking.size (); i++)
{
- System *system = dynamic_cast <System*> (clone ());
+ System *system = dynamic_cast <System*> (clone (i));
system->rank_ = i;
Link_array<Grob> c (breaking[i].cols_);
&& ly_c_equal_p (right_mus->get_property ("pitch"),
left_mus->get_property ("pitch")))
{
- Grob * p = new Spanner (tie_start_definition_);
+ Grob * p = new Spanner (tie_start_definition_, get_grob_key ("Tie"));
announce_grob (p, last_event_->self_scm ());
Tie::set_interface (p); // cannot remove yet!