diff options
| -rw-r--r-- | glview.cc | 15 | ||||
| -rw-r--r-- | mainwin.cc | 63 | ||||
| -rw-r--r-- | openscad.h | 10 | 
3 files changed, 81 insertions, 7 deletions
| @@ -212,6 +212,20 @@ void GLView::paintGL()  		renderfunc(renderfunc_vp);  } +void GLView::keyPressEvent(QKeyEvent *event) +{ +	if (event->key() == Qt::Key_Plus) { +		viewer_distance *= 0.9; +		updateGL(); +		return; +	} +	if (event->key() == Qt::Key_Minus) { +		viewer_distance /= 0.9; +		updateGL(); +		return; +	} +} +  void GLView::wheelEvent(QWheelEvent *event)  {  	viewer_distance *= pow(0.9, event->delta() / 120.0); @@ -224,6 +238,7 @@ void GLView::mousePressEvent(QMouseEvent *event)  	last_mouse_x = event->globalX();  	last_mouse_y = event->globalY();  	grabMouse(); +	setFocus();  }  void GLView::mouseMoveEvent(QMouseEvent *event) @@ -165,13 +165,13 @@ MainWindow::MainWindow(const char *filename)  		actViewModeAnimate->setCheckable(true);  		menu->addSeparator(); -		menu->addAction("Top"); -		menu->addAction("Bottom"); -		menu->addAction("Left"); -		menu->addAction("Right"); -		menu->addAction("Front"); -		menu->addAction("Back"); -		menu->addAction("Diagonal"); +		menu->addAction("Top", this, SLOT(viewAngleTop())); +		menu->addAction("Bottom", this, SLOT(viewAngleBottom())); +		menu->addAction("Left", this, SLOT(viewAngleLeft())); +		menu->addAction("Right", this, SLOT(viewAngleRight())); +		menu->addAction("Front", this, SLOT(viewAngleFront())); +		menu->addAction("Back", this, SLOT(viewAngleBack())); +		menu->addAction("Diagonal", this, SLOT(viewAngleDiagonal()));  		menu->addSeparator();  		menu->addAction("Perspective");  		menu->addAction("Orthogonal"); @@ -1124,3 +1124,52 @@ void MainWindow::viewModeAnimate()  	}  } +void MainWindow::viewAngleTop() +{ +	screen->object_rot_y = 90; +	screen->object_rot_z = 0; +	screen->updateGL(); +} + +void MainWindow::viewAngleBottom() +{ +	screen->object_rot_y = 270; +	screen->object_rot_z = 0; +	screen->updateGL(); +} + +void MainWindow::viewAngleLeft() +{ +	screen->object_rot_y = 0; +	screen->object_rot_z = 90; +	screen->updateGL(); +} + +void MainWindow::viewAngleRight() +{ +	screen->object_rot_y = 0; +	screen->object_rot_z = 270; +	screen->updateGL(); +} + +void MainWindow::viewAngleFront() +{ +	screen->object_rot_y = 0; +	screen->object_rot_z = 0; +	screen->updateGL(); +} + +void MainWindow::viewAngleBack() +{ +	screen->object_rot_y = 0; +	screen->object_rot_z = 180; +	screen->updateGL(); +} + +void MainWindow::viewAngleDiagonal() +{ +	screen->object_rot_y = 35; +	screen->object_rot_z = 25; +	screen->updateGL(); +} + @@ -658,6 +658,7 @@ protected:  	int last_mouse_x;  	int last_mouse_y; +	void keyPressEvent(QKeyEvent *event);  	void wheelEvent(QWheelEvent *event);  	void mousePressEvent(QMouseEvent *event);  	void mouseMoveEvent(QMouseEvent *event); @@ -763,6 +764,15 @@ private slots:  	void viewModeThrownTogether();  	void viewModeShowEdges();  	void viewModeAnimate(); + +private slots: +	void viewAngleTop(); +	void viewAngleBottom(); +	void viewAngleLeft(); +	void viewAngleRight(); +	void viewAngleFront(); +	void viewAngleBack(); +	void viewAngleDiagonal();  };  extern AbstractModule *parse(const char *text, int debug); | 
