myPluginsInfoLoaded = false;
myCheckTransactions = true;
myOperationAttachedToNext = false;
+ myIsAutoUpdateBlocked = false;
ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session>(this));
// register the configuration reading listener
Events_Loop* aLoop = Events_Loop::loop();
{
return ROOT_DOC->transactionID();
}
+
+void Model_Session::blockAutoUpdate(const bool theBlock)
+{
+ if (myIsAutoUpdateBlocked != theBlock) {
+ static Events_Loop* aLoop = Events_Loop::loop();
+ if (theBlock) {
+ static const Events_ID kAutoOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
+ std::shared_ptr<Events_Message> aMsg(new Events_Message(kAutoOff));
+ aLoop->send(aMsg);
+ } else {
+ static const Events_ID kAutoOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
+ std::shared_ptr<Events_Message> aMsg(new Events_Message(kAutoOn));
+ aLoop->send(aMsg);
+ }
+ }
+}
/// if true, generates error if document is updated outside of transaction
bool myCheckTransactions;
bool myOperationAttachedToNext; ///< the current operation must be committed twice, with nested
+ bool myIsAutoUpdateBlocked; ///< the current state of the auto-update flag in the application
public:
//! Loads the OCAF document from the file.
/// Returns the global identifier of the current transaction (needed for the update algo)
MODEL_EXPORT virtual int transactionID();
+
+ /// Returns true if auto-update in the application is blocked
+ MODEL_EXPORT virtual bool isAutoUpdateBlocked() const {
+ return myIsAutoUpdateBlocked;
+ }
+
+ /// Set state of the auto-update of features result in the application
+ MODEL_EXPORT virtual void blockAutoUpdate(const bool theBlock);
+
protected:
/// Loads (if not done yet) the information about the features and plugins
void LoadPluginsInfo();
/// Returns the global identifier of the current transaction (needed for the update algo)
virtual int transactionID() = 0;
+ /// Returns true if auto-update in the application is blocked
+ virtual bool isAutoUpdateBlocked() const = 0;
+
+ /// Set state of the auto-update of features result in the application
+ virtual void blockAutoUpdate(const bool theBlock) = 0;
+
protected:
/// Sets the session interface implementation (once per application launch)
static void setSession(std::shared_ptr<ModelAPI_Session> theManager);