mirror of https://github.com/vitalif/openscad
Some fixes by Jestin Stoffel
git-svn-id: http://svn.clifford.at/openscad/trunk@566 b57f626f-c46c-0410-a088-ec61d464b74cstl_dim
parent
e2ba9561d5
commit
6a9653b1db
|
@ -215,8 +215,8 @@ void GLView::resizeGL(int w, int h)
|
||||||
|
|
||||||
void GLView::paintGL()
|
void GLView::paintGL()
|
||||||
{
|
{
|
||||||
const QColor &col = Preferences::inst()->color(Preferences::BACKGROUND_COLOR);
|
const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR);
|
||||||
glClearColor(col.redF(), col.greenF(), col.blueF(), 0.0);
|
glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
|
@ -253,6 +253,8 @@ void GLView::paintGL()
|
||||||
glRotated(object_rot_y, 0.0, 1.0, 0.0);
|
glRotated(object_rot_y, 0.0, 1.0, 0.0);
|
||||||
glRotated(object_rot_z, 0.0, 0.0, 1.0);
|
glRotated(object_rot_z, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
// FIXME: Crosshairs and axes are lighted, this doesn't make sense and causes them
|
||||||
|
// to change color based on view orientation.
|
||||||
if (showcrosshairs)
|
if (showcrosshairs)
|
||||||
{
|
{
|
||||||
glLineWidth(3);
|
glLineWidth(3);
|
||||||
|
@ -271,6 +273,7 @@ void GLView::paintGL()
|
||||||
glTranslated(object_trans_x, object_trans_y, object_trans_z);
|
glTranslated(object_trans_x, object_trans_y, object_trans_z);
|
||||||
|
|
||||||
// Large gray axis cross inline with the model
|
// Large gray axis cross inline with the model
|
||||||
|
// FIXME: This is always gray - adjust color to keep contrast with background
|
||||||
if (showaxes)
|
if (showaxes)
|
||||||
{
|
{
|
||||||
glLineWidth(1);
|
glLineWidth(1);
|
||||||
|
@ -296,7 +299,6 @@ void GLView::paintGL()
|
||||||
renderfunc(renderfunc_vp);
|
renderfunc(renderfunc_vp);
|
||||||
|
|
||||||
// Small axis cross in the lower left corner
|
// Small axis cross in the lower left corner
|
||||||
// FIXME: Adjust color to keep contrast with background
|
|
||||||
if (showaxes)
|
if (showaxes)
|
||||||
{
|
{
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
|
@ -354,8 +356,11 @@ void GLView::paintGL()
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
// FIXME: Adjust color to keep contrast with background
|
// FIXME: This was an attempt to keep contrast with background, but is suboptimal
|
||||||
glColor3d(0.0, 0.0, 0.0);
|
// (e.g. nearly invisible against a gray background).
|
||||||
|
int r,g,b;
|
||||||
|
bgcol.getRgb(&r, &g, &b);
|
||||||
|
glColor3d((255.0-r)/255.0, (255.0-g)/255.0, (255.0-b)/255.0);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
// X Label
|
// X Label
|
||||||
glVertex3d(xlabel_x-3, xlabel_y-3, 0); glVertex3d(xlabel_x+3, xlabel_y+3, 0);
|
glVertex3d(xlabel_x-3, xlabel_y-3, 0); glVertex3d(xlabel_x+3, xlabel_y+3, 0);
|
||||||
|
|
|
@ -812,6 +812,9 @@ void MainWindow::actionNew()
|
||||||
#ifdef ENABLE_MDI
|
#ifdef ENABLE_MDI
|
||||||
new MainWindow(QString());
|
new MainWindow(QString());
|
||||||
#else
|
#else
|
||||||
|
if (!maybeSave())
|
||||||
|
return;
|
||||||
|
|
||||||
setFileName("");
|
setFileName("");
|
||||||
editor->setPlainText("");
|
editor->setPlainText("");
|
||||||
#endif
|
#endif
|
||||||
|
@ -819,18 +822,35 @@ void MainWindow::actionNew()
|
||||||
|
|
||||||
void MainWindow::actionOpen()
|
void MainWindow::actionOpen()
|
||||||
{
|
{
|
||||||
setCurrentOutput();
|
|
||||||
QString new_filename = QFileDialog::getOpenFileName(this, "Open File", "", "OpenSCAD Designs (*.scad)");
|
QString new_filename = QFileDialog::getOpenFileName(this, "Open File", "", "OpenSCAD Designs (*.scad)");
|
||||||
if (!new_filename.isEmpty()) openFile(new_filename);
|
#ifdef ENABLE_MDI
|
||||||
clearCurrentOutput();
|
new MainWindow(new_filename);
|
||||||
|
#else
|
||||||
|
if (!new_filename.isEmpty()) {
|
||||||
|
if (!maybeSave())
|
||||||
|
return;
|
||||||
|
|
||||||
|
setCurrentOutput();
|
||||||
|
openFile(new_filename);
|
||||||
|
clearCurrentOutput();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::actionOpenRecent()
|
void MainWindow::actionOpenRecent()
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
|
|
||||||
|
#ifdef ENABLE_MDI
|
||||||
|
new MainWindow(action->data().toString());
|
||||||
|
#else
|
||||||
|
if (!maybeSave())
|
||||||
|
return;
|
||||||
|
|
||||||
if (action) {
|
if (action) {
|
||||||
openFile(action->data().toString());
|
openFile(action->data().toString());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::clearRecentFiles()
|
void MainWindow::clearRecentFiles()
|
||||||
|
@ -1800,8 +1820,7 @@ MainWindow::helpManual()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
FIXME: In SDI mode, this should be called also on New and Open
|
FIXME: In MDI mode, should this be called on both reload functions?
|
||||||
In MDI mode; also call on both reload functions?
|
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
MainWindow::maybeSave()
|
MainWindow::maybeSave()
|
||||||
|
|
Loading…
Reference in New Issue