Core.hh 63.1 KB
Newer Older
1
/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
2 3
*                                                                            *
*                              OpenFlipper                                   *
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 *           Copyright (c) 2001-2015, RWTH-Aachen University                 *
 *           Department of Computer Graphics and Multimedia                  *
 *                          All rights reserved.                             *
 *                            www.openflipper.org                            *
 *                                                                           *
 *---------------------------------------------------------------------------*
 * This file is part of OpenFlipper.                                         *
 *---------------------------------------------------------------------------*
 *                                                                           *
 * Redistribution and use in source and binary forms, with or without        *
 * modification, are permitted provided that the following conditions        *
 * are met:                                                                  *
 *                                                                           *
 * 1. Redistributions of source code must retain the above copyright notice, *
 *    this list of conditions and the following disclaimer.                  *
 *                                                                           *
 * 2. Redistributions in binary form must reproduce the above copyright      *
 *    notice, this list of conditions and the following disclaimer in the    *
 *    documentation and/or other materials provided with the distribution.   *
 *                                                                           *
 * 3. Neither the name of the copyright holder nor the names of its          *
 *    contributors may be used to endorse or promote products derived from   *
 *    this software without specific prior written permission.               *
 *                                                                           *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       *
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           *
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  *
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,       *
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR        *
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    *
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      *
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        *
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              *
Jan Möbius's avatar
Jan Möbius committed
39
*                                                                            *
40 41 42
\*===========================================================================*/

/*===========================================================================*\
Jan Möbius's avatar
Jan Möbius committed
43 44 45 46 47
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
48
\*===========================================================================*/
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69




//=============================================================================
//
//  CLASS Core
//
//=============================================================================

/**
 * \file Core.hh
 * This File contains the header of the frameworks system core
*/

#ifndef MVIEWWIDGET_HH
#define MVIEWWIDGET_HH


//== INCLUDES =================================================================

70
#include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>
71 72

// QT INCLUDES
73 74
#include <QVariant>
#include <QMainWindow>
75 76 77 78 79 80
#include <QToolBox>
#include <QStackedWidget>
#include <QSplashScreen>

#include <QDockWidget>
#include <QVector>
81
#include <QProgressDialog>
82 83 84 85 86 87 88 89 90 91 92

#include <QtScript/QScriptEngine>
#include <QtScript/QtScript>

#include "OpenFlipper/INIFile/INIFile.hh"

#include "OpenFlipper/Logging/Logging.hh"
#include "OpenFlipper/Scripting/Scripting.hh"

// Prototypes for scripting
#include "OpenFlipper/Scripting/scriptPrototypes/prototypeVec3d.hh"
93
#include "OpenFlipper/Scripting/scriptPrototypes/prototypeVec4d.hh"
94
#include "OpenFlipper/Scripting/scriptPrototypes/prototypeMatrix4x4.hh"
95
#include "OpenFlipper/Scripting/scriptPrototypes/prototypeDataType.hh"
96
#include <OpenFlipper/Scripting/scriptWrappers/vec3dWrapper.hh>
97
#include <OpenFlipper/Scripting/scriptWrappers/vec4dWrapper.hh>
98
#include <OpenFlipper/Scripting/scriptWrappers/matrix4x4Wrapper.hh>
99
#include <OpenFlipper/Scripting/scriptWrappers/DataTypeWrapper.hh>
100 101 102 103 104
// #include <OpenFlipper/Scripting/scriptWrappers/ObjectIdWrapper.hh>

// Required Interface definition ( Some variables were defined there )
#include "OpenFlipper/BasePlugin/BaseInterface.hh"
#include "OpenFlipper/BasePlugin/FileInterface.hh"
105
#include "OpenFlipper/BasePlugin/TypeInterface.hh"
106
#include "OpenFlipper/BasePlugin/MenuInterface.hh"
107
#include "OpenFlipper/BasePlugin/InformationInterface.hh"
108
#include "OpenFlipper/BasePlugin/SelectionInterface.hh" // -> for SelectionInterface::PrimitiveType
109 110 111 112
#include "OpenFlipper/BasePlugin/ContextMenuInterface.hh"

#include <OpenFlipper/widgets/coreWidget/CoreWidget.hh>

113 114 115
// Process manager widget
#include <OpenFlipper/widgets/processManagerWidget/processManagerWidget.hh>

116 117
#include <OpenFlipper/common/GlobalOptions.hh>

Dirk Wilden's avatar
Dirk Wilden committed
118 119
#include <OpenFlipper/Core/PluginInfo.hh>

120 121
#include <ACG/Scenegraph/CoordsysNode.hh>

122 123
#include <OpenFlipper/threads/JobInfo.hh>

124
#include <OpenFlipper/common/InformationPlugins.hh>
125
#include "SpinBoxEventFilter.hh"
126

127 128 129
//== CLASS DEFINITION =========================================================


130 131 132 133 134 135
struct dataTypes {
  QString name;
  DataType type;
  TypeInterface* plugin;
};

136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
/** Core Widget of the Application
 */
class Core : public QObject
{
  Q_OBJECT

public:

  /// constructor
  Core();

  void init();

  /// destructor
  ~Core();

  /// Synchronise two viewers
  bool add_sync_host(const QString& _name);


private slots:

  /// Handle Mouse events when in Identifier mode
  void slotMouseEventIdentify( QMouseEvent* _event );
Jan Möbius's avatar
Jan Möbius committed
160 161 162
  
  /// Handle Mouse events when in Light mode
  void slotMouseEventLight( QMouseEvent* _event );
163 164 165 166 167 168 169 170

protected:

    //===========================================================================
    /** @name Signals send to Plugins
    * @{ */
   //===========================================================================
signals:
Jan Möbius's avatar
Jan Möbius committed
171
   /// Signal send to plugins when whole scene is cleared
172
   void allCleared();
173

174
   /// When this Signal is emitted all Plugins are informed that the object list changed
175
   void signalObjectUpdated(int);
176

177
   /// When this Signal is emitted all Plugins are informed that some type of update was performed on an object
178
   void signalObjectUpdated(int, const UpdateType&);
179
   
180 181 182 183 184 185
   /// When this Signal is emitted when a Wheel Event occures
   void PluginWheelEvent(QWheelEvent * , const std::string & );

   /// When this Signal is emitted when a Mouse Event occures
   void PluginMouseEvent(QMouseEvent* );

Jan Möbius's avatar
Jan Möbius committed
186 187
   /// Emitted when an light event occurs
   void PluginMouseEventLight( QMouseEvent* );
188

189 190
   /// This signal is emitted if the object has been changed (source/target)
   void objectSelectionChanged( int );
191

192 193
   /// This signal is emitted if one of the viewers updated its view
   void pluginViewChanged();
194

195 196 197
   /// This signal is emitted after the scene has been drawn
   void pluginSceneDrawn();

Dirk Wilden's avatar
Dirk Wilden committed
198 199 200
   /// The texture with the given name and filename has been added
   void addTexture( QString, QString , uint, int );

201 202 203
   /// The texture with the given name and image has been added
   void addTexture( QString, QImage , uint, int );

204 205 206
   /// The texture with the given name and filename has been added
   void addTexture( QString, QString , uint );

207 208 209
   /// The texture with the given name and image has been added
   void addTexture( QString, QImage , uint );

210 211 212
   /// The texture with the given name and filename has been added
   void addMultiTexture( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId );

213 214 215
   /// The texture with the given name and image has been added
   void addMultiTexture( QString _textureGroup , QString _name , QImage _image , int _id , int& _textureId );

216 217 218 219 220 221 222 223 224
   /// Tell the plugins to update the given texture
   void updateTexture( QString , int );

