(c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
+#include "dimension-cache.hh"
#include "span-bar.hh"
#include "lookup.hh"
#include "dimensions.hh"
spanning_l_arr_.unordered_substitute (o, n);
}
-void
-Span_bar::set_align (Align_element *a)
-{
- add_dependency (a);
-}
Interval
Span_bar::do_width () const
{
- Molecule m = lookup_l ()->bar (type_str_, 40 PT);
+ Molecule m = lookup_l ()->bar (type_str_, 40 PT, paper_l ());
return m.extent (X_AXIS);
}
Bar::do_pre_processing ();
evaluate_empty ();
- translate_axis (extra_x_off_, X_AXIS);
- dim_cache_[Y_AXIS].set_empty (false); // a hack to make mark scripts work.
+ set_empty (false, Y_AXIS); // a hack to make mark scripts work.
}
void
Span_bar::do_post_processing ()
{
Bar::do_post_processing ();
+ Interval i(get_spanned_interval ());
+
+ translate_axis (i.center (), Y_AXIS);
}
void
if (spanning_l_arr_.size () < 1)
{
set_elt_property (transparent_scm_sym, SCM_BOOL_T);
- set_empty (true);
+ set_empty (true, X_AXIS, Y_AXIS);
+
}
if (type_str_.empty_b ())
{
Span_bar::get_spanned_interval () const
{
Interval y_int;
+
for (int i=0; i < spanning_l_arr_.size (); i++)
{
- Dimension_cache*common =
- common_group (spanning_l_arr_[i], Y_AXIS);
-
- Real y = spanning_l_arr_[i]->dim_cache_[Y_AXIS].relative_coordinate (common)
- -dim_cache_[Y_AXIS].relative_coordinate (common);
+ Graphical_element*common = common_refpoint (spanning_l_arr_[i], Y_AXIS);
+ Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS)
+ - relative_coordinate (common, Y_AXIS);
y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
}
Molecule*output = new Molecule;
if (!iv.empty_b())
{
- output->add_molecule (lookup_l ()->bar (type_str_, iv.length ()));
- output->translate_axis (iv.center (), Y_AXIS);
+ output->add_molecule (lookup_l ()->bar (type_str_, iv.length (), paper_l ()));
}
else
{
- warning("Huh? My children deflated (FIXME)");
+ programming_error("Huh? My children deflated (FIXME)");
}
return output;
}
Span_bar::Span_bar ()
{
type_str_ = "";
- extra_x_off_ = 0.0;
}