summaryrefslogtreecommitdiffstats
path: root/src/Gui
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2008-04-15 12:26:05 +0200
committerneoraider <devnull@localhost>2008-04-15 12:26:05 +0200
commit7c929e6e1ce1f43d16d0d279af1e1261b5c566b7 (patch)
tree0ec7d7e4e9af10ff50d1e87f47b02889029f7610 /src/Gui
parent85e58bd658d3b572ed598e0460965d7827f4e901 (diff)
downloadzoomedit-7c929e6e1ce1f43d16d0d279af1e1261b5c566b7.tar
zoomedit-7c929e6e1ce1f43d16d0d279af1e1261b5c566b7.zip
zoomedit:
* Moved grid drawing code to TopView
Diffstat (limited to 'src/Gui')
-rw-r--r--src/Gui/RenderArea.cpp38
-rw-r--r--src/Gui/RenderArea.h29
2 files changed, 17 insertions, 50 deletions
diff --git a/src/Gui/RenderArea.cpp b/src/Gui/RenderArea.cpp
index 7aa2745..6b6b8ed 100644
--- a/src/Gui/RenderArea.cpp
+++ b/src/Gui/RenderArea.cpp
@@ -102,10 +102,8 @@ bool RenderArea::onExposeEvent(GdkEventExpose*) {
glScalef(scale, scale, 1);
glTranslatef(-xCenter, -yCenter, 0);
- drawGrid();
-
if(view)
- view->render();
+ view->render(this);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
@@ -219,39 +217,5 @@ void RenderArea::updateScrolling() {
queue_draw();
}
-void RenderArea::drawGrid() {
- float depth = 1.25f + 0.04f*zoomLevel;
- float depth2 = std::floor(depth);
- float step = std::pow(0.1f, depth2);
- float f;
- int i;
- float x1 = xCenter-getViewWidth()/2, y1 = yCenter-getViewHeight()/2;
- float x2 = xCenter+getViewWidth()/2, y2 = yCenter+getViewHeight()/2;
-
-
- glLineWidth(1.0f);
-
- glBegin(GL_LINES);
-
- for(i = 0; 0.4f*(depth-depth2+i-1) < 0.5f; i++) {
- f = std::min(0.4f*(depth-depth2+i), 0.5f);
- glColor3f(f, f, f);
-
- for(f = x1 - std::fmod(x1, step); f <= x2; f+=step) {
- glVertex2f(f, y1);
- glVertex2f(f, y2);
- }
-
- for(f = y1 - std::fmod(y1, step); f <= y2; f+=step) {
- glVertex2f(x1, f);
- glVertex2f(x2, f);
- }
-
- step *= 10;
- }
-
- glEnd();
-}
-
}
}
diff --git a/src/Gui/RenderArea.h b/src/Gui/RenderArea.h
index 123c50f..c47c56d 100644
--- a/src/Gui/RenderArea.h
+++ b/src/Gui/RenderArea.h
@@ -43,6 +43,22 @@ class RenderArea : public Gtk::DrawingArea {
queue_draw();
}
+ float getViewWidth() const {
+ return get_width()/scale;
+ }
+
+ float getViewHeight() const {
+ return get_height()/scale;
+ }
+
+ float getImageWidth() const {return 10;}
+ float getImageHeight() const {return 10;}
+
+ float getScale() const {return scale;}
+
+ float getXCenter() const {return xCenter;}
+ float getYCenter() const {return yCenter;}
+
private:
static GdkGLConfig *glconfig;
@@ -67,19 +83,6 @@ class RenderArea : public Gtk::DrawingArea {
void updateScrollbars(float x = 0.5f, float y = 0.5f);
void updateScrolling();
- void drawGrid();
-
- float getViewWidth() const {
- return get_width()/scale;
- }
-
- float getViewHeight() const {
- return get_height()/scale;
- }
-
- float getImageWidth() const {return 10;}
- float getImageHeight() const {return 10;}
-
bool gdkGLBegin() {
GtkWidget *widget = GTK_WIDGET(gobj());