Commit 880ff482 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

Added clearComment/clearAllComments functions to base object. Added...

Added clearComment/clearAllComments functions to base object. Added corresponding slots to core. Added slotSetView() to core.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16206 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b9b8b43e
...@@ -1682,6 +1682,47 @@ void Core::deleteObject( int _id ){ ...@@ -1682,6 +1682,47 @@ void Core::deleteObject( int _id ){
} }
void Core::setObjectComment(int _id, QString key, QString comment) {
if ( _id == -1 ) return;
BaseObject* object = objectRoot_->childExists(_id);
if (!object || object == objectRoot_) {
std::cerr << "No such object." << std::endl;
return;
}
object->getCommentByKey(key) = comment;
}
void Core::clearObjectComment(int _id, QString key) {
if ( _id == -1 ) return;
BaseObject* object = objectRoot_->childExists(_id);
if (!object || object == objectRoot_) {
std::cerr << "No such object." << std::endl;
return;
}
object->clearComment(key);
}
void Core::clearAllComments(int _id) {
if ( _id == -1 ) return;
BaseObject* object = objectRoot_->childExists(_id);
if (!object || object == objectRoot_) {
std::cerr << "No such object." << std::endl;
return;
}
object->clearAllComments();
}
void Core::slotDeleteAllObjects( ){ void Core::slotDeleteAllObjects( ){
// Remember ids // Remember ids
......
...@@ -645,6 +645,10 @@ public slots: ...@@ -645,6 +645,10 @@ public slots:
/// Called to delete an object /// Called to delete an object
void deleteObject( int _id ); void deleteObject( int _id );
void setObjectComment(int objId, QString key, QString comment);
void clearObjectComment(int objId, QString key);
void clearAllComments(int objId);
/// set fullscreen mode /// set fullscreen mode
void fullscreen( bool _state ); void fullscreen( bool _state );
...@@ -716,6 +720,8 @@ public slots: ...@@ -716,6 +720,8 @@ public slots:
/// Unblock the scenegraph updates /// Unblock the scenegraph updates
void unblockSceneGraphUpdates(); void unblockSceneGraphUpdates();
void setView(QString view);
//=========================================================================== //===========================================================================
/** @name Scripting functions for controlling view modes /** @name Scripting functions for controlling view modes
* @{ */ * @{ */
......
...@@ -333,6 +333,9 @@ void Core::unblockSceneGraphUpdates() { ...@@ -333,6 +333,9 @@ void Core::unblockSceneGraphUpdates() {
OpenFlipper::Options::unblockSceneGraphUpdates(); OpenFlipper::Options::unblockSceneGraphUpdates();
} }
void Core::setView(QString view) {
coreWidget_->slotSetView(view);
}
//============================================================================= //=============================================================================
//== Script Special Functions ================================================= //== Script Special Functions =================================================
......
...@@ -552,6 +552,14 @@ class DLLEXPORTONLY BaseObject : public QObject { ...@@ -552,6 +552,14 @@ class DLLEXPORTONLY BaseObject : public QObject {
return !commentsByKey_.empty(); return !commentsByKey_.empty();
} }
void clearComment(const QString &key) {
commentsByKey_.remove(key);
}
void clearAllComments() {
commentsByKey_.clear();
}
/** Returns a reference to all comments. */ /** Returns a reference to all comments. */
const QMap<QString, QString> &getAllComments() const { const QMap<QString, QString> &getAllComments() const {
return commentsByKey_; return commentsByKey_;
......
...@@ -908,6 +908,9 @@ public: ...@@ -908,6 +908,9 @@ public:
/// Paste the view, the window and toolbox size to the last active examiner /// Paste the view, the window and toolbox size to the last active examiner
void slotPasteViewAndWindow( ); void slotPasteViewAndWindow( );
/// Set the supplied serialized view
void slotSetView( QString view );
/// Copy view from the last active examiner /// Copy view from the last active examiner
void slotCopyView( ); void slotCopyView( );
......
...@@ -867,6 +867,10 @@ void CoreWidget::slotPasteView( ) { ...@@ -867,6 +867,10 @@ void CoreWidget::slotPasteView( ) {
examiner_widgets_[PluginFunctions::activeExaminer()]->actionPasteView(); examiner_widgets_[PluginFunctions::activeExaminer()]->actionPasteView();
} }
void CoreWidget::slotSetView( QString view ) {
examiner_widgets_[PluginFunctions::activeExaminer()]->actionSetView(view);
}
void CoreWidget::slotPasteViewAndWindow() void CoreWidget::slotPasteViewAndWindow()
{ {
QSize size; QSize size;
......
...@@ -1138,6 +1138,9 @@ void glViewer::actionPasteView(QSize * _windowSize /*= NULL*/, int *_splitterWid ...@@ -1138,6 +1138,9 @@ void glViewer::actionPasteView(QSize * _windowSize /*= NULL*/, int *_splitterWid
decodeView(view,_windowSize,_splitterWidth); decodeView(view,_windowSize,_splitterWidth);
} }
void glViewer::actionSetView(QString view) {
decodeView(view, 0, 0);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -2050,7 +2053,17 @@ void glViewer::snapshot( int _width, int _height, bool _alpha, bool _hideCoordsy ...@@ -2050,7 +2053,17 @@ void glViewer::snapshot( int _width, int _height, bool _alpha, bool _hideCoordsy
// Capture image // Capture image
snapshot(image, _width, _height, _alpha, _hideCoordsys, samples); snapshot(image, _width, _height, _alpha, _hideCoordsys, samples);
/*
* Meta data
*/
QString comments = PluginFunctions::collectObjectComments(true, false).join("\n");
if (!comments.isEmpty())
image.setText("Mesh Comments", comments);
QString view;
encodeView(view);
image.setText("View", view);
QFileInfo fi(properties_.snapshotName()); QFileInfo fi(properties_.snapshotName());
QString fname = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(properties_.snapshotCounter()).rightJustified(7,'0') + "." + properties_.snapshotFileType().toLower(); QString fname = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(properties_.snapshotCounter()).rightJustified(7,'0') + "." + properties_.snapshotFileType().toLower();
......
...@@ -366,6 +366,8 @@ public slots: ...@@ -366,6 +366,8 @@ public slots:
*/ */
void actionCopyView(const QSize &_windowSize = QSize(-1,-1), const int _splitterWidth = -1); void actionCopyView(const QSize &_windowSize = QSize(-1,-1), const int _splitterWidth = -1);
void actionSetView(QString view);
//-------------------------------------------------------------- public signals //-------------------------------------------------------------- public signals
signals: signals:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment