]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Compilation by CMake.
authorouv <ouv@opencascade.com>
Tue, 23 Jul 2013 15:03:20 +0000 (15:03 +0000)
committerouv <ouv@opencascade.com>
Tue, 23 Jul 2013 15:03:20 +0000 (15:03 +0000)
23 files changed:
CMake/Common.cmake
CMake/CommonInstall.cmake
CMake/UseQT4EXT.cmake [new file with mode: 0644]
CMakeLists.txt
src/HYDROGUI/CMakeLists.txt [new file with mode: 0644]
src/HYDROGUI/HYDROGUI.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_InputPanel.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_InputPanel.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Module.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Module.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ObjSelector.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ObjSelector.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Operation.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Operation.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Operations.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Operations.h [new file with mode: 0644]
src/HYDROGUI/resources/HYDRO.png [new file with mode: 0755]
src/HYDROGUI/resources/HYDROGUI_images.ts [new file with mode: 0644]
src/HYDROGUI/resources/HYDROGUI_msg_en.ts [new file with mode: 0644]
src/HYDROGUI/resources/HYDROGUI_msg_fr.ts [new file with mode: 0644]
src/HYDROGUI/resources/LightApp.xml [new file with mode: 0644]
src/HYDROGUI/resources/SalomeApp.xml [new file with mode: 0644]
src/HYDROOperations/HYDROOperations_Factory.cxx

index 29f6e2241aa301f052916a50918b3b3c69dc7b90..ceefd5bed88bf6d7b55bbe5a517df8fea38fec75 100644 (file)
@@ -1,8 +1,8 @@
 cmake_minimum_required (VERSION 2.6)
 cmake_policy(SET CMP0011 NEW)
 
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/salome)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/salome)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/salome)
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
index 7394c236e064f69a5ac2cf9c812677c3060645ef..5e6a62c0c3729e398977c9344106cd295d79f6b1 100644 (file)
@@ -1,2 +1,2 @@
-install(TARGETS ${PROJECT_LIBRARIES} RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
+install(TARGETS ${PROJECT_LIBRARIES} RUNTIME DESTINATION bin/salome LIBRARY DESTINATION lib/salome)
 install(FILES ${PROJECT_HEADERS} DESTINATION include)
diff --git a/CMake/UseQT4EXT.cmake b/CMake/UseQT4EXT.cmake
new file mode 100644 (file)
index 0000000..7983577
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
+  FILE(MAKE_DIRECTORY \${MYFULLDIR})
+  MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
+  EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
+ENDMACRO(QT4_COMPILE_TS_ON_INSTALL)")
+
+# This MACRO uses the following vars
+# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
+#
+# MYTSFILES containing all ts files to be compiled.
+# WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
+MACRO(QT4_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
+  INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
+  SET(MYSOURCES)
+  FOREACH(input ${MYTSFILES})
+    GET_FILENAME_COMPONENT(input2 ${input} NAME)
+    STRING(REGEX REPLACE ".ts" "" base ${input2})
+    SET(output "${base}.qm")
+    INSTALL(CODE "QT4_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
+  ENDFOREACH(input ${MYIDLFILES})
+ENDMACRO(QT4_INSTALL_TS_RESOURCES)
index bcda5f39a68c4ada8d6dc614bee7e4b5c70efeb6..e0a549826cce69a976d84954ac381408a0cdb3b2 100644 (file)
@@ -21,7 +21,10 @@ find_package(SalomeQT4)
 find_package(SalomeCAS)
 find_package(SalomeCPPUNIT)
 
+set(HYDRO_salomeres_DATA share/salome/resources/hydro)
+
 add_subdirectory (src/HYDROData)
 add_subdirectory (src/HYDROOperations)
+add_subdirectory (src/HYDROGUI)
 
 enable_testing()
diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9f2554a
--- /dev/null
@@ -0,0 +1,57 @@
+include(../../CMake/Common.cmake)
+include(../../CMake/UseQT4EXT.cmake)
+
+set(PROJECT_HEADERS 
+    HYDROGUI.h
+    HYDROGUI_InputPanel.h
+    HYDROGUI_Module.h
+    HYDROGUI_ObjSelector.h
+    HYDROGUI_Operation.h
+    HYDROGUI_Operations.h
+)
+
+QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
+
+set(PROJECT_SOURCES 
+    HYDROGUI_InputPanel.cxx
+    HYDROGUI_Module.cxx
+    HYDROGUI_ObjSelector.cxx
+    HYDROGUI_Operation.cxx
+    HYDROGUI_Operations.cxx
+)
+
+add_definitions(
+  -DHYDROGUI_EXPORTS
+  ${CAS_DEFINITIONS}
+  ${QT_DEFINITIONS}
+  $(GUI_CXXFLAGS)
+)
+
+include_directories(
+  ${CAS_INCLUDE_DIRS}
+  ${QT_INCLUDES}
+  ${GUI_ROOT_DIR}/include/salome
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData
+)
+
+add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC})
+target_link_libraries(HYDROGUI ${CAS_OCAF})
+
+set(PROJECT_LIBRARIES HYDROGUI)
+
+set(GUITS_SOURCES
+  resources/HYDROGUI_images.ts
+  resources/HYDROGUI_msg_en.ts
+  resources/HYDROGUI_msg_fr.ts
+)
+
+include(../../CMake/CommonInstall.cmake)
+
+# resources
+QT4_INSTALL_TS_RESOURCES("${GUITS_SOURCES}" "${HYDRO_salomeres_DATA}")
+
+FILE(GLOB GUIPNG_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.png")
+FILE(GLOB GUIXML_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.xml")
+SET(GUI_DATA ${GUIPNG_DATA} ${GUIXML_DATA})
+INSTALL(FILES ${GUI_DATA} DESTINATION ${HYDRO_salomeres_DATA})
diff --git a/src/HYDROGUI/HYDROGUI.h b/src/HYDROGUI/HYDROGUI.h
new file mode 100644 (file)
index 0000000..c2d7cec
--- /dev/null
@@ -0,0 +1,36 @@
+
+#ifndef HYDROGUI_H
+#define HYDROGUI_H
+
+#if defined HYDROGUI_EXPORTS
+#if defined WNT
+#define HYDRO_EXPORT   __declspec( dllexport )
+#else
+#define HYDRO_EXPORT
+#endif
+#else
+#if defined WNT
+#define HYDRO_EXPORT   __declspec( dllimport )
+#else
+#define HYDRO_EXPORT
+#endif
+#endif
+
+#ifdef WNT
+#pragma warning ( disable: 4251 )
+#pragma warning ( disable: 4267 )
+#pragma warning ( disable: 4311 )
+#pragma warning ( disable: 4312 )
+#endif
+
+#if defined ( _DEBUG ) || defined ( DEBUG )
+#include <assert.h>
+#define HYDRO_VERIFY(x)        (assert(x))
+#define HYDRO_ASSERT(x)        (assert(x))
+#else
+#define HYDRO_VERIFY(x)        (x)
+#define HYDRO_ASSERT(x)
+#endif
+
+#endif
+
diff --git a/src/HYDROGUI/HYDROGUI_InputPanel.cxx b/src/HYDROGUI/HYDROGUI_InputPanel.cxx
new file mode 100644 (file)
index 0000000..a48f65a
--- /dev/null
@@ -0,0 +1,67 @@
+
+#include <HYDROGUI_InputPanel.h>
+#include <HYDROGUI_Module.h>
+#include <CAM_Application.h>
+#include <SUIT_Desktop.h>
+#include <QLayout>
+#include <QPushButton>
+
+HYDROGUI_InputPanel::HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle )
+: QDockWidget( theModule->application()->desktop() ),
+  myModule( theModule )
+{
+  setFloating( false );
+  setWindowTitle( theTitle );
+  setAllowedAreas( Qt::RightDockWidgetArea );
+
+  QFrame* aFrame = new QFrame( this );
+  setWidget( aFrame );
+  QVBoxLayout* aLayout = new QVBoxLayout( aFrame );
+  
+  myMainFrame = new QFrame( this );
+  QGridLayout* aMainLayout = new QGridLayout( myMainFrame );
+  myBtnFrame = new QFrame( this );
+  aLayout->addWidget( myMainFrame, 1 );
+  aLayout->addWidget( myBtnFrame, 0 );
+
+  QHBoxLayout* aBtnsLayout = new QHBoxLayout( myBtnFrame );
+  aBtnsLayout->setMargin( 5 );
+  aBtnsLayout->setSpacing( 5 );
+
+  myApply = new QPushButton( tr( "APPLY" ), myBtnFrame ),
+  myCancel = new QPushButton( tr( "CANCEL" ), myBtnFrame );
+  myHelp = new QPushButton( tr( "HELP" ), myBtnFrame );
+
+  aBtnsLayout->addWidget( myApply, 0 );
+  aBtnsLayout->addWidget( myCancel, 0 );
+  aBtnsLayout->addStretch( 1 );
+  aBtnsLayout->addWidget( myHelp, 0 );
+
+  connect( myApply,  SIGNAL( clicked() ), this, SLOT( OnApply()  ) );
+  connect( myCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
+  connect( myHelp,   SIGNAL( clicked() ), this, SLOT( OnHelp()   ) );
+}
+
+HYDROGUI_InputPanel::~HYDROGUI_InputPanel()
+{
+}
+
+void HYDROGUI_InputPanel::OnApply()
+{
+}
+
+void HYDROGUI_InputPanel::OnCancel()
+{
+}
+
+void HYDROGUI_InputPanel::OnHelp()
+{
+}
+
+void HYDROGUI_InputPanel::addWidget( const QString& theLabel, QWidget* theWidget )
+{
+  QGridLayout* aMainLayout = dynamic_cast<QGridLayout*>( myMainFrame->layout() );
+  int aRow = aMainLayout->rowCount();
+  aMainLayout->addWidget( new QLabel( theLabel, this ), aRow, 0 );
+  aMainLayout->addWidget( theWidget, aRow, 1 );
+}
diff --git a/src/HYDROGUI/HYDROGUI_InputPanel.h b/src/HYDROGUI/HYDROGUI_InputPanel.h
new file mode 100644 (file)
index 0000000..e1801c1
--- /dev/null
@@ -0,0 +1,39 @@
+
+#ifndef HYDROGUI_DIALOG_HEADER
+#define HYDROGUI_DIALOG_HEADER
+
+#include <HYDROGUI.h>
+#include <QDockWidget>
+
+class HYDROGUI_Module;
+class QFrame;
+class QPushButton;
+
+/**\class HYDROGUI_Dialog
+ *\brief The base class representing base input panel for all HYDROGUI panels
+ */
+class HYDROGUI_InputPanel : public QDockWidget
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_InputPanel();
+
+  void addWidget( const QString& theLabel, QWidget* theWidget );
+
+protected slots:
+  void OnApply();
+  void OnCancel();
+  void OnHelp();
+
+private:
+  HYDROGUI_Module* myModule;
+  QFrame* myMainFrame;
+  QFrame* myBtnFrame;
+  QPushButton* myApply;
+  QPushButton* myCancel;
+  QPushButton* myHelp;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx
new file mode 100644 (file)
index 0000000..1ddd42d
--- /dev/null
@@ -0,0 +1,103 @@
+
+#include <HYDROGUI_Module.h>
+#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include <GraphicsView_PrsImage.h>
+#include <GraphicsView_Viewer.h>
+#include <GraphicsView_ViewFrame.h>
+#include <GraphicsView_ViewPort.h>
+#include <LightApp_GVSelector.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_Desktop.h>
+#include <QApplication>
+#include <HYDROGUI_InputPanel.h>
+#include <HYDROGUI_ObjSelector.h>
+
+extern "C" HYDRO_EXPORT CAM_Module* createModule()
+{
+  return new HYDROGUI_Module();
+}
+
+HYDROGUI_Module::HYDROGUI_Module()
+: LightApp_Module( "HYDRO GUI" )
+{
+}
+
+HYDROGUI_Module::~HYDROGUI_Module()
+{
+}
+
+void HYDROGUI_Module::initialize( CAM_Application* theApp )
+{
+  LightApp_Module::initialize( theApp );
+
+  CreateActions();
+  CreateMenus();
+  CreatePopups();
+  CreateToolbars();
+
+  setMenuShown( false );
+
+  HYDROGUI_InputPanel* aDlg = new HYDROGUI_InputPanel( this, "Fuse Images" );
+  HYDROGUI_ObjSelector* aSel1 = new HYDROGUI_ObjSelector( this, aDlg );
+  HYDROGUI_ObjSelector* aSel2 = new HYDROGUI_ObjSelector( this, aDlg );
+  aDlg->addWidget( "Image 1", aSel1 );
+  aDlg->addWidget( "Image 2", aSel2 );
+  application()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aDlg );
+
+  qApp->processEvents();
+}
+
+bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
+{
+  setMenuShown( true );
+  return LightApp_Module::activateModule( theStudy );
+}
+
+void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
+{
+  theMap.clear();
+  theMap.insert( LightApp_Application::WT_LogWindow,     Qt::BottomDockWidgetArea );
+  theMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea   );
+}
+
+void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
+{
+  theTypesList << GraphicsView_Viewer::Type();
+}
+
+void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theMgr )
+{
+  LightApp_Module::onViewManagerAdded( theMgr );
+  connect( theMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
+           this, SLOT( onViewWindowAdded( SUIT_ViewWindow* ) ) );
+}
+
+void HYDROGUI_Module::onViewWindowAdded( SUIT_ViewWindow* theWnd )
+{
+  GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theWnd );
+
+  LightApp_SelectionMgr* aSelMgr = getApp()->selectionMgr();
+  LightApp_GVSelector* aSelector = new LightApp_GVSelector( aViewFrame->getViewer(), aSelMgr );
+
+  GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
+
+  GraphicsView_PrsImage* aPrs1 = new GraphicsView_PrsImage();
+  QImage anImage1( "W:/Work/HYDRO/data/samples/1.bmp" );
+  aPrs1->setImage( anImage1 );
+  aPrs1->setName( "example_1" );
+  aPrs1->compute();
+  aViewPort->addItem( aPrs1 );
+
+  GraphicsView_PrsImage* aPrs2 = new GraphicsView_PrsImage();
+  QImage anImage2( "W:/Work/HYDRO/data/samples/2.bmp" );
+  aPrs2->setImage( anImage2 );
+  aPrs2->setName( "example_2" );
+  aPrs2->setRotationAngle( 30 );
+  aPrs2->setPosition( 200, 50 );
+  aPrs2->compute();
+  aViewPort->addItem( aPrs2 );
+  
+  //qApp->processEvents();
+  aViewPort->fitAll();
+}
diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h
new file mode 100644 (file)
index 0000000..7ed7f66
--- /dev/null
@@ -0,0 +1,49 @@
+
+#ifndef HYDROGUI_MODULE_HEADER
+#define HYDROGUI_MODULE_HEADER
+
+#include <HYDROGUI.h>
+#include <LightApp_Module.h>
+
+class SUIT_ViewWindow;
+
+/**\class HYDROGUI_Module
+ *\brief The class representing the HYDROGUI module
+ */
+class HYDROGUI_Module : public LightApp_Module
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_Module();
+  virtual ~HYDROGUI_Module();
+
+  virtual void initialize( CAM_Application* );
+  virtual void windows( QMap<int, int>& ) const;
+  virtual void viewManagers( QStringList& ) const;
+
+public slots:
+  virtual bool activateModule( SUIT_Study* );
+
+protected:
+  virtual LightApp_Operation* createOperation( const int ) const;
+
+protected slots:
+  void onOperation();
+  virtual void onViewManagerAdded( SUIT_ViewManager* );
+  virtual void onViewWindowAdded( SUIT_ViewWindow* );
+
+private:
+  void CreateActions();
+  void CreateMenus();
+  void CreatePopups();
+  void CreateToolbars();
+
+private:
+  QAction* CreateAction( const int theId, const QString& theSuffix,
+                         const QString& theImg = QString::null,
+                         const int theKey = 0, const bool isToggle = false,
+                         const QString& theSlot = QString::null );
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_ObjSelector.cxx b/src/HYDROGUI/HYDROGUI_ObjSelector.cxx
new file mode 100644 (file)
index 0000000..9a6016e
--- /dev/null
@@ -0,0 +1,77 @@
+
+#include <HYDROGUI_ObjSelector.h>
+#include <HYDROGUI_Module.h>
+#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include <LightApp_GVSelector.h>
+#include <GraphicsView_Object.h>
+#include <QLayout>
+#include <QToolButton>
+#include <QLineEdit>
+
+HYDROGUI_ObjSelector::HYDROGUI_ObjSelector( HYDROGUI_Module* theModule, QWidget* theParent )
+: QAbstractButton( theParent ), myModule( theModule )
+{
+  QHBoxLayout* aLayout = new QHBoxLayout( this );
+  myBtn = new QToolButton( this );
+  myBtn->setCheckable( true );
+  myBtn->setChecked( false );
+  myObjName = new QLineEdit( this );
+  myObjName->setReadOnly( true );
+  aLayout->addWidget( myBtn, 0 );
+  aLayout->addWidget( myObjName, 1 );
+
+  SUIT_SelectionMgr* aSelMgr = theModule->getApp()->selectionMgr();
+
+  connect( myBtn, SIGNAL( toggled( bool ) ), this, SLOT( OnToggled( bool ) ) );
+  connect( aSelMgr, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
+}
+
+HYDROGUI_ObjSelector::~HYDROGUI_ObjSelector()
+{
+}
+
+void HYDROGUI_ObjSelector::paintEvent( QPaintEvent* )
+{
+}
+
+bool HYDROGUI_ObjSelector::hitButton( const QPoint& thePnt ) const
+{
+  return false;
+}
+
+void HYDROGUI_ObjSelector::OnToggled( bool isChecked )
+{
+  if( !isChecked )
+    return;
+
+  QList<HYDROGUI_ObjSelector*> aSelectors = parentWidget()->findChildren<HYDROGUI_ObjSelector*>();
+  foreach( HYDROGUI_ObjSelector* aSelector, aSelectors )
+    if( aSelector != this )
+      aSelector->myBtn->setChecked( false );
+
+  if( isChecked )
+    OnSelectionChanged();
+}
+
+void HYDROGUI_ObjSelector::OnSelectionChanged()
+{
+  if( !myBtn->isChecked() )
+    return;
+
+  SUIT_SelectionMgr* aSelMgr = myModule->getApp()->selectionMgr();
+  SUIT_DataOwnerPtrList anOwners;
+  aSelMgr->selected( anOwners );
+
+  QString anObjName;
+  foreach( SUIT_DataOwner* anOwner, anOwners )
+  {
+    LightApp_GVDataOwner* aGrDOwner = dynamic_cast<LightApp_GVDataOwner*>( anOwner );
+    if( aGrDOwner )
+    {
+      anObjName = aGrDOwner->object()->getName();
+      break;
+    }
+  }
+  myObjName->setText( anObjName );
+}
diff --git a/src/HYDROGUI/HYDROGUI_ObjSelector.h b/src/HYDROGUI/HYDROGUI_ObjSelector.h
new file mode 100644 (file)
index 0000000..55c463b
--- /dev/null
@@ -0,0 +1,33 @@
+
+#ifndef HYDROGUI_OBJ_SELECTOR_HEADER
+#define HYDROGUI_OBJ_SELECTOR_HEADER
+
+#include <QAbstractButton>
+
+class QToolButton;
+class QLineEdit;
+class HYDROGUI_Module;
+
+class HYDROGUI_ObjSelector : public QAbstractButton
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_ObjSelector( HYDROGUI_Module* theModule, QWidget* theParent );
+  virtual ~HYDROGUI_ObjSelector();
+
+protected:
+  virtual void paintEvent( QPaintEvent* );
+  virtual bool hitButton( const QPoint& thePnt ) const;
+
+protected slots:
+  void OnToggled( bool );
+  void OnSelectionChanged();
+
+private:
+  HYDROGUI_Module* myModule;
+  QToolButton* myBtn;
+  QLineEdit* myObjName;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_Operation.cxx b/src/HYDROGUI/HYDROGUI_Operation.cxx
new file mode 100644 (file)
index 0000000..6bd7e44
--- /dev/null
@@ -0,0 +1,50 @@
+
+#include <HYDROGUI_Operation.h>
+#include <HYDROGUI_Module.h>
+#include <HYDROGUI_InputPanel.h>
+#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include <SUIT_Desktop.h>
+
+HYDROGUI_Operation::HYDROGUI_Operation( HYDROGUI_Module* theModule )
+: SUIT_Operation( theModule->getApp() ), myModule( theModule ), myPanel( 0 )
+{
+}
+
+HYDROGUI_Operation::~HYDROGUI_Operation()
+{
+}
+
+SUIT_SelectionMgr* HYDROGUI_Operation::selectionMgr() const
+{
+  return myModule->getApp()->selectionMgr();
+}
+
+void HYDROGUI_Operation::startOperation()
+{
+  /*TODO: if( myIsTransactional && doc() )
+    doc()->OpenTransaction();*/
+
+  if( selectionMgr() )
+    connect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( OnSelectionDone() ) );
+
+  if( inputPanel() )
+  {
+    //TODO: connect( inputPanel(), SIGNAL( dlgOk() ),     this, SLOT( onOk() ) );
+    //TODO: connect( inputPanel(), SIGNAL( dlgCancel() ), this, SLOT( abort()  ) );
+
+    inputPanel()->show();
+    myModule->getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, inputPanel() );
+  }
+}
+
+void HYDROGUI_Operation::OnSelectionDone()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_Operation::inputPanel() const
+{
+  if( !myPanel )
+    ( ( HYDROGUI_Operation* )this )->myPanel = createInputPanel();
+  return myPanel;
+}
diff --git a/src/HYDROGUI/HYDROGUI_Operation.h b/src/HYDROGUI/HYDROGUI_Operation.h
new file mode 100644 (file)
index 0000000..04db8ea
--- /dev/null
@@ -0,0 +1,35 @@
+
+#ifndef HYDROGUI_OPERATION_HEADER
+#define HYDROGUI_OPERATION_HEADER
+
+#include <HYDROGUI.h>
+#include <SUIT_Operation.h>
+
+class HYDROGUI_Module;
+class HYDROGUI_InputPanel;
+class SUIT_SelectionMgr;
+
+class HYDROGUI_Operation : public SUIT_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_Operation( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_Operation();
+
+  HYDROGUI_InputPanel* inputPanel() const;
+  SUIT_SelectionMgr* selectionMgr() const;
+
+protected:
+  virtual void startOperation();
+  virtual HYDROGUI_InputPanel* createInputPanel() const = 0;
+
+protected slots:
+  virtual void OnSelectionDone();
+
+private:
+  HYDROGUI_Module* myModule;
+  HYDROGUI_InputPanel* myPanel;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx
new file mode 100644 (file)
index 0000000..9b7b0c1
--- /dev/null
@@ -0,0 +1,71 @@
+
+#include <HYDROGUI_Module.h>
+#include <HYDROGUI_Operations.h>
+#include <CAM_Application.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Desktop.h>
+#include <QAction>
+
+QAction* HYDROGUI_Module::CreateAction( const int theId, const QString& theSuffix, const QString& theImg,
+                                        const int theKey, const bool isToggle, const QString& theSlot )
+{
+  QString aSlot = theSlot;
+  if( aSlot.isEmpty() )
+    aSlot = SLOT( onOperation() );
+  SUIT_ResourceMgr* aMgr = application()->resourceMgr();
+  std::string anImg = theImg.toStdString();
+  QPixmap aPixmap = theImg.isEmpty() ? QPixmap() : aMgr->loadPixmap( "HYDROGUI", tr( anImg.c_str() ) );
+  std::string aMenu    = ( "MEN_" + theSuffix ).toStdString();
+  std::string aDesktop = ( "DSK_" + theSuffix ).toStdString();
+  std::string aToolbar = ( "STB_" + theSuffix ).toStdString();
+  std::string aSlotStr = aSlot.toStdString();
+  return LightApp_Module::createAction( theId, tr( aMenu.c_str() ), aPixmap,
+    tr( aDesktop.c_str() ), tr( aToolbar.c_str() ),
+               theKey, application()->desktop(), isToggle, this, aSlotStr.c_str() );
+}
+
+void HYDROGUI_Module::CreateActions()
+{
+  CreateAction( ImportImageId, "IMPORT_IMAGE", "", Qt::CTRL + Qt::Key_I );
+}
+
+void HYDROGUI_Module::CreateMenus()
+{
+  int aFileId = createMenu( tr( "MEN_DESK_FILE" ), -1, -1, 0 );
+
+  createMenu( separator(), aFileId, -1, 1, -1 );
+  createMenu( ImportImageId, aFileId, -1, -1 );
+}
+
+void HYDROGUI_Module::CreatePopups()
+{
+}
+
+void HYDROGUI_Module::CreateToolbars()
+{
+}
+
+void HYDROGUI_Module::onOperation()
+{
+  const QAction* anAction = dynamic_cast<const QAction*>( sender() );
+  int anId = actionId( anAction );
+  if( anId >= 0 )
+    startOperation( anId );
+}
+
+LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
+{
+  LightApp_Operation* anOp = 0;
+  HYDROGUI_Module* aModule = const_cast<HYDROGUI_Module*>( this );
+  switch( theId )
+  {
+  case ImportImageId:
+    anOp = 0;
+    break;
+  }
+
+  if( !anOp )
+    anOp = LightApp_Module::createOperation( theId );
+
+  return anOp;
+}
diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h
new file mode 100644 (file)
index 0000000..75fa414
--- /dev/null
@@ -0,0 +1,12 @@
+
+#ifndef HYDROGUI_OPERATIONS_HEADER
+#define HYDROGUI_OPERATIONS_HEADER
+
+enum OperationId
+{
+  FirstId,
+
+  ImportImageId
+};
+
+#endif
diff --git a/src/HYDROGUI/resources/HYDRO.png b/src/HYDROGUI/resources/HYDRO.png
new file mode 100755 (executable)
index 0000000..7eba0d7
Binary files /dev/null and b/src/HYDROGUI/resources/HYDRO.png differ
diff --git a/src/HYDROGUI/resources/HYDROGUI_images.ts b/src/HYDROGUI/resources/HYDROGUI_images.ts
new file mode 100644 (file)
index 0000000..aec9f52
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE TS>
+<TS version="1.1" >
+  <context>
+    <name>@default</name>
+    <message>
+      <source>TEST_ICO</source>
+      <translation>icon_test.png</translation>
+    </message>
+  </context>
+</TS>
diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts
new file mode 100644 (file)
index 0000000..dd0c858
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE TS>
+<TS version="1.1" >
+  <context>
+    <name>@default</name>
+    <message>
+      <source>TEST</source>
+      <translation>Test</translation>
+    </message>
+  </context>
+</TS>
diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_fr.ts b/src/HYDROGUI/resources/HYDROGUI_msg_fr.ts
new file mode 100644 (file)
index 0000000..dd0c858
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE TS>
+<TS version="1.1" >
+  <context>
+    <name>@default</name>
+    <message>
+      <source>TEST</source>
+      <translation>Test</translation>
+    </message>
+  </context>
+</TS>
diff --git a/src/HYDROGUI/resources/LightApp.xml b/src/HYDROGUI/resources/LightApp.xml
new file mode 100644 (file)
index 0000000..d7895ac
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE document>
+<document>
+  <section name="HYDRO" >
+    <parameter value="HYDRO.png" name="icon" />
+    <parameter value="HYDRO GUI" name="name" />
+    <parameter value="HYDROGUI" name="library" />
+    <parameter value="0" name="parameter_test" />
+  </section>
+  <section name="launch" >
+    <parameter value="HYDRO" name="modules" />
+  </section>
+  <section name="language">
+    <parameter name="language"    value="en"/>
+    <parameter name="translators" value="%P_msg_%L.qm|%P_icons.qm|%P_images.qm"/>
+  </section>
+  <section name="resources" >
+    <parameter value="${HYDRORes}" name="HYDRO" />
+  </section>
+</document>
diff --git a/src/HYDROGUI/resources/SalomeApp.xml b/src/HYDROGUI/resources/SalomeApp.xml
new file mode 100644 (file)
index 0000000..d7895ac
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE document>
+<document>
+  <section name="HYDRO" >
+    <parameter value="HYDRO.png" name="icon" />
+    <parameter value="HYDRO GUI" name="name" />
+    <parameter value="HYDROGUI" name="library" />
+    <parameter value="0" name="parameter_test" />
+  </section>
+  <section name="launch" >
+    <parameter value="HYDRO" name="modules" />
+  </section>
+  <section name="language">
+    <parameter name="language"    value="en"/>
+    <parameter name="translators" value="%P_msg_%L.qm|%P_icons.qm|%P_images.qm"/>
+  </section>
+  <section name="resources" >
+    <parameter value="${HYDRORes}" name="HYDRO" />
+  </section>
+</document>
index 974155b0b6ca12e36838e51a2785f4785cbef311..d327fc98e8e36280ff64a8cc1fe5cf1afd55cb93 100644 (file)
@@ -9,6 +9,8 @@
 #include<ImageComposer_FuseOperator.h>
 #include<ImageComposer_Image.h>
 
+#include <typeinfo>
+
 // global instance
 HYDROOperations_Factory* FACTORY = 0;