|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r48693 - in sandbox/guigl: boost/guigl/view boost/guigl/view/impl libs/guigl/build/xcodeide/guigl.xcodeproj libs/guigl/example
From: stipe_at_[hidden]
Date: 2008-09-10 03:11:47
Author: srajko
Date: 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
New Revision: 48693
URL: http://svn.boost.org/trac/boost/changeset/48693
Log:
added navigable class, drag_origin
Added:
sandbox/guigl/boost/guigl/view/impl/navigable.hpp (contents, props changed)
sandbox/guigl/boost/guigl/view/navigable.hpp (contents, props changed)
Text files modified:
sandbox/guigl/boost/guigl/view/draggable.hpp | 6 ++++++
sandbox/guigl/boost/guigl/view/impl/draggable.hpp | 3 +++
sandbox/guigl/boost/guigl/view/impl/three_dimensional.hpp | 5 +----
sandbox/guigl/boost/guigl/view/three_dimensional.hpp | 3 ++-
sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj | 4 ++++
sandbox/guigl/libs/guigl/example/two_spheres.cpp | 6 ++++--
sandbox/guigl/libs/guigl/example/two_spheres.hpp | 11 ++++++-----
7 files changed, 26 insertions(+), 12 deletions(-)
Modified: sandbox/guigl/boost/guigl/view/draggable.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/draggable.hpp (original)
+++ sandbox/guigl/boost/guigl/view/draggable.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -37,6 +37,10 @@
protected:
bool on_event(const event_type &event_info);
+ const position_type &drag_origin() const
+ { return m_drag_origin; }
+ void set_drag_origin(const position_type &origin)
+ { m_drag_origin = origin; }
private:
void draggable_on_drag(const position_type &position)
@@ -45,6 +49,8 @@
}
friend struct detail::draggable_static_visitor<Derived,BaseView>;
+
+ position_type m_drag_origin;
};
}}}
Modified: sandbox/guigl/boost/guigl/view/impl/draggable.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/impl/draggable.hpp (original)
+++ sandbox/guigl/boost/guigl/view/impl/draggable.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -38,7 +38,10 @@
bool operator()(const button_event &event_info) const
{
if(event_info.direction == direction::down)
+ {
+ m_draggable.m_drag_origin = m_draggable.mouse_state().get().position;
m_draggable.draggable_on_drag(m_draggable.mouse_state().get().position);
+ }
return true;
}
Added: sandbox/guigl/boost/guigl/view/impl/navigable.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/view/impl/navigable.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -0,0 +1,45 @@
+/*=================================---------------------------------------------
+ Copyright 2008 Stjepan Rajko
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------===============================*/
+
+#ifndef BOOST__GUIGL__VIEW__IMPL__NAVIGABLE_HPP
+#define BOOST__GUIGL__VIEW__IMPL__NAVIGABLE_HPP
+
+#include <boost/guigl/view/impl/draggable.hpp>
+#include <boost/guigl/window.hpp>
+
+namespace boost { namespace guigl { namespace view {
+
+template<typename BaseView>
+void navigable<BaseView>::draw_prologue()
+{
+ base_type::draw_prologue();
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glRotated(m_angle, 0, 1, 0);
+ glTranslatef(0, 0, -500);
+}
+
+template<typename BaseView>
+void navigable<BaseView>::draw_epilogue()
+{
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ base_type::draw_epilogue();
+}
+
+template<typename BaseView>
+void navigable<BaseView>::draggable_on_drag(const position_type &position)
+{
+ m_angle += position.x - base_type::drag_origin().x;
+ base_type::set_drag_origin(position);
+ guigl::window::redraw(*this);
+}
+
+}}}
+
+#endif // BOOST__GUIGL__VIEW__IMPL__NAVIGABLE_HPP
\ No newline at end of file
Modified: sandbox/guigl/boost/guigl/view/impl/three_dimensional.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/impl/three_dimensional.hpp (original)
+++ sandbox/guigl/boost/guigl/view/impl/three_dimensional.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -19,17 +19,14 @@
inline void three_dimensional<BaseView>::draw_prologue()
{
BaseView::draw_prologue();
+ glMatrixMode(GL_PROJECTION);
glPushMatrix();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
double xy_aspect = BaseView::size().x / BaseView::size().y;
- glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(xy_aspect*-0.5, xy_aspect*0.5, -0.5, 0.5, 0.5, 5000);
-
- glMatrixMode(GL_MODELVIEW);
- glTranslatef(0, 0, -500);
}
template<typename BaseView>
Added: sandbox/guigl/boost/guigl/view/navigable.hpp
==============================================================================
--- (empty file)
+++ sandbox/guigl/boost/guigl/view/navigable.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -0,0 +1,43 @@
+/*=================================---------------------------------------------
+ Copyright 2008 Stjepan Rajko
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------===============================*/
+
+#ifndef BOOST__GUIGL__VIEW__NAVIGABLE_HPP
+#define BOOST__GUIGL__VIEW__NAVIGABLE_HPP
+
+#include <boost/guigl/view/base.hpp>
+#include <boost/guigl/view/draggable.hpp>
+
+namespace boost { namespace guigl { namespace view {
+
+template<typename BaseView=base>
+class navigable : public draggable<navigable<BaseView>, BaseView>
+{
+public:
+ typedef draggable<navigable<BaseView>, BaseView> base_type;
+
+ template<typename ArgumentPack>
+ navigable(const ArgumentPack &args)
+ : base_type(args)
+ , m_angle(0)
+ {}
+
+protected:
+ void draw_prologue();
+ void draw_epilogue();
+
+ void draggable_on_drag(const position_type &position);
+
+ friend class draggable<navigable<BaseView>, BaseView>;
+
+private:
+ double m_angle;
+};
+
+}}}
+
+#endif // BOOST__GUIGL__VIEW__NAVIGABLE_HPP
\ No newline at end of file
Modified: sandbox/guigl/boost/guigl/view/three_dimensional.hpp
==============================================================================
--- sandbox/guigl/boost/guigl/view/three_dimensional.hpp (original)
+++ sandbox/guigl/boost/guigl/view/three_dimensional.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -19,8 +19,9 @@
template<typename BaseView=base>
class three_dimensional : public BaseView
{
- typedef BaseView base_type;
public:
+ typedef BaseView base_type;
+
template<typename ArgumentPack>
three_dimensional(const ArgumentPack &args)
: base_type(args)
Modified: sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj (original)
+++ sandbox/guigl/libs/guigl/build/xcodeide/guigl.xcodeproj/project.pbxproj 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -138,6 +138,8 @@
089E34A60E5BB90900D9AD51 /* typed_keyword.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = typed_keyword.hpp; sourceTree = "<group>"; };
089E34AB0E5C865400D9AD51 /* typed_name.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = typed_name.hpp; sourceTree = "<group>"; };
089E86720E5A80E500DA4902 /* test_parameter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_parameter.cpp; sourceTree = "<group>"; };
+ 08A048C40E77A1B70034FD11 /* navigable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = navigable.hpp; sourceTree = "<group>"; };
+ 08A048CF0E77A2E70034FD11 /* navigable.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = navigable.hpp; sourceTree = "<group>"; };
08A13C090E535040008C8A10 /* field_map.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = field_map.hpp; sourceTree = "<group>"; };
08A77AB30E4F91AA00B8793E /* Jamroot */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Jamroot; path = ../../../../Jamroot; sourceTree = SOURCE_ROOT; };
08A77AB40E4F91AB00B8793E /* LICENSE_1_0.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE_1_0.txt; path = ../../../../LICENSE_1_0.txt; sourceTree = SOURCE_ROOT; };
@@ -214,6 +216,7 @@
081B07930E5FFBEC00EF7F91 /* mouse_tracking.hpp */,
08D0F2550E6712E90026C6DF /* active_colored.hpp */,
08E17F600E76DE81008EAE5E /* three_dimensional.hpp */,
+ 08A048C40E77A1B70034FD11 /* navigable.hpp */,
);
path = view;
sourceTree = "<group>";
@@ -243,6 +246,7 @@
08E225F00E65D5C700C3319B /* mouse_tracking.hpp */,
08D0F25D0E67139E0026C6DF /* active_colored.hpp */,
08E17F660E76E062008EAE5E /* three_dimensional.hpp */,
+ 08A048CF0E77A2E70034FD11 /* navigable.hpp */,
);
path = impl;
sourceTree = "<group>";
Modified: sandbox/guigl/libs/guigl/example/two_spheres.cpp
==============================================================================
--- sandbox/guigl/libs/guigl/example/two_spheres.cpp (original)
+++ sandbox/guigl/libs/guigl/example/two_spheres.cpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -9,6 +9,7 @@
#include "two_spheres.hpp"
#include <boost/guigl/view/impl/colored.hpp>
+#include <boost/guigl/view/impl/navigable.hpp>
#include <boost/guigl/view/impl/positioned.hpp>
#include <boost/guigl/view/impl/solid_background.hpp>
#include <boost/guigl/view/impl/three_dimensional.hpp>
@@ -17,11 +18,12 @@
void two_spheres::draw_prologue()
{
base_type::draw_prologue();
- glPushMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
gluSphere(static_cast<GLUquadric *>(sphere()), 10, 4, 4);
+ glLoadIdentity();
glTranslatef(50,50,50);
gluSphere(static_cast<GLUquadric *>(sphere()), 10, 4, 4);
- glPopMatrix();
}
void two_spheres::draw()
Modified: sandbox/guigl/libs/guigl/example/two_spheres.hpp
==============================================================================
--- sandbox/guigl/libs/guigl/example/two_spheres.hpp (original)
+++ sandbox/guigl/libs/guigl/example/two_spheres.hpp 2008-09-10 03:11:45 EDT (Wed, 10 Sep 2008)
@@ -12,16 +12,17 @@
#include <boost/guigl/view/colored.hpp>
#include <boost/guigl/view/positioned.hpp>
#include <boost/guigl/view/solid_background.hpp>
+#include <boost/guigl/view/navigable.hpp>
#include <boost/guigl/view/three_dimensional.hpp>
typedef
boost::guigl::view::colored<
- boost::guigl::view::three_dimensional<
- boost::guigl::view::solid_background<
- boost::guigl::view::positioned<>
- > > > two_spheres_base_type;
+ boost::guigl::view::navigable<
+ boost::guigl::view::three_dimensional<
+ boost::guigl::view::solid_background<
+ boost::guigl::view::positioned<>
+ > > > > two_spheres_base_type;
-/// A slider storing a floating point value, changable by dragging in the GUI.
class two_spheres : public two_spheres_base_type
{
typedef two_spheres_base_type base_type;
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