$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: stipe_at_[hidden]
Date: 2008-08-01 02:42:35
Author: srajko
Date: 2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
New Revision: 47926
URL: http://svn.boost.org/trac/boost/changeset/47926
Log:
reorganized vtk, updated glv
Added:
   sandbox/SOC/2007/signals/boost/dataflow/vtk/support.hpp
      - copied, changed from r47744, /sandbox/SOC/2007/signals/libs/dataflow/example/VTK/vtk_dataflow_support.hpp
   sandbox/SOC/2007/signals/libs/glv/include/glv_buttons.h   (contents, props changed)
   sandbox/SOC/2007/signals/libs/glv/include/glv_pimpl_binding.h   (contents, props changed)
   sandbox/SOC/2007/signals/libs/glv/include/glv_widget.h   (contents, props changed)
   sandbox/SOC/2007/signals/libs/glv/src/glv_buttons.cpp   (contents, props changed)
   sandbox/SOC/2007/signals/libs/glv/src/glv_pimpl_binding.cpp   (contents, props changed)
   sandbox/SOC/2007/signals/libs/glv/src/glv_pimpl_binding_glut.cpp   (contents, props changed)
Removed:
   sandbox/SOC/2007/signals/libs/dataflow/example/VTK/vtk_dataflow_support.hpp
Text files modified: 
   sandbox/SOC/2007/signals/boost/dataflow/blueprint/binary_operation.hpp                   |     2                                         
   sandbox/SOC/2007/signals/boost/dataflow/blueprint/component.hpp                          |    46 +++                                     
   sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp                             |    11                                         
   sandbox/SOC/2007/signals/boost/dataflow/vtk/support.hpp                                  |    78 +++++-                                  
   sandbox/SOC/2007/signals/boost/functional/factory.hpp                                    |     4                                         
   sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj |    25 +                                       
   sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk                                  |     2                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone.cxx                              |     2                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone2.cxx                             |     2                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Jamfile.v2                            |    34 --                                      
   sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/Jamfile.v2                        |    11                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_bank.hpp                |     2                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_window.hpp              |     2                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_example.cpp                |    14                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_graph.cpp                  |     2                                         
   sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_logic.cpp                  |     7                                         
   sandbox/SOC/2007/signals/libs/glv/Jamfile                                                |    15                                         
   sandbox/SOC/2007/signals/libs/glv/include/glv.h                                          |     3                                         
   sandbox/SOC/2007/signals/libs/glv/include/glv_abstract_binding.h                         |    27 +                                       
   sandbox/SOC/2007/signals/libs/glv/include/glv_binding_carbon.h                           |     2                                         
   sandbox/SOC/2007/signals/libs/glv/include/glv_binding_glut.h                             |     5                                         
   sandbox/SOC/2007/signals/libs/glv/include/glv_conf.h                                     |     4                                         
   sandbox/SOC/2007/signals/libs/glv/include/glv_core.h                                     |   157 ++++--------                            
   sandbox/SOC/2007/signals/libs/glv/include/glv_draw.h                                     |    89 +++++-                                  
   sandbox/SOC/2007/signals/libs/glv/include/glv_rect.h                                     |     9                                         
   sandbox/SOC/2007/signals/libs/glv/include/glv_sliders.h                                  |   487 +++++++++++++++++++++++---------------- 
   sandbox/SOC/2007/signals/libs/glv/include/glv_texture.h                                  |    41 ++                                      
   sandbox/SOC/2007/signals/libs/glv/include/glv_textview.h                                 |   143 +++++++++++                             
   sandbox/SOC/2007/signals/libs/glv/include/glv_util.h                                     |   239 +++++++++++++++++++                     
   sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp                           |    12                                         
   sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp                             |     2                                         
   sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp                               |    38 ++                                      
   sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp                                       |     7                                         
   sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp                                        |    35 ++                                      
   sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp                                    |   333 +++++++++++++++++++-------              
   sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp                                    |    47 +++                                     
   sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp                                   |    10                                         
   sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp                                       |    30 +-                                      
   sandbox/SOC/2007/signals/libs/vtk/Jamfile                                                |    44 +++                                     
   39 files changed, 1463 insertions(+), 560 deletions(-)
Modified: sandbox/SOC/2007/signals/boost/dataflow/blueprint/binary_operation.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/blueprint/binary_operation.hpp	(original)
+++ sandbox/SOC/2007/signals/boost/dataflow/blueprint/binary_operation.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -33,7 +33,7 @@
 
     if (right.is_complemented_port())
     {
-        port &resolved_left = left.resolve_key(left);
+        port &resolved_left = left.resolve_key(right);
         
         return right.as<complemented_port>().template is_operable_complement_to_port<Operation>()
             && (right.as<complemented_port>().complement_type_info()
Modified: sandbox/SOC/2007/signals/boost/dataflow/blueprint/component.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/blueprint/component.hpp	(original)
+++ sandbox/SOC/2007/signals/boost/dataflow/blueprint/component.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -14,6 +14,8 @@
 #include <boost/mpl/size.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
 
 
 namespace boost { namespace dataflow { namespace blueprint {
@@ -63,10 +65,42 @@
     };
 }
 
+template<typename T, typename Enable=void>
+struct underlying_component_type
+{
+    typedef T type;
+};
+
+template<typename T>
+struct underlying_component_type<T,
+    typename dataflow::utility::enable_if_type<typename T::element_type>::type >
+{
+    typedef typename T::element_type type;
+};
+
+template<typename T, typename Enable=void>
+struct get_underlying_component
+{
+    T &operator()(T &t) const
+    {
+        return t;
+    }
+};
+
+template<typename T>
+struct get_underlying_component<T, typename dataflow::utility::enable_if_type<typename T::element_type>::type >
+{
+    typename T::element_type &operator()(T &t) const
+    {
+        return *t;
+    }
+};
+
 template<typename Component, typename Tag=default_tag>
-class component_t : public based_component<typename runtime_base_class<Component>::type>
+class component_t : public based_component<typename runtime_base_class<typename underlying_component_type<Component>::type>::type>
 {
-    typedef typename runtime_base_class<Component>::type runtime_base_class_type;
+    typedef typename underlying_component_type<Component>::type component_type;
+    typedef typename runtime_base_class<component_type>::type runtime_base_class_type;
 public:
     component_t() {component_t_();}
     template<typename T0>
@@ -78,15 +112,15 @@
     
     void invoke()
     {
-        detail::try_invoke<Component, Tag>()(c);
+        detail::try_invoke<component_type, Tag>()(get_underlying_component<Component>()(c));
     }
     virtual bool is_invocable()
     {
-        return is_component_operable<Component, operations::invoke, Tag>::type::value;
+        return is_component_operable<component_type, operations::invoke, Tag>::type::value;
     };
     size_t num_ports() const
     {
-        return mpl::size<typename traits_of<Component, Tag>::type::ports>::value;
+        return mpl::size<typename traits_of<component_type, Tag>::type::ports>::value;
     }
     port & get_port(int port_num)
     {
@@ -103,7 +137,7 @@
     void component_t_()
     {
         for(size_t i=0; i<num_ports(); i++)
-            ports.push_back(blueprint::get_port<Tag>(c, i));
+            ports.push_back(blueprint::get_port<Tag>(get_underlying_component<Component>()(c), i));
     }
     Component c;
     ptr_vector<port> ports;
Modified: sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp	(original)
+++ sandbox/SOC/2007/signals/boost/dataflow/blueprint/port_t.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -139,6 +139,17 @@
     };
     virtual bool is_operable_complement_to_port(int operation_uuid)
     {
+        typedef port_type right_type;
+        typedef typename port_traits_type::complement_port_type left_type;
+        
+        if(operation_uuid == runtime::property<operations::connect, int>()())
+            return dataflow::are_binary_operable<
+                left_type, right_type, operations::connect, Tag>::type::value; 
+
+        if(operation_uuid == runtime::property<operations::extract, int>()())
+            return dataflow::are_binary_operable<
+                left_type, right_type, operations::extract, Tag>::type::value;
+
         return false;
     }
 
Copied: sandbox/SOC/2007/signals/boost/dataflow/vtk/support.hpp (from r47744, /sandbox/SOC/2007/signals/libs/dataflow/example/VTK/vtk_dataflow_support.hpp)
==============================================================================
--- /sandbox/SOC/2007/signals/libs/dataflow/example/VTK/vtk_dataflow_support.hpp	(original)
+++ sandbox/SOC/2007/signals/boost/dataflow/vtk/support.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -9,6 +9,8 @@
 #include "vtkAlgorithmOutput.h"
 #include "vtkActor.h"
 #include "vtkAlgorithm.h"
+#include "vtkMapper.h"
+#include "vtkRenderer.h"
 #include "vtkRenderWindow.h"
 
 #include <boost/dataflow/support.hpp>
@@ -36,11 +38,14 @@
 //[  vtk_algorithm_output_producer
 namespace boost { namespace dataflow { namespace vtk {
 
+struct vtk_algorithm_consumer;
+
 // PortTraits for vtkAlgorithmOutput objects, which produce data.
 // We specify the PortCategory (ports::producer) and Tag (vtk::tag).
 
 struct vtk_algorithm_output_producer
-    : public port_traits<ports::producer, tag> {};
+    : public complemented_port_traits<ports::producer,
+        port_adapter<vtkAlgorithm, vtk::vtk_algorithm_consumer, vtk::tag>, tag> {};
     
 } } } // namespace boost::dataflow::vtk
 
@@ -99,7 +104,7 @@
         get_object(consumer).SetInputConnection(&get_object(producer));
     }
 };
-    
+
 } } } // namespace boost::dataflow::vtk
 
 //]
@@ -119,6 +124,12 @@
                     <dataflow::args::right>,
                     mpl::int_<1> >
             >::type default_map;
+            
+    typedef mpl::map<
+                mpl::pair<dataflow::default_port_selector
+                    <dataflow::args::right>,
+                    mpl::int_<0> >
+            >::type consumer_only_map;
 
 }
 
@@ -158,20 +169,25 @@
 
 namespace boost { namespace dataflow { namespace vtk {
 
+struct vtk_renderer_consumer;
+
 struct vtk_actor_producer
-    : public port_traits<ports::producer, tag>
+    : public complemented_port_traits<ports::producer,
+        dataflow::port_adapter<vtkRenderer, vtk_renderer_consumer, tag>, tag>
 {};
 
+struct vtk_mapper_producer;
+
 struct vtk_actor_consumer
-    : public port_traits<ports::consumer, tag>
+    : public complemented_port_traits<ports::consumer,
+        port_adapter<vtkMapper, vtk_mapper_producer, tag>, tag>
 {};
 
-template<typename T>
 struct vtk_actor_component_traits
     : public dataflow::fusion_component_traits<
         fusion::vector<
-            dataflow::port_adapter<T, vtk_actor_producer, tag>,
-            dataflow::port_adapter<T, vtk_actor_consumer, tag> >,
+            dataflow::port_adapter<vtkActor, vtk_actor_producer, tag>,
+            dataflow::port_adapter<vtkActor, vtk_actor_consumer, tag> >,
         detail::default_map,
         tag>
 {
@@ -187,7 +203,7 @@
 DATAFLOW_TRAITS_ENABLE_IF(
     T,
     boost::is_base_of<vtkActor BOOST_PP_COMMA() T>,
-    vtk::vtk_actor_component_traits<T>)
+    vtk::vtk_actor_component_traits)
 
 //]
 
@@ -197,7 +213,8 @@
 
 // First we need a PortTraits type that we will use for vtkMapper connections.
 struct vtk_mapper_producer
-    : public port_traits<ports::producer, tag> {};
+    : public complemented_port_traits<ports::producer,
+        dataflow::port_adapter<vtkActor, vtk_actor_producer, tag>, tag> {};
 
 // Next, we define a fusion map type to hold the mapping between consumers
 // and Port types.
@@ -273,20 +290,22 @@
 
 namespace boost { namespace dataflow { namespace vtk {
 
+struct vtk_rendererwindow_consumer;
+
 struct vtk_renderer_producer
-    : public port_traits<ports::producer, tag>
+    : public complemented_port_traits<ports::producer,
+        dataflow::port_adapter<vtkRenderWindow, vtk_rendererwindow_consumer, tag>, tag>
 {};
 
 struct vtk_renderer_consumer
     : public port_traits<ports::consumer, tag>
 {};
 
-template<typename T>
 struct vtk_renderer_component_traits
     : public dataflow::fusion_component_traits<
         fusion::vector<
-            dataflow::port_adapter<T, vtk_renderer_producer, tag>,
-            dataflow::port_adapter<T, vtk_renderer_consumer, tag> >, 
+            dataflow::port_adapter<vtkRenderer, vtk_renderer_producer, tag>,
+            dataflow::port_adapter<vtkRenderer, vtk_renderer_consumer, tag> >, 
         detail::default_map,
         tag>
 {
@@ -298,20 +317,35 @@
 };
 
 struct vtk_rendererwindow_consumer
-    : public port_traits<ports::consumer, tag>
+    : public complemented_port_traits<ports::consumer, 
+        dataflow::port_adapter<vtkRenderer, vtk_renderer_producer, tag>, tag>
 {};
 
+struct vtk_renderer_window_component_traits
+    : public dataflow::fusion_component_traits<
+        fusion::vector<
+            dataflow::port_adapter<vtkRenderWindow, vtk_rendererwindow_consumer, tag> >, 
+        detail::consumer_only_map,
+        tag>
+{
+    template<typename Component>
+    static typename vtk_renderer_window_component_traits::fusion_ports get_ports(Component &c)
+    {
+        return typename vtk_renderer_window_component_traits::fusion_ports(fusion::vector1<Component &>(c));
+    }
+};
+
 } } } // namespace boost::dataflow::vtk
 
 DATAFLOW_TRAITS_ENABLE_IF(
     T,
     boost::is_base_of<vtkRenderer BOOST_PP_COMMA() T>,
-    vtk::vtk_renderer_component_traits<T>)
+    vtk::vtk_renderer_component_traits)
 
 DATAFLOW_TRAITS_ENABLE_IF(
     T,
     boost::is_base_of<vtkRenderWindow BOOST_PP_COMMA() T>,
-    vtk::vtk_rendererwindow_consumer)
+    vtk::vtk_renderer_window_component_traits)
 
 namespace boost { namespace dataflow { namespace extension {
 
@@ -339,6 +373,18 @@
     }
 };
 
+template<>
+struct component_operation_impl<vtk::vtk_renderer_window_component_traits, operations::invoke>
+{
+    typedef void result_type;
+
+    template<typename Component>
+    void operator()(Component &component)
+    {
+        get_object(component).Render();
+    }
+};
+
 } } } // namespace boost::dataflow::extension
 
 //]
Modified: sandbox/SOC/2007/signals/boost/functional/factory.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/functional/factory.hpp	(original)
+++ sandbox/SOC/2007/signals/boost/functional/factory.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -46,7 +46,9 @@
         inline result_type operator()() const
         {
             memory m(this->obj_allocator);
-            result_type result( new(m.get()) value_type() );
+//            result_type result( new(m.get()) value_type() );
+            obj_allocator.construct(m.get(), value_type());
+            result_type result(m.get());
             m.release();
             return result;
         }
Modified: sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -87,6 +87,8 @@
                 0812D6370CF1283B0047236E /* binary_operation_t.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = binary_operation_t.hpp; sourceTree = "<group>"; };
                 0812D6380CF1283B0047236E /* binary_operation.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = binary_operation.hpp; sourceTree = "<group>"; };
                 0812D63C0CF140F30047236E /* component.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = component.hpp; sourceTree = "<group>"; };
+		0814D87E0E42E16400AC5DFC /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
+		0814D8800E42E38300AC5DFC /* support.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = support.hpp; sourceTree = "<group>"; };
                 0815AE780D0B7C88007ED135 /* is_type.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = is_type.hpp; sourceTree = "<group>"; };
                 0815AEC90D0B814E007ED135 /* test_complemented_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_complemented_port.cpp; sourceTree = "<group>"; };
                 08256FE60CEBDFEC003EC1B4 /* network.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = network.hpp; sourceTree = "<group>"; };
@@ -205,6 +207,7 @@
                 08A6B26C0E25A566005539F2 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
                 08A74E790E33AFA900B1A8CF /* glvgui_graph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glvgui_graph.cpp; sourceTree = "<group>"; };
                 08A82B550E11EBF500AAB117 /* dynamic_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dynamic_port.hpp; sourceTree = "<group>"; };
+		08A8CA6F0E3E819C00DA0439 /* glvgui_vtk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glvgui_vtk.cpp; sourceTree = "<group>"; };
                 08AD8AB50D84DF31008A9764 /* test_has_call_operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_has_call_operator.cpp; sourceTree = "<group>"; };
                 08AD8AC40D84E3A9008A9764 /* has_call_operator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = has_call_operator.hpp; sourceTree = "<group>"; };
                 08B234E40DC92C3A002A7FFE /* fusion_filter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = fusion_filter.hpp; sourceTree = "<group>"; };
@@ -292,7 +295,6 @@
                 08F2A7C20D0C597000AED0BC /* utility.qbk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = utility.qbk; sourceTree = "<group>"; };
                 08F2A83A0D0C634200AED0BC /* fusion_vector_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = fusion_vector_port.hpp; sourceTree = "<group>"; };
                 08F2A85A0D0C663C00AED0BC /* fusion_keyed_port.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = fusion_keyed_port.hpp; sourceTree = "<group>"; };
-		08F2C31B0CAD961F00F9100C /* vtk_dataflow_support.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = vtk_dataflow_support.hpp; sourceTree = "<group>"; };
                 08F2D3A90CCADDE00042A3FF /* underlying_type.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = underlying_type.hpp; sourceTree = "<group>"; };
                 08F2D4A60D0B0C640054E4A2 /* fusion_port_vector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = fusion_port_vector.hpp; sourceTree = "<group>"; };
                 08F2D4D10D0B106F0054E4A2 /* test_vector_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_vector_port.cpp; sourceTree = "<group>"; };
@@ -377,7 +379,6 @@
                         isa = PBXGroup;
                         children = (
                                 0800AC300C8CA99700994538 /* Jamfile.v2 */,
-				08F2C31B0CAD961F00F9100C /* vtk_dataflow_support.hpp */,
                                 08F2464B0CA86D85001C3D41 /* Cone2.cxx */,
                                 08F2464C0CA86D85001C3D41 /* Cone3.cxx */,
                                 08F2464D0CA86D85001C3D41 /* Cone4.cxx */,
@@ -391,6 +392,7 @@
                 080DD7560C13908400EEB53D = {
                         isa = PBXGroup;
                         children = (
+				0814D87D0E42E15600AC5DFC /* vtk */,
                                 089B78DE0E2C2E5900D09757 /* fusion */,
                                 08A2D5030E2A728A00D8FA04 /* glv */,
                                 08A439340E295B35009845FD /* build */,
@@ -405,6 +407,23 @@
                         );
                         sourceTree = "<group>";
                 };
