Fresco/Berlin/modules/Layout LayoutKitImpl.cc,1.31,1.32 StageImpl.cc,1.52,1.53 StageImpl.hh,1.25,1.26
Tobias Hunger <[email protected]>
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Layout
In directory purcel:/tmp/cvs-serv1225/Berlin/modules/Layout
Modified Files:
LayoutKitImpl.cc StageImpl.cc StageImpl.hh
Log Message:
Initial checkin of a scene graph debugging framework.
To activate run the server with the -D option (and -l if you want to
see the log output of course). To get a dot-file of the current
scene graph send a USR1 signal to the server process. It will then
dump the graph into /tmp/debug.dot. Use graphviz's dot-tool to turn that
file into a PS-drawing of the scene graph (cat /tmp/debug.dot | dot -Tps).
TODO: * add more information to the output (transformation, allocation, etc.)
* make sure all graphics get registered. We have a couple of "unknowns"
in the dump as of now.
Index: LayoutKitImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/LayoutKitImpl.cc,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- LayoutKitImpl.cc 18 Feb 2003 07:26:32 -0000 1.31
+++ LayoutKitImpl.cc 26 Feb 2003 00:19:06 -0000 1.32
@@ -94,7 +94,8 @@
Viewport_ptr LayoutKitImpl::scrollable(Graphic_ptr g)
{
- return create_and_set_body<Viewport>(new ViewportImpl, g);
+ return create_and_set_body<Viewport>(new ViewportImpl, g,
+ "LayoutKit/scrollable");
}
// Layout::Splitter_ptr LayoutKitImpl::splitter(Graphic_ptr g, Graphic_ptr p, Axis a)
@@ -107,74 +108,81 @@
Stage_ptr LayoutKitImpl::create_stage()
{
- return create<Stage>(new StageImpl);
+ return create<Stage>(new StageImpl, "LayoutKit/create_stage");
}
Grid_ptr LayoutKitImpl::fixed_grid(const Grid::Index &upper)
{
- return create<Grid>(new GridImpl(upper));
+ return create<Grid>(new GridImpl(upper), "LayoutKit/fixed_grid");
}
Graphic_ptr LayoutKitImpl::fixed_range(Grid_ptr g, const Grid::Range &r)
{
- return create<Graphic>(new SubGridImpl(g, r));
+ return create<Graphic>(new SubGridImpl(g, r), "LayoutKit/fixed_range");
}
Graphic_ptr LayoutKitImpl::hbox()
{
- return create<Graphic>(new HBox);
+ return create<Graphic>(new HBox, "LayoutKit/hbox");
}
Graphic_ptr LayoutKitImpl::vbox()
{
- return create<Graphic>(new VBox);
+ return create<Graphic>(new VBox, "LayoutKit/vbox");
}
Graphic_ptr LayoutKitImpl::hbox_first_aligned()
{
- return create<Graphic>(new HBoxFirstAligned);
+ return create<Graphic>(new HBoxFirstAligned,
+ "LayoutKit/hbox_first_alligned");
}
Graphic_ptr LayoutKitImpl::vbox_first_aligned()
{
- return create<Graphic>(new VBoxFirstAligned);
+ return create<Graphic>(new VBoxFirstAligned,
+ "LayoutKit/vbox_first_alligned");
}
Graphic_ptr LayoutKitImpl::hbox_align_elements(Alignment align)
{
- return create<Graphic>(new HBoxAlignElements(align));
+ return create<Graphic>(new HBoxAlignElements(align),
+ "LayoutKit/hbox_align_elements");
}
Graphic_ptr LayoutKitImpl::vbox_align_elements(Alignment align)
{
- return create<Graphic>(new VBoxAlignElements(align));
+ return create<Graphic>(new VBoxAlignElements(align),
+ "LayoutKit/vbox_align_elements");
}
Graphic_ptr LayoutKitImpl::overlay()
{
- return create<Graphic>(new Overlay);
+ return create<Graphic>(new Overlay, "LayoutKit/overlay");
}
Graphic_ptr LayoutKitImpl::deck()
{
- return create<Graphic>(new Deck);
+ return create<Graphic>(new Deck, "LayoutKit/deck");
}
Graphic_ptr LayoutKitImpl::back(Graphic_ptr g, Graphic_ptr under)
{
- return create<Graphic>(new LayoutLayer(g, under, 0));
+ return create<Graphic>(new LayoutLayer(g, under, 0),
+ "LayoutKit/back");
}
Graphic_ptr LayoutKitImpl::front(Graphic_ptr g, Graphic_ptr over)
{
- return create<Graphic>(new LayoutLayer(g, 0, over));
+ return create<Graphic>(new LayoutLayer(g, 0, over),
+ "LayoutKit/front");
}
Graphic_ptr
LayoutKitImpl::between(Graphic_ptr g, Graphic_ptr under, Graphic_ptr over)
{
- return create<Graphic>(new LayoutLayer(g, under, over));
+ return create<Graphic>(new LayoutLayer(g, under, over),
+ "LayoutKit/between");
}
Graphic_ptr
@@ -182,86 +190,101 @@
Coord natural, Coord stretch, Coord shrink,
Alignment align)
{
- return create<Graphic>(new Glue(a, natural, stretch, shrink, align));
+ return create<Graphic>(new Glue(a, natural, stretch, shrink, align),
+ "LayoutKit/glue");
}
Graphic_ptr LayoutKitImpl::glue_requisition(const Graphic::Requisition &r)
{
- return create<Graphic>(new Glue(r));
+ return create<Graphic>(new Glue(r),
+ "LayoutKit/glue_requisition");
}
Graphic_ptr LayoutKitImpl::hfill()
{
- return create<Graphic>(new Glue(xaxis, 0., my_fill, 0., 0.));
+ return create<Graphic>(new Glue(xaxis, 0., my_fill, 0., 0.),
+ "LayoutKit/hfill");
}
Graphic_ptr LayoutKitImpl::hglue_fill(Coord natural)
{
- return create<Graphic>(new Glue(xaxis, natural, my_fill, 0., 0.));
+ return create<Graphic>(new Glue(xaxis, natural, my_fill, 0., 0.),
+ "LayoutKit/hglue_fill");
}
Graphic_ptr LayoutKitImpl::hglue(Coord natural,
Coord stretch,
Coord shrink)
{
- return create<Graphic>(new Glue(xaxis, natural, stretch, shrink, 0.));
+ return create<Graphic>(new Glue(xaxis, natural, stretch, shrink, 0.),
+ "LayoutKit/hglue");
}
Graphic_ptr
LayoutKitImpl::hglue_aligned(Coord natural, Coord stretch, Coord shrink,
Alignment a)
{
- return create<Graphic>(new Glue(xaxis, natural, stretch, shrink, a));
+ return create<Graphic>(new Glue(xaxis, natural, stretch, shrink, a),
+ "LayoutKit/hglue_aligned");
}
Graphic_ptr LayoutKitImpl::hspace(Coord natural)
{
- return create<Graphic>(new Glue(xaxis, natural, 0., 0., 0.));
+ return create<Graphic>(new Glue(xaxis, natural, 0., 0., 0.),
+ "LayoutKit/hspace");
}
Graphic_ptr LayoutKitImpl::vfill()
{
- return create<Graphic>(new Glue(yaxis, 0., my_fill, 0., 0.));
+ return create<Graphic>(new Glue(yaxis, 0., my_fill, 0., 0.),
+ "LayoutKit/vfill");
}
Graphic_ptr LayoutKitImpl::vglue_fill(Coord natural)
{
- return create<Graphic>(new Glue(yaxis, natural, my_fill, 0., 0.));
+ return create<Graphic>(new Glue(yaxis, natural, my_fill, 0., 0.),
+ "LayoutKit/vglue_fill");
}
Graphic_ptr LayoutKitImpl::vglue(Coord natural,
Coord stretch,
Coord shrink)
{
- return create<Graphic>(new Glue(yaxis, natural, stretch, shrink, 0.));
+ return create<Graphic>(new Glue(yaxis, natural, stretch, shrink, 0.),
+ "LayoutKit/vglue");
}
Graphic_ptr
LayoutKitImpl::vglue_aligned(Coord natural, Coord stretch, Coord shrink,
Alignment a)
{
- return create<Graphic>(new Glue(yaxis, natural, stretch, shrink, a));
+ return create<Graphic>(new Glue(yaxis, natural, stretch, shrink, a),
+ "LayoutKit/vglue_aligned");
}
Graphic_ptr LayoutKitImpl::vspace(Coord natural)
{
- return create<Graphic>(new Glue(yaxis, natural, 0., 0., 0.));
+ return create<Graphic>(new Glue(yaxis, natural, 0., 0., 0.),
+ "LayoutKit/vspace");
}
Graphic_ptr LayoutKitImpl::shape_of(Graphic_ptr g)
{
- return create<Graphic>(new ShapeOf(g, 0, 0));
+ return create<Graphic>(new ShapeOf(g, 0, 0),
+ "LayoutKit/shape_of");
}
Graphic_ptr LayoutKitImpl::shape_of_xy(Graphic_ptr gx, Graphic_ptr gy)
{
- return create<Graphic>(new ShapeOf(gx, gy, 0));
+ return create<Graphic>(new ShapeOf(gx, gy, 0),
+ "LayoutKit/shape_of_xy");
}
Graphic_ptr
LayoutKitImpl::shape_of_xyz(Graphic_ptr gx, Graphic_ptr gy, Graphic_ptr gz)
{
- return create<Graphic>(new ShapeOf(gx, gy, gz));
+ return create<Graphic>(new ShapeOf(gx, gy, gz),
+ "LayoutKit/shape_of_xyz");
}
// Graphic_ptr LayoutKitImpl::strut(Font_ptr f, Coord natural, Coord stretch, Coord shrink)
@@ -290,13 +313,14 @@
new LayoutSuperpose(
new LayoutCenter(xaxis, x),
new LayoutCenter(yaxis, y))),
- g);
+ g, "LayoutKit/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);
+ new LayoutCenter(a, align)), g,
+ "LayoutKit/align_axis");
}
Graphic_ptr LayoutKitImpl::halign(Graphic_ptr g, Alignment x)
@@ -315,13 +339,14 @@
new LayoutSuperpose(
new LayoutFixed(xaxis, x),
new LayoutFixed(yaxis, y))),
- g);
+ g, "LayoutKit/fixed_size");
}
Graphic_ptr LayoutKitImpl::fixed_axis(Graphic_ptr g, Axis a, Coord size)
{
return create_and_set_body<Graphic>(new Placement(
- new LayoutFixed(a, size)), g);
+ new LayoutFixed(a, size)), g,
+ "LayoutKit/fixed_axis");
}
Graphic_ptr LayoutKitImpl::hfixed(Graphic_ptr g, Coord x)
@@ -342,7 +367,7 @@
new Placement(new LayoutSuperpose(
new LayoutVariable(xaxis, stretch, shrink),
new LayoutVariable(yaxis, stretch, shrink))),
- g);
+ g, "LayoutKit/flexible");
}
Graphic_ptr LayoutKitImpl::flexible_fill(Graphic_ptr g)
@@ -357,7 +382,8 @@
return create_and_set_body<Graphic>(new Placement(
new LayoutVariable(a,
stretch,
- shrink)), g);
+ shrink)), g,
+ "LayoutKit/flexible_axis");
}
Graphic_ptr
@@ -378,13 +404,14 @@
new LayoutSuperpose(
new LayoutNatural(xaxis, x),
new LayoutNatural(yaxis, y))),
- g);
+ g, "LayoutKit/natural");
}
Graphic_ptr LayoutKitImpl::natural_axis(Graphic_ptr g, Axis a, Coord size)
{
return create_and_set_body<Graphic>(new Placement(
- new LayoutNatural(a, size)), g);
+ new LayoutNatural(a, size)), g,
+ "LayoutKit/natural_axis");
}
Graphic_ptr LayoutKitImpl::hnatural(Graphic_ptr g, Coord x)
@@ -400,7 +427,8 @@
Graphic_ptr LayoutKitImpl::margin(Graphic_ptr g, Coord all)
{
return create_and_set_body<Graphic>(new Placement(
- new LayoutMargin(all)), g);
+ new LayoutMargin(all)), g,
+ "LayoutKit/margin");
}
Graphic_ptr
@@ -412,7 +440,8 @@
new LayoutMargin(margin, stretch, shrink,
margin, stretch, shrink,
margin, stretch, shrink,
- margin, stretch, shrink)), g);
+ margin, stretch, shrink)), g,
+ "LayoutKit/margin_flexible");
}
Graphic_ptr
@@ -422,7 +451,8 @@
{
return create_and_set_body<Graphic>(
new Placement(new LayoutMargin(lmargin, rmargin,
- bmargin, tmargin)), g);
+ bmargin, tmargin)), g,
+ "LayoutKit/margin_lrtb");
}
Graphic_ptr
@@ -440,7 +470,8 @@
new Placement(new LayoutMargin(lmargin, lstretch, lshrink,
rmargin, rstretch, rshrink,
tmargin, tstretch, tshrink,
- bmargin, bstretch, bshrink)), g);
+ bmargin, bstretch, bshrink)), g,
+ "LayoutKit/margin_lrtb_flexible");
}
Graphic_ptr LayoutKitImpl::hmargin(Graphic_ptr g, Coord both)
Index: StageImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/StageImpl.cc,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- StageImpl.cc 5 Jan 2003 16:21:33 -0000 1.52
+++ StageImpl.cc 26 Feb 2003 00:19:06 -0000 1.53
@@ -30,6 +30,7 @@
#include <Berlin/DebugGraphic.hh>
#include <Berlin/QuadTree.hh>
#include <Berlin/Math.hh>
+#include <Berlin/RefCountVar.hh>
#include "StageImpl.hh"
#include <list>
@@ -511,6 +512,42 @@
}
}
+
+class StageImpl::Iterator : public virtual POA_Fresco::GraphicIterator,
+ public virtual GraphicIteratorImpl
+{
+public:
+ Iterator(StageImpl *p, Tag c) :
+ my_parent(p),
+ my_cursor(c)
+ {
+ my_parent->_add_ref();
+ }
+ virtual ~Iterator() { my_parent->_remove_ref();}
+
+ virtual Fresco::Graphic_ptr child()
+ {
+ Prague::Guard<Mutex> guard(my_parent->_mutex);
+ if (my_cursor >= my_parent->_children->size())
+ return Fresco::Graphic::_nil();
+ return RefCount_var<Fresco::Graphic>::increment(
+ my_parent->_children->find(my_cursor)->child());
+ }
+ virtual void next() { my_cursor++;}
+ virtual void prev() { my_cursor--;}
+ virtual void insert(Graphic_ptr child)
+ { }
+ virtual void replace(Graphic_ptr child)
+ { }
+
+ virtual void remove()
+ { }
+private:
+ StageImpl * my_parent;
+ CORBA::ULong my_cursor;
+};
+
+
StageImpl::StageImpl()
: _children(new Sequence),
_tree(new QuadTree),
@@ -526,6 +563,21 @@
{
delete _tree;
delete _children;
+}
+
+Fresco::GraphicIterator_ptr StageImpl::first_child_graphic()
+{
+ Iterator *iterator = new Iterator(this, 0);
+ activate(iterator);
+ return iterator->_this();
+}
+
+Fresco::GraphicIterator_ptr StageImpl::last_child_graphic()
+{
+ Iterator *iterator =
+ new Iterator(this, _children->size() ? _children->size() - 1 : 0);
+ activate(iterator);
+ return iterator->_this();
}
void StageImpl::request(Fresco::Graphic::Requisition &r)
Index: StageImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Layout/StageImpl.hh,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- StageImpl.hh 5 Jan 2003 16:21:33 -0000 1.25
+++ StageImpl.hh 26 Feb 2003 00:19:07 -0000 1.26
@@ -39,11 +39,17 @@
class StageImpl : public virtual POA_Layout::Stage,
public GraphicImpl
{
+ class Iterator;
+ friend class Iterator;
+
class Sequence;
class QuadTree;
public:
StageImpl();
~StageImpl();
+
+ Fresco::GraphicIterator_ptr first_child_graphic();
+ Fresco::GraphicIterator_ptr last_child_graphic();
virtual void request(Fresco::Graphic::Requisition &);