Fresco/Berlin/modules/Layout Backdrop.cc,1.6,1.7 Backdrop.hh,1.5,1.6 Box.cc,1.38,1.39 Box.hh,1.15,1.16 Deck.cc,1.16,1.17 Deck.hh,1.8,1.9 Glue.cc,1.9,1.10 Glue.hh,1.7,1.8 GridImpl.cc,1.32,1.33 GridImpl.hh,1.15,1.16 LayoutKitImpl.cc,1.32,1.33 LayoutKitImpl.hh,1.23,1.24 LayoutManager.cc,1.16,1.17 LayoutManager.hh,1.14,1.15 Placement.cc,1.22,1.23 Placement.hh,1.11,1.12 ShapeOf.cc,1.6,1.7 ShapeOf.hh,1.5,1.6 StageImpl.cc,1.55,1.56 StageImpl.hh,1.27,1.28 ViewportImpl.cc,1.34,1.35 ViewportImpl.hh,1.19,1.20
Tobias Hunger <[email protected]> Tue, 30 Dec 2003 06:08:29 +0100
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Layout
In directory purcel:/tmp/cvs-serv30213/modules/Layout
Modified Files:
Backdrop.cc Backdrop.hh Box.cc Box.hh Deck.cc Deck.hh Glue.cc
Glue.hh GridImpl.cc GridImpl.hh LayoutKitImpl.cc
LayoutKitImpl.hh LayoutManager.cc LayoutManager.hh
Placement.cc Placement.hh ShapeOf.cc ShapeOf.hh StageImpl.cc
StageImpl.hh ViewportImpl.cc ViewportImpl.hh
Log Message:
* Styleguidify Berlin
* Add namespace Berlin
Both patches are mixed into one since I did not want to commit two such
large and disruptive patches.
Index: Backdrop.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Backdrop.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Backdrop.cc 5 Jan 2003 16:21:33 -0000 1.6
+++ Backdrop.cc 29 Dec 2003 08:03:28 -0000 1.7
@@ -31,76 +31,82 @@
void Backdrop::request(Requisition &r)
{
- GraphicImpl::require(r.x, 0., GraphicImpl::infinity, 0., 0.);
- GraphicImpl::require(r.y, 0., GraphicImpl::infinity, 0., 0.);
- GraphicImpl::require(r.z, 0., GraphicImpl::infinity, 0., 0.);
+ GraphicImpl::require(r.x, 0., GraphicImpl::infinity, 0., 0.);
+ GraphicImpl::require(r.y, 0., GraphicImpl::infinity, 0., 0.);
+ GraphicImpl::require(r.z, 0., GraphicImpl::infinity, 0., 0.);
}
void Backdrop::draw(DrawTraversal_ptr t)
{
- DrawTraversal_var traversal = t;
- // Get the origin of our allocation.
- Vertex origin;
- Region_var allocation = traversal->allocation();
- allocation->origin(origin);
-
- // Get the visible regions bounds.
- Vertex lower, upper;
- Painter_var painter = traversal->current_painter();
- Region_var visible = painter->visible();
- visible->bounds(lower, upper);
-
- // Figure out the lower coordinate to begin drawing.
- Graphic::Requisition requisition;
- GraphicImpl::init_requisition(requisition);
- offset->child->request(requisition);
- if (!requisition.x.defined)
- GraphicImpl::require(requisition.x,Coord(1),Coord(0),Coord(0),Alignment(0));
- if (!requisition.y.defined)
- GraphicImpl::require(requisition.y,Coord(1),Coord(0),Coord(0),Alignment(0));
- Coord w = requisition.x.natural;
- Coord h = requisition.y.natural;
- Coord lead_w = w * requisition.x.align;
- Coord lead_h = h * requisition.y.align;
- Long below_x = Long(((origin.x - lead_w - lower.x) + (w - epsilon)) / w);
- Long below_y = Long(((origin.y - lead_h - lower.y) + (h - epsilon)) / h);
- Coord x = origin.x - Coord(below_x) * w;
- Coord y = origin.y - Coord(below_y) * h;
+ DrawTraversal_var traversal = t;
+ // Get the origin of our allocation.
+ Vertex origin;
+ Region_var allocation = traversal->allocation();
+ allocation->origin(origin);
+
+ // Get the visible regions bounds.
+ Vertex lower, upper;
+ Painter_var painter = traversal->current_painter();
+ Region_var visible = painter->visible();
+ visible->bounds(lower, upper);
+
+ // Figure out the lower coordinate to begin drawing.
+ Graphic::Requisition requisition;
+ GraphicImpl::init_requisition(requisition);
+ offset->child->request(requisition);
+ if (!requisition.x.defined)
+ GraphicImpl::require(requisition.x, Coord(1), Coord(0), Coord(0),
+ Alignment(0));
+ if (!requisition.y.defined)
+ GraphicImpl::require(requisition.y, Coord(1), Coord(0), Coord(0),
+ Alignment(0));
+ Coord w = requisition.x.natural;
+ Coord h = requisition.y.natural;
+ Coord lead_w = w * requisition.x.align;
+ Coord lead_h = h * requisition.y.align;
+ Long below_x = Long(((origin.x - lead_w - lower.x) + (w - epsilon)) /
+ w);
+ Long below_y = Long(((origin.y - lead_h - lower.y) + (h - epsilon)) /
+ h);
+ Coord x = origin.x - Coord(below_x) * w;
+ Coord y = origin.y - Coord(below_y) * h;
- // Figure out how many times to draw.
- CORBA::ULong count_x = CORBA::ULong(((upper.x - x) + (w - epsilon)) / w);
- CORBA::ULong count_y = CORBA::ULong(((upper.y - y) + (h - epsilon)) / h);
+ // Figure out how many times to draw.
+ CORBA::ULong count_x = CORBA::ULong(((upper.x - x) + (w - epsilon)) /
+ w);
+ CORBA::ULong count_y = CORBA::ULong(((upper.y - y) + (h - epsilon)) /
+ h);
- // Do the drawing.
- Coord current_x = x;
- for (CORBA::ULong i_x = 0; i_x < count_x; ++i_x)
+ // Do the drawing.
+ Coord current_x = x;
+ for (CORBA::ULong i_x = 0; i_x < count_x; ++i_x)
{
- Coord current_y = y;
- for (CORBA::ULong i_y = 0; i_y < count_y; ++i_y)
+ Coord current_y = y;
+ for (CORBA::ULong i_y = 0; i_y < count_y; ++i_y)
{
- RegionImpl* a = new RegionImpl;
- a->valid = true;
- a->lower.x = current_x - lead_w;
- a->lower.y = current_y - lead_h;
- a->upper.x = current_x - lead_w + w;
- a->upper.y = current_y - lead_h + h;
- a->xalign = requisition.x.align;
- a->yalign = requisition.y.align;
- t->traverse_child(offset, a);
- CORBA::release(a);
- current_y += h;
+ RegionImpl* a = new RegionImpl;
+ a->valid = true;
+ a->lower.x = current_x - lead_w;
+ a->lower.y = current_y - lead_h;
+ a->upper.x = current_x - lead_w + w;
+ a->upper.y = current_y - lead_h + h;
+ a->xalign = requisition.x.align;
+ a->yalign = requisition.y.align;
+ t->traverse_child(offset, a);
+ CORBA::release(a);
+ current_y += h;
}
- current_x += w;
+ current_x += w;
}
}
void Backdrop::traverse(Traversal_ptr t)
{
- if (t->op() == GraphicTraversal::draw)
+ if (t->op() == GraphicTraversal::draw)
{
- if (!is_nil(offset->child))
- draw(t);
+ if (!is_nil(offset->child))
+ draw(t);
}
- else
- MonoGraphic::traverse(t);
+ else
+ MonoGraphic::traverse(t);
}
Index: Backdrop.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Backdrop.hh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Backdrop.hh 5 Jan 2003 16:21:33 -0000 1.5
+++ Backdrop.hh 29 Dec 2003 08:03:28 -0000 1.6
@@ -19,26 +19,28 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _Backdrop_hh
-#define _Backdrop_hh
+#ifndef _Layout_Backdrop_hh
+#define _Layout_Backdrop_hh
#include <Berlin/MonoGraphic.hh>
-namespace Berlin {
-namespace LayoutKit {
-
-class Backdrop : public MonoGraphic
+namespace Berlin
{
-public:
- Backdrop();
- ~Backdrop();
- virtual void request(Requisition &);
-
- virtual void traverse(Traversal_ptr);
- virtual void draw(DrawTraversal_ptr);
-};
+ namespace LayoutKit
+ {
-} // namespace
+ class Backdrop : public MonoGraphic
+ {
+ public:
+ Backdrop();
+ ~Backdrop();
+ virtual void request(Requisition &);
+
+ virtual void traverse(Traversal_ptr);
+ virtual void draw(DrawTraversal_ptr);
+ };
+
+ } // namespace
} // namespace
#endif
Index: Box.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Box.cc,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- Box.cc 5 Jan 2003 16:21:33 -0000 1.38
+++ Box.cc 29 Dec 2003 08:03:28 -0000 1.39
@@ -36,108 +36,112 @@
using namespace Berlin::LayoutKit;
-Box::Box(LayoutManager *l)
- : _layout(l),
- _requested(false),
- _cache_allocations(0)
+Box::Box(LayoutManager *l) :
+ my_layout(l),
+ my_requested(false),
+ my_cache_allocations(0)
{
- _obj_name = new char[256];
+ my_obj_name = new char[256];
- _box_name = "Box";
+ my_box_name = "Box";
std::ostringstream buf;
- buf << _box_name << " " << _layout->name() << std::ends;
- strcpy(_obj_name, buf.str().c_str());
+ buf << my_box_name << " " << my_layout->name() << std::ends;
+ strcpy(my_obj_name, buf.str().c_str());
}
Box::~Box()
{
- if (_cache_allocations)
+ if (my_cache_allocations)
{
- for (CORBA::Long i = 0; i != _cache_size; ++i)
- Provider<RegionImpl>::adopt(_cache_allocations[i]);
- delete[] _cache_allocations;
+ for (CORBA::Long i = 0; i != my_cache_size; ++i)
+ Provider<RegionImpl>::adopt(my_cache_allocations[i]);
+ delete[] my_cache_allocations;
}
- delete _obj_name;
- delete _layout;
+ delete my_obj_name;
+ delete my_layout;
}
void Box::request(Fresco::Graphic::Requisition &r)
{
- Trace trace(this, "Box::request");
- if (!_requested)
+ Trace trace(this, "Box::request");
+ if (!my_requested)
{
- GraphicImpl::default_requisition(_requisition);
- GraphicImpl::init_requisition(_requisition);
- long n = num_children();
- if (n > 0)
+ GraphicImpl::default_requisition(my_requisition);
+ GraphicImpl::init_requisition(my_requisition);
+ long n = num_children();
+ if (n > 0)
{
- Fresco::Graphic::Requisition *r = children_requests();
- _layout->request(n, r, _requisition);
- deallocate_requisitions(r);
+ Fresco::Graphic::Requisition *r = children_requests();
+ my_layout->request(n, r, my_requisition);
+ deallocate_requisitions(r);
}
- _requested = true;
+ my_requested = true;
}
- r = _requisition;
+ r = my_requisition;
}
void Box::extension(const Allocation::Info &info, Region_ptr ext_region)
{
- Trace trace(this, "Box::extension");
- long size = num_children();
- if (size > 0)
+ Trace trace(this, "Box::extension");
+ long size = num_children();
+ if (size > 0)
{
- Allocation::Info child;
- Vertex origin, previous, delta;
- previous.x = previous.y = previous.z = 0;
+ Allocation::Info child;
+ Vertex origin, previous, delta;
+ previous.x = previous.y = previous.z = 0;
- Lease_var<TransformImpl> child_tx(Provider<TransformImpl>::provide());
- Lease_var<TransformImpl> tmp_tx(Provider<TransformImpl>::provide());
- Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
- Region_var region_this(region->_this());
- Transform_var tmp_tx_this(tmp_tx->_this());
- tmp_tx->load_identity();
- child_tx->load_identity();
-
- child.transformation = child_tx->_this();
- child.transformation->copy(info.transformation);
- LayoutManager::Allocations result = children_allocations(info.allocation);
- for (long i = 0; i < size; i++)
+ Lease_var<TransformImpl>
+ child_tx(Provider<TransformImpl>::provide());
+ Lease_var<TransformImpl>
+ tmp_tx(Provider<TransformImpl>::provide());
+ Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
+ Region_var region_this(region->_this());
+ Transform_var tmp_tx_this(tmp_tx->_this());
+ tmp_tx->load_identity();
+ child_tx->load_identity();
+
+ child.transformation = child_tx->_this();
+ child.transformation->copy(info.transformation);
+ LayoutManager::Allocations result =
+ children_allocations(info.allocation);
+ for (long i = 0; i < size; i++)
{
#if 1
- *region = *result[i];
- region->normalize(origin);
- delta = origin - previous;
-// tmp_tx->loadIdentity();
- tmp_tx->translate(delta);
- child.allocation = region_this;
- child.transformation->premultiply(tmp_tx_this);
- child_extension(i, child, ext_region);
- previous = origin;
+ *region = *result[i];
+ region->normalize(origin);
+ delta = origin - previous;
+// tmp_tx->loadIdentity();
+ tmp_tx->translate(delta);
+ child.allocation = region_this;
+ child.transformation->premultiply(tmp_tx_this);
+ child_extension(i, child, ext_region);
+ previous = origin;
#else
- result[i]->normalize(origin);
- delta = origin - previous;
-// tmp_tx->loadIdentity();
- tmp_tx->translate(delta);
- child.allocation = result[i]->_this();
- child.transformation->premultiply(Transform_var(tmp_tx->_this()));
- child_extension(i, child, ext_region);
- previous = origin;
+ result[i]->normalize(origin);
+ delta = origin - previous;
+// tmp_tx->loadIdentity();
+ tmp_tx->translate(delta);
+ child.allocation = result[i]->_this();
+ child.transformation->premultiply(Transform_var(tmp_tx->_this()));
+ child_extension(i, child, ext_region);
+ previous = origin;
#endif
}
#ifndef USE_ALLOCATION_CACHE
- for (CORBA::Long i = 0; i != size; ++i) Provider<RegionImpl>::adopt(result[i]);
- delete [] result;
+ for (CORBA::Long i = 0; i != size; ++i)
+ Provider<RegionImpl>::adopt(result[i]);
+ delete [] result;
#endif
}
}
void Box::traverse(Traversal_ptr traversal)
{
- Trace trace(this, "Box::traverse");
- if (num_children())
+ Trace trace(this, "Box::traverse");
+ if (num_children())
{
- Region_var given = traversal->current_allocation();
- if (!CORBA::is_nil(given))
+ Region_var given = traversal->current_allocation();
+ if (!CORBA::is_nil(given))
{
/*
* this cull test is not accurate, it assumes that the children
@@ -146,34 +150,32 @@
* -stefan
*/
if (traversal->intersects_allocation())
- traverse_with_allocation(traversal, given);
+ traverse_with_allocation(traversal, given);
}
- else traverse_without_allocation(traversal);
+ else traverse_without_allocation(traversal);
}
}
void Box::need_resize()
{
- _requested = false;
- if (_cache_allocations)
+ my_requested = false;
+ if (my_cache_allocations)
{
- for (CORBA::Long i = 0; i != _cache_size; ++i)
- Provider<RegionImpl>::adopt(_cache_allocations[i]);
- delete [] _cache_allocations;
- _cache_allocations = 0;
+ for (CORBA::Long i = 0; i != my_cache_size; ++i)
+ Provider<RegionImpl>::adopt(my_cache_allocations[i]);
+ delete [] my_cache_allocations;
+ my_cache_allocations = 0;
}
- {
- std::ostringstream buf;
- buf << _box_name << " " << _layout->name() << " with " << num_children() << " children" << std::ends;
- strcpy(_obj_name, buf.str().c_str());
- }
- PolyGraphic::need_resize();
+ {
+ std::ostringstream buf;
+ buf << my_box_name << " " << my_layout->name() << " with "
+ << num_children() << " children" << std::ends;
+ strcpy(my_obj_name, buf.str().c_str());
+ }
+ PolyGraphic::need_resize();
}
-void Box::need_resize(Tag)
-{
- need_resize();
-}
+void Box::need_resize(Tag) { need_resize(); }
/*
* this is a method called (but left empty in the superclass) in
@@ -183,176 +185,207 @@
*/
void Box::allocate(Tag tag, const Allocation::Info &info)
{
- Trace trace(this, "Box::allocate");
- /*
- * fetch requested (presumably allocated) child regions
- */
- CORBA::Long n = num_children();
- LayoutManager::Allocations result = children_allocations(info.allocation);
- Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
- tx->load_identity();
+ Trace trace(this, "Box::allocate");
+ // fetch requested (presumably allocated) child regions
+ CORBA::Long n = num_children();
+ LayoutManager::Allocations result =
+ children_allocations(info.allocation);
+ Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
+ tx->load_identity();
- /*
- * copy transformation and region into allocation
- */
- CORBA::Long idx = child_id_to_index(tag);
- Logger::log(Logger::layout) << "Allocating child " << idx << "\n";
- Lease_var<RegionImpl> region( Provider<RegionImpl>::provide() );
- *region = *result[idx];
- region->normalize(Transform_var(tx->_this()));
- info.transformation->premultiply(Transform_var(tx->_this()));
- info.allocation->copy(Region_var(region->_this()));
+ // copy transformation and region into allocation
+ CORBA::Long idx = child_id_to_index(tag);
+ Logger::log(Logger::layout) << "Allocating child " << idx << "\n";
+ Lease_var<RegionImpl> region( Provider<RegionImpl>::provide() );
+ *region = *result[idx];
+ region->normalize(Transform_var(tx->_this()));
+ info.transformation->premultiply(Transform_var(tx->_this()));
+ info.allocation->copy(Region_var(region->_this()));
}
/*
* this is called from Box::allocate to resolve the layout of the box's
* children by (a) asking the children how big they want to be, then (b)
- * delegating the actual allocation to the current layoutManager. It also caches
- * the children's requests so that the real layout (at draw time) will happen
- * faster.
+ * delegating the actual allocation to the current layoutManager. It also
+ * caches the children's requests so that the real layout (at draw time)
+ * will happen faster.
*/
LayoutManager::Allocations Box::children_allocations(Region_ptr allocation)
{
- Trace trace(this, "Box::children_allocations");
- if (!_cache_allocations)
+ Trace trace(this, "Box::children_allocations");
+ if (!my_cache_allocations)
{
- CORBA::Long children = num_children();
- Fresco::Graphic::Requisition *childrenRequisitions = children_requests();
+ CORBA::Long children = num_children();
+ Fresco::Graphic::Requisition *childrenRequisitions =
+ children_requests();
- // cache integrated form of children requisitions
- if (!_requested)
+ // cache integrated form of children requisitions
+ if (!my_requested)
{
- GraphicImpl::init_requisition(_requisition);
- _layout->request(children, childrenRequisitions, _requisition);
- _requested = true;
+ GraphicImpl::init_requisition(my_requisition);
+ my_layout->request(children, childrenRequisitions,
+ my_requisition);
+ my_requested = true;
}
- // build region array for children
- RegionImpl **childrenRegions = new RegionImpl *[children];
- for (CORBA::Long i = 0; i < children; i++)
+ // build region array for children
+ RegionImpl **childrenRegions = new RegionImpl *[children];
+ for (CORBA::Long i = 0; i < children; i++)
{
- childrenRegions[i] = Provider<RegionImpl>::provide();
- childrenRegions[i]->valid = true;
+ childrenRegions[i] = Provider<RegionImpl>::provide();
+ childrenRegions[i]->valid = true;
}
- // fill in children regions which are reasonable matches for the given requesitions
- _layout->allocate(children, childrenRequisitions, allocation, childrenRegions);
- deallocate_requisitions(childrenRequisitions);
- _cache_allocations = childrenRegions;
- _cache_size = children;
+ // fill in children regions which are reasonable matches for the
+ // given requesitions
+ my_layout->allocate(children, childrenRequisitions, allocation,
+ childrenRegions);
+ deallocate_requisitions(childrenRequisitions);
+ my_cache_allocations = childrenRegions;
+ my_cache_size = children;
}
#ifndef USE_ALLOCATION_CACHE
- // Return a copy of the region array for old code that changes the regions
- RegionImpl **childrenRegions = _cache_allocations;
-// new RegionImpl *[_cache_size];
-// for (CORBA::Long i = 0; i < _cache_size; i++)
-// {
-// childrenRegions[i] = Provider<RegionImpl>::provide();
-// *childrenRegions[i] = *_cache_allocations[i];
-// }
- _cache_allocations = 0;
- return childrenRegions;
+ // Return a copy of the region array for old code that changes the
+ // regions
+ RegionImpl **childrenRegions = my_cache_allocations;
+// new RegionImpl *[my_cache_size];
+// for (CORBA::Long i = 0; i < my_cache_size; i++)
+// {
+// childrenRegions[i] = Provider<RegionImpl>::provide();
+// *childrenRegions[i] = *my_cache_allocations[i];
+// }
+ my_cache_allocations = 0;
+ return childrenRegions;
#else
- return _cache_allocations;
+ return my_cache_allocations;
#endif
}
void Box::traverse_with_allocation(Traversal_ptr t, Region_ptr r)
{
- Trace trace(this, "Box::traverse_with_allocation");
- LayoutManager::Allocations result = children_allocations(r);
+ Trace trace(this, "Box::traverse_with_allocation");
+ LayoutManager::Allocations result = children_allocations(r);
- Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
- Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
- Transform_var tx_this(tx->_this());
- Region_var region_this(region->_this());
- tx->load_identity();
+ Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
+ Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
+ Transform_var tx_this(tx->_this());
+ Region_var region_this(region->_this());
+ tx->load_identity();
- CORBA::Long size = num_children();
- CORBA::Long begin, end, incr;
- if (t->direction() == Traversal::up)
+ CORBA::Long size = num_children();
+ CORBA::Long begin, end, incr;
+ if (t->direction() == Traversal::up)
{
- begin = 0;
- end = size;
- incr = 1;
+ begin = 0;
+ end = size;
+ incr = 1;
}
- else
+ else
{
- begin = size - 1;
- end = -1;
- incr = -1;
+ begin = size - 1;
+ end = -1;
+ incr = -1;
}
- for (CORBA::Long i = begin; i != end; i += incr)
+ for (CORBA::Long i = begin; i != end; i += incr)
{
- if (CORBA::is_nil(_children[i].peer)) continue;
- Vertex origin;
- *region = *result[i];
- region->normalize(origin);
- tx->load_identity();
- /*
- * ok, so we stipulate that Boxes lay out their children
- * only translating them -stefan
- */
- tx->translate(origin);
- try { t->traverse_child(_children[i].peer, _children[i].localId, region_this, tx_this);}
- catch (const CORBA::OBJECT_NOT_EXIST &) { _children [i].peer = Fresco::Graphic::_nil ();}
- catch (const CORBA::COMM_FAILURE &) { _children [i].peer = Fresco::Graphic::_nil ();}
- catch (const CORBA::TRANSIENT &) { _children [i].peer = Fresco::Graphic::_nil ();}
- if (!t->ok()) break;
+ if (CORBA::is_nil(my_children[i].peer)) continue;
+ Vertex origin;
+ *region = *result[i];
+ region->normalize(origin);
+ tx->load_identity();
+ // ok, so we stipulate that Boxes lay out their children
+ // only translating them -stefan
+ tx->translate(origin);
+ try
+ {
+ t->traverse_child(my_children[i].peer,
+ my_children[i].localId,
+ region_this, tx_this);
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { my_children [i].peer = Fresco::Graphic::_nil (); }
+ catch (const CORBA::COMM_FAILURE &)
+ { my_children [i].peer = Fresco::Graphic::_nil (); }
+ catch (const CORBA::TRANSIENT &)
+ { my_children [i].peer = Fresco::Graphic::_nil (); }
+ if (!t->ok()) break;
}
#ifndef USE_ALLOCATION_CACHE
- for (CORBA::Long i = 0; i != size; ++i) Provider<RegionImpl>::adopt(result[i]);
- delete [] result;
+ for (CORBA::Long i = 0; i != size; ++i)
+ Provider<RegionImpl>::adopt(result[i]);
+ delete [] result;
#endif
}
void Box::traverse_without_allocation(Traversal_ptr t)
{
- Trace trace(this, "Box::traverse_without_allocation");
- if (t->direction() == Traversal::up)
+ Trace trace(this, "Box::traverse_without_allocation");
+ if (t->direction() == Traversal::up)
{
- for (glist_t::iterator i = _children.begin(); i != _children.end() && t->ok(); i++)
+ for (glist_t::iterator i = my_children.begin();
+ i != my_children.end() && t->ok(); ++i)
{
- if (CORBA::is_nil(i->peer)) continue;
- try { t->traverse_child (i->peer, i->localId, Region::_nil (), Transform::_nil ());}
- catch (const CORBA::OBJECT_NOT_EXIST &) { i->peer = Fresco::Graphic::_nil ();}
- catch (const CORBA::COMM_FAILURE &) { i->peer = Fresco::Graphic::_nil ();}
- catch (const CORBA::TRANSIENT &) { i->peer = Fresco::Graphic::_nil ();}
+ if (CORBA::is_nil(i->peer)) continue;
+ try
+ {
+ t->traverse_child (i->peer, i->localId, Region::_nil(),
+ Transform::_nil());
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { i->peer = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { i->peer = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { i->peer = Fresco::Graphic::_nil(); }
}
}
- else
+ else
{
- for (glist_t::reverse_iterator i = _children.rbegin(); i != _children.rend() && t->ok(); i++)
+ for (glist_t::reverse_iterator i = my_children.rbegin();
+ i != my_children.rend() && t->ok();
+ ++i)
{
- if (CORBA::is_nil (i->peer)) continue;
- try { t->traverse_child (i->peer, i->localId, Region::_nil(), Transform::_nil());}
- catch (const CORBA::OBJECT_NOT_EXIST &) { i->peer = Fresco::Graphic::_nil();}
- catch (const CORBA::COMM_FAILURE &) { i->peer = Fresco::Graphic::_nil();}
- catch (const CORBA::TRANSIENT &) { i->peer = Fresco::Graphic::_nil();}
+ if (CORBA::is_nil (i->peer)) continue;
+ try
+ {
+ t->traverse_child (i->peer, i->localId, Region::_nil(),
+ Transform::_nil());
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { i->peer = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { i->peer = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { i->peer = Fresco::Graphic::_nil(); }
}
}
}
-BoxAlignElements::BoxAlignElements(LayoutManager *layout, Axis a, Alignment align)
- : Box(layout), axis(a), alignment(align)
+BoxAlignElements::BoxAlignElements(LayoutManager *layout, Axis a,
+ Alignment align) :
+ Box(layout),
+ my_axis(a),
+ my_alignment(align)
{
- _box_name = "BoxAlignElements";
- std::ostringstream buf;
- buf << _box_name << " " << layout->name() << std::ends;
- strcpy(_obj_name, buf.str().c_str());
+ my_box_name = "BoxAlignElements";
+ std::ostringstream buf;
+ buf << my_box_name << " " << layout->name() << std::ends;
+ strcpy(my_obj_name, buf.str().c_str());
}
-BoxAlignElements::~BoxAlignElements() {}
+BoxAlignElements::~BoxAlignElements() { }
void BoxAlignElements::append_graphic(Graphic_ptr g)
{
- Placement *placement = new Placement(new LayoutCenter(axis, alignment));
- placement->body(g);
- Box::append_graphic(Graphic_var(placement->_this()));
+ Placement *placement =
+ new Placement(new LayoutCenter(my_axis, my_alignment));
+ placement->body(g);
+ Box::append_graphic(Graphic_var(placement->_this()));
}
void BoxAlignElements::prepend_graphic(Graphic_ptr g)
{
- Placement *placement = new Placement(new LayoutCenter(axis, alignment));
- placement->body(g);
- Box::prepend_graphic(Graphic_var(placement->_this()));
+ Placement *placement =
+ new Placement(new LayoutCenter(my_axis, my_alignment));
+ placement->body(g);
+ Box::prepend_graphic(Graphic_var(placement->_this()));
}
Index: Box.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Box.hh,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Box.hh 5 Jan 2003 16:21:33 -0000 1.15
+++ Box.hh 29 Dec 2003 08:03:28 -0000 1.16
@@ -1,7 +1,7 @@
/*$Id$
*
* This source file is a part of the Fresco Project.
- * Copyright (C) 1999 Stefan Seefeld <[email protected]>
+ * Copyright (C) 1999 Stefan Seefeld <[email protected]>
* http://www.fresco.org
*
* This library is free software; you can redistribute it and/or
@@ -19,111 +19,140 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _Box_hh
-#define _Box_hh
+#ifndef _Layout_Box_hh
+#define _Layout_Box_hh
#include <Berlin/PolyGraphic.hh>
#include "LayoutManager.hh"
-namespace Berlin {
-namespace LayoutKit {
-
-class Box : public PolyGraphic
+namespace Berlin
{
-public:
- Box(LayoutManager *);
- virtual ~Box();
+ namespace LayoutKit
+ {
- virtual void request(Fresco::Graphic::Requisition &);
- virtual void extension(const Fresco::Allocation::Info &, Fresco::Region_ptr);
+ class Box : public PolyGraphic
+ {
+ public:
+ Box(LayoutManager *);
+ virtual ~Box();
- virtual void traverse(Fresco::Traversal_ptr);
- virtual void need_resize();
- virtual void need_resize(Fresco::Tag);
- virtual void allocate(Fresco::Tag, const Fresco::Allocation::Info &);
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void extension(const Fresco::Allocation::Info &,
+ Fresco::Region_ptr);
- virtual const char* object_name() { return _obj_name;}
+ virtual void traverse(Fresco::Traversal_ptr);
+ virtual void need_resize();
+ virtual void need_resize(Fresco::Tag);
+ virtual void allocate(Fresco::Tag,
+ const Fresco::Allocation::Info &);
-protected:
- LayoutManager::Allocations children_allocations(Fresco::Region_ptr);
- void traverse_with_allocation(Fresco::Traversal_ptr, Fresco::Region_ptr);
- void traverse_without_allocation(Fresco::Traversal_ptr);
-
- //. The fixed class name of this object, used for constructing name strings
- const char *_box_name;
- //. The changing object name. Note that this is allocated as a buffer and
- //. strcpy'd into, since it may change over the course of a method but cannot
- //. be deleted in the scope of a Trace guard object
- char *_obj_name;
-private:
- LayoutManager *_layout;
- bool _requested;
- Fresco::Graphic::Requisition _requisition;
+ virtual const char* object_name() { return my_obj_name; }
- //. The size of the allocation cache
- CORBA::Long _cache_size;
- //. A cache of children allocations to speed traversals
- LayoutManager::Allocations _cache_allocations;
-};
+ protected:
+ LayoutManager::Allocations
+ children_allocations(Fresco::Region_ptr);
+ void traverse_with_allocation(Fresco::Traversal_ptr,
+ Fresco::Region_ptr);
+ void traverse_without_allocation(Fresco::Traversal_ptr);
-class BoxAlignElements : public Box
-{
-public:
- BoxAlignElements(LayoutManager *, Fresco::Axis, Fresco::Alignment);
- virtual ~BoxAlignElements();
+ //. The fixed class name of this object, used for constructing
+ //. name strings
+ const char *my_box_name;
+ //. The changing object name. Note that this is allocated as a
+ //. buffer and strcpy'd into, since it may change over the course
+ //. of a method but cannot be deleted in the scope of a Trace guard
+ //. object
+ char *my_obj_name;
+ private:
+ LayoutManager *my_layout;
+ bool my_requested;
+ Fresco::Graphic::Requisition my_requisition;
- virtual void append_graphic(Fresco::Graphic_ptr);
- virtual void prepend_graphic(Fresco::Graphic_ptr);
-private:
- Fresco::Axis axis;
- Fresco::Alignment alignment;
-};
+ //. The size of the allocation cache
+ CORBA::Long my_cache_size;
+ //. A cache of children allocations to speed traversals
+ LayoutManager::Allocations my_cache_allocations;
+ };
+
+ class BoxAlignElements : public Box
+ {
+ public:
+ BoxAlignElements(LayoutManager *, Fresco::Axis, Fresco::Alignment);
+ virtual ~BoxAlignElements();
-class HBox : public Box
-{
-public:
- HBox() : Box(new LayoutSuperpose(new LayoutTile(Fresco::xaxis), new LayoutAlign(Fresco::yaxis), new LayoutAlign(Fresco::zaxis))) {}
-};
+ virtual void append_graphic(Fresco::Graphic_ptr);
+ virtual void prepend_graphic(Fresco::Graphic_ptr);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Alignment my_alignment;
+ };
-class VBox : public Box
-{
-public:
- VBox() : Box(new LayoutSuperpose(new LayoutTile(Fresco::yaxis), new LayoutAlign(Fresco::xaxis), new LayoutAlign(Fresco::zaxis))) {}
-};
+ class HBox : public Box
+ {
+ public:
+ HBox() :
+ Box(new LayoutSuperpose(new LayoutTile(Fresco::xaxis),
+ new LayoutAlign(Fresco::yaxis),
+ new LayoutAlign(Fresco::zaxis)))
+ { }
+ };
-class HBoxFirstAligned : public Box
-{
-public:
- HBoxFirstAligned() : Box(new LayoutSuperpose(new LayoutTileFirstAligned(Fresco::xaxis), new LayoutAlign(Fresco::yaxis))) {}
-};
+ class VBox : public Box
+ {
+ public:
+ VBox() :
+ Box(new LayoutSuperpose(new LayoutTile(Fresco::yaxis),
+ new LayoutAlign(Fresco::xaxis),
+ new LayoutAlign(Fresco::zaxis)))
+ { }
+ };
-class VBoxFirstAligned : public Box
-{
-public:
- VBoxFirstAligned() : Box(new LayoutSuperpose(new LayoutTileReversedFirstAligned(Fresco::yaxis), new LayoutAlign(Fresco::xaxis))) {}
-};
+ class HBoxFirstAligned : public Box
+ {
+ public:
+ HBoxFirstAligned() :
+ Box(new LayoutSuperpose(new LayoutTileFirstAligned(Fresco::xaxis),
+ new LayoutAlign(Fresco::yaxis)))
+ { }
+ };
-class HBoxAlignElements : public BoxAlignElements
-{
-public:
- HBoxAlignElements(double align)
- : BoxAlignElements(new LayoutSuperpose(new LayoutTile(Fresco::xaxis), new LayoutAlign(Fresco::yaxis)), Fresco::yaxis, align) {}
-};
+ class VBoxFirstAligned : public Box
+ {
+ public:
+ VBoxFirstAligned() :
+ Box(new LayoutSuperpose(new LayoutTileReversedFirstAligned(Fresco::yaxis),
+ new LayoutAlign(Fresco::xaxis)))
+ { }
+ };
-class VBoxAlignElements : public BoxAlignElements
-{
-public:
- VBoxAlignElements(double align)
- : BoxAlignElements(new LayoutSuperpose(new LayoutTile(Fresco::yaxis), new LayoutAlign(Fresco::xaxis)), Fresco::xaxis, align) {}
-};
+ class HBoxAlignElements : public BoxAlignElements
+ {
+ public:
+ HBoxAlignElements(double align) :
+ BoxAlignElements(new LayoutSuperpose(new LayoutTile(Fresco::xaxis),
+ new LayoutAlign(Fresco::yaxis)), Fresco::yaxis, align)
+ { }
+ };
-class Overlay : public Box
-{
-public:
- Overlay() : Box(new LayoutSuperpose(new LayoutAlign(Fresco::xaxis), new LayoutAlign(Fresco::yaxis))) {}
-};
+ class VBoxAlignElements : public BoxAlignElements
+ {
+ public:
+ VBoxAlignElements(double align) :
+ BoxAlignElements(new LayoutSuperpose(new LayoutTile(Fresco::yaxis),
+ new LayoutAlign(Fresco::xaxis)), Fresco::xaxis, align)
+ { }
+ };
-} // namespace
+ class Overlay : public Box
+ {
+ public:
+ Overlay() :
+ Box(new LayoutSuperpose(new LayoutAlign(Fresco::xaxis),
+ new LayoutAlign(Fresco::yaxis)))
+ { }
+ };
+
+ } // namespace
} // namespace
#endif
Index: Deck.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Deck.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Deck.cc 5 Jan 2003 16:21:33 -0000 1.16
+++ Deck.cc 29 Dec 2003 08:03:28 -0000 1.17
@@ -29,40 +29,49 @@
using namespace Berlin::LayoutKit;
-Deck::Deck() : _requested(false) {}
-Deck::~Deck() {}
+Deck::Deck() : my_requested(false) { }
+Deck::~Deck() { }
void Deck::request(Fresco::Graphic::Requisition &r)
{
- if (!_requested)
+ if (!my_requested)
{
- GraphicImpl::init_requisition(_requisition);
- long n = _children.size();
- if (n > 0)
+ GraphicImpl::init_requisition(my_requisition);
+ long n = my_children.size();
+ if (n > 0)
{
- Fresco::Graphic::Requisition *r = children_requests();
- LayoutAlign x(xaxis);
- x.request(n, r, _requisition);
- LayoutAlign y(yaxis);
- y.request(n, r, _requisition);
- _pool.deallocate(r);
+ Fresco::Graphic::Requisition *r = children_requests();
+ LayoutAlign x(xaxis);
+ x.request(n, r, my_requisition);
+ LayoutAlign y(yaxis);
+ y.request(n, r, my_requisition);
+ my_pool.deallocate(r);
}
- _requested = true;
+ my_requested = true;
}
- r = _requisition;
+ r = my_requisition;
}
void Deck::extension(const Allocation::Info &a, Region_ptr r)
{
- if (size_t n = _children.size()) _children[n - 1].peer->extension(a, r);
+ if (size_t n = my_children.size())
+ my_children[n - 1].peer->extension(a, r);
}
void Deck::traverse(Traversal_ptr t)
{
- size_t n = _children.size ();
- if (n == 0) return;
- try { t->traverse_child (_children [n-1].peer, _children [n-1].localId, Region::_nil(), Transform::_nil());}
- catch (const CORBA::OBJECT_NOT_EXIST &) { _children [n-1].peer = Fresco::Graphic::_nil();}
- catch (const CORBA::COMM_FAILURE &) { _children [n-1].peer = Fresco::Graphic::_nil();}
- catch (const CORBA::TRANSIENT &) { _children [n-1].peer = Fresco::Graphic::_nil();}
+ size_t n = my_children.size ();
+ if (n == 0) return;
+ try
+ {
+ t->traverse_child(my_children [n-1].peer,
+ my_children [n-1].localId, Region::_nil(),
+ Transform::_nil());
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { my_children[n-1].peer = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { my_children[n-1].peer = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { my_children[n-1].peer = Fresco::Graphic::_nil(); }
}
Index: Deck.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Deck.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Deck.hh 5 Jan 2003 16:21:33 -0000 1.8
+++ Deck.hh 29 Dec 2003 08:03:28 -0000 1.9
@@ -19,31 +19,34 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _Deck_hh
-#define _Deck_hh
+#ifndef _Layout_Deck_hh
+#define _Layout_Deck_hh
#include <Berlin/PolyGraphic.hh>
-namespace Berlin {
-namespace LayoutKit {
-
-class Deck : public PolyGraphic
+namespace Berlin
{
-public:
- Deck();
- virtual ~Deck();
-
- virtual void request(Fresco::Graphic::Requisition &);
- virtual void extension(const Fresco::Allocation::Info &, Fresco::Region_ptr);
+ namespace LayoutKit
+ {
- virtual void traverse(Fresco::Traversal_ptr);
+ class Deck : public PolyGraphic
+ {
+ public:
+ Deck();
+ virtual ~Deck();
+
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void extension(const Fresco::Allocation::Info &,
+ Fresco::Region_ptr);
-protected:
- bool _requested;
- Fresco::Graphic::Requisition _requisition;
-};
+ virtual void traverse(Fresco::Traversal_ptr);
-} // namespace
+ protected:
+ bool my_requested;
+ Fresco::Graphic::Requisition my_requisition;
+ };
+
+ } // namespace
} // namespace
#endif
Index: Glue.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Glue.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Glue.cc 5 Jan 2003 16:21:33 -0000 1.9
+++ Glue.cc 29 Dec 2003 08:03:28 -0000 1.10
@@ -25,15 +25,17 @@
using namespace Berlin::LayoutKit;
-Glue::Glue(Axis a, Coord natural, Coord stretch, Coord shrink, Alignment align)
+Glue::Glue(Axis a,
+ Coord natural, Coord stretch, Coord shrink, Alignment align)
{
- GraphicImpl::init_requisition(_requisition);
- Fresco::Graphic::Requirement *r = GraphicImpl::requirement(_requisition, a);
- if (r != 0) GraphicImpl::require(*r, natural, stretch, shrink, align);
+ GraphicImpl::init_requisition(my_requisition);
+ Fresco::Graphic::Requirement *r =
+ GraphicImpl::requirement(my_requisition, a);
+ if (r != 0) GraphicImpl::require(*r, natural, stretch, shrink, align);
}
-Glue::Glue(const Fresco::Graphic::Requisition &r) { _requisition = r;}
-Glue::~Glue() {}
+Glue::Glue(const Fresco::Graphic::Requisition &r) { my_requisition = r; }
+Glue::~Glue() { }
-void Glue::request(Fresco::Graphic::Requisition &r) { r = _requisition;}
+void Glue::request(Fresco::Graphic::Requisition &r) { r = my_requisition; }
Index: Glue.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Glue.hh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Glue.hh 5 Jan 2003 16:21:33 -0000 1.7
+++ Glue.hh 29 Dec 2003 08:03:28 -0000 1.8
@@ -19,29 +19,33 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _Glue_hh
-#define _Glue_hh
+#ifndef _Layout_Glue_hh
+#define _Layout_Glue_hh
#include <Berlin/GraphicImpl.hh>
-namespace Berlin {
-namespace LayoutKit {
-
-class Glue : public GraphicImpl
+namespace Berlin
{
-public:
- Glue(Fresco::Axis, Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Alignment);
- Glue(const Fresco::Graphic::Requisition &);
- virtual ~Glue();
-
- virtual void request(Fresco::Graphic::Requisition &);
+ namespace LayoutKit
+ {
- virtual const char *object_name() { return "Layout/Glue";}
-private:
- Fresco::Graphic::Requisition _requisition;
-};
+ class Glue : public GraphicImpl
+ {
+ public:
+ Glue(Fresco::Axis,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Alignment);
+ Glue(const Fresco::Graphic::Requisition &);
+ virtual ~Glue();
+
+ virtual void request(Fresco::Graphic::Requisition &);
-} // namespace
+ virtual const char *object_name() { return "Layout/Glue";}
+ private:
+ Fresco::Graphic::Requisition my_requisition;
+ };
+
+ } // namespace
} // namespace
#endif
Index: GridImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/GridImpl.cc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- GridImpl.cc 27 Oct 2003 17:08:37 -0000 1.32
+++ GridImpl.cc 29 Dec 2003 08:03:28 -0000 1.33
@@ -37,35 +37,45 @@
using namespace Berlin::LayoutKit;
-std::ostream &operator << (std::ostream &os, const GridImpl::Span &span)
-{ return os << '(' << span.lower << ',' << span.upper << '@' << span.align << ')';}
+namespace std
+{
+ std::ostream &operator << (std::ostream &os,
+ const GridImpl::Span &span)
+ {
+ return os << '(' << span.lower << ',' << span.upper
+ << '@' << span.align << ')';
+ }
+} // namespace
-static void set_span(GridImpl::Span &s, Coord origin, Coord length, Alignment align)
+static void set_span(GridImpl::Span &s, Coord origin, Coord length,
+ Alignment align)
{
- Coord begin = origin - length * align;
- Coord end = begin + length;
- s.lower = begin;
- s.upper = end;
- s.align = align;
+ Coord begin = origin - length * align;
+ Coord end = begin + length;
+ s.lower = begin;
+ s.upper = end;
+ s.align = align;
}
-static inline void spans_to_region(GridImpl::Span &x_span, GridImpl::Span &y_span, RegionImpl *r)
+static inline void spans_to_region(GridImpl::Span &x_span,
+ GridImpl::Span &y_span,
+ Berlin::RegionImpl *r)
{
- r->valid = true;
- r->lower.x = x_span.lower;
- r->upper.x = x_span.upper;
- r->xalign = x_span.align;
- r->lower.y = y_span.lower;
- r->upper.y = y_span.upper;
- r->yalign = y_span.align;
+ r->valid = true;
+ r->lower.x = x_span.lower;
+ r->upper.x = x_span.upper;
+ r->xalign = x_span.align;
+ r->lower.y = y_span.lower;
+ r->upper.y = y_span.upper;
+ r->yalign = y_span.align;
}
-static void offset_region(RegionImpl *r, Coord dx, Coord dy)
+static void offset_region(Berlin::RegionImpl *r, Coord dx, Coord dy)
{
- r->lower.x += dx;
- r->upper.x += dx;
- r->lower.y += dy;
- r->upper.y += dy;
+ r->lower.x += dx;
+ r->upper.x += dx;
+ r->lower.y += dy;
+ r->upper.y += dy;
}
namespace Berlin
@@ -76,38 +86,38 @@
{
public:
LayoutAlignRequest();
-
+
void margin(Coord margin);
-
+
void accumulate(const Graphic::Requirement &r);
void requirement(Graphic::Requirement &r) const;
-
+
protected:
- Coord natural_lead;
- Coord min_lead;
- Coord max_lead;
- Coord natural_trail;
- Coord min_trail;
- Coord max_trail;
+ Coord my_natural_lead;
+ Coord my_min_lead;
+ Coord my_max_lead;
+ Coord my_natural_trail;
+ Coord my_min_trail;
+ Coord my_max_trail;
};
LayoutAlignRequest::LayoutAlignRequest() :
- natural_lead(0),
- min_lead(-GraphicImpl::infinity),
- max_lead(GraphicImpl::infinity),
- natural_trail(0),
- min_trail(-GraphicImpl::infinity),
- max_trail(GraphicImpl::infinity)
+ my_natural_lead(0),
+ my_min_lead(-GraphicImpl::infinity),
+ my_max_lead(GraphicImpl::infinity),
+ my_natural_trail(0),
+ my_min_trail(-GraphicImpl::infinity),
+ my_max_trail(GraphicImpl::infinity)
{ }
void LayoutAlignRequest::margin(Coord margin)
{
- natural_lead += margin;
- min_lead -= margin;
- max_lead += margin;
- natural_trail += margin;
- min_trail -= margin;
- max_trail += margin;
+ my_natural_lead += margin;
+ my_min_lead -= margin;
+ my_max_lead += margin;
+ my_natural_trail += margin;
+ my_min_trail -= margin;
+ my_max_trail += margin;
}
void LayoutAlignRequest::accumulate(const Graphic::Requirement &r)
@@ -119,26 +129,29 @@
Coord r_min = r.minimum;
Coord r_align = r.align;
Coord r_inv_align = Coord(1) - r_align;
- natural_lead = Math::max(natural_lead, Coord(r_nat * r_align));
- max_lead = Math::min(max_lead, Coord(r_max * r_align));
- min_lead = Math::max(min_lead, Coord(r_min * r_align));
- natural_trail = Math::max(natural_trail, Coord(r_nat * r_inv_align));
- max_trail = Math::min(max_trail, Coord(r_max * r_inv_align));
- min_trail = Math::max(min_trail, Coord(r_min * r_inv_align));
+ my_natural_lead = Math::max(my_natural_lead,
+ Coord(r_nat * r_align));
+ my_max_lead = Math::min(my_max_lead, Coord(r_max * r_align));
+ my_min_lead = Math::max(my_min_lead, Coord(r_min * r_align));
+ my_natural_trail = Math::max(my_natural_trail,
+ Coord(r_nat * r_inv_align));
+ my_max_trail = Math::min(my_max_trail, Coord(r_max * r_inv_align));
+ my_min_trail = Math::max(my_min_trail, Coord(r_min * r_inv_align));
}
void LayoutAlignRequest::requirement(Graphic::Requirement &r) const
{
GraphicImpl::require_lead_trail(r,
- natural_lead, max_lead, min_lead,
- natural_trail, max_trail, min_trail);
+ my_natural_lead, my_max_lead,
+ my_min_lead, my_natural_trail,
+ my_max_trail, my_min_trail);
}
class LayoutTileRequest
{
public:
LayoutTileRequest();
-
+
void space(Coord space);
void flexible();
@@ -150,7 +163,9 @@
Coord max_size;
};
- LayoutTileRequest::LayoutTileRequest() : natural(0), min_size(0), max_size(0) { }
+ LayoutTileRequest::LayoutTileRequest() :
+ natural(0), min_size(0), max_size(0)
+ { }
void LayoutTileRequest::space(Coord space)
{
@@ -159,12 +174,13 @@
min_size += space;
}
- void LayoutTileRequest::flexible() { max_size = GraphicImpl::infinity; }
+ void LayoutTileRequest::flexible()
+ { max_size = GraphicImpl::infinity; }
void LayoutTileRequest::accumulate(const Graphic::Requirement &r)
{
if (!r.defined) return;
-
+
natural += r.natural;
max_size += r.maximum;
min_size += r.minimum;
@@ -191,29 +207,30 @@
void next_span(const Graphic::Requirement &, GridImpl::Span &);
private:
- bool first_aligned;
- bool growing;
- bool shrinking;
- Coord f;
- Coord p;
- long i;
+ bool my_first_aligned;
+ bool my_growing;
+ bool my_shrinking;
+ Coord my_f;
+ Coord my_p;
+ long my_i;
};
LayoutTileAllocate::LayoutTileAllocate(Axis axis,
- Graphic::Requisition &total, bool fa,
+ Graphic::Requisition &total,
+ bool fa,
Region_ptr given)
{
- first_aligned = fa;
+ my_first_aligned = fa;
Graphic::Requirement *r;
Region::Allotment a;
r = GraphicImpl::requirement(total, axis);
given->span(axis, a);
Coord length = compute_length(*r, a);
- growing = length > r->natural;
- shrinking = length < r->natural;
- f = compute_squeeze(*r, length);
- p = a.begin + a.align * (a.end - a.begin);
- i = 0;
+ my_growing = length > r->natural;
+ my_shrinking = length < r->natural;
+ my_f = compute_squeeze(*r, length);
+ my_p = a.begin + a.align * (a.end - a.begin);
+ my_i = 0;
}
Coord LayoutTileAllocate::compute_length(const Graphic::Requirement &r,
@@ -233,7 +250,8 @@
{
double f;
Coord nat = r.natural;
- if (length > nat && r.maximum > nat) f = (length - nat) / (r.maximum - nat);
+ if (length > nat && r.maximum > nat)
+ f = (length - nat) / (r.maximum - nat);
else if (length < nat && r.minimum < nat)
f = (nat - length) / (nat - r.minimum);
else f = 0.0;
@@ -246,298 +264,351 @@
if (r.defined)
{
Coord cspan = r.natural;
- if (growing) cspan += f * (r.maximum - r.natural);
- else if (shrinking) cspan -= f * (r.natural - r.minimum);
- if (first_aligned && (i == 0)) p -= r.align * cspan;
- set_span(s, p + cspan * r.align, cspan, r.align);
- p += cspan;
+ if (my_growing) cspan += my_f * (r.maximum - r.natural);
+ else if (my_shrinking) cspan -= my_f * (r.natural - r.minimum);
+ if (my_first_aligned && (my_i == 0))
+ my_p -= r.align * cspan;
+ set_span(s, my_p + cspan * r.align, cspan, r.align);
+ my_p += cspan;
}
- else set_span(s, p, Coord(0), Alignment(0));
- ++i;
+ else set_span(s, my_p, Coord(0), Alignment(0));
+ ++my_i;
}
} // namespace
} // namespace
GridImpl::GridImpl(const Layout::Grid::Index &upper)
{
- _dimensions[xaxis].init(upper.col, upper.row);
- _dimensions[yaxis].init(upper.row, upper.col);
- _cursor.col = _cursor.row = 0;
- _requested = false;
- GridImpl::init_requisition(_requisition);
+ my_dimensions[xaxis].init(upper.col, upper.row);
+ my_dimensions[yaxis].init(upper.row, upper.col);
+ my_cursor.col = my_cursor.row = 0;
+ my_requested = false;
+ GridImpl::init_requisition(my_requisition);
}
-GridImpl::~GridImpl() {}
+GridImpl::~GridImpl() { }
void GridImpl::append_graphic(Graphic_ptr g)
{
- replace(g, _cursor);
+ replace(g, my_cursor);
- if (++_cursor.col >= _dimensions[xaxis].size())
+ if (++my_cursor.col >= my_dimensions[xaxis].size())
{
- long count = _dimensions[yaxis].size();
- _cursor.row = (_cursor.row + 1) % count;
- _cursor.col = 0;
+ long count = my_dimensions[yaxis].size();
+ my_cursor.row = (my_cursor.row + 1) % count;
+ my_cursor.col = 0;
}
}
void GridImpl::prepend_graphic(Graphic_ptr g)
{
- if (--_cursor.col < 0)
- {
- long count = _dimensions[yaxis].size();
- _cursor.row = (_cursor.row - 1 + count) % count;
- _cursor.col = _dimensions[xaxis].size() - 1;
- }
- replace(g, _cursor);
+ if (--my_cursor.col < 0)
+ {
+ long count = my_dimensions[yaxis].size();
+ my_cursor.row = (my_cursor.row - 1 + count) % count;
+ my_cursor.col = my_dimensions[xaxis].size() - 1;
+ }
+ replace(g, my_cursor);
}
void GridImpl::request(Fresco::Graphic::Requisition &r)
{
- cache_request();
- r = _requisition;
+ cache_request();
+ r = my_requisition;
}
void GridImpl::traverse(Traversal_ptr traversal)
{
- Layout::Grid::Range range;
- range.lower.col = 0;
- range.upper.col = _dimensions[xaxis].size();
- range.lower.row = 0;
- range.upper.row = _dimensions[yaxis].size();
+ Layout::Grid::Range range;
+ range.lower.col = 0;
+ range.upper.col = my_dimensions[xaxis].size();
+ range.lower.row = 0;
+ range.upper.row = my_dimensions[yaxis].size();
- traverse_range(traversal, range);
+ traverse_range(traversal, range);
}
void GridImpl::need_resize()
{
- _requested = false;
- GraphicImpl::need_resize();
+ my_requested = false;
+ GraphicImpl::need_resize();
}
void GridImpl::replace(Graphic_ptr g, const Layout::Grid::Index &i)
{
- // use at(n) for ranged checked access throws out_of_range
- Graphic_ptr old = _dimensions[xaxis].children.at(i.col).at(i.row);
- if (!CORBA::is_nil(old))
- try { old->remove_parent_graphic(index_to_tag(i));}
- catch (const CORBA::OBJECT_NOT_EXIST &) {}
- catch (const CORBA::COMM_FAILURE &) {}
- catch (const CORBA::TRANSIENT &) {}
- _dimensions[xaxis].children[i.col][i.row] = Fresco::Graphic::_duplicate(g);
- _dimensions[yaxis].children[i.row][i.col] = Fresco::Graphic::_duplicate(g);
- g->add_parent_graphic(Graphic_var(_this()), index_to_tag(i));
+ // use at(n) for ranged checked access throws out_of_range
+ Graphic_ptr old = my_dimensions[xaxis].children.at(i.col).at(i.row);
+ if (!CORBA::is_nil(old))
+ try
+ { old->remove_parent_graphic(index_to_tag(i)); }
+ catch (const CORBA::OBJECT_NOT_EXIST &) { }
+ catch (const CORBA::COMM_FAILURE &) { }
+ catch (const CORBA::TRANSIENT &) { }
+ my_dimensions[xaxis].children[i.col][i.row] =
+ Fresco::Graphic::_duplicate(g);
+ my_dimensions[yaxis].children[i.row][i.col] =
+ Fresco::Graphic::_duplicate(g);
+ g->add_parent_graphic(Graphic_var(_this()), index_to_tag(i));
}
Layout::Grid::Index GridImpl::find(Traversal_ptr traversal)
{
- Layout::Grid::Range range;
- range.lower.col = 0;
- range.upper.col = _dimensions[xaxis].size();
- range.lower.row = 0;
- range.upper.row = _dimensions[yaxis].size();
-
- return find_range(traversal, range);
+ Layout::Grid::Range range;
+ range.lower.col = 0;
+ range.upper.col = my_dimensions[xaxis].size();
+ range.lower.row = 0;
+ range.upper.row = my_dimensions[yaxis].size();
+
+ return find_range(traversal, range);
}
-void GridImpl::allocate_cell(Region_ptr given, const Layout::Grid::Index &i, Region_ptr a)
+void GridImpl::allocate_cell(Region_ptr given,
+ const Layout::Grid::Index &i, Region_ptr a)
{
- Span *xspans = full_allocate(xaxis, given);
- Span *yspans = full_allocate(yaxis, given);
+ Span *xspans = full_allocate(xaxis, given);
+ Span *yspans = full_allocate(yaxis, given);
- Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
- spans_to_region(xspans[i.col], yspans[i.row], region);
- a->copy(Region_var(region->_this()));
- delete [] xspans;
- delete [] yspans;
+ Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
+ spans_to_region(xspans[i.col], yspans[i.row], region);
+ a->copy(Region_var(region->_this()));
+ delete [] xspans;
+ delete [] yspans;
}
-void GridImpl::request_range(Fresco::Graphic::Requisition &r, const Layout::Grid::Range &a)
+void GridImpl::request_range(Fresco::Graphic::Requisition &r,
+ const Layout::Grid::Range &a)
{
- cache_request();
-
- partial_request(xaxis, a.lower.col, a.upper.col, r.x);
- partial_request(yaxis, a.lower.row, a.upper.row, r.y);
+ cache_request();
+
+ partial_request(xaxis, a.lower.col, a.upper.col, r.x);
+ partial_request(yaxis, a.lower.row, a.upper.row, r.y);
}
-void GridImpl::traverse_range(Traversal_ptr traversal, const Layout::Grid::Range &a)
+void GridImpl::traverse_range(Traversal_ptr traversal,
+ const Layout::Grid::Range &a)
{
- Region_var given = traversal->current_allocation();
- if (!CORBA::is_nil(given))
+ Region_var given = traversal->current_allocation();
+ if (!CORBA::is_nil(given))
{
- if (traversal->intersects_allocation())
- traverse_with_allocation(traversal, given, a);
+ if (traversal->intersects_allocation())
+ traverse_with_allocation(traversal, given, a);
}
- else
- traverse_without_allocation(traversal, a);
+ else
+ traverse_without_allocation(traversal, a);
}
-Layout::Grid::Index GridImpl::find_range(Traversal_ptr traversal, const Layout::Grid::Range &a)
+Layout::Grid::Index GridImpl::find_range(Traversal_ptr traversal,
+ const Layout::Grid::Range &a)
{
- Region_var given = traversal->current_allocation();
- Span *xspans = full_allocate(xaxis, given);
- Span *yspans = full_allocate(yaxis, given);
- Vertex lower;//, upper;
-// e->bounds(lower, upper);
- Coord x = lower.x;
- Coord y = lower.y;
- // If the point is outside the range find the outermost cell.
- long c, r;
- for (c = a.lower.col; c < (a.upper.col - 1); c++)
- if (x <= xspans[c].upper) break;
- for (r = a.lower.row; r < (a.upper.row - 1); r++)
- if (y <= yspans[r].upper) break;
- Layout::Grid::Index index;
- index.col = c;
- index.row = r;
- delete [] xspans;
- delete [] yspans;
- return index;
+ Region_var given = traversal->current_allocation();
+ Span *xspans = full_allocate(xaxis, given);
+ Span *yspans = full_allocate(yaxis, given);
+ Vertex lower;//, upper;
+// e->bounds(lower, upper);
+ Coord x = lower.x;
+ Coord y = lower.y;
+ // If the point is outside the range find the outermost cell.
+ long c, r;
+ for (c = a.lower.col; c < (a.upper.col - 1); c++)
+ if (x <= xspans[c].upper) break;
+ for (r = a.lower.row; r < (a.upper.row - 1); r++)
+ if (y <= yspans[r].upper) break;
+ Layout::Grid::Index index;
+ index.col = c;
+ index.row = r;
+ delete [] xspans;
+ delete [] yspans;
+ return index;
}
-void GridImpl::range_position(Region_ptr given, const Layout::Grid::Range &a, Vertex &pos)
+void GridImpl::range_position(Region_ptr given,
+ const Layout::Grid::Range &a, Vertex &pos)
{
- Span *xspans = full_allocate(xaxis, given);
- Span *yspans = full_allocate(yaxis, given);
- pos.x = xspans[0].lower - xspans[a.lower.col].lower;
- pos.y = yspans[0].lower - yspans[a.lower.row].lower;
- pos.z = 0.;
- delete [] xspans;
- delete [] yspans;
+ Span *xspans = full_allocate(xaxis, given);
+ Span *yspans = full_allocate(yaxis, given);
+ pos.x = xspans[0].lower - xspans[a.lower.col].lower;
+ pos.y = yspans[0].lower - yspans[a.lower.row].lower;
+ pos.z = 0.;
+ delete [] xspans;
+ delete [] yspans;
}
Layout::Grid::Index GridImpl::upper()
{
- Layout::Grid::Index upper;
- upper.col = _dimensions[xaxis].size();
- upper.row = _dimensions[yaxis].size();
- return upper;
+ Layout::Grid::Index upper;
+ upper.col = my_dimensions[xaxis].size();
+ upper.row = my_dimensions[yaxis].size();
+ return upper;
}
-std::ostream &operator << (std::ostream &os, const Layout::Grid::Index &i) { return os << i.col << ' ' << i.row;}
+namespace std
+{
+ std::ostream &operator << (std::ostream &os,
+ const Layout::Grid::Index &i)
+ { return os << i.col << ' ' << i.row; }
+} // namespace
void GridImpl::allocate(Tag tag, const Allocation::Info &info)
{
- Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
- tx->load_identity();
- allocate_cell(info.allocation, tag_to_index(tag), info.allocation);
- Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
- region->copy(info.allocation);
- region->normalize(Transform_var(tx->_this()));
- info.allocation->copy(Region_var(region->_this()));
- info.transformation->premultiply(Transform_var(tx->_this()));
+ Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
+ tx->load_identity();
+ allocate_cell(info.allocation, tag_to_index(tag), info.allocation);
+ Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
+ region->copy(info.allocation);
+ region->normalize(Transform_var(tx->_this()));
+ info.allocation->copy(Region_var(region->_this()));
+ info.transformation->premultiply(Transform_var(tx->_this()));
}
void GridImpl::cache_request()
{
- if (!_requested)
+ if (!my_requested)
{
- full_request(xaxis, yaxis);
- full_request(yaxis, xaxis);
- _requested = true;
+ full_request(xaxis, yaxis);
+ full_request(yaxis, xaxis);
+ my_requested = true;
}
}
-void GridImpl::partial_request(Axis axis, long begin, long end, Fresco::Graphic::Requirement &r)
+void GridImpl::partial_request(Axis axis, long begin, long end,
+ Fresco::Graphic::Requirement &r)
{
- Dimension &d = _dimensions[axis];
- LayoutTileRequest tile;
- for (long i = begin; i < end; i++)
- tile.accumulate(d.requirements[i]);
- tile.requirement(r);
+ Dimension &d = my_dimensions[axis];
+ LayoutTileRequest tile;
+ for (long i = begin; i < end; i++)
+ tile.accumulate(d.requirements[i]);
+ tile.requirement(r);
}
void GridImpl::full_request(Axis axis, Axis direction)
{
- Dimension &d = _dimensions[axis];
- LayoutTileRequest tile;
- for (int i = 0; i < d.size(); i++)
+ Dimension &d = my_dimensions[axis];
+ LayoutTileRequest tile;
+ for (int i = 0; i < d.size(); i++)
{
- LayoutAlignRequest align;
- for (std::vector<Graphic_var>::iterator j = d.children[i].begin(); j != d.children[i].end(); ++j)
- if (!CORBA::is_nil(*j))
- {
- Fresco::Graphic::Requisition r;
- GraphicImpl::init_requisition(r);
- GraphicImpl::default_requisition(r);
- (*j)->request(r);
- align.accumulate(axis == xaxis ? r.x : r.y);
- }
- Fresco::Graphic::Requirement &r = d.requirements[i];
- align.requirement(r);
- tile.accumulate(r);
+ LayoutAlignRequest align;
+ for (std::vector<Graphic_var>::iterator j = d.children[i].begin();
+ j != d.children[i].end();
+ ++j)
+ if (!CORBA::is_nil(*j))
+ {
+ Fresco::Graphic::Requisition r;
+ GraphicImpl::init_requisition(r);
+ GraphicImpl::default_requisition(r);
+ (*j)->request(r);
+ align.accumulate(axis == xaxis ? r.x : r.y);
+ }
+ Fresco::Graphic::Requirement &r = d.requirements[i];
+ align.requirement(r);
+ tile.accumulate(r);
}
- Fresco::Graphic::Requirement &r = *GraphicImpl::requirement(_requisition, axis);
- tile.requirement(r);
+ Fresco::Graphic::Requirement &r =
+ *GraphicImpl::requirement(my_requisition, axis);
+ tile.requirement(r);
}
GridImpl::Span *GridImpl::full_allocate(Axis axis, Region_ptr given)
{
- Dimension &d = _dimensions[axis];
- Span *spans = new Span[d.size()];
- LayoutTileAllocate allocate(axis, _requisition, false, given);
- for (int i = 0; i < d.size(); i++)
- allocate.next_span(d.requirements[i], spans[i]);
- return spans;
+ Dimension &d = my_dimensions[axis];
+ Span *spans = new Span[d.size()];
+ LayoutTileAllocate allocate(axis, my_requisition, false, given);
+ for (int i = 0; i < d.size(); ++i)
+ allocate.next_span(d.requirements[i], spans[i]);
+ return spans;
}
-void GridImpl::traverse_with_allocation(Traversal_ptr t, Region_ptr given, const Layout::Grid::Range &range)
+void GridImpl::traverse_with_allocation(Traversal_ptr t,
+ Region_ptr given,
+ const Layout::Grid::Range &range)
{
- Span *xspans = full_allocate(xaxis, given);
- Span *yspans = full_allocate(yaxis, given);
- Coord dx = xspans[0].lower - xspans[range.lower.col].lower;
- Coord dy = yspans[0].lower - yspans[range.lower.row].lower;
- Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
- tx->load_identity();
- Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
- Dimension &d = _dimensions[yaxis];
- Layout::Grid::Index i;
- for (i.row = range.lower.row; i.row != range.upper.row && t->ok(); i.row++)
- for (i.col = range.lower.col; i.col != range.upper.col && t->ok(); i.col++)
- {
- Graphic_var child = d.children [i.row][i.col];
- if (CORBA::is_nil(child)) continue;
+ Span *xspans = full_allocate(xaxis, given);
+ Span *yspans = full_allocate(yaxis, given);
+ Coord dx = xspans[0].lower - xspans[range.lower.col].lower;
+ Coord dy = yspans[0].lower - yspans[range.lower.row].lower;
+ Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
tx->load_identity();
- spans_to_region(xspans[i.col], yspans[i.row], region);
- offset_region(region, dx, dy);
- region->normalize(Transform_var(tx->_this()));
- try { t->traverse_child (child, index_to_tag(i), Region_var(region->_this()), Transform_var(tx->_this()));}
- catch (const CORBA::OBJECT_NOT_EXIST &) { d.children [i.row][i.col] = Fresco::Graphic::_nil();}
- catch (const CORBA::COMM_FAILURE &) { d.children [i.row][i.col] = Fresco::Graphic::_nil();}
- catch (const CORBA::TRANSIENT &) { d.children [i.row][i.col] = Fresco::Graphic::_nil();}
- }
- delete [] xspans;
- delete [] yspans;
+ Lease_var<RegionImpl> region(Provider<RegionImpl>::provide());
+ Dimension &d = my_dimensions[yaxis];
+ Layout::Grid::Index i;
+ for (i.row = range.lower.row;
+ i.row != range.upper.row && t->ok();
+ ++i.row)
+ for (i.col = range.lower.col;
+ i.col != range.upper.col && t->ok();
+ ++i.col)
+ {
+ Graphic_var child = d.children [i.row][i.col];
+ if (CORBA::is_nil(child)) continue;
+ tx->load_identity();
+ spans_to_region(xspans[i.col], yspans[i.row], region);
+ offset_region(region, dx, dy);
+ region->normalize(Transform_var(tx->_this()));
+ try
+ {
+ t->traverse_child (child, index_to_tag(i),
+ Region_var(region->_this()),
+ Transform_var(tx->_this()));
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { d.children [i.row][i.col] = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { d.children [i.row][i.col] = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { d.children [i.row][i.col] = Fresco::Graphic::_nil(); }
+ }
+ delete [] xspans;
+ delete [] yspans;
}
-void GridImpl::traverse_without_allocation(Traversal_ptr t, const Layout::Grid::Range &range)
+void
+GridImpl::traverse_without_allocation(Traversal_ptr t,
+ const Layout::Grid::Range &range)
{
- Dimension &d = _dimensions[yaxis];
- Layout::Grid::Index i;
- for (i.row = range.lower.row; i.row != range.upper.row && t->ok(); i.row++)
- for (i.col = range.lower.col; i.col != range.upper.col && t->ok(); i.col++)
- {
- Graphic_var child = d.children [i.row][i.col];
- if (CORBA::is_nil (child)) continue;
- try { t->traverse_child (child, index_to_tag(i), Region::_nil(), Transform::_nil());}
- catch (const CORBA::OBJECT_NOT_EXIST &) { d.children [i.row][i.col] = Fresco::Graphic::_nil();}
- catch (const CORBA::COMM_FAILURE &) { d.children [i.row][i.col] = Fresco::Graphic::_nil();}
- catch (const CORBA::TRANSIENT &) { d.children [i.row][i.col] = Fresco::Graphic::_nil();}
- }
+ Dimension &d = my_dimensions[yaxis];
+ Layout::Grid::Index i;
+ for (i.row = range.lower.row;
+ i.row != range.upper.row && t->ok();
+ ++i.row)
+ for (i.col = range.lower.col;
+ i.col != range.upper.col && t->ok();
+ ++i.col)
+ {
+ Graphic_var child = d.children [i.row][i.col];
+ if (CORBA::is_nil(child)) continue;
+ try
+ {
+ t->traverse_child (child, index_to_tag(i), Region::_nil(),
+ Transform::_nil());
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { d.children [i.row][i.col] = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { d.children [i.row][i.col] = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { d.children [i.row][i.col] = Fresco::Graphic::_nil(); }
+ }
}
-SubGridImpl::SubGridImpl(Grid_ptr grid, const Layout::Grid::Range &r)
- : _child(Layout::Grid::_duplicate(grid)), _range(r) {}
+SubGridImpl::SubGridImpl(Grid_ptr grid, const Layout::Grid::Range &r) :
+ my_child(Layout::Grid::_duplicate(grid)), my_range(r)
+{ }
-SubGridImpl::~SubGridImpl() {}
-void SubGridImpl::request(Fresco::Graphic::Requisition &r) { _child->request_range(r, _range);}
+SubGridImpl::~SubGridImpl() { }
+void SubGridImpl::request(Fresco::Graphic::Requisition &r)
+{ my_child->request_range(r, my_range); }
void SubGridImpl::traverse(Traversal_ptr t)
{
- if (CORBA::is_nil(_child)) return;
- try { t->traverse_child (_child, 0, Region::_nil(), Transform::_nil());}
- catch (const CORBA::OBJECT_NOT_EXIST &) { _child = Layout::Grid::_nil();}
- catch (const CORBA::COMM_FAILURE &) { _child = Layout::Grid::_nil();}
- catch (const CORBA::TRANSIENT &) { _child = Layout::Grid::_nil();}
+ if (CORBA::is_nil(my_child)) return;
+ try
+ {
+ t->traverse_child(my_child, 0, Region::_nil(), Transform::_nil());
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { my_child = Layout::Grid::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { my_child = Layout::Grid::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { my_child = Layout::Grid::_nil(); }
}
Index: GridImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/GridImpl.hh,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- GridImpl.hh 5 Jan 2003 16:21:33 -0000 1.15
+++ GridImpl.hh 29 Dec 2003 08:03:28 -0000 1.16
@@ -19,97 +19,115 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _GridImpl_hh
-#define _GridImpl_hh
+#ifndef _Layout_GridImpl_hh
+#define _Layout_GridImpl_hh
#include <Fresco/config.hh>
#include <Fresco/Grid.hh>
#include <Berlin/GraphicImpl.hh>
#include <vector>
-namespace Berlin {
-namespace LayoutKit {
-
-class GridImpl : public virtual POA_Layout::Grid,
- public GraphicImpl
+namespace Berlin
{
- struct Dimension
- {
- void init(long count, long n)
- {
- children.resize(count);
- for (std::vector<std::vector<Fresco::Graphic_var> >::iterator i = children.begin(); i != children.end(); ++i)
- (*i).resize(n);
- requirements.resize(count);
- }
- CORBA::Long size() { return children.size();}
- std::vector<std::vector<Fresco::Graphic_var> > children;
- std::vector<Fresco::Graphic::Requirement> requirements;
- };
-public:
- struct Span
+ namespace LayoutKit
{
- Fresco::Coord lower;
- Fresco::Coord upper;
- Fresco::Alignment align;
- };
- GridImpl(const Layout::Grid::Index &upper);
- ~GridImpl();
-
- virtual void append_graphic(Fresco::Graphic_ptr);
- virtual void prepend_graphic(Fresco::Graphic_ptr);
-
- virtual void request(Fresco::Graphic::Requisition &);
- virtual void traverse(Fresco::Traversal_ptr);
- virtual void need_resize();
- virtual void allocate(Fresco::Tag, const Fresco::Allocation::Info &);
-
- virtual void replace(Fresco::Graphic_ptr, const Layout::Grid::Index &);
- virtual Layout::Grid::Index find(Fresco::Traversal_ptr);
- virtual void allocate_cell(Fresco::Region_ptr, const Layout::Grid::Index &, Fresco::Region_ptr);
- virtual void request_range(Fresco::Graphic::Requisition &, const Layout::Grid::Range &);
- virtual void traverse_range(Fresco::Traversal_ptr, const Layout::Grid::Range &);
- virtual Layout::Grid::Index find_range(Fresco::Traversal_ptr, const Layout::Grid::Range &);
- virtual void range_position(Fresco::Region_ptr, const Layout::Grid::Range &, Fresco::Vertex &);
- virtual Layout::Grid::Index upper();
- private:
- Fresco::Tag index_to_tag(const Layout::Grid::Index &index) { return (index.col << 16) + index.row;}
- Layout::Grid::Index tag_to_index(Fresco::Tag tag)
+ class GridImpl : public virtual POA_Layout::Grid,
+ public GraphicImpl
{
- Layout::Grid::Index index;
- index.col = tag >> 16;
- index.row = tag & 0xffff;
- return index;
- }
- void cache_request();
- void partial_request(Fresco::Axis axis, long lower, long, Fresco::Graphic::Requirement &);
- void full_request(Fresco::Axis, Fresco::Axis);
- Span *full_allocate(Fresco::Axis, Fresco::Region_ptr);
- void traverse_with_allocation(Fresco::Traversal_ptr, Fresco::Region_ptr, const Layout::Grid::Range &);
- void traverse_without_allocation(Fresco::Traversal_ptr, const Layout::Grid::Range &);
-
- Dimension _dimensions[2];
- Layout::Grid::Index _cursor;
+ struct Dimension
+ {
+ void init(long count, long n)
+ {
+ children.resize(count);
+ for (std::vector<std::vector<Fresco::Graphic_var> >::iterator i = children.begin();
+ i != children.end();
+ ++i)
+ (*i).resize(n);
+ requirements.resize(count);
+ }
+ CORBA::Long size() { return children.size(); }
+ std::vector<std::vector<Fresco::Graphic_var> > children;
+ std::vector<Fresco::Graphic::Requirement> requirements;
+ };
+ public:
+ struct Span
+ {
+ Fresco::Coord lower;
+ Fresco::Coord upper;
+ Fresco::Alignment align;
+ };
+ GridImpl(const Layout::Grid::Index &upper);
+ ~GridImpl();
+
+ virtual void append_graphic(Fresco::Graphic_ptr);
+ virtual void prepend_graphic(Fresco::Graphic_ptr);
- bool _requested;
- Fresco::Graphic::Requisition _requisition;
-};
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void traverse(Fresco::Traversal_ptr);
+ virtual void need_resize();
+ virtual void allocate(Fresco::Tag,
+ const Fresco::Allocation::Info &);
+
+ virtual void replace(Fresco::Graphic_ptr,
+ const Layout::Grid::Index &);
+ virtual Layout::Grid::Index find(Fresco::Traversal_ptr);
+ virtual void allocate_cell(Fresco::Region_ptr,
+ const Layout::Grid::Index &,
+ Fresco::Region_ptr);
+ virtual void request_range(Fresco::Graphic::Requisition &,
+ const Layout::Grid::Range &);
+ virtual void traverse_range(Fresco::Traversal_ptr,
+ const Layout::Grid::Range &);
+ virtual Layout::Grid::Index
+ find_range(Fresco::Traversal_ptr, const Layout::Grid::Range &);
+ virtual void range_position(Fresco::Region_ptr,
+ const Layout::Grid::Range &,
+ Fresco::Vertex &);
+ virtual Layout::Grid::Index upper();
-class SubGridImpl : public GraphicImpl
-{
-public:
- SubGridImpl(Layout::Grid_ptr, const Layout::Grid::Range &);
- ~SubGridImpl();
+ private:
+ Fresco::Tag index_to_tag(const Layout::Grid::Index &index)
+ { return (index.col << 16) + index.row; }
+ Layout::Grid::Index tag_to_index(Fresco::Tag tag)
+ {
+ Layout::Grid::Index index;
+ index.col = tag >> 16;
+ index.row = tag & 0xffff;
+ return index;
+ }
+ void cache_request();
+ void partial_request(Fresco::Axis, long, long,
+ Fresco::Graphic::Requirement &);
+ void full_request(Fresco::Axis, Fresco::Axis);
+ Span *full_allocate(Fresco::Axis, Fresco::Region_ptr);
+ void traverse_with_allocation(Fresco::Traversal_ptr,
+ Fresco::Region_ptr,
+ const Layout::Grid::Range &);
+ void traverse_without_allocation(Fresco::Traversal_ptr,
+ const Layout::Grid::Range &);
- virtual void request(Fresco::Graphic::Requisition &);
- virtual void traverse(Fresco::Traversal_ptr);
-private:
- Layout::Grid_var _child;
- Layout::Grid::Range _range;
-};
+ Dimension my_dimensions[2];
+ Layout::Grid::Index my_cursor;
+
+ bool my_requested;
+ Fresco::Graphic::Requisition my_requisition;
+ };
+
+ class SubGridImpl : public GraphicImpl
+ {
+ public:
+ SubGridImpl(Layout::Grid_ptr, const Layout::Grid::Range &);
+ ~SubGridImpl();
-} // namespace
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void traverse(Fresco::Traversal_ptr);
+ private:
+ Layout::Grid_var my_child;
+ Layout::Grid::Range my_range;
+ };
+
+ } // namespace
} // namespace
#endif
Index: LayoutKitImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/LayoutKitImpl.cc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- LayoutKitImpl.cc 26 Feb 2003 00:19:06 -0000 1.32
+++ LayoutKitImpl.cc 29 Dec 2003 08:03:28 -0000 1.33
@@ -43,10 +43,12 @@
LayoutKitImpl::LayoutKitImpl(const std::string &id,
const Fresco::Kit::PropertySeq &p,
- ServerContextImpl *c)
- : KitImpl(id, p, c), my_fill(GraphicImpl::infinity) { }
+ ServerContextImpl *c) :
+ KitImpl(id, p, c),
+ my_fill(GraphicImpl::infinity)
+{ }
-LayoutKitImpl::~LayoutKitImpl() {}
+LayoutKitImpl::~LayoutKitImpl() { }
void LayoutKitImpl::fill(Coord c) { my_fill = c; }
@@ -54,42 +56,49 @@
Graphic_ptr LayoutKitImpl::clipper(Graphic_ptr g)
{
+ // FIXME: NIY
return Graphic::_nil();
// return create<Clipper, Graphic_ptr> (new Clipper(g));
}
-// Graphic_ptr LayoutKitImpl::create_backdrop() { return new Backdrop;}
-// AutoScroll_ptr LayoutKitImpl::create_auto_scroll(Adjustment_ptr x_adjustment, Adjustment_ptr y_adjustment)
+// Graphic_ptr LayoutKitImpl::create_backdrop() { return new Backdrop; }
+// AutoScroll_ptr
+// LayoutKitImpl::create_auto_scroll(Adjustment_ptr x_adjustment,
+// Adjustment_ptr y_adjustment)
// {
-// return new AutoScrollImpl(x_adjustment, y_adjustment);
+// return new AutoScrollImpl(x_adjustment, y_adjustment);
// }
-// FullyVisibleConstraint_ptr LayoutKitImpl::create_fully_visible_constraint(Float usable, Float align)
+//
+// FullyVisibleConstraint_ptr
+// LayoutKitImpl::create_fully_visible_constraint(Float usable,
+// Float align)
// {
-// return new FullyVisibleConstraintImpl(usable, align);
+// return new FullyVisibleConstraintImpl(usable, align);
// }
+//
// Scrollable* LayoutKitImpl::scroll_box(Axis a)
// {
-// ScrollBox* b = nil;
-// switch (a)
+// ScrollBox* b = nil;
+// switch (a)
// {
// case X_axis:
-// // unimplemented
-// break;
+// // unimplemented
+// break;
// case Y_axis:
-// b = new TBScrollBox();
-// break;
+// b = new TBScrollBox();
+// break;
// case Z_axis:
-// // should raise an exception
-// break;
+// // should raise an exception
+// break;
// }
-// Scrollable* s = new Scrollable();
-// if (is_not_nil(b))
+// Scrollable* s = new Scrollable();
+// if (is_not_nil(b))
// {
-// s->glyph_ptr = b;
-// s->adjustment_ptr = b->scroll_adjustment(Y_axis);
+// s->glyph_ptr = b;
+// s->adjustment_ptr = b->scroll_adjustment(Y_axis);
// }
-// else fresco_fail("Layout kit can't create scroll box for given axis");
-// return s;
+// else fresco_fail("Layout kit can't create scroll box for given axis");
+// return s;
// }
Viewport_ptr LayoutKitImpl::scrollable(Graphic_ptr g)
@@ -98,12 +107,13 @@
"LayoutKit/scrollable");
}
-// Layout::Splitter_ptr LayoutKitImpl::splitter(Graphic_ptr g, Graphic_ptr p, Axis a)
+// Layout::Splitter_ptr LayoutKitImpl::splitter(Graphic_ptr g,
+// Graphic_ptr p, Axis a)
// {
-// SplitterImpl *sp = new SplitterImpl(a);
-// activate(sp);
-// sp->init(g, p);
-// return sp->_this();
+// SplitterImpl *sp = new SplitterImpl(a);
+// activate(sp);
+// sp->init(g, p);
+// return sp->_this();
// }
Stage_ptr LayoutKitImpl::create_stage()
@@ -287,22 +297,29 @@
"LayoutKit/shape_of_xyz");
}
-// Graphic_ptr LayoutKitImpl::strut(Font_ptr f, Coord natural, Coord stretch, Coord shrink)
+// Graphic_ptr LayoutKitImpl::strut(Font_ptr f, Coord natural,
+// Coord stretch, Coord shrink)
// {
-// return new Strut(f, natural, stretch, shrink);
+// return new Strut(f, natural, stretch, shrink);
// }
-// Graphic_ptr LayoutKitImpl::hstrut(Coord right_bearing, Coord left_bearing, Coord natural, Coord stretch, Coord shrink)
+// Graphic_ptr LayoutKitImpl::hstrut(Coord right_bearing,
+// Coord left_bearing,
+// Coord natural, Coord stretch,
+// Coord shrink)
// {
// return new HStrut(right_bearing, left_bearing, natural, stretch, shrink);
// }
-// Graphic_ptr LayoutKitImpl::vstrut(Coord ascent, Coord descent, Coord natural, Coord stretch, Coord shrink)
+// Graphic_ptr LayoutKitImpl::vstrut(Coord ascent, Coord descent,
+// Coord natural, Coord stretch,
+// Coord shrink)
// {
// return new VStrut(ascent, descent, natural, stretch, shrink);
// }
-// Graphic_ptr LayoutKitImpl::spaces(Long count, Coord each, Font_ptr f, Color_ptr c)
+// Graphic_ptr LayoutKitImpl::spaces(Long count, Coord each, Font_ptr f,
+// Color_ptr c)
// {
// return new Space(count, each, f, c);
// }
@@ -316,7 +333,8 @@
g, "LayoutKit/align");
}
-Graphic_ptr LayoutKitImpl::align_axis(Graphic_ptr g, Axis a, Alignment align)
+Graphic_ptr LayoutKitImpl::align_axis(Graphic_ptr g, Axis a,
+ Alignment align)
{
return create_and_set_body<Graphic>(new Placement(
new LayoutCenter(a, align)), g,
@@ -581,8 +599,8 @@
-extern "C" KitImpl *load()
+extern "C" Berlin::KitImpl *load()
{
static std::string properties[] = {"implementation", "LayoutKitImpl"};
- return create_prototype<LayoutKitImpl> ("IDL:fresco.org/Fresco/LayoutKit:1.0", properties, 2);
+ return Berlin::create_prototype<LayoutKitImpl> ("IDL:fresco.org/Fresco/LayoutKit:1.0", properties, 2);
}
Index: LayoutKitImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/LayoutKitImpl.hh,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- LayoutKitImpl.hh 18 Feb 2003 07:26:32 -0000 1.23
+++ LayoutKitImpl.hh 29 Dec 2003 08:03:28 -0000 1.24
@@ -27,107 +27,195 @@
#include <Berlin/KitImpl.hh>
#include <vector>
-class GraphicImpl;
-
namespace Berlin
{
-namespace LayoutKit
-{
-class LayoutKitImpl : public virtual POA_Fresco::LayoutKit,
- public KitImpl
-{
-public:
- LayoutKitImpl(const std::string &,
- const Fresco::Kit::PropertySeq &,
- ServerContextImpl *);
- ~LayoutKitImpl();
- virtual KitImpl *clone(const Fresco::Kit::PropertySeq &p, ServerContextImpl *c)
- { return new LayoutKitImpl(repo_id(), p, c);}
+ class GraphicImpl;
- virtual Fresco::Coord fill();
- virtual void fill(Fresco::Coord);
- virtual Fresco::Graphic_ptr clipper(Fresco::Graphic_ptr);
-// virtual Graphic_ptr create_backdrop();
-// virtual AutoScroll_ptr create_auto_scroll(Adjustment_ptr x_adjustment, Adjustment_ptr y_adjustment);
-// virtual FullyVisibleConstraint_ptr create_fully_visible_constraint(Float usable, Float align);
-// virtual Scrollable* scroll_box(Axis a);
- virtual Layout::Viewport_ptr scrollable(Fresco::Graphic_ptr);
-// virtual Layout::Splitter_ptr splitter(Fresco::Graphic_ptr, Fresco::Graphic_ptr, Fresco::Axis);
- virtual Layout::Stage_ptr create_stage();
- virtual Layout::Grid_ptr fixed_grid(const Layout::Grid::Index &);
- virtual Fresco::Graphic_ptr fixed_range(Layout::Grid_ptr g, const Layout::Grid::Range &);
- virtual Fresco::Graphic_ptr hbox();
- virtual Fresco::Graphic_ptr vbox();
- virtual Fresco::Graphic_ptr hbox_first_aligned();
- virtual Fresco::Graphic_ptr vbox_first_aligned();
- virtual Fresco::Graphic_ptr hbox_align_elements(Fresco::Alignment);
- virtual Fresco::Graphic_ptr vbox_align_elements(Fresco::Alignment);
- virtual Fresco::Graphic_ptr overlay();
- virtual Fresco::Graphic_ptr deck();
- virtual Fresco::Graphic_ptr back(Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual Fresco::Graphic_ptr front(Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual Fresco::Graphic_ptr between(Fresco::Graphic_ptr, Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual Fresco::Graphic_ptr glue(Fresco::Axis, Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Alignment);
- virtual Fresco::Graphic_ptr glue_requisition(const Fresco::Graphic::Requisition &);
- virtual Fresco::Graphic_ptr hfill();
- virtual Fresco::Graphic_ptr hglue_fill(Fresco::Coord);
- virtual Fresco::Graphic_ptr hglue(Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr hglue_aligned(Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Alignment);
- virtual Fresco::Graphic_ptr hspace(Fresco::Coord);
- virtual Fresco::Graphic_ptr vfill();
- virtual Fresco::Graphic_ptr vglue_fill(Fresco::Coord);
- virtual Fresco::Graphic_ptr vglue(Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr vglue_aligned(Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Alignment);
- virtual Fresco::Graphic_ptr vspace(Fresco::Coord);
- virtual Fresco::Graphic_ptr shape_of(Fresco::Graphic_ptr g);
- virtual Fresco::Graphic_ptr shape_of_xy(Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual Fresco::Graphic_ptr shape_of_xyz(Fresco::Graphic_ptr, Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual Fresco::Graphic_ptr align(Fresco::Graphic_ptr, Fresco::Alignment, Fresco::Alignment);
- virtual Fresco::Graphic_ptr align_axis(Fresco::Graphic_ptr, Fresco::Axis, Fresco::Alignment);
- virtual Fresco::Graphic_ptr halign(Fresco::Graphic_ptr, Fresco::Alignment);
- virtual Fresco::Graphic_ptr valign(Fresco::Graphic_ptr, Fresco::Alignment);
- virtual Fresco::Graphic_ptr fixed_size(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr fixed_axis(Fresco::Graphic_ptr, Fresco::Axis, Fresco::Coord);
- virtual Fresco::Graphic_ptr hfixed(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr vfixed(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr flexible_fill(Fresco::Graphic_ptr);
- virtual Fresco::Graphic_ptr flexible_axis(Fresco::Graphic_ptr, Fresco::Axis, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr hflexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr vflexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr natural(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr natural_axis(Fresco::Graphic_ptr, Fresco::Axis, Fresco::Coord);
- virtual Fresco::Graphic_ptr hnatural(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr vnatural(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr margin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr margin_lrbt(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr margin_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr margin_lrbt_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr hmargin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr hmargin_lr(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr hmargin_lr_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr vmargin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr vmargin_bt(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr vmargin_bt_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr lmargin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr lmargin_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr rmargin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr rmargin_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr bmargin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr bmargin_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual Fresco::Graphic_ptr tmargin(Fresco::Graphic_ptr, Fresco::Coord);
- virtual Fresco::Graphic_ptr tmargin_flexible(Fresco::Graphic_ptr, Fresco::Coord, Fresco::Coord, Fresco::Coord);
-private:
- Fresco::Coord my_fill;
-};
+ namespace LayoutKit
+ {
-} // namespace
+ class LayoutKitImpl : public virtual POA_Fresco::LayoutKit,
+ public KitImpl
+ {
+ public:
+ LayoutKitImpl(const std::string &,
+ const Fresco::Kit::PropertySeq &,
+ ServerContextImpl *);
+ ~LayoutKitImpl();
+ virtual Berlin::KitImpl * clone(const Fresco::Kit::PropertySeq &p,
+ ServerContextImpl *c)
+ { return new LayoutKitImpl(repo_id(), p, c); }
+
+ virtual Fresco::Coord fill();
+ virtual void fill(Fresco::Coord);
+ virtual Fresco::Graphic_ptr clipper(Fresco::Graphic_ptr);
+// virtual Graphic_ptr create_backdrop();
+// virtual AutoScroll_ptr
+// create_auto_scroll(Adjustment_ptr x_adjustment,
+// Adjustment_ptr y_adjustment);
+// virtual FullyVisibleConstraint_ptr
+// create_fully_visible_constraint(Float usable, Float align);
+// virtual Scrollable* scroll_box(Axis a);
+ virtual Layout::Viewport_ptr scrollable(Fresco::Graphic_ptr);
+// virtual Layout::Splitter_ptr splitter(Fresco::Graphic_ptr,
+// Fresco::Graphic_ptr,
+// Fresco::Axis);
+ virtual Layout::Stage_ptr create_stage();
+ virtual Layout::Grid_ptr fixed_grid(const Layout::Grid::Index &);
+ virtual Fresco::Graphic_ptr
+ fixed_range(Layout::Grid_ptr g, const Layout::Grid::Range &);
+ virtual Fresco::Graphic_ptr hbox();
+ virtual Fresco::Graphic_ptr vbox();
+ virtual Fresco::Graphic_ptr hbox_first_aligned();
+ virtual Fresco::Graphic_ptr vbox_first_aligned();
+ virtual Fresco::Graphic_ptr hbox_align_elements(Fresco::Alignment);
+ virtual Fresco::Graphic_ptr vbox_align_elements(Fresco::Alignment);
+ virtual Fresco::Graphic_ptr overlay();
+ virtual Fresco::Graphic_ptr deck();
+ virtual Fresco::Graphic_ptr back(Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual Fresco::Graphic_ptr front(Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual Fresco::Graphic_ptr between(Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual Fresco::Graphic_ptr glue(Fresco::Axis,
+ Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Alignment);
+ virtual Fresco::Graphic_ptr
+ glue_requisition(const Fresco::Graphic::Requisition &);
+ virtual Fresco::Graphic_ptr hfill();
+ virtual Fresco::Graphic_ptr hglue_fill(Fresco::Coord);
+ virtual Fresco::Graphic_ptr hglue(Fresco::Coord, Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr hglue_aligned(Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Alignment);
+ virtual Fresco::Graphic_ptr hspace(Fresco::Coord);
+ virtual Fresco::Graphic_ptr vfill();
+ virtual Fresco::Graphic_ptr vglue_fill(Fresco::Coord);
+ virtual Fresco::Graphic_ptr vglue(Fresco::Coord, Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr vglue_aligned(Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Alignment);
+ virtual Fresco::Graphic_ptr vspace(Fresco::Coord);
+ virtual Fresco::Graphic_ptr shape_of(Fresco::Graphic_ptr g);
+ virtual Fresco::Graphic_ptr shape_of_xy(Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual Fresco::Graphic_ptr shape_of_xyz(Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual Fresco::Graphic_ptr align(Fresco::Graphic_ptr,
+ Fresco::Alignment,
+ Fresco::Alignment);
+ virtual Fresco::Graphic_ptr align_axis(Fresco::Graphic_ptr,
+ Fresco::Axis,
+ Fresco::Alignment);
+ virtual Fresco::Graphic_ptr halign(Fresco::Graphic_ptr,
+ Fresco::Alignment);
+ virtual Fresco::Graphic_ptr valign(Fresco::Graphic_ptr,
+ Fresco::Alignment);
+ virtual Fresco::Graphic_ptr fixed_size(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr fixed_axis(Fresco::Graphic_ptr,
+ Fresco::Axis,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr hfixed(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr vfixed(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr flexible(Fresco::Graphic_ptr,
+ Fresco::Coord, Fresco::Coord);
+ virtual Fresco::Graphic_ptr flexible_fill(Fresco::Graphic_ptr);
+ virtual Fresco::Graphic_ptr flexible_axis(Fresco::Graphic_ptr,
+ Fresco::Axis,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr hflexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr vflexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr natural(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr natural_axis(Fresco::Graphic_ptr,
+ Fresco::Axis,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr hnatural(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr vnatural(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr margin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr margin_lrbt(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr margin_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr
+ margin_lrbt_flexible(Fresco::Graphic_ptr, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord);
+ virtual Fresco::Graphic_ptr hmargin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr hmargin_lr(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr
+ hmargin_lr_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord);
+ virtual Fresco::Graphic_ptr vmargin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr vmargin_bt(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr
+ vmargin_bt_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord);
+ virtual Fresco::Graphic_ptr lmargin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr lmargin_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr rmargin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr rmargin_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr bmargin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr bmargin_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr tmargin(Fresco::Graphic_ptr,
+ Fresco::Coord);
+ virtual Fresco::Graphic_ptr tmargin_flexible(Fresco::Graphic_ptr,
+ Fresco::Coord,
+ Fresco::Coord,
+ Fresco::Coord);
+ private:
+ Fresco::Coord my_fill;
+ };
+
+ } // namespace
} // namespace
#endif
Index: LayoutManager.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/LayoutManager.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- LayoutManager.cc 5 Jan 2003 16:21:33 -0000 1.16
+++ LayoutManager.cc 29 Dec 2003 08:03:28 -0000 1.17
@@ -36,550 +36,638 @@
//. names axes
const char* name_axis(Axis a)
{
- switch (a)
+ switch (a)
{
case xaxis: return "X";
case yaxis: return "Y";
case zaxis: return "Z";
}
- return "";
[...963 lines suppressed...]
-LayoutVariable::LayoutVariable(Axis a, Coord S, Coord s) : _axis(a), _stretch(S), _shrink(s) {}
-LayoutVariable::~LayoutVariable() {}
-LayoutManager *LayoutVariable::clone() { return new LayoutVariable(_axis, _stretch, _shrink);}
-
-void LayoutVariable::request(long, Graphic::Requisition *, Graphic::Requisition &result)
+void LayoutVariable::request(long, Graphic::Requisition *,
+ Graphic::Requisition &result)
{
- Graphic::Requirement *r = GraphicImpl::requirement(result, _axis);
- r->maximum = r->natural + _stretch;
- r->minimum = r->natural - _shrink;
+ Graphic::Requirement *r = GraphicImpl::requirement(result, my_axis);
+ r->maximum = r->natural + my_stretch;
+ r->minimum = r->natural - my_shrink;
}
-void LayoutVariable::allocate(long, Graphic::Requisition *, Region_ptr, LayoutManager::Allocations) {} // leave it as is
+void LayoutVariable::allocate(long, Graphic::Requisition *,
+ Region_ptr, LayoutManager::Allocations)
+{ } // leave it as is
Index: LayoutManager.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/LayoutManager.hh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- LayoutManager.hh 5 Jan 2003 16:21:33 -0000 1.14
+++ LayoutManager.hh 29 Dec 2003 08:03:29 -0000 1.15
@@ -20,8 +20,8 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _LayoutManager_hh
-#define _LayoutManager_hh
+#ifndef _Layout_LayoutManager_hh
+#define _Layout_LayoutManager_hh
#include <Fresco/config.hh>
#include <Fresco/Graphic.hh>
@@ -29,240 +29,306 @@
class RegionImpl;
-namespace Berlin {
-namespace LayoutKit {
-
-class LayoutManager
-{
-public:
- typedef RegionImpl **Allocations;
-
- LayoutManager();
- virtual ~LayoutManager();
- virtual LayoutManager *clone() = 0;
-
- virtual char *name() = 0;
-
- virtual void request(long n, Fresco::Graphic::Requisition *requests, Fresco::Graphic::Requisition &result) = 0;
- virtual void allocate(long n, Fresco::Graphic::Requisition *requests, Fresco::Region_ptr given, LayoutManager::Allocations result) = 0;
-
- static void set_span(RegionImpl *r, Fresco::Axis a, Fresco::Coord origin, Fresco::Coord length, Fresco::Alignment align);
-};
-
-//. LayoutAlign -- align positions along an axis
-class LayoutAlign : public LayoutManager
-{
-public:
- LayoutAlign(Fresco::Axis);
- virtual ~LayoutAlign();
- virtual LayoutManager *clone();
-
- virtual char *name() { return "Align";}
-
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis axis;
-};
-
-//. LayoutCenter -- center positions along an axis
-class LayoutCenter : public LayoutManager
+namespace Berlin
{
-public:
- LayoutCenter(Fresco::Axis, Fresco::Alignment a);
- virtual ~LayoutCenter();
+ namespace LayoutKit
+ {
- virtual char *name() { return "Center";}
+ class LayoutManager
+ {
+ public:
+ typedef RegionImpl **Allocations;
- virtual LayoutManager *clone();
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis _axis;
- Fresco::Alignment _alignment;
-};
+ LayoutManager();
+ virtual ~LayoutManager();
+ virtual LayoutManager *clone() = 0;
+
+ virtual char *name() = 0;
-//. LayoutFixed -- set size along an axis
-class LayoutFixed : public LayoutManager
-{
-public:
- LayoutFixed(Fresco::Axis, Fresco::Coord);
- virtual ~LayoutFixed();
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &) = 0;
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations) = 0;
- virtual char *name() { return "Fixed";}
+ static void set_span(Berlin::RegionImpl *, Fresco::Axis,
+ Fresco::Coord, Fresco::Coord,
+ Fresco::Alignment);
+ };
+
+ //. LayoutAlign -- align positions along an axis
+ class LayoutAlign : public LayoutManager
+ {
+ public:
+ LayoutAlign(Fresco::Axis);
+ virtual ~LayoutAlign();
+ virtual LayoutManager *clone();
+
+ virtual char *name() { return "Align";}
- virtual LayoutManager *clone();
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis _axis;
- Fresco::Coord _size;
-};
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ };
-//. LayoutVariable -- allow flexibility along an axis
-class LayoutVariable : public LayoutManager
-{
-public:
- LayoutVariable(Fresco::Axis, Fresco::Coord stretch, Fresco::Coord shrink);
- virtual ~LayoutVariable();
+ //. LayoutCenter -- center positions along an axis
+ class LayoutCenter : public LayoutManager
+ {
+ public:
+ LayoutCenter(Fresco::Axis, Fresco::Alignment a);
+ virtual ~LayoutCenter();
- virtual char *name() { return "Variable";}
+ virtual char *name() { return "Center"; }
- virtual LayoutManager* clone();
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis _axis;
- Fresco::Coord _stretch;
- Fresco::Coord _shrink;
-};
+ virtual LayoutManager *clone();
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Alignment my_alignment;
+ };
-//. LayoutNatural -- set the natural size along an axis
-class LayoutNatural : public LayoutManager
-{
-public:
- LayoutNatural(Fresco::Axis, Fresco::Coord);
- virtual ~LayoutNatural();
+ //. LayoutFixed -- set size along an axis
+ class LayoutFixed : public LayoutManager
+ {
+ public:
+ LayoutFixed(Fresco::Axis, Fresco::Coord);
+ virtual ~LayoutFixed();
- virtual char *name() { return "Natural";}
+ virtual char *name() { return "Fixed"; }
- virtual LayoutManager *clone();
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis axis;
- Fresco::Coord natural;
-};
+ virtual LayoutManager *clone();
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Coord my_size;
+ };
-//. LayoutMargin -- leave a margin around the sides
-class LayoutMargin : public LayoutManager
-{
-public:
- LayoutMargin(Fresco::Coord);
- LayoutMargin(Fresco::Coord, Fresco::Coord);
- LayoutMargin(Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- LayoutMargin(Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Coord);
- virtual ~LayoutMargin();
+ //. LayoutVariable -- allow flexibility along an axis
+ class LayoutVariable : public LayoutManager
+ {
+ public:
+ LayoutVariable(Fresco::Axis, Fresco::Coord stretch,
+ Fresco::Coord shrink);
+ virtual ~LayoutVariable();
- virtual char *name() { return "Margin";}
+ virtual char *name() { return "Variable"; }
+
+ virtual LayoutManager* clone();
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Coord my_stretch;
+ Fresco::Coord my_shrink;
+ };
- virtual LayoutManager *clone();
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- void allocate_axis(Fresco::Axis, Fresco::Coord, Fresco::Coord, Fresco::Coord, Fresco::Coord,
- Fresco::Coord, Fresco::Coord, LayoutManager::Allocations);
- static Fresco::Coord span(Fresco::Coord, Fresco::Graphic::Requirement &, Fresco::Coord, Fresco::Coord, Fresco::Coord);
+ //. LayoutNatural -- set the natural size along an axis
+ class LayoutNatural : public LayoutManager
+ {
+ public:
+ LayoutNatural(Fresco::Axis, Fresco::Coord);
+ virtual ~LayoutNatural();
+
+ virtual char *name() { return "Natural"; }
+
+ virtual LayoutManager *clone();
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Coord my_natural;
+ };
- Fresco::Coord _lnatural, _lstretch, _lshrink;
- Fresco::Coord _rnatural, _rstretch, _rshrink;
- Fresco::Coord _bnatural, _bstretch, _bshrink;
- Fresco::Coord _tnatural, _tstretch, _tshrink;
- Fresco::Graphic::Requisition _requisition;
-};
+ //. LayoutMargin -- leave a margin around the sides
+ class LayoutMargin : public LayoutManager
+ {
+ public:
+ LayoutMargin(Fresco::Coord);
+ LayoutMargin(Fresco::Coord, Fresco::Coord);
+ LayoutMargin(Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord);
+ LayoutMargin(Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord);
+ virtual ~LayoutMargin();
-//. LayoutSuperpose - composite layout manager
-class LayoutSuperpose : public LayoutManager
-{
-public:
- LayoutSuperpose(LayoutManager *, LayoutManager *);
- LayoutSuperpose(LayoutManager *, LayoutManager *, LayoutManager *);
- virtual ~LayoutSuperpose();
- virtual LayoutManager *clone();
+ virtual char *name() { return "Margin"; }
- virtual char *name() { return _name;}
+ virtual LayoutManager *clone();
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ void allocate_axis(Fresco::Axis,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ Fresco::Coord, Fresco::Coord, Fresco::Coord,
+ LayoutManager::Allocations);
+ static Fresco::Coord span(Fresco::Coord,
+ Fresco::Graphic::Requirement &,
+ Fresco::Coord, Fresco::Coord,
+ Fresco::Coord);
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- char *_name;
- LayoutManager *_first;
- LayoutManager *_second;
- LayoutManager *_third;
-};
+ Fresco::Coord my_lnatural, my_lstretch, my_lshrink;
+ Fresco::Coord my_rnatural, my_rstretch, my_rshrink;
+ Fresco::Coord my_bnatural, my_bstretch, my_bshrink;
+ Fresco::Coord my_tnatural, my_tstretch, my_tshrink;
+ Fresco::Graphic::Requisition my_requisition;
+ };
-//. LayoutTile -- side-by-side, first-to-last along an axis
-class LayoutTile : public LayoutManager
-{
-public:
- LayoutTile(Fresco::Axis);
- virtual ~LayoutTile();
- virtual LayoutManager *clone();
+ //. LayoutSuperpose - composite layout manager
+ class LayoutSuperpose : public LayoutManager
+ {
+ public:
+ LayoutSuperpose(LayoutManager *, LayoutManager *);
+ LayoutSuperpose(LayoutManager *, LayoutManager *, LayoutManager *);
+ virtual ~LayoutSuperpose();
+ virtual LayoutManager *clone();
- virtual char *name() { return _name;}
+ virtual char *name() { return my_name; }
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ char *my_name;
+ LayoutManager *my_first;
+ LayoutManager *my_second;
+ LayoutManager *my_third;
+ };
- static void compute_request(Fresco::Axis, Fresco::Alignment, long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- static void compute_allocations(Fresco::Axis, Fresco::Graphic::Requisition &, bool, long, Fresco::Graphic::Requisition *,
- Fresco::Region_ptr, LayoutManager::Allocations);
- static Fresco::Coord compute_length(const Fresco::Graphic::Requirement &, const Fresco::Region::Allotment &);
- static Fresco::Coord compute_squeeze(const Fresco::Graphic::Requirement &, Fresco::Coord);
-private:
- char *_name;
- Fresco::Axis _axis;
- Fresco::Graphic::Requisition _requisition;
-};
+ //. LayoutTile -- side-by-side, first-to-last along an axis
+ class LayoutTile : public LayoutManager
+ {
+ public:
+ LayoutTile(Fresco::Axis);
+ virtual ~LayoutTile();
+ virtual LayoutManager *clone();
-//. LayoutTileReversed -- side-by-side, last-to-first
-class LayoutTileReversed : public LayoutManager
-{
-public:
- LayoutTileReversed(Fresco::Axis);
- virtual ~LayoutTileReversed();
- virtual LayoutManager *clone();
+ virtual char *name() { return my_name; }
- virtual char *name() { return "TileReversed";}
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
- static void compute_reversed_allocations(Fresco::Axis, Fresco::Graphic::Requisition &, bool, long, Fresco::Graphic::Requisition *,
- Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis _axis;
- Fresco::Graphic::Requisition _requisition;
-};
+ static void compute_request(Fresco::Axis, Fresco::Alignment,
+ long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ static void compute_allocations(Fresco::Axis,
+ Fresco::Graphic::Requisition &,
+ bool, long,
+ Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ static Fresco::Coord
+ compute_length(const Fresco::Graphic::Requirement &,
+ const Fresco::Region::Allotment &);
+ static Fresco::Coord
+ compute_squeeze(const Fresco::Graphic::Requirement &,
+ Fresco::Coord);
+ private:
+ char *my_name;
+ Fresco::Axis my_axis;
+ Fresco::Graphic::Requisition my_requisition;
+ };
-//. LayoutTileFirstAligned -- like Tile but use first element's origin
-class LayoutTileFirstAligned : public LayoutManager
-{
-public:
- LayoutTileFirstAligned(Fresco::Axis);
- virtual ~LayoutTileFirstAligned();
- virtual LayoutManager *clone();
+ //. LayoutTileReversed -- side-by-side, last-to-first
+ class LayoutTileReversed : public LayoutManager
+ {
+ public:
+ LayoutTileReversed(Fresco::Axis);
+ virtual ~LayoutTileReversed();
+ virtual LayoutManager *clone();
- virtual char *name() { return "TileFirstAligned";}
+ virtual char *name() { return "TileReversed"; }
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
- static void compute_request_first_aligned(Fresco::Axis, long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
-private:
- Fresco::Axis _axis;
- Fresco::Graphic::Requisition _requisition;
-};
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ static void
+ compute_reversed_allocations(Fresco::Axis,
+ Fresco::Graphic::Requisition &,
+ bool, long,
+ Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Graphic::Requisition my_requisition;
+ };
-//. LayoutTileReversedFirstAligned -- like TileReversed
-//. but use first element's origin
-class LayoutTileReversedFirstAligned : public LayoutManager
-{
-public:
- LayoutTileReversedFirstAligned(Fresco::Axis);
- virtual ~LayoutTileReversedFirstAligned();
- virtual LayoutManager *clone();
+ //. LayoutTileFirstAligned -- like Tile but use first element's origin
+ class LayoutTileFirstAligned : public LayoutManager
+ {
+ public:
+ LayoutTileFirstAligned(Fresco::Axis);
+ virtual ~LayoutTileFirstAligned();
+ virtual LayoutManager *clone();
+
+ virtual char *name() { return "TileFirstAligned"; }
- virtual char *name() { return "TileReversedFirstAligned";}
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ static void
+ compute_request_first_aligned(Fresco::Axis, long,
+ Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Graphic::Requisition my_requisition;
+ };
- virtual void request(long, Fresco::Graphic::Requisition *, Fresco::Graphic::Requisition &);
- virtual void allocate(long, Fresco::Graphic::Requisition *, Fresco::Region_ptr, LayoutManager::Allocations);
-private:
- Fresco::Axis _axis;
- Fresco::Graphic::Requisition _requisition;
-};
+ //. LayoutTileReversedFirstAligned -- like TileReversed
+ //. but use first element's origin
+ class LayoutTileReversedFirstAligned : public LayoutManager
+ {
+ public:
+ LayoutTileReversedFirstAligned(Fresco::Axis);
+ virtual ~LayoutTileReversedFirstAligned();
+ virtual LayoutManager *clone();
+
+ virtual char *name() { return "TileReversedFirstAligned"; }
-} // namespace
+ virtual void request(long, Fresco::Graphic::Requisition *,
+ Fresco::Graphic::Requisition &);
+ virtual void allocate(long, Fresco::Graphic::Requisition *,
+ Fresco::Region_ptr,
+ LayoutManager::Allocations);
+ private:
+ Fresco::Axis my_axis;
+ Fresco::Graphic::Requisition my_requisition;
+ };
+
+ } // namespace
} // namespace
#endif
Index: Placement.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Placement.cc,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- Placement.cc 5 Jan 2003 16:21:33 -0000 1.22
+++ Placement.cc 29 Dec 2003 08:03:29 -0000 1.23
@@ -31,90 +31,97 @@
using namespace Berlin::LayoutKit;
-Placement::Placement(LayoutManager *l)
- : _layout(l),
- _region(new RegionImpl())
+Placement::Placement(LayoutManager *l) :
+ my_layout(l), my_region(new RegionImpl())
{
- std::ostringstream buf;
- buf << "Placement" << _layout->name() << std::ends;
- _name = strdup(buf.str().c_str());
+ std::ostringstream buf;
+ buf << "Placement" << my_layout->name() << std::ends;
+ my_name = strdup(buf.str().c_str());
}
-Placement::~Placement()
-{
- delete _layout;
-}
+Placement::~Placement() { delete my_layout; }
void Placement::request(Fresco::Graphic::Requisition::Requisition &r)
{
- MonoGraphic::request(r);
- _layout->request(0, 0, r);
+ MonoGraphic::request(r);
+ my_layout->request(0, 0, r);
}
void Placement::traverse(Traversal_ptr traversal)
{
- Trace trace(this, "Placement::traverse");
- Region_var allocation = traversal->current_allocation();
- if (!CORBA::is_nil(allocation))
+ Trace trace(this, "Placement::traverse");
+ Region_var allocation = traversal->current_allocation();
+ if (!CORBA::is_nil(allocation))
{
- Fresco::Graphic::Requisition r;
- GraphicImpl::init_requisition(r);
- MonoGraphic::request(r);
- Graphic_var child = body();
- if (CORBA::is_nil(child)) return;
- Lease_var<RegionImpl> result(Provider<RegionImpl>::provide());
- result->copy(allocation);
- RegionImpl *tmp = static_cast<RegionImpl *>(result);
- _layout->allocate(1, &r, allocation, &tmp);
- Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
- tx->load_identity();
- result->normalize(Transform_var(tx->_this()));
- try { traversal->traverse_child (child, 0, Region_var(result->_this()), Transform_var(tx->_this()));}
- catch (const CORBA::OBJECT_NOT_EXIST &) { body (Fresco::Graphic::_nil());}
- catch (const CORBA::COMM_FAILURE &) { body(Fresco::Graphic::_nil());}
- catch (const CORBA::TRANSIENT &) { body(Fresco::Graphic::_nil());}
+ Fresco::Graphic::Requisition r;
+ GraphicImpl::init_requisition(r);
+ MonoGraphic::request(r);
+ Graphic_var child = body();
+ if (CORBA::is_nil(child)) return;
+ Lease_var<RegionImpl> result(Provider<RegionImpl>::provide());
+ result->copy(allocation);
+ RegionImpl *tmp = static_cast<RegionImpl *>(result);
+ my_layout->allocate(1, &r, allocation, &tmp);
+ Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
+ tx->load_identity();
+ result->normalize(Transform_var(tx->_this()));
+ try
+ {
+ traversal->traverse_child(child, 0,
+ Region_var(result->_this()),
+ Transform_var(tx->_this()));
+ }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::COMM_FAILURE &)
+ { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::TRANSIENT &)
+ { body(Fresco::Graphic::_nil()); }
}
- else MonoGraphic::traverse(traversal);
+ else MonoGraphic::traverse(traversal);
}
void Placement::allocate(Tag, const Allocation::Info &a)
{
- Trace trace(this, "Placement::allocate");
- _region->copy(a.allocation);
- Fresco::Graphic::Requisition r;
- GraphicImpl::init_requisition(r);
- MonoGraphic::request(r);
- RegionImpl *cast = _region;
- _layout->allocate(1, &r, a.allocation, &cast);
- Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
- tx->load_identity();
- _region->normalize(Transform_var(tx->_this()));
- a.transformation->premultiply(Transform_var(tx->_this()));
- a.allocation->copy(Region_var(_region->_this()));
+ Trace trace(this, "Placement::allocate");
+ my_region->copy(a.allocation);
+ Fresco::Graphic::Requisition r;
+ GraphicImpl::init_requisition(r);
+ MonoGraphic::request(r);
+ RegionImpl *cast = my_region;
+ my_layout->allocate(1, &r, a.allocation, &cast);
+ Lease_var<TransformImpl> tx(Provider<TransformImpl>::provide());
+ tx->load_identity();
+ my_region->normalize(Transform_var(tx->_this()));
+ a.transformation->premultiply(Transform_var(tx->_this()));
+ a.allocation->copy(Region_var(my_region->_this()));
}
-LayoutLayer::LayoutLayer(Graphic_ptr between, Graphic_ptr under, Graphic_ptr over)
- : _under(Fresco::Graphic::_duplicate(under)),
- _over(Fresco::Graphic::_duplicate(over))
-{
- body(between);
-}
+LayoutLayer::LayoutLayer(Graphic_ptr between, Graphic_ptr under,
+ Graphic_ptr over) :
+ my_under(Fresco::Graphic::_duplicate(under)),
+ my_over(Fresco::Graphic::_duplicate(over))
+{ body(between); }
-LayoutLayer::~LayoutLayer()
-{
-}
+LayoutLayer::~LayoutLayer() { }
void LayoutLayer::traverse(Traversal_ptr t)
{
- if (!CORBA::is_nil(_under))
- try { _under->traverse(t);}
- catch (const CORBA::OBJECT_NOT_EXIST &) { _under = Fresco::Graphic::_nil();}
- catch (const CORBA::COMM_FAILURE &) { _under = Fresco::Graphic::_nil();}
- catch (const CORBA::TRANSIENT &) { _under = Fresco::Graphic::_nil();}
- MonoGraphic::traverse(t);
- if (!CORBA::is_nil(_over))
- try { _over->traverse(t);}
- catch (const CORBA::OBJECT_NOT_EXIST &) { _over = Fresco::Graphic::_nil();}
- catch (const CORBA::COMM_FAILURE &) { _over = Fresco::Graphic::_nil();}
- catch (const CORBA::TRANSIENT &) { _over = Fresco::Graphic::_nil();}
+ if (!CORBA::is_nil(my_under))
+ try { my_under->traverse(t); }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { my_under = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { my_under = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { my_under = Fresco::Graphic::_nil(); }
+ MonoGraphic::traverse(t);
+ if (!CORBA::is_nil(my_over))
+ try { my_over->traverse(t); }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { my_over = Fresco::Graphic::_nil(); }
+ catch (const CORBA::COMM_FAILURE &)
+ { my_over = Fresco::Graphic::_nil(); }
+ catch (const CORBA::TRANSIENT &)
+ { my_over = Fresco::Graphic::_nil(); }
}
Index: Placement.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/Placement.hh,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Placement.hh 5 Jan 2003 16:21:33 -0000 1.11
+++ Placement.hh 29 Dec 2003 08:03:29 -0000 1.12
@@ -29,46 +29,47 @@
class RegionImpl;
-namespace Berlin {
-namespace LayoutKit {
-
-class LayoutManager;
-
-class Placement : public MonoGraphic
+namespace Berlin
{
-public:
- Placement(LayoutManager *);
- virtual ~Placement();
-
- virtual void request(Fresco::Graphic::Requisition &);
-
- virtual void traverse(Fresco::Traversal_ptr);
-
- virtual void allocate(Fresco::Tag, const Fresco::Allocation::Info &);
+ namespace LayoutKit
+ {
- virtual const char *object_name() { return _name;}
+ class LayoutManager;
-private:
- LayoutManager *_layout;
- Impl_var<RegionImpl> _region;
- char *_name;
-};
+ class Placement : public MonoGraphic
+ {
+ public:
+ Placement(LayoutManager *);
+ virtual ~Placement();
+
+ virtual void request(Fresco::Graphic::Requisition &);
+ virtual void traverse(Fresco::Traversal_ptr);
+ virtual void allocate(Fresco::Tag,
+ const Fresco::Allocation::Info &);
-class LayoutLayer : public MonoGraphic
-{
-public:
- LayoutLayer(Fresco::Graphic_ptr, Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual ~LayoutLayer();
- virtual void traverse(Fresco::Traversal_ptr);
+ virtual const char *object_name() { return my_name; }
- virtual const char* object_name() { return "LayoutLayer";}
+ private:
+ LayoutManager *my_layout;
+ Impl_var<RegionImpl> my_region;
+ char *my_name;
+ };
-private:
- Fresco::Graphic_var _under;
- Fresco::Graphic_var _over;
-};
+ class LayoutLayer : public MonoGraphic
+ {
+ public:
+ LayoutLayer(Fresco::Graphic_ptr, Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual ~LayoutLayer();
+ virtual void traverse(Fresco::Traversal_ptr);
-} // namespace
+ virtual const char* object_name() { return "LayoutLayer"; }
+ private:
+ Fresco::Graphic_var my_under;
+ Fresco::Graphic_var my_over;
+ };
+
+ } // namespace
} // namespace
#endif
Index: ShapeOf.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/ShapeOf.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ShapeOf.cc 5 Jan 2003 16:21:33 -0000 1.6
+++ ShapeOf.cc 29 Dec 2003 08:03:29 -0000 1.7
@@ -25,38 +25,35 @@
using namespace Berlin::LayoutKit;
-ShapeOf::ShapeOf(Graphic_ptr xx, Graphic_ptr yy, Graphic_ptr zz)
- : x(Fresco::Graphic::_duplicate(xx)),
- y(Fresco::Graphic::_duplicate(yy)),
- z(Fresco::Graphic::_duplicate(zz))
-{
-}
+ShapeOf::ShapeOf(Graphic_ptr xx, Graphic_ptr yy, Graphic_ptr zz) :
+ my_x(Fresco::Graphic::_duplicate(xx)),
+ my_y(Fresco::Graphic::_duplicate(yy)),
+ my_z(Fresco::Graphic::_duplicate(zz))
+{ }
-ShapeOf::~ShapeOf()
-{
-}
+ShapeOf::~ShapeOf() { }
void ShapeOf::request(Fresco::Graphic::Requisition &r)
{
- if (CORBA::is_nil(y) && CORBA::is_nil(z)) x->request(r);
- else
+ if (CORBA::is_nil(my_y) && CORBA::is_nil(my_z)) my_x->request(r);
+ else
{
- Fresco::Graphic::Requisition req;
- GraphicImpl::init_requisition(req);
- if (!CORBA::is_nil(x))
+ Fresco::Graphic::Requisition req;
+ GraphicImpl::init_requisition(req);
+ if (!CORBA::is_nil(my_x))
{
- x->request(req);
- r.x = req.x;
+ my_x->request(req);
+ r.x = req.x;
}
- if (!CORBA::is_nil(y))
+ if (!CORBA::is_nil(my_y))
{
- y->request(req);
- r.y = req.y;
+ my_y->request(req);
+ r.y = req.y;
}
- if (CORBA::is_nil(z))
+ if (CORBA::is_nil(my_z))
{
- z->request(req);
- r.z = req.z;
+ my_z->request(req);
+ r.z = req.z;
}
}
}
Index: ShapeOf.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/ShapeOf.hh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ShapeOf.hh 5 Jan 2003 16:21:33 -0000 1.5
+++ ShapeOf.hh 29 Dec 2003 08:03:29 -0000 1.6
@@ -24,23 +24,26 @@
#include <Berlin/GraphicImpl.hh>
-namespace Berlin {
-namespace LayoutKit {
-
-class ShapeOf : public GraphicImpl
+namespace Berlin
{
-public:
- ShapeOf(Fresco::Graphic_ptr, Fresco::Graphic_ptr, Fresco::Graphic_ptr);
- virtual ~ShapeOf();
+ namespace LayoutKit
+ {
- virtual void request(Fresco::Graphic::Requisition &);
-private:
- Fresco::Graphic_var x;
- Fresco::Graphic_var y;
- Fresco::Graphic_var z;
-};
+ class ShapeOf : public GraphicImpl
+ {
+ public:
+ ShapeOf(Fresco::Graphic_ptr, Fresco::Graphic_ptr,
+ Fresco::Graphic_ptr);
+ virtual ~ShapeOf();
-} // namespace
+ virtual void request(Fresco::Graphic::Requisition &);
+ private:
+ Fresco::Graphic_var my_x;
+ Fresco::Graphic_var my_y;
+ Fresco::Graphic_var my_z;
+ };
+
+ } // namespace
} // namespace
#endif
Index: StageImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/StageImpl.cc,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- StageImpl.cc 3 Nov 2003 20:45:42 -0000 1.55
+++ StageImpl.cc 29 Dec 2003 08:03:29 -0000 1.56
@@ -38,6 +38,7 @@
using namespace Prague;
using namespace Fresco;
using namespace Layout;
+using namespace Berlin;
using namespace Berlin::LayoutKit;
@@ -49,62 +50,63 @@
{
typedef std::vector<StageHandleImpl *> parent_t;
public:
[...1216 lines suppressed...]
+ my_bbox.t = my_position.y - r.y.natural * r.y.align;
+ my_bbox.b = my_position.y + r.y.natural * (1. - r.y.align);
}
}
else
{
- _xalign = 0.;
- _yalign = 0.;
- _bbox.l = _position.x;
- _bbox.r = _position.x;
- _bbox.t = _position.y;
- _bbox.b = _position.y;
+ my_xalign = 0.;
+ my_yalign = 0.;
+ my_bbox.l = my_position.x;
+ my_bbox.r = my_position.x;
+ my_bbox.t = my_position.y;
+ my_bbox.b = my_position.y;
}
}
Index: StageImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/StageImpl.hh,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- StageImpl.hh 27 Oct 2003 17:08:38 -0000 1.27
+++ StageImpl.hh 29 Dec 2003 08:03:29 -0000 1.28
@@ -19,8 +19,8 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _StageImpl_hh
-#define _StageImpl_hh
+#ifndef _LayoutKit_StageImpl_hh
+#define _LayoutKit_StageImpl_hh
#include <Prague/Sys/Thread.hh>
#include <Fresco/config.hh>
@@ -83,22 +83,22 @@
private:
//. Return a new unique tag in the scope of this parent
Fresco::Tag unique_tag();
- //. Return a handle to the child of the Stage that has the given tag.
- //. It returns 0 if no child has the given tag.
+ //. Return a handle to the child of the Stage that has the given
+ //. tag. It returns 0 if no child has the given tag.
StageHandleImpl *tag_to_handle(Fresco::Tag);
//. Mark the region occupied by the given StageHandle as damaged.
- //. This is done by either merging that region with the one allready
+ //. This is done by either merging that region with the one already
//. damaged or by creating a new onw
void damage(StageHandleImpl *);
- Sequence *_children;
- QuadTree *_tree;
- long _nesting;
- Impl_var<RegionImpl> _damage;
- Impl_var<RegionImpl> _bbregion;
- bool _need_redraw : 1;
- bool _need_resize : 1;
- Prague::Mutex _mutex;
+ Sequence *my_children;
+ QuadTree *my_tree;
+ long my_nesting;
+ Impl_var<RegionImpl> my_damage;
+ Impl_var<RegionImpl> my_bbregion;
+ bool my_need_redraw : 1;
+ bool my_need_resize : 1;
+ Prague::Mutex my_mutex;
};
class StageHandleImpl : public virtual POA_Layout::StageHandle
@@ -120,30 +120,33 @@
const Geometry::Rectangle<Fresco::Coord> &bbox();
void bbox(RegionImpl &);
// private:
- //. Calculate the bounding box of the graphic in this StageHandle and
- //. stores the result in _bbox.
+ // FIXME: These variables should be private!
+
+ //. Calculate the bounding box of the graphic in this StageHandle
+ //. and stores the result in _bbox.
void cache_bbox();
//. The stage this StageHandle belongs into.
- StageImpl *_parent;
+ StageImpl *my_parent;
//. The graphic forming this StageHandle.
- Fresco::Graphic_var _child;
- //. This tag is unique for the parent-Stage and identifies this StageHandle.
- Fresco::Tag _tag;
+ Fresco::Graphic_var my_child;
+ //. This tag is unique for the parent-Stage and identifies this
+ //. StageHandle.
+ Fresco::Tag my_tag;
//. The position of the graphic forming this StageHandle.
- Fresco::Vertex _position;
+ Fresco::Vertex my_position;
//. The size of the graphic forming this StageHandle
- Fresco::Vertex _size;
- //. The layer this StageHandle has.
- Layout::Stage::Index _layer;
- //. The bounding box of the graphic of this StageHandle as calculated
- //. by cache_bbox().
- Geometry::Rectangle<Fresco::Coord> _bbox;
+ Fresco::Vertex my_size;
+ //. The bounding box of the graphic of this StageHandle as
+ //. calculated by cache_bbox().
+ Geometry::Rectangle<Fresco::Coord> my_bbox;
//. The alignment along the x-axis.
- Fresco::Alignment _xalign;
+ Fresco::Alignment my_xalign;
//. The alignment along the y-axis.
- Fresco::Alignment _yalign;
+ Fresco::Alignment my_yalign;
//. A mutex for thread safety.
- Prague::Mutex _mutex;
+ Prague::Mutex my_mutex;
+ //. The layer this StageHandle has.
+ Layout::Stage::Index my_layer;
};
} // namespace
Index: ViewportImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/ViewportImpl.cc,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- ViewportImpl.cc 27 Oct 2003 17:08:38 -0000 1.34
+++ ViewportImpl.cc 29 Dec 2003 08:03:29 -0000 1.35
@@ -41,8 +41,8 @@
{
namespace LayoutKit
{
- class ViewportImpl::Adjustment : public virtual POA_Fresco::BoundedRange,
- public SubjectImpl
+ class ViewportImpl::Adjustment :
+ public virtual POA_Fresco::BoundedRange, public SubjectImpl
{
public:
Adjustment();
@@ -68,105 +68,114 @@
virtual void begin();
virtual void end();
virtual void adjust(Coord);
- virtual const char *object_name() { return "ViewportImpl::Adjustment";}
+ virtual const char *object_name()
+ { return "ViewportImpl::Adjustment"; }
private:
- Fresco::BoundedRange::Settings _settings;
- Coord _s;
- Coord _p;
- Mutex _mutex;
+ Fresco::BoundedRange::Settings my_settings;
+ Coord my_s;
+ Coord my_p;
+ Mutex my_mutex;
};
-
- ViewportImpl::Adjustment::Adjustment() : _s(10.), _p(10.)
- { _settings.lower = _settings.upper = _settings.lvalue = _settings.uvalue = 0.; }
+
+ ViewportImpl::Adjustment::Adjustment() : my_s(10.), my_p(10.)
+ {
+ my_settings.lower = my_settings.upper =
+ my_settings.lvalue = my_settings.uvalue = 0.;
+ }
ViewportImpl::Adjustment::~Adjustment() { }
Fresco::BoundedRange::Settings ViewportImpl::Adjustment::state()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _settings;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_settings;
}
void ViewportImpl::Adjustment::state(const Fresco::BoundedRange::Settings &s)
{
- Prague::Guard<Mutex> guard(_mutex);
- _settings = s;
+ Prague::Guard<Mutex> guard(my_mutex);
+ my_settings = s;
}
Coord ViewportImpl::Adjustment::lower()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _settings.lower;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_settings.lower;
}
void ViewportImpl::Adjustment::lower(Coord l)
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- if (l == _settings.lower) return;
- _settings.lower = l;
- _settings.lvalue = std::max(_settings.lvalue, _settings.lower);
- _settings.uvalue = std::max(_settings.uvalue, _settings.lower);
- any <<= _settings;
+ Prague::Guard<Mutex> guard(my_mutex);
+ if (l == my_settings.lower) return;
+ my_settings.lower = l;
+ my_settings.lvalue = std::max(my_settings.lvalue,
+ my_settings.lower);
+ my_settings.uvalue = std::max(my_settings.uvalue,
+ my_settings.lower);
+ any <<= my_settings;
}
notify(any);
}
Coord ViewportImpl::Adjustment::upper()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _settings.upper;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_settings.upper;
}
void ViewportImpl::Adjustment::upper(Coord u)
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- if (_settings.upper == u) return;
- _settings.upper = u;
- _settings.lvalue = std::min(_settings.lvalue, _settings.upper);
- _settings.uvalue = std::min(_settings.uvalue, _settings.upper);
- any <<= _settings;
+ Prague::Guard<Mutex> guard(my_mutex);
+ if (my_settings.upper == u) return;
+ my_settings.upper = u;
+ my_settings.lvalue = std::min(my_settings.lvalue,
+ my_settings.upper);
+ my_settings.uvalue = std::min(my_settings.uvalue,
+ my_settings.upper);
+ any <<= my_settings;
}
notify(any);
}
Coord ViewportImpl::Adjustment::step()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _s;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_s;
}
void ViewportImpl::Adjustment::step(Coord s)
{
- Prague::Guard<Mutex> guard(_mutex);
- _s = s;
+ Prague::Guard<Mutex> guard(my_mutex);
+ my_s = s;
}
Coord ViewportImpl::Adjustment::page()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _p;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_p;
}
void ViewportImpl::Adjustment::page(Coord p)
{
- Prague::Guard<Mutex> guard(_mutex);
- _p = p;
+ Prague::Guard<Mutex> guard(my_mutex);
+ my_p = p;
}
void ViewportImpl::Adjustment::forward()
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = std::min(_s, _settings.upper - _settings.uvalue);
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t = std::min(my_s,
+ my_settings.upper - my_settings.uvalue);
if (t <= 0.) return;
- _settings.lvalue += t;
- _settings.uvalue += t;
- any <<= _settings;
+ my_settings.lvalue += t;
+ my_settings.uvalue += t;
+ any <<= my_settings;
}
notify(any);
}
@@ -175,12 +184,13 @@
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = std::min(_s, _settings.lvalue - _settings.lower);
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t = std::min(my_s,+
+ my_settings.lvalue - my_settings.lower);
if (t <= 0.) return;
- _settings.lvalue -= t;
- _settings.uvalue -= t;
- any <<= _settings;
+ my_settings.lvalue -= t;
+ my_settings.uvalue -= t;
+ any <<= my_settings;
}
notify(any);
}
@@ -189,12 +199,13 @@
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = std::min(_p, _settings.upper - _settings.uvalue);
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t = std::min(my_p,
+ my_settings.upper - my_settings.uvalue);
if (t <= 0.) return;
- _settings.lvalue += t;
- _settings.uvalue += t;
- any <<= _settings;
+ my_settings.lvalue += t;
+ my_settings.uvalue += t;
+ any <<= my_settings;
}
notify(any);
}
@@ -203,12 +214,13 @@
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = std::min(_p, _settings.lvalue - _settings.lower);
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t = std::min(my_p,
+ my_settings.lvalue - my_settings.lower);
if (t <= 0.) return;
- _settings.lvalue -= t;
- _settings.uvalue -= t;
- any <<= _settings;
+ my_settings.lvalue -= t;
+ my_settings.uvalue -= t;
+ any <<= my_settings;
}
notify(any);
}
@@ -217,12 +229,12 @@
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = _settings.lvalue - _settings.lower;
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t = my_settings.lvalue - my_settings.lower;
if (t == 0.) return;
- _settings.lvalue -= t;
- _settings.uvalue -= t;
- any <<= _settings;
+ my_settings.lvalue -= t;
+ my_settings.uvalue -= t;
+ any <<= my_settings;
}
notify(any);
}
@@ -231,12 +243,12 @@
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = _settings.upper - _settings.uvalue;
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t = my_settings.upper - my_settings.uvalue;
if (t == 0.) return;
- _settings.lvalue += t;
- _settings.uvalue += t;
- any <<= _settings;
+ my_settings.lvalue += t;
+ my_settings.uvalue += t;
+ any <<= my_settings;
}
notify(any);
}
@@ -245,19 +257,20 @@
{
CORBA::Any any;
{
- lv = std::min(std::max(_settings.lower, lv), _settings.upper);
- Prague::Guard<Mutex> guard(_mutex);
- if (lv == _settings.lvalue) return;
- _settings.lvalue = lv;
- any <<= _settings;
+ lv = std::min(std::max(my_settings.lower, lv),
+ my_settings.upper);
+ Prague::Guard<Mutex> guard(my_mutex);
+ if (lv == my_settings.lvalue) return;
+ my_settings.lvalue = lv;
+ any <<= my_settings;
}
notify(any);
}
Coord ViewportImpl::Adjustment::lvalue()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _settings.lvalue;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_settings.lvalue;
}
@@ -265,19 +278,20 @@
{
CORBA::Any any;
{
- uv = std::min(std::max(_settings.lower, uv), _settings.upper);
- Prague::Guard<Mutex> guard(_mutex);
- if (_settings.uvalue == uv) return;
- _settings.uvalue = uv;
- any <<= _settings;
+ uv = std::min(std::max(my_settings.lower, uv),
+ my_settings.upper);
+ Prague::Guard<Mutex> guard(my_mutex);
+ if (my_settings.uvalue == uv) return;
+ my_settings.uvalue = uv;
+ any <<= my_settings;
}
notify(any);
}
Coord ViewportImpl::Adjustment::uvalue()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _settings.uvalue;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_settings.uvalue;
}
@@ -285,24 +299,26 @@
{
CORBA::Any any;
{
- Prague::Guard<Mutex> guard(_mutex);
- Coord t = std::min(std::max(d, _settings.lower - _settings.lvalue),
- _settings.upper - _settings.uvalue);
+ Prague::Guard<Mutex> guard(my_mutex);
+ Coord t =
+ std::min(std::max(d,
+ my_settings.lower - my_settings.lvalue),
+ my_settings.upper - my_settings.uvalue);
if (t == 0.) return;
- _settings.lvalue += t;
- _settings.uvalue += t;
- any <<= _settings;
+ my_settings.lvalue += t;
+ my_settings.uvalue += t;
+ any <<= my_settings;
}
notify(any);
}
-
- ViewportImpl::ViewportImpl() : _requested(false)
+
+ ViewportImpl::ViewportImpl() : my_requested(false)
{
- init_requisition(_requisition);
- _settings[xaxis].lower = _settings[xaxis].upper =
- _settings[xaxis].lvalue = _settings[xaxis].uvalue = 0;
- _settings[yaxis].lower = _settings[yaxis].upper =
- _settings[yaxis].lvalue = _settings[yaxis].uvalue = 0;
+ init_requisition(my_requisition);
+ my_settings[xaxis].lower = my_settings[xaxis].upper =
+ my_settings[xaxis].lvalue = my_settings[xaxis].uvalue = 0;
+ my_settings[yaxis].lower = my_settings[yaxis].upper =
+ my_settings[yaxis].lvalue = my_settings[yaxis].uvalue = 0;
}
ViewportImpl::~ViewportImpl() { }
@@ -314,18 +330,22 @@
MonoGraphic::need_resize();
}
- Transform_ptr ViewportImpl::transformation() { return Transform::_nil(); }
+ Transform_ptr ViewportImpl::transformation()
+ { return Transform::_nil(); }
void ViewportImpl::request(Fresco::Graphic::Requisition &r)
{
cache_requisition();
- GraphicImpl::require(r.x, _requisition.x.natural, 0.,
- _requisition.x.natural, _requisition.x.align);
- GraphicImpl::require(r.y, _requisition.y.natural, 0.,
- _requisition.y.natural, _requisition.y.align);
- if(_requisition.z.defined)
- GraphicImpl::require(r.z, _requisition.z.natural, 0.,
- _requisition.z.natural, _requisition.z.align);
+ GraphicImpl::require(r.x, my_requisition.x.natural, 0.,
+ my_requisition.x.natural,
+ my_requisition.x.align);
+ GraphicImpl::require(r.y, my_requisition.y.natural, 0.,
+ my_requisition.y.natural,
+ my_requisition.y.align);
+ if(my_requisition.z.defined)
+ GraphicImpl::require(r.z, my_requisition.z.natural, 0.,
+ my_requisition.z.natural,
+ my_requisition.z.align);
}
void ViewportImpl::traverse(Traversal_ptr traversal)
@@ -333,9 +353,7 @@
Graphic_var child = body();
if (!CORBA::is_nil(child) && traversal->intersects_allocation())
{
- /*
- * first update the cached allocation and the adjustments
- */
+ // first update the cached allocation and the adjustments
Region_var allocation = traversal->current_allocation();
cache_allocation(allocation);
traversal->visit(Graphic_var(_this()));
@@ -366,19 +384,23 @@
body_allocation(allocation, b);
region->copy(Region_var(b->_this()));
- Lease_var<TransformImpl> transform(Provider<TransformImpl>::provide());
+ Lease_var<TransformImpl>
+ transform(Provider<TransformImpl>::provide());
transform->load_identity();
region->normalize(Transform_var(transform->_this()));
try
{
- traversal->traverse_child(_child.peer, _child.localId,
+ traversal->traverse_child(my_child.peer, my_child.localId,
Region_var(region->_this()),
Transform_var(transform->_this()));
}
- catch (const CORBA::OBJECT_NOT_EXIST &) { body(Fresco::Graphic::_nil()); }
- catch (const CORBA::COMM_FAILURE &) { body(Fresco::Graphic::_nil()); }
- catch (const CORBA::TRANSIENT &) { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::COMM_FAILURE &)
+ { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::TRANSIENT &)
+ { body(Fresco::Graphic::_nil()); }
drawing->restore();
}
@@ -394,27 +416,29 @@
body_allocation(allocation, b);
region->copy(Region_var(b->_this()));
- Lease_var<TransformImpl> transform(Provider<TransformImpl>::provide());
+ Lease_var<TransformImpl>
+ transform(Provider<TransformImpl>::provide());
transform->load_identity();
region->normalize(Transform_var(transform->_this()));
try
{
- traversal->traverse_child (_child.peer, _child.localId,
+ traversal->traverse_child (my_child.peer, my_child.localId,
Region_var(region->_this()),
Transform_var(transform->_this()));
}
- catch (const CORBA::OBJECT_NOT_EXIST &) { body(Fresco::Graphic::_nil()); }
- catch (const CORBA::COMM_FAILURE &) { body(Fresco::Graphic::_nil()); }
- catch (const CORBA::TRANSIENT &) { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::OBJECT_NOT_EXIST &)
+ { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::COMM_FAILURE &)
+ { body(Fresco::Graphic::_nil()); }
+ catch (const CORBA::TRANSIENT &)
+ { body(Fresco::Graphic::_nil()); }
}
void ViewportImpl::need_resize()
{
- /*
- * set adjustment's outer range according to the body size
- */
- _requested = false;
+ // set adjustment's outer range according to the body size
+ my_requested = false;
cache_requisition();
need_redraw();
}
@@ -422,21 +446,21 @@
void ViewportImpl::update(const CORBA::Any &)
{
/*
- * we are only interested in changes concerning the outer range (body)
- * or the offset
+ * we are only interested in changes concerning the outer range
+ * (body) or the offset
*/
- Fresco::BoundedRange::Settings x = _xadjustment->state();
- Fresco::BoundedRange::Settings y = _yadjustment->state();
- bool damage = (x.lower != _settings[xaxis].lower ||
- y.lower != _settings[yaxis].lower ||
- x.upper != _settings[xaxis].upper ||
- y.upper != _settings[yaxis].upper ||
- x.lvalue != _settings[xaxis].lvalue ||
- y.lvalue != _settings[yaxis].lvalue);
- _settings[xaxis].lvalue = x.lvalue;
- _settings[xaxis].uvalue = x.uvalue;
- _settings[yaxis].lvalue = y.lvalue;
- _settings[yaxis].uvalue = y.uvalue;
+ Fresco::BoundedRange::Settings x = my_xadjustment->state();
+ Fresco::BoundedRange::Settings y = my_yadjustment->state();
+ bool damage = (x.lower != my_settings[xaxis].lower ||
+ y.lower != my_settings[yaxis].lower ||
+ x.upper != my_settings[xaxis].upper ||
+ y.upper != my_settings[yaxis].upper ||
+ x.lvalue != my_settings[xaxis].lvalue ||
+ y.lvalue != my_settings[yaxis].lvalue);
+ my_settings[xaxis].lvalue = x.lvalue;
+ my_settings[xaxis].uvalue = x.uvalue;
+ my_settings[yaxis].lvalue = y.lvalue;
+ my_settings[yaxis].uvalue = y.uvalue;
if (damage) need_redraw();
}
@@ -444,12 +468,16 @@
{
Adjustment *adjustment = new Adjustment;
activate(adjustment);
- _xadjustment = RefCount_var<BoundedRange>::increment(adjustment->_this(), false);
- _xadjustment->attach(Observer_var(_this()));
+ my_xadjustment =
+ RefCount_var<BoundedRange>::increment(adjustment->_this(),
+ false);
+ my_xadjustment->attach(Observer_var(_this()));
adjustment = new Adjustment;
activate(adjustment);
- _yadjustment = RefCount_var<BoundedRange>::increment(adjustment->_this(), false);
- _yadjustment->attach(Observer_var(_this()));
+ my_yadjustment =
+ RefCount_var<BoundedRange>::increment(adjustment->_this(),
+ false);
+ my_yadjustment->attach(Observer_var(_this()));
}
void ViewportImpl::allocate_child(Allocation::Info &info)
@@ -467,37 +495,38 @@
// FIXME: What about the zaxis? I know... it is not really useful
// but it is allowed for input and should not just return
// the value for the yaxis. -- tobias
- return a == xaxis ? RefCount_var<BoundedRange>::increment(_xadjustment) :
- RefCount_var<BoundedRange>::increment(_yadjustment);
+ return a == xaxis ?
+ RefCount_var<BoundedRange>::increment(my_xadjustment) :
+ RefCount_var<BoundedRange>::increment(my_yadjustment);
}
void ViewportImpl::cache_requisition()
//. retrieves requisition from body and updates adjustments
{
- if (!_requested)
+ if (!my_requested)
{
- _requested = true;
- MonoGraphic::request(_requisition);
- Fresco::Graphic::Requirement &rx = _requisition.x;
- Fresco::Graphic::Requirement &ry = _requisition.y;
+ my_requested = true;
+ MonoGraphic::request(my_requisition);
+ Fresco::Graphic::Requirement &rx = my_requisition.x;
+ Fresco::Graphic::Requirement &ry = my_requisition.y;
- _settings[xaxis].lvalue = _settings[xaxis].lower =
+ my_settings[xaxis].lvalue = my_settings[xaxis].lower =
rx.defined ? - rx.natural * rx.align : 0.;
- _settings[xaxis].uvalue = _settings[xaxis].upper =
- rx.defined ? _settings[xaxis].lvalue + rx.natural : 0.;
+ my_settings[xaxis].uvalue = my_settings[xaxis].upper =
+ rx.defined ? my_settings[xaxis].lvalue + rx.natural : 0.;
if (rx.defined)
{
- _xadjustment->lower(_settings[xaxis].lower);
- _xadjustment->upper(_settings[xaxis].upper);
+ my_xadjustment->lower(my_settings[xaxis].lower);
+ my_xadjustment->upper(my_settings[xaxis].upper);
}
- _settings[yaxis].lvalue = _settings[yaxis].lower =
+ my_settings[yaxis].lvalue = my_settings[yaxis].lower =
ry.defined ? - ry.natural * ry.align : 0.;
- _settings[yaxis].uvalue = _settings[yaxis].upper =
- ry.defined ? _settings[yaxis].lvalue + ry.natural : 0.;
+ my_settings[yaxis].uvalue = my_settings[yaxis].upper =
+ ry.defined ? my_settings[yaxis].lvalue + ry.natural : 0.;
if (ry.defined)
{
- _yadjustment->lower(_settings[yaxis].lower);
- _yadjustment->upper(_settings[yaxis].upper);
+ my_yadjustment->lower(my_settings[yaxis].lower);
+ my_yadjustment->upper(my_settings[yaxis].upper);
}
}
}
@@ -510,19 +539,22 @@
allocation->span(xaxis, xa);
allocation->span(yaxis, ya);
- if (! Math::equal(xa.end - xa.begin,
- _settings[xaxis].uvalue - _settings[xaxis].lvalue,
- epsilon))
+ if (!Math::equal(xa.end - xa.begin,
+ my_settings[xaxis].uvalue -
+ my_settings[xaxis].lvalue,
+ epsilon))
{
- _settings[xaxis].uvalue = _settings[xaxis].lvalue + xa.end - xa.begin;
- _xadjustment->uvalue(_settings[xaxis].uvalue);
+ my_settings[xaxis].uvalue =
+ my_settings[xaxis].lvalue + xa.end - xa.begin;
+ my_xadjustment->uvalue(my_settings[xaxis].uvalue);
}
- if (! Math::equal(ya.end - ya.begin,
- _settings[yaxis].uvalue - _settings[yaxis].lvalue,
- epsilon))
+ if (!Math::equal(ya.end - ya.begin,
+ my_settings[yaxis].uvalue -
+ my_settings[yaxis].lvalue,
+ epsilon))
{
- _settings[yaxis].uvalue = ya.end - ya.begin;
- _yadjustment->uvalue(_settings[yaxis].uvalue);
+ my_settings[yaxis].uvalue = ya.end - ya.begin;
+ my_yadjustment->uvalue(my_settings[yaxis].uvalue);
}
}
}
@@ -530,14 +562,19 @@
void ViewportImpl::body_allocation(Region_ptr, RegionImpl *ca)
{
/*
- * FIXME!! : this implementation ignores completely the body alignment...
+ * FIXME!! : this implementation ignores completely the body
+ * alignment...
*/
ca->valid = true;
- ca->lower.x = -(_settings[xaxis].lvalue - _settings[xaxis].lower);
- ca->lower.y = -(_settings[yaxis].lvalue - _settings[yaxis].lower);
+ ca->lower.x = -(my_settings[xaxis].lvalue -
+ my_settings[xaxis].lower);
+ ca->lower.y = -(my_settings[yaxis].lvalue -
+ my_settings[yaxis].lower);
ca->lower.z = 0.;
- ca->upper.x = -(_settings[xaxis].lvalue - _settings[xaxis].upper);
- ca->upper.y = -(_settings[yaxis].lvalue - _settings[yaxis].upper);
+ ca->upper.x = -(my_settings[xaxis].lvalue -
+ my_settings[xaxis].upper);
+ ca->upper.y = -(my_settings[yaxis].lvalue -
+ my_settings[yaxis].upper);
ca->upper.z = 0.;
ca->xalign = ca->yalign = ca->yalign = 0.;
}
@@ -545,8 +582,8 @@
void ViewportImpl::scroll_transform(Transform_ptr tx)
{
Vertex v;
- v.x = _settings[xaxis].lvalue - _settings[xaxis].lower;
- v.y = _settings[yaxis].lvalue - _settings[yaxis].lower;
+ v.x = my_settings[xaxis].lvalue - my_settings[xaxis].lower;
+ v.y = my_settings[yaxis].lvalue - my_settings[yaxis].lower;
v.z = 0.;
tx->translate(v);
}
Index: ViewportImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/ViewportImpl.hh,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- ViewportImpl.hh 27 Oct 2003 17:08:38 -0000 1.19
+++ ViewportImpl.hh 29 Dec 2003 08:03:29 -0000 1.20
@@ -45,7 +45,7 @@
~ViewportImpl();
virtual void body(Fresco::Graphic_ptr);
virtual Fresco::Graphic_ptr body() { return MonoGraphic::body();}
-
+
virtual Fresco::Transform_ptr transformation();
virtual void request(Fresco::Graphic::Requisition &);
@@ -69,11 +69,11 @@
void body_allocation(Fresco::Region_ptr, RegionImpl *);
void scroll_transform(Fresco::Transform_ptr);
- Fresco::BoundedRange::Settings _settings[2];
- RefCount_var<Fresco::BoundedRange> _xadjustment;
- RefCount_var<Fresco::BoundedRange> _yadjustment;
- bool _requested;
- Fresco::Graphic::Requisition _requisition;
+ Fresco::BoundedRange::Settings my_settings[2];
+ RefCount_var<Fresco::BoundedRange> my_xadjustment;
+ RefCount_var<Fresco::BoundedRange> my_yadjustment;
+ bool my_requested;
+ Fresco::Graphic::Requisition my_requisition;
};
} // namespace