+		0814D87D0E42E15600AC5DFC /* vtk */ = {
+			isa = PBXGroup;
+			children = (
+				0814D87E0E42E16400AC5DFC /* Jamfile */,
+			);
+			name = vtk;
+			path = ../../../vtk;
+			sourceTree = SOURCE_ROOT;
+		};
+		0814D87F0E42E38300AC5DFC /* vtk */ = {
+			isa = PBXGroup;
+			children = (
+				0814D8800E42E38300AC5DFC /* support.hpp */,
+			);
+			path = vtk;
+			sourceTree = "<group>";
+		};
                 083FD3C00C62A75100EF3F6B /* phoenix */ = {
                         isa = PBXGroup;
                         children = (
@@ -644,6 +663,7 @@
                                 08A6B26A0E25A566005539F2 /* blueprint_window.hpp */,
                                 08A6B26B0E25A566005539F2 /* glvgui_example.cpp */,
                                 08A6B26C0E25A566005539F2 /* Jamfile.v2 */,
+				08A8CA6F0E3E819C00DA0439 /* glvgui_vtk.cpp */,
                         );
                         path = glv_gui;
                         sourceTree = "<group>";
@@ -1046,6 +1066,7 @@
                 08FC25BA0C45B60E00F59CDD /* dataflow */ = {
                         isa = PBXGroup;
                         children = (
+				0814D87F0E42E38300AC5DFC /* vtk */,
                                 089C08A30E0AFA5E00397123 /* managed */,
                                 08F01F950C470E1500C0ED27 /* support */,
                                 08EF9B200C5D506A00D4D206 /* signals */,
Modified: sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -188,7 +188,7 @@
 [import ../example/signals/gil_example.cpp]
 [import ../example/signals/quick_start_examples.cpp]
 
-[import ../example/VTK/vtk_dataflow_support.hpp]
+[import ../../../boost/dataflow/vtk/support.hpp]
 [import ../example/VTK/Cone.cxx]
 
 [import ../example/blueprint/blueprint_example.cpp]
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone.cxx
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone.cxx	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone.cxx	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -35,7 +35,7 @@
 #include "vtkRenderer.h"
 
 // ... and include the VTK Dataflow support layer.
-#include "vtk_dataflow_support.hpp"
+#include <boost/dataflow/vtk/support.hpp>
 
 int main()
 {
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone2.cxx
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone2.cxx	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Cone2.cxx	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -36,7 +36,7 @@
 #include "vtkActor.h"
 #include "vtkRenderer.h"
 
-#include "vtk_dataflow_support.hpp"
+#include <boost/dataflow/vtk/support.hpp>
 
 // Callback for the interaction
 class vtkMyCallback : public vtkCommand
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Jamfile.v2	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/VTK/Jamfile.v2	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -3,42 +3,12 @@
 # accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
-lib vtkRendering : : <name>vtkRendering ;
-lib vtkCommon : : <name>vtkCommon ;
-lib vtkFiltering : : <name>vtkFiltering ;
-lib vtkGraphics : : <name>vtkGraphics ;
-lib vtkHybrid : : <name>vtkHybrid ;
-lib vtkIO : : <name>vtkIO ;
-lib vtkImaging : : <name>vtkImaging ;
-lib vtkGenericFiltering : : <name>vtkGenericFiltering ;
-lib vtkVolumeRendering : : <name>vtkVolumeRendering ;
-lib vtkWidgets : : <name>vtkWidgets ;
-lib vtkftgl : : <name>vtkftgl ;
-
-lib GL : : <name>GL <search>/usr/X11R6/lib ;
-lib GLU : : <name>GLU <search>/usr/X11R6/lib ;
-lib OSMesa : : <name>OSMesa <search>/usr/X11R6/lib ;
-lib X11 : : <name>X11 <search>/usr/X11R6/lib ;
-lib Xt : : <name>Xt <search>/usr/X11R6/lib ;
-
-lib pthread : : <name>pthread ;
-
 project dataflow/test/VTK
     : requirements
       <include>../../../..
       <include>$(BOOST_ROOT)
-      <include>/usr/local/include/vtk-5.0/
-      <include>/usr/include/vtk-5.0/
       <define>BOOST_ALL_NO_LIB=1
-      <toolset>darwin:<linkflags>"-framework CoreServices"
-      <toolset>darwin:<library>GL
-      <toolset>darwin:<library>X11
-      <toolset>darwin:<library>Xt
-	  <toolset>gcc:<library>pthread
-      <library>vtkCommon
-      <library>vtkRendering
-      <library>vtkFiltering
-      <library>vtkGraphics
+      <use>$(TOP)/libs/vtk//VTK_dataflow
     ;
 
 exe Cone : Cone.cxx ;
@@ -46,5 +16,5 @@
 #exe Cone3 : Cone3.cxx ;
 #exe Cone4 : Cone4.cxx ;
 #exe Cone5 : Cone5.cxx ;
-#exe Cone6 : Cone6.cxx X11 Xt vtkCommon vtkRendering vtkFiltering vtkGraphics vtkWidgets GL ;
+#exe Cone6 : Cone6.cxx ;
 
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/VTK/vtk_dataflow_support.hpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/VTK/vtk_dataflow_support.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
+++ (empty file)
@@ -1,387 +0,0 @@
-// Copyright Stjepan Rajko 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_DATAFLOW_VTK_SUPPORT_HPP
-#define BOOST_DATAFLOW_VTK_SUPPORT_HPP
-
-#include "vtkAlgorithmOutput.h"
-#include "vtkActor.h"
-#include "vtkAlgorithm.h"
-#include "vtkRenderWindow.h"
-
-#include <boost/dataflow/support.hpp>
-#include <boost/dataflow/support/port/port_adapter.hpp>
-#include <boost/dataflow/support/fusion_component.hpp>
-#include <boost/dataflow/support/fusion_keyed_port.hpp>
-
-#include <boost/assert.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/fusion/container/map.hpp>
-#include <boost/type_traits/is_base_of.hpp>
-
-//[ vtk_tag
-
-namespace boost { namespace dataflow { namespace vtk {
-
-// The vtk framework tag
-struct tag : public default_tag {};
-
-} } } // namespace boost::dataflow::vtk
-
-//]
-
-//[  vtk_algorithm_output_producer
-namespace boost { namespace dataflow { namespace vtk {
-
-// PortTraits for vtkAlgorithmOutput objects, which produce data.
-// We specify the PortCategory (ports::producer) and Tag (vtk::tag).
-
-struct vtk_algorithm_output_producer
-    : public port_traits<ports::producer, tag> {};
-    
-} } } // namespace boost::dataflow::vtk
-
-// This macro specializes the traits_of template to the specified
-// PortTraits, and also verifies that the PortTraits requirements are satisfied.
-// The traits_of template is used by the Dataflow library to associate
-// a Port with its PortTraits.
-DATAFLOW_TRAITS(vtkAlgorithmOutput, vtk::vtk_algorithm_output_producer)
-//]
-
-
-//[ vtk_algorithm_consumer
-namespace boost { namespace dataflow { namespace vtk {
-
-struct vtk_algorithm_consumer
-    : public port_traits<ports::consumer, vtk::tag> {};
-    
-typedef port_adapter<vtkAlgorithm, vtk::vtk_algorithm_consumer, vtk::tag>
-    vtk_algorithm_consumer_adapter;
-    
-} } } // namespace boost::dataflow::vtk
-
-//]
-
-//[ vtk_connect_impl_algorithm
-namespace boost { namespace dataflow { namespace extension {
-
-// To implement Connectable, we specialize the binary_operation_impl
-// functor template.  We specify three things:
-//   producer PortTraits (vtk::vtk_algorithm_output_producer)
-//   consumer PortTraits (vtk::vtk_algorithm_consumer)
-//   operation (operations::connect)
-template<>
-struct binary_operation_impl<vtk::vtk_algorithm_output_producer, vtk::vtk_algorithm_consumer, operations::connect>
-{
-    typedef void result_type;
-    
-    template<typename Producer, typename Consumer>
-    void operator()(Producer &producer, Consumer &consumer)
-    {
-        // To interface with port_adaptor objects, we use get_object
-        get_object(consumer).AddInputConnection(&get_object(producer));
-    }
-};
-
-// To implement OnlyConnectable, we do the same thing except now the operation
-// is operations::connect_only
-template<>
-struct binary_operation_impl<vtk::vtk_algorithm_output_producer, vtk::vtk_algorithm_consumer, operations::connect_only>
-{
-    typedef void result_type;
-
-    template<typename Producer, typename Consumer>
-    void operator()(Producer &producer, Consumer &consumer)
-    {
-        get_object(consumer).SetInputConnection(&get_object(producer));
-    }
-};
-    
-} } } // namespace boost::dataflow::vtk
-
-//]
-
-
-//[ vtk_algorithm_component
-
-namespace boost { namespace dataflow { namespace vtk {
-
-namespace detail {
-    
-    typedef mpl::map<
-                mpl::pair<dataflow::default_port_selector
-                    <dataflow::args::left>,
-                    mpl::int_<0> >,
-                mpl::pair<dataflow::default_port_selector
-                    <dataflow::args::right>,
-                    mpl::int_<1> >
-            >::type default_map;
-
-}
-
-// First we need a ComponentTraits type
-template<typename T>
-struct vtk_algorithm_component_traits
-    : public dataflow::fusion_component_traits<
-        fusion::vector<
-            vtkAlgorithmOutput &,
-            vtk_algorithm_consumer_adapter>,
-        detail::default_map,
-        tag>
-{
-    template<typename Component>
-    static typename vtk_algorithm_component_traits::fusion_ports get_ports(Component &c)
-    {
-        return typename vtk_algorithm_component_traits::fusion_ports(*c.GetOutputPort(), c);
-    }
-};
-
-} } } // namespace boost::dataflow::vtk
-
-// Then we associate all descendants of vtkAlgorithm with the ComponentTraits.
-// vtkMapper is a descendant of vtkAlgorithm, but we want to exclude it's
-// descendants from this registration because they will be treated differently.
-DATAFLOW_TRAITS_ENABLE_IF(
-    T,
-    mpl::and_<
-        boost::is_base_of<vtkAlgorithm BOOST_PP_COMMA() T> BOOST_PP_COMMA()
-        mpl::not_<boost::is_base_of<vtkMapper BOOST_PP_COMMA() T> >
-    >,
-    vtk::vtk_algorithm_component_traits<T>)
-
-//]
-
-//[ vtk_actor_filter
-
-namespace boost { namespace dataflow { namespace vtk {
-
-struct vtk_actor_producer
-    : public port_traits<ports::producer, tag>
-{};
-
-struct vtk_actor_consumer
-    : public port_traits<ports::consumer, tag>
-{};
-
-template<typename T>
-struct vtk_actor_component_traits
-    : public dataflow::fusion_component_traits<
-        fusion::vector<
-            dataflow::port_adapter<T, vtk_actor_producer, tag>,
-            dataflow::port_adapter<T, vtk_actor_consumer, tag> >,
-        detail::default_map,
-        tag>
-{
-    template<typename Component>
-    static typename vtk_actor_component_traits::fusion_ports get_ports(Component &c)
-    {
-        return typename vtk_actor_component_traits::fusion_ports(c, c);
-    }
-};
-
-} } } // namespace boost::dataflow::vtk
-
-DATAFLOW_TRAITS_ENABLE_IF(
-    T,
-    boost::is_base_of<vtkActor BOOST_PP_COMMA() T>,
-    vtk::vtk_actor_component_traits<T>)
-
-//]
-
-//[ vtk_mapper_producer
-
-namespace boost { namespace dataflow { namespace vtk {
-
-// First we need a PortTraits type that we will use for vtkMapper connections.
-struct vtk_mapper_producer
-    : public port_traits<ports::producer, tag> {};
-
-// Next, we define a fusion map type to hold the mapping between consumers
-// and Port types.
-typedef boost::fusion::map<
-            boost::fusion::pair<vtk::vtk_algorithm_consumer, vtkAlgorithmOutput &>,
-            boost::fusion::pair<vtk::vtk_actor_consumer, port_adapter<vtkMapper, vtk_mapper_producer, tag> >
-        > vtk_mapper_map;
-
-// ...And a ComponentTraits type...
-template<typename T>
-struct vtk_mapper_component_traits
-    : public dataflow::fusion_component_traits<
-        fusion::vector<
-            fusion_keyed_port<ports::producer, vtk::vtk_mapper_map, tag>,
-            vtk_algorithm_consumer_adapter >,
-        detail::default_map,
-        tag>
-{
-    template<typename Component>
-    static typename vtk_mapper_component_traits::fusion_ports get_ports(Component &c)
-    {
-        return typename vtk_mapper_component_traits::fusion_ports(
-            fusion_keyed_port<dataflow::ports::producer, vtk::vtk_mapper_map, tag>(
-                vtk::vtk_mapper_map(c.GetNumberOfOutputPorts() ? *c.GetOutputPort() : *(vtkAlgorithmOutput *)NULL,
-                port_adapter<vtkMapper, vtk_mapper_producer, tag>(c))),
-            c);
-    }
-};
-    
-} } } // namespace boost::dataflow::vtk
-
-// ... that we associate with vtkMapper descendants.
-DATAFLOW_TRAITS_ENABLE_IF(
-    T,
-    boost::is_base_of<vtkMapper BOOST_PP_COMMA() T>,
-    vtk::vtk_mapper_component_traits<T>)
-
-namespace boost { namespace dataflow { namespace extension {
-
-// Finally, we provide implementations for connect and connect_only
-// between vtk_mapper_producer and vtk_actor_consumer
-template<>
-struct binary_operation_impl<vtk::vtk_mapper_producer, vtk::vtk_actor_consumer, operations::connect_only>
-{
-    typedef void result_type;
-
-    template<typename Producer, typename Consumer>
-    void operator()(Producer &producer, Consumer &consumer)
-    {
-        consumer.SetMapper(producer);
-    }
-};
-
-template<>
-struct binary_operation_impl<vtk::vtk_mapper_producer, vtk::vtk_actor_consumer, operations::connect>
-{
-    typedef void result_type;
-
-    template<typename Producer, typename Consumer>
-    void operator()(Producer &producer, Consumer &consumer)
-    {
-        BOOST_ASSERT(!get_object(consumer).GetMapper());
-        get_object(consumer).SetMapper(&get_object(producer));
-    }
-};
-
-} } } // namespace boost::dataflow::extension
-
-
-//]
-
-//[ vtk_setup_rest
-
-namespace boost { namespace dataflow { namespace vtk {
-
-struct vtk_renderer_producer
-    : public port_traits<ports::producer, tag>
-{};
-
-struct vtk_renderer_consumer
-    : public port_traits<ports::consumer, tag>
-{};
-
-template<typename T>
-struct vtk_renderer_component_traits
-    : public dataflow::fusion_component_traits<
-        fusion::vector<
-            dataflow::port_adapter<T, vtk_renderer_producer, tag>,
-            dataflow::port_adapter<T, vtk_renderer_consumer, tag> >, 
-        detail::default_map,
-        tag>
-{
-    template<typename Component>
-    static typename vtk_renderer_component_traits::fusion_ports get_ports(Component &c)
-    {
-        return typename vtk_renderer_component_traits::fusion_ports(c, c);
-    }
-};
-
-struct vtk_rendererwindow_consumer
-    : public port_traits<ports::consumer, tag>
-{};
-
-} } } // namespace boost::dataflow::vtk
-
-DATAFLOW_TRAITS_ENABLE_IF(
-    T,
-    boost::is_base_of<vtkRenderer BOOST_PP_COMMA() T>,
-    vtk::vtk_renderer_component_traits<T>)
-
-DATAFLOW_TRAITS_ENABLE_IF(
-    T,
-    boost::is_base_of<vtkRenderWindow BOOST_PP_COMMA() T>,
-    vtk::vtk_rendererwindow_consumer)
-
-namespace boost { namespace dataflow { namespace extension {
-
-template<>
-struct binary_operation_impl<vtk::vtk_actor_producer, vtk::vtk_renderer_consumer, operations::connect>
-{
-    typedef void result_type;
-
-    template<typename Producer, typename Consumer>
-    void operator()(Producer &producer, Consumer &consumer)
-    {
-        get_object(consumer).AddActor(&get_object(producer));
-    }
-};
-
-template<>
-struct binary_operation_impl<vtk::vtk_renderer_producer, vtk::vtk_rendererwindow_consumer, operations::connect>
-{
-    typedef void result_type;
-
-    template<typename Producer, typename Consumer>
-    void operator()(Producer &producer, Consumer &consumer)
-    {
-        get_object(consumer).AddRenderer(&get_object(producer));
-    }
-};
-
-} } } // namespace boost::dataflow::extension
-
-//]
-
-//[ vtk_support_pointer
-
-//]
-
-//[ vtk_specialize_connect
-// the include templates expect DATAFLOW_TEMPLATE_TAG to have
-// the mechanism type
-#define DATAFLOW_TEMPLATE_TAG boost::dataflow::vtk::tag
-#define DATAFLOW_TEMPLATE_MECHANISM boost::dataflow::default_mechanism
-
-// the binary_operation.hpp template expects DATAFLOW_TEMPLATE_BINARY_OPERATION
-#   define DATAFLOW_TEMPLATE_BINARY_OPERATION connect
-#       include <boost/dataflow/templates/binary_operation.hpp>
-
-// the operator.hpp template expects DATAFLOW_TEMPLATE_OPERATOR
-#       define DATAFLOW_TEMPLATE_OPERATOR >>=
-#           include <boost/dataflow/templates/operator.hpp>
-#       undef DATAFLOW_TEMPLATE_OPERATOR
-
-#   undef DATAFLOW_TEMPLATE_BINARY_OPERATION
-
-#   define DATAFLOW_TEMPLATE_BINARY_OPERATION connect_only
-#       include <boost/dataflow/templates/binary_operation.hpp>
-
-#       define DATAFLOW_TEMPLATE_OPERATOR ^=
-#           include <boost/dataflow/templates/operator.hpp>
-#       undef DATAFLOW_TEMPLATE_OPERATOR
-
-#   undef DATAFLOW_TEMPLATE_BINARY_OPERATION
-
-#undef DATAFLOW_TEMPLATE_MECHANISM
-#undef DATAFLOW_TEMPLATE_TAG
-
-// We now have connect and connect_only functions that each take a
-// vtk ProducerPort and vtk ConsumerPort as arguments, and try to connect them.
-
-// We also have operators >>= for the connect operation,
-// and ^= for the connect_only operation.
-
-//]
-
-#endif // BOOST_DATAFLOW_VTK_SUPPORT_HPP
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/Jamfile.v2	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/Jamfile.v2	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -8,7 +8,7 @@
 project dataflow/example/glv_gui
     : requirements
       <library>/boost/signals//boost_signals/<link>static
-      <library>$(TOP)/libs/glv//lib_glv/<link>static
+      <library>$(TOP)/libs/glv//lib_glv_pimpl/<link>static
       <library>$(TOP)/libs/dataflow/build/managed//dataflow_managed/<link>static
       <define>BOOST_ALL_NO_LIB=1
     ;
@@ -18,7 +18,10 @@
     blueprint_window
     blueprint_component
     ;
+    
+lib glv_gui : $(sources).cpp : <link>static ;
 
-exe glv_example : glvgui_example.cpp $(sources).cpp ;
-exe glv_logic : glvgui_logic.cpp $(sources).cpp ;
-exe glv_graph : glvgui_graph.cpp $(sources).cpp ;
\ No newline at end of file
+exe glv_example : glvgui_example.cpp glv_gui ;
+exe glv_logic : glvgui_logic.cpp glv_gui ;
+exe glv_graph : glvgui_graph.cpp glv_gui ;
+exe glv_vtk : glvgui_vtk.cpp glv_gui $(TOP)/libs/vtk//VTK_dataflow ;
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_bank.hpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_bank.hpp	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_bank.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -11,7 +11,7 @@
 #include <boost/ptr_container/ptr_vector.hpp>
 
 #include <glv.h>
-#include <glv_binding_glut.h>
+#include <glv_pimpl_binding.h>
 
 namespace boost { namespace dataflow { namespace glv_gui {
 
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_window.hpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_window.hpp	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/blueprint_window.hpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -7,7 +7,7 @@
 #define BLUEPRINT_WINDOW_HPP
 
 #include "glv.h"
-#include "glv_binding_glut.h"
+#include "glv_pimpl_binding.h"
 
 #include <boost/dataflow/blueprint/network.hpp>
 #include <boost/dataflow/signals/runtime_support.hpp>
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_example.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_example.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_example.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -6,7 +6,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 #include <glv.h>
-#include <glv_binding_glut.h>
+#include <glv_pimpl_binding.h>
 
 #include "blueprint_bank.hpp"
 #include "blueprint_window.hpp"
@@ -26,13 +26,13 @@
 public:
     typedef glv::View runtime_base_class_type;
     output_valuator()
-        : glv::Slider(glv::Rect(100,100),0)
+        : glv::Slider(glv::Rect(100,100))
     {
         anchor(glv::Place::CL);
     }
     void operator()(float x)
     {
-        value(x, 0);
+        value(x);
         out(x);
     }
 };
@@ -43,7 +43,7 @@
 public:
     typedef glv::View runtime_base_class_type;
     input_valuator()
-        : glv::Slider(glv::Rect(100,100),0)
+        : glv::Slider(glv::Rect(100,100))
     {
         anchor(glv::Place::CL);
     }
@@ -51,7 +51,7 @@
     bool onEvent(glv::Event::t e, glv::GLV& glv)
     {
         bool response = glv::Slider::onEvent(e, glv);
-        out(value(0));
+        out(value());
         return response;
     }
 };
@@ -69,8 +69,8 @@
         add_component<input_valuator>("in");
 #ifndef BOOST_MSVC
         // a doubler (this doesn't compile on MSVC...)
-        add_component<signals::function<void (int), int(int)> >
-            ("x2", boost::function<int(int)>(boost::bind(std::multiplies<int>(), _1, 2)));
+        add_component<signals::function<void (float), float(float)> >
+            ("x2", boost::function<float(float)>(boost::bind(std::multiplies<float>(), _1, 2)));
 #endif
     }
 };
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_graph.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_graph.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_graph.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -6,7 +6,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 #include <glv.h>
-#include <glv_binding_glut.h>
+#include <glv_pimpl_binding.h>
 
 #include "blueprint_bank.hpp"
 #include "blueprint_window.hpp"
Modified: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_logic.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_logic.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glvgui_logic.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -6,7 +6,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 #include <glv.h>
-#include <glv_binding_glut.h>
+#include <glv_pimpl_binding.h>
 
 #include "blueprint_bank.hpp"
 #include "blueprint_window.hpp"
@@ -37,15 +37,14 @@
     {
         if(port<0>().connected())
         {
-            value(port<0>().get(), 0);
+            value(port<0>().get());
             port<1>().set(port<0>().get());
         }
     }
     bool onEvent(glv::Event::t e, glv::GLV& glv)
     {
         bool response = glv::Button::onEvent(e, glv);
-        std::cout <<"preval: " << value(0) << std::endl;
-        port<1>().set(value(0));
+        port<1>().set(value());
         return response;
     }
 };
Modified: sandbox/SOC/2007/signals/libs/glv/Jamfile
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/Jamfile	(original)
+++ sandbox/SOC/2007/signals/libs/glv/Jamfile	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -41,12 +41,19 @@
         <toolset>msvc:<define>WIN32
     : requirements
         <include>include
+        <toolset>darwin:<linkflags>"-framework AGL"
+        <toolset>darwin:<linkflags>"-framework GLUT"
+        <toolset>darwin:<linkflags>"-framework OpenGL"
+        <toolset>gcc:<library>$(GLlibraries)
+        <toolset>msvc:<define>WIN32
         <toolset>msvc:<define>WIN32
     ;
 
-SOURCES = glv_abstract_binding glv_color glv_core glv_draw glv_glv
-    glv_inputdevice glv_layout glv_sliders glv_textview glv_view
-    glv_binding_glut ;
+SOURCES =  glv_buttons glv_color glv_core glv_draw glv_glv
+    glv_inputdevice glv_layout glv_sliders glv_textview glv_view ;
 
-lib lib_glv : $(SOURCES).cpp
+lib lib_glv : glv_abstract_binding.cpp $(SOURCES).cpp glv_binding_glut.cpp
+    ;
+    
+lib lib_glv_pimpl : glv_pimpl_binding.cpp $(SOURCES).cpp glv_pimpl_binding_glut.cpp
     ;
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -8,7 +8,7 @@
 
         \section intro_sec Introduction
 
-	GLV (short for GL View) is an OpenGL based GUI library, currently for OSX, 
+	GLV (short for Graphics Library of Views) is an OpenGL based GUI library, currently for OSX, 
         Win32, and Linux. The ideal is to create a reasonably efficient, 
         multi-platform API that makes it simple for the end-user developer to 
         create an application's graphical user interface entirely using GPU-based 
@@ -27,6 +27,7 @@
 #include "glv_layout.h"
 
 // widgets:
+#include "glv_buttons.h"
 #include "glv_sliders.h"
 #include "glv_textview.h"
 
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_abstract_binding.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_abstract_binding.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_abstract_binding.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -8,13 +8,29 @@
 
 class GLV;
 
+/// Display mode bit masks
+enum{
+	SingleBuf	= 1<<0,
+	DoubleBuf	= 1<<1,
+	AccumBuf	= 1<<2,
+	AlphaBuf	= 1<<3,
+	DepthBuf	= 1<<4,
+	StencilBuf	= 1<<5,
+	Stereo		= 1<<6,
+	DefaultBuf	= DoubleBuf|AlphaBuf|DepthBuf
+};
+
 
 class AbstractWindow{
 
 public:
-	AbstractWindow(unsigned int width=800, unsigned int height=600, char * title="GLV Window", GLV * glv=0, double framerate=40.0);
+	AbstractWindow(
+		unsigned int width=800, unsigned int height=600, 
+		char * title="GLV Window", GLV * glv=0, double framerate=40.0, int mode=DefaultBuf
+	);
         virtual ~AbstractWindow(){}
 
+	int enabled(int dispMode) const { return mDispMode & dispMode; }
         void fullscreen(bool on);
         void fullscreenToggle();
         void resize(int w, int h);
@@ -33,12 +49,15 @@
         double mFPS;
         char * mLabel;
         unsigned int w, h, wwin, hwin;
+	int mDispMode;		// display mode bit field
         bool mFullscreen;
-	bool mVisible;
-	bool mIsActive;
-	bool mHideCursor;
+	bool mVisible;		// window visible?
+	bool mIsActive;		// window context ready?
+	bool mHideCursor;	//
         
         bool shouldDraw();	// if the GLV views should be drawn
+	
+	void onContextChange();
 
         // These virtuals should be overridden for the specific bindings
         virtual void platformFullscreen(){}
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_binding_carbon.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_binding_carbon.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_binding_carbon.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -66,4 +66,4 @@
 
 } // namespace
 
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_binding_glut.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_binding_glut.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_binding_glut.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -29,7 +29,10 @@
 
 class Window : public AbstractWindow{
 public:
-	Window(unsigned int width=800, unsigned int height=600, char * title="GLV Window", GLV * glv=0, double framerate=40);
+	Window(
+		unsigned int width=800, unsigned int height=600, 
+		char * title="GLV Window", GLV * glv=0, double framerate=40, int mode=DefaultBuf
+	);
         virtual ~Window();
 
         void draw();	// GLUT draw function
Added: sandbox/SOC/2007/signals/libs/glv/include/glv_buttons.h
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_buttons.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,141 @@
+#ifndef INC_GLV_BUTTONS_H
+#define INC_GLV_BUTTONS_H
+
+/*	Graphics Library of Views (GLV) - GUI Building Toolkit
+	See COPYRIGHT file for authors and license information */
+
+#include "glv_core.h"
+#include "glv_widget.h"
+
+namespace glv {
+
+
+// LJP: The constructor for widgets takes a Rect as an argument rather than
+// individual l,t,w,h components since it's more flexible for layout and 
+// only requires writing one constructor.
+
+/// Icon function type
+typedef void (* iconFunc)(float l, float t, float r, float b);
+
+
+
+template <class V>
+class ButtonBase: public ValueWidget<V>{
+public:
+	GLV_INHERIT_VALUEWIDGET
+	
+	/// @param[in] r		geometry
+	/// @param[in] nx		number along x (ignored by fixed size value types)
+	/// @param[in] ny		number along y (ignored by fixed size value types)
+	/// @param[in] toggles	whether the button toggles
+	/// @param[in] mutExc	whether multiple buttons can be on
+	/// @param[in] on		the on state icon
+	/// @param[in] off		the off state icon
+	ButtonBase(const Rect& r, int nx=1, int ny=1, bool toggles=true, bool mutExc=false, iconFunc on=draw::rect, iconFunc off=0)
+	:	ValueWidget<V>(r, nx, ny, 3, toggles, mutExc, true),
+		mIconOff(off), mIconOn(on)
+	{
+	}
+	
+	virtual void onDraw(){
+		using namespace glv::draw;
+
+		float dx = w/sizeX();
+		float dy = h/sizeY();
+
+		// draw the grid lines
+//		if(drawGrid()){
+//			color(colors().border); lineWidth(1);
+//			begin(Lines);
+//			for(int x=1; x<sizeX(); ++x){ vertex(x*dx,0); vertex(x*dx,h); }
+//			for(int y=1; y<sizeY(); ++y){ vertex(0,y*dy); vertex(w,y*dy); }
+//			end();
+//		}
+		ValueWidget<V>::drawGrid();
+
+		float p1  = padding();
+		float p_2 = padding()*0.5;
+		color(colors().fore);
+		
+		for(int i=0; i<sizeX(); ++i){
+			
+			float x = dx*i + p_2;
+		
+			for(int j=0; j<sizeY(); ++j){
+				int ind = index(i,j);
+				float y = dy*j + p_2;
+				if(value()[ind]){	if(mIconOn ) mIconOn (x, y, x+dx-p1, y+dy-p1); }
+				else{				if(mIconOff) mIconOff(x, y, x+dx-p1, y+dy-p1); }
+			}		
+		}
+		
+	}
+	
+	virtual bool onEvent(Event::t e, GLV& g){
+		switch(e){		
+		case Event::MouseDown:
+			if(g.mouse.left()){
+				
+				ValueWidget<V>::onSelectClick(g);
+				
+				if(enabled(MutualExc))	value().zero();
+				if(enabled(Toggleable))	value()[selected()] ^= true;
+				else value()[selected()]  = true;
+				return false;
+			}
+			break;
+
+//		case Event::MouseDrag:
+//			if(g.mouse.left()){
+//				
+//				ValueWidget<V>::onSelectClick(g);
+//				
+//				if(enabled(MutualExc))		value().zero();
+//				//if(!enabled(Toggleable))
+//					value()[selected()]  = true;
+//				return false;
+//			}
+//			break;
+			
+		case Event::MouseUp:
+			if(g.mouse.button() == Mouse::Left){
+				if(!enabled(Toggleable)) value()[selected()] = false;
+			}
+			break;
+			
+		default: break;
+		}
+		return true;
+	}
+	
+protected:
+	iconFunc mIconOff, mIconOn;	// state icons
+
+};
+
+
+
+/// Single button
+struct Button : public ButtonBase<Values<bool> >{
+
+	typedef ButtonBase<Values<bool> > super;
+
+	Button(const Rect& r=Rect(20), bool toggles=true, iconFunc on=draw::rect, iconFunc off=0)
+	:	super(r, 1, 1, toggles, false, on, off)
+	{}
+	
+	bool value() const { return super::value()[0]; }
+	Button& value(bool v){ super::value()[0] = v; return *this; }
+};
+
+
+
+/// Multiple buttons
+typedef ButtonBase<Array<bool> >  Buttons;
+
+
+
+} // glv::
+
+#endif
+
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_conf.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_conf.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_conf.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -57,8 +57,8 @@
 #endif
 
 #ifdef WIN32
-
-    #define GLV_PLATFORM		"WIN32"
+	
+	#define GLV_PLATFORM		"WIN32"
 
         #include <windows.h>
 
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_core.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_core.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_core.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -41,13 +41,20 @@
 
 /// View property flags
 enum{
-	Visible			=1<<0,	/**< Whether to draw myself */
-	DrawBack		=1<<1,	/**< Whether to draw back rect */
-	DrawBorder		=1<<2,	/**< Whether to draw border */
-	CropChildren	=1<<3,	/**< Whether to crop children when drawing */
-	CropSelf		=1<<4,	/**< Whether to crop own drawing routine(s) */
-	FocusHighlight	=1<<5,	/**< Whether to highlight border when focused */
-	HitTest			=1<<6	/**< Whether View can be clicked */
+	Visible			=1<< 0,	/**< Whether to draw myself */
+	DrawBack		=1<< 1,	/**< Whether to draw back rect */
+	DrawBorder		=1<< 2,	/**< Whether to draw border */
+	CropChildren	=1<< 3,	/**< Whether to crop children when drawing */
+	CropSelf		=1<< 4,	/**< Whether to crop own drawing routine(s) */
+	Focused			=1<< 5,	/**< Whether View is focused */
+	FocusHighlight	=1<< 6,	/**< Whether to highlight border when focused */
+	HitTest			=1<< 7,	/**< Whether View can be clicked */
+	Controllable	=1<< 8,	/**< Whether View can be controlled through events */
+	
+	DrawGrid		=1<<28,	/**< Whether to draw grid lines between widget elements */
+	MutualExc		=1<<29,	/**< Whether only one element of a widget can be non-zero */
+	SelectOnDrag	=1<<30,	/**< Whether a new element of a widget is selected while dragging */
+	Toggleable		=1<<31	/**< Whether widget element toggles when clicked */
 };
 
 
@@ -80,6 +87,7 @@
                 
                 // core events
                 Quit,		/**< Application quit */
+		ContextChange,	/**< New graphics context */
                 
                 // view events
                 GetFocus,	/**< View got focus */
@@ -330,47 +338,27 @@
         drawCallback draw;		///< Drawing callback
         
         
-	// const methods
         bool absToRel(View * target, space_t& x, space_t& y) const;
-
-	StyleColor& colors() const;
-	int enabled(int prop) const;	///< Returns whether a property is set
-	int visible() const;			///< Returns whether View is visible
+	StyleColor& colors() const;					///< Returns my style colors
+	int enabled(int prop) const;				///< Returns whether a property is set
         int numEventCallbacks(Event::t e) const;	///< Returns number of registered callbacks
-	void printDescendents() const;	///< Print tree of descendent Views to stdout
-	void printFlags() const;
-
-	/// Get style
-	Style& style() const { return *mStyle; }
-
-
-	
-	/// Set anchor translation factors
-	View& anchor(space_t mx, space_t my);
+	void printDescendents() const;				///< Print tree of descendent Views to stdout
+	void printFlags() const;					
+	Style& style() const { return *mStyle; }	///< Get style object
+	int visible() const;						///< Returns whether View is visible
 
-	/// Set anchor place on parent
-	View& anchor(Place::t parentPlace);//{ mAnchor = parentPlace; return *this; }
+		
+	View& anchor(space_t mx, space_t my);		///< Set anchor translation factors	
+	View& anchor(Place::t parentPlace);			///< Set anchor place on parent
 
         /// Append callback to a specific event type callback sequence.
         void appendCallback(Event::t type, eventCallback cb);
+	View& operator()(Event::t e, eventCallback cb){ appendCallback(e, cb); return *this; }
         
-	/// Append callback to a specific event type callback sequence.
-	View& operator()(Event::t e, eventCallback cb){
-		appendCallback(e, cb);
-		return *this;
-	}	
-
-	/// Creates own copy of current style
-	void cloneStyle();
-
-	/// Force to remain in parent
-	void constrainWithinParent();
-
-	/// Disable property flag(s)
-	View& disable(int prop);
-	
-	/// Enable property flag(s)
-	View& enable(int prop);
+	void cloneStyle();							///< Creates own copy of current style
+	void constrainWithinParent();				///< Force to remain in parent	
+	View& disable(int prop);					///< Disable property flag(s)
+	View& enable(int prop);						///< Enable property flag(s)
 
         /// Returns View under these absolute coordinates or 0 if none.
         
@@ -378,50 +366,28 @@
         ///
         View * findTarget(space_t& x, space_t& y);
 
-	/// Set whether I'm focused
-	void focused(bool b);
-
-	/// Translate constraining within parent.
-	void move(space_t x, space_t y);
-	
-	/// Set first callback for a specific event type.
-	void on(Event::t e, eventCallback cb = 0);
-	
-	/// Main drawing callback
-	virtual void onDraw();
-	
-	/// Main event callback
-	virtual bool onEvent(Event::t e, GLV& glv);
-	
-	/// Resize callback
-	virtual void onResize(space_t dx, space_t dy);
-	
-	/// Set position according to a specific place on rect
-	View& pos(Place::t p, space_t x=0, space_t y=0);
-
-	/// Set property flag(s) to a specfic value
-	View& property(int prop, bool v);
-
-	/// Toggle property flag(s)
-	View& toggle(int prop);
-
-	/// Set parent resize stretch factors
-	View& stretch(space_t mx, space_t my){ mStretchX=mx; mStretchY=my;	return *this; }
-	
-	/// Set pointer to style
-	void style(Style * style);
-
+	void focused(bool b);						///< Set whether I'm focused
+	void move(space_t x, space_t y);			///< Translate constraining within parent.
+	void on(Event::t e, eventCallback cb=0);	///< Set first callback for a specific event type.
+
+	virtual void onDraw();						///< Main drawing callback
+	virtual bool onEvent(Event::t e, GLV& glv);	///< Main event callback
+	virtual void onResize(space_t dx, space_t dy);	///< Resize callback
+
+	View& pos(Place::t p, space_t x=0, space_t y=0);///< Set position according to a specific place on rect
+	View& property(int prop, bool v);			///< Set property flag(s) to a specfic value	
+	View& stretch(space_t mx, space_t my);		///< Set parent resize stretch factors
+	void style(Style * style);					///< Set pointer to style	
+	View& toggle(int prop);						///< Toggle property flag(s)
         
 protected:
         int mFlags;						// Property flags
         Style * mStyle;					// Visual appearance
         space_t mAnchorX, mAnchorY;		// Position anchoring factors when parent is resized
         space_t mStretchX, mStretchY;	// Stretch factors when parent is resized
-	bool mFocused;					// Whether I have focus
 
-	void drawBack() const;			///< Draw the back rect
-	void drawBorder() const;		///< Draw the border
-	
+	void drawBack() const;			// Draw the back rect
+	void drawBorder() const;		// Draw the border
         void reanchor(space_t dx, space_t dy);	// Reanchor when parent resizes
 };
 
@@ -441,6 +407,10 @@
         Mouse mouse;		///< Current mouse state
         Keyboard keyboard;	///< Current keyboard state
 
+
+	/// Send this event to everyone in tree
+	void broadcastEvent(Event::t e);
+
         
         /// GLV MAIN RENDER LOOP: draw all Views in the GLV
         /// The assumption is that we are inside an OpenGL context of size [w, h]
@@ -482,7 +452,9 @@
         void setMouseMove(space_t& x, space_t& y);
 
         void setMouseWheel(int wheelDelta);	// Sets mouse and GLV event state
-		
+
+	View * focusedView(){ return mFocusedView; }
+
 protected:
         View * mFocusedView;	// current focused widget
         Event::t mEventType;	// current event type
@@ -497,8 +469,6 @@
 
 
 
-
-
 // Implementation ______________________________________________________________
 
 // View
@@ -515,11 +485,11 @@
 inline int Keyboard::keyAsNumber() const { return key() - 48; }
 inline bool Keyboard::isDown() const { return mIsDown; }
 inline bool Keyboard::isNumber() const { return (key() >= '0') && (key() <= '9'); }
-inline bool Keyboard::alt()   const { return mModifiers[1]; };
-inline bool Keyboard::caps()  const { return mModifiers[3]; };
-inline bool Keyboard::ctrl()  const { return mModifiers[2]; };
-inline bool Keyboard::meta()  const { return mModifiers[4]; };
-inline bool Keyboard::shift() const { return mModifiers[0]; };
+inline bool Keyboard::alt()   const { return mModifiers[1]; }
+inline bool Keyboard::caps()  const { return mModifiers[3]; }
+inline bool Keyboard::ctrl()  const { return mModifiers[2]; }
+inline bool Keyboard::meta()  const { return mModifiers[4]; }
+inline bool Keyboard::shift() const { return mModifiers[0]; }
 inline bool Keyboard::key(int k) const { return mKeycode == k; }
 inline void Keyboard::alt  (bool state){mModifiers[1] = state;}
 inline void Keyboard::caps (bool state){mModifiers[3] = state;}
@@ -549,14 +519,8 @@
 inline bool Mouse::middle() const { return b[Middle]; }
 inline bool Mouse::right() const { return b[Right]; }
 
-inline void Mouse::setContext(View * v){
-	mXRel -= v->l;
-	mYRel -= v->t;
-}
-inline void Mouse::unsetContext(View * v){
-	mXRel += v->l;
-	mYRel += v->t;
-}
+inline void Mouse::  setContext(View * v){mXRel -= v->l; mYRel -= v->t;}
+inline void Mouse::unsetContext(View * v){mXRel += v->l; mYRel += v->t;}
 inline void	Mouse::pos(int x, int y) {
         bufferPos((space_t)x, mX);
         bufferPos((space_t)y, mY);
@@ -566,10 +530,7 @@
         pos[1] = pos[0];
         pos[0] = newPos;
 }
-inline void	Mouse::posRel(space_t relx, space_t rely){
-	mXRel = relx; mYRel = rely;
-}
-
+inline void	Mouse::posRel(space_t rx, space_t ry){ mXRel=rx; mYRel=ry;}
 
 
 } // glv::
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_draw.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_draw.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_draw.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -37,11 +37,13 @@
 enum{
         Blend			= GL_BLEND,
         DepthTest		= GL_DEPTH_TEST,
+	Fog				= GL_FOG,
         LineSmooth		= GL_LINE_SMOOTH,
         LineStipple		= GL_LINE_STIPPLE,
         PolygonSmooth	= GL_POLYGON_SMOOTH,
         PointSmooth		= GL_POINT_SMOOTH,
-	ScissorTest		= GL_SCISSOR_TEST
+	ScissorTest		= GL_SCISSOR_TEST,
+	Texture2D		= GL_TEXTURE_2D
 };
 
 // attribute masks
@@ -64,24 +66,32 @@
         const unsigned char field;
         float x[8], y[8];
         
-	unsigned char dots(){ return (field & MaskDots) >> 5; }
-	unsigned char once(){ return (field           ) >> 7; }
-	unsigned char size(){ return (field & MaskSize)     ; }
+	static int cap()		{ return 0; }
+	static int median()		{ return 3; }
+	static int baseline()	{ return 8; }
+	static int descent()	{ return 11; }
+	static int width()		{ return 8; }
+	
+	unsigned char dots() const { return (field & MaskDots) >> 5; }
+	unsigned char once() const { return (field           ) >> 7; }
+	unsigned char size() const { return (field & MaskSize)     ; }
 };
 
 
 
 // Basic rendering commands
 void begin(int primitive);							///< Begin vertex group delimitation
+void blendFunc(int sfactor, int dfactor);			///< Set blending function
+void blendTrans();									///< Set blending function to transparent
+void blendAdd();									///< Set blending function to additive
 void clear(int mask);								///< Clear drawing buffers
 void clearColor(float r, float g, float b, float a=1);	///< Set clear color
 void color(float gray, float a=1);					///< Set current draw color
 void color(float r, float g, float b, float a=1);		///< Set current draw color
 void color(const Color& c);							///< Set current draw color
 void color(const Color& c, float a);				///< Set current draw color, but override alpha component
-void disable(int cap);								///< Disable a rendering capability
-void enable(int cap);								///< Enable a rendering capability
 void end();											///< End vertex group delimitation
+void fog(float end, float start, float density=1);	///< Set linear fog parameters
 void identity();									///< Load identity transform matrix
 void lineStipple(char factor, short pattern);		///< Specify line stipple pattern
 void lineWidth(float val);							///< Set width of lines
@@ -104,13 +114,15 @@
 void rotateZ(float deg);
 void scale(float x, float y, float z=1.f);
 void scissor(float x, float y, float w, float h);
+void texCoord(float x, float y);
 void translate(float x, float y, float z=0.f);
 void translateX(float x);
 void translateY(float y);
 void translateZ(float z);
 void viewport(float x, float y, float w, float h);
 
