From: admin Date: Mon, 30 Jun 2008 06:52:58 +0000 (+0000) Subject: This commit was generated by cvs2git to create tag 'V4_1_0rc1'. X-Git-Tag: V4_1_0rc1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9246871485649d65c611d5a818e2363466e0869d;p=modules%2Fgui.git This commit was generated by cvs2git to create tag 'V4_1_0rc1'. Sprout from BR_Dev_For_4_0 2007-11-08 11:54:03 UTC mkr 'IMP NPAL13547: Checkbox to kill SALOME completely.' Cherrypick from master 2008-03-07 07:44:13 UTC jfa 'Join modifications from BR_Dev_For_4_0 tag V4_1_1.': doc/salome/gui/GUI/images/plot2d_clone.gif doc/salome/gui/GUI/images/plot2d_legend.gif doc/salome/gui/GUI/images/plot2d_lines.gif doc/salome/gui/GUI/images/plot2d_logarithmic_horizontal.gif doc/salome/gui/GUI/images/plot2d_logarithmic_vertical.gif doc/salome/gui/GUI/images/plot2d_points.gif doc/salome/gui/GUI/images/plot2d_settings.gif doc/salome/gui/GUI/images/plot2d_splines.gif doc/salome/gui/GUI/images/plot2d_view_settings.png doc/salome/gui/GUI/images/pref40.png doc/salome/gui/GUI/images/updaterate.png doc/salome/gui/GUI/images/urbutton.png doc/salome/gui/GUI/input/plot2d_viewer.doc src/ObjBrowser/OB_FindDlg.cxx src/ObjBrowser/OB_FindDlg.h src/ObjBrowser/OB_ObjSearch.cxx src/ObjBrowser/OB_ObjSearch.h src/SUIT/SUIT_MsgDlg.h src/SalomeApp/SalomeApp_ExitDlg.cxx src/SalomeApp/SalomeApp_ExitDlg.h Cherrypick from V4_1_0_maintainance 2008-06-30 06:52:56 UTC mkr 'Fix for bug 0019905: EDF 783 ALL: Default button at activation of a module for a new study.': doc/salome/gui/GUI/images/occviewer_axialscale.png doc/salome/gui/GUI/images/occviewer_toolbar.png doc/salome/gui/GUI/images/polyselection1.png doc/salome/gui/GUI/images/polyselection2.png src/OCCViewer/OCCViewer_AxialScaleDlg.cxx src/OCCViewer/OCCViewer_AxialScaleDlg.h src/OCCViewer/resources/view_scaling.png src/SUIT/SUIT_MsgDlg.cxx --- diff --git a/doc/salome/gui/GUI/images/occviewer_axialscale.png b/doc/salome/gui/GUI/images/occviewer_axialscale.png new file mode 100644 index 000000000..82277c3fe Binary files /dev/null and b/doc/salome/gui/GUI/images/occviewer_axialscale.png differ diff --git a/doc/salome/gui/GUI/images/occviewer_toolbar.png b/doc/salome/gui/GUI/images/occviewer_toolbar.png new file mode 100644 index 000000000..611504328 Binary files /dev/null and b/doc/salome/gui/GUI/images/occviewer_toolbar.png differ diff --git a/doc/salome/gui/GUI/images/plot2d_clone.gif b/doc/salome/gui/GUI/images/plot2d_clone.gif new file mode 100644 index 000000000..f980a5dd2 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_clone.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_legend.gif b/doc/salome/gui/GUI/images/plot2d_legend.gif new file mode 100644 index 000000000..a40211e8a Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_legend.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_lines.gif b/doc/salome/gui/GUI/images/plot2d_lines.gif new file mode 100644 index 000000000..8d1dc2313 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_lines.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_logarithmic_horizontal.gif b/doc/salome/gui/GUI/images/plot2d_logarithmic_horizontal.gif new file mode 100644 index 000000000..3473ad94a Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_logarithmic_horizontal.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_logarithmic_vertical.gif b/doc/salome/gui/GUI/images/plot2d_logarithmic_vertical.gif new file mode 100644 index 000000000..0d3b25ef4 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_logarithmic_vertical.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_points.gif b/doc/salome/gui/GUI/images/plot2d_points.gif new file mode 100644 index 000000000..6700f0078 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_points.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_settings.gif b/doc/salome/gui/GUI/images/plot2d_settings.gif new file mode 100644 index 000000000..87e1105c6 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_settings.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_splines.gif b/doc/salome/gui/GUI/images/plot2d_splines.gif new file mode 100644 index 000000000..1d50b2097 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_splines.gif differ diff --git a/doc/salome/gui/GUI/images/plot2d_view_settings.png b/doc/salome/gui/GUI/images/plot2d_view_settings.png new file mode 100644 index 000000000..d4b4d29c2 Binary files /dev/null and b/doc/salome/gui/GUI/images/plot2d_view_settings.png differ diff --git a/doc/salome/gui/GUI/images/polyselection1.png b/doc/salome/gui/GUI/images/polyselection1.png new file mode 100755 index 000000000..1920e972d Binary files /dev/null and b/doc/salome/gui/GUI/images/polyselection1.png differ diff --git a/doc/salome/gui/GUI/images/polyselection2.png b/doc/salome/gui/GUI/images/polyselection2.png new file mode 100755 index 000000000..8467a4df3 Binary files /dev/null and b/doc/salome/gui/GUI/images/polyselection2.png differ diff --git a/doc/salome/gui/GUI/images/pref40.png b/doc/salome/gui/GUI/images/pref40.png new file mode 100755 index 000000000..e86c1e250 Binary files /dev/null and b/doc/salome/gui/GUI/images/pref40.png differ diff --git a/doc/salome/gui/GUI/images/updaterate.png b/doc/salome/gui/GUI/images/updaterate.png new file mode 100755 index 000000000..4a6c29981 Binary files /dev/null and b/doc/salome/gui/GUI/images/updaterate.png differ diff --git a/doc/salome/gui/GUI/images/urbutton.png b/doc/salome/gui/GUI/images/urbutton.png new file mode 100755 index 000000000..d7c0841e3 Binary files /dev/null and b/doc/salome/gui/GUI/images/urbutton.png differ diff --git a/doc/salome/gui/GUI/input/plot2d_viewer.doc b/doc/salome/gui/GUI/input/plot2d_viewer.doc new file mode 100644 index 000000000..e6208d618 --- /dev/null +++ b/doc/salome/gui/GUI/input/plot2d_viewer.doc @@ -0,0 +1,94 @@ +/*! + +\page plot2d_viewer_page Plot 2D viewer + +\n Plot 2d viewer is destined to the representation of 2d +plots and graphs in Post-Pro module. +\n Its viewer toolbar gives you fast access to the following +operations: + +\image html image77.gif +
Dump View - exports an object from the viewer in bmp, +png, jpg or jpeg image format.
+ +\image html image96.gif +
Fit all - scales the display to show the entire +scene. Use this to resize the scene so that it could fit within the +Viewer boundary.
+ +\image html image97.gif +
Fit area - resizes the view to place in the visible +area only the contents of a frame drawn with pressed left mouse +button.
+ +\image html image98.gif +
Zoom - allows to zoom in and out.
+ +\image html image99.gif +
\b Panning - if the represented objects are greater that the +visible area and you don't wish to use Fit all functionality, click on +this button and you'll be able to drag the scene to see its remote +parts.
+ +\image html image100.gif +
Global panning - allows to define the center of the +scene presenting all displayed objects in the visible area.
+ +\image html plot2d_points.gif +
Draw Points - represents points on the graph.
+ +\image html plot2d_lines.gif +
Draw Lines - represents lines on the graph.
+ +\image html plot2d_splines.gif +
Draw Splines - represents splines on the graph.
+ +\image html plot2d_logarithmic_horizontal.gif +
Horizontal axis logarithmic - changes the scaling on +horizontal axis to logarithmic.
+ +\image html plot2d_logarithmic_vertical.gif +
Vertical axis logarithmic - changes the scaling on vertical +axis to logarithmic.
+ +\image html plot2d_legend.gif +
Show Legend - reveals all verbal and numerical +information on the graphs.
+ +\image html plot2d_settings.gif +
\b Settings - calls a menu, in which you can specify advanced +settings for your Plot 2d Viewer.
+ +\image html plot2d_clone.gif +
Clone view - opens a new duplicate scene.
+ +\anchor settings +\n \image html plot2d_view_settings.png + +The options are as follows: +
    +
  • Main title: the title of the XY plot. By default, it will +consist of the names of the tables, on the basis of which the curve +lines have been constructed.
  • +
  • Curve type: you can select from \b Points, \b Lines and \b Spline.
  • +
  • Show legend: here you can define the position of the +description table on the XY plot (to the \b Left, to the \b Right, on +\b Top or on \b Bottom).
  • +
  • Marker size - size of the points (markers) forming curve lines.
  • +
  • Background color of the XY plot.
  • +
  • Scale mode: here you can select the type of scaling (\b +Linear or \b Logarithmic) along X (Horizontal) or Y (Vertical) axes.
  • +
+ +You can define settings for each axis separately: +
    +
  • \b Horizontal or \b Vertical axis title.
  • +
  • Grid/Axes marks: here you can define the maximum number of major +and minor scale divisions for a specified axis. The real number of +intervals fits to {1,2,5}*10^N, where N is a natural number, and +doesn't exceed the maximum.
  • +
  • Save settings as default: If this check box is marked, all +XY plots will be displayed with these defined properties.
  • +
+ +*/ diff --git a/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx b/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx new file mode 100644 index 000000000..83f206822 --- /dev/null +++ b/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx @@ -0,0 +1,191 @@ +// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA 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 "OCCViewer_AxialScaleDlg.h" +#include "OCCViewer_ViewWindow.h" +#include "OCCViewer_ViewPort3d.h" + +#include + +#include "QtxDblSpinBox.h" + +#include +#include +#include +#include + +/*! + Constructor + \param view - view window + \param parent - parent widget + \param name - dialog name + \param modal - is this dialog modal + \param fl - flags +*/ +OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, WFlags fl ) +: QDialog( parent, "OCCViewer_AxialScaleDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), + myView( view ) +{ + setCaption( tr( "DLG_SCALING" ) ); + + setSizeGripEnabled(TRUE); + + // Create layout for this dialog + QGridLayout* layoutDlg = new QGridLayout (this); + layoutDlg->setSpacing(6); + layoutDlg->setMargin(11); + + // Create croup box with grid layout + QGroupBox* aGroupBox = new QGroupBox(this, "GroupBox"); + QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox); + aHBoxLayout->setMargin(11); + aHBoxLayout->setSpacing(6); + + // "X" scaling + QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox, "TextLabelX"); + TextLabelX->setFixedWidth(15); + m_sbXcoeff = new QtxDblSpinBox(1e-7, RealLast(), 0.1, aGroupBox); + m_sbXcoeff->setMinimumWidth(80); + m_sbXcoeff->setValue(1.0); + + // "Y" scaling + QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox, "TextLabelY"); + TextLabelY->setFixedWidth(15); + m_sbYcoeff = new QtxDblSpinBox(1e-7, RealLast(), 0.1, aGroupBox); + m_sbYcoeff->setMinimumWidth(80); + m_sbYcoeff->setValue(1.0); + + // "Z" scaling + QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox, "TextLabelZ"); + TextLabelZ->setFixedWidth(15); + m_sbZcoeff = new QtxDblSpinBox(1e-7, RealLast(), 0.1, aGroupBox); + m_sbZcoeff->setMinimumWidth(80); + m_sbZcoeff->setValue(1.0); + + // Create button + m_bReset = new QPushButton(tr("&Reset"), aGroupBox, "m_bReset"); + + // Layout widgets in the group box + aHBoxLayout->addWidget(TextLabelX); + aHBoxLayout->addWidget(m_sbXcoeff); + aHBoxLayout->addWidget(TextLabelY); + aHBoxLayout->addWidget(m_sbYcoeff); + aHBoxLayout->addWidget(TextLabelZ); + aHBoxLayout->addWidget(m_sbZcoeff); + //aHBoxLayout->addStretch(); + aHBoxLayout->addWidget(m_bReset); + + // OK, CANCEL, Apply button + QGroupBox* aGroupBox2 = new QGroupBox(this); + QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox2); + aHBoxLayout2->setMargin(11); + aHBoxLayout2->setSpacing(6); + // Create button + QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2, "m_bOk"); + m_bOk->setDefault(TRUE); + m_bOk->setAutoDefault(TRUE); + // Create button + QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2, "m_bApply"); + m_bApply->setAutoDefault(TRUE); + // Create button + QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2, "m_bCancel"); + m_bCancel->setAutoDefault(TRUE); + + // Layout buttons + aHBoxLayout2->addWidget(m_bOk); + aHBoxLayout2->addWidget(m_bApply); + aHBoxLayout2->addStretch(); + aHBoxLayout2->addWidget(m_bCancel); + + // Layout top level widgets + layoutDlg->addWidget(aGroupBox,0,0); + layoutDlg->addWidget(aGroupBox2,1,0); + + // signals and slots connections + connect(m_bCancel, SIGNAL(clicked()), this, SLOT(onClickClose())); + connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk())); + connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply())); + connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset())); + + connect(view, SIGNAL(Hide( QHideEvent * )), this, SLOT(onViewHide())); + + this->resize(100, this->sizeHint().height()); +} + +/*! + Destructor + Destroys the object and frees any allocated resources +*/ +OCCViewer_AxialScaleDlg::~OCCViewer_AxialScaleDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +void +OCCViewer_AxialScaleDlg +::Update() +{ + // Get values from the OCC view + Standard_Real aScaleFactor[3]; + myView->getViewPort()->getView()->AxialScale(aScaleFactor[0],aScaleFactor[1],aScaleFactor[2]); + m_sbXcoeff->setValue(aScaleFactor[0]); + m_sbYcoeff->setValue(aScaleFactor[1]); + m_sbZcoeff->setValue(aScaleFactor[2]); +} + +void +OCCViewer_AxialScaleDlg +::onClickOk() +{ + //apply changes + onClickApply(); + //Close dialog + accept(); +} + +void +OCCViewer_AxialScaleDlg +::onClickApply() +{ + double aScaleFactor[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()}; + myView->getViewPort()->getView()->SetAxialScale(aScaleFactor[0],aScaleFactor[1],aScaleFactor[2]); +} + +void +OCCViewer_AxialScaleDlg +::onClickReset() +{ + m_bReset->setFocus(); + m_sbXcoeff->setValue(1.0); + m_sbYcoeff->setValue(1.0); + m_sbZcoeff->setValue(1.0); +} + +void +OCCViewer_AxialScaleDlg +::onClickClose() +{ + reject(); +} + +void OCCViewer_AxialScaleDlg::onViewHide() +{ + hide(); +} + diff --git a/src/OCCViewer/OCCViewer_AxialScaleDlg.h b/src/OCCViewer/OCCViewer_AxialScaleDlg.h new file mode 100644 index 000000000..c0dc9ed73 --- /dev/null +++ b/src/OCCViewer/OCCViewer_AxialScaleDlg.h @@ -0,0 +1,62 @@ +// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA 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 OCCVIEWER_AXIALSCALEDLG_H +#define OCCVIEWER_AXIALSCALEDLG_H + +#include "OCCViewer.h" + +#include + +class OCCViewer_ViewWindow; + +class QtxDblSpinBox; +class QPushButton; + +/*! + \class OCCViewer_AxialScaleDlg + \brief Dialog allowing to assign parameters of axes scaling +*/ +class OCCViewer_AxialScaleDlg : public QDialog +{ + Q_OBJECT + + public: + OCCViewer_AxialScaleDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + ~OCCViewer_AxialScaleDlg(); + + void Update(); + +protected: + OCCViewer_ViewWindow *myView; + + QtxDblSpinBox* m_sbXcoeff; + QtxDblSpinBox* m_sbYcoeff; + QtxDblSpinBox* m_sbZcoeff; + QPushButton* m_bReset; + +protected slots: + void onClickApply(); + void onClickReset(); + void onClickOk(); + void onClickClose(); + + void onViewHide(); +}; + +#endif // OCCVIEWER_AXIALSCALEDLG_H diff --git a/src/OCCViewer/resources/view_scaling.png b/src/OCCViewer/resources/view_scaling.png new file mode 100644 index 000000000..5d3443634 Binary files /dev/null and b/src/OCCViewer/resources/view_scaling.png differ diff --git a/src/ObjBrowser/OB_FindDlg.cxx b/src/ObjBrowser/OB_FindDlg.cxx new file mode 100644 index 000000000..07ed30dd5 --- /dev/null +++ b/src/ObjBrowser/OB_FindDlg.cxx @@ -0,0 +1,92 @@ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +OB_FindDlg::OB_FindDlg( QWidget* parent ) +: QGroupBox( 1, Qt::Horizontal, tr( "FIND" ), parent ), + mySearch( 0 ) +{ + QFrame *btns = new QFrame( this ), *checks = new QFrame( this ); + + myData = new QLineEdit( btns ); + myToFirst = new QPushButton( "|<<", btns ); + myToLast = new QPushButton( ">>|", btns ); + myNext = new QPushButton( ">>", btns ); + myPrev = new QPushButton( "<<", btns ); + myClose = new QPushButton( tr( "CLOSE" ), checks ); + myIsCaseSens = new QCheckBox( tr( "CASE_SENSITIVE" ), checks ); + myIsRegExp = new QCheckBox( tr( "IS_REG_EXP" ), checks ); + int w = 30, h = myToFirst->height(); + myToFirst->setMaximumSize( w, h ); + myToLast->setMaximumSize( w, h ); + myNext->setMaximumSize( w, h ); + myPrev->setMaximumSize( w, h ); + + QHBoxLayout* l = new QHBoxLayout( btns, 5, 5 ); + l->addWidget( myToFirst, 0 ); + l->addWidget( myPrev, 0 ); + l->addWidget( myData, 1 ); + l->addWidget( myNext, 0 ); + l->addWidget( myToLast, 0 ); + + QHBoxLayout* c = new QHBoxLayout( checks, 5, 5 ); + c->addWidget( myIsCaseSens, 0 ); + c->addWidget( myIsRegExp, 0 ); + c->addWidget( myClose, 0 ); + + connect( myToFirst, SIGNAL( clicked() ), this, SLOT( onFind() ) ); + connect( myToLast, SIGNAL( clicked() ), this, SLOT( onFind() ) ); + connect( myNext, SIGNAL( clicked() ), this, SLOT( onFind() ) ); + connect( myPrev, SIGNAL( clicked() ), this, SLOT( onFind() ) ); + connect( myClose, SIGNAL( clicked() ), this, SLOT( onClose() ) ); +} + +OB_FindDlg::~OB_FindDlg() +{ +} + +void OB_FindDlg::onClose() +{ + hide(); +} + +void OB_FindDlg::onFind() +{ + OB_ListItem* it = 0; + mySearch->setPattern( myData->text(), myIsRegExp->isChecked(), myIsCaseSens->isChecked() ); + if( sender()==myToFirst ) + it = mySearch->findFirst(); + else if( sender()==myNext ) + it = mySearch->findNext(); + else if( sender()==myPrev ) + it = mySearch->findPrev(); + else if( sender()==myToLast ) + it = mySearch->findLast(); + if( it ) + { + mySearch->browser()->setSelected( it->dataObject(), false ); + mySearch->browser()->listView()->ensureItemVisible( it ); + } + else + SUIT_MessageBox::info1( this, tr( "FIND" ), tr( "NOT_FOUND" ), tr( "OK" ) ); +} + +OB_ObjSearch* OB_FindDlg::getSearch() const +{ + return mySearch; +} + +void OB_FindDlg::setSearch( OB_ObjSearch* s ) +{ + mySearch = s; +} diff --git a/src/ObjBrowser/OB_FindDlg.h b/src/ObjBrowser/OB_FindDlg.h new file mode 100644 index 000000000..4c8230d81 --- /dev/null +++ b/src/ObjBrowser/OB_FindDlg.h @@ -0,0 +1,34 @@ + +#ifndef OBJECT_BROWSER_FIND_DIALOG_HEADER +#define OBJECT_BROWSER_FIND_DIALOG_HEADER + +#include + +class OB_ObjSearch; +class QLineEdit; +class QPushButton; +class QCheckBox; + +class OB_FindDlg : public QGroupBox +{ + Q_OBJECT + +public: + OB_FindDlg( QWidget* = 0 ); + virtual ~OB_FindDlg(); + + OB_ObjSearch* getSearch() const; + void setSearch( OB_ObjSearch* ); + +private slots: + void onFind(); + void onClose(); + +private: + QLineEdit* myData; + QPushButton *myToFirst, *myToLast, *myNext, *myPrev, *myClose; + QCheckBox *myIsCaseSens, *myIsRegExp; + OB_ObjSearch* mySearch; +}; + +#endif diff --git a/src/ObjBrowser/OB_ObjSearch.cxx b/src/ObjBrowser/OB_ObjSearch.cxx new file mode 100644 index 000000000..84d9c2c61 --- /dev/null +++ b/src/ObjBrowser/OB_ObjSearch.cxx @@ -0,0 +1,107 @@ + +#include +#include +#include + +#include + +OB_ObjSearch::OB_ObjSearch( OB_Browser* b ) +: myBrowser( b ) +{ +} + +OB_ObjSearch::~OB_ObjSearch() +{ +} + +OB_ListItem* OB_ObjSearch::tail( const bool first ) const +{ + QListView* lv = myBrowser->listView(); + return dynamic_cast( first ? lv->firstChild() : lv->lastItem() ); +} + +OB_ListItem* OB_ObjSearch::next( OB_ListItem* i, const bool forward ) const +{ + QListViewItemIterator it( i ); + if( forward ) + it++; + else + it--; + return dynamic_cast( *it ); +} + +SUIT_DataObject* OB_ObjSearch::data( OB_ListItem* i ) const +{ + return i ? i->dataObject() : 0; +} + +void OB_ObjSearch::setPattern( const QString& data, const bool is_reg_exp, const bool is_case_sens ) +{ + myData = data; + myIsRegExp = is_reg_exp; + myIsCaseSens = is_case_sens; +} + +bool OB_ObjSearch::matches( SUIT_DataObject* obj ) const +{ + if( !obj ) + return false; + + QString txt = obj->name(); + if( myIsRegExp ) + { + QRegExp re( myData ); + re.setCaseSensitive( myIsCaseSens ); + return txt.contains( re ); + } + else + return txt.contains( myData, myIsCaseSens ); +} + +OB_Browser* OB_ObjSearch::browser() const +{ + return myBrowser; +} + +OB_ListItem* OB_ObjSearch::findFirst() const +{ + return find( tail( true ), true, false, false ); +} + +OB_ListItem* OB_ObjSearch::findLast() const +{ + return find( tail( false ), false, false, false ); +} + +OB_ListItem* OB_ObjSearch::findNext() const +{ + return find( current(), true, true, true ); +} + +OB_ListItem* OB_ObjSearch::findPrev() const +{ + return find( current(), false, true, true ); +} + +OB_ListItem* OB_ObjSearch::find( OB_ListItem* i, const bool forward, + const bool ignore_first, const bool cyclic ) const +{ + if( !i ) + i = tail( forward ); + + if( ignore_first ) + i = next( i, forward ); + + while( i && !matches( data( i ) ) ) + i = next( i, forward ); + + if( !i && cyclic ) + return find( tail( forward ), forward, false, false ); + + return i; +} + +OB_ListItem* OB_ObjSearch::current() const +{ + return dynamic_cast( myBrowser->listView()->currentItem() ); +} diff --git a/src/ObjBrowser/OB_ObjSearch.h b/src/ObjBrowser/OB_ObjSearch.h new file mode 100644 index 000000000..6106d9fef --- /dev/null +++ b/src/ObjBrowser/OB_ObjSearch.h @@ -0,0 +1,39 @@ + +#ifndef OBJECT_BROWSER_OBJECT_SEARCH_HEADER +#define OBJECT_BROWSER_OBJECT_SEARCH_HEADER + +#include + +class OB_ListItem; +class OB_Browser; +class SUIT_DataObject; + +class OB_ObjSearch +{ +public: + OB_ObjSearch( OB_Browser* ); + virtual ~OB_ObjSearch(); + + void setPattern( const QString&, const bool, const bool ); + OB_Browser* browser() const; + + OB_ListItem* findFirst() const; + OB_ListItem* findLast() const; + OB_ListItem* findNext() const; + OB_ListItem* findPrev() const; + +protected: + virtual OB_ListItem* current() const; + virtual OB_ListItem* tail( const bool ) const; + virtual OB_ListItem* next( OB_ListItem*, const bool ) const; + virtual SUIT_DataObject* data( OB_ListItem* ) const; + virtual bool matches( SUIT_DataObject* ) const; + OB_ListItem* find( OB_ListItem*, const bool, const bool, const bool ) const; + +private: + OB_Browser* myBrowser; + QString myData; + bool myIsRegExp, myIsCaseSens; +}; + +#endif diff --git a/src/SUIT/SUIT_MsgDlg.cxx b/src/SUIT/SUIT_MsgDlg.cxx new file mode 100644 index 000000000..96e8a616d --- /dev/null +++ b/src/SUIT/SUIT_MsgDlg.cxx @@ -0,0 +1,227 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 +// +// File : SUIT_MsgDlg.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// + +#include "SUIT_MsgDlg.h" + +#include +#include +#include + +/*! + \class SUIT_MsgDlg + \brief Information message dialog box with custom number of buttons. + + The class provides a functionality to display message box with the custom number + of buttons. Each button is identified by the unique non-zero number which can + be tested after dialog box finishes its execution. Pressing each button except + causes dialog box to finish execution with return status equal to the button + identifier. In addition, pressing "Cancel" button finishes dialog box execution + wih return status 0. + + It is also possible to display custom pixmap or icon at the left side of the + dialog box. Pass the required pixmap to the constructor or use method setPixmap(). + + The typical usage of the dialog box: + \code + SUIT_MsgDlg dlg( this, tr( "Warning!" ), + tr( "File %s exists. Overwrite?" ).arg( files[i] ), + QMessageBox::standardIcon( QMessageBox::Warning ) ); + dlg.addButton( "Yes", YesId ); + dlg.addButton( "No", NoId ); + dlg.addButton( "Yes to all", YesAllId ); + dlg.addButton( "No to all", NoAllId ); + int ret = dlg.exec(); + switch( ret ) { + case YesId: + // process one file + processOneFile(); + break; + case NoId: + // skip current file processing and proceed to the next file + break; + case YesAllId: + // process all files + processAllFiles(); + stopped = true; + break; + case NoAllId: + // skip all process all files + processAllFiles(); + break; + default: + // operation is cancelled + break; + } + \endcode + + \sa addButton(), setPixmap() +*/ + +/*! + \brief Constructor. + \param parent parent widget + \param title dialog box caption + \param msg dialog box message + \param icon dialog box icon +*/ +SUIT_MsgDlg::SUIT_MsgDlg( QWidget* parent, + const QString& title, + const QString& msg, + const QPixmap& icon ) +: QDialog ( parent, "SUIT_MsgDlg", true ) +{ + // title + setCaption( title ); + + // icon + myIconLab = new QLabel( this ); + myIconLab->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + myIconLab->setScaledContents( false ); + myIconLab->setAlignment( Qt::AlignCenter ); + + if ( !icon.isNull() ) + myIconLab->setPixmap( icon ); + + // info message + myMsgLab = new QLabel( msg, this ); + myMsgLab->setTextFormat( Qt::RichText ); + myMsgLab->setAlignment( Qt::AlignCenter ); + + // Buttons + myButtonLayout = new QHBoxLayout(); + myButtonLayout->setMargin( 0 ); + myButtonLayout->setSpacing( 6 ); + + // + QPushButton* cancelBtn = new QPushButton( tr( "CANCEL" ), this ); + myButtonLayout->addSpacing( 20 ); + myButtonLayout->addStretch(); + myButtonLayout->addWidget( cancelBtn ); + + QGridLayout* layout = new QGridLayout( this ); + layout->setMargin( 11 ); + layout->setSpacing( 6 ); + + layout->addWidget( myIconLab, 0, 0 ); + layout->addWidget( myMsgLab, 0, 1 ); + layout->addMultiCellLayout( myButtonLayout, 1, 1, 0, 1 ); + + // signals and slots connections + connect( cancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/*! + \brief Destructor. +*/ +SUIT_MsgDlg::~SUIT_MsgDlg() +{ +} + +/*! + \brief Add operation button to the dialog box. + + If the parameter \a id is equal to -1, then the + button identifier is generated automatically. + + \param btext button text + \param id button identifier + \return button identifier +*/ +int SUIT_MsgDlg::addButton( const QString& btext, const int id ) +{ + static int lastId = 0; + int bid = id == -1 ? --lastId : id; + + QPushButton* b = button( bid ); + if ( b ) { + myButtons.remove( b ); + delete b; + } + + QPushButton* newButton = new QPushButton( btext, this ); + + myButtonLayout->insertWidget( myButtons.count(), newButton ); + + if ( myButtons.empty() ) newButton->setDefault(true); + + myButtons.insert( newButton, bid ); + connect( newButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); + + return bid; +} + +/*! + \brief Set icon to the dialog box + \param icon pixmap +*/ +void SUIT_MsgDlg::setPixmap( const QPixmap& icon ) +{ + myIconLab->setPixmap( icon ); +} + + +/*! + \brief Called when any dialog button (except \c Cancel) + is clicked. + + Closes the dialog and sets its result code to the identifier + of the button clicked by the user. +*/ +void SUIT_MsgDlg::accept() +{ + QPushButton* btn = ( QPushButton* )sender(); + done( myButtons[ btn ] ); +} + +/*! + \brief Search button with the specified identifier. + \param id button identifier + \return button or 0 if \a id is invalid +*/ +QPushButton* SUIT_MsgDlg::button( const int id ) const +{ + QPushButton* btn = 0; + for ( ButtonMap::ConstIterator it = myButtons.begin(); + it != myButtons.end() && !btn; ++it ) { + if ( it.data() == id ) + btn = it.key(); + } + return btn; +} + +/*! + \brief Get information icon label. + \return information icon label +*/ +QLabel* SUIT_MsgDlg::iconLabel() const +{ + return myIconLab; +} + +/*! + \brief Get information message label. + \return information message label +*/ +QLabel* SUIT_MsgDlg::messageLabel() const +{ + return myMsgLab; +} diff --git a/src/SUIT/SUIT_MsgDlg.h b/src/SUIT/SUIT_MsgDlg.h new file mode 100644 index 000000000..e7f0e816c --- /dev/null +++ b/src/SUIT/SUIT_MsgDlg.h @@ -0,0 +1,66 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 +// +// File : SUIT_MsgDlg.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// + +#ifndef SUIT_MSGDLG_H +#define SUIT_MSGDLG_H + +#include "SUIT.h" + +#include +#include +#include + +class QLabel; +class QPushButton; +class QHBoxLayout; + +class SUIT_EXPORT SUIT_MsgDlg : public QDialog +{ + Q_OBJECT + +public: + SUIT_MsgDlg( QWidget*, const QString&, const QString&, const QPixmap& = QPixmap() ) ; + ~SUIT_MsgDlg(); + + int addButton( const QString&, const int = -1); + void setPixmap( const QPixmap& ); + +public slots: + void accept(); + +protected: + QPushButton* button( const int ) const; + QLabel* iconLabel() const; + QLabel* messageLabel() const; + +private: + typedef QMap ButtonMap; + +private: + ButtonMap myButtons; + QHBoxLayout* myButtonLayout; + QLabel* myIconLab; + QLabel* myMsgLab; +}; + +#endif // SUIT_MSGDLG_H + diff --git a/src/SalomeApp/SalomeApp_ExitDlg.cxx b/src/SalomeApp/SalomeApp_ExitDlg.cxx new file mode 100644 index 000000000..f01d581c9 --- /dev/null +++ b/src/SalomeApp/SalomeApp_ExitDlg.cxx @@ -0,0 +1,104 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 +// +// File: SalomeApp_ExitDlg.cxx +// Author: Margarita KARPUNINA, Open CASCADE S.A.S. +// + +#include "SalomeApp_ExitDlg.h" + +#include +#include +#include +#include +#include + +/*! + * \brief creates a Exit dialog box + * \param parent a parent widget + * \param modal bool argument, if true the dialog box is a modal dialog box + * \param f style flags + */ +SalomeApp_ExitDlg::SalomeApp_ExitDlg( QWidget* parent ) + : QDialog( parent, "SalomeApp_ExitDlg", true ) +{ + setSizeGripEnabled( true ); + setCaption( tr( "INF_DESK_EXIT" ) ); + + QVBoxLayout* m_vbL = new QVBoxLayout( this ); + m_vbL->setMargin( 11 ); + m_vbL->setSpacing( 6 ); + + QLabel* m_lIcon = new QLabel( this, "m_lDescr" ); + QPixmap pm = QMessageBox::standardIcon( QMessageBox::Question ); + m_lIcon->setPixmap( pm ); + m_lIcon->setScaledContents( false ); + m_lIcon->setAlignment( Qt::AlignCenter ); + + QLabel* m_lDescr = new QLabel (this, "m_lDescr"); + m_lDescr->setText ( tr ("QUE_DESK_EXIT") ); + m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + myServersShutdown = new QCheckBox( tr("SHUTDOWN_SERVERS"), this ); + myServersShutdown->setChecked(true); + + QVBoxLayout* m_vl1 = new QVBoxLayout(); + m_vl1->setMargin( 10 ); m_vl1->setSpacing( 16 ); + m_vl1->addWidget( m_lDescr ); + m_vl1->addWidget( myServersShutdown ); + + QHBoxLayout* m_hl1 = new QHBoxLayout(); + m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 ); + m_hl1->addWidget( m_lIcon ); + m_hl1->addStretch(); + m_hl1->addLayout( m_vl1 ); + m_hl1->addStretch(); + + QPushButton* m_pbOk = new QPushButton( tr( "BUT_OK" ), this ); + QPushButton* m_pbCancel = new QPushButton( tr( "BUT_CANCEL" ), this ); + + QGridLayout* m_hl2 = new QGridLayout(); + m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 ); + m_hl2->addWidget( m_pbOk, 0, 0 ); + m_hl2->setColStretch( 1, 5 ); + m_hl2->addWidget( m_pbCancel, 0, 2 ); + + m_vbL->addStretch(); + m_vbL->addLayout( m_hl1 ); + m_vbL->addStretch(); + m_vbL->addLayout( m_hl2 ); + + connect( m_pbOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( m_pbCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/*! + * \brief Destructor + */ +SalomeApp_ExitDlg::~SalomeApp_ExitDlg() +{ +} + +/*! + * \brief get the check box status + */ +bool SalomeApp_ExitDlg::isServersShutdown() +{ + return myServersShutdown->isChecked(); +} + diff --git a/src/SalomeApp/SalomeApp_ExitDlg.h b/src/SalomeApp/SalomeApp_ExitDlg.h new file mode 100644 index 000000000..e046291e1 --- /dev/null +++ b/src/SalomeApp/SalomeApp_ExitDlg.h @@ -0,0 +1,48 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 +// +// File: SalomeApp_ExitDlg.h +// Author: Margarita KARPUNINA, Open CASCADE S.A.S. +// + +#ifndef SALOMEAPP_EXITDLG_H +#define SALOMEAPP_EXITDLG_H + +#include + +class QCheckBox; + +/*!\class SalomeApp_ExitDlg + * \brief Describes a dialog box shown on question about quit application + */ +class SalomeApp_ExitDlg: public QDialog +{ + Q_OBJECT + +public: + SalomeApp_ExitDlg( QWidget* ) ; + ~SalomeApp_ExitDlg(); + + bool isServersShutdown(); + +private: + QCheckBox* myServersShutdown; +}; + +#endif // SALOMEAPP_EXITDLG_H +