summaryrefslogtreecommitdiffstats
path: root/src/Gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gui')
-rw-r--r--src/Gui/RenderArea.cpp8
-rw-r--r--src/Gui/RenderArea.h13
-rw-r--r--src/Gui/Window.h2
3 files changed, 20 insertions, 3 deletions
diff --git a/src/Gui/RenderArea.cpp b/src/Gui/RenderArea.cpp
index 39e1e45..7aa2745 100644
--- a/src/Gui/RenderArea.cpp
+++ b/src/Gui/RenderArea.cpp
@@ -18,6 +18,7 @@
*/
#include "RenderArea.h"
+#include <View/View.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
@@ -31,7 +32,7 @@ namespace Gui {
GdkGLConfig *RenderArea::glconfig = 0;
RenderArea::RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &xml)
-: Gtk::DrawingArea(cobject), xCenter(0), yCenter(0), zoomLevel(0), scale(100) {
+: Gtk::DrawingArea(cobject), view(0), xCenter(0), yCenter(0), zoomLevel(0), scale(100) {
if(!glconfig) {
glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DOUBLE));
if(!glconfig) glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB); // Hmm, can't find double buffered config
@@ -101,12 +102,13 @@ bool RenderArea::onExposeEvent(GdkEventExpose*) {
glScalef(scale, scale, 1);
glTranslatef(-xCenter, -yCenter, 0);
-
drawGrid();
+ if(view)
+ view->render();
+
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
-
gdkSwapBuffers();
gdkGLEnd();
diff --git a/src/Gui/RenderArea.h b/src/Gui/RenderArea.h
index 66a8924..123c50f 100644
--- a/src/Gui/RenderArea.h
+++ b/src/Gui/RenderArea.h
@@ -26,18 +26,31 @@
#include <gtk/gtkgl.h>
namespace ZoomEdit {
+
+namespace View {
+class View;
+}
+
namespace Gui {
class RenderArea : public Gtk::DrawingArea {
public:
RenderArea(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &xml);
+ View::View* getView() const {return view;}
+ void setView(View::View *view0) {
+ view = view0;
+ queue_draw();
+ }
+
private:
static GdkGLConfig *glconfig;
Gtk::HScrollbar *hScrollbar;
Gtk::VScrollbar *vScrollbar;
+ View::View *view;
+
float xCenter, yCenter;
int zoomLevel;
diff --git a/src/Gui/Window.h b/src/Gui/Window.h
index 92369ce..ae22d42 100644
--- a/src/Gui/Window.h
+++ b/src/Gui/Window.h
@@ -35,6 +35,8 @@ class Window : public Gtk::Window {
public:
Window(BaseObjectType *cobject, const Glib::RefPtr<Gnome::Glade::Xml> &xml);
virtual ~Window();
+
+ RenderArea* getRenderArea() const {return renderArea;}
};
}