* lily/context.cc (Context): take key argument in ctor.
(create_context): new function
* lily/include/object-key.hh (class Object_key): new file.
2004-11-14 Han-Wen Nienhuys <hanwen@xs4all.nl>
2004-11-14 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/lookup.cc (triangle): rewrite, obviating symmetric_x_triangle().
+
* lily/context.cc (Context): take key argument in ctor.
* lily/context.cc (Context): take key argument in ctor.
+ (create_context): new function
* lily/grob.cc (Grob): take key argument in ctor.
* lily/grob.cc (Grob): take key argument in ctor.
-
- Object_key const *key = get_context_key (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);
-
- current = new_group;
+
+
+ current = create_context (path[i],
+ this_id,
+ ops);
+
+Context*
+Context::create_context (Context_def * cdef,
+ String id,
+ SCM ops)
+{
+ String type = ly_symbol2string (cdef->get_context_name());
+ Object_key const *key = get_context_key (type, id);
+ Context * new_group
+ = cdef->instantiate (ops, key);
+ scm_gc_unprotect_object (key->self_scm ());
+
+ new_group->id_string_ = this_id;
+ add_context (new_group);
+ apply_property_operations (new_group, ops);
+
+ return new_group;
+}
+
Object_key const*
Context::get_context_key (String type, String id)
{
Object_key const*
Context::get_context_key (String type, String id)
{
t = unsmob_context_def (this->definition_);
}
t = unsmob_context_def (this->definition_);
}
- Object_key const *key = get_context_key (name, "");
-
- Context *tg = t->instantiate (SCM_EOL, key);
- add_context (tg);
+ Context *tg = create_context (t, "", SCM_EOL)
if (!tg->is_bottom_context ())
return tg->get_default_interpreter ();
else
if (!tg->is_bottom_context ())
return tg->get_default_interpreter ();
else
Object_key const *get_grob_key (String);
Object_key const *get_context_key (String, String);
Object_key const *get_grob_key (String);
Object_key const *get_context_key (String, String);
+ Context *create_context (Context_def*, String, SCM);
String id_string () const { return id_string_; }
SCM children_contexts () const { return context_list_; }
SCM default_child_context_name () const;
String id_string () const { return id_string_; }
SCM children_contexts () const { return context_list_; }
SCM default_child_context_name () const;
virtual void derived_mark () const;
virtual int get_type () const;
virtual int do_compare (Object_key const * other) const;
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;
};
public:
int compare (Object_key const *other) const;
};
private:
Object_key const * original_;
int copy_count_;
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;
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);
};
public:
Copied_key (Object_key const*, int);
};
b[X_AXIS] = Interval (0, iv.length());
b[Y_AXIS] = Interval (0 <? protude , 0 >? protude);
b[X_AXIS] = Interval (0, iv.length());
b[Y_AXIS] = Interval (0 <? protude , 0 >? protude);
- SCM s = scm_list_n (ly_symbol2scm ("symmetric-x-triangle"),
- scm_make_real (thick),
- scm_make_real (iv.length ()),
- scm_make_real (protude), SCM_UNDEFINED);
-
- Stencil stc (b, s);
- stc.translate_axis (iv[LEFT], X_AXIS);
- return stc;
+
+ Offset z1(iv[LEFT], 0);
+ Offset z2(iv[RIGHT], 0);
+ Offset z3(z2[X_AXIS]/2, protude);
+
+ Stencil tri = make_line (z1, z2);
+ tri.add_stencil (make_line (z2, z3));
+ tri.add_stencil (make_line (z3, z1));
+
+ return tri;
-/draw_symmetric_x_triangle % h w th
-{
- setlinewidth
- 0 0 moveto
- dup 0 lineto
- 2 div
- exch lineto
- 0 0 lineto
- stroke
-} bind def
-
/draw_round_box % breapth width depth height blot
{
/blot exch def
/draw_round_box % breapth width depth height blot
{
/blot exch def
polygon
repeat-slash
round-filled-box
polygon
repeat-slash
round-filled-box
char
dashed-line
zigzag-line
char
dashed-line
zigzag-line
ez-ball
comment
repeat-slash
ez-ball
comment
repeat-slash
(ly:numbers->string (list breapth width depth height))
" draw_box" ))
(ly:numbers->string (list breapth width depth height))
" draw_box" ))
-(define (symmetric-x-triangle thick w h)
- (string-append
- (ly:numbers->string (list h w thick))
- " draw_symmetric_x_triangle"))
(define (text font s)
(let*
(define (text font s)
(let*
char
dashed-line
zigzag-line
char
dashed-line
zigzag-line
ez-ball
comment
repeat-slash
ez-ball
comment
repeat-slash
(define (zigzag-line centre? zzw zzh thick dx dy)
(embedded-ps (list 'zigzag-line centre? zzw zzh thick dx dy)))
(define (zigzag-line centre? zzw zzh thick dx dy)
(embedded-ps (list 'zigzag-line centre? zzw zzh thick dx dy)))
-(define (symmetric-x-triangle t w h)
- (embedded-ps (list 'symmetric-x-triangle t w h)))
-
-
(define (ez-ball c l b)
(embedded-ps (list 'ez-ball c l b)))
(define (ez-ball c l b)
(embedded-ps (list 'ez-ball c l b)))