mirror of https://github.com/vitalif/openscad
Merge pull request #1093 from openscad/warning-highlight
Color code warning and error messages in the console window (fixes #855).master
commit
fa3cba12cc
|
@ -46,7 +46,7 @@ void CGAL_Nef_polyhedron::transform( const Transform3d &matrix )
|
|||
{
|
||||
if (!this->isEmpty()) {
|
||||
if (matrix.matrix().determinant() == 0) {
|
||||
PRINT("Warning: Scaling a 3D object with 0 - removing object");
|
||||
PRINT("WARNING: Scaling a 3D object with 0 - removing object");
|
||||
this->reset();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -101,7 +101,7 @@ FontCache::FontCache()
|
|||
// Just load the configs. We'll build the fonts once all configs are loaded
|
||||
this->config = FcInitLoadConfig();
|
||||
if (!this->config) {
|
||||
PRINT("Can't initialize fontconfig library, text() objects will not be rendered");
|
||||
PRINT("WARNING: Can't initialize fontconfig library, text() objects will not be rendered");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ FontCache::FontCache()
|
|||
|
||||
const FT_Error error = FT_Init_FreeType(&this->library);
|
||||
if (error) {
|
||||
PRINT("Can't initialize freetype library, text() objects will not be rendered");
|
||||
PRINT("WARNING: Can't initialize freetype library, text() objects will not be rendered");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -530,7 +530,7 @@ Response GeometryEvaluator::visit(State &state, const TransformNode &node)
|
|||
if (!isSmartCached(node)) {
|
||||
if (matrix_contains_infinity(node.matrix) || matrix_contains_nan(node.matrix)) {
|
||||
// due to the way parse/eval works we can't currently distinguish between NaN and Inf
|
||||
PRINT("Warning: Transformation matrix contains Not-a-Number and/or Infinity - removing object.");
|
||||
PRINT("WARNING: Transformation matrix contains Not-a-Number and/or Infinity - removing object.");
|
||||
}
|
||||
else {
|
||||
// First union all children
|
||||
|
|
|
@ -59,7 +59,7 @@ bool Polygon2d::isEmpty() const
|
|||
void Polygon2d::transform(const Transform2d &mat)
|
||||
{
|
||||
if (mat.matrix().determinant() == 0) {
|
||||
PRINT("Warning: Scaling a 2D object with 0 - removing object");
|
||||
PRINT("WARNING: Scaling a 2D object with 0 - removing object");
|
||||
this->theoutlines.clear();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ static void export_stl(const CGAL_Polyhedron &P, std::ostream &output)
|
|||
void export_stl(const CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
||||
{
|
||||
if (!root_N->p3->is_simple()) {
|
||||
PRINT("Warning: Exported object may not be a valid 2-manifold and may need repair");
|
||||
PRINT("WARNING: Exported object may not be a valid 2-manifold and may need repair");
|
||||
}
|
||||
|
||||
bool usePolySet = true;
|
||||
|
@ -271,10 +271,10 @@ void export_stl(const CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
|||
export_stl(P, output);
|
||||
}
|
||||
catch (const CGAL::Assertion_exception &e) {
|
||||
PRINTB("CGAL error in CGAL_Nef_polyhedron3::convert_to_Polyhedron(): %s", e.what());
|
||||
PRINTB("ERROR: CGAL error in CGAL_Nef_polyhedron3::convert_to_Polyhedron(): %s", e.what());
|
||||
}
|
||||
catch (...) {
|
||||
PRINT("CGAL unknown error in CGAL_Nef_polyhedron3::convert_to_Polyhedron()");
|
||||
PRINT("ERROR: CGAL unknown error in CGAL_Nef_polyhedron3::convert_to_Polyhedron()");
|
||||
}
|
||||
CGAL::set_error_behaviour(old_behaviour);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ void export_off(const class PolySet &ps, std::ostream &output)
|
|||
void export_off(const CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
||||
{
|
||||
if (!root_N->p3->is_simple()) {
|
||||
PRINT("Object isn't a valid 2-manifold! Modify your design.");
|
||||
PRINT("WARNING: Export failed, the object isn't a valid 2-manifold.");
|
||||
return;
|
||||
}
|
||||
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
|
||||
|
@ -301,7 +301,7 @@ void export_off(const CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
|||
output << P;
|
||||
}
|
||||
catch (const CGAL::Assertion_exception &e) {
|
||||
PRINTB("CGAL error in CGAL_Nef_polyhedron3::convert_to_Polyhedron(): %s", e.what());
|
||||
PRINTB("ERROR: CGAL error in CGAL_Nef_polyhedron3::convert_to_Polyhedron(): %s", e.what());
|
||||
}
|
||||
CGAL::set_error_behaviour(old_behaviour);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void export_amf(const class PolySet &ps, std::ostream &output)
|
|||
void export_amf(const CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
||||
{
|
||||
if (!root_N->p3->is_simple()) {
|
||||
PRINT("Object isn't a valid 2-manifold! Modify your design.");
|
||||
PRINT("WARNING: Export failed, the object isn't a valid 2-manifold.");
|
||||
return;
|
||||
}
|
||||
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
|
||||
|
|
|
@ -930,7 +930,7 @@ ValuePtr builtin_norm(const Context *, const EvalContext *evalctx)
|
|||
register double x = v[i].toDouble();
|
||||
sum += x*x;
|
||||
} else {
|
||||
PRINT(" WARNING: Incorrect arguments to norm()");
|
||||
PRINT("WARNING: Incorrect arguments to norm()");
|
||||
return ValuePtr::undefined;
|
||||
}
|
||||
return ValuePtr(sqrt(sum));
|
||||
|
|
|
@ -1936,7 +1936,7 @@ void MainWindow::actionExport(export_type_e, QString, QString)
|
|||
|
||||
const CGAL_Nef_polyhedron *N = dynamic_cast<const CGAL_Nef_polyhedron *>(this->root_geom.get());
|
||||
if (N && !N->p3->is_simple()) {
|
||||
PRINT("Warning: Object may not be a valid 2-manifold and may need repair! See http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export");
|
||||
PRINT("WARNING: Object may not be a valid 2-manifold and may need repair! See http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export");
|
||||
}
|
||||
|
||||
QString title = QString(_("Export %1 File")).arg(type_name);
|
||||
|
@ -2524,10 +2524,15 @@ void MainWindow::quit()
|
|||
void MainWindow::consoleOutput(const std::string &msg, void *userdata)
|
||||
{
|
||||
// Invoke the append function in the main thread in case the output
|
||||
// originates in a worker thread.
|
||||
// originates in a worker thread.
|
||||
MainWindow *thisp = static_cast<MainWindow*>(userdata);
|
||||
QMetaObject::invokeMethod(thisp->console, "append", Qt::QueuedConnection,
|
||||
Q_ARG(QString, QString::fromUtf8(msg.c_str())));
|
||||
QString qmsg = QString::fromUtf8(msg.c_str());
|
||||
if (qmsg.startsWith("WARNING:")) {
|
||||
qmsg = "<html><span style=\"color: black; background-color: #ffffb0;\">" + qmsg + "</span></html>";
|
||||
} else if (qmsg.startsWith("ERROR:")) {
|
||||
qmsg = "<html><span style=\"color: black; background-color: #ffb0b0;\">" + qmsg + "</span></html>";
|
||||
}
|
||||
QMetaObject::invokeMethod(thisp->console, "append", Qt::QueuedConnection, Q_ARG(QString, qmsg));
|
||||
if (thisp->procevents) QApplication::processEvents();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,15 @@ ECHO: undef
|
|||
ECHO: undef
|
||||
ECHO: undef
|
||||
ECHO: undef
|
||||
WARNING: Incorrect arguments to norm()
|
||||
WARNING: Incorrect arguments to norm()
|
||||
ECHO: undef
|
||||
WARNING: Incorrect arguments to norm()
|
||||
WARNING: Incorrect arguments to norm()
|
||||
ECHO: undef
|
||||
WARNING: Incorrect arguments to norm()
|
||||
WARNING: Incorrect arguments to norm()
|
||||
ECHO: undef
|
||||
WARNING: Incorrect arguments to norm()
|
||||
WARNING: Incorrect arguments to norm()
|
||||
ECHO: undef
|
||||
WARNING: Incorrect arguments to norm()
|
||||
WARNING: Incorrect arguments to norm()
|
||||
ECHO: undef
|
||||
ECHO: undef
|
||||
ECHO: undef
|
||||
|
|
Loading…
Reference in New Issue