   /// Update all textures in the plugins
   void updateAllTextures( );

   /// This Signal is send to the plugins if a texture has been updated
   void updatedTextures( QString , int );

Dirk Wilden's avatar
Dirk Wilden committed
225 226 227
   /// A texture mode should be changed
   void setTextureMode(QString _textureName ,QString _mode, int _id);

228 229 230
   /// A texture mode should be changed
   void setTextureMode(QString _textureName ,QString _mode);

Dirk Wilden's avatar
Dirk Wilden committed
231 232 233
   /// Switch Texture Plugins to a given Mode
   void switchTexture( QString, int );

234 235 236
   /// Switch Texture Plugins to a given Mode
   void switchTexture( QString );

237 238 239 240 241 242
   /// Change the image for a given texture
   void textureChangeImage( QString _textureName , QImage& _image );

   /// Change the image for a given texture
   void textureChangeImage( QString _textureName , QImage& _image , int _id );

243 244 245 246 247
   ///fetch texture image
   void textureGetImage( QString _textureName , QImage& _image );

   ///fetch texture image
   void textureGetImage( QString _textureName , QImage& _image , int _id );
248 249 250 251

   /// get the texture index
   void textureIndex( QString _textureName, int _id, int& _index);
   
252 253 254
   /// get the texture index property name
   void textureIndexPropertyName( int _id, QString& _propertyName);
   
255 256
   /// get the texture name
   void textureName( int _id, int _textureIndex, QString& _textureName);
257 258 259
   
   /// get the texture's filename
   void textureFilename( int _id, QString _textureName, QString& _textureFilename);
260

261 262 263 264 265
   ///get current texture
   void getCurrentTexture( int _id, QString& _textureName );

   /// get a multi-texture's sub textures
   void getSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );
266 267
   
   /// SelectionInterface: This signal is emitted when a new toolbutton should be added
268
   void addSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
269 270 271 272 273
   
   /// SelectionInterface: This signal is emitted when a data type should be registered for a selection mode
   void registerType(QString _handleName, DataType _type);
   
   /// SelectionInterface: This signal is emitted when a selection plugin should handle a new primitive type
274
   void addPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
275 276
   
   /// SelectionInterface: This signal is emitted when a custom selection mode is added
277
   void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
278
                               SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
279
   void addCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
280 281
                               SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
                               DataType _objectTypeRestriction);
282 283 284
   
   /// SelectionInterface: This signal is used to add non-interactive operations for a specific primitive type
   void addSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
285 286 287

   /// SelectionInterface: This signal is used to add interactive selection parameters for a specific primitive type
   void addSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type);
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
   
   /// SelectionInterface: This signal is emitted when a non-interactive operation has been performed
   void selectionOperation(QString _operation);
  
   /// SelectionInterface: This signal is emitted when standard toggle selection is required
   void showToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
   
   /// SelectionInterface: This signal is emitted when standard lasso selection is required
   void showLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
   
   /// SelectionInterface: This signal is emitted when standard volume lasso selection is required
   void showVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
   
   /// SelectionInterface: This signal is emitted when standard surface lasso selection is required
   void showSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
   
   /// SelectionInterface: This signal is emitted when standard sphere selection is required
   void showSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
   
   /// SelectionInterface: This signal is emitted when standard closest boundary selection is required
   void showClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
   
   /// SelectionInterface: This signal is emitted when standard flood fill selection is required
   void showFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
312 313 314

   /// SelectionInterface: This signal is emitted when standard connected components selection is required
   void showComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
315 316
  
   /// SelectionInterface: This signal is emitted when standard toggle selection has been performed
317
   void toggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
318 319 320 321 322 323 324 325 326 327 328
   
   /// SelectionInterface: This signal is emitted when standard lasso selection has been performed
   void lassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
   
   /// SelectionInterface: This signal is emitted when standard volume lasso selection has been performed
   void volumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
   
   /// SelectionInterface: This signal is emitted when standard surface lasso selection has been performed
   void surfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
   
   /// SelectionInterface: This signal is emitted when standard sphere selection has been performed
329
   void sphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
330 331
   
   /// SelectionInterface: This signal is emitted when standard closest boundary selection has been performed
332
   void closestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
333 334
   
   /// SelectionInterface: This signal is emitted when standard flood fill selection has been performed
335
   void floodFillSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
336
   
337 338 339
   /// SelectionInterface: This signal is emitted when standard connected components selection has been performed
   void componentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);

340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
   /// SelectionInterface: This signal is emitted when a custom selection operation has been performed
   void customSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);
  
   /// SelectionInterface: This signal is emitted when the active (selected) data types should be fetched
   void getActiveDataTypes(SelectionInterface::TypeList& _types);
   
   /// SelectionInterface: This signal is emitted when the active (selected) primitive type should be fetched
   void getActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
   
   /// SelectionInterface: This signal is emitted if the current target restriction state is requested
   void targetObjectsOnly(bool& _targetsOnly);
   
   /// SelectionInterface: This signal is emitted when a selection should be loaded from a file
   void loadSelection(const INIFile& _file);
   
   /// SelectionInterface: This signal is emitted when a selection should be written into a file
   void saveSelection(INIFile& _file);
   
   /// SelectionInterface: This signal is emitted when a type selection plugin wants to listen to a key event
   void registerKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
   
   /// SelectionInterface: This signal is emitted when a key shortcut has been pressed
   void keyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers = Qt::NoModifier);
363

364 365 366 367 368 369 370 371 372 373 374 375
   /// If an ini File is opened, this signal is send to Plugins capable of handling ini files
   void iniLoad( INIFile&, int );

   /// This signal is used to tell the plugins to save the data of _id to the given file
   void iniSave( INIFile& _ini ,int _id );

   /// This signal is used to tell the plugins to save their current status
   void iniSaveOptions(  INIFile& _ini );

   /// This signal is used to tell the plugins to load their new status
   void iniLoadOptions(  INIFile& _ini );

376 377 378
   /// This signal is used to tell the plugins to load their new status after objects are loaded
   void iniLoadOptionsLast(  INIFile& _ini );

379 380 381
   /// This signal is emitted before the core deletes its data and exits
   void saveOnExit( INIFile& _ini );

382 383 384 385 386 387 388 389 390 391 392
   /// Tell backup-plugin to create a backup
   void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
   void createBackup( IdList _objectids, QString _name, std::vector<UpdateType> _types);

   /// Tell backup-plugin to undo/redo
   void undo(int _objectid);
   void redo(int _objectid);
   void undo();
   void redo();

   /// Backup Plugin tells other Plugins that a restore will happen
393
   void aboutToRestore(int _objectId);
Jan Möbius's avatar
Jan Möbius committed
394
   
395
   /// Backup Plugin tells other Plugins that a restore has happened
396
   void restored( int _objectId);
397 398 399 400

   /// Tell the plugins that a file has been opened ( -> Database)
   void openedFile( int _id );

Dirk Wilden's avatar
Dirk Wilden committed
401 402 403
   /// Tell the plugins that an empty object has been added
   void emptyObjectAdded( int _id);

404 405 406
   /// Called after all plugins are loaded
   void pluginsInitialized();

407 408 409
   /// Called after all plugins are loaded and additionally passes command line plugin options
   void pluginsInitialized(QVector<QPair<QString, QString>> const&);

410 411 412
   /// Tell plugins that the visibility of an object has changed
   void visibilityChanged(int _id);

413 414 415
   /// Tell plugins that object properties such as object names have been changed
   void objectPropertiesChanged( int _id );

416 417 418
   /// Called after an object has been deleted
   void objectDeleted( int );

419 420 421 422 423 424 425 426
   /** @} */

   //===========================================================================
    /** @name Slots called by the plugins
    * @{ */
   //===========================================================================
   private slots :

427
      /// Called by the plugins if they changed something in the object list (deleted, added, or other property changes)
428
      void slotObjectUpdated(int _identifier, const UpdateType& _type = UPDATE_ALL);
429

430
      /// Called when a plugin changes the visibility of an object
431
      void slotVisibilityChanged(int _id);
432

433 434 435
      /// Called by plugins if object properties like names have changed
      void slotObjectPropertiesChanged( int _id );

436
      /// Called by Plugins if they changed the active object
437
      void slotObjectSelectionChanged( int _id);
438 439

      /// Add a new picking mode to the examiner_widget_
Jan Möbius's avatar
Jan Möbius committed
440
      void slotAddPickMode( const std::string& _mode );
441 442

      /// Add a new and invisible picking mode to the examiner_widget_
Jan Möbius's avatar
Jan Möbius committed
443
      void slotAddHiddenPickMode( const std::string& _mode );
444

Dirk Wilden's avatar
Dirk Wilden committed
445 446
      /// Called by a plugin if it creates a texture
      void slotAddTexture( QString _textureName , QString _filename , uint _dimension , int _id );
447 448 449
      
      /// Called by a plugin if it creates a texture
      void slotAddTexture( QString _textureName , QImage _image , uint _dimension , int _id );
Dirk Wilden's avatar
Dirk Wilden committed
450

451 452
      /// Called by a plugin if it creates a texture
      void slotAddTexture( QString _textureName , QString _filename , uint _dimension );
453 454 455
      
      /// Called by a plugin if it creates a texture
      void slotAddTexture( QString _textureName , QImage _image , uint _dimension );
456

457 458
      /// Called by a plugin if it creates a multitexture
      void slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId );
459
      void slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int* _textureId );
460 461 462
      
      /// Called by a plugin if it creates a multitexture
      void slotMultiTextureAdded( QString _textureGroup , QString _name , QImage _image , int _id , int& _textureId );
463

464 465 466 467 468 469 470 471 472
      /// Tell the plugins to update the given texture
      void slotUpdateTexture( QString _name , int _identifier);

      /// Update all textures in the plugins
      void slotUpdateAllTextures( );

      /// A Texture has been updated
      void slotTextureUpdated( QString _textureName , int _identifier );

Dirk Wilden's avatar
Dirk Wilden committed
473 474 475
      /// A texture mode should be changed
      void slotSetTextureMode(QString _textureName ,QString _mode, int _id);

476 477 478
      /// A texture mode should be changed
      void slotSetTextureMode(QString _textureName ,QString _mode);

Dirk Wilden's avatar
Dirk Wilden committed
479 480 481
      /// Tells Plugins to switch to the given Texture
      void slotSwitchTexture( QString _textureName, int _id );

482 483 484
      /// Tells Plugins to switch to the given Texture
      void slotSwitchTexture( QString _textureName );

485 486 487 488 489 490
      ///Called by plugins if texture image should be changed
      void slotTextureChangeImage( QString _textureName , QImage& _image );

      ///Called by plugins if texture image should be changed
      void slotTextureChangeImage( QString _textureName , QImage& _image , int _id );

491 492 493 494 495 496
      ///Called by plugins if texture image should be fetched
      void slotTextureGetImage( QString _textureName , QImage& _image );

      ///Called by plugins if texture image should be fetched
      void slotTextureGetImage( QString _textureName , QImage& _image , int _id );
      
497 498 499
      ///Called by plugins if texture index should be fetched
      void slotTextureIndex( QString _textureName, int _id, int& _index);
      
500 501 502
      ///Called by plugins if texture index property name should be fetched
      void slotTextureIndexPropertyName( int _id, QString& _propertyName);
      
503 504 505
      ///Called by plugins if texture name should be fetched
      void slotTextureName( int _id, int _textureIndex, QString& _textureName);
      
506 507 508
      ///Called by plugins if texture name should be fetched
      void slotTextureFilename( int _id, QString _textureName, QString& _textureFilename);
      
509 510 511 512 513 514
      ///Called by plugins if current texture should be retrieved
      void slotGetCurrentTexture( int _id, QString& _textureName );

      ///Called by plugins if a multi-texture's sub textures should be fetched
      void slotGetSubTextures( int _id, QString _multiTextureName, QStringList& _subTextures );

515 516 517
      /// A plugin wants to load a given file
      void slotLoad(QString _filename, DataType _type, int& _id);

518
      /// the load widget wants to load a given file
519
      void slotLoad(QStringList _filenames, IdList _pluginIDs);
520
      
521
      /// Called when a file has been opened
522
      void slotFileOpened ( int _id );
523 524 525

      /// Called when an empty object has been Added
      void slotEmptyObjectAdded ( int _id );
526 527
  
      /// SelectionInterface: Called when a new selection type button should be added to the toolbar
528
      void slotAddSelectionEnvironment(QString _modeName, QString _description, QString _icon, QString& _handleName);
529 530 531 532 533

      /// SelectionInterface: Called when a data type is added for a specific selection type
      void slotRegisterType(QString _handleName, DataType _type);

      /// SelectionInterface: Called when a new, non-standard primitive type should be handled
534
      void slotAddPrimitiveType(QString _handleName, QString _name, QString _icon, SelectionInterface::PrimitiveType& _typeHandle);
535

536 537 538 539 540 541 542 543 544
      /** \brief SelectionInterface: Add new selection mode for specified type
       *
       * @param _handleName             Handle of the selection mode
       * @param _modeName               User visible name of the selection mode
       * @param _description            Description of the mode
       * @param _icon                   Icon displayed in the selection toolbar
       * @param _associatedTypes        primitive types supported by this mode
       * @param _customIdentifier       Identifier of this mode
       */
545
      void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
546
                                      SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier);
547 548 549 550 551 552 553 554 555 556 557

      /** \brief  SelectionInterface: Add new selection mode for specified type
       *
       * @param _handleName             Handle of the selection mode
       * @param _modeName               User visible name of the selection mode
       * @param _description            Description of the mode
       * @param _icon                   Icon displayed in the selection toolbar
       * @param _associatedTypes        primitive types supported by this mode
       * @param _customIdentifier       Identifier of this mode
       * @param _objectTypeRestriction  Object types supported by this mode
       */
558
      void slotAddCustomSelectionMode(QString _handleName, QString _modeName, QString _description, QString _icon,
559 560
                                      SelectionInterface::PrimitiveType _associatedTypes, QString& _customIdentifier,
                                      DataType _objectTypeRestriction);
561 562 563
      
      /// SelectionInterface: Called in order to add non-interactive operations for a specific primitive type
      void slotAddSelectionOperations(QString _handleName, QStringList _operationsList, QString _category, SelectionInterface::PrimitiveType _type);
564 565 566

      /// SelectionInterface: Called in order to add interactive parameters for a specific primitive type
      void slotAddSelectionParameters(QString _handleName, QWidget* _widget, QString _category, SelectionInterface::PrimitiveType _type);
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
       
      /// SelectionInterface: Called when a non-interactive operation has been performed
      void slotSelectionOperation(QString _operation);

      /// SelectionInterface: Provide toggle selection operation for specific selection mode
      void slotShowToggleSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

      /// SelectionInterface: Provide lasso selection operation for specific selection mode
      void slotShowLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

      /// SelectionInterface: Provide volume lasso selection operation for specific selection mode
      void slotShowVolumeLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);
      
      /// SelectionInterface: Provide surface lasso selection operation for specific selection mode
      void slotShowSurfaceLassoSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

      /// SelectionInterface: Provide sphere selection operation for specific selection mode
      void slotShowSphereSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

      /// SelectionInterface: Provide closest boundary selection operation for specific selection mode
      void slotShowClosestBoundarySelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

      /// SelectionInterface: Provide flood fill selection operation for specific selection mode
      void slotShowFloodFillSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

592 593 594
      /// SelectionInterface: Provide connected components selection operation for specific selection mode
      void slotShowComponentsSelectionMode(QString _handleName, bool _show, SelectionInterface::PrimitiveType _associatedTypes);

595
      /// SelectionInterface: Called when toggle selection operation has been performed
596
      void slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
597 598 599 600 601 602 603 604 605 606 607

      /// SelectionInterface: Called when lasso selection operation has been performed
      void slotLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);

      /// SelectionInterface: Called when volume lasso selection operation has been performed
      void slotVolumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
      
      /// SelectionInterface: Called when surface lasso selection operation has been performed
      void slotSurfaceLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);

      /// SelectionInterface: Called when sphere selection operation has been performed
608
      void slotSphereSelection(QMouseEvent* _event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect);
609 610

      /// SelectionInterface: Called when closest boundary selection operation has been performed
611
      void slotClosestBoundarySelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
612 613

      /// SelectionInterface: Called when flood fill selection operation has been performed
614
      void slotFloodFillSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);
615

616 617 618
      /// SelectionInterface: Called when connected components selection operation has been performed
      void slotComponentsSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect);

619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641
      /// SelectionInterface: Called when custom selection operation has been performed
      void slotCustomSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, QString _customIdentifier, bool _deselect);

      /// SelectionInterface: Called when active (selected) data types should be fetched
      void slotGetActiveDataTypes(SelectionInterface::TypeList& _types);

      /// SelectionInterface: Called when active primitive type should be fetched
      void slotGetActivePrimitiveType(SelectionInterface::PrimitiveType& _type);
      
      /// SelectionInterface: Called when target restriction state should be fetched
      void slotTargetObjectsOnly(bool& _targetsOnly);
      
      /// SelectionInterface: Called when a selection should be loaded from a file
      void slotLoadSelection(const INIFile& _file);
      
      /// SelectionInterface: Called when a selection should be stored into a file
      void slotSaveSelection(INIFile& _file);
      
      /// SelectionInterface: Called when a key shortcut is to be registered
      void slotRegisterKeyShortcut(int _key, Qt::KeyboardModifiers _modifiers);
      
      /// SelectionInterface: Called when a key event occurred
      void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
642

Jan Möbius's avatar
Jan Möbius committed
643 644 645 646 647 648 649
      /** \brief Called when a plugin requests a list of file-filters
      *
      * This function collects all available load filters from the file Plugins.
      * It is normally called via the Load/Save interface ( LoadSaveInterface ).
      *
      * @param _list Returns a list of all available file load filters
      */ 
650 651
      void slotGetAllFilters ( QStringList& _list);

652

653 654
      /// Called when a plugin wants to delete all objects
      void slotDeleteAllObjects( );
655 656 657
      
      /// Called to create inter plugin connections
      void slotCrossPluginConnect( QString _pluginName1, const char* _signal, QString _pluginName2, const char* _slot);
658

659 660 661
      /// Called to create inter plugin connections
      void slotCrossPluginConnectQueued( QString _pluginName1, const char* _signal, QString _pluginName2, const char* _slot);

662 663 664
      /// called to switch the renderer for a specific viewer
      void slotSetRenderer(unsigned int _viewer, QString _rendererName);

665 666 667
      /// called to get the currently active renderer renderer for a specific viewer
      void slotGetCurrentRenderer(unsigned int _viewer, QString& _rendererName);

Dirk Wilden's avatar
Dirk Wilden committed
668
      /// Get a Pointer to the Plugin with given _name (if it is loaded)
669
      //  void slotGetPlugin(QString _name, QObject* & _plugin );
Dirk Wilden's avatar
Dirk Wilden committed
670

671 672 673 674 675 676 677 678 679 680 681
   /** @} */

    //===========================================================================
    /** @name scriptable slots
    * @{ */
   //===========================================================================
public slots:

    /// Called when a  plugin requests an update in the viewer
    void updateView();

682 683 684
    /// Called when a plugin wants to lock or unlock scenegraph updates
    void  blockScenegraphUpdates(bool _block);

685 686 687
    /// process events during script execution to keep the ui alive
    void updateUI();

688 689 690
    /// Clear all data objects
    void clearAll();

691 692 693
    /// Called to delete an object
    void deleteObject( int _id );

694 695 696 697
    void setObjectComment(int objId, QString key, QString comment);
    void clearObjectComment(int objId, QString key);
    void clearAllComments(int objId);

698 699
    /// set fullscreen mode
    void fullscreen( bool _state );
700 701 702
    
    /// Show or Hide the viewmode control widget.
    void showViewModeControls( bool _show );
703

704 705
    /// Change the logging window state
    void loggerState(int _state);
706 707 708
    
    /// Enable or disable OpenMesh error logging
    void enableOpenMeshErrorLog(bool _state);
709

710 711
    /// Show or hide toolbox
    void showToolbox( bool _state );
712

713 714 715
    /// Show or hide Status Bar
    void showStatusBar( bool _state );

716 717
    /// Switch the multiView Mode
    void multiViewMode( int _mode );
718

719 720 721 722 723 724
    /// Enable or disable framerate restriction
    void restrictFrameRate( bool _enable );

    /// set the maximal framerate ( automatically enables framerate restriction )
    void setMaxFrameRate( int _rate );

725 726
    /// set the baseFilename for snapshots (a counter is automatically increased when
    /// snapshot() is called)
727
    void snapshotBaseFileName(QString _fname, unsigned int _viewerId = 0);
728 729
    
    /// Set the file type for snapshots.
730
    void snapshotFileType(QString _type, unsigned int _viewerId = 0);
731 732 733
    
    /// Set the start index for the snapshot counter
    void snapshotCounterStart(const int _counter, unsigned int _viewerId = 0);
734

735 736 737
    /** Trigger a snapshot and increase the snapshot counter.
      Save snapshot to file determined by snapshotBaseFileName() and
      the current snapshot counter. The \a back buffer will be saved.
738
      The id of the current viewer is 0 (default).
739
    */
740
    void snapshot(unsigned int _viewerId = 0, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int _numSamples = 1);
741

Dirk Wilden's avatar
Dirk Wilden committed
742 743 744 745 746 747
    /// Take a snapshot from the whole app
    void applicationSnapshot();

    /// Set the baseName for the application snapshot
    void applicationSnapshotName(QString _name);

Dirk Wilden's avatar
Dirk Wilden committed
748 749 750
    /// Take a snapshot from all viewers
    void viewerSnapshot();

751 752 753
    /// Scriptable snapshot method offering full control
    void viewerSnapshot(QString file_name, bool store_comments,
            bool comments_visible_only, bool comments_targeted_only,
754
            bool store_material_info, int snapshot_width, int snapshot_height,
755 756 757
            bool snapshot_transparent, bool hide_coord_sys,
            int snapshot_multisampling, bool store_view);

758
    /// resize the examinerViewer
759 760 761 762
    void resizeViewers(int _width, int _height );

    /// resize the whole Application
    void resizeApplication(int _width, int _height );
763

Dirk Wilden's avatar
Dirk Wilden committed
764 765 766
    /// write the current versions of all plugins to ini file
    void writeVersionNumbers(QString _filename);

Jan Möbius's avatar
Jan Möbius committed
767 768 769
    /// return the list of available object that has the given selection and type
    QList<int> objectList (QString _selection, QStringList _types);

770 771 772 773 774 775
    /// Block the scenegraph updates
    void blockSceneGraphUpdates();

    /// Unblock the scenegraph updates
    void unblockSceneGraphUpdates();

776
    void setView(QString view);
777
    void setViewAndWindowGeometry(QString view);
778

Jan Möbius's avatar
Jan Möbius committed
779 780
    /** @} */

781 782 783 784 785 786
   //===========================================================================
    /** @name Scripting functions for controlling view modes
    * @{ */
   //===========================================================================

public slots:
787
    /** \brief Scripting function to set toolboxes in a view mode
788 789 790
     *
     * @param _modeName Name of the View Mode
     * @param _toolboxList ; separated list of toolboxes in the view mode
791
    */
792 793 794
    void addViewModeToolboxes(QString _modeName, QString _toolboxList);
    
    /** \brief Scripting function to set toolbars in a view mode
795 796 797 798
     *
     * @param _modeName Name of the View Mode
     * @param _toolbarList ; separated list of toolbars in the view mode
     *
799 800
    */
    void addViewModeToolbars(QString _modeName, QString _toolbarList);
Jan Möbius's avatar
Jan Möbius committed
801 802
    
    /** \brief Scripting function to set context menus in a view mode
803 804 805
     *
     * @param _modeName Name of the View Mode
     * @param _contextMenuList ; separated list of context menus in the view mode
Jan Möbius's avatar
Jan Möbius committed
806 807
    */
    void addViewModeContextMenus(QString _modeName, QString _contextMenuList);
808 809
    
    /** \brief Scripting function to set an icon for a view mode
810 811
     * @param _modeName Name of the View Mode
     * @param _iconName Name of the Icon File. Will be taken from OpenFlippers Icon directory
812 813
    */
    void addViewModeIcon(QString _modeName, QString _iconName);    
814 815
    
    /** \brief Scripting function to set the side of the main window on which the toolbox should be displayed
816 817
     *
     * @param _side The desired side (either "left" or "right")
818 819
    */
    void setToolBoxSide(QString _side);
820

821 822 823 824
    /** \brief Scripting function to activate or deactivate a toolbox
     *
     * @param _toolBoxName Name of the toolbox to manipulate
     * @param _active      Activate or deactivate
Dirk Wilden's avatar
Dirk Wilden committed
825 826
    */
    void setToolBoxActive(QString _toolBoxName, bool _active);
Jan Möbius's avatar
Jan Möbius committed
827

828 829 830 831 832 833
    /** @} */

   //===========================================================================
    /** @name Basic functions
    * @{ */
   //===========================================================================
834
public slots:
Jan Möbius's avatar
Jan Möbius committed
835 836 837 838 839
  /** \brief Load a new Object ( this may also be an ini or ofs file )
   *
   * This function tries to get the type of data to be loaded from the filename 
   * and then load the file.
   *
840 841 842 843
   *  @param _filename Filename of the data
   *  @return id of object otherwise -1
   */
  int loadObject ( QString _filename );
844 845
  
private slots:
846 847
  void loadObjectFinished(QString _filename);

848 849 850 851 852
  /** Do a reset of the scenegraph (bounding box update,...)
   *
   * @param _resetTrackBall Should the rotation center of the trackball be reset to the scene center?
   */
  void resetScenegraph( bool _resetTrackBall );
853 854 855

 public :

Jan Möbius's avatar
Jan Möbius committed
856 857 858 859 860 861
  /** \brief Load an object from the commandline on application start
  *
  * This function is called before the event queue is executed. The filename and parameters
  * are stored. After the event queue is started, all files in this list will be opened.
  * This is necessary as the event queue has to run to schedule the events emitted 
  * during open operations.
862 863 864 865
  *
  * @param _filename filename of the file to be opened. If it does not contain a full path,
  *                  the current path will be prepended.
  * @param _asPolyMesh Load as a polymesh ( yes/no)
Jan Möbius's avatar
Jan Möbius committed
866
  */
867
  void commandLineOpen(const QString& _filename, bool _asPolyMesh );
868

869 870 871 872 873 874 875 876 877 878
  /** \brief Load a script from the commandline on application start
  *
  * This function is called before the event queue is executed. The filename 
  * is stored. After the event queue is started, all files in this list will be opened.
  * This is necessary as the event queue has to run to schedule the events emitted 
  * during open operations.
  *
  * @param _filename filename of the script to be opened. If it does not contain a full path,
  *                  the current path will be prepended.
  */
879
  void commandLineScript(const QString& _filename );
880

881 882
  private slots:

Jan Möbius's avatar
Jan Möbius committed
883
  /** \brief Executed after loading core completly to load files from commandline
884
  *
Jan Möbius's avatar
Jan Möbius committed
885 886 887
  * This slot is automatically called after application startup. All files from the commandline
  * will be loaded by this slot. This is required as the core and the event queue need to be running
  * to emit the required signals to the plugins.
888
  */
889
  void slotExecuteAfterStartup();
890 891

  private:
Jan Möbius's avatar
Jan Möbius committed
892
    /// Vector storing filenames from commandline to be opened after application startup (objects)
893
    std::vector< std::pair < QString , bool >  > commandLineFileNames_;
Jan Möbius's avatar
Jan Möbius committed
894 895
    
    /// Vector storing filenames from commandline to be opened after application startup (script files)
896
    std::vector< QString > commandLineScriptNames_;
897 898 899

  public:

900 901 902 903 904
  /** Add an empty Object of the given Type
  * @return id of the new object or -1 if unsupported
  */
  int addEmptyObject( DataType _type );

Jan Möbius's avatar
Jan Möbius committed
905 906 907 908 909
  /** \brief Load object of the given Type with given filename
   *
   * This function should not be used anymore. \n
   * The extension is now used to check for the plugin handling the given types.
   *
910 911 912 913
   * @return id of the new object or -1 if unsupported
   */
  int loadObject( DataType _type, QString _filename);

914
  /** @} */
915

916
  //===========================================================================
917 918 919 920 921 922 923 924 925 926
  /** @name  Video Stream creation
  * @{ */
  //===========================================================================
  private slots:
    /// Slot called everytime the view is updated
    void viewUpdated();

    /// Function called for every frame when capturing video
    void captureVideo();

Dirk Wilden's avatar
Dirk Wilden committed
927 928
  public slots:

929
    /// Start video capturing
Dirk Wilden's avatar
Dirk Wilden committed
930
    void startVideoCapture(QString _baseName, int _fps, bool _captureViewers);
931 932

    /// Stop video capturing
Dirk Wilden's avatar
Dirk Wilden committed
933
    void stopVideoCapture();
934 935 936 937 938

  private:
    QTimer videoTimer_;
    QTime  lastVideoTime_;

Dirk Wilden's avatar
Dirk Wilden committed
939 940
    int captureType_;

941 942
    bool capture_;

943 944 945
    int lastWidth_;
    int lastHeight_;

946 947
  /** @} */
  //===========================================================================
948 949 950 951 952 953 954 955 956 957
    /** @name Load / Save slots
    * @{ */
  //===========================================================================

  public slots:

    /** Save object with given id
      * @param _id id of the object
      */
    bool saveObject( int _id, QString _filename );
958 959
    
    void saveObject( int _id, QString _filename, int _pluginID );
960 961
    
    void saveObjects( IdList _ids, QString _filename, int _pluginID );
962

963 964 965 966 967 968
    /** Show dialog for saving an object to a new location
      * @param _id id of the object
      * @param _filename current filename of the object
      */
    bool saveObjectTo( int _id, QString _filename );

969 970
    bool saveObjectsTo( IdList _ids, QString _filename );
      
971 972 973 974 975 976
    /// Slot for saving objects from Menu
    void saveAllObjects();

    /// Slot for saving objects to a new location
    void saveAllObjectsTo();

977
    /// Save current status to a settings file. Solicit file name through dialog.
978 979
    void saveSettings();

980 981 982 983
    /// Save current status to a the provided settings file
    void saveSettings(QString filePath, bool is_saveObjectInfo, bool is_targetOnly, bool is_saveAll,
                      bool is_askOverwrite, bool is_saveProgramSettings, bool is_savePluginSettings);

984 985 986 987 988 989 990 991
    /// Open Load Widget
    void loadObject();

    /// Load status from file
    void loadSettings();

    /// Load status from file
    void loadSettings(QString _filename);
992

993 994 995
    /// Get object id from filename
    int getObjectId(QString _filename);

Jan Möbius's avatar
Jan Möbius committed
996 997 998 999 1000 1001
    /** \brief Serialize material properties
     *
     * @param _objId  Id of the object where the material should be deserialized into
     * @param _props   A QString containing the serialized material
     */
    void deserializeMaterialProperties(int _objId, QString _props);
1002

Jan Möbius's avatar
Jan Möbius committed
1003 1004 1005 1006 1007
    /** \brief Serialize material properties
     *
     * @param _objId  Id of the object where the material should be serialized
     * @return A Qstring containing the serialized material
     */
1008 1009
    QString serializeMaterialProperties(int _objId);

1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
  /** @} */

  //===========================================================================
    /** @name Basic slots
    * @{ */
  //===========================================================================
   private slots :

      /// Gets called by examiner widget when mouse is moved in picking mode
      void slotMouseEvent( QMouseEvent* _event );

      /// Gets called by examiner widget when Wheel is moved in picking mode
      void slotWheelEvent( QWheelEvent * _event, const std::string & _mode);

1024 1025 1026 1027
      /** \brief Open the add Empty dialog
      *
      * This slot shows the addEmpty dialog which is used to add empty objects of supported dataTypes
      */
1028 1029
      void slotAddEmptyObjectMenu();

1030
      /// Slot adding empty object of a given type
1031
      void slotAddEmptyObject( DataType _type , int& _id );
1032
      void slotAddEmptyObject( DataType _type, int* _id);
1033

1034 1035 1036
      /// Slot copying an object
      void slotCopyObject( int _oldId , int& _newId );

1037 1038 1039 1040 1041
      /// Exit Application
      void slotExit();

      /// Open Recent file
      void slotRecentOpen(QAction* _action);
1042

1043 1044 1045
      /// Slot for generating type specific backups
      void slotGenerateBackup( int _id, QString _name, UpdateType _type );

1046
   public slots:
1047

1048 1049
    /// Add a Toolbox from a plugin or from scripting
     void addToolbox(QString _name ,QWidget* _widget);
1050

Dirk Wilden's avatar
Dirk Wilden committed
1051 1052 1053
    /// Add a Toolbox from a plugin or from scripting (with icon)
     void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon);

1054 1055 1056 1057
     /// Add a Toolbox from a plugin or from scripting (with icon)
      void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon,
              QWidget* _headerAreaWidget);

1058 1059 1060
     /**
      * Get a toolbox.
      *
1061
      * @param _pluginName The plugin which the requested toolbox belongs to.
1062
      * @param _toolboxName The name of the requested toolbox.
1063
      * @return A pointer to the requested toolbox widget if it was found, nullptr, otherwise.
1064 1065 1066
      */
     QWidget *getToolbox(QString _pluginName, QString _toolboxName);

Jan Möbius's avatar
Jan Möbius committed
1067 1068
     void activateToolbox(QString _pluginName, QString _toolboxName, bool activate);

1069 1070 1071 1072 1073 1074 1075 1076 1077
   private :

   //===========================================================================
    /** @name Scenegraph
    * @{ */
   //===========================================================================

   private:
      /// Scenegraphs root node
1078
      SeparatorNode* root_node_scenegraph_;
1079 1080 1081
      
      /// Seperator node for global nodes
      SeparatorNode* root_node_scenegraph_global_;
1082

1083 1084 1085 1086 1087 1088 1089 1090 1091
      /// Separator Node holding all core scenegraph nodes
      SeparatorNode* core_nodes_;
      
      
      ///Toplevel Nodes for data objects
      SeparatorNode* dataSeparatorNode_;
      
      /// Root Node for data objects
      SeparatorNode*  dataRootNode_;
1092

1093 1094 1095
      /// Node for coordsys Material
      ACG::SceneGraph::MaterialNode* coordsysMaterialNode_;

1096 1097
      /// Node for the coordinate system
      ACG::SceneGraph::CoordsysNode* coordsysNode_;
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108

   /** @} */

   //===========================================================================
    /** @name IniFile and Options Handling
    * @{ */
   //===========================================================================

   /// Get all ini files and set basic paths and options
   void setupOptions();

1109 1110 1111
   /// Read Options that needs the GUI to be set up completely
   void readGUIOptions(INIFile& _ini);

1112 1113 1114 1115 1116 1117
   /// Get and set Application options from ini file
   void readApplicationOptions(INIFile& _ini);

   /// Write Application options to ini file
   void writeApplicationOptions(INIFile& _ini);

1118 1119 1120
   /// Restore key assignments from configs files
   void restoreKeyBindings();

1121 1122
  public slots:

1123 1124 1125
   /// Save the current options to the standard ini file
   void saveOptions();

1126 1127 1128
   /// after ini-files have been loaded and core is up or if options have been changed -> apply Options
   void applyOptions();

1129 1130 1131 1132 1133
   /** \brief Load information from an ini file
    *
    * This function will open an ini file and load the information in it.
    *
    * @param _filename Name of the ini file
1134
    * @param _coreSettings      Load core settings from the file
1135
    * @param _perPluginSettings Load per plugin settings from the file
1136
    * @param _loadObjects       Load objects defined in the ini file
1137 1138
    *
    */
1139 1140 1141 1142
   void openIniFile( QString _filename,
                     bool    _coreSettings ,
                     bool    _perPluginSettings,
                     bool    _loadObjects );
1143 1144 1145 1146 1147 1148

  private:

   /** \brief Write current status to ini file (Application and File Options)
    *
    *  Writes the complete status to an ini file ( All open objects and their Information )
1149
    *
1150 1151 1152
    * @param _filename           Filename of the ini file to write with full path
    * @param _relativePaths      This defines if the paths to the objects should be made relative
    * @param _targetOnly         Select if we want all open objects or only the ones which are selected as target.
1153 1154
    * @param _saveSystemSettings Choose if you also want to save system settings into the ini file.
    * @param _savePluginSettings Choose if you want to save per Plugin global settings into the ini file.
1155 1156
    * @param _saveObjectInfo     If you want to store information about all open objects this has to be true
    * @param _fileMapping        If multiple files have the same name, all duplicates get renamed. Mapping: Id -> new file name.
1157
    */
1158 1159 1160 1161 1162
   void writeIniFile( QString _filename,
                      bool    _relativePaths,
                      bool    _targetOnly,
                      bool    _saveSystemSettings,
                      bool    _savePluginSettings ,
1163 1164
                      bool    _saveObjectInfo,
                      std::map<int,QString>& _fileMapping);
1165 1166 1167 1168 1169

   /** \brief Write current status to obj file (Application and File Options)
    *
    *  Writes the complete status to an obj file ( All open objects and their Information )
    */
1170
   void writeObjFile(QString _filename, bool _relativePaths, bool _targetOnly, std::map<int,QString>& _fileMapping);
1171 1172 1173 1174 1175 1176

   /// Called if app is closed and writes all information to ini file
   void writeOnExit();

   /** @} */

1177
   
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200
  //===========================================================================
  /** @name Logging
  * @{ */
  //===========================================================================

  signals:
    /// Logg with OUT,WARN or ERR as type
    void log(Logtype _type , QString _message );

    /// Default logging as OUT
    void log(QString _message );

    /// Logging signal for ScriptEngine
    void scriptLog(QString _message);

    /// This signal is emitted to send log data to a plugin
    void externalLog(Logtype _type , QString _message);

  private slots:

    /// Console logger
    void slotLog(Logtype _type, QString _message);

Dirk Wilden's avatar
Dirk Wilden committed
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210
    /// log to file
    void slotLogToFile(Logtype _type, QString _message);

  private:
    ///stream for logging to file
    QTextStream* logStream_;

    ///logfile
    QFile* logFile_;

1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
  public :
    void scriptLogFunction( QString _output);

  /** @} */


  //===========================================================================
  /** @name Signal and Slot processing for Plugins
  * @{ */
  //===========================================================================

  private :
    /// Check if a plugin has a slot
    bool checkSlot(QObject* _plugin , const char* _slotSignature);

    /// Check if a plugin has a signal
    bool checkSignal(QObject* _plugin , const char* _signalSignature);

  /** @} */

  //===========================================================================
    /** @name Plugin Management
      * @{ */
  //===========================================================================

1236
  public :
1237
    std::vector<PluginInfo>& plugins();
1238

1239 1240 1241 1242 1243 1244 1245
  private:

    /// Index of Plugins toolbox widget
    int toolboxindex_;

    /// Load all plugins from default plugin directory and from INI-File
    void loadPlugins();
1246 1247 1248 1249

    /// Print all info collected about plugin during loading
    void printPluginLoadLog(const QString& errors,const QString& warnings);

1250
  private slots:
Dirk Wilden's avatar
Dirk Wilden committed
1251 1252
    /// Show Plugins Dialog
    void slotShowPlugins();
1253

1254 1255
    /// Function for loading Plugins
    void loadPlugin(const QString& _filename,const bool _silent, QString& _licenseErrors , QObject* _plugin = 0 );
1256 1257 1258 1259

    /// Load Plugins from menu
    void slotLoadPlugin();

1260 1261 1262 1263 1264 1265
    /// Function for Blocking Plugins. Blocked plugins will unloaded and not loaded wthin the next starts
    void slotBlockPlugin(const QString &_rpcName);

    /// Function for UnBlocking Plugins. Plugins will not loaded automatically
    void slotUnBlockPlugin(const QString &_rpcName);

1266 1267
  /** @} */

Jan Möbius's avatar
Jan Möbius committed
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282
  //===========================================================================
  /** @name Metadata support
    * @{ */
  //===========================================================================
  signals:
        void genericMetadataDeserialized(QString key, QString value);
        void objectMetadataDeserialized(QString object_name, QString value);
        void objectMetadataDeserializedJson(
                QString object_name, QJsonDocument value);

  private slots:
        void slotMetadataDeserialized( const QVector<QPair<QString, QString> > &data);

      /** @} */

1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296

  //===========================================================================
    /** @name Scripting support
      * @{ */
  //===========================================================================

  signals:

    void scriptInfo( QString _pluginName , QString _functionName  );

    void executeScript( QString _script );

    void executeFileScript( QString _filename );

1297 1298
    void setSlotDescription(QString     _slotName,   QString     _slotDescription,
                            QStringList _parameters, QStringList _descriptions);
1299 1300 1301 1302 1303 1304 1305 1306 1307

  public slots:
    /** \brief Create an script object from a ui file
     *
     * This function will load an ui file, set up a qwidget from that and makes it available
     * under _objectName for scripting.
     * @param _objectName The name in scripting environment used for the new object
     * @param _uiFilename ui file to load
     */
1308
    void createWidget(QString _objectName, QString _uiFilename, bool _show = true);
1309

1310 1311 1312
    /// Set the active ViewMode
    void setViewMode(QString _viewMode);

1313 1314 1315
    /// Get current view mode
    QString getCurrentViewMode();

1316 1317
    /// Set the icon of a viewMode
    void setViewModeIcon(QString _mode, QString _iconName);
1318 1319
    
    /// Move selected toolbox to top of side area
1320
    void moveToolBoxToTop(QString _name);
1321 1322
    
    /// Move selected toolbox to bottom of side area
1323
    void moveToolBoxToBottom(QString _name);
1324

Jan Möbius's avatar
Jan Möbius committed
1325 1326
    void showReducedMenuBar(bool reduced);

1327 1328


1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340
  private :
    /// Core scripting engine
    QScriptEngine scriptEngine_;

    /// Wrappers for plugin scripting
    std::vector<ScriptingWrapper*> scriptingWrappers_;

    /// List of all registered scripting functions
    QStringList scriptingFunctions_;

    /// Prototype for the Vector type
    prototypeVec3d vec3dPrototype_;
1341
    
1342 1343 1344
    /// Prototype for the Vector type
    prototypeVec4d vec4dPrototype_;

1345 1346
    /// Prototype for the DataType
    prototypeDataType DataTypePrototype_;
1347

1348
    /// Prototype for the Matrix type
1349 1350 1351 1352 1353 1354
    prototypeMatrix4x4 matrix4x4Prototype_;


  private slots:
    void slotScriptInfo( QString _pluginName , QString _functionName  );

Jan Möbius's avatar
Jan Möbius committed
1355 1356 1357 1358 1359

    /** Core slot, executes the given script text via scripting plugin
     *
     * @param _script Script as QString
     */
1360 1361
    void slotExecuteScript( QString _script );

Jan Möbius's avatar
Jan Möbius committed
1362 1363 1364 1365 1366 1367
    /** Core slot, executes the given file as a script via scripting plugin
     *
     * @param _filename Filename of the script
     */
    void slotExecuteFileScript( QString _filename );

1368 1369 1370 1371
    void slotGetScriptingEngine( QScriptEngine*& _engine  );

    void slotGetAllAvailableFunctions( QStringList& _functions  );

1372 1373 1374
    /// set a description for one of the plugin's public slots
    void slotSetSlotDescription(QString     _slotName,   QString _slotDescription,
                                QStringList _parameters, QStringList _descriptions);
1375 1376 1377 1378 1379

    /// set a description for a global scripting function
    void slotSetSlotDescriptionGlobalFunction(QString     _functionName,   QString _slotDescription,
                                              QStringList _parameters, QStringList _descriptions);

1380
    /// get available descriptions for a given public slot
1381 1382
    void slotGetDescription(QString _function,        QString& _fnDescription,
                            QStringList& _parameters, QStringList& _descriptions );
1383

Jan Möbius's avatar
Jan Möbius committed
1384
    void slotScriptError(const QScriptValue &error);
1385

1386 1387 1388
  private:

    QList< SlotInfo > coreSlots_;
1389
    QList< SlotInfo > globalFunctions_;
1390

1391 1392
    void setDescriptions();

1393 1394 1395 1396 1397 1398 1399 1400
  /** @} */

  //===========================================================================
    /** @name RPC ( Remote procedure Call) support
      * @{ */
  //===========================================================================
  private slots:

Jan Möbius's avatar
Jan Möbius committed
1401 1402 1403 1404 1405 1406
    /** \brief Check if a plugin exists
     *
     * @param _pluginName   Name of the plugin to check
     * @param _exists       Returns if the function was found in the plugin
     */
    void slotPluginExists( QString _pluginName , bool& _exists );
1407

Jan Möbius's avatar
Jan Möbius committed
1408 1409 1410 1411 1412 1413
    /** \brief Check if a function exists
     *
     * @param _pluginName   Name of the plugin to check
     * @param _functionName Name of the function inside the plugin
     * @param _exists       Returns if the function was found in the plugin
     */
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444
    void slotFunctionExists( QString _pluginName , QString _functionName , bool& _exists  );

    /** This slot executes a function of a plugin.
     * If it does not exist, _success will be false
     * @param _pluginName Plugin where the function is implemented
     * @param _functionName name of the function ( Standard name, no parameters allowed!)
     * @param _success successfull execution?
     */
    void slotCall( QString _pluginName , QString _functionName , bool& _success  );

    /** This slot executes the given expression.
     * No checks are performed if the remote function is available.
     * @param _expression command to execute
     * @param _success successfull execution?
     */
    void slotCall( QString _expression , bool& _success  );

    /** This slot executes the given expression and returns the result
     *  No checks are performed if the remote function is available.
     *  if an error occurs the result contains an invalid QVariant
     *
     * ex. getValue("databaseplugin.tableExists(\"meshes\")", result) )
     *     result.toBool() == true
     *
     * @param _expression command to execute
     * @param _result The return value of the command
     */
    void slotGetValue(QString _expression, QVariant& _result );

  /** @} */

1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461
  //===========================================================================
    /** @name Scenegraph redraw handling
      * @{ */
  //===========================================================================

  private slots:

    /// Called to check if the scenegraph needs to be redrawn
    void checkScenegraphDirty();

  private:

    /// Timer that starts scenegraph check
    QTimer *scenegraphCheckTimer_;

    /// Holds the time since last redraw
    QTime *redrawTime_;
1462

1463
  /** @} */
1464 1465 1466 1467 1468 1469 1470 1471 1472
  
  
  //===========================================================================
  /** @name Process Interface and Controls
  * @{ */
  //===========================================================================
  
  private:
    
Matthias Möller's avatar
Matthias Möller committed
1473
    QList< JobInfo >  currentJobs;
1474
    
1475 1476
    ProcessManagerWidget* processManager_;
    
1477 1478 1479
    /// Find a job in the jobslist
    bool getJob(QString _jobId, int& _index);
    
1480 1481
  private slots:

1482 1483
    /// A job has been started by a plugin
    void slotStartJob( QString _jobId, QString _description , int _min , int _max,bool _blocking );
1484
    
1485
    /// A job state has been updated by a plugin
1486 1487
    void slotSetJobState(QString _jobId, int _value );
    
1488 1489 1490 1491 1492 1493
    /// A job's widget caption has been updated by a plugin
    void slotSetJobName(QString _jobId, QString _name );
    
    /// A job's widget's status text has been updated by a plugin
    void slotSetJobDescription(QString _jobId, QString _text );
    
1494
    /// A job state has been canceled by a plugin
1495 1496
    void slotCancelJob(QString _jobId );
    
1497
    /// A job state has been finished by a plugin