-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// 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 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, or (at your option) any later version.
//
-// 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : Plot2d_SetupCurveDlg.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include "Plot2d_SetupCurveDlg.h"
#include <QtxColorButton.h>
+#ifndef NO_SUIT
#include <SUIT_Tools.h>
+#endif
#include <QGridLayout>
#include <QHBoxLayout>
myLineCombo = new QComboBox( this );
myLineCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myLineCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myLineCombo->setIconSize( QSize( 40, 16 ) );
+ QSize lsz( 40, 16 );
+ myLineCombo->setIconSize( lsz );
// curve width
QLabel* aLineWidthLab = new QLabel( tr( "CURVE_LINE_WIDTH_LAB" ), this );
myMarkerCombo = new QComboBox( this );
myMarkerCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
myMarkerCombo->setMinimumWidth( MIN_COMBO_WIDTH );
- myMarkerCombo->setIconSize( QSize( 16, 16 ) );
+ QSize sz(16, 16);
+ myMarkerCombo->setIconSize(sz);
// curve color
QLabel* aColorLab = new QLabel( tr( "CURVE_COLOR_LAB" ), this );
topLayout->addLayout( btnLayout, 5, 0, 1, 3 );
// fill then combo boxes
- myLineCombo->addItem( lineIcon( Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
- myLineCombo->addItem( lineIcon( Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
-
- myMarkerCombo->addItem( markerIcon( Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
- myMarkerCombo->addItem( markerIcon( Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
+ QColor cl = myLineCombo->palette().color( QPalette::Text );
+
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::NoPen ), tr( "NONE_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Solid ), tr( "SOLID_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Dash ), tr( "DASH_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::Dot ), tr( "DOT_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::DashDot ), tr( "DASHDOT_LINE_LBL" ) );
+ myLineCombo->addItem( Plot2d::lineIcon( lsz, cl, Plot2d::DashDotDot ), tr( "DAHSDOTDOT_LINE_LBL" ) );
+
+ cl = myMarkerCombo->palette().color( QPalette::Text );
+
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::None ), tr( "NONE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Circle ), tr( "CIRCLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Rectangle ), tr( "RECTANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Diamond ), tr( "DIAMOND_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::DTriangle ), tr( "DTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::UTriangle ), tr( "UTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::LTriangle ), tr( "LTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::RTriangle ), tr( "RTRIANGLE_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::Cross ), tr( "CROSS_MARKER_LBL" ) );
+ myMarkerCombo->addItem( Plot2d::markerIcon( sz, cl, Plot2d::XCross ), tr( "XCROSS_MARKER_LBL" ) );
// default settings
setLine( Plot2d::Solid, 0 ); // solid line, width = 0
connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+#ifndef NO_SUIT
SUIT_Tools::centerWidget( this, parent );
+#endif
updatePreview();
}
return myColorBtn->color();
}
-/*!
- \brief Create icon pixmap according to the line type.
- \param type line type
- \return icon
-*/
-QPixmap Plot2d_SetupCurveDlg::lineIcon( Plot2d::LineType type ) const
-{
- QSize sz = myLineCombo->iconSize();
- QPixmap px( sz );
- px.fill( QColor( 255, 255, 255, 0 ) );
- QPainter p( &px );
- Plot2d::drawLine( &p, 5, sz.height()/2, sz.width()-5, sz.height()/2, type,
- myLineCombo->palette().color( QPalette::Text ), 1 );
- return px;
-}
-
-/*!
- \brief Create icon pixmap according to the marker type.
- \param type marker type
- \return icon
-*/
-QPixmap Plot2d_SetupCurveDlg::markerIcon( Plot2d::MarkerType type ) const
-{
- QSize sz = myMarkerCombo->iconSize();
- QPixmap px( sz );
- px.fill( QColor( 255, 255, 255, 0 ) );
- QPainter p( &px );
- Plot2d::drawMarker( &p, sz.width()/2, sz.height()/2, MSIZE, MSIZE, type,
- myMarkerCombo->palette().color( QPalette::Text ) );
- return px;
-}
-
/*
\brief Update preview widget.
*/
QPainter p( &px );
Plot2d::drawLine( &p, 5+MSIZE/2, sz.height()/2, sz.width()-5-MSIZE/2, sz.height()/2,
- getLine(), getColor(), getLineWidth() );
+ getLine(), getColor(), getLineWidth() );
Plot2d::drawMarker( &p, 5+MSIZE/2, sz.height()/2, MSIZE, MSIZE,
- getMarker(), getColor() );
+ getMarker(), getColor() );
Plot2d::drawMarker( &p, sz.width()-5-MSIZE/2, sz.height()/2, MSIZE, MSIZE,
- getMarker(), getColor() );
+ getMarker(), getColor() );
myPreview->setPixmap( px );
}