diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-06 10:48:51 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-06 10:48:51 (GMT) |
commit | 2ff53c89ce5c1e30d6f001fdd4361b8fcad36e82 (patch) | |
tree | 3b4607c9e49d5eb53859086a6299dffbae5f67ca /printutils.cc | |
parent | 6575732286d3f8909972d3705b748c6cfc02f8a8 (diff) |
Clifford Wolf:
Added caching of messages along wioth synthesis products
git-svn-id: http://svn.clifford.at/openscad/trunk@215 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'printutils.cc')
-rw-r--r-- | printutils.cc | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/printutils.cc b/printutils.cc index 8f53cd3..a75cf14 100644 --- a/printutils.cc +++ b/printutils.cc @@ -1,14 +1,44 @@ #include "printutils.h" #include "MainWindow.h" +QList<QString> print_messages_stack; + +void print_messages_push() +{ + print_messages_stack.append(QString()); +} + +void print_messages_pop() +{ + QString msg = print_messages_stack.last(); + print_messages_stack.removeLast(); + if (print_messages_stack.size() > 0 && !msg.isNull()) { + if (!print_messages_stack.last().isEmpty()) + print_messages_stack.last() += "\n"; + print_messages_stack.last() += msg; + } +} + void PRINT(const QString &msg) { - do { - if (MainWindow::current_win.isNull()) { - fprintf(stderr, "%s\n", msg.toAscii().data()); - } - else { - MainWindow::current_win->console->append(msg); - } - } while (0); + if (msg.isNull()) + return; + if (print_messages_stack.size() > 0) { + if (!print_messages_stack.last().isEmpty()) + print_messages_stack.last() += "\n"; + print_messages_stack.last() += msg; + } + PRINT_NOCACHE(msg); } + +void PRINT_NOCACHE(const QString &msg) +{ + if (msg.isNull()) + return; + if (MainWindow::current_win.isNull()) { + fprintf(stderr, "%s\n", msg.toAscii().data()); + } else { + MainWindow::current_win->console->append(msg); + } +} + |