diff --git a/CoreApp/CoreApp.pro b/CoreApp/CoreApp.pro index ffbe9be73a2104ea662febc2cee5701e08d4beab..9d86d65f010ac813b1f9e844fbd27d4393d94169 100644 --- a/CoreApp/CoreApp.pro +++ b/CoreApp/CoreApp.pro @@ -15,7 +15,8 @@ qt() DIRECTORIES = ../ ../Core ../Logging \ ../Scripting ../Scripting/scriptPrototypes ../Scripting/scriptWrappers ../SimpleOpt \ - ../widgets/aboutWidget ../widgets/addEmptyWidget ../widgets/coreWidget ../widgets/helpBrowser \ + ../widgets/aboutWidget ../widgets/addEmptyWidget ../widgets/loggerWidget \ + ../widgets/coreWidget ../widgets/helpBrowser \ ../widgets/loadWidget ../widgets/optionsWidget ../widgets/unloadPluginsWidget \ ../widgets/viewModeWidget diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc index e011658de25de661d4729c63066ddb6af56803fc..828868206d0ad0dda8fd698572dfd9983abb7ab2 100644 --- a/widgets/coreWidget/CoreWidget.cc +++ b/widgets/coreWidget/CoreWidget.cc @@ -69,7 +69,7 @@ CoreWidget( QVector& _viewModes, viewModeMenu_(0), viewGroup_(0), splitter_(0), - textedit_(0), + logWidget_(0), recentFilesMenu_(0), pluginsMenu_(0), fileMenu_(0), @@ -95,11 +95,11 @@ CoreWidget( QVector& _viewModes, // ====================================================================== // Set up the logging window // ====================================================================== - textedit_ = new QTextEdit(splitter_); - textedit_->setReadOnly(true); - textedit_->setSizePolicy( QSizePolicy ( QSizePolicy::Preferred , QSizePolicy::Preferred ) ); - textedit_->resize( splitter_->width() ,120); - textedit_->setLineWrapMode( QTextEdit::NoWrap ); + logWidget_ = new LoggerWidget(splitter_); + logWidget_->setReadOnly(true); + logWidget_->setSizePolicy( QSizePolicy ( QSizePolicy::Preferred , QSizePolicy::Preferred ) ); + logWidget_->resize( splitter_->width() ,120); + logWidget_->setLineWrapMode( QTextEdit::NoWrap ); originalLoggerSize_ = 0; @@ -473,6 +473,8 @@ CoreWidget::showToolbox( bool _state ) { void CoreWidget::keyPressEvent(QKeyEvent* _e) { + std::cerr << "Key event in core" << std::endl; + if (_e->modifiers() == Qt::ControlModifier ) { switch (_e->key()) { @@ -497,6 +499,11 @@ CoreWidget::keyPressEvent(QKeyEvent* _e) switch (_e->key()) { + case Qt::Key_Escape: + std::cerr << "Escape Key" << std::endl; + for ( uint i = 0 ; i < examiner_widgets_.size(); ++i) + examiner_widgets_[i]->actionMode(examiner_widgets_[i]->lastActionMode()); + // Send remaining events to plugins default: mapKeyPressEvent(_e); diff --git a/widgets/coreWidget/CoreWidget.hh b/widgets/coreWidget/CoreWidget.hh index cd725d0230ae94e6d8fd5590b310626f730ade59..5aa7413d4c2ca66eb16dd79105790856f00418d8 100644 --- a/widgets/coreWidget/CoreWidget.hh +++ b/widgets/coreWidget/CoreWidget.hh @@ -68,6 +68,7 @@ #include #include +#include #include #include @@ -305,7 +306,7 @@ public: QSplitter* splitter_; /// Textedit at the bottom for log messages - QTextEdit* textedit_; + LoggerWidget* logWidget_; /// Size of the logging window ( defaults to 240 ) int originalLoggerSize_; diff --git a/widgets/coreWidget/CoreWidgetLogging.cc b/widgets/coreWidget/CoreWidgetLogging.cc index a9ae25556bd4d3870818d9e474574fefc9d31dbd..1760be6c400242dd954ea2dc3fd3e04951a611dc 100644 --- a/widgets/coreWidget/CoreWidgetLogging.cc +++ b/widgets/coreWidget/CoreWidgetLogging.cc @@ -12,12 +12,12 @@ // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // OpenFlipper is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with OpenFlipper. If not, see . // @@ -50,39 +50,39 @@ #include #include -//== IMPLEMENTATION ========================================================== +//== IMPLEMENTATION ========================================================== /** \brief Slot writing everything to the Logger widget - * + * * This slot has to be called by all loggers. It is used to serialize * and color the Output. - * + * * @param _type Logtype (defines the color of the output) * @param _message The message for output **/ -void +void CoreWidget:: slotLog(Logtype _type, QString _message) { switch (_type) { case LOGINFO: - textedit_->setTextColor(QColor(0,160,0)); + logWidget_->setTextColor(QColor(0,160,0)); break; case LOGOUT: - textedit_->setTextColor(QColor(0,0,0)); + logWidget_->setTextColor(QColor(0,0,0)); break; case LOGWARN: - textedit_->setTextColor(QColor(160,160,0)); + logWidget_->setTextColor(QColor(160,160,0)); break; case LOGERR: - textedit_->setTextColor(QColor(250,0,0)); + logWidget_->setTextColor(QColor(250,0,0)); break; } - - textedit_->append(_message); - - QScrollBar* bar = textedit_->verticalScrollBar(); + + logWidget_->append(_message); + + QScrollBar* bar = logWidget_->verticalScrollBar(); bar->setValue(bar->maximum()); - + // Make shure, we see the message QApplication::processEvents(); } diff --git a/widgets/loggerWidget/loggerWidget.cc b/widgets/loggerWidget/loggerWidget.cc new file mode 100644 index 0000000000000000000000000000000000000000..a329c9e8314f833e654a716186ee127ab2986a8b --- /dev/null +++ b/widgets/loggerWidget/loggerWidget.cc @@ -0,0 +1,50 @@ +//============================================================================= +// +// OpenFlipper +// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen +// www.openflipper.org +// +//----------------------------------------------------------------------------- +// +// License +// +// OpenFlipper is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// OpenFlipper is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with OpenFlipper. If not, see . +// +//----------------------------------------------------------------------------- +// +// $Revision: 1909 $ +// $Author: wilden $ +// $Date: 2008-06-03 18:45:21 +0200 (Tue, 03 Jun 2008) $ +// +//============================================================================= + + + + +#include "loggerWidget.hh" + +LoggerWidget::LoggerWidget( QWidget *parent) + : QTextEdit(parent) +{ +} + +void LoggerWidget::keyPressEvent (QKeyEvent * _event ) { + // Return key event to parent if not one of the standard key combinations ( ... Core ) + if ( ( (_event->modifiers() & Qt::ControlModifier ) && ( _event->key() == Qt::Key_C ) ) || + ( (_event->modifiers() & Qt::ControlModifier ) && ( _event->key() == Qt::Key_A ) ) ) { + QTextEdit::keyPressEvent(_event); + } else + _event->ignore(); +} + diff --git a/widgets/loggerWidget/loggerWidget.hh b/widgets/loggerWidget/loggerWidget.hh new file mode 100644 index 0000000000000000000000000000000000000000..32a4d51f6407045ef786f6d348d1988137862e1a --- /dev/null +++ b/widgets/loggerWidget/loggerWidget.hh @@ -0,0 +1,61 @@ +//============================================================================= +// +// OpenFlipper +// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen +// www.openflipper.org +// +//----------------------------------------------------------------------------- +// +// License +// +// OpenFlipper is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// OpenFlipper is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with OpenFlipper. If not, see . +// +//----------------------------------------------------------------------------- +// +// $Revision: 1909 $ +// $Author: wilden $ +// $Date: 2008-06-03 18:45:21 +0200 (Tue, 03 Jun 2008) $ +// +//============================================================================= + + + + +#ifndef LOGGERWIDGET_HH +#define LOGGERWIDGET_HH + +#include + +/** \brief Implementation of the logger Widget + * + * This class adds some special features to the textedit for the log window + */ +class LoggerWidget : public QTextEdit +{ + +Q_OBJECT + +public: + LoggerWidget( QWidget *parent = 0 ); + +protected: + + /** \brief Grab key events before TextEdit + * + * This function grabs all key events and passes them back to the core to handle them correctly + */ + void keyPressEvent (QKeyEvent * _event ); +}; + +#endif //LOGGERWIDGET_HH