|
From: <br...@us...> - 2009-04-05 01:07:43
|
Revision: 3882
http://openvrml.svn.sourceforge.net/openvrml/?rev=3882&view=rev
Author: braden
Date: 2009-04-05 01:07:30 +0000 (Sun, 05 Apr 2009)
Log Message:
-----------
Apply the nonvirtual interface pattern to openvrml::gl::viewer's pure virtual functions.
Modified Paths:
--------------
trunk/ChangeLog
trunk/examples/sdl_viewer.cpp
trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp
trunk/src/libopenvrml-gl/openvrml/gl/viewer.h
trunk/src/openvrml-xembed/browser.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-04-03 07:15:23 UTC (rev 3881)
+++ trunk/ChangeLog 2009-04-05 01:07:30 UTC (rev 3882)
@@ -1,3 +1,35 @@
+2009-04-04 Braden McDaniel <br...@en...>
+
+ Apply the nonvirtual interface pattern to openvrml::gl::viewer's
+ pure virtual functions.
+
+ * examples/sdl_viewer.cpp (sdl_viewer): Override do_post_redraw,
+ do_set_cursor, do_swap_buffers, and do_set_timer.
+ * src/libopenvrml-gl/openvrml/gl/viewer.cpp
+ (openvrml::gl::viewer::post_redraw()): Delegate to do_post_redraw.
+ (openvrml::gl::viewer::do_post_redraw()): Moved the logic that was
+ in post_redraw to here.
+ (openvrml::gl::viewer::set_cursor(cursor_style)): Delegate to
+ do_set_cursor.
+ (openvrml::gl::viewer::do_set_cursor(cursor_style)): Moved the
+ logic that was in set_cursor to here.
+ (openvrml::gl::viewer::swap_buffers()): Delegate to
+ do_swap_buffers.
+ (openvrml::gl::viewer::do_swap_buffers()): Moved the logic that
+ was in swap_buffers to here.
+ (openvrml::gl::viewer::set_timer(double)): Delegate to
+ do_set_timer.
+ (openvrml::gl::viewer::do_set_timer(double)): Moved the logic that
+ was in set_timer to here.
+ * src/libopenvrml-gl/openvrml/gl/viewer.h
+ (openvrml::gl::viewer): Made post_redraw, set_cursor,
+ swap_buffers, and set_timer nonvirtual (and protected); added
+ private virtual functions do_post_redraw, do_set_cursor,
+ do_swap_buffers, and do_set_timer.
+ * src/openvrml-xembed/browser.cpp
+ (GtkGLViewer): Override do_post_redraw, do_set_cursor,
+ do_swap_buffers, and do_set_timer.
+
2009-04-03 Braden McDaniel <br...@en...>
Get rid of the last vestiges of openvrml::viewer::object_t.
Modified: trunk/examples/sdl_viewer.cpp
===================================================================
--- trunk/examples/sdl_viewer.cpp 2009-04-03 07:15:23 UTC (rev 3881)
+++ trunk/examples/sdl_viewer.cpp 2009-04-05 01:07:30 UTC (rev 3882)
@@ -70,10 +70,10 @@
//
// Window system specific methods
//
- virtual void post_redraw();
- virtual void set_cursor(cursor_style c);
- virtual void swap_buffers();
- virtual void set_timer(double);
+ virtual void do_post_redraw();
+ virtual void do_set_cursor(cursor_style c);
+ virtual void do_swap_buffers();
+ virtual void do_set_timer(double);
};
}
@@ -384,7 +384,7 @@
} while (!done);
}
- void sdl_viewer::post_redraw()
+ void sdl_viewer::do_post_redraw()
{
SDL_Event redraw_event;
redraw_event.type = SDL_USEREVENT;
@@ -394,10 +394,10 @@
SDL_PushEvent(&redraw_event);
}
- void sdl_viewer::set_cursor(cursor_style)
+ void sdl_viewer::do_set_cursor(cursor_style)
{}
- void sdl_viewer::swap_buffers()
+ void sdl_viewer::do_swap_buffers()
{
SDL_GL_SwapBuffers();
}
@@ -416,7 +416,7 @@
return 0;
}
- void sdl_viewer::set_timer(const double t)
+ void sdl_viewer::do_set_timer(const double t)
{
if (!this->update_timer_id) {
const Uint32 interval = Uint32(1000.0 * t + 20); // milliseconds.
Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp
===================================================================
--- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-03 07:15:23 UTC (rev 3881)
+++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2009-04-05 01:07:30 UTC (rev 3882)
@@ -4659,30 +4659,68 @@
}
/**
- * @fn void openvrml::gl::viewer::post_redraw()
+ * @brief Called to indicate to the windowing system that a redraw is
+ * necessary.
+ */
+void openvrml::gl::viewer::post_redraw()
+{
+ this->do_post_redraw();
+}
+
+/**
+ * @fn void openvrml::gl::viewer::do_post_redraw()
*
* @brief Called to indicate to the windowing system that a redraw is
* necessary.
*/
/**
- * @fn void openvrml::gl::viewer::set_cursor(cursor_style c)
+ * @brief Called to set the cursor style.
*
+ * @param[in] c cursor style identifier.
+ */
+void openvrml::gl::viewer::set_cursor(const cursor_style c)
+{
+ this->do_set_cursor(c);
+}
+
+/**
+ * @fn void openvrml::gl::viewer::do_set_cursor(cursor_style c)
+ *
* @brief Called to set the cursor style.
*
* @param[in] c cursor style identifier.
*/
/**
- * @fn void openvrml::gl::viewer::swap_buffers()
+ * @brief Called to indicate to the windowing system that the front and back
+ * buffers should be swapped.
+ */
+void openvrml::gl::viewer::swap_buffers()
+{
+ this->do_swap_buffers();
+}
+
+/**
+ * @fn void openvrml::gl::viewer::do_swap_buffers()
*
* @brief Called to indicate to the windowing system that the front and back
* buffers should be swapped.
*/
/**
- * @fn void openvrml::gl::viewer::set_timer(double interval)
+ * @brief Set a delay.
*
+ * @param[in] interval milliseconds to delay.
+ */
+void openvrml::gl::viewer::set_timer(const double interval)
+{
+ this->do_set_timer(interval);
+}
+
+/**
+ * @fn void openvrml::gl::viewer::do_set_timer(double interval)
+ *
* @brief Set a delay.
*
* @param[in] interval milliseconds to delay.
Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.h
===================================================================
--- trunk/src/libopenvrml-gl/openvrml/gl/viewer.h 2009-04-03 07:15:23 UTC (rev 3881)
+++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.h 2009-04-05 01:07:30 UTC (rev 3882)
@@ -163,6 +163,11 @@
// Check for pickable entity selection
bool checkSensitive(int x, int y, event_type event);
+ void post_redraw();
+ void set_cursor(cursor_style c);
+ void swap_buffers();
+ void set_timer(double interval);
+
public:
viewer();
virtual ~viewer() OPENVRML_NOTHROW;
@@ -340,10 +345,10 @@
// Window system specific methods
- virtual void post_redraw() = 0;
- virtual void set_cursor(cursor_style c) = 0;
- virtual void swap_buffers() = 0;
- virtual void set_timer(double interval) = 0;
+ virtual void do_post_redraw() = 0;
+ virtual void do_set_cursor(cursor_style c) = 0;
+ virtual void do_swap_buffers() = 0;
+ virtual void do_set_timer(double interval) = 0;
};
}
}
Modified: trunk/src/openvrml-xembed/browser.cpp
===================================================================
--- trunk/src/openvrml-xembed/browser.cpp 2009-04-03 07:15:23 UTC (rev 3881)
+++ trunk/src/openvrml-xembed/browser.cpp 2009-04-05 01:07:30 UTC (rev 3882)
@@ -617,10 +617,10 @@
//
// Implement pure virtual methods from openvrml::gl::viewer.
//
- virtual void post_redraw();
- virtual void set_cursor(openvrml::gl::viewer::cursor_style);
- virtual void swap_buffers();
- virtual void set_timer(double);
+ virtual void do_post_redraw();
+ virtual void do_set_cursor(openvrml::gl::viewer::cursor_style);
+ virtual void do_swap_buffers();
+ virtual void do_set_timer(double);
};
}
@@ -1121,7 +1121,7 @@
if (this->timer) { g_source_remove(timer); }
}
- void GtkGLViewer::post_redraw()
+ void GtkGLViewer::do_post_redraw()
{
if (!this->browser_plug_.priv->redraw_needed) {
this->browser_plug_.priv->redraw_needed = true;
@@ -1130,7 +1130,7 @@
}
}
- void GtkGLViewer::set_cursor(cursor_style style)
+ void GtkGLViewer::do_set_cursor(cursor_style style)
{
GdkCursor * cursor(0);
@@ -1170,7 +1170,7 @@
gdk_cursor_destroy(cursor);
}
- void GtkGLViewer::swap_buffers()
+ void GtkGLViewer::do_swap_buffers()
{
GdkGLDrawable * const gl_drawable =
gtk_widget_get_gl_drawable(
@@ -1178,7 +1178,7 @@
gdk_gl_drawable_swap_buffers(gl_drawable);
}
- void GtkGLViewer::set_timer(const double t)
+ void GtkGLViewer::do_set_timer(const double t)
{
if (!this->timer) {
this->timer =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|