From 7b6256bc422bcb0298915e5fc57fbfc98d26d959 Mon Sep 17 00:00:00 2001 From: abuhsing Date: Thu, 5 Dec 2013 12:22:57 +0000 Subject: [PATCH] Delete unused files --- src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx | 131 ----------- src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx | 45 ---- .../HEXABLOCKGUI_DocumentDelegate.cxx | 216 ------------------ .../HEXABLOCKGUI_DocumentDelegate.hxx | 87 ------- 4 files changed, 479 deletions(-) delete mode 100644 src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx delete mode 100644 src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx delete mode 100755 src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx delete mode 100755 src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx deleted file mode 100644 index d87fd70..0000000 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D -// -// 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 -// - -#include "HEXABLOCKGUI_Browser.hxx" -#include "HEXABLOCKGUI.hxx" - -#include "Hex.hxx" -#include "HexDocument.hxx" - -#include -#include -#include -#include -#include - -// --------------------------------------------------- classe SaLObject -class SalObject : public LightApp_DataObject -{ -public : - SalObject (cpchar nom="") : LightApp_DataObject (NULL) - { obj_name = nom ; obj_entry = "6.6.66" ; } - - virtual ~SalObject () { cout << "SalObject::delete" << endl ; } - virtual QString name () const { return obj_name ; } - virtual QString entry () const { return obj_entry ; } - void rename (cpchar nom) { obj_name = nom ; } - -private : - QString obj_name; - QString obj_entry; -}; -//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -// --------------------------------------------------- classe SaLModel -class SalModel : public LightApp_DataModel -{ -public : - SalModel (HEXABLOCKGUI* guy); - void clear (); - void addItem (cpchar fils); - -private : - CAM_ModuleObject* obj_root; -}; - -// =================================================== Constructeur SalModel -SalModel::SalModel (HEXABLOCKGUI* guy) - : LightApp_DataModel (guy) -{ -/* ********************************************** - LightApp_Study* study = (LightApp_Study*) guy->activeStudy(); - obj_root = createModuleObject (study->root()); - - obj_root ->setDataModel (this); - setRoot (obj_root); - - SalObject* obj1 = new SalObject ("Document1"); - SalObject* obj2 = new SalObject ("Document2"); - - PutData (obj1->name ().toStdString()); - PutData (obj2->name ().toStdString()); - - obj_root->appendChild (obj1); - obj_root->appendChild (obj2); - PutData (obj_root->childCount()); - - ********************************************** */ -} -// ================================================================ clear -void SalModel::clear () -{ - const bool nodel = false; - while (true) - { - SUIT_DataObject* obj = obj_root->firstChild (); - if (obj==NULL) - return; - obj_root->removeChild (obj, nodel); - cout << " Delete object " << obj->name ().toStdString() - << endl; - } -} -// ================================================================ addItem -void SalModel::addItem (cpchar name) -{ - SalObject* obj1 = new SalObject (name); - obj_root->appendChild (obj1); -} -//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 -// =================================================== Constructeur H.G.Browser -HEXABLOCKGUI_Browser::HEXABLOCKGUI_Browser (HEXABLOCKGUI* guy) -{ - hexa_gui = guy; - hexa_root = HEXA_NS::Hex::getInstance (); - data_model = NULL; -} - -// =============================================================== rebuildTree -void HEXABLOCKGUI_Browser::rebuildTree () -{ - if (data_model==NULL) - data_model = new SalModel (hexa_gui); - - data_model->clear (); - - int nbre = hexa_root->countDocument (); - for (int nro=0 ; nrogetDocument (nro); - cpchar nom = doc->getName (); - data_model->addItem (nom); - } - - hexa_gui->updateObjBrowser( true ); -} - diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx deleted file mode 100644 index cd16e5d..0000000 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D -// -// 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 -// - -#ifndef _HEXABLOCKGUI_BROWSER_HXX_ -#define _HEXABLOCKGUI_BROWSER_HXX_ - -//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 - -#include "hexa_base.hxx" -#include "HEXABLOCKGUI_Export.hxx" - -using namespace Hex; - -class HEXABLOCKGUI; -class SalModel; - -class HEXABLOCK_EXPORT HEXABLOCKGUI_Browser -{ -public : - HEXABLOCKGUI_Browser (HEXABLOCKGUI* dad); - void rebuildTree (); - - -private : - Hex::Hex* hexa_root; - SalModel* data_model; - HEXABLOCKGUI* hexa_gui; -}; -#endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx deleted file mode 100755 index 4d4a27d..0000000 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx +++ /dev/null @@ -1,216 +0,0 @@ - -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D -// -// 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 -// -#include -#include -#include -#include -#include - - -#include "utilities.h" -#include "HEXABLOCKGUI.hxx" - - -#include "HEXABLOCKGUI_DocumentDelegate.hxx" - -using namespace std; -using namespace HEXABLOCK::GUI; - - -//QWidget* currentEditor = NULL; - -DocumentDelegate::DocumentDelegate(QDockWidget *dw, QObject *parent) - : QItemDelegate(parent), - _dw(dw), - _currentEditor(NULL) -{ -} - - -QWidget *DocumentDelegate::createEditor( QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index ) const -{ - //close current editor if there's one before creating a new one - if (_currentEditor != NULL) - { - delete _currentEditor; - _currentEditor = NULL; - } - - HexaBaseDialog *editor = NULL; - - if (_dw->widget()) _dw->widget()->close(); - if ( !_dw->isVisible() ) _dw->setVisible(true); - - switch ( index.data(HEXA_TREE_ROLE).toInt() ) - { - case VERTEX_TREE : editor = new VertexDialog(_dw, HexaBaseDialog::INFO_MODE); break; - case EDGE_TREE : editor = new EdgeDialog(_dw, HexaBaseDialog::INFO_MODE); break; - case QUAD_TREE : editor = new QuadDialog(_dw, HexaBaseDialog::INFO_MODE); break; - case HEXA_TREE : editor = new HexaDialog(_dw, HexaBaseDialog::INFO_MODE); break; - case VECTOR_TREE : editor = new VectorDialog(_dw, HexaBaseDialog::INFO_MODE); break; - -// case ELEMENTS_DIR_TREE : trouver le type exact (cylinder ou pipe) et creer la boite d'info en fonction. - - // * OBSOLETE ****** -// case CYLINDER_TREE : editor = new CylinderDialog(_dw, HexaBaseDialog::INFO_MODE); break; -// case PIPE_TREE : editor = new PipeDialog(_dw, HexaBaseDialog::INFO_MODE); break; - // ****************** - - case GROUP_TREE : editor = new GroupDialog(_dw, HexaBaseDialog::INFO_MODE/*UPDATE_MODE*/); break; - case LAW_TREE : editor = new LawDialog(_dw, HexaBaseDialog::INFO_MODE); break; - case PROPAGATION_TREE : editor = new PropagationDialog(_dw, HexaBaseDialog::INFO_MODE); break; - } - - if ( editor != NULL ) - { - HEXABLOCKGUI::assocInProgress = false; - - //show the editor in the dockwidget - editor->resetSizeAndShow(_dw); - } - else - _dw->close(); - - _currentEditor = editor; - - return editor; -} - -//Close the current edition dialog -void DocumentDelegate::closeDialog() -{ - if (_currentEditor!=NULL) - { - _currentEditor->close(); - emit closeEditor(_currentEditor, NoHint); //Problem - delete _currentEditor; - _currentEditor = NULL; - } -} - -void DocumentDelegate::setEditorData( QWidget *editor, - const QModelIndex &index) const -{ - HexaBaseDialog* hexaEditor = dynamic_cast( editor ); - if (hexaEditor == NULL) return; - DocumentModel* documentModel = hexaEditor->getDocumentModel(); - if (documentModel == NULL) return; - - switch ( index.data(HEXA_TREE_ROLE).toInt() ){ - case VERTEX_TREE : { - HEXA_NS::Vertex *value = documentModel->getHexaPtr(index); - VertexDialog *vertexEditor = static_cast(editor); - vertexEditor->setValue(value); - } - break; - case EDGE_TREE : { - HEXA_NS::Edge *value = documentModel->getHexaPtr(index); - EdgeDialog *edgeEditor = static_cast(editor); - edgeEditor->setValue(value); - } - break; - case QUAD_TREE : { - HEXA_NS::Quad *value = documentModel->getHexaPtr(index); - QuadDialog *quadEditor = static_cast(editor); - quadEditor->setValue(value); - } - break; - case HEXA_TREE : { - HEXA_NS::Hexa *value = documentModel->getHexaPtr(index); - HexaDialog *hexaEditor = static_cast(editor); - hexaEditor->setValue(value); - } - break; - case VECTOR_TREE : { - HEXA_NS::Vector *value = documentModel->getHexaPtr(index); - VectorDialog *vectorEditor = static_cast(editor); - vectorEditor->setValue(value); - } - break; - - /* - case ELEMENTS_DIR_TREE : { - HEXA_NS::Elements* value = documentModel->getHexaPtr(index); - // trouver le type exact (cylinder ou pipe) pour choisir le bon editor - // editor->setValue(value) - } - break; - */ - - // ************ OBSOLETE ******************** -// case CYLINDER_TREE : { -// HEXA_NS::Cylinder *value = documentModel->getHexaPtr(index); -// CylinderDialog *cylinderEditor = static_cast(editor); -// cylinderEditor->setValue(value); -// } -// break; -// case PIPE_TREE : { -// HEXA_NS::Pipe *value = documentModel->getHexaPtr(index); -// PipeDialog *pipeEditor= static_cast(editor); -// pipeEditor->setValue(value); -// } -// break; - // ************ FIN OBSOLETE ***************** - - case GROUP_TREE : { - HEXA_NS::Group *value = index.data( HEXA_DATA_ROLE ).value< HEXA_NS::Group* >(); - GroupDialog *groupEditor = static_cast(editor); - groupEditor->setValue(value); - } - break; - case LAW_TREE : { - HEXA_NS::Law *value = index.data( HEXA_DATA_ROLE ).value< HEXA_NS::Law* >(); - LawDialog *lawEditor = static_cast(editor); - lawEditor->setValue(value); - } - break; - case PROPAGATION_TREE : { - HEXA_NS::Propagation *value = index.data( HEXA_DATA_ROLE ).value< HEXA_NS::Propagation* >(); - PropagationDialog *propagationEditor = static_cast(editor); - propagationEditor->setValue(value); - } - break; - } -} - - -bool DocumentDelegate::editorEvent ( QEvent *event, - QAbstractItemModel *model, - const QStyleOptionViewItem &option, - const QModelIndex &index ) -{ - return QItemDelegate::editorEvent ( event, model, option, index ); -} - -bool DocumentDelegate::eventFilter ( QObject * editor, QEvent * event ) -{ - if ( event->type() == QEvent::FocusOut ){ - return true; //do nothing for this signal - } - else if (event->type() == QEvent::HideToParent && editor != NULL) - { - //close the current editor when the tree is reduced - ((QWidget*) editor->parent())->close(); - } - - return false; -} diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx deleted file mode 100755 index a3cbe06..0000000 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D -// -// 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 -// -#ifndef __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_ -#define __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_ - -#include "HEXABLOCKGUI_Export.hxx" -// QEvent * event, QAbstractItemModel - -#include -#include -#include -#include -#include -#include - -#include - -#include "HEXABLOCKGUI_DocumentModel.hxx" -#include "HEXABLOCKGUI_DocumentSelectionModel.hxx" -#include "HEXABLOCKGUI_DocumentItem.hxx" -#include "HEXABLOCKGUI_DocumentPanel.hxx" - -namespace HEXABLOCK -{ - namespace GUI - { - class HEXABLOCK_EXPORT DocumentDelegate : public QItemDelegate - { - Q_OBJECT - - public: - /// close the editor - void closeDialog(); - - DocumentDelegate( QDockWidget *dw, QObject *parent = 0); - - /// create the editor - QWidget *createEditor( QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index) const; - - /// set editor's data - void setEditorData( QWidget *editor, const QModelIndex &index) const; - - /// set the editor's model - void setModelData( QWidget *editor, - QAbstractItemModel *model, - const QModelIndex &index ) const {}; - - virtual void updateEditorGeometry( QWidget *editor, - const QStyleOptionViewItem &option, - const QModelIndex &index ) const {}; - - protected: - mutable QWidget* _currentEditor; - virtual bool editorEvent ( QEvent * event, - QAbstractItemModel * model, - const QStyleOptionViewItem & option, const QModelIndex & index ); - virtual bool eventFilter ( QObject * editor, QEvent * event ); - - private: - QDockWidget* _dw; // creator's container - - private slots: - // void commitEditor(); - - }; - } -} - -#endif -- 2.39.2