Salome HOME
no message
authorstv <stv@opencascade.com>
Fri, 11 Nov 2005 09:40:31 +0000 (09:40 +0000)
committerstv <stv@opencascade.com>
Fri, 11 Nov 2005 09:40:31 +0000 (09:40 +0000)
src/CAF/CAF_Application.cxx
src/CAF/CAF_Application.h
src/Qtx/QtxListAction.cxx
src/Qtx/QtxListAction.h
src/SUIT/SUIT_Application.cxx
src/SUIT/SUIT_Application.h

index 3a069fdcb9275ad3d0d486138205ee900b16c711..db05644cf941d3f2cf7679d50c34c97c7d6e3603 100755 (executable)
@@ -160,18 +160,25 @@ void CAF_Application::updateCommandsStatus()
     cafStudy = (CAF_Study*)activeStudy();
 
   QAction* undo = action( EditUndoId );
-  if ( cafStudy && undo->inherits( "QtxListAction" ) )
-    ((QtxListAction*)undo)->addNames( cafStudy->undoNames() );
+  if ( cafStudy && undo )
+    undo->setProperty( "names", cafStudy->undoNames() );
 
   QAction* redo = action( EditRedoId );
-  if ( cafStudy && redo->inherits( "QtxListAction" ) )
-    ((QtxListAction*)redo)->addNames( cafStudy->redoNames() );
+  if ( cafStudy && redo )
+    redo->setProperty( "names", cafStudy->redoNames() );
 
-  undo->setEnabled( cafStudy && cafStudy->canUndo() );
-  redo->setEnabled( cafStudy && cafStudy->canRedo() );
+  if ( undo )
+    undo->setEnabled( cafStudy && cafStudy->canUndo() );
+  if ( redo )
+    redo->setEnabled( cafStudy && cafStudy->canRedo() );
 }
 
 void CAF_Application::onHelpAbout()
 {
   SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
 }
+
+SUIT_Study* CAF_Application::createNewStudy()
+{
+  return new CAF_Study( this );
+}
index f5610fe90d5fd8b53119cb64bbd7f419daaa65ae..8f73004598e8e55ac4a00dd3931ecda82d9c401f 100755 (executable)
@@ -23,24 +23,26 @@ public:
   CAF_Application();
   virtual ~CAF_Application();
 
-  virtual QString applicationName() const;
+  virtual QString     applicationName() const;
 
 public slots:  
-  virtual void    onHelpAbout();
+  virtual void        onHelpAbout();
 
 protected slots:
-  virtual bool    onUndo( int );
-  virtual bool    onRedo( int );
+  virtual bool        onUndo( int );
+  virtual bool        onRedo( int );
   
 protected:
   enum {  EditUndoId = STD_Application::UserID, EditRedoId, UserID };
 
 protected:
-  virtual void    createActions();
-  virtual void    updateCommandsStatus();
+  virtual void        createActions();
+  virtual void        updateCommandsStatus();
 
-  bool                             undo( CAF_Study* doc );
-  bool                             redo( CAF_Study* doc );
+  virtual SUIT_Study* createNewStudy();
+
+  bool                                 undo( CAF_Study* doc );
+  bool                                 redo( CAF_Study* doc );
 };
 
 #if defined WIN32
index 329c3d7a8e2727f062bcde3080b17b6964302dd7..633fa370a40d26cb6842c3c56372274175b8291a 100755 (executable)
@@ -153,6 +153,14 @@ void QtxListAction::setPopupMode( const int mode )
   myMode = mode;
 }
 
+QStringList QtxListAction::names() const
+{
+  QStringList lst;
+  if ( myFrame )
+    lst = myFrame->names();
+  return lst;
+}
+
 /*!
        Name: addNames [public]
        Desc: Fills the list of actions. Removes the old contents from
index 64003fe91b4d16b12df2824ee041e9b5173f1ac2..8f74210e13123b1ffebdcf60dc7b488e231f51f3 100755 (executable)
@@ -26,6 +26,8 @@ class QTX_EXPORT QtxListAction : public QtxAction
 {
     Q_OBJECT
 
+    Q_PROPERTY( QStringList names READ names WRITE addNames )
+
     class ToolButton;
 
 public:
@@ -47,6 +49,7 @@ public:
     int                     popupMode() const;
     void                    setPopupMode( const int );
 
+    QStringList             names() const;
     void                    addNames( const QStringList&, bool = true );
     void                    setComment( const QString&, const QString& = QString::null );
 
index 38082005581f8c940770b37fbf0aa0c73e2d7d2e..b0b1cd9d6a42d012ecff0b1262e60229d30fe509 100755 (executable)
@@ -257,6 +257,18 @@ void SUIT_Application::setToolShown( const int id, const bool on )
     desktop()->toolMgr()->setShown( id, on );
 }
 
+void SUIT_Application::setActionShown( QAction* a, const bool on )
+{
+  setMenuShown( a, on );
+  setToolShown( a, on );
+}
+
+void SUIT_Application::setActionShown( const int id, const bool on )
+{
+  setMenuShown( id, on );
+  setToolShown( id, on );
+}
+
 QAction* SUIT_Application::action( const int id ) const
 {
   SUIT_Application* that = (SUIT_Application*)this;
index 283d546de6103c869087bd5012a8651aa376bd70..8e54602642c892e728365a9ff9f0852f40bdbea1 100755 (executable)
@@ -120,6 +120,9 @@ protected:
   void                  setToolShown( QAction*, const bool );
   void                  setToolShown( const int, const bool );//@}
 
+  void                  setActionShown( QAction*, const bool );
+  void                  setActionShown( const int, const bool );
+
   static QAction*       separator();
   QAction*              action( const int ) const;
   int                   actionId( const QAction* ) const;