diff options
author | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-30 04:17:05 (GMT) |
---|---|---|
committer | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-30 04:17:05 (GMT) |
commit | 6940d171812565209efe679a5d923417c3f47d4a (patch) | |
tree | 2a05d2f8865ff1127f854db41bf31143f64ccf2d /src/printutils.cc | |
parent | 2b19f33ee1ddce246c2bfe0a05fe379d0117a741 (diff) |
reorganized file structure layout. more to follow...
git-svn-id: http://svn.clifford.at/openscad/trunk@364 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/printutils.cc')
-rw-r--r-- | src/printutils.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/printutils.cc b/src/printutils.cc new file mode 100644 index 0000000..a75cf14 --- /dev/null +++ b/src/printutils.cc @@ -0,0 +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) +{ + 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); + } +} + |