-void vertex(float x, float y, float z=0);
+template <class V3> void vertex(const V3& v);		///< Send single vertex given 3-element array accessible object
+void vertex(float x, float y, float z=0);			///< Send single vertex
 
 template <class T>
 void vertexY(T * ys, unsigned long len, T xInc=1, int prim = LineStrip);
@@ -121,6 +133,7 @@
 
 // icons
 void check		(float l, float t, float r, float b);
+template <int N> void dot(float l, float t, float r, float b);
 void frame		(float l, float t, float r, float b);
 void minus		(float l, float t, float r, float b);
 void plus		(float l, float t, float r, float b);
@@ -164,6 +177,21 @@
 void text(const char * s, float l=0, float t=0, float lineSpacing=1, unsigned int tabSpaces=4);
 
 
+/// Functor for disabling rendering capabilities
+struct Disable{
+	const Disable& operator() (int cap) const { glDisable(cap); return *this; }
+	const Disable& operator<< (int cap) const { return (*this)(cap); }
+};
+
+static Disable disable;
+
+/// Functor for enabling rendering capabilities
+struct Enable{
+	const Enable& operator() (int cap) const { glEnable(cap); return *this; }
+	const Enable& operator<< (int cap) const { return (*this)(cap); }
+};
+
+static Enable enable;
 
 
 
@@ -173,6 +201,22 @@
         shape(LineStrip, l,0.5*(t+b), l+(r-l)*0.3,b, r,t);
 }
 
+template <int N>
+void dot(float l, float t, float r, float b){
+	float px=1, py=0, rx=cos(6.28318530718/N), ry=sin(6.28318530718/N);
+	float mx=0.5*(l+r), my=0.5*(t+b), sx=(r-l)*0.5, sy=(b-t)*0.5;
+	
+	begin(TriangleFan);
+	vertex(mx, my);
+	for(int i=0; i<N+1; ++i){	
+		vertex(mx+px*sx, my+py*sy);
+		float tx=px;
+		px = px*rx - py*ry;
+		py = tx*ry + py*rx;
+	}
+	end();
+}
+
 inline void frame(float l, float t, float r, float b){
         shape(LineLoop, l, t, l, b, r, b, r, t);
 }
@@ -259,6 +303,9 @@
 inline void translateY(float y){ translate(0, y, 0); }
 inline void translateZ(float z){ translate(0, 0, z); }
 
+template <class V3>
+inline void vertex(const V3& v){ vertex(v[0], v[1], v[2]); }
+
 template <class T>
 void vertexY(T * ys, unsigned long len, T xInc, int prim){
         begin(prim);
@@ -281,21 +328,15 @@
 inline void clear(int mask){ glClear(mask); }
 inline void clearColor(float r, float g, float b, float a){ glClearColor(r,g,b,a); }
 inline void color(float r, float g, float b, float a){ glColor4f(r,g,b,a); }
-inline void disable(int cap){ glDisable(cap); }
-inline void enable(int cap){ glEnable(cap); }
 inline void end(){ glEnd(); }
 
 // we need to push and pop matrices and viewport bit
 template <class T>
 void push2D(T w, T h){
-
-	disable(DepthTest);
-	disable(PolygonSmooth);	// to ensure polygon edges blend properly
-	
-	enable(Blend);
-	enable(LineSmooth);
-	
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+							// to ensure polygon edges blend properly
+	disable << DepthTest << PolygonSmooth;
+	enable << Blend << LineSmooth;
+	blendTrans();
 
         push(Projection); pushAttrib(ViewPortBit); identity();
                 viewport(0, 0, w, h);
@@ -313,13 +354,13 @@
 
 
 template <class T>
-void push3D(T w, T h, T znear, T zfar){
+void push3D(T w, T h, T near, T far){
         //pushAttrib(DepthBufferBit);
         pushAttrib(ColorBufferBit | DepthBufferBit | EnableBit);
         enable(DepthTest);
         
         push(Projection); identity();
-		gluPerspective(45, w/(GLfloat)h, znear, zfar);
+		gluPerspective(45, w/(GLfloat)h, near, far);
         
         push(Model); identity();
                 translate(0, 0, -2.42);
@@ -332,6 +373,15 @@
         pop(Model);
 }
 
+inline void blendFunc(int sfactor, int dfactor){ glBlendFunc(sfactor, dfactor); }
+inline void blendTrans(){ blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); }
+inline void blendAdd(){ blendFunc(GL_SRC_COLOR, GL_ONE); }
+
+inline void fog(float end, float start, float density){
+	glFogi(GL_FOG_MODE, GL_LINEAR); 
+	glFogf(GL_FOG_DENSITY, density); glFogf(GL_FOG_START, start); glFogf(GL_FOG_END, end);
+}
+
 inline void identity(){ glLoadIdentity(); }
 inline void lineStipple(char factor, short pattern){ glLineStipple(factor, pattern); }
 inline void lineWidth(float v){ glLineWidth(v); }
@@ -347,6 +397,7 @@
 inline void rotateZ(float deg){ glRotatef(deg, 0.f, 0.f, 1.f); }
 inline void scale(float x, float y, float z){ glScalef(x,y,z); }
 inline void scissor(float x, float y, float w, float h){ glScissor((GLint)x,(GLint)y,(GLsizei)w,(GLsizei)h); }
+inline void texCoord(float x, float y){ glTexCoord2f(x,y); }
 inline void translate(float x, float y, float z){ glTranslatef(x,y,z); }
 inline void viewport(float x, float y, float w, float h){ glViewport((GLint)x,(GLint)y,(GLsizei)w,(GLsizei)h); }
 inline void vertex(float x, float y, float z){ glVertex3f(x,y,z); }
Added: sandbox/SOC/2007/signals/libs/glv/include/glv_pimpl_binding.h
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_pimpl_binding.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,99 @@
+#ifndef INC_GLV_PIMPL_BINDING_H
+#define INC_GLV_PIMPL_BINDING_H
+
+/*	Graphics Library of Views (GLV) - GUI Building Toolkit
+	See COPYRIGHT file for authors and license information */
+
+#include <memory>
+
+namespace glv{
+
+class GLV;
+
+/// Display mode bit masks
+enum{
+	SingleBuf	= 1<<0,
+	DoubleBuf	= 1<<1,
+	AccumBuf	= 1<<2,
+	AlphaBuf	= 1<<3,
+	DepthBuf	= 1<<4,
+	StencilBuf	= 1<<5,
+	Stereo		= 1<<6,
+	DefaultBuf	= DoubleBuf|AlphaBuf|DepthBuf
+};
+
+class WindowImpl;
+
+class Window{
+
+public:
+	Window(
+		unsigned int width=800, unsigned int height=600, 
+		char * title="GLV Window", GLV * glv=0, double framerate=40.0, int mode=DefaultBuf
+	);
+	~Window();
+
+	int enabled(int dispMode) const { return mDispMode & dispMode; }
+	void fullscreen(bool on);
+	void fullscreenToggle();
+	void resize(int w, int h);
+	void show(bool v);
+	void hideCursor(bool hide=true);
+
+	void setGLV(GLV & g);
+
+	double fps(){ return mFPS; }
+	unsigned int height(){ return h; }
+	unsigned int width(){ return w; }
+
+	GLV * glv;
+	
+protected:	
+	double mFPS;
+	char * mLabel;
+	unsigned int w, h, wwin, hwin;
+	int mDispMode;		// display mode bit field
+	bool mFullscreen;
+	bool mVisible;		// window visible?
+	bool mIsActive;		// window context ready?
+	bool mHideCursor;	//
+	
+	bool shouldDraw();	// if the GLV views should be drawn
+	
+	void onContextChange();
+
+	// These will be implemented in the the specific bindings
+	void platformFullscreen();
+	void platformHideCursor(bool hide);
+	void platformResize(int width, int height);	// platform specific resize stuff
+	void platformShowHide();						// platform specific show/hide stuff
+    
+    // pointer to the binding-specific implementation
+    std::auto_ptr<WindowImpl> mImpl;
+    // with the auto_ptr for the implementation, disallow assignment and copy
+private:
+    const Window& operator=(const Window&);
+    Window(const Window&);
+    friend class WindowImpl;
+};
+
+
+
+class Application{
+public:
+
+	static void			run();
+	static void			quit();
+//	static void			windowNotify(Notifier * sender, void * userdata);
+
+protected:
+	static Window *focusedWindow;
+};
+
+typedef Window AbstractWindow;
+typedef Application AbstractApplication;
+
+} // glv::
+
+#endif
+
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_rect.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_rect.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_rect.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -44,9 +44,10 @@
 
         const TRect& operator= (const TRect& r);
 
-	void extent(T v);				///< Set extent to fit in square.
-	void extent(T w, T h);			///< Set extent.
         void copyUnder(const TRect<T>& from, T by=0);
+	void extent(T v);				///< Set extent to be square.
+	void extent(T w, T h);			///< Set extent.
+	void fitSquare(T v);			///< Set extent to fit in square.
         void fixNegativeExtent();		///< Fixes negative width or height to be positive.
         void insetFrom(const TRect<T>& from, T inset);	///< Make TRect relative inset from 'from'
         void pos(T left, T top);		///< Set left-top position.
@@ -122,7 +123,7 @@
         extent(r.w, r.h);
 }
 
-TEM inline void TRect<T>::extent(T v){ w > h ? extent(v, v * h/w) : extent(v * w/h, v); }
+TEM inline void TRect<T>::extent(T v){ extent(v, v); }
 
 TEM inline void TRect<T>::extent(T wi, T he){
         T dx = wi - w;
@@ -131,6 +132,8 @@
         onResize(dx, dy);
 }
 
+TEM inline void TRect<T>::fitSquare(T v){ w > h ? extent(v, v * h/w) : extent(v * w/h, v); }
+
 TEM inline void TRect<T>::fixNegativeExtent(){
         if(w < (T)0){ w = -w; l -= w; }
         if(h < (T)0){ h = -h; t -= h; }
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_sliders.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_sliders.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_sliders.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -5,6 +5,8 @@
         See COPYRIGHT file for authors and license information */
 
 #include "glv_core.h"
+#include "glv_widget.h"
+#include <vector>
 
 namespace glv {
 
@@ -13,110 +15,6 @@
 // individual l,t,w,h components since it's more flexible for layout and 
 // only requires writing one constructor.
 
-/// Icon function type
-typedef void (* iconFunc)(float l, float t, float r, float b);
-
-template <int N>
-class ButtonBase : public View{
-public:
-
-	ButtonBase(const Rect& r=Rect(20), bool toggles=true, iconFunc on=draw::rect, iconFunc off=0, space_t iconInset=2)
-	:	View(r), mIconOff(off), mIconOn(on), mIconInset(iconInset), mToggles(toggles)
-	{
-		valueMin();
-	}
-
-	
-	ButtonBase& iconInset(space_t v){ mIconInset = v; return *this; }
-
-	/// Set button's inactive icon.
-	ButtonBase& iconOff(iconFunc fnc){ mIconOff = fnc; return *this; }
-	
-	/// Set button's active icon.
-	ButtonBase& iconOn(iconFunc fnc){ mIconOn = fnc; return *this; }
-	
-	ButtonBase& toggles(bool v){ mToggles = v; return *this; }
-	
-	ButtonBase& value(bool v, int i){ mVals[i] = v; return *this; }
-	
-	ButtonBase& valueMin(){ memset(mVals, 0, sizeof(bool) * size()); return *this; }
-	
-	
-	space_t iconInset() const { return mIconInset; }
-	
-	bool toggles() const { return mToggles; }
-	
-	/// Get value of button
-	bool value(int i=0) const { return mVals[i]; }
-	
-	static int size(){ return N; }
-
-
-protected:
-	iconFunc mIconOff, mIconOn;	// state icons
-	space_t mIconInset;			// num pixels to inset icon
-	bool mVals[N];				// values
-	bool mToggles;				// whether button stays on or off when clicked once
-};
-
-
-
-
-/// Button widget
-class Button : public ButtonBase<1>{
-public:
-
-	using ButtonBase<1>::iconInset;
-	using ButtonBase<1>::toggles;
-	using ButtonBase<1>::value;
-	
-	/// Constructor
-	Button(const Rect& r=Rect(20), bool toggles=true, iconFunc on=draw::rect, iconFunc off=0);
-	
-	virtual void onDraw();
-	virtual bool onEvent(Event::t e, GLV& glv);
-};
-
-
-
-template <int Nx, int Ny=1>
-class Buttons : public ButtonBase<Nx * Ny>{
-public:
-
-	using ButtonBase<Nx * Ny>::iconInset;
-	using ButtonBase<Nx * Ny>::toggles;
-	using ButtonBase<Nx * Ny>::value;
-	using ButtonBase<Nx * Ny>::valueMin;
-	using ButtonBase<Nx * Ny>::w;
-	using ButtonBase<Nx * Ny>::h;
-	using ButtonBase<Nx * Ny>::colors;
-
-	/// Constructor
-	Buttons(const Rect& r=Rect(20), bool mutExc=false, iconFunc on=draw::rect, iconFunc off=0);
-	
-	int lastClicked() const;
-
-	virtual void onDraw();
-	virtual bool onEvent(Event::t e, GLV& glv);
-
-protected:
-
-	using ButtonBase<Nx * Ny>::mIconOn;
-	using ButtonBase<Nx * Ny>::mIconOff;
-
-	int cx, cy;
-	
-	float rNx(){ return 1./Nx; }
-	float rNy(){ return 1./Ny; }
-	int index(int x, int y) const { return x + y*Nx; }
-	float cellW(){ return w * rNx(); }
-	float cellH(){ return h * rNy(); }
-	float iconW(){ return cellW() - 2*iconInset() + 0.5; }
-	float iconH(){ return cellH() - 2*iconInset() + 0.5; }
-};
-
-
-
 /// Abstract multidimensional slider
 
 /// The foreground color determines the color of the slider.
@@ -130,10 +28,10 @@
         
         float value(int dim=0) const;			///< Returns a slider value
         
-	void value(float val, int dim);			///< Sets a slider value
-	void valueAdd(float val, int dim);		///< Add to a slider value
-	void valueMax();						///< Max all slider values
-	void valueMid();						///< Center all slider values
+	SliderBase& value(float val, int dim);		///< Sets a slider value
+	SliderBase& valueAdd(float val, int dim);	///< Add to a slider value
+	SliderBase& valueMax();						///< Max all slider values
+	SliderBase& valueMid();						///< Center all slider values
         
         static int dimensions(){ return Dim; }	///< Returns number of dimensions of slider
 
@@ -150,15 +48,18 @@
 
 
 /// A 1-D slider
-class Slider : public SliderBase<1>{
-public:
-
-	/// Constructor
-	Slider(const Rect& r=Rect(200,20), float val=0);
-
-	virtual void onDraw();
-	virtual bool onEvent(Event::t e, GLV & glv);
-};
+//class Slider : public SliderBase<1>{
+//public:
+//
+//	/// Constructor
+//	Slider(const Rect& r=Rect(200,20), float val=0);
+//
+//	float value() const { return SliderBase<1>::value(0); }		///< Return slider value
+//	Slider& value(float v){ SliderBase<1>::value(v,0); return *this; }		///< Set slider value
+//
+//	virtual void onDraw();
+//	virtual bool onEvent(Event::t e, GLV & glv);
+//};
 
 
 
@@ -210,130 +111,286 @@
 
 
 
-// Implementation ______________________________________________________________
+template <class V>
+class Slider1DBase: public ValueWidget<V>{
+public:
+	GLV_INHERIT_VALUEWIDGET
 
-template <int Nx, int Ny>
-Buttons<Nx, Ny>::Buttons(const Rect& r, bool mutExc, iconFunc on, iconFunc off)
-:	ButtonBase<Nx*Ny>(r, !mutExc, on, off), cx(0), cy(0)
-{}
+	Slider1DBase(const Rect& r, int nx, int ny, bool dragSelect=false);
 
+	virtual ~Slider1DBase(){}
+	
+	virtual void onDraw();
+	virtual bool onEvent(Event::t e, GLV& glv);
+	
+protected:
+	float mAcc;
 
-template <int Nx, int Ny>
-int Buttons<Nx, Ny>::lastClicked() const{ return index(cx, cy); }
+	void selectSlider(GLV& g, bool click);
+	bool isVertical() const { return this->dy() > this->dx(); }
+};
 
 
-template <int Nx, int Ny>
-void Buttons<Nx, Ny>::onDraw(){
-	using namespace glv::draw;
+/// Single slider
+class Slider : public Slider1DBase<Values<float> >{
+public:
+	typedef Slider1DBase<Values<float> > super;
 
-	float wi = pix(w);
-	float hi = pix(h);
-	float wc = cellW();
-	float hc = cellH();
+	Slider(const Rect& r=Rect(20)): super(r, 1, 1, false){}
+	
+	float value() const { return super::value()[0]; }
+	Slider& value(float v){ super::value()[0] = v; return *this; }
+};
 
-	// draw the grid lines
-	color(colors().border);
-	lineWidth(1);
-	begin(Lines);
-		for(int x=1; x<Nx; ++x){
-			vertex(pix(x * wc), 0); vertex(pix(x * wc), hi);
-		}
-		for(int y=1; y<Ny; ++y){
-			vertex(0, pix(y * hc), 0); vertex(wi, pix(y * hc));
-		}
-	end();
+
+/// Multiple sliders
+typedef Slider1DBase<Array<float> > Sliders;
+
+
+
+
+//there must be at least 3 points
+class FunctionGraph : public View{
+public:
+	class Curve : public Array<float>{
+	public:
+		Curve(int res)
+		: Array<float>(res)
+		{}
+		
+		~Curve() {}
+	};
         
-	for(int x=0; x<Nx; ++x){
+	struct Knot {
+	public:
+		Knot() : x(0), y(0)
+		{}
+		
+		~Knot() {}
+		
+		Knot(const Knot& k) : x(k.x), y(k.y)
+		{}
+		
+		float x;
+		float y;
+	};
+
+public:
+	FunctionGraph(const Rect& r, int nKnots, int res);
+	virtual ~FunctionGraph();
         
-		float dx = x * wc + iconInset();
+	virtual void onDraw();
+	virtual bool onEvent(Event::t e, GLV& glv);
+
+	void eval(int n, float *vals);
+	void tension(float v) {mTension = v; calcCurves();}
+	float tension() {return mTension;}
+
+protected:
+	void calcCurves();
         
-		for(int y=0; y<Ny; ++y){
-		
-			float dy = y * hc + iconInset();
+	/*
+	Tension: 1 is high, 0 normal, -1 is low
+	Bias: 0 is even,
+	positive is towards first segment,
+	negative towards the other
+	*/
+	inline float HermiteInterpolate( float y0, float y1,
+						float y2, float y3,
+						float mu,
+						float tension,
+						float bias)
+	{
+		float m0,m1,mu2,mu3;
+		float a0,a1,a2,a3;
+
+		mu2 = mu * mu;
+		mu3 = mu2 * mu;
+		m0  = (y1-y0)*(1+bias)*(1-tension)/2;
+		m0 += (y2-y1)*(1-bias)*(1-tension)/2;
+		m1  = (y2-y1)*(1+bias)*(1-tension)/2;
+		m1 += (y3-y2)*(1-bias)*(1-tension)/2;
+		a0 =  2*mu3 - 3*mu2 + 1;
+		a1 =    mu3 - 2*mu2 + mu;
+		a2 =    mu3 -   mu2;
+		a3 = -2*mu3 + 3*mu2;
                 
-			if(value(index(x,y))){
-				color(colors().fore);
-				if(mIconOn) mIconOn(pix(dx), pix(dy), pix(dx+iconW()), pix(dy+iconH()+0.5));
-			}
-			else{
-				color(colors().fore);
-				if(mIconOff) mIconOff(pix(dx), pix(dy), pix(dx+iconW()), pix(dy+iconH()+0.5));
-			}
-		}
+		return (a0*y1+a1*m0+a2*m1+a3*y2);
         }
-}
+	
+	//returns -1 on failure (> mKnobSize pixels away)
+	int knotHitTest(space_t x, space_t y);
 
-template <int Nx, int Ny>
-bool Buttons<Nx, Ny>::onEvent(Event::t e, GLV& g){
-	switch(e){		
-	case Event::MouseDown:
-		if(g.mouse.left()){
-			cx = (int)((g.mouse.xRel() / w) * Nx);
-			cy = (int)((g.mouse.yRel() / h) * Ny);
-			cx < 0 ? cx=0 : cx>=Nx ? cx=Nx-1 : 0;
-			cy < 0 ? cy=0 : cy>=Ny ? cy=Ny-1 : 0;
-			
-			if(!toggles()){ valueMin(); value(true, index(cx, cy)); }
-			else value(!value(index(cx, cy)), index(cx, cy));
-			return false;
-		}
-	default: break;
-	}
-	return true;
-}
+	float mTension;
+	int mKnobSize;
+	int mCurrentKnot;
+	int mNKnots;
+	Knot *mKnots;
+	std::vector<Curve *> mCurves;
+};
 
 
+// Implementation ______________________________________________________________
 
 // SliderBase
 
-template <int Dim>
-SliderBase<Dim>::SliderBase(const Rect& r)
+#define TEM template <int Dim>
+
+TEM SliderBase<Dim>::SliderBase(const Rect& r)
 :	View(r)
 {
         memset(mAcc, 0, sizeof(float) * Dim);
         memset(mVal, 0, sizeof(float) * Dim);
 }
 
-template <int Dim>
-inline void SliderBase<Dim>::valueAdd(float add, int dim){
-	if(!validDim(dim)) return;
+TEM inline float SliderBase<Dim>::value(int dim) const{
+	return validDim(dim) ? mVal[dim] : 0;
+}
+
+TEM inline SliderBase<Dim>& SliderBase<Dim>::value(float value, int dim){
+	if(validDim(dim)) mVal[dim] = mAcc[dim] = value; return *this;
+}
+
+TEM inline SliderBase<Dim>& SliderBase<Dim>::valueAdd(float add, int dim){
+	if(!validDim(dim)) return *this;
         float acc = mAcc[dim] + add;
         mAcc[dim] = mVal[dim] = acc;
         clip(mVal[dim]);	// clip in [0, 1]
+	return *this;
 }
 
-template <int Dim>
-inline float SliderBase<Dim>::value(int dim) const{
-	return validDim(dim) ? mVal[dim] : 0;
+TEM inline SliderBase<Dim>& SliderBase<Dim>::valueMax(){
+	for(int i=0; i<Dim; ++i) mVal[i] = mAcc[i] = 1; return *this;
 }
 
-template <int Dim>
-inline void SliderBase<Dim>::valueMid(){
-	for(int i=0; i<Dim; ++i) mVal[i] = mAcc[i] = 0.5;
+TEM inline SliderBase<Dim>& SliderBase<Dim>::valueMid(){
+	for(int i=0; i<Dim; ++i) mVal[i] = mAcc[i] = 0.5; return *this;
 }
 
-template <int Dim>
-inline void SliderBase<Dim>::valueMax(){
-	for(int i=0; i<Dim; ++i) mVal[i] = mAcc[i] = 1;
+
+
+#define TEMV template <class V>
+
+TEMV Slider1DBase<V>::Slider1DBase(const Rect& r, int nx, int ny, bool dragSelect)
+:	ValueWidget<V>(r, nx, ny, 1, false, false, true),
+	mAcc(0)
+{
+	property(SelectOnDrag, dragSelect);
 }
 
-template <int Dim>
-inline void SliderBase<Dim>::value(float value, int dim){
-	if(validDim(dim)) mVal[dim] = mAcc[dim] = value;
+TEMV void Slider1DBase<V>::onDraw(){
+
+	float x=padding()*0.5, xd=this->dx(), yd=this->dy();
+
+	if(isVertical()){
+		for(int i=0; i<sizeX(); ++i){
+		
+			float y = padding()*0.5;
+		
+			for(int j=0; j<sizeY(); ++j){
+				int ind = index(i,j);
+				if(isSelected(i,j)) draw::color(colors().fore);
+				else draw::color(colors().fore, colors().fore.a*0.5);
+				draw::rect(x, y+yd-value()[ind]*yd, x+xd-padding(), y+yd);
+				y += yd;
+			}
+			x += xd;	
+		}
+	}
+	else{
+		for(int i=0; i<sizeX(); ++i){
+		
+			float y = padding()*0.5;
+		
+			for(int j=0; j<sizeY(); ++j){
+				int ind = index(i,j);
+				if(isSelected(i,j)) draw::color(colors().fore);
+				else draw::color(colors().fore, colors().fore.a*0.5);
+				draw::rect(x, y, value()[ind]*xd+x, y+yd-padding());
+				y += yd;
+			}
+			x += xd;
+		}
+	}
 }
 
+TEMV bool Slider1DBase<V>::onEvent(Event::t e, GLV& g){
 
+	switch(e){
+		case Event::MouseDrag:
+			// if drag settable
+			if(enabled(SelectOnDrag)){
+				selectSlider(g, false);
+			}
 
-template <int Dim>
-SliderGrid<Dim>::SliderGrid(const Rect& r, space_t knobSize)
+			if(g.mouse.right() || g.mouse.left()) {
+				
+				// accumulate differences
+				mAcc += (isVertical() ? -g.mouse.dy()*sizeY()/h : g.mouse.dx()*sizeX()/w) * this->sens(g.mouse);
+				value()[selected()] = this->clip1(mAcc);
+			}
+
+			notify();
+			return false;
+			
+		case Event::MouseDown:
+			selectSlider(g, true);
+			notify();
+			return false;
+			
+		case Event::KeyDown:{
+			ValueWidget<V>::onSelectKey(g);
+			int i = selected();
+
+			switch(g.keyboard.key()){
+			case 'x':
+			case 'a': value()[i] = this->clip1(value()[i] + 1/32.); return false;
+			case 'z': value()[i] = this->clip1(value()[i] - 1/32.); return false;
+			default:;
+			}
+		}
+
+		default:;
+			
+	}
+	return true;
+}
+
+TEMV void Slider1DBase<V>::selectSlider(GLV& g, bool click){
+
+	Mouse& m = g.mouse;
+	
+	int oldIdx = selected();
+	ValueWidget<V>::onSelectClick(g);
+	
+	float val = isVertical() ? 1-(m.yRel()*sizeY()/h - selectedY()) : m.xRel()*sizeX()/w - selectedX();
+	
+	int idx = selected();
+	
+	// if left-button, set value
+	if(m.left() && !m.right()) value()[idx] = val;
+	
+	// if click or new slider, reset accumulator
+	if(click || (oldIdx != idx)){
+		if(m.left() && !m.right()) mAcc = val;
+		else mAcc = value()[idx];
+	}
+}
+
+#undef TEMV
+
+
+
+
+
+TEM SliderGrid<Dim>::SliderGrid(const Rect& r, space_t knobSize)
 :	SliderBase<Dim>(r), knobSize(knobSize), cx(0), cy(0)
 {
         //this->cropSelf = false;
         this->disable(CropSelf);
 }
 
-template <int Dim>
-void SliderGrid<Dim>::onDraw(){
+TEM void SliderGrid<Dim>::onDraw(){
         using namespace glv::draw;
 
         float rDim = 1./Dim;
@@ -346,6 +403,38 @@
         shape(Lines,0,h,w,0);
         disable(LineStipple);
 
+	/*
+	float dx = rDim*w;
+	float dy = rDim*h;
+
+	glShadeModel(GL_SMOOTH);
+	glBegin(GL_QUADS);
+	for(int i=0; i<Dim; ++i){
+		float x = i*dx;
+		HSV xc(i/(float)Dim, 0.8, 0.2);
+		
+		for(int j=0; j<Dim; ++j){
+			float y = (Dim-j-1)*dy;
+			
+			HSV yc(j/(float)Dim, 0.8, 0.2);
+			HSV mid( (xc.h+yc.h)*0.5, 0.8, 0.2);
+			
+			color(Color(yc));
+			glVertex3f(x, y, 0);
+			
+			glColor4f(1, 1, 1, 1.);
+			glVertex3f(x, y+dy, 0);
+			
+			color(Color(xc));
+			glVertex3f(x+dx, y+dy, 0);
+			
+			color(Color(mid));
+			glVertex3f(x+dx, y, 0);
+		}
+	}
+	glEnd();
+
+	glColor4f(1, 1, 1, 1.);*/
         pointSize(knobSize);
         begin(Points);
         for(int i=0; i<Dim; ++i){
@@ -360,8 +449,7 @@
         end();
 }
 
-template <int Dim>
-bool SliderGrid<Dim>::onEvent(Event::t e, GLV& g){
+TEM bool SliderGrid<Dim>::onEvent(Event::t e, GLV& g){
 
         switch(e){
         case Event::MouseDrag:
@@ -390,6 +478,9 @@
         return false;
 }
 
+#undef TEM
+
+
 
 
 } // glv::
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_texture.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_texture.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_texture.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -8,21 +8,40 @@
 
 namespace glv{
 
-class Texture2D{
+// 2-D texture
+class Texture2{
 public:
-	Texture2D(GLsizei width, GLsizei height, bool doesLoad=false);
-	virtual ~Texture2D();
-
-	GLsizei width(){ return w; }
-	GLsizei height(){ return h; }
-
-	void bind(){ glBindTexture(GL_TEXTURE_2D, mID); }					// Bind self to current context.
-	void load(GLsizei w, GLsizei h, const GLvoid * pixels = 0);	// Resizes texture on graphics card.
-	void reload(){ load(w,h); }
-
+	Texture2(
+		GLsizei width, GLsizei height, GLvoid * pixels=0,
+		GLenum format=GL_RGB, GLenum type=GL_UNSIGNED_BYTE,
+		bool doesLoad=false);
+	virtual ~Texture2();
+
+	GLsizei width() const { return w; }
+	GLsizei height() const { return h; }
+
+	void bind();											// Bind self to current context.
+	void draw(												// Draw texture to rectangular quad
+		float ql, float qt, float qr, float qb,
+		float tl=0, float tt=1, float tr=1, float tb=0
+	);
+	void load(GLsizei w, GLsizei h, GLvoid * pixels = 0);	// Resizes texture on graphics card.
+	void reload();											// Reload texture onto GPU
+	void send();											// Send pointed to pixels to GPU
+
+	Texture2& format(GLenum v);
+	Texture2& type(GLenum v);
+	
 private:
         GLuint mID;
         GLsizei w, h;
+	GLvoid * mPixels;	// the client-side pixel data (0 if none)
+	GLenum mFormat;		// format of the pixel data:
+						//   GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, 
+						//   GL_RGB, GL_BGR, GL_RGBA, GL_BGRA, GL_LUMINANCE, and GL_LUMINANCE_ALPHA.
+					
+	GLenum mType;		// type of the pixel data:
+						//   GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT
 };
 
 
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_textview.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_textview.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_textview.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -7,6 +7,7 @@
 #include <string>
 #include <string.h>
 #include "glv_core.h"
+#include "glv_widget.h"
 
 namespace glv{
 
@@ -14,14 +15,25 @@
 class Label : public View{
 public:
 
-	Label(const std::string str, bool vert);
+	/// @param[in] str		Label string
+	/// @param[in] vert		Whether to draw label vertically
+	Label(const std::string& str, bool vert);
 
         /// @param[in] str		Label string
         /// @param[in] l		Left position
         /// @param[in] t		Top position
         /// @param[in] vert		Whether to draw label vertically
-	Label(const std::string str, space_t l=0, space_t t=0, bool vert=false);
-	
+	Label(const std::string& str, space_t l=0, space_t t=0, bool vert=false);
+
+	/// Ctor for adding label to inside of another View
+
+	/// @param[in] str		Label string
+	/// @param[in] posAnch	Position/anchor place relative to parent
+	/// @param[in] px		X position offset
+	/// @param[in] py		Y position offset
+	/// @param[in] vert		Whether to draw label vertically
+	Label(const std::string& str, Place::t posAnch, space_t px, space_t py, bool vert=false);
+
         Label& label(const std::string& s);
         Label& size(float pixels);
         Label& vertical(bool v);
@@ -37,6 +49,129 @@
         void rotateRect();		// swap between vertical and horizontal
 };
 
-} // glv::
 
+
+// Base class for number displaying/editing box(es)
+
+//
+//
+template <class V>
+class NumberBoxBase : public ValueWidget<V>{
+public:
+	GLV_INHERIT_VALUEWIDGET
+
+	NumberBoxBase(const Rect& r, int nx=1, int ny=1, const char * format="% g")
+	:	ValueWidget<V>(r, nx, ny, 10, false, true, true),
+		mStep(1), mFormat(format)
+	{}
+	
+	NumberBoxBase& step(float v){ mStep=v; return *this; }
+
+	virtual void onDraw(){
+		using namespace glv::draw;
+
+		float dx = w/sizeX();
+		float dy = h/sizeY();
+
+		// draw the grid lines
+		//ValueWidget<V>::drawGrid(*this);
+
+		// draw selected frame
+		color(colors().fore);
+		float fx = dx*selectedX(), fy = dy*selectedY();
+		frame(fx, fy, fx+dx, fy+dy);
+
+		float p_2 = padding()*0.5;
+		float textScale = (dy-padding())/Glyph::baseline();
+		float rTextScale = 1./textScale;
+		
+		// Draw cursor
+		color(colors().text, colors().text.a*0.3);
+		float curx = mNumEnt.pos() * Glyph::width()*textScale + selectedX()*this->dx() + p_2;
+		float cury = selectedY() * this->dy();
+		draw::rect(curx, cury, curx+Glyph::width(), cury+this->dy());
+		
+		lineWidth(1);
+		
+		char buf[16]; // text buffer
+		
+		// Draw text
+		// TODO: turn this into a display list
+		color(colors().text);
+		for(int i=0; i<sizeX(); ++i){
+			
+			float x = dx*i + p_2;
+		
+			for(int j=0; j<sizeY(); ++j){
+				int ind = index(i,j);
+				float y = dy*j + p_2;
+
+				float v = value()[ind];
+				snprintf(buf, sizeof(buf), mFormat, v);
+				//float len = strlen(buf);
+				//text(buf, p - (8.f * len * 0.5f), 4); // center text
+				
+				push();
+				scale(textScale, textScale);
+				text(buf, pix(x)*rTextScale, pix(y)*rTextScale);
+				pop();
+			}
+		}
+		
+	}
+	
+	virtual bool onEvent(Event::t e, GLV& g){
+		switch(e){		
+		case Event::MouseDown:
+			ValueWidget<V>::onSelectClick(g);
+			mNumEnt.value(value()[selected()]);
+			return false;
+			
+		case Event::MouseUp:
+			break;
+			
+		case Event::KeyDown:
+		
+			ValueWidget<V>::onSelectKey(g);
+			#define SETVAL value()[selected()] = mNumEnt.value()
+
+			if(mNumEnt.read(g.keyboard.key())){
+				SETVAL;
+			}
+
+			switch(g.keyboard.key()){
+			case 'w':	mNumEnt.bwd1(); return false;
+			case 'e':	mNumEnt.fwd1(); return false;
+			case 'a':	mNumEnt.addAtPos( 1); SETVAL; return false;
+			case 'z':	mNumEnt.addAtPos(-1); SETVAL; return false;
+			
+			case Key::Delete:	mNumEnt.del(); SETVAL; return false;
+//			case 'a': value()[selected()] += mStep; return false;
+//			case 'z': value()[selected()] -= mStep; return false;
+//			case '\\': mNumEnt.reset(); return false;
+			//case Key::Delete: mNumEnt.back1(); return false;
+			default:;
+			}
+		
+			break;
+			#undef SETVAL
+		default: break;
+		}
+		return true;
+	}
+
+
+protected:
+	float mStep;
+	const char * mFormat;
+	NumberEntry mNumEnt;
+};
+
+
+
+
+
+
+
+} // glv::
 #endif
Modified: sandbox/SOC/2007/signals/libs/glv/include/glv_util.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/include/glv_util.h	(original)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_util.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -4,6 +4,12 @@
 /*	Graphics Library of Views (GLV) - GUI Building Toolkit
         See COPYRIGHT file for authors and license information */
 
+#include <cctype>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+
 namespace glv {
 
 /// Smart pointer functionality to avoid deleting references.
@@ -42,7 +48,238 @@
         bool mDeletable;
 };
 
-}	// end namespace glv
+
+
+
+// Array
+template <class T>
+class Array{
+public:
+
+	Array(): mVal(0), mSizeX(0), mSizeY(0){}
+	Array(int nx, int ny=1): mSizeX(0), mSizeY(0), mVal(0) { resize(nx, ny); }
+	
+	~Array(){ clear(); }
+
+	// interface methods
+	T& operator[](int i){ return mVal[i]; }
+	const T& operator[](int i) const { return mVal[i]; }
+
+	Array& operator= (const T& v){ for(int i=0; i<size(); ++i) (*this)[i]=v; return *this; }
+	
+	Array& data(){ return *this; }
+	const Array& data() const { return *this; }
+	
+	void resize(int nx, int ny){
+		if(nx*ny != size()){
+			clear();
+			mVal = new T[nx*ny];
+			mSizeX = nx; mSizeY = ny;
+		}
+	}
+	
+	int size()  const { return sizeX() * sizeY(); }
+	int sizeX() const { return mSizeX; }
+	int sizeY() const { return mSizeY; }
+	
+	void zero(){ memset(mVal, 0, size()*sizeof(T)); }
+	
+protected:
+	int mSizeX, mSizeY;
+	T * mVal;
+	void clear(){ if(mVal) delete[] mVal; mVal=0; }
+};
+
+
+
+
+/// One or more static values
+template <class T, int Nx=1, int Ny=1>
+class Values{
+public:
+
+	// interface methods
+	T& operator[](int i){ return mVal[i]; }
+	const T& operator[](int i) const { return mVal[i]; }
+	
+	Values& operator= (const T& v){ for(int i=0; i<size(); ++i) (*this)[i]=v; return *this; }
+	
+	Values& data(){ return *this; }
+	const Values& data() const { return *this; }
+	
+	void resize(int nx, int ny){}
+	
+	int size()  const { return sizeX()*sizeY(); }
+	int sizeX() const { return Nx; }
+	int sizeY() const { return Ny; }
+	
+	void zero(){ memset(mVal, 0, size()*sizeof(T)); }
+
+protected:
+	T mVal[Nx*Ny];
+};
+
+
+
+
+class NumberEntry{
+public:
+	#define BUFSIZE 16
+	// 123456789012345678901234567890
+	// 1234567890123456
+
+	NumberEntry(){ reset(); }
+	
+	// interpret key press
+	// returns true if successful, false otherwise
+	bool read(char c){
+	
+		if(		mPos < BUFSIZE
+			&&	(isdigit(c) || (c == '.' && !mHasPoint) || c == '-')
+		){
+			switch(c){
+			case '-': mBuf[0] = mBuf[0] == '-' ? ' ' : '-'; break;
+			case '.': mHasPoint = true;
+			default : 
+				if(mBuf[mPos] == '.') mHasPoint=false;
+				mBuf[mPos++] = c;
+				if(mPos>=mNum) mNum++;
+			}
+			//printf("%s\n", mBuf); printf("%f\n", value());
+			return true;
+		}
+		return false;
+	}
+
+	
+	double value(){		
+		char * end;
+		double v = strtod(mBuf, &end);
+		if(end != mBuf) mVal = v;
+		return mVal;
+	}
+	
+
+	void value(double v){
+		char t[BUFSIZE];
+#ifdef WIN32
+#define snprintf _snprintf
+#endif
+		int n = snprintf(t, BUFSIZE-1, "% g", v);	// %f is not precise enough!
+#ifdef WIN32
+#undef snprintf
+#endif
+		
+		if(n>1){
+			reset();
+
+			// eliminate trailing zeros
+			while(n-1){
+				if(t[n-1] == '0' || t[n-1] == '.'){ t[n-1] = '\0'; --n; }
+				else break;
+			}
+			
+			if(n==1) read('0');
+			else{
+				for(int i=0; i<n; ++i){ read(t[i]); /*printf(" %d", t[i]);*/}
+			}
+		}
+		printf("\n");
+	}
+
+
+	void reset(){
+		mBuf[0] = ' ';
+		memset(mBuf + 1, 0, (BUFSIZE-1));
+		mPos = 1, mNum = 1;
+		mHasPoint = false;
+		mVal = 0;
+	}
+
+	
+	void del(){
+		if(pos() > 1){
+			for(int i=pos(); i<=mNum; ++i){
+				if(mBuf[i-1] == '.') mHasPoint = false;
+				mBuf[i-1] = mBuf[i];
+			}
+			mBuf[mNum] = '\0';
+			bwd1(); mNum--;
+		}
+	}
+
+	
+	void bwd1(){ if(pos() > 1) mPos--; }
+	void fwd1(){ if(pos() < mNum) mPos++; }
+	
+	void addAtPos(int v){
+		char c = mBuf[pos()];
+		if(isdigit(c)){
+			c += v;
+			mBuf[pos()] = c > '9' ? '9' : c < '0' ? '0' : c;
+		}
+	}
+	
+	const char * buf(){ return mBuf; }
+	int pos(){ return mPos; }
+	
+private:
+	char mBuf[BUFSIZE];
+	int mPos, mNum;
+	double mVal;
+	bool mHasPoint;
+	#undef BUFSIZE
+};
+
+
+
+//template <class T, int Nx=1, int Ny=1>
+//class RangedValues : public Values<T, Nx, Ny>{
+//public:
+//
+//	T& operator[](int i){ return mVal[i]; }
+//	const T& operator[](int i) const { return mVal[i]; }
+//
+//	RangedValues& range(T max, T min=0){ mMax=max; mMin=min; return *this; }
+//
+//	
+//
+//protected:
+//	T mMin, mMax;
+//	
+//	void valueSet(T v){
+//		v>mMax ? v=mMax : v<mMin ? v=mMin : 0;
+//		value()[selected()] = v;
+//	}
+//	
+//};
+
+
+//template <class V>
+//class ValuesRef{
+//public:
+//	ValuesRef(): mVal(0){}
+//
+//	V& data(){ return *mVal; }
+//	const V& data() const { return *mVal; }
+//
+//	// interface methods
+//	void resize(int nx, int ny){}
+//	
+//	void ref(V& r){ mVal = &r; }
+//	
+//protected:
+//	V * mVal;
+//};
+
+
+// We something that wraps around more atomic types to give them all a common
+// interface. However, if the atomic type has the interface methods already,
+// they should be used. Otherwise, the wrapper's default methods should be called.
+
+
+
+}	// glv::
 
 #endif
 
Added: sandbox/SOC/2007/signals/libs/glv/include/glv_widget.h
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/include/glv_widget.h	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,184 @@
+#ifndef INC_GLV_WIDGET_H
+#define INC_GLV_WIDGET_H
+
+/*	Graphics Library of Views (GLV) - GUI Building Toolkit
+	See COPYRIGHT file for authors and license information */
+
+#include "glv_core.h"
+
+namespace glv {
+
+
+// One-to-one value maps
+//namespace map{
+//
+//	template <class T>
+//	T clip(T v, T max, T min){ return v<min ? min : v>max ? max : v; }
+//	
+//	template <class T>
+//	T wrap(T v, T max, T min){ return v<min ? v + (max-min) : v>max ? v - (max-min) : v; }
+//}
+
+
+// inheritance definitions for templated subclasses
+#define GLV_INHERIT_VALUEWIDGET\
+	using ValueWidget<V>::w;\
+	using ValueWidget<V>::h;\
+	using ValueWidget<V>::notify;\
+	using ValueWidget<V>::colors;\
+	using ValueWidget<V>::enabled;\
+	using ValueWidget<V>::property;\
+	using ValueWidget<V>::padding;\
+	using ValueWidget<V>::sizeX;\
+	using ValueWidget<V>::sizeY;\
+	using ValueWidget<V>::value;\
+	using ValueWidget<V>::index;\
+	using ValueWidget<V>::isSelected;\
+	using ValueWidget<V>::selected;\
+	using ValueWidget<V>::selectedX;\
+	using ValueWidget<V>::selectedY;\
+
+
+/// Base class of generic grid-based, valued widget
+template <class V>
+class ValueWidget : public View{
+public:
+
+	ValueWidget(const Rect& r, int nx, int ny, space_t pad, bool toggles, bool mutExc, bool drawGrid=true)
+	:	View(r),
+		mPadding(pad), sx(0), sy(0)
+	{
+		value().resize(nx, ny);	// req'd for dynamically sized values
+		//valueMin();
+		value().zero();
+		
+		property(DrawGrid, drawGrid);
+		property(MutualExc, mutExc);
+		property(Toggleable, toggles);
+	}
+
+	int size () const { return value().size (); }
+	int sizeX() const { return value().sizeX(); }
+	int sizeY() const { return value().sizeY(); }
+	
+	V& value(){ return mVal; }
+	const V& value() const { return mVal; }
+
+	bool isSelected(int x, int y) const { return x == selectedX() && y == selectedY(); }
+
+	int lastClicked() const { return index(sx, sy); }
+	
+	space_t padding() const { return mPadding; }
+	ValueWidget& padding(space_t v){ mPadding=v; return *this; }
+
+	int selected() const { return index(sx, sy); }
+	int selectedX() const { return sx; }
+	int selectedY() const { return sy; }
+
+	//ValueWidget& valueMin(){ value().zero(); return *this; }
+	//ValueWidget& valueMid(){ for(int i=0; i<size(); ++i) value()[i]=0.5; return *this; }
+	//ValueWidget& valueMax(){ for(int i=0; i<size(); ++i) value()[i]=1.0; return *this; }
+
+
+protected:
+	V mVal;
+	space_t mPadding;			// num pixels to inset icon
+	int sx, sy;					// last clicked position
+
+
+	float dx() const { return w/sizeX(); }
+	float dy() const { return h/sizeY(); }
+	int index(int x, int y) const { return x + y*value().sizeX(); }
+	float sens(const Mouse& m){ return (m.left() && m.right()) ? 0.25 : 1; }
+
+
+	// draw the grid lines
+	void drawGrid(){
+		
+		if(enabled(DrawGrid)){
+			using namespace glv::draw;
+
+			float xd = dx();
+			float yd = dy();
+
+			color(colors().border); lineWidth(1);
+			begin(Lines);
+			for(int x=1; x<sizeX(); ++x){ vertex(x*xd, 0); vertex(x*xd, h); }
+			for(int y=1; y<sizeY(); ++y){ vertex(0, y*yd); vertex(w, y*yd); }
+			end();
+		}
+	}
+
+
+	void onSelectClick(GLV& g){
+		sx = (int)((g.mouse.xRel() / w) * sizeX());
+		sy = (int)((g.mouse.yRel() / h) * sizeY());
+		clipIndices();
+	}
+
+	
+	void onSelectKey(GLV& g){
+		//printf("shift %d\n", g.keyboard.shift());
+		//printf("shift %d\n", g.keyboard.key());
+		switch(g.keyboard.key()){
+		case Key::Down:	sy++; break;
+		case Key::Up:	sy--; break;
+		case Key::Right:sx++; break;
+		case Key::Left:	sx--; break;
+		case Key::Tab:
+			
+			if(!g.keyboard.shift()){
+				if(sx == sizeX()-1){
+					sx=0;
+					if(sy == sizeY()-1)	sy=0;
+					else				sy++;
+				}
+				else sx++;
+			}
+			else{	// doesn't work with GLUT; key == 25 (end-of-medium) with shift down
+				if(sx == 0){
+					sx=sizeX()-1;
+					if(sy == 0) sy=sizeY()-1;
+					else		sy--;
+				}
+				else sx--;
+			}
+			break;
+		}
+		clipIndices();
+	}
+
+	
+	static void clip(int& i, int max){ i<0 ? i=0 : i>=max ? i=max-1 : 0; }
+	static float clip1(float v){ return v < 0. ? 0. : v > 1. ? 1 : v; }
+	void clipIndices(){ clip(sx, sizeX()); clip(sy, sizeY()); }
+};
+
+
+
+
+//class ValueMapper{
+//
+//	float map(float v1){
+//		float r = mBoundFunc(v1);
+//		if(mSigned) r = r*2-1;
+//		r = mWarpFunc(r);
+//		r = r * (mMax - mMin) + mMin;
+//		if(mStep != 0){
+//			r /= mStep;
+//			r += r > 0 ? 0.5 : -0.5;	// round
+//			r = int(r) * mStep;
+//		}
+//		return r;
+//	}
+//
+//	float mMin, mMax, mStep;
+//	WarpFunc mWarpFunc;
+//	BoundFunc mBoundFunc;	// clip, wrap, none
+//	bool mSigned;
+//};
+
+
+
+} // glv::
+#endif
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -19,10 +19,13 @@
 
 
 
-AbstractWindow::AbstractWindow(unsigned int w, unsigned int h, char * title, GLV * glv, double framerate)
+AbstractWindow::AbstractWindow(
+	unsigned int w, unsigned int h, char * title, GLV * glv, double framerate, int mode
+)
 :	glv(0), mFPS(framerate),
         mLabel(title), 
         w(w), h(h),
+	mDispMode(mode),
         mFullscreen(false), mVisible(true), mIsActive(true)
 {
         if(glv) setGLV(*glv);
@@ -31,6 +34,7 @@
 void AbstractWindow::setGLV(GLV & g){ 
         glv = &g;
         g.extent(w, h);
+	onContextChange();
 }
 
 void AbstractWindow::fullscreen(bool on){
@@ -38,6 +42,7 @@
                 wwin = w, hwin = h;
                 mFullscreen = true;
                 platformFullscreen();
+		onContextChange();
         }
         else if(!on && mFullscreen){
                 //resize(wwin, hwin);
@@ -45,6 +50,7 @@
                 if(glv) glv->extent(w, h);
                 mFullscreen = false;
                 platformFullscreen();
+		onContextChange();
         }
 }
 
@@ -55,6 +61,10 @@
         platformHideCursor(hide);
 }
 
+void AbstractWindow::onContextChange(){
+	if(mIsActive && glv) glv->broadcastEvent(Event::ContextChange);
+}
+
 void AbstractWindow::resize(int width, int height){
         w = width; h = height;
         if(glv) glv->extent(w, h);
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -817,4 +817,4 @@
 
 } // end namespace glv
 
-#undef debug
\ No newline at end of file
+#undef debug
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -5,9 +5,6 @@
 
 namespace glv{
 
-
-static Window * singletonWindow = NULL;
-
 void Application::quit(){
 }
 
@@ -16,6 +13,10 @@
         glutMainLoop();	
 }
 
+
+
+static Window * singletonWindow = NULL;
+
 static void glutDisplayCB(){
         // this is empty because we are using a periodic timer for drawing
 }
@@ -117,16 +118,26 @@
         glutTimerFunc((unsigned int)(1000.0/singletonWindow->fps()), scheduleDraw, 0);
 }
 
-Window :: Window(unsigned int width, unsigned int height, char * title, GLV * glv, double framerate)
-: AbstractWindow(width, height, title, glv, framerate)
+Window :: Window(unsigned int w, unsigned int h, char * title, GLV * glv, double framerate, int mode)
+:	AbstractWindow(w, h, title, glv, framerate, mode)
 {
         int argc = 0;
         char * argv[] = {0};
         if(singletonWindow == NULL){
                 glutInit(&argc,argv);
-		glutInitWindowSize(width,height);
+		glutInitWindowSize(w, h);
                 //glutInitWindowPosition (100, 100);
-		glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH|GLUT_STENCIL);
+		
+		int bits = 
+			(enabled(SingleBuf ) ? GLUT_SINGLE :0) |
+			(enabled(DoubleBuf ) ? GLUT_DOUBLE :0) |
+			(enabled(AccumBuf  ) ? GLUT_ACCUM  :0) |
+			(enabled(AlphaBuf  ) ? GLUT_ALPHA  :0) |
+			(enabled(DepthBuf  ) ? GLUT_DEPTH  :0) |
+			(enabled(StencilBuf) ? GLUT_STENCIL:0) |
+			(enabled(Stereo    ) ? GLUT_STEREO :0);
+		
+		glutInitDisplayMode(GLUT_RGBA | bits);
                 glutCreateWindow(title);
 
                 registerCBs();
@@ -145,9 +156,6 @@
 // glutFullScreen() just maximizes the window.  We want use game mode to get rid
 // of the OS toolbars.
 
-//	if(mFullscreen) glutFullScreen();
-//	else			platformResize(AbstractWindow::w, AbstractWindow::h);
-
         if(mFullscreen){
 
 //		"width=1024 height=768 bpp=24 hertz=60"
@@ -180,11 +188,19 @@
 //		compact mode [ width "x" height ][ ":" bitsPerPixel ][ "@" videoRate ]
 
                 glutGameModeString("1024x768:24_at_60");
+		
+		mIsActive = false;
                 glutEnterGameMode();
                 registerCBs();
+		mIsActive = true;
+		
                 hideCursor(mHideCursor);
         }
-	else glutLeaveGameMode();
+	else{
+		mIsActive = false;
+		glutLeaveGameMode();
+		mIsActive = true;
+	}
 }
 
 void Window::platformHideCursor(bool v){
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_buttons.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_buttons.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,9 @@
+/*	Graphics Library of Views (GLV) - GUI Building Toolkit
+	See COPYRIGHT file for authors and license information */
+
+#include "glv_buttons.h"
+
+namespace glv {
+
+
+}	//end namespace glv
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -144,7 +144,6 @@
         return c == ' ';
 }
 
-
 void grid(float l, float t, float w, float h, float divx, float divy, bool incEnds){
         double inc, r=l+w, b=t+h;
         begin(Lines);
@@ -217,14 +216,14 @@
 
 
 void text(const char * s, float l, float t, float lineSpacing, unsigned int tabSpaces){
-	float x=l, y=t, tabUnits = tabSpaces*8;
+	float x=l, y=t, tabUnits = tabSpaces * Glyph::baseline();
         //x = (int)x + 0.5; y = (int)y + 0.5;
         begin(Lines);
         while(*s){
                 switch(*s){
                         case '\t':	x = ((int)(x/tabUnits) + 1) * tabUnits; break;
-			case '\n':	x = l; y += 16 * lineSpacing; break;
-			default:	if(character(*s, x, y)) x += 8;
+			case '\n':	x = l; y += Glyph::baseline() * 2.f * lineSpacing; break;
+			default:	if(character(*s, x, y)) x += Glyph::baseline();
                 }
                 s++;
         }
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -13,10 +13,39 @@
 }
 
 
+
+void GLV::broadcastEvent(Event::t e){ 
+
+	View * const root = this;
+	View * cv = root;
+	
+	doEventCallbacks(*cv, e);
+	
+	while(true){
+		if(cv->child) cv = cv->child;
+		
+		else if(cv->sibling) cv = cv->sibling;
+		
+		// retrace upwards until a parent's sibling is found
+		else{
+			while(cv != root && cv->sibling == 0) cv = cv->parent;
+			
+			if(cv->sibling) cv = cv->sibling;
+
+			else break; // break the loop when the traversal returns to the root
+		}
+		
+		doEventCallbacks(*cv, e);
+	}
+}
+
+
 // Since we possibly have multiple event callbacks, we will bubble the event if any
 // one of them has bubbling set to true.
 bool GLV::doEventCallbacks(View& v, Event::t e){
 
+	if(!v.enabled(Controllable)) return false;
+
         bool bubble = v.onEvent(e, *this);					// Execute virtual callback
 
         const eventCallbackList& cbl = v.callbackLists[e];
@@ -147,14 +176,14 @@
 
 void GLV::preamble(unsigned int w, unsigned int h){
         using namespace draw;
+	glDrawBuffer(GL_BACK);
         clearColor(colors().back.r, colors().back.g, colors().back.b, colors().back.a);
-	clear(ColorBufferBit | DepthBufferBit);
+	clear(ColorBufferBit | DepthBufferBit);	// TODO: this needs to be coordinated with the display settings
 }
 
 void GLV::propagateEvent(){ //printf("GLV::propagateEvent(): %s\n", Event::getName(eventtype));
         View * v = mFocusedView;
-	Event::t e = eventType();	// get current event type
-
+	Event::t e = eventType();
         while(v && doEventCallbacks(*v, e)) v = v->parent;
 }
 
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_pimpl_binding.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_pimpl_binding.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,58 @@
+/*	Graphics Library of Views (GLV) - GUI Building Toolkit
+	See COPYRIGHT file for authors and license information */
+
+#include <stdio.h>
+#include "glv_core.h"
+#include "glv_pimpl_binding.h"
+
+namespace glv{
+
+
+void Window::setGLV(GLV & g){ 
+	glv = &g;
+	g.extent(w, h);
+	onContextChange();
+}
+
+void Window::fullscreen(bool on){
+	if(on && !mFullscreen){
+		wwin = w, hwin = h;
+		mFullscreen = true;
+		platformFullscreen();
+		onContextChange();
+	}
+	else if(!on && mFullscreen){
+		//resize(wwin, hwin);
+		w = wwin; h = hwin;
+		if(glv) glv->extent(w, h);
+		mFullscreen = false;
+		platformFullscreen();
+		onContextChange();
+	}
+}
+
+void Window::fullscreenToggle(){ fullscreen(!mFullscreen); }
+
+void Window::hideCursor(bool hide){
+	mHideCursor = hide;
+	platformHideCursor(hide);
+}
+
+void Window::onContextChange(){
+	if(mIsActive && glv) glv->broadcastEvent(Event::ContextChange);
+}
+
+void Window::resize(int width, int height){
+	w = width; h = height;
+	if(glv) glv->extent(w, h);
+	platformResize(w, h);
+}
+
+bool Window::shouldDraw(){ return glv && mIsActive && mVisible; }
+
+void Window::show(bool v){
+	mVisible = v;
+	platformShowHide();
+}
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_pimpl_binding_glut.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_pimpl_binding_glut.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,299 @@
+/*	Graphics Library of Views (GLV) - GUI Building Toolkit
+	See COPYRIGHT file for authors and license information */
+
+#include "glv_pimpl_binding.h"
+#include "glv_core.h"
+
+#if defined (__APPLE__) || defined (OSX)
+	#include <GLUT/glut.h>
+#endif
+#if defined(__linux__)
+	#include <GL/glut.h>
+#endif
+#ifdef WIN32
+	#include <GL/glut.h>
+#endif
+
+#include <map>
+#include <iostream>
+
+namespace glv {
+
+class WindowImpl
+{
+public:
+    WindowImpl(Window *window, int window_id)
+        : mWindow(window)
+        , mGLUTWindowId(window_id)
+    {
+        mWindows[mGLUTWindowId]=this;
+    }
+    ~WindowImpl()
+    {
+        mWindows.erase(mGLUTWindowId);
+    }
+	void draw();	// GLUT draw function
+    void scheduleDraw()
+    {
+        scheduleDrawStatic(mGLUTWindowId);
+    }
+    static WindowImpl *getWindowImpl()
+    {
+        return mWindows[glutGetWindow()];
+    }
+    static WindowImpl *getWindowImpl(int window_id)
+    {
+        return mWindows[window_id];
+    }
+    static Window *getWindow()
+    {
+        return getWindowImpl()->mWindow;
+    }
+private:
+    static void scheduleDrawStatic(int window_id)
+    {
+        WindowImpl *impl = WindowImpl::getWindowImpl(window_id);
+        if(impl)
+        {
+            int current = glutGetWindow();
+            glutSetWindow(window_id);
+            impl->draw();
+            glutTimerFunc((unsigned int)(1000.0/WindowImpl::getWindow()->fps()), scheduleDrawStatic, window_id);
+            glutSetWindow(current);
+        }
+    }
+
+    static std::map<int, WindowImpl *> mWindows;
+    static bool mGLUTInitialized;
+
+    Window *mWindow;
+    int mGLUTWindowId;
+    
+    friend class Window;
+};
+
+bool WindowImpl::mGLUTInitialized = false;
+std::map<int, WindowImpl *> WindowImpl::mWindows;
+
+void Application::quit(){
+}
+
+void Application::run(){
+    GLV_PLATFORM_INIT
+	glutMainLoop();	
+}
+
+static void glutDisplayCB(){
+	// this is empty because we are using a periodic timer for drawing
+}
+
+// this must be called whenever a GLUT input event for a keyboard or mouse
+// callback is generated.
+static void modToGLV(){
+    
+	GLV * glv = WindowImpl::getWindow()->glv;
+	int mod = glutGetModifiers();	
+	glv->keyboard.alt  (mod & GLUT_ACTIVE_ALT);
+	glv->keyboard.ctrl (mod & GLUT_ACTIVE_CTRL);
+	glv->keyboard.shift(mod & GLUT_ACTIVE_SHIFT);
+}
+
+static void keyToGLV(unsigned int key, bool down, bool special){
+	//printf("GLUT: keyboard event k:%d d:%d s:%d\n", key, down, special);
+	GLV * glv = WindowImpl::getWindow()->glv;
+	if(special){
+
+		#define CS(glut, glv) case GLUT_KEY_##glut: key = Key::glv; break;
+		switch(key){
+			CS(LEFT, Left) CS(UP, Up) CS(RIGHT, Right) CS(DOWN, Down)
+			CS(PAGE_UP, PageUp) CS(PAGE_DOWN, PageDown)
+			CS(HOME, Home) CS(END, End) CS(INSERT, Insert)
+		
+			CS(F1, F1) CS(F2, F2) CS(F3, F3) CS(F4, F4)
+			CS(F5, F5) CS(F6, F6) CS(F7, F7) CS(F8, F8)
+			CS(F9, F9) CS(F10, F10)	CS(F11, F11) CS(F12, F12)
+		}
+		#undef CS
+	}
+	
+	down ? glv->setKeyDown(key) : glv->setKeyUp(key);
+	modToGLV();
+	glv->propagateEvent();
+}
+
+static void glutKeyboardCB(unsigned char key, int x, int y){ keyToGLV(key, true, false); }
+static void glutKeyboardUpCB(unsigned char key, int x, int y){ keyToGLV(key, false, false); }
+static void glutSpecialCB(int key, int x, int y){ keyToGLV(key, true, true); }
+static void glutSpecialUpCB(int key, int x, int y){ keyToGLV(key, false, true); }
+
+static void glutMouseCB(int btn, int state, int ax, int ay){
+	//printf("GLUT: mouse event x:%d y:%d bt:#%d,%d\n", ax,ay, btn, state==GLUT_DOWN);
+	GLV * glv = WindowImpl::getWindow()->glv;
+	space_t x = (space_t)ax;
+	space_t y = (space_t)ay;
+	space_t relx = x;
+	space_t rely = y;
+
+	switch(btn){
+		case GLUT_LEFT_BUTTON:		btn = Mouse::Left; break;
+		case GLUT_MIDDLE_BUTTON:	btn = Mouse::Middle; break;
+		case GLUT_RIGHT_BUTTON:		btn = Mouse::Right; break;
+		default:					btn = Mouse::Extra;		// unrecognized button
+	}
+
+	if(GLUT_DOWN == state)		glv->setMouseDown(relx, rely, btn, 0);
+	else if(GLUT_UP == state)	glv->setMouseUp  (relx, rely, btn, 0);
+
+	glv->setMousePos((int)x, (int)y, relx, rely);
+	modToGLV();
+	glv->propagateEvent();
+}
+
+static void glutMotionCB(int ax, int ay){
+	//printf("GLUT: motion event x:%d y:%d\n", ax, ay);
+
+	GLV * glv = WindowImpl::getWindow()->glv;
+	space_t x = (space_t)ax;
+	space_t y = (space_t)ay;
+	space_t relx = x;
+	space_t rely = y;
+	
+	//glv->setMouseDrag(relx, rely, glv->mouse.button(), 0);
+	glv->setMouseDrag(relx, rely);
+	glv->setMousePos((int)x, (int)y, relx, rely);
+	//modToGLV();	// GLUT complains about calling glutGetModifiers()
+	glv->propagateEvent();
+}
+
+static void glutReshapeCB(int w, int h){
+	WindowImpl::getWindow()->resize(w, h);
+}
+
+static void registerCBs(){
+	glutDisplayFunc(glutDisplayCB);
+	glutKeyboardFunc(glutKeyboardCB);
+	glutKeyboardUpFunc(glutKeyboardUpCB);
+	glutMouseFunc(glutMouseCB);
+	glutMotionFunc(glutMotionCB);
+	glutReshapeFunc(glutReshapeCB);
+	glutSpecialFunc(glutSpecialCB); 
+	glutSpecialUpFunc(glutSpecialUpCB);
+}
+
+Window::Window(
+	unsigned int w, unsigned int h, char * title, GLV * glv, double framerate, int mode
+)
+:	glv(0), mFPS(framerate),
+	mLabel(title), 
+	w(w), h(h),
+	mDispMode(mode),
+	mFullscreen(false), mVisible(true), mIsActive(true)
+{
+	if(glv) setGLV(*glv);
+    
+    if(!WindowImpl::mGLUTInitialized)
+    {
+        int argc = 0;
+        char * argv[] = {0};
+
+        glutInit(&argc,argv);
+        WindowImpl::mGLUTInitialized = true;
+    }
+    glutInitWindowSize(w, h);
+    //glutInitWindowPosition (100, 100);
+		
+    int bits = 
+        (enabled(SingleBuf ) ? GLUT_SINGLE :0) |
+        (enabled(DoubleBuf ) ? GLUT_DOUBLE :0) |
+        (enabled(AccumBuf  ) ? GLUT_ACCUM  :0) |
+        (enabled(AlphaBuf  ) ? GLUT_ALPHA  :0) |
+        (enabled(DepthBuf  ) ? GLUT_DEPTH  :0) |
+        (enabled(StencilBuf) ? GLUT_STENCIL:0) |
+        (enabled(Stereo    ) ? GLUT_STEREO :0);
+		
+    glutInitDisplayMode(GLUT_RGBA | bits);
+    int window_id = glutCreateWindow(title);
+		
+    glutIgnoreKeyRepeat(1);
+		
+    mImpl.reset(new WindowImpl(this, window_id));
+
+	registerCBs();
+    mImpl->scheduleDraw();
+}
+
+void Window::platformFullscreen(){
+
+// glutFullScreen() just maximizes the window.  We want use game mode to get rid
+// of the OS toolbars.
+
+	if(mFullscreen){
+
+//		"width=1024 height=768 bpp=24 hertz=60"
+
+//	=       Equal.
+//	!=      Not equal.
+//	<       Less  than  and  preferring larger difference (the
+//			least is best).
+//	>       Greater than  and  preferring  larger  differences
+//			(the most is best).
+//	<=      Less  than  or equal and preferring larger differ-
+//			ence (the least is best).
+//	>=      Greater than or equal and preferring more  instead
+//			of less.  This comparator is useful for allocating
+//			resources like color precsion or depth buffer pre-
+//			cision  where  the  maximum  precison is generally
+//			preferred.  Contrast with the tilde (~) comprator.
+//	~       Greater  than or equal but preferring less instead
+//			of more.  This compartor is useful for  allocating
+//			resources  such as stencil bits or auxillary color
+//			buffers where you would rather not over  allocate.
+
+//		bpp     Bits per pixel for the frame buffer.
+//		height  Height of the screen in pixels.
+//		hertz   Video refresh rate of the screen in hertz.
+//		num     Number  of  the  window  system depenedent display
+//				mode configuration.
+//		width   Width of the screen in pixels.
+	
+//		compact mode [ width "x" height ][ ":" bitsPerPixel ][ "@" videoRate ]
+
+		glutGameModeString("1024x768:24_at_60");
+		
+		mIsActive = false;
+		glutEnterGameMode();
+		registerCBs();
+		mIsActive = true;
+		
+		hideCursor(mHideCursor);
+	}
+	else{
+		mIsActive = false;
+		glutLeaveGameMode();
+		mIsActive = true;
+	}
+}
+
+void Window::platformHideCursor(bool v){
+	glutSetCursor(v ? GLUT_CURSOR_NONE : GLUT_CURSOR_INHERIT);
+}
+
+void Window::platformResize(int width, int height){
+	glutReshapeWindow(width, height);
+}
+
+void Window::platformShowHide(){ }
+
+void WindowImpl::draw(){
+    std::cout << "draw" << std::endl;
+	if(mWindow->shouldDraw()){
+		mWindow->glv->drawGLV(mWindow->w, mWindow->h);
+		glutSwapBuffers();
+	}
+}
+
+Window::~Window()
+{}
+
+
+} // end namespace glv
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -6,98 +6,6 @@
 
 namespace glv{
 
-// Button
-
-Button::Button(const Rect& r, bool toggles, iconFunc on, iconFunc off)
-:	ButtonBase<1>(r, toggles, on, off, 3)
-{}
-	
-void Button::onDraw(){
-	using namespace glv::draw;
-
-	draw::lineWidth(2);
-
-	float v1 = pix(iconInset());
-	float vr = pix(w - iconInset() + 0.5);	// add 0.5 for rect, 0 o.w.; not sure why?
-	float vb = pix(h - iconInset() + 0.5);
-
-	if(value()){
-		color(colors().fore);
-		if(mIconOn) mIconOn(v1, v1, vr, vb);
-	}
-	else{
-		color(colors().fore);
-		if(mIconOff) mIconOff(v1, v1, vr, vb);
-	}
-}
-
-bool Button::onEvent(Event::t e, GLV& g){
-	switch(e){
-		case Event::MouseDown:
-			if(g.mouse.left()){
-				value(toggles() ? !value() : true, 0);
-				notify();
-			}
-			break;
-			
-		case Event::MouseUp:
-			if(g.mouse.button() == Mouse::Left){
-				if(!toggles()){ value(false, 0); notify(); }
-			}
-			break;
-		default: break;
-	}
-	return false;
-}
-
-
-
-// Slider
-
-Slider::Slider(const Rect& r, float val)
-:	SliderBase<1>(r)
-{
-	value(val, 0);
-}
-
-
-void Slider::onDraw(){
-	using namespace glv::draw;
-	draw::color(colors().fore);
-	if(isVertical())	rect(1, pix(h * (1.f - value())), pix(w), pix(h));
-	else				rect(1, 1, pix(w * value()), pix(h));
-}
-
-bool Slider::onEvent(Event::t e, GLV& g){
-
-	switch(e){
-		case Event::MouseDrag:
-			if(isVertical()) valueAdd(-g.mouse.dy()/h * sens(g), 0);
-			else             valueAdd( g.mouse.dx()/w * sens(g), 0);
-			notify();
-			break;
-			
-		case Event::MouseDown:
-			if(g.mouse.left() && !g.mouse.right()){
-				if(isVertical()) value(1.f - g.mouse.yRel() / h, 0);
-				else             value(      g.mouse.xRel() / w, 0);
-			}
-			notify();
-			break;
-			
-		case Event::MouseUp: clipAccs(); break;
-			
-		case Event::KeyDown:
-			switch(g.keyboard.key()){
-			default: return true;
-			}
-		default: break;
-			
-	}
-	return false;
-}
-
-
 // Slider2D
 
 Slider2D::Slider2D(const Rect& r, float valX, float valY, space_t knobSize)
@@ -232,6 +140,247 @@
 
 
 
+FunctionGraph::FunctionGraph(const Rect& r, int nKnots, int res)
+: View(r), mTension(0.), mKnobSize(3), mCurrentKnot(-1), mNKnots(nKnots), mKnots(0)
+{
+	//minimum 3 knots
+	if(mNKnots < 3) mNKnots = 3;
+	
+	mKnots = new Knot[mNKnots];
+	for(int i=0; i < mNKnots; i++) {
+		mKnots[i].x = ((float)i)/(mNKnots-1);
+		mKnots[i].y = mKnots[i].x*mKnots[i].x;
+	}
+	
+	for(int i=0; i < mNKnots-1; i++) {
+		mCurves.push_back(new Curve(res));
+	}
+	calcCurves();
+}
+
+FunctionGraph::~FunctionGraph()
+{
+	if(mKnots) delete[] mKnots;
+	std::vector<Curve *>::iterator it = mCurves.begin();
+	std::vector<Curve *>::iterator it_e = mCurves.end();
+	for(; it != it_e; ++it){
+		delete *it;
+	}
+}
 
+void FunctionGraph::calcCurves()
+{
+	std::vector<Curve *>::iterator it = mCurves.begin();
+	std::vector<Curve *>::iterator it_e = mCurves.end();
+	int i=0;
+	for(; it != it_e; ++it){
+		//for now we duplicate boundry points
+		int idx0, idx1, idx2, idx3;
+		
+		if(i==0) {
+			idx0 = idx1 = 0;
+			idx2 = 1;
+			idx3 = 2;
+		}
+		else if(i == (mNKnots-2)) {
+			idx0 = i-1;
+			idx1 = i;
+			idx2 = idx3 = mNKnots-1;
+		}
+		else {
+			idx0 = i-1;
+			idx1 = i;
+			idx2 = i+1;
+			idx3 = i+2;
+		}
+	
+		Curve &c = *(*it);
+	
+		float mu = 0.;
+		float dmu = 1./(float)(c.size()-1);
+		for(int t = 0; t < c.size(); t++) {
+			c[t] = HermiteInterpolate(mKnots[idx0].y, mKnots[idx1].y, mKnots[idx2].y, mKnots[idx3].y, mu, mTension, 0);
+			mu += dmu;
+		}
+		
+		i++;
+	}
+}
+
+void FunctionGraph::eval(int n, float *vals)
+{
+	float dx = 1./(n-1);
+	float x = 0;
+	int idx = 0;
+	int k = 0;
+	vals[idx] = mKnots[k].y;
+	
+	int idx0 = 0;
+	int idx1 = 0;
+	int idx2 = 1;
+	int idx3 = 2;
+
+	for(; idx < n-1; idx++) {
+		if(x > mKnots[k+1].x) {
+			while(x > mKnots[k+1].x) {
+				k++;
+			}
+			
+			if(k == (mNKnots-2)) {
+				idx0 = k-1;
+				idx1 = k;
+				idx2 = idx3 = mNKnots-1;
+			}
+			else {
+				idx0 = k-1;
+				idx1 = k;
+				idx2 = k+1;
+				idx3 = k+2;
+			}
+		}
+		
+		float mu = (x - mKnots[k].x) / (mKnots[k+1].x - mKnots[k].x);
+		vals[idx] = HermiteInterpolate(mKnots[idx0].y, mKnots[idx1].y, mKnots[idx2].y, mKnots[idx3].y, mu, mTension, 0);
+		
+		x += dx;
+	}
+	
+	vals[idx] = mKnots[k].y;
+}
+
+void FunctionGraph::onDraw()
+{
+	using namespace glv::draw;
+
+	
+	std::vector<Curve *>::iterator it = mCurves.begin();
+	std::vector<Curve *>::iterator it_e = mCurves.end();
+	
+	color(mStyle->color.fore);
+	begin(LineStrip);
+	int i=0;
+	for(; it != it_e; ++it){
+		Curve &c = *(*it);
+		
+		float dx = (mKnots[i+1].x - mKnots[i].x)/(c.size()-1);
+		float x = mKnots[i].x;
+		for(int t = 0; t < c.size(); t++) {
+			vertex(x*w, (1.-c[t])*h);
+			x += dx;
+		}
+		i++;
+	}
+	end();
+	
+	color(mStyle->color.fore, mStyle->color.fore.a*0.5);
+	begin(QuadStrip);
+	i=0;
+	it = mCurves.begin();
+	for(; it != it_e; ++it){
+		Curve &c = *(*it);
+		
+		float dx = (mKnots[i+1].x - mKnots[i].x)/(c.size()-1);
+		float x = mKnots[i].x;
+		for(int t = 0; t < c.size(); t++) {
+			vertex(x*w, (1.-c[t])*h);
+			vertex(x*w, h);
+			x += dx;
+		}
+		i++;
+	}
+	end();
+	
+	for(int k = 0; k < mNKnots; k++) {
+		int cx = mKnots[k].x*w;
+		int cy = (1.-mKnots[k].y)*h;
+		frame(cx-mKnobSize, cy-mKnobSize, cx+mKnobSize, cy+mKnobSize);
+	}
+}
+
+bool FunctionGraph::onEvent(Event::t e, GLV& glv)
+{
+	switch(e){
+	case Event::MouseDrag: {
+		if(glv.mouse.left() && mCurrentKnot >= 0) {
+			if(mCurrentKnot == 0 || mCurrentKnot == (mNKnots-1)) {
+				mKnots[mCurrentKnot].y = 1.-(glv.mouse.yRel()/h);
+				mKnots[mCurrentKnot].y = (mKnots[mCurrentKnot].y < 0.) ? 0. : 
+												((mKnots[mCurrentKnot].y > 1.) ? 1. : mKnots[mCurrentKnot].y);
+			}
+			else {
+				mKnots[mCurrentKnot].x = (glv.mouse.xRel()/w);
+				mKnots[mCurrentKnot].y = 1.-(glv.mouse.yRel()/h);
+				
+				mKnots[mCurrentKnot].x = (mKnots[mCurrentKnot].x < 0) ? 0 : 
+											((mKnots[mCurrentKnot].x > 1.) ? 1 : mKnots[mCurrentKnot].x);
+				
+				mKnots[mCurrentKnot].y = (mKnots[mCurrentKnot].y < 0.) ? 0. : 
+												((mKnots[mCurrentKnot].y > 1.) ? 1. : mKnots[mCurrentKnot].y);
+				
+				//check if we went beyond neighboring knots
+				if(mKnots[mCurrentKnot].x < mKnots[mCurrentKnot-1].x && mCurrentKnot != mCurrentKnot+1) {
+					Knot kt;
+					kt.x = mKnots[mCurrentKnot].x;
+					kt.y = mKnots[mCurrentKnot].y;
+					
+					mKnots[mCurrentKnot].x = mKnots[mCurrentKnot-1].x;
+					mKnots[mCurrentKnot].y = mKnots[mCurrentKnot-1].y;
+					
+					mKnots[mCurrentKnot-1].x = kt.x;
+					mKnots[mCurrentKnot-1].y = kt.y;
+					
+					mCurrentKnot--;
+				}
+				else if(mKnots[mCurrentKnot].x > mKnots[mCurrentKnot+1].x && mCurrentKnot != mNKnots-2) {
+					Knot kt;
+					kt.x = mKnots[mCurrentKnot].x;
+					kt.y = mKnots[mCurrentKnot].y;
+					
+					mKnots[mCurrentKnot].x = mKnots[mCurrentKnot+1].x;
+					mKnots[mCurrentKnot].y = mKnots[mCurrentKnot+1].y;
+					
+					mKnots[mCurrentKnot+1].x = kt.x;
+					mKnots[mCurrentKnot+1].y = kt.y;
+					
+					mCurrentKnot++;
+				}
+			}
+			
+			calcCurves();
+		}
+	}
+	break;
+	
+	case Event::MouseDown: {
+		if(glv.mouse.left()) {
+			mCurrentKnot = knotHitTest(glv.mouse.xRel(), glv.mouse.yRel());
+		}
+	}
+	break;
+	
+	default:
+	break;
+	}
+	
+	return false;
+}
+
+int FunctionGraph::knotHitTest(space_t x, space_t y)
+{
+	int idx = -1;
+	float min_dsq = mKnobSize*mKnobSize*2.5;
+	
+	for(int k = 0; k < mNKnots; k++) {
+		float dx = mKnots[k].x*w - x;
+		float dy =(1.-mKnots[k].y)*h - y;
+		float dsq = dx*dx+dy*dy;
+		if(dsq < min_dsq) {
+			min_dsq = dsq;
+			idx = k;
+		}
+	}
+	
+	return idx;
+}
 
 } // end namespace glv
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -5,25 +5,60 @@
 
 namespace glv{
 
-Texture2D::Texture2D(GLsizei width, GLsizei height, bool doesLoad)
-	: mID(0), w(width), h(height)
+Texture2::Texture2(GLsizei w, GLsizei h, GLvoid * pixs, GLenum format, GLenum type, bool doesLoad)
+	: mID(0), w(w), h(h), mPixels(pixs), mFormat(format), mType(type)
 {
-	if(doesLoad) load(w, h);
+	if(doesLoad) load(w, h, mPixels);
 }
 
-Texture2D::~Texture2D(){
+Texture2::~Texture2(){
         glDeleteTextures(1, &mID);
 }
 
-void Texture2D::load(GLsizei width, GLsizei height, const GLvoid * pixels){
+void Texture2::bind(){ glBindTexture(GL_TEXTURE_2D, mID); }
+
+
+void Texture2::draw(
+	float ql, float qt, float qr, float qb,
+	float tl, float tt, float tr, float tb
+){	
+	glBegin(GL_QUADS);       
+		glTexCoord2f(tl,tt); glVertex2f(ql,qt);
+		glTexCoord2f(tl,tb); glVertex2f(ql,qb);
+		glTexCoord2f(tr,tb); glVertex2f(qr,qb);
+		glTexCoord2f(tr,tt); glVertex2f(qr,qt);
+	glEnd();
+}
+
+Texture2& Texture2::format(GLenum v){ mFormat=v; return *this; }
+
+void Texture2::load(GLsizei width, GLsizei height, GLvoid * pixs){
         w = width;
         h = height;
+	mPixels = pixs;
+
         if(mID) glDeleteTextures(1, &mID);
         glGenTextures(1, &mID); //printf("%i\n", mID);
         glBindTexture(GL_TEXTURE_2D, mID);
-	glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
+	glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, mFormat, mType, mPixels);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 }
 
+void Texture2::reload(){ load(w,h, mPixels); }
+
+void Texture2::send(){
+
+/*	void glTexSubImage2D(	GLenum target,
+							GLint level,
+							GLint xoffset, GLint yoffset,
+							GLsizei width, GLsizei height,
+							GLenum format, GLenum type,
+							const GLvoid *pixels ) */
+
+	glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, mFormat, mType, mPixels);
+}
+
+Texture2& Texture2::type(GLenum v){ mType=v; return *this; }
+
 } // glv::
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -14,14 +14,20 @@
         label(str);\
         vertical(vert);
 
-Label::Label(const std::string str, bool vert)
+Label::Label(const std::string& str, bool vert)
 :	View(0,0,0,0), CTOR_LIST
 {	CTOR_BODY }
 
-Label::Label(const std::string str, space_t l, space_t t, bool vert)
+Label::Label(const std::string& str, space_t l, space_t t, bool vert)
 :	View(l,t,0,0), CTOR_LIST
 {	CTOR_BODY }
 
+Label::Label(const std::string& str, Place::t p, space_t px, space_t py, bool vert)
+:	View(0,0,0,0), CTOR_LIST
+{	CTOR_BODY 
+	pos(p, px, py).anchor(p);
+}
+
 #undef CTOR_LIST
 #undef CTOR_BODY
 
Modified: sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp	(original)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -9,9 +9,8 @@
         Notifier(),\
         parent(0), child(0), sibling(0), \
         draw(cb),\
-	mFlags(Visible | DrawBack | DrawBorder | CropSelf | FocusHighlight | HitTest), \
-	mStyle(&(Style::standard())), mAnchorX(0), mAnchorY(0), mStretchX(0), mStretchY(0),\
-	mFocused(false)
+	mFlags(Visible | DrawBack | DrawBorder | CropSelf | FocusHighlight | HitTest | Controllable), \
+	mStyle(&(Style::standard())), mAnchorX(0), mAnchorY(0), mStretchX(0), mStretchY(0)
 
 View::View(space_t left, space_t top, space_t width, space_t height, drawCallback cb)
 :	Rect(left, top, width, height), VIEW_INIT
@@ -203,7 +202,7 @@
                 float borderWidth = 1.0;
                 //draw::color((mFocused && focusHighlight) ? colors().fore : colors().border);
                 
-		if(mFocused && enabled(FocusHighlight)){
+		if(enabled(Focused) && enabled(FocusHighlight)){
                         HSV hsv(colors().border);
                         hsv.v > 0.5 ? hsv.v -= 0.2 : hsv.v += 0.2;
                         color(Color(hsv));
@@ -259,7 +258,7 @@
 
 
 void View::focused(bool b){
-	mFocused = b;
+	property(Focused, b);
         if(b) makeLastSibling(); // move to end of chain, so drawn last
         notify();
 }
@@ -305,15 +304,15 @@
         using namespace glv::Place;
         
         switch(p){
-		case TL: Rect::pos(x		,y); break;
-		case TC: Rect::pos(x-w/2	,y); break;
-		case TR: Rect::pos(x-w	,y); break;
-		case CL: Rect::pos(x		,y-h/2); break;
-		case CC: Rect::pos(x-w/2	,y-h/2); break;
-		case CR: Rect::pos(x-w	,y-h/2); break;
-		case BL: Rect::pos(x		,y-h); break;
-		case BC: Rect::pos(x-w/2	,y-h); break;
-		case BR: Rect::pos(x-w	,y-h); break;
+		case TL: Rect::pos(x	, y    ); break;
+		case TC: Rect::pos(x-w/2, y    ); break;
+		case TR: Rect::pos(x-w	, y    ); break;
+		case CL: Rect::pos(x	, y-h/2); break;
+		case CC: Rect::pos(x-w/2, y-h/2); break;
+		case CR: Rect::pos(x-w	, y-h/2); break;
+		case BL: Rect::pos(x	, y-h  ); break;
+		case BC: Rect::pos(x-w/2, y-h  ); break;
+		case BR: Rect::pos(x-w	, y-h  ); break;
         }
         
         return *this;
@@ -335,6 +334,9 @@
 }
 
 
+View& View::stretch(space_t mx, space_t my){ mStretchX=mx; mStretchY=my; return *this; }
+
+
 void View::style(Style * style){
         mStyle->smartDelete();
         mStyle = style;
Modified: sandbox/SOC/2007/signals/libs/vtk/Jamfile
==============================================================================
--- sandbox/SOC/2007/signals/libs/vtk/Jamfile	(original)
+++ sandbox/SOC/2007/signals/libs/vtk/Jamfile	2008-08-01 02:42:30 EDT (Fri, 01 Aug 2008)
@@ -0,0 +1,44 @@
+# Copyright 2008 Stjepan Rajko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+lib vtkRendering : : <name>vtkRendering ;
+lib vtkCommon : : <name>vtkCommon ;
+lib vtkFiltering : : <name>vtkFiltering ;
+lib vtkGraphics : : <name>vtkGraphics ;
+lib vtkHybrid : : <name>vtkHybrid ;
+lib vtkIO : : <name>vtkIO ;
+lib vtkImaging : : <name>vtkImaging ;
+lib vtkGenericFiltering : : <name>vtkGenericFiltering ;
+lib vtkVolumeRendering : : <name>vtkVolumeRendering ;
+lib vtkWidgets : : <name>vtkWidgets ;
+lib vtkftgl : : <name>vtkftgl ;
+
+lib GL : : <name>GL <search>/usr/X11R6/lib ;
+lib GLU : : <name>GLU <search>/usr/X11R6/lib ;
+lib OSMesa : : <name>OSMesa <search>/usr/X11R6/lib ;
+lib X11 : : <name>X11 <search>/usr/X11R6/lib ;
+lib Xt : : <name>Xt <search>/usr/X11R6/lib ;
+
+lib pthread : : <name>pthread ;
+
+project dataflow/vtk
+    : requirements
+    : usage-requirements
+      <library>vtkCommon/<link>shared
+      <library>vtkRendering/<link>shared
+      <library>vtkFiltering/<link>shared
+      <library>vtkGraphics/<link>shared
+
+      <toolset>darwin:<include>/usr/local/include/vtk-5.0/
+      <toolset>darwin:<include>/usr/include/vtk-5.0/
+      <toolset>darwin:<linkflags>"-framework CoreServices"
+#      <toolset>darwin:<library>GL
+#      <toolset>darwin:<library>X11
+#      <toolset>darwin:<library>Xt
+	  <toolset>gcc:<library>pthread
+
+    ;
+    
+alias VTK_dataflow ;