|
Boost-Commit : |
From: stipe_at_[hidden]
Date: 2008-07-13 14:18:59
Author: srajko
Date: 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
New Revision: 47390
URL: http://svn.boost.org/trac/boost/changeset/47390
Log:
glv_gui examples build with glv library built with bjam
Added:
sandbox/SOC/2007/signals/libs/glv/COPYRIGHT (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/Jamfile (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/include/COPYRIGHT
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/COPYRIGHT
sandbox/SOC/2007/signals/libs/glv/include/glv.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv.h
sandbox/SOC/2007/signals/libs/glv/include/glv_abstract_binding.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_abstract_binding.h
sandbox/SOC/2007/signals/libs/glv/include/glv_behavior.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_behavior.h
sandbox/SOC/2007/signals/libs/glv/include/glv_binding_carbon.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_carbon.h
sandbox/SOC/2007/signals/libs/glv/include/glv_binding_fltk.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_fltk.h
sandbox/SOC/2007/signals/libs/glv/include/glv_binding_glut.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_glut.h
sandbox/SOC/2007/signals/libs/glv/include/glv_color.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_color.h
sandbox/SOC/2007/signals/libs/glv/include/glv_conf.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_conf.h
sandbox/SOC/2007/signals/libs/glv/include/glv_core.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_core.h
sandbox/SOC/2007/signals/libs/glv/include/glv_draw.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_draw.h
sandbox/SOC/2007/signals/libs/glv/include/glv_layout.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_layout.h
sandbox/SOC/2007/signals/libs/glv/include/glv_observer_pattern.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_observer_pattern.h
sandbox/SOC/2007/signals/libs/glv/include/glv_rect.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_rect.h
sandbox/SOC/2007/signals/libs/glv/include/glv_sliders.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_sliders.h
sandbox/SOC/2007/signals/libs/glv/include/glv_texture.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_texture.h
sandbox/SOC/2007/signals/libs/glv/include/glv_textview.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_textview.h
sandbox/SOC/2007/signals/libs/glv/include/glv_util.h
- copied unchanged from r47367, /sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_util.h
sandbox/SOC/2007/signals/libs/glv/src/
sandbox/SOC/2007/signals/libs/glv/src/COPYRIGHT (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/FontGL/
sandbox/SOC/2007/signals/libs/glv/src/FontGL/FontGL.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/FontGL/FontGL.h (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_binding_fltk.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_color.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_core.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_inputdevice.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_layout.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp (contents, props changed)
sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp (contents, props changed)
Removed:
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/COPYRIGHT
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_abstract_binding.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_behavior.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_carbon.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_fltk.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_glut.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_color.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_conf.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_core.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_draw.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_layout.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_observer_pattern.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_rect.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_sliders.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_texture.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_textview.h
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_util.h
Text files modified:
sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj | 149 ++++++++++++++++++++++++++++-----------
sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/Jamfile.v2 | 13 --
sandbox/SOC/2007/signals/project-root.jam | 1
3 files changed, 110 insertions(+), 53 deletions(-)
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-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -153,6 +153,43 @@
08A15D250E290EA0005AE94D /* support.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = support.hpp; sourceTree = "<group>"; };
08A15D2B0E29108B005AE94D /* runtime_support.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = runtime_support.hpp; sourceTree = "<group>"; };
08A15D6F0E2914C3005AE94D /* test_managed_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_managed_port.cpp; sourceTree = "<group>"; };
+ 08A2D5040E2A728A00D8FA04 /* COPYRIGHT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYRIGHT; sourceTree = "<group>"; };
+ 08A2D5060E2A728A00D8FA04 /* COPYRIGHT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYRIGHT; sourceTree = "<group>"; };
+ 08A2D5070E2A728A00D8FA04 /* glv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv.h; sourceTree = "<group>"; };
+ 08A2D5080E2A728A00D8FA04 /* glv_abstract_binding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_abstract_binding.h; sourceTree = "<group>"; };
+ 08A2D5090E2A728A00D8FA04 /* glv_behavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_behavior.h; sourceTree = "<group>"; };
+ 08A2D50A0E2A728A00D8FA04 /* glv_binding_carbon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_binding_carbon.h; sourceTree = "<group>"; };
+ 08A2D50B0E2A728A00D8FA04 /* glv_binding_fltk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_binding_fltk.h; sourceTree = "<group>"; };
+ 08A2D50C0E2A728A00D8FA04 /* glv_binding_glut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_binding_glut.h; sourceTree = "<group>"; };
+ 08A2D50D0E2A728A00D8FA04 /* glv_color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_color.h; sourceTree = "<group>"; };
+ 08A2D50E0E2A728A00D8FA04 /* glv_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_conf.h; sourceTree = "<group>"; };
+ 08A2D50F0E2A728A00D8FA04 /* glv_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_core.h; sourceTree = "<group>"; };
+ 08A2D5100E2A728A00D8FA04 /* glv_draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_draw.h; sourceTree = "<group>"; };
+ 08A2D5110E2A728A00D8FA04 /* glv_layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_layout.h; sourceTree = "<group>"; };
+ 08A2D5120E2A728A00D8FA04 /* glv_observer_pattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_observer_pattern.h; sourceTree = "<group>"; };
+ 08A2D5130E2A728A00D8FA04 /* glv_rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_rect.h; sourceTree = "<group>"; };
+ 08A2D5140E2A728A00D8FA04 /* glv_sliders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_sliders.h; sourceTree = "<group>"; };
+ 08A2D5150E2A728A00D8FA04 /* glv_texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_texture.h; sourceTree = "<group>"; };
+ 08A2D5160E2A728A00D8FA04 /* glv_textview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_textview.h; sourceTree = "<group>"; };
+ 08A2D5170E2A728A00D8FA04 /* glv_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_util.h; sourceTree = "<group>"; };
+ 08A2D5180E2A728A00D8FA04 /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
+ 08A2D51A0E2A728A00D8FA04 /* COPYRIGHT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYRIGHT; sourceTree = "<group>"; };
+ 08A2D51C0E2A728A00D8FA04 /* FontGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontGL.cpp; sourceTree = "<group>"; };
+ 08A2D51D0E2A728A00D8FA04 /* FontGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontGL.h; sourceTree = "<group>"; };
+ 08A2D51E0E2A728A00D8FA04 /* glv_abstract_binding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_abstract_binding.cpp; sourceTree = "<group>"; };
+ 08A2D51F0E2A728A00D8FA04 /* glv_binding_carbon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_binding_carbon.cpp; sourceTree = "<group>"; };
+ 08A2D5200E2A728A00D8FA04 /* glv_binding_fltk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_binding_fltk.cpp; sourceTree = "<group>"; };
+ 08A2D5210E2A728A00D8FA04 /* glv_binding_glut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_binding_glut.cpp; sourceTree = "<group>"; };
+ 08A2D5220E2A728A00D8FA04 /* glv_color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_color.cpp; sourceTree = "<group>"; };
+ 08A2D5230E2A728A00D8FA04 /* glv_core.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_core.cpp; sourceTree = "<group>"; };
+ 08A2D5240E2A728A00D8FA04 /* glv_draw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_draw.cpp; sourceTree = "<group>"; };
+ 08A2D5250E2A728A00D8FA04 /* glv_glv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_glv.cpp; sourceTree = "<group>"; };
+ 08A2D5260E2A728A00D8FA04 /* glv_inputdevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_inputdevice.cpp; sourceTree = "<group>"; };
+ 08A2D5270E2A728A00D8FA04 /* glv_layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_layout.cpp; sourceTree = "<group>"; };
+ 08A2D5280E2A728A00D8FA04 /* glv_sliders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_sliders.cpp; sourceTree = "<group>"; };
+ 08A2D5290E2A728A00D8FA04 /* glv_texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_texture.cpp; sourceTree = "<group>"; };
+ 08A2D52A0E2A728A00D8FA04 /* glv_textview.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_textview.cpp; sourceTree = "<group>"; };
+ 08A2D52B0E2A728A00D8FA04 /* glv_view.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glv_view.cpp; sourceTree = "<group>"; };
08A364C10E129DC7001E6002 /* test_dynamic_port.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_dynamic_port.cpp; sourceTree = "<group>"; };
08A438900E295AE7009845FD /* component.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = component.cpp; sourceTree = "<group>"; };
08A439B80E295B8B009845FD /* Jamfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.jam; path = Jamfile; sourceTree = "<group>"; };
@@ -164,23 +201,6 @@
08A6B26A0E25A566005539F2 /* blueprint_window.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = blueprint_window.hpp; sourceTree = "<group>"; };
08A6B26B0E25A566005539F2 /* glvgui_example.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glvgui_example.cpp; sourceTree = "<group>"; };
08A6B26C0E25A566005539F2 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
- 08A6B2990E25A6A5005539F2 /* glv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv.h; sourceTree = "<group>"; };
- 08A6B29A0E25A6A5005539F2 /* glv_abstract_binding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_abstract_binding.h; sourceTree = "<group>"; };
- 08A6B29B0E25A6A5005539F2 /* glv_behavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_behavior.h; sourceTree = "<group>"; };
- 08A6B29C0E25A6A5005539F2 /* glv_binding_carbon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_binding_carbon.h; sourceTree = "<group>"; };
- 08A6B29D0E25A6A5005539F2 /* glv_binding_fltk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_binding_fltk.h; sourceTree = "<group>"; };
- 08A6B29E0E25A6A5005539F2 /* glv_binding_glut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_binding_glut.h; sourceTree = "<group>"; };
- 08A6B29F0E25A6A5005539F2 /* glv_color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_color.h; sourceTree = "<group>"; };
- 08A6B2A00E25A6A5005539F2 /* glv_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_conf.h; sourceTree = "<group>"; };
- 08A6B2A10E25A6A5005539F2 /* glv_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_core.h; sourceTree = "<group>"; };
- 08A6B2A20E25A6A5005539F2 /* glv_draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_draw.h; sourceTree = "<group>"; };
- 08A6B2A30E25A6A5005539F2 /* glv_layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_layout.h; sourceTree = "<group>"; };
- 08A6B2A40E25A6A5005539F2 /* glv_observer_pattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_observer_pattern.h; sourceTree = "<group>"; };
- 08A6B2A50E25A6A5005539F2 /* glv_rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_rect.h; sourceTree = "<group>"; };
- 08A6B2A60E25A6A5005539F2 /* glv_sliders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_sliders.h; sourceTree = "<group>"; };
- 08A6B2A70E25A6A5005539F2 /* glv_texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_texture.h; sourceTree = "<group>"; };
- 08A6B2A80E25A6A5005539F2 /* glv_textview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_textview.h; sourceTree = "<group>"; };
- 08A6B2A90E25A6A5005539F2 /* glv_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glv_util.h; sourceTree = "<group>"; };
08A82B550E11EBF500AAB117 /* dynamic_port.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dynamic_port.hpp; 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>"; };
@@ -367,6 +387,7 @@
080DD7560C13908400EEB53D = {
isa = PBXGroup;
children = (
+ 08A2D5030E2A728A00D8FA04 /* glv */,
08A439340E295B35009845FD /* build */,
0800AC390C8CAAC300994538 /* boost-build.jam */,
0800AC3A0C8CAAC300994538 /* Jamfile.v2 */,
@@ -483,6 +504,75 @@
path = cppgui_gui;
sourceTree = "<group>";
};
+ 08A2D5030E2A728A00D8FA04 /* glv */ = {
+ isa = PBXGroup;
+ children = (
+ 08A2D5040E2A728A00D8FA04 /* COPYRIGHT */,
+ 08A2D5050E2A728A00D8FA04 /* include */,
+ 08A2D5180E2A728A00D8FA04 /* Jamfile */,
+ 08A2D5190E2A728A00D8FA04 /* src */,
+ );
+ name = glv;
+ path = ../../../glv;
+ sourceTree = SOURCE_ROOT;
+ };
+ 08A2D5050E2A728A00D8FA04 /* include */ = {
+ isa = PBXGroup;
+ children = (
+ 08A2D5060E2A728A00D8FA04 /* COPYRIGHT */,
+ 08A2D5070E2A728A00D8FA04 /* glv.h */,
+ 08A2D5080E2A728A00D8FA04 /* glv_abstract_binding.h */,
+ 08A2D5090E2A728A00D8FA04 /* glv_behavior.h */,
+ 08A2D50A0E2A728A00D8FA04 /* glv_binding_carbon.h */,
+ 08A2D50B0E2A728A00D8FA04 /* glv_binding_fltk.h */,
+ 08A2D50C0E2A728A00D8FA04 /* glv_binding_glut.h */,
+ 08A2D50D0E2A728A00D8FA04 /* glv_color.h */,
+ 08A2D50E0E2A728A00D8FA04 /* glv_conf.h */,
+ 08A2D50F0E2A728A00D8FA04 /* glv_core.h */,
+ 08A2D5100E2A728A00D8FA04 /* glv_draw.h */,
+ 08A2D5110E2A728A00D8FA04 /* glv_layout.h */,
+ 08A2D5120E2A728A00D8FA04 /* glv_observer_pattern.h */,
+ 08A2D5130E2A728A00D8FA04 /* glv_rect.h */,
+ 08A2D5140E2A728A00D8FA04 /* glv_sliders.h */,
+ 08A2D5150E2A728A00D8FA04 /* glv_texture.h */,
+ 08A2D5160E2A728A00D8FA04 /* glv_textview.h */,
+ 08A2D5170E2A728A00D8FA04 /* glv_util.h */,
+ );
+ path = include;
+ sourceTree = "<group>";
+ };
+ 08A2D5190E2A728A00D8FA04 /* src */ = {
+ isa = PBXGroup;
+ children = (
+ 08A2D51A0E2A728A00D8FA04 /* COPYRIGHT */,
+ 08A2D51B0E2A728A00D8FA04 /* FontGL */,
+ 08A2D51E0E2A728A00D8FA04 /* glv_abstract_binding.cpp */,
+ 08A2D51F0E2A728A00D8FA04 /* glv_binding_carbon.cpp */,
+ 08A2D5200E2A728A00D8FA04 /* glv_binding_fltk.cpp */,
+ 08A2D5210E2A728A00D8FA04 /* glv_binding_glut.cpp */,
+ 08A2D5220E2A728A00D8FA04 /* glv_color.cpp */,
+ 08A2D5230E2A728A00D8FA04 /* glv_core.cpp */,
+ 08A2D5240E2A728A00D8FA04 /* glv_draw.cpp */,
+ 08A2D5250E2A728A00D8FA04 /* glv_glv.cpp */,
+ 08A2D5260E2A728A00D8FA04 /* glv_inputdevice.cpp */,
+ 08A2D5270E2A728A00D8FA04 /* glv_layout.cpp */,
+ 08A2D5280E2A728A00D8FA04 /* glv_sliders.cpp */,
+ 08A2D5290E2A728A00D8FA04 /* glv_texture.cpp */,
+ 08A2D52A0E2A728A00D8FA04 /* glv_textview.cpp */,
+ 08A2D52B0E2A728A00D8FA04 /* glv_view.cpp */,
+ );
+ path = src;
+ sourceTree = "<group>";
+ };
+ 08A2D51B0E2A728A00D8FA04 /* FontGL */ = {
+ isa = PBXGroup;
+ children = (
+ 08A2D51C0E2A728A00D8FA04 /* FontGL.cpp */,
+ 08A2D51D0E2A728A00D8FA04 /* FontGL.h */,
+ );
+ path = FontGL;
+ sourceTree = "<group>";
+ };
08A4388E0E295AAB009845FD /* src */ = {
isa = PBXGroup;
children = (
@@ -521,7 +611,6 @@
isa = PBXGroup;
children = (
08C617FB0E27E39500FC4F24 /* glvgui_logic.cpp */,
- 08A6B2980E25A6A5005539F2 /* glv */,
08A6B2650E25A566005539F2 /* blueprint_bank.cpp */,
08A6B2660E25A566005539F2 /* blueprint_bank.hpp */,
08A6B2670E25A566005539F2 /* blueprint_component.cpp */,
@@ -534,30 +623,6 @@
path = glv_gui;
sourceTree = "<group>";
};
- 08A6B2980E25A6A5005539F2 /* glv */ = {
- isa = PBXGroup;
- children = (
- 08A6B2990E25A6A5005539F2 /* glv.h */,
- 08A6B29A0E25A6A5005539F2 /* glv_abstract_binding.h */,
- 08A6B29B0E25A6A5005539F2 /* glv_behavior.h */,
- 08A6B29C0E25A6A5005539F2 /* glv_binding_carbon.h */,
- 08A6B29D0E25A6A5005539F2 /* glv_binding_fltk.h */,
- 08A6B29E0E25A6A5005539F2 /* glv_binding_glut.h */,
- 08A6B29F0E25A6A5005539F2 /* glv_color.h */,
- 08A6B2A00E25A6A5005539F2 /* glv_conf.h */,
- 08A6B2A10E25A6A5005539F2 /* glv_core.h */,
- 08A6B2A20E25A6A5005539F2 /* glv_draw.h */,
- 08A6B2A30E25A6A5005539F2 /* glv_layout.h */,
- 08A6B2A40E25A6A5005539F2 /* glv_observer_pattern.h */,
- 08A6B2A50E25A6A5005539F2 /* glv_rect.h */,
- 08A6B2A60E25A6A5005539F2 /* glv_sliders.h */,
- 08A6B2A70E25A6A5005539F2 /* glv_texture.h */,
- 08A6B2A80E25A6A5005539F2 /* glv_textview.h */,
- 08A6B2A90E25A6A5005539F2 /* glv_util.h */,
- );
- path = glv;
- sourceTree = "<group>";
- };
08C675960C13A03E00D85379 /* test */ = {
isa = PBXGroup;
children = (
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-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -5,19 +5,12 @@
import os ;
-lib glv : : <name>glv ;
-
project dataflow/example/glv_gui
: requirements
- <include>../../../..
- <include>glv
- <library>glv
<library>/boost/signals//boost_signals/<link>static
- <library>../../build/managed//dataflow_managed/<link>static
+ <library>$(TOP)/libs/glv//lib_glv/<link>static
+ <library>$(TOP)/libs/dataflow/build/managed//dataflow_managed/<link>static
<define>BOOST_ALL_NO_LIB=1
- <toolset>darwin:<linkflags>"-framework AGL"
- <toolset>darwin:<linkflags>"-framework GLUT"
- <toolset>darwin:<linkflags>"-framework OpenGL"
;
local sources =
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/COPYRIGHT
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/COPYRIGHT 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,40 +0,0 @@
-GLV AUTHORSHIP AND COPYRIGHT NOTICE
-
-Authors
----------------------------------------------------------------------------
-
-Main design and development by Lance Putnam, Wesley Smith, and Graham Wakefield with contributions from:
- Eric Newman,
- Alex Norman,
- Stephen Pope,
- and others,
-all at the Graduate Program in Media Arts and Technology (MAT) at the University of California, Santa Barbara (UCSB).
-
-Contact: Lance Putnam (ljputnam_at_[hidden])
-
-
-
-License
----------------------------------------------------------------------------
-
-Copyright (C) 2006-2008. The Regents of the University of California (REGENTS).
-All Rights Reserved.
-
-Permission to use, copy, modify, distribute, and distribute modified versions
-of this software and its documentation without fee and without a signed
-licensing agreement, is hereby granted, provided that the above copyright
-notice, the list of contributors, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions.
-
-IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
-SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
-OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
-HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
-MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,34 +0,0 @@
-#ifndef INC_GLV_H
-#define INC_GLV_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-/*! \mainpage GLV - OpenGL GUI library
-
- \section intro_sec Introduction
-
- GLV (short for GL View) 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
- OpenGL instructions, thus freeing CPU resources for other work
- (e.g. audio DSP).
-
-*/
-
-/*
- helpful include file to include all of GLV at once
-*/
-
-// GLV core:
-#include "glv_core.h"
-#include "glv_behavior.h"
-#include "glv_layout.h"
-
-// widgets:
-#include "glv_sliders.h"
-#include "glv_textview.h"
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_abstract_binding.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_abstract_binding.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,67 +0,0 @@
-#ifndef INC_GLV_ABSTRACT_BINDING_H
-#define INC_GLV_ABSTRACT_BINDING_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-namespace glv{
-
-class GLV;
-
-
-class AbstractWindow{
-
-public:
- AbstractWindow(unsigned int width=800, unsigned int height=600, char * title="GLV Window", GLV * glv=0, double framerate=40.0);
- virtual ~AbstractWindow(){}
-
- 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;
- bool mFullscreen;
- bool mVisible;
- bool mIsActive;
- bool mHideCursor;
-
- bool shouldDraw(); // if the GLV views should be drawn
-
- // These virtuals should be overridden for the specific bindings
- virtual void platformFullscreen(){}
- virtual void platformHideCursor(bool hide){}
- virtual void platformResize(int width, int height){} // platform specific resize stuff
- virtual void platformShowHide(){} // platform specific show/hide stuff
-};
-
-
-
-class AbstractApplication{
-public:
-
- static void run();
- static void quit();
-// static void windowNotify(Notifier * sender, void * userdata);
-
-protected:
- static AbstractWindow *focusedWindow;
-};
-
-
-} // glv::
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_behavior.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_behavior.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,44 +0,0 @@
-#ifndef INC_GLV_BEHAVIOR_H
-#define INC_GLV_BEHAVIOR_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_core.h"
-
-namespace glv{
-
-namespace Behavior{
-
- static bool mouseMove(View * v, GLV & glv){
- if(glv.mouse.right()){
- v->move(glv.mouse.dx(), glv.mouse.dy());
- }
- return false;
- }
-
- static bool mouseResize(View * v, GLV & glv){
- if(glv.mouse.middle()){
-
- float dx = glv.mouse.dx();
- float dy = glv.mouse.dy();
- float mx = glv.mouse.xRel() / v->w;
- float my = glv.mouse.yRel() / v->h;
-
- if(mx < 0.5){
- v->resizeLeftTo(v->l + dx);
- my < 0.5 ? v->resizeTopTo(v->t + dy) : v->resizeBottomTo(v->bottom() + dy);
- }
- else{
- v->resizeRightTo(v->right() + dx);
- my < 0.5 ? v->resizeTopTo(v->t + dy) : v->resizeBottomTo(v->bottom() + dy);
- }
- v->fixNegativeExtent();
- }
- return false;
- }
-
-} // Behavior::
-} // glv::
-
-#endif
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_carbon.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_carbon.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,69 +0,0 @@
-#ifndef INC_GLV_BINDING_CARBON_H
-#define INC_GLV_BINDING_CARBON_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#define GLV_CARBON_PATH_DEFAULT_FONT "/Library/Frameworks/GLV.framework/Versions/A/Resources/ProFontWindows.ttf"
-
-typedef ::Rect CarbonRect;
-
-#include "glv_core.h"
-#include "glv_abstract_binding.h"
-
-//#include <Carbon/Carbon.h>
-#include <AGL/agl.h>
-#include <map>
-#include <string>
-
-namespace glv {
-
-class Application : public AbstractApplication
-{
-public:
-
- static void run();
- static void quit();
-
-protected:
-
- static EventHandlerRef * carbonApplicationHandlerRef;
- static OSStatus carbonApplicationHandler(EventHandlerCallRef nextHandler, EventRef e, void * udata);
-
-};
-
-#define CARBON_TITLEBARHEIGHT (24)
-
-class Window : public AbstractWindow
-{
-public:
-
- Window(unsigned int width=800, unsigned int height=600, char * title="GLV Window", GLV * glv=0, double framerate=40);
- virtual ~Window();
-
-protected:
- virtual void platformResize(int width, int height); // called at tail of AbstractWindow::resize()
- virtual void platformShowHide(); // called at tail of AbstractWindow::show()
-
- // Carbon window pointer:
- WindowRef windowRef;
-
- // Carbon event system callbacks:
- EventLoopTimerUPP timerUPP;
- static OSStatus carbonWindowHandler(EventHandlerCallRef nextHandler, EventRef e, void * udata);
- static pascal void carbonWindowDrawHandler(EventLoopTimerRef inTimer, void * userData);
-
- // OpenGL driver & state:
- AGLContext aglcontext;
- CarbonRect rectport;
- GDHandle graphicsdevice;
- GLint attrib[64];
- AGLPixelFormat pixelformat;
-
- std::map<UInt32, std::string> eventClassDescription;
- std::map<UInt32, std::string> eventKindDescription;
-};
-
-} // namespace
-
-#endif
\ No newline at end of file
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_fltk.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_fltk.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,65 +0,0 @@
-#ifndef INC_GLV_BINDING_FLTK_H
-#define INC_GLV_BINDING_FLTK_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_core.h"
-#include "glv_abstract_binding.h"
-
-#include <FL/Fl.H>
-#include <FL/Fl_Gl_Window.H>
-#include <FL/gl.h>
-
-//#define GLV_KEY_BACKSPACE FL_BackSpace
-//#define GLV_KEY_DELETE FL_Delete
-//#define GLV_KEY_ENTER FL_Enter
-//#define GLV_KEY_ESC FL_Escape
-//#define GLV_KEY_TAB FL_Tab
-//#define GLV_KEY_PAUSE FL_Pause
-//#define GLV_KEY_SCROLL_LOCK FL_Scroll_Lock
-//#define GLV_KEY_HOME FL_Home
-//#define GLV_KEY_LEFT FL_Left
-//#define GLV_KEY_UP FL_Up
-//#define GLV_KEY_RIGHT FL_Right
-//#define GLV_KEY_DOWN FL_Down
-//#define GLV_KEY_PAGE_UP FL_Page_Up
-//#define GLV_KEY_PAGE_DOWN FL_Page_Down
-//#define GLV_KEY_END FL_End
-//#define GLV_KEY_PRINT FL_Print
-//#define GLV_KEY_INSERT FL_Insert
-//#define GLV_KEY_NUM_LOCK FL_Num_Lock
-//#define GLV_KEY_F FL_F /* use GLV_KEY_F + n for function key n */
-
-namespace glv {
-
-class Application : public AbstractApplication{
-public:
- static void run();
- static void quit();
-protected:
-
-};
-
-class Window : public AbstractWindow, public Fl_Gl_Window{
-public:
- Window(unsigned int width = 800, unsigned int height = 600, char * title = "GLV Window", double framerate = 40.0);
- virtual ~Window();
-
-protected:
- bool mFullscreenDeferred;
- void draw(); // FLTK draw callback
- int handle(int event); // FLTK event callback
- void resize(int l, int t, int w, int h); // FLTK resize callback
- void fltkFullscreen(); // FLTK fullscreen called at start of draw loop
- static void scheduleDraw(void * userdata);
-
- virtual void platformFullscreen(); // defers fullscreen to draw loop for thread safety
- virtual void platformResize(int width, int height); // called at tail of AbstractWindow::resize()
- virtual void platformShowHide(); // called at tail of AbstractWindow::show()
-};
-
-} // namespace
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_glut.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_binding_glut.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,48 +0,0 @@
-#ifndef INC_GLV_BINDING_GLUT_H
-#define INC_GLV_BINDING_GLUT_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_core.h"
-#include "glv_abstract_binding.h"
-
-#if defined (__APPLE__) || defined (OSX)
- #include <GLUT/glut.h>
-#endif
-#if defined(__linux__)
- #include <GL/glut.h>
-#endif
-#ifdef WIN32
- #include <?/glut.h>
-#endif
-
-namespace glv {
-
-class Application : public AbstractApplication{
-public:
- static void run();
- static void quit();
-
-protected:
-};
-
-class Window : public AbstractWindow{
-public:
- Window(unsigned int width=800, unsigned int height=600, char * title="GLV Window", GLV * glv=0, double framerate=40);
- virtual ~Window();
-
- void draw(); // GLUT draw function
-
-protected:
-
- virtual void platformFullscreen();
- virtual void platformHideCursor(bool hide);
- virtual void platformResize(int width, int height); // called at tail of AbstractWindow::resize()
- virtual void platformShowHide(); // called at tail of AbstractWindow::show()
-};
-
-} // namespace
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_color.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_color.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,125 +0,0 @@
-#ifndef INC_GLV_COLOR_H
-#define INC_GLV_COLOR_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_util.h"
-#include <stdio.h>
-
-namespace glv {
-
-class HSV;
-
-/// An RGBA color.
-struct Color{
-
- float r; ///< Red component in [0, 1]
- float g; ///< Green component in [0, 1]
- float b; ///< Blue component in [0, 1]
- float a; ///< Alpha component in [0, 1]
-
- /// @param[in] r red component
- /// @param[in] g green component
- /// @param[in] b blue component
- /// @param[in] a alpha component
- Color(float r, float g, float b, float a = 1.f);
-
- /// @param[in] gray red/green/blue components
- /// @param[in] a alpha component
- Color(float gray=1.f, float a=1.f);
-
- Color(const HSV& hsv, float a=1.f);
-
- // Setters
-
- Color& operator= (const HSV& hsv);
-
- void set(float r, float g, float b, float a); ///< Set r, g, b, and a components
- void set(float r, float g, float b); ///< Set r, g, and b components
- void set(const Color& other, float rgbScale=1); ///< Copy another Color's colors
- void set(float gray); ///< Set as gray color
- void set(float gray, float alpha); ///< Set as gray color with alpha
- void invert(); ///< Invert colors
- void scale(float amount); ///< Scale r, g, and b values
-
- /// Set color from HSV values in [0, 1]
- void setHSV(float h, float s, float v);
-
- /// Get HSV values in [0, 1] from color
- void getHSV(float &h, float &s, float &v) const;
-
- /// Set color from H value in [0, 6] and SV values in [0, 1].
- void setHSV6(float h, float s, float v);
-
- /// Get H value in [0, 6] and SV values in [0, 1] from color.
- void getHSV6(float &h, float &s, float &v) const;
-
- void print(const char * append="\n", FILE * fp=stdout) const;
-};
-
-
-struct HSV{
-
- float h, s, v;
-
- HSV(): h(0), s(1), v(1){}
- HSV(float h, float s, float v): h(h), s(s), v(v){}
- HSV(const Color& c){ *this = c; }
-
- HSV& operator=(const Color& c){
- c.getHSV(h, s, v); return *this;
- }
-};
-
-
-
-// Implementation ______________________________________________________________
-
-inline Color::Color(float r, float g, float b, float a)
-: r(r), g(g), b(b), a(a)
-{}
-
-inline Color::Color(float v, float a)
-: r(v), g(v), b(v), a(a)
-{}
-
-inline Color::Color(const HSV& hsv, float a)
-: a(a)
-{
- setHSV(hsv.h, hsv.s, hsv.v);
-}
-
-
-inline Color& Color::operator=(const HSV& hsv){
- setHSV(hsv.h, hsv.s, hsv.v); return *this;
-}
-
-inline void Color::set(float re, float gr, float bl, float al){
- r = re; g = gr; b = bl; a = al;
-}
-
-inline void Color::set(float re, float gr, float bl){ set(re, gr, bl, a); }
-
-inline void Color::set(const Color & c, float rgbScale){
- set(c.r, c.g, c.b, c.a);
- scale(rgbScale);
-}
-inline void Color::set(float v){ set(v,v,v); }
-inline void Color::set(float v, float al){ set(v,v,v,al); }
-inline void Color::invert(){ set(1.f - r, 1.f - g, 1.f - b); }
-inline void Color::scale(float v){ set(r*v, g*v, b*v); }
-
-inline void Color::setHSV(float h, float s, float v){
- setHSV6(h * 6.f, s, v);
-}
-
-inline void Color::getHSV(float &h, float &s, float &v) const{
- getHSV6(h,s,v);
- h *= 0.166666667f; // 0..1
-}
-
-} // glv::
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_conf.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_conf.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,78 +0,0 @@
-#ifndef INC_GLV_CONF_H
-#define INC_GLV_CONF_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#define GLV_VERSION "0.79"
-#define GLV_MAX_MOUSE_BUTTONS 8
-
-
-// Macros for binding GLV to a specific platform's windowing system.
-// Type "#include GLV_BINDING_H" in the source files that need it.
-#ifndef GLV_BINDING_H
- #if defined (__APPLE__) || defined (OSX)
- #define GLV_BINDING_H "glv_binding_carbon.h"
- #endif
- #if defined(__linux__)
- #define GLV_BINDING_H "glv_binding_glut.h"
- #endif
- #ifdef WIN32
- #define GLV_BINDING_H ""
- #endif
-#endif
-
-
-// OpenGL platform-dependent includes
-#if defined (__APPLE__) || defined (OSX)
-
- #define GLV_PLATFORM "OSX"
-
- //#include <Carbon/Carbon.h>
- //#include <AGL/agl.h>
- //#include <AGL/aglRenderers.h>
- #include <OpenGL/OpenGL.h>
- #include <OpenGL/gl.h>
- #include <OpenGL/glext.h>
- #include <OpenGL/glu.h>
-
- #define C2CFSTR(cstr) CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingMacRoman)
-
- #define GLV_PLATFORM_INIT\
- GLint MacHackVBL = 1;\
- CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &MacHackVBL);
-
-#endif
-
-#if defined(__linux__)
-
- #define GLV_PLATFORM "UNIX"
-
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <time.h>
-
- #define GLV_PLATFORM_INIT
-
-#endif
-
-#ifdef WIN32
-
- #define GLV_PLATFORM "WIN32"
-
- #include <windows.h>
-
- #include <gl/gl.h>
- #include <gl/glu.h>
-
- #pragma comment( lib, "winmm.lib")
- #pragma comment( lib, "opengl32.lib" )
- #pragma comment( lib, "glu32.lib" )
-
- #define GLV_PLATFORM_INIT
-
-#endif
-
-
-
-#endif
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_core.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_core.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,578 +0,0 @@
-#ifndef INC_GLV_CORE_H
-#define INC_GLV_CORE_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_rect.h"
-#include "glv_observer_pattern.h"
-#include "glv_color.h"
-#include "glv_draw.h"
-
-#include <map>
-#include <string>
-#include <list>
-
-namespace glv {
-
-class GLV;
-class View;
-
-/// Type for graphical space values, i.e. dimensions, extents, positions, etc..
-typedef float space_t;
-
-/// Type for View rectangle geometry
-typedef TRect<space_t> Rect;
-
-/// Type for a drawing callback
-typedef void (*drawCallback)(View * v);
-
-/// Type for an event callback
-
-/// The first parameter is the View receiving the event and the second is the
-/// GLV context sending the event. The function returns true if the event is
-/// to be bubbled up to the receiver's parent View.
-typedef bool (*eventCallback)(View * v, GLV& glv);
-
-/// Type for a list of event callbacks
-typedef std::list<eventCallback> eventCallbackList;
-
-
-
-/// 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 */
-};
-
-
-
-/// Direction types
-struct Direction{
-
- /// Direction enumeration
- enum{
- N = 1<<0, /**< North */
- E = 1<<1, /**< East */
- S = 1<<2, /**< South */
- W = 1<<3 /**< West */
- };
-
- Direction(): val(0){}
- Direction(int v): val(v){}
- operator int(){ return val; }
- int val;
-};
-
-
-
-/// Recognized event types.
-namespace Event{
-
- /// Event type enum
- enum t{
- Null = 0, /**< No event */
-
- // core events
- Quit, /**< Application quit */
-
- // view events
- GetFocus, /**< View got focus */
- LoseFocus, /**< View lost focus */
-
- // mouse events
- MouseDown, /**< Mouse button pressed */
- MouseUp, /**< Mouse button released */
- MouseMove, /**< Mouse has moved */
- MouseDrag, /**< Mouse has moved with a button pressed */
- MouseWheel, /**< Mouse wheel moved */
-
- // keyboard events
- KeyDown, /**< Keyboard key pressed*/
- KeyUp, /**< Keyboard key released */
- KeyRepeat, /**< Keyboard key auto-repeated */
-
- // window events
- // WindowActivated,
- // WindowDeactivated,
- Unused, /**< Add to this for runtime event types */
- NumTypes /**< Number of event types */
- };
-
- /// Returns a string of event type.
- const char * string(const Event::t e);
-}
-
-
-
-/// Constants of keyboard keys.
-namespace Key{
- enum t{
-
- // Standard ASCII non-printable characters
- Enter =3, /**< */
- BackSpace =8, /**< */
- Tab =9, /**< */
- Return =13, /**< */
- Escape =27, /**< */
- Delete =127, /**< */
-
- // Non-standard, but common keys.
- F1=256, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
- Insert, Left, Up, Right, Down, PageDown, PageUp, End, Home,
- };
-}
-
-
-
-/// Placement types
-namespace Place{
- enum t{
- TC=1<<0, /**< Top-center */
- TR=1<<1, /**< Top-right */
- CR=1<<2, /**< Center-right */
- BR=1<<3, /**< Bottom-right */
- BC=1<<4, /**< Bottom-center */
- BL=1<<5, /**< Bottom-left */
- CL=1<<6, /**< Center-left */
- TL=1<<7, /**< Top-left */
- CC=1<<8 /**< Center-center */
- };
-}
-
-
-
-/// Holds keyboard state.
-class Keyboard{
- friend class GLV;
-public:
-
- /// Constructor.
- Keyboard();
- ~Keyboard(){}
-
- int key() const; ///< Returns key code (non-shifted character) of last key event.
- int keyAsNumber() const;///< Returns decimal number correlating to key code
- bool alt() const; ///< Whether an alt key is down.
- bool caps() const; ///< Whether capslock is down.
- bool ctrl() const; ///< Whether a ctrl key is down.
- bool meta() const; ///< Whether a meta (e.g. windows, apple) key is down.
- bool shift() const; ///< Whether a shift key is down.
- bool isDown() const; ///< Whether last event was button down.
- bool isNumber() const; ///< Whether key is a number key
- bool key(int k) const; ///< Whether the last key was 'k'.
-
- void alt (bool state); ///< Set alt key state.
- void caps (bool state); ///< Set alt key state.
- void ctrl (bool state); ///< Set ctrl key state.
- void meta (bool state); ///< Set meta key state.
- void shift(bool state); ///< Set shift key state.
-
- void print(); ///< Print keyboard state to stdout.
-
-protected:
- int mKeycode; // last key event key number
- bool mIsDown; // last key event state (pressed or released)
- bool mModifiers[5]; // Modifier key state array (shift, alt, ctrl, caps, meta)
-};
-
-
-
-/// Holds mouse state.
-class Mouse{
-friend class GLV;
-public:
-
- /// Mouse button enumeration
- enum{ Left = 0, Middle, Right, Extra = (GLV_MAX_MOUSE_BUTTONS - 1) };
-
- /// Constructor.
- Mouse();
- ~Mouse(){};
-
- // Accessors
- space_t x() const; ///< Current x position.
- space_t y() const; ///< Current y position.
- space_t x(int button) const; ///< Get button's last down x position.
- space_t y(int button) const; ///< Get button's last down y position.
- space_t w() const; ///< Current wheel position.
-
- space_t dx() const; ///< Current x velocity.
- space_t dy() const; ///< Current y velocity.
- space_t dw() const; ///< Current wheel velocity.
- space_t ddx() const; ///< Current x acceleration.
- space_t ddy() const; ///< Current y acceleration.
- space_t ddw() const; ///< Current wheel acceleration.
-
- space_t xRel() const; ///< Current x position relative to current listener.
- space_t yRel() const; ///< Current y position relative to current listener.
-
- int button() const; ///< Last event button number.
- int clicks() const; ///< Number of sequential clicks of buttons.
- bool isDown() const; ///< Whether last event was button down.
- bool isDown(int button) const; ///< Whether button is currently down.
- bool left() const; ///< Whether left button is currently down.
- bool middle() const; ///< Whether middle button is currently down.
- bool right() const; ///< Whether right button is currently down.
-
-
- void setContext(View * v); ///< Translate relative pos into sub-View.
- void unsetContext(View * v);///< Translate relative pos out of sub-View.
-
- void print(); ///< Print out information about Mouse to stdout
-
-protected:
-
- // Current (0) and previous (1,2) absolute mouse positions
- space_t mX[3], mY[3], mW[3];
-
- // Mouse coords in the current listener's relative coordinate space.
- space_t mXRel, mYRel;
-
- bool b[GLV_MAX_MOUSE_BUTTONS]; // button-down states
- space_t bx[GLV_MAX_MOUSE_BUTTONS]; // button-down absolute coordinates
- space_t by[GLV_MAX_MOUSE_BUTTONS];
-
- int mButton;
- int mClicks;
- bool mIsDown;
-
- void bufferPos(space_t newPos, space_t * prev3Pos);
- void pos(int x1, int y1);
- void posRel(space_t relx, space_t rely);
- void updateButton(int btn, bool pressed, int clicks);
-};
-
-
-
-/// Color style for View appearance.
-class StyleColor{
-public:
- StyleColor();
-
- enum{ BlackOnWhite, Gray, WhiteOnBlack };
-
- Color back; ///< Background
- Color border; ///< Border outline
- Color fore; ///< Foreground
- Color text; ///< Text
-
- void set(int preset);
- void hsv(float h, float s=1, float v=1);
-};
-
-
-
-/// Overall appearance scheme.
-class Style : public SmartPointer{
-public:
- Style(bool deletable): SmartPointer(deletable){}
-
- StyleColor color; ///< Color style
-
- /// Get reference to standard style
- static Style& standard(){
-
- // Note: This uses a Construct On First Use Idiom to avoid unpredictable
- // static initialization order. The memory allocated will get freed from
- // the heap when the program exits.
- static Style* ans = new Style(false);
- return *ans;
- }
-};
-
-
-
-/// The base class of all GUI elements.
-class View : public Rect, public Notifier {
-
-friend class GLV;
-
-public:
-
- /// @param[in] left Initial left edge position
- /// @param[in] top Initial top edge position
- /// @param[in] width Initial width
- /// @param[in] height Initial height
- /// @param[in] cb Drawing callback
- View(space_t left, space_t top, space_t width, space_t height, drawCallback cb=0);
-
-
- /// @param[in] rect Rect geometry of View
- /// @param[in] anchor Anchor place
- /// @param[in] cb Drawing callback
- View(const Rect& rect=Rect(200, 200), Place::t anchor=Place::TL, drawCallback cb=0);
-
- virtual ~View();
-
- // Doubly linked tree list of views
- // TODO: move this stuff to a Node sub-class
- View * parent; ///< My parent view
- View * child; ///< My first child (next to be drawn)
- View * sibling; ///< My next sibling view (drawn after all my children)
- void add(View & child); ///< Add a child view to myself, and update linked lists
- void makeLastSibling();
- void remove(); ///< Remove myself from the parent view, and update linked lists
-
- /// Add a child view to myself
- View& operator << (View& child){ add( child); return *this; }
- View& operator << (View* child){ add(*child); return *this; }
-
-
- /// Map of event callback sequences.
- std::map<Event::t, eventCallbackList> callbackLists;
-
- 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
- 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);
-
- /// Set anchor place on parent
- View& anchor(Place::t parentPlace);//{ mAnchor = parentPlace; return *this; }
-
- /// Append callback to a specific event type callback sequence.
- void appendCallback(Event::t type, eventCallback cb);
-
- /// 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);
-
- /// Returns View under these absolute coordinates or 0 if none.
-
- /// The coordinates are modified to be relative to the returned View's.
- ///
- 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);
-
-
-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 reanchor(space_t dx, space_t dy); // Reanchor when parent resizes
-};
-
-
-/// The top-level View.
-
-///
-///
-class GLV : public View{
-public:
-
- /// @param[in] cb My drawing callback
- /// @param[in] width Initial width
- /// @param[in] height Initial height
- GLV(drawCallback cb = 0, space_t width = 800, space_t height = 600);
-
- Mouse mouse; ///< Current mouse state
- Keyboard keyboard; ///< Current keyboard state
-
-
- /// GLV MAIN RENDER LOOP: draw all Views in the GLV
- /// The assumption is that we are inside an OpenGL context of size [w, h]
- virtual void drawGLV(unsigned int w, unsigned int h);
-
- /// Draws all acive widgest in the GLV
- void drawWidgets(unsigned int w, unsigned int h);
-
- void eventType(Event::t e){ mEventType = e; }
- Event::t eventType() const { return mEventType; }
-
- /// Clears color and depth buffers. Prepares OpenGL context for draw loop
- void preamble(unsigned int w, unsigned int h);
-
- /// Update input event state; called by external event handlers.
- /// be sure to set the eventType first!
- void propagateEvent();
-
- /// set current event target:
- void setFocus(View * v);
-
- void setKeyDown(int keycode); // Sets keyboard and GLV event state
- void setKeyUp(int keycode); // Sets keyboard and GLV event state
-
- /// this function will modify the input coordinates to be relative to the target view's origin
- void setMouseDown(space_t& x, space_t& y, int button, int clicks);
-
- /// this function will modify the input coordinates to be relative to the target view's origin
- void setMouseDrag(space_t& x, space_t& y);
-
- // LJP: Deprecated. This doesn't work right when multiple buttons are held down.
- void setMouseDrag(space_t& x, space_t& y, int button, int clicks);
-
- void setMousePos(int x, int y, space_t relx, space_t rely);
-
- /// this function will modify the input coordinates to be relative to the target view's origin
- void setMouseUp(space_t& x, space_t& y, int button, int clicks);
-
- void setMouseMove(space_t& x, space_t& y);
-
- void setMouseWheel(int wheelDelta); // Sets mouse and GLV event state
-
-protected:
- View * mFocusedView; // current focused widget
- Event::t mEventType; // current event type
-
- // Returns whether the event should be bubbled to parent
- bool doEventCallbacks(View& target, glv::Event::t e);
-
- void doFocusCallback(bool get); // Call get or lose focus callback of focused view
-};
-
-
-
-
-
-
-
-// Implementation ______________________________________________________________
-
-// View
-inline int View::enabled(int prop) const { return mFlags & prop; }
-inline int View::visible() const { return enabled(Visible); }
-
-inline View& View::disable (int prop){ mFlags &=~prop; return *this; }
-inline View& View::enable (int prop){ mFlags |= prop; return *this; }
-inline View& View::property(int prop, bool v){ v ? enable(prop) : disable(prop); return *this; }
-inline View& View::toggle (int prop){ mFlags ^= prop; return *this; }
-
-// Keyboard
-inline int Keyboard::key() const { return mKeycode; }
-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::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;}
-inline void Keyboard::ctrl (bool state){mModifiers[2] = state;}
-inline void Keyboard::meta (bool state){mModifiers[4] = state;}
-inline void Keyboard::shift(bool state){mModifiers[0] = state;}
-
-// Mouse
-inline space_t Mouse::x() const { return mX[0]; }
-inline space_t Mouse::y() const { return mY[0]; }
-inline space_t Mouse::x(int button) const { return bx[button]; }
-inline space_t Mouse::y(int button) const { return by[button]; }
-inline space_t Mouse::w() const { return mW[0]; }
-inline space_t Mouse::dx() const { return mX[0] - mX[1]; }
-inline space_t Mouse::dy() const { return mY[0] - mY[1]; }
-inline space_t Mouse::dw() const { return mW[0] - mW[1]; }
-inline space_t Mouse::ddx() const { return mX[0] - 2 * mX[1] + mX[2]; }
-inline space_t Mouse::ddy() const { return mY[0] - 2 * mY[1] + mY[2];; }
-inline space_t Mouse::ddw() const { return mW[0] - 2 * mW[1] + mW[2];; }
-inline space_t Mouse::xRel() const { return mXRel; }
-inline space_t Mouse::yRel() const { return mYRel; }
-inline int Mouse::button() const { return mButton; }
-inline int Mouse::clicks() const { return mClicks; }
-inline bool Mouse::isDown() const { return mIsDown; }
-inline bool Mouse::isDown(int button) const { return b[button]; }
-inline bool Mouse::left() const { return b[Left]; }
-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::pos(int x, int y) {
- bufferPos((space_t)x, mX);
- bufferPos((space_t)y, mY);
-}
-inline void Mouse::bufferPos(space_t newPos, space_t * pos){
- pos[2] = pos[1];
- pos[1] = pos[0];
- pos[0] = newPos;
-}
-inline void Mouse::posRel(space_t relx, space_t rely){
- mXRel = relx; mYRel = rely;
-}
-
-
-
-} // glv::
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_draw.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_draw.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,359 +0,0 @@
-#ifndef INC_GLV_DRAW_H
-#define INC_GLV_DRAW_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include <math.h>
-#include "glv_conf.h"
-#include "glv_color.h"
-
-namespace glv {
-
-/// Drawing routines.
-namespace draw{
-
-const double C_PI = 4. * atan(1.);
-const double C_2PI = 2. * C_PI;
-
-#ifdef check
- #undef check
-#endif
-
-// primitives
-enum{
- LineLoop = GL_LINE_LOOP,
- LineStrip = GL_LINE_STRIP,
- Lines = GL_LINES,
- Points = GL_POINTS,
- TriangleFan = GL_TRIANGLE_FAN,
- TriangleStrip = GL_TRIANGLE_STRIP,
- Triangles = GL_TRIANGLES,
- QuadStrip = GL_QUAD_STRIP,
- Quads = GL_QUADS
-};
-
-// capabilities (for disable() and enable())
-enum{
- Blend = GL_BLEND,
- DepthTest = GL_DEPTH_TEST,
- LineSmooth = GL_LINE_SMOOTH,
- LineStipple = GL_LINE_STIPPLE,
- PolygonSmooth = GL_POLYGON_SMOOTH,
- PointSmooth = GL_POINT_SMOOTH,
- ScissorTest = GL_SCISSOR_TEST
-};
-
-// attribute masks
-enum{
- ColorBufferBit = GL_COLOR_BUFFER_BIT,
- DepthBufferBit = GL_DEPTH_BUFFER_BIT,
- EnableBit = GL_ENABLE_BIT,
- ViewPortBit = GL_VIEWPORT_BIT
-};
-
-enum{
- Model = GL_MODELVIEW,
- Projection = GL_PROJECTION,
- Texture = GL_TEXTURE
-};
-
-struct Glyph{
- enum{ Once=(1<<7), Dot1=(1<<5), Dot2=(2<<5), MaskDots=96, MaskSize=31 };
-
- 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) ; }
-};
-
-
-
-// Basic rendering commands
-void begin(int primitive); ///< Begin vertex group delimitation
-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 identity(); ///< Load identity transform matrix
-void lineStipple(char factor, short pattern); ///< Specify line stipple pattern
-void lineWidth(float val); ///< Set width of lines
-void matrixMode(int mode); ///< Set current transform matrix
-void ortho(float l, float r, float b, float t); ///< Set orthographic projection mode
-void pointSize(float val); ///< Set size of points
-void pop(); ///< Pop current transform matrix stack
-void pop(int matrixMode); ///< Pop a transform matrix stack also setting as current matrix
-void pop2D(); ///< Pop 2-D pixel space
-void pop3D(); ///< Pop 3-D signed normalized cartesian space
-void popAttrib(); ///< Pop last pushed attributes from stack
-void push(); ///< Push current transform matrix stack
-void push(int matrixMode); ///< Push a transform matrix stack also setting as current matrix
-template <class T> void push2D(T w, T h); ///< Push 2-D pixel space
-template <class T> void push3D(T w, T h, T near=0.1, T far=100); ///< Push 3-D signed normalized cartesian space
-void pushAttrib(int attribs); ///< Push current attributes onto stack
-void rotate(float degx, float degy, float degz);
-void rotateX(float deg);
-void rotateY(float deg);
-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 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 T>
-void vertexY(T * ys, unsigned long len, T xInc=1, int prim = LineStrip);
-
-template <class T>
-void vertex(T * xs, T * ys, unsigned long len, int prim = LineStrip);
-
-
-// icons
-void check (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);
-void rect (float l, float t, float r, float b);
-void triangleR (float l, float t, float r, float b);
-void triangleL (float l, float t, float r, float b);
-void triangleU (float l, float t, float r, float b);
-void triangleD (float l, float t, float r, float b);
-void x (float l, float t, float r, float b);
-
-/// Parallel horizontal and vertical lines
-void grid(float l, float t, float w, float h, float divx, float divy, bool incEnds=true);
-
-void linePattern(float l, float t, float w, float h, int n, const char * pat="/");
-
-/// Parallel horizontal lines
-void linesH(float l, float t, float w, float h, int n);
-
-/// Converts a float to its pixel value.
-inline int pix(float v);
-
-/// Regular polygon
-void pgon(float l, float t, float w, float h, int sides, float angleNorm=0);
-
-void shape(int prim, float x0, float y0, float x1, float y1);
-void shape(int prim, float x0, float y0, float x1, float y1, float x2, float y2);
-void shape(int prim, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3);
-
-void spokes(float l, float t, float w, float h, int sides, float angleNorm=0);
-
-/// Sends vertex calls for a printable ascii character.
-
-/// This function must be called within a begin(Lines) and end().
-/// The coordinate system is an 8x8 grid with top-left at (0,0).
-bool character(int c, float dx=0, float dy=0);
-
-/// Draws a text string, including new lines and tabs.
-
-/// The spacing between characters is fixed at 8 units.
-///
-void text(const char * s, float l=0, float t=0, float lineSpacing=1, unsigned int tabSpaces=4);
-
-
-
-
-
-// Implementation ______________________________________________________________
-
-inline void check(float l, float t, float r, float b){
- shape(LineStrip, l,0.5*(t+b), l+(r-l)*0.3,b, r,t);
-}
-
-inline void frame(float l, float t, float r, float b){
- shape(LineLoop, l, t, l, b, r, b, r, t);
-}
-
-inline void minus(float l, float t, float r, float b){
- float my = 0.5*(t+b);
- shape(Lines, l,my, r,my);
-}
-
-// [-2,-1) -> -1.5
-// [-1, 0) -> -0.5
-// [ 0, 1) -> 0.5
-// [ 1, 2) -> 1.5
-inline int pix(float v){ return v>=0 ? (int)(v+0.5) : (int)(v-0.5); }
-
-inline void plus(float l, float t, float r, float b){
- float mx = 0.5*(l+r);
- float my = 0.5*(t+b);
- shape(Lines, mx,t, mx,b, l,my, r,my);
-}
-
-inline void rect(float l, float t, float r, float b){
- glRectf(r, b, l, t);
-}
-
-inline void shape(int primitive, float x0, float y0, float x1, float y1){
- begin(primitive);
- vertex(x0, y0); vertex(x1, y1);
- end();
-}
-
-inline void shape(int primitive, float x0, float y0, float x1, float y1, float x2, float y2){
- begin(primitive);
- vertex(x0, y0); vertex(x1, y1); vertex(x2, y2);
- end();
-}
-
-inline void shape(int primitive, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3){
- begin(primitive);
- vertex(x0, y0); vertex(x1, y1); vertex(x2, y2); vertex(x3, y3);
- end();
-}
-
-inline void triangleD(float l, float t, float r, float b){
- shape(Triangles, 0.5*(l+r),b, r,t, l,t);
-}
-
-inline void triangleL(float l, float t, float r, float b){
- shape(Triangles, l,0.5*(t+b), r,b, r,t);
-}
-
-inline void triangleR(float l, float t, float r, float b){
- shape(Triangles, r,0.5*(t+b), l,t, l,b);
-}
-
-inline void triangleU(float l, float t, float r, float b){
- shape(Triangles, 0.5*(l+r),t, l,b, r,b);
-}
-
-inline void x(float l, float t, float r, float b){
- shape(Lines, l,t, r,b, l,b, r,t);
-}
-
-
-
-
-
-
-// core drawing routines
-inline void color(float v, float a){ color(v,v,v,a); }
-
-inline void color(const Color& c){ color(c.r, c.g, c.b, c.a); }
-
-inline void color(const Color& c, float a){ color(c.r, c.g, c.b, a); }
-
-inline void pop(int mode){ matrixMode(mode); pop(); }
-inline void push(int mode){ matrixMode(mode); push(); }
-
-inline void rotate(float degx, float degy, float degz){
- rotateX(degx); rotateY(degy); rotateZ(degz);
-}
-
-inline void translateX(float x){ translate(x, 0, 0); }
-inline void translateY(float y){ translate(0, y, 0); }
-inline void translateZ(float z){ translate(0, 0, z); }
-
-template <class T>
-void vertexY(T * ys, unsigned long len, T xInc=1, int prim = LineStrip){
- begin(prim);
- for(unsigned long i=0; i<len; ++i) vertex((float)(xInc * i), (float)ys[i]);
- end();
-}
-
-template <class T>
-void vertex(T * xs, T * ys, unsigned long len, int prim){
- begin(prim);
- for(unsigned long i=0; i<len; ++i) vertex((float)xs[i], (float)ys[i]);
- end();
-}
-
-
-
-// platform dependent
-
-inline void begin(int primitive){ glBegin(primitive); }
-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);
-
- push(Projection); pushAttrib(ViewPortBit); identity();
- viewport(0, 0, w, h);
- ortho(0, w, h, 0); // flat 2D world dimension L,R,B,T
-
- push(Model); identity();
-}
-
-
-inline void pop2D(){
- popAttrib(); // for popping GL_VIEWPORT_BIT
- pop(Projection);
- pop(Model);
-}
-
-
-template <class T>
-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, near, far);
-
- push(Model); identity();
- translate(0, 0, -2.42);
-}
-
-
-inline void pop3D(){
- popAttrib(); // for popping GL_DEPTH_BUFFER_BIT
- pop(Projection);
- pop(Model);
-}
-
-inline void identity(){ glLoadIdentity(); }
-inline void lineStipple(char factor, short pattern){ glLineStipple(factor, pattern); }
-inline void lineWidth(float v){ glLineWidth(v); }
-inline void matrixMode(int mode){ glMatrixMode(mode); }
-inline void ortho(float l, float r, float b, float t){ gluOrtho2D(l,r,b,t); }
-inline void pointSize(float v){ glPointSize(v); }
-inline void push(){ glPushMatrix(); }
-inline void pushAttrib(int attribs){ glPushAttrib(attribs); }
-inline void pop() { glPopMatrix(); }
-inline void popAttrib(){ glPopAttrib(); }
-inline void rotateX(float deg){ glRotatef(deg, 1.f, 0.f, 0.f); }
-inline void rotateY(float deg){ glRotatef(deg, 0.f, 1.f, 0.f); }
-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 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); }
-
-} // end namespace draw
-
-} // end namespace glv
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_layout.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_layout.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,134 +0,0 @@
-#ifndef INC_GLV_LAYOUT_H
-#define INC_GLV_LAYOUT_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_core.h"
-
-
-namespace glv{
-
-/// View placer
-
-/// A Placer is used for aligning a series of views. It can position views
-/// according to an absolute increment and/or increment relative to the views'
-/// geometric extent.
-class Placer{
-public:
-
- Placer(space_t absX=0, space_t absY=0);
-
- Placer(View& parent, Direction dir, Place::t align, space_t x, space_t y, space_t pad=4);
-
- /// Set a view's position
- Placer& operator<< (View& v);
-
- /// Set the absolute increment amounts
- Placer& abs(space_t vx, space_t vy);
-
- /// Set view alignment location
- Placer& align(space_t vx, space_t vy);
-
- /// Set view alignment place
- Placer& align(Place::t p);
-
- /// Set anchor place of Views
- Placer& anchor(Place::t p);
-
- /// Reassign the placement flow direction
- Placer& flow(Direction d);
-
- /// Set the placement flow along with absolute and relative incrementing values
- Placer& flow(Direction d, space_t abs, space_t rel=1);
-
- /// Set the current position
- Placer& pos(space_t vx, space_t vy);
-
- /// Set the current x-position
- Placer& posX(space_t v);
-
- /// Set the current y-position
- Placer& posY(space_t v);
-
- /// Set the relative increment factors
- Placer& rel(space_t vx, space_t vy);
-
-protected:
- space_t x, y; // trajectory point
- space_t rx, ry; // relative increment factors
- space_t ax, ay; // absolute increment amounts
- space_t fw, fh; // view alignment fraction [0, 1]
- Place::t mAnchor;
- View * parent;
-};
-
-
-
-
-// Base interface class for View auto-layout functors
-struct LayoutFunc{
-
- /// @param[in] w Width of rect element
- /// @param[in] h Height of rect element
- /// @param[in] bounds Layout bounding rect
- LayoutFunc(space_t w, space_t h, const Rect& bounds);
- virtual ~LayoutFunc();
-
- /// Returns next rect element of layout function
- virtual Rect& operator()() = 0;
-
- void layoutChildren(View& v);
-
- Rect elem; ///< The current rect element
- Rect bounds; ///< The layout bounding rect
- View * parent;
-};
-
-
-
-// Grid auto-layout functor
-
-// Generates evenly distributed rects within a bounding region.
-//
-struct LayoutGrid : public LayoutFunc{
-
- /// @param[in] w Width of rect element
- /// @param[in] h Height of rect element
- /// @param[in] bounds Layout bounding rect
- /// @param[in] numV Number of vertical divisions
- /// @param[in] numH Number of horizontal divisions
- LayoutGrid(space_t w, space_t h, const Rect& bounds, int numV, int numH);
- virtual ~LayoutGrid();
-
-
- /// Constructor for auto-sized elements with uniform padding
-
- /// @param[in] pad Padding between elements
- /// @param[in] bounds Layout bounding rect
- /// @param[in] numV Number of vertical divisions
- /// @param[in] numH Number of horizontal divisions
- LayoutGrid(space_t pad, const Rect& bounds, int numV, int numH);
-
-
- LayoutGrid(View& parent, int numH, int numV, space_t pad);
-
- /// Generate next layout rect going left-to-right, then top-to-bottom.
- virtual Rect& operator()();
-
-
- LayoutGrid& operator<< (View& v){
- if(parent) (*parent) << v;
- v.set((*this)());
- return *this;
- }
-
-protected:
- int numV, numH, cntV, cntH;
-};
-
-
-
-} // glv::
-
-#endif
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_observer_pattern.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_observer_pattern.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,76 +0,0 @@
-#ifndef INC_GLV_OBSERVER_H
-#define INC_GLV_OBSERVER_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include <vector>
-
-namespace glv {
-
-class Notifier;
-
-typedef void (*glvHandler)(Notifier * sender, void * userdata); ///< Handler type
-
-//! Handler functor
-class HandlerFunctor
-{
-public:
-
- HandlerFunctor(glvHandler a, void * v = 0) { handler = a; udata = v; }
-
- glvHandler handler;
- void * udata;
-};
-
-//! Notifier
-class Notifier
-{
-public:
-
- void notify();
-
- void attachHandler(glvHandler a, void * userdata = 0);
- void detachHandler(glvHandler a, void * userdata = 0);
-
-protected:
-
- std::vector<HandlerFunctor> mHandlers;
-};
-
-
-
-// Implementation ______________________________________________________________
-
-inline
-void Notifier :: notify()
-{
- if(mHandlers.empty()) return;
-
- int i=mHandlers.size(); // call handlers in FIFO order
- while (i--)
- {
- if (mHandlers[i].handler) mHandlers[i].handler(this, mHandlers[i].udata);
- }
-}
-
-inline
-void Notifier :: attachHandler (glvHandler a, void * userdata)
-{
- mHandlers.push_back(HandlerFunctor(a, userdata));
-}
-
-inline
-void Notifier :: detachHandler (glvHandler a, void * userdata)
-{
- for(unsigned int i=0; i<mHandlers.size(); i++)
- {
- if (mHandlers[i].handler == a && mHandlers[i].udata == userdata) mHandlers.erase(mHandlers.begin() + i);
- }
-}
-
-
-} // glv::
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_rect.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_rect.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,226 +0,0 @@
-#ifndef INC_GLV_RECT_H
-#define INC_GLV_RECT_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include <stdio.h>
-
-namespace glv {
-
-/// Rectangle shape.
-
-/// Knows how to calculate useful things such as centre, intersection areas
-/// with other rects, etc.
-template <class T>
-class TRect {
-public:
- T l; ///< Left edge position
- T t; ///< Top edge position
- T w; ///< Width
- T h; ///< Height
-
- TRect();
-
- /// Construct from square extent with position set to (0,0).
-
- /// @param[in] extent initial width and height
- ///
- TRect(T extent);
-
- /// Construct from width and height with position set to (0,0).
-
- /// @param[in] width initial width
- /// @param[in] height initial height
- TRect(T width, T height);
-
- /// @param[in] left initial left edge position
- /// @param[in] top initial top edge position
- /// @param[in] width initial width
- /// @param[in] height initial height
- TRect(T left, T top, T width, T height);
-
- virtual ~TRect(){}
-
- 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 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.
- void posAdd(T x, T y); ///< Translate by [x, y] units.
- void posUnder(const TRect<T>& r, T by=0);
- void posRightOf(const TRect<T>& r, T by=0);
- void resizeLeftTo(T v); ///< Resize by moving left edge to value.
- void resizeTopTo(T v); ///< Resize by moving top edge to value.
- void resizeRightTo(T v); ///< Resize by moving right edge to value.
- void resizeBottomTo(T v); ///< Resize by moving bottom edge to value.
- void resizeEdgesBy(T v); ///< Resize by moving edges by value.
- void set(T left, T top, T width, T height); ///< Set components.
- void set(const TRect<T>& r); ///< Set components from other TRect.
- void transpose(); ///< Swaps width and height.
-
- void left(T v); ///< Set left position.
- void top(T v); ///< Set top position.
- void width(T v); ///< Set width.
- void height(T v); ///< Set height.
- void bottom(T v); ///< Set bottom edge preserving height.
- void right(T v); ///< Set right edge preserving width.
-
- // Accessors
- T left() const { return l; } ///< Get left edge position
- T top() const { return t; } ///< Get top edge position
- T width() const { return w; } ///< Get width
- T height() const { return h; } ///< Get height
- T right() const; ///< Get right edge position
- T bottom() const; ///< Get bottom edge position
-
- T area() const; ///< Returns area (w x h).
- void center(T & x, T & y) const;///< Gets center point
- T centerX() const; ///< Returns center along x axis.
- T centerY() const; ///< Returns center along y axis.
-
- bool containsPoint(T x, T y) const; ///< Returns whether the point is inside the TRect.
-
- TRect<T> extent() const;
-
- /// Calculates the intersection of the two Rects.
- void intersection(const TRect<T> & check, TRect<T> & intersection) const;
-
- bool intersects(const TRect<T> & rect) const;///< Returns whether the two Rects intersect.
- bool isVertical() const; ///< Returns true if h > w, false otherwise.
- bool withinXBounds(T xmin, T xmax) const; ///< Returns whether the TRect is within the x range.
- bool withinYBounds(T ymin, T ymax) const; ///< Returns whether the TRect is within the y range.
-
- /// Called when the width or height change. Changes in extent are passed in.
- virtual void onResize(T dx, T dy){}
-
- void print(FILE * fp=stdout); ///< write about TRect to a file
-};
-
-
-
-
-// Implementation ______________________________________________________________
-
-#define TEM template <class T>
-
-TEM TRect<T>::TRect(){ set((T)0, (T)0, (T)40, (T)40); }
-TEM TRect<T>::TRect(T v){ set(0, 0, v, v); }
-TEM TRect<T>::TRect(T iw, T ih){ set(0, 0, iw, ih); }
-TEM TRect<T>::TRect(T il, T it, T iw, T ih){ set(il, it, iw, ih); }
-
-TEM const TRect<T>& TRect<T>::operator= (const TRect<T>& r){
- set(r.l, r.t, r.w, r.h);
- return *this;
-}
-
-TEM void TRect<T>::copyUnder(const TRect<T> & r, T by){
- pos(r.l, r.bottom() + by);
- 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 wi, T he){
- T dx = wi - w;
- T dy = he - h;
- w = wi; h = he;
- onResize(dx, dy);
-}
-
-TEM inline void TRect<T>::fixNegativeExtent(){
- if(w < (T)0){ w = -w; l -= w; }
- if(h < (T)0){ h = -h; t -= h; }
-}
-
-TEM inline void TRect<T>::pos(T le, T to){ l = le; t = to; }
-TEM inline void TRect<T>::posAdd(T x, T y){ l += x; t += y; }
-TEM inline void TRect<T>::posRightOf(const TRect<T> & r, T by){ pos(r.right() + by, r.t); }
-TEM inline void TRect<T>::posUnder(const TRect<T> & r, T by){ pos(r.l, r.bottom() + by); }
-TEM inline void TRect<T>::resizeLeftTo(T v){ T dl = l-v; w += dl; l = v; onResize(dl, 0); }
-TEM inline void TRect<T>::resizeTopTo(T v){ T dt = t-v; h += dt; t = v; onResize(0, dt); }
-TEM inline void TRect<T>::resizeRightTo(T v){ width(v - l); }
-TEM inline void TRect<T>::resizeBottomTo(T v){ height(v - t); }
-TEM inline void TRect<T>::resizeEdgesBy(T v){ l -= v; t -= v; extent(w + 2 * v, h + 2 * v); }
-TEM inline void TRect<T>::set(const TRect<T>& r){ set(r.l, r.t, r.w, r.h); }
-TEM inline void TRect<T>::set(T le, T to, T wi, T he){ pos(le, to); extent(wi, he); }
-TEM inline void TRect<T>::transpose(){ extent(h, w); }
-
-TEM inline void TRect<T>::left (T v){ l = v; }
-TEM inline void TRect<T>::top (T v){ t = v; }
-TEM inline void TRect<T>::width (T v){ extent(v, h); }
-TEM inline void TRect<T>::height(T v){ extent(w, v); }
-TEM inline void TRect<T>::bottom(T v){ t = v - h; }
-TEM inline void TRect<T>::right (T v){ l = v - w; }
-
-TEM inline T TRect<T>::right() const { return l + w; }
-TEM inline T TRect<T>::bottom() const { return t + h; }
-TEM inline T TRect<T>::area() const { return w * h; }
-TEM inline void TRect<T>::center(T & x, T & y) const { x = centerX(); y = centerY(); }
-TEM inline T TRect<T>::centerX() const { return l + w * 0.5f; }
-TEM inline T TRect<T>::centerY() const { return t + h * 0.5f; }
-
-TEM inline bool TRect<T>::containsPoint(T x, T y) const {
- return (x >= l) && (x <= (l + w)) && (y >= t) && (y <= (t + h));
-}
-
-TEM inline TRect<T> TRect<T>::extent() const { return TRect<T>(0,0,w,h); }
-
-TEM inline bool TRect<T>::intersects(const TRect<T> & r) const {
- return ((l <= r.right()) && (r.l <= right()) &&
- (t <= r.bottom()) && (r.t <= bottom()));
-}
-
-TEM inline bool TRect<T>::isVertical() const { return h > w; }
-
-TEM inline bool TRect<T>::withinXBounds(T xmin, T xmax) const {
- return (l < xmax) && (right() > xmin);
-}
-
-TEM inline bool TRect<T>::withinYBounds(T ymin, T ymax) const {
- return (t < ymax) && (bottom() > ymin);
-}
-
-TEM void TRect<T>::insetFrom(const TRect<T>& from, T by){
- l = by;
- t = by;
- by *= 2.f;
- extent(from.w - by, from.h - by);
-}
-
-TEM void TRect<T>::intersection(const TRect<T> & check, TRect<T> & inter) const{
- T l1 = l;
- T r1 = right();
- T t1 = t;
- T b1 = bottom();
-
- T l2 = check.l;
- T r2 = check.right();
- T t2 = check.t;
- T b2 = check.bottom();
-
- inter.pos(
- (l1 > l2) ? l1 : l2,
- (t1 > t2) ? t1 : t2
- );
-
- inter.extent(
- ((r1 < r2) ? r1 : r2) - inter.l,
- ((b1 < b2) ? b1 : b2) - inter.t
- );
-}
-
-
-TEM void TRect<T>::print(FILE * fp){
- fprintf(fp, "[%.2f, %.2f, %.2f, %.2f]\n", l, t, w, h);
-}
-
-} // glv::
-
-#undef TEM
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_sliders.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_sliders.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,398 +0,0 @@
-#ifndef INC_GLV_SLIDERS_H
-#define INC_GLV_SLIDERS_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_core.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 <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.
-///
-template <int Dim>
-class SliderBase : public View{
-public:
-
- /// Constructor
- SliderBase(const Rect& r);
-
- 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
-
- static int dimensions(){ return Dim; } ///< Returns number of dimensions of slider
-
-protected:
- float mAcc[Dim], mVal[Dim];
- //float mSens;
-
- void clip(float & v){ v<0.f ? v=0.f : v>1.f ? v=1.f : 0; }
- void clipAccs(){ for(int i=0; i<Dim; ++i) clip(mAcc[i]); }
- bool validDim(int dim) const { return (dim < Dim) && (dim >= 0); }
- float sens(const GLV& g){ return (g.mouse.left() && g.mouse.right()) ? 0.25 : 1; }
-};
-
-
-
-/// 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);
-};
-
-
-
-/// A 2-D slider
-class Slider2D : public SliderBase<2>{
-public:
-
- /// Constructor
- Slider2D(const Rect& r, float valX=0, float valY=0, space_t knobSize=12);
-
- space_t knobSize; ///< Size of slider knob
-
- virtual void onDraw();
- virtual bool onEvent(Event::t e, GLV & glv);
-
- static void drawKnob(const Slider2D& s);
-
-};
-
-
-
-/// A multi-parameter slider grid
-
-/// The cells of the grid represent all the pair permutations of parameters.
-/// The parameter values run from 0 to N, going left-to-right along the x-axis
-/// and bottom-to-top along th y-axis. Cells along the diagonal control the
-/// parameters individually.
-template <int Dim>
-class SliderGrid : public SliderBase<Dim>{
-public:
- using SliderBase<Dim>::colors;
- using SliderBase<Dim>::w;
- using SliderBase<Dim>::h;
- using SliderBase<Dim>::value;
- using SliderBase<Dim>::clipAccs;
- using SliderBase<Dim>::sens;
-
- /// Constructor
- SliderGrid(const Rect& r, space_t knobSize=4);
-
- space_t knobSize; ///< Knob size
-
- virtual void onDraw();
- virtual bool onEvent(Event::t e, GLV& glv);
-
-protected:
- int cx, cy;
-};
-
-
-
-// Implementation ______________________________________________________________
-
-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)
-{}
-
-
-template <int Nx, int Ny>
-int Buttons<Nx, Ny>::lastClicked() const{ return index(cx, cy); }
-
-
-template <int Nx, int Ny>
-void Buttons<Nx, Ny>::onDraw(){
- using namespace glv::draw;
-
- float wi = pix(w);
- float hi = pix(h);
- float wc = cellW();
- float hc = cellH();
-
- // 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();
-
- for(int x=0; x<Nx; ++x){
-
- float dx = x * wc + iconInset();
-
- for(int y=0; y<Ny; ++y){
-
- float dy = y * hc + iconInset();
-
- 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));
- }
- }
- }
-}
-
-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;
-}
-
-
-
-// SliderBase
-
-template <int Dim>
-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;
- float acc = mAcc[dim] + add;
- mAcc[dim] = mVal[dim] = acc;
- clip(mVal[dim]); // clip in [0, 1]
-}
-
-template <int Dim>
-inline float SliderBase<Dim>::value(int dim) const{
- return validDim(dim) ? mVal[dim] : 0;
-}
-
-template <int Dim>
-inline void SliderBase<Dim>::valueMid(){
- for(int i=0; i<Dim; ++i) mVal[i] = mAcc[i] = 0.5;
-}
-
-template <int Dim>
-inline void SliderBase<Dim>::valueMax(){
- for(int i=0; i<Dim; ++i) mVal[i] = mAcc[i] = 1;
-}
-
-template <int Dim>
-inline void SliderBase<Dim>::value(float value, int dim){
- if(validDim(dim)) mVal[dim] = mAcc[dim] = value;
-}
-
-
-
-template <int Dim>
-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(){
- using namespace glv::draw;
-
- float rDim = 1./Dim;
- color(colors().fore);
- lineWidth(1);
- frame(cx * w * rDim, (Dim-cy-1) * h * rDim, (cx+1) * w * rDim, (Dim-cy) * h * rDim);
- enable(LineStipple);
- lineStipple(1, 0xAAAA);
- grid(0,0,w,h,Dim,Dim, false);
- shape(Lines,0,h,w,0);
- disable(LineStipple);
-
- pointSize(knobSize);
- begin(Points);
- for(int i=0; i<Dim; ++i){
- float f = (i+value(i)) * rDim;
- float x = f*w;
- //float y = f*h;
-
- for(int j=0; j<Dim; ++j){
- vertex(x, (1.-(j+value(j)) * rDim) * h);
- }
- }
- end();
-}
-
-template <int Dim>
-bool SliderGrid<Dim>::onEvent(Event::t e, GLV& g){
-
- switch(e){
- case Event::MouseDrag:
- valueAdd( g.mouse.dx()/w * sens(g) * Dim, cx);
- if(cx!=cy) valueAdd(-g.mouse.dy()/h * sens(g) * Dim, cy);
- break;
-
- case Event::MouseDown:
- cx = (int)((g.mouse.xRel() / w) * Dim);
- cy = (int)((g.mouse.yRel() / h) * Dim);
- cy = (Dim-1) - cy;
- cx < 0 ? cx=0 : cx>=Dim ? cx=Dim-1 : 0;
- cy < 0 ? cy=0 : cy>=Dim ? cy=Dim-1 : 0;
-
- if(g.mouse.left() && !g.mouse.right()){
- float cw = w/Dim;
- float ch = h/Dim;
- value( (g.mouse.xRel()/cw - cx), cx);
- if(cx!=cy) value(1.f - (g.mouse.yRel()/ch - ((Dim-1)-cy)), cy);
- }
- break;
-
- case Event::MouseUp: clipAccs(); break;
- default: break;
- }
- return false;
-}
-
-
-
-} // glv::
-
-#endif
-
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_texture.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_texture.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,31 +0,0 @@
-#ifndef INC_GLV_TEXTURE_H
-#define INC_GLV_TEXTURE_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include "glv_conf.h"
-
-namespace glv{
-
-class Texture2D{
-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); }
-
-private:
- GLuint mID;
- GLsizei w, h;
-};
-
-
-} //glv::
-
-#endif
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_textview.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_textview.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,42 +0,0 @@
-#ifndef INC_GLV_TEXTVIEW_H
-#define INC_GLV_TEXTVIEW_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-#include <string>
-#include <string.h>
-#include "glv_core.h"
-
-namespace glv{
-
-/// Basic label widget
-class Label : public View{
-public:
-
- 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& label(const std::string& s);
- Label& size(float pixels);
- Label& vertical(bool v);
-
- virtual void onDraw();
-
-protected:
- std::string mLabel; // The label string
- float mSize;
- bool mVertical;
-
- void fitExtent();
- void rotateRect(); // swap between vertical and horizontal
-};
-
-} // glv::
-
-#endif
Deleted: sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_util.h
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/example/glv_gui/glv/glv_util.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
+++ (empty file)
@@ -1,48 +0,0 @@
-#ifndef INC_GLV_UTIL_H
-#define INC_GLV_UTIL_H
-
-/* Graphics Library of Views (GLV) - GUI Building Toolkit
- See COPYRIGHT file for authors and license information */
-
-namespace glv {
-
-/// Smart pointer functionality to avoid deleting references.
-
-/// When a class contains pointers to other objects, sometimes it is not clear
-/// if it is responsible for freeing the memory associated with those objects.
-class SmartPointer{
-public:
-
- /// @param[in] del whether the object is deleted with smartDelete()
- SmartPointer(bool del=true): mDeletable(del){}
-
- /// Deletes object only if it is deletable, i.e. not a reference.
- void smartDelete(){
- //printf("%p %c\n", this, mDeletable ? 'y' : 'n');
- if(true == mDeletable) delete this;
- }
-
- /// Set whether the object can be deleted.
- void deletable(bool v){ mDeletable = v; }
-
- /// Returns whether the object can be deleted.
- bool deletable(){ return mDeletable; }
-
-// void operator delete (void * p){
-//
-// SmartPointer * pc = static_cast<SmartPointer *>(p);
-// if(pc && pc->mIsDeletable){
-// free(pc);
-// printf("freed\n");
-// }
-// else printf("denied\n");
-// }
-
-private:
- bool mDeletable;
-};
-
-} // end namespace glv
-
-#endif
-
Added: sandbox/SOC/2007/signals/libs/glv/COPYRIGHT
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/COPYRIGHT 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,40 @@
+GLV AUTHORSHIP AND COPYRIGHT NOTICE
+
+Authors
+---------------------------------------------------------------------------
+
+Main design and development by Lance Putnam, Wesley Smith, and Graham Wakefield with contributions from:
+ Eric Newman,
+ Alex Norman,
+ Stephen Pope,
+ and others,
+all at the Graduate Program in Media Arts and Technology (MAT) at the University of California, Santa Barbara (UCSB).
+
+Contact: Lance Putnam (ljputnam_at_[hidden])
+
+
+
+License
+---------------------------------------------------------------------------
+
+Copyright (C) 2006-2008. The Regents of the University of California (REGENTS).
+All Rights Reserved.
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, the list of contributors, this paragraph and the following two paragraphs
+appear in all copies, modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
Added: sandbox/SOC/2007/signals/libs/glv/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/Jamfile 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,22 @@
+# Copyright 2007 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)
+
+project dataflow/example/glv
+ : source-location src
+ : usage-requirements
+ <include>include
+ <toolset>darwin:<linkflags>"-framework AGL"
+ <toolset>darwin:<linkflags>"-framework GLUT"
+ <toolset>darwin:<linkflags>"-framework OpenGL"
+ : requirements
+ <include>include
+ ;
+
+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 ;
+
+lib lib_glv : $(SOURCES).cpp
+ ;
Added: sandbox/SOC/2007/signals/libs/glv/src/COPYRIGHT
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/COPYRIGHT 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,40 @@
+GLV AUTHORSHIP AND COPYRIGHT NOTICE
+
+Authors
+---------------------------------------------------------------------------
+
+Main design and development by Lance Putnam, Wesley Smith, and Graham Wakefield with contributions from:
+ Eric Newman,
+ Alex Norman,
+ Stephen Pope,
+ and others,
+all at the Graduate Program in Media Arts and Technology (MAT) at the University of California, Santa Barbara (UCSB).
+
+Contact: Lance Putnam (ljputnam_at_[hidden])
+
+
+
+License
+---------------------------------------------------------------------------
+
+Copyright (C) 2006-2008. The Regents of the University of California (REGENTS).
+All Rights Reserved.
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, the list of contributors, this paragraph and the following two paragraphs
+appear in all copies, modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
Added: sandbox/SOC/2007/signals/libs/glv/src/FontGL/FontGL.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/FontGL/FontGL.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,237 @@
+/***************************************************************************/
+/* */
+/* FontGL.cpp */
+/* */
+/* FontGL: An OpenGL font-rendering library. */
+/* */
+/* Copyright 2006 by Eric Newman. */
+/* Contact: e.newman_at_[hidden] */
+/* */
+/* FontGL may be freely used and modified for non-commercial purposes by */
+/* any individual, organization, or entity. However, please be kind and */
+/* cite the author's work where appropriate. */
+/* */
+/***************************************************************************/
+
+#include "FontGL.h"
+
+FT_Library *FontGL_Library = 0;
+
+void FontGL_InitializeLibrary()
+{
+ if (!FontGL_Library)
+ {
+ FontGL_Library = new FT_Library;
+ FT_Init_FreeType(FontGL_Library);
+ }
+}
+
+void FontGL_CloseLibrary()
+{
+ FT_Done_FreeType(*FontGL_Library);
+ delete FontGL_Library;
+ FontGL_Library = 0;
+}
+
+FontGL::FontGL(char *fontName, int fontSize, bool antiAliased, bool cacheGlyphs)
+{
+ FT_New_Face(*FontGL_Library, fontName, 0, &face);
+
+ fontsize = fontSize;
+ antialiased = antiAliased;
+ cacheglyphs = cacheGlyphs;
+
+ color = new FontGLColor;
+ setColor(1.f, 1.f, 1.f, 1.f);
+
+ widths = new int[ASCII_SIZE];
+ vOffsets = new int[ASCII_SIZE];
+ textures = new GLuint[ASCII_SIZE];
+
+ textureSize = 1;
+ while (textureSize < fontsize) textureSize *= 2;
+
+ if (cacheglyphs)
+ {
+ for (int i=0; i<ASCII_SIZE; i++)
+ {
+ glyphImages[i] = new unsigned char[textureSize * textureSize * 2];
+ loadGlyph(i, glyphImages[i]);
+ }
+ }
+
+ initTextures();
+}
+
+FontGL::~FontGL()
+{
+ uninitTextures();
+
+ if (cacheglyphs)
+ {
+ for (int i=0; i<ASCII_SIZE; i++)
+ delete glyphImages[i];
+ }
+
+ delete textures;
+ delete widths;
+ delete vOffsets;
+
+ delete color;
+
+ FT_Done_Face(face);
+}
+
+void FontGL::initTextures()
+{
+ glGenTextures(255, textures);
+
+ if (cacheglyphs)
+ {
+ for (int i=0; i<ASCII_SIZE; i++)
+ loadTexture(i, glyphImages[i]);
+ }
+ else
+ {
+ unsigned char *glyphImage = new unsigned char[textureSize * textureSize * 2];
+
+ for (int i=0; i<ASCII_SIZE; i++)
+ {
+ loadGlyph(i, glyphImage);
+ loadTexture(i, glyphImage);
+ }
+
+ delete glyphImage;
+ }
+}
+
+void FontGL::loadGlyph(int glyphNum, unsigned char *glyphImage)
+{
+ int j, k, l;
+ int glyph_index;
+
+ glyph_index = FT_Get_Char_Index(face, glyphNum);
+
+ FT_Set_Char_Size(face, 0, fontsize * 64, 0, 0);
+
+ if (antialiased)
+ {
+ FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
+ FT_Render_Glyph(face->glyph, FT_RENDER_MODE_NORMAL);
+ }
+ else
+ {
+ FT_Load_Glyph(face, glyph_index, FT_LOAD_MONOCHROME);
+ FT_Render_Glyph(face->glyph, FT_RENDER_MODE_MONO);
+ }
+
+ widths[glyphNum] = face->glyph->advance.x/64;
+ vOffsets[glyphNum] = face->glyph->bitmap_top;
+
+ memset(glyphImage, 0, textureSize * textureSize * 2);
+
+ FT_Bitmap *bitmap = &face->glyph->bitmap;
+
+ if (antialiased)
+ {
+ for (j=0; j<bitmap->rows; j++)
+ {
+ for (k=0; k<bitmap->width; k++)
+ {
+ glyphImage[(j * textureSize * 2) + (k * 2)] = 255;
+ glyphImage[(j * textureSize * 2) + (k * 2) + 1] = bitmap->buffer[j * bitmap->width + k];
+ }
+ }
+ }
+ else
+ {
+ unsigned char temp;
+
+ for (j=0; j<bitmap->rows; j++)
+ {
+ for (k=0; k<bitmap->pitch; k++)
+ {
+ for (l=7; l>=0; l--)
+ {
+ temp = (bitmap->buffer[j * bitmap->pitch + k] >> l) & 1;
+
+ if (temp)
+ {
+ glyphImage[(j * textureSize * 2) + ((k * 8 + (7 - l)) * 2)] = 255;
+ glyphImage[(j * textureSize * 2) + ((k * 8 + (7 - l)) * 2) + 1] = 255;
+ }
+ }
+ }
+ }
+ }
+}
+
+void FontGL::loadTexture(int textureNum, unsigned char *glyphImage)
+{
+ glBindTexture(GL_TEXTURE_2D, textures[textureNum]);
+ glTexImage2D(GL_TEXTURE_2D, 0, 2, textureSize, textureSize, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, glyphImage);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+}
+
+void FontGL::uninitTextures()
+{
+ glDeleteTextures(255, textures);
+}
+
+float FontGL::advance(const char *text)
+{
+ float total = 0.f;
+
+ for (int i=0; i<(int) strlen(text); i++)
+ total += widths[text[i]];
+
+ return total;
+}
+
+void FontGL::render(float x, float y, float z, const char *text)
+{
+ glPushAttrib(GL_ENABLE_BIT);
+
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+
+ GLint blendDest, blendSource;
+ glGetIntegerv(GL_BLEND_DST, &blendDest);
+ glGetIntegerv(GL_BLEND_SRC, &blendSource);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glPushMatrix();
+
+ glTranslatef(x, y, z);
+ glColor3f(color->r, color->g, color->b);
+
+ int width, vOffset;
+
+ for (unsigned i=0; i<strlen(text); i++)
+ {
+ width = widths[text[i]];
+ vOffset = vOffsets[text[i]];
+
+ glBindTexture(GL_TEXTURE_2D, textures[text[i]]);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0.0, 0.0); glVertex3f(0.f, (float) (-vOffset), 0.f);
+ glTexCoord2f(0.0, 1.0); glVertex3f(0.f, (float) (-vOffset + textureSize), 0.f);
+ glTexCoord2f(1.0, 1.0); glVertex3f((float) textureSize, (float) (-vOffset + textureSize), 0.f);
+ glTexCoord2f(1.0, 0.0); glVertex3f((float) textureSize, (float) (-vOffset), 0.f);
+ glEnd();
+
+ glTranslatef((float) width, 0.f, 0.f);
+ }
+
+ glPopMatrix();
+
+ glPopAttrib();
+
+ glBlendFunc(blendSource, blendDest);
+}
+
Added: sandbox/SOC/2007/signals/libs/glv/src/FontGL/FontGL.h
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/FontGL/FontGL.h 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,102 @@
+/***************************************************************************/
+/* */
+/* FontGL.h */
+/* */
+/* FontGL: An OpenGL font-rendering library. */
+/* */
+/* Copyright 2006 by Eric Newman. */
+/* Contact: e.newman_at_[hidden] */
+/* */
+/* FontGL may be freely used and modified for non-commercial purposes by */
+/* any individual, organization, or entity. However, please be kind and */
+/* cite the author's work where appropriate. */
+/* */
+/***************************************************************************/
+
+#ifndef FONT_GL_H
+#define FONT_GL_H
+
+#if defined (__APPLE__) || defined (OSX)
+
+ #include <OpenGL/OpenGL.h>
+ #include <OpenGL/glu.h>
+ #include <ft2build.h>
+ #include FT_FREETYPE_H
+
+#elif defined(__linux__)
+
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #include <ft2build.h>
+ #include <freetype/freetype.h>
+
+#elif defined WIN32
+
+ #include <windows.h>
+ #include <gl/gl.h>
+ #include <gl/glu.h>
+ #include <ft2build.h>
+ #include FT_FREETYPE_H
+
+#endif
+
+
+// must be called before instanciating any fonts.
+void FontGL_InitializeLibrary();
+
+// must be called afer all font instances are deleted.
+void FontGL_CloseLibrary();
+
+#define ASCII_SIZE 255 // number of characters to use
+
+typedef struct
+{
+ float r, g, b, a;
+}
+FontGLColor;
+
+class FontGL
+{
+public:
+
+ FontGL(char *fontName, int fontSize, bool antiAliased, bool cacheGlyphs = false);
+ ~FontGL();
+
+ // renders a text string at the specified 3D position
+ void render(float x, float y, float z, const char *text);
+
+ // returns the width of a text string in pixels
+ float advance(const char *text);
+
+ // returns the "above-line" height of the font in pixels
+ float ascender() { return face->size->metrics.ascender/64.f; }
+
+ // returns the "below-line" height of the font in pixels
+ float descender() { return face->size->metrics.descender/64.f; }
+
+ // returns the total height of the font in pixels
+ int size() { return fontsize; }
+
+ // sets the color of the font
+ void setColor(float R, float G, float B, float A)
+ { color->r = R; color->g = G; color->b = B; color->a = A; }
+
+ // these functions are necessary if your application
+ // creates/destroys multiple windows while running
+ void initTextures();
+ void uninitTextures();
+
+protected:
+
+ FT_Face face;
+ FontGLColor *color;
+ GLuint *textures;
+ int *widths, *vOffsets, fontsize, textureSize;
+ bool antialiased, cacheglyphs;
+ unsigned char *glyphImages[ASCII_SIZE];
+
+ void loadTexture(int textureNum, unsigned char *glyphImage);
+ void loadGlyph(int glyphNum, unsigned char *glyphImage);
+};
+
+#endif // FONT_GL_H
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_abstract_binding.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,71 @@
+/* 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_abstract_binding.h"
+
+namespace glv{
+
+void AbstractApplication::run(){
+ //printf("GLV Application run()\n");
+ GLV_PLATFORM_INIT;
+}
+
+void AbstractApplication::quit(){
+ //printf("GLV Application quit()\n");
+ //GLV::exit();
+}
+
+
+
+AbstractWindow::AbstractWindow(unsigned int w, unsigned int h, char * title, GLV * glv, double framerate)
+: glv(0), mFPS(framerate),
+ mLabel(title),
+ w(w), h(h),
+ mFullscreen(false), mVisible(true), mIsActive(true)
+{
+ if(glv) setGLV(*glv);
+}
+
+void AbstractWindow::setGLV(GLV & g){
+ glv = &g;
+ g.extent(w, h);
+}
+
+void AbstractWindow::fullscreen(bool on){
+ if(on && !mFullscreen){
+ wwin = w, hwin = h;
+ mFullscreen = true;
+ platformFullscreen();
+ }
+ else if(!on && mFullscreen){
+ //resize(wwin, hwin);
+ w = wwin; h = hwin;
+ if(glv) glv->extent(w, h);
+ mFullscreen = false;
+ platformFullscreen();
+ }
+}
+
+void AbstractWindow::fullscreenToggle(){ fullscreen(!mFullscreen); }
+
+void AbstractWindow::hideCursor(bool hide){
+ mHideCursor = hide;
+ platformHideCursor(hide);
+}
+
+void AbstractWindow::resize(int width, int height){
+ w = width; h = height;
+ if(glv) glv->extent(w, h);
+ platformResize(w, h);
+}
+
+bool AbstractWindow::shouldDraw(){ return glv && mIsActive && mVisible; }
+
+void AbstractWindow::show(bool v){
+ mVisible = v;
+ platformShowHide();
+}
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_binding_carbon.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,820 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_binding_carbon.h"
+
+//#define DEBUG_ENABLE
+#ifdef DEBUG_ENABLE
+ #define debug(format, args...) fprintf (stderr, format , ## args)
+#else
+ #define debug(format, args...)
+#endif
+
+namespace glv{
+
+EventHandlerRef * Application :: carbonApplicationHandlerRef;
+
+void Application :: quit()
+{
+ QuitApplicationEventLoop();
+ AbstractApplication::quit();
+}
+
+void Application :: run()
+{
+ OSStatus err;
+
+ // the order of these calls is important:
+
+ // INSTALL APPLICATION EVENT HANDLER //
+
+ // create a typelist for events to respond to:
+ const EventTypeSpec eventTypes[] =
+ {
+ // keyboard
+ { kEventClassKeyboard, kEventRawKeyDown },
+ { kEventClassKeyboard, kEventRawKeyUp },
+ { kEventClassKeyboard, kEventRawKeyRepeat },
+ //{ kEventClassKeyboard, kEventRawKeyModifiersChanged },
+
+ // application
+ { kEventClassApplication, kEventAppActivated },
+ { kEventClassApplication, kEventAppDeactivated },
+
+ // command
+ { kEventClassCommand, kEventCommandProcess }
+ };
+
+ // register the multi-event handler
+ err = InstallEventHandler (
+ GetApplicationEventTarget(), // EventTargetRef target,
+ NewEventHandlerUPP(carbonApplicationHandler), // EventHandlerUPP handlerProc,
+ GetEventTypeCount(eventTypes), // UInt32 numTypes,
+ eventTypes, // const EventTypeSpec* typeList,
+ NULL, // void * userData, (passed back to the handler)
+ carbonApplicationHandlerRef // EventHandlerRef* handlerRef (reference to the handler)
+ );
+
+ if (err) printf("Error in registerApplicationHandler(): %i\n", err);
+
+ // INSTALL APPLICAITON MENU BAR //
+
+ const char * name = "MenuBar";
+ const char * resource = "main";
+
+ IBNibRef nibRef;
+ err = CreateNibReference(C2CFSTR(resource), &nibRef);
+
+ if (err != 0) printf("unable to create Nib reference\n");
+ if (err == 0) err = SetMenuBarFromNib(nibRef, C2CFSTR(name));
+ if (err != 0) printf("unable to create menu bar\n");
+ DisposeNibReference(nibRef);
+
+ // CALL GLV APPLICATION RUN() //
+
+ AbstractApplication::run();
+
+ // START CARBON EVENT MODEL //
+
+ RunApplicationEventLoop();
+}
+
+// a function to handle application level events:
+OSStatus Application :: carbonApplicationHandler(EventHandlerCallRef nextHandler, EventRef theEvent, void * udata)
+{
+ OSStatus result = noErr;
+ GLV& glv = *((GLV *)udata);
+
+ // Generic properties of all events:
+ UInt32 eventClass = GetEventClass(theEvent); // e.g. to use in a switch statement
+ UInt32 eventKind = GetEventKind(theEvent);
+
+ // respond to event by type
+ switch (eventClass) {
+
+ case kEventClassKeyboard:
+ // get keyboard keycode and modifiers:
+ UInt32 keycode, modifiers;
+ char keychar;
+ result = GetEventParameter (
+ theEvent, // EventRef inEvent,
+ kEventParamKeyCode, // EventParamName inName,
+ typeUInt32, // EventParamType inDesiredType,
+ NULL, // EventParamType * outActualType, /* can be NULL */
+ sizeof(keycode), // UInt32 inBufferSize,
+ NULL, // UInt32 * outActualSize, /* can be NULL */
+ &keycode // void * outData /* can be NULL */
+ );
+ result = GetEventParameter (
+ theEvent, // EventRef inEvent,
+ kEventParamKeyMacCharCodes, // EventParamName inName,
+ typeUTF8Text, // EventParamType inDesiredType,
+ NULL, // EventParamType * outActualType, /* can be NULL */
+ sizeof(keychar), // UInt32 inBufferSize,
+ NULL, // UInt32 * outActualSize, /* can be NULL */
+ &keychar // void * outData /* can be NULL */
+ );
+ result = GetEventParameter (
+ theEvent, // EventRef inEvent,
+ kEventParamKeyModifiers, // EventParamName inName,
+ typeUInt32, // EventParamType inDesiredType,
+ NULL, // EventParamType * outActualType, /* can be NULL */
+ sizeof(modifiers), // UInt32 inBufferSize,
+ NULL, // UInt32 * outActualSize, /* can be NULL */
+ &modifiers // void * outData /* can be NULL */
+ );
+
+ // respond to event kind:
+ switch (eventKind) {
+ case kEventRawKeyUp:
+ glv.eventType(Event::KeyUp);
+ break;
+ case kEventRawKeyDown:
+ glv.eventType(Event::KeyDown);
+ break;
+ case kEventRawKeyRepeat:
+ glv.eventType(Event::KeyRepeat);
+ break;
+// case kEventRawKeyModifiersChanged:
+// glv.KeyEvent(0, keycode, keychar, modifiers);
+// debug("key mod %i %i %i\n", keycode, keychar, modifiers);
+// break;
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ glv.propagateEvent();
+
+ return result; // stop the App from processing this event
+ break;
+
+ case kEventClassApplication:
+
+ switch (eventKind) {
+ case kEventAppActivated:
+ debug("application activated\n");
+ //self->mIsActive = true;
+ break;
+ case kEventAppDeactivated:
+ debug("application deactivated\n");
+ break;
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ break;
+
+ case kEventClassCommand:
+
+ HICommand cmd;
+ result = GetEventParameter(theEvent,
+ kEventParamDirectObject,
+ typeHICommand,
+ NULL,
+ sizeof(HICommand),
+ NULL,
+ &cmd);
+
+ switch (cmd.commandID)
+ {
+ case kHICommandOK:
+ debug("Command: ok \n");
+ break;
+ case kHICommandCancel:
+ debug("Command: cancel \n");
+ break;
+ case kHICommandCopy:
+ debug("Command: copy \n");
+ break;
+ case kHICommandCut:
+ debug("Command: cut \n");
+ break;
+ case kHICommandPaste:
+ debug("Command: paste \n");
+ break;
+ case kHICommandClear:
+ debug("Command: delete \n");
+ break;
+ case kHICommandSelectAll:
+ debug("Command: select all \n");
+ break;
+ case kHICommandAbout:
+ debug("Command: about \n");
+ break;
+ case kHICommandAppHelp:
+ debug("Command: help \n");
+ break;
+ case kHICommandUndo:
+ debug("Command: undo \n");
+ break;
+ case kHICommandRedo:
+ debug("Command: redo \n");
+ break;
+ case kHICommandPreferences:
+ debug("Command: preferences \n");
+ break;
+ case kHICommandNew:
+ debug("Command: new \n");
+ break;
+ case kHICommandOpen:
+ debug("Command: open \n");
+ break;
+ case kHICommandClose:
+ debug("Command: close \n");
+ break;
+ case kHICommandSave:
+ debug("Command: save \n");
+ break;
+ case kHICommandSaveAs:
+ debug("Command: save as \n");
+ break;
+ case kHICommandRevert:
+ debug("Command: revert \n");
+ break;
+ case kHICommandPrint:
+ debug("Command: print \n");
+ break;
+ case kHICommandPageSetup:
+ debug("Command: page setup \n");
+ break;
+ case kHICommandQuit:
+ debug("Command: quit \n");
+ Application::quit();
+ break;
+
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ break;
+ }
+
+ CallNextEventHandler( nextHandler, theEvent ); // propagate event
+
+ return result; // Report failure
+}
+
+
+
+
+Window :: Window(unsigned int width, unsigned int height, char * title, GLV * glv, double framerate)
+: AbstractWindow(width, height, title, glv, framerate)
+{
+ OSStatus err;
+
+ // CREATE A WINDOW FROM THE .NIB RESOURCE
+
+ char * resource = "main"; // .nib reference
+ char * resourceItem = "Window";
+
+ /// create a nib reference from the resource name
+ IBNibRef nibRef;
+ err = CreateNibReference(C2CFSTR(resource), &nibRef);
+ if (err != 0) printf("unable to create Nib reference\n");
+
+ err = CreateWindowFromNib(nibRef, C2CFSTR(resourceItem), &windowRef);
+ if (err != 0) printf("unable to create window from Nib\n");
+ DisposeNibReference(nibRef);
+//
+// // create a window without using a .nib:
+//// WindowAttributes windowAttrs; // Window attribute flags
+//// CarbonRect contentRect; // Boundary of content region
+//// EventTypeSpec eventType; // Specifier for event type
+//// EventHandlerUPP handlerUPP; // Pointer to event handler routine
+////
+//// windowAttrs = kWindowStandardDocumentAttributes // Standard document window
+//// | kWindowStandardHandlerAttribute; // Use standard event handler
+//// SetRect (&rectport, 100.0, 100.0, // Set content rectangle
+//// 580.0, 460.0);
+//// CreateNewWindow (kDocumentWindowClass, windowAttrs, // Create the window
+//// &rectport, &windowRef);
+
+ show(false);
+ resize(width, height);
+
+ CFStringRef CFTitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
+ SetWindowTitleWithCFString(windowRef, CFTitle);
+ CFRelease(CFTitle);
+
+ // INITIALIZE AN OPENGL CONTEXT //
+
+ //CGMainDisplayID returns the display ID of the main display
+ CGDirectDisplayID mainDisplay = CGMainDisplayID();
+
+ /* THIS FOR FULLSCREEN
+ // Captures display for exclusive use
+ CGDisplayCapture (mainDisplay);
+ // Finds the closest display mode to the desired specifications
+ CFDictionaryRef refDisplayMode = CGDisplayBestModeForParameters (mainDisplay, bpp, width, height, NULL);
+ // Switches display to the mode obtained in previous function
+ CGDisplaySwitchToMode (mainDisplay, refDisplayMode);
+
+ /* ---This here is Display Manager, from Carbon--- */
+ // Obtains a handle for the video device with the specified display ID
+ DMGetGDeviceByDisplayID ((DisplayIDType)mainDisplay, &graphicsdevice, false);
+
+ GLint val = 0;
+
+ short i = 0;
+
+ attrib [i++] = AGL_ALL_RENDERERS;
+ attrib [i++] = AGL_RGBA; // red green blue and alpha
+ attrib [i++] = AGL_DOUBLEBUFFER; // double buffered
+ attrib [i++] = AGL_ACCELERATED; // HWA pixel format only
+ attrib [i++] = AGL_PIXEL_SIZE; // screen deoth we are looking for
+ attrib [i++] = 32;
+ attrib [i++] = AGL_DEPTH_SIZE; // screen deoth we are looking for
+ attrib [i++] = 24;
+ attrib [i++] = AGL_NONE;
+
+ // from:http://tuvix.apple.com/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/index.html#//apple_ref/doc/uid/TP40001987
+ if ((char *) kUnresolvedCFragSymbolAddress == (char *) aglChoosePixelFormat) {// check for existence of OpenGL
+ printf ("OpenGL not installed\n");
+ }
+ pixelformat = aglChoosePixelFormat(&graphicsdevice, 1, attrib); // this may fail if looking for acclerated across multiple monitors
+
+ if (NULL == pixelformat) {
+ printf("Could not find valid pixel format: %s\n", (char *)aglErrorString(aglGetError()));
+ }
+
+ aglDescribePixelFormat (pixelformat, AGL_PIXEL_SIZE, &val);
+
+ aglcontext = aglCreateContext (pixelformat, NULL); // Create an AGL context
+ if (NULL == aglcontext) {
+ printf ("Could not create context: %s\n", (char *)aglErrorString(aglGetError()));
+ }
+
+ if (!aglSetDrawable(aglcontext, GetWindowPort(windowRef)))
+ {
+ printf ("Could not set drawable on window: %s\n", (char *)aglErrorString(aglGetError()));
+ }
+
+ if (!aglSetCurrentContext (aglcontext)) { // make the context the current context
+ printf ("SetCurrentContext failed\n");
+ aglSetDrawable (aglcontext, NULL); // turn off full screen
+ debug(("%s\n", (char *)aglErrorString(aglGetError())));
+ }
+
+ long swapInterval = 1;
+ aglSetInteger (aglcontext, AGL_SWAP_INTERVAL, &swapInterval);
+
+ GetWindowBounds(windowRef, kWindowContentRgn, &rectport);
+
+ //SetRect(&rectport, 0, 0, 600, 400); // l, t, r, b
+ //sdebug (gcstrMode, "Stereo: %d x %d x %d", 480, 360, (**(**ghTargetDevice).gdPMap).pixelSize);
+
+
+
+
+
+ // INITIALIZE THE WINDOW EVENT HANDLER //
+
+ // get a target reference, using one of GetApplicationEventTarget, GetWindowEventTarget, GetMenuEventTarget, or GetControlEventTarget.
+ EventTargetRef target = GetWindowEventTarget(windowRef);
+
+ // create a handler
+ EventHandlerUPP handlerProc;
+ handlerProc = NewEventHandlerUPP(Window::carbonWindowHandler);
+
+ // create a typelist for events to respond to:
+ const EventTypeSpec eventTypes[] =
+ {
+
+ // keyboard
+ { kEventClassKeyboard, kEventRawKeyDown },
+ { kEventClassKeyboard, kEventRawKeyUp },
+ { kEventClassKeyboard, kEventRawKeyRepeat },
+ { kEventClassKeyboard, kEventRawKeyModifiersChanged },
+
+ // mouse
+ { kEventClassMouse, kEventMouseDown },
+ { kEventClassMouse, kEventMouseUp },
+ { kEventClassMouse, kEventMouseMoved },
+ { kEventClassMouse, kEventMouseDragged },
+ { kEventClassMouse, kEventMouseEntered },
+ { kEventClassMouse, kEventMouseExited },
+ { kEventClassMouse, kEventMouseWheelMoved },
+
+ // window
+ { kEventClassWindow, kEventWindowDrawContent },
+ { kEventClassWindow, kEventWindowContextualMenuSelect },
+ { kEventClassWindow, kEventWindowActivated },
+ { kEventClassWindow, kEventWindowDeactivated },
+ { kEventClassWindow, kEventWindowFocusAcquired },
+ { kEventClassWindow, kEventWindowFocusRelinquish },
+ { kEventClassWindow, kEventWindowClose },
+ { kEventClassWindow, kEventWindowClosed },
+ { kEventClassWindow, kEventWindowDispose },
+ { kEventClassWindow, kEventWindowResizeStarted },
+ { kEventClassWindow, kEventWindowResizeCompleted },
+ { kEventClassWindow, kEventWindowBoundsChanged },
+ { kEventClassWindow, kEventWindowGetIdealSize },
+ { kEventClassWindow, kEventWindowGetMinimumSize },
+ { kEventClassWindow, kEventWindowGetMaximumSize },
+
+ // command
+ { kEventClassCommand, kEventCommandProcess }
+ };
+
+ // register the multi-event handler
+ err = InstallEventHandler ( target, // EventTargetRef target,
+ handlerProc, // EventHandlerUPP handlerProc,
+ GetEventTypeCount(eventTypes), // UInt32 numTypes,
+ eventTypes, // const EventTypeSpec* typeList,
+ (void *)this, // void* userData, (passed back to the handler)
+ NULL // EventHandlerRef* handlerRef (reference to the handler)
+ );
+
+ timerUPP = NewEventLoopTimerUPP(carbonWindowDrawHandler);
+ InstallEventLoopTimer(
+ GetCurrentEventLoop(), // event loop
+ 1000.0 * kEventDurationMillisecond/fps(), // first delay
+ 1000.0 * kEventDurationMillisecond/fps(), // repeat
+ timerUPP, // callback
+ (void *)this, // userdata
+ 0 // EventLoopTimerRef
+ );
+
+ eventClassDescription[kEventClassKeyboard] = "Keyboard Event";
+ eventClassDescription[kEventClassMouse] = "Mouse Event";
+ eventClassDescription[kEventClassWindow] = "Window Event";
+
+ eventKindDescription[kEventRawKeyDown] = "Keyboard: RawKeyDown";
+ eventKindDescription[kEventRawKeyUp] = "Keyboard: RawKeyUp";
+ eventKindDescription[kEventRawKeyRepeat] = "Keyboard: RawKeyRepeat";
+ eventKindDescription[kEventRawKeyModifiersChanged] = "Keyboard: RawKeyModifiersChanged";
+
+ eventKindDescription[kEventMouseDown] = "Mouse: MouseDown";
+ eventKindDescription[kEventMouseUp] = "Mouse: MouseUp";
+ eventKindDescription[kEventMouseMoved] = "Mouse: MouseMoved";
+ eventKindDescription[kEventMouseDragged] = "Mouse: MouseDragged";
+ eventKindDescription[kEventMouseEntered] = "Mouse: MouseEntered";
+ eventKindDescription[kEventMouseExited] = "Mouse: MouseExited";
+ eventKindDescription[kEventMouseWheelMoved] = "Mouse: MouseWheelMoved";
+
+ eventKindDescription[kEventWindowDrawContent] = "Window: DrawContent";
+ eventKindDescription[kEventWindowContextualMenuSelect] = "Window: ContextualMenuSelect";
+ eventKindDescription[kEventWindowActivated] = "Window: Activated";
+ eventKindDescription[kEventWindowDeactivated] = "Window: Deactivated";
+ eventKindDescription[kEventWindowFocusAcquired] = "Window: FocusAcquired";
+ eventKindDescription[kEventWindowFocusRelinquish] = "Window: FocusRelinquish";
+ eventKindDescription[kEventWindowClose] = "Window: Close";
+ eventKindDescription[kEventWindowClosed] = "Window: Closed";
+ eventKindDescription[kEventWindowDispose] = "Window: Dispose";
+ eventKindDescription[kEventWindowResizeStarted] = "Window: ResizeStarted";
+ eventKindDescription[kEventWindowResizeCompleted] = "Window: ResizeCompleted";
+ eventKindDescription[kEventWindowBoundsChanged] = "Window: BoundsChanged";
+ eventKindDescription[kEventWindowGetIdealSize] = "Window: GetIdealSize";
+ eventKindDescription[kEventWindowGetMinimumSize] = "Window: GetMinimumSize";
+ eventKindDescription[kEventWindowGetMaximumSize] = "Window: GetMaximumSize";
+
+ // FOCUS AND SHOW THE WINDOW //
+
+ show(true);
+ ActivateWindow(windowRef, true);
+}
+
+Window :: ~Window()
+{
+
+}
+
+void Window :: platformResize(int width, int height){
+ SizeWindow(windowRef, width, height, true);
+}
+
+void Window :: platformShowHide(){
+ ShowHide(windowRef, mVisible);
+}
+
+pascal void Window :: carbonWindowDrawHandler(EventLoopTimerRef inTimer, void* udata)
+{
+ Window * self = (Window *)udata;
+
+ if (self->shouldDraw() && self->aglcontext)
+ {
+ aglSetCurrentContext(self->aglcontext); // ensure our context is current prior to drawing
+ aglUpdateContext(self->aglcontext); // test not normally needed
+ self->glv->drawGLV(self->w, self->h);
+ aglSwapBuffers(self->aglcontext); // send swap command
+ }
+}
+
+
+// convert carbon mouse button to GLV
+static int mouseButtonToGLV(EventMouseButton b){
+ switch(b){
+ case kEventMouseButtonPrimary: return Mouse::Left;
+ case kEventMouseButtonSecondary: return Mouse::Right;
+ case kEventMouseButtonTertiary: return Mouse::Middle;
+ default: return Mouse::Extra;
+ }
+}
+
+// a function to handle keyboard events:
+OSStatus Window :: carbonWindowHandler(EventHandlerCallRef nextHandler, EventRef theEvent, void * udata)
+{
+ Window * self = (Window *)udata;
+ if(!self->glv) return -1;
+ GLV& glv = *self->glv;
+
+ OSStatus result = noErr;
+
+ // Generic properties of all events:
+ UInt32 eventClass = GetEventClass(theEvent); // e.g. to use in a switch statement
+ UInt32 eventKind = GetEventKind(theEvent);
+
+// debug("Event: %s\t%s\n", self->eventClassDescription[eventClass].data(),
+// self->eventKindDescription[eventKind].data());
+
+// extern OSStatus
+// GetEventParameter(
+// EventRef inEvent,
+// EventParamName inName,
+// EventParamType inDesiredType,
+// EventParamType * outActualType, /* can be NULL */
+// UInt32 inBufferSize,
+// UInt32 * outActualSize, /* can be NULL */
+// void * outData) /* can be NULL */
+
+ // respond to event by type
+ switch (eventClass) {
+
+ case kEventClassMouse:
+
+ EventMouseButton button;
+ UInt32 clicks;
+
+ // get mouse position
+ int x, y;
+ space_t relx, rely;
+ HIPoint pt;
+ GetEventParameter(theEvent, kEventParamWindowMouseLocation, typeHIPoint, 0, sizeof(pt), 0, &pt);
+ x = (int)pt.x - 1;
+ y = (int)pt.y - CARBON_TITLEBARHEIGHT;
+ relx = (space_t)x;
+ rely = (space_t)y;
+
+ // respond to event kind:
+ switch(eventKind){
+
+ case kEventMouseDown:
+ GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, 0, sizeof(button), 0, &button);
+ GetEventParameter(theEvent, kEventParamClickCount, typeUInt32, 0, sizeof(clicks), 0, &clicks);
+ glv.setMouseDown(relx, rely, mouseButtonToGLV(button), clicks);
+ break;
+
+ case kEventMouseDragged:
+ glv.setMouseDrag(relx, rely);
+ break;
+
+ case kEventMouseMoved:
+ glv.setMouseMove(relx, rely);
+ break;
+
+ case kEventMouseUp:
+ GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, 0, sizeof(button), 0, &button);
+ glv.setMouseUp(relx, rely, mouseButtonToGLV(button), 1);
+ break;
+
+ case kEventMouseWheelMoved:
+ SInt32 wheelDelta; // EventMouseWheelAxis is an int for the axis 0 or 1
+ GetEventParameter(theEvent, kEventParamMouseWheelDelta, typeSInt32, 0, sizeof(wheelDelta), 0, &wheelDelta);
+ //EventMouseWheelAxis wheelAxis; // EventMouseWheelAxis is an int for the axis 0 or 1
+ //GetEventParameter(theEvent, kEventParamMouseWheelAxis, typeMouseWheelAxis, 0, sizeof(wheelAxis), 0, &wheelAxis);
+ glv.setMouseWheel(wheelDelta);
+ break;
+
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ glv.setMousePos(x, y, relx, rely);
+ glv.propagateEvent();
+ break;
+
+ case kEventClassKeyboard:
+
+ // get keyboard keycode and modifiers:
+ UInt32 keycode, modifiers;
+ char keychar;
+ GetEventParameter(theEvent, kEventParamKeyCode, typeUInt32, 0, sizeof(keycode), 0, &keycode);
+ GetEventParameter(theEvent, kEventParamKeyMacCharCodes, typeUTF8Text, 0, sizeof(keychar), 0, &keychar);
+ GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, 0, sizeof(modifiers), 0, &modifiers);
+
+ // respond to event kind:
+ switch(eventKind){
+ case kEventRawKeyUp: glv.setKeyUp((int)keychar); break;
+ case kEventRawKeyDown: glv.setKeyDown((int)keychar); break;
+ case kEventRawKeyRepeat:glv.eventType(Event::KeyRepeat); break;
+// case kEventRawKeyModifiersChanged:
+// glv.KeyEvent(0, keycode, keychar, modifiers);
+// debug("key mod %i %i %i\n", keycode, keychar, modifiers);
+// break;
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ //debug("%d\n", modifiers);
+ //for(int i=16; i>=0; i--){ debug("%d", (modifiers >> i) & 1 ); } debug("\n");
+
+ glv.keyboard.alt (modifiers & optionKey);
+ glv.keyboard.caps (modifiers & alphaLock);
+ glv.keyboard.ctrl (modifiers & controlKey);
+ glv.keyboard.shift(modifiers & shiftKey);
+ glv.propagateEvent();
+
+ return result; // stop the App from processing this event
+ break;
+
+ case kEventClassCommand:
+
+ HICommand cmd;
+ result = GetEventParameter(theEvent,
+ kEventParamDirectObject,
+ typeHICommand,
+ NULL,
+ sizeof(HICommand),
+ NULL,
+ &cmd);
+
+ switch (cmd.commandID)
+ {
+ case kHICommandOK:
+ debug("Command: ok \n");
+ break;
+ case kHICommandCancel:
+ debug("Command: cancel \n");
+ break;
+ case kHICommandCopy:
+ debug("Command: copy \n");
+ break;
+ case kHICommandCut:
+ debug("Command: cut \n");
+ break;
+ case kHICommandPaste:
+ debug("Command: paste \n");
+ break;
+ case kHICommandClear:
+ debug("Command: delete \n");
+ break;
+ case kHICommandSelectAll:
+ debug("Command: select all \n");
+ break;
+ case kHICommandAbout:
+ debug("Command: about \n");
+ break;
+ case kHICommandAppHelp:
+ debug("Command: help \n");
+ break;
+ case kHICommandUndo:
+ debug("Command: undo \n");
+ break;
+ case kHICommandRedo:
+ debug("Command: redo \n");
+ break;
+ case kHICommandPreferences:
+ debug("Command: preferences \n");
+ break;
+ case kHICommandNew:
+ debug("Command: new \n");
+ break;
+ case kHICommandOpen:
+ debug("Command: open \n");
+ break;
+ case kHICommandClose:
+ debug("Command: close \n");
+ break;
+ case kHICommandSave:
+ debug("Command: save \n");
+ break;
+ case kHICommandSaveAs:
+ debug("Command: save as \n");
+ break;
+ case kHICommandRevert:
+ debug("Command: revert \n");
+ break;
+ case kHICommandPrint:
+ debug("Command: print \n");
+ break;
+ case kHICommandPageSetup:
+ debug("Command: page setup \n");
+ break;
+ case kHICommandQuit:
+ debug("Command: quit \n");
+ Application::quit();
+ break;
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ return result; // stop the App from processing this event
+ break;
+
+ case kEventClassWindow:
+
+ switch (eventKind)
+ {
+ case kEventWindowDrawContent:
+ debug("Window draw \n");
+ break;
+ case kEventWindowContextualMenuSelect:
+ debug("Window right-click context menu \n");
+ break;
+ case kEventWindowActivated: {
+ debug("Window activated \n");
+ debug("Event::GetFocus: %d glv.eventtype: %d", Event::GetFocus, glv.eventType());
+ self->mIsActive = true;
+ break;
+ }
+ case kEventWindowDeactivated: {
+ debug("Window deactivated \n");
+ //ActivateWindow(self->windowRef, false);
+ //self->mIsActive = false;
+ break;
+ }
+ case kEventWindowFocusAcquired:
+ debug("Event::GetFocus: %d glv.eventtype: %d", Event::GetFocus, glv.eventType());
+ debug("Window got focus \n");
+ ActivateWindow(self->windowRef, true);
+ break;
+ case kEventWindowFocusRelinquish:
+ debug("Window lost focus \n");
+ break;
+ case kEventWindowClose:
+ debug("Window close \n");
+ break;
+ case kEventWindowClosed: {
+ debug("Window closed \n");
+ self->mIsActive = false;
+ break;
+ }
+ case kEventWindowDispose: {
+ //debug("Window dispose \n");
+ DisposeEventLoopTimerUPP(self->timerUPP);
+ break;
+ }
+ case kEventWindowResizeStarted: {
+ //debug("Window resize start \n");
+ self->mIsActive = false;
+ break;
+ }
+ case kEventWindowBoundsChanged: {
+ //debug("Window bounds changed \n");
+ CarbonRect newbounds;
+ unsigned int x, y;
+ result = GetEventParameter (
+ theEvent, // EventRef inEvent,
+ kEventParamCurrentBounds, // EventParamName inName,
+ typeQDRectangle, // EventParamType inDesiredType,
+ NULL, // EventParamType * outActualType, /* can be NULL */
+ sizeof(newbounds), // UInt32 inBufferSize,
+ NULL, // UInt32 * outActualSize, /* can be NULL */
+ &newbounds // void * outData /* can be NULL */
+ );
+
+ x = newbounds.right-newbounds.left;
+ y = newbounds.bottom-newbounds.top;
+
+ debug("resize %i %i\n", x, y);
+
+ if (x != self->w & y != self->h) {
+ self->resize(x,y);
+ }
+ break;
+ }
+ case kEventWindowResizeCompleted: {
+ debug("Window resize complete \n");
+// // this is necessary to restart drawing
+ self->mIsActive = true;
+ ActivateWindow(self->windowRef, true);
+ break;
+ }
+ case kEventWindowGetIdealSize: {
+ debug("Window get ideal size \n");
+ break;
+ }
+ case kEventWindowGetMinimumSize: {
+ debug("Window get min size \n");
+ break;
+ }
+ case kEventWindowGetMaximumSize: {
+ debug("Window get max size \n");
+ break;
+ }
+ default:
+ glv.eventType(Event::Null);
+ }
+
+ break;
+
+ }
+
+ CallNextEventHandler(nextHandler, theEvent); // propagate event
+
+ return result; // Report any failure
+}
+
+} // end namespace glv
+
+#undef debug
\ No newline at end of file
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_binding_fltk.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_binding_fltk.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,156 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_binding_fltk.h"
+#include <FL/fl_draw.H> // for cursor
+
+namespace glv{
+
+
+void AbstractWindow::hideCursor(bool v){}
+
+
+//---- Application
+void Application::quit(){
+}
+
+void Application::run(){
+ AbstractApplication::run();
+ Fl::run();
+}
+
+
+//---- Window
+Window::Window(unsigned int width, unsigned int height, char * title, double framerate)
+: AbstractWindow(width, height, title, framerate), Fl_Gl_Window(0, 0, width, height, title)
+{
+ mFullscreenDeferred = false;
+ Fl_Gl_Window::resizable(this);
+
+ // Use timer to fix frame rate.
+ Fl::add_timeout(1.0/framerate, Window::scheduleDraw, (void*)this);
+
+ AbstractWindow::show(true);
+ //fl_cursor(FL_CURSOR_NONE);
+}
+
+Window::~Window(){ }
+
+void Window::scheduleDraw(void * userdata){
+ Window * win = (Window *)userdata;
+ win->redraw();
+ Fl::repeat_timeout(1.0/win->fps(), scheduleDraw, userdata);
+}
+
+void Window::draw(){
+ if (!glv) return;
+
+ if(mFullscreenDeferred){
+ mFullscreenDeferred = false;
+ fltkFullscreen();
+ }
+
+ if (mIsActive && mVisible){
+ glv->drawGLV(AbstractWindow::w, AbstractWindow::h);
+
+ // swap_buffers() is called automatically by FLTK after this method returns.
+ }
+}
+
+int Window::handle(int event) {
+
+ //---- Mouse Event
+ if(FL_DRAG == event || FL_MOUSEWHEEL == event || FL_PUSH == event || FL_RELEASE == event){
+ //printf("FLTK: mouse event x:%d y:%d dx:%3d dy:%3d bt:%d cl:%d\n", Fl::event_x(), Fl::event_y(), Fl::event_dx(), Fl::event_dy(), Fl::event_button(), Fl::event_clicks());
+ space_t x = (space_t)Fl::event_x();
+ space_t y = (space_t)Fl::event_y();
+ space_t relx = x;
+ space_t rely = y;
+
+ int btn = Fl::event_button();
+ switch(btn){
+ case FL_LEFT_MOUSE: btn = GLV_MOUSE_LEFT; break;
+ case FL_MIDDLE_MOUSE: btn = GLV_MOUSE_MIDDLE; break;
+ case FL_RIGHT_MOUSE: btn = GLV_MOUSE_RIGHT; break;
+ default: btn = GLV_MOUSE_EXTRA; // unrecognized button
+ }
+
+ switch(event){
+ case FL_DRAG: glv->setMouseDrag(relx, rely, btn, Fl::event_clicks()); break;
+ case FL_MOUSEWHEEL: glv->setMouseWheel(Fl::event_dy()); break;
+ case FL_PUSH: glv->setMouseDown(relx, rely, btn, Fl::event_clicks()); break;
+ case FL_RELEASE: glv->setMouseUp(relx, rely, btn, Fl::event_clicks()); break;
+ }
+
+ glv->setMouseXY((int)x, (int)y, relx, rely);
+ glv->propagateEvent();
+ return 1;
+ }
+
+ //---- Keyboard Event
+ //... keypress, key is in Fl::event_key(), ascii in Fl::event_text()
+ //... Return 1 if you understand/use the keyboard event, 0 otherwise...
+ else if(FL_KEYDOWN == event || FL_KEYUP == event){
+
+// printf("FLTK: keyboard %d %d\n", Fl::event_key(), Fl::event_state());
+ glv->keyboard.alt (Fl::event_alt() != 0);
+ glv->keyboard.caps ((Fl::event_state() & FL_CAPS_LOCK) != 0);
+ glv->keyboard.ctrl (Fl::event_ctrl() != 0);
+ glv->keyboard.meta ((Fl::event_state() & FL_META) != 0);
+#if defined(__linux__)
+ glv->keyboard.shift(Fl::event_shift() == 0);
+#else
+ glv->keyboard.shift(Fl::event_shift() != 0);
+#endif
+
+ switch(event){
+ case FL_KEYDOWN: glv->setKeyDown(Fl::event_key()); break;
+ case FL_KEYUP: glv->setKeyUp(Fl::event_key()); break;
+ }
+
+ glv->propagateEvent();
+ return 1;
+ }
+
+ //---- Other Events
+ else{
+ switch(event) {
+ case FL_FOCUS :
+ case FL_UNFOCUS : //... Return 1 if you want keyboard events, 0 otherwise
+ return 1;
+
+ case FL_SHORTCUT: //... shortcut, key is in Fl::event_key(), ascii in Fl::event_text()
+ //... Return 1 if you understand/use the shortcut event, 0 otherwise...
+ return 1;
+
+ default: // pass other events to the base class...
+ return Fl_Gl_Window::handle(event);
+ }
+ }
+}
+
+void Window::resize(int l, int t, int w, int h){
+ AbstractWindow::resize(w, h);
+}
+
+void Window::platformFullscreen(){ mFullscreenDeferred = true; }
+
+void Window::fltkFullscreen(){
+ if(mFullscreen) Fl_Gl_Window::fullscreen();
+ else Fl_Gl_Window::fullscreen_off(0, 0, AbstractWindow::w, AbstractWindow::h);
+}
+
+void Window::platformResize(int width, int height){
+ if(mFullscreen){
+ int fx, fy, fw, fh;
+ Fl::screen_xywh(fx, fy, fw, fh);
+ Fl_Gl_Window::resize(fx, fy, fw, fh);
+ }
+ else Fl_Gl_Window::resize(20, 40, AbstractWindow::w, AbstractWindow::h);
+}
+
+void Window::platformShowHide(){
+ mVisible ? Fl_Gl_Window::show() : Fl_Gl_Window::hide();
+}
+
+} // end namespace glv
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_binding_glut.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,207 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_binding_glut.h"
+
+namespace glv{
+
+
+static Window * singletonWindow = NULL;
+
+void Application::quit(){
+}
+
+void Application::run(){
+ AbstractApplication::run();
+ 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 = singletonWindow->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 = singletonWindow->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 = singletonWindow->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 = singletonWindow->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){
+ singletonWindow->AbstractWindow::resize(w, h);
+}
+
+static void registerCBs(){
+ glutDisplayFunc(glutDisplayCB);
+ glutKeyboardFunc(glutKeyboardCB);
+ glutKeyboardUpFunc(glutKeyboardUpCB);
+ glutMouseFunc(glutMouseCB);
+ glutMotionFunc(glutMotionCB);
+ glutReshapeFunc(glutReshapeCB);
+ glutSpecialFunc(glutSpecialCB);
+ glutSpecialUpFunc(glutSpecialUpCB);
+}
+
+static void scheduleDraw(int value){
+ singletonWindow->draw();
+ 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)
+{
+ int argc = 0;
+ char * argv[] = {};
+ if(singletonWindow == NULL){
+ glutInit(&argc,argv);
+ glutInitWindowSize(width,height);
+ //glutInitWindowPosition (100, 100);
+ glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH|GLUT_STENCIL);
+ glutCreateWindow(title);
+
+ registerCBs();
+
+ glutIgnoreKeyRepeat(1);
+
+ singletonWindow = this;
+ scheduleDraw(0);
+ }
+}
+
+Window::~Window(){ }
+
+void Window::platformFullscreen(){
+
+// 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"
+
+// = 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");
+ glutEnterGameMode();
+ registerCBs();
+ hideCursor(mHideCursor);
+ }
+ else glutLeaveGameMode();
+}
+
+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 Window::draw(){
+ if(shouldDraw()){
+ glv->drawGLV(w, h);
+ glutSwapBuffers();
+ }
+}
+
+} // end namespace glv
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_color.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_color.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,62 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include <stdio.h>
+#include "glv_color.h"
+
+namespace glv{
+
+void Color::setHSV6(float h, float s, float v){
+ if( s == 0.f ) {
+ r = g = b = v; // achromatic (gray)
+ return;
+ }
+ // sector 0 to 5
+ unsigned int i = (unsigned int)(h); // integer part of h
+ float f = h - (float)i; // fractional part of h
+ float p = v * ( 1.f - s );
+
+ // depends on hue section being even or odd
+ float q = v * (1.f - s * ( i & 1U ? f : 1.f - f));
+
+ switch( i ) {
+ case 0: r = v; g = q; b = p; break;
+ case 1: r = q; g = v; b = p; break;
+ case 2: r = p; g = v; b = q; break;
+ case 3: r = p; g = q; b = v; break;
+ case 4: r = q; g = p; b = v; break;
+ default:r = v; g = p; b = q; break;
+ }
+}
+
+void Color::getHSV6(float &h, float &s, float &v) const{
+
+ float min = r < g ? (r < b ? r : b) : (g < b ? g : b);
+ float max = r > g ? (r > b ? r : b) : (g > b ? g : b);
+
+ v = max; // v
+ float delta = max - min; // delta RGB value
+
+ if ( delta != 0.f && max != 0.f ){ // chromatic data...
+ s = delta / max; // s
+
+ float hl;
+ if ( r == max ) hl = ( g - b ) / delta; // between yellow & magenta
+ else if( g == max ) hl = 2.f + ( b - r ) / delta; // between cyan & yellow
+ else hl = 4.f + ( r - g ) / delta; // between magenta & cyan
+
+ if( hl < 0.f ) hl += 6.f;
+
+ h = hl;
+ }
+ else{ // this is a gray, no chroma...
+ h = 0.f;
+ s = 0.f;
+ }
+}
+
+void Color::print(const char * append, FILE * fp) const{
+ fprintf(fp, "[%.2f, %.2f, %.2f, %.2f]%s", r, g, b, a, append);
+}
+
+} // end namespace glv
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_core.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_core.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,50 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_core.h"
+
+namespace glv{
+
+namespace Event{
+
+ const char * string(const Event::t e){
+ #define CS(t) case Event::t: return #t;
+ switch(e){
+ CS(Null)
+ CS(Quit)
+ CS(GetFocus) CS(LoseFocus)
+ CS(MouseDown) CS(MouseUp) CS(MouseMove) CS(MouseDrag) CS(MouseWheel)
+ CS(KeyDown) CS(KeyUp) CS(KeyRepeat)
+ CS(Unused)
+ default: return "?";
+ };
+ #undef CS
+ }
+}
+
+
+
+StyleColor::StyleColor()
+: back(0.5, 0.5), border(0.5, 1), fore(1, 1), text(1, 1)
+{}
+
+
+
+void StyleColor::set(int preset){
+ switch(preset){
+ case BlackOnWhite: back.set(1 ); border.set(0); fore.set(0.5); text.set(0); break;
+ case Gray: back.set(0.2); border.set(1); fore.set(1); text.set(0); break;
+ case WhiteOnBlack: back.set(0 ); border.set(1); fore.set(0.5); text.set(1); break;
+ }
+}
+
+
+void StyleColor::hsv(float h, float s, float v){
+ Color c; c.setHSV(h,s,v);
+ c.a = 0.2; back.set(c);
+ c.a = 0.5; border.set(c);
+ c.a = 1.0; fore.set(c);
+}
+
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_draw.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,235 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include <ctype.h>
+#include "glv_draw.h"
+
+namespace glv{
+namespace draw{
+
+// graphical ASCII characters lie in decimal range [33, 126]
+static Glyph glyphs[94] = {
+ {Glyph::Once | Glyph::Dot1 | 2, {3,4,4}, {7,0,5}}, // !
+ {Glyph::Once | 4, {3,3,5,5}, {0,3,0,3}}, // "
+ {Glyph::Once | 8, {1,7,1,7,3,3,5,5}, {3,3,5,5,1,7,1,7}},// #
+ {0}, // $
+ {Glyph::Once | Glyph::Dot2 | 2, {1,6,7,1}, {0,7,0,8}}, // %
+ {7, {7,3,4,5,1,4,7}, {8,1,0,1,6,8,5}}, // &
+ {Glyph::Once | 2, {5,3}, {0,3}}, // '
+ {4, {5,3,3,5}, {0,2,6,8}}, // (
+ {4, {3,5,5,3}, {0,2,6,8}}, // )
+ {Glyph::Once | 6, {1,7,4,4,7,1}, {2,6,0,8,2,6}}, // *
+ {Glyph::Once | 4, {1,7,4,4},{4,4,1,7}}, // +
+ {Glyph::Once | 2, {4,2}, {7,10}}, // ,
+ {2, {1,7}, {5,5}}, // -
+ {Glyph::Dot1, {3}, {7}}, // .
+ {Glyph::Once | 2, {6,2}, {0,8.5}}, // /
+ {6, {6,1,1,6,6,1}, {0,0,8,8,0,8}}, // 0
+ {3, {2,4,4}, {1,0,8.5}}, // 1
+ {6, {1,2,5,6,1,6}, {2,0,0,2,8,8}}, // 2
+ {7, {1,6,6,2,6,6,1}, {0,0,2,3,4,7,8}}, // 3
+ {4, {6,1,5,5}, {6,6,0,8.5}}, // 4
+ {6, {6,1,1,6,6,1}, {0,0,2,3,7,8}}, // 5
+ {6, {6,1,1,6,6,1}, {0,0,8,8,4,4}}, // 6
+ {3, {1,6,3}, {0,0,8.5}}, // 7
+ {7, {6,1,1,6,6,1,1}, {4,4,0,0,8,8,4}}, // 8
+ {6, {6,1,1,6,6,1}, {4,4,0,0,8,8}}, // 9
+ {Glyph::Dot2, {3,3}, {1,7}}, // :
+ {Glyph::Once | Glyph::Dot1 | 2, {3,4,2}, {1,7,10}}, // ;
+ {3, {7,1,7}, {0,4,8.5}}, // <
+ {Glyph::Once | 4, {1,7,1,7}, {3,3,6,6}}, // =
+ {3, {1,7,1}, {0,4,8.5}}, // >
+ {Glyph::Dot1 | 5, {3,1,6,6,3,3}, {7,0,0,3,4,5}}, // ?
+ {8, {7,3,3,7,7,1,1,7}, {2,3,6,6,0,0,8,8}}, // @
+ {Glyph::Once | 6, {1,4,4,7,2,6}, {8.5,0,0,8.5,5,5}}, // A
+ {8, {1,1,5,5,1,6,6,1}, {8,0,1,4,4,4,8,8}}, // B
+ {4, {6,1,1,6}, {0,1,7,8}}, // C
+ {5, {1,6,6,1,1}, {0,2,7,8,0}}, // D
+ {Glyph::Once | 8, {1,1,1,6,1,5,1,6}, {0,8,0,0,4,4,8,8}},// E
+ {Glyph::Once | 6, {1,1,1,6,1,5}, {0,8,0,0,4,4}}, // F
+ {6, {6,1,1,6,6,4}, {0,1,7,8,5,5}}, // G
+ {Glyph::Once | 6, {1,1,1,6,6,6}, {0,8.5,4,4,0,8.5}}, // H
+ {Glyph::Once | 6, {2,6,4,4,2,6}, {0,0,0,8,8,8}}, // I
+ {4, {1,1,6,6}, {6,8,8,-0.5}}, // J
+ {Glyph::Once | 6, {1,1,6,1,1,6}, {-0.5,8.5,-0.5,4,4,8.5}}, // K
+ {3, {1,1,6}, {-0.5,8,8}}, // L
+ {5, {1,1,4,7,7}, {8.5,0,5,0,8.5}}, // M
+ {4, {1,1,6,6}, {8.5,0,8,0}}, // N
+ {5, {1,6,6,1,1}, {0,0,8,8,0}}, // O
+ {5, {1,1,6,6,1}, {8.5,0,1,4,4}}, // P
+ {6, {5,1,1,6,5,7}, {7,7,0,0,7,9}}, // Q
+ {6, {1,1,6,6,1,6}, {8.5,0,1,4,4,8}}, // R
+ {6, {6,1,1,6,6,1}, {0,0,3,5,8,8}}, // S
+ {Glyph::Once | 4, {1,7,4,4}, {0,0,0,8.5}}, // T
+ {4, {1,1,6,6}, {0,8,8,0}}, // U
+ {3, {1,4,7}, {0,8,0}}, // V
+ {5, {1,2,4,6,7}, {0,8,4,8,0}}, // W
+ {Glyph::Once | 4, {1,6,6,1}, {0,8,0,8}}, // X
+ {Glyph::Once | 6, {1,4,4,7,4,4}, {0,4,4,0,4,8.5}}, // Y
+ {4, {1,6,1,6}, {0,0,8,8}}, // Z
+ {4, {5,3,3,5}, {0,0,8,8}}, // [
+ {Glyph::Once | 2, {2,6}, {0,8.5}}, /* \ */
+ {4, {3,5,5,3}, {0,0,8,8}}, // ]
+ {3, {1,4,7}, {4,0,4}}, // ^
+ {Glyph::Once | 2, {1,7}, {8,8}}, // _
+ {Glyph::Once | 2, {3,5}, {0,3}}, // `
+ {6, {2,6,6,1,1,6}, {3,3,8,8,5,4}}, // a
+ {5, {1,1,6,6,1}, {-0.5,8,8,4,3}}, // b
+ {4, {6,1,1,6}, {3,4,8,8}}, // c
+ {5, {6,6,1,1,6}, {-0.5,8,8,4,3}}, // d
+ {6, {1,6,6,1,1,6}, {6,5,3,3,8,8}}, // e
+ {Glyph::Once | 6, {7,3,3,3,5.5,1.5}, {0,0,0,8.5,3,3}}, // f
+ {6, {6,1,1,6,6,2}, {8,7,3,3,10,10}}, // g
+ {Glyph::Once | 6, {1,1,1,6,6,6}, {-0.5,8.5,3,4,4,8.5}}, // h
+ {Glyph::Dot1 | 3, {3,3,4,4}, {0,3,3,8.5}}, // i
+ {Glyph::Dot1 | 4, {4,4,5,5,1}, {0,3,3,10,10}}, // j
+ {Glyph::Once | 6, {1,1,5,1,1,6}, {-0.5,8.5,3,5,5,8,5}}, // k
+ {3, {3,3,5}, {-0.5,8.5,8.5}}, // l
+ {7, {1,1,3,4,4,6,7}, {8.5,3,3,7,3,3,8.5}}, // m
+ {4, {1,1,5,6}, {8.5,3,3,8.5}}, // n
+ {5, {1,6,6,1,1}, {3,3,8,8,3}}, // o
+ {5, {1,1,6,6,1}, {11,3,3,7,8}}, // p
+ {5, {6,1,1,6,6}, {8,7,3,3,11}}, // q
+ {4, {1,1,3,6}, {8.5,4,3,3}}, // r
+ {6, {6.6,1,1,6,6,0.5}, {3,3,5,6,8,8}}, // s
+ {Glyph::Once | 4, {1,6,3,3}, {3,3,-0.5,8.5}}, // t
+ {4, {1,2,6,6}, {2.5,8,8,2.5}}, // u
+ {3, {1,4,7}, {2.5,8,2.5}}, // v
+ {5, {1,2,4,6,7}, {2.5,8,5,8,2.5}}, // w
+ {Glyph::Once | 4, {1,6,1,6}, {8.5,2.5,2.5,8.5}}, // x
+ {Glyph::Once | 4, {1,4,6,3}, {2.5,8,2.5,11}}, // y
+ {4, {1,6,1,6.5}, {3,3,8,8}}, // z
+ {7, {5,3,3,1,3,3,5}, {0,0,3,4,5,8,8}}, // {
+ {Glyph::Once | 2, {4,4}, {0,8.5}}, // |
+ {7, {3,5,5,7,5,5,3}, {0,0,3,4,5,8,8}}, // }
+ {4, {1,3,5,7}, {2,0,2,0}} // ~
+};
+
+
+bool character(int c, float dx, float dy){
+
+ if(isgraph(c)){ // is graphical character?
+ c -= 33;
+
+ float * x = glyphs[c].x;
+ float * y = glyphs[c].y;
+ int n = glyphs[c].size();
+ int dots = glyphs[c].dots();
+
+ if(dots){
+ for(int j=0; j<dots; ++j){
+ float l = x[j] + dx; float t = y[j] + dy;
+ float r = l + 1; float b = t + 1;
+ vertex(l, t); vertex(r, t); vertex(r, t); vertex(r, b);
+ vertex(r, b); vertex(l, b); vertex(l, b); vertex(l, t);
+ }
+ if(n == 0) return true;
+ x += dots; y += dots;
+ }
+
+ n--;
+ vertex(x[0] + dx, y[0] + dy);
+ if(glyphs[c].once() == 0){ // line strip
+ for(int i=1; i<n; ++i){
+ vertex(x[i] + dx, y[i] + dy);
+ vertex(x[i] + dx, y[i] + dy);
+ }
+ }
+ else{ // normal lines
+ for(int i=1; i<n; ++i) vertex(x[i] + dx, y[i] + dy);
+ }
+ vertex(x[n] + dx, y[n] + dy);
+ return true;
+ }
+ 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);
+ if(divy > 0){
+ inc = (double)h/(double)divy;
+ double i = incEnds ? t-0.0001 : t-0.0001+inc, e = incEnds ? b : b-inc;
+ for(; i<e; i+=inc){ vertex(l,i); vertex(r,i); }
+ }
+ if(divx > 0){
+ inc = (double)w/(double)divx;
+ double i = incEnds ? l-0.0001 : l-0.0001+inc, e = incEnds ? r : r-inc;
+ for(; i<e; i+=inc){ vertex(i,t); vertex(i,b); }
+ }
+ end();
+}
+
+
+void linesH(float l, float t, float w, float h, int n){
+ double pos = 0;
+ double inc = (double)h/(double)(n-1);
+
+ push(); translate(l,t);
+ begin(Lines);
+ for(int i=0; i<n; ++i){
+ vertex(0, pos); vertex(w, pos);
+ pos+=inc;
+ }
+ end(); pop();
+}
+
+
+void linePattern(float l, float t, float w, float h, int n, const char * pat){
+ const char * p = pat;
+ double pos = 0;
+ double inc = (double)w/(double)(n-1);
+
+ push(); translate(l,t);
+ begin(Lines);
+ for(int i=0; i<n; ++i){
+ if(!*p) p = pat;
+ if(*p++ == '/'){ vertex(pos, 0); vertex(pos, h); }
+ pos+=inc;
+ }
+ end(); pop();
+}
+
+
+void pgon(float l, float t, float w, float h, int n, float a){
+ w *= 0.5; h *= 0.5;
+ push(); translate(l + w, t + h); scale(w, h); rotate(0, 0, a * 360);
+ begin(LineLoop);
+ for(int i=0; i<n; ++i){
+ float p = (double)i / (double)n * C_2PI;
+ vertex(cos(p), sin(p));
+ }
+ end(); pop();
+}
+
+
+void spokes(float l, float t, float w, float h, int n, float a){
+ w *= 0.5; h *= 0.5;
+ push(); translate(l + w, t + h); scale(w, h); rotate(0, 0, a * 360);
+ begin(Lines);
+ for(int i=0; i<n; ++i){
+ float p = (double)i / (double)n * C_2PI;
+ vertex(0,0); vertex(cos(p), sin(p));
+ }
+ end(); pop();
+}
+
+
+void text(const char * s, float l, float t, float lineSpacing, unsigned int tabSpaces){
+ float x=l, y=t, tabUnits = tabSpaces*8;
+ //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;
+ }
+ s++;
+ }
+ end();
+}
+
+} // draw::
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_glv.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,241 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_core.h"
+
+namespace glv{
+
+GLV::GLV(drawCallback cb, space_t width, space_t height)
+: View(0, 0, width, height, cb), mFocusedView(this)
+{
+ disable(DrawBorder | FocusHighlight);
+ cloneStyle();
+}
+
+
+// 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){
+
+ bool bubble = v.onEvent(e, *this); // Execute virtual callback
+
+ const eventCallbackList& cbl = v.callbackLists[e];
+
+ // Execute callbacks in list
+ for(eventCallbackList::const_iterator it = cbl.begin(); it != cbl.end(); it++){
+ if(*it) bubble |= (*it)(&v, *this);
+ }
+
+ return bubble;
+}
+
+void GLV::doFocusCallback(bool get){
+
+ Event::t e = get ? Event::GetFocus : Event::LoseFocus;
+
+ if(mFocusedView){
+ mFocusedView->focused(get);
+
+ if(mFocusedView->numEventCallbacks(e) ){
+ eventType(e);
+ doEventCallbacks(*mFocusedView, e);
+ }
+ }
+}
+
+void GLV::drawGLV(unsigned int w, unsigned int h){
+ preamble(w, h);
+ drawWidgets(w, h);
+}
+
+
+static void drawContext(float tx, float ty, View * v, float& cx, float& cy, View *& c){
+ using namespace glv::draw;
+
+ cx += tx; cy += ty; // update absolute coordinates of drawing context
+
+ identity(); // clear model matrix (assumed set already)
+
+ // these weird calls are necessary so that we draw on the center of pixels
+ // rather than on the boundaries
+ translate(pix(cx) + 0.5, pix(cy) + 0.5); // offset to center of top-left pixel
+ //scale(v->w/(v->w+1), v->h/(v->h+1)); // scale to lose 1 pixel on each edge
+
+ c = v;
+}
+
+static void computeCrop(std::vector<Rect>& cr, int lvl, space_t ax, space_t ay, View * v){
+ if(v->enabled(CropChildren)){
+ cr[lvl].set(ax, ay, v->w, v->h); // set absolute rect
+ cr[lvl].intersection(cr[lvl-1], cr[lvl]);
+ }
+}
+
+// Views are drawn depth-first from leftmost to rightmost sibling
+void GLV::drawWidgets(unsigned int w, unsigned int h){
+ using namespace draw;
+
+ float cx = 0, cy = 0; // drawing context absolute position
+ View * const root = this;
+ View * cv = root;
+
+ // The crop region is the intersection of all parent rects up to the top
+ // view. The intersections also need to be done in absolute coordinates.
+ std::vector<Rect> cropRects(16, Rect(w, h)); // index is hierarchy level
+ int lvl = 0; // start at root = 0
+
+ push2D(w, h); // initialise the OpenGL renderer for our 2D GUI world
+ onDraw(); // draw myself
+ push(); // push model matrix because of transformations in drawContext()
+
+ draw::enable(ScissorTest);
+
+ while(true){
+ // find the next view to draw
+
+ // go to child node if exists and I'm drawable
+ if(cv->child && cv->visible()){
+ drawContext(cv->child->l, cv->child->t, cv->child, cx, cy, cv);
+ computeCrop(cropRects, ++lvl, cx, cy, cv);
+ }
+
+ // go to sibling node if exists
+ else if(cv->sibling){
+ drawContext(cv->sibling->l - cv->l, cv->sibling->t - cv->t, cv->sibling, cx, cy, cv);
+ computeCrop(cropRects, lvl, cx, cy, cv);
+ }
+
+ // retrace upwards until a parent's sibling is found
+ else{
+ while(cv != root && cv->sibling == 0){
+ drawContext(-cv->l, -cv->t, cv->parent, cx, cy, cv);
+ lvl--;
+ }
+
+ if(cv->sibling){
+ drawContext(cv->sibling->l - cv->l, cv->sibling->t - cv->t, cv->sibling, cx, cy, cv);
+ computeCrop(cropRects, lvl, cx, cy, cv);
+ }
+ else break; // break the loop when the traversal returns to the root
+ }
+
+
+ // draw the current view
+ if(cv->visible()){
+
+ Rect r = cropRects[lvl-1]; // cropping region comes from parent context
+ if(cv->enabled(CropSelf)) r.intersection(Rect(cx, cy, cv->w, cv->h), r); // crop my own draw?
+
+ // LJP: using some weird numbers here, seems to work right though...
+ //scissor(r.l, h - r.bottom() - 1, r.w+2, r.h+1);
+ scissor(pix(r.l), pix(h - r.bottom() - 1.499), pix(r.w+1), pix(r.h+1.499));
+
+ cv->drawBack();
+ push(); cv->onDraw(); pop(); // push/pop model cuz user might forget to...
+ cv->drawBorder();
+ }
+ }
+
+ pop();
+
+ // this weird call is necessary so that raster calls get scissored properly
+ // not entirely sure why this works, but it does.
+ scissor(0,0,(GLint)w,(GLint)h);
+
+ pop2D();
+}
+
+void GLV::preamble(unsigned int w, unsigned int h){
+ using namespace draw;
+ clearColor(colors().back.r, colors().back.g, colors().back.b, colors().back.a);
+ clear(ColorBufferBit | DepthBufferBit);
+}
+
+void GLV::propagateEvent(){ //printf("GLV::propagateEvent(): %s\n", Event::getName(eventtype));
+ View * v = mFocusedView;
+ Event::t e = eventType(); // get current event type
+
+ while(v && doEventCallbacks(*v, e)) v = v->parent;
+}
+
+void GLV::setFocus(View * v){
+
+ // save current event since we do not want to propagate GetFocus and LoseFocus
+ Event::t currentEvent = eventType();
+
+ doFocusCallback(false); // Call current focused View's LoseFocus callback
+ mFocusedView = v; // Set the currently focused View
+ doFocusCallback(true); // Call newly focused View's GetFocus callback
+
+ eventType(currentEvent);
+}
+
+void GLV::setKeyDown(int keycode){
+ eventType(Event::KeyDown);
+ keyboard.mKeycode = keycode;
+ keyboard.mIsDown = true;
+}
+
+void GLV::setKeyUp(int keycode){
+ eventType(Event::KeyUp);
+ keyboard.mKeycode = keycode;
+ keyboard.mIsDown = false;
+}
+
+void GLV::setMouseDown(space_t& x, space_t& y, int button, int clicks){
+ eventType(Event::MouseDown);
+ //if(button == Mouse::Left)
+ setFocus(findTarget(x, y));
+ mouse.updateButton(button, true, clicks);
+}
+
+void GLV::setMouseMove(space_t& x, space_t& y){
+ eventType(Event::MouseMove);
+ if(absToRel(mFocusedView, x, y)){
+ x -= mFocusedView->l;
+ y -= mFocusedView->t;
+ }
+}
+
+void GLV::setMouseDrag(space_t& x, space_t& y){
+ eventType(Event::MouseDrag);
+ if(absToRel(mFocusedView, x, y)){
+ x -= mFocusedView->l;
+ y -= mFocusedView->t;
+ }
+}
+
+// MouseDrag doesn't call setFocus because that messes up the dragging of a view.
+// x, y coords are passed in as absolute (i.e. relative to top GLV View)
+void GLV::setMouseDrag(space_t& x, space_t& y, int button, int clicks){
+ eventType(Event::MouseDrag);
+
+ // LJP: This operates on all children, rather than just the focused View.
+ //findTarget(x, y); //for setting relative coordinates
+
+ if(absToRel(mFocusedView, x, y)){
+ x -= mFocusedView->l;
+ y -= mFocusedView->t;
+ }
+
+ // LJP: Why update button state during a drag event?
+ mouse.updateButton(button, true, clicks);
+}
+
+void GLV::setMousePos(int x, int y, space_t relx, space_t rely){
+ mouse.pos(x, y);
+ mouse.posRel(relx, rely);
+}
+
+void GLV::setMouseUp(space_t& x, space_t& y, int button, int clicks){
+ eventType(Event::MouseUp);
+ mouse.updateButton(button, false, clicks);
+}
+
+void GLV::setMouseWheel(int wheelDelta){
+ eventType(Event::MouseWheel);
+ mouse.bufferPos(mouse.mW[0] + (space_t)wheelDelta, mouse.mW);
+}
+
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_inputdevice.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_inputdevice.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,57 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_core.h"
+
+namespace glv{
+
+Keyboard::Keyboard()
+: mKeycode(-1), mIsDown(false)
+{
+ for(int i=0; i<5; ++i) mModifiers[i] = false;
+}
+
+void Keyboard::print(){
+ printf("code:%3d (%c) down:%d a:%d C:%d c:%d m:%d s:%d\n",
+ key(), key(), isDown(), alt(), caps(), ctrl(), meta(), shift());
+}
+
+
+
+Mouse::Mouse()
+: mXRel(0), mYRel(0), mButton(0), mClicks(0), mIsDown(false)
+{
+ mX[0] = mX[1] = mX[2] = mY[0] = mY[1] = mY[2] = mW[0] = mW[1] = mW[2] = 0;
+
+ for (int i=0; i<GLV_MAX_MOUSE_BUTTONS; i++){
+ b[i] = false;
+ bx[i] = by[i] = 0;
+ }
+}
+
+void Mouse :: print(){
+ printf("abspos: [%i, %i]\n", (int)x(), (int)y());
+ printf("relpos: [%f, %f]\n", (float)xRel(), (float)yRel());
+ printf("dpos: [%i, %i]\n", (int)dx(), (int)dy());
+ printf("ddpos: [%i, %i]\n", (int)ddx(), (int)ddy());
+ printf("button: ");
+ for(int i=0; i<GLV_MAX_MOUSE_BUTTONS; i++){
+ printf(b[i] ? "|" : ".");
+ }
+ for(int i=0; i<GLV_MAX_MOUSE_BUTTONS; i++){
+ printf("\nbpos%i: [%i, %i]", i, (int)bx[i], (int)by[i]);
+ }
+ printf("\n\n");
+}
+
+void Mouse::updateButton(int btn, bool pressed, int clicks){
+ if(btn >= 0 && btn < GLV_MAX_MOUSE_BUTTONS) {
+ mButton = btn;
+ mClicks = clicks;
+ mIsDown = b[mButton] = pressed;
+ bx[mButton] = mX[0];
+ by[mButton] = mY[0];
+ }
+}
+
+} // end namespace glv
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_layout.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_layout.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,136 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_layout.h"
+
+namespace glv{
+
+
+Placer::Placer(space_t absX, space_t absY)
+: x(absX), y(absY), rx(0), ry(0), ax(0), ay(0), fw(0), fh(0), mAnchor((Place::t)0), parent(0)
+{}
+
+Placer::Placer(View& parent, Direction dir, Place::t ali, space_t x, space_t y, space_t pad)
+: x(x), y(y), rx(1), ry(1), mAnchor((Place::t)0), parent(&parent)
+{
+ flow(dir, pad);
+ align(ali);
+}
+
+Placer& Placer::operator<< (View& v){
+ v.Rect::pos(x - v.w * fw, y - v.h * fh);
+
+ x += rx * v.w + ax;
+ y += ry * v.h + ay;
+
+ if(mAnchor) v.anchor(mAnchor);
+ if(parent) (*parent) << v;
+ return *this;
+}
+
+Placer& Placer::abs(space_t vx, space_t vy){ ax=vx; ay=vy; return *this; }
+
+Placer& Placer::align(space_t vx, space_t vy){ fw=vx; fh=vy; return *this; }
+
+Placer& Placer::align(Place::t p){
+ switch(p){
+ case Place::TL: return align(0.0, 0.0);
+ case Place::TC: return align(0.5, 0.0);
+ case Place::TR: return align(1.0, 0.0);
+ case Place::CL: return align(0.0, 0.5);
+ case Place::CC: return align(0.5, 0.5);
+ case Place::CR: return align(1.0, 0.5);
+ case Place::BL: return align(0.0, 1.0);
+ case Place::BC: return align(0.5, 1.0);
+ case Place::BR: return align(1.0, 1.0);
+ default: return *this;
+ }
+}
+
+Placer& Placer::anchor(Place::t p){ mAnchor = p; return *this; }
+
+Placer& Placer::flow(Direction d){
+ ax < 0 ? ax = -ax : 0;
+ ay < 0 ? ay = -ay : 0;
+ rx < 0 ? rx = -rx : 0;
+ ry < 0 ? ry = -ry : 0;
+ return flow(d, ax > ay ? ax : ay, rx > ry ? rx : ry);
+}
+
+Placer& Placer::flow(Direction d, space_t va, space_t vr){
+ switch(d){
+ case Direction::S: return abs( 0, va).rel( 0, vr);
+ case Direction::E: return abs( va, 0).rel( vr, 0);
+ case Direction::N: return abs( 0,-va).rel( 0,-vr);
+ case Direction::W: return abs(-va, 0).rel(-vr, 0);
+ default: return *this;
+ }
+}
+
+Placer& Placer::pos(space_t vx, space_t vy){ x=vx; y=vy; return *this; }
+Placer& Placer::posX(space_t v){ x=v; return *this; }
+Placer& Placer::posY(space_t v){ y=v; return *this; }
+Placer& Placer::rel(space_t vx, space_t vy){ rx=vx; ry=vy; return *this; }
+
+
+
+
+LayoutFunc::LayoutFunc(space_t w, space_t h, const Rect& bounds)
+: elem(0,0,w,h), bounds(bounds), parent(0)
+{}
+
+LayoutFunc::~LayoutFunc()
+{}
+
+void LayoutFunc::layoutChildren(View& pv){
+ View * cv = pv.child;
+ while(cv){
+ cv->set((*this)());
+ cv = cv->sibling;
+ }
+}
+
+
+
+LayoutGrid::LayoutGrid(space_t w, space_t h, const Rect& b, int numV, int numH)
+: LayoutFunc(w,h, b), numV(numV), numH(numH), cntV(0), cntH(0)
+{}
+
+LayoutGrid::LayoutGrid(space_t pad, const Rect& b, int numV, int numH)
+: LayoutFunc((b.w - pad)/numH - pad, (b.h - pad)/numV - pad, b),
+ numV(numV), numH(numH), cntV(0), cntH(0)
+{
+ bounds.l += pad;
+ bounds.t += pad;
+ bounds.w -= pad;
+ bounds.h -= pad;
+}
+
+LayoutGrid::LayoutGrid(View& p, int numH, int numV, space_t pad)
+: LayoutFunc((p.w - pad)/numH - pad, (p.h - pad)/numV - pad, Rect(p.w, p.h)),
+ numV(numV), numH(numH), cntV(0), cntH(0)
+{
+ bounds.l += pad;
+ bounds.t += pad;
+ bounds.w -= pad;
+ bounds.h -= pad;
+ parent = &p;
+}
+
+LayoutGrid::~LayoutGrid()
+{}
+
+Rect& LayoutGrid::operator()(){
+
+ elem.l = cntH/(float)numH * bounds.w + bounds.l;
+ elem.t = cntV/(float)numV * bounds.h + bounds.t;
+
+ if(++cntH == numH){
+ cntH=0;
+ if(++cntV == numV) cntV=0;
+ }
+
+ return elem;
+}
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_sliders.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,237 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_sliders.h"
+#include "glv_draw.h"
+
+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)
+: SliderBase<2>(r), knobSize(knobSize)
+{
+ value(valX, 0);
+ value(valY, 1);
+}
+
+bool Slider2D::onEvent(Event::t e, GLV& g){
+
+ switch(e){
+ case Event::MouseDrag:
+ valueAdd( g.mouse.dx()/w * sens(g), 0);
+ valueAdd(-g.mouse.dy()/h * sens(g), 1);
+ notify();
+ break;
+
+ case Event::MouseDown:
+ if(g.mouse.left() && !g.mouse.right()){
+ value( g.mouse.xRel() / w, 0);
+ value(1.f - g.mouse.yRel() / h, 1);
+ }
+ notify();
+ break;
+
+ case Event::MouseUp: clipAccs(); break;
+
+ case Event::KeyDown:
+ switch(g.keyboard.key()){
+ case Key::Left: valueAdd(-1. / w, 0); notify(); break;
+ case Key::Right: valueAdd( 1. / w, 0); notify(); break;
+ case Key::Up: valueAdd( 1. / h, 1); notify(); break;
+ case Key::Down: valueAdd(-1. / h, 1); notify(); break;
+ default: return true;
+ }
+ break;
+ default: break;
+ }
+ return false;
+}
+
+
+void Slider2D::drawKnob(const Slider2D& s){
+ using namespace glv::draw;
+ float sz = s.knobSize; // size of indicator block
+ float sz2 = sz * 0.5f;
+ float posX = sz2 + (s.w - sz) * s.value(0);
+ float posY = sz2 + (s.h - sz) * (1.f - s.value(1));
+
+ color(s.colors().fore);
+ rect(pix(posX - sz2), pix(posY - sz2), pix(posX + sz2), pix(posY + sz2));
+}
+
+/*
+static void drawQuad(const Slider2D& s){
+ using namespace glv::draw;
+ float posX = s.w * s.value(0);
+ float posY = s.h * (1.f - s.value(1));
+
+ color(s.colors().fore);
+
+ begin(Quads);
+ vertex(0.f, posY);
+ vertex(posX, s.h);
+ vertex(s.w, posY);
+ vertex(posX, 0.f);
+ end();
+
+ // clock hand
+ //shape(Lines, posX, posY, s.w*0.5, s.h*0.5);
+}
+*/
+
+void Slider2D::onDraw(){
+
+ drawKnob(*this);
+ //drawQuad(*this);
+
+// float hh = h * 0.5f;
+// float hw = w * 0.5f;
+
+ // Web
+// glBegin(GL_LINES);
+// glVertex2f(posX, posY); glVertex2f(hw, h);
+// glVertex2f(posX, posY); glVertex2f(w, hh);
+// glVertex2f(posX, posY); glVertex2f(hw, 0.f);
+// glVertex2f(posX, posY); glVertex2f(0.f, hh);
+//
+// glVertex2f(posX, posY); glVertex2f(0.f, h);
+// glVertex2f(posX, posY); glVertex2f(w, h);
+// glVertex2f(posX, posY); glVertex2f(w, 0.f);
+// glVertex2f(posX, posY); glVertex2f(0.f, 0.f);
+//
+//// glVertex2f(0.f, posY); glVertex2f(w, posY);
+//// glVertex2f(posX, 0.f); glVertex2f(posX, h);
+// glEnd();
+
+ //glColor4f(glvColor4(bgColor));
+ //glRectf(posX, h, posX+1, 0.f);
+ //glRectf(0.f, posY, w, posY+1);
+
+// if((posX > 6.f) && (posY < (h - 6.f))) return;
+
+ // fade color in
+ //s->sliderColor->glColor3(1.f - ((posX < h - posY) ? posX : h - posY) * 0.16667f);
+
+ // double diagonal indicators
+// glBegin(GL_LINES);
+// glVertex2f(posX, posY); glVertex2f(w, hh);
+// glVertex2f(posX, posY); glVertex2f(hw, 0.f);
+// glEnd();
+
+ // x
+// glBegin(GL_LINES);
+// float d = 6.f;
+// glVertex2f(posX - d, posY - d);
+// glVertex2f(posX + d, posY + d);
+// glVertex2f(posX, posY);
+// glVertex2f(posX + d, posY - d);
+// glEnd();
+
+ // overline
+// glBegin(GL_LINES);
+// float d = 6.f;
+// glVertex2f(0.f, h - d);
+// glVertex2f(posX, h - d);
+// glVertex2f(d, h);
+// glVertex2f(d, posY);
+// glEnd();
+}
+
+
+
+
+
+} // end namespace glv
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_texture.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,29 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_texture.h"
+
+namespace glv{
+
+Texture2D::Texture2D(GLsizei width, GLsizei height, bool doesLoad)
+ : mID(0), w(width), h(height)
+{
+ if(doesLoad) load(w, h);
+}
+
+Texture2D::~Texture2D(){
+ glDeleteTextures(1, &mID);
+}
+
+void Texture2D::load(GLsizei width, GLsizei height, const GLvoid * pixels){
+ w = width;
+ h = height;
+ 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);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+}
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_textview.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,67 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include <string>
+#include <string.h>
+#include "glv_textview.h"
+
+namespace glv{
+
+#define CTOR_LIST mSize(1), mVertical(false)
+
+#define CTOR_BODY\
+ disable(CropSelf | DrawBack | DrawBorder | HitTest);\
+ label(str);\
+ vertical(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)
+: View(l,t,0,0), CTOR_LIST
+{ CTOR_BODY }
+
+#undef CTOR_LIST
+#undef CTOR_BODY
+
+Label& Label::label(const std::string& s){ mLabel = s; fitExtent(); return *this; }
+Label& Label::size(float pixels){ mSize = pixels/8.; fitExtent(); return *this; }
+
+Label& Label::vertical(bool v){
+ if(v != mVertical){
+ rotateRect();
+ mVertical = v;
+ }
+ return *this;
+}
+
+void Label::onDraw(){
+ using namespace glv::draw;
+ lineWidth(1);
+ color(colors().text);
+ if(mVertical){ translate(0,h); rotate(0,0,-90); }
+ scale(mSize, mSize);
+ text(mLabel.c_str());
+}
+
+
+void Label::fitExtent(){
+ space_t tw = 0, th = 8, mw = 0;
+ const char * c = mLabel.c_str();
+
+ while(*c){
+ switch(*c++){
+ case '\n': th += 16; tw = 0; break;
+ case '\t': tw = ((int)(tw/32) + 1) * 32; if(tw > mw) mw=tw; break;
+ default: tw += 8; if(tw > mw) mw=tw;
+ }
+ }
+ extent(mw*mSize, th*mSize);
+ if(mVertical) rotateRect();
+}
+
+void Label::rotateRect(){ t += w - h; transpose(); }
+
+
+} // glv::
Added: sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/glv/src/glv_view.cpp 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -0,0 +1,344 @@
+/* Graphics Library of Views (GLV) - GUI Building Toolkit
+ See COPYRIGHT file for authors and license information */
+
+#include "glv_core.h"
+
+namespace glv{
+
+#define VIEW_INIT\
+ 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)
+
+View::View(space_t left, space_t top, space_t width, space_t height, drawCallback cb)
+: Rect(left, top, width, height), VIEW_INIT
+{}
+
+View::View(const Rect& rect, Place::t anch, drawCallback cb)
+: Rect(rect), VIEW_INIT
+{
+ anchor(anch);
+}
+
+#undef VIEW_INIT
+
+
+View::~View(){
+
+ // If you get a double-free warning, it's probably because you set a
+ // pointer to the address of statically allocated data.
+ mStyle->smartDelete();
+
+ // remove myself from the view hierarchy
+ if (parent) remove();
+
+ // TODO: make sure this isn't causing a space leak
+ if (child) {
+ // delete children
+ while (child->sibling)
+ {
+ // note that delete View also calls remove() automatically
+ delete child->sibling;
+ }
+
+ delete child;
+ }
+}
+
+// Add a child view to myself
+void View::add(View& newchild)
+{
+
+ View * op = newchild.parent;
+
+ // This is problematic when the child does not have a parent
+ newchild.reanchor(op ? w-op->w : w, op ? h-op->h : h);
+ //if(op) newchild.reanchor(w - op->w, h - op->h);
+
+ newchild.parent = this;
+ newchild.sibling = 0;
+
+ //newchild.constrainWithinParent(); // keep within the bounds of the parent's rect
+
+ if (child == 0) // I didn't have any children until now
+ {
+ child = &newchild;
+ } else {
+ // I have children already... so go to the end and add there
+ // default behaviour is to add at the end of the list, to be drawn last
+ View * lastChild = child;
+ while (lastChild->sibling != 0) lastChild = lastChild->sibling;
+ lastChild->sibling = &newchild;
+ }
+}
+
+void View::remove()
+{
+ // note that this doesn't delete the view, it just removes it from the hierarchy
+ if (parent && parent->child) // sanity check: don't try to remove a window or an unattached view
+ {
+ if (parent->child == this)
+ {
+ // I'm my parent's first child
+ // - remove my reference, but keep the sibling list healthy
+ parent->child = sibling;
+
+ } else {
+ // I must be one of parent->child's siblings
+ View * temp = parent->child;
+ while (temp->sibling)
+ {
+ if (temp->sibling == this) {
+ // I'm temp's sibling
+ // - remove my reference, keep the sibling list healthy
+ temp->sibling = this->sibling;
+ break;
+ }
+ temp = temp->sibling;
+ }
+ }
+ }
+
+ // keep a reference to this 'lost' view in the removedViews list
+// View::removedViews.push_back(this);
+}
+
+
+void View::makeLastSibling(){
+ if(parent && sibling){
+ View * p = parent;
+ remove();
+ p->add(*this);
+ }
+}
+
+
+// Compute translation from this View to target's parent
+// We do this by traversing the tree upwards and accumulating positions.
+bool View::absToRel(View * v, space_t & x, space_t & y) const{
+
+ v = v ? v->parent : 0; // go up one View
+ space_t dx = 0, dy = 0;
+
+ while(v){
+ if(v == this){ // found target's top parent
+ x -= dx; y -= dy;
+ return true;
+ }
+ dx += v->l; dy += v->t; // accum relative offsets
+ v = v->parent;
+ }
+ return false;
+}
+
+
+View& View::anchor(space_t mx, space_t my){
+ mAnchorX = mx; mAnchorY = my; return *this;
+}
+
+
+View& View::anchor(Place::t p){
+ #define CS(p,x,y) case Place::p: anchor(x,y); break;
+ switch(p){
+ CS(TL, 0, 0 ) CS(TC, 0.5, 0 ) CS(TR, 1, 0)
+ CS(CL, 0, 0.5) CS(CC, 0.5, 0.5) CS(CR, 1, 0.5)
+ CS(BL, 0, 1 ) CS(BC, 0.5, 1 ) CS(BR, 1, 1)
+ }
+ #undef CS
+ return *this;
+}
+
+
+void View::appendCallback(Event::t e, eventCallback cb){
+ callbackLists[e].push_back(cb);
+}
+
+
+void View::cloneStyle(){
+ if(mStyle){
+ style(new Style(*mStyle));
+ mStyle->deletable(true);
+ }
+ else{
+ mStyle = new Style(true);
+ }
+}
+
+
+StyleColor& View::colors() const { return style().color; }
+
+
+void View::constrainWithinParent(){
+ if (parent) {
+ // LJP: maybe this is too restrictive for top level children?
+// l = l < 0 ? 0 : l > (parent->w - w) ? (parent->w - w) : l;
+// t = t < 0 ? 0 : t > (parent->h - h) ? (parent->h - h) : t;
+
+ space_t d = w < 20 ? w : 20; // allow this many pixels to remain on a side
+ l = l < d - w ? d - w : l > parent->w - d ? parent->w - d : l;
+
+ d = h < 20 ? h : 20;
+ t = t < d - h ? d - h : t > parent->h - d ? parent->h - d : t;
+ }
+}
+
+
+void View::drawBack() const{
+ using namespace glv::draw;
+
+ if(enabled(DrawBack)){
+ color(colors().back);
+ rect(0, 0, pix(w), pix(h));
+ }
+}
+
+
+void View::drawBorder() const{
+ using namespace glv::draw;
+
+ if(enabled(DrawBorder)){
+ float borderWidth = 1.0;
+ //draw::color((mFocused && focusHighlight) ? colors().fore : colors().border);
+
+ if(mFocused && enabled(FocusHighlight)){
+ HSV hsv(colors().border);
+ hsv.v > 0.5 ? hsv.v -= 0.2 : hsv.v += 0.2;
+ color(Color(hsv));
+ }
+ else{
+ color(colors().border);
+ }
+ lineWidth(borderWidth);
+ frame(0, 0, pix(w), pix(h));
+ }
+}
+
+
+// This returns the last child and sibling View containing point.
+View * View::findTarget(space_t &x, space_t &y){
+
+ // start search from current focus (if it contains x,y) or top level window
+ View * n = this; // node for walking tree
+ View * target = this; // our hit
+
+ space_t rx = x, ry = y;
+
+ while(n->child){
+
+ // target may be the child or one of its siblings
+ View * sib = n->child;
+ View * match = 0;
+
+ // Iterate through siblings
+ while(sib){
+ if(sib->containsPoint(x,y) && sib->visible()) match = sib;
+ sib = sib->sibling;
+ }
+
+ // we found a sibling target; update the relative x & y & run the main while() again
+ if(match){
+ n = match;
+ rx -= n->l; ry -= n->t; // compute relative coords
+
+ if(match->enabled(HitTest)){
+ target = match;
+ x = rx; y = ry; // relativize x&y to new context
+ }
+ }
+ else{
+ // if we reached the end of the sibling chain, end the target search
+ break;
+ }
+ }
+
+ return target;
+}
+
+
+void View::focused(bool b){
+ mFocused = b;
+ if(b) makeLastSibling(); // move to end of chain, so drawn last
+ notify();
+}
+
+
+void View::move(space_t x, space_t y){
+ posAdd(x, y);
+ constrainWithinParent();
+}
+
+
+int View::numEventCallbacks(Event::t e) const{
+ const std::map<Event::t, eventCallbackList>::const_iterator it = callbackLists.find(e);
+ return it != callbackLists.end() ? it->second.size() : 0;
+}
+
+
+void View::on(Event::t e, eventCallback cb){
+ if(!callbackLists[e].empty())
+ callbackLists[e].pop_front();
+
+ callbackLists[e].push_front(cb);
+}
+
+
+void View::onDraw(){ if(draw) draw(this); }
+
+bool View::onEvent(Event::t e, GLV& glv){ return false; }
+
+
+void View::onResize(space_t dx, space_t dy){
+
+ // move anchored children
+ View * v = child;
+ while(v){
+ v->reanchor(dx, dy);
+ v = v->sibling;
+ }
+}
+
+
+View& View::pos(Place::t p, space_t x, space_t y){
+ 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;
+ }
+
+ return *this;
+}
+
+
+void View::printFlags() const{
+ //printf("\n%p: (%x)\n", this, mFlags);
+ #define DO(flag) printf("%d: %s\n", enabled(flag) != 0, #flag);
+ DO(Visible) DO(DrawBack) DO(DrawBorder) DO(CropChildren)
+ DO(CropSelf) DO(FocusHighlight) DO(HitTest)
+ #undef DO
+}
+
+
+void View::reanchor(space_t dx, space_t dy){
+ posAdd(dx * mAnchorX, dy * mAnchorY);
+ extent(w + dx * mStretchX, h + dy * mStretchY);
+}
+
+
+void View::style(Style * style){
+ mStyle->smartDelete();
+ mStyle = style;
+}
+
+
+} // glv::
Modified: sandbox/SOC/2007/signals/project-root.jam
==============================================================================
--- sandbox/SOC/2007/signals/project-root.jam (original)
+++ sandbox/SOC/2007/signals/project-root.jam 2008-07-13 14:18:56 EDT (Sun, 13 Jul 2008)
@@ -6,3 +6,4 @@
import os ;
path-constant BOOST_ROOT : [ os.environ BOOST_ROOT ] ;
+path-constant TOP : . ;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk