Commit fba0eda6 authored by Jan Möbius's avatar Jan Möbius

Split Signals for visibility Changed and Object Selection changed from updatedObject block

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5325 383ad7c9-94d9-4d36-a494-682f7c89f535
parent cf469652
......@@ -103,7 +103,7 @@ class BaseInterface {
/** \brief An object has been changed or added by this plugin
*
* Emit this Signal, if you updated any part of an object (e.g. source/target ).\n
* Emit this Signal, if you updated any part of an object.\n
* If you changed the element itself (geometry, topology,..) you also have to emit this signal.\n
* Dont emit this Signal in BaseInterface::slotObjectUpdated() as this causes an endless Loop!!
* Give the id of the new object as parameter or -1 if you updated all objects or deleted an object.
......@@ -116,17 +116,18 @@ class BaseInterface {
*
* Emit this Signal, if you changed the visibility of an object.
* This is required to reset the near and far plane for the viewers to provide
* an optimal view.
* an optimal view. Use the id of the object you show or hide as a parameter.
* Otherwise use -1 if you dont have the id.
*
*/
virtual void visibilityChanged( ) {};
virtual void visibilityChanged( int /*_identifier*/ ) {};
/** \brief The active object has been switched by this plugin
/** \brief The object selection has been changed by this plugin
*
* This signal is used to tell the other plugins that the object selection (source/target) has been changed.\n
*
* This signal is used to tell the other plugins that the active object has been changed.\n
* You should only do this if you are writing a plugin that manages the objects(e.g. DatacontrolPlugin).\n
*/
virtual void activeObjectChanged() {};
virtual void objectSelectionChanged( int /*_identifier*/ ) {};
private slots:
......@@ -138,7 +139,7 @@ class BaseInterface {
* If you store local information about one of these Objects, you should check if its still valid!\n
* Dont emit BaseInterface::updatedObject(int) in this slot as this causes an endless Loop!!
* You dont need to call updateView as the core triggers a redraw itself.
* @param _identifier Identifier of the updated/new object or -1 if one is deleted
* @param _identifier Identifier of the updated/new object or -1 if one is deleted.
*/
virtual void slotObjectUpdated( int /*_identifier*/ ) {};
......@@ -152,10 +153,21 @@ class BaseInterface {
/** \brief The active object has changed
*
* This slot is called by the main aplication if the currently active object has changed.\n
* This means that the selection of target objects has changed.
* This slot is called by the main aplication if the currentselection of an object has changed.\n
* This means that the selection of source / target objects has changed.
* Addisionally you get the id of the object that has been changed or -1 if all objects
* have been modified.
*/
virtual void slotActiveObjectChanged() {};
virtual void slotObjectSelectionChanged( int /*_identifier*/ ) {};
/** \brief An object has been shown or hidden
*
* This slot is called if an objecct is shown or hidden.
* The id of the object is given as a parameter.
* If multiple or all objects have changed, the id will be -1.
*
*/
virtual void slotVisibilityChanged( int /*_identifier*/ ) {};
/** @} */
......
......@@ -149,8 +149,8 @@ signals:
/// Emitted when an identify event occurs
void PluginMouseEventIdentify( QMouseEvent* );
/// This signal is emitted if the active object has been changed
void activeObjectChanged();
/// This signal is emitted if the object has been changed (source/target)
void objectSelectionChanged( int );
/// The texture with the given name and filename has been added
void addTexture( QString, QString , uint );
......@@ -194,6 +194,9 @@ signals:
/// Called after all plugins are loaded
void pluginsInitialized();
/// Tell plugins that the visibility of an object has changed
void visibilityChanged(int _id);
/** @} */
//===========================================================================
......@@ -208,10 +211,10 @@ signals:
void slotObjectUpdated(int _identifier);
/// Called when a plugin changes the visibility of an object
void slotVisibilityChanged();
void slotVisibilityChanged(int _id);
/// Called by Plugins if they changed the active object
void slotActiveObjectChanged();
void slotObjectSelectionChanged( int _id);
/// Add a new picking mode to the examiner_widget_
void slotAddPickMode( const std::string _mode );
......
......@@ -572,7 +572,7 @@ void Core::openIniFile( QString _filename,
}
if ( newActiveObject )
emit activeObjectChanged();
emit objectSelectionChanged(-1);
}
......
......@@ -261,7 +261,7 @@ void Core::preprocessObjFile(QString _filename)
emit log(LOGERR,"Unable to open Object " + path);
if ( newActiveObject )
emit activeObjectChanged();
emit objectSelectionChanged(-1);
}
//-----------------------------------------------------------------------------
......
......@@ -96,18 +96,25 @@ void Core::slotObjectUpdated(int _identifier) {
updateView();
}
void Core::slotVisibilityChanged() {
resetScenegraph();
updateView();
}
void Core::slotVisibilityChanged( int _id ) {
/** This function is called if the active object has changed. The information is passed to all plugins.
*/
void Core::slotActiveObjectChanged()
{
// just inform the plugins as we dont do anything else
emit activeObjectChanged();
}
// tell plugins
emit visibilityChanged( _id );
resetScenegraph();
updateView();
}
/** This function is called if the active object has changed. The information is passed to all plugins.
*/
void Core::slotObjectSelectionChanged( int _id )
{
// just inform the plugins as we dont do anything else
emit objectSelectionChanged(_id);
// std::cerr << "objectSelection changed triggers updatedObjects for now" << std::endl;
// emit updatedObject(_id);
}
//====================================================================================
// === Toolbox handling =================
......
......@@ -470,24 +470,40 @@ void Core::loadPlugin(QString filename, bool silent){
if ( checkSignal(plugin,"updateView()") )
connect(plugin,SIGNAL(updateView()),this,SLOT(updateView()));
if ( checkSignal(plugin,"updatedObject(int)") )
connect(plugin,SIGNAL(updatedObject(int)),this,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
if ( checkSignal(plugin,"visibilityChanged()") )
connect(plugin,SIGNAL(visibilityChanged()),this,SLOT(slotVisibilityChanged()), Qt::DirectConnection);
if ( checkSlot( plugin , "slotObjectUpdated(int)" ) )
connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
if ( checkSignal(plugin,"visibilityChanged(int)" ) )
emit log (LOGERR,"Signal visibilityChanged() now requires objectid or -1 as argument " );
if ( checkSignal(plugin,"visibilityChanged(int)") )
connect(plugin,SIGNAL(visibilityChanged(int)),this,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
if ( checkSlot(plugin,"slotVisibilityChanged(int)") )
connect(this,SIGNAL(visibilityChanged(int)),plugin,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
if ( checkSignal(plugin,"activeObjectChanged()" ) )
emit log (LOGERR,"Signal activeObjectChanged() is now objectSelectionChanged( int _objectId ) " );
if ( checkSignal(plugin,"slotActiveObjectChanged()" ) )
emit log (LOGERR,"Signal activeObjectChanged() is now slotObjectSelectionChanged( int _objectId ) " );
if ( checkSlot(plugin,"slotAllCleared()") )
connect(this,SIGNAL(allCleared()),plugin,SLOT(slotAllCleared()));
if ( checkSignal(plugin,"activeObjectChanged()") )
connect(plugin,SIGNAL(activeObjectChanged()),this,SLOT(slotActiveObjectChanged() ));
if ( checkSlot( plugin , "slotActiveObjectChanged()" ) )
connect(this,SIGNAL(activeObjectChanged()),plugin,SLOT(slotActiveObjectChanged() ));
if ( checkSignal(plugin,"objectSelectionChanged(int)") )
connect(plugin,SIGNAL(objectSelectionChanged(int)),this,SLOT(slotObjectSelectionChanged(int) ));
if ( checkSlot( plugin , "slotObjectSelectionChanged(int)" ) )
connect(this,SIGNAL(objectSelectionChanged(int)),plugin,SLOT(slotObjectSelectionChanged(int) ));
if ( checkSlot( plugin , "slotObjectUpdated(int)" ) )
connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
if ( checkSlot( plugin , "pluginsInitialized()" ) )
connect(this,SIGNAL(pluginsInitialized()),plugin,SLOT(pluginsInitialized()), Qt::DirectConnection);
......
......@@ -57,7 +57,7 @@ void Core::resetScenegraph() {
}
}
// Update the draw Modes Menu
coreWidget_->slotUpdateGlobalDrawMenu();
}
......@@ -219,7 +219,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) {
// Tell the Plugins that the Object List and the active object have changed
emit signalObjectUpdated(_id);
emit activeObjectChanged();
emit objectSelectionChanged( _id );
backupRequest(_id,"Original Object");
......@@ -245,7 +245,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) {
void Core::slotEmptyObjectAdded ( int _id ) {
// Tell the Plugins that the Object List and the active object have changed
emit signalObjectUpdated(_id);
emit activeObjectChanged();
emit objectSelectionChanged(_id);
backupRequest(_id,"Original Object");
......
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