QtxListAction* editUndo =
new QtxListAction( tr( "TOT_APP_EDIT_UNDO" ),
- resMgr->loadPixmap( "STD", tr( "ICON_EDIT_UNDO" ) ),
- tr( "MEN_APP_EDIT_UNDO" ), Qt::CTRL+Qt::Key_Z, desk );
+ resMgr->loadPixmap( "STD", tr( "ICON_EDIT_UNDO" ) ),
+ tr( "MEN_APP_EDIT_UNDO" ), Qt::CTRL+Qt::Key_Z, desk );
editUndo->setStatusTip( tr( "PRP_APP_EDIT_UNDO" ) );
registerAction( EditUndoId, editUndo );
QtxListAction* editRedo =
new QtxListAction( tr( "TOT_APP_EDIT_REDO" ),
- resMgr->loadPixmap( "STD", tr( "ICON_EDIT_REDO" ) ),
- tr( "MEN_APP_EDIT_REDO" ), Qt::CTRL+Qt::Key_Y, desk );
+ resMgr->loadPixmap( "STD", tr( "ICON_EDIT_REDO" ) ),
+ tr( "MEN_APP_EDIT_REDO" ), Qt::CTRL+Qt::Key_Y, desk );
editRedo->setStatusTip( tr( "PRP_APP_EDIT_REDO" ) );
registerAction( EditRedoId, editRedo );
{
if ( !undo( cafStudy ) )
{
- ok = false;
- break;
+ ok = false;
+ break;
}
numActions--;
}
{
if ( !redo( cafStudy ) )
{
- ok = false;
- break;
+ ok = false;
+ break;
}
numActions--;
}
}
catch ( Standard_Failure ) {
SUIT_MessageBox::critical(application()->desktop(), tr( "ERR_ERROR" ),
- tr( "ERR_DOC_UNDO" ));
+ tr( "ERR_DOC_UNDO" ));
return false;
}
return true;
}
catch ( Standard_Failure ) {
SUIT_MessageBox::critical( application()->desktop(), tr( "ERR_ERROR" ),
- tr( "ERR_DOC_REDO" ) );
+ tr( "ERR_DOC_REDO" ) );
return false;
}
return true;
{
CAM_Module* mod = 0;
for ( QList<CAM_Module*>::const_iterator it = myModules.begin();
- it != myModules.end() && !mod; ++it )
+ it != myModules.end() && !mod; ++it )
if ( (*it)->moduleName() == modName )
mod = *it;
return mod;
out.clear();
for ( QList<CAM_Module*>::const_iterator it = myModules.begin();
- it != myModules.end(); ++it )
+ it != myModules.end(); ++it )
out.append( *it );
}
if ( loaded )
{
for ( QList<CAM_Module*>::const_iterator it = myModules.begin();
- it != myModules.end(); ++it )
+ it != myModules.end(); ++it )
lst.append( (*it)->moduleName() );
}
else
{
for ( ModuleInfoList::const_iterator it = myInfoList.begin();
- it != myInfoList.end(); ++it )
+ it != myInfoList.end(); ++it )
lst.append( (*it).title );
}
}
ModuleList newList;
for ( ModuleInfoList::const_iterator it = myInfoList.begin();
- it != myInfoList.end(); ++it )
+ it != myInfoList.end(); ++it )
{
if ( (*it).title == mod->moduleName() )
newList.append( mod );
}
for ( QList<CAM_Module*>::const_iterator it = myModules.begin();
- it != myModules.end(); ++it )
+ it != myModules.end(); ++it )
{
if ( !newList.contains( *it ) )
newList.append( *it );
else {
QString wrn = tr( "Can not load module %1" ).arg( (*it).title );
if ( desktop() && desktop()->isVisible() )
- SUIT_MessageBox::critical( desktop(), tr( "Loading modules" ), wrn );
+ SUIT_MessageBox::critical( desktop(), tr( "Loading modules" ), wrn );
else
- qWarning( qPrintable( wrn ) );
+ qWarning( qPrintable( wrn ) );
}
}
}
{
// ....
}
- }
+ }
myModule = mod;
if ( myModule ){
myModule->setToolShown( false );
QString wrn = tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() );
if ( desktop() && desktop()->isVisible() )
- SUIT_MessageBox::critical( desktop(), tr( "ERROR_TLT" ), wrn );
+ SUIT_MessageBox::critical( desktop(), tr( "ERROR_TLT" ), wrn );
else
- qWarning( qPrintable( wrn ) );
+ qWarning( qPrintable( wrn ) );
myModule = 0;
return false;
}
QStringList mods = modules.split( QRegExp( "[:|,\\s]" ), QString::SkipEmptyParts );
for ( int i = 0; i < mods.count(); i++ ) {
if ( !mods[i].trimmed().isEmpty() )
- modList.append( mods[i].trimmed() );
+ modList.append( mods[i].trimmed() );
}
}
SUIT_MessageBox::warning( desktop(), tr( "Warning" ), tr( "Modules list is empty" ) );
else
{
- printf( "****************************************************************\n" );
- printf( "* Warning: modules list is empty.\n" );
- printf( "****************************************************************\n" );
+ printf( "****************************************************************\n" );
+ printf( "* Warning: modules list is empty.\n" );
+ printf( "****************************************************************\n" );
}
}
}
if ( myRoot )
myRoot->disconnect( SIGNAL( destroyed( SUIT_DataObject* ) ),
- this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+ this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
myRoot = (CAM_DataObject*)newRoot;
if ( myRoot )
myRoot->connect( SIGNAL( destroyed( SUIT_DataObject* ) ),
- this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+ this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
emit rootChanged( this );
}
\return \c true if data model is loaded successfully
*/
bool CAM_DataModel::open( const QString& /*name*/,
- CAM_Study* /*study*/,
- QStringList /*files*/ )
+ CAM_Study* /*study*/,
+ QStringList /*files*/ )
{
return true;
}
\return \c true if data model is saved successfully
*/
bool CAM_DataModel::saveAs( const QString& /*name*/,
- CAM_Study* /*study*/,
- QStringList& /*files*/ )
+ CAM_Study* /*study*/,
+ QStringList& /*files*/ )
{
return true;
}
#endif
act.sa_handler = (SIG_PFV) &SegvHandler ;
-#ifdef SA_SIGINFO // OSF,SOLARIS,IRIX
+#ifdef SA_SIGINFO // OSF,SOLARIS,IRIX
act.sa_flags = act.sa_flags | SA_SIGINFO ;
# ifdef SOLARIS
act.sa_sigaction = (void(*)(int, siginfo_t *, void*)) &SegvHandler ;
/*!
\brief Get the minimum value of the parameter for the specified
units system \a theSystem.
-
+
Returned value is converted to SI.
\param theUnitsSystem units system
{
// Read the text in the element "value"
//LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
- LDOM_Node aNode = aListItemValue.getFirstChild();
- const LDOM_Text& aText = (const LDOM_Text&) aNode;
- LDOM_Text aListItemTxt(aText);
+ LDOM_Node aNode = aListItemValue.getFirstChild();
+ const LDOM_Text& aText = (const LDOM_Text&) aNode;
+ LDOM_Text aListItemTxt(aText);
if ( !aListItemTxt.isNull() )
{
// adding ID and text value to sequence
LDOMString v = attr.getValue();
if( v.Type()==LDOMBasicString::LDOM_Integer )
{
- Standard_Integer ival;
- v.GetInteger( ival );
- value = TCollection_ExtendedString( ival );
+ Standard_Integer ival;
+ v.GetInteger( ival );
+ value = TCollection_ExtendedString( ival );
}
else
- value = ( Standard_CString )v.GetString();
+ value = ( Standard_CString )v.GetString();
}
else
continue;
else if ( anUnitData.myUnits.ToCString()[0] ) // treat '%' as unit with scale 100
anUnitData.myScale = 0.01;
}
- catch( Standard_Failure ) {
+ catch( Standard_Failure ) {
anUnitData.myUnits.Clear();
}
\class SALOME_Event
\brief The class which encapsulates data and functionality required for
posting component-specific events to perform arbitrary operations
- in the main GUI thread.
+ in the main GUI thread.
SALOME_Event objects can be posted by any thread belonging to the GUI process.
TResult myResult;
typedef TResult (TObject::* TAction)();
TMemFunEvent(TObject* theObject, TAction theAction,
- TResult theResult = TResult()):
+ TResult theResult = TResult()):
myObject(theObject),
myAction(theAction),
myResult(theResult)
TResult myResult;
typedef TResult (TObject::* TAction)(TArg);
TMemFun1ArgEvent(TObject* theObject, TAction theAction, TArg theArg,
- TResult theResult = TResult()):
+ TResult theResult = TResult()):
myObject(theObject),
myAction(theAction),
myResult(theResult),
TResult myResult;
typedef TResult (TObject::* TAction)(TArg,TArg1);
TMemFun2ArgEvent(TObject* theObject, TAction theAction,
- TArg theArg, TArg1 theArg1,
- TResult theResult = TResult()):
+ TArg theArg, TArg1 theArg1,
+ TResult theResult = TResult()):
myObject(theObject),
myAction(theAction),
myResult(theResult),
//! Export numbers of highlighted/selected lines
void exportNumbers( QList<int>& high, QList<int>& unhigh,
- QList<int>& sel, QList<int>& unsel );
+ QList<int>& sel, QList<int>& unsel );
//! Returns numbers of selected lines
QList<int> getSelectedElements() { return mySelNumbers; }
void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
{
if( WidthBot > myArrowWidthTop || WidthBot < 1 )
- return;
+ return;
myArrowWidthBottom=WidthBot;
}
if ( !Append )
{
for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it )
- if( myLastPicked != *it )
+ if( myLastPicked != *it )
{
- updateAll = (*it)->unselect() || updateAll;
- aList.append( *it );
+ updateAll = (*it)->unselect() || updateAll;
+ aList.append( *it );
}
if( updateAll || myUpdateAll )
if ( !Append )
{
for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it )
- if ( myLastPicked != *it )
+ if ( myLastPicked != *it )
{
- updateAll = (*it)->unselect() || updateAll;
- aList.append( *it );
+ updateAll = (*it)->unselect() || updateAll;
+ aList.append( *it );
}
if( updateAll || myUpdateAll )
*/
void GLViewer_Drawer::setAntialiasing(const bool on)
{
- if (on)
- {
+ if (on)
+ {
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_POLYGON_SMOOTH);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- }
- else
- {
- glDisable(GL_POINT_SMOOTH);
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_POLYGON_SMOOTH);
- glBlendFunc (GL_ONE, GL_ZERO);
- glDisable (GL_BLEND);
- }
+ glEnable(GL_POINT_SMOOTH);
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_POLYGON_SMOOTH);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+ }
+ else
+ {
+ glDisable(GL_POINT_SMOOTH);
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_POLYGON_SMOOTH);
+ glBlendFunc (GL_ONE, GL_ZERO);
+ glDisable (GL_BLEND);
+ }
}
/*! Loads texture from file
\param fillingColor - color of filling
*/
void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, GLfloat lineWidth, GLfloat gap,
- QColor color, bool filled, QColor fillingColor )
+ QColor color, bool filled, QColor fillingColor )
{
if( !rect )
return;
\param isStripe - enables line stipple
*/
void GLViewer_Drawer::drawContour( GLViewer_Rect* rect, QColor color, GLfloat lineWidth,
- GLushort pattern, bool isStripe )
+ GLushort pattern, bool isStripe )
{
float x1 = rect->left();
float x2 = rect->right();
\param filled - drawn as filled
*/
void GLViewer_Drawer::drawArrow( const GLfloat red, const GLfloat green, const GLfloat blue,
- GLfloat lineWidth,
- GLfloat staff, GLfloat length, GLfloat width,
- GLfloat x, GLfloat y, GLfloat angle, GLboolean filled )
+ GLfloat lineWidth,
+ GLfloat staff, GLfloat length, GLfloat width,
+ GLfloat x, GLfloat y, GLfloat angle, GLboolean filled )
{
GLfloat vx1 = x;
GLfloat vy1 = y + staff + length;
//! Returns object priority
int getPriority() const { return myPriority; }
- //! The function enables and disables antialiasing in Open GL (for points, lines and polygons).
- void setAntialiasing(const bool on);
+ //! The function enables and disables antialiasing in Open GL (for points, lines and polygons).
+ void setAntialiasing(const bool on);
//! Clears all generated textures
static void destroyAllTextures();
*/
void drawText( const QString& text,
GLfloat xPos,
- GLfloat yPos,
+ GLfloat yPos,
const QColor& color,
QFont* aFont,
int theSeparator,
*\param smallFont - font format
*/
void drawGLText( QString text,
- float x,
- float y,
+ float x,
+ float y,
int hPosition = GLText_Center,
int vPosition = GLText_Center,
QColor color = Qt::black,
//! Draw basic primitives: rectangle, contour, polygon, vertex, cross, arrow
//* with predefined color
static void drawRectangle( GLViewer_Rect*, GLfloat, GLfloat = 0, QColor = Qt::black,
- bool = false, QColor = Qt::white );
+ bool = false, QColor = Qt::white );
static void drawContour( GLViewer_Rect*, QColor, GLfloat, GLushort, bool );
static void drawContour( const GLViewer_PntList&, QColor, GLfloat );
static void drawPolygon( GLViewer_Rect*, QColor, GLushort, bool );
static void drawVertex( GLfloat, GLfloat, QColor );
static void drawCross( GLfloat, GLfloat, QColor );
static void drawArrow( const GLfloat red, const GLfloat green, const GLfloat blue,
- GLfloat, GLfloat, GLfloat, GLfloat,
- GLfloat, GLfloat, GLfloat, GLboolean = GL_FALSE );
+ GLfloat, GLfloat, GLfloat, GLfloat,
+ GLfloat, GLfloat, GLfloat, GLboolean = GL_FALSE );
//! Draw object text
virtual void drawText( GLViewer_Object* theObject );
* \param xScale and \param yScal - scale factors along x and y direction
*/
GLViewer_Grid( GLfloat width, GLfloat height,
- GLfloat winW, GLfloat winH,
- GLfloat xSize, GLfloat ySize,
- GLfloat xPan, GLfloat yPan,
- GLfloat xScale, GLfloat yScale );
+ GLfloat winW, GLfloat winH,
+ GLfloat xSize, GLfloat ySize,
+ GLfloat xPan, GLfloat yPan,
+ GLfloat xScale, GLfloat yScale );
~GLViewer_Grid();
//! Draws grid
for( j = 0; j < aObjNum; j++ )
{
QByteArray aTempArray;
- aTempArray.resize(aObjSizeList[j]);
+ aTempArray.resize(aObjSizeList[j]);
for( ; anIndex < aCurIndex + aObjSizeList[j]; anIndex++ )
aTempArray[anIndex-aCurIndex] = theArray[anIndex];
aObjects.append( aTempArray );
QByteArray aResult;
aResult.resize( 2*anISize + sizeOf8Float +
- aTypeLength + aToolTipLength +
- aGLText.size() + aAspect.size() );
+ aTypeLength + aToolTipLength +
+ aGLText.size() + aAspect.size() );
// puts 8 float values into the byte array
char* aPointer = (char*)&aRectData;
for( i = 0; i < sizeOf8Float; i++, aPointer++ )
*\param isCircle - = true if sensitive area of detection is round
*/
virtual GLboolean highlight( GLfloat x,
- GLfloat y,
+ GLfloat y,
GLfloat tol,
GLboolean isCircle = GL_FALSE ) = 0;
//! Clears all highlight information
mypViewPort = theParent;
//mypLabel = NULL;
mypLabel = new QLabel( "Test", NULL,
- Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool | Qt::X11BypassWindowManagerHint );
+ Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool | Qt::X11BypassWindowManagerHint );
mypLabel->setObjectName("ObjectTipText");
mypLabel->setMargin( 1 );
//mypLabel->setAutoMask( FALSE );
case QEvent::MouseButtonDblClick:
case QEvent::KeyPress:
case QEvent::KeyRelease:
- // input - turn off tool tip mode
- hideTipAndSleep();
- break;*/
+ // input - turn off tool tip mode
+ hideTipAndSleep();
+ break;*/
case QEvent::MouseMove:
{
//hideTipAndSleep();
class GLVIEWER_API GLViewer_Tools
{
public:
- //GLViewer_Tools();
- //virtual ~GLViewer_Tools();
+ //GLViewer_Tools();
+ //virtual ~GLViewer_Tools();
//static
};
// Dump view
aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_DUMP" ) ),
- tr( "MNU_DUMP_VIEW" ), 0, this);
+ tr( "MNU_DUMP_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
toolMgr()->registerAction( aAction, DumpId );
// FitAll
aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITALL" ) ),
- tr( "MNU_FITALL" ), 0, this);
+ tr( "MNU_FITALL" ), 0, this);
aAction->setStatusTip(tr("DSC_FITALL"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitAll()));
toolMgr()->registerAction( aAction, FitAllId );
// FitRect
aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITAREA" ) ),
- tr( "MNU_FITRECT" ), 0, this);
+ tr( "MNU_FITRECT" ), 0, this);
aAction->setStatusTip(tr("DSC_FITRECT"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitArea()));
toolMgr()->registerAction( aAction, FitRectId );
// FitSelect
aAction = new QtxAction(tr("MNU_FITSELECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITSELECT" ) ),
- tr( "MNU_FITSELECT" ), 0, this);
+ tr( "MNU_FITSELECT" ), 0, this);
aAction->setStatusTip(tr("DSC_FITSELECT"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitSelect()));
toolMgr()->registerAction( aAction, FitSelectId );
// Zoom
aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_ZOOM" ) ),
- tr( "MNU_ZOOM_VIEW" ), 0, this);
+ tr( "MNU_ZOOM_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewZoom()));
toolMgr()->registerAction( aAction, ZoomId );
// Panning
aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_PAN" ) ),
- tr( "MNU_PAN_VIEW" ), 0, this);
+ tr( "MNU_PAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_PAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan()));
toolMgr()->registerAction( aAction, PanId );
// Global Panning
aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_GLOBALPAN" ) ),
- tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
+ tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewGlobalPan()));
toolMgr()->registerAction( aAction, GlobalPanId );
aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_RESET" ) ),
- tr( "MNU_RESET_VIEW" ), 0, this);
+ tr( "MNU_RESET_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_RESET_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset()));
toolMgr()->registerAction( aAction, ResetId );
{
myRectBand->hide(); /* erase */
- mypLastPoint->setX( x );
+ mypLastPoint->setX( x );
mypLastPoint->setY( y );
- QRect aRect = selectionRect();
- myRectBand->setGeometry( aRect ); /* draw */
- myRectBand->setVisible( aRect.isValid() );
+ QRect aRect = selectionRect();
+ myRectBand->setGeometry( aRect ); /* draw */
+ myRectBand->setVisible( aRect.isValid() );
}
}
mypFirstPoint = NULL;
mypLastPoint = NULL;
- delete myRectBand;
- myRectBand = 0;
+ delete myRectBand;
+ myRectBand = 0;
}
}
qAbs( myStart.x() - myCurr.x() ), qAbs( myStart.y() - myCurr.y() ) );
if ( !rect.isEmpty() )
{
- if ( !sketchRect->isEmpty() && myRectBand )
+ if ( !sketchRect->isEmpty() && myRectBand )
myRectBand->hide(); /* erase */
*sketchRect = rect;
if ( state != Fin )
return;
GLViewer_ViewPort2d* vp = ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() );
- QColor selColor = QColorDialog::getColor( vp->backgroundColor(), vp );
+ QColor selColor = QColorDialog::getColor( vp->backgroundColor(), vp );
if ( selColor.isValid() ) {
vp->setBackgroundColor( selColor );
}
* output paper size \param aPType, with margins in mm
*/
virtual bool translateTo( VectorFileType aType, QString FileName, PaperType aPType,
- double mmLeft, double mmRight, double mmTop, double mmBottom );
+ double mmLeft, double mmRight, double mmTop, double mmBottom );
//bool isSketchingActive();
//int getSketchingType();
\return start point of curren rotation of Window in OpenGL global scene
*/
void GLViewer_Widget::getRotationStart( GLfloat& rotationStartX,
- GLfloat& rotationStartY,
+ GLfloat& rotationStartY,
GLfloat& rotationStartZ )
{
rotationStartX = myRotationStartX;
A function for installing the rotation angle of Window in OpenGL global scene in degree (Only in 2D)
*/
void GLViewer_Widget::setRotationStart( GLfloat rotationStartX,
- GLfloat rotationStartY,
+ GLfloat rotationStartY,
GLfloat rotationStartZ )
{
myRotationStartX = rotationStartX;
\param rotationCenterZ - center z
*/
void GLViewer_Widget::getRotation( GLfloat& rotationAngle,
- GLfloat& rotationCenterX,
- GLfloat& rotationCenterY,
- GLfloat& rotationCenterZ )
+ GLfloat& rotationCenterX,
+ GLfloat& rotationCenterY,
+ GLfloat& rotationCenterZ )
{
rotationAngle = myRotationAngle;
rotationCenterX = myRotationCenterX;
\param rotationCenterZ - center z
*/
void GLViewer_Widget::setRotation( GLfloat rotationAngle,
- GLfloat rotationCenterX,
- GLfloat rotationCenterY,
- GLfloat rotationCenterZ )
+ GLfloat rotationCenterX,
+ GLfloat rotationCenterY,
+ GLfloat rotationCenterZ )
{
myRotationAngle = rotationAngle;
myRotationCenterX = rotationCenterX;
{
uchar* theCurLine = image.scanLine( i ), cur;
for( int j=w1; j<=w2; j++ )
- for( int k=0; k<3; k++ )
- {
- cur = *(theCurLine+4*j+2-k);
- *(line+cur_index) = hex( cur/16 ); //HI
- *(line+cur_index+1) = hex( cur%16 ); //LO
- full++;
- cur_index+=2;
- if( cur_index>=80 )
- {
- aBuffer += line;
- aBuffer += "\n";
- cur_index = 0;
- }
- }
+ for( int k=0; k<3; k++ )
+ {
+ cur = *(theCurLine+4*j+2-k);
+ *(line+cur_index) = hex( cur/16 ); //HI
+ *(line+cur_index+1) = hex( cur%16 ); //LO
+ full++;
+ cur_index+=2;
+ if( cur_index>=80 )
+ {
+ aBuffer += line;
+ aBuffer += "\n";
+ cur_index = 0;
+ }
+ }
}
aBuffer += "> false 3 colorimage\n\n";
//! Returns scales on OpenGL scene along 3 directions
/*! in 2d scene zScale = 1.0 */
void getScale( GLfloat& xScale,
- GLfloat& yScale,
- GLfloat& zScale );
+ GLfloat& yScale,
+ GLfloat& zScale );
//! A function for installing the scales of OpenGL scene
void setScale( GLfloat xScale,
- GLfloat yScale,
+ GLfloat yScale,
GLfloat zScaleGLfloat );
//! Returns offset parameters of Window in OpenGL global scene
//! Returns start point of curren rotation of Window in OpenGL global scene
void getRotationStart( GLfloat& rotationStartX,
- GLfloat& rotationStartY,
- GLfloat& rotationStartZ );
+ GLfloat& rotationStartY,
+ GLfloat& rotationStartZ );
//! A function for installing the start point of curren rotation of Window in OpenGL global scene
void setRotationStart( GLfloat rotationStartX,
- GLfloat rotationStartY,
- GLfloat rotationStartZ );
+ GLfloat rotationStartY,
+ GLfloat rotationStartZ );
//! Returns parameters of current rotation
void getRotation( GLfloat& rotationAngle,
- GLfloat& rotationCenterX,
- GLfloat& rotationCenterY,
- GLfloat& rotationCenterZ );
+ GLfloat& rotationCenterX,
+ GLfloat& rotationCenterY,
+ GLfloat& rotationCenterZ );
//! A function for installing the parameters of current rotation
void setRotation( GLfloat, GLfloat, GLfloat, GLfloat );
static const char* imageEmptyIcon[] = {
"20 20 1 1",
-". c None",
+". c None",
"....................",
"....................",
"....................",
{
aFamily = *it;
if ( famdb.contains(aFamily) )
- {
- f.setFamily( aFamily );
- aResMgr->setValue( "PyConsole", "font", f );
- break;
- }
+ {
+ f.setFamily( aFamily );
+ aResMgr->setValue( "PyConsole", "font", f );
+ break;
+ }
}
}
if ( vf.open( QIODevice::ReadOnly ) )
{
QString line( vf.readLine( 1024 ) );
- vf.close();
+ vf.close();
- if ( !line.isEmpty() )
+ if ( !line.isEmpty() )
{
- while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
- line.remove( line.length() - 1, 1 );
+ while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )
+ line.remove( line.length() - 1, 1 );
- int idx = line.lastIndexOf( ":" );
- if ( idx != -1 )
- _app_version = line.mid( idx + 1 ).trimmed();
+ int idx = line.lastIndexOf( ":" );
+ if ( idx != -1 )
+ _app_version = line.mid( idx + 1 ).trimmed();
}
}
}
const int accel )
{
QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), QIcon(),
- tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
- tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
- accel, desktop(), false, this, SLOT( onNewWindow() ) );
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
+ tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ),
+ accel, desktop(), false, this, SLOT( onNewWindow() ) );
createMenu( a, parentId, -1 );
}
//! Preferences
createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIcon(),
- tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
- Qt::CTRL+Qt::Key_R, desk, false, this, SLOT( onPreferences() ) );
+ tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
+ Qt::CTRL+Qt::Key_R, desk, false, this, SLOT( onPreferences() ) );
//! Help for modules
int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
QStringList idxLst = QStringList() << modDir << "share" << "doc" << "salome" << "gui" << modName << "index.html";
QString indexFile = idxLst.join( QDir::separator() ); // index file
if ( QFile::exists( indexFile ) ) {
- QAction* a = createAction( id, tr( "%1 Help" ).arg( aModule ),
- resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
- tr( "%1 Help" ).arg( aModule ),
- tr( "%1 Help" ).arg( aModule ),
- 0, desk, false, this, SLOT( onHelpContentsModule() ) );
- a->setData( indexFile );
- createMenu( a, helpModuleMenu, -1 );
- id++;
+ QAction* a = createAction( id, tr( "%1 Help" ).arg( aModule ),
+ resMgr->loadPixmap( "STD", tr( "ICON_HELP" ), false ),
+ tr( "%1 Help" ).arg( aModule ),
+ tr( "%1 Help" ).arg( aModule ),
+ 0, desk, false, this, SLOT( onHelpContentsModule() ) );
+ a->setData( indexFile );
+ createMenu( a, helpModuleMenu, -1 );
+ id++;
}
}
}
QPixmap icon = resMgr->loadPixmap( modName, iconName, false );
if ( icon.isNull() )
{
- icon = modIcon;
- INFOS ( "****************************************************************" << std::endl
- << "* Icon for " << (*it).toLatin1().constData() << " not found. Using the default one." << std::endl
- << "****************************************************************" << std::endl );
+ icon = modIcon;
+ INFOS ( "****************************************************************" << std::endl
+ << "* Icon for " << (*it).toLatin1().constData() << " not found. Using the default one." << std::endl
+ << "****************************************************************" << std::endl );
}
icon = Qtx::scaleIcon( icon, iconSize );
#endif
createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
- Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
+ Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
createMenu( RenameId, windowMenu, -1 );
int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
putInfo( tr("INF_CANCELLED") );
LightApp_ModuleAction* moduleAction =
- qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
+ qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
if ( moduleAction )
- moduleAction->setActiveModule( QString() );
+ moduleAction->setActiveModule( QString() );
cancelled = true;
}
}
{
public:
RunBrowser( LightApp_Application* app,
- const QString& theApp,
- const QString& theParams,
- const QString& theHelpFile,
- const QString& theContext = QString() )
+ const QString& theApp,
+ const QString& theParams,
+ const QString& theHelpFile,
+ const QString& theContext = QString() )
: myApp( theApp ),
myParams( theParams ),
#ifdef WIN32
if ( !myApp.isEmpty()) {
QString aCommand = QString( "%1 %2 %3" ).arg( myApp, myParams, myHelpFile );
if ( !myContext.isEmpty() )
- aCommand += "#" + myContext;
+ aCommand += "#" + myContext;
QProcess* proc = new QProcess();
proc->start( aCommand );
if ( !proc->waitForStarted() ) {
- SALOME_CustomEvent* ce2000 = new SALOME_CustomEvent( 2000 );
- QString* msg = new QString( QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).arg( myApp, myHelpFile ) );
- ce2000->setData( msg );
- QApplication::postEvent( myLApp, ce2000 );
+ SALOME_CustomEvent* ce2000 = new SALOME_CustomEvent( 2000 );
+ QString* msg = new QString( QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).arg( myApp, myHelpFile ) );
+ ce2000->setData( msg );
+ QApplication::postEvent( myLApp, ce2000 );
}
}
}
else
{
if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "DEFINE_EXTERNAL_BROWSER" ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
showPreferences( tr( "PREF_APP" ) );
}
SLOT: Displays help contents for choosen dialog
*/
void LightApp_Application::onHelpContextModule( const QString& theComponentName,
- const QString& theFileName,
- const QString& theContext )
+ const QString& theFileName,
+ const QString& theContext )
{
QString homeDir = "";
if ( !theComponentName.isEmpty() ) {
QString dir = getenv( ( theComponentName + "_ROOT_DIR" ).toLatin1().constData() );
if ( !dir.isEmpty() )
homeDir = Qtx::addSlash( Qtx::addSlash( dir ) +
- Qtx::addSlash( "share" ) +
- Qtx::addSlash( "doc" ) +
- Qtx::addSlash( "salome" ) +
- Qtx::addSlash( "gui" ) +
- Qtx::addSlash( theComponentName ) );
+ Qtx::addSlash( "share" ) +
+ Qtx::addSlash( "doc" ) +
+ Qtx::addSlash( "salome" ) +
+ Qtx::addSlash( "gui" ) +
+ Qtx::addSlash( theComponentName ) );
}
QString helpFile = QFileInfo( homeDir + theFileName ).absoluteFilePath();
SUIT_ResourceMgr* resMgr = resourceMgr();
- QString platform;
+ QString platform;
#ifdef WIN32
- platform = "winapplication";
+ platform = "winapplication";
#else
- platform = "application";
+ platform = "application";
#endif
- QString anApp = resMgr->stringValue("ExternalBrowser", platform);
+ QString anApp = resMgr->stringValue("ExternalBrowser", platform);
#ifdef WIN32
- QString quote("\"");
- anApp.prepend( quote );
- anApp.append( quote );
+ QString quote("\"");
+ anApp.prepend( quote );
+ anApp.append( quote );
#endif
QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
else
{
if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "DEFINE_EXTERNAL_BROWSER" ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
showPreferences( tr( "PREF_APP" ) );
}
}
f = resourceMgr()->fontValue( "PyConsole", "font" );
else
{
- f = ( ( PyConsole_Console* )wid )->font();
- resourceMgr()->setValue( "PyConsole", "font", f );
+ f = ( ( PyConsole_Console* )wid )->font();
+ resourceMgr()->setValue( "PyConsole", "font", f );
}
}
else
study->dataModels( dm_list );
QListIterator<CAM_DataModel*> it( dm_list );
while ( it.hasNext() ) {
- CAM_DataModel* camDM = it.next();
+ CAM_DataModel* camDM = it.next();
if ( camDM && camDM->inherits( "LightApp_DataModel" ) )
((LightApp_DataModel*)camDM)->update();
}
vm->setProjectionMode( resMgr->integerValue( "VTKViewer", "projection_mode", vm->projectionMode() ) );
vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) );
vm->setTrihedronSize( resMgr->doubleValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ),
- resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) );
+ resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) );
vm->setInteractionStyle( resMgr->integerValue( "VTKViewer", "navigation_mode", vm->interactionStyle() ) );
vm->setIncrementalSpeed( resMgr->integerValue( "VTKViewer", "speed_value", vm->incrementalSpeed() ),
- resMgr->integerValue( "VTKViewer", "speed_mode", vm->incrementalSpeedMode() ) );
+ resMgr->integerValue( "VTKViewer", "speed_mode", vm->incrementalSpeedMode() ) );
vm->setSpacemouseButtons( resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", vm->spacemouseBtn(1) ),
- resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", vm->spacemouseBtn(2) ),
- resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", vm->spacemouseBtn(3) ) );
+ resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", vm->spacemouseBtn(2) ),
+ resMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", vm->spacemouseBtn(3) ) );
new LightApp_VTKSelector( vm, mySelMgr );
}
#else
for ( QStringList::const_iterator it = modNameList.begin(); it != modNameList.end(); ++it )
{
if ( !app->isLibExists( *it ) )
- continue;
+ continue;
int modId = _prefs_->addPreference( *it );
if ( iconMap.contains( *it ) )
- _prefs_->setItemIcon( modId, Qtx::scaleIcon( resMgr->loadPixmap( moduleName( *it ), iconMap[*it], false ), 20 ) );
+ _prefs_->setItemIcon( modId, Qtx::scaleIcon( resMgr->loadPixmap( moduleName( *it ), iconMap[*it], false ), 20 ) );
}
ModuleList modList;
CAM_Module* anItem = itr.next();
if ( anItem->inherits( "LightApp_Module" ) )
- mod = (LightApp_Module*)anItem;
+ mod = (LightApp_Module*)anItem;
if ( mod && !_prefs_->hasModule( mod->moduleName() ) )
{
- _prefs_->addPreference( mod->moduleName() );
- mod->createPreferences();
- that->emptyPreferences( mod->moduleName() );
+ _prefs_->addPreference( mod->moduleName() );
+ mod->createPreferences();
+ that->emptyPreferences( mod->moduleName() );
}
}
}
pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
int autoSaveInterval = pref->addPreference( tr( "PREF_AUTO_SAVE" ), studyGroup,
- LightApp_Preferences::IntSpin, "Study", "auto_save_interval" );
+ LightApp_Preferences::IntSpin, "Study", "auto_save_interval" );
pref->setItemProperty( "min", 0, autoSaveInterval );
pref->setItemProperty( "max", 1440, autoSaveInterval );
pref->setItemProperty( "special", tr( "PREF_AUTO_SAVE_DISABLED" ), autoSaveInterval );
// OCC Viewer
int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup,
- LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" );
+ LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" );
pref->setItemProperty( "min", 1.0E-06, occTS );
pref->setItemProperty( "max", 1000, occTS );
int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
- LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
+ LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
pref->setItemProperty( "min", 0, isoU );
pref->setItemProperty( "max", 100000, isoU );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
- LightApp_Preferences::Color, "OCCViewer", "background" );
+ LightApp_Preferences::Color, "OCCViewer", "background" );
int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
- LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
+ LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
pref->setItemProperty( "min", 0, isoV );
pref->setItemProperty( "max", 100000, isoV );
pref->setItemProperty( "columns", 2, vtkGen );
int vtkProjMode = pref->addPreference( tr( "PREF_PROJECTION_MODE" ), vtkGen,
- LightApp_Preferences::Selector, "VTKViewer", "projection_mode" );
+ LightApp_Preferences::Selector, "VTKViewer", "projection_mode" );
QStringList aProjModeList;
aProjModeList.append( tr("PREF_ORTHOGRAPHIC") );
aProjModeList.append( tr("PREF_PERSPECTIVE") );
pref->setItemProperty( "indexes", aModeIndexesList, vtkProjMode );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGen,
- LightApp_Preferences::Color, "VTKViewer", "background" );
+ LightApp_Preferences::Color, "VTKViewer", "background" );
int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGen,
- LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" );
+ LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" );
pref->setItemProperty( "min", 1.0E-06, vtkTS );
pref->setItemProperty( "max", 150, vtkTS );
pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGen, LightApp_Preferences::Bool, "VTKViewer", "relative_size" );
int vtkStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), vtkGen,
- LightApp_Preferences::Selector, "VTKViewer", "navigation_mode" );
+ LightApp_Preferences::Selector, "VTKViewer", "navigation_mode" );
QStringList aStyleModeList;
aStyleModeList.append( tr("PREF_STANDARD_STYLE") );
aStyleModeList.append( tr("PREF_KEYFREE_STYLE") );
pref->addPreference( "", vtkGroup, LightApp_Preferences::Space );
int vtkSpeed = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED" ), vtkGen,
- LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" );
+ LightApp_Preferences::IntSpin, "VTKViewer", "speed_value" );
pref->setItemProperty( "min", 1, vtkSpeed );
pref->setItemProperty( "max", 1000, vtkSpeed );
int vtkSpeedMode = pref->addPreference( tr( "PREF_INCREMENTAL_SPEED_MODE" ), vtkGen,
- LightApp_Preferences::Selector, "VTKViewer", "speed_mode" );
+ LightApp_Preferences::Selector, "VTKViewer", "speed_mode" );
QStringList aSpeedModeList;
aSpeedModeList.append( tr("PREF_ARITHMETIC") );
aSpeedModeList.append( tr("PREF_GEOMETRICAL") );
int vtkSM = pref->addPreference( tr( "PREF_FRAME_SPACEMOUSE" ), vtkGroup, LightApp_Preferences::GroupBox );
pref->setItemProperty( "columns", 2, vtkSM );
int spacemousePref1 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_1" ), vtkSM,
- LightApp_Preferences::Selector, "VTKViewer",
- "spacemouse_func1_btn" ); //decrease_speed_increment
+ LightApp_Preferences::Selector, "VTKViewer",
+ "spacemouse_func1_btn" ); //decrease_speed_increment
int spacemousePref2 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_2" ), vtkSM,
- LightApp_Preferences::Selector, "VTKViewer",
- "spacemouse_func2_btn" ); //increase_speed_increment
+ LightApp_Preferences::Selector, "VTKViewer",
+ "spacemouse_func2_btn" ); //increase_speed_increment
int spacemousePref3 = pref->addPreference( tr( "PREF_SPACEMOUSE_FUNC_3" ), vtkSM,
- LightApp_Preferences::Selector, "VTKViewer",
- "spacemouse_func5_btn" ); //dominant_combined_switch
+ LightApp_Preferences::Selector, "VTKViewer",
+ "spacemouse_func5_btn" ); //dominant_combined_switch
QStringList values;
values.append( tr( "PREF_SPACEMOUSE_BTN_1" ) );
pref->setItemProperty( "columns", 2, vtkRec );
int modePref = pref->addPreference( tr( "PREF_RECORDING_MODE" ), vtkRec,
- LightApp_Preferences::Selector, "VTKViewer", "recorder_mode" );
+ LightApp_Preferences::Selector, "VTKViewer", "recorder_mode" );
values.clear();
values.append( tr( "PREF_SKIPPED_FRAMES" ) );
values.append( tr( "PREF_ALL_DISLPAYED_FRAMES" ) );
pref->setItemProperty( "indexes", indices, modePref );
int fpsPref = pref->addPreference( tr( "PREF_FPS" ), vtkRec,
- LightApp_Preferences::DblSpin, "VTKViewer", "recorder_fps" );
+ LightApp_Preferences::DblSpin, "VTKViewer", "recorder_fps" );
pref->setItemProperty( "min", 0.1, fpsPref );
pref->setItemProperty( "max", 100, fpsPref );
int qualityPref = pref->addPreference( tr( "PREF_QUALITY" ), vtkRec,
- LightApp_Preferences::IntSpin, "VTKViewer", "recorder_quality" );
+ LightApp_Preferences::IntSpin, "VTKViewer", "recorder_quality" );
pref->setItemProperty( "min", 1, qualityPref );
pref->setItemProperty( "max", 100, qualityPref );
pref->addPreference( tr( "PREF_PROGRESSIVE" ), vtkRec,
- LightApp_Preferences::Bool, "VTKViewer", "recorder_progressive" );
+ LightApp_Preferences::Bool, "VTKViewer", "recorder_progressive" );
int vtkGN = pref->addPreference( tr( "PREF_FRAME_GROUP_NAMES" ), vtkGroup,
- LightApp_Preferences::GroupBox, "VTKViewer", "show_group_names" );
+ LightApp_Preferences::GroupBox, "VTKViewer", "show_group_names" );
pref->setItemProperty( "columns", 2, vtkGN );
pref->addPreference( tr( "PREF_GROUP_NAMES_TEXT_COLOR" ), vtkGN,
- LightApp_Preferences::Color, "VTKViewer", "group_names_text_color" );
+ LightApp_Preferences::Color, "VTKViewer", "group_names_text_color" );
int transPref = pref->addPreference( tr( "PREF_GROUP_NAMES_TRANSPARENCY" ), vtkGN,
- LightApp_Preferences::DblSpin, "VTKViewer", "group_names_transparency" );
+ LightApp_Preferences::DblSpin, "VTKViewer", "group_names_transparency" );
pref->setItemProperty( "min", 0.0, transPref );
pref->setItemProperty( "max", 1.0, transPref );
// Plot2d
pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup,
- LightApp_Preferences::Bool, "Plot2d", "ShowLegend" );
+ LightApp_Preferences::Bool, "Plot2d", "ShowLegend" );
int legendPosition = pref->addPreference( tr( "PREF_LEGEND_POSITION" ), plot2dGroup,
- LightApp_Preferences::Selector, "Plot2d", "LegendPos" );
+ LightApp_Preferences::Selector, "Plot2d", "LegendPos" );
aValuesList.clear();
anIndicesList.clear();
aValuesList << tr("PREF_LEFT") << tr("PREF_RIGHT") << tr("PREF_TOP") << tr("PREF_BOTTOM");
pref->setItemProperty( "indexes", anIndicesList, legendPosition );
int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup,
- LightApp_Preferences::Selector, "Plot2d", "CurveType" );
+ LightApp_Preferences::Selector, "Plot2d", "CurveType" );
aValuesList.clear();
anIndicesList.clear();
aValuesList << tr("PREF_POINTS") << tr("PREF_LINES") << tr("PREF_SPLINE");
pref->setItemProperty( "indexes", anIndicesList, curveType );
int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup,
- LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
+ LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" );
pref->setItemProperty( "min", 0, markerSize );
pref->setItemProperty( "max", 100, markerSize );
anIndicesList << 0 << 1 ;
int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup,
- LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
+ LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" );
pref->setItemProperty( "strings", aValuesList, horScale );
pref->setItemProperty( "indexes", anIndicesList, horScale );
int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup,
- LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
+ LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" );
pref->setItemProperty( "strings", aValuesList, verScale );
pref->setItemProperty( "indexes", anIndicesList, verScale );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup,
- LightApp_Preferences::Color, "Plot2d", "Background" );
+ LightApp_Preferences::Color, "Plot2d", "Background" );
int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat );
int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab );
pref->addPreference( tr( "" ), dirGroup,
- LightApp_Preferences::DirList, "FileDlg", "QuickDirList" );
+ LightApp_Preferences::DirList, "FileDlg", "QuickDirList" );
/* VSR : 26/02/09 : temporarily comment : SUPERV is not migrated to Qt 4
pref->setItemProperty( "columns", 4, supervGroup );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), supervGroup,
- LightApp_Preferences::Color, "SUPERVGraph", "Background" );
+ LightApp_Preferences::Color, "SUPERVGraph", "Background" );
pref->addPreference( tr( "PREF_SUPERV_TITLE_COLOR" ), supervGroup,
- LightApp_Preferences::Color, "SUPERVGraph", "Title" );
+ LightApp_Preferences::Color, "SUPERVGraph", "Title" );
// pref->addPreference( tr( "PREF_SUPERV_CTRL_COLOR" ), supervGroup,
-// LightApp_Preferences::Color, "SUPERVGraph", "Ctrl" );
+// LightApp_Preferences::Color, "SUPERVGraph", "Ctrl" );
----> end VSR : 26/02/09 */
int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
int stGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SEARCH_TOOL" ), obTab );
pref->addPreference( tr( "PREF_AUTO_HIDE_SEARCH_TOOL" ), stGroup, LightApp_Preferences::Bool,
- "ObjectBrowser", "auto_hide_search_tool" );
+ "ObjectBrowser", "auto_hide_search_tool" );
int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
pref->setItemProperty( "columns", 2, objSetGroup );
pref->addPreference( tr( "PREF_AUTO_SIZE_FIRST" ), objSetGroup, LightApp_Preferences::Bool,
- "ObjectBrowser", "auto_size_first" );
+ "ObjectBrowser", "auto_size_first" );
pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool,
- "ObjectBrowser", "auto_size" );
+ "ObjectBrowser", "auto_size" );
pref->addPreference( tr( "PREF_RESIZE_ON_EXPAND_ITEM" ), objSetGroup, LightApp_Preferences::Bool,
- "ObjectBrowser", "resize_on_expand_item" );
+ "ObjectBrowser", "resize_on_expand_item" );
// MRU preferences
int mruGroup = pref->addPreference( tr( "PREF_GROUP_MRU" ), genTab, LightApp_Preferences::Auto, "MRU", "show_mru" );
pref->setItemProperty( "columns", 4, mruGroup );
int mruVisCount = pref->addPreference( tr( "PREF_MRU_VISIBLE_COUNT" ), mruGroup, LightApp_Preferences::IntSpin,
- "MRU", "visible_count" );
+ "MRU", "visible_count" );
pref->setItemProperty( "min", 0, mruVisCount );
pref->setItemProperty( "max", 100, mruVisCount );
int mruLinkType = pref->addPreference( tr( "PREF_MRU_LINK_TYPE" ), mruGroup, LightApp_Preferences::Selector,
- "MRU", "link_type" );
+ "MRU", "link_type" );
aValuesList.clear();
anIndicesList.clear();
aValuesList << tr("PREF_MRU_LINK_AUTO") << tr("PREF_MRU_LINK_SHORT") << tr("PREF_MRU_LINK_FULL");
{
SUIT_ViewModel* vm = it.next()->getViewModel();
if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) )
- continue;
+ continue;
OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
occVM->setTrihedronSize( sz );
{
SUIT_ViewModel* vm = it.next()->getViewModel();
if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
- continue;
+ continue;
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM )
{
- vtkVM->setTrihedronSize( sz, isRelative );
- vtkVM->Repaint();
+ vtkVM->setTrihedronSize( sz, isRelative );
+ vtkVM->Repaint();
}
}
#endif
{
SUIT_ViewModel* vm = it.next()->getViewModel();
if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
- continue;
+ continue;
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM ) vtkVM->setIncrementalSpeed( speed, mode );
{
SUIT_ViewModel* vm = it.next()->getViewModel();
if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
- continue;
+ continue;
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM ) vtkVM->setProjectionMode( mode );
{
SUIT_ViewModel* vm = it.next()->getViewModel();
if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
- continue;
+ continue;
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM ) vtkVM->setInteractionStyle( mode );
#ifndef DISABLE_VTKVIEWER
if ( sec == QString( "VTKViewer" ) && (param == QString( "spacemouse_func1_btn" ) ||
- param == QString( "spacemouse_func2_btn" ) ||
- param == QString( "spacemouse_func5_btn" ) ) )
+ param == QString( "spacemouse_func2_btn" ) ||
+ param == QString( "spacemouse_func5_btn" ) ) )
{
int btn1 = resMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", 1 );
int btn2 = resMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", 2 );
{
SUIT_ViewModel* vm = it.next()->getViewModel();
if ( !vm || !vm->inherits( "SVTK_Viewer" ) )
- continue;
+ continue;
SVTK_Viewer* vtkVM = dynamic_cast<SVTK_Viewer*>( vm );
if( vtkVM ) vtkVM->setSpacemouseButtons( btn1, btn2, btn3 );
{
OCCViewer_ViewManager* mgr = dynamic_cast<OCCViewer_ViewManager*>( it.next() );
if( mgr && mgr->getOCCViewer() )
- mgr->getOCCViewer()->setIsos( u, v );
+ mgr->getOCCViewer()->setIsos( u, v );
}
}
#endif
bool autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
ob->setAutoSizeFirstColumn( autoSizeFirst );
if ( autoSizeFirst )
- ob->adjustFirstColumnWidth();
+ ob->adjustFirstColumnWidth();
}
else if ( param=="auto_size" ) {
bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
ob->setAutoSizeColumns(autoSize);
if ( autoSize )
- ob->adjustColumnsWidth();
+ ob->adjustColumnsWidth();
}
else if ( param=="resize_on_expand_item" ) {
bool resizeOnExpandItem = resMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", false );
{
if( param=="font" )
if( pythonConsole() )
- pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
+ pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) );
}
#endif
QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
if ( mru ) {
if ( param == "visible_count" )
- mru->setVisibleCount( resMgr->integerValue( "MRU", "visible_count", 5 ) ); // 5 MRU items by default
+ mru->setVisibleCount( resMgr->integerValue( "MRU", "visible_count", 5 ) ); // 5 MRU items by default
else if ( param == "max_count" )
- mru->setHistoryCount( resMgr->integerValue( "MRU", "max_count", -1 ) ); // unlimited history by default
+ mru->setHistoryCount( resMgr->integerValue( "MRU", "max_count", -1 ) ); // unlimited history by default
else if ( param == "insert_mode" )
- mru->setInsertMode( resMgr->integerValue( "MRU", "insert_mode", 0 ) ); // QtxMRUAction::MoveFirst by default
+ mru->setInsertMode( resMgr->integerValue( "MRU", "insert_mode", 0 ) ); // QtxMRUAction::MoveFirst by default
else if ( param == "link_type" )
- mru->setLinkType( resMgr->integerValue( "MRU", "link_type", 0 ) ); // QtxMRUAction::LinkAuto by default
+ mru->setLinkType( resMgr->integerValue( "MRU", "link_type", 0 ) ); // QtxMRUAction::LinkAuto by default
else if ( param == "show_clear" )
- mru->setClearPossible( resMgr->booleanValue( "MRU", "show_clear", false ) ); // do not show "Clear" item by default
+ mru->setClearPossible( resMgr->booleanValue( "MRU", "show_clear", false ) ); // do not show "Clear" item by default
else if ( param == "show_mru" )
- mru->setVisible( resMgr->booleanValue( "MRU", "show_mru", false ) ); // do not show MRU menu item by default
+ mru->setVisible( resMgr->booleanValue( "MRU", "show_mru", false ) ); // do not show MRU menu item by default
}
}
}
for ( QMap<int, int>::ConstIterator it = winMap.begin(); it != winMap.end(); ++it )
{
if ( !dockWindow( it.key() ) )
- getWindow( it.key() );
+ getWindow( it.key() );
}
}
if( inf.exists() )
{
- isLibFound = true;
- break;
+ isLibFound = true;
+ break;
}
}
bool isPyLib = false, isPyGuiLib = false;
QStringList::const_iterator anIt = paths.begin(), aLast = paths.end();
for( ; anIt!=aLast; anIt++ )
- {
- QFileInfo inf( Qtx::addSlash( *anIt ) + pylib );
- QFileInfo infgui( Qtx::addSlash( *anIt ) + pylibgui );
+ {
+ QFileInfo inf( Qtx::addSlash( *anIt ) + pylib );
+ QFileInfo infgui( Qtx::addSlash( *anIt ) + pylibgui );
if(!isPythonLightModule)
if( !isPyLib && inf.exists() )
isPyLib = true;
- if( !isPyGuiLib && infgui.exists() )
- isPyGuiLib = true;
+ if( !isPyGuiLib && infgui.exists() )
+ isPyGuiLib = true;
- if ((isPyLib || isPythonLightModule ) && isPyGuiLib && isLibFound)
- return true;
- }
+ if ((isPyLib || isPythonLightModule ) && isPyGuiLib && isLibFound)
+ return true;
+ }
printf( "****************************************************************\n" );
printf( "* Warning: python library for %s cannot be found:\n", moduleTitle.toLatin1().constData() );
if (!isPyLib)
- printf( "* No module named %s\n", moduleName( moduleTitle ).toLatin1().constData() );
+ printf( "* No module named %s\n", moduleName( moduleTitle ).toLatin1().constData() );
if (!isPyGuiLib)
- printf( "* No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).toLatin1().constData() );
+ printf( "* No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).toLatin1().constData() );
printf( "****************************************************************\n" );
return true;
}
SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e;
QString* d = ( QString* )ce->data();
if( SUIT_MessageBox::question(0, tr("WRN_WARNING"),
- d ? *d : "",
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
+ d ? *d : "",
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes )
showPreferences( tr( "PREF_APP" ) );
if( d )
delete d;
{
if (theObj)
{
- bool isSuitable = !theObj->entry().isEmpty() &&
- !theObj->componentDataType().isEmpty() &&
- !theObj->name().isEmpty();
+ bool isSuitable = !theObj->entry().isEmpty() &&
+ !theObj->componentDataType().isEmpty() &&
+ !theObj->name().isEmpty();
return isSuitable;
}
{
// Do you want to reload it?
if ( SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "QUE_DOC_ALREADYOPEN" ).arg( aName ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No ) == SUIT_MessageBox::Yes )
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No ) == SUIT_MessageBox::Yes )
choice = OpenReload;
}
QList<SUIT_Application*> appList = session->applications();
for ( QList<SUIT_Application*>::iterator it = appList.begin(); it != appList.end() && !app; ++it )
{
- if ( (*it)->activeStudy() && (*it)->activeStudy()->studyName() == aName )
- app = ::qobject_cast<STD_Application*>( *it );
+ if ( (*it)->activeStudy() && (*it)->activeStudy()->studyName() == aName )
+ app = ::qobject_cast<STD_Application*>( *it );
}
if ( app )
{
- app->onCloseDoc( false );
- appList = session->applications();
- STD_Application* other = 0;
- for ( QList<SUIT_Application*>::iterator it = appList.begin(); it != appList.end() && !other; ++it )
- other = ::qobject_cast<STD_Application*>( *it );
-
- if ( other )
- res = other->onOpenDoc( aName );
+ app->onCloseDoc( false );
+ appList = session->applications();
+ STD_Application* other = 0;
+ for ( QList<SUIT_Application*>::iterator it = appList.begin(); it != appList.end() && !other; ++it )
+ other = ::qobject_cast<STD_Application*>( *it );
+
+ if ( other )
+ res = other->onOpenDoc( aName );
}
}
break;
enum { MenuWindowId = 6 };
enum { RenameId = CAM_Application::UserID,
- CloseId, CloseAllId, GroupAllId,
- PreferencesId, MRUId, ModulesListId,
+ CloseId, CloseAllId, GroupAllId,
+ PreferencesId, MRUId, ModulesListId,
NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId,
- NewQxSceneViewId = NewQxGraphViewId, StyleId,
- UserID };
+ NewQxSceneViewId = NewQxGraphViewId, StyleId,
+ UserID };
protected:
enum { NewStudyId = 1, OpenStudyId };
virtual QString getFileFilter() const;
virtual QString getFileName( bool open, const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent );
+ const QString& caption, QWidget* parent );
virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent );
+ const QString& caption, QWidget* parent );
void updateActions();
{
myGroupId = 0;
if( module() )
- myGroupId = qHash( module()->name() );
+ myGroupId = qHash( module()->name() );
}
/*!
{
SUIT_AbstractModel* m = dynamic_cast<SUIT_AbstractModel*>( browser ? browser->model() : 0 );
if( m )
- m->unregisterColumn( groupId(), name );
+ m->unregisterColumn( groupId(), name );
}
bool result = true;
bool calculated = false;
for ( int i = 0; i < idsLeft.count() || i < idsRight.count(); i++ ) {
- bool okLeft = true, okRight = true;
- int lid = 0, rid = 0;
- if ( i < idsLeft.count() )
- lid = idsLeft[i].toInt( &okLeft );
- if ( i < idsRight.count() )
- rid = idsRight[i].toInt( &okRight );
- if ( okLeft && okRight ) {
- // both seem to be correct integer ID
- return lid < rid;
- }
- else if ( okLeft || okRight ) {
- // objects with correct (int) ID have higher priority
- return okLeft;
- }
- else {
- // both not integer ID
- int r = QString::localeAwareCompare( idsLeft[i], idsRight[i] );
- if ( !calculated && r != 0 ) {
- result = r < 0;
- calculated = true;
- }
- }
+ bool okLeft = true, okRight = true;
+ int lid = 0, rid = 0;
+ if ( i < idsLeft.count() )
+ lid = idsLeft[i].toInt( &okLeft );
+ if ( i < idsRight.count() )
+ rid = idsRight[i].toInt( &okRight );
+ if ( okLeft && okRight ) {
+ // both seem to be correct integer ID
+ return lid < rid;
+ }
+ else if ( okLeft || okRight ) {
+ // objects with correct (int) ID have higher priority
+ return okLeft;
+ }
+ else {
+ // both not integer ID
+ int r = QString::localeAwareCompare( idsLeft[i], idsRight[i] );
+ if ( !calculated && r != 0 ) {
+ result = r < 0;
+ calculated = true;
+ }
+ }
}
// we should reach this if the entries are exactly equal
return result;
SUIT_ViewModel* vmodel = vman->getViewModel();
if( !vmodel )
- continue;
-
+ continue;
+
SALOME_View* view = dynamic_cast<SALOME_View*>(vmodel);
if( view && ( IsDisplayed( entry, view ) || view == GetActiveView() ) )
{
- Erase( entry, true, false, view );
- Display( entry, updateViewer, view );
+ Erase( entry, true, false, view );
+ Display( entry, updateViewer, view );
}
}
}
if ( prs ) {
vf->Erase( prs, forced );
if ( updateViewer )
- vf->Repaint();
+ vf->Repaint();
delete prs; // delete presentation because displayer is its owner
}
}
if ( SUIT_Application* app = session->activeApplication() ) {
if ( LightApp_Application* sApp = dynamic_cast<LightApp_Application*>( app ) ) {
if( SUIT_ViewManager* vman = sApp->activeViewManager() ) {
- if ( SUIT_ViewModel* vmod = vman->getViewModel() )
- return dynamic_cast<SALOME_View*>( vmod );
+ if ( SUIT_ViewModel* vmod = vman->getViewModel() )
+ return dynamic_cast<SALOME_View*>( vmod );
}
}
}
if( SUIT_Application* app = session->activeApplication() )
if( LightApp_Application* sApp = dynamic_cast<LightApp_Application*>( app ) )
if( SUIT_ViewManager* vman = sApp->activeViewManager() )
- if( SUIT_ViewModel* vmod = vman->getViewModel() )
- viewerType = vmod->getType();
+ if( SUIT_ViewModel* vmod = vman->getViewModel() )
+ viewerType = vmod->getType();
return canBeDisplayed( entry, viewerType );
}
SUIT_Desktop* aDesktop = 0;
while( parent )
- {
- if ( aDesktop = dynamic_cast<SUIT_Desktop*>(parent) )
- break;
- parent = parent->parentWidget();
- }
+ {
+ if ( aDesktop = dynamic_cast<SUIT_Desktop*>(parent) )
+ break;
+ parent = parent->parentWidget();
+ }
if ( aDesktop )
- aDesktop->emitActivated();
+ aDesktop->emitActivated();
}
else if(e->type() == SALOME_EVENT)
int addPreference( const QString& label );
int addPreference( const QString& label, const int pId, const int = LightApp_Preferences::Auto,
- const QString& section = QString(),
- const QString& param = QString() );
+ const QString& section = QString(),
+ const QString& param = QString() );
QVariant preferenceProperty( const int, const QString& ) const;
void setPreferenceProperty( const int, const QString&, const QVariant& );
\param icon module icon
*/
LightApp_ModuleDlg::LightApp_ModuleDlg( QWidget* parent,
- const QString& component,
- const QPixmap& icon )
+ const QString& component,
+ const QPixmap& icon )
: QDialog ( parent )
{
setModal( true );
{
QPushButton* btn = 0;
for ( ButtonMap::ConstIterator it = myButtons.begin();
- it != myButtons.end() && !btn; ++it ) {
+ it != myButtons.end() && !btn; ++it ) {
if ( it.value() == id )
btn = it.key();
}
#ifndef DISABLE_SALOMEOBJECT
Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject
( obj->entry().toLatin1().constData(),
- obj->componentDataType().toLatin1().constData(),
- obj->name().toLatin1().constData() );
+ obj->componentDataType().toLatin1().constData(),
+ obj->name().toLatin1().constData() );
LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj );
#else
LightApp_DataOwner* owner = new LightApp_DataOwner( obj->entry() );
if ( !myBrowser )
return;
- if( myEntries.count() == 0 || myModifiedTime < myBrowser->getModifiedTime() )
+ if( myEntries.count() == 0 || myModifiedTime < myBrowser->getModifiedTime() )
fillEntries( myEntries );
DataObjectList objList;
for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin();
- it != theList.end(); ++it ) {
+ it != theList.end(); ++it ) {
const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*it).operator->() );
if ( owner && myEntries.contains( owner->entry() ) )
objList.append( myEntries[owner->entry()] );
void LightApp_Preferences::changedResources( const ResourceMap& map )
{
for ( ResourceMap::ConstIterator it = map.begin();
- it != map.end(); ++it )
+ it != map.end(); ++it )
{
QString sec, param;
it.key()->resource( sec, param );
void LightApp_PreferencesDlg::onDefault()
{
if( SUIT_MessageBox::Ok == SUIT_MessageBox::question( this, tr( "WARNING" ), tr( "DEFAULT_QUESTION" ),
- SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel,
- SUIT_MessageBox::Ok ) )
+ SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel,
+ SUIT_MessageBox::Ok ) )
{
if ( myPrefs && myPrefs->resourceMgr() )
- {
+ {
QtxResourceMgr::WorkingMode prev = myPrefs->resourceMgr()->workingMode();
- myPrefs->resourceMgr()->setWorkingMode( QtxResourceMgr::IgnoreUserValues );
- myPrefs->retrieve();
+ myPrefs->resourceMgr()->setWorkingMode( QtxResourceMgr::IgnoreUserValues );
+ myPrefs->retrieve();
myPrefs->resourceMgr()->setWorkingMode( prev );
- }
+ }
}
}
SUIT_Selector* selector = it.next();
if( selector->type() != client && selector->isEnabled() )
{
- //mgr->selected( cur_sel, selector->type() );
+ //mgr->selected( cur_sel, selector->type() );
selector->selected( cur_sel );
- SUIT_DataOwnerPtrList::const_iterator aLIt = cur_sel.begin(), aLLast = cur_sel.end();
- for( ; aLIt!=aLLast; aLIt++ )
- sel.append( *aLIt ); //check entry and don't append if such entry is in list already
+ SUIT_DataOwnerPtrList::const_iterator aLIt = cur_sel.begin(), aLLast = cur_sel.end();
+ for( ; aLIt!=aLLast; aLIt++ )
+ sel.append( *aLIt ); //check entry and don't append if such entry is in list already
}
}
if( sowner )
{
entry = referencedToEntry( sowner->entry() );
- if( entries.contains( entry ) )
- continue;
+ if( entries.contains( entry ) )
+ continue;
- entries.insert( entry, 0 );
+ entries.insert( entry, 0 );
myEntries.insert( num, entry );
- myIsReferences.insert( num, sowner->entry() != entry );
+ myIsReferences.insert( num, sowner->entry() != entry );
processOwner( sowner );
- num++;
+ num++;
}
}
}
if ( app ) {
SUIT_Desktop* desk = app->desktop();
if ( desk )
- return desk->activeWindow();
+ return desk->activeWindow();
}
}
return 0;
}
else {
if( !entryMap.contains( entry ) && !owner->IO().IsNull() )
- theList.Append( owner->IO() );
+ theList.Append( owner->IO() );
}
entryMap.insert(checkEntry, 1);
const LightApp_DataSubOwner* subOwner = dynamic_cast<const LightApp_DataSubOwner*>( (*itr).operator->() );
if ( subOwner )
if ( subOwner->entry() == QString(IObject->getEntry()) )
- theIndex.Add( subOwner->index() );
+ theIndex.Add( subOwner->index() );
}
}
const LightApp_DataSubOwner* subOwner = dynamic_cast<const LightApp_DataSubOwner*>( (*itr).operator->() );
if ( subOwner )
if ( subOwner->entry() == theEntry )
- theIndex.Add( subOwner->index() );
+ theIndex.Add( subOwner->index() );
}
}
const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
if ( owner )
{
- if ( owner->entry() != ioEntry )
- {
- const LightApp_DataSubOwner* subOwner = dynamic_cast<const LightApp_DataSubOwner*>( owner );
- if ( subOwner )
- remainsOwners.append( new LightApp_DataSubOwner( subOwner->entry(), subOwner->index() ) );
- else
- remainsOwners.append( new LightApp_DataOwner( owner->entry() ) );
- }
+ if ( owner->entry() != ioEntry )
+ {
+ const LightApp_DataSubOwner* subOwner = dynamic_cast<const LightApp_DataSubOwner*>( owner );
+ if ( subOwner )
+ remainsOwners.append( new LightApp_DataSubOwner( subOwner->entry(), subOwner->index() ) );
+ else
+ remainsOwners.append( new LightApp_DataOwner( owner->entry() ) );
+ }
}
}
}
select 'subobjects' with given indexes
*/
void LightApp_SelectionMgr::selectObjects( const Handle(SALOME_InteractiveObject)& IObject,
- TColStd_IndexedMapOfInteger theIndex, bool append )
+ TColStd_IndexedMapOfInteger theIndex, bool append )
{
SUIT_DataOwnerPtrList aList;
{
int i;
for ( i = 1; i <= theIndex.Extent(); i++ )
- aList.append( new LightApp_DataSubOwner( QString(IObject->getEntry()), theIndex( i ) ) );
+ aList.append( new LightApp_DataSubOwner( QString(IObject->getEntry()), theIndex( i ) ) );
}
setSelected( aList, append );
for ( ; it.More(); it.Next() )
{
if ( it.Value().IsEmpty() )
- aList.append( new LightApp_DataOwner( QString(it.Key()->getEntry()) ) );
+ aList.append( new LightApp_DataOwner( QString(it.Key()->getEntry()) ) );
else
- {
- int i;
- for ( i = 1; i <= it.Value().Extent(); i++ )
- aList.append( new LightApp_DataSubOwner( QString(it.Key()->getEntry()), it.Value()( i ) ) );
- }
+ {
+ int i;
+ for ( i = 1; i <= it.Value().Extent(); i++ )
+ aList.append( new LightApp_DataSubOwner( QString(it.Key()->getEntry()), it.Value()( i ) ) );
+ }
}
setSelected( aList, append );
if ( !theMap.IsBound( subOwner->entry().toLatin1().data() ) )
#endif
{
- anIndexes.Clear();
- //Bug 17269: GetIndexes( subOwner->entry(), anIndexes );
+ anIndexes.Clear();
+ //Bug 17269: GetIndexes( subOwner->entry(), anIndexes );
//Bug 17269: To avoid multiple calling of selected(aList)
for ( SUIT_DataOwnerPtrList::const_iterator itr2 = itr; itr2 != aList.end(); ++itr2 )
{
anIndexes.Add( subOwner2->index() );
}
//
- theMap.Bind( subOwner->entry().toLatin1().data(), anIndexes );
+ theMap.Bind( subOwner->entry().toLatin1().data(), anIndexes );
}
}
}
void setSelectedObjects( const SALOME_ListIO&, const bool = false );
void GetIndexes( const Handle(SALOME_InteractiveObject)& IObject,
- TColStd_IndexedMapOfInteger& theIndex );
+ TColStd_IndexedMapOfInteger& theIndex );
void GetIndexes( const QString& theEntry,
- TColStd_IndexedMapOfInteger& theIndex );
+ TColStd_IndexedMapOfInteger& theIndex );
//bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
void AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject,
- const TColStd_MapOfInteger& theIndices,
- bool modeShift );
+ const TColStd_MapOfInteger& theIndices,
+ bool modeShift );
void selectObjects( const Handle(SALOME_InteractiveObject)& IObject,
- TColStd_IndexedMapOfInteger theIndex, bool append );
+ TColStd_IndexedMapOfInteger theIndex, bool append );
void selectObjects( MapIOOfMapOfInteger theMapIO, bool append );
void selectedSubOwners( MapEntryOfMapOfInteger& theMap );
{
LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( app->moduleTitle( *anIt ), true );
if( disp )
- disp->EraseAll( false, false, 0 );
+ disp->EraseAll( false, false, 0 );
}
if( myActionType==ERASE_ALL )
{
SUIT_Operation* anOp = anIter.next();
if ( anOp &&
- anOp->inherits( "LightApp_Operation" ) &&
+ anOp->inherits( "LightApp_Operation" ) &&
((LightApp_Operation*)anOp)->dlg() == aDlg )
return ((LightApp_Operation*)anOp);
}
Constructor.
*/
LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO,
- SUIT_Desktop* theDesktop )
+ SUIT_Desktop* theDesktop )
: LightApp_DataOwner( theIO ),
myDesktop( theDesktop )
{
*/
LightApp_VTKSelector
::LightApp_VTKSelector( SVTK_ViewModelBase* viewer,
- SUIT_SelectionMgr* mgr ):
+ SUIT_SelectionMgr* mgr ):
SUIT_Selector( mgr, viewer ),
myViewer( viewer )
{
if(myViewer){
if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){
if(SVTK_ViewManager* aViewMgr = dynamic_cast<SVTK_ViewManager*>(aViewManager)){
- if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
- if(SVTK_Selector* aSelector = aView->GetSelector()){
- const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
- SALOME_ListIteratorOfListIO anIter(aListIO);
- for(; anIter.More(); anIter.Next()){
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if(anIO->hasEntry())
- aList.append(new LightApp_SVTKDataOwner(anIO,aViewMgr->getDesktop()));
- }
- }
- }
+ if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
+ if(SVTK_Selector* aSelector = aView->GetSelector()){
+ const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ for(; anIter.More(); anIter.Next()){
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(anIO->hasEntry())
+ aList.append(new LightApp_SVTKDataOwner(anIO,aViewMgr->getDesktop()));
+ }
+ }
+ }
}
}
}
if(myViewer){
if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
- if(SVTK_Selector* aSelector = aView->GetSelector()){
- SALOME_ListIO anAppendList;
- const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
- SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();
- for(; anIter != theList.end(); ++anIter){
- const SUIT_DataOwner* aDataOwner = (*anIter).get();
- if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast<const LightApp_SVTKDataOwner*>(aDataOwner)){
- aSelector->SetSelectionMode(anOwner->GetMode());
- Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
+ if(SVTK_Selector* aSelector = aView->GetSelector()){
+ SALOME_ListIO anAppendList;
+ const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
+ SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin();
+ for(; anIter != theList.end(); ++anIter){
+ const SUIT_DataOwner* aDataOwner = (*anIter).get();
+ if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast<const LightApp_SVTKDataOwner*>(aDataOwner)){
+ aSelector->SetSelectionMode(anOwner->GetMode());
+ Handle(SALOME_InteractiveObject) anIO = anOwner->IO();
- aSelector->AddIObject(anIO);
+ aSelector->AddIObject(anIO);
- anAppendList.Append(anIO);
- aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
- }else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner)){
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(anOwner->entry().toLatin1(),"");
- aSelector->AddIObject(anIO);
- anAppendList.Append(anIO);
- }
- }
- // To remove IOs, which is not selected.
- QMap< QString, Handle( SALOME_InteractiveObject )> toRemove;
- SALOME_ListIteratorOfListIO anIt( aStoredList );
- for( ; anIt.More(); anIt.Next() )
- if( !anIt.Value().IsNull() )
- toRemove[ anIt.Value()->getEntry() ] = anIt.Value();
+ anAppendList.Append(anIO);
+ aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false);
+ }else if(const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>(aDataOwner)){
+ Handle(SALOME_InteractiveObject) anIO =
+ new SALOME_InteractiveObject(anOwner->entry().toLatin1(),"");
+ aSelector->AddIObject(anIO);
+ anAppendList.Append(anIO);
+ }
+ }
+ // To remove IOs, which is not selected.
+ QMap< QString, Handle( SALOME_InteractiveObject )> toRemove;
+ SALOME_ListIteratorOfListIO anIt( aStoredList );
+ for( ; anIt.More(); anIt.Next() )
+ if( !anIt.Value().IsNull() )
+ toRemove[ anIt.Value()->getEntry() ] = anIt.Value();
- anIt = SALOME_ListIteratorOfListIO(anAppendList);
- for( ; anIt.More(); anIt.Next() )
- toRemove.remove( anIt.Value()->getEntry() );
+ anIt = SALOME_ListIteratorOfListIO(anAppendList);
+ for( ; anIt.More(); anIt.Next() )
+ toRemove.remove( anIt.Value()->getEntry() );
- QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),
- REnd = toRemove.end();
- for( ; RIt!=REnd; RIt++ )
- aSelector->RemoveIObject( RIt.value() );
-
- aView->onSelectionChanged();
- }
+ QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(),
+ REnd = toRemove.end();
+ for( ; RIt!=REnd; RIt++ )
+ aSelector->RemoveIObject( RIt.value() );
+
+ aView->onSelectionChanged();
+ }
}
}
}
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_AISObject_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_AISObject",
- sizeof(SALOME_AISObject),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_AISObject),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_AISShape_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_AISShape",
- sizeof(SALOME_AISShape),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_AISShape),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_DataMapNodeOfDataMapOfIOMapOfInteger",
- sizeof(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_Filter_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_Filter",
- sizeof(SALOME_Filter),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_Filter),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
//
Standard_EXPORT SALOME_InteractiveObject();
Standard_EXPORT SALOME_InteractiveObject(const char* anEntry,
- const char* aComponentDataType,
- const char* aName = "");
+ const char* aComponentDataType,
+ const char* aName = "");
Standard_EXPORT void setEntry(const char* anEntry) ;
Standard_EXPORT const char* getEntry() ;
Standard_EXPORT void setName(const char* aName) ;
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_InteractiveObject_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_InteractiveObject",
- sizeof(SALOME_InteractiveObject),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_InteractiveObject),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_ListNodeOfListIO",
- sizeof(SALOME_ListNodeOfListIO),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_ListNodeOfListIO),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
//
Standard_EXPORT friend Handle_Standard_Type& SALOME_TypeFilter_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("SALOME_TypeFilter",
- sizeof(SALOME_TypeFilter),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
+ sizeof(SALOME_TypeFilter),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
return _aType;
}
qApp->processEvents();
myView->setCuttingPlane( true, SpinBox_X->value() , SpinBox_Y->value() , SpinBox_Z->value(),
- SpinBox_Dx->value(), SpinBox_Dy->value(), SpinBox_Dz->value() );
+ SpinBox_Dx->value(), SpinBox_Dy->value(), SpinBox_Dz->value() );
QApplication::restoreOverrideCursor();
intersector.Perform( gp_Lin( aCenter, aNormal), gp_Pln( aBasePnt, aNormal), Precision::Confusion() );
if ( intersector.IsDone() && intersector.NbPoints() == 1 )
- aBasePnt = intersector.Point( 1 );
+ aBasePnt = intersector.Point( 1 );
}
myPreviewPlane = new AIS_Plane( new Geom_Plane( aBasePnt, aNormal ) );
{
aView3d->InitActivePlanes();
if ( aView3d->MoreActivePlanes() )
- myClippingPlane = aView3d->ActivePlane();
+ myClippingPlane = aView3d->ActivePlane();
}
}
myKeyFlag = 0;
int aQuantityOfItems = myParametersMap.count();
-
+
setFixedSize( 400, 300 );
QGridLayout* aGrid = new QGridLayout( this );
QWidget* aWidget1 = new QWidget( this );
QWidget* aWidget2 = new QWidget( this );
-
+
QHBoxLayout* aLayout = new QHBoxLayout( aWidget1 );
-
+
myListBox = new QListWidget( aWidget1 );
myListBox->installEventFilter( this );
myCurViewPort->getView()->SetBackgroundColor( Quantity_NOC_BLACK );
myListBox->setEditTriggers( QAbstractItemView::DoubleClicked );
-
+
if ( aQuantityOfItems )
{
myListBox->clear();
connect( myListBox, SIGNAL( itemClicked( QListWidgetItem* ) ), this, SLOT( changeImage( QListWidgetItem* ) ) );
connect( myListBox, SIGNAL( itemChanged( QListWidgetItem* ) ), this, SLOT( editItemText( QListWidgetItem* ) ) );
-
+
aLayout->addWidget( myListBox );
aLayout->addWidget( myCurViewPort, 30 );
aButtonLayout->setSpacing( 5 );
QPushButton* theOk = new QPushButton( tr( "Ok" ), aWidget2 ); theOk->setAutoDefault( false );
- QPushButton* theCancel = new QPushButton( tr( "Cancel" ), aWidget2 ); theCancel->setAutoDefault( false );
- QPushButton* theDelete = new QPushButton( tr( "Delete" ), aWidget2 ); theDelete->setAutoDefault( false );
+ QPushButton* theCancel = new QPushButton( tr( "Cancel" ), aWidget2 ); theCancel->setAutoDefault( false );
+ QPushButton* theDelete = new QPushButton( tr( "Delete" ), aWidget2 ); theDelete->setAutoDefault( false );
QPushButton* theClearAll = new QPushButton( tr( "Clear List" ), aWidget2 ); theClearAll->setAutoDefault( false );
aButtonLayout->addWidget( theOk );
aGrid->addWidget( aWidget1, 0, 0 );
aGrid->addWidget( aWidget2, 1, 0 );
-
+
connect( theOk, SIGNAL( clicked() ), this, SLOT( OKpressed() ) );
connect( theCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( theDelete, SIGNAL( clicked() ), this, SLOT( deleteSelectedItems() ) );
{
for( int i = 0; i < (int)myListBox->count(); i++ )
{
- if( myListBox->item( i )->isSelected() && i != index )
- {
- myListBox->clearSelection();
- if( i > index )
- {
- lowLevel = index;
- highLevel = i;
- }
- else
- {
- lowLevel = i;
- highLevel = index;
- }
- for( int j = lowLevel; j <= highLevel; j++ )
- myListBox->item( j )->setSelected( TRUE );
- break;
- }
- if( myListBox->item( i )->isSelected() && i == index )
- myListBox->item( i )->setSelected( TRUE );
+ if( myListBox->item( i )->isSelected() && i != index )
+ {
+ myListBox->clearSelection();
+ if( i > index )
+ {
+ lowLevel = index;
+ highLevel = i;
+ }
+ else
+ {
+ lowLevel = i;
+ highLevel = index;
+ }
+ for( int j = lowLevel; j <= highLevel; j++ )
+ myListBox->item( j )->setSelected( TRUE );
+ break;
+ }
+ if( myListBox->item( i )->isSelected() && i == index )
+ myListBox->item( i )->setSelected( TRUE );
}
}
for( int i = 0; i < (int)myListBox->count(); i++ )
if( myListBox->item( i )->isSelected() && ( myListBox->item( i )->flags() & Qt::ItemIsEditable ) )
{
- QListWidgetItem* anItemToDelete = myListBox->takeItem( i );
- delete anItemToDelete;
- for( int j = i; j < (int)myParametersMap.count(); j++ )
- if( j != myParametersMap.count() - 1 )
- myParametersMap[ j ] = myParametersMap[ j + 1 ];
- else
- myParametersMap.removeAt( j );
- if( i != myListBox->count() )
- curIndex = i;
- else
- curIndex = i - 1;
- i--;
+ QListWidgetItem* anItemToDelete = myListBox->takeItem( i );
+ delete anItemToDelete;
+ for( int j = i; j < (int)myParametersMap.count(); j++ )
+ if( j != myParametersMap.count() - 1 )
+ myParametersMap[ j ] = myParametersMap[ j + 1 ];
+ else
+ myParametersMap.removeAt( j );
+ if( i != myListBox->count() )
+ curIndex = i;
+ else
+ curIndex = i - 1;
+ i--;
}
if( curIndex >= 0 )
{
if( aKeyEv->key() == Qt::Key_Control )
{
myKeyFlag = 1;
- myListBox->setSelectionMode( QAbstractItemView::MultiSelection );
+ myListBox->setSelectionMode( QAbstractItemView::MultiSelection );
}
else if( aKeyEv->key() == Qt::Key_Shift )
{
myKeyFlag = 2;
- myListBox->setSelectionMode( QAbstractItemView::MultiSelection );
+ myListBox->setSelectionMode( QAbstractItemView::MultiSelection );
}
else
myListBox->setSelectionMode( QAbstractItemView::SingleSelection );
class OCCVIEWER_EXPORT OCCViewer_CreateRestoreViewDlg : public QDialog
{
- Q_OBJECT
+ Q_OBJECT
public:
- OCCViewer_CreateRestoreViewDlg( QWidget*, OCCViewer_Viewer* );
- virtual ~OCCViewer_CreateRestoreViewDlg();
+ OCCViewer_CreateRestoreViewDlg( QWidget*, OCCViewer_Viewer* );
+ virtual ~OCCViewer_CreateRestoreViewDlg();
- const viewAspectList& parameters() const;
- viewAspect currentItem() const;
- virtual bool eventFilter( QObject*, QEvent* );
+ const viewAspectList& parameters() const;
+ viewAspect currentItem() const;
+ virtual bool eventFilter( QObject*, QEvent* );
public slots:
- void OKpressed();
- void clearList();
- void editItemText( QListWidgetItem* );
- void changeImage( QListWidgetItem* );
- void deleteSelectedItems();
+ void OKpressed();
+ void clearList();
+ void editItemText( QListWidgetItem* );
+ void changeImage( QListWidgetItem* );
+ void deleteSelectedItems();
signals:
- void dlgOk();
+ void dlgOk();
private:
- int myKeyFlag;
- QListWidget* myListBox;
- OCCViewer_ViewPort3d* myCurViewPort;
- viewAspect myCurrentItem;
- viewAspectList myParametersMap;
+ int myKeyFlag;
+ QListWidget* myListBox;
+ OCCViewer_ViewPort3d* myCurViewPort;
+ viewAspect myCurrentItem;
+ viewAspectList myParametersMap;
};
#ifdef WIN32
}
else
myView->activateSetRotationSelected(myX->text().toDouble(),
- myY->text().toDouble(),
- myZ->text().toDouble());
+ myY->text().toDouble(),
+ myZ->text().toDouble());
}
void
mySelectPoint->toggle();
setCoords();
myView->activateSetRotationSelected(myX->text().toDouble(),
- myY->text().toDouble(),
- myZ->text().toDouble());
+ myY->text().toDouble(),
+ myZ->text().toDouble());
}
void
if ( !myIsBBCenter->isChecked() )
{
if ( mySelectPoint->isChecked()
- &&
- ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
+ &&
+ ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
mySelectPoint->toggle();
myView->activateSetRotationSelected(myX->text().toDouble(),
- myY->text().toDouble(),
- myZ->text().toDouble());
+ myY->text().toDouble(),
+ myZ->text().toDouble());
}
}
public:
OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , QWidget* parent = 0,
- const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
+ const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
~OCCViewer_SetRotationPointDlg();
void SetAction( QtxAction* theAction ) { myAction = theAction; }
myWnd( wnd )
{
connect( this, SIGNAL( maybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ),
- this, SLOT( onToolTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) );
+ this, SLOT( onToolTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) );
}
/*!
* Redefined method. Calculates the object presentation.
*/
void OCCViewer_Trihedron::Compute( const Handle( PrsMgr_PresentationManager3d )&,
- const Handle( Prs3d_Presentation )& aPrs,
- const Standard_Integer aMode )
+ const Handle( Prs3d_Presentation )& aPrs,
+ const Standard_Integer aMode )
{
if( aPrs.IsNull() )
return;
* Redefined method. Does nothing.
*/
void OCCViewer_Trihedron::ComputeSelection( const Handle( SelectMgr_Selection )& theSelection,
- const Standard_Integer theMode )
+ const Standard_Integer theMode )
{
}
virtual ~OCCViewer_Trihedron();
virtual void Compute( const Handle(PrsMgr_PresentationManager3d)&,
- const Handle(Prs3d_Presentation)&,
- const Standard_Integer );
+ const Handle(Prs3d_Presentation)&,
+ const Standard_Integer );
virtual void ComputeSelection( const Handle( SelectMgr_Selection )&,
- const Standard_Integer );
+ const Standard_Integer );
virtual void bounds( Graphic3d_CBounds& ) const;
Create native view window for CasCade view [ static ]
*/
Handle(Aspect_Window) OCCViewer_VService::CreateWindow( const Handle(V3d_View)& view,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality quality )
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality quality )
{
#ifdef WNT
Handle(WNT_Window) viewWindow = new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin );
Maps CasCade view to the window [ static ]
*/
void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality quality )
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality quality )
{
view->SetWindow( OCCViewer_VService::CreateWindow( view, hiwin, lowin, quality ) );
}
Magnifies 'view' based on previous view [ static ]
*/
void OCCViewer_VService::SetMagnify( const Handle(V3d_View)& view,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Handle(V3d_View)& prevView,
- const Standard_Integer x1,
- const Standard_Integer y1,
- const Standard_Integer x2,
- const Standard_Integer y2,
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Handle(V3d_View)& prevView,
+ const Standard_Integer x1,
+ const Standard_Integer y1,
+ const Standard_Integer x2,
+ const Standard_Integer y2,
const Xw_WindowQuality aQuality )
{
#ifdef WNT
Creates view 2D and maps it to the window [ static ]
*/
/*Handle(V2d_View) OCCViewer_VService::View2d( const Handle(V2d_Viewer)& aViewer,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality aQuality,
- const Standard_Boolean Update,
- const Quantity_NameOfColor BackColor )
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality aQuality,
+ const Standard_Boolean Update,
+ const Quantity_NameOfColor BackColor )
{
#ifdef WNT
Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device());
Creates view 2D and maps it to the window [ static ]
*/
/*Handle(V2d_View) OCCViewer_VService::dpsView2d( const Handle(V2d_Viewer)& aViewer,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality aQuality,
- const Standard_Boolean Update,
- const Quantity_NameOfColor BackColor )
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality aQuality,
+ const Standard_Boolean Update,
+ const Quantity_NameOfColor BackColor )
{
#ifdef WNT
Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device());
Creates viewer 2D [ static ]
*/
/*Handle(V2d_Viewer) OCCViewer_VService::Viewer2d( const Standard_CString aDisplay,
- const Standard_ExtString aName,
- const Standard_CString aDomain )
+ const Standard_ExtString aName,
+ const Standard_CString aDomain )
{
#ifdef WNT
if ( XServiceDefault2dDevice.IsNull() )
Creates viewer 2D [ static ]
*/
/*Handle(V2d_Viewer) OCCViewer_VService::Viewer2d( const Standard_CString aDisplay,
- const Handle(Graphic2d_View)& aView,
- const Standard_ExtString aName,
- const Standard_CString aDomain )
+ const Handle(Graphic2d_View)& aView,
+ const Standard_ExtString aName,
+ const Standard_CString aDomain )
{
#ifdef WNT
if ( XServiceDefault2dDevice.IsNull() )
// STATIC METHODS
static Handle(Aspect_Window)
CreateWindow( const Handle(V3d_View)& view,
- const Standard_Integer hiwin,
- const Standard_Integer lowin,
- const Xw_WindowQuality quality );
+ const Standard_Integer hiwin,
+ const Standard_Integer lowin,
+ const Xw_WindowQuality quality );
static void SetWindow( const Handle( V3d_View )& view,
const Standard_Integer hiwin,
SUIT_ViewModel::setViewManager(theViewManager);
if (theViewManager) {
connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
- this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+ this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)),
this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
*/
void OCCViewer_Viewer::clearViewAspects()
{
- myViewAspects.clear();
+ myViewAspects.clear();
}
/*!
*/
const viewAspectList& OCCViewer_Viewer::getViewAspects()
{
- return myViewAspects;
+ return myViewAspects;
}
/*!
*/
void OCCViewer_Viewer::appendViewAspect( const viewAspect& aParams )
{
- myViewAspects.append( aParams );
+ myViewAspects.append( aParams );
}
/*!
*/
void OCCViewer_Viewer::updateViewAspects( const viewAspectList& aViewList )
{
- myViewAspects = aViewList;
+ myViewAspects = aViewList;
}
/*!
struct viewAspect
{
public:
- double scale;
- double centerX;
- double centerY;
- double projX;
- double projY;
- double projZ;
- double twist;
- double atX;
- double atY;
- double atZ;
- double eyeX;
- double eyeY;
- double eyeZ;
+ double scale;
+ double centerX;
+ double centerY;
+ double projX;
+ double projY;
+ double projZ;
+ double twist;
+ double atX;
+ double atY;
+ double atZ;
+ double eyeX;
+ double eyeY;
+ double eyeZ;
double scaleX;
double scaleY;
double scaleZ;
- QString name;
- bool isVisible;
- double size;
+ QString name;
+ bool isVisible;
+ double size;
};
typedef QList<viewAspect> viewAspectList;
/* Selection management */
bool highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true );
- bool unHighlightAll( bool=true );
+ bool unHighlightAll( bool=true );
bool isInViewer( const Handle(AIS_InteractiveObject)&, bool=false );
bool isVisible( const Handle(AIS_InteractiveObject)& );
struct CMapEntry
{
- CMapEntry();
- ~CMapEntry();
- Colormap cmap;
- bool alloc;
- XStandardColormap scmap;
+ CMapEntry();
+ ~CMapEntry();
+ Colormap cmap;
+ bool alloc;
+ XStandardColormap scmap;
};
/*!
*/
CMapEntry::CMapEntry()
{
- cmap = 0;
- alloc = false;
- scmap.colormap = 0;
+ cmap = 0;
+ alloc = false;
+ scmap.colormap = 0;
}
/*!
*/
CMapEntry::~CMapEntry()
{
- if ( alloc )
- XFreeColormap( QX11Info::display(), cmap );
+ if ( alloc )
+ XFreeColormap( QX11Info::display(), cmap );
}
static QMultiHash<int,CMapEntry> *cmap_dict = 0;
static void cleanup_cmaps()
{
- if ( !cmap_dict )
- return;
- //while (!cmap_dict->isEmpty())
- // cmap_dict->erase(cmap_dict->begin());
- cmap_dict->clear();
- delete cmap_dict;
- cmap_dict = 0;
+ if ( !cmap_dict )
+ return;
+ //while (!cmap_dict->isEmpty())
+ // cmap_dict->erase(cmap_dict->begin());
+ cmap_dict->clear();
+ delete cmap_dict;
+ cmap_dict = 0;
}
static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
{
if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, hp_cmaps ) )
{
- i = 0;
- while ( i < n && x.cmap == 0 )
- {
- if ( c[i].visualid == vi->visual->visualid )
- {
- x.cmap = c[i].colormap;
- x.scmap = c[i];
- }
- i++;
- }
- XFree( (char*)c );
+ i = 0;
+ while ( i < n && x.cmap == 0 )
+ {
+ if ( c[i].visualid == vi->visual->visualid )
+ {
+ x.cmap = c[i].colormap;
+ x.scmap = c[i];
+ }
+ i++;
+ }
+ XFree( (char*)c );
}
}
}
{
if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, XA_RGB_DEFAULT_MAP ) )
{
- i = 0;
- while ( i < n && x.cmap == 0 )
- {
- if ( c[i].visualid == vi->visualid )
- {
- x.cmap = c[i].colormap;
- x.scmap = c[i];
- }
- i++;
- }
- XFree( (char *)c );
+ i = 0;
+ while ( i < n && x.cmap == 0 )
+ {
+ if ( c[i].visualid == vi->visualid )
+ {
+ x.cmap = c[i].colormap;
+ x.scmap = c[i];
+ }
+ i++;
+ }
+ XFree( (char *)c );
}
}
}
OCCViewer_ViewPort::OCCViewer_ViewPort( QWidget* parent )
: QWidget( parent )
{
- initialize();
+ initialize();
}
/*!
*/
OCCViewer_ViewPort::~OCCViewer_ViewPort()
{
- cleanup();
+ cleanup();
}
/*!
void OCCViewer_ViewPort::selectVisualId()
{
#if !defined WNT
- XVisualInfo* pVisualInfo;
- if ( QX11Info::display() )
- {
- /* Initialization with the default VisualID */
- Visual *v = DefaultVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ) );
- int visualID = XVisualIDFromVisual( v );
+ XVisualInfo* pVisualInfo;
+ if ( QX11Info::display() )
+ {
+ /* Initialization with the default VisualID */
+ Visual *v = DefaultVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ) );
+ int visualID = XVisualIDFromVisual( v );
- /* Here we use the settings from Optimizer_ViewInfo::TxglCreateWindow() */
- int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None };
+ /* Here we use the settings from Optimizer_ViewInfo::TxglCreateWindow() */
+ int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None };
- pVisualInfo = ::glXChooseVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ), visualAttr );
+ pVisualInfo = ::glXChooseVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ), visualAttr );
- if ( isVisible() )
- hide();
+ if ( isVisible() )
+ hide();
- XSetWindowAttributes a;
+ XSetWindowAttributes a;
- a.colormap = choose_cmap( QX11Info::display(), pVisualInfo ); /* find best colormap */
- a.background_pixel = QColormap::instance().pixel( backgroundColor() );
- a.border_pixel = QColormap::instance().pixel( Qt::black );
- Window p = RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) );
- if ( parentWidget() )
- p = parentWidget()->winId();
+ a.colormap = choose_cmap( QX11Info::display(), pVisualInfo ); /* find best colormap */
+ a.background_pixel = QColormap::instance().pixel( backgroundColor() );
+ a.border_pixel = QColormap::instance().pixel( Qt::black );
+ Window p = RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) );
+ if ( parentWidget() )
+ p = parentWidget()->winId();
- Window w;
- /* if ( type == Type2D ) // creating simple X window for 2d
+ Window w;
+ /* if ( type == Type2D ) // creating simple X window for 2d
{
unsigned long xbackground =
BlackPixel( QX11Info::display(), DefaultScreen( QX11Info::display() ) );
}
else if ( type == Type3D )
{
- w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(),
+ w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(),
0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
CWBackPixel | CWBorderPixel | CWColormap, &a );
- }
- else
- return;*/
- w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(),
- 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
- CWBackPixel | CWBorderPixel | CWColormap, &a );
-
- Window *cmw;
- Window *cmwret;
- int count;
- if ( XGetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), &cmwret, &count ) )
- {
- cmw = new Window[count+1];
- memcpy( (char*)cmw, (char*)cmwret, sizeof(Window) * count );
- XFree( (char*)cmwret );
+ }
+ else
+ return;*/
+ w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(),
+ 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
+ CWBackPixel | CWBorderPixel | CWColormap, &a );
+
+ Window *cmw;
+ Window *cmwret;
+ int count;
+ if ( XGetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), &cmwret, &count ) )
+ {
+ cmw = new Window[count+1];
+ memcpy( (char*)cmw, (char*)cmwret, sizeof(Window) * count );
+ XFree( (char*)cmwret );
int i;
- for ( i = 0; i < count; i++ )
- {
- if ( cmw[i] == winId() ) /* replace old window */
- {
- cmw[i] = w;
- break;
- }
- }
-
- if ( i >= count ) /* append new window */
- cmw[count++] = w;
- }
- else
- {
- count = 1;
- cmw = new Window[count];
- cmw[0] = w;
- }
-
- /* Creating new window (with good VisualID) for this widget */
- create(w);
- XSetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), cmw, count );
- delete[] cmw;
-
- if ( isVisible() )
+ for ( i = 0; i < count; i++ )
+ {
+ if ( cmw[i] == winId() ) /* replace old window */
+ {
+ cmw[i] = w;
+ break;
+ }
+ }
+
+ if ( i >= count ) /* append new window */
+ cmw[count++] = w;
+ }
+ else
+ {
+ count = 1;
+ cmw = new Window[count];
+ cmw[0] = w;
+ }
+
+ /* Creating new window (with good VisualID) for this widget */
+ create(w);
+ XSetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), cmw, count );
+ delete[] cmw;
+
+ if ( isVisible() )
show();
- if ( pVisualInfo )
+ if ( pVisualInfo )
{
- XFree( (char *)pVisualInfo );
- }
- XFlush( QX11Info::display() );
- }
+ XFree( (char *)pVisualInfo );
+ }
+ XFlush( QX11Info::display() );
+ }
#endif
}
*/
void OCCViewer_ViewPort::setSketchingEnabled( bool enable )
{
- myEnableSketching = enable;
+ myEnableSketching = enable;
}
/*!
*/
void OCCViewer_ViewPort::setTransformEnabled( bool enable )
{
- myEnableTransform = enable;
+ myEnableTransform = enable;
}
/*!
*/
void OCCViewer_ViewPort::paintEvent( QPaintEvent* )
{
- if ( myPaintersRedrawing )
- {
- QPainter p( this );
- emit vpDrawExternal( &p );
- myPaintersRedrawing = false;
- }
+ if ( myPaintersRedrawing )
+ {
+ QPainter p( this );
+ emit vpDrawExternal( &p );
+ myPaintersRedrawing = false;
+ }
}
/*!
*/
void OCCViewer_ViewPort::redrawPainters()
{
- myPaintersRedrawing = true;
- repaint();
+ myPaintersRedrawing = true;
+ repaint();
}
/*!
*/
/*void OCCViewer_ViewPort::onCreatePopup( QPopupMenu* popup )
{
- if ( popup )
- {
- QtxAction* a = new QtxAction( "", tr( "MEN_VP_CHANGEBGR" ), 0, this );
+ if ( popup )
+ {
+ QtxAction* a = new QtxAction( "", tr( "MEN_VP_CHANGEBGR" ), 0, this );
a->setStatusTip( tr( "PRP_VP_CHANGEBGR" ) );
- connect( a, SIGNAL( activated() ), SLOT( onChangeBgColor()));
- myPopupActions.append( a );
- a->addTo( popup );
- }
+ connect( a, SIGNAL( activated() ), SLOT( onChangeBgColor()));
+ myPopupActions.append( a );
+ a->addTo( popup );
+ }
}*/
/*!
*/
/*void OCCViewer_ViewPort::onDestroyPopup( QPopupMenu* popup )
{
- if ( popup )
- {
- for ( QtxAction* a = myPopupActions.first(); a; a = myPopupActions.next() )
- a->removeFrom( popup );
- //while (!myPopupActions.isEmpty())
- // delete myPopupActions.takeFirst();
- myPopupActions.clear();
- }
+ if ( popup )
+ {
+ for ( QtxAction* a = myPopupActions.first(); a; a = myPopupActions.next() )
+ a->removeFrom( popup );
+ //while (!myPopupActions.isEmpty())
+ // delete myPopupActions.takeFirst();
+ myPopupActions.clear();
+ }
}*/
/*!
virtual ~OCCViewer_ViewPort();
public:
- void setSketchingEnabled( bool );
+ void setSketchingEnabled( bool );
bool isSketchingEnabled() const;
- void setTransformEnabled( bool );
+ void setTransformEnabled( bool );
bool isTransformEnabled() const;
virtual QColor backgroundColor() const;
virtual void setBackgroundColor( const QColor& );
- void redrawPainters();
+ void redrawPainters();
virtual void onUpdate();
virtual QPaintEngine* paintEngine() const;
protected:
-// enum ViewType { Type2D, Type3D };
- void selectVisualId();
+// enum ViewType { Type2D, Type3D };
+ void selectVisualId();
// EVENTS
virtual void paintEvent( QPaintEvent *);
- virtual void mouseMoveEvent( QMouseEvent *);
- virtual void mouseReleaseEvent( QMouseEvent *);
- virtual void mousePressEvent( QMouseEvent *);
- virtual void mouseDoubleClickEvent( QMouseEvent *);
+ virtual void mouseMoveEvent( QMouseEvent *);
+ virtual void mouseReleaseEvent( QMouseEvent *);
+ virtual void mousePressEvent( QMouseEvent *);
+ virtual void mouseDoubleClickEvent( QMouseEvent *);
virtual void keyPressEvent( QKeyEvent *);
virtual void keyReleaseEvent( QKeyEvent *);
// TO BE REDEFINED
- virtual void reset() = 0;
- virtual void pan( int, int ) = 0;
- virtual void setCenter( int, int ) = 0;
- virtual void fitRect( const QRect& ) = 0;
- virtual void zoom( int, int, int, int ) = 0;
- virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
+ virtual void reset() = 0;
+ virtual void pan( int, int ) = 0;
+ virtual void setCenter( int, int ) = 0;
+ virtual void fitRect( const QRect& ) = 0;
+ virtual void zoom( int, int, int, int ) = 0;
+ virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
// POPUP
// void onCreatePopup( QPopupMenu* );
// void onDestroyPopup( QPopupMenu* );
protected slots:
- virtual void onChangeBgColor();
+ virtual void onChangeBgColor();
signals:
- void vpKeyEvent( QKeyEvent* );
- void vpMouseEvent( QMouseEvent* );
- void vpDrawExternal( QPainter* );
+ void vpKeyEvent( QKeyEvent* );
+ void vpMouseEvent( QMouseEvent* );
+ void vpDrawExternal( QPainter* );
void vpChangeBGColor( QColor );
private:
- void initialize();
- void cleanup();
+ void initialize();
+ void cleanup();
protected:
Handle(Aspect_Window) myWindow;
- bool myEnableSketching;
- bool myEnableTransform;
- bool myPaintersRedrawing; /* set to draw externally */
+ bool myEnableSketching;
+ bool myEnableTransform;
+ bool myPaintersRedrawing; /* set to draw externally */
QList<QtxAction*> myPopupActions;
private:
- static int nCounter; /* objects counter */
+ static int nCounter; /* objects counter */
};
#ifdef WIN32
/* Syncronize view types */
/* if ( tgtView->Type() != refView->Type() )
- {
- setActive( refView->Type() );
- tgtView = getView();
- }*/
+ {
+ setActive( refView->Type() );
+ tgtView = getView();
+ }*/
/* The following params are copied:
- view type( ortho/persp )
myActiveView->SetZSize( zsize );
/* if ( !myOrthoView.IsNull() )
myOrthoView->SetZSize( zsize );
- if ( !myPerspView.IsNull() )
+ if ( !myPerspView.IsNull() )
myPerspView->SetZSize( zsize );*/
}
{
if ( !activeView().IsNull() ) {
activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255.,
- color.green()/255., color.blue()/255.);
+ color.green()/255., color.blue()/255.);
activeView()->Update();
emit vpChangeBGColor( color );
}
Inits 'rotation' transformation. [ protected ]
*/
void OCCViewer_ViewPort3d::startRotation( int x, int y,
- int theRotationPointType,
- const gp_Pnt& theSelectedPoint )
+ int theRotationPointType,
+ const gp_Pnt& theSelectedPoint )
{
if ( !activeView().IsNull() ) {
myDegenerated = activeView()->DegenerateModeIsOn();
ry = Standard_Real(activeView()->Convert(Y));
activeView()->Rotate( 0., 0., 0.,
- theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(),
- Standard_True );
+ theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(),
+ Standard_True );
Quantity_Ratio zRotationThreshold;
zRotation = Standard_False;
zRotationThreshold = 0.45;
if( zRotationThreshold > 0. ) {
- Standard_Real dx = Abs(sx - rx/2.);
- Standard_Real dy = Abs(sy - ry/2.);
- Standard_Real dd = zRotationThreshold * (rx + ry)/2.;
- if( dx > dd || dy > dd ) zRotation = Standard_True;
+ Standard_Real dx = Abs(sx - rx/2.);
+ Standard_Real dy = Abs(sy - ry/2.);
+ Standard_Real dd = zRotationThreshold * (rx + ry)/2.;
+ if( dx > dd || dy > dd ) zRotation = Standard_True;
}
break;
default:
Rotates the viewport. [ protected ]
*/
void OCCViewer_ViewPort3d::rotate( int x, int y,
- int theRotationPointType,
- const gp_Pnt& theSelectedPoint )
+ int theRotationPointType,
+ const gp_Pnt& theSelectedPoint )
{
if ( !activeView().IsNull() ) {
switch ( theRotationPointType ) {
case OCCViewer_ViewWindow::SELECTED:
double dx, dy, dz;
if( zRotation ) {
- dz = atan2(Standard_Real(x)-rx/2., ry/2.-Standard_Real(y)) -
- atan2(sx-rx/2.,ry/2.-sy);
- dx = dy = 0.;
+ dz = atan2(Standard_Real(x)-rx/2., ry/2.-Standard_Real(y)) -
+ atan2(sx-rx/2.,ry/2.-sy);
+ dx = dy = 0.;
}
else {
- dx = (Standard_Real(x) - sx) * Standard_PI/rx;
- dy = (sy - Standard_Real(y)) * Standard_PI/ry;
- dz = 0.;
+ dx = (Standard_Real(x) - sx) * Standard_PI/rx;
+ dy = (sy - Standard_Real(y)) * Standard_PI/ry;
+ dz = 0.;
}
activeView()->Rotate( dx, dy, dz,
- theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(),
- Standard_False );
+ theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(),
+ Standard_False );
break;
default:
break;
public:
Handle(V3d_View) getView() const;
- Handle(V3d_View) setView( const Handle(V3d_View)& );
+ Handle(V3d_View) setView( const Handle(V3d_View)& );
Handle(V3d_Viewer) getViewer() const;
void setAnimationMode(bool theDegenerated);
- virtual void setBackgroundColor( const QColor& color);
- virtual QColor backgroundColor() const;
+ virtual void setBackgroundColor( const QColor& color);
+ virtual QColor backgroundColor() const;
// void setActive( V3d_TypeOfView );
virtual bool syncronize( const OCCViewer_ViewPort3d* );
virtual void onUpdate();
// TRANSFORMATIONS
- virtual void reset();
- virtual void pan( int , int );
- virtual void setCenter( int , int );
- virtual void fitRect( const QRect& );
- virtual void zoom( int, int, int, int );
- virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
-
- void startRotation( int, int, int, const gp_Pnt& );
- void rotate( int, int, int, const gp_Pnt& );
- void endRotation();
+ virtual void reset();
+ virtual void pan( int , int );
+ virtual void setCenter( int , int );
+ virtual void fitRect( const QRect& );
+ virtual void zoom( int, int, int, int );
+ virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
+
+ void startRotation( int, int, int, const gp_Pnt& );
+ void rotate( int, int, int, const gp_Pnt& );
+ void endRotation();
bool isBusy() {return myBusy;} // check that View Port is fully initialized
protected:
// EVENTS
- virtual void paintEvent( QPaintEvent* );
+ virtual void paintEvent( QPaintEvent* );
virtual void resizeEvent( QResizeEvent* );
// initialization
Handle(V3d_View) activeView() const;
Handle(V3d_View) inactiveView() const;
bool mapView( const Handle(V3d_View)& );
- bool setWindow( const Handle(V3d_View)& );
- bool mapped( const Handle(V3d_View)& ) const;
+ bool setWindow( const Handle(V3d_View)& );
+ bool mapped( const Handle(V3d_View)& ) const;
private:
- Handle(V3d_View) myOrthoView;
- Handle(V3d_View) myPerspView;
- Handle(V3d_View) myActiveView;
- bool myDegenerated;
+ Handle(V3d_View) myOrthoView;
+ Handle(V3d_View) myPerspView;
+ Handle(V3d_View) myActiveView;
+ bool myDegenerated;
bool myAnimate;
bool myBusy;
- double myScale;
+ double myScale;
};
#ifdef WIN32
myResult = Accept;
QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(),
e->globalPos(), e->button(),
- e->buttons(), e->modifiers() ) );
+ e->buttons(), e->modifiers() ) );
}
}
myResult = Reject;
QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(),
e->globalPos(), e->button(),
- e->buttons(), e->modifiers() ) );
+ e->buttons(), e->modifiers() ) );
}
else if ( e->type() == QEvent::MouseButtonRelease && ( e->button() & myAddButton ) )
{
}
bool OCCViewer_PolygonSketcher::isIntersect( const QPoint& aStart1, const QPoint& anEnd1,
- const QPoint& aStart2, const QPoint& anEnd2 ) const
+ const QPoint& aStart2, const QPoint& anEnd2 ) const
{
if ( ( aStart1 == aStart2 && anEnd1 == anEnd2 ) ||
( aStart1 == anEnd2 && anEnd1 == aStart2 ) )
\param theModel OCC 3D viewer
*/
OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop,
- OCCViewer_Viewer* theModel )
+ OCCViewer_Viewer* theModel )
: SUIT_ViewWindow( theDesktop )
{
myModel = theModel;
case ROTATE:
if ( theEvent->button() == Qt::LeftButton ) {
- myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
- emit vpTransformationStarted ( ROTATE );
- }
+ myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+ emit vpTransformationStarted ( ROTATE );
+ }
break;
default:
/* Try to activate a transformation */
switch ( getButtonState(theEvent) ) {
case ZOOMVIEW:
- activateZoom();
+ activateZoom();
break;
case PANVIEW:
- activatePanning();
+ activatePanning();
break;
case ROTATE:
- activateRotation();
- myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+ activateRotation();
+ myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
break;
default:
if ( myRotationPointSelection )
{
- if ( theEvent->button() == Qt::LeftButton )
- {
- Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
- ic->Select();
- for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() )
- {
- TopoDS_Shape aShape = ic->SelectedShape();
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
- {
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
- if ( mySetRotationPointDlg )
- {
- myRotationPointSelection = false;
- mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z());
- }
- }
- else
- {
- myCurrPointType = myPrevPointType;
- break;
- }
- }
- if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType;
- if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
- ic->CloseAllContexts();
- myOperation = NOTHING;
- myViewPort->setCursor( myCursor );
- myCursorIsHand = false;
- myRotationPointSelection = false;
- }
+ if ( theEvent->button() == Qt::LeftButton )
+ {
+ Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
+ ic->Select();
+ for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() )
+ {
+ TopoDS_Shape aShape = ic->SelectedShape();
+ if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+ {
+ gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
+ if ( mySetRotationPointDlg )
+ {
+ myRotationPointSelection = false;
+ mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z());
+ }
+ }
+ else
+ {
+ myCurrPointType = myPrevPointType;
+ break;
+ }
+ }
+ if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType;
+ if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
+ ic->CloseAllContexts();
+ myOperation = NOTHING;
+ myViewPort->setCursor( myCursor );
+ myCursorIsHand = false;
+ myRotationPointSelection = false;
+ }
}
else
- emit mousePressed(this, theEvent);
+ emit mousePressed(this, theEvent);
break;
}
/* notify that we start a transformation */
if ( transformRequested() )
- emit vpTransformationStarted ( myOperation );
+ emit vpTransformationStarted ( myOperation );
}
if ( transformRequested() )
setTransformInProcess( true );
void OCCViewer_ViewWindow::activateZoom()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
+ myCursor = cursor(); /* save old cursor */
if ( myOperation != ZOOMVIEW ) {
QPixmap zoomPixmap (imageZoomCursor);
void OCCViewer_ViewWindow::activatePanning()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); // save old cursor
+ myCursor = cursor(); // save old cursor
if ( myOperation != PANVIEW ) {
QCursor panCursor (Qt::SizeAllCursor);
void OCCViewer_ViewWindow::activateRotation()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); // save old cursor
+ myCursor = cursor(); // save old cursor
if ( myOperation != ROTATE ) {
QPixmap rotatePixmap (imageRotateCursor);
QCursor glPanCursor (globalPanPixmap);
myCurScale = aView3d->Scale();
aView3d->FitAll(0.01, false);
- myCursor = cursor(); // save old cursor
+ myCursor = cursor(); // save old cursor
myViewPort->fitAll(); // fits view before selecting a new scene center
setTransformRequested( PANGLOBAL );
myViewPort->setCursor( glPanCursor );
void OCCViewer_ViewWindow::activateWindowFit()
{
if ( !transformRequested() && !myCursorIsHand )
- myCursor = cursor(); /* save old cursor */
+ myCursor = cursor(); /* save old cursor */
if ( myOperation != WINDOWFIT ) {
QCursor handCursor (Qt::PointingHandCursor);
int aState = theEvent->modifiers();
int aButton = theEvent->buttons();
if ( aButton == Qt::LeftButton && ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) {
- myDrawRect = myEnableDrawMode;
- if ( myDrawRect ) {
- drawRect();
- if ( !myCursorIsHand ) { // we are going to sketch a rectangle
- QCursor handCursor (Qt::PointingHandCursor);
- myCursorIsHand = true;
- myCursor = cursor();
- myViewPort->setCursor( handCursor );
- }
- }
+ myDrawRect = myEnableDrawMode;
+ if ( myDrawRect ) {
+ drawRect();
+ if ( !myCursorIsHand ) { // we are going to sketch a rectangle
+ QCursor handCursor (Qt::PointingHandCursor);
+ myCursorIsHand = true;
+ myCursor = cursor();
+ myViewPort->setCursor( handCursor );
+ }
+ }
}
else if ( aButton == Qt::RightButton && ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) {
- OCCViewer_ViewSketcher* sketcher = 0;
- QList<OCCViewer_ViewSketcher*>::Iterator it;
- for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it )
- {
- OCCViewer_ViewSketcher* sk = (*it);
- if( sk->isDefault() && sk->sketchButton() == aButton )
- sketcher = sk;
- }
- if ( sketcher && myCurSketch == -1 )
- {
- activateSketching( sketcher->type() );
- if ( mypSketcher )
- {
- myCurSketch = mypSketcher->sketchButton();
-
- if ( l_mbPressEvent )
- {
- QApplication::sendEvent( getViewPort(), l_mbPressEvent );
- delete l_mbPressEvent;
- l_mbPressEvent = 0;
- }
- QApplication::sendEvent( getViewPort(), theEvent );
- }
- }
+ OCCViewer_ViewSketcher* sketcher = 0;
+ QList<OCCViewer_ViewSketcher*>::Iterator it;
+ for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it )
+ {
+ OCCViewer_ViewSketcher* sk = (*it);
+ if( sk->isDefault() && sk->sketchButton() == aButton )
+ sketcher = sk;
+ }
+ if ( sketcher && myCurSketch == -1 )
+ {
+ activateSketching( sketcher->type() );
+ if ( mypSketcher )
+ {
+ myCurSketch = mypSketcher->sketchButton();
+
+ if ( l_mbPressEvent )
+ {
+ QApplication::sendEvent( getViewPort(), l_mbPressEvent );
+ delete l_mbPressEvent;
+ l_mbPressEvent = 0;
+ }
+ QApplication::sendEvent( getViewPort(), theEvent );
+ }
+ }
}
else
- emit mouseMoving( this, theEvent );
+ emit mouseMoving( this, theEvent );
}
}
}
int prevState = myCurSketch;
if(theEvent->button() == Qt::RightButton)
{
- QList<OCCViewer_ViewSketcher*>::Iterator it;
- for ( it = mySketchers.begin(); it != mySketchers.end() && myCurSketch != -1; ++it )
- {
- OCCViewer_ViewSketcher* sk = (*it);
- if( ( sk->sketchButton() & theEvent->button() ) && sk->sketchButton() == myCurSketch )
- myCurSketch = -1;
- }
+ QList<OCCViewer_ViewSketcher*>::Iterator it;
+ for ( it = mySketchers.begin(); it != mySketchers.end() && myCurSketch != -1; ++it )
+ {
+ OCCViewer_ViewSketcher* sk = (*it);
+ if( ( sk->sketchButton() & theEvent->button() ) && sk->sketchButton() == myCurSketch )
+ myCurSketch = -1;
+ }
}
emit mouseReleased(this, theEvent);
{
Handle(V3d_Light) light = viewer->DefinedLight();
if(light->Type() != V3d_AMBIENT)
- {
- Handle(V3d_View) aView3d = myViewPort->getView();
- if( aView3d->IsActiveLight(light) ) viewer->SetLightOff(light);
- else viewer->SetLightOn(light);
- }
+ {
+ Handle(V3d_View) aView3d = myViewPort->getView();
+ if( aView3d->IsActiveLight(light) ) viewer->SetLightOff(light);
+ else viewer->SetLightOn(light);
+ }
viewer->NextDefinedLights();
}
viewer->Update();
aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ );
myModel->setTrihedronShown( anItem.isVisible );
myModel->setTrihedronSize( anItem.size );
-
+
myRestoreFlag = 0;
}
}
bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
- const QString& fileName,
- const QString& format )
+ const QString& fileName,
+ const QString& format )
{
if ( format != "PS" && format != "EPS")
return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format );
\param dz Z coordinate of plane normal
*/
void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const double y, const double z,
- const double dx, const double dy, const double dz )
+ const double dx, const double dy, const double dz )
{
Handle(V3d_View) view = myViewPort->getView();
if ( view.IsNull() )
params.scaleX = aScaleX;
params.scaleY = aScaleY;
params.scaleZ = aScaleZ;
- params.name = aName;
+ params.name = aName;
params.isVisible= isShown;
params.size = size;
viewAspect params = getViewParams();
QString retStr;
retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale,
- params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
- params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ,
- params.scaleX, params.scaleY, params.scaleZ );
+ params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist,
+ params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ,
+ params.scaleX, params.scaleY, params.scaleZ );
retStr += QString().sprintf("*%u*%.2f", params.isVisible, params.size );
return retStr;
}
{
case Rect:
{
- QRect* aRect = (QRect*)mypSketcher->data();
- if( aRect )
- {
- int aLeft = aRect->left();
- int aRight = aRect->right();
- int aTop = aRect->top();
- int aBottom = aRect->bottom();
-
- if( append )
- ic->ShiftSelect( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False );
- else
- ic->Select( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False );
- }
+ QRect* aRect = (QRect*)mypSketcher->data();
+ if( aRect )
+ {
+ int aLeft = aRect->left();
+ int aRight = aRect->right();
+ int aTop = aRect->top();
+ int aBottom = aRect->bottom();
+
+ if( append )
+ ic->ShiftSelect( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False );
+ else
+ ic->Select( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False );
+ }
}
break;
case Polygon:
QPolygon* aPolygon = (QPolygon*)mypSketcher->data();
if( aPolygon )
{
- int size = aPolygon->size();
- TColgp_Array1OfPnt2d anArray( 1, size );
-
- QPolygon::Iterator it = aPolygon->begin();
- QPolygon::Iterator itEnd = aPolygon->end();
- for( int index = 1; it != itEnd; ++it, index++ )
- {
- QPoint aPoint = *it;
- anArray.SetValue( index, gp_Pnt2d( aPoint.x(), aPoint.y() ) );
- }
-
- if( append )
- ic->ShiftSelect( anArray, getViewPort()->getView(), Standard_False );
- else
- ic->Select( anArray, getViewPort()->getView(), Standard_False );
+ int size = aPolygon->size();
+ TColgp_Array1OfPnt2d anArray( 1, size );
+
+ QPolygon::Iterator it = aPolygon->begin();
+ QPolygon::Iterator itEnd = aPolygon->end();
+ for( int index = 1; it != itEnd; ++it, index++ )
+ {
+ QPoint aPoint = *it;
+ anArray.SetValue( index, gp_Pnt2d( aPoint.x(), aPoint.y() ) );
+ }
+
+ if( append )
+ ic->ShiftSelect( anArray, getViewPort()->getView(), Standard_False );
+ else
+ ic->Select( anArray, getViewPort()->getView(), Standard_False );
}
}
break;
public:
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
- ChangeRotationPointId, RotationId,
+ ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
TrihedronShowId, AxialScaleId, AmbientId };
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
- PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
+ PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW };
enum RotationPointType{ GRAVITY, SELECTED };
void setTransformRequested ( OperationType );
/* Transformation is selected and already started */
- bool transformInProcess() const;
- void setTransformInProcess( bool );
+ bool transformInProcess() const;
+ void setTransformInProcess( bool );
void vpMousePressEvent(QMouseEvent* theEvent);
void vpMouseReleaseEvent(QMouseEvent* theEvent);
gp_Pnt mySelectedPoint;
bool myRotationPointSelection;
- int myRestoreFlag;
+ int myRestoreFlag;
- int myStartX;
- int myStartY;
- int myCurrX;
- int myCurrY;
+ int myStartX;
+ int myStartY;
+ int myCurrX;
+ int myCurrY;
- bool myEventStarted; // set when transformation is in process
- bool myCursorIsHand;
- bool myDrawRect; // set when a rect is used for selection or magnify
- bool myEnableDrawMode;
- bool myPaintersRedrawing; // set to draw with external painters
+ bool myEventStarted; // set when transformation is in process
+ bool myCursorIsHand;
+ bool myDrawRect; // set when a rect is used for selection or magnify
+ bool myEnableDrawMode;
+ bool myPaintersRedrawing; // set to draw with external painters
- QCursor myCursor;
+ QCursor myCursor;
double myCurScale;
void OB_Browser::ToolTip::maybeTip( const QPoint& pos )
{
if ( !parentWidget() || !myBrowser || !myBrowser->isShowToolTips() )
- return;
+ return;
QListView* lv = myBrowser->listView();
setModel( model );
connect( myView, SIGNAL( selectionChanged() ),
- this, SIGNAL( selectionChanged() ) );
+ this, SIGNAL( selectionChanged() ) );
}
{
bool parentOpen = true;
if( item && item->parent() )
- parentOpen = item->parent()->isOpen();
+ parentOpen = item->parent()->isOpen();
if ( openObjs[obj] && parentOpen )
lv->setOpen( item, true );
{
bool parentOpen = true;
if( item && item->parent() )
- parentOpen = item->parent()->isOpen();
+ parentOpen = item->parent()->isOpen();
if( parentOpen )
- lv->setOpen( item, true );
+ lv->setOpen( item, true );
}
if ( !curItem && ( curObj == obj || ( !curKey.isNull() && curKey == key )) )
bool closed = false, opened = false;
for ( QModelIndexList::Iterator it = indexes.begin();
- it != indexes.end() && !closed; ++it ) {
+ it != indexes.end() && !closed; ++it ) {
closed = hasCollased( *it );
}
for ( QModelIndexList::Iterator it = indexes.begin();
- it != indexes.end() && !opened; ++it ) {
+ it != indexes.end() && !opened; ++it ) {
opened = hasExpanded( *it );
}
if ( !result && hasChildren ) {
int rows = model()->rowCount( index );
for ( int i = 0; i < rows && !result; i ++ ) {
- QModelIndex child = model()->index( i, 0, index );
- result = hasCollased( child );
+ QModelIndex child = model()->index( i, 0, index );
+ result = hasCollased( child );
}
}
}
if ( !result && hasChildren ) {
int rows = model()->rowCount( index );
for ( int i = 0; i < rows && !result; i ++ ) {
- QModelIndex child = model()->index( i, 0, index );
- result = hasExpanded( child );
+ QModelIndex child = model()->index( i, 0, index );
+ result = hasExpanded( child );
}
}
}
\param width line width
*/
void Plot2d::drawLine( QPainter* painter, const QPoint& p1, const QPoint& p2,
- Qt::PenStyle type, const QColor& color, int width )
+ Qt::PenStyle type, const QColor& color, int width )
{
painter->save();
QPen pen( type );
\param width line width
*/
void Plot2d::drawLine( QPainter* painter, const QPoint& p1, const QPoint& p2,
- Plot2d::LineType type, const QColor& color, int width )
+ Plot2d::LineType type, const QColor& color, int width )
{
drawLine( painter, p1, p2, plot2qwtLine( type ), color, width );
}
\param width line width
*/
void Plot2d::drawLine( QPainter* painter, int x1, int y1, int x2, int y2,
- Qt::PenStyle type, const QColor& color, int width )
+ Qt::PenStyle type, const QColor& color, int width )
{
drawLine( painter, QPoint( x1, y1 ), QPoint( x2, y2 ), type, color, width );
}
\param width line width
*/
void Plot2d::drawLine( QPainter* painter, int x1, int y1, int x2, int y2,
- Plot2d::LineType type, const QColor& color, int width )
+ Plot2d::LineType type, const QColor& color, int width )
{
drawLine( painter, QPoint( x1, y1 ), QPoint( x2, y2 ),
- plot2qwtLine( type), color, width );
+ plot2qwtLine( type), color, width );
}
/*!
\param color marker color
*/
void Plot2d::drawMarker( QPainter* painter, const QPoint& p, const QRect& r,
- QwtSymbol::Style type, const QColor& color )
+ QwtSymbol::Style type, const QColor& color )
{
painter->save();
painter->setPen( color );
\param color marker color
*/
void Plot2d::drawMarker( QPainter* painter, const QPoint& p, const QRect& r,
- Plot2d::MarkerType type, const QColor& color )
+ Plot2d::MarkerType type, const QColor& color )
{
drawMarker( painter, p, r, plot2qwtMarker( type ), color );
}
\param color marker color
*/
void Plot2d::drawMarker( QPainter* painter, int x, int y, int w, int h,
- QwtSymbol::Style type, const QColor& color )
+ QwtSymbol::Style type, const QColor& color )
{
drawMarker( painter, QPoint( x, y ), QRect( 0, 0, w, h ), type, color );
}
\param color marker color
*/
void Plot2d::drawMarker( QPainter* painter, int x, int y, int w, int h,
- Plot2d::MarkerType type, const QColor& color )
+ Plot2d::MarkerType type, const QColor& color )
{
drawMarker( painter, QPoint( x, y ), QRect( 0, 0, w, h ), plot2qwtMarker( type ), color );
}
namespace Plot2d
{
typedef enum { None,
- Circle,
- Rectangle,
- Diamond,
- DTriangle,
- UTriangle,
- LTriangle,
- RTriangle,
- Cross,
- XCross
+ Circle,
+ Rectangle,
+ Diamond,
+ DTriangle,
+ UTriangle,
+ LTriangle,
+ RTriangle,
+ Cross,
+ XCross
} MarkerType;
typedef enum {
LineType qwt2plotLine( Qt::PenStyle );
void drawLine( QPainter*, const QPoint&, const QPoint&,
- Qt::PenStyle = Qt::SolidLine,
- const QColor& = Qt::black, int = 0 );
+ Qt::PenStyle = Qt::SolidLine,
+ const QColor& = Qt::black, int = 0 );
void drawLine( QPainter*, const QPoint&, const QPoint&,
- LineType = Solid,
- const QColor& = Qt::black, int = 0 );
+ LineType = Solid,
+ const QColor& = Qt::black, int = 0 );
void drawLine( QPainter*, int, int, int, int,
- Qt::PenStyle = Qt::SolidLine,
- const QColor& = Qt::black, int = 0 );
+ Qt::PenStyle = Qt::SolidLine,
+ const QColor& = Qt::black, int = 0 );
void drawLine( QPainter*, int, int, int, int,
- LineType = Solid,
- const QColor& = Qt::black, int = 0 );
+ LineType = Solid,
+ const QColor& = Qt::black, int = 0 );
void drawMarker( QPainter*, const QPoint&, const QRect&,
- QwtSymbol::Style = QwtSymbol::Ellipse,
- const QColor& = Qt::black );
+ QwtSymbol::Style = QwtSymbol::Ellipse,
+ const QColor& = Qt::black );
void drawMarker( QPainter*, const QPoint&, const QRect&,
- MarkerType = Circle,
- const QColor& = Qt::black );
+ MarkerType = Circle,
+ const QColor& = Qt::black );
void drawMarker( QPainter*, int, int, int, int,
- QwtSymbol::Style = QwtSymbol::Ellipse,
- const QColor& = Qt::black );
+ QwtSymbol::Style = QwtSymbol::Ellipse,
+ const QColor& = Qt::black );
void drawMarker( QPainter*, int, int, int, int,
- MarkerType = Circle,
- const QColor& = Qt::black );
+ MarkerType = Circle,
+ const QColor& = Qt::black );
}
#if defined WIN32
pointList getPointList() const;
void setData( const double*, const double*,
- long, const QStringList& = QStringList() );
+ long, const QStringList& = QStringList() );
double* horData() const;
double* verData() const;
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 );
+ myLineCombo->palette().color( QPalette::Text ), 1 );
return px;
}
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 ) );
+ myMarkerCombo->palette().color( QPalette::Text ) );
return px;
}
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 );
}
\param secondAxisY if \c true, show widgets for the second (right) vertical axis
*/
Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent,
- bool showDefCheck,
- bool secondAxisY )
+ bool showDefCheck,
+ bool secondAxisY )
: QDialog( parent ),
mySecondAxisY( secondAxisY )
{
myPlot( plot )
{
connect( this, SIGNAL( maybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ),
- this, SLOT( onToolTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) );
+ this, SLOT( onToolTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) );
}
Plot2d_ToolTip::~Plot2d_ToolTip()
// createActions();
connect( myPlot, SIGNAL( legendClicked( QwtPlotItem* ) ),
- this, SIGNAL( legendClicked( QwtPlotItem* ) ) );
+ this, SIGNAL( legendClicked( QwtPlotItem* ) ) );
// IPAL 21465
/* connect( myPlot->axisWidget( QwtPlot::xBottom ), SIGNAL( scaleDivChanged() ),
- myPlot, SLOT( onScaleDivChanged() ) );
+ myPlot, SLOT( onScaleDivChanged() ) );
connect( myPlot->axisWidget( QwtPlot::yLeft ), SIGNAL( scaleDivChanged() ),
- myPlot, SLOT( onScaleDivChanged() ) );
+ myPlot, SLOT( onScaleDivChanged() ) );
if (mySecondY)
connect( myPlot->axisWidget( QwtPlot::yRight ), SIGNAL( scaleDivChanged() ),
myPlot, SLOT( onScaleDivChanged() ) );*/
if ( plotMouseMoved( m ) )
return true;
}
- break;
+ break;
}
case QEvent::MouseButtonPress: {
QMouseEvent* me = (QMouseEvent*)e;
"Fit Data" command for TUI interface
*/
void Plot2d_ViewFrame::fitData(const int mode,
- const double xMin, const double xMax,
- const double yMin, const double yMax,
- double y2Min, double y2Max)
+ const double xMin, const double xMax,
+ const double yMin, const double yMax,
+ double y2Min, double y2Max)
{
if ( mode == 0 || mode == 2 ) {
myPlot->setAxisScale( QwtPlot::yLeft, yMin, yMax );
Gets current fit ranges for view frame
*/
void Plot2d_ViewFrame::getFitRanges(double& xMin,double& xMax,
- double& yMin, double& yMax,
- double& y2Min, double& y2Max)
+ double& yMin, double& yMax,
+ double& y2Min, double& y2Max)
{
int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).transform( myPlot->canvasMap( QwtPlot::xBottom ).s1() );
int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).transform( myPlot->canvasMap( QwtPlot::xBottom ).s2() );
Gets current fit ranges by Curves
*/
void Plot2d_ViewFrame::getFitRangeByCurves(double& xMin,double& xMax,
- double& yMin, double& yMax,
- double& y2Min, double& y2Max)
+ double& yMin, double& yMax,
+ double& y2Min, double& y2Max)
{
CurveDict cdict = getCurves();
if ( !cdict.isEmpty() ) {
*/
void Plot2d_ViewFrame::onChangeBackground()
{
- QColor selColor = QColorDialog::getColor ( backgroundColor(), this );
+ QColor selColor = QColorDialog::getColor ( backgroundColor(), this );
if ( selColor.isValid() ) {
setBackgroundColor( selColor );
}
QwtScaleDraw* aQwtSD = axisScaleDraw(axisId);
Plot2d_ScaleDraw* aPlot2dSD = dynamic_cast<Plot2d_ScaleDraw*>(aQwtSD);
if ( !aPlot2dSD && aPrecision > 6 || aPlot2dSD && aPlot2dSD->precision() != aPrecision )
- setAxisScaleDraw( axisId, new Plot2d_ScaleDraw(*aQwtSD, 'f', aPrecision) );
+ setAxisScaleDraw( axisId, new Plot2d_ScaleDraw(*aQwtSD, 'f', aPrecision) );
}
}
}
getFitRanges( xmin, xmax, ymin, ymax, y2min, y2max );
QString retStr;
retStr.sprintf( "%d*%d*%d*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", myXMode,
- myYMode, mySecondY, xmin, xmax, ymin, ymax, y2min, y2max );
+ myYMode, mySecondY, xmin, xmax, ymin, ymax, y2min, y2max );
return retStr;
}
QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::yLeft,
- myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s1() )-incrY ),
- myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s2() )-incrY ) );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s1() )-incrY ),
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s2() )-incrY ) );
myPlot->setAxisScale( QwtPlot::xBottom,
- myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s1() )-incrX ),
- myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s2() )-incrX ) );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s1() )-incrX ),
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s2() )-incrX ) );
if (mySecondY) {
QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight,
- myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s1() )-incrY ),
- myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s2() )-incrY ) );
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s1() )-incrY ),
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s2() )-incrY ) );
}
myPlot->replot();
}
QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
myPlot->setAxisScale( QwtPlot::yLeft, yMap.s1(),
- myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s2() ) + incrY ) );
+ myPlot->invTransform( QwtPlot::yLeft, yMap.transform( yMap.s2() ) + incrY ) );
myPlot->setAxisScale( QwtPlot::xBottom, xMap.s1(),
- myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s2() ) - incrX ) );
+ myPlot->invTransform( QwtPlot::xBottom, xMap.transform( xMap.s2() ) - incrX ) );
if (mySecondY) {
QwtScaleMap y2Map = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight, y2Map.s1(),
- myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s2() ) + incrY ) );
+ myPlot->invTransform( QwtPlot::yRight, y2Map.transform( y2Map.s2() ) + incrY ) );
}
myPlot->replot();
}
void fitAll();
void fitArea( const QRect& area );
void fitData(const int mode,
- const double xMin, const double xMax,
- const double yMin, const double yMax,
- const double y2Min = 0, const double y2Max = 0);
+ const double xMin, const double xMax,
+ const double yMin, const double yMax,
+ const double y2Min = 0, const double y2Max = 0);
void getFitRanges(double& xMin, double& xMax,
- double& yMin, double& yMax,
- double& y2Min, double& y2Max);
+ double& yMin, double& yMax,
+ double& y2Min, double& y2Max);
void getFitRangeByCurves(double& xMin, double& xMax,
- double& yMin, double& yMax,
- double& y2Min, double& y2Max);
+ double& yMin, double& yMax,
+ double& y2Min, double& y2Max);
/* view parameters */
void copyPreferences( Plot2d_ViewFrame* );
Plot2d_ViewFrame* aViewFrame = view->getViewFrame();
Plot2d_Viewer* aViewer = getPlot2dModel();
connect( aViewFrame, SIGNAL( legendClicked( QwtPlotItem* ) ),
- aViewer, SLOT( onLegendClicked( QwtPlotItem* ) ) );
+ aViewer, SLOT( onLegendClicked( QwtPlotItem* ) ) );
}
return res;
}
{
Plot2d_ViewManager* pmgr = ( Plot2d_ViewManager* )mgr;
connect( pmgr, SIGNAL( cloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) ),
- this, SLOT( onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) ) );
+ this, SLOT( onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) ) );
}
}
connect( myViewFrame, SIGNAL( vpModeVerChanged() ), this, SLOT( onChangeVerMode() ) );
connect( myViewFrame, SIGNAL( vpCurveChanged() ), this, SLOT( onChangeCurveMode() ) );
connect( myViewFrame, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ),
- this, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ) );
+ this, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ) );
myViewFrame->installEventFilter( this );
}
// 1. Dump View
aAction = new QtxAction( tr( "MNU_DUMP_VIEW" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_DUMP" ) ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_DUMP" ) ),
tr( "MNU_DUMP_VIEW" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_DUMP_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onDumpView() ) );
mgr->registerAction( aAction, DumpId );
// 2.1. Fit All
aAction = new QtxAction( tr( "MNU_FITALL" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_ALL" ) ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_ALL" ) ),
tr( "MNU_FITALL" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_FITALL" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitAll() ) );
mgr->registerAction( aAction, FitAllId );
// 2.2. Fit Rect
aAction = new QtxAction( tr( "MNU_FITRECT" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_AREA" ) ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_AREA" ) ),
tr( "MNU_FITRECT" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_FITRECT" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitRect() ) );
mgr->registerAction( aAction, FitRectId );
// 2.3. Zoom
aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ZOOM" ) ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ZOOM" ) ),
tr( "MNU_ZOOM_VIEW" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onZoom() ) );
mgr->registerAction( aAction, ZoomId );
// 3.1. Panning
aAction = new QtxAction( tr( "MNU_PAN_VIEW" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_PAN" ) ),
- tr( "MNU_PAN_VIEW" ),
- 0, this);
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_PAN" ) ),
+ tr( "MNU_PAN_VIEW" ),
+ 0, this);
aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPanning() ) );
mgr->registerAction( aAction, PanId );
// 3.2. Global Panning
aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_GLOBALPAN" ) ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_GLOBALPAN" ) ),
tr( "MNU_GLOBALPAN_VIEW" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onGlobalPanning() ) );
mgr->registerAction( aAction, GlobalPanId );
// 4.1. Points
aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_POINTS" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_POINTS" ) ),
- tr( "MEN_PLOT2D_CURVES_POINTS" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_POINTS" ) ),
+ tr( "MEN_PLOT2D_CURVES_POINTS" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_POINTS" ) );
aAction->setCheckable( true );
mgr->registerAction( aAction, CurvPointsId );
// 4.2. Lines
aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_LINES" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_LINES" ) ),
- tr( "MEN_PLOT2D_CURVES_LINES" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_LINES" ) ),
+ tr( "MEN_PLOT2D_CURVES_LINES" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_LINES" ) );
aAction->setCheckable( true );
mgr->registerAction( aAction, CurvLinesId );
// 4.3. Splines
aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_SPLINES" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_SPLINES" ) ),
- tr( "MEN_PLOT2D_CURVES_SPLINES" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_SPLINES" ) ),
+ tr( "MEN_PLOT2D_CURVES_SPLINES" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_SPLINES" ) );
aAction->setCheckable( true );
mgr->registerAction( aAction, CurvSplinesId );
// 5.1. Linear
aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LINEAR_HOR" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_HOR" ) ),
- tr( "MEN_PLOT2D_MODE_LINEAR_HOR" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_HOR" ) ),
+ tr( "MEN_PLOT2D_MODE_LINEAR_HOR" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
aAction->setCheckable( true );
// 5.2. Logarithmic
aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" ) ),
- tr( "MEN_PLOT2D_MODE_LOGARITHMIC_HOR" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" ) ),
+ tr( "MEN_PLOT2D_MODE_LOGARITHMIC_HOR" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
aAction->setCheckable( true );
// 6.1. Linear
aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LINEAR_VER" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_VER" ) ),
- tr( "MEN_PLOT2D_MODE_LINEAR_VER" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_VER" ) ),
+ tr( "MEN_PLOT2D_MODE_LINEAR_VER" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_VER" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
aAction->setCheckable( true );
// 6.2. Logarithmic
aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_VER" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_VER" ) ),
- tr( "MEN_PLOT2D_MODE_LOGARITHMIC_VER" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_VER" ) ),
+ tr( "MEN_PLOT2D_MODE_LOGARITHMIC_VER" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_VER" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
aAction->setCheckable( true );
// 7. Legend
aAction = new QtxAction( tr( "TOT_PLOT2D_SHOW_LEGEND" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SHOW_LEGEND" ) ),
- tr( "MEN_PLOT2D_SHOW_LEGEND" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SHOW_LEGEND" ) ),
+ tr( "MEN_PLOT2D_SHOW_LEGEND" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_SHOW_LEGEND" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onLegend() ) );
aAction->setCheckable( true );
// 8. Settings
aAction = new QtxAction( tr( "TOT_PLOT2D_SETTINGS" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SETTINGS" ) ),
- tr( "MEN_PLOT2D_SETTINGS" ),
- 0, this );
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SETTINGS" ) ),
+ tr( "MEN_PLOT2D_SETTINGS" ),
+ 0, this );
aAction->setStatusTip( tr( "PRP_PLOT2D_SETTINGS" ) );
connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) );
mgr->registerAction( aAction, CurvSettingsId );
// 9. Clone
aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ),
- aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
+ aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
tr( "MNU_CLONE_VIEW" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_CLONE_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SIGNAL( cloneView() ) );
mgr->registerAction( aAction, CloneId );
\param format image format ("BMP" [default], "JPEG", "JPG", "PNG")
*/
bool Plot2d_ViewWindow::dumpViewToFormat( const QImage& img,
- const QString& fileName,
- const QString& format )
+ const QString& fileName,
+ const QString& format )
{
bool res = myViewFrame ? myViewFrame->print( fileName, format ) : false;
if( !res )
public:
enum { DumpId,
- ScaleOpId, FitAllId, FitRectId, ZoomId,
- MoveOpId, PanId, GlobalPanId,
- PModeXLinearId, PModeXLogarithmicId,
+ ScaleOpId, FitAllId, FitRectId, ZoomId,
+ MoveOpId, PanId, GlobalPanId,
+ PModeXLinearId, PModeXLogarithmicId,
PModeYLinearId, PModeYLogarithmicId,
- CurvPointsId, CurvLinesId, CurvSplinesId,
- LegendId,
- CurvSettingsId,
- CloneId };
+ CurvPointsId, CurvLinesId, CurvSplinesId,
+ LegendId,
+ CurvSettingsId,
+ CloneId };
public:
Plot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* );
protected:
virtual QImage dumpView();
virtual bool dumpViewToFormat( const QImage&,
- const QString&,
- const QString& );
+ const QString&,
+ const QString& );
virtual QString filter() const;
signals:
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// File: SALOME_Prs.cxx
-// Created: Wed Apr 28 15:03:43 2004
-// Author: Sergey ANIKIN
-// <san@startrex.nnov.opencascade.com>
+// File: SALOME_Prs.cxx
+// Created: Wed Apr 28 15:03:43 2004
+// Author: Sergey ANIKIN
+// <san@startrex.nnov.opencascade.com>
//
#include "SALOME_Prs.h"
\param sync if True the request is processed synchronously
*/
ExecCommand( PyInterp_Interp* theInterp,
- const QString& theCommand,
- PyConsole_Editor* theListener,
- bool sync = false )
+ const QString& theCommand,
+ PyConsole_Editor* theListener,
+ bool sync = false )
: PyInterp_LockRequest( theInterp, theListener, sync ),
myCommand( theCommand ), myState( PyInterp_Event::ES_OK )
{}
{
int ret = getInterp()->run( myCommand.toLatin1() );
if ( ret < 0 )
- myState = PyInterp_Event::ES_ERROR;
+ myState = PyInterp_Event::ES_ERROR;
else if ( ret > 0 )
- myState = PyInterp_Event::ES_INCOMPLETE;
+ myState = PyInterp_Event::ES_INCOMPLETE;
}
}
\param theParent parent widget
*/
PyConsole_Editor::PyConsole_Editor( PyConsole_Interp* theInterp,
- QWidget* theParent )
+ QWidget* theParent )
: QTextEdit( theParent ),
myInterp( 0 ),
myCmdInHistory( -1 ),
\param newBlock if True, then the string is printed on a new line
*/
void PyConsole_Editor::addText( const QString& str,
- const bool newBlock )
+ const bool newBlock )
{
moveCursor( QTextCursor::End );
if ( newBlock )
}
// create new drop event and use it instead of the original
QDropEvent de( pos,
- event->possibleActions(),
- event->mimeData(),
- event->mouseButtons(),
- event->keyboardModifiers(),
- event->type() );
+ event->possibleActions(),
+ event->mimeData(),
+ event->mouseButtons(),
+ event->keyboardModifiers(),
+ event->type() );
QTextEdit::dropEvent( &de );
// accept the original event
event->acceptProposedAction();
// any printed key: just print it
{
if ( curLine < endLine || curCol < PROMPT_SIZE ) {
- moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::End );
}
QTextEdit::keyPressEvent( event );
break;
// - with <Ctrl>+<Shift> modifier keys pressed: scroll one row up
{
if ( ctrlPressed && shftPressed ) {
- int value = verticalScrollBar()->value();
- int spacing = fontMetrics().lineSpacing();
- verticalScrollBar()->setValue( value > spacing ? value-spacing : 0 );
+ int value = verticalScrollBar()->value();
+ int spacing = fontMetrics().lineSpacing();
+ verticalScrollBar()->setValue( value > spacing ? value-spacing : 0 );
}
else if ( shftPressed || ctrlPressed ) {
- if ( curLine > 0 )
- moveCursor( QTextCursor::Up,
- shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ if ( curLine > 0 )
+ moveCursor( QTextCursor::Up,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
}
else {
- if ( myCmdInHistory < 0 && myHistory.count() > 0 ) {
- // set history browsing mode
- myCmdInHistory = myHistory.count();
- // remember current command
- QTextBlock par = document()->end().previous();
- myCurrentCommand = par.text().remove( 0, PROMPT_SIZE );
- }
- if ( myCmdInHistory > 0 ) {
- myCmdInHistory--;
- // get previous command in the history
- QString previousCommand = myHistory.at( myCmdInHistory );
- // print previous command
- moveCursor( QTextCursor::End );
- moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- addText( myPrompt + previousCommand );
- // move cursor to the end
- moveCursor( QTextCursor::End );
- }
+ if ( myCmdInHistory < 0 && myHistory.count() > 0 ) {
+ // set history browsing mode
+ myCmdInHistory = myHistory.count();
+ // remember current command
+ QTextBlock par = document()->end().previous();
+ myCurrentCommand = par.text().remove( 0, PROMPT_SIZE );
+ }
+ if ( myCmdInHistory > 0 ) {
+ myCmdInHistory--;
+ // get previous command in the history
+ QString previousCommand = myHistory.at( myCmdInHistory );
+ // print previous command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + previousCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
}
break;
}
// - with <Ctrl>+<Shift> modifier keys pressed: scroll one row down
{
if ( ctrlPressed && shftPressed ) {
- int value = verticalScrollBar()->value();
- int maxval = verticalScrollBar()->maximum();
- int spacing = fontMetrics().lineSpacing();
- verticalScrollBar()->setValue( value+spacing < maxval ? value+spacing : maxval );
+ int value = verticalScrollBar()->value();
+ int maxval = verticalScrollBar()->maximum();
+ int spacing = fontMetrics().lineSpacing();
+ verticalScrollBar()->setValue( value+spacing < maxval ? value+spacing : maxval );
}
else if ( shftPressed || ctrlPressed) {
- if ( curLine < endLine )
- moveCursor( QTextCursor::Down,
- shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ if ( curLine < endLine )
+ moveCursor( QTextCursor::Down,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
}
else {
- if ( myCmdInHistory >= 0 ) {
- // get next command in the history
- myCmdInHistory++;
- QString nextCommand;
- if ( myCmdInHistory < myHistory.count() ) {
- // next command in history
- nextCommand = myHistory.at( myCmdInHistory );
- }
- else {
- // end of history is reached
- // last printed command
- nextCommand = myCurrentCommand;
- // unset history browsing mode
- myCmdInHistory = -1;
- }
- // print next or current command
- moveCursor( QTextCursor::End );
- moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- addText( myPrompt + nextCommand );
- // move cursor to the end
- moveCursor( QTextCursor::End );
- }
+ if ( myCmdInHistory >= 0 ) {
+ // get next command in the history
+ myCmdInHistory++;
+ QString nextCommand;
+ if ( myCmdInHistory < myHistory.count() ) {
+ // next command in history
+ nextCommand = myHistory.at( myCmdInHistory );
+ }
+ else {
+ // end of history is reached
+ // last printed command
+ nextCommand = myCurrentCommand;
+ // unset history browsing mode
+ myCmdInHistory = -1;
+ }
+ // print next or current command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + nextCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
}
break;
}
{
QString txt = textCursor().block().text();
if ( !shftPressed && isCommand( txt ) && curCol <= PROMPT_SIZE ) {
- moveCursor( QTextCursor::Up );
- moveCursor( QTextCursor::EndOfBlock );
+ moveCursor( QTextCursor::Up );
+ moveCursor( QTextCursor::EndOfBlock );
}
else {
- QTextEdit::keyPressEvent( event );
+ QTextEdit::keyPressEvent( event );
}
break;
}
{
QString txt = textCursor().block().text();
if ( !shftPressed ) {
- if ( curCol < txt.length() ) {
- if ( isCommand( txt ) && curCol < PROMPT_SIZE ) {
- cur.setPosition( cur.block().position() + PROMPT_SIZE );
- setTextCursor( cur );
- break;
- }
- }
- else {
- if ( curLine < endLine && isCommand( textCursor().block().next().text() ) ) {
- cur.setPosition( cur.position() + PROMPT_SIZE+1 );
- setTextCursor( cur );
- horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
- break;
- }
- }
+ if ( curCol < txt.length() ) {
+ if ( isCommand( txt ) && curCol < PROMPT_SIZE ) {
+ cur.setPosition( cur.block().position() + PROMPT_SIZE );
+ setTextCursor( cur );
+ break;
+ }
+ }
+ else {
+ if ( curLine < endLine && isCommand( textCursor().block().next().text() ) ) {
+ cur.setPosition( cur.position() + PROMPT_SIZE+1 );
+ setTextCursor( cur );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ break;
+ }
+ }
}
QTextEdit::keyPressEvent( event );
break;
// - with <Ctrl>+<Shift> modifier keys pressed: scroll one page up
{
if ( ctrlPressed && shftPressed ) {
- verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
+ verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
}
else if ( shftPressed || ctrlPressed ) {
- bool moved = false;
- qreal lastY = cursorRect( cur ).top();
- qreal distance = 0;
- // move using movePosition to keep the cursor's x
- do {
- qreal y = cursorRect( cur ).top();
- distance += qAbs( y - lastY );
- lastY = y;
- moved = cur.movePosition( QTextCursor::Up,
- shftPressed ? QTextCursor::KeepAnchor :
- QTextCursor::MoveAnchor );
- } while ( moved && distance < viewport()->height() );
- if ( moved ) {
- cur.movePosition( QTextCursor::Down,
- shftPressed ? QTextCursor::KeepAnchor :
- QTextCursor::MoveAnchor );
- verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub );
- }
- setTextCursor( cur );
+ bool moved = false;
+ qreal lastY = cursorRect( cur ).top();
+ qreal distance = 0;
+ // move using movePosition to keep the cursor's x
+ do {
+ qreal y = cursorRect( cur ).top();
+ distance += qAbs( y - lastY );
+ lastY = y;
+ moved = cur.movePosition( QTextCursor::Up,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ } while ( moved && distance < viewport()->height() );
+ if ( moved ) {
+ cur.movePosition( QTextCursor::Down,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub );
+ }
+ setTextCursor( cur );
}
else {
- if ( myCmdInHistory < 0 && myHistory.count() > 0 ) {
- // set history browsing mode
- myCmdInHistory = myHistory.count();
- // remember current command
- QTextBlock par = document()->end().previous();
- myCurrentCommand = par.text().remove( 0, PROMPT_SIZE );
- }
- if ( myCmdInHistory > 0 ) {
- myCmdInHistory = 0;
- // get very first command in the history
- QString firstCommand = myHistory.at( myCmdInHistory );
- // print first command
- moveCursor( QTextCursor::End );
- moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- addText( myPrompt + firstCommand );
- // move cursor to the end
- moveCursor( QTextCursor::End );
- }
+ if ( myCmdInHistory < 0 && myHistory.count() > 0 ) {
+ // set history browsing mode
+ myCmdInHistory = myHistory.count();
+ // remember current command
+ QTextBlock par = document()->end().previous();
+ myCurrentCommand = par.text().remove( 0, PROMPT_SIZE );
+ }
+ if ( myCmdInHistory > 0 ) {
+ myCmdInHistory = 0;
+ // get very first command in the history
+ QString firstCommand = myHistory.at( myCmdInHistory );
+ // print first command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + firstCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
}
break;
}
// - with <Ctrl>+<Shift> modifier keys pressed: scroll one page down
{
if ( ctrlPressed && shftPressed ) {
- verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
+ verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
}
else if ( shftPressed || ctrlPressed ) {
- bool moved = false;
- qreal lastY = cursorRect( cur ).top();
- qreal distance = 0;
- // move using movePosition to keep the cursor's x
- do {
- qreal y = cursorRect( cur ).top();
- distance += qAbs( y - lastY );
- lastY = y;
- moved = cur.movePosition( QTextCursor::Down,
- shftPressed ? QTextCursor::KeepAnchor :
- QTextCursor::MoveAnchor );
- } while ( moved && distance < viewport()->height() );
- if ( moved ) {
- cur.movePosition( QTextCursor::Up,
- shftPressed ? QTextCursor::KeepAnchor :
- QTextCursor::MoveAnchor );
- verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub );
- }
- setTextCursor( cur );
+ bool moved = false;
+ qreal lastY = cursorRect( cur ).top();
+ qreal distance = 0;
+ // move using movePosition to keep the cursor's x
+ do {
+ qreal y = cursorRect( cur ).top();
+ distance += qAbs( y - lastY );
+ lastY = y;
+ moved = cur.movePosition( QTextCursor::Down,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ } while ( moved && distance < viewport()->height() );
+ if ( moved ) {
+ cur.movePosition( QTextCursor::Up,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub );
+ }
+ setTextCursor( cur );
}
else {
- if ( myCmdInHistory >= 0 ) {
- // unset history browsing mode
- myCmdInHistory = -1;
- // print current command
- moveCursor( QTextCursor::End );
- moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- addText( myPrompt + myCurrentCommand );
- // move cursor to the end
- moveCursor( QTextCursor::End );
- }
+ if ( myCmdInHistory >= 0 ) {
+ // unset history browsing mode
+ myCmdInHistory = -1;
+ // print current command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + myCurrentCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
}
break;
}
// - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very first symbol with selection
{
if ( ctrlPressed ) {
- moveCursor( QTextCursor::Start,
- shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ moveCursor( QTextCursor::Start,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
}
else {
- QString txt = textCursor().block().text();
- if ( isCommand( txt ) ) {
- if ( shftPressed ) {
- if ( curCol > PROMPT_SIZE ) {
- cur.movePosition( QTextCursor::StartOfLine, QTextCursor::KeepAnchor );
- cur.movePosition( QTextCursor::Right, QTextCursor::KeepAnchor, PROMPT_SIZE );
- }
- }
- else {
- cur.movePosition( QTextCursor::StartOfLine );
- cur.movePosition( QTextCursor::Right, QTextCursor::MoveAnchor, PROMPT_SIZE );
- }
- setTextCursor( cur );
- }
- else {
- moveCursor( QTextCursor::StartOfBlock,
- shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
- }
- horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ QString txt = textCursor().block().text();
+ if ( isCommand( txt ) ) {
+ if ( shftPressed ) {
+ if ( curCol > PROMPT_SIZE ) {
+ cur.movePosition( QTextCursor::StartOfLine, QTextCursor::KeepAnchor );
+ cur.movePosition( QTextCursor::Right, QTextCursor::KeepAnchor, PROMPT_SIZE );
+ }
+ }
+ else {
+ cur.movePosition( QTextCursor::StartOfLine );
+ cur.movePosition( QTextCursor::Right, QTextCursor::MoveAnchor, PROMPT_SIZE );
+ }
+ setTextCursor( cur );
+ }
+ else {
+ moveCursor( QTextCursor::StartOfBlock,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ }
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
}
break;
}
// - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very last symbol with selection
{
moveCursor( ctrlPressed ? QTextCursor::End : QTextCursor::EndOfBlock,
- shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
break;
}
case Qt::Key_Backspace :
// works only for last (command) line
{
if ( cur.hasSelection() ) {
- cut();
+ cut();
}
else if ( cur.position() > document()->end().previous().position() + PROMPT_SIZE ) {
- if ( shftPressed ) {
- moveCursor( QTextCursor::PreviousWord, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- }
- else if ( ctrlPressed ) {
- cur.setPosition( document()->end().previous().position() + PROMPT_SIZE,
- QTextCursor::KeepAnchor );
- setTextCursor( cur );
- textCursor().removeSelectedText();
- }
- else {
- QTextEdit::keyPressEvent( event );
- }
+ if ( shftPressed ) {
+ moveCursor( QTextCursor::PreviousWord, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ }
+ else if ( ctrlPressed ) {
+ cur.setPosition( document()->end().previous().position() + PROMPT_SIZE,
+ QTextCursor::KeepAnchor );
+ setTextCursor( cur );
+ textCursor().removeSelectedText();
+ }
+ else {
+ QTextEdit::keyPressEvent( event );
+ }
}
else {
- cur.setPosition( document()->end().previous().position() + PROMPT_SIZE );
- setTextCursor( cur );
- horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ cur.setPosition( document()->end().previous().position() + PROMPT_SIZE );
+ setTextCursor( cur );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
}
break;
}
// works only for last (command) line
{
if ( cur.hasSelection() ) {
- cut();
+ cut();
}
else if ( cur.position() > document()->end().previous().position() + PROMPT_SIZE-1 ) {
- if ( shftPressed ) {
- moveCursor( QTextCursor::NextWord, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- }
- else if ( ctrlPressed ) {
- moveCursor( QTextCursor::EndOfBlock, QTextCursor::KeepAnchor );
- textCursor().removeSelectedText();
- }
- else {
- QTextEdit::keyPressEvent( event );
- }
+ if ( shftPressed ) {
+ moveCursor( QTextCursor::NextWord, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ }
+ else if ( ctrlPressed ) {
+ moveCursor( QTextCursor::EndOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ }
+ else {
+ QTextEdit::keyPressEvent( event );
+ }
}
else {
- cur.setPosition( document()->end().previous().position() + PROMPT_SIZE );
- setTextCursor( cur );
- horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ cur.setPosition( document()->end().previous().position() + PROMPT_SIZE );
+ setTextCursor( cur );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
}
break;
}
// - with <Shift> modifier key pressed: paste() to the command line
{
if ( ctrlPressed ) {
- copy();
+ copy();
}
else if ( shftPressed ) {
- paste();
+ paste();
}
else
- QTextEdit::keyPressEvent( event );
+ QTextEdit::keyPressEvent( event );
break;
}
}
viewport()->unsetCursor();
// stop event loop (if running)
if( myEventLoop)
- myEventLoop->exit();
+ myEventLoop->exit();
}
else {
// clear contents
// Private class that keeps track of destructions of request listeners
class PYINTERP_EXPORT PyInterp_Watcher : public QObject
-{
+{
Q_OBJECT
public:
{
QFileInfo inf = *it;
if ( inf.fileName() == "." || inf.fileName() == ".." )
- continue;
+ continue;
stat = stat && rmDir( inf.absoluteFilePath() );
}
stat = stat && aDir.rmdir( thePath );
if ( nbwri != outcnt )
{
::fclose( src );
- ::fclose( tgt );
+ ::fclose( tgt );
QFile::remove( QString( temp ) );
return false;
}
{
QString envName = findEnvVar( res, start, len );
if ( envName.isNull() )
- break;
+ break;
QString newStr;
if ( ::getenv( envName.toLatin1() ) || mode == Always )
- newStr = QString( ::getenv( envName.toLatin1() ) );
+ newStr = QString( ::getenv( envName.toLatin1() ) );
if ( newStr.isNull() )
{
- if ( ignoreMap.contains( envName ) )
- {
- start += len;
- continue;
- }
- ignoreMap.insert( envName, 0 );
+ if ( ignoreMap.contains( envName ) )
+ {
+ start += len;
+ continue;
+ }
+ ignoreMap.insert( envName, 0 );
}
res.replace( start, len, newStr );
}
// spread type
if ( vals.count() > 5 )
{
- QString spread = vals[ 5 ].trimmed().toLower();
- if ( spread == "pad" || spread == "0" )
- gradient.setSpread( QGradient::PadSpread );
- else if ( spread == "repeat" || spread == "2" )
- gradient.setSpread( QGradient::RepeatSpread );
- else if ( spread == "reflect" || spread == "1" )
- gradient.setSpread( QGradient::ReflectSpread );
+ QString spread = vals[ 5 ].trimmed().toLower();
+ if ( spread == "pad" || spread == "0" )
+ gradient.setSpread( QGradient::PadSpread );
+ else if ( spread == "repeat" || spread == "2" )
+ gradient.setSpread( QGradient::RepeatSpread );
+ else if ( spread == "reflect" || spread == "1" )
+ gradient.setSpread( QGradient::ReflectSpread );
}
// stop points
QGradientStops stops;
for ( int i = 6; i < vals.count(); i+=2 )
{
- bool bOk5, bOk6 = false;
- QColor c;
- double stop = vals[i].toDouble( &bOk5 );
- if ( i+1 < vals.count() )
- bOk6 = stringToColor( vals[ i+1 ], c );
- if ( bOk5 && stop >= 0.0 && stop <= 1.0 && bOk6 && c.isValid() )
- stops.append( QGradientStop( stop, c ) );
+ bool bOk5, bOk6 = false;
+ QColor c;
+ double stop = vals[i].toDouble( &bOk5 );
+ if ( i+1 < vals.count() )
+ bOk6 = stringToColor( vals[ i+1 ], c );
+ if ( bOk5 && stop >= 0.0 && stop <= 1.0 && bOk6 && c.isValid() )
+ stops.append( QGradientStop( stop, c ) );
}
gradient.setStops( stops );
success = true;
// spread type
if ( vals.count() > 6 )
{
- QString spread = vals[ 6 ].trimmed().toLower();
- if ( spread == "pad" || spread == "0" )
- gradient.setSpread( QGradient::PadSpread );
- else if ( spread == "repeat" || spread == "2" )
- gradient.setSpread( QGradient::RepeatSpread );
- else if ( spread == "reflect" || spread == "1" )
- gradient.setSpread( QGradient::ReflectSpread );
+ QString spread = vals[ 6 ].trimmed().toLower();
+ if ( spread == "pad" || spread == "0" )
+ gradient.setSpread( QGradient::PadSpread );
+ else if ( spread == "repeat" || spread == "2" )
+ gradient.setSpread( QGradient::RepeatSpread );
+ else if ( spread == "reflect" || spread == "1" )
+ gradient.setSpread( QGradient::ReflectSpread );
}
// stop points
QGradientStops stops;
for ( int i = 7; i < vals.count(); i+=2 )
{
- bool bOk7, bOk8 = false;
- QColor c;
- double stop = vals[i].toDouble( &bOk7 );
- if ( i+1 < vals.count() )
- bOk8 = stringToColor( vals[ i+1 ], c );
- if ( bOk7 && stop >= 0.0 && stop <= 1.0 && bOk8 && c.isValid() )
- stops.append( QGradientStop( stop, c ) );
+ bool bOk7, bOk8 = false;
+ QColor c;
+ double stop = vals[i].toDouble( &bOk7 );
+ if ( i+1 < vals.count() )
+ bOk8 = stringToColor( vals[ i+1 ], c );
+ if ( bOk7 && stop >= 0.0 && stop <= 1.0 && bOk8 && c.isValid() )
+ stops.append( QGradientStop( stop, c ) );
}
gradient.setStops( stops );
success = true;
// spread type
if ( vals.count() > 4 )
{
- QString spread = vals[ 4 ].trimmed().toLower();
- if ( spread == "pad" || spread == "0" )
- gradient.setSpread( QGradient::PadSpread );
- else if ( spread == "repeat" || spread == "2" )
- gradient.setSpread( QGradient::RepeatSpread );
- else if ( spread == "reflect" || spread == "1" )
- gradient.setSpread( QGradient::ReflectSpread );
+ QString spread = vals[ 4 ].trimmed().toLower();
+ if ( spread == "pad" || spread == "0" )
+ gradient.setSpread( QGradient::PadSpread );
+ else if ( spread == "repeat" || spread == "2" )
+ gradient.setSpread( QGradient::RepeatSpread );
+ else if ( spread == "reflect" || spread == "1" )
+ gradient.setSpread( QGradient::ReflectSpread );
}
// stop points
QGradientStops stops;
for ( int i = 5; i < vals.count(); i+=2 )
{
- bool bOk4, bOk5 = false;
- QColor c;
- double stop = vals[i].toDouble( &bOk4 );
- if ( i+1 < vals.count() )
- bOk5 = stringToColor( vals[ i+1 ], c );
- if ( bOk4 && stop >= 0.0 && stop <= 1.0 && bOk5 && c.isValid() )
- stops.append( QGradientStop( stop, c ) );
+ bool bOk4, bOk5 = false;
+ QColor c;
+ double stop = vals[i].toDouble( &bOk4 );
+ if ( i+1 < vals.count() )
+ bOk5 = stringToColor( vals[ i+1 ], c );
+ if ( bOk4 && stop >= 0.0 && stop <= 1.0 && bOk5 && c.isValid() )
+ stops.append( QGradientStop( stop, c ) );
}
gradient.setStops( stops );
success = true;
};
typedef enum {
- Shown, //!< column should be always visible
- Hidden, //!< column should be always hidden
- Toggled //!< it should be possible to show/hide the column with help of popup menu
+ Shown, //!< column should be always visible
+ Hidden, //!< column should be always hidden
+ Toggled //!< it should be possible to show/hide the column with help of popup menu
} Appropriate; //!< appropriate status
//! Environment variables substitution mode
typedef enum {
- Always, //!< substitute environment variable by it's value if variable exists, and "" otherwise
- Never, //!< keep environment variable as is without any substitution
- Auto //!< substitute environment variable by it's value if variable exists, and keep it as is otherwise
+ Always, //!< substitute environment variable by it's value if variable exists, and "" otherwise
+ Never, //!< keep environment variable as is without any substitution
+ Auto //!< substitute environment variable by it's value if variable exists, and keep it as is otherwise
} SubstMode;
static QString toQString( const char*, const int = -1 );
{
QtxComboBox* cb = ::qobject_cast<QtxComboBox*>( *it );
if ( cb )
- cb->setCurrentId( id );
+ cb->setCurrentId( id );
}
}
QList<QAction*> lst = actions();
for ( QList<QAction*>::iterator it = lst.begin(); it != lst.end(); ++it )
- w->removeAction( *it );
+ w->removeAction( *it );
}
}
else
else {
QList<QAction*> lst = actions();
for ( QList<QAction*>::iterator it = lst.begin(); it != lst.end(); ++it )
- w->removeAction( *it );
+ w->removeAction( *it );
}
}
}
\param _group menu node group ID
*/
QtxActionMenuMgr::MenuNode::MenuNode( MenuNode* p,
- const int _id,
- const int _idx,
- const int _group )
+ const int _id,
+ const int _idx,
+ const int _group )
: parent( p ), id( _id ), idx( _idx ), group( _group ), visible( true ), emptyEnabled( 0 )
{
if ( p )
{
a = foralit.next();
if ( !mw->actions().contains( a ) )
- foralit.remove();
+ foralit.remove();
}
}
QList<QAction*> alist = mw->actions();
Reader* reader() const;
virtual int append( const QString&, const bool,
- const ItemAttributes&, const int ) = 0;
+ const ItemAttributes&, const int ) = 0;
virtual void connect( QAction* ) const;
virtual bool loadPixmap( const QString&, QPixmap& ) const;
protected:
static int intValue( const ItemAttributes&, const QString&, const int );
static QString strValue( const ItemAttributes&, const QString&,
- const QString& = QString() );
+ const QString& = QString() );
private:
QtxActionMgr::Reader* myReader; //!< actions reader
};
}
int QtxActionToolMgr::createToolBar( const QString& title, bool floatable, Qt::ToolBarAreas dockAreas,
- int tid, QMainWindow* mw )
+ int tid, QMainWindow* mw )
{
static int _toolBarId = -1;
{
const NodeList& list = it.value().nodes;
for ( NodeList::const_iterator nit = list.begin(); nit != list.end(); ++nit )
- if ( (*nit).id == id )
- return true;
+ if ( (*nit).id == id )
+ return true;
}
}
return false;
int createToolBar( const QString&, int = -1, QMainWindow* = 0 );
int createToolBar( const QString&, bool, Qt::ToolBarAreas = Qt::AllToolBarAreas,
- int = -1, QMainWindow* = 0 );
+ int = -1, QMainWindow* = 0 );
void removeToolBar( const QString& );
void removeToolBar( const int );
\return color scale size
*/
QSize QtxColorScale::calculateSize( const bool min, const int flags, const bool title,
- const bool labels, const bool colors ) const
+ const bool labels, const bool colors ) const
{
int num = intervalsNumber();
{
QPainter p( (QtxColorScale*)this );
if ( scaleWidth )
- srt->setTextWidth( scaleWidth );
+ srt->setTextWidth( scaleWidth );
titleHeight = (int)srt->size().height() + spacer;
titleWidth = (int)srt->size().width() + 10;
{
bool scale = ( myDumpMode == ScaleDump || myDumpMode == FullDump );
bool label = ( myDumpMode == ScaleDump || myDumpMode == FullDump ) &&
- labelPosition() != None;
+ labelPosition() != None;
bool title = ( myDumpMode == TitleDump || myDumpMode == FullDump ) &&
- titlePosition() != None;
+ titlePosition() != None;
QColor bgc = palette().color( backgroundRole() );
QPainter p;
p.begin( &aPix );
QSize sz = calculateSize( false, myFlags & ~WrapTitle, title, label, scale );
if ( W < 0 )
- W = sz.width();
+ W = sz.width();
if ( H < 0 )
- H = sz.height();
+ H = sz.height();
}
aPix = QPixmap( W, H );
QRect aDrawRect = contentsRect();
drawScale( p, false/*testFlags( Transparent )*/, aDrawRect.x(),
- aDrawRect.y(), aDrawRect.width(), aDrawRect.height(),
- titlePosition() != None, labelPosition() != None, true );
+ aDrawRect.y(), aDrawRect.width(), aDrawRect.height(),
+ titlePosition() != None, labelPosition() != None, true );
}
/*!
int pos2 = lab - 1 - i2;
if ( filter && !( pos1 % filter ) )
{
- p->drawText( x, (int)( Y + i1 * step + ascent + offset ), labels[i1] );
- last1 = i1;
+ p->drawText( x, (int)( Y + i1 * step + ascent + offset ), labels[i1] );
+ last1 = i1;
}
if ( filter && !( pos2 % filter ) )
{
- p->drawText( x, (int)( Y + i2 * step + ascent + offset ), labels[i2] );
- last2 = i2;
+ p->drawText( x, (int)( Y + i2 * step + ascent + offset ), labels[i2] );
+ last2 = i2;
}
i1++;
i2--;
while ( pos <= i2 && i0 == -1 )
{
if ( filter && !( pos % filter ) &&
- qAbs( pos - last1 ) >= filter && qAbs( pos - last2 ) >= filter )
- i0 = pos;
+ qAbs( pos - last1 ) >= filter && qAbs( pos - last2 ) >= filter )
+ i0 = pos;
pos++;
}
double getNumber( const int ) const;
QTextDocument* textDocument( const int ) const;
void drawScale( QPainter*, const bool, const int, const int,
- const int, const int, const bool, const bool, const bool ) const;
+ const int, const int, const bool, const bool, const bool ) const;
void drawScale( QPainter*, const QColor&, const bool,
- const int, const int, const int, const int,
- const bool, const bool, const bool ) const;
+ const int, const int, const int, const int,
+ const bool, const bool, const bool ) const;
QSize calculateSize( const bool, const int,
- const bool, const bool, const bool ) const;
+ const bool, const bool, const bool ) const;
private:
double myMin; //!< lower limit
{
buttonId[mit.value()] = mit.key();
if ( mit.key() >= 0 )
- src.append( mit.value() );
+ src.append( mit.value() );
}
}
{
buttonLayout->addWidget( other[i] );
if ( aPolicy == QtxDialog::Uniform && i < (int)other.count() - 1 )
- buttonLayout->addStretch( 1 );
+ buttonLayout->addStretch( 1 );
}
}
#endif
( ( allowResize
#ifdef WIN32
- // in qwidget_win.cpp flag WStyle_ContextHelp will be unset in WStyle_MinMax in switched ON
- && !( wf & Qt::WindowContextHelpButtonHint )
+ // in qwidget_win.cpp flag WStyle_ContextHelp will be unset in WStyle_MinMax in switched ON
+ && !( wf & Qt::WindowContextHelpButtonHint )
#endif
- ) ? Qt::WindowMaximizeButtonHint : 0 ) ) ),
+ ) ? Qt::WindowMaximizeButtonHint : 0 ) ) ),
myInited( false ),
mySender( 0 ),
myAlignment( 0 ),
for ( ButtonMap::Iterator it = myButton.begin(); it != myButton.end(); ++it )
{
if ( it.key() < 0 )
- map.insert( it.key(), it.value() );
+ map.insert( it.key(), it.value() );
}
}
else if ( myButton.contains( id ) )
{
for ( ButtonMap::ConstIterator it = myButton.begin(); it != myButton.end(); ++it )
if ( f == -1 || ( it.key() >= 0 && f & it.key() ) )
- retmap.insert( it.key(), it.value() );
+ retmap.insert( it.key(), it.value() );
}
return retmap;
}
const QList<QAbstractButton*>& lst = aIt.value()->buttons();
for ( QList<QAbstractButton*>::const_iterator bIt = lst.begin(); bIt != lst.end(); ++bIt )
if ( (*bIt)->isVisibleTo( this ) )
- minWidth = qMax( minWidth, (*bIt)->sizeHint().width() );
+ minWidth = qMax( minWidth, (*bIt)->sizeHint().width() );
}
for ( AreaMap::Iterator aItr = myArea.begin(); aItr != myArea.end(); ++aItr )
const QList<QAbstractButton*>& lst = aItr.value()->buttons();
for ( QList<QAbstractButton*>::const_iterator bItr = lst.begin(); bItr != lst.end(); ++bItr )
if ( (*bItr)->isVisibleTo( this ) )
- (*bItr)->setMinimumWidth( minWidth );
+ (*bItr)->setMinimumWidth( minWidth );
}
}
public:
//! Buttons alignment type
typedef enum { Position, //!< buttons are placed according their position
- Expand, //!< buttons occupy all available space
- Uniform //!< buttons are uniformly placed in the area
+ Expand, //!< buttons occupy all available space
+ Uniform //!< buttons are uniformly placed in the area
} PlacePolicy;
//! Buttons area
typedef enum { TopArea, //!< horizontal area at the top side of the dialog box
- BottomArea, //!< horizontal area at the bottom side of the dialog box
- LeftArea, //!< vertical area at the left side of the dialog box
- RightArea //!< vertical area at the right side of the dialog box
+ BottomArea, //!< horizontal area at the bottom side of the dialog box
+ LeftArea, //!< vertical area at the left side of the dialog box
+ RightArea //!< vertical area at the right side of the dialog box
} ButtonArea;
//! Button position
typedef enum { Left, //!< set button left-most
- Right, //!< set button right-most
- Center, //!< place button in the center
- Top = Left, //!< set button top-most
- Bottom = Right //!< set button bottom-most
+ Right, //!< set button right-most
+ Center, //!< place button in the center
+ Top = Left, //!< set button top-most
+ Bottom = Right //!< set button bottom-most
} ButtonPosition;
//! Button ID flags
typedef enum { None = 0x00000000, //!< no button used
- OK = 0x00000001, //!< OK button
- Apply = 0x00000002, //!< Apply button
- Cancel = 0x00000004, //!< Cancel button
- Yes = 0x00000008, //!< Yes button
- No = 0x00000010, //!< No button
- Close = 0x00000020, //!< Close button
- Help = 0x00000040, //!< Help button
- OKCancel = OK | Cancel, //!< OK & Cancel button
- YesNo = Yes | No, //!< Yes & No buttons
- Standard = OK | Cancel | Help, //!< OK, Cancel & Help buttons
- All = Standard | YesNo | Apply | Close //!< all buttons
+ OK = 0x00000001, //!< OK button
+ Apply = 0x00000002, //!< Apply button
+ Cancel = 0x00000004, //!< Cancel button
+ Yes = 0x00000008, //!< Yes button
+ No = 0x00000010, //!< No button
+ Close = 0x00000020, //!< Close button
+ Help = 0x00000040, //!< Help button
+ OKCancel = OK | Cancel, //!< OK & Cancel button
+ YesNo = Yes | No, //!< Yes & No buttons
+ Standard = OK | Cancel | Help, //!< OK, Cancel & Help buttons
+ All = Standard | YesNo | Apply | Close //!< all buttons
} ButtonFlags;
//! Dialog box flags
typedef enum { Accept = 0x000001, //!< allow dialog box accepting control
- Reject = 0x000002, //!< allow dialog box rejecting control
- AlignOnce = 0x000004, //!< align dialog box only when it is first time shown
- SetFocus = 0x000008 //!< allow to set focus on dialog box when it is shown (user can use setFocusProxy() and specify own initial focus widget)
+ Reject = 0x000002, //!< allow dialog box rejecting control
+ AlignOnce = 0x000004, //!< align dialog box only when it is first time shown
+ SetFocus = 0x000008 //!< allow to set focus on dialog box when it is shown (user can use setFocusProxy() and specify own initial focus widget)
} DialogFlags;
public:
public:
//! Dock windows type.
enum { ToolBar, //!< list toolbars only
- DockWidget, //!< list dockable windows only
- Both //!< list toolbars and dockable windows
+ DockWidget, //!< list dockable windows only
+ Both //!< list toolbars and dockable windows
} DockType;
public:
if ( l )
{
for ( int i = 0; i < (int)l->count() && !vis; i++ )
- vis = l->itemAt( i ) && l->itemAt( i )->widget() && l->itemAt( i )->widget()->isVisibleTo( myCont );
+ vis = l->itemAt( i ) && l->itemAt( i )->widget() && l->itemAt( i )->widget()->isVisibleTo( myCont );
}
}
myPrecision(0)
{
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
}
/*!
setSingleStep( step );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
}
/*!
setSingleStep( step );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
}
/*!
else
{
if ( str.length() >= overhead && str.startsWith( pref ) &&
- str.right( suff.length() ) == suff )
- {
- QString core = str.mid( pref.length(), str.length() - overhead );
- int corePos = pos - pref.length();
- state = v.validate( core, corePos );
- pos = corePos + pref.length();
- str.replace( pref.length(), str.length() - overhead, core );
- }
+ str.right( suff.length() ) == suff )
+ {
+ QString core = str.mid( pref.length(), str.length() - overhead );
+ int corePos = pos - pref.length();
+ state = v.validate( core, corePos );
+ pos = corePos + pref.length();
+ str.replace( pref.length(), str.length() - overhead, core );
+ }
else
- {
- state = v.validate( str, pos );
- if ( state == QValidator::Invalid )
- {
- QString special = this->specialValueText().trimmed();
- QString candidate = str.trimmed();
- if ( special.startsWith( candidate ) )
- {
- if ( candidate.length() == special.length() )
- state = QValidator::Acceptable;
- else
- state = QValidator::Intermediate;
- }
- }
- }
+ {
+ state = v.validate( str, pos );
+ if ( state == QValidator::Invalid )
+ {
+ QString special = this->specialValueText().trimmed();
+ QString candidate = str.trimmed();
+ if ( special.startsWith( candidate ) )
+ {
+ if ( candidate.length() == special.length() )
+ state = QValidator::Acceptable;
+ else
+ state = QValidator::Intermediate;
+ }
+ }
+ }
}
return state;
}
mLen = 0;
if ( oPos != pos && cPos != pos )
{
- int i;
+ int i;
for ( i = pos + 1; i < (int)expr.length(); i++ )
{
if ( expr[i].isSpace() )
v1 = res;
}
else
- v1 = QVariant( v2.toList().contains( v1 ) );
+ v1 = QVariant( v2.toList().contains( v1 ) );
}
}
return err;
\return error code (QtxEvalExpr::Error)
*/
QtxEvalExpr::Error QtxEvalSetConst::isValid( const QString& /*op*/,
- const QVariant::Type /*t1*/,
- const QVariant::Type /*t2*/ ) const
+ const QVariant::Type /*t1*/,
+ const QVariant::Type /*t2*/ ) const
{
return QtxEvalExpr::InvalidOperation;
}
{
setCorrectionMode( QSpinBox::CorrectToNearestValue );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
}
/*!
setCorrectionMode( QSpinBox::CorrectToNearestValue );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
}
/*!
\param parent parent object
*/
QtxListAction::QtxListAction( const QIcon& icon, const QString& menuText,
- int accel, QObject* parent )
+ int accel, QObject* parent )
: QtxAction( menuText, icon, menuText, accel, parent ),
myFrame( 0 )
{
\param parent parent object
*/
QtxListAction::QtxListAction( const QString& text, const QString& menuText,
- int accel, QObject* parent )
+ int accel, QObject* parent )
: QtxAction( text, menuText, accel, parent ),
myFrame( 0 )
{
\param parent parent object
*/
QtxListAction::QtxListAction( const QString& text, const QIcon& icon,
- const QString& menuText, int accel, QObject* parent )
+ const QString& menuText, int accel, QObject* parent )
: QtxAction( text, icon, menuText, accel, parent ),
myFrame( 0 )
{
{
logoLab->setPixmap( (*it).pix );
// if ( !pix.mask().isNull() )
-// logoLab->setMask( pix.mask() );
+// logoLab->setMask( pix.mask() );
}
logoLab->setScaledContents( false );
for ( QStringList::const_iterator it = items.begin(); it != items.end(); ++it )
{
if ( (*it).startsWith( itemPrefix ) )
- resMgr->remove( section, *it );
+ resMgr->remove( section, *it );
}
}
int counter = 0;
for ( QStringList::const_iterator iter = lst.begin();
- iter != lst.end() && ( myHistoryCount < 0 || counter < myHistoryCount );
- ++iter, counter++ )
+ iter != lst.end() && ( myHistoryCount < 0 || counter < myHistoryCount );
+ ++iter, counter++ )
resMgr->setValue( section, itemPrefix + QString().sprintf( "%03d", counter ), *iter );
}
{
QString shortName = Qtx::file( myLinks[i] );
if ( map.contains( shortName ) )
- map[shortName]++;
+ map[shortName]++;
else
- map.insert( shortName, 0 );
+ map.insert( shortName, 0 );
}
}
case LinkAuto:
linkName = Qtx::file( *it );
if ( map.contains( linkName ) && map[linkName] )
- linkName = *it;
+ linkName = *it;
break;
case LinkShort:
linkName = Qtx::file( *it );
public:
//! Items insertion policy
typedef enum { MoveFirst, //!< put the specified item to the beginning
- MoveLast, //!< put the specified item to the end
- AddFirst, //!< if specified item doesn't exist, add it to the beginning
- AddLast //!< if specified item doesn't exist, add it to the end
+ MoveLast, //!< put the specified item to the end
+ AddFirst, //!< if specified item doesn't exist, add it to the beginning
+ AddLast //!< if specified item doesn't exist, add it to the end
} InsertionMode;
typedef enum { LinkAuto, //!< put the full path of link into the menu if link file names of severals link are same
- LinkShort, //!< put the only file name of link into the menu
- LinkFull //!< put the full path of link into the menu
+ LinkShort, //!< put the only file name of link into the menu
+ LinkFull //!< put the full path of link into the menu
} LinkType;
public:
if ( xOk )
{
if ( xp )
- x = screen.width() * qMax( qMin( x, 100 ), 0 ) / 100;
+ x = screen.width() * qMax( qMin( x, 100 ), 0 ) / 100;
x = ( xs > 0 ? x : screen.right() - x - rect.width() ) + frameGeometry().x() - geometry().x();
}
if ( yOk )
{
if ( yp )
- y = screen.height() * qMax( qMin( y, 100 ), 0 ) / 100;
+ y = screen.height() * qMax( qMin( y, 100 ), 0 ) / 100;
y = ( ys > 0 ? y : screen.bottom() - y - rect.height() ) + frameGeometry().y() - geometry().y();
}
if ( e->type() == QEvent::Leave ) {
QToolButton* tb = qobject_cast<QToolButton*>( o );
if ( tb )
- tb->setDown( false );
+ tb->setDown( false );
}
return QObject::eventFilter( o, e );
}
*/
QtxPagePrefEditItem::QtxPagePrefEditItem( const int type, const QString& title,
QtxPreferenceItem* parent, const QString& sect,
- const QString& param )
+ const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
myType( type )
{
*/
QtxPagePrefSpinItem::QtxPagePrefSpinItem( const int type, const QString& title,
QtxPreferenceItem* parent, const QString& sect,
- const QString& param )
+ const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param ),
myType( type )
{
\param param resource file parameter associated with the preference item
*/
QtxPagePrefTextItem::QtxPagePrefTextItem( QtxPreferenceItem* parent, const QString& sect,
- const QString& param )
+ const QString& param )
: QtxPageNamedPrefItem( QString(), parent, sect, param )
{
myEditor = new QTextEdit();
*/
QtxPagePrefFontItem::QtxPagePrefFontItem( const int feat, const QString& title,
QtxPreferenceItem* parent, const QString& sect,
- const QString& param )
+ const QString& param )
: QtxPageNamedPrefItem( title, parent, sect, param )
{
setControl( myFont = new QtxFontEdit( feat ) );
bool QtxPathDialog::acceptData() const
{
bool ok = true;
-
+
QWidget* parent = (QWidget*)this;
FileEntryMap::ConstIterator it;
if ( entry.edit->text().isEmpty() )
{
QMessageBox::critical( parent, windowTitle(), tr( "File name not specified" ),
- QMessageBox::Ok, QMessageBox::NoButton );
+ QMessageBox::Ok, QMessageBox::NoButton );
ok = false;
}
else switch ( entry.mode )
case OpenFile:
if ( !fileInfo.exists() )
{
- QMessageBox::critical( parent, windowTitle(), tr( "File \"%1\" does not exist" ).arg( fileInfo.filePath() ),
- QMessageBox::Ok, QMessageBox::NoButton );
- ok = false;
+ QMessageBox::critical( parent, windowTitle(), tr( "File \"%1\" does not exist" ).arg( fileInfo.filePath() ),
+ QMessageBox::Ok, QMessageBox::NoButton );
+ ok = false;
}
break;
case SaveFile:
if ( fileInfo.exists() )
- ok = QMessageBox::warning( parent, windowTitle(), tr( "File \"%1\" already exist. Do you want to overwrite it?" ).arg( fileInfo.filePath() ),
- QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes;
+ ok = QMessageBox::warning( parent, windowTitle(), tr( "File \"%1\" already exist. Do you want to overwrite it?" ).arg( fileInfo.filePath() ),
+ QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes;
break;
case OpenDir:
if ( !fileInfo.exists() || !fileInfo.isDir() )
{
- QMessageBox::critical( parent, windowTitle(), tr( "Directory \"%1\" does not exist" ).arg( fileInfo.filePath() ),
- QMessageBox::Ok, QMessageBox::NoButton );
- ok = false;
+ QMessageBox::critical( parent, windowTitle(), tr( "Directory \"%1\" does not exist" ).arg( fileInfo.filePath() ),
+ QMessageBox::Ok, QMessageBox::NoButton );
+ ok = false;
}
break;
case SaveDir:
if ( fileInfo.exists() && !fileInfo.isDir() )
{
- QMessageBox::critical( parent, windowTitle(), tr( "Directory \"%1\" can't be created because file with the same name exist" ).arg( fileInfo.filePath() ),
- QMessageBox::Ok, QMessageBox::NoButton );
- ok = false;
+ QMessageBox::critical( parent, windowTitle(), tr( "Directory \"%1\" can't be created because file with the same name exist" ).arg( fileInfo.filePath() ),
+ QMessageBox::Ok, QMessageBox::NoButton );
+ ok = false;
}
break;
case NewDir:
if ( fileInfo.exists() )
{
- if ( !fileInfo.isDir() )
- {
- QMessageBox::critical( parent, windowTitle(), tr( "Directory \"%1\" can't be created because file with the same name exist" ).arg( fileInfo.filePath() ),
- QMessageBox::Ok, QMessageBox::NoButton );
- ok = false;
- }
- else if ( QDir( fileInfo.filePath() ).count() > 2 )
- ok = QMessageBox::warning( parent, windowTitle(), tr( "Directory \"%1\" not empty. Do you want to remove all files in this directory?" ).arg( fileInfo.filePath() ),
- QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes;
+ if ( !fileInfo.isDir() )
+ {
+ QMessageBox::critical( parent, windowTitle(), tr( "Directory \"%1\" can't be created because file with the same name exist" ).arg( fileInfo.filePath() ),
+ QMessageBox::Ok, QMessageBox::NoButton );
+ ok = false;
+ }
+ else if ( QDir( fileInfo.filePath() ).count() > 2 )
+ ok = QMessageBox::warning( parent, windowTitle(), tr( "Directory \"%1\" not empty. Do you want to remove all files in this directory?" ).arg( fileInfo.filePath() ),
+ QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes;
}
break;
default:
{
int mode;
QLineEdit* le = fileEntry( id, mode );
-
+
if ( le )
{
if ( autoExt && ( mode == OpenFile || mode == SaveFile ) )
\return created file entry ID
*/
int QtxPathDialog::createFileEntry( const QString& lab, const int mode,
- const QString& filter, const int id )
+ const QString& filter, const int id )
{
int num = id;
if ( num == -1 )
for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it )
{
if ( (*it).indexOf( "." ) != -1 )
- res.append( (*it).trimmed() );
+ res.append( (*it).trimmed() );
}
}
return res;
for ( QObjectList::const_iterator it = aChildren.begin(); it != aChildren.end() && !res; ++it )
{
if ( (*it)->isWidgetType() )
- res = ((QWidget*)(*it))->isVisibleTo( wid );
+ res = ((QWidget*)(*it))->isVisibleTo( wid );
}
}
return res;
void initialize();
void updateVisibility();
QStringList prepareFilters( const QString& ) const;
- bool hasVisibleChildren( QWidget* ) const;
+ bool hasVisibleChildren( QWidget* ) const;
QStringList filterWildCards( const QString& ) const;
QString autoExtension( const QString&, const QString& = QString() ) const;
if (found) {
if (found != myLastSelected) {
// it is forbidden to add directory more then once
- if ( !quietMode )
- QMessageBox::critical(this,
- tr("Error"),
- tr("Directory already specified."),
- tr("Ok"));
- myEdit->setFocus();
+ if ( !quietMode )
+ QMessageBox::critical(this,
+ tr("Error"),
+ tr("Directory already specified."),
+ tr("Ok"));
+ myEdit->setFocus();
return false;
}
}
else {
if (!dir.exists()) {
- if ( !quietMode && QMessageBox::information(this,
- tr("Warning"),
- tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
- tr("Yes"), tr("No"), QString(), 1, 1) == 1) {
- myEdit->setFocus();
+ if ( !quietMode && QMessageBox::information(this,
+ tr("Warning"),
+ tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
+ tr("Yes"), tr("No"), QString(), 1, 1) == 1) {
+ myEdit->setFocus();
return false;
- }
+ }
}
// append
appendDir(myLastSelected, dir.absPath());
{
const QList<QVariant>& aList1 = v1.toList(), aList2 = v2.toList();
QList<QVariant>::const_iterator anIt1 = aList1.begin(), aLast1 = aList1.end(),
- anIt2 = aList2.begin(), aLast2 = aList2.end();
+ anIt2 = aList2.begin(), aLast2 = aList2.end();
for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ )
{
- if ( (*anIt1) != (*anIt2) )
- return (*anIt1)<(*anIt2);
+ if ( (*anIt1) != (*anIt2) )
+ return (*anIt1)<(*anIt2);
}
return anIt1 == aLast1 && anIt2 != aLast2;
}
const ItemAttributes&, const int );
virtual QString rule( const ItemAttributes&,
- const QtxPopupMgr::RuleType = VisibleRule ) const;
+ const QtxPopupMgr::RuleType = VisibleRule ) const;
private:
QtxPopupMgr* myMgr;
\return rule for the menu item corresponding to the rule type
*/
QString QtxPopupMgr::PopupCreator::rule( const ItemAttributes& /*attr*/,
- const QtxPopupMgr::RuleType /*ruleType*/ ) const
+ const QtxPopupMgr::RuleType /*ruleType*/ ) const
{
return QString();
}
if ( mySelection )
mySelection->setParent( this );
connect( mySelection, SIGNAL( destroyed( QObject* ) ),
- this, SLOT( onSelectionDestroyed( QObject* ) ) );
+ this, SLOT( onSelectionDestroyed( QObject* ) ) );
QtxActionMgr::triggerUpdate();
}
for ( int i = 0; i < mySelection->count() && !res; i++ )
{
QList<QVariant> c;
- for ( QStringList::const_iterator anIt1 = specific.begin(); anIt1 != specific.end(); ++anIt1 )
+ for ( QStringList::const_iterator anIt1 = specific.begin(); anIt1 != specific.end(); ++anIt1 )
c.append( parameter( *anIt1, i ) );
aCorteges.insert( c, 0 );
}
for ( QMap<QList<QVariant>, int>::const_iterator anIt = aCorteges.begin(); anIt != aCorteges.end(); ++anIt )
{
- const QList<QVariant>& aCortege = anIt.key();
- QStringList::const_iterator anIt1 = specific.begin(), aLast1 = specific.end();
- QList<QVariant>::const_iterator anIt2 = aCortege.begin();
- for ( ; anIt1 != aLast1; anIt1++, anIt2++ )
- p->setParameter( *anIt1, *anIt2 );
- res = res || result( p );
+ const QList<QVariant>& aCortege = anIt.key();
+ QStringList::const_iterator anIt1 = specific.begin(), aLast1 = specific.end();
+ QList<QVariant>::const_iterator anIt2 = aCortege.begin();
+ for ( ; anIt1 != aLast1; anIt1++, anIt2++ )
+ p->setParameter( *anIt1, *anIt2 );
+ res = res || result( p );
}
}
else
{
QVariant v = parameter( i, par );
if ( v.isValid() )
- QtxEvalSetSets::add( set, v );
+ QtxEvalSetSets::add( set, v );
else
- return QVariant();
+ return QVariant();
}
return set;
}
secMap[section].insert( paramName, paramValue );
}
else
- {
- qDebug( "Invalid parameter element" );
+ {
+ qDebug( "Invalid parameter element" );
res = false;
- }
+ }
+ }
+ else
+ {
+ res = paramNode.isComment();
+ if( !res )
+ qDebug( "Node isn't element nor comment" );
}
- else
- {
- res = paramNode.isComment();
- if( !res )
- qDebug( "Node isn't element nor comment" );
- }
paramNode = paramNode.nextSibling();
}
}
else
{
- qDebug( "Invalid section" );
+ qDebug( "Invalid section" );
res = false;
}
}
{
res = sectNode.isComment(); // if it's a comment -- let it be, pass it..
if( !res )
- qDebug( "Node isn't element nor comment" );
+ qDebug( "Node isn't element nor comment" );
}
sectNode = sectNode.nextSibling();
\brief Get the value of the option with specified name.
If option doesn't exist then null QString is returned.
-
+
\param opt option name
\return option value
*/
QtxRectRubberBand::QtxRectRubberBand(QWidget* parent)
- :QtxAbstractRubberBand( parent )
+ :QtxAbstractRubberBand( parent )
{
myPoints.resize( 4 );
myIsClosed = true;
void QtxRectRubberBand::setEndPoint( const QPoint& thePoint)
{
- myPoints[2] = thePoint;
+ myPoints[2] = thePoint;
myPoints[1].setX( thePoint.x() );
myPoints[3].setY( thePoint.y() );
updateMask();
void initGeometry( const QRect& );
void setStartPoint( const QPoint& );
void setEndPoint( const QPoint& );
-
+
virtual void clearGeometry();
};
const char* const first_xpm[] = {
"16 16 14 1",
-" c None",
-". c #111111",
-"+ c #0A0A0A",
-"@ c #161616",
-"# c #ACACAC",
-"$ c #FC6D6E",
-"% c #FB6364",
-"& c #F25B5C",
-"* c #EA5859",
-"= c #C1494A",
-"- c #B64545",
-"; c #AB4040",
-"> c #A03C3C",
-", c #99393A",
+" c None",
+". c #111111",
+"+ c #0A0A0A",
+"@ c #161616",
+"# c #ACACAC",
+"$ c #FC6D6E",
+"% c #FB6364",
+"& c #F25B5C",
+"* c #EA5859",
+"= c #C1494A",
+"- c #B64545",
+"; c #AB4040",
+"> c #A03C3C",
+", c #99393A",
" . ",
" +@+ ..# ",
" +$+# .$.... ",
const char* const last_xpm[] = {
"16 16 14 1",
-" c None",
-". c #111111",
-"+ c #0A0A0A",
-"@ c #161616",
-"# c #FC6D6E",
-"$ c #ACACAC",
-"% c #FB6364",
-"& c #F25B5C",
-"* c #EA5859",
-"= c #C1494A",
-"- c #B64545",
-"; c #AB4040",
-"> c #A03C3C",
-", c #99393A",
+" c None",
+". c #111111",
+"+ c #0A0A0A",
+"@ c #161616",
+"# c #FC6D6E",
+"$ c #ACACAC",
+"% c #FB6364",
+"& c #F25B5C",
+"* c #EA5859",
+"= c #C1494A",
+"- c #B64545",
+"; c #AB4040",
+"> c #A03C3C",
+", c #99393A",
" . ",
" .. +@+ ",
" ....#. +#+$",
const char* const prev_xpm[] = {
"16 16 12 1",
-" c None",
-". c #111111",
-"+ c #ACACAC",
-"@ c #FC6D6E",
-"# c #FB6364",
-"$ c #F25B5C",
-"% c #EA5859",
-"& c #C1494A",
-"* c #B64545",
-"= c #AB4040",
-"- c #A03C3C",
-"; c #99393A",
+" c None",
+". c #111111",
+"+ c #ACACAC",
+"@ c #FC6D6E",
+"# c #FB6364",
+"$ c #F25B5C",
+"% c #EA5859",
+"& c #C1494A",
+"* c #B64545",
+"= c #AB4040",
+"- c #A03C3C",
+"; c #99393A",
" . ",
" ..+ ",
" .@...... ",
const char* const next_xpm[] = {
"16 16 12 1",
-" c None",
-". c #111111",
-"+ c #FC6D6E",
-"@ c #FB6364",
-"# c #F25B5C",
-"$ c #EA5859",
-"% c #C1494A",
-"& c #B64545",
-"* c #ACACAC",
-"= c #AB4040",
-"- c #A03C3C",
-"; c #99393A",
+" c None",
+". c #111111",
+"+ c #FC6D6E",
+"@ c #FB6364",
+"# c #F25B5C",
+"$ c #EA5859",
+"% c #C1494A",
+"& c #B64545",
+"* c #ACACAC",
+"= c #AB4040",
+"- c #A03C3C",
+"; c #99393A",
" . ",
" .. ",
" ......+. ",
const char* const close_xpm[] = {
"16 16 8 1",
-" c None",
-". c #D73727",
-"+ c #E17765",
-"@ c #E7957F",
-"# c #DE6F48",
-"$ c #DF7B4F",
-"% c #FAE9E4",
-"& c #FFFFFF",
+" c None",
+". c #D73727",
+"+ c #E17765",
+"@ c #E7957F",
+"# c #DE6F48",
+"$ c #DF7B4F",
+"% c #FAE9E4",
+"& c #FFFFFF",
" ",
" ............ ",
" .+@@@@@@@@@@+. ",
QPalette p = myData->palette();
p.setColor( QPalette::Active,
- QPalette::Base,
- QApplication::palette( myData ).color( QPalette::Active,
- QPalette::Base ) );
+ QPalette::Base,
+ QApplication::palette( myData ).color( QPalette::Active,
+ QPalette::Base ) );
bool found = true;
if ( mySearcher && !what.isEmpty() )
for ( it = myShortcuts.begin(), i = 0; it != myShortcuts.end(); ++it, i++ )
{
(*it)->setEnabled( isEnabled() && ( i < 3 && myActivators & StandardKey ||
- i > 2 && myActivators & HotKey ) );
+ i > 2 && myActivators & HotKey ) );
}
}
if ( myView->model() )
return myView->model()->match( myView->model()->index( 0, myColumn ),
- Qt::DisplayRole,
- s, -1, fl );
+ Qt::DisplayRole,
+ s, -1, fl );
return QModelIndexList();
}
appropriate item
*/
QModelIndex QtxTreeViewSearcher::findNearest( const QModelIndex& index,
- const QModelIndexList& lst,
- bool direction )
+ const QModelIndexList& lst,
+ bool direction )
{
if ( direction )
{
{
QModelIndex found = it.next();
if ( compareIndices( found, index ) > 0 )
- return found;
+ return found;
}
}
else
{
QModelIndex found = it.previous();
if ( compareIndices( found, index ) < 0 )
- return found;
+ return found;
}
}
return QModelIndex();
and positive value otherwise
*/
int QtxTreeViewSearcher::compareIndices( const QModelIndex& left,
- const QModelIndex& right )
+ const QModelIndex& right )
{
QString leftId = getId( left );
QString rightId = getId( right );
if ( mySplash ) {
mySplash->setError( code );
QMessageBox::critical( mySplash,
- title.isEmpty() ? tr( "Error" ) : title,
- error,
- tr( "&OK" ) );
+ title.isEmpty() ? tr( "Error" ) : title,
+ error,
+ tr( "&OK" ) );
}
else {
printf( "QtxSplash::error: %s\n",error.toLatin1().constData() );
\sa progressColors()
*/
void QtxSplash::setProgressColors( const QColor& startColor,
- const QColor& endColor,
+ const QColor& endColor,
const Qt::Orientation orientation )
{
if ( !startColor.isValid() )
fl = 0;
QStringList opts = pf.split( QRegExp( "," ), QString::SkipEmptyParts );
for ( int i = 0; i < opts.count(); i++ ) {
- QString opt = opts[i].trimmed().toLower();
- if ( opt == "left" )
- fl = fl | LeftSide;
- else if ( opt == "right" )
- fl = fl | RightSide;
- else if ( opt == "top" )
- fl = fl | TopSide;
- else if ( opt == "bottom" )
- fl = fl | BottomSide;
- else if ( opt == "left_to_right" )
- fl = fl | LeftToRight;
- else if ( opt == "right_to_left" )
- fl = fl | RightToLeft;
+ QString opt = opts[i].trimmed().toLower();
+ if ( opt == "left" )
+ fl = fl | LeftSide;
+ else if ( opt == "right" )
+ fl = fl | RightSide;
+ else if ( opt == "top" )
+ fl = fl | TopSide;
+ else if ( opt == "bottom" )
+ fl = fl | BottomSide;
+ else if ( opt == "left_to_right" )
+ fl = fl | LeftToRight;
+ else if ( opt == "right_to_left" )
+ fl = fl | RightToLeft;
}
}
setProgressFlags( fl );
fl = 0;
QStringList opts = al.split( QRegExp( "," ), QString::SkipEmptyParts );
for ( int i = 0; i < opts.count(); i++ ) {
- QString opt = opts[i].trimmed().toLower();
- if ( opt == "left" )
- fl = fl | Qt::AlignLeft;
- else if ( opt == "right" )
- fl = fl | Qt::AlignRight;
- else if ( opt == "top" )
- fl = fl | Qt::AlignTop;
- else if ( opt == "bottom" )
- fl = fl | Qt::AlignBottom;
- else if ( opt == "hcenter" )
- fl = fl | Qt::AlignHCenter;
- else if ( opt == "vcenter" )
- fl = fl | Qt::AlignVCenter;
- else if ( opt == "justify" )
- fl = fl | Qt::AlignJustify;
- else if ( opt == "center" )
- fl = fl | Qt::AlignCenter;
+ QString opt = opts[i].trimmed().toLower();
+ if ( opt == "left" )
+ fl = fl | Qt::AlignLeft;
+ else if ( opt == "right" )
+ fl = fl | Qt::AlignRight;
+ else if ( opt == "top" )
+ fl = fl | Qt::AlignTop;
+ else if ( opt == "bottom" )
+ fl = fl | Qt::AlignBottom;
+ else if ( opt == "hcenter" )
+ fl = fl | Qt::AlignHCenter;
+ else if ( opt == "vcenter" )
+ fl = fl | Qt::AlignVCenter;
+ else if ( opt == "justify" )
+ fl = fl | Qt::AlignJustify;
+ else if ( opt == "center" )
+ fl = fl | Qt::AlignCenter;
}
}
setTextAlignment( fl );
setProgressColors( lgrad );
}
else if ( resMgr->value( resSection, "progress_color", rgrad ) ||
- resMgr->value( resSection, "progress_colors", rgrad ) ) {
+ resMgr->value( resSection, "progress_colors", rgrad ) ) {
// radial gradient-colored progress bar
setProgressColors( rgrad );
}
else if ( resMgr->value( resSection, "progress_color", cgrad ) ||
- resMgr->value( resSection, "progress_colors", cgrad ) ) {
+ resMgr->value( resSection, "progress_colors", cgrad ) ) {
// conical gradient-colored progress bar
setProgressColors( cgrad );
}
else if ( resMgr->value( resSection, "progress_color", pc ) ||
- resMgr->value( resSection, "progress_colors", pc ) ) {
+ resMgr->value( resSection, "progress_colors", pc ) ) {
// one/two-colored progress bar
QStringList colors = pc.split( "|", QString::SkipEmptyParts );
QColor c1, c2;
bool bOk;
gt = colors[2].toInt( &bOk );
if ( bOk ) {
- if ( gt == 0 )
- o = Qt::Horizontal;
+ if ( gt == 0 )
+ o = Qt::Horizontal;
}
else {
- if ( colors[2].toLower().startsWith( "h" ) )
- o = Qt::Horizontal;
+ if ( colors[2].toLower().startsWith( "h" ) )
+ o = Qt::Horizontal;
}
}
setProgressColors( c1, c2, o );
\sa message(), constantInfo(), setConstantInfo()
*/
void QtxSplash::setMessage( const QString& msg,
- int alignment,
- const QColor& color )
+ int alignment,
+ const QColor& color )
{
myMessage = msg;
myAlignment = alignment;
QLinearGradient lg;
const QLinearGradient* other = static_cast<const QLinearGradient*>( progressColors() );
if ( checkGradient( other ) ) {
- // gradient is defined in relative coordinates [0.0 - 1.0]
- lg.setStart( r.left() + r.width() * other->start().x(),
- r.top() + r.height() * other->start().y() );
- lg.setFinalStop( r.left() + r.width() * other->finalStop().x(),
- r.top() + r.height() * other->finalStop().y() );
+ // gradient is defined in relative coordinates [0.0 - 1.0]
+ lg.setStart( r.left() + r.width() * other->start().x(),
+ r.top() + r.height() * other->start().y() );
+ lg.setFinalStop( r.left() + r.width() * other->finalStop().x(),
+ r.top() + r.height() * other->finalStop().y() );
}
else {
- // gradient is defined in absolute coordinates
- // according to its dimensions
- lg.setStart( r.topLeft() + other->start() );
- lg.setFinalStop( r.topLeft() + other->finalStop() );
+ // gradient is defined in absolute coordinates
+ // according to its dimensions
+ lg.setStart( r.topLeft() + other->start() );
+ lg.setFinalStop( r.topLeft() + other->finalStop() );
}
lg.setStops( other->stops() );
QRadialGradient rg;
const QRadialGradient* other = static_cast<const QRadialGradient*>( progressColors() );
if ( checkGradient( other ) ) {
- // gradient is defined in relative coordinates [0.0 - 1.0]
- rg.setCenter( r.left() + r.width() * other->center().x(),
- r.top() + r.height() * other->center().y() );
- rg.setFocalPoint( r.left() + r.width() * other->focalPoint().x(),
- r.top() + r.height() * other->focalPoint().y() );
+ // gradient is defined in relative coordinates [0.0 - 1.0]
+ rg.setCenter( r.left() + r.width() * other->center().x(),
+ r.top() + r.height() * other->center().y() );
+ rg.setFocalPoint( r.left() + r.width() * other->focalPoint().x(),
+ r.top() + r.height() * other->focalPoint().y() );
}
else {
- // gradient is defined in absolute coordinates
- // according to its dimensions
- rg.setCenter( r.topLeft() + other->center() );
- rg.setFocalPoint( r.topLeft() + other->focalPoint() );
+ // gradient is defined in absolute coordinates
+ // according to its dimensions
+ rg.setCenter( r.topLeft() + other->center() );
+ rg.setFocalPoint( r.topLeft() + other->focalPoint() );
}
// only width is taken into account for the radius in relative mode
QConicalGradient cg;
const QConicalGradient* other = static_cast<const QConicalGradient*>( progressColors() );
if ( checkGradient( other ) ) {
- // gradient is defined in relative coordinates [0.0 - 1.0]
- cg.setCenter( r.left() + r.width() * other->center().x(),
- r.top() + r.height() * other->center().y() );
+ // gradient is defined in relative coordinates [0.0 - 1.0]
+ cg.setCenter( r.left() + r.width() * other->center().x(),
+ r.top() + r.height() * other->center().y() );
}
else {
- // gradient is defined in absolute coordinates
- // according to its dimensions
- cg.setCenter( r.topLeft() + other->center() );
+ // gradient is defined in absolute coordinates
+ // according to its dimensions
+ cg.setCenter( r.topLeft() + other->center() );
}
cg.setAngle( other->angle() );
int progressFlags() const;
void setProgressColors( const QColor&,
- const QColor& = QColor(),
- const Qt::Orientation = Qt::Vertical );
+ const QColor& = QColor(),
+ const Qt::Orientation = Qt::Vertical );
void setProgressColors( const QGradient& );
const QGradient* progressColors() const;
public slots:
void setMessage( const QString&,
- const int,
- const QColor& = QColor() );
+ const int,
+ const QColor& = QColor() );
void setMessage( const QString& );
void clear();
if ( o == myHeaderEditor && e->type() == QEvent::KeyPress && isHeaderEditing() )
{
- QKeyEvent* ke = (QKeyEvent*)e;
+ QKeyEvent* ke = (QKeyEvent*)e;
if ( ke->key() == Key_Escape )
{
endHeaderEdit( false );
if ( o == myHeaderEditor && e->type() == QEvent::FocusOut &&
isHeaderEditing() && ((QFocusEvent*)e)->reason() != QFocusEvent::Popup )
{
- endHeaderEdit();
- return true;
+ endHeaderEdit();
+ return true;
}
if ( e->type() == QEvent::Wheel && isHeaderEditing() )
bool updVis = ( o != myCont && ( e->type() == QEvent::Show || e->type() == QEvent::ShowToParent ||
e->type() == QEvent::Hide || e->type() == QEvent::HideToParent ) ) ||
( o == myCont && ( e->type() == QEvent::ChildRemoved || e->type() == QEvent::Show ||
- e->type() == QEvent::ShowToParent || e->type() == QEvent::ActionAdded ||
- e->type() == QEvent::ActionRemoved ) );
+ e->type() == QEvent::ShowToParent || e->type() == QEvent::ActionAdded ||
+ e->type() == QEvent::ActionRemoved ) );
if ( updVis )
{
palette.setColor( backgroundRole(), QColor( 255, 255, 231 ) );
setPalette( palette );
- myWidgetRegion = QRect( -1, -1, -1, -1 );
+ myWidgetRegion = QRect( -1, -1, -1, -1 );
- setFrameShape( QFrame::Panel );
- setFrameShadow( QFrame::Plain );
+ setFrameShape( QFrame::Panel );
+ setFrameShadow( QFrame::Plain );
parent->setMouseTracking( true );
- parent->installEventFilter( this );
- installEventFilter( this );
+ parent->installEventFilter( this );
+ installEventFilter( this );
- mySleepTimer = new QTimer( this );
+ mySleepTimer = new QTimer( this );
mySleepTimer->setSingleShot( true );
- myWakeUpTimer = new QTimer( this );
+ myWakeUpTimer = new QTimer( this );
myWakeUpTimer->setSingleShot( true );
- connect( mySleepTimer, SIGNAL( timeout() ), this, SLOT( onSleepTimeOut() ) );
- connect( myWakeUpTimer, SIGNAL( timeout() ), this, SLOT( onWakeUpTimeOut() ) );
+ connect( mySleepTimer, SIGNAL( timeout() ), this, SLOT( onSleepTimeOut() ) );
+ connect( myWakeUpTimer, SIGNAL( timeout() ), this, SLOT( onWakeUpTimeOut() ) );
myWakeUpDelayTime = 700;
myShowDelayTime = 5000;
*/
bool QtxToolTip::eventFilter( QObject* o, QEvent* e )
{
- if ( ( e->type() == QEvent::Destroy ) || ( e->type() == QEvent::Close ) || ( e->type() == QEvent::Hide ) )
- {
- hideTip();
- }
- if ( e->type() == QEvent::Leave )
- {
- if ( isVisible() && ( o == this ) )
- hideTip();
- myWakeUpTimer->stop();
- }
- if ( e->type() == QEvent::MouseMove )
- {
- QMouseEvent* me = (QMouseEvent*)e;
- QPoint thePos = parentWidget()->mapFromGlobal( me->globalPos() );
- if ( myWakeUpTimer->isActive() )
- {
- myWakeUpTimer->stop();
- myWakeUpTimer->start( myWakeUpDelayTime );
- }
- if ( isVisible() )
- {
- if ( !myWidgetRegion.contains( thePos ) )
+ if ( ( e->type() == QEvent::Destroy ) || ( e->type() == QEvent::Close ) || ( e->type() == QEvent::Hide ) )
+ {
+ hideTip();
+ }
+ if ( e->type() == QEvent::Leave )
+ {
+ if ( isVisible() && ( o == this ) )
+ hideTip();
+ myWakeUpTimer->stop();
+ }
+ if ( e->type() == QEvent::MouseMove )
+ {
+ QMouseEvent* me = (QMouseEvent*)e;
+ QPoint thePos = parentWidget()->mapFromGlobal( me->globalPos() );
+ if ( myWakeUpTimer->isActive() )
+ {
+ myWakeUpTimer->stop();
+ myWakeUpTimer->start( myWakeUpDelayTime );
+ }
+ if ( isVisible() )
+ {
+ if ( !myWidgetRegion.contains( thePos ) )
{
- hideTip();
+ hideTip();
myWidgetRegion = QRect( -1, -1, -1, -1 );
}
- }
- else
- {
- if ( !myWidgetRegion.isValid() || myWidgetRegion.contains( thePos ) )
- myWakeUpTimer->start( myWakeUpDelayTime );
- }
- }
- if ( e->type() == QEvent::KeyPress )
- {
- hideTip();
- }
- if ( o == parent() && ( e->type() == QEvent::MouseButtonPress ||
+ }
+ else
+ {
+ if ( !myWidgetRegion.isValid() || myWidgetRegion.contains( thePos ) )
+ myWakeUpTimer->start( myWakeUpDelayTime );
+ }
+ }
+ if ( e->type() == QEvent::KeyPress )
+ {
+ hideTip();
+ }
+ if ( o == parent() && ( e->type() == QEvent::MouseButtonPress ||
e->type() == QEvent::MouseButtonRelease ) )
- {
- hideTip();
- }
- return false;
+ {
+ hideTip();
+ }
+ return false;
}
/*!
*/
void QtxToolTip::showTip( const QPoint& aPos, const QString& text, const QRect& aWidgetRegion )
{
- QFontMetrics theFM = fontMetrics();
- int theHeight = theFM.height();
- int theWidth = theFM.width( text ) + 2;
- showTip( QRect( QPoint( aPos.x(), aPos.y() + 10 ), QSize( theWidth, theHeight ) ), text, aWidgetRegion );
+ QFontMetrics theFM = fontMetrics();
+ int theHeight = theFM.height();
+ int theWidth = theFM.width( text ) + 2;
+ showTip( QRect( QPoint( aPos.x(), aPos.y() + 10 ), QSize( theWidth, theHeight ) ), text, aWidgetRegion );
}
/*!
*/
void QtxToolTip::showTip( const QRect& aRegion, const QString& text, const QRect& aWidgetRegion )
{
- setText( text );
- myWidgetRegion = aWidgetRegion;
- setGeometry( aRegion );
- if ( myShowDelayTime != 0 )
- mySleepTimer->start( myShowDelayTime );
- show();
+ setText( text );
+ myWidgetRegion = aWidgetRegion;
+ setGeometry( aRegion );
+ if ( myShowDelayTime != 0 )
+ mySleepTimer->start( myShowDelayTime );
+ show();
}
/*!
*/
void QtxToolTip::hideTip()
{
- hide();
+ hide();
myWidgetRegion = QRect( -1, -1, -1, -1 );
- mySleepTimer->stop();
+ mySleepTimer->stop();
}
/*!
*/
void QtxToolTip::maybeTip( const QPoint& pos )
{
- QString text;
- QRect textRegion, theRegion( -1, -1, -1, -1 );
- QFont theFnt = font();
+ QString text;
+ QRect textRegion, theRegion( -1, -1, -1, -1 );
+ QFont theFnt = font();
emit maybeTip( pos, text, theFnt, textRegion, theRegion );
if ( theRegion.isValid() )
- {
- setFont( theFnt );
- int margin = lineWidth() + indent();
- QRect dspRegion( QPoint( textRegion.x() - margin, textRegion.y() ),
- QSize( textRegion.width() + 2 * margin, textRegion.height() ) );
- QRect tipRegion( parentWidget()->mapToGlobal( dspRegion.topLeft() ), dspRegion.size() );
- if ( tipRegion.left() < 0 )
- tipRegion.translate( -1 * tipRegion.left(), 0 );
- showTip( tipRegion, text, theRegion );
- }
+ {
+ setFont( theFnt );
+ int margin = lineWidth() + indent();
+ QRect dspRegion( QPoint( textRegion.x() - margin, textRegion.y() ),
+ QSize( textRegion.width() + 2 * margin, textRegion.height() ) );
+ QRect tipRegion( parentWidget()->mapToGlobal( dspRegion.topLeft() ), dspRegion.size() );
+ if ( tipRegion.left() < 0 )
+ tipRegion.translate( -1 * tipRegion.left(), 0 );
+ showTip( tipRegion, text, theRegion );
+ }
}
/*!
*/
void QtxToolTip::onSleepTimeOut()
{
- mySleepTimer->stop();
- hideTip();
+ mySleepTimer->stop();
+ hideTip();
}
/*!
*/
void QtxToolTip::onWakeUpTimeOut()
{
- myWakeUpTimer->stop();
+ myWakeUpTimer->stop();
QPoint pos = QCursor::pos();
if ( parentWidget() )
pos = parentWidget()->mapFromGlobal( pos );
*/
void QtxToolTip::mousePressEvent( QMouseEvent* e )
{
- hideTip();
- QWidget* reciever = parentWidget();
- QMouseEvent* me = new QMouseEvent( QEvent::MouseButtonPress,
- reciever->mapFromGlobal( e->globalPos() ),
- e->button(), e->buttons(), Qt::KeypadModifier );
- QApplication::sendEvent( reciever, me );
+ hideTip();
+ QWidget* reciever = parentWidget();
+ QMouseEvent* me = new QMouseEvent( QEvent::MouseButtonPress,
+ reciever->mapFromGlobal( e->globalPos() ),
+ e->button(), e->buttons(), Qt::KeypadModifier );
+ QApplication::sendEvent( reciever, me );
}
/*!
*/
void QtxToolTip::mouseDoubleClickEvent( QMouseEvent* e )
{
- hideTip();
- QWidget* reciever = parentWidget();
- QMouseEvent* me = new QMouseEvent( QEvent::MouseButtonDblClick,
- reciever->mapFromGlobal( e->globalPos() ),
- e->button(), e->buttons(), Qt::KeypadModifier );
- QApplication::sendEvent( reciever, me );
+ hideTip();
+ QWidget* reciever = parentWidget();
+ QMouseEvent* me = new QMouseEvent( QEvent::MouseButtonDblClick,
+ reciever->mapFromGlobal( e->globalPos() ),
+ e->button(), e->buttons(), Qt::KeypadModifier );
+ QApplication::sendEvent( reciever, me );
}
/*!
class QTX_EXPORT QtxToolTip : public QLabel
{
- Q_OBJECT
+ Q_OBJECT
public:
- QtxToolTip( QWidget* = 0 );
- virtual ~QtxToolTip();
+ QtxToolTip( QWidget* = 0 );
+ virtual ~QtxToolTip();
- void hideTip();
+ void hideTip();
- virtual void showTip( const QPoint& aPos,
+ virtual void showTip( const QPoint& aPos,
const QString& text, const QRect& aWidgetRegion );
- virtual void showTip( const QRect& aRegion,
+ virtual void showTip( const QRect& aRegion,
const QString& text, const QRect& aWidgetRegion );
- virtual bool eventFilter( QObject* o, QEvent* e );
+ virtual bool eventFilter( QObject* o, QEvent* e );
void setWakeUpDelayTime( int );
void setShowDelayTime( int );
void maybeTip( QPoint, QString&, QFont&, QRect&, QRect& );
protected slots:
- void onSleepTimeOut();
- void onWakeUpTimeOut();
+ void onSleepTimeOut();
+ void onWakeUpTimeOut();
protected:
- virtual void maybeTip( const QPoint& );
- virtual void mousePressEvent( QMouseEvent* );
- virtual void mouseDoubleClickEvent( QMouseEvent* );
+ virtual void maybeTip( const QPoint& );
+ virtual void mousePressEvent( QMouseEvent* );
+ virtual void mouseDoubleClickEvent( QMouseEvent* );
QTimer* sleepTimer() const;
QTimer* wakeUpTimer() const;
private:
- QTimer* myWakeUpTimer;
- QTimer* mySleepTimer;
- QRect myWidgetRegion;
+ QTimer* myWakeUpTimer;
+ QTimer* mySleepTimer;
+ QRect myWidgetRegion;
int myShowDelayTime;
int myWakeUpDelayTime;
QIcon icon;
if ( iconData.isValid() ) {
if ( qVariantCanConvert<QIcon>( iconData ) )
- icon = qVariantValue<QIcon>( iconData );
+ icon = qVariantValue<QIcon>( iconData );
else if ( qVariantCanConvert<QPixmap>( iconData ) )
- icon = qVariantValue<QPixmap>( iconData );
+ icon = qVariantValue<QPixmap>( iconData );
}
if( ( !lab.isEmpty() || !icon.isNull() ) &&
- appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true )
- {
+ appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true )
+ {
QAction* a = menu.addAction( icon, lab );
a->setCheckable( true );
a->setChecked( !isSectionHidden( i ) );
setClickable( a->isChecked() );
QtxTreeView* view = qobject_cast<QtxTreeView*>( parent() );
if ( view ) {
- view->emitSortingEnabled( a->isChecked() );
- if ( a->isChecked() ) {
- connect( this, SIGNAL( sectionClicked( int ) ), view, SLOT( onHeaderClicked( int ) ) );
- view->sortByColumn( sortIndicatorSection(), sortIndicatorOrder() );
- }
- else {
- disconnect( this, SIGNAL( sectionClicked( int ) ), view, SLOT( onHeaderClicked( int ) ) );
- view->sortByColumn( 0, Qt::AscendingOrder );
- }
+ view->emitSortingEnabled( a->isChecked() );
+ if ( a->isChecked() ) {
+ connect( this, SIGNAL( sectionClicked( int ) ), view, SLOT( onHeaderClicked( int ) ) );
+ view->sortByColumn( sortIndicatorSection(), sortIndicatorOrder() );
+ }
+ else {
+ disconnect( this, SIGNAL( sectionClicked( int ) ), view, SLOT( onHeaderClicked( int ) ) );
+ view->sortByColumn( 0, Qt::AscendingOrder );
+ }
}
}
}
\param deselected previous selection
*/
void QtxTreeView::selectionChanged( const QItemSelection& selected,
- const QItemSelection& deselected )
+ const QItemSelection& deselected )
{
QTreeView::selectionChanged( selected, deselected );
emit( selectionChanged() );
QTreeView::setModel( m );
if ( model() )
connect( model(), SIGNAL( headerDataChanged( Qt::Orientation, int, int ) ),
- this, SLOT( onAppropriate( Qt::Orientation, int, int ) ) );
+ this, SLOT( onAppropriate( Qt::Orientation, int, int ) ) );
}
void QtxTreeView::onAppropriate( Qt::Orientation orient, int first, int last )
{
if( orient==Qt::Horizontal )
for( int i=first; i<=last; i++ )
- {
- int appr = model()->headerData( i, orient, Qtx::AppropriateRole ).toInt();
- header()->setSectionHidden( i, appr==Qtx::Hidden );
- }
+ {
+ int appr = model()->headerData( i, orient, Qtx::AppropriateRole ).toInt();
+ header()->setSectionHidden( i, appr==Qtx::Hidden );
+ }
}
\param parent parent object
*/
QtxDoubleValidator::QtxDoubleValidator( const double bot, const double top,
- const int dec, QObject* parent )
+ const int dec, QObject* parent )
: QDoubleValidator( bot, top, dec, parent )
{
}
ws->cascade();
- int w = ws->width();
- int h = ws->height();
+ int w = ws->width();
+ int h = ws->height();
- QWidgetList winList = ws->windowList();
+ QWidgetList winList = ws->windowList();
for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
- (*it)->resize( int( w * 0.8 ), int( h * 0.8 ) );
+ (*it)->resize( int( w * 0.8 ), int( h * 0.8 ) );
}
/*!
QPixmap pm = icon().pixmap( style()->pixelMetric( QStyle::PM_SmallIconSize ), isEnabled() ?
underMouse() ? QIcon::Active : QIcon::Normal
- : QIcon::Disabled,
+ : QIcon::Disabled,
isDown() ? QIcon::On : QIcon::Off );
style()->drawItemPixmap( &p, r, Qt::AlignCenter, pm );
}
{
QtxWorkstackArea* area = ::qobject_cast<QtxWorkstackArea*>( wid );
if ( area )
- area->saveState( stream );
+ area->saveState( stream );
}
}
}
if ( activeWidget()->focusWidget()->hasFocus() )
{
QFocusEvent in( QEvent::FocusIn );
- QApplication::sendEvent( this, &in );
- }
+ QApplication::sendEvent( this, &in );
+ }
else
{
activeWidget()->focusWidget()->setFocus();
- myBar->updateActiveState();
- }
+ myBar->updateActiveState();
+ }
}
}
break;
{
area->removeWidget( wid_i );
newArea->insertWidget( wid_i );
- wid_i->showMaximized();
+ wid_i->showMaximized();
}
}
break;
{
area->removeWidget( *itr );
newArea->insertWidget( *itr );
- (*itr)->showMaximized();
+ (*itr)->showMaximized();
}
}
break;
area1->insertWidget( *itr2, wid1_ind + 1 );
else
area1->insertWidget( *itr2, ind );
- (*itr2)->showMaximized();
+ (*itr2)->showMaximized();
}
}
else
connect( area, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
connect( area, SIGNAL( activated( QWidget* ) ), this, SLOT( onWindowActivated( QWidget* ) ) );
connect( area, SIGNAL( contextMenuRequested( QWidget*, QPoint ) ),
- this, SLOT( onContextMenuRequested( QWidget*, QPoint ) ) );
+ this, SLOT( onContextMenuRequested( QWidget*, QPoint ) ) );
connect( area, SIGNAL( deactivated( QtxWorkstackArea* ) ), this, SLOT( onDeactivated( QtxWorkstackArea* ) ) );
return area;
{
QtxWorkstackChild* c = *itr;
if ( !c->widget() )
- continue;
+ continue;
map.insert( c->widget()->objectName(), c );
public:
//! Workstack actions (context menu items)
enum { SplitVertical = 0x01, //!< "Split vertically" menu item
- SplitHorizontal = 0x02, //!< "Split horizontally" menu item
- Close = 0x04, //!< "Close" menu item
- Rename = 0x08, //!< "Rename" menu item
- All = SplitVertical | SplitHorizontal |
- Close | Rename //!< all menu items
+ SplitHorizontal = 0x02, //!< "Split horizontally" menu item
+ Close = 0x04, //!< "Close" menu item
+ Rename = 0x08, //!< "Rename" menu item
+ All = SplitVertical | SplitHorizontal |
+ Close | Rename //!< all menu items
};
enum { VersionMarker = 0x01,
- SplitMarker = 0x02,
- AreaMarker = 0x04,
- WidgetMarker = 0x08
+ SplitMarker = 0x02,
+ AreaMarker = 0x04,
+ WidgetMarker = 0x08
};
enum { Horizontal = 0x01,
- Visible = 0x02
+ Visible = 0x02
};
//! Workstack splitting type
void distributeSpace( QSplitter* ) const;
int setPosition( QWidget* wid, QSplitter* split, const Qt::Orientation o,
- const int need_pos, const int splitter_pos );
+ const int need_pos, const int splitter_pos );
private:
QPointer<QWidget> myWin; //!< active widget
private:
//! Custom events
enum { ActivateWidget = QEvent::User, //!< activate widget event
- FocusWidget, //!< focus receiving widget event
+ FocusWidget, //!< focus receiving widget event
MakeCurrent,
RestoreWidget
};
insertAction( myWorkstack->action( QtxWorkstack::SplitVertical ), SplitVertical );
else
insertAction( new QtxAction( tr( "Split the active window on two vertical parts" ),
- tr( "Split vertically" ), 0, this ), SplitVertical );
+ tr( "Split vertically" ), 0, this ), SplitVertical );
if ( myWorkstack )
insertAction( myWorkstack->action( QtxWorkstack::SplitHorizontal ), SplitHorizontal );
else
insertAction( new QtxAction( tr( "Split the active window on two horizontal parts" ),
- tr( "Split horizontally" ), 0, this ), SplitHorizontal );
+ tr( "Split horizontally" ), 0, this ), SplitHorizontal );
connect( this, SIGNAL( triggered( int ) ), this, SLOT( onTriggered( int ) ) );
int aCursorType;
if ( anActItem && anActItem->isResizable(myPoint,aCursorType) )
{ // resize itself only active items if it is resizable
- anActItem->beforeResizing(aCursorType);
- myCurrentItem = *it;
- return;
+ anActItem->beforeResizing(aCursorType);
+ myCurrentItem = *it;
+ return;
}
else if ( anActItem && anActItem->isMoveable() )
{ // move itself only active items if it is moveable
- anActItem->beforeMoving();
- myCurrentItem = *it;
- return;
+ anActItem->beforeMoving();
+ myCurrentItem = *it;
+ return;
}
}
}
if ( myOperation == PANVIEW )
{ // Panning
scrollBy(myGlobalPoint.x() - aGlobalPoint.x(),
- myGlobalPoint.y() - aGlobalPoint.y());
+ myGlobalPoint.y() - aGlobalPoint.y());
myGlobalPoint = aGlobalPoint;
myMovingDone = true;
return;
if ( anActItem ) anActItem->setTMatrix(m);
(*it)->show();
}
-
+
myGlobalPoint = aGlobalPoint;
myMovingDone = true;
if ( myCurrentItem->x() && myCurrentItem->y() ) {
double cx = myCurrentItem->x() - myPoint.x();
double cy = myCurrentItem->y() - myPoint.y();
-
+
if (aPoint.x()+cx < 0) aPoint.setX(-(int)cx);
if (aPoint.y()+cy < 0) aPoint.setY(-(int)cy);
}
myCurrentItem->moveBy(aPoint.x() - myPoint.x(),
- aPoint.y() - myPoint.y());
+ aPoint.y() - myPoint.y());
myMovingDone = true;
myPoint = aPoint;
canvas()->update();
QxGraph_ActiveItem* anActItem = dynamic_cast<QxGraph_ActiveItem*>( *it );
if (!isHilightPerformed && anActItem) {
- // hilight
- anActItem->hilight(aPoint);
- if (anActItem != myHilightedItem) {
- if (myHilightedItem)
- myHilightedItem->hilight(aPoint, false);
- myHilightedItem = anActItem;
- }
- isHilightPerformed = true;
-
- // show tooltip
- QxGraph_ToolTip* aToolTip = new QxGraph_ToolTip(this);
- aToolTip->maybeTip(aPoint);
+ // hilight
+ anActItem->hilight(aPoint);
+ if (anActItem != myHilightedItem) {
+ if (myHilightedItem)
+ myHilightedItem->hilight(aPoint, false);
+ myHilightedItem = anActItem;
+ }
+ isHilightPerformed = true;
+
+ // show tooltip
+ QxGraph_ToolTip* aToolTip = new QxGraph_ToolTip(this);
+ aToolTip->maybeTip(aPoint);
}
int aCursorType;
if ( anActItem && anActItem->isResizable(aPoint,aCursorType) ) {
- // set resize cursor
- QCursor resizeCursor;
- switch (aCursorType)
- {
- case 1: //left
- case 3: //right
- resizeCursor = QCursor(Qt::SizeHorCursor);
- break;
- case 2: //top
- case 4: //bottom
- resizeCursor = QCursor(Qt::SizeVerCursor);
- break;
- case 5: //left-top
- case 7: //right-bottom
- resizeCursor = QCursor(Qt::SizeFDiagCursor);
- break;
- case 6: //right-top
- case 8: //left-bottom
- resizeCursor = QCursor(Qt::SizeBDiagCursor);
- break;
- default :
- resizeCursor = QCursor(Qt::ArrowCursor);
- break;
- }
- setCursor(resizeCursor);
- return;
+ // set resize cursor
+ QCursor resizeCursor;
+ switch (aCursorType)
+ {
+ case 1: //left
+ case 3: //right
+ resizeCursor = QCursor(Qt::SizeHorCursor);
+ break;
+ case 2: //top
+ case 4: //bottom
+ resizeCursor = QCursor(Qt::SizeVerCursor);
+ break;
+ case 5: //left-top
+ case 7: //right-bottom
+ resizeCursor = QCursor(Qt::SizeFDiagCursor);
+ break;
+ case 6: //right-top
+ case 8: //left-bottom
+ resizeCursor = QCursor(Qt::SizeBDiagCursor);
+ break;
+ default :
+ resizeCursor = QCursor(Qt::ArrowCursor);
+ break;
+ }
+ setCursor(resizeCursor);
+ return;
}
else {
- // reset old cursor
- setCursor(QCursor(Qt::ArrowCursor));
- return;
+ // reset old cursor
+ setCursor(QCursor(Qt::ArrowCursor));
+ return;
}
}
}
if ( cursor().shape() == Qt::SizeVerCursor || cursor().shape() == Qt::SizeHorCursor
- || cursor().shape() == Qt::SizeBDiagCursor || cursor().shape() == Qt::SizeFDiagCursor)
+ || cursor().shape() == Qt::SizeBDiagCursor || cursor().shape() == Qt::SizeFDiagCursor)
setCursor(QCursor(Qt::ArrowCursor));
}
}
QxGraph_ActiveItem* anActItem = dynamic_cast<QxGraph_ActiveItem*>( *it );
if (!isSelectionPerformed && anActItem)
{
- anActItem->select(aPoint);
- if (anActItem != mySelectedItem)
- {
- if (mySelectedItem && isSelectedItemInCanvas() &&
- !mySelectedItem->arePartsOfOtherItem(anActItem)) mySelectedItem->select(aPoint, false);
- mySelectedItem = anActItem;
-
- // unhilight hilighted item if selection was performed
- if (myHilightedItem) {
- myHilightedItem->hilight(aPoint, false);
- myHilightedItem = 0;
- }
- }
- isSelectionPerformed = true;
+ anActItem->select(aPoint);
+ if (anActItem != mySelectedItem)
+ {
+ if (mySelectedItem && isSelectedItemInCanvas() &&
+ !mySelectedItem->arePartsOfOtherItem(anActItem)) mySelectedItem->select(aPoint, false);
+ mySelectedItem = anActItem;
+
+ // unhilight hilighted item if selection was performed
+ if (myHilightedItem) {
+ myHilightedItem->hilight(aPoint, false);
+ myHilightedItem = 0;
+ }
+ }
+ isSelectionPerformed = true;
}
}
{
if ( mySelectedItem )
{
- if ( isSelectedItemInCanvas() ) mySelectedItem->select(aPoint, false);
- mySelectedItem = 0;
+ if ( isSelectedItemInCanvas() ) mySelectedItem->select(aPoint, false);
+ mySelectedItem = 0;
}
// Background popup
printf("Background popup\n");
QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
- theEvent->pos(), theEvent->globalPos(),
- theEvent->state() );
+ theEvent->pos(), theEvent->globalPos(),
+ theEvent->state() );
if ( getViewWindow() )
- getViewWindow()->contextPopupEvent(&aEvent); // => emit contextMenuRequested( &aEvent );
+ getViewWindow()->contextPopupEvent(&aEvent); // => emit contextMenuRequested( &aEvent );
}
else
{ // show context popup for the selected item
else
{
for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) {
- QxGraph_ActiveItem* anActItem = dynamic_cast<QxGraph_ActiveItem*>( *it );
- if (anActItem)
- {
- anActItem->select(aPoint);
- if (anActItem != mySelectedItem)
- {
- if (mySelectedItem && isSelectedItemInCanvas() &&
- !mySelectedItem->arePartsOfOtherItem(anActItem)) mySelectedItem->select(aPoint, false);
- mySelectedItem = anActItem;
- }
- break;
- }
+ QxGraph_ActiveItem* anActItem = dynamic_cast<QxGraph_ActiveItem*>( *it );
+ if (anActItem)
+ {
+ anActItem->select(aPoint);
+ if (anActItem != mySelectedItem)
+ {
+ if (mySelectedItem && isSelectedItemInCanvas() &&
+ !mySelectedItem->arePartsOfOtherItem(anActItem)) mySelectedItem->select(aPoint, false);
+ mySelectedItem = anActItem;
+ }
+ break;
+ }
}
}
}
QxGraph_ActiveItem* anActItem = dynamic_cast<QxGraph_ActiveItem*>( *it );
if (anActItem)
{
- QRect aRect;
- QString aText = anActItem->getToolTipText(theMousePos, aRect);
- int avX, avY;
- QWMatrix aWM = ((QCanvasView*)parentWidget())->worldMatrix();
- ((QCanvasView*)parentWidget())->contentsToViewport((int)(aRect.left()*aWM.m11()),
- (int)(aRect.top()*aWM.m22()),
- avX, avY);
- QRect aTipRect(avX, avY, (int)(aRect.width()*aWM.m11()), (int)(aRect.height()*aWM.m22()));
- if (!aText.isEmpty())
- tip(aTipRect, aText);
- return;
+ QRect aRect;
+ QString aText = anActItem->getToolTipText(theMousePos, aRect);
+ int avX, avY;
+ QWMatrix aWM = ((QCanvasView*)parentWidget())->worldMatrix();
+ ((QCanvasView*)parentWidget())->contentsToViewport((int)(aRect.left()*aWM.m11()),
+ (int)(aRect.top()*aWM.m22()),
+ avX, avY);
+ QRect aTipRect(avX, avY, (int)(aRect.width()*aWM.m11()), (int)(aRect.height()*aWM.m22()));
+ if (!aText.isEmpty())
+ tip(aTipRect, aText);
+ return;
}
}
}
public:
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, PANGLOBAL,
- WINDOWFIT, FITALLVIEW, RESETVIEW };
+ WINDOWFIT, FITALLVIEW, RESETVIEW };
QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWindow* theViewWindow);
virtual ~QxGraph_CanvasView();
QxGraph_Prs::~QxGraph_Prs()
{
for ( DMode2ItemList::iterator it1 = myDisplayMap.begin();
- it1 != myDisplayMap.end();
- it1++ )
+ it1 != myDisplayMap.end();
+ it1++ )
{
for ( std::list<QCanvasItem*>::iterator it2 = (*it1).second.begin();
- it2 != (*it1).second.end();
- it2++ )
+ it2 != (*it1).second.end();
+ it2++ )
{
QCanvasItem* anItem = *it2;
if ( anItem ) delete anItem;
update();
for ( std::list<QCanvasItem*>::iterator it = myDisplayMap[myDMode].begin();
- it != myDisplayMap[myDMode].end();
- it++ )
+ it != myDisplayMap[myDMode].end();
+ it++ )
{
QCanvasItem* anItem = *it;
if ( anItem )
void QxGraph_Prs::hide()
{
for ( DMode2ItemList::iterator it1 = myDisplayMap.begin();
- it1 != myDisplayMap.end();
- it1++ )
+ it1 != myDisplayMap.end();
+ it1++ )
{
for ( std::list<QCanvasItem*>::iterator it2 = (*it1).second.begin();
- it2 != (*it1).second.end();
- it2++ )
+ it2 != (*it1).second.end();
+ it2++ )
{
QCanvasItem* anItem = *it2;
if ( anItem )
{
- anItem->setCanvas( 0 );
+ anItem->setCanvas( 0 );
}
}
}
Constructor
*/
QxGraph_ViewManager::QxGraph_ViewManager( SUIT_Study* theStudy,
- SUIT_Desktop* theDesktop,
- SUIT_ViewModel* theViewModel )
+ SUIT_Desktop* theDesktop,
+ SUIT_ViewModel* theViewModel )
: SUIT_ViewManager( theStudy, theDesktop, theViewModel )
{
}
// FitAll
aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_FITALL" ) ),
- tr( "MNU_FITALL" ), 0, this);
+ tr( "MNU_FITALL" ), 0, this);
aAction->setStatusTip(tr("DSC_FITALL"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitAll()));
myActionsMap[ FitAllId ] = aAction;
// FitRect
aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_FITAREA" ) ),
- tr( "MNU_FITRECT" ), 0, this);
+ tr( "MNU_FITRECT" ), 0, this);
aAction->setStatusTip(tr("DSC_FITRECT"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitArea()));
myActionsMap[ FitRectId ] = aAction;
// Zoom
aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_ZOOM" ) ),
- tr( "MNU_ZOOM_VIEW" ), 0, this);
+ tr( "MNU_ZOOM_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewZoom()));
myActionsMap[ ZoomId ] = aAction;
// Panning
aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_PAN" ) ),
- tr( "MNU_PAN_VIEW" ), 0, this);
+ tr( "MNU_PAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_PAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan()));
myActionsMap[ PanId ] = aAction;
// Global Panning
aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_GLOBALPAN" ) ),
- tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
+ tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewGlobalPan()));
myActionsMap[ GlobalPanId ] = aAction;
// Reset
aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_RESET" ) ),
- tr( "MNU_RESET_VIEW" ), 0, this);
+ tr( "MNU_RESET_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_RESET_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset()));
myActionsMap[ ResetId ] = aAction;
Constructor
*/
QxScene_ViewManager::QxScene_ViewManager( SUIT_Study* theStudy,
- SUIT_Desktop* theDesktop,
- SUIT_ViewModel* theViewModel )
+ SUIT_Desktop* theDesktop,
+ SUIT_ViewModel* theViewModel )
: SUIT_ViewManager( theStudy, theDesktop, theViewModel )
{
DEBTRACE("QxScene_ViewManager::QxScene_ViewManager");
aAction = new QtxAction( tr( "MNU_FITALL" ),
aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_FITALL" ) ),
tr( "MNU_FITALL" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_FITALL" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewFitAll() ) );
mgr->registerAction( aAction, FitAllId );
aAction = new QtxAction( tr( "MNU_FITRECT" ),
aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_FITAREA" ) ),
tr( "MNU_FITRECT" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_FITRECT" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewFitArea() ) );
mgr->registerAction( aAction, FitRectId );
// 2.3. Zoom
aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ),
- aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_ZOOM" ) ),
+ aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_ZOOM" ) ),
tr( "MNU_ZOOM_VIEW" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewZoom() ) );
mgr->registerAction( aAction, ZoomId );
// 3.1. Panning
aAction = new QtxAction( tr( "MNU_PAN_VIEW" ),
- aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_PAN" ) ),
- tr( "MNU_PAN_VIEW" ),
- 0, this);
+ aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_PAN" ) ),
+ tr( "MNU_PAN_VIEW" ),
+ 0, this);
aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewPan() ) );
mgr->registerAction( aAction, PanId );
// 3.2. Global Panning
aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ),
- aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_GLOBALPAN" ) ),
+ aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_GLOBALPAN" ) ),
tr( "MNU_GLOBALPAN_VIEW" ),
- 0, this);
+ 0, this);
aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewGlobalPan() ) );
mgr->registerAction( aAction, GlobalPanId );
// reset
aAction = new QtxAction( tr( "MNU_RESET_VIEW" ),
- aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_RESET" ) ),
- tr( "MNU_RESET_VIEW" ),
- 0, this);
+ aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_RESET" ) ),
+ tr( "MNU_RESET_VIEW" ),
+ 0, this);
aAction->setStatusTip( tr( "DSC_RESET_VIEW" ) );
connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewReset() ) );
mgr->registerAction( aAction, ResetId );
for ( int i = 1; i < argc; i ++ ) {
QString anArg = QString( argv[i] ).trimmed();
if ( anArg.startsWith( "-" ) ) {
- anArg.remove( 0, 1 );
- if ( anArg.contains( ":" ) ) {
- QStringList vals = anArg.split( ":", QString::SkipEmptyParts );
- QString section = vals[ 0 ].trimmed();
- QString param = vals[ 1 ].trimmed();
- if ( section.isEmpty() || param.isEmpty() ) continue;
- resMgr->remove( section, param );
- }
+ anArg.remove( 0, 1 );
+ if ( anArg.contains( ":" ) ) {
+ QStringList vals = anArg.split( ":", QString::SkipEmptyParts );
+ QString section = vals[ 0 ].trimmed();
+ QString param = vals[ 1 ].trimmed();
+ if ( section.isEmpty() || param.isEmpty() ) continue;
+ resMgr->remove( section, param );
+ }
}
else if ( anArg.contains( "+=" ) ) {
- QStringList vals = anArg.split( "+=", QString::SkipEmptyParts );
- if ( vals[ 0 ].contains( ":" ) ) {
- QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts );
- QString section = vals1[ 0 ].trimmed();
- QString param = vals1[ 1 ].trimmed();
- QString newValue = vals [ 1 ].trimmed();
- QString separ = ","; // default separator
- if ( newValue.contains( "|" ) ) {
- QStringList vals2 = newValue.split( "|", QString::SkipEmptyParts );
- newValue = vals2[ 0 ].trimmed();
- separ = vals2[ 1 ].trimmed();
- }
- if ( section.isEmpty() || param.isEmpty() || newValue.isEmpty() || separ.isEmpty() ) continue;
- QString value = resMgr->stringValue( section, param );
- QStringList valsOld = value.split( separ, QString::SkipEmptyParts );
- QStringList valsNew = newValue.split( separ, QString::SkipEmptyParts );
- for ( int i = 0; i < (int)valsNew.count(); i++ )
- if ( !valsOld.contains( valsNew[i] ) )
- valsOld.append( valsNew[i] );
- resMgr->setValue( section, param, valsOld.join( separ ) );
- }
+ QStringList vals = anArg.split( "+=", QString::SkipEmptyParts );
+ if ( vals[ 0 ].contains( ":" ) ) {
+ QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts );
+ QString section = vals1[ 0 ].trimmed();
+ QString param = vals1[ 1 ].trimmed();
+ QString newValue = vals [ 1 ].trimmed();
+ QString separ = ","; // default separator
+ if ( newValue.contains( "|" ) ) {
+ QStringList vals2 = newValue.split( "|", QString::SkipEmptyParts );
+ newValue = vals2[ 0 ].trimmed();
+ separ = vals2[ 1 ].trimmed();
+ }
+ if ( section.isEmpty() || param.isEmpty() || newValue.isEmpty() || separ.isEmpty() ) continue;
+ QString value = resMgr->stringValue( section, param );
+ QStringList valsOld = value.split( separ, QString::SkipEmptyParts );
+ QStringList valsNew = newValue.split( separ, QString::SkipEmptyParts );
+ for ( int i = 0; i < (int)valsNew.count(); i++ )
+ if ( !valsOld.contains( valsNew[i] ) )
+ valsOld.append( valsNew[i] );
+ resMgr->setValue( section, param, valsOld.join( separ ) );
+ }
}
else if ( anArg.contains( "=" ) ) {
- QStringList vals = anArg.split( "=", QString::SkipEmptyParts );
- if ( vals[ 0 ].contains( ":" ) ) {
- QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts );
- QString section = vals1[ 0 ].trimmed();
- QString param = vals1[ 1 ].trimmed();
- QString value = vals [ 1 ].trimmed();
- if ( section.isEmpty() || param.isEmpty() ) continue;
- resMgr->setValue( section, param, value );
- }
+ QStringList vals = anArg.split( "=", QString::SkipEmptyParts );
+ if ( vals[ 0 ].contains( ":" ) ) {
+ QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts );
+ QString section = vals1[ 0 ].trimmed();
+ QString param = vals1[ 1 ].trimmed();
+ QString value = vals [ 1 ].trimmed();
+ if ( section.isEmpty() || param.isEmpty() ) continue;
+ resMgr->setValue( section, param, value );
+ }
}
}
resMgr->save();
// get active study
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() );
if ( aStudy ) {
- // find or create VTK view manager
- if ( toCreate == __Create ) {
- SVTK_ViewManager* aVM = dynamic_cast<SVTK_ViewManager*>( anApp->createViewManager( "VTKViewer" ) );
- if ( aVM ) {
- aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getActiveView() );
- if ( !aVW )
- aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->createViewWindow() );
- // VSR : When new view window is created it can be not active yet at this moment,
- // so the following is a some workaround
- if ( !aVW && !aVM->getViews().isEmpty() )
- aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getViews()[0] );
- }
- }
- else {
- SVTK_ViewManager* aVM = dynamic_cast<SVTK_ViewManager*>( anApp->getViewManager( "VTKViewer", toCreate == __FindOrCreate ) );
- if ( aVM ) {
- aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getActiveView() );
- // VSR : When new view window is created it can be not active yet at this moment,
- // so the following is a some workaround
- if ( !aVW && !aVM->getViews().isEmpty() )
- aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getViews()[0] );
- }
- }
+ // find or create VTK view manager
+ if ( toCreate == __Create ) {
+ SVTK_ViewManager* aVM = dynamic_cast<SVTK_ViewManager*>( anApp->createViewManager( "VTKViewer" ) );
+ if ( aVM ) {
+ aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getActiveView() );
+ if ( !aVW )
+ aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->createViewWindow() );
+ // VSR : When new view window is created it can be not active yet at this moment,
+ // so the following is a some workaround
+ if ( !aVW && !aVM->getViews().isEmpty() )
+ aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getViews()[0] );
+ }
+ }
+ else {
+ SVTK_ViewManager* aVM = dynamic_cast<SVTK_ViewManager*>( anApp->getViewManager( "VTKViewer", toCreate == __FindOrCreate ) );
+ if ( aVM ) {
+ aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getActiveView() );
+ // VSR : When new view window is created it can be not active yet at this moment,
+ // so the following is a some workaround
+ if ( !aVW && !aVM->getViews().isEmpty() )
+ aVW = dynamic_cast<SVTK_ViewWindow*>( aVM->getViews()[0] );
+ }
+ }
}
}
}
virtual void Execute()
{
if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) {
- if ( aVTKViewWindow->isTrihedronDisplayed() != myShow )
- aVTKViewWindow->onViewTrihedron();
+ if ( aVTKViewWindow->isTrihedronDisplayed() != myShow )
+ aVTKViewWindow->onViewTrihedron();
}
}
};
virtual void Execute()
{
if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) {
- aVTKViewWindow->onFitAll();
+ aVTKViewWindow->onFitAll();
}
}
};
virtual void Execute()
{
if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) {
- switch( myType ) {
- case ViewFront:
- aVTKViewWindow->onFrontView(); break;
- case ViewBack:
- aVTKViewWindow->onBackView(); break;
- case ViewTop:
- aVTKViewWindow->onTopView(); break;
- case ViewBottom:
- aVTKViewWindow->onBottomView(); break;
- case ViewRight:
- aVTKViewWindow->onRightView(); break;
- case ViewLeft:
- aVTKViewWindow->onLeftView(); break;
- default:
- PyErr_Format(PyExc_ValueError,"setView%: wrong parameter value; must be between %d and %d", ViewFront, ViewLeft );
- break;
- }
+ switch( myType ) {
+ case ViewFront:
+ aVTKViewWindow->onFrontView(); break;
+ case ViewBack:
+ aVTKViewWindow->onBackView(); break;
+ case ViewTop:
+ aVTKViewWindow->onTopView(); break;
+ case ViewBottom:
+ aVTKViewWindow->onBottomView(); break;
+ case ViewRight:
+ aVTKViewWindow->onRightView(); break;
+ case ViewLeft:
+ aVTKViewWindow->onLeftView(); break;
+ default:
+ PyErr_Format(PyExc_ValueError,"setView%: wrong parameter value; must be between %d and %d", ViewFront, ViewLeft );
+ break;
+ }
}
}
};
virtual void Execute()
{
if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) {
- aVTKViewWindow->onResetView();
+ aVTKViewWindow->onResetView();
}
}
};
{
public:
EngineIORReq( PyInterp_Interp* _py_interp,
- SALOME_PYQT_Module* _obj )
+ SALOME_PYQT_Module* _obj )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myObj( _obj ) {}
\param setting preference resource name
*/
void SALOME_PYQT_Module::preferenceChanged( const QString& module,
- const QString& section,
- const QString& setting )
+ const QString& section,
+ const QString& setting )
{
SALOME_PYQT_ModuleLight::preferenceChanged(module,section,setting);
}
public slots:
void preferenceChanged( const QString&,
- const QString&,
- const QString& );
+ const QString&,
+ const QString& );
void onGUIEvent();
void onActiveViewChanged( SUIT_ViewWindow* );
void onViewClosed( SUIT_ViewWindow* );
XmlHandler( SALOME_PYQT_ModuleLight* module, const QString& fileName );
void createActions();
void createPopup ( QMenu* menu,
- const QString& context,
- const QString& parent,
- const QString& object );
+ const QString& context,
+ const QString& parent,
+ const QString& object );
void activateMenus( bool );
protected:
void createToolBar ( QDomNode& parentNode );
void createMenu ( QDomNode& parentNode,
- const int parentMenuId = -1,
- QMenu* parentPopup = 0 );
+ const int parentMenuId = -1,
+ QMenu* parentPopup = 0 );
void insertPopupItems( QDomNode& parentNode,
- QMenu* menu );
+ QMenu* menu );
private:
SALOME_PYQT_ModuleLight* myModule;
{
public:
InitializeReq( CAM_Application* _app,
- SALOME_PYQT_ModuleLight* _obj )
+ SALOME_PYQT_ModuleLight* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myApp( _app ),
myObj( _obj ) {}
{
public:
ActivateReq( SUIT_Study* _study,
- SALOME_PYQT_ModuleLight* _obj )
+ SALOME_PYQT_ModuleLight* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
// connect preferences changing signal
connect( getApp(), SIGNAL( preferenceChanged( const QString&, const QString&, const QString& ) ),
- this, SLOT( preferenceChanged( const QString&, const QString&, const QString& ) ) );
+ this, SLOT( preferenceChanged( const QString&, const QString&, const QString& ) ) );
// perform custom activation actions
// CustomizeReq: request class for internal customize() operation
{
public:
CustomizeReq( SUIT_Study* _study,
- SALOME_PYQT_ModuleLight* _obj )
+ SALOME_PYQT_ModuleLight* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
// disconnect preferences changing signal
disconnect( getApp(), SIGNAL( preferenceChanged( const QString&, const QString&, const QString& ) ),
- this, SLOT( preferenceChanged( const QString&, const QString&, const QString& ) ) );
+ this, SLOT( preferenceChanged( const QString&, const QString&, const QString& ) ) );
// perform internal deactivation
// DeactivateReq: request class for internal deactivate() operation
{
public:
DeactivateReq( PyInterp_Interp* _py_interp,
- SUIT_Study* _study,
- SALOME_PYQT_ModuleLight* _obj )
+ SUIT_Study* _study,
+ SALOME_PYQT_ModuleLight* _obj )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
\param setting preference resource name
*/
void SALOME_PYQT_ModuleLight::preferenceChanged( const QString& module,
- const QString& section,
- const QString& setting )
+ const QString& section,
+ const QString& setting )
{
FuncMsg fmsg( "SALOME_PYQT_ModuleLight::preferenceChanged()" );
{
public:
Event( PyInterp_Interp* _py_interp,
- SALOME_PYQT_ModuleLight* _obj,
- const QString& _section,
- const QString& _setting )
+ SALOME_PYQT_ModuleLight* _obj,
+ const QString& _section,
+ const QString& _setting )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myObj ( _obj ),
mySection( _section ),
{
public:
StudyChangedReq( SUIT_Study* _study,
- SALOME_PYQT_ModuleLight* _obj )
+ SALOME_PYQT_ModuleLight* _obj )
: PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true)
myStudy ( _study ),
myObj ( _obj ) {}
{
public:
GUIEvent( PyInterp_Interp* _py_interp,
- SALOME_PYQT_ModuleLight* _obj,
- int _id )
+ SALOME_PYQT_ModuleLight* _obj,
+ int _id )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myId ( _id ),
myObj ( _obj ) {}
\param title popup menu title (not used)
*/
void SALOME_PYQT_ModuleLight::contextMenuPopup( const QString& theContext,
- QMenu* thePopupMenu,
- QString& /*title*/ )
+ QMenu* thePopupMenu,
+ QString& /*title*/ )
{
FuncMsg fmsg( "SALOME_PYQT_ModuleLight::contextMenuPopup()" );
fmsg.message( QString( "context: %1" ).arg( theContext ) );
{
public:
PopupMenuEvent( PyInterp_Interp* _py_interp,
- SALOME_PYQT_ModuleLight* _obj,
- const QString& _context,
- QMenu* _popup )
+ SALOME_PYQT_ModuleLight* _obj,
+ const QString& _context,
+ QMenu* _popup )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myContext( _context ),
myPopup ( _popup ),
{
public:
Event( PyInterp_Interp* _py_interp,
- SALOME_PYQT_ModuleLight* _obj )
+ SALOME_PYQT_ModuleLight* _obj )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myObj ( _obj ) {}
{
public:
Event( PyInterp_Interp* _py_interp,
- SALOME_PYQT_ModuleLight* _obj,
- const QString& _section,
- const QString& _setting )
+ SALOME_PYQT_ModuleLight* _obj,
+ const QString& _section,
+ const QString& _setting )
: PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true)
myObj ( _obj ),
mySection( _section ),
PyObject* value;
Py_ssize_t pos = 0;
while ( PyDict_Next( res1, &pos, &key, &value ) ) {
- // parse the return value
- // it should be a map: {integer:integer}
- int aKey, aValue;
- if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) {
- aKey = PyInt_AsLong( key );
- aValue = PyInt_AsLong( value );
- myWindowsMap[ aKey ] = aValue;
- }
+ // parse the return value
+ // it should be a map: {integer:integer}
+ int aKey, aValue;
+ if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) {
+ aKey = PyInt_AsLong( key );
+ aValue = PyInt_AsLong( value );
+ myWindowsMap[ aKey ] = aValue;
+ }
}
}
}
else if ( PyList_Check( res2 ) ) {
int size = PyList_Size( res2 );
for ( int i = 0; i < size; i++ ) {
- PyObject* value = PyList_GetItem( res2, i );
- if( value && PyString_Check( value ) ) {
- myViewMgrList.append( PyString_AsString( value ) );
- }
+ PyObject* value = PyList_GetItem( res2, i );
+ if( value && PyString_Check( value ) ) {
+ myViewMgrList.append( PyString_AsString( value ) );
+ }
}
}
}
if ( aDesk )
{
connect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
- this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) );
+ this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) );
// If a active window exists send activeViewChanged
// If a getActiveView() in SalomePyQt available we no longer need this
SUIT_ViewWindow* aView = aDesk->activeWindow();
// call definePopup() Python module's function
// this is obsolete function, used only for compatibility reasons
PyObjWrapper res( PyObject_CallMethod( myModule,
- (char*)"definePopup",
- (char*)"sss",
- theContext.toLatin1().constData(),
- aObject.toLatin1().constData(),
- aParent.toLatin1().constData() ) );
+ (char*)"definePopup",
+ (char*)"sss",
+ theContext.toLatin1().constData(),
+ aObject.toLatin1().constData(),
+ aParent.toLatin1().constData() ) );
if( !res ) {
PyErr_Print();
}
char *co, *ob, *pa;
if( PyArg_ParseTuple( res, "sss", &co, &ob, &pa ) ) {
aContext = co;
- aObject = ob;
- aParent = pa;
+ aObject = ob;
+ aParent = pa;
}
}
} // if ( IsCallOldMethods ... )
// then call Python module's createPopupMenu() method (for new modules)
if ( PyObject_HasAttrString( myModule, "createPopupMenu" ) ) {
PyObjWrapper res1( PyObject_CallMethod( myModule,
- (char*)"createPopupMenu",
- (char*)"Os",
- sipPopup.get(),
- theContext.toLatin1().constData() ) );
+ (char*)"createPopupMenu",
+ (char*)"Os",
+ sipPopup.get(),
+ theContext.toLatin1().constData() ) );
if( !res1 ) {
PyErr_Print();
}
// call customPopup() Python module's function
// this is obsolete function, used only for compatibility reasons
PyObjWrapper res2( PyObject_CallMethod( myModule,
- (char*)"customPopup",
- (char*)"Osss",
- sipPopup.get(),
- aContext.toLatin1().constData(),
- aObject.toLatin1().constData(),
- aParent.toLatin1().constData() ) );
+ (char*)"customPopup",
+ (char*)"Osss",
+ sipPopup.get(),
+ aContext.toLatin1().constData(),
+ aObject.toLatin1().constData(),
+ aParent.toLatin1().constData() ) );
if( !res2 ) {
PyErr_Print();
}
if ( PyObject_HasAttrString( myModule, "preferenceChanged" ) ) {
PyObjWrapper res( PyObject_CallMethod( myModule,
- (char*)"preferenceChanged",
- (char*)"ss",
- section.toLatin1().constData(),
- setting.toLatin1().constData() ) );
+ (char*)"preferenceChanged",
+ (char*)"ss",
+ section.toLatin1().constData(),
+ setting.toLatin1().constData() ) );
if( !res ) {
PyErr_Print();
}
\return created action
*/
QAction* SALOME_PYQT_ModuleLight::createAction( const int id, const QString& text, const QString& icon,
- const QString& menu, const QString& tip, const int key,
- const bool toggle, QObject* parent )
+ const QString& menu, const QString& tip, const int key,
+ const bool toggle, QObject* parent )
{
QIcon anIcon = loadIcon( icon );
QAction* a = action( id );
}
else {
a = LightApp_Module::createAction( id,
- text,
- anIcon,
- menu,
- tip,
- key,
- parent ? parent : this,
- toggle,
- this,
- SLOT( onGUIEvent() ) );
+ text,
+ anIcon,
+ menu,
+ tip,
+ key,
+ parent ? parent : this,
+ toggle,
+ this,
+ SLOT( onGUIEvent() ) );
}
return a;
}
{
return LightApp_Module::addPreference( label );
}
-
+
/*!
\brief Add preference.
\param label preference name
\return preference ID
*/
int SALOME_PYQT_ModuleLight::addPreference( const QString& label,
- const int pId, const int type,
- const QString& section,
- const QString& param )
+ const int pId, const int type,
+ const QString& section,
+ const QString& param )
{
return LightApp_Module::addPreference( label, pId, type, section, param );
}
\return property value (invalid QVariant() if property is not found)
*/
QVariant SALOME_PYQT_ModuleLight::preferenceProperty( const int id,
- const QString& prop ) const
+ const QString& prop ) const
{
QVariant v = LightApp_Module::preferenceProperty( id, prop );
return v;
\param var property value
*/
void SALOME_PYQT_ModuleLight::setPreferenceProperty( const int id,
- const QString& prop,
- const QVariant& var )
+ const QString& prop,
+ const QVariant& var )
{
LightApp_Module::setPreferenceProperty( id, prop, var );
}
\param fileName XML file path
*/
SALOME_PYQT_ModuleLight::XmlHandler::XmlHandler( SALOME_PYQT_ModuleLight* module,
- const QString& fileName )
+ const QString& fileName )
: myModule( module )
{
if ( fileName.isEmpty() )
\param context popup menu object name
*/
void SALOME_PYQT_ModuleLight::XmlHandler::createPopup( QMenu* menu,
- const QString& context,
- const QString& parent,
- const QString& object )
+ const QString& context,
+ const QString& parent,
+ const QString& object )
{
// get document element
QDomElement aDocElem = myDoc.documentElement();
QString prt = attribute( e, "parent-id" );
QString obj = attribute( e, "object-id" );
if ( ctx == context && prt == parent && obj == object ) {
- insertPopupItems( n, menu );
- break;
+ insertPopupItems( n, menu );
+ break;
}
}
}
\param parentPopup parent popup menu (0 for top-level menu)
*/
void SALOME_PYQT_ModuleLight::XmlHandler::createMenu( QDomNode& parentNode,
- const int parentMenuId,
- QMenu* parentPopup )
+ const int parentMenuId,
+ QMenu* parentPopup )
{
if ( !myModule || parentNode.isNull() )
return;
int pid = checkInt( attribute( parentElement, "item-id" ) );
int ppos = checkInt( attribute( parentElement, "pos-id" ) );
int group = checkInt( attribute( parentElement, "group-id" ),
- myModule->defaultMenuGroup() );
+ myModule->defaultMenuGroup() );
if ( !plabel.isEmpty() ) {
QMenu* popup = 0;
int menuId = -1;
// create menu
menuId = myModule->createMenu( plabel, // label
- parentMenuId, // parent menu ID, -1 for top-level menu
- pid, // ID
- group, // group ID
- ppos ); // position
+ parentMenuId, // parent menu ID, -1 for top-level menu
+ pid, // ID
+ group, // group ID
+ ppos ); // position
myMenuItems.append( menuId );
QDomNode node = parentNode.firstChild();
while ( !node.isNull() ) {
- if ( node.isElement() ) {
- QDomElement elem = node.toElement();
- QString aTagName = tagName( elem );
- if ( aTagName == "popup-item" ) {
- int id = checkInt( attribute( elem, "item-id" ) );
- int pos = checkInt( attribute( elem, "pos-id" ) );
- int group = checkInt( attribute( elem, "group-id" ),
- myModule->defaultMenuGroup() );
- QString label = attribute( elem, "label-id" );
- QString icon = attribute( elem, "icon-id" );
- QString tooltip = attribute( elem, "tooltip-id" );
- QString accel = attribute( elem, "accel-id" );
- bool toggle = checkBool( attribute( elem, "toggle-id" ) );
-
- // -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
- // also check if the action with given ID is already created
- if ( id != -1 ) {
- // create menu action
- QAction* action = myModule->createAction( id, // ID
- tooltip, // tooltip
- icon, // icon
- label, // menu text
- tooltip, // status-bar text
- QKeySequence( accel ), // keyboard accelerator
- toggle ); // toogled action
- myModule->createMenu( action, // action
- menuId, // parent menu ID
- id, // ID (same as for createAction())
- group, // group ID
- pos ); // position
- }
- }
- else if ( aTagName == "submenu" ) {
- // create sub-menu
- createMenu( node, menuId, popup );
- }
- else if ( aTagName == "separator" ) {
- // create menu separator
- int id = checkInt( attribute( elem, "item-id" ) ); // separator can have ID
- int pos = checkInt( attribute( elem, "pos-id" ) );
- int group = checkInt( attribute( elem, "group-id" ),
- myModule->defaultMenuGroup() );
- QAction* action = myModule->separator();
- myModule->createMenu( action, // separator action
- menuId, // parent menu ID
- id, // ID
- group, // group ID
- pos ); // position
- }
- }
- node = node.nextSibling();
+ if ( node.isElement() ) {
+ QDomElement elem = node.toElement();
+ QString aTagName = tagName( elem );
+ if ( aTagName == "popup-item" ) {
+ int id = checkInt( attribute( elem, "item-id" ) );
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ int group = checkInt( attribute( elem, "group-id" ),
+ myModule->defaultMenuGroup() );
+ QString label = attribute( elem, "label-id" );
+ QString icon = attribute( elem, "icon-id" );
+ QString tooltip = attribute( elem, "tooltip-id" );
+ QString accel = attribute( elem, "accel-id" );
+ bool toggle = checkBool( attribute( elem, "toggle-id" ) );
+
+ // -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
+ // also check if the action with given ID is already created
+ if ( id != -1 ) {
+ // create menu action
+ QAction* action = myModule->createAction( id, // ID
+ tooltip, // tooltip
+ icon, // icon
+ label, // menu text
+ tooltip, // status-bar text
+ QKeySequence( accel ), // keyboard accelerator
+ toggle ); // toogled action
+ myModule->createMenu( action, // action
+ menuId, // parent menu ID
+ id, // ID (same as for createAction())
+ group, // group ID
+ pos ); // position
+ }
+ }
+ else if ( aTagName == "submenu" ) {
+ // create sub-menu
+ createMenu( node, menuId, popup );
+ }
+ else if ( aTagName == "separator" ) {
+ // create menu separator
+ int id = checkInt( attribute( elem, "item-id" ) ); // separator can have ID
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ int group = checkInt( attribute( elem, "group-id" ),
+ myModule->defaultMenuGroup() );
+ QAction* action = myModule->separator();
+ myModule->createMenu( action, // separator action
+ menuId, // parent menu ID
+ id, // ID
+ group, // group ID
+ pos ); // position
+ }
+ }
+ node = node.nextSibling();
}
}
}
int tbId = myModule->createTool( aLabel );
QDomNode node = parentNode.firstChild();
while ( !node.isNull() ) {
- if ( node.isElement() ) {
- QDomElement elem = node.toElement();
- QString aTagName = tagName( elem );
- if ( aTagName == "toolbutton-item" ) {
- int id = checkInt( attribute( elem, "item-id" ) );
- int pos = checkInt( attribute( elem, "pos-id" ) );
- QString label = attribute( elem, "label-id" );
- QString icon = attribute( elem, "icon-id" );
- QString tooltip = attribute( elem, "tooltip-id" );
- QString accel = attribute( elem, "accel-id" );
- bool toggle = checkBool( attribute( elem, "toggle-id" ) );
-
- // -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
- // also check if the action with given ID is already created
+ if ( node.isElement() ) {
+ QDomElement elem = node.toElement();
+ QString aTagName = tagName( elem );
+ if ( aTagName == "toolbutton-item" ) {
+ int id = checkInt( attribute( elem, "item-id" ) );
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ QString label = attribute( elem, "label-id" );
+ QString icon = attribute( elem, "icon-id" );
+ QString tooltip = attribute( elem, "tooltip-id" );
+ QString accel = attribute( elem, "accel-id" );
+ bool toggle = checkBool( attribute( elem, "toggle-id" ) );
+
+ // -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
+ // also check if the action with given ID is already created
if ( id != -1 ) {
- // create toolbar action
- QAction* action = myModule->createAction( id, // ID
- tooltip, // tooltip
- icon, // icon
- label, // menu text
- tooltip, // status-bar text
- QKeySequence( accel ), // keyboard accelerator
- toggle ); // toogled action
- myModule->createTool( action, tbId, -1, pos );
- }
- }
- else if ( aTagName == "separatorTB" || aTagName == "separator" ) {
- // create toolbar separator
- int pos = checkInt( attribute( elem, "pos-id" ) );
- QAction* action = myModule->separator();
- myModule->createTool( action, tbId, -1, pos );
- }
- }
- node = node.nextSibling();
+ // create toolbar action
+ QAction* action = myModule->createAction( id, // ID
+ tooltip, // tooltip
+ icon, // icon
+ label, // menu text
+ tooltip, // status-bar text
+ QKeySequence( accel ), // keyboard accelerator
+ toggle ); // toogled action
+ myModule->createTool( action, tbId, -1, pos );
+ }
+ }
+ else if ( aTagName == "separatorTB" || aTagName == "separator" ) {
+ // create toolbar separator
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ QAction* action = myModule->separator();
+ myModule->createTool( action, tbId, -1, pos );
+ }
+ }
+ node = node.nextSibling();
}
}
}
QString aTagName = tagName( elem );
QList<QAction*> actions = menu->actions();
if ( aTagName == "popup-item" ) {
- // insert a command item
- int id = checkInt( attribute( elem, "item-id" ) );
- int pos = checkInt( attribute( elem, "pos-id" ) );
- QString label = attribute( elem, "label-id" );
- QString icon = attribute( elem, "icon-id" );
- QString tooltip = attribute( elem, "tooltip-id" );
- QString accel = attribute( elem, "accel-id" );
- bool toggle = checkBool( attribute( elem, "toggle-id" ) );
-
- // -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
- // also check if the action with given ID is already created
- if ( id != -1 ) {
- QAction* action = myModule->createAction( id, // ID
- tooltip, // tooltip
- icon, // icon
- label, // menu text
- tooltip, // status-bar text
- QKeySequence( accel ), // keyboard accelerator
- toggle ); // toogled action
- QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0;
- menu->insertAction( before, action );
- }
+ // insert a command item
+ int id = checkInt( attribute( elem, "item-id" ) );
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ QString label = attribute( elem, "label-id" );
+ QString icon = attribute( elem, "icon-id" );
+ QString tooltip = attribute( elem, "tooltip-id" );
+ QString accel = attribute( elem, "accel-id" );
+ bool toggle = checkBool( attribute( elem, "toggle-id" ) );
+
+ // -1 action ID is not allowed : it means that <item-id> attribute is missed in the XML file!
+ // also check if the action with given ID is already created
+ if ( id != -1 ) {
+ QAction* action = myModule->createAction( id, // ID
+ tooltip, // tooltip
+ icon, // icon
+ label, // menu text
+ tooltip, // status-bar text
+ QKeySequence( accel ), // keyboard accelerator
+ toggle ); // toogled action
+ QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0;
+ menu->insertAction( before, action );
+ }
}
else if ( aTagName == "submenu" ) {
- // create sub-menu
- ////int id = checkInt( attribute( elem, "item-id" ) ); // not used //
- int pos = checkInt( attribute( elem, "pos-id" ) );
- QString label = attribute( elem, "label-id" );
- QString icon = attribute( elem, "icon-id" );
-
- QIcon anIcon;
- if ( !icon.isEmpty() ) {
- QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(), icon );
- if ( !pixmap.isNull() )
- anIcon = QIcon( pixmap );
+ // create sub-menu
+ ////int id = checkInt( attribute( elem, "item-id" ) ); // not used //
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ QString label = attribute( elem, "label-id" );
+ QString icon = attribute( elem, "icon-id" );
+
+ QIcon anIcon;
+ if ( !icon.isEmpty() ) {
+ QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(), icon );
+ if ( !pixmap.isNull() )
+ anIcon = QIcon( pixmap );
}
- QMenu* newPopup = menu->addMenu( anIcon, label );
- QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0;
- menu->insertMenu( before, newPopup );
- insertPopupItems( node, newPopup );
+ QMenu* newPopup = menu->addMenu( anIcon, label );
+ QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0;
+ menu->insertMenu( before, newPopup );
+ insertPopupItems( node, newPopup );
}
else if ( aTagName == "separator" ) {
- // create menu separator
- int pos = checkInt( attribute( elem, "pos-id" ) );
- QAction* action = myModule->separator();
- QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0;
- menu->insertAction( before, action );
+ // create menu separator
+ int pos = checkInt( attribute( elem, "pos-id" ) );
+ QAction* action = myModule->separator();
+ QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0;
+ menu->insertAction( before, action );
}
}
node = node.nextSibling();
if ( PyObject_HasAttrString(myModule, "saveFiles") ) {
PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"saveFiles",
- (char*)"s", (*it).toLatin1().constData()));
+ (char*)"s", (*it).toLatin1().constData()));
if( !res ) {
PyErr_Print();
}
else if ( PyList_Check( res ) ) {
int size = PyList_Size( res );
for ( int i = 0; i < size; i++ ) {
- PyObject* value = PyList_GetItem( res, i );
- if( value && PyString_Check( value ) ) {
- theListOfFiles.append( PyString_AsString( value ) );
- }
+ PyObject* value = PyList_GetItem( res, i );
+ if( value && PyString_Check( value ) ) {
+ theListOfFiles.append( PyString_AsString( value ) );
+ }
}
}
}
#endif
if ( PyObject_HasAttrString(myModule , "openFiles") ) {
PyObjWrapper res( PyObject_CallMethod( myModule, (char*)"openFiles",
- (char*)"O", sipList.get()));
+ (char*)"O", sipList.get()));
if( !res || !PyBool_Check( res )) {
PyErr_Print();
opened = false;
int createTool( const int, const int, const int = -1 );
int createTool( const int, const QString&, const int = -1 );
int createTool( QAction*, const int,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
int createTool( QAction*, const QString&,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
int createMenu( const QString&, const int,
- const int = -1, const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
int createMenu( const QString&, const QString&,
- const int = -1, const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
int createMenu( const int, const int,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
int createMenu( const int, const QString&,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
int createMenu( QAction*, const int,
- const int = -1, const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
int createMenu( QAction*, const QString&,
- const int = -1, const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
QAction* separator();
QAction* action( const int ) const;
int actionId( const QAction* ) const;
QAction* createAction( const int, const QString&, const QString&,
- const QString&, const QString&, const int,
- const bool = false, QObject* = 0 );
+ const QString&, const QString&, const int,
+ const bool = false, QObject* = 0 );
QtxActionGroup* createActionGroup( const int, const bool );
int addGlobalPreference( const QString& );
int addPreference( const QString& );
int addPreference( const QString&, const int, const int = LightApp_Preferences::Auto,
- const QString& = QString(),
- const QString& = QString() );
+ const QString& = QString(),
+ const QString& = QString() );
QVariant preferenceProperty( const int, const QString& ) const;
void setPreferenceProperty( const int, const QString&,
- const QVariant& );
+ const QVariant& );
void save(QStringList& theListOfFiles);
/*create new SALOME_PYQT_DataObjectLight and return its entry*/
QString createObject(const QString& parent);
QString createObject(const QString& name,
- const QString& iconname,
- const QString& tooltip,
- const QString& parent);
+ const QString& iconname,
+ const QString& tooltip,
+ const QString& parent);
/*Sets Name, Icon and Tool Tip for object*/
void setName(const QString& obj,const QString& iconname);
void setIcon(const QString& obj,const QString& name);
virtual bool activateModule( SUIT_Study* );
virtual bool deactivateModule( SUIT_Study* );
void preferenceChanged( const QString&,
- const QString&,
- const QString& );
+ const QString&,
+ const QString& );
void onGUIEvent();
void onActiveViewChanged( SUIT_ViewWindow* );
if ( SUIT_Session::session() ) {
if ( getActiveStudy() && myStudyId <= 0 )
myStudyId = getActiveStudy()->id();
- if ( myStudyId > 0 ) {
+ if ( myStudyId > 0 ) {
QList<SUIT_Application*> apps = SUIT_Session::session()->applications();
QList<SUIT_Application*>::Iterator it;
- for( it = apps.begin(); it != apps.end(); ++it ) {
+ for( it = apps.begin(); it != apps.end(); ++it ) {
LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( *it );
if ( anApp && anApp->activeStudy() && anApp->activeStudy()->id() == myStudyId ) {
- anApp->updateObjectBrowser();
- return;
- }
+ anApp->updateObjectBrowser();
+ return;
+ }
}
}
}
virtual void Execute() {
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QStringList sl = myName.split( ":", QString::SkipEmptyParts );
- QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
- QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
- if ( !_sec.isEmpty() && !_nam.isEmpty() )
+ QStringList sl = myName.split( ":", QString::SkipEmptyParts );
+ QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
+ QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
+ if ( !_sec.isEmpty() && !_nam.isEmpty() )
resMgr->setValue( _sec, _nam, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QStringList sl = myName.split( ":", QString::SkipEmptyParts );
- QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
- QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
- if ( !_sec.isEmpty() && !_nam.isEmpty() )
+ QStringList sl = myName.split( ":", QString::SkipEmptyParts );
+ QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
+ QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
+ if ( !_sec.isEmpty() && !_nam.isEmpty() )
resMgr->setValue( _sec, _nam, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QStringList sl = myName.split( ":", QString::SkipEmptyParts );
- QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
- QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
- if ( !_sec.isEmpty() && !_nam.isEmpty() )
+ QStringList sl = myName.split( ":", QString::SkipEmptyParts );
+ QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
+ QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
+ if ( !_sec.isEmpty() && !_nam.isEmpty() )
resMgr->setValue( _sec, _nam, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QStringList sl = myName.split( ":", QString::SkipEmptyParts );
- QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
- QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
- if ( !_sec.isEmpty() && !_nam.isEmpty() )
+ QStringList sl = myName.split( ":", QString::SkipEmptyParts );
+ QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
+ QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
+ if ( !_sec.isEmpty() && !_nam.isEmpty() )
resMgr->setValue( _sec, _nam, myValue );
}
}
virtual void Execute() {
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QStringList sl = myName.split( ":", QString::SkipEmptyParts );
- QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
- QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
- if ( !_sec.isEmpty() && !_nam.isEmpty() )
+ QStringList sl = myName.split( ":", QString::SkipEmptyParts );
+ QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION );
+ QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" );
+ if ( !_sec.isEmpty() && !_nam.isEmpty() )
resMgr->remove( _sec, _nam );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( !mySection.isEmpty() && !myName.isEmpty() )
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
resMgr->setValue( mySection, myName, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( !mySection.isEmpty() && !myName.isEmpty() )
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
resMgr->setValue( mySection, myName, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( !mySection.isEmpty() && !myName.isEmpty() )
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
resMgr->setValue( mySection, myName, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( !mySection.isEmpty() && !myName.isEmpty() )
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
resMgr->setValue( mySection, myName, myValue );
}
}
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( !mySection.isEmpty() && !myName.isEmpty() )
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
resMgr->setValue( mySection, myName, myValue );
}
}
/*!
\fn int SalomePyQt::integerSetting( const QString& section,
const QString& name,
- const int def );
+ const int def );
\brief Get integer setting from the application preferences.
\param section resources file section name
\param name setting name
/*!
\fn double SalomePyQt::doubleSetting( const QString& section,
const QString& name,
- const double def );
+ const double def );
\brief Get double setting from the application preferences.
\param section resources file section name
\param name setting name
/*!
\fn bool SalomePyQt::boolSetting( const QString& section,
const QString& name,
- const bool def );
+ const bool def );
\brief Get boolean setting from the application preferences.
\param section resources file section name
\param name setting name
/*!
\fn QString SalomePyQt::stringSetting( const QString& section,
const QString& name,
- const QString& def );
+ const QString& def );
\brief Get string setting from the application preferences.
\param section resources file section name
\param name setting name
/*!
\fn QColor SalomePyQt::colorSetting( const QString& section,
const QString& name,
- const QColor def );
+ const QColor def );
\brief Get color setting from the application preferences.
\param section resources file section name
\param name setting name
{
if ( SUIT_Session::session() ) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( !mySection.isEmpty() && !myName.isEmpty() )
+ if ( !mySection.isEmpty() && !myName.isEmpty() )
resMgr->remove( mySection, myName );
}
}
/*!
\fn QString SalomePyQt::getFileName( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open );
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption,
+ bool open );
\brief Show 'Open/Save file' dialog box for file selection
and return a user's choice (selected file name).
\param parent parent widget
QString myCaption;
bool myOpen;
TGetFileNameEvent( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open )
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption,
+ bool open )
: myParent ( parent ),
myInitial( initial ),
myFilters( filters ),
{
if ( LightApp_Application* anApp = getApplication() ) {
myResult = anApp->getFileName( myOpen, myInitial, myFilters.join(";;"),
- myCaption, myParent );
+ myCaption, myParent );
}
}
};
QString SalomePyQt::getFileName( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption,
- bool open )
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption,
+ bool open )
{
return ProcessEvent( new TGetFileNameEvent( parent, initial, filters, caption, open ) );
}
/*!
\fn QStringList SalomePyQt::getOpenFileNames( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption );
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption );
\brief Show 'Open files' dialog box for multiple files selection
and return a user's choice (selected file names list).
\param parent parent widget
QStringList myFilters;
QString myCaption;
TGetOpenFileNamesEvent( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption )
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption )
: myParent ( parent ),
myInitial( initial ),
myFilters( filters ),
}
};
QStringList SalomePyQt::getOpenFileNames( QWidget* parent,
- const QString& initial,
- const QStringList& filters,
- const QString& caption )
+ const QString& initial,
+ const QStringList& filters,
+ const QString& caption )
{
return ProcessEvent( new TGetOpenFileNamesEvent( parent, initial, filters, caption ) );
}
/*!
\fn QString SalomePyQt::getExistingDirectory( QWidget* parent,
- const QString& initial,
- const QString& caption );
+ const QString& initial,
+ const QString& caption );
\brief Show 'Get Directory' dialog box for the directory selection
and return a user's choice (selected directory name).
\param parent parent widget
QString myInitial;
QString myCaption;
TGetExistingDirectoryEvent( QWidget* parent,
- const QString& initial,
- const QString& caption )
+ const QString& initial,
+ const QString& caption )
: myParent ( parent ),
myInitial( initial ),
myCaption( caption ) {}
}
};
QString SalomePyQt::getExistingDirectory( QWidget* parent,
- const QString& initial,
- const QString& caption )
+ const QString& initial,
+ const QString& caption )
{
return ProcessEvent( new TGetExistingDirectoryEvent( parent, initial, caption ) );
}
{
if ( LightApp_Application* anApp = getApplication() ) {
if ( !myFileName.isEmpty() ) {
- QPixmap pixmap = anApp->resourceMgr()->loadPixmap( myModule,
+ QPixmap pixmap = anApp->resourceMgr()->loadPixmap( myModule,
QApplication::translate( myModule.toLatin1().data(),
- myFileName.toLatin1().data() ) );
- if ( !pixmap.isNull() )
- myResult = QIcon( pixmap );
+ myFileName.toLatin1().data() ) );
+ if ( !pixmap.isNull() )
+ myResult = QIcon( pixmap );
}
}
}
SUIT_ViewManager* vm = anApp->activeViewManager();
if ( vm ) {
SUIT_ViewWindow* vw = vm->getActiveView();
- if ( vw ) {
+ if ( vw ) {
QImage im = vw->dumpView();
- if ( !im.isNull() && !myFileName.isEmpty() ) {
+ if ( !im.isNull() && !myFileName.isEmpty() ) {
QString fmt = SUIT_Tools::extension( myFileName ).toUpper();
- if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format
- if ( fmt == "JPG" ) fmt = "JPEG";
- myResult = im.save( myFileName, fmt.toLatin1() );
+ if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format
+ if ( fmt == "JPG" ) fmt = "JPEG";
+ myResult = im.save( myFileName, fmt.toLatin1() );
}
- }
+ }
}
}
}
/*!
\fn QAction* SalomePyQt::createAction( const int id,
const QString& menuText,
- const QString& tipText,
- const QString& statusText,
- const QString& icon,
- const int key,
- const bool toggle )
+ const QString& tipText,
+ const QString& statusText,
+ const QString& icon,
+ const int key,
+ const bool toggle )
\brief Create an action which can be then used in the menu or toolbar.
\param id the unique id action to be registered to
\param menuText action text which should appear in menu
int myKey;
bool myToggle;
TCreateActionEvent( const int id, const QString& menuText, const QString& tipText,
- const QString& statusText, const QString& icon, const int key, const bool toggle )
+ const QString& statusText, const QString& icon, const int key, const bool toggle )
: myResult( 0 ), myId( id ), myMenuText( menuText ), myTipText( tipText ),
myStatusText( statusText ), myIcon( icon ), myKey( key ), myToggle( toggle ) {}
virtual void Execute()
}
};
QAction* SalomePyQt::createAction( const int id, const QString& menuText,
- const QString& tipText, const QString& statusText,
- const QString& icon, const int key, const bool toggle )
+ const QString& tipText, const QString& statusText,
+ const QString& icon, const int key, const bool toggle )
{
return ProcessEvent( new TCreateActionEvent( id, menuText, tipText, statusText, icon, key, toggle ) );
}
/*!
\fn int SalomePyQt::addPreference( const QString& label, const int pId, const int type,
- const QString& section, const QString& param );
+ const QString& section, const QString& param );
\brief Add module-related preferences.
\param label preferences group name
\param pId parent preferences group id
QString mySection;
QString myParam;
TAddPrefParamEvent( const QString& label,
- const int pId, const int type,
- const QString& section,
- const QString& param )
+ const int pId, const int type,
+ const QString& section,
+ const QString& param )
: myResult( -1 ),
myLabel( label ), myPId( pId ), myType( type ),
mySection( section ), myParam ( param ) {}
}
};
int SalomePyQt::addPreference( const QString& label, const int pId, const int type,
- const QString& section, const QString& param )
+ const QString& section, const QString& param )
{
return ProcessEvent( new TAddPrefParamEvent( label, pId, type, section, param ) );
}
\param var preferences property value
*/
void SalomePyQt::setPreferenceProperty( const int id,
- const QString& prop,
- const QVariant& var )
+ const QString& prop,
+ const QVariant& var )
{
class TEvent: public SALOME_Event
{
{
SALOME_PYQT_ModuleLight* module = getActiveModule();
if ( module )
- module->setPreferenceProperty( myId, myProp, myVar );
+ module->setPreferenceProperty( myId, myProp, myVar );
}
};
ProcessVoidEvent( new TEvent( id, prop, var) );
\param var preferences property value for the index \a idx
*/
void SalomePyQt::addPreferenceProperty( const int id,
- const QString& prop,
- const int idx,
- const QVariant& var )
+ const QString& prop,
+ const int idx,
+ const QVariant& var )
{
class TEvent: public SALOME_Event
{
{
SALOME_PYQT_ModuleLight* module = getActiveModule();
if ( module ) {
- QVariant var = module->preferenceProperty( myId, myProp );
- if ( var.isValid() ) {
- if ( var.type() == QVariant::StringList ) {
- QStringList sl = var.toStringList();
- if ( myIdx >= 0 && myIdx < sl.count() )
- sl[myIdx] = myVar.toString();
- else
- sl.append( myVar.toString() );
- module->setPreferenceProperty( myId, myProp, sl );
- }
- else if ( var.type() == QVariant::List ) {
- QList<QVariant> vl = var.toList();
- if ( myIdx >= 0 && myIdx < vl.count() )
- vl[myIdx] = myVar;
- else
- vl.append( myVar );
- module->setPreferenceProperty( myId, myProp, vl );
- }
- }
- else {
- QList<QVariant> vl;
- vl.append( myVar );
- module->setPreferenceProperty( myId, myProp, vl );
- }
+ QVariant var = module->preferenceProperty( myId, myProp );
+ if ( var.isValid() ) {
+ if ( var.type() == QVariant::StringList ) {
+ QStringList sl = var.toStringList();
+ if ( myIdx >= 0 && myIdx < sl.count() )
+ sl[myIdx] = myVar.toString();
+ else
+ sl.append( myVar.toString() );
+ module->setPreferenceProperty( myId, myProp, sl );
+ }
+ else if ( var.type() == QVariant::List ) {
+ QList<QVariant> vl = var.toList();
+ if ( myIdx >= 0 && myIdx < vl.count() )
+ vl[myIdx] = myVar;
+ else
+ vl.append( myVar );
+ module->setPreferenceProperty( myId, myProp, vl );
+ }
+ }
+ else {
+ QList<QVariant> vl;
+ vl.append( myVar );
+ module->setPreferenceProperty( myId, myProp, vl );
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- LogWindow* lw = anApp->logWindow();
- if ( lw )
- lw->putMessage( myMsg, myAddSep );
+ LogWindow* lw = anApp->logWindow();
+ if ( lw )
+ lw->putMessage( myMsg, myAddSep );
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- LogWindow* lw = anApp->logWindow();
- if ( lw )
- lw->clear();
+ LogWindow* lw = anApp->logWindow();
+ if ( lw )
+ lw->clear();
}
}
};
static QString createObject(const QString& parent = QString(""));
static QString createObject(const QString& name,
- const QString& iconname,
- const QString& tooltip,
- const QString& parent = QString(""));
+ const QString& iconname,
+ const QString& tooltip,
+ const QString& parent = QString(""));
static void removeObject( const QString& obj);
static void removeChild( const QString& obj = QString(""));
static int createTool( QAction*, const QString&, const int = -1, const int = -1 );
static int createMenu( const QString&, const int = -1,
- const int = -1, const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const QString&, const QString& = QString(),
- const int = -1, const int = -1, const int = -1 );
+ const int = -1, const int = -1, const int = -1 );
static int createMenu( const int, const int = -1,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
static int createMenu( const int, const QString& = QString(),
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
static int createMenu( QAction*, const int, const int = -1,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
static int createMenu( QAction*, const QString&, const int = -1,
- const int = -1, const int = -1 );
+ const int = -1, const int = -1 );
static QAction* createSeparator();
static QAction* createAction( const int, const QString&,
- const QString& = QString(), const QString& = QString(),
- const QString& = QString(), const int = 0, const bool = false );
+ const QString& = QString(), const QString& = QString(),
+ const QString& = QString(), const int = 0, const bool = false );
static QtxActionGroup* createActionGroup( const int, const bool = true );
static int addPreference( const QString&,
const int, const int = PT_Auto,
const QString& = QString(),
- const QString& = QString() );
+ const QString& = QString() );
static QVariant preferenceProperty( const int, const QString& );
static void setPreferenceProperty( const int,
const QString&,
const QVariant& );
static void addPreferenceProperty( const int,
- const QString&,
- const int,
- const QVariant& );
+ const QString&,
+ const int,
+ const QVariant& );
static void message( const QString&, bool = true );
static void clearMessages();
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- anApp->updateObjectBrowser();
- anApp->updateActions(); //SRN: added in order to update the toolbar
+ anApp->updateObjectBrowser();
+ anApp->updateActions(); //SRN: added in order to update the toolbar
}
}
};
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
if ( aStudy && aSelMgr ) {
- SUIT_DataOwnerPtrList aList;
- aSelMgr->selected( aList );
-
- for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin();
- itr != aList.end(); ++itr ) {
- const LightApp_DataOwner* owner =
- dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
- if( !owner )
- continue;
- QString entry = owner->entry();
- if( !myResult.contains( entry ) )
- myResult.append( entry );
- }
+ SUIT_DataOwnerPtrList aList;
+ aSelMgr->selected( aList );
+
+ for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin();
+ itr != aList.end(); ++itr ) {
+ const LightApp_DataOwner* owner =
+ dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
+ if( !owner )
+ continue;
+ QString entry = owner->entry();
+ if( !myResult.contains( entry ) )
+ myResult.append( entry );
+ }
}
}
}
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
- if ( aStudy && aSelMgr ) {
- SALOME_ListIO anIOList;
- anIOList.Append( new SALOME_InteractiveObject( myEntry.toLatin1(), "", "" ) );
- aSelMgr->setSelectedObjects( anIOList, true );
- }
+ LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr ) {
+ SALOME_ListIO anIOList;
+ anIOList.Append( new SALOME_InteractiveObject( myEntry.toLatin1(), "", "" ) );
+ aSelMgr->setSelectedObjects( anIOList, true );
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
- if ( aStudy && aSelMgr ) {
- SALOME_ListIO anIOList;
- // VSR: temporary solution, until LightApp_SelectionMgr::unsetSelectedObjects() method appears
- // Lately this should be replaced by the following:
- // anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) );
- // aSelMgr->unsetSelectedObjects( anIOList );
- ///////////////////////////////////////////////
- aSelMgr->selectedObjects( anIOList );
- SALOME_ListIteratorOfListIO anIter( anIOList );
- for( ; anIter.More(); anIter.Next() ) {
- if ( anIter.Value()->isSame( new SALOME_InteractiveObject( myEntry.toLatin1(), "", "" ) ) ) {
- anIOList.Remove( anIter );
- aSelMgr->setSelectedObjects( anIOList, true );
- return;
- }
- }
- }
+ LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr ) {
+ SALOME_ListIO anIOList;
+ // VSR: temporary solution, until LightApp_SelectionMgr::unsetSelectedObjects() method appears
+ // Lately this should be replaced by the following:
+ // anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) );
+ // aSelMgr->unsetSelectedObjects( anIOList );
+ ///////////////////////////////////////////////
+ aSelMgr->selectedObjects( anIOList );
+ SALOME_ListIteratorOfListIO anIter( anIOList );
+ for( ; anIter.More(); anIter.Next() ) {
+ if ( anIter.Value()->isSame( new SALOME_InteractiveObject( myEntry.toLatin1(), "", "" ) ) ) {
+ anIOList.Remove( anIter );
+ aSelMgr->setSelectedObjects( anIOList, true );
+ return;
+ }
+ }
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
- LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
- if ( aStudy && aSelMgr )
- aSelMgr->clearSelected();
+ LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
+ LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
+ if ( aStudy && aSelMgr )
+ aSelMgr->clearSelected();
}
}
};
For the current moment implemented for OCC and VTK viewers only.
\param theEntry object entry
-*/
+*/
void SALOMEGUI_Swig::Display( const char* theEntry )
{
class TEvent: public SALOME_Event
TEvent( const char* theEntry ) : myEntry( theEntry ) {}
virtual void Execute() {
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view )
- view->Display( view->CreatePrs( myEntry.toLatin1() ) );
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->Display( view->CreatePrs( myEntry.toLatin1() ) );
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view ) {
- view->EraseAll( false );
- view->Display( view->CreatePrs( myEntry.toLatin1() ) );
- }
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view ) {
+ view->EraseAll( false );
+ view->Display( view->CreatePrs( myEntry.toLatin1() ) );
+ }
+ }
}
}
};
For the current moment implemented for OCC and VTK viewers only.
\param theEntry object entry
-*/
+*/
void SALOMEGUI_Swig::Erase( const char* theEntry )
{
class TEvent: public SALOME_Event
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view )
- view->Erase( view->CreatePrs( myEntry.toLatin1() ) );
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->Erase( view->CreatePrs( myEntry.toLatin1() ) );
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- LightApp_Study* study = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- LightApp_Module* activeModule = dynamic_cast<LightApp_Module*>( anApp->activeModule() );
- if ( study && window && activeModule ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view ) {
- for ( SUIT_DataObjectIterator it( activeModule->dataModel()->root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) {
- LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( it.current() );
- if ( obj && !obj->entry().isEmpty() )
- view->Display( view->CreatePrs( obj->entry().toLatin1() ) );
- }
- }
- }
+ LightApp_Study* study = dynamic_cast<LightApp_Study*>( anApp->activeStudy() ); // for sure!
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ LightApp_Module* activeModule = dynamic_cast<LightApp_Module*>( anApp->activeModule() );
+ if ( study && window && activeModule ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view ) {
+ for ( SUIT_DataObjectIterator it( activeModule->dataModel()->root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) {
+ LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( it.current() );
+ if ( obj && !obj->entry().isEmpty() )
+ view->Display( view->CreatePrs( obj->entry().toLatin1() ) );
+ }
+ }
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view )
- view->EraseAll( false );
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->EraseAll( false );
+ }
}
}
};
if ( LightApp_Application* anApp = getApplication() ) {
SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
if ( window ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view ) {
- SALOME_Prs* aPrs = view->CreatePrs( myEntry.toLatin1() );
- myResult = !aPrs->IsNull();
- }
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view ) {
+ SALOME_Prs* aPrs = view->CreatePrs( myEntry.toLatin1() );
+ myResult = !aPrs->IsNull();
+ }
}
}
}
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
- if ( view )
- view->Repaint();
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ SALOME_View* view = dynamic_cast<SALOME_View*>( window->getViewManager()->getViewModel() );
+ if ( view )
+ view->Repaint();
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- if ( dynamic_cast<SVTK_ViewWindow*>( window ) )
- ( dynamic_cast<SVTK_ViewWindow*>( window ) )->onFitAll();
- else if ( dynamic_cast<SOCC_ViewWindow*>( window ) )
- ( dynamic_cast<SOCC_ViewWindow*>( window ) )->onFitAll();
- else if ( dynamic_cast<SPlot2d_ViewWindow*>( window ) )
- ( dynamic_cast<SPlot2d_ViewWindow*>( window ) )->onFitAll();
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ if ( dynamic_cast<SVTK_ViewWindow*>( window ) )
+ ( dynamic_cast<SVTK_ViewWindow*>( window ) )->onFitAll();
+ else if ( dynamic_cast<SOCC_ViewWindow*>( window ) )
+ ( dynamic_cast<SOCC_ViewWindow*>( window ) )->onFitAll();
+ else if ( dynamic_cast<SPlot2d_ViewWindow*>( window ) )
+ ( dynamic_cast<SPlot2d_ViewWindow*>( window ) )->onFitAll();
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- if ( dynamic_cast<SVTK_ViewWindow*>( window ) )
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onResetView();
- else if ( dynamic_cast<SOCC_ViewWindow*>( window ) )
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onResetView();
- else if ( dynamic_cast<SPlot2d_ViewWindow*>( window ) )
- (dynamic_cast<SPlot2d_ViewWindow*>( window ))->onFitAll();
- // VSR: there is no 'ResetView' functionality for Plot2d viewer,
- // so we use 'FitAll' instead.
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ if ( dynamic_cast<SVTK_ViewWindow*>( window ) )
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onResetView();
+ else if ( dynamic_cast<SOCC_ViewWindow*>( window ) )
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onResetView();
+ else if ( dynamic_cast<SPlot2d_ViewWindow*>( window ) )
+ (dynamic_cast<SPlot2d_ViewWindow*>( window ))->onFitAll();
+ // VSR: there is no 'ResetView' functionality for Plot2d viewer,
+ // so we use 'FitAll' instead.
+ }
}
}
};
virtual void Execute()
{
if ( LightApp_Application* anApp = getApplication() ) {
- SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
- if ( window ) {
- if ( dynamic_cast<SVTK_ViewWindow*>( window ) ) {
- switch( myView ) {
- case __ViewTop:
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onTopView(); break;
- case __ViewBottom:
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onBottomView(); break;
- case __ViewLeft:
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onLeftView(); break;
- case __ViewRight:
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onRightView(); break;
- case __ViewFront:
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onFrontView(); break;
- case __ViewBack:
- (dynamic_cast<SVTK_ViewWindow*>( window ))->onBackView(); break;
- default:
- break;
- }
- }
- else if ( dynamic_cast<SOCC_ViewWindow*>( window ) ) {
- switch( myView ) {
- case __ViewTop:
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onTopView(); break;
- case __ViewBottom:
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onBottomView(); break;
- case __ViewLeft:
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onLeftView(); break;
- case __ViewRight:
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onRightView(); break;
- case __ViewFront:
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onFrontView(); break;
- case __ViewBack:
- (dynamic_cast<SOCC_ViewWindow*>( window ))->onBackView(); break;
- default:
- break;
- }
- }
- }
+ SUIT_ViewWindow* window = anApp->desktop()->activeWindow();
+ if ( window ) {
+ if ( dynamic_cast<SVTK_ViewWindow*>( window ) ) {
+ switch( myView ) {
+ case __ViewTop:
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onTopView(); break;
+ case __ViewBottom:
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onBottomView(); break;
+ case __ViewLeft:
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onLeftView(); break;
+ case __ViewRight:
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onRightView(); break;
+ case __ViewFront:
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onFrontView(); break;
+ case __ViewBack:
+ (dynamic_cast<SVTK_ViewWindow*>( window ))->onBackView(); break;
+ default:
+ break;
+ }
+ }
+ else if ( dynamic_cast<SOCC_ViewWindow*>( window ) ) {
+ switch( myView ) {
+ case __ViewTop:
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onTopView(); break;
+ case __ViewBottom:
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onBottomView(); break;
+ case __ViewLeft:
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onLeftView(); break;
+ case __ViewRight:
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onRightView(); break;
+ case __ViewFront:
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onFrontView(); break;
+ case __ViewBack:
+ (dynamic_cast<SOCC_ViewWindow*>( window ))->onBackView(); break;
+ default:
+ break;
+ }
+ }
+ }
}
}
};
bDisplayed = true;
// Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj =
+ // Temporarily commented to avoid awful dependecy on SALOMEDS
+ // TODO: better mechanism of storing display/erse status in a study
+ // should be provided...
+ //Handle(SALOME_InteractiveObject) anObj =
// Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
//if ( !anObj.IsNull() && anObj->hasEntry() )
//{
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
- //}
+ // if ( study )
+ // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
+ //}
break;
}
}
AIS_ListIteratorOfListOfInteractive anIter( aList );
for ( ; anIter.More(); anIter.Next() ) {
if ( isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) ||
- anIter.Value()->DynamicType() == STANDARD_TYPE( OCCViewer_Trihedron ))
+ anIter.Value()->DynamicType() == STANDARD_TYPE( OCCViewer_Trihedron ))
continue;
// erase an object
// should be provided...
//if ( !forced ) {
// Handle(SALOME_InteractiveObject) anObj =
- // Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
+ // Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
// if ( !anObj.IsNull() && anObj->hasEntry() ) {
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
+ // if ( study )
+ // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
// }
//}
}
virtual ~SOCC_Viewer();
/* Selection management */
- bool highlight( const Handle(SALOME_InteractiveObject)&, bool, bool=true );
+ bool highlight( const Handle(SALOME_InteractiveObject)&, bool, bool=true );
bool isInViewer( const Handle(SALOME_InteractiveObject)&, bool=false );
void setColor( const Handle(SALOME_InteractiveObject)&, const QColor&, bool=true );
*/
SOCC_ViewWindow
::SOCC_ViewWindow( SUIT_Desktop* theDesktop,
- OCCViewer_Viewer* theModel)
+ OCCViewer_Viewer* theModel)
: OCCViewer_ViewWindow( theDesktop, theModel )
{
}
Renames curve if it is found
*/
void SPlot2d_Viewer::rename( const Handle(SALOME_InteractiveObject)& IObject,
- const QString& newName, Plot2d_ViewFrame* fr )
+ const QString& newName, Plot2d_ViewFrame* fr )
{
Plot2d_ViewFrame* aViewFrame = fr ? fr : getActiveViewFrame();
if( !aViewFrame )
CurveDict::Iterator it = aCurves.begin();
for( ; it != aCurves.end(); ++it ) {
SPlot2d_Curve* aCurve = dynamic_cast<SPlot2d_Curve*>( it.value() );
- if(aCurve && aCurve->hasIO() && aCurve->getTableIO()->isSame(IObject))
- return 1;
+ if(aCurve && aCurve->hasIO() && aCurve->getTableIO()->isSame(IObject))
+ return 1;
}
}
}
_PTR(SObject) aChildSO = aIter->Value();
_PTR(SObject) refSO;
if ( aChildSO->ReferencedObject( refSO ) && refSO )
- aChildSO = refSO;
+ aChildSO = refSO;
curve = getCurveByIO( new SALOME_InteractiveObject( aChildSO->GetID().c_str(), "") );
if ( curve )
- aViewFrame->eraseCurve( curve, update );
+ aViewFrame->eraseCurve( curve, update );
}
}
*/
\param fr - viewframe
*/
SPlot2d_Curve* SPlot2d_Viewer::getCurveByIO( const Handle(SALOME_InteractiveObject)& theIObject,
- Plot2d_ViewFrame* fr )
+ Plot2d_ViewFrame* fr )
{
if ( !theIObject.IsNull() ) {
Plot2d_ViewFrame* aViewFrame = fr ? fr : getActiveViewFrame();
CurveDict::Iterator it = aCurves.begin();
for( ; it != aCurves.end(); ++it ) {
SPlot2d_Curve* aCurve = dynamic_cast<SPlot2d_Curve*>( it.value() );
- if(aCurve) {
- if ( aCurve->hasIO() && aCurve->getIO()->isSame( theIObject ) )
- return aCurve;
- }
+ if(aCurve) {
+ if ( aCurve->hasIO() && aCurve->getIO()->isSame( theIObject ) )
+ return aCurve;
+ }
}
}
}
virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
- /* display */
+ /* display */
void Display( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
void Erase( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
*/
SPlot2d_ViewWindow
::SPlot2d_ViewWindow( SUIT_Desktop* theDesktop,
- Plot2d_Viewer* theModel)
+ Plot2d_Viewer* theModel)
: Plot2d_ViewWindow( theDesktop, theModel )
{
}
#if defined ( _DEBUG ) || defined ( DEBUG )
#include <assert.h>
-#define STD_VERIFY(x) (assert(x))
-#define STD_ASSERT(x) (assert(x))
+#define STD_VERIFY(x) (assert(x))
+#define STD_ASSERT(x) (assert(x))
#else
-#define STD_VERIFY(x) (x)
+#define STD_VERIFY(x) (x)
#define STD_ASSERT(x)
#endif
Qt::CTRL+Qt::Key_O, desk, false, this, SLOT( onOpenDoc() ) );
createAction( FileReopenId, tr( "TOT_DESK_FILE_REOPEN" ), QIcon(),
- tr( "MEN_DESK_FILE_REOPEN" ), tr( "PRP_DESK_FILE_REOPEN" ),
- 0, desk, false, this, SLOT( onReopenDoc() ) );
+ tr( "MEN_DESK_FILE_REOPEN" ), tr( "PRP_DESK_FILE_REOPEN" ),
+ 0, desk, false, this, SLOT( onReopenDoc() ) );
createAction( FileCloseId, tr( "TOT_DESK_FILE_CLOSE" ),
resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) ),
if ( study && study->isSaved() ) {
// ask user for the confirmation
if ( SUIT_MessageBox::question( desktop(), tr( "REOPEN_STUDY" ), tr( "REOPEN_QUESTION" ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No
- ) == SUIT_MessageBox::No )
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No
+ ) == SUIT_MessageBox::No )
return false;
// remember study name
QList<SUIT_Application*> aAppList = aSession->applications();
for ( QList<SUIT_Application*>::iterator it = aAppList.begin(); it != aAppList.end() && !aApp; ++it )
{
- if ( (*it)->activeStudy() && (*it)->activeStudy()->studyName() == aName )
- aApp = *it;
+ if ( (*it)->activeStudy() && (*it)->activeStudy()->studyName() == aName )
+ aApp = *it;
}
if ( aApp )
- aApp->desktop()->activateWindow();
+ aApp->desktop()->activateWindow();
else
- res = false;
+ res = false;
}
break;
case OpenNew:
{
SUIT_Application* aApp = startApplication( 0, 0 );
if ( aApp )
- res = aApp->useFile( aName );
+ res = aApp->useFile( aName );
if ( !res )
- aApp->closeApplication();
+ aApp->closeApplication();
}
break;
case OpenCancel:
/*!\retval QString - return file name from dialog.*/
QString STD_Application::getFileName( bool open, const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent )
+ const QString& caption, QWidget* parent )
{
if ( !parent )
parent = desktop();
isOk = true;
else
{
- int aEnd = aUsedFilter.lastIndexOf( ')' );
- int aStart = aUsedFilter.lastIndexOf( '(', aEnd );
- QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 );
+ int aEnd = aUsedFilter.lastIndexOf( ')' );
+ int aStart = aUsedFilter.lastIndexOf( '(', aEnd );
+ QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 );
int idx = 0;
QStringList extList;
if ( !extList.isEmpty() && !extList.contains( SUIT_Tools::extension( aName ) ) )
aName += QString( ".%1" ).arg( extList.first() );
- if ( QFileInfo( aName ).exists() )
+ if ( QFileInfo( aName ).exists() )
{
- int aAnswer = SUIT_MessageBox::question( desktop(), tr( "TIT_FILE_SAVEAS" ),
- tr( "MSG_FILE_EXISTS" ).arg( aName ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No | SUIT_MessageBox::Cancel, SUIT_MessageBox::Yes );
- if ( aAnswer == SUIT_MessageBox::Cancel )
+ int aAnswer = SUIT_MessageBox::question( desktop(), tr( "TIT_FILE_SAVEAS" ),
+ tr( "MSG_FILE_EXISTS" ).arg( aName ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No | SUIT_MessageBox::Cancel, SUIT_MessageBox::Yes );
+ if ( aAnswer == SUIT_MessageBox::Cancel )
{ // cancelled
aName = QString();
- isOk = true;
+ isOk = true;
}
- else if ( aAnswer == SUIT_MessageBox::No ) // not save to this file
- anOldPath = aName; // not to return to the same initial dir at each "while" step
- else // overwrite the existing file
- isOk = true;
+ else if ( aAnswer == SUIT_MessageBox::No ) // not save to this file
+ anOldPath = aName; // not to return to the same initial dir at each "while" step
+ else // overwrite the existing file
+ isOk = true;
}
- else
- isOk = true;
+ else
+ isOk = true;
}
}
return aName;
virtual QString getFileFilter() const { return QString(); }
virtual QString getFileName( bool open, const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent );
+ const QString& caption, QWidget* parent );
QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
virtual void start();
myWorkspaceAction = new QtxWorkspaceAction( workspace(), this );
myWorkspaceAction->setMenuActions( QtxWorkspaceAction::Cascade | QtxWorkspaceAction::Tile |
- QtxWorkspaceAction::HTile | QtxWorkspaceAction::VTile |
- QtxWorkspaceAction::Windows );
+ QtxWorkspaceAction::HTile | QtxWorkspaceAction::VTile |
+ QtxWorkspaceAction::Windows );
// Cascade
myWorkspaceAction->setIcon( QtxWorkspaceAction::Cascade,
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( resMgr ) {
myWorkstack->setIcon( QtxWorkstack::SplitVertical,
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) );
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VSPLIT" ) ) );
myWorkstack->setIcon( QtxWorkstack::SplitHorizontal,
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) );
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HSPLIT" ) ) );
myWorkstack->setIcon( QtxWorkstack::Close,
- resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) ));
+ resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) ));
}
connect( myWorkstack, SIGNAL( windowActivated( QWidget* ) ),
void STD_TabDesktop::setWindowOperations( const int first, ... )
{
va_list ints;
- va_start( ints, first );
+ va_start( ints, first );
- QList<int> typeList;
+ QList<int> typeList;
- int cur = first;
- while ( cur )
- {
- typeList.append( cur );
- cur = va_arg( ints, int );
+ int cur = first;
+ while ( cur )
+ {
+ typeList.append( cur );
+ cur = va_arg( ints, int );
}
- setWindowOperations( typeList );
+ setWindowOperations( typeList );
}
/*!
if ( vw ) {
QString type = vw->getViewManager()->getViewModel()->getType();
if ( myMap.contains( type ) ) {
- IdActionMap idActionMap = myMap[type];
- if ( idActionMap.contains( key ) ) {
- return vw->onAccelAction( idActionMap[key] );
- }
+ IdActionMap idActionMap = myMap[type];
+ if ( idActionMap.contains( key ) ) {
+ return vw->onAccelAction( idActionMap[key] );
+ }
}
}
}
* Create new instance of QtxAction and set.
*/
void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon,
- const QString& menuText, QKeySequence accel,
+ const QString& menuText, QKeySequence accel,
QObject* parent, bool toggle )
{
setAction( new QtxAction( text, icon, menuText, accel, parent, toggle ) );
* Create new instance of QtxAction and set.
*/
void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText,
- QKeySequence accel, QObject* parent, bool toggle )
+ QKeySequence accel, QObject* parent, bool toggle )
{
setAction( new QtxAction( text, menuText, accel, parent, toggle ) );
}
/*!Provide support QtxAction*/
class SUIT_EXPORT SUIT_ActionOperation : public SUIT_Operation
{
- Q_OBJECT
+ Q_OBJECT
public:
- SUIT_ActionOperation( SUIT_Application* );
- virtual ~SUIT_ActionOperation();
+ SUIT_ActionOperation( SUIT_Application* );
+ virtual ~SUIT_ActionOperation();
- QtxAction* action() const;
+ QtxAction* action() const;
- /** @name GUI management*/
- //@{
- virtual void setAction( const QString& text, const QIcon& icon, const QString& menuText,
- QKeySequence accel, QObject* parent, bool toggle = false );
+ /** @name GUI management*/
+ //@{
+ virtual void setAction( const QString& text, const QIcon& icon, const QString& menuText,
+ QKeySequence accel, QObject* parent, bool toggle = false );
- virtual void setAction( const QString& text, const QString& menuText,
+ virtual void setAction( const QString& text, const QString& menuText,
QKeySequence accel, QObject* parent, bool toggle = false );
- virtual void setAction( QtxAction* theAction );
-
- bool addTo( QWidget* theWidget );
+ virtual void setAction( QtxAction* theAction );
+
+ bool addTo( QWidget* theWidget );
- void setStatusTip( const QString& theTip );
- //@}
+ void setStatusTip( const QString& theTip );
+ //@}
private:
- QtxAction* myAction;
+ QtxAction* myAction;
- friend class SUIT_Study;
+ friend class SUIT_Study;
};
#endif
//! Invokes application-specific "Open/Save File" dialog and returns the selected file name.
virtual QString getFileName( bool open, const QString& initial, const QString& filters,
- const QString& caption, QWidget* parent ) = 0;
+ const QString& caption, QWidget* parent ) = 0;
//! Invokes application-specific "Select Directory" dialog and returns the selected directory name.
virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ) = 0;
foreach( idx, sel ) {
SUIT_DataObject* obj = m->object( idx );
if ( obj )
- lst.append( obj );
+ lst.append( obj );
}
}
}
foreach( obj, lst ) {
QModelIndex index = m->index( obj );
if ( index.isValid() )
- indexes.append( index );
+ indexes.append( index );
}
select( indexes, true, append ); // if !indexes.isEmpty() ???
}
setModel( m );
setItemDelegate( qobject_cast<SUIT_ProxyModel*>( model() )->delegate() );
connect( treeView(), SIGNAL( sortingEnabled( bool ) ),
- model(), SLOT( setSortingEnabled( bool ) ) );
+ model(), SLOT( setSortingEnabled( bool ) ) );
connect( treeView(), SIGNAL( clicked( const QModelIndex& ) ),
- this, SLOT( onClicked( const QModelIndex& ) ) );
+ this, SLOT( onClicked( const QModelIndex& ) ) );
connect( treeView(), SIGNAL( doubleClicked( const QModelIndex& ) ),
- this, SLOT( onDblClicked( const QModelIndex& ) ) );
+ this, SLOT( onDblClicked( const QModelIndex& ) ) );
connect( treeView(), SIGNAL( expanded( const QModelIndex& ) ),
- this, SLOT( onExpanded( const QModelIndex& ) ) );
+ this, SLOT( onExpanded( const QModelIndex& ) ) );
myShortcut = new QShortcut( Qt::Key_F5, this, SIGNAL( requestUpdate() ), SIGNAL( requestUpdate() ) );
myAutoSizeFirstColumn = true;
\sa customSorting()
*/
bool SUIT_DataObject::compare( const QVariant& /*left*/, const QVariant& /*right*/,
- const int /*id*/ ) const
+ const int /*id*/ ) const
{
return false;
}
SUIT_DataObject::Signal::~Signal()
{
for ( DataObjectList::Iterator it = myDelLaterObjects.begin();
- it != myDelLaterObjects.end(); ++it ) {
+ it != myDelLaterObjects.end(); ++it ) {
delete *it;
}
myDelLaterObjects.clear();
filters << "Image files (*.bmp *.gif *.jpg )" << "All files (*)";
QString fileName = SUIT_FileDlg::getFileName( desktop(),
QString(),
- filters,
- "Dump view",
- false );
+ filters,
+ "Dump view",
+ false );
if ( !fileName.isEmpty() ) {
... writing image to the file
}
filters << "*.cpp | *.cxx | *.c++" << "*.h | *.hpp | *.hxx";
QStringList fileNames = SUIT_FileDlg::getOpenFileName( desktop(),
QString(),
- filters,
- QString() );
+ filters,
+ QString() );
if ( !fileNames.isEmpty() ) {
... open files
}
QStringList dirList;
if ( resMgr )
- dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts );
+ dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts );
if ( dirList.isEmpty() )
- dirList << QDir::homePath();
+ dirList << QDir::homePath();
for ( int i = 0; i < dirList.count(); i++ )
- myQuickCombo->addItem( dirList[i] );
+ myQuickCombo->addItem( dirList[i] );
}
else {
delete myQuickLab; myQuickLab = 0;
QString f = it.next();
QFileInfo finfo( f );
if ( !finfo.isDir() )
- it.setValue( addExtension( f ) );
+ it.setValue( addExtension( f ) );
}
}
return files;
for ( int i = 0; i < editBoxes.count(); i++ ) {
int widx = grid->indexOf( editBoxes[ i ] );
if ( widx >= 0 )
- idx = qMin( idx, widx );
+ idx = qMin( idx, widx );
}
if ( grid->itemAt( idx ) )
ebox = qobject_cast<QLineEdit*>( grid->itemAt( idx )->widget() );
if ( txt == ".." ) {
QDir dir = directory();
if ( dir.cdUp() ) {
- setDirectory( dir );
- bool block = lineEdit()->blockSignals( true );
- lineEdit()->setText( ".." );
- lineEdit()->selectAll();
- lineEdit()->setFocus( Qt::OtherFocusReason );
- lineEdit()->blockSignals( block );
- return false;
+ setDirectory( dir );
+ bool block = lineEdit()->blockSignals( true );
+ lineEdit()->setText( ".." );
+ lineEdit()->selectAll();
+ lineEdit()->setFocus( Qt::OtherFocusReason );
+ lineEdit()->blockSignals( block );
+ return false;
}
}
else if ( fileMode() != DirectoryOnly ) {
QStringList fs = txt.split( " ", QString::SkipEmptyParts );
for ( int i = 0; i < fs.count(); i++ ) {
- QString wc = fs.at( i );
- if ( wc.startsWith( "\"" ) && wc.endsWith( "\"" ) )
- wc = wc.mid( 1, wc.length()-2 );
- if ( hasWildCards( wc ) ) {
- addFilter( wc );
- lineEdit()->clear();
- return false;
- }
+ QString wc = fs.at( i );
+ if ( wc.startsWith( "\"" ) && wc.endsWith( "\"" ) )
+ wc = wc.mid( 1, wc.length()-2 );
+ if ( hasWildCards( wc ) ) {
+ addFilter( wc );
+ lineEdit()->clear();
+ return false;
+ }
}
}
}
{
QString fn = files.first();
if ( validator() ) {
- bOk = isOpenDlg() ? validator()->canReadDir( fn, checkPermissions() ) :
- validator()->canWriteDir( fn, checkPermissions() );
+ bOk = isOpenDlg() ? validator()->canReadDir( fn, checkPermissions() ) :
+ validator()->canWriteDir( fn, checkPermissions() );
}
break;
}
QString fn = files.first();
QFileInfo info( fn );
if ( info.isDir() ) {
- setDirectory( info.absoluteFilePath() );
- if ( lineEdit() ) {
- lineEdit()->selectAll();
- lineEdit()->setFocus( Qt::OtherFocusReason );
- }
- return false;
+ setDirectory( info.absoluteFilePath() );
+ if ( lineEdit() ) {
+ lineEdit()->selectAll();
+ lineEdit()->setFocus( Qt::OtherFocusReason );
+ }
+ return false;
}
// validation is not required
if ( validator() ) {
- bOk = isOpenDlg() ? validator()->canOpen( fn, checkPermissions() ) :
- validator()->canSave( fn, checkPermissions() );
+ bOk = isOpenDlg() ? validator()->canOpen( fn, checkPermissions() ) :
+ validator()->canSave( fn, checkPermissions() );
}
break;
}
case ExistingFiles:
{
for ( int i = 0; i < files.count(); ++i ) {
- QFileInfo info( files.at( i ) );
- if ( info.isDir() ) {
- setDirectory( info.absoluteFilePath() );
- if ( lineEdit() ) {
- lineEdit()->selectAll();
- lineEdit()->setFocus( Qt::OtherFocusReason );
- }
- return false;
- }
- if ( validator() ) {
- bOk = isOpenDlg() ? validator()->canOpen( files.at( i ), checkPermissions() ) :
- validator()->canSave( files.at( i ), checkPermissions() );
- if ( !bOk )
- return false;
- }
+ QFileInfo info( files.at( i ) );
+ if ( info.isDir() ) {
+ setDirectory( info.absoluteFilePath() );
+ if ( lineEdit() ) {
+ lineEdit()->selectAll();
+ lineEdit()->setFocus( Qt::OtherFocusReason );
+ }
+ return false;
+ }
+ if ( validator() ) {
+ bOk = isOpenDlg() ? validator()->canOpen( files.at( i ), checkPermissions() ) :
+ validator()->canSave( files.at( i ), checkPermissions() );
+ if ( !bOk )
+ return false;
+ }
}
break;
}
QFileInfo fi( path );
if ( fi.exists() ) {
if ( fi.isFile() )
- selectFile( path );
+ selectFile( path );
else if ( fi.isDir() )
- setDirectory( path );
+ setDirectory( path );
return true;
}
QString dirPath = SUIT_Tools::dir( path, false );
bool emptyAndHome = false;
if ( dirList.count() > 0 ) {
for ( int i = 0; i < dirList.count() && !found; i++ ) {
- QDir aDir( dirList[i] );
- if ( aDir.canonicalPath().isNull() && dirList[i] == dir.absolutePath() ||
- !aDir.canonicalPath().isNull() && aDir.exists() &&
- aDir.canonicalPath() == dir.canonicalPath() ) {
- found = true;
- }
+ QDir aDir( dirList[i] );
+ if ( aDir.canonicalPath().isNull() && dirList[i] == dir.absolutePath() ||
+ !aDir.canonicalPath().isNull() && aDir.exists() &&
+ aDir.canonicalPath() == dir.canonicalPath() ) {
+ found = true;
+ }
}
}
else {
dirList.append( dp );
resMgr->setValue( "FileDlg", "QuickDirList", dirList.join( ";" ) );
if ( !emptyAndHome )
- myQuickCombo->addItem( dp );
+ myQuickCombo->addItem( dp );
}
}
}
int maxBtnWidth = 0;
for ( QList<QPushButton*>::const_iterator it = buttons.begin();
- it != buttons.end(); ++it )
+ it != buttons.end(); ++it )
maxBtnWidth = qMax( maxBtnWidth, (*it)->sizeHint().width() );
for ( QList<QPushButton*>::const_iterator it = buttons.begin();
- it != buttons.end(); ++it ) {
+ it != buttons.end(); ++it ) {
(*it)->setDefault( false );
(*it)->setAutoDefault( false );
(*it)->setFixedWidth( maxBtnWidth );
QList<QListView*> views = findChildren<QListView*>();
for ( QList<QListView*>::const_iterator it = views.begin();
- it != views.end(); ++it ) {
+ it != views.end(); ++it ) {
(*it)->setViewMode( QListView::ListMode );
}
}
\sa getOpenFileNames(), getExistingDirectory()
*/
QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial,
- const QStringList& filters, const QString& caption,
- const bool open, const bool showQuickDir,
+ const QStringList& filters, const QString& caption,
+ const bool open, const bool showQuickDir,
SUIT_FileValidator* validator )
{
SUIT_FileDlg fd( parent, open, showQuickDir, true );
\sa getOpenFileNames(), getExistingDirectory()
*/
QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial,
- const QString& filters, const QString& caption,
- const bool open, const bool showQuickDir,
+ const QString& filters, const QString& caption,
+ const bool open, const bool showQuickDir,
SUIT_FileValidator* validator )
{
return getFileName( parent, initial, filters.split( ";;", QString::SkipEmptyParts ),
- caption, open, showQuickDir, validator );
+ caption, open, showQuickDir, validator );
}
/*!
\sa getFileName(), getExistingDirectory()
*/
QStringList SUIT_FileDlg::getOpenFileNames( QWidget* parent, const QString& initial,
- const QStringList& filters, const QString& caption,
- const bool showQuickDir,
- SUIT_FileValidator* validator )
+ const QStringList& filters, const QString& caption,
+ const bool showQuickDir,
+ SUIT_FileValidator* validator )
{
SUIT_FileDlg fd( parent, true, showQuickDir, true );
\sa getFileName(), getExistingDirectory()
*/
QStringList SUIT_FileDlg::getOpenFileNames( QWidget* parent, const QString& initial,
- const QString& filters, const QString& caption,
- const bool showQuickDir,
- SUIT_FileValidator* validator )
+ const QString& filters, const QString& caption,
+ const bool showQuickDir,
+ SUIT_FileValidator* validator )
{
return getOpenFileNames( parent, initial, filters.split( ";;", QString::SkipEmptyParts ),
- caption, showQuickDir, validator );
+ caption, showQuickDir, validator );
}
/*!
*/
QString SUIT_FileDlg::getExistingDirectory( QWidget* parent, const QString& initial,
const QString& caption, const bool showQuickDir,
- SUIT_FileValidator* validator )
+ SUIT_FileValidator* validator )
{
SUIT_FileDlg fd( parent, true, showQuickDir, true );
static QString getLastVisitedDirectory();
static QString getFileName( QWidget*,
- const QString&,
- const QStringList&,
- const QString& = QString(),
- const bool = true,
- const bool = true,
+ const QString&,
+ const QStringList&,
+ const QString& = QString(),
+ const bool = true,
+ const bool = true,
SUIT_FileValidator* = 0 );
static QString getFileName( QWidget*,
- const QString&,
- const QString&,
- const QString& = QString(),
- const bool = true,
- const bool = true,
+ const QString&,
+ const QString&,
+ const QString& = QString(),
+ const bool = true,
+ const bool = true,
SUIT_FileValidator* = 0 );
static QStringList getOpenFileNames( QWidget*,
- const QString&,
- const QStringList&,
- const QString& = QString(),
- const bool = true,
- SUIT_FileValidator* = 0 );
+ const QString&,
+ const QStringList&,
+ const QString& = QString(),
+ const bool = true,
+ SUIT_FileValidator* = 0 );
static QStringList getOpenFileNames( QWidget*,
- const QString&,
- const QString&,
- const QString& = QString(),
- const bool = true,
- SUIT_FileValidator* = 0 );
+ const QString&,
+ const QString&,
+ const QString& = QString(),
+ const bool = true,
+ SUIT_FileValidator* = 0 );
static QString getExistingDirectory( QWidget*,
- const QString&,
+ const QString&,
const QString& = QString(),
- const bool = true,
- SUIT_FileValidator* = 0 );
+ const bool = true,
+ SUIT_FileValidator* = 0 );
static QString getLastVisitedPath();
if ( !QFile::exists( fileName ) ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_FILE_NOT_EXIST" ).arg( fileName ) );
+ QObject::tr( "ERR_FILE_NOT_EXIST" ).arg( fileName ) );
return false;
}
if ( checkPermission && !QFileInfo( fileName ).isReadable() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_OPEN_PERMISSION_DENIED" ).arg( fileName ) );
+ QObject::tr( "ERR_OPEN_PERMISSION_DENIED" ).arg( fileName ) );
return false;
}
return true;
if ( QFile::exists( fileName ) ) {
if ( parent() )
if ( SUIT_MessageBox::question( parent(), QObject::tr( "WRN_WARNING" ),
- QObject::tr( "QUE_DOC_FILEEXISTS" ).arg( fileName ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
- return false;
+ QObject::tr( "QUE_DOC_FILEEXISTS" ).arg( fileName ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
+ return false;
if ( checkPermission && !QFileInfo( fileName ).isWritable() ) {
if ( parent() )
- SUIT_MessageBox::critical( myParent, QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_PERMISSION_DENIED" ).arg( fileName ) );
+ SUIT_MessageBox::critical( myParent, QObject::tr( "ERR_ERROR" ),
+ QObject::tr( "ERR_PERMISSION_DENIED" ).arg( fileName ) );
return false;
}
}
QString dirName = SUIT_Tools::dir( fileName );
if ( !QFile::exists( dirName ) ) {
SUIT_MessageBox::critical( parent(), QObject::tr( "WRN_WARNING" ),
- QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) );
+ QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) );
return false;
}
if ( checkPermission && !QFileInfo( dirName ).isWritable() ) {
if ( parent() )
- SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_PERMISSION_DENIED" ).arg( fileName ) );
+ SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
+ QObject::tr( "ERR_PERMISSION_DENIED" ).arg( fileName ) );
return false;
}
}
if ( !info.exists() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) );
+ QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) );
return false;
}
if ( !info.isDir() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_FILE_NOT_DIR" ).arg( dirName ) );
+ QObject::tr( "ERR_FILE_NOT_DIR" ).arg( dirName ) );
return false;
}
if ( checkPermission && !info.isReadable() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_DIR_READ_PERMISSION_DENIED" ).arg( dirName ) );
+ QObject::tr( "ERR_DIR_READ_PERMISSION_DENIED" ).arg( dirName ) );
return false;
}
return true;
if ( !info.exists() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) );
+ QObject::tr( "ERR_DIR_NOT_EXIST" ).arg( dirName ) );
return false;
}
if ( !info.isDir() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_FILE_NOT_DIR" ).arg( dirName ) );
+ QObject::tr( "ERR_FILE_NOT_DIR" ).arg( dirName ) );
return false;
}
if ( checkPermission && !info.isWritable() ) {
if ( parent() )
SUIT_MessageBox::critical( parent(), QObject::tr( "ERR_ERROR" ),
- QObject::tr( "ERR_DIR_WRITE_PERMISSION_DENIED" ).arg( dirName ) );
+ QObject::tr( "ERR_DIR_WRITE_PERMISSION_DENIED" ).arg( dirName ) );
return false;
}
return true;
}
/*!
- Name: ~SUIT_LicenseDlg [public]
- Desc: Destructor
+ Name: ~SUIT_LicenseDlg [public]
+ Desc: Destructor
*/
SUIT_LicenseDlg::~SUIT_LicenseDlg()
// convert text to rich text format
QString aFormattedText = Qt::convertFromPlainText( myTextEdit->toPlainText() );
-
+
QTextDocument aRichText( aFormattedText );
aRichText.setDefaultFont( aBodyFont );
/*QSimpleRichText aRichText( aFormattedText,
- aBodyFont,
- myTextEdit->context(),
- myTextEdit->styleSheet(),
- myTextEdit->mimeSourceFactory(),
- aBody.height() );
+ aBodyFont,
+ myTextEdit->context(),
+ myTextEdit->styleSheet(),
+ myTextEdit->mimeSourceFactory(),
+ aBody.height() );
*/
aRichText.setPageSize( QSize( aBody.width(), aRichText.pageSize().height() ) );
- //aRichText.setWidth( &aPainter, aBody.width() );
+ //aRichText.setWidth( &aPainter, aBody.width() );
QRect aView( aBody );
do {
// print page text
aRichText.drawContents( &aPainter, aView );
- //aRichText.draw( &aPainter, aBody.left(), aBody.top(), aView, colorGroup() );
+ //aRichText.draw( &aPainter, aBody.left(), aBody.top(), aView, colorGroup() );
aView.translate( 0, aBody.height() );
aPainter.translate( 0 , -aBody.height() );
aPainter.setFont(aFooterFont);
QString aFooter = QString("Page ") + QString::number(aPageIndex);
aPainter.drawText( aView.right() - aPainter.fontMetrics().width( aFooter ),
- aView.bottom() + aPainter.fontMetrics().ascent() + 5, aFooter );
+ aView.bottom() + aPainter.fontMetrics().ascent() + 5, aFooter );
if ( aView.top() >= aRichText.size().height() )
- break;
+ break;
aPrinter.newPage();
aPageIndex++;
} while (true);
// show question message box with two standard buttons
int result = SUIT_MessageBox::question(desktop(), "Error",
"File already exists? Overwrite?",
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::No );
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::No );
if ( result == SUIT_MessageBox::Yes )
overwriteFileFunction();
// default is second button and escape is third button
int result = SUIT_MessageBox::critical(desktop(), "Hazard!",
"The situation is critical! What to do?",
- "Hide", "Run Away", "Stand still", 1, 2);
+ "Hide", "Run Away", "Stand still", 1, 2);
switch ( result )
{
case 0:
// both default and escape buttons are set to first button ("Zero")
int result = SUIT_MessageBox::information(desktop(), "Question",
"Select your favourite number",
- 0, 0,
- "Zero", "One", "Two", "Three", "Four", "Five");
+ 0, 0,
+ "Zero", "One", "Two", "Three", "Four", "Five");
useMyFavouriteNumberSomewhere( result );
\endcode
*/
\return button id clicked by the user (QMessageBox::StandardButton)
*/
int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button )
+ const QString& button )
{
ButtonInfos lst;
lst.append( ButtonInfo( 0, button ) );
\return button id clicked by the user (QMessageBox::StandardButton)
*/
int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button )
+ const QString& button )
{
ButtonInfos lst;
lst.append( ButtonInfo( 0, button ) );
\return button id clicked by the user (QMessageBox::StandardButton)
*/
int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text,
- const QString& button )
+ const QString& button )
{
ButtonInfos lst;
lst.append( ButtonInfo( 0, button ) );
\return button id clicked by the user (QMessageBox::StandardButton)
*/
int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text,
- const QString& button )
+ const QString& button )
{
ButtonInfos lst;
lst.append( ButtonInfo( 0, button ) );
\return button used button id
*/
int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button1 ) );
lst.append( ButtonInfo( id++, button2 ) );
return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button1 ) );
lst.append( ButtonInfo( id++, button2 ) );
return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button1 ) );
lst.append( ButtonInfo( id++, button2 ) );
return messageBox( SUIT_MessageBox::Information, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button1 ) );
lst.append( ButtonInfo( id++, button2 ) );
return messageBox( SUIT_MessageBox::Question, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button2 ) );
lst.append( ButtonInfo( id++, button3 ) );
return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button2 ) );
lst.append( ButtonInfo( id++, button3 ) );
return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button2 ) );
lst.append( ButtonInfo( id++, button3 ) );
return messageBox( SUIT_MessageBox::Information, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button2 ) );
lst.append( ButtonInfo( id++, button3 ) );
return messageBox( SUIT_MessageBox::Question, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button3 ) );
lst.append( ButtonInfo( id++, button4 ) );
return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button3 ) );
lst.append( ButtonInfo( id++, button4 ) );
return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button3 ) );
lst.append( ButtonInfo( id++, button4 ) );
return messageBox( SUIT_MessageBox::Information, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton, const int escapeButton )
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton, const int escapeButton )
{
ButtonInfos lst;
int id = 0;
lst.append( ButtonInfo( id++, button3 ) );
lst.append( ButtonInfo( id++, button4 ) );
return messageBox( SUIT_MessageBox::Question, parent, title, text, lst,
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char* btn, ... )
+ const int defaultButton, const int escapeButton,
+ char* btn, ... )
{
va_list args;
va_start( args, btn );
return messageBox( SUIT_MessageBox::Critical, parent, title, text,
messageList( btn, args ),
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char* btn, ... )
+ const int defaultButton, const int escapeButton,
+ char* btn, ... )
{
va_list args;
va_start( args, btn );
return messageBox( SUIT_MessageBox::Warning, parent, title, text,
messageList( btn, args ),
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char* btn, ... )
+ const int defaultButton, const int escapeButton,
+ char* btn, ... )
{
va_list args;
va_start( args, btn );
return messageBox( SUIT_MessageBox::Information, parent, title, text,
messageList( btn, args ),
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char* btn, ... )
+ const int defaultButton, const int escapeButton,
+ char* btn, ... )
{
va_list args;
va_start( args, btn );
return messageBox( SUIT_MessageBox::Question, parent, title, text,
messageList( btn, args ),
- defaultButton, escapeButton );
+ defaultButton, escapeButton );
}
/*!
\return button used button id
*/
int SUIT_MessageBox::messageBox( Icon icon, QWidget* parent,
- const QString& title, const QString& text,
- const ButtonInfos& lst,
- const int defaultButton,
- const int escapeButton )
+ const QString& title, const QString& text,
+ const ButtonInfos& lst,
+ const int defaultButton,
+ const int escapeButton )
{
SUIT_MessageBox msgBox( icon, title, text, NoButton, parent );
// message boxes with one custom button
static int critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button );
+ const QString& button );
static int warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button );
+ const QString& button );
static int information( QWidget* parent, const QString& title, const QString& text,
- const QString& button );
+ const QString& button );
static int question( QWidget* parent, const QString& title, const QString& text,
- const QString& button );
+ const QString& button );
// message boxes with two custom buttons
static int critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int information( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int question( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const int defaultButton = -1, const int escapeButton = -1 );
// message boxes with three custom buttons
static int critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2, const QString& button3,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2, const QString& button3,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2, const QString& button3,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2, const QString& button3,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int information( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2, const QString& button3,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2, const QString& button3,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int question( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2, const QString& button3,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2, const QString& button3,
+ const int defaultButton = -1, const int escapeButton = -1 );
// message boxes with four custom buttons
static int critical( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int warning( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int information( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton = -1, const int escapeButton = -1 );
static int question( QWidget* parent, const QString& title, const QString& text,
- const QString& button1, const QString& button2,
- const QString& button3, const QString& button4,
- const int defaultButton = -1, const int escapeButton = -1 );
+ const QString& button1, const QString& button2,
+ const QString& button3, const QString& button4,
+ const int defaultButton = -1, const int escapeButton = -1 );
// message boxes with arbitrary number of buttons
static int critical( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char*, ... );
+ const int defaultButton, const int escapeButton,
+ char*, ... );
static int warning( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char*, ... );
+ const int defaultButton, const int escapeButton,
+ char*, ... );
static int information( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char*, ... );
+ const int defaultButton, const int escapeButton,
+ char*, ... );
static int question( QWidget* parent, const QString& title, const QString& text,
- const int defaultButton, const int escapeButton,
- char*, ... );
+ const int defaultButton, const int escapeButton,
+ char*, ... );
private:
class ButtonInfo
{
public:
ButtonInfo( const int id,
- const QString& text,
- const ButtonRole role = ActionRole )
+ const QString& text,
+ const ButtonRole role = ActionRole )
: myId( id ), myText( text ), myRole( role ) {}
int id() const { return myId; }
QString text() const { return myText; }
private:
static int messageBox( SUIT_MessageBox::Icon icon, QWidget* parent,
- const QString& title, const QString& text,
- const ButtonInfos& lst,
- const int defaultButton = -1,
- const int escapeButton = -1 );
+ const QString& title, const QString& text,
+ const ButtonInfos& lst,
+ const int defaultButton = -1,
+ const int escapeButton = -1 );
static ButtonInfos messageList( char*, va_list& );
};
{
// Temporary action(to avoid selection of the objects which don't pass the filters):
//if ( *it != sel )
- (*it)->setSelected( newOwners );
+ (*it)->setSelected( newOwners );
}
}
myIsSelChangeEnabled = true;
connect( app, SIGNAL( applicationClosed( SUIT_Application* ) ),
this, SLOT( onApplicationClosed( SUIT_Application* ) ) );
connect( app, SIGNAL( activated( SUIT_Application* ) ),
- this, SLOT( onApplicationActivated( SUIT_Application* ) ) );
+ this, SLOT( onApplicationActivated( SUIT_Application* ) ) );
}
/*!
{
SUIT_Study* study = app->activeStudy();
if ( study->isModified() && study->isSaved() )
- study->saveDocument();
+ study->saveDocument();
}
else if ( mode == DONT_SAVE )
{
tmpPath += QString( "Salome_trace" );
- FILE* pStream;
+ FILE* pStream;
pStream = fopen( lpszLog ? lpszLog : (const char*)tmpPath.toLatin1(), "a" );
if ( pStream )
- {
+ {
va_list argptr;
va_start( argptr, lpszFormat );
fprintf( pStream, "- Trace %s [%d] : %s", __FILE__, __LINE__, lpszFormat );
/*!
Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) )
and BottomRight = ( TopLeft + (x2-x1)(y2-y1) )
-*/
+*/
QRect SUIT_Tools::makeRect( const int x1, const int y1, const int x2, const int y2 )
{
return QRect( qMin( x1, x2 ), qMin( y1, y2 ), qAbs( x2 - x1 ), qAbs( y2 - y1 ) );
\param after tree item after each this one should be inserted
*/
SUIT_TreeModel::TreeItem::TreeItem( SUIT_DataObject* obj,
- SUIT_TreeModel::TreeItem* parent,
- SUIT_TreeModel::TreeItem* after )
+ SUIT_TreeModel::TreeItem* parent,
+ SUIT_TreeModel::TreeItem* after )
: myParent( parent ),
myObj( obj )
{
\param after tree item after each \a child should be inserted
*/
void SUIT_TreeModel::TreeItem::insertChild( SUIT_TreeModel::TreeItem* child,
- SUIT_TreeModel::TreeItem* after )
+ SUIT_TreeModel::TreeItem* after )
{
if ( !child )
return;
\return created item
*/
SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::createItem( const ObjPtr& obj,
- const ItemPtr& parent,
- const ItemPtr& after ) const
+ const ItemPtr& parent,
+ const ItemPtr& after ) const
{
ItemPtr item = myModel ? myModel->createItem( obj, parent, after ) : 0;
/* update = ( item->text( 0 ) != obj->name() ) || myBrowser->needToUpdateTexts( item );
if ( !update ) {
- // 2. check pixmap (compare serialNumber()-s)
- QPixmap objPix = obj->icon();
- const QPixmap* itemPix = item->pixmap( 0 );
- update = ( objPix.isNull() && ( itemPix && !itemPix->isNull() ) ) ||
- ( !objPix.isNull() && ( !itemPix || itemPix->isNull() ) );
- if ( !update && !objPix.isNull() && itemPix && !itemPix->isNull() ) {
- int aIconW = objPix.width();
- if( aIconW > 20 ) {
- QWMatrix aM;
- double aScale = 20.0 / aIconW;
- aM.scale( aScale, aScale );
- objPix = objPix.xForm( aM );
- }
- update = ( objPix.serialNumber() != itemPix->serialNumber() );
- }
+ // 2. check pixmap (compare serialNumber()-s)
+ QPixmap objPix = obj->icon();
+ const QPixmap* itemPix = item->pixmap( 0 );
+ update = ( objPix.isNull() && ( itemPix && !itemPix->isNull() ) ) ||
+ ( !objPix.isNull() && ( !itemPix || itemPix->isNull() ) );
+ if ( !update && !objPix.isNull() && itemPix && !itemPix->isNull() ) {
+ int aIconW = objPix.width();
+ if( aIconW > 20 ) {
+ QWMatrix aM;
+ double aScale = 20.0 / aIconW;
+ aM.scale( aScale, aScale );
+ objPix = objPix.xForm( aM );
+ }
+ update = ( objPix.serialNumber() != itemPix->serialNumber() );
+ }
}*/
}
}
{
if ( autoDeleteTree() ) {
SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
delete myRoot;
}
bool found = false;
for( int i=0, n=myColumns.size(); i<n && !found; i++ )
if( name==myColumns[i].myName )
- {
- myColumns[i].myIds.insert( group_id, custom_id );
- found = true;
- }
+ {
+ myColumns[i].myIds.insert( group_id, custom_id );
+ found = true;
+ }
if( !found )
{
- ColumnInfo inf;
- inf.myName = name;
- inf.myIds.insert( group_id, custom_id );
- inf.myAppropriate = Qtx::Shown;
- int n = myColumns.size();
- myColumns.resize( n+1 );
- myColumns[n] = inf;
- reset();
+ ColumnInfo inf;
+ inf.myName = name;
+ inf.myIds.insert( group_id, custom_id );
+ inf.myAppropriate = Qtx::Shown;
+ int n = myColumns.size();
+ myColumns.resize( n+1 );
+ myColumns[n] = inf;
+ reset();
}
}
{
for( int i=0, n=myColumns.size(); i<n; i++ )
if( myColumns[i].myName==name )
- {
- myColumns[i].myIds.remove( group_id );
- if( myColumns[i].myIds.isEmpty() )
- {
- myColumns.remove( i );
- reset();
- }
- break;
+ {
+ myColumns[i].myIds.remove( group_id );
+ if( myColumns[i].myIds.isEmpty() )
+ {
+ myColumns.remove( i );
+ reset();
+ }
+ break;
}
}
{
for( int i=0, n=myColumns.size(); i<n; i++ )
if( myColumns[i].myName==name )
- {
- myColumns[i].myIcon = icon;
- break;
- }
+ {
+ myColumns[i].myIcon = icon;
+ break;
+ }
}
/*!
QPixmap res;
for( int i=0, n=myColumns.size(); i<n; i++ )
if( myColumns[i].myName==name )
- {
- res = myColumns[i].myIcon;
- break;
- }
+ {
+ res = myColumns[i].myIcon;
+ break;
+ }
return res;
}
Qtx::Appropriate appr = Qtx::Shown;
for( int i=0, n=myColumns.size(); i<n; i++ )
if( myColumns[i].myName==name )
- {
- appr = myColumns[i].myAppropriate;
- break;
- }
+ {
+ appr = myColumns[i].myAppropriate;
+ break;
+ }
return appr;
}
if ( autoDeleteTree() ) {
SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
delete myRoot;
}
if ( obj )
{
switch ( role )
- {
+ {
case DisplayRole:
// data object text for the specified column
val = obj->text( id );
// data background color for the specified column
c = obj->color( SUIT_DataObject::Background, id );
if( !c.isValid() ) // default value
- c = QApplication::palette().color( QPalette::Base );
+ c = QApplication::palette().color( QPalette::Base );
c.setAlpha( 0 );
val = c;
break;
// data foreground (text) color for the specified column
c = obj->color( SUIT_DataObject::Foreground, id );
if( !c.isValid() ) // default value
- c = QApplication::palette().color( QPalette::Foreground );
+ c = QApplication::palette().color( QPalette::Foreground );
val = c;
break;
case BaseColorRole:
// editor background color for the specified column
c = obj->color( SUIT_DataObject::Base, id );
if( !c.isValid() ) // default value
- c = QApplication::palette().color( QPalette::Base );
+ c = QApplication::palette().color( QPalette::Base );
val = c;
break;
case TextColorRole:
// editor foreground (text) color for the specified column
c = obj->color( SUIT_DataObject::Text, id );
if( !c.isValid() ) // default value
- c = QApplication::palette().color( QPalette::Text );
+ c = QApplication::palette().color( QPalette::Text );
val = c;
break;
case HighlightRole:
// adta object highlighted background color for the specified column
c = obj->color( SUIT_DataObject::Highlight, id );
if( !c.isValid() ) // default value
- c = QApplication::palette().color( QPalette::Highlight );
+ c = QApplication::palette().color( QPalette::Highlight );
val = c;
break;
case HighlightedTextRole:
// data object highlighted foreground (text) color for the specified column
c = obj->color( SUIT_DataObject::HighlightedText, id );
if( !c.isValid() ) // default value
- c = QApplication::palette().color( QPalette::HighlightedText );
+ c = QApplication::palette().color( QPalette::HighlightedText );
val = c;
break;
case CheckStateRole:
// data object checked state for the specified column
// NOTE! three-state check is not supported currently
if( obj->isCheckable( id ) )
- val = obj->isOn( id ) ? Qt::Checked : Qt::Unchecked;
+ val = obj->isOn( id ) ? Qt::Checked : Qt::Unchecked;
break;
case SizeHintRole:
// data size hint
\sa data()
*/
bool SUIT_TreeModel::setData( const QModelIndex& index,
- const QVariant& value, int role )
+ const QVariant& value, int role )
{
if ( index.isValid() && value.isValid() ) {
SUIT_DataObject* obj = object( index );
// NOTE! only 'check state' data is supported by default
switch ( role ) {
case CheckStateRole:
- // checked state
- if ( obj->isCheckable( index.column() ) ) {
- obj->setOn( value.toBool(), index.column() );
- emit( dataChanged( index, index ) );
- return true;
- }
- break;
+ // checked state
+ if ( obj->isCheckable( index.column() ) ) {
+ obj->setOn( value.toBool(), index.column() );
+ emit( dataChanged( index, index ) );
+ return true;
+ }
+ break;
default:
- break;
+ break;
}
}
}
if ( root() && orientation == Qt::Horizontal )
{
switch ( role )
- {
+ {
case DisplayRole:
// column title
d = myColumns[column].myName;
\return model index
*/
QModelIndex SUIT_TreeModel::index( int row, int column,
- const QModelIndex& parent ) const
+ const QModelIndex& parent ) const
{
if( hasIndex( row, column, parent ) )
{
{
TreeItem* childItem = parentItem->child( row );
if( childItem )
- return createIndex( row, column, childItem );
+ return createIndex( row, column, childItem );
}
}
return QModelIndex();
return;
SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
myAutoUpdate = on;
if ( myAutoUpdate ) {
SUIT_DataObject::connect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
updateTree();
}
return;
synchronize<ObjPtr,ItemPtr,SUIT_TreeModel::TreeSync>( obj,
- treeItem( obj ),
- SUIT_TreeModel::TreeSync( this ) );
+ treeItem( obj ),
+ SUIT_TreeModel::TreeSync( this ) );
emit modelUpdated();
}
void SUIT_TreeModel::initialize()
{
SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::disconnect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
if ( autoUpdate() ) {
SUIT_DataObject::connect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) );
SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ),
- this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
+ this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) );
}
myItems.clear(); // ????? is it really necessary
\return created tree item or 0 if item could not be created
*/
SUIT_TreeModel::TreeItem* SUIT_TreeModel::createItem( SUIT_DataObject* obj,
- SUIT_TreeModel::TreeItem* parent,
- SUIT_TreeModel::TreeItem* after )
+ SUIT_TreeModel::TreeItem* parent,
+ SUIT_TreeModel::TreeItem* after )
{
if ( !obj )
return 0;
\param index model index being rendered
*/
void SUIT_ItemDelegate::paint( QPainter* painter,
- const QStyleOptionViewItem& option,
- const QModelIndex& index ) const
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index ) const
{
QStyleOptionViewItem opt = option;
if ( index.isValid() ) {
typedef struct
{
QString myName;
- QMap<int,int> myIds;
- QPixmap myIcon;
- Qtx::Appropriate myAppropriate;
+ QMap<int,int> myIds;
+ QPixmap myIcon;
+ Qtx::Appropriate myAppropriate;
} ColumnInfo;
SUIT_ItemDelegate( QObject* = 0 );
virtual void paint( QPainter*, const QStyleOptionViewItem&,
- const QModelIndex& ) const;
-
+ const QModelIndex& ) const;
+
virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
};
template <class SrcItem, class TrgItem, class TreeData>
QList< DiffItem<SrcItem,TrgItem> > diffSiblings( const SrcItem&,
- const TrgItem&,
- const TreeData& );
+ const TrgItem&,
+ const TreeData& );
template <class SrcItem, class TrgItem, class TreeData>
TrgItem createSubTree( const SrcItem&, const TrgItem&, const TrgItem&, const TreeData& );
template <class SrcItem, class TrgItem, class TreeData>
const typename QList<TrgItem>::const_iterator findEqual( const SrcItem& it,
- const typename QList<TrgItem>::const_iterator& first,
- const typename QList<TrgItem>::const_iterator& last,
- const TreeData& td );
+ const typename QList<TrgItem>::const_iterator& first,
+ const typename QList<TrgItem>::const_iterator& last,
+ const TreeData& td );
//
for ( ; anIt != aLast; anIt++ ) {
const DiffItem<SrcItem,TrgItem>& item = *anIt;
if ( item.mySrc == td.nullSrc() ) {
- if ( item.myTrg == td.nullTrg() )
- qDebug( "error: both null" );
+ if ( item.myTrg == td.nullTrg() )
+ qDebug( "error: both null" );
else
- // delete item
- td.deleteItemWithChildren( item.myTrg );
+ // delete item
+ td.deleteItemWithChildren( item.myTrg );
}
else {
- if ( item.myTrg == td.nullTrg() ) {
- // add item (recursively)
- TrgItem nitem = createSubTree( item.mySrc, r2, lastItem, td );
- if ( nitem != td.nullTrg() )
- lastItem = nitem;
- }
+ if ( item.myTrg == td.nullTrg() ) {
+ // add item (recursively)
+ TrgItem nitem = createSubTree( item.mySrc, r2, lastItem, td );
+ if ( nitem != td.nullTrg() )
+ lastItem = nitem;
+ }
else {
- // update item
- synchronize( item.mySrc, item.myTrg, td );
- lastItem = item.myTrg;
- }
+ // update item
+ synchronize( item.mySrc, item.myTrg, td );
+ lastItem = item.myTrg;
+ }
}
}
return r2;
*/
template <class SrcItem, class TrgItem, class TreeData>
const typename QList<TrgItem>::const_iterator findEqual( const SrcItem& it,
- const typename QList<TrgItem>::const_iterator& first,
- const typename QList<TrgItem>::const_iterator& last,
- const TreeData& td )
+ const typename QList<TrgItem>::const_iterator& first,
+ const typename QList<TrgItem>::const_iterator& last,
+ const TreeData& td )
{
typename QList<TrgItem>::const_iterator cur = first;
for ( ; cur != last; cur++ ) {
*/
template <class SrcItem, class TrgItem, class TreeData>
QList< DiffItem<SrcItem,TrgItem> > diffSiblings( const SrcItem& src, const TrgItem& trg,
- const TreeData& td )
+ const TreeData& td )
{
//if( src==td.nullSrc() || trg==td.nullTrg() )
// return;
// target is found
// mark all items before found one as "to be deleted"
for ( typename QList<TrgItem>::const_iterator it = cur; it != f; it++ ) {
- DiffItem<SrcItem,TrgItem> ndiff;
- ndiff.mySrc = td.nullSrc();
- ndiff.myTrg = *it; // delete item
- d.append( ndiff );
+ DiffItem<SrcItem,TrgItem> ndiff;
+ ndiff.mySrc = td.nullSrc();
+ ndiff.myTrg = *it; // delete item
+ d.append( ndiff );
}
cur = f;
DiffItem<SrcItem,TrgItem> ndiff;
*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem createSubTree( const SrcItem& src, const TrgItem& parent,
- const TrgItem& after, const TreeData& td )
+ const TrgItem& after, const TreeData& td )
{
if ( src == td.nullSrc() )
return td.nullTrg();
*/
class SUIT_EXPORT SUIT_ViewModel : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
enum HotOperation { PAN, ZOOM, ROTATE, FIT_AREA };
virtual void contextMenuPopup( QMenu* ) {}
static void setHotButton( HotOperation theOper, Qt::KeyboardModifier theState,
- Qt::MouseButton theButton );
+ Qt::MouseButton theButton );
static void getHotButton( HotOperation theOper, Qt::KeyboardModifier& theState,
- Qt::MouseButton& theButton );
+ Qt::MouseButton& theButton );
protected:
SUIT_ViewManager* myViewManager;
QString fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 );
if ( !fileName.isEmpty() )
{
- QString fmt = SUIT_Tools::extension( fileName ).toUpper();
- bOk = dumpViewToFormat( im, fileName, fmt );
+ QString fmt = SUIT_Tools::extension( fileName ).toUpper();
+ bOk = dumpViewToFormat( im, fileName, fmt );
}
else
- bOk = true; // cancelled
+ bOk = true; // cancelled
}
if ( !bOk )
SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
iniFormat = true;
else if ( !strcmp( argv[i], "--nosplash") )
noSplash = true;
- else if ( !strcmp( argv[i], "--uselicense" ) )
+ else if ( !strcmp( argv[i], "--uselicense" ) )
useLicense = true;
- else
+ else
argList.append( QString( argv[i] ) );
}
{
if ( resMgr )
{
- resMgr->loadLanguage( false );
-
- splash = QtxSplash::splash( QPixmap() );
- splash->readSettings( resMgr );
- if ( splash->pixmap().isNull() ) {
- delete splash;
- splash = 0;
- }
- else {
- QString appName = QObject::tr( "APP_NAME" ).trimmed();
- QString appVersion = QObject::tr( "APP_VERSION" ).trimmed();
- if ( appVersion == "APP_VERSION" )
- {
- if ( appName == "APP_NAME" || appName.toLower() == "salome" )
- appVersion = salomeVersion();
- else
- appVersion = "";
- }
- splash->setOption( "%A", appName );
- splash->setOption( "%V", QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
- splash->setOption( "%L", QObject::tr( "ABOUT_LICENSE" ) );
- splash->setOption( "%C", QObject::tr( "ABOUT_COPYRIGHT" ) );
- splash->show();
- QApplication::instance()->processEvents();
- }
+ resMgr->loadLanguage( false );
+
+ splash = QtxSplash::splash( QPixmap() );
+ splash->readSettings( resMgr );
+ if ( splash->pixmap().isNull() ) {
+ delete splash;
+ splash = 0;
+ }
+ else {
+ QString appName = QObject::tr( "APP_NAME" ).trimmed();
+ QString appVersion = QObject::tr( "APP_VERSION" ).trimmed();
+ if ( appVersion == "APP_VERSION" )
+ {
+ if ( appName == "APP_NAME" || appName.toLower() == "salome" )
+ appVersion = salomeVersion();
+ else
+ appVersion = "";
+ }
+ splash->setOption( "%A", appName );
+ splash->setOption( "%V", QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
+ splash->setOption( "%L", QObject::tr( "ABOUT_LICENSE" ) );
+ splash->setOption( "%C", QObject::tr( "ABOUT_COPYRIGHT" ) );
+ splash->show();
+ QApplication::instance()->processEvents();
+ }
}
}
{
Style_Salome::initialize( theApp->resourceMgr() );
if ( theApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) )
- Style_Salome::apply();
+ Style_Salome::apply();
if ( !noExceptHandling )
app.setHandler( aSession->handler() );
if ( splash )
- splash->finish( theApp->desktop() );
+ splash->finish( theApp->desktop() );
result = app.exec();
}
*/
void SUITApp_Application::setHandler( SUIT_ExceptionHandler* hand )
{
- myExceptHandler = hand;
+ myExceptHandler = hand;
}
/*!
virtual bool notify( QObject* receiver, QEvent* e );
- SUIT_ExceptionHandler* handler() const;
- void setHandler( SUIT_ExceptionHandler* );
+ SUIT_ExceptionHandler* handler() const;
+ void setHandler( SUIT_ExceptionHandler* );
private:
SUIT_ExceptionHandler* myExceptHandler;
// Panning
aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_PAN" ) ),
- tr( "MNU_PAN_VIEW" ), 0, this);
+ tr( "MNU_PAN_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_PAN_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan()));
myActionsMap[ PanId ] = aAction;
// Reset
aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_RESET" ) ),
- tr( "MNU_RESET_VIEW" ), 0, this);
+ tr( "MNU_RESET_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_RESET_VIEW"));
connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset()));
myActionsMap[ ResetId ] = aAction;
\param name - new name
*/
void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName )
+ QString newName )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
}
\param update - update current viewer
*/
void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly )
+ bool highlight, bool immediatly )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
}
/* interactive object management */
void highlight( const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight, bool immediatly = true );
+ bool highlight, bool immediatly = true );
void unHighlightAll();
void rename( const Handle(SALOME_InteractiveObject)& IObject,
- QString newName );
+ QString newName );
bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
/* selection */
Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
- /* display */
+ /* display */
void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
void DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
void Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
Constructor
*/
SUPERVGraph_ViewManager::SUPERVGraph_ViewManager( SUIT_Study* theStudy,
- SUIT_Desktop* theDesktop,
- SUIT_ViewModel* theViewModel )
+ SUIT_Desktop* theDesktop,
+ SUIT_ViewModel* theViewModel )
: SUIT_ViewManager( theStudy, theDesktop, theViewModel )
{
myId = ++myMaxId;
{
int
GetEdgeId(SALOME_Actor* theActor,
- vtkPicker* thePicker,
- int theObjId)
+ vtkPicker* thePicker,
+ int theObjId)
{
int anEdgeId = 0;
if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) {
thePicker->GetPickPosition(aPickPosition);
vtkFloatingPointType aMinDist = 1000000.0, aDist = 0;
for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){
- if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
- int subId;
- vtkFloatingPointType pcoords[3], closestPoint[3], weights[3];
- aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
- if (aDist < aMinDist) {
- aMinDist = aDist;
- anEdgeId = -1 - i;
- }
- }
+ if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){
+ int subId;
+ vtkFloatingPointType pcoords[3], closestPoint[3], weights[3];
+ aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights);
+ if (aDist < aMinDist) {
+ aMinDist = aDist;
+ anEdgeId = -1 - i;
+ }
+ }
}
}
return anEdgeId;
inline
bool
CheckDimensionId(Selection_Mode theMode,
- SALOME_Actor *theActor,
- vtkIdType theObjId)
+ SALOME_Actor *theActor,
+ vtkIdType theObjId)
{
switch(theMode){
case CellSelection:
QColor aForegroundColor = aResourceMgr->colorValue( "VTKViewer", "group_names_text_color", Qt::white );
myNameActor->SetForegroundColor(aForegroundColor.redF(),
- aForegroundColor.greenF(),
- aForegroundColor.blueF());
+ aForegroundColor.greenF(),
+ aForegroundColor.blueF());
vtkFloatingPointType aGroupNamesTransparency = 0.5;
aGroupNamesTransparency = aResourceMgr->doubleValue( "VTKViewer", "group_names_transparency", aGroupNamesTransparency );
SALOME_Actor
::setName(const char* theName)
{
- if(hasIO())
+ if(hasIO())
myIO->setName(theName);
myNameActor->SetText(theName);
Superclass::setName(theName);
void
SALOME_Actor
::SetPosition(vtkFloatingPointType _arg1,
- vtkFloatingPointType _arg2,
- vtkFloatingPointType _arg3)
+ vtkFloatingPointType _arg2,
+ vtkFloatingPointType _arg3)
{
Superclass::SetPosition(_arg1,_arg2,_arg3);
mySelector->GetIndex( getIO(), aMapIndex );
switch( mySelectionMode ){
case NodeSelection:
- myHighlightActor->GetProperty()->SetRepresentationToPoints();
- myHighlightActor->MapPoints( this, aMapIndex );
- break;
+ myHighlightActor->GetProperty()->SetRepresentationToPoints();
+ myHighlightActor->MapPoints( this, aMapIndex );
+ break;
case EdgeOfCellSelection:
- myHighlightActor->GetProperty()->SetRepresentationToWireframe();
- myHighlightActor->MapEdge( this, aMapIndex );
- break;
+ myHighlightActor->GetProperty()->SetRepresentationToWireframe();
+ myHighlightActor->MapEdge( this, aMapIndex );
+ break;
case CellSelection:
case EdgeSelection:
case FaceSelection:
case VolumeSelection:
- myHighlightActor->GetProperty()->SetRepresentationToSurface();
- myHighlightActor->MapCells( this, aMapIndex );
- break;
+ myHighlightActor->GetProperty()->SetRepresentationToSurface();
+ myHighlightActor->MapCells( this, aMapIndex );
+ break;
}
myHighlightActor->SetVisibility( GetVisibility() && theIsHighlight );
}
bool
SALOME_Actor
::PreHighlight(vtkInteractorStyle *theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight)
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight)
{
if ( !GetPickable() )
return false;
theActors->InitTraversal();
while( vtkActor *ac = theActors->GetNextActor() )
if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) )
- if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
- anActor->SetPreSelected( false );
+ if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
+ anActor->SetPreSelected( false );
}else{
switch(aSelectionMode) {
int aVtkId = myPointPicker->GetPointId();
if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) {
- int anObjId = GetNodeObjId( aVtkId );
- myIsPreselected = (anObjId >= 0);
- if(myIsPreselected){
- const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
- int anExtent = aMapIndex.Extent();
- anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
- if(anIsChanged){
- TColStd_IndexedMapOfInteger aMapIndex;
- aMapIndex.Add( anObjId );
-
- myPreHighlightActor->GetProperty()->SetRepresentationToPoints();
- myPreHighlightActor->MapPoints( this, aMapIndex );
- }
- myPreHighlightActor->SetVisibility( true );
- }
+ int anObjId = GetNodeObjId( aVtkId );
+ myIsPreselected = (anObjId >= 0);
+ if(myIsPreselected){
+ const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+ int anExtent = aMapIndex.Extent();
+ anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
+ if(anIsChanged){
+ TColStd_IndexedMapOfInteger aMapIndex;
+ aMapIndex.Add( anObjId );
+
+ myPreHighlightActor->GetProperty()->SetRepresentationToPoints();
+ myPreHighlightActor->MapPoints( this, aMapIndex );
+ }
+ myPreHighlightActor->SetVisibility( true );
+ }
}
break;
}
int aVtkId = myCellPicker->GetCellId();
if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) && hasIO() ) {
- int anObjId = GetElemObjId (aVtkId );
- if ( anObjId >= 0 ) {
- myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId);
- if(myIsPreselected){
- const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
- int anExtent = aMapIndex.Extent();
- anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
- if(anIsChanged){
- TColStd_IndexedMapOfInteger aMapIndex;
- aMapIndex.Add( anObjId );
-
- myPreHighlightActor->GetProperty()->SetRepresentationToSurface();
- myPreHighlightActor->MapCells( this, aMapIndex );
- }
- myPreHighlightActor->SetVisibility( true );
- }
- }
+ int anObjId = GetElemObjId (aVtkId );
+ if ( anObjId >= 0 ) {
+ myIsPreselected = CheckDimensionId(aSelectionMode,this,anObjId);
+ if(myIsPreselected){
+ const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+ int anExtent = aMapIndex.Extent();
+ anIsChanged |= (anExtent == 0 || anExtent > 0 && anObjId != aMapIndex(1));
+ if(anIsChanged){
+ TColStd_IndexedMapOfInteger aMapIndex;
+ aMapIndex.Add( anObjId );
+
+ myPreHighlightActor->GetProperty()->SetRepresentationToSurface();
+ myPreHighlightActor->MapCells( this, aMapIndex );
+ }
+ myPreHighlightActor->SetVisibility( true );
+ }
+ }
}
break;
}
int aVtkId = myCellPicker->GetCellId();
if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId )) {
- int anObjId = GetElemObjId( aVtkId );
- if ( anObjId >= 0 ) {
- int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
- myIsPreselected = anEdgeId < 0;
- if(myIsPreselected){
- const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
- int anExtent = aMapIndex.Extent();
- anIsChanged |= (anExtent == 0 || anExtent == 1);
- anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
- if(anIsChanged){
- TColStd_IndexedMapOfInteger aMapIndex;
- aMapIndex.Add( anObjId );
- aMapIndex.Add( anEdgeId );
-
- myPreHighlightActor->GetProperty()->SetRepresentationToWireframe();
- myPreHighlightActor->MapEdge( this, aMapIndex );
- }
- myPreHighlightActor->SetVisibility( true );
- }
- }
+ int anObjId = GetElemObjId( aVtkId );
+ if ( anObjId >= 0 ) {
+ int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
+ myIsPreselected = anEdgeId < 0;
+ if(myIsPreselected){
+ const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex();
+ int anExtent = aMapIndex.Extent();
+ anIsChanged |= (anExtent == 0 || anExtent == 1);
+ anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2)));
+ if(anIsChanged){
+ TColStd_IndexedMapOfInteger aMapIndex;
+ aMapIndex.Add( anObjId );
+ aMapIndex.Add( anEdgeId );
+
+ myPreHighlightActor->GetProperty()->SetRepresentationToWireframe();
+ myPreHighlightActor->MapEdge( this, aMapIndex );
+ }
+ myPreHighlightActor->SetVisibility( true );
+ }
+ }
}
break;
}
case ActorSelection :
{
if( !mySelector->IsSelected( myIO ) ) {
- SetPreSelected( true );
-
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
- vtkActorCollection* theActors = aCopy.GetActors();
- theActors->InitTraversal();
- while( vtkActor *anAct = theActors->GetNextActor() ) {
- if( anAct != this )
- if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( anAct ) )
- if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
- anActor->SetPreSelected( true );
- }
+ SetPreSelected( true );
+
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ vtkActorCollection* theActors = aCopy.GetActors();
+ theActors->InitTraversal();
+ while( vtkActor *anAct = theActors->GetNextActor() ) {
+ if( anAct != this )
+ if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( anAct ) )
+ if( anActor->hasIO() && myIO->isSame( anActor->getIO() ) )
+ anActor->SetPreSelected( true );
+ }
}
}
default:
bool
SALOME_Actor
::Highlight(vtkInteractorStyle *theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight)
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight)
{
if ( !GetPickable() || !mySelector )
return false;
int aVtkId = myPointPicker->GetPointId();
if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) ) {
- int anObjId = GetNodeObjId( aVtkId );
- if( anObjId >= 0 ) {
- mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
- mySelector->AddIObject( this );
- }
+ int anObjId = GetNodeObjId( aVtkId );
+ if( anObjId >= 0 ) {
+ mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
+ mySelector->AddIObject( this );
+ }
}
break;
}
int aVtkId = myCellPicker->GetCellId();
if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
- int anObjId = GetElemObjId( aVtkId );
- if( anObjId >= 0 ) {
- if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
- mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
- mySelector->AddIObject( this );
- }
- }
+ int anObjId = GetElemObjId( aVtkId );
+ if( anObjId >= 0 ) {
+ if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
+ mySelector->AddOrRemoveIndex( myIO, anObjId, anIsShift );
+ mySelector->AddIObject( this );
+ }
+ }
}
break;
}
int aVtkId = myCellPicker->GetCellId();
if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) {
- int anObjId = GetElemObjId( aVtkId );
- if( anObjId >= 0 ) {
- int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
- if( anEdgeId < 0 ) {
- mySelector->AddOrRemoveIndex( myIO, anObjId, false );
- mySelector->AddOrRemoveIndex( myIO, anEdgeId, true );
- mySelector->AddIObject( this );
- }
- }
+ int anObjId = GetElemObjId( aVtkId );
+ if( anObjId >= 0 ) {
+ int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId);
+ if( anEdgeId < 0 ) {
+ mySelector->AddOrRemoveIndex( myIO, anObjId, false );
+ mySelector->AddOrRemoveIndex( myIO, anEdgeId, true );
+ mySelector->AddIObject( this );
+ }
+ }
}
break;
}
case ActorSelection :
{
if( mySelector->IsSelected( myIO ) && anIsShift )
- mySelector->RemoveIObject( this );
+ mySelector->RemoveIObject( this );
else {
- mySelector->AddIObject( this );
+ mySelector->AddIObject( this );
}
break;
}
SVTK_RectPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
TColStd_MapOfInteger anIndexes;
if(aMapIter != aVectorIdsMap.end()){
- const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
- vtkIdType anEnd = aVectorIds.size();
- for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
- int aPointId = aVectorIds[anId];
- if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) {
- int anObjId = GetNodeObjId( aPointId );
- anIndexes.Add( anObjId );
- }
- }
+ const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
+ vtkIdType anEnd = aVectorIds.size();
+ for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
+ int aPointId = aVectorIds[anId];
+ if( aPointId >= 0 && mySelector->IsValid( this, aPointId, true ) ) {
+ int anObjId = GetNodeObjId( aPointId );
+ anIndexes.Add( anObjId );
+ }
+ }
}
if( !anIndexes.IsEmpty() ) {
- mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
- mySelector->AddIObject( this );
- anIndexes.Clear();
+ mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
+ mySelector->AddIObject( this );
+ anIndexes.Clear();
}
else
- mySelector->RemoveIObject( this );
+ mySelector->RemoveIObject( this );
break;
}
bool anIsPicked = true;
for( int i = 0; i <= 1; i++ ) {
- for( int j = 2; j <= 3; j++ ) {
- for( int k = 4; k <= 5; k++ ) {
- aRenderer->SetWorldPoint( aBounds[ i ], aBounds[ j ], aBounds[ k ], 1.0 );
- aRenderer->WorldToDisplay();
- aRenderer->GetDisplayPoint( aPnt );
-
- if( aPnt[0] < x1 || aPnt[0] > x2 || aPnt[1] < y1 || aPnt[1] > y2 ) {
- anIsPicked = false;
- break;
- }
- }
- }
+ for( int j = 2; j <= 3; j++ ) {
+ for( int k = 4; k <= 5; k++ ) {
+ aRenderer->SetWorldPoint( aBounds[ i ], aBounds[ j ], aBounds[ k ], 1.0 );
+ aRenderer->WorldToDisplay();
+ aRenderer->GetDisplayPoint( aPnt );
+
+ if( aPnt[0] < x1 || aPnt[0] > x2 || aPnt[1] < y1 || aPnt[1] > y2 ) {
+ anIsPicked = false;
+ break;
+ }
+ }
+ }
}
if( anIsPicked )
- mySelector->AddIObject(this);
+ mySelector->AddIObject(this);
break;
}
SVTK_RectPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this);
TColStd_MapOfInteger anIndexes;
if(aMapIter != aVectorIdsMap.end()){
- const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
- vtkIdType anEnd = aVectorIds.size();
- for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
- int aCellId = aVectorIds[anId];
- if ( !mySelector->IsValid( this, aCellId ) )
- continue;
-
- int anObjId = GetElemObjId( aCellId );
- if( anObjId != -1 )
- if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
- anIndexes.Add(anObjId);
- }
- }
+ const SVTK_RectPicker::TVectorIds& aVectorIds = aMapIter->second;
+ vtkIdType anEnd = aVectorIds.size();
+ for(vtkIdType anId = 0; anId < anEnd; anId++ ) {
+ int aCellId = aVectorIds[anId];
+ if ( !mySelector->IsValid( this, aCellId ) )
+ continue;
+
+ int anObjId = GetElemObjId( aCellId );
+ if( anObjId != -1 )
+ if ( CheckDimensionId(aSelectionMode,this,anObjId) ) {
+ anIndexes.Add(anObjId);
+ }
+ }
}
if( !anIndexes.IsEmpty() ) {
- mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
- mySelector->AddIObject( this );
- anIndexes.Clear();
+ mySelector->AddOrRemoveIndex( myIO, anIndexes, anIsShift );
+ mySelector->AddIObject( this );
+ anIndexes.Clear();
}
else
- mySelector->RemoveIObject( this );
+ mySelector->RemoveIObject( this );
}
default:
break;
{
if( SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>( aCollection->GetItemAsObject( anIndex ) ) )
{
- if( anActor->IsDisplayNameActor() )
- {
- anActor->SetNameActorOffset( anOffset );
- if( anActor->GetVisibility() )
- {
- int aSize[2];
- anActor->GetNameActorSize( aRenderer, aSize );
- anOffset[0] = anOffset[0] + aSize[0];
- anOffset[1] = anOffset[1] + aSize[1];
- }
- }
+ if( anActor->IsDisplayNameActor() )
+ {
+ anActor->SetNameActorOffset( anOffset );
+ if( anActor->GetVisibility() )
+ {
+ int aSize[2];
+ anActor->GetNameActorSize( aRenderer, aSize );
+ anOffset[0] = anOffset[0] + aSize[0];
+ anOffset[1] = anOffset[1] + aSize[1];
+ }
+ }
}
}
}
virtual
void
SetPosition(vtkFloatingPointType _arg1,
- vtkFloatingPointType _arg2,
- vtkFloatingPointType _arg3);
+ vtkFloatingPointType _arg2,
+ vtkFloatingPointType _arg3);
//! Apply additional position
virtual
virtual
bool
PreHighlight(vtkInteractorStyle* theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight);
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight);
//! To process highlight (called from #SVTK_InteractorStyle)
virtual
bool
Highlight(vtkInteractorStyle* theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight);
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight);
//----------------------------------------------------------------------------
//! To get flag of displaying of name actor
void
SVTK_Actor
::MapCells(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const TColStd_IndexedMapOfInteger& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
void
SVTK_Actor
::MapPoints(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const TColStd_IndexedMapOfInteger& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
for(vtkIdType i = 0; i < aNbOfParts; i++){
int aPartId = theMapIndex( i+1 );
if(vtkFloatingPointType* aCoord = theMapActor->GetNodeCoord(aPartId)){
- aPoints->SetPoint(i,aCoord);
- // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK
- // from ParaView-3.4.0 compiled on 64-bit Debian platform with VTK_USE_64BIT_IDS = ON
- myUnstructuredGrid->InsertNextCell(VTK_VERTEX,(vtkIdType) 1,&i);
+ aPoints->SetPoint(i,aCoord);
+ // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK
+ // from ParaView-3.4.0 compiled on 64-bit Debian platform with VTK_USE_64BIT_IDS = ON
+ myUnstructuredGrid->InsertNextCell(VTK_VERTEX,(vtkIdType) 1,&i);
}
}
myUnstructuredGrid->SetPoints(aPoints);
void
SVTK_Actor
::MapEdge(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex)
+ const TColStd_IndexedMapOfInteger& theMapIndex)
{
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
if(aCellId > 0){
if(vtkCell* aCell = theMapActor->GetElemCell(aCellId)){
- if(anEdgeId < 0){
- anEdgeId = -anEdgeId - 1;
- int aNbOfEdges = aCell->GetNumberOfEdges();
- if(0 <= anEdgeId || anEdgeId < aNbOfEdges){
- if(vtkCell* anEdge = aCell->GetEdge(anEdgeId))
- myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdge->GetPointIds());
- }
- }
+ if(anEdgeId < 0){
+ anEdgeId = -anEdgeId - 1;
+ int aNbOfEdges = aCell->GetNumberOfEdges();
+ if(0 <= anEdgeId || anEdgeId < aNbOfEdges){
+ if(vtkCell* anEdge = aCell->GetEdge(anEdgeId))
+ myUnstructuredGrid->InsertNextCell(VTK_LINE,anEdge->GetPointIds());
+ }
+ }
}
}
}
//! Allow to recostruct selected cells from source SALOME_Actor and map of subindexes
void
MapCells(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex);
+ const TColStd_IndexedMapOfInteger& theMapIndex);
//! Allow to recostruct selected points from source SALOME_Actor and map of subindexes
void
MapPoints(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex);
+ const TColStd_IndexedMapOfInteger& theMapIndex);
//! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes
void
MapEdge(SALOME_Actor* theMapActor,
- const TColStd_IndexedMapOfInteger& theMapIndex);
+ const TColStd_IndexedMapOfInteger& theMapIndex);
const TColStd_IndexedMapOfInteger&
GetMapIndex() const;
}
static void ChangeValues(vtkFloatingPointType* aArray1,
- vtkFloatingPointType* aArray2,
- vtkFloatingPointType *aRange1,
- vtkFloatingPointType* aRange2,
- bool theY)
+ vtkFloatingPointType* aArray2,
+ vtkFloatingPointType *aRange1,
+ vtkFloatingPointType* aRange2,
+ bool theY)
{
vtkFloatingPointType tmp=-1000;
if (!theY){
}
static void ChangeArrays(vtkFloatingPointType* xCoords,
- vtkFloatingPointType* yCoords,
- vtkFloatingPointType* zCoords,
- vtkFloatingPointType* xRange,
- vtkFloatingPointType* yRange,
- vtkFloatingPointType* zRange,
- const int xAxes,
- const int yAxes,
- const int zAxes)
+ vtkFloatingPointType* yCoords,
+ vtkFloatingPointType* zCoords,
+ vtkFloatingPointType* xRange,
+ vtkFloatingPointType* yRange,
+ vtkFloatingPointType* zRange,
+ const int xAxes,
+ const int yAxes,
+ const int zAxes)
{
if ( xAxes == 0 && yAxes == 2 && zAxes == 1)
ChangeValues(yCoords,zCoords,yRange,zRange,true);
// if xAxes=0 yAxes=1 zAxes=2 - good situation
if (!(xAxes == 0 && yAxes == 1 && zAxes == 2))
ChangeArrays(xCoords,yCoords,zCoords,
- xRange,yRange,zRange,
- xAxes,yAxes,zAxes);
+ xRange,yRange,zRange,
+ xAxes,yAxes,zAxes);
double aTScale[3];
if(m_Transform.GetPointer() != NULL)
}
void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor,
- const int theFont,
- const bool theIsBold,
- const bool theIsItalic,
- const bool theIsShadow)
+ const int theFont,
+ const bool theIsBold,
+ const bool theIsItalic,
+ const bool theIsShadow)
{
myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
}
Constructor
*/
SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName):
+ SVTK_ViewWindow* theParent,
+ const char* theName):
SVTK_DialogBase(theAction,
- theParent,
- theName),
+ theParent,
+ theName),
myMainWindow(theParent)
{
setWindowTitle(tr("CAPTION"));
public:
SVTK_CubeAxesDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName);
+ SVTK_ViewWindow* theParent,
+ const char* theName);
virtual ~SVTK_CubeAxesDlg();
void Update();
myIsResolveCoincidentTopology = true;
vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ myPolygonOffsetUnits);
myMapper = vtkDataSetMapper::New();
int numPts = aDataSet->GetNumberOfPoints();
//It's impossible to use to apply "shrink" for "empty" dataset
if (numCells < 1 || numPts < 1)
- return;
+ return;
myShrinkFilter->SetInput( aDataSet );
myPassFilter[ 1 ]->SetInput( myShrinkFilter->GetOutput() );
myIsShrunk = true;
void
SVTK_DeviceActor
::GetFeatureEdgesFlags(bool& theIsFeatureEdges,
- bool& theIsBoundaryEdges,
- bool& theIsManifoldEdges,
- bool& theIsNonManifoldEdges)
+ bool& theIsBoundaryEdges,
+ bool& theIsManifoldEdges,
+ bool& theIsNonManifoldEdges)
{
theIsFeatureEdges = myFeatureEdges->GetFeatureEdges();
theIsBoundaryEdges = myFeatureEdges->GetBoundaryEdges();
void
SVTK_DeviceActor
::SetFeatureEdgesFlags(bool theIsFeatureEdges,
- bool theIsBoundaryEdges,
- bool theIsManifoldEdges,
- bool theIsNonManifoldEdges)
+ bool theIsBoundaryEdges,
+ bool theIsManifoldEdges,
+ bool theIsNonManifoldEdges)
{
myFeatureEdges->SetFeatureEdges(theIsFeatureEdges);
myFeatureEdges->SetBoundaryEdges(theIsBoundaryEdges);
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ myPolygonOffsetUnits);
Superclass::Render(ren,m);
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit);
void
SVTK_DeviceActor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units)
+ vtkFloatingPointType units)
{
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
void
SVTK_DeviceActor
::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
- vtkFloatingPointType& units)
+ vtkFloatingPointType& units)
{
factor = myPolygonOffsetFactor;
units = myPolygonOffsetUnits;
virtual
void
GetFeatureEdgesFlags(bool& theIsFeatureEdges,
- bool& theIsBoundaryEdges,
- bool& theIsManifoldEdges,
- bool& theIsNonManifoldEdges);
+ bool& theIsBoundaryEdges,
+ bool& theIsManifoldEdges,
+ bool& theIsNonManifoldEdges);
virtual
void
SetFeatureEdgesFlags(bool theIsFeatureEdges,
- bool theIsBoundaryEdges,
- bool theIsManifoldEdges,
- bool theIsNonManifoldEdges);
+ bool theIsBoundaryEdges,
+ bool theIsManifoldEdges,
+ bool theIsNonManifoldEdges);
virtual
bool
vtkFloatingPointType myPolygonOffsetUnits;
void SetPolygonOffsetParameters(vtkFloatingPointType factor,
- vtkFloatingPointType units);
+ vtkFloatingPointType units);
void GetPolygonOffsetParameters(vtkFloatingPointType& factor,
- vtkFloatingPointType& units);
+ vtkFloatingPointType& units);
SVTK_DeviceActor();
~SVTK_DeviceActor();
*/
SVTK_DialogBase
::SVTK_DialogBase(QtxAction* theAction,
- QWidget* theParent,
- const char* theName,
- bool theModal,
- Qt::WindowFlags theWFalgs):
+ QWidget* theParent,
+ const char* theName,
+ bool theModal,
+ Qt::WindowFlags theWFalgs):
QDialog(theParent,
- theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
+ theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
myAction(theAction)
{
setObjectName(theName);
public:
SVTK_DialogBase(QtxAction* theAction,
- QWidget* theParent,
- const char* theName = "",
- bool theModal = FALSE,
- Qt::WindowFlags theWFalgs = 0);
+ QWidget* theParent,
+ const char* theName = "",
+ bool theModal = FALSE,
+ Qt::WindowFlags theWFalgs = 0);
~SVTK_DialogBase();
}
void SVTK_FontWidget::GetData( QColor& theColor,
- int& theFamily,
- bool& theBold,
- bool& theItalic,
- bool& theShadow ) const
+ int& theFamily,
+ bool& theBold,
+ bool& theItalic,
+ bool& theShadow ) const
{
theColor = GetColor();
//----------------------------------------------------------------------------
SVTK_ImageWriter
::SVTK_ImageWriter(QSemaphore* theSemaphore,
- vtkImageData* theImageData,
- const std::string& theName,
- int theProgressive,
- int theQuality):
+ vtkImageData* theImageData,
+ const std::string& theName,
+ int theProgressive,
+ int theQuality):
mySemaphore(theSemaphore),
myImageData(theImageData),
myName(theName),
myImageData->Delete();
if(MYDEBUG) cout<<"SVTK_ImageWriter::run "<<
- "- this = "<<this<<
- //"; total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
+ "- this = "<<this<<
+ //"; total = "<<mySemaphore->total()<<
+ "; available = "<<mySemaphore->available()<<endl;
mySemaphore->release();
}
{
public:
SVTK_ImageWriter(QSemaphore* theSemaphore,
- vtkImageData* theImageData,
- const std::string& theName,
- int theProgressive,
- int theQuality);
+ vtkImageData* theImageData,
+ const std::string& theName,
+ int theProgressive,
+ int theQuality);
~SVTK_ImageWriter();
mySemaphore = new QSemaphore(aMax);
mySemaphore->acquire( aMax );
if(MYDEBUG) cout<<"SVTK_ImageWriterMgr::SVTK_ImageWriterMgr "<<
- //"- total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
+ //"- total = "<<mySemaphore->total()<<
+ "; available = "<<mySemaphore->available()<<endl;
}
void
SVTK_ImageWriterMgr
::StartImageWriter(vtkImageData *theImageData,
- const std::string& theName,
- const int theProgressive,
- const int theQuality)
+ const std::string& theName,
+ const int theProgressive,
+ const int theQuality)
{
SVTK_ImageWriter *anImageWriter =
new SVTK_ImageWriter(mySemaphore,
- theImageData,
- theName,
- theProgressive,
- theQuality);
+ theImageData,
+ theName,
+ theProgressive,
+ theQuality);
myThreads.push_back(anImageWriter);
anImageWriter->start();
::Stop()
{
if(MYDEBUG) cout<<"SVTK_ImageWriterMgr::Stop "<<
- //"- total = "<<mySemaphore->total()<<
- "; available = "<<mySemaphore->available()<<endl;
+ //"- total = "<<mySemaphore->total()<<
+ "; available = "<<mySemaphore->available()<<endl;
if(MYDEBUG) cout<<"SVTK_ImageWriterMgr::Stop - *mySemaphore += "<<myThreads.size()<<endl;
mySemaphore->acquire( myThreads.size() );
void
StartImageWriter(vtkImageData *theImageData,
- const std::string& theName,
- const int theProgressive,
- const int theQuality);
+ const std::string& theName,
+ const int theProgressive,
+ const int theQuality);
void
Stop();
namespace
{
inline void GetEventPosition(vtkRenderWindowInteractor* theInteractor,
- int& theX,
- int& theY)
+ int& theX,
+ int& theY)
{
theInteractor->GetEventPosition(theX,theY);
theY = theInteractor->GetSize()[1] - theY - 1;
double ryf = double(dy) * aDeltaElevation * this->MotionFactor;
vtkMatrix4x4* aMatrix = cam->GetViewTransformMatrix();
const double anAxis[3] = {-aMatrix->GetElement(0,0), // mkr : 27.11.2006 : PAL14011 - Strange behaviour in rotation in VTK Viewer.
- -aMatrix->GetElement(0,1),
- -aMatrix->GetElement(0,2)};
+ -aMatrix->GetElement(0,1),
+ -aMatrix->GetElement(0,2)};
aTransform->RotateWXYZ(ryf, anAxis);
return;
double newAngle = atan2((double)(y - GetCurrentRenderer()->GetCenter()[1]),
- (double)(x - GetCurrentRenderer()->GetCenter()[0]));
+ (double)(x - GetCurrentRenderer()->GetCenter()[0]));
double oldAngle = atan2((double)(oldY -GetCurrentRenderer()->GetCenter()[1]),
- (double)(oldX - GetCurrentRenderer()->GetCenter()[0]));
+ (double)(oldX - GetCurrentRenderer()->GetCenter()[0]));
newAngle *= this->RadianToDegree;
oldAngle *= this->RadianToDegree;
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnMouseMove( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnLeftButtonDown( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnLeftButtonUp( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnMiddleButtonDown( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnMiddleButtonUp( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnRightButtonDown( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
int x, y;
GetEventPosition( this->Interactor, x, y );
this->OnRightButtonUp( this->Interactor->GetControlKey(),
- this->Interactor->GetShiftKey(),
- x, y );
+ this->Interactor->GetShiftKey(),
+ x, y );
}
/*!
To handle mouse move event
*/
void SVTK_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl),
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
myShiftState = shift;
if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE)
To handle left mouse button down event (reimplemented from vtkInteractorStyle)
*/
void SVTK_InteractorStyle::OnLeftButtonDown(int ctrl, int shift,
- int x, int y)
+ int x, int y)
{
this->FindPokedRenderer(x, y);
if(GetCurrentRenderer() == NULL)
if (ctrl)
startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
else if ( myCurrRotationPointType == SVTK::StartPointSelection ||
- myCurrFocalPointType == SVTK::StartFocalPointSelection )
+ myCurrFocalPointType == SVTK::StartFocalPointSelection )
{
SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
if ( anActor )
{
- myPointPicker->Pick( aSelectionEvent->myX,
- aSelectionEvent->myY,
- 0.0,
- GetCurrentRenderer() );
- int aVtkId = myPointPicker->GetPointId();
- if ( aVtkId >= 0 )
- {
- int anObjId = anActor->GetNodeObjId( aVtkId );
- vtkFloatingPointType* aCoords = anActor->GetNodeCoord(anObjId);
-
- if (myCurrRotationPointType == SVTK::StartPointSelection) {
- myCurrRotationPointType = SVTK::SetRotateSelected;
-
- // invoke event for update coordinates in SVTK_SetRotationPointDlg
- InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
- }
- else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
- myCurrFocalPointType = SVTK::SetFocalPointSelected;
-
- // invoke event for update coordinates in SVTK_ViewParameterDlg
- InvokeEvent(SVTK::FocalPointChanged,(void*)aCoords);
- }
- }
- else
- {
- if (myCurrRotationPointType == SVTK::StartPointSelection) {
- // invoke event with no data (for SVTK_SetRotationPointDlg)
- InvokeEvent(SVTK::RotationPointChanged,0);
- myCurrRotationPointType = myPrevRotationPointType;
- }
- else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
- // invoke event with no data (for SVTK_ViewParameterDlg)
- InvokeEvent(SVTK::FocalPointChanged,0);
- myCurrFocalPointType = myPrevFocalPointType;
- }
- }
+ myPointPicker->Pick( aSelectionEvent->myX,
+ aSelectionEvent->myY,
+ 0.0,
+ GetCurrentRenderer() );
+ int aVtkId = myPointPicker->GetPointId();
+ if ( aVtkId >= 0 )
+ {
+ int anObjId = anActor->GetNodeObjId( aVtkId );
+ vtkFloatingPointType* aCoords = anActor->GetNodeCoord(anObjId);
+
+ if (myCurrRotationPointType == SVTK::StartPointSelection) {
+ myCurrRotationPointType = SVTK::SetRotateSelected;
+
+ // invoke event for update coordinates in SVTK_SetRotationPointDlg
+ InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords);
+ }
+ else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+ myCurrFocalPointType = SVTK::SetFocalPointSelected;
+
+ // invoke event for update coordinates in SVTK_ViewParameterDlg
+ InvokeEvent(SVTK::FocalPointChanged,(void*)aCoords);
+ }
+ }
+ else
+ {
+ if (myCurrRotationPointType == SVTK::StartPointSelection) {
+ // invoke event with no data (for SVTK_SetRotationPointDlg)
+ InvokeEvent(SVTK::RotationPointChanged,0);
+ myCurrRotationPointType = myPrevRotationPointType;
+ }
+ else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+ // invoke event with no data (for SVTK_ViewParameterDlg)
+ InvokeEvent(SVTK::FocalPointChanged,0);
+ myCurrFocalPointType = myPrevFocalPointType;
+ }
+ }
}
else
{
- if (myCurrRotationPointType == SVTK::StartPointSelection) {
- // invoke event with no data (for SVTK_SetRotationPointDlg)
- InvokeEvent(SVTK::RotationPointChanged,0);
- myCurrRotationPointType = myPrevRotationPointType;
- }
- else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
- // invoke event with no data (for SVTK_ViewParameterDlg)
- InvokeEvent(SVTK::FocalPointChanged,0);
- myCurrFocalPointType = myPrevFocalPointType;
- }
+ if (myCurrRotationPointType == SVTK::StartPointSelection) {
+ // invoke event with no data (for SVTK_SetRotationPointDlg)
+ InvokeEvent(SVTK::RotationPointChanged,0);
+ myCurrRotationPointType = myPrevRotationPointType;
+ }
+ else if (myCurrFocalPointType == SVTK::StartFocalPointSelection) {
+ // invoke event with no data (for SVTK_ViewParameterDlg)
+ InvokeEvent(SVTK::FocalPointChanged,0);
+ myCurrFocalPointType = myPrevFocalPointType;
+ }
}
myHighlightSelectionPointActor->SetVisibility( false );
if(GetCurrentRenderer() != NULL)
- GetCurrentRenderer()->RemoveActor( myHighlightSelectionPointActor.GetPointer() );
+ GetCurrentRenderer()->RemoveActor( myHighlightSelectionPointActor.GetPointer() );
GetRenderWidget()->setCursor(myDefCursor);
}
To handle left mouse button up event (reimplemented from vtkInteractorStyle)
*/
void SVTK_InteractorStyle::OnLeftButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
{
myShiftState = shift;
// finishing current viewer operation
To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
*/
void SVTK_InteractorStyle::OnMiddleButtonDown(int ctrl,
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
this->FindPokedRenderer(x, y);
if(GetCurrentRenderer() == NULL)
To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
*/
void SVTK_InteractorStyle::OnMiddleButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
{
myShiftState = shift;
// finishing current viewer operation
To handle right mouse button down event (reimplemented from vtkInteractorStyle)
*/
void SVTK_InteractorStyle::OnRightButtonDown(int ctrl,
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
this->FindPokedRenderer(x, y);
if(GetCurrentRenderer() == NULL)
To handle right mouse button up event (reimplemented from vtkInteractorStyle)
*/
void SVTK_InteractorStyle::OnRightButtonUp(int vtkNotUsed(ctrl),
- int shift,
- int vtkNotUsed(x),
- int vtkNotUsed(y))
+ int shift,
+ int vtkNotUsed(x),
+ int vtkNotUsed(y))
{
myShiftState = shift;
// finishing current viewer operation
vtkFloatingPointType aColor[3];
GetCurrentRenderer()->GetBackground( aColor );
myHighlightSelectionPointActor->GetProperty()->SetColor(1. - aColor[0],
- 1. - aColor[1],
- 1. - aColor[2]);
+ 1. - aColor[1],
+ 1. - aColor[2]);
}
setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
vtkFloatingPointType aColor[3];
GetCurrentRenderer()->GetBackground( aColor );
myHighlightSelectionPointActor->GetProperty()->SetColor(1. - aColor[0],
- 1. - aColor[1],
- 1. - aColor[2]);
+ 1. - aColor[1],
+ 1. - aColor[2]);
}
setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE);
Fits viewer contents to rect
*/
void SVTK_InteractorStyle::fitRect(const int left,
- const int top,
- const int right,
- const int bottom)
+ const int top,
+ const int right,
+ const int bottom)
{
if (GetCurrentRenderer() == NULL)
return;
case VTK_INTERACTOR_STYLE_CAMERA_NONE:
default:
if ( myCurrRotationPointType == SVTK::StartPointSelection ||
- myCurrFocalPointType == SVTK::StartFocalPointSelection )
- GetRenderWidget()->setCursor(myHandCursor);
+ myCurrFocalPointType == SVTK::StartFocalPointSelection )
+ GetRenderWidget()->setCursor(myHandCursor);
else
- GetRenderWidget()->setCursor(myDefCursor);
+ GetRenderWidget()->setCursor(myDefCursor);
myCursorState = false;
break;
}
}
else {
if (myPoint == myOtherPoint)
- {
- // process point selection
- this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY);
- Interactor->StartPickCallback();
-
- SALOME_Actor* anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
-
- aSelectionEvent->myIsRectangle = false;
-
- if(!myShiftState)
- GetSelector()->ClearIObjects();
-
- if(anActor)
- {
- anActor->Highlight( this, aSelectionEvent, true );
- }
- else
- {
- if(myLastHighlitedActor.GetPointer() && myLastHighlitedActor.GetPointer() != anActor)
- myLastHighlitedActor->Highlight( this, aSelectionEvent, false );
- }
- myLastHighlitedActor = anActor;
- }
- else
- {
- //processing rectangle selection
- Interactor->StartPickCallback();
- GetSelector()->StartPickCallback();
- aSelectionEvent->myIsRectangle = true;
-
- if(!myShiftState)
- GetSelector()->ClearIObjects();
-
- VTK::ActorCollectionCopy aCopy(GetCurrentRenderer()->GetActors());
- vtkActorCollection* aListActors = aCopy.GetActors();
- aListActors->InitTraversal();
- while(vtkActor* aActor = aListActors->GetNextActor())
- {
- if(aActor->GetVisibility())
- {
- if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor))
- {
- if(aSActor->hasIO())
- aSActor->Highlight( this, aSelectionEvent, true );
- }
- }
- }
- }
- Interactor->EndPickCallback();
- GetSelector()->EndPickCallback();
+ {
+ // process point selection
+ this->FindPokedRenderer(aSelectionEvent->myX, aSelectionEvent->myY);
+ Interactor->StartPickCallback();
+
+ SALOME_Actor* anActor = GetSelector()->Pick(aSelectionEvent, GetCurrentRenderer());
+
+ aSelectionEvent->myIsRectangle = false;
+
+ if(!myShiftState)
+ GetSelector()->ClearIObjects();
+
+ if(anActor)
+ {
+ anActor->Highlight( this, aSelectionEvent, true );
+ }
+ else
+ {
+ if(myLastHighlitedActor.GetPointer() && myLastHighlitedActor.GetPointer() != anActor)
+ myLastHighlitedActor->Highlight( this, aSelectionEvent, false );
+ }
+ myLastHighlitedActor = anActor;
+ }
+ else
+ {
+ //processing rectangle selection
+ Interactor->StartPickCallback();
+ GetSelector()->StartPickCallback();
+ aSelectionEvent->myIsRectangle = true;
+
+ if(!myShiftState)
+ GetSelector()->ClearIObjects();
+
+ VTK::ActorCollectionCopy aCopy(GetCurrentRenderer()->GetActors());
+ vtkActorCollection* aListActors = aCopy.GetActors();
+ aListActors->InitTraversal();
+ while(vtkActor* aActor = aListActors->GetNextActor())
+ {
+ if(aActor->GetVisibility())
+ {
+ if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor))
+ {
+ if(aSActor->hasIO())
+ aSActor->Highlight( this, aSelectionEvent, true );
+ }
+ }
+ }
+ }
+ Interactor->EndPickCallback();
+ GetSelector()->EndPickCallback();
}
}
break;
myPointPicker->Pick( aSelectionEvent->myX, aSelectionEvent->myY, 0.0, GetCurrentRenderer() );
int aVtkId = myPointPicker->GetPointId();
if ( aVtkId >= 0 ) {
- int anObjId = anActor->GetNodeObjId( aVtkId );
+ int anObjId = anActor->GetNodeObjId( aVtkId );
- TColStd_IndexedMapOfInteger aMapIndex;
- aMapIndex.Add( anObjId );
- myHighlightSelectionPointActor->MapPoints( anActor, aMapIndex );
+ TColStd_IndexedMapOfInteger aMapIndex;
+ aMapIndex.Add( anObjId );
+ myHighlightSelectionPointActor->MapPoints( anActor, aMapIndex );
- myHighlightSelectionPointActor->SetVisibility( true );
- anIsChanged = true;
+ myHighlightSelectionPointActor->SetVisibility( true );
+ anIsChanged = true;
}
}
}
cam->GetFocalPoint(viewFocus);
this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1],
- viewFocus[2], viewFocus);
+ viewFocus[2], viewFocus);
focalDepth = viewFocus[2];
this->ComputeDisplayToWorld(double(toX), double(toY),
- focalDepth, newPickPoint);
+ focalDepth, newPickPoint);
this->ComputeDisplayToWorld(double(fromX),double(fromY),
- focalDepth, oldPickPoint);
+ focalDepth, oldPickPoint);
// camera motion is reversed
motionVector[0] = oldPickPoint[0] - newPickPoint[0];
cam->GetFocalPoint(viewFocus);
cam->GetPosition(viewPoint);
cam->SetFocalPoint(motionVector[0] + viewFocus[0],
- motionVector[1] + viewFocus[1],
- motionVector[2] + viewFocus[2]);
+ motionVector[1] + viewFocus[1],
+ motionVector[2] + viewFocus[2]);
cam->SetPosition(motionVector[0] + viewPoint[0],
- motionVector[1] + viewPoint[1],
- motionVector[2] + viewPoint[2]);
+ motionVector[1] + viewPoint[1],
+ motionVector[2] + viewPoint[2]);
}
void SVTK_InteractorStyle::IncrementalPan( const int incrX, const int incrY )
{
if ( !myBBFirstCheck )
{
- if ( fabs(aCurrBBCenter[0]-myBBCenter[0]) > 1e-38 ||
- fabs(aCurrBBCenter[1]-myBBCenter[1]) > 1e-38 ||
- fabs(aCurrBBCenter[2]-myBBCenter[2]) > 1e-38 ) {
- // bounding box was changed => send SVTK::RotationPointChanged event
- // invoke event for update coordinates in SVTK_SetRotationPointDlg
- InvokeEvent(SVTK::BBCenterChanged,(void*)aCurrBBCenter);
- for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
- }
+ if ( fabs(aCurrBBCenter[0]-myBBCenter[0]) > 1e-38 ||
+ fabs(aCurrBBCenter[1]-myBBCenter[1]) > 1e-38 ||
+ fabs(aCurrBBCenter[2]-myBBCenter[2]) > 1e-38 ) {
+ // bounding box was changed => send SVTK::RotationPointChanged event
+ // invoke event for update coordinates in SVTK_SetRotationPointDlg
+ InvokeEvent(SVTK::BBCenterChanged,(void*)aCurrBBCenter);
+ for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
+ }
}
else
{
- for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
- myBBFirstCheck = false;
+ for ( int i =0; i < 3; i++) myBBCenter[i] = aCurrBBCenter[i];
+ myBBFirstCheck = false;
}
}
}
Main process event method (reimplemented from #vtkInteractorStyle)
*/
void SVTK_InteractorStyle::ProcessEvents( vtkObject* object,
- unsigned long event,
- void* clientData,
- void* callData )
+ unsigned long event,
+ void* clientData,
+ void* callData )
{
if ( clientData ) {
vtkObject* anObject = reinterpret_cast<vtkObject*>( clientData );
if ( self ) {
switch ( event ) {
case SVTK::SpaceMouseMoveEvent :
- self->onSpaceMouseMove( (double*)callData );
- return;
+ self->onSpaceMouseMove( (double*)callData );
+ return;
case SVTK::SpaceMouseButtonEvent :
- self->onSpaceMouseButton( *((int*)callData) );
- return;
+ self->onSpaceMouseButton( *((int*)callData) );
+ return;
case SVTK::PanLeftEvent:
- self->IncrementalPan(-aSpeedIncrement, 0);
- return;
+ self->IncrementalPan(-aSpeedIncrement, 0);
+ return;
case SVTK::PanRightEvent:
- self->IncrementalPan(aSpeedIncrement, 0);
- return;
+ self->IncrementalPan(aSpeedIncrement, 0);
+ return;
case SVTK::PanUpEvent:
- self->IncrementalPan(0, aSpeedIncrement);
- return;
+ self->IncrementalPan(0, aSpeedIncrement);
+ return;
case SVTK::PanDownEvent:
- self->IncrementalPan(0, -aSpeedIncrement);
- return;
+ self->IncrementalPan(0, -aSpeedIncrement);
+ return;
case SVTK::ZoomInEvent:
- self->IncrementalZoom(aSpeedIncrement);
- return;
+ self->IncrementalZoom(aSpeedIncrement);
+ return;
case SVTK::ZoomOutEvent:
- self->IncrementalZoom(-aSpeedIncrement);
- return;
+ self->IncrementalZoom(-aSpeedIncrement);
+ return;
case SVTK::RotateLeftEvent:
- self->IncrementalRotate(-aSpeedIncrement, 0);
- return;
+ self->IncrementalRotate(-aSpeedIncrement, 0);
+ return;
case SVTK::RotateRightEvent:
- self->IncrementalRotate(aSpeedIncrement, 0);
- return;
+ self->IncrementalRotate(aSpeedIncrement, 0);
+ return;
case SVTK::RotateUpEvent:
- self->IncrementalRotate(0, -aSpeedIncrement);
- return;
+ self->IncrementalRotate(0, -aSpeedIncrement);
+ return;
case SVTK::RotateDownEvent:
- self->IncrementalRotate(0, aSpeedIncrement);
- return;
+ self->IncrementalRotate(0, aSpeedIncrement);
+ return;
case SVTK::PlusSpeedIncrementEvent:
- self->ControllerIncrement()->Increase();
- return;
+ self->ControllerIncrement()->Increase();
+ return;
case SVTK::MinusSpeedIncrementEvent:
- self->ControllerIncrement()->Decrease();
- return;
+ self->ControllerIncrement()->Decrease();
+ return;
case SVTK::SetSpeedIncrementEvent:
- self->ControllerIncrement()->SetStartValue(*((int*)callData));
- return;
+ self->ControllerIncrement()->SetStartValue(*((int*)callData));
+ return;
case SVTK::SetSMDecreaseSpeedEvent:
- self->mySMDecreaseSpeedBtn = *((int*)callData);
- return;
+ self->mySMDecreaseSpeedBtn = *((int*)callData);
+ return;
case SVTK::SetSMIncreaseSpeedEvent:
- self->mySMIncreaseSpeedBtn = *((int*)callData);
- return;
+ self->mySMIncreaseSpeedBtn = *((int*)callData);
+ return;
case SVTK::SetSMDominantCombinedSwitchEvent:
- self->mySMDominantCombinedSwitchBtn = *((int*)callData);
- return;
+ self->mySMDominantCombinedSwitchBtn = *((int*)callData);
+ return;
case SVTK::StartZoom:
- self->startZoom();
- return;
+ self->startZoom();
+ return;
case SVTK::StartPan:
- self->startPan();
- return;
+ self->startPan();
+ return;
case SVTK::StartRotate:
- self->startRotate();
- return;
+ self->startRotate();
+ return;
case SVTK::StartGlobalPan:
- self->startGlobalPan();
- return;
+ self->startGlobalPan();
+ return;
case SVTK::StartFitArea:
- self->startFitArea();
- return;
+ self->startFitArea();
+ return;
case SVTK::SetRotateGravity:
- if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
- {
- self->myHighlightSelectionPointActor->SetVisibility( false );
- if( self->GetCurrentRenderer() != NULL )
- self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
- self->GetRenderWidget()->setCursor(self->myDefCursor);
- }
- self->myPrevRotationPointType = self->myCurrRotationPointType;
- self->myCurrRotationPointType = SVTK::SetRotateGravity;
- if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) )
- // invoke event for update coordinates in SVTK_SetRotationPointDlg
- self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
- return;
+ if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
+ {
+ self->myHighlightSelectionPointActor->SetVisibility( false );
+ if( self->GetCurrentRenderer() != NULL )
+ self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+ self->GetRenderWidget()->setCursor(self->myDefCursor);
+ }
+ self->myPrevRotationPointType = self->myCurrRotationPointType;
+ self->myCurrRotationPointType = SVTK::SetRotateGravity;
+ if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) )
+ // invoke event for update coordinates in SVTK_SetRotationPointDlg
+ self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
+ return;
case SVTK::StartPointSelection:
- self->startPointSelection();
- return;
+ self->startPointSelection();
+ return;
case SVTK::ChangeRotationPoint:
- if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
- {
- self->myHighlightSelectionPointActor->SetVisibility( false );
- if( self->GetCurrentRenderer() != NULL )
- self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
- self->GetRenderWidget()->setCursor(self->myDefCursor);
- }
- self->myPrevRotationPointType = self->myCurrRotationPointType;
- self->myCurrRotationPointType = SVTK::SetRotateSelected;
- aSelectedPoint = (vtkFloatingPointType*)callData;
- self->myRotationPointX = aSelectedPoint[0];
- self->myRotationPointY = aSelectedPoint[1];
- self->myRotationPointZ = aSelectedPoint[2];
- return;
+ if ( self->myCurrRotationPointType == SVTK::StartPointSelection )
+ {
+ self->myHighlightSelectionPointActor->SetVisibility( false );
+ if( self->GetCurrentRenderer() != NULL )
+ self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+ self->GetRenderWidget()->setCursor(self->myDefCursor);
+ }
+ self->myPrevRotationPointType = self->myCurrRotationPointType;
+ self->myCurrRotationPointType = SVTK::SetRotateSelected;
+ aSelectedPoint = (vtkFloatingPointType*)callData;
+ self->myRotationPointX = aSelectedPoint[0];
+ self->myRotationPointY = aSelectedPoint[1];
+ self->myRotationPointZ = aSelectedPoint[2];
+ return;
case SVTK::SetFocalPointGravity:
- if ( self->myCurrFocalPointType == SVTK::StartPointSelection )
- {
- self->myHighlightSelectionPointActor->SetVisibility( false );
- if( self->GetCurrentRenderer() != NULL )
- self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
- self->GetRenderWidget()->setCursor(self->myDefCursor);
- }
- self->myCurrFocalPointType = SVTK::SetFocalPointGravity;
- if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) {
- // invoke event for update coordinates in SVTK_ViewParameterDlg
- self->InvokeEvent(SVTK::FocalPointChanged,(void*)aCenter);
- }
- return;
+ if ( self->myCurrFocalPointType == SVTK::StartPointSelection )
+ {
+ self->myHighlightSelectionPointActor->SetVisibility( false );
+ if( self->GetCurrentRenderer() != NULL )
+ self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+ self->GetRenderWidget()->setCursor(self->myDefCursor);
+ }
+ self->myCurrFocalPointType = SVTK::SetFocalPointGravity;
+ if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) {
+ // invoke event for update coordinates in SVTK_ViewParameterDlg
+ self->InvokeEvent(SVTK::FocalPointChanged,(void*)aCenter);
+ }
+ return;
case SVTK::StartFocalPointSelection:
- self->startFocalPointSelection();
- return;
+ self->startFocalPointSelection();
+ return;
case SVTK::SetFocalPointSelected:
- if ( self->myCurrFocalPointType == SVTK::StartFocalPointSelection )
- {
- self->myHighlightSelectionPointActor->SetVisibility( false );
- if( self->GetCurrentRenderer() != NULL )
- self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
- self->GetRenderWidget()->setCursor(self->myDefCursor);
- }
- self->myPrevFocalPointType = self->myCurrFocalPointType;
- self->myCurrFocalPointType = SVTK::SetFocalPointSelected;
- return;
+ if ( self->myCurrFocalPointType == SVTK::StartFocalPointSelection )
+ {
+ self->myHighlightSelectionPointActor->SetVisibility( false );
+ if( self->GetCurrentRenderer() != NULL )
+ self->GetCurrentRenderer()->RemoveActor( self->myHighlightSelectionPointActor.GetPointer() );
+ self->GetRenderWidget()->setCursor(self->myDefCursor);
+ }
+ self->myPrevFocalPointType = self->myCurrFocalPointType;
+ self->myCurrFocalPointType = SVTK::SetFocalPointSelected;
+ return;
}
}
}
static
void
ProcessEvents(vtkObject* object,
- unsigned long event,
- void* clientData,
- void* callData );
+ unsigned long event,
+ void* clientData,
+ void* callData );
float MotionFactor;
float RadianToDegree; // constant: for conv from deg to rad
//----------------------------------------------------------------------------
void SVTK_KeyFreeInteractorStyle::OnLeftButtonDown(int ctrl, int shift,
- int x, int y)
+ int x, int y)
{
myIsLeftButtonDown = true;
else {
if (!(ctrl||shift)){
if (myIsMidButtonDown){
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
}
else{
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
}
}
}
//----------------------------------------------------------------------------
void SVTK_KeyFreeInteractorStyle::OnMiddleButtonDown(int ctrl,
- int shift,
- int x, int y)
+ int shift,
+ int x, int y)
{
myIsMidButtonDown = true;
else {
if (!(ctrl||shift)){
if ( myIsLeftButtonDown ){
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
}
else{
- startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
+ startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
}
}
}
*/
SVTK_NonIsometricDlg
::SVTK_NonIsometricDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName):
+ SVTK_ViewWindow* theParent,
+ const char* theName):
SVTK_DialogBase(theAction,
- theParent,
- theName),
+ theParent,
+ theName),
m_MainWindow(theParent)
{
setWindowTitle(tr("DLG_TITLE"));
public:
SVTK_NonIsometricDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName);
+ SVTK_ViewWindow* theParent,
+ const char* theName);
~SVTK_NonIsometricDlg();
inline
void
GetNameJPEG(const std::string& thePreffix,
- const int theIndex,
- std::string& theName)
+ const int theIndex,
+ std::string& theName)
{
using namespace std;
ostringstream aStream;
void
SVTK_Recorder
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* vtkNotUsed(theCallData))
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
{
if(vtkObject* anObj = reinterpret_cast<vtkObject*>(theClientData)){
if(SVTK_Recorder* aSelf = dynamic_cast<SVTK_Recorder*>(anObj)){
if(theEvent==vtkCommand::EndEvent){
- if(aSelf->State() == SVTK_Recorder::SVTK_Recorder_Record){
- aSelf->DoRecord();
- }
+ if(aSelf->State() == SVTK_Recorder::SVTK_Recorder_Record){
+ aSelf->DoRecord();
+ }
}
}
}
inline
int
GetFrameIndex(double theStartTime,
- double theFPS)
+ double theFPS)
{
double aTimeNow = vtkTimerLog::GetCurrentTime();
double aDelta = aTimeNow - theStartTime;
myFrameIndexes.back() = abs(myFrameIndexes.back());
double aPauseTime = fabs((double)(aFrameIndex - myFrameIndex - 1)) / myNbFPS;
if(MYDEBUG)
- cout<<"SVTK_Recorder::DoRecord - aFrameIndex = "<<aFrameIndex<<
- "; aPauseTime = "<<aPauseTime<<endl;
+ cout<<"SVTK_Recorder::DoRecord - aFrameIndex = "<<aFrameIndex<<
+ "; aPauseTime = "<<aPauseTime<<endl;
myTimeStart += aPauseTime;
}
anImageData->UpdateInformation();
int *anExtent = anImageData->GetWholeExtent();
anImageData->SetUpdateExtent(anExtent[0], anExtent[1],
- anExtent[2], anExtent[3],
- 0,0);
+ anExtent[2], anExtent[3],
+ 0,0);
anImageData->UpdateData();
}
GetNameJPEG(myName,anIndex,anCurrentName);
aStream<<"ln -s "<< anInitialName<<" "<<anCurrentName<<";";
if(anIndex + 1 < aFinishIndex)
- aStream<<" \\";
+ aStream<<" \\";
aStream<<endl;
}
std::string aString(aStream.str());
static
void
ProcessEvents(vtkObject* theObject,
- unsigned long theEvent,
- void* theClientData,
- void* theCallData);
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData);
protected :
int myState;
if (app)
app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName);
else {
- QString platform;
+ QString platform;
#ifdef WIN32
- platform = "winapplication";
+ platform = "winapplication";
#else
- platform = "application";
+ platform = "application";
#endif
SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
- QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+ QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
}
*/
}
aFilter.append( tr( "FLT_ALL_FILES" ) );
QString aFileName = SUIT_FileDlg::getFileName( this, getenv( "HOME" ), aFilter,
- tr( "FILE_NAME" ), false );
+ tr( "FILE_NAME" ), false );
if( aFileName.isNull() )
return false;
inline
int
Check(float* theZPtr,
- int theSelection[4],
- vtkFloatingPointType theTolerance,
- vtkFloatingPointType theDZ,
- int theDX,
- int theDY)
+ int theSelection[4],
+ vtkFloatingPointType theTolerance,
+ vtkFloatingPointType theDZ,
+ int theDX,
+ int theDY)
{
int aRet = 0;
vtkFloatingPointType aZ = -1.0;
// the selection window.
aZ = GetZ(theZPtr,theSelection,theDX,theDY);
if(aZ > theTolerance && aZ < 1.0 - theTolerance){
- aRet = fabs(aZ - theDZ) <= theTolerance;
+ aRet = fabs(aZ - theDZ) <= theTolerance;
}
}
//----------------------------------------------------------------------------
void
SelectVisiblePoints(int theSelection[4],
- vtkRenderer *theRenderer,
- vtkDataSet *theInput,
- SVTK_RectPicker::TVectorIds& theVisibleIds,
- SVTK_RectPicker::TVectorIds& theInVisibleIds,
- vtkFloatingPointType theTolerance)
+ vtkRenderer *theRenderer,
+ vtkDataSet *theInput,
+ SVTK_RectPicker::TVectorIds& theVisibleIds,
+ SVTK_RectPicker::TVectorIds& theInVisibleIds,
+ vtkFloatingPointType theTolerance)
{
theVisibleIds.clear();
theInVisibleIds.clear();
// and handle the transformation ourselves.
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
aMatrix->DeepCopy( theRenderer->GetActiveCamera()->
- GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) );
+ GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) );
// We grab the z-buffer for the selection region all at once and probe the resulting array.
float *aZPtr = theRenderer->GetRenderWindow()->
for(int iY = theSelection[1]; iY <= theSelection[3]; iY++){
//cout<<iY<<"\t";
for(int iX = theSelection[0]; iX <= theSelection[2]; iX++){
- //cout<<std::setprecision(4)<<GetZ(aZPtr,theSelection,iX,iY)<<"\t";
+ //cout<<std::setprecision(4)<<GetZ(aZPtr,theSelection,iX,iY)<<"\t";
}
//cout<<endl;
}
vtkFloatingPointType aView[4];
aMatrix->MultiplyPoint(aX,aView);
if(aView[3] == 0.0)
- continue;
+ continue;
theRenderer->SetViewPoint(aView[0]/aView[3],
- aView[1]/aView[3],
- aView[2]/aView[3]);
+ aView[1]/aView[3],
+ aView[2]/aView[3]);
theRenderer->ViewToDisplay();
vtkFloatingPointType aDX[3];
if(aDX[0] >= theSelection[0] && aDX[0] <= theSelection[2] &&
aDX[1] >= theSelection[1] && aDX[1] <= theSelection[3])
{
- //cout<<"aPntId "<<aPntId<<"; aDX = {"<<aDX[0]<<", "<<aDX[1]<<", "<<aDX[2]<<"}\n";
- int aDX0 = int(aDX[0]);
- int aDX1 = int(aDX[1]);
-
- int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aDX0,aDX1);
- if(aRet > 0)
- goto ADD_VISIBLE;
- if(aRet < 0)
- goto ADD_INVISIBLE;
-
- static int aMaxRadius = 5;
- for(int aRadius = 1; aRadius < aMaxRadius; aRadius++){
- int aStartDX[2] = {aDX0 - aRadius, aDX1 - aRadius};
- for(int i = 0; i <= aRadius; i++){
- int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0]++,aStartDX[1]);
- if(aRet > 0)
- goto ADD_VISIBLE;
- if(aRet < 0)
- goto ADD_INVISIBLE;
- }
- for(int i = 0; i <= aRadius; i++){
- int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0],aStartDX[1]++);
- if(aRet > 0)
- goto ADD_VISIBLE;
- if(aRet < 0)
- goto ADD_INVISIBLE;
- }
- for(int i = 0; i <= aRadius; i++){
- int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0]--,aStartDX[1]);
- if(aRet > 0)
- goto ADD_VISIBLE;
- if(aRet < 0)
- goto ADD_INVISIBLE;
- }
- for(int i = 0; i <= aRadius; i++){
- int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0],aStartDX[1]--);
- if(aRet > 0)
- goto ADD_VISIBLE;
- if(aRet < 0)
- goto ADD_INVISIBLE;
- }
- }
- if(false)
- ADD_VISIBLE : theVisibleIds.push_back(aPntId);
- if(false)
- ADD_INVISIBLE : theInVisibleIds.push_back(aPntId);
+ //cout<<"aPntId "<<aPntId<<"; aDX = {"<<aDX[0]<<", "<<aDX[1]<<", "<<aDX[2]<<"}\n";
+ int aDX0 = int(aDX[0]);
+ int aDX1 = int(aDX[1]);
+
+ int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aDX0,aDX1);
+ if(aRet > 0)
+ goto ADD_VISIBLE;
+ if(aRet < 0)
+ goto ADD_INVISIBLE;
+
+ static int aMaxRadius = 5;
+ for(int aRadius = 1; aRadius < aMaxRadius; aRadius++){
+ int aStartDX[2] = {aDX0 - aRadius, aDX1 - aRadius};
+ for(int i = 0; i <= aRadius; i++){
+ int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0]++,aStartDX[1]);
+ if(aRet > 0)
+ goto ADD_VISIBLE;
+ if(aRet < 0)
+ goto ADD_INVISIBLE;
+ }
+ for(int i = 0; i <= aRadius; i++){
+ int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0],aStartDX[1]++);
+ if(aRet > 0)
+ goto ADD_VISIBLE;
+ if(aRet < 0)
+ goto ADD_INVISIBLE;
+ }
+ for(int i = 0; i <= aRadius; i++){
+ int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0]--,aStartDX[1]);
+ if(aRet > 0)
+ goto ADD_VISIBLE;
+ if(aRet < 0)
+ goto ADD_INVISIBLE;
+ }
+ for(int i = 0; i <= aRadius; i++){
+ int aRet = Check(aZPtr,theSelection,theTolerance,aDX[2],aStartDX[0],aStartDX[1]--);
+ if(aRet > 0)
+ goto ADD_VISIBLE;
+ if(aRet < 0)
+ goto ADD_INVISIBLE;
+ }
+ }
+ if(false)
+ ADD_VISIBLE : theVisibleIds.push_back(aPntId);
+ if(false)
+ ADD_INVISIBLE : theInVisibleIds.push_back(aPntId);
}
}//for all points
inline
void
GetCenter(const vtkFloatingPointType theBounds[6],
- vtkFloatingPointType theCenter[3])
+ vtkFloatingPointType theCenter[3])
{
theCenter[0] = (theBounds[1] + theBounds[0]) / 2.0;
theCenter[1] = (theBounds[3] + theBounds[2]) / 2.0;
void
SelectVisibleCells(int theSelection[4],
- vtkRenderer *theRenderer,
- vtkDataSet *theInput,
- SVTK_RectPicker::TVectorIds& theVectorIds,
- vtkFloatingPointType theTolerance)
+ vtkRenderer *theRenderer,
+ vtkDataSet *theInput,
+ SVTK_RectPicker::TVectorIds& theVectorIds,
+ vtkFloatingPointType theTolerance)
{
theVectorIds.clear();
SVTK_RectPicker::TVectorIds aVisiblePntIds;
SVTK_RectPicker::TVectorIds anInVisiblePntIds;
SelectVisiblePoints(theSelection,
- theRenderer,
- theInput,
- aVisiblePntIds,
- anInVisiblePntIds,
- theTolerance);
+ theRenderer,
+ theInput,
+ aVisiblePntIds,
+ anInVisiblePntIds,
+ theTolerance);
typedef std::set<vtkIdType> TIdsSet;
TIdsSet aVisibleIds(aVisiblePntIds.begin(),aVisiblePntIds.end());
// and handle the transformation ourselves.
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
aMatrix->DeepCopy(theRenderer->GetActiveCamera()->
- GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) );
+ GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) );
for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){
vtkCell* aCell = theInput->GetCell(aCellId);
aMatrix->MultiplyPoint(aX,aView);
if(aView[3] == 0.0)
- continue;
+ continue;
theRenderer->SetViewPoint(aView[0]/aView[3],
- aView[1]/aView[3],
- aView[2]/aView[3]);
+ aView[1]/aView[3],
+ aView[2]/aView[3]);
theRenderer->ViewToDisplay();
vtkFloatingPointType aDX[3];
aDX[1] >= theSelection[1] && aDX[1] <= theSelection[3])
{
- //cout<<"aCellId = "<<aCellId<<": ";
- vtkIdType aNumPts = aCell->GetNumberOfPoints();
- bool anIsVisible = true;
- for(vtkIdType anId = 0; anId < aNumPts; anId++){
- vtkIdType aPntId = aCell->GetPointId(anId);
- //cout<<aPntId<<"; ";
- anIsVisible = aVisibleIds.find(aPntId) != aVisibleIds.end();
- if(!anIsVisible)
- break;
- }
- //cout<<"\t"<<anIsVisible<<"\n";
- if(anIsVisible)
- theVectorIds.push_back(aCellId);
+ //cout<<"aCellId = "<<aCellId<<": ";
+ vtkIdType aNumPts = aCell->GetNumberOfPoints();
+ bool anIsVisible = true;
+ for(vtkIdType anId = 0; anId < aNumPts; anId++){
+ vtkIdType aPntId = aCell->GetPointId(anId);
+ //cout<<aPntId<<"; ";
+ anIsVisible = aVisibleIds.find(aPntId) != aVisibleIds.end();
+ if(!anIsVisible)
+ break;
+ }
+ //cout<<"\t"<<anIsVisible<<"\n";
+ if(anIsVisible)
+ theVectorIds.push_back(aCellId);
}
}//for all parts
}
//----------------------------------------------------------------------------
void
CalculatePickPosition(vtkRenderer *theRenderer,
- vtkFloatingPointType theSelectionX,
- vtkFloatingPointType theSelectionY,
- vtkFloatingPointType theSelectionZ,
- vtkFloatingPointType thePickPosition[3])
+ vtkFloatingPointType theSelectionX,
+ vtkFloatingPointType theSelectionY,
+ vtkFloatingPointType theSelectionZ,
+ vtkFloatingPointType thePickPosition[3])
{
// Convert the selection point into world coordinates.
//
vtkFloatingPointType* aWorldCoords = theRenderer->GetWorldPoint();
if ( aWorldCoords[3] != 0.0 ) {
for (int i=0; i < 3; i++) {
- thePickPosition[i] = aWorldCoords[i] / aWorldCoords[3];
+ thePickPosition[i] = aWorldCoords[i] / aWorldCoords[3];
}
}
}
vtkRenderer *theRenderer)
{
return Pick(theSelection[0], theSelection[1], theSelection[2],
- theSelection2[0], theSelection2[1], theSelection2[2],
- theRenderer);
+ theSelection2[0], theSelection2[1], theSelection2[2],
+ theRenderer);
}
int
// Convert the selection point into world coordinates.
//
CalculatePickPosition(theRenderer,
- theSelectionX,
- theSelectionY,
- aSelectionZ,
- this->PickPosition);
+ theSelectionX,
+ theSelectionY,
+ aSelectionZ,
+ this->PickPosition);
this->SelectionPoint2[0] = theSelectionX2;
this->SelectionPoint2[1] = theSelectionY2;
// Convert the selection point into world coordinates.
//
CalculatePickPosition(theRenderer,
- theSelectionX2,
- theSelectionY2,
- aSelectionZ,
- this->PickPosition2);
+ theSelectionX2,
+ theSelectionY2,
+ aSelectionZ,
+ this->PickPosition2);
// Invoke start pick method if defined
this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
vtkProp *aPropCandidate = aPath->GetLastNode()->GetProp();
if ( aPropCandidate->GetPickable() && aPropCandidate->GetVisibility() ) {
anIsPickable = true;
- anActor = vtkActor::SafeDownCast(aPropCandidate);
- if ( anActor ) {
+ anActor = vtkActor::SafeDownCast(aPropCandidate);
+ if ( anActor ) {
aMapper = anActor->GetMapper();
if ( anActor->GetProperty()->GetOpacity() <= 0.0 )
- anIsPickable = false;
- }
+ anIsPickable = false;
+ }
}
if ( anIsPickable && aMapper && aMapper->GetInput()) {
- int aSelectionPoint[4] = {int(theSelectionX),
- int(theSelectionY),
- int(theSelectionX2),
- int(theSelectionY2)};
- if ( this->PickPoints ) {
- TVectorIds& aVisibleIds = myPointIdsMap[anActor];
- TVectorIds anInVisibleIds;
- SelectVisiblePoints(aSelectionPoint,
- theRenderer,
- aMapper->GetInput(),
- aVisibleIds,
- anInVisibleIds,
- this->Tolerance);
- if ( aVisibleIds.empty() ) {
- myPointIdsMap.erase(myPointIdsMap.find(anActor));
- }
- } else {
- TVectorIds& aVectorIds = myCellIdsMap[anActor];
- SelectVisibleCells(aSelectionPoint,
- theRenderer,
- aMapper->GetInput(),
- aVectorIds,
- this->Tolerance);
- if ( aVectorIds.empty() ) {
- myCellIdsMap.erase(myCellIdsMap.find(anActor));
- }
- }
+ int aSelectionPoint[4] = {int(theSelectionX),
+ int(theSelectionY),
+ int(theSelectionX2),
+ int(theSelectionY2)};
+ if ( this->PickPoints ) {
+ TVectorIds& aVisibleIds = myPointIdsMap[anActor];
+ TVectorIds anInVisibleIds;
+ SelectVisiblePoints(aSelectionPoint,
+ theRenderer,
+ aMapper->GetInput(),
+ aVisibleIds,
+ anInVisibleIds,
+ this->Tolerance);
+ if ( aVisibleIds.empty() ) {
+ myPointIdsMap.erase(myPointIdsMap.find(anActor));
+ }
+ } else {
+ TVectorIds& aVectorIds = myCellIdsMap[anActor];
+ SelectVisibleCells(aSelectionPoint,
+ theRenderer,
+ aMapper->GetInput(),
+ aVectorIds,
+ this->Tolerance);
+ if ( aVectorIds.empty() ) {
+ myCellIdsMap.erase(myCellIdsMap.find(anActor));
+ }
+ }
}
}
}
*/
QVTK_RenderWindowInteractor
::QVTK_RenderWindowInteractor(QWidget* theParent,
- const char* theName):
+ const char* theName):
QWidget(theParent),
myRenderWindow(vtkRenderWindow::New())
{
aRenderers->InitTraversal();
double aCoeff = 1.0;
if(vtkRenderer *aRenderer = aRenderers->GetNextItem()) {
- vtkCamera *aCamera = aRenderer->GetActiveCamera();
- double aScale = aCamera->GetParallelScale();
- if((aWidth - width())*(aHeight - height()) > 0)
- aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
- else
- aCoeff = double(aWidth)/double(width());
- aCamera->SetParallelScale(aScale*aCoeff);
+ vtkCamera *aCamera = aRenderer->GetActiveCamera();
+ double aScale = aCamera->GetParallelScale();
+ if((aWidth - width())*(aHeight - height()) > 0)
+ aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
+ else
+ aCoeff = double(aWidth)/double(width());
+ aCamera->SetParallelScale(aScale*aCoeff);
}
}
}
::mouseMoveEvent( QMouseEvent* event )
{
GetDevice()->SetEventInformationFlipY(event->x(),
- event->y(),
- event->modifiers() & Qt::ControlModifier,
- event->modifiers() & Qt::ShiftModifier);
+ event->y(),
+ event->modifiers() & Qt::ControlModifier,
+ event->modifiers() & Qt::ShiftModifier);
GetDevice()->MouseMoveEvent();
}
::mousePressEvent( QMouseEvent* event )
{
GetDevice()->SetEventInformationFlipY(event->x(),
- event->y(),
- event->modifiers() & Qt::ControlModifier,
- event->modifiers() & Qt::ShiftModifier);
+ event->y(),
+ event->modifiers() & Qt::ControlModifier,
+ event->modifiers() & Qt::ShiftModifier);
if( event->button() & Qt::LeftButton )
GetDevice()->LeftButtonPressEvent();
else if( event->button() & Qt::MidButton )
::mouseReleaseEvent( QMouseEvent *event )
{
GetDevice()->SetEventInformationFlipY(event->x(),
- event->y(),
- event->modifiers() & Qt::ControlModifier,
- event->modifiers() & Qt::ShiftModifier);
+ event->y(),
+ event->modifiers() & Qt::ControlModifier,
+ event->modifiers() & Qt::ShiftModifier);
if( event->button() & Qt::LeftButton )
GetDevice()->LeftButtonReleaseEvent();
::keyPressEvent( QKeyEvent* event )
{
GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier,
- event->modifiers() & Qt::ShiftModifier,
- event->key());
+ event->modifiers() & Qt::ShiftModifier,
+ event->key());
GetDevice()->KeyPressEvent();
GetDevice()->CharEvent();
}
::keyReleaseEvent( QKeyEvent * event )
{
GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier,
- event->modifiers() & Qt::ShiftModifier,
- event->key());
+ event->modifiers() & Qt::ShiftModifier,
+ event->key());
GetDevice()->KeyReleaseEvent();
}
switch ( type )
{
case SVTK_SpaceMouse::SpaceMouseMove:
- GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data );
- break;
+ GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data );
+ break;
case SVTK_SpaceMouse::SpaceButtonPress:
- GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button );
- break;
+ GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button );
+ break;
case SVTK_SpaceMouse::SpaceButtonRelease:
- break;
+ break;
}
return true; // stop handling the event
}
*/
SVTK_RenderWindowInteractor
::SVTK_RenderWindowInteractor(QWidget* theParent,
- const char* theName):
+ const char* theName):
QVTK_RenderWindowInteractor(theParent,theName),
myEventCallbackCommand(vtkCallbackCommand::New())
{
void
SVTK_RenderWindowInteractor
::Initialize(vtkGenericRenderWindowInteractor* theDevice,
- SVTK_Renderer* theRenderer,
- SVTK_Selector* theSelector)
+ SVTK_Renderer* theRenderer,
+ SVTK_Selector* theSelector)
{
QVTK_RenderWindowInteractor::Initialize(theDevice);
SetRenderer(theRenderer);
if(mySelector.GetPointer())
mySelector->AddObserver(vtkCommand::EndPickEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
/*!
void
SVTK_RenderWindowInteractor
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* vtkNotUsed(theCallData))
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
{
SVTK_RenderWindowInteractor* self = reinterpret_cast<SVTK_RenderWindowInteractor*>(theClientData);
public:
QVTK_RenderWindowInteractor(QWidget* theParent,
- const char* theName);
+ const char* theName);
~QVTK_RenderWindowInteractor();
public:
SVTK_RenderWindowInteractor(QWidget* theParent,
- const char* theName);
+ const char* theName);
~SVTK_RenderWindowInteractor();
virtual
void
Initialize(vtkGenericRenderWindowInteractor* theDevice,
- SVTK_Renderer* theRenderer,
- SVTK_Selector* theSelector);
+ SVTK_Renderer* theRenderer,
+ SVTK_Selector* theSelector);
//----------------------------------------------------------------------------
//! To get corresponding SVTK_Renderer instance
static
void
ProcessEvents(vtkObject* theObject,
- unsigned long theEvent,
- void* theClientData,
- void* theCallData);
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData);
// Used to process VTK events
vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
myEventCallbackCommand->SetClientData(this);
myEventCallbackCommand->SetCallback(SVTK_Renderer::ProcessEvents);
GetDevice()->AddObserver(vtkCommand::ConfigureEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
GetDevice()->AddObserver(vtkCommand::ResetCameraEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
GetDevice()->AddObserver(vtkCommand::ResetCameraClippingRangeEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
/*!
void
SVTK_Renderer
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* vtkNotUsed(theCallData))
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
{
SVTK_Renderer* self = reinterpret_cast<SVTK_Renderer*>(theClientData);
void
SVTK_Renderer
::Initialize(vtkRenderWindowInteractor* theInteractor,
- SVTK_Selector* theSelector)
+ SVTK_Selector* theSelector)
{
myInteractor = theInteractor;
mySelector = theSelector;
while(vtkActor* anAct = anActors->GetNextActor())
if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct))
if(anActor->isHighlighted() && !anActor->IsInfinitive())
- anActor->highlight(true);
+ anActor->highlight(true);
}
/*!
void
SVTK_Renderer
::SetSelectionProp(const double& theRed,
- const double& theGreen,
- const double& theBlue,
- const int& theWidth)
+ const double& theGreen,
+ const double& theBlue,
+ const int& theWidth)
{
myHighlightProperty->SetColor( theRed, theGreen, theBlue );
myHighlightProperty->SetLineWidth( theWidth );
void
SVTK_Renderer
::SetPreselectionProp(const double& theRed,
- const double& theGreen,
- const double& theBlue,
- const int& theWidth)
+ const double& theGreen,
+ const double& theBlue,
+ const int& theWidth)
{
myPreHighlightProperty->SetColor( theRed, theGreen, theBlue );
myPreHighlightProperty->SetLineWidth( theWidth );
void
SVTK_Renderer
::SetSelectionTolerance(const double& theTolNodes,
- const double& theTolCell,
- const double& theTolObjects)
+ const double& theTolCell,
+ const double& theTolObjects)
{
myPointPicker->SetTolerance( theTolNodes );
myCellPicker->SetTolerance( theTolCell );
vtkFloatingPointType aSize = myTrihedron->GetSize();
if ( IsTrihedronRelative() )
{
- ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
- myTrihedron->SetSize(aSize);
+ ComputeTrihedronSize(GetDevice(),aSize,aSize,myTrihedronSize);
+ myTrihedron->SetSize(aSize);
}
else
myTrihedron->SetSize( myTrihedronSize );
anActors->InitTraversal();
while(vtkActor* anAct = anActors->GetNextActor()){
if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
- if(anActor->IsResizable())
- anActor->SetSize(0.5*aSize);
+ if(anActor->IsResizable())
+ anActor->SetSize(0.5*aSize);
if(anActor->GetVisibility() && !anActor->IsInfinitive()){
- vtkFloatingPointType *aBounds = anActor->GetBounds();
+ vtkFloatingPointType *aBounds = anActor->GetBounds();
if(CheckBndBox(aBounds))
- for(int i = 0; i < 5; i = i + 2){
- if(aBounds[i] < aNewBndBox[i])
- aNewBndBox[i] = aBounds[i];
- if(aBounds[i+1] > aNewBndBox[i+1])
- aNewBndBox[i+1] = aBounds[i+1];
- }
+ for(int i = 0; i < 5; i = i + 2){
+ if(aBounds[i] < aNewBndBox[i])
+ aNewBndBox[i] = aBounds[i];
+ if(aBounds[i+1] > aNewBndBox[i+1])
+ aNewBndBox[i+1] = aBounds[i+1];
+ }
}
}
}
virtual
void
Initialize(vtkRenderWindowInteractor* theInteractor,
- SVTK_Selector* theSelector);
+ SVTK_Selector* theSelector);
//----------------------------------------------------------------------------
//! Publishes pointed actor into the renderer
//! Applies color and size (PointSize and LineWidth) of primitives in selection mode
void
SetSelectionProp(const double& theRed = 1,
- const double& theGreen = 1,
- const double& theBlue = 0,
- const int& theWidth = 5);
+ const double& theGreen = 1,
+ const double& theBlue = 0,
+ const int& theWidth = 5);
//! Applies color and size (PointSize and LineWidth) of primitives in preselection mode
void
SetPreselectionProp(const double& theRed = 0,
- const double& theGreen = 1,
- const double& theBlue = 1,
- const int& theWidth = 5);
+ const double& theGreen = 1,
+ const double& theBlue = 1,
+ const int& theWidth = 5);
//! Setup requested tolerance for the picking
void
SetSelectionTolerance(const double& theTolNodes = 0.025,
- const double& theTolCell = 0.001,
- const double& theTolObjects = 0.025);
+ const double& theTolCell = 0.001,
+ const double& theTolObjects = 0.025);
//----------------------------------------------------------------------------
//! Adjust all intenal actors (trihedron and graduated rules) to the scene
virtual
void
GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
- TColStd_IndexedMapOfInteger& theIndex ) = 0;
-
+ TColStd_IndexedMapOfInteger& theIndex ) = 0;
+
//! Change indices of subselection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIndices,
- bool theIsModeShift) = 0;
+ const TColStd_IndexedMapOfInteger& theIndices,
+ bool theIsModeShift) = 0;
//! Change indexes of subslection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_MapOfInteger& theIndices,
- bool theIsModeShift) = 0;
+ const TColStd_MapOfInteger& theIndices,
+ bool theIsModeShift) = 0;
//! Change index of subslection for given #SALOME_InteractiveObject
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex,
- bool theIsModeShift) = 0;
+ int theIndex,
+ bool theIsModeShift) = 0;
//! Change index of subslection for given #SALOME_InteractiveObject
virtual
void
RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex) = 0;
+ int theIndex) = 0;
//! Check, if the given index is present in subselection
virtual
bool
IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex) const = 0;
+ int theIndex) const = 0;
//! Clear subselection
virtual
virtual
bool
IsValid(SALOME_Actor* theActor,
- const int theId,
- const bool theIsNode = false) const = 0;
+ const int theId,
+ const bool theIsNode = false) const = 0;
//----------------------------------------------------------------------------
virtual
virtual
void
GetIndex( const Handle(SALOME_InteractiveObject)& theIO,
- TColStd_IndexedMapOfInteger& theIndex );
-
+ TColStd_IndexedMapOfInteger& theIndex );
+
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_IndexedMapOfInteger& theIndices,
- bool theIsModeShift);
+ const TColStd_IndexedMapOfInteger& theIndices,
+ bool theIsModeShift);
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- const TColStd_MapOfInteger& theIndices,
- bool theIsModeShift);
+ const TColStd_MapOfInteger& theIndices,
+ bool theIsModeShift);
virtual
bool
AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex,
- bool theIsModeShift);
+ int theIndex,
+ bool theIsModeShift);
virtual
void
RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex);
+ int theIndex);
virtual
bool
IsIndexSelected(const Handle(SALOME_InteractiveObject)& theIO,
- int theIndex) const;
+ int theIndex) const;
virtual
void
ClearIndex();
virtual
bool
IsValid(SALOME_Actor* theActor,
- const TFilterID theId,
- const bool theIsNode = false) const;
+ const TFilterID theId,
+ const bool theIsNode = false) const;
//----------------------------------------------------------------------------
virtual
{
bool
operator()(const Handle(SALOME_InteractiveObject)& theRightIO,
- const Handle(SALOME_InteractiveObject)& theLeftIO) const
+ const Handle(SALOME_InteractiveObject)& theLeftIO) const
{
return strcmp(theRightIO->getEntry(),theLeftIO->getEntry()) < 0;
}
*/
SVTK_SetRotationPointDlg
::SVTK_SetRotationPointDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName):
+ SVTK_ViewWindow* theParent,
+ const char* theName):
SVTK_DialogBase(theAction,
- theParent,
- theName),
+ theParent,
+ theName),
myMainWindow(theParent),
myPriority(0.0),
myEventCallbackCommand(vtkCallbackCommand::New()),
void
SVTK_SetRotationPointDlg
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* theCallData)
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData)
{
SVTK_SetRotationPointDlg* self = reinterpret_cast<SVTK_SetRotationPointDlg*>(theClientData);
vtkFloatingPointType* aCoord = (vtkFloatingPointType*)theCallData;
switch ( theEvent ) {
case SVTK::BBCenterChanged:
if ( self->myIsBBCenter->isChecked()
- ||
- IsBBEmpty(self->myMainWindow->getRenderer()) )
+ ||
+ IsBBEmpty(self->myMainWindow->getRenderer()) )
{
if ( aCoord )
{
- self->myX->setText( QString::number(aCoord[0]) );
- self->myY->setText( QString::number(aCoord[1]) );
- self->myZ->setText( QString::number(aCoord[2]) );
+ self->myX->setText( QString::number(aCoord[0]) );
+ self->myY->setText( QString::number(aCoord[1]) );
+ self->myZ->setText( QString::number(aCoord[2]) );
}
}
break;
{
if ( !myIsBBCenter->isChecked() ) {
if ( mySelectPoint->isChecked()
- &&
- ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
+ &&
+ ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
mySelectPoint->toggle();
vtkFloatingPointType aCenter[3] = {myX->text().toDouble(),
- myY->text().toDouble(),
- myZ->text().toDouble()};
+ myY->text().toDouble(),
+ myZ->text().toDouble()};
myMainWindow->activateSetRotationSelected((void*)aCenter);
}
else
public:
SVTK_SetRotationPointDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName);
+ SVTK_ViewWindow* theParent,
+ const char* theName);
~SVTK_SetRotationPointDlg();
PropReturn = NULL;
XGetWindowProperty( display, root, XCommandEvent, 0,1, 0,
- AnyPropertyType, &type, &format, &NItems,
- &BytesReturn, &PropReturn );
+ AnyPropertyType, &type, &format, &NItems,
+ &BytesReturn, &PropReturn );
win = InputFocus;
if ( PropReturn != NULL ) {
Custom event handler
*/
int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
- double scale, double rScale )
+ double scale, double rScale )
{
if ( !spaceMouseOn )
return 0;
if ( xEvent->xclient.message_type == XMotionEvent ) {
spaceMouseEvent->type = SpaceMouseMove;
spaceMouseEvent->data[ x ] =
- xEvent->xclient.data.s[2] * scale;
+ xEvent->xclient.data.s[2] * scale;
spaceMouseEvent->data[ y ] =
- xEvent->xclient.data.s[3] * scale;
+ xEvent->xclient.data.s[3] * scale;
spaceMouseEvent->data[ z ] =
- xEvent->xclient.data.s[4] * scale;
+ xEvent->xclient.data.s[4] * scale;
spaceMouseEvent->data[ a ] =
- xEvent->xclient.data.s[5] * rScale;
+ xEvent->xclient.data.s[5] * rScale;
spaceMouseEvent->data[ b ] =
- xEvent->xclient.data.s[6] * rScale;
+ xEvent->xclient.data.s[6] * rScale;
spaceMouseEvent->data[ c ] =
- xEvent->xclient.data.s[7] * rScale;
+ xEvent->xclient.data.s[7] * rScale;
spaceMouseEvent->period = xEvent->xclient.data.s[8];
return 1;
}
if(aProp->GetVisibility())
if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(aProp)) {
if(!anActor->IsInfinitive())
- aCount++;
+ aCount++;
}
else if ( !OwnActor( aProp ) ) {
- aCount++;
+ aCount++;
}
}
return aCount;
if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
vtkFloatingPointType aLastRenderTimeInSeconds = aRenderer->GetLastRenderTimeInSeconds();
if(aLastRenderTimeInSeconds > FLOAT_TOLERANCE){
- std::ostringstream aStr;
- vtkFloatingPointType aFPS = 1.0 / aLastRenderTimeInSeconds;
- aStr<<aFPS;
- return QString(aStr.str().c_str());
+ std::ostringstream aStr;
+ vtkFloatingPointType aFPS = 1.0 / aLastRenderTimeInSeconds;
+ aStr<<aFPS;
+ return QString(aStr.str().c_str());
}
}
return "Inf";
operator()(vtkActor* theActor)
{
if(theActor->GetVisibility()){
- myVTKMultiplier += theActor->GetAllocatedRenderTime();
- if(dynamic_cast<SALOME_Actor*>(theActor))
- mySALOMEMultiplier += theActor->GetAllocatedRenderTime();
+ myVTKMultiplier += theActor->GetAllocatedRenderTime();
+ if(dynamic_cast<SALOME_Actor*>(theActor))
+ mySALOMEMultiplier += theActor->GetAllocatedRenderTime();
}
}
};
inline
vtkFloatingPointType
AdjustUpdateRate(SVTK_RenderWindowInteractor* theRWInteractor,
- vtkFloatingPointType theUpdateRate)
+ vtkFloatingPointType theUpdateRate)
{
if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
if(vtkActorCollection *anActorCollection = aCopy.GetActors()){
- TRenderTimeMultiplier aMultiplier;
- using namespace VTK;
- aMultiplier = ForEach<vtkActor>(anActorCollection,
- aMultiplier);
- if(aMultiplier.mySALOMEMultiplier > FLOAT_TOLERANCE)
- theUpdateRate *= aMultiplier.mySALOMEMultiplier / aMultiplier.myVTKMultiplier;
+ TRenderTimeMultiplier aMultiplier;
+ using namespace VTK;
+ aMultiplier = ForEach<vtkActor>(anActorCollection,
+ aMultiplier);
+ if(aMultiplier.mySALOMEMultiplier > FLOAT_TOLERANCE)
+ theUpdateRate *= aMultiplier.mySALOMEMultiplier / aMultiplier.myVTKMultiplier;
}
}
return theUpdateRate;
operator()(SALOME_Actor* theActor)
{
if(theActor->GetVisibility()){
- if(vtkMapper *aMapper = theActor->GetMapper()){
- if(vtkDataSet *aDataSet = aMapper->GetInput()){
- myCounter += aDataSet->GetNumberOfCells();
- }
- }
+ if(vtkMapper *aMapper = theActor->GetMapper()){
+ if(vtkDataSet *aDataSet = aMapper->GetInput()){
+ myCounter += aDataSet->GetNumberOfCells();
+ }
+ }
}
}
};
if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
if(vtkActorCollection *anActorCollection = aCopy.GetActors()){
- TCellsCounter aCounter;
- using namespace VTK;
- aCounter = ForEach<SALOME_Actor>(anActorCollection,
- aCounter);
- return QString::number(aCounter.myCounter);
+ TCellsCounter aCounter;
+ using namespace VTK;
+ aCounter = ForEach<SALOME_Actor>(anActorCollection,
+ aCounter);
+ return QString::number(aCounter.myCounter);
}
}
*/
SVTK_UpdateRateDlg
::SVTK_UpdateRateDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName):
+ SVTK_ViewWindow* theParent,
+ const char* theName):
SVTK_DialogBase(theAction,
- theParent,
- theName),
+ theParent,
+ theName),
myPriority(0.0),
myEventCallbackCommand(vtkCallbackCommand::New()),
myRWInteractor(theParent->GetInteractor()),
myEventCallbackCommand->SetCallback(SVTK_UpdateRateDlg::ProcessEvents);
vtkRenderer *aRenderer = myRWInteractor->getRenderer();
aRenderer->AddObserver(vtkCommand::EndEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
/*!
void
SVTK_UpdateRateDlg
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* vtkNotUsed(theCallData))
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
{
SVTK_UpdateRateDlg* self = reinterpret_cast<SVTK_UpdateRateDlg*>(theClientData);
public:
SVTK_UpdateRateDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName);
+ SVTK_ViewWindow* theParent,
+ const char* theName);
~SVTK_UpdateRateDlg();
//! To highlight a VTK presentation with the same #SALOME_InteractiveObject
void
highlight(const Handle(SALOME_InteractiveObject)& IObject,
- bool highlight,
- bool immediatly = true);
+ bool highlight,
+ bool immediatly = true);
//! To unhighlight all VTK presentations
void
void
rename(const Handle(SALOME_InteractiveObject)& IObject,
- const QString& newName);
+ const QString& newName);
//----------------------------------------------------------------------------
// Displaymode management
//! Switch representation wireframe/shading
void
SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject,
- int theMode);
+ int theMode);
//! Change all actors to wireframe
void
//! Change transparency
void
SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
- float trans);
+ float trans);
//! Get current transparency
float
//! Change color
void
SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
- const QColor& theColor);
+ const QColor& theColor);
//! Get current color
QColor
//! To erase VTK presentation with defined #SALOME_InteractiveObject
void
Erase(const Handle(SALOME_InteractiveObject)& IObject,
- bool immediatly = true);
+ bool immediatly = true);
void
Remove(const Handle(SALOME_InteractiveObject)& IObject,
- bool immediatly = true);
+ bool immediatly = true);
//! To display VTK presentation with defined #SALOME_InteractiveObject
void
Display(const Handle(SALOME_InteractiveObject)& IObject,
- bool immediatly = true);
+ bool immediatly = true);
//! To display VTK presentation with defined #SALOME_InteractiveObject and erase all anothers
void
//! To display the VTK presentation
void
Display(SALOME_Actor* SActor,
- bool immediatly = true);
+ bool immediatly = true);
//! To erase the VTK presentation
void
Erase(SALOME_Actor* SActor,
- bool immediatly = true);
+ bool immediatly = true);
//! To remove the VTK presentation
void
Remove(SALOME_Actor* SActor,
- bool updateViewer = true);
+ bool updateViewer = true);
//----------------------------------------------------------------------------
//! Redirect the request to #SVTK_Renderer::SetPreselectionProp
void
SetSelectionProp(const double& theRed = 1,
- const double& theGreen = 1,
- const double& theBlue = 0,
- const int& theWidth = 5);
+ const double& theGreen = 1,
+ const double& theBlue = 0,
+ const int& theWidth = 5);
//! Redirect the request to #SVTK_Renderer::SetPreselectionProp
void
SetPreselectionProp(const double& theRed = 0,
- const double& theGreen = 1,
- const double& theBlue = 1,
- const int& theWidth = 5);
+ const double& theGreen = 1,
+ const double& theBlue = 1,
+ const int& theWidth = 5);
//! Redirect the request to #SVTK_Renderer::SetPreselectionProp
void
SetSelectionTolerance(const double& theTolNodes = 0.025,
- const double& theTolCell = 0.001,
- const double& theTolObjects = 0.025);
+ const double& theTolCell = 0.001,
+ const double& theTolObjects = 0.025);
protected:
int myDisplayMode;
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
- aView->setBackgroundColor(theColor);
+ aView->setBackgroundColor(theColor);
}
}
}
aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) );
connect(aViewWindow, SIGNAL( actorAdded(VTKViewer_Actor*) ),
- this, SLOT(onActorAdded(VTKViewer_Actor*)));
+ this, SLOT(onActorAdded(VTKViewer_Actor*)));
connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ),
- this, SLOT(onActorRemoved(VTKViewer_Actor*)));
+ this, SLOT(onActorRemoved(VTKViewer_Actor*)));
return aViewWindow;
}
for ( uint i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
- aView->SetTrihedronSize( theSize, theRelative );
+ aView->SetTrihedronSize( theSize, theRelative );
}
}
}
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
for ( uint i = 0; i < aViews.count(); i++ )
{
- if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
- aView->SetProjectionMode( theMode );
+ if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
+ aView->SetProjectionMode( theMode );
}
}
}
for ( uint i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
- aView->SetInteractionStyle( theStyle );
+ aView->SetInteractionStyle( theStyle );
}
}
}
for ( uint i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
- aView->SetIncrementalSpeed( theValue, theMode );
+ aView->SetIncrementalSpeed( theValue, theMode );
}
}
}
for ( uint i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
- aView->SetSpacemouseButtons( theBtn1, theBtn2, theBtn3 );
+ aView->SetSpacemouseButtons( theBtn1, theBtn2, theBtn3 );
}
}
}
// _PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor()){
- if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
- if(!anAct->ShouldBeDisplayed())
- continue;
- // Set visibility flag
+ if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+ if(!anAct->ShouldBeDisplayed())
+ continue;
+ // Set visibility flag
// Temporarily commented to avoid awful dependecy on SALOMEDS
// TODO: better mechanism of storing display/erse status in a study
// should be provided...
- //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
- //}
- // just display the object
- QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
- if(SVTK_View* aView = aViewWindow->getView()){
- aView->Display(anAct,false);
- if(anAct->IsSetCamera()){
- vtkRenderer* aRenderer = aView->getRenderer();
- anAct->SetCamera( aRenderer->GetActiveCamera() );
- }
- }
- }
- }
- }
+ //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+ // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
+ //}
+ // just display the object
+ QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+ for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+ if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i))){
+ if(SVTK_View* aView = aViewWindow->getView()){
+ aView->Display(anAct,false);
+ if(anAct->IsSetCamera()){
+ vtkRenderer* aRenderer = aView->getRenderer();
+ anAct->SetCamera( aRenderer->GetActiveCamera() );
+ }
+ }
+ }
+ }
+ }
}
}
}
//_PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor())
- if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
- // Set visibility flag
+ if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+ // Set visibility flag
// Temporarily commented to avoid awful dependecy on SALOMEDS
// TODO: better mechanism of storing display/erse status in a study
// should be provided...
- //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
- //}
- // just display the object
- QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
- if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
- if(SVTK_View* aView = aViewWindow->getView())
- if ( forced )
- aView->Remove(anAct,false);
- else
- aView->Erase(anAct,forced);
- }
- }
+ //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+ // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ //}
+ // just display the object
+ QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
+ for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+ if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
+ if(SVTK_View* aView = aViewWindow->getView())
+ if ( forced )
+ aView->Remove(anAct,false);
+ else
+ aView->Erase(anAct,forced);
+ }
+ }
}
}
}
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
if(SVTK_View* aView = aViewWindow->getView()){
- vtkRenderer* aRenderer = aView->getRenderer();
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
- vtkActorCollection* anActorCollection = aCopy.GetActors();
- anActorCollection->InitTraversal();
- while(vtkActor* anActor = anActorCollection->GetNextActor()){
- if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
- // Set visibility flag
+ vtkRenderer* aRenderer = aView->getRenderer();
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ vtkActorCollection* anActorCollection = aCopy.GetActors();
+ anActorCollection->InitTraversal();
+ while(vtkActor* anActor = anActorCollection->GetNextActor()){
+ if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+ // Set visibility flag
// Temporarily commented to avoid awful dependecy on SALOMEDS
// TODO: better mechanism of storing display/erse status in a study
// should be provided...
- //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
- if(forced)
- aRenderer->RemoveActor(anAct);
- else{
- // just erase actor
- anAct->SetVisibility( false );
- // erase dependent actors
- vtkActorCollection* aCollection = vtkActorCollection::New();
- anAct->GetChildActors( aCollection );
- aCollection->InitTraversal();
- while(vtkActor* aSubAct = aCollection->GetNextActor())
- aSubAct->SetVisibility( false );
- aCollection->Delete();
- }
- }
- }
+ //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+ //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
+ // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ if(forced)
+ aRenderer->RemoveActor(anAct);
+ else{
+ // just erase actor
+ anAct->SetVisibility( false );
+ // erase dependent actors
+ vtkActorCollection* aCollection = vtkActorCollection::New();
+ anAct->GetChildActors( aCollection );
+ aCollection->InitTraversal();
+ while(vtkActor* aSubAct = aCollection->GetNextActor())
+ aSubAct->SetVisibility( false );
+ aCollection->Delete();
+ }
+ }
+ }
}
}
Repaint();
if ( entry ) {
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(getViewManager()->getActiveView()))
if(SVTK_View* aView = aViewWindow->getView()){
- vtkRenderer* aRenderer = aView->getRenderer();
- VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
- vtkActorCollection* theActors = aCopy.GetActors();
- theActors->InitTraversal();
- vtkActor* ac;
- while( ( ac = theActors->GetNextActor() ) ) {
- SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
- if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {
- prs->AddObject( ac );
- }
- }
+ vtkRenderer* aRenderer = aView->getRenderer();
+ VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
+ vtkActorCollection* theActors = aCopy.GetActors();
+ theActors->InitTraversal();
+ vtkActor* ac;
+ while( ( ac = theActors->GetNextActor() ) ) {
+ SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+ if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {
+ prs->AddObject( ac );
+ }
+ }
}
}
return prs;
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
if(TViewWindow* aViewWindow = dynamic_cast<TViewWindow*>(aViews.at(i)))
if(SVTK_View* aView = aViewWindow->getView())
- aView->Repaint();
+ aView->Repaint();
}
Constructor
*/
SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName):
+ SVTK_ViewWindow* theParent,
+ const char* theName):
SVTK_DialogBase(theAction, theParent, theName),
myMainWindow(theParent),
myPriority(0.0),
Processes events
*/
void SVTK_ViewParameterDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* theCallData)
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData)
{
SVTK_ViewParameterDlg* self = reinterpret_cast<SVTK_ViewParameterDlg*>(theClientData);
vtkFloatingPointType* aCoord;
vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
aCamera->SetFocalPoint(myFocalX->text().toDouble(),
- myFocalY->text().toDouble(),
- myFocalZ->text().toDouble());
+ myFocalY->text().toDouble(),
+ myFocalZ->text().toDouble());
aCamera->OrthogonalizeViewUp();
myRWInteractor->getRenderer()->ResetCameraClippingRange();
vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
aCamera->SetPosition(myCameraX->text().toDouble(),
- myCameraY->text().toDouble(),
- myCameraZ->text().toDouble());
+ myCameraY->text().toDouble(),
+ myCameraZ->text().toDouble());
aCamera->OrthogonalizeViewUp();
myRWInteractor->getRenderer()->ResetCameraClippingRange();
vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
aCamera->SetViewUp(myViewDirX->text().toDouble(),
- myViewDirY->text().toDouble(),
- myViewDirZ->text().toDouble());
+ myViewDirY->text().toDouble(),
+ myViewDirZ->text().toDouble());
// update view
myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
// recompute focal point
if (computePoint(pos, dir, dist, pnt)) {
if (mySelectPoint->isChecked())
- mySelectPoint->toggle();
+ mySelectPoint->toggle();
myBusy = true;
myFocalX->setText(QString::number(pnt[0]));
myFocalY->setText(QString::number(pnt[1]));
}
bool SVTK_ViewParameterDlg::computePoint(const double start[3],
- const double dir[3],
- const double dist,
- double result[3])
+ const double dir[3],
+ const double dist,
+ double result[3])
{
double d = sqrt(dir[0]*dir[0]+dir[1]*dir[1]+dir[2]*dir[2]);
if ( d < 0.0002 ) return false;
public:
SVTK_ViewParameterDlg(QtxAction* theAction,
- SVTK_ViewWindow* theParent,
- const char* theName);
+ SVTK_ViewWindow* theParent,
+ const char* theName);
~SVTK_ViewParameterDlg();
void setEnabled(QFrame* theWidget, const bool theState);
bool computePoint(const double start[3], const double dir[3],
- const double dist, double result[3]);
+ const double dist, double result[3]);
void updateProjection();
void updateCoordinates();
/* interactive object management */
//! Redirect the request to #SVTK_View::highlight (to support old code)
virtual void highlight(const Handle(SALOME_InteractiveObject)& theIO,
- bool theIsHighlight = true,
- bool theIsUpdate = true);
+ bool theIsHighlight = true,
+ bool theIsUpdate = true);
//! Redirect the request to #SVTK_View::unHighlightAll (to support old code)
virtual void unHighlightAll();
//----------------------------------------------------------------------------
Handle(SALOME_InteractiveObject) FindIObject(const char* theEntry);
- /* display */
+ /* display */
//----------------------------------------------------------------------------
//! Redirect the request to #SVTK_View::Display (to support old code)
virtual void Display(const Handle(SALOME_InteractiveObject)& theIObject,
- bool theImmediatly = true);
+ bool theImmediatly = true);
//! Redirect the request to #SVTK_View::DisplayOnly (to support old code)
virtual void DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject);
//! Redirect the request to #SVTK_View::Erase (to support old code)
virtual void Erase(const Handle(SALOME_InteractiveObject)& theIObject,
- bool theImmediatly = true);
+ bool theImmediatly = true);
//! Redirect the request to #SVTK_View::DisplayAll (to support old code)
virtual void DisplayAll();
//! Redirect the request to #SVTK_Renderer::AddActor
virtual void AddActor(VTKViewer_Actor* theActor,
- bool theIsUpdate = false);
+ bool theIsUpdate = false);
//! Redirect the request to #SVTK_Renderer::RemoveActor
virtual void RemoveActor(VTKViewer_Actor* theActor,
- bool theIsUpdate = false);
+ bool theIsUpdate = false);
//----------------------------------------------------------------------------
//! Redirect the request to #SVTK_Renderer::AdjustActors
//! Redirect the request to #SVTK_Renderer::SetSelectionProp
virtual void SetSelectionProp(const double& theRed = 1,
- const double& theGreen = 1,
- const double& theBlue = 0,
- const int& theWidth = 5);
+ const double& theGreen = 1,
+ const double& theBlue = 0,
+ const int& theWidth = 5);
//! Redirect the request to #SVTK_Renderer::SetPreselectionProp
virtual void SetPreselectionProp(const double& theRed = 0,
- const double& theGreen = 1,
- const double& theBlue = 1,
- const int& theWidth = 5);
+ const double& theGreen = 1,
+ const double& theBlue = 1,
+ const int& theWidth = 5);
//! Redirect the request to #SVTK_Renderer::SetSelectionTolerance
virtual void SetSelectionTolerance(const double& theTolNodes = 0.025,
- const double& theTolCell = 0.001,
- const double& theTolObjects = 0.025);
+ const double& theTolCell = 0.001,
+ const double& theTolObjects = 0.025);
//! Methods to save/restore visual parameters of a view (pan, zoom, etc.)
virtual QString getVisualParameters();
protected:
virtual void Initialize(SVTK_View* theView,
- SVTK_ViewModelBase* theModel);
+ SVTK_ViewModelBase* theModel);
void doSetVisualParameters( const QString& );
void SetEventDispatcher(vtkObject* theDispatcher);
void createActions(SUIT_ResourceMgr* theResourceMgr);
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
- ChangeRotationPointId, RotationId,
+ ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId,
- ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
- ParallelModeId, ProjectionModeId, ViewParametersId, SwitchInteractionStyleId,
- StartRecordingId, PlayRecordingId, PauseRecordingId, StopRecordingId };
+ ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
+ ParallelModeId, ProjectionModeId, ViewParametersId, SwitchInteractionStyleId,
+ StartRecordingId, PlayRecordingId, PauseRecordingId, StopRecordingId };
SVTK_View* myView;
: LightApp_Application()
{
connect( desktop(), SIGNAL( message( const QString& ) ),
- this, SLOT( onDesktopMessage( const QString& ) ) );
+ this, SLOT( onDesktopMessage( const QString& ) ) );
setNoteBook(0);
}
for (int i = 1; i < qApp->argc(); i++) {
QRegExp rxs ("--study-hdf=(.+)");
if ( rxs.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
- QString file = rxs.capturedTexts()[1];
+ QString file = rxs.capturedTexts()[1];
QFileInfo fi ( file );
QString extension = fi.suffix().toLower();
if ( extension == "hdf" && fi.exists() )
if ( pyfiles.count() > 0 && activeStudy() ) {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if ( appStudy ) {
- _PTR(Study) aStudy = appStudy->studyDS();
- if ( !aStudy->GetProperties()->IsLocked() ) {
+ _PTR(Study) aStudy = appStudy->studyDS();
+ if ( !aStudy->GetProperties()->IsLocked() ) {
for (uint j = 0; j < pyfiles.count(); j++ ) {
QFileInfo fi ( pyfiles[j] );
- PyConsole_Console* pyConsole = pythonConsole();
- if ( pyConsole ) {
+ PyConsole_Console* pyConsole = pythonConsole();
+ if ( pyConsole ) {
QString extension = fi.suffix().toLower();
if ( fi.exists() ) {
// execute python script
else {
// import python module
QString command = QString( "import %1" ).arg( pyfiles[j] );
- if ( extension == "py" )
- command = QString( "import %1" ).arg( fi.completeBaseName() );
+ if ( extension == "py" )
+ command = QString( "import %1" ).arg( fi.completeBaseName() );
pyConsole->exec( command );
}
}
}
- }
+ }
}
}
}
//! Save GUI state
// "Save GUI State" command is moved to VISU module
// createAction( SaveGUIStateId, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(),
- // tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
- // 0, desk, false, this, SLOT( onSaveGUIState() ) );
+ // tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
+ // 0, desk, false, this, SLOT( onSaveGUIState() ) );
//! Dump study
createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIcon(),
- tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
- Qt::CTRL+Qt::Key_D, desk, false, this, SLOT( onDumpStudy() ) );
+ tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
+ Qt::CTRL+Qt::Key_D, desk, false, this, SLOT( onDumpStudy() ) );
//! NoteBook
createAction(NoteBookId, tr( "TOT_DESK_FILE_NOTEBOOK" ), QIcon(),
//! Load script
createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIcon(),
- tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
- Qt::CTRL+Qt::Key_T, desk, false, this, SLOT( onLoadScript() ) );
+ tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
+ Qt::CTRL+Qt::Key_T, desk, false, this, SLOT( onLoadScript() ) );
//! Properties
createAction( PropertiesId, tr( "TOT_DESK_PROPERTIES" ), QIcon(),
- tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ),
- Qt::CTRL+Qt::Key_P, desk, false, this, SLOT( onProperties() ) );
+ tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ),
+ Qt::CTRL+Qt::Key_P, desk, false, this, SLOT( onProperties() ) );
//! Catalog Generator
createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIcon(),
- tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
- Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) );
+ tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
+ Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) );
//! Registry Display
createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIcon(),
- tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
- /*Qt::SHIFT+Qt::Key_D*/0, desk, false, this, SLOT( onRegDisplay() ) );
+ tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
+ /*Qt::SHIFT+Qt::Key_D*/0, desk, false, this, SLOT( onRegDisplay() ) );
//SRN: BugID IPAL9021, add an action "Load"
createAction( FileLoadId, tr( "TOT_DESK_FILE_LOAD" ),
resourceMgr()->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
- tr( "MEN_DESK_FILE_LOAD" ), tr( "PRP_DESK_FILE_LOAD" ),
- Qt::CTRL+Qt::Key_L, desk, false, this, SLOT( onLoadDoc() ) );
+ tr( "MEN_DESK_FILE_LOAD" ), tr( "PRP_DESK_FILE_LOAD" ),
+ Qt::CTRL+Qt::Key_L, desk, false, this, SLOT( onLoadDoc() ) );
//SRN: BugID IPAL9021: End
while ( it.hasNext() && !isAlreadyOpen ) {
SUIT_Application* aApp = it.next();
if( !aApp || !aApp->activeStudy() )
- continue;
+ continue;
if ( aApp->activeStudy()->studyName() == studyName )
- isAlreadyOpen = true;
+ isAlreadyOpen = true;
}
if ( !isAlreadyOpen )
bool isAlreadyOpen = false;
SalomeApp_Application* aApp = 0;
for ( QList<SUIT_Application*>::iterator it = aAppList.begin();
- it != aAppList.end() && !isAlreadyOpen; ++it ) {
+ it != aAppList.end() && !isAlreadyOpen; ++it ) {
aApp = dynamic_cast<SalomeApp_Application*>( *it );
if ( aApp && aApp->activeStudy()->studyName() == aName )
isAlreadyOpen = true;
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
try {
- studyMgr()->Copy(so);
- onSelectionChanged();
+ studyMgr()->Copy(so);
+ onSelectionChanged();
}
catch(...) {
}
if ( stdDS->GetProperties()->IsLocked() ) {
SUIT_MessageBox::warning( desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED") );
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED") );
return;
}
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
try {
- studyMgr()->Paste(so);
- updateObjectBrowser( true );
- updateActions(); //SRN: BugID IPAL9377, case 3
+ studyMgr()->Paste(so);
+ updateObjectBrowser( true );
+ updateActions(); //SRN: BugID IPAL9377, case 3
}
catch(...) {
}
_PTR(Study) stdDS = study->studyDS();
if(stdDS && stdDS->IsStudyLocked()) {
if ( SUIT_MessageBox::question( desktop(),
- QObject::tr( "WRN_WARNING" ),
- QObject::tr( "CLOSE_LOCKED_STUDY" ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No,
- SUIT_MessageBox::No) == SUIT_MessageBox::No ) return;
+ QObject::tr( "WRN_WARNING" ),
+ QObject::tr( "CLOSE_LOCKED_STUDY" ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No,
+ SUIT_MessageBox::No) == SUIT_MessageBox::No ) return;
}
}
{
_PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() ), aRefObj = aSObject;
while( aRefObj && aRefObj->ReferencedObject( anObj ) )
- aRefObj = anObj;
+ aRefObj = anObj;
if( aRefObj && aRefObj!=aSObject && QString( aRefObj->GetName().c_str() ).isEmpty() )
- aStudyBuilder->RemoveReference( aSObject );
+ aStudyBuilder->RemoveReference( aSObject );
}
updateObjectBrowser();
}
QFileInfo fi( file );
if ( !QRegExp( "[A-Za-z_][A-Za-z0-9_]*" ).exactMatch( fi.completeBaseName() ) ) {
SUIT_MessageBox::critical( parent(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_FILE_NAME_BAD") );
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_FILE_NAME_BAD") );
return false;
}
return SUIT_FileValidator::canSave( file, permissions);
if ( !aFileName.isEmpty() ) {
QFileInfo aFileInfo(aFileName);
if( aFileInfo.isDir() ) // IPAL19257
- return;
+ return;
int savePoint;
_PTR(AttributeParameter) ap;
_PTR(IParameters) ip = ClientFactory::getIParameters(ap);
if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag.
if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method
- ip->setDumpPython(appStudy->studyDS());
- savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
+ ip->setDumpPython(appStudy->studyDS());
+ savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point
}
bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(),
- aFileInfo.baseName().toStdString(), toPublish);
+ aFileInfo.baseName().toStdString(), toPublish);
if ( toSaveGUI )
- appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
+ appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point.
if ( !res )
- SUIT_MessageBox::warning( desktop(),
- QObject::tr("WRN_WARNING"),
- tr("WRN_DUMP_STUDY_FAILED") );
+ SUIT_MessageBox::warning( desktop(),
+ QObject::tr("WRN_WARNING"),
+ tr("WRN_DUMP_STUDY_FAILED") );
}
}
}
if ( aStudy->GetProperties()->IsLocked() ) {
SUIT_MessageBox::warning( desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED") );
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED") );
return;
}
// temporary commented
/*
- ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
- ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
- ob->resize( desktop()->width()/3, ob->height() );
+ ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
+ ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
+ ob->resize( desktop()->width()/3, ob->height() );
*/
}
}
if ( study ) {
_PTR(Study) stdDS = study->studyDS();
if(stdDS) {
- if ( stdDS->GetProperties()->IsLocked() ) {
- aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) );
- } else {
- aTitle += QString( " - [%1]" ).arg( sName );
- }
+ if ( stdDS->GetProperties()->IsLocked() ) {
+ aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) );
+ } else {
+ aTitle += QString( " - [%1]" ).arg( sName );
+ }
}
}
}
{
int answer = SUIT_MessageBox::question( desktop(), tr( "APPCLOSE_CAPTION" ), tr( "APPCLOSE_DESCRIPTION" ).arg( docName ),
tr ("APPCLOSE_SAVE"), tr ("APPCLOSE_CLOSE"),
- tr ("APPCLOSE_UNLOAD"), tr ("APPCLOSE_CANCEL"), 0 );
+ tr ("APPCLOSE_UNLOAD"), tr ("APPCLOSE_CANCEL"), 0 );
int res = CloseCancel;
if ( answer == 0 )
if ( exist )
{
int answer = SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "QUE_DOC_ALREADYEXIST" ).arg( aName ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No );
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No );
if ( answer == SUIT_MessageBox::Yes )
- choice = OpenRefresh;
+ choice = OpenRefresh;
else
- choice = OpenCancel;
+ choice = OpenCancel;
}
}
_PTR(Study) aStudy = studyMgr()->GetStudyByName( aName.toStdString() );
if ( aStudy )
{
- studyMgr()->Close( aStudy );
- choice = OpenNew;
+ studyMgr()->Close( aStudy );
+ choice = OpenNew;
}
}
default:
{
_PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() ), aRefObj = aSObject;
while( aRefObj && aRefObj->ReferencedObject( anObj ) )
- aRefObj = anObj;
+ aRefObj = anObj;
if( aRefObj && aRefObj!=aSObject && QString( aRefObj->GetName().c_str() ).isEmpty() )
- isInvalidRefs = true;
+ isInvalidRefs = true;
}
// Add "Delete reference" item to popup
{
for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() )
{
- _PTR(SComponent) aComponent ( it->Value() );
+ _PTR(SComponent) aComponent ( it->Value() );
- if ( aComponent->ComponentDataType() == "Interface Applicative" )
- continue; // skip the magic "Interface Applicative" component
+ if ( aComponent->ComponentDataType() == "Interface Applicative" )
+ continue; // skip the magic "Interface Applicative" component
- if ( !objectBrowser() )
- getWindow( WT_ObjectBrowser );
- const bool isAutoUpdate = objectBrowser()->autoUpdate();
- objectBrowser()->setAutoUpdate( false );
- SalomeApp_DataModel::synchronize( aComponent, study );
- objectBrowser()->setAutoUpdate( isAutoUpdate );
+ if ( !objectBrowser() )
+ getWindow( WT_ObjectBrowser );
+ const bool isAutoUpdate = objectBrowser()->autoUpdate();
+ objectBrowser()->setAutoUpdate( false );
+ SalomeApp_DataModel::synchronize( aComponent, study );
+ objectBrowser()->setAutoUpdate( isAutoUpdate );
}
}
}
QModelIndexList aSelectedIndexes = ob->selectedIndexes();
if ( !aSelectedIndexes.isEmpty() )
- ob->treeView()->scrollTo( aSelectedIndexes.first() );
+ ob->treeView()->scrollTo( aSelectedIndexes.first() );
}
}
}
\param prepend - SUIT object must be added to start of children list
*/
suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so,
- const suitPtr& parent,
- const suitPtr& after ) const
+ const suitPtr& parent,
+ const suitPtr& after ) const
{
if( !isCorrect( so ) )
return 0;
_PTR( SComponent ) aComp( p );
bool res = ( !p && !q ) ||
( lobj && !sobj && aComp ) ||
- ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() );
+ ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() );
return res;
}
studyRoot = dynamic_cast<LightApp_RootObject*>( aSStudy->root() );
QString anId = getRootEntry( aSStudy );
if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing
- _PTR(Study) aStudy ( aSStudy->studyDS() );
- sobj = aStudy->FindComponentID( std::string( anId.toLatin1() ) );
+ _PTR(Study) aStudy ( aSStudy->studyDS() );
+ sobj = aStudy->FindComponentID( std::string( anId.toLatin1() ) );
}
}
}
\param parent parent data object
*/
SalomeApp_DataObject::SalomeApp_DataObject( const _PTR(SObject)& sobj,
- SUIT_DataObject* parent )
+ SUIT_DataObject* parent )
: CAM_DataObject( parent ),
LightApp_DataObject( parent )
{
#endif
txt = value( object() );
if ( txt.isEmpty() )
- txt = value( referencedObject() );
+ txt = value( referencedObject() );
break;
case IORId:
txt = ior( referencedObject() );
if ( myObject && myObject->FindAttribute( anAttr, "AttributePixMap" ) ){
_PTR(AttributePixMap) aPixAttr ( anAttr );
if ( aPixAttr->HasPixMap() ) {
- QString componentType = componentDataType();
- QString pixmapID = aPixAttr->GetPixMap().c_str();
- // select a plugin within a component
- QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts );
- if ( plugin_pixmap.size() == 2 ) {
- componentType = plugin_pixmap.front();
- pixmapID = plugin_pixmap.back();
- }
- QString pixmapName = QObject::tr( pixmapID.toLatin1().constData() );
- LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
- if ( aRoot && aRoot->study() ) {
- SUIT_ResourceMgr* mgr = aRoot->study()->application()->resourceMgr();
- return mgr->loadPixmap( componentType, pixmapName, false );
- }
+ QString componentType = componentDataType();
+ QString pixmapID = aPixAttr->GetPixMap().c_str();
+ // select a plugin within a component
+ QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts );
+ if ( plugin_pixmap.size() == 2 ) {
+ componentType = plugin_pixmap.front();
+ pixmapID = plugin_pixmap.back();
+ }
+ QString pixmapName = QObject::tr( pixmapID.toLatin1().constData() );
+ LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
+ if ( aRoot && aRoot->study() ) {
+ SUIT_ResourceMgr* mgr = aRoot->study()->application()->resourceMgr();
+ return mgr->loadPixmap( componentType, pixmapName, false );
+ }
}
}
}
// text color (not selected item)
if ( isReference() ) {
if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) )
- c = QColor( 255, 0, 0 ); // valid reference (red)
+ c = QColor( 255, 0, 0 ); // valid reference (red)
else
- c = QColor( 200, 200, 200 ); // invalid reference (grayed)
+ c = QColor( 200, 200, 200 ); // invalid reference (grayed)
}
else if ( myObject ) {
// get color atrtribute value
_PTR(GenericAttribute) anAttr;
if ( myObject->FindAttribute( anAttr, "AttributeTextColor" ) ) {
- _PTR(AttributeTextColor) aColAttr = anAttr;
- c = QColor( (int)aColAttr->TextColor().R, (int)aColAttr->TextColor().G, (int)aColAttr->TextColor().B );
+ _PTR(AttributeTextColor) aColAttr = anAttr;
+ c = QColor( (int)aColAttr->TextColor().R, (int)aColAttr->TextColor().G, (int)aColAttr->TextColor().B );
}
}
break;
// background color for the highlighted item
if ( isReference() ) {
if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) )
- c = QColor( 255, 0, 0 ); // valid reference (red)
+ c = QColor( 255, 0, 0 ); // valid reference (red)
else
- c = QColor( 200, 200, 200 ); // invalid reference (grayed)
+ c = QColor( 200, 200, 200 ); // invalid reference (grayed)
}
else if ( myObject ) {
// get color atrtribute value
_PTR(GenericAttribute) anAttr;
if( myObject->FindAttribute ( anAttr, "AttributeTextHighlightColor") ) {
_PTR(AttributeTextHighlightColor) aHighColAttr = anAttr;
- c = QColor( (int)(aHighColAttr->TextHighlightColor().R),
- (int)(aHighColAttr->TextHighlightColor().G),
- (int)(aHighColAttr->TextHighlightColor().B));
+ c = QColor( (int)(aHighColAttr->TextHighlightColor().R),
+ (int)(aHighColAttr->TextHighlightColor().G),
+ (int)(aHighColAttr->TextHighlightColor().B));
}
}
break;
app->lcc()->FindComponent(params, componentDataType().toLatin1().constData() );
if ( !CORBA::is_nil(aComponent) && aComponent->hasObjectInfo() ) {
- LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
- if ( aRoot && aRoot->study() )
- return QString( (CORBA::String_var)aComponent->getObjectInfo( aRoot->study()->id(), entry().toLatin1().constData()) );
+ LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
+ if ( aRoot && aRoot->study() )
+ return QString( (CORBA::String_var)aComponent->getObjectInfo( aRoot->study()->id(), entry().toLatin1().constData()) );
}
}
}
_PTR(AttributeIOR) iorAttr = attr;
if ( iorAttr )
{
- std::string str = iorAttr->Value();
- txt = QString( str.c_str() );
+ std::string str = iorAttr->Value();
+ txt = QString( str.c_str() );
}
}
}
{
_PTR(Study) studyDS( aStudy->studyDS() );
- bool ok = false;
- QStringList aSectionList = aStrings.split( "|" );
- if ( !aSectionList.isEmpty() )
- {
- QString aLastSection = aSectionList.last();
- QStringList aStringList = aLastSection.split( ":" );
- if ( !aStringList.isEmpty() )
- {
- ok = true;
- for ( int i = 0, n = aStringList.size(); i < n; i++ )
- {
- QString aStr = aStringList[i];
- if ( studyDS->IsVariable( aStr.toStdString() ) )
- val.append( aStr + ", " );
- }
-
- if ( !val.isEmpty() )
- val.remove( val.length() - 2, 2 );
- }
- }
- if( !ok )
- val = aStrings;
+ bool ok = false;
+ QStringList aSectionList = aStrings.split( "|" );
+ if ( !aSectionList.isEmpty() )
+ {
+ QString aLastSection = aSectionList.last();
+ QStringList aStringList = aLastSection.split( ":" );
+ if ( !aStringList.isEmpty() )
+ {
+ ok = true;
+ for ( int i = 0, n = aStringList.size(); i < n; i++ )
+ {
+ QString aStr = aStringList[i];
+ if ( studyDS->IsVariable( aStr.toStdString() ) )
+ val.append( aStr + ", " );
+ }
+
+ if ( !val.isEmpty() )
+ val.remove( val.length() - 2, 2 );
+ }
+ }
+ if( !ok )
+ val = aStrings;
}
}
}
\param parent parent data object
*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( const _PTR(SObject)& sobj,
- SUIT_DataObject* parent )
+ SUIT_DataObject* parent )
: CAM_DataObject( parent ),
LightApp_DataObject( parent ),
SalomeApp_DataObject( sobj, parent ),
\param parent parent data object
*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( CAM_DataModel* dm,
- const _PTR(SObject)& sobj,
- SUIT_DataObject* parent )
+ const _PTR(SObject)& sobj,
+ SUIT_DataObject* parent )
: CAM_DataObject( parent ),
LightApp_DataObject( parent ),
SalomeApp_DataObject( sobj, parent ),
\param study study
*/
SalomeApp_SavePointObject::SalomeApp_SavePointObject( SUIT_DataObject* parent,
- const int id,
- SalomeApp_Study* study )
+ const int id,
+ SalomeApp_Study* study )
: LightApp_DataObject( parent ),
CAM_DataObject( parent ),
myId( id ),
void SalomeApp_DoubleSpinBox::connectSignalsAndSlots()
{
connect( this, SIGNAL( editingFinished() ),
- this, SLOT( onEditingFinished() ) );
+ this, SLOT( onEditingFinished() ) );
connect( this, SIGNAL( valueChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
connect( lineEdit(), SIGNAL( textChanged( const QString& )),
- this, SIGNAL( textChanged( const QString& ) ) );
+ this, SIGNAL( textChanged( const QString& ) ) );
}
/*!
if( toCorrect )
{
if( aState == Incompatible )
- msg += tr( "ERR_INCOMPATIBLE_TYPE" ).arg( text() ) + "\n";
+ msg += tr( "ERR_INCOMPATIBLE_TYPE" ).arg( text() ) + "\n";
else if( aState == NoVariable )
- msg += tr( "ERR_NO_VARIABLE" ).arg( text() ) + "\n";
+ msg += tr( "ERR_NO_VARIABLE" ).arg( text() ) + "\n";
else if( aState == Invalid )
- msg += tr( "ERR_INVALID_VALUE" ) + "\n";
+ msg += tr( "ERR_INVALID_VALUE" ) + "\n";
setText( myCorrectValue );
}
std::string aName = name.toStdString();
if( studyDS->IsVariable( aName ) )
{
- if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) || studyDS->IsString( aName ) )
- {
- if( studyDS->IsString( aName ) )
- {
- PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
- PyLockWrapper aLock = pyInterp->GetLockWrapper();
- std::string command;
- command = "import salome_notebook ; ";
- command += "salome_notebook.notebook.setAsReal(\"";
- command += aName;
- command += "\")";
- bool aResult;
- aResult = pyInterp->run(command.c_str());
- if(aResult)
- {
- return IncorrectType;
- }
- }
- value = studyDS->GetReal( aName );
- return Found;
- }
- return IncorrectType;
+ if( studyDS->IsReal( aName ) || studyDS->IsInteger( aName ) || studyDS->IsString( aName ) )
+ {
+ if( studyDS->IsString( aName ) )
+ {
+ PyConsole_Console* pyConsole = app->pythonConsole();
+ PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyLockWrapper aLock = pyInterp->GetLockWrapper();
+ std::string command;
+ command = "import salome_notebook ; ";
+ command += "salome_notebook.notebook.setAsReal(\"";
+ command += aName;
+ command += "\")";
+ bool aResult;
+ aResult = pyInterp->run(command.c_str());
+ if(aResult)
+ {
+ return IncorrectType;
+ }
+ }
+ value = studyDS->GetReal( aName );
+ return Found;
+ }
+ return IncorrectType;
}
}
}
void SalomeApp_IntSpinBox::connectSignalsAndSlots()
{
connect( this, SIGNAL( editingFinished() ),
- this, SLOT( onEditingFinished() ) );
+ this, SLOT( onEditingFinished() ) );
connect( this, SIGNAL( valueChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
connect( lineEdit(), SIGNAL( textChanged( const QString& ) ),
- this, SLOT( onTextChanged( const QString& ) ) );
+ this, SLOT( onTextChanged( const QString& ) ) );
connect( lineEdit(), SIGNAL( textChanged( const QString& )),
- this, SIGNAL( textChanged( const QString& ) ) );
+ this, SIGNAL( textChanged( const QString& ) ) );
}
/*!
if( toCorrect )
{
if( aState == Incompatible )
- msg += tr( "ERR_INCOMPATIBLE_TYPE" ).arg( text() ) + "\n";
+ msg += tr( "ERR_INCOMPATIBLE_TYPE" ).arg( text() ) + "\n";
else if( aState == NoVariable )
- msg += tr( "ERR_NO_VARIABLE" ).arg( text() ) + "\n";
+ msg += tr( "ERR_NO_VARIABLE" ).arg( text() ) + "\n";
else if( aState == Invalid )
- msg += tr( "ERR_INVALID_VALUE" ) + "\n";
+ msg += tr( "ERR_INVALID_VALUE" ) + "\n";
setText( myCorrectValue );
}
{
text.toDouble( &ok );
if( ok )
- return Invalid;
+ return Invalid;
return NoVariable;
}
}
std::string aName = name.toStdString();
if( studyDS->IsVariable( aName ) )
{
- if( studyDS->IsInteger( aName ) || studyDS->IsString( aName ) )
- {
- if( studyDS->IsString( aName ) )
- {
- PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
- PyLockWrapper aLock = pyInterp->GetLockWrapper();
- std::string command;
- command = "import salome_notebook ; ";
- command += "salome_notebook.notebook.setAsInteger(\"";
- command += aName;
- command += "\")";
- bool aResult;
- aResult = pyInterp->run(command.c_str());
- if(aResult)
- {
- return IncorrectType;
- }
- }
- value = studyDS->GetInteger( aName );
- return Found;
- }
- return IncorrectType;
+ if( studyDS->IsInteger( aName ) || studyDS->IsString( aName ) )
+ {
+ if( studyDS->IsString( aName ) )
+ {
+ PyConsole_Console* pyConsole = app->pythonConsole();
+ PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyLockWrapper aLock = pyInterp->GetLockWrapper();
+ std::string command;
+ command = "import salome_notebook ; ";
+ command += "salome_notebook.notebook.setAsInteger(\"";
+ command += aName;
+ command += "\")";
+ bool aResult;
+ aResult = pyInterp->run(command.c_str());
+ if(aResult)
+ {
+ return IncorrectType;
+ }
+ }
+ value = studyDS->GetInteger( aName );
+ return Found;
+ }
+ return IncorrectType;
}
}
}
viewport()->installEventFilter(this);
connect(this, SIGNAL(itemSelectionChanged()),
- this, SLOT(onSelectionChanged()));
+ this, SLOT(onSelectionChanged()));
connect(header(), SIGNAL(sizeChange(int, int, int)),
- this, SLOT(onHeaderSizeChange(int, int, int)));
+ this, SLOT(onHeaderSizeChange(int, int, int)));
}
/*!
if (ok) {
aNeedsUpdate = myEditedItem->finishEditing(myEdit);
if (aNeedsUpdate == utCancel) {
- // something to do here on Cancel...
+ // something to do here on Cancel...
}
else {
- // something to do here on OK...
+ // something to do here on OK...
}
// updating contents
switch (aNeedsUpdate) {
\retval valid rect in success
*/
QRect SalomeApp_ListView::tip(QPoint aPos,
- QString& aText,
- QRect& dspRect,
- QFont& dspFnt) const
+ QString& aText,
+ QRect& dspRect,
+ QFont& dspFnt) const
{
QRect result( -1, -1, -1, -1 );
SalomeApp_ListViewItem* aItem = (SalomeApp_ListViewItem*)itemAt( aPos );
QRect aItemRect = aItem->itemRect(i);
QRect aTextRect = aItem->textRect(i);
if ( !aItem->text(i).isEmpty() &&
- ( aItemRect.width() > header()->sectionSize(i) ||
- aTextRect.left() < 0 ||
+ ( aItemRect.width() > header()->sectionSize(i) ||
+ aTextRect.left() < 0 ||
aTextRect.top() < 0 ||
aTextRect.right() > viewport()->width() ||
aTextRect.bottom() > viewport()->height() ) ) {
// calculating tip data
aText = aItem->tipText();
- dspRect = aItem->tipRect();
- dspFnt = font();
+ dspRect = aItem->tipRect();
+ dspFnt = font();
if (dspRect.isValid()) {
result = QRect(QPoint(0, aItemRect.top()),
QSize(viewport()->width(), aItemRect.height()));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after) :
+ SalomeApp_ListViewItem* after) :
QTreeWidgetItem( parent, after )
{
init();
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- const QStringList& theStrings,
- const bool theEditable) :
+ const QStringList& theStrings,
+ const bool theEditable) :
QTreeWidgetItem(parent, theStrings)
{
init();
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- const QStringList& theString,
- const bool theEditable) :
+ const QStringList& theString,
+ const bool theEditable) :
QTreeWidgetItem(parent, theString)
{
init();
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const QString& theValue,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const QString& theValue,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
return 0;
aWidget = new SalomeApp_EntityEdit(aListView->viewport(),
anEditType,
- aValueType,
- aButtons & SalomeApp_EntityEdit::btApply,
- aButtons & SalomeApp_EntityEdit::btCancel);
+ aValueType,
+ aButtons & SalomeApp_EntityEdit::btApply,
+ aButtons & SalomeApp_EntityEdit::btCancel);
computeEditGeometry(this, aWidget);
fillWidgetWithValues(aWidget);
Adds item in combo box
*/
void SalomeApp_ComboBox::insertItem(const QString& theValue,
- int theIndex)
+ int theIndex)
{
if (duplicatesEnabled() || findItem(theValue) < 0)
QComboBox::insertItem(theIndex, theValue);
Constructor
*/
SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent,
- int controlType,
- int valueType,
- bool butApply,
- bool butCancel) :
+ int controlType,
+ int valueType,
+ bool butApply,
+ bool butCancel) :
QWidget(parent),
myEdit(0),
myCombo(0),
Adds item in combo box, sets it current if theSetCurrent is true
*/
void SalomeApp_EntityEdit::insertItem(const QString& theValue,
- bool theSetCurrent,
- int theOrder)
+ bool theSetCurrent,
+ int theOrder)
{
if (myCombo) {
int aIndexAt = -1;
Adds items in combo box, sets item theCurrent as current
*/
void SalomeApp_EntityEdit::insertList(const QStringList& theList,
- const int theCurrent)
+ const int theCurrent)
{
if (myCombo)
myCombo->insertList(theList);
Adds item in combo box, sets it current if theSetCurrent is true
*/
void SalomeApp_EntityEdit::insertItem(const int theValue,
- bool theSetCurrent)
+ bool theSetCurrent)
{
if (myCombo) {
myCombo->insertItem(theValue);
Adds items in combo box, sets item theCurrent as current
*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList,
- const int theCurrent)
+ const int theCurrent)
{
if (myCombo)
myCombo->insertList(theList);
Adds item in combo box, sets it current if theSetCurrent is true
*/
void SalomeApp_EntityEdit::insertItem(const double theValue,
- bool theSetCurrent)
+ bool theSetCurrent)
{
if (myCombo) {
myCombo->insertItem(theValue);
Adds items in combo box, sets item theCurrent as current
*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList,
- const int theCurrent)
+ const int theCurrent)
{
if (myCombo)
myCombo->insertList(theList);
public:
SalomeApp_EntityEdit( QWidget* parent,
- int controlType = etLineEdit,
- int valueType = vtString,
- bool butApply = false,
- bool butCancel = false);
+ int controlType = etLineEdit,
+ int valueType = vtString,
+ bool butApply = false,
+ bool butCancel = false);
~SalomeApp_EntityEdit();
void finishEditing();
QString getText();
void setText(const QString& theText );
void insertItem( const QString& theValue,
- bool theSetCurrent = false,
- int theOrder = atBottom );
+ bool theSetCurrent = false,
+ int theOrder = atBottom );
void insertList( const QStringList& theList,
- const int theCurrent = -1 );
+ const int theCurrent = -1 );
void insertItem( const int theValue,
- bool theSetCurrent = false );
+ bool theSetCurrent = false );
void insertList( const TColStd_ListOfInteger& theList,
- const int theCurrent = -1 );
+ const int theCurrent = -1 );
void insertItem( const double theValue,
- bool theSetCurrent = false );
+ bool theSetCurrent = false );
void insertList( const TColStd_ListOfReal& theList,
- const int theCurrent = -1 );
+ const int theCurrent = -1 );
QWidget* getControl();
void setFocus();
void setValidator(const QValidator*);
public:
SalomeApp_ListViewItem( SalomeApp_ListView* );
SalomeApp_ListViewItem( SalomeApp_ListView*,
- SalomeApp_ListViewItem* );
+ SalomeApp_ListViewItem* );
SalomeApp_ListViewItem( SalomeApp_ListView*,
- const QStringList&,
- const bool = false );
+ const QStringList&,
+ const bool = false );
SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
- const QStringList&,
- const bool = false );
+ const QStringList&,
+ const bool = false );
SalomeApp_ListViewItem( SalomeApp_ListView*,
- SalomeApp_ListViewItem*,
- const QString&,
- const bool = false );
+ SalomeApp_ListViewItem*,
+ const QString&,
+ const bool = false );
SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
- SalomeApp_ListViewItem*,
- const QString&,
- const bool = false);
+ SalomeApp_ListViewItem*,
+ const QString&,
+ const bool = false);
SalomeApp_ListViewItem( SalomeApp_ListView*,
- SalomeApp_ListViewItem*,
- const QString& theName,
- const QString& theValue,
- const bool = false);
+ SalomeApp_ListViewItem*,
+ const QString& theName,
+ const QString& theValue,
+ const bool = false);
SalomeApp_ListViewItem( SalomeApp_ListViewItem*,
- SalomeApp_ListViewItem*,
- const QString&,
- const QString&,
- const bool = false);
+ SalomeApp_ListViewItem*,
+ const QString&,
+ const QString&,
+ const bool = false);
~SalomeApp_ListViewItem();
QString fullName();
myList = new QListWidget( this );
myList->setMinimumSize( MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT );
myList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
- QSizePolicy::Expanding ) );
+ QSizePolicy::Expanding ) );
myList->setSelectionMode( QAbstractItemView::SingleSelection );
topLayout->addWidget( lab );
connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( myList, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
- this, SLOT( accept() ) );
+ this, SLOT( accept() ) );
connect( myList, SIGNAL( itemSelectionChanged() ),
- this, SLOT( updateState() ) );
+ this, SLOT( updateState() ) );
myList->addItems( studies );
updateState();
_PTR(SObject) SO = study->studyDS()->FindObjectID( obj->getEntry() );
if( SO && QString( SO->GetID().c_str() ) == SO->GetFatherComponent()->GetID().c_str() )
{ //component is selected
- _PTR(SComponent) SC( SO->GetFatherComponent() );
- _PTR(ChildIterator) anIter ( study->studyDS()->NewChildIterator( SC ) );
- anIter->InitEx( true );
- while( anIter->More() )
- {
- _PTR(SObject) valSO ( anIter->Value() );
- _PTR(SObject) refSO;
- if( !valSO->ReferencedObject( refSO ) )
- {
- QString id = valSO->GetID().c_str(),
- comp = SC->ComponentDataType().c_str(),
- val = valSO->GetName().c_str();
-
- Handle( SALOME_InteractiveObject ) new_obj =
- new SALOME_InteractiveObject( id.toLatin1(), comp.toLatin1(), val.toLatin1() );
- dest.Append( new_obj );
- }
- anIter->Next();
- }
- continue;
+ _PTR(SComponent) SC( SO->GetFatherComponent() );
+ _PTR(ChildIterator) anIter ( study->studyDS()->NewChildIterator( SC ) );
+ anIter->InitEx( true );
+ while( anIter->More() )
+ {
+ _PTR(SObject) valSO ( anIter->Value() );
+ _PTR(SObject) refSO;
+ if( !valSO->ReferencedObject( refSO ) )
+ {
+ QString id = valSO->GetID().c_str(),
+ comp = SC->ComponentDataType().c_str(),
+ val = valSO->GetName().c_str();
+
+ Handle( SALOME_InteractiveObject ) new_obj =
+ new SALOME_InteractiveObject( id.toLatin1(), comp.toLatin1(), val.toLatin1() );
+ dest.Append( new_obj );
+ }
+ anIter->Next();
+ }
+ continue;
}
}
dest.Append( obj );
NoteBook_TableRow* aRow = myRows[ i ];
if( aRow )
{
- delete aRow;
- aRow = 0;
+ delete aRow;
+ aRow = 0;
}
}
myRows.clear();
vector<string> aVariables = theStudy->GetVariableNames();
for(int iVar = 0; iVar < aVariables.size(); iVar++ ) {
AddRow(QString(aVariables[iVar].c_str()),
- Variable2String(aVariables[iVar],theStudy));
+ Variable2String(aVariables[iVar],theStudy));
}
//Add empty row
QString aMsg;
if(aCurrentColumn == NAME_COLUMN) {
- int anIndex = aRow->GetIndex();
- if( myVariableMap.contains( anIndex ) )
- {
- const NoteBoox_Variable& aVariable = myVariableMap[ anIndex ];
- if( !aVariable.Name.isEmpty() && myStudy->IsVariableUsed( string( aVariable.Name.toLatin1().constData() ) ) )
- {
- if( QMessageBox::warning( parentWidget(), tr( "WARNING" ),
- tr( "RENAME_VARIABLE_IS_USED" ).arg( aVariable.Name ),
- QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
- {
- bool isBlocked = blockSignals( true );
- aRow->SetName( aVariable.Name );
- blockSignals( isBlocked );
- return;
- }
- }
- }
+ int anIndex = aRow->GetIndex();
+ if( myVariableMap.contains( anIndex ) )
+ {
+ const NoteBoox_Variable& aVariable = myVariableMap[ anIndex ];
+ if( !aVariable.Name.isEmpty() && myStudy->IsVariableUsed( string( aVariable.Name.toLatin1().constData() ) ) )
+ {
+ if( QMessageBox::warning( parentWidget(), tr( "WARNING" ),
+ tr( "RENAME_VARIABLE_IS_USED" ).arg( aVariable.Name ),
+ QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
+ {
+ bool isBlocked = blockSignals( true );
+ aRow->SetName( aVariable.Name );
+ blockSignals( isBlocked );
+ return;
+ }
+ }
+ }
}
//Case then varible name changed.
if(aCurrentColumn == NAME_COLUMN) {
if(!aRow->CheckName()) {
- IsCorrect = false;
- aMsg = tr( "VARNAME_INCORRECT" ).arg(aRow->GetName());
- }
+ IsCorrect = false;
+ aMsg = tr( "VARNAME_INCORRECT" ).arg(aRow->GetName());
+ }
else if(!IsUniqueName(aRow)) {
- IsCorrect = false;
+ IsCorrect = false;
aMsg = tr( "VARNAME_EXISTS" ).arg(aRow->GetName());
- }
- else
- IsVariableComplited = aRow->CheckValue();
+ }
+ else
+ IsVariableComplited = aRow->CheckValue();
}
//Case then varible value changed.
else if(aCurrentColumn == VALUE_COLUMN){
if(!aRow->CheckValue()) {
- IsCorrect = false;
- aMsg = tr( "VARVALUE_INCORRECT" ).arg(aRow->GetName());
- }
- else
- IsVariableComplited = aRow->CheckName() && IsUniqueName(aRow);
+ IsCorrect = false;
+ aMsg = tr( "VARVALUE_INCORRECT" ).arg(aRow->GetName());
+ }
+ else
+ IsVariableComplited = aRow->CheckName() && IsUniqueName(aRow);
}
if(!IsCorrect && !aMsg.isEmpty())
- SUIT_MessageBox::warning( parentWidget(), tr( "WARNING" ), aMsg );
+ SUIT_MessageBox::warning( parentWidget(), tr( "WARNING" ), aMsg );
bool isBlocked = blockSignals( true );
theItem->setForeground( QBrush( IsCorrect ? Qt::black : Qt::red ) );
int anIndex = aRow->GetIndex();
if( myVariableMap.contains( anIndex ) )
{
- NoteBoox_Variable& aVariable = myVariableMap[ anIndex ];
- if( aVariable.Name.compare( aRow->GetName() ) != 0 ||
- aVariable.Value.compare( aRow->GetValue() ) != 0 )
- {
- aVariable.Name = aRow->GetName();
- aVariable.Value = aRow->GetValue();
- }
- else
- isModified = false;
+ NoteBoox_Variable& aVariable = myVariableMap[ anIndex ];
+ if( aVariable.Name.compare( aRow->GetName() ) != 0 ||
+ aVariable.Value.compare( aRow->GetValue() ) != 0 )
+ {
+ aVariable.Name = aRow->GetName();
+ aVariable.Value = aRow->GetValue();
+ }
+ else
+ isModified = false;
}
if(IsCorrect && IsVariableComplited && IsLastRow(aRow))
- AddEmptyRow();
+ AddEmptyRow();
}
if( !myIsModified )
else {
int nRow = row(aSelectedItems[i]);
- if( myStudy->IsVariableUsed( string( aRow->GetName().toLatin1().constData() ) ) )
- {
- if( QMessageBox::warning( parentWidget(), tr( "WARNING" ),
- tr( "REMOVE_VARIABLE_IS_USED" ).arg( aRow->GetName() ),
- QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
- {
- isProcessItemChangedSignal = true;
- return;
- }
- }
-
- int index = aRow->GetIndex();
+ if( myStudy->IsVariableUsed( string( aRow->GetName().toLatin1().constData() ) ) )
+ {
+ if( QMessageBox::warning( parentWidget(), tr( "WARNING" ),
+ tr( "REMOVE_VARIABLE_IS_USED" ).arg( aRow->GetName() ),
+ QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
+ {
+ isProcessItemChangedSignal = true;
+ return;
+ }
+ }
+
+ int index = aRow->GetIndex();
QString aVarName = aRow->GetName();
- myRemovedRows.append( index );
- if( myVariableMap.contains( index ) )
- myVariableMap.remove( index );
+ myRemovedRows.append( index );
+ if( myVariableMap.contains( index ) )
+ myVariableMap.remove( index );
removeRow(nRow);
myRows.removeAt(nRow);
if(myStudy->IsVariable(aVarName.toLatin1().constData()))
{
if( aVariableMapRef.contains( anIndex ) )
{
- const NoteBoox_Variable& aVariableRef = aVariableMapRef[ anIndex ];
- QString aNameRef = aVariableRef.Name;
- QString aValueRef = aVariableRef.Value;
-
- if( !aNameRef.isEmpty() && !aValueRef.isEmpty() && aNameRef != aName )
- {
- myStudy->RenameVariable( string( aNameRef.toLatin1().constData() ),
- string( aName.toLatin1().constData() ) );
- }
+ const NoteBoox_Variable& aVariableRef = aVariableMapRef[ anIndex ];
+ QString aNameRef = aVariableRef.Name;
+ QString aValueRef = aVariableRef.Value;
+
+ if( !aNameRef.isEmpty() && !aValueRef.isEmpty() && aNameRef != aName )
+ {
+ myStudy->RenameVariable( string( aNameRef.toLatin1().constData() ),
+ string( aName.toLatin1().constData() ) );
+ }
}
if( NoteBook_TableRow::IsIntegerValue(aValue,&anIVal) )
- myStudy->SetInteger(string(aName.toLatin1().constData()),anIVal);
+ myStudy->SetInteger(string(aName.toLatin1().constData()),anIVal);
else if( NoteBook_TableRow::IsRealValue(aValue,&aDVal) )
- myStudy->SetReal(string(aName.toLatin1().constData()),aDVal);
+ myStudy->SetReal(string(aName.toLatin1().constData()),aDVal);
else if( NoteBook_TableRow::IsBooleanValue(aValue,&aBVal) )
- myStudy->SetBoolean(string(aName.toLatin1().constData()),aBVal);
+ myStudy->SetBoolean(string(aName.toLatin1().constData()),aBVal);
else if( NoteBook_TableRow::IsValidStringValue(aValue) )
- myStudy->SetString(string(aName.toLatin1().constData()),aValue.toStdString());
+ myStudy->SetString(string(aName.toLatin1().constData()),aValue.toStdString());
}
}
myTable->ResetMaps();
if( myTable->IsModified() )
{
int answer = QMessageBox::question( this, tr( "CLOSE_CAPTION" ), tr( "CLOSE_DESCRIPTION" ),
- QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel );
+ QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel );
switch( answer )
{
case QMessageBox::Yes : onOK(); return;
case QMessageBox::No : break;
case QMessageBox::Cancel : return;
- default : break;
+ default : break;
}
}
reject();
int aY = y();
// Disconnect dialog from application desktop in case if:
- // 1) Application is not the first application in the session
+ // 1) Application is not the first application in the session
// 2) Application is the first application in session but not the only.
bool changeDesktop = ((anIndex > 0) || (anIndex == 0 && aList.count() > 1));
void Init(_PTR(Study) theStudy);
static QString Variable2String(const std::string& theVarName,
- _PTR(Study) theStudy);
+ _PTR(Study) theStudy);
bool IsValid() const;
listOfFiles.clear();
aModel->saveAs( theFileName, this, listOfFiles );
if ( !listOfFiles.isEmpty() )
- saveModuleData(aModel->module()->name(), listOfFiles);
+ saveModuleData(aModel->module()->name(), listOfFiles);
}
}
listOfFiles.clear();
aModel->save(listOfFiles);
if ( !listOfFiles.isEmpty() )
- saveModuleData(aModel->module()->name(), listOfFiles);
+ saveModuleData(aModel->module()->name(), listOfFiles);
}
}
curName = prefix.arg( i );
for ( j = 0 ; j < n; j++ ){
if ( !strcmp( studies[j].c_str(), curName.toLatin1() ) )
- break;
+ break;
}
if ( j == n )
newName = curName;
public:
/*! constructor */
SalomeApp_PropItem(SalomeApp_ListView* parent,
- const QString theName,
- const bool theEditable,
- const int theUserType) :
+ const QString theName,
+ const bool theEditable,
+ const int theUserType) :
SalomeApp_ListViewItem( parent, QStringList(theName), theEditable )
{
setUserType(theUserType);
}
/*! constructor */
SalomeApp_PropItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString theName,
- const bool theEditable,
- const int theUserType) :
+ SalomeApp_ListViewItem* after,
+ const QString theName,
+ const bool theEditable,
+ const int theUserType) :
SalomeApp_ListViewItem( parent, after, theName, theEditable )
{
setUserType(theUserType);
// }
case SalomeApp_StudyPropertiesDlg::prpLockedId:
{
- list << SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) << SalomeApp_StudyPropertiesDlg::tr( "PRP_YES" );
- theWidget->insertList(list, getValue() == SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) ? 0 : 1 );
- break;
+ list << SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) << SalomeApp_StudyPropertiesDlg::tr( "PRP_YES" );
+ theWidget->insertList(list, getValue() == SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) ? 0 : 1 );
+ break;
}
case SalomeApp_StudyPropertiesDlg::prpModificationsId:
{
- SalomeApp_Study* study =
+ SalomeApp_Study* study =
dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
- if (study) {
- _PTR(Study) studyDoc = study->studyDS();
- _PTR(AttributeStudyProperties) propAttr;
- if ( studyDoc ) {
- propAttr = studyDoc->GetProperties();
- if ( propAttr ) {
- std::vector<std::string> aUsers;
- std::vector<int> aMins, aHours, aDays, aMonths, aYears;
- propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
- int aCnt = aUsers.size();
- for ( int i = 0; i < aCnt; i++ ) {
- QString val;
- val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
- aDays [i],
- aMonths[i],
- aYears [i],
- aHours [i],
- aMins [i]);
- val = val + " : " + QString( aUsers[i].c_str() );
- list.prepend(val);
- }
- theWidget->setDuplicatesEnabled(true);
- theWidget->insertList(list);
- }
- }
- }
- break;
+ if (study) {
+ _PTR(Study) studyDoc = study->studyDS();
+ _PTR(AttributeStudyProperties) propAttr;
+ if ( studyDoc ) {
+ propAttr = studyDoc->GetProperties();
+ if ( propAttr ) {
+ std::vector<std::string> aUsers;
+ std::vector<int> aMins, aHours, aDays, aMonths, aYears;
+ propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false);
+ int aCnt = aUsers.size();
+ for ( int i = 0; i < aCnt; i++ ) {
+ QString val;
+ val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
+ aDays [i],
+ aMonths[i],
+ aYears [i],
+ aHours [i],
+ aMins [i]);
+ val = val + " : " + QString( aUsers[i].c_str() );
+ list.prepend(val);
+ }
+ theWidget->setDuplicatesEnabled(true);
+ theWidget->insertList(list);
+ }
+ }
+ }
+ break;
}
default:
{
- SalomeApp_ListViewItem::fillWidgetWithValues(theWidget);
- break;
+ SalomeApp_ListViewItem::fillWidgetWithValues(theWidget);
+ break;
}
}
}
if (aLast >= 0) {
QString val;
val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d",
- aDays [aLast],
- aMonths[aLast],
- aYears [aLast],
- aHours [aLast],
- aMins [aLast]);
+ aDays [aLast],
+ aMonths[aLast],
+ aYears [aLast],
+ aHours [aLast],
+ aMins [aLast]);
val = val + " : " + QString(aUsers[aUsers.size()-1].c_str());
item->setValue(val);
}
QTreeWidgetItemIterator it( myPropList );
// iterate through all items of the listview
while (*it) {
- SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it);
- switch (item->getUserType()) {
- case prpAuthorId:
+ SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it);
+ switch (item->getUserType()) {
+ case prpAuthorId:
if (QString(propAttr->GetUserName().c_str()) != item->getValue().trimmed()) {
if (!propAttr->IsLocked()) {
propAttr->SetUserName(item->getValue().trimmed().toStdString());
myChanged = true;
} else {
SUIT_MessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED") );
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED") );
}
}
- break;
+ break;
//case prpModeId:
- // propAttr->SetCreationMode(item->getValue().trimmed().latin1());
- // break;
- case prpLockedId:
+ // propAttr->SetCreationMode(item->getValue().trimmed().latin1());
+ // break;
+ case prpLockedId:
{
bool bLocked = item->getValue().compare(tr("PRP_YES")) == 0;
if (propAttr->IsLocked() != bLocked) {
myChanged = true;
}
}
- break;
- default:
- break;
- }
- ++it;
+ break;
+ default:
+ break;
+ }
+ ++it;
}
}
accept();
SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it);
switch (item->getUserType()) {
case prpAuthorId:
- if ( QString( propAttr->GetUserName().c_str() ) != item->getValue().trimmed() ) {
- return true;
- }
- break;
+ if ( QString( propAttr->GetUserName().c_str() ) != item->getValue().trimmed() ) {
+ return true;
+ }
+ break;
//case prpModeId:
// if ( QString( propAttr->GetCreationMode().c_str() ) != item->getValue().trimmed() ) {
// return true;
// }
// break;
case prpLockedId:
- {
- bool bLocked = item->getValue().compare( tr( "PRP_YES" ) ) == 0;
- if ( propAttr->IsLocked() != bLocked ) {
- return true;
- }
- break;
- }
+ {
+ bool bLocked = item->getValue().compare( tr( "PRP_YES" ) ) == 0;
+ if ( propAttr->IsLocked() != bLocked ) {
+ return true;
+ }
+ break;
+ }
default:
- break;
+ break;
}
++it;
}
*/
Quantity_Color SalomeApp_Tools::color( const QColor& c )
{
- Quantity_Color aColor;
- if ( c.isValid() )
- aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
- return aColor;
+ Quantity_Color aColor;
+ if ( c.isValid() )
+ aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
+ return aColor;
}
/*!
*/
QColor SalomeApp_Tools::color( const Quantity_Color& c )
{
- return QColor( (int)( c.Red() * 255 ), (int)( c.Green() * 255 ), (int)( c.Blue() * 255 ) );
+ return QColor( (int)( c.Red() * 255 ), (int)( c.Green() * 255 ), (int)( c.Blue() * 255 ) );
}
/*!
case SALOME::COMM:
case SALOME::INTERNAL_ERROR:
{
- message = QString( S_ex.details.text );
- QString source( S_ex.details.sourceFile );
- QString line;
- line.setNum( S_ex.details.lineNumber );
- message = message + " \n" + source + " : " + line;
+ message = QString( S_ex.details.text );
+ QString source( S_ex.details.sourceFile );
+ QString line;
+ line.setNum( S_ex.details.lineNumber );
+ message = message + " \n" + source + " : " + line;
break;
}
case SALOME::BAD_PARAM:
{
- message = QString( S_ex.details.text );
+ message = QString( S_ex.details.text );
#ifdef _DEBUG_
- QString source( S_ex.details.sourceFile );
- QString line;
- line.setNum( S_ex.details.lineNumber );
- message = message + " \n" + source + " : " + line;
+ QString source( S_ex.details.sourceFile );
+ QString line;
+ line.setNum( S_ex.details.lineNumber );
+ message = message + " \n" + source + " : " + line;
#endif
- break;
+ break;
}
default:
{
- message = QString( "SALOME CORBA Exception Type invalid" );
- QString source( S_ex.details.sourceFile );
- QString line;
- line.setNum( S_ex.details.lineNumber );
- message = message + " \n" + source + " : " + line;
- break;
+ message = QString( "SALOME CORBA Exception Type invalid" );
+ QString source( S_ex.details.sourceFile );
+ QString line;
+ line.setNum( S_ex.details.lineNumber );
+ message = message + " \n" + source + " : " + line;
+ break;
}
}
return message;
case SALOME::BAD_PARAM:
error = false;
title = QObject::tr( "Engine Warning" );
- break;
+ break;
default:
title = QObject::tr( "Internal SALOME Error" );
break;
if ( error )
SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
- title, message );
+ title, message );
else
SUIT_MessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(),
- title, message );
+ title, message );
}
_PTR(SObject) aSObj( aStudy->FindObjectID( entry.toStdString() ) );
if (aSObj)
- {
- _PTR(SComponent) aComponent(aSObj->GetFatherComponent());
- if ( aComponent && (aComponent->ComponentDataType() == myKind.toStdString()) )
- return true;
- }
+ {
+ _PTR(SComponent) aComponent(aSObj->GetFatherComponent());
+ if ( aComponent && (aComponent->ComponentDataType() == myKind.toStdString()) )
+ return true;
+ }
}
return false;
{
viewWin = views[i];
if ( !viewWin )
- continue;
+ continue;
// wait untill the window is really shown. This step fixes MANY bugs..
// while ( !vm->isVisible() )
- // qApp->processEvents();
+ // qApp->processEvents();
viewWin->setWindowTitle( ip->getValue( viewerEntry, j ).c_str() );
{
if ( !viewersParameters.contains( views[i] ) )
{
- viewersParameters[ views[i] ] = views[i]->getVisualParameters();
- // printf ( "store VP for viewWin \"%s\": %s\n", views[i]->name(), views[i]->getVisualParameters().toLatin1().constData() );
+ viewersParameters[ views[i] ] = views[i]->getVisualParameters();
+ // printf ( "store VP for viewWin \"%s\": %s\n", views[i]->name(), views[i]->getVisualParameters().toLatin1().constData() );
}
}
}
// QPtrVector<SUIT_ViewWindow> views = it.current()->getViews();
// for ( int i = 0; i < view_count; i++ ) {
// if ( activeViewName == views[i]->name() )
- // views[i]->setFocus();
+ // views[i]->setFocus();
// }
// }
}
if ( myExtAppVersion == "APP_VERSION" ) {
if ( myExtAppName != "SalomeApp" )
myExtAppVersion = "";
- else myExtAppVersion = salomeVersion();
+ else myExtAppVersion = salomeVersion();
}
}
}
QString fname = QFileInfo( _fname ).fileName();
if( exp.exactMatch( fname ) ) {
- QStringList vers = exp.cap( 1 ).split( ".", QString::SkipEmptyParts );
- int major=0, minor=0;
- major = vers[0].toInt();
- minor = vers[1].toInt();
- if( vers_exp.indexIn( vers[2] )==-1 )
- return -1;
- int release = 0, dev1 = 0, dev2 = 0;
- release = vers_exp.cap( 1 ).toInt();
- dev1 = vers_exp.cap( 2 )[ 0 ].toLatin1();
- dev2 = vers_exp.cap( 3 ).toInt();
-
- int dev = dev1*100+dev2, id = major;
- id*=100; id+=minor;
- id*=100; id+=release;
- id*=10000;
- if ( dev > 0 ) id+=dev-10000;
- return id;
+ QStringList vers = exp.cap( 1 ).split( ".", QString::SkipEmptyParts );
+ int major=0, minor=0;
+ major = vers[0].toInt();
+ minor = vers[1].toInt();
+ if( vers_exp.indexIn( vers[2] )==-1 )
+ return -1;
+ int release = 0, dev1 = 0, dev2 = 0;
+ release = vers_exp.cap( 1 ).toInt();
+ dev1 = vers_exp.cap( 2 )[ 0 ].toLatin1();
+ dev2 = vers_exp.cap( 3 ).toInt();
+
+ int dev = dev1*100+dev2, id = major;
+ id*=100; id+=minor;
+ id*=100; id+=release;
+ id*=10000;
+ if ( dev > 0 ) id+=dev-10000;
+ return id;
}
}
splash->setProgress( 0, sc.totalSteps() );
// start check loop
while ( true ) {
- int step = sc.currentStep();
- int total = sc.totalSteps();
- QString msg = sc.currentMessage();
- QString err = sc.error();
- if ( !err.isEmpty() ) {
- QtxSplash::setError( err );
- QApplication::instance()->processEvents();
- result = -1;
- break;
- }
- QtxSplash::setStatus( msg, step );
- QApplication::instance()->processEvents();
- if ( step >= total )
- break;
- // ...block this thread until servers checking is finished
- _SplashStarted.wait( &_SplashMutex );
+ int step = sc.currentStep();
+ int total = sc.totalSteps();
+ QString msg = sc.currentMessage();
+ QString err = sc.error();
+ if ( !err.isEmpty() ) {
+ QtxSplash::setError( err );
+ QApplication::instance()->processEvents();
+ result = -1;
+ break;
+ }
+ QtxSplash::setStatus( msg, step );
+ QApplication::instance()->processEvents();
+ if ( step >= total )
+ break;
+ // ...block this thread until servers checking is finished
+ _SplashStarted.wait( &_SplashMutex );
}
// ...unlock mutex 'cause it is no more needed
_SplashMutex.unlock();
// Launch GUI activator
if ( isGUI ) {
if ( splash )
- splash->setStatus( QApplication::translate( "", "Activating desktop..." ) );
+ splash->setStatus( QApplication::translate( "", "Activating desktop..." ) );
// ...retrieve Session interface reference
CORBA::Object_var obj = _NS->Resolve( "/Kernel/Session" );
SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
SUIT_Application* aGUIApp = aGUISession->startApplication( "SalomeApp", 0, 0 );
if ( aGUIApp )
{
- Style_Salome::initialize( aGUIApp->resourceMgr() );
- if ( aGUIApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) )
- Style_Salome::apply();
-
- if ( !isFound( "noexcepthandler", argc, argv ) )
- _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application
- // aGUISession contains SalomeApp_ExceptionHandler
- // Run GUI loop
- MESSAGE( "run(): starting the main event loop" );
-
- if ( splash )
- splash->finish( aGUIApp->desktop() );
-
- result = _qappl.exec();
-
- splash = 0;
-
- if ( result == SUIT_Session::NORMAL ) { // desktop is closed by user from GUI
- shutdown = aGUISession->exitFlags();
- _SessionMutex.lock();
- break;
- }
+ Style_Salome::initialize( aGUIApp->resourceMgr() );
+ if ( aGUIApp->resourceMgr()->booleanValue( "Style", "use_salome_style", true ) )
+ Style_Salome::apply();
+
+ if ( !isFound( "noexcepthandler", argc, argv ) )
+ _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application
+ // aGUISession contains SalomeApp_ExceptionHandler
+ // Run GUI loop
+ MESSAGE( "run(): starting the main event loop" );
+
+ if ( splash )
+ splash->finish( aGUIApp->desktop() );
+
+ result = _qappl.exec();
+
+ splash = 0;
+
+ if ( result == SUIT_Session::NORMAL ) { // desktop is closed by user from GUI
+ shutdown = aGUISession->exitFlags();
+ _SessionMutex.lock();
+ break;
+ }
}
delete aGUISession;
CORBA::Object_var obj = orb->resolve_initial_references( "NameService" );
CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow( obj );
if ( !CORBA::is_nil( _root_context ) ) {
- setStep( ++current * myAttempts );
- break;
+ setStep( ++current * myAttempts );
+ break;
}
}
catch( CORBA::COMM_FAILURE& ) {
CORBA::Object_var obj = NS.Resolve( "/Registry" );
Registry::Components_var registry = Registry::Components::_narrow( obj );
if ( !CORBA::is_nil( registry ) ) {
- MESSAGE( "/Registry is found" );
- registry->ping();
- MESSAGE( "Registry was activated" );
- setStep( ++current * myAttempts );
- break;
+ MESSAGE( "/Registry is found" );
+ registry->ping();
+ MESSAGE( "Registry was activated" );
+ setStep( ++current * myAttempts );
+ break;
}
}
catch ( ServiceUnreachable& ) {
CORBA::Object_var obj = NS.Resolve( "/myStudyManager" );
SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow( obj );
if ( !CORBA::is_nil( studyManager ) ) {
- MESSAGE( "/myStudyManager is found" );
- studyManager->ping();
- MESSAGE( "StudyManager was activated" );
- setStep( ++current * myAttempts );
- break;
+ MESSAGE( "/myStudyManager is found" );
+ studyManager->ping();
+ MESSAGE( "StudyManager was activated" );
+ setStep( ++current * myAttempts );
+ break;
}
}
catch ( ServiceUnreachable& ) {
CORBA::Object_var obj = NS.Resolve( "/Kernel/ModulCatalog" );
SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow( obj );
if ( !CORBA::is_nil( catalog ) ){
- MESSAGE( "/Kernel/ModulCatalog is found" );
- catalog->ping();
- MESSAGE( "ModuleCatalog was activated" );
- setStep( ++current * myAttempts );
- break;
+ MESSAGE( "/Kernel/ModulCatalog is found" );
+ catalog->ping();
+ MESSAGE( "ModuleCatalog was activated" );
+ setStep( ++current * myAttempts );
+ break;
}
}
catch ( ServiceUnreachable& ) {
CORBA::Object_var obj = NS.Resolve( "/Kernel/Session" );
SALOME::Session_var session = SALOME::Session::_narrow( obj );
if ( !CORBA::is_nil( session ) ) {
- MESSAGE( "/Kernel/Session is found" );
- session->ping();
- MESSAGE( "SALOME_Session was activated" );
- setStep( ++current * myAttempts );
- break;
+ MESSAGE( "/Kernel/Session is found" );
+ session->ping();
+ MESSAGE( "SALOME_Session was activated" );
+ setStep( ++current * myAttempts );
+ break;
}
}
catch ( ServiceUnreachable& ) {
setStep( current * myAttempts + i );
try {
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
- ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
- NS.init_orb( orb );
- QString containerName = QString( "/Containers/%1/FactoryServer" ).arg( Kernel_Utils::GetHostname().c_str() );
- CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() );
- Engines::Container_var FScontainer = Engines::Container::_narrow( obj );
- if ( !CORBA::is_nil( FScontainer ) ) {
- MESSAGE( containerName.toLatin1().constData() << " is found" );
- FScontainer->ping();
- MESSAGE( "FactoryServer container was activated" );
- setStep( ++current * myAttempts );
- break;
- }
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
+ ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
+ NS.init_orb( orb );
+ QString containerName = QString( "/Containers/%1/FactoryServer" ).arg( Kernel_Utils::GetHostname().c_str() );
+ CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() );
+ Engines::Container_var FScontainer = Engines::Container::_narrow( obj );
+ if ( !CORBA::is_nil( FScontainer ) ) {
+ MESSAGE( containerName.toLatin1().constData() << " is found" );
+ FScontainer->ping();
+ MESSAGE( "FactoryServer container was activated" );
+ setStep( ++current * myAttempts );
+ break;
+ }
}
catch ( ServiceUnreachable& ) {
- MESSAGE( "Caught exception: Naming Service unreachable." );
- error = "Naming service unreachable";
+ MESSAGE( "Caught exception: Naming Service unreachable." );
+ error = "Naming service unreachable";
}
catch ( CORBA::COMM_FAILURE& ) {
- MESSAGE( "Caught CORBA::SystemException CommFailure." );
- error = "Caught CORBA::SystemException CommFailure.";
+ MESSAGE( "Caught CORBA::SystemException CommFailure." );
+ error = "Caught CORBA::SystemException CommFailure.";
}
catch ( CORBA::SystemException& ) {
- MESSAGE( "Caught CORBA::SystemException." );
- error = "Caught CORBA::SystemException.";
+ MESSAGE( "Caught CORBA::SystemException." );
+ error = "Caught CORBA::SystemException.";
}
catch ( CORBA::Exception& ) {
- MESSAGE( "Caught CORBA::Exception." );
- error = "Caught CORBA::Exception.";
+ MESSAGE( "Caught CORBA::Exception." );
+ error = "Caught CORBA::Exception.";
}
catch (...) {
- MESSAGE( "Caught unknown exception." );
- error = "Caught unknown exception.";
+ MESSAGE( "Caught unknown exception." );
+ error = "Caught unknown exception.";
}
if ( i == myAttempts-1 ) {
- setError( tr( "C++ container is not found.\n%1" ).arg ( error ) );
- return;
+ setError( tr( "C++ container is not found.\n%1" ).arg ( error ) );
+ return;
}
}
}
setStep( current * myAttempts + i );
try {
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
- ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
- NS.init_orb( orb );
- QString containerName = QString( "/Containers/%1/FactoryServerPy" ).arg( Kernel_Utils::GetHostname().c_str() );
- CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() );
- Engines::Container_var FSPcontainer = Engines::Container::_narrow( obj );
- if ( !CORBA::is_nil( FSPcontainer ) ) {
- MESSAGE( containerName.toLatin1().constData() << " is found" );
- FSPcontainer->ping();
- MESSAGE("FactoryServerPy container was activated");
- setStep( ++current * myAttempts );
- break;
- }
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
+ ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
+ NS.init_orb( orb );
+ QString containerName = QString( "/Containers/%1/FactoryServerPy" ).arg( Kernel_Utils::GetHostname().c_str() );
+ CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() );
+ Engines::Container_var FSPcontainer = Engines::Container::_narrow( obj );
+ if ( !CORBA::is_nil( FSPcontainer ) ) {
+ MESSAGE( containerName.toLatin1().constData() << " is found" );
+ FSPcontainer->ping();
+ MESSAGE("FactoryServerPy container was activated");
+ setStep( ++current * myAttempts );
+ break;
+ }
}
catch ( ServiceUnreachable& ) {
- MESSAGE( "Caught exception: Naming Service unreachable." );
- error = "Naming service unreachable";
+ MESSAGE( "Caught exception: Naming Service unreachable." );
+ error = "Naming service unreachable";
}
catch ( CORBA::COMM_FAILURE& ) {
- MESSAGE( "Caught CORBA::SystemException CommFailure." );
- error = "Caught CORBA::SystemException CommFailure.";
+ MESSAGE( "Caught CORBA::SystemException CommFailure." );
+ error = "Caught CORBA::SystemException CommFailure.";
}
catch ( CORBA::SystemException& ) {
- MESSAGE( "Caught CORBA::SystemException." );
- error = "Caught CORBA::SystemException.";
+ MESSAGE( "Caught CORBA::SystemException." );
+ error = "Caught CORBA::SystemException.";
}
catch ( CORBA::Exception& ) {
- MESSAGE( "Caught CORBA::Exception." );
- error = "Caught CORBA::Exception.";
+ MESSAGE( "Caught CORBA::Exception." );
+ error = "Caught CORBA::Exception.";
}
catch (...) {
- MESSAGE( "Caught unknown exception." );
- error = "Caught unknown exception.";
+ MESSAGE( "Caught unknown exception." );
+ error = "Caught unknown exception.";
}
if ( i == myAttempts-1 ) {
- setError( tr( "Python container is not found.\n%1" ).arg ( error ) );
- return;
+ setError( tr( "Python container is not found.\n%1" ).arg ( error ) );
+ return;
}
}
}
setStep( current * myAttempts + i );
try {
- CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
- SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
- ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
- NS.init_orb( orb );
- QString containerName = QString( "/Containers/%1/SuperVisionContainer" ).arg( Kernel_Utils::GetHostname().c_str() );
- CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() );
- Engines::Container_var SVcontainer = Engines::Container::_narrow( obj );
- if ( !CORBA::is_nil( SVcontainer ) ) {
- MESSAGE( containerName.toLatin1().constData() << " is found" );
- SVcontainer->ping();
- MESSAGE("SuperVisionContainer container was activated");
- setStep( ++current * myAttempts );
- break;
- }
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
+ SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance();
+ ASSERT( SINGLETON_<SALOME_NamingService>::IsAlreadyExisting() );
+ NS.init_orb( orb );
+ QString containerName = QString( "/Containers/%1/SuperVisionContainer" ).arg( Kernel_Utils::GetHostname().c_str() );
+ CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() );
+ Engines::Container_var SVcontainer = Engines::Container::_narrow( obj );
+ if ( !CORBA::is_nil( SVcontainer ) ) {
+ MESSAGE( containerName.toLatin1().constData() << " is found" );
+ SVcontainer->ping();
+ MESSAGE("SuperVisionContainer container was activated");
+ setStep( ++current * myAttempts );
+ break;
+ }
}
catch ( ServiceUnreachable& ) {
- MESSAGE( "Caught exception: Naming Service unreachable." );
- error = "Naming service unreachable";
+ MESSAGE( "Caught exception: Naming Service unreachable." );
+ error = "Naming service unreachable";
}
catch ( CORBA::COMM_FAILURE& ) {
- MESSAGE( "Caught CORBA::SystemException CommFailure." );
- error = "Caught CORBA::SystemException CommFailure.";
+ MESSAGE( "Caught CORBA::SystemException CommFailure." );
+ error = "Caught CORBA::SystemException CommFailure.";
}
catch ( CORBA::SystemException& ) {
- MESSAGE( "Caught CORBA::SystemException." );
- error = "Caught CORBA::SystemException.";
+ MESSAGE( "Caught CORBA::SystemException." );
+ error = "Caught CORBA::SystemException.";
}
catch ( CORBA::Exception& ) {
- MESSAGE( "Caught CORBA::Exception." );
- error = "Caught CORBA::Exception.";
+ MESSAGE( "Caught CORBA::Exception." );
+ error = "Caught CORBA::Exception.";
}
catch (...) {
- MESSAGE( "Caught unknown exception." );
- error = "Caught unknown exception.";
+ MESSAGE( "Caught unknown exception." );
+ error = "Caught unknown exception.";
}
if ( i == myAttempts-1 ) {
- setError( tr( "Supervision container is not found.\n%1" ).arg ( error ) );
- return;
+ setError( tr( "Supervision container is not found.\n%1" ).arg ( error ) );
+ return;
}
}
}
constructor
*/
Session_ServerLauncher::Session_ServerLauncher(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex,
- QWaitCondition *ServerLaunch,
- QMutex *SessionMutex,
- QWaitCondition *SessionStarted)
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex *GUIMutex,
+ QWaitCondition *ServerLaunch,
+ QMutex *SessionMutex,
+ QWaitCondition *SessionStarted)
{
_argc = argc;
_argv = argv;
SCRUTE(_argv[iarg]);
_argCopy.push_back(_argv[iarg]);
switch (argState)
- {
- case 0: // looking for "--with"
- {
- if (strcmp(_argv[iarg],"--with")==0)
- argState = 1;
- break;
- }
- case 1: // looking for server type
- {
- for (int i=0; i<Session_ServerThread::NB_SRV_TYP; i++)
- if (strcmp(_argv[iarg],Session_ServerThread::_serverTypes[i])==0)
- {
- aServArg._servType = i;
- argState = 2;
- break;
- }
- break;
- }
- case 2: // looking for "("
- {
- if (strcmp(_argv[iarg],"(")!=0)
- {
- INFOS("parenthesis '(' is required here...");
- for (int i=0; i<iarg; i++)
- cerr << _argv[i] << " ";
- cerr << endl;
- throw SALOME_Exception(LOCALIZED("Error in command arguments, missing prenthesis"));
- }
- else
- {
- aServArg._firstArg=iarg+1; // arg after '('
- argState = 3;
- }
- break;
- }
- case 3: // looking for arguments
- {
- if (strcmp(_argv[iarg],")")==0) // end of arguments = ')'
- {
- aServArg._lastArg=iarg-1; // arg before ')'
- MESSAGE("server : "<< Session_ServerThread::_serverTypes[aServArg._servType]);
- for (int i=aServArg._firstArg; i<=aServArg._lastArg; i++)
- MESSAGE(" arg : " << _argCopy[i]);
- _argServToLaunch.push_back(aServArg);
- argState = 0;
- }
- break;
- }
- default:
- {
- ASSERT(0);
- break;
- }
- }
+ {
+ case 0: // looking for "--with"
+ {
+ if (strcmp(_argv[iarg],"--with")==0)
+ argState = 1;
+ break;
+ }
+ case 1: // looking for server type
+ {
+ for (int i=0; i<Session_ServerThread::NB_SRV_TYP; i++)
+ if (strcmp(_argv[iarg],Session_ServerThread::_serverTypes[i])==0)
+ {
+ aServArg._servType = i;
+ argState = 2;
+ break;
+ }
+ break;
+ }
+ case 2: // looking for "("
+ {
+ if (strcmp(_argv[iarg],"(")!=0)
+ {
+ INFOS("parenthesis '(' is required here...");
+ for (int i=0; i<iarg; i++)
+ cerr << _argv[i] << " ";
+ cerr << endl;
+ throw SALOME_Exception(LOCALIZED("Error in command arguments, missing prenthesis"));
+ }
+ else
+ {
+ aServArg._firstArg=iarg+1; // arg after '('
+ argState = 3;
+ }
+ break;
+ }
+ case 3: // looking for arguments
+ {
+ if (strcmp(_argv[iarg],")")==0) // end of arguments = ')'
+ {
+ aServArg._lastArg=iarg-1; // arg before ')'
+ MESSAGE("server : "<< Session_ServerThread::_serverTypes[aServArg._servType]);
+ for (int i=aServArg._firstArg; i<=aServArg._lastArg; i++)
+ MESSAGE(" arg : " << _argCopy[i]);
+ _argServToLaunch.push_back(aServArg);
+ argState = 0;
+ }
+ break;
+ }
+ default:
+ {
+ ASSERT(0);
+ break;
+ }
+ }
}
if (argState == 1)
throw SALOME_Exception(LOCALIZED("Error in command arguments, missing server type"));
if (argc>1)
{
for (int i=0; i<argc-1; i++)
- //argv[i+1] = _argCopy[(*itServ)._firstArg + i].c_str();
- argv[i+1] = _argv[(*itServ)._firstArg + i];
+ //argv[i+1] = _argCopy[(*itServ)._firstArg + i].c_str();
+ argv[i+1] = _argv[(*itServ)._firstArg + i];
}
MESSAGE("*** activating [" << argc << "] : " << argv[0]);
public:
Session_ServerLauncher();
Session_ServerLauncher(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex *GUIMutex,
- QWaitCondition *ServerLaunch,
- QMutex *SessionMutex,
- QWaitCondition *SessionStarted);
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex *GUIMutex,
+ QWaitCondition *ServerLaunch,
+ QMutex *SessionMutex,
+ QWaitCondition *SessionStarted);
virtual ~Session_ServerLauncher();
void run();
void KillAll();
const int Session_ServerThread::NB_SRV_TYP = 7;
const char* Session_ServerThread::_serverTypes[NB_SRV_TYP] = {"Container",
- "ModuleCatalog",
- "Registry",
- "SALOMEDS",
- "Session",
- "SalomeAppEngine",
+ "ModuleCatalog",
+ "Registry",
+ "SALOMEDS",
+ "Session",
+ "SalomeAppEngine",
"ContainerManager"};
/*!
constructor
*/
Session_ServerThread::Session_ServerThread(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa)
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa)
{
//MESSAGE("Session_ServerThread Constructor " << argv[0]);
_argc = argc;
MESSAGE("Server Thread type : "<<_serverTypes[i]);
switch (_servType) {
case 0: // Container
- {
- NamingService_WaitForServerReadiness(_NS,"/Registry");
- NamingService_WaitForServerReadiness(_NS,"/ContainerManager");
- ActivateContainer(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"/Registry");
+ NamingService_WaitForServerReadiness(_NS,"/ContainerManager");
+ ActivateContainer(_argc, _argv);
+ break;
+ }
case 1: // ModuleCatalog
- {
- NamingService_WaitForServerReadiness(_NS,"/Registry");
- ActivateModuleCatalog(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"/Registry");
+ ActivateModuleCatalog(_argc, _argv);
+ break;
+ }
case 2: // Registry
- {
- NamingService_WaitForServerReadiness(_NS,"");
- ActivateRegistry(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"");
+ ActivateRegistry(_argc, _argv);
+ break;
+ }
case 3: // SALOMEDS
- {
- NamingService_WaitForServerReadiness(_NS,"/Kernel/ModulCatalog");
- ActivateSALOMEDS(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"/Kernel/ModulCatalog");
+ ActivateSALOMEDS(_argc, _argv);
+ break;
+ }
case 4: // Session
- {
- NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
- string containerName = "/Containers/";
- containerName = containerName + Kernel_Utils::GetHostname();
- containerName = containerName + "/FactoryServer";
- NamingService_WaitForServerReadiness(_NS,containerName);
- ActivateSession(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
+ string containerName = "/Containers/";
+ containerName = containerName + Kernel_Utils::GetHostname();
+ containerName = containerName + "/FactoryServer";
+ NamingService_WaitForServerReadiness(_NS,containerName);
+ ActivateSession(_argc, _argv);
+ break;
+ }
case 5: // SalomeApp_Engine
- {
- NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
- ActivateEngine(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
+ ActivateEngine(_argc, _argv);
+ break;
+ }
case 6: // Container Manager
- {
- NamingService_WaitForServerReadiness(_NS,"");
- ActivateContainerManager(_argc, _argv);
- break;
- }
+ {
+ NamingService_WaitForServerReadiness(_NS,"");
+ ActivateContainerManager(_argc, _argv);
+ break;
+ }
default:
- {
- ASSERT(0);
- break;
- }
+ {
+ ASSERT(0);
+ break;
+ }
}
}
}
}
void Session_ServerThread::ActivateModuleCatalog(int argc,
- char ** argv)
+ char ** argv)
{
try {
MESSAGE("ModuleCatalog thread started");
}
void Session_ServerThread::ActivateSALOMEDS(int argc,
- char ** argv)
+ char ** argv)
{
try {
MESSAGE("SALOMEDS thread started");
}
void Session_ServerThread::ActivateRegistry(int argc,
- char ** argv)
+ char ** argv)
{
MESSAGE("Registry thread started");
SCRUTE(argc);
}
void Session_ServerThread::ActivateContainerManager(int argc,
- char ** argv)
+ char ** argv)
{
try {
PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
}
void Session_ServerThread::ActivateContainer(int argc,
- char ** argv)
+ char ** argv)
{
try {
MESSAGE("Container thread started");
MESSAGE("factory_poa does not exists, create...");
// define policy objects
PortableServer::ImplicitActivationPolicy_var implicitActivation =
- _root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION);
+ _root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION);
// default = NO_IMPLICIT_ACTIVATION
PortableServer::ThreadPolicy_var threadPolicy =
- _root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL);
+ _root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL);
// default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
// create policy list
CORBA::PolicyList policyList;
policyList.length(2);
policyList[0] = PortableServer::ImplicitActivationPolicy::
- _duplicate(implicitActivation);
+ _duplicate(implicitActivation);
policyList[1] = PortableServer::ThreadPolicy::
- _duplicate(threadPolicy);
+ _duplicate(threadPolicy);
PortableServer::POAManager_var nil_mgr
- = PortableServer::POAManager::_nil();
+ = PortableServer::POAManager::_nil();
factory_poa = _root_poa->create_POA("factory_poa",
- nil_mgr,
- policyList);
+ nil_mgr,
+ policyList);
//with nil_mgr instead of pman,
//a new POA manager is created with the new POA
}
void Session_ServerThread::ActivateSession(int argc,
- char ** argv)
+ char ** argv)
{
MESSAGE("Session_ServerThread::ActivateSession() not implemented!");
}
constructor
*/
Session_SessionThread::Session_SessionThread(int argc,
- char** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
- QWaitCondition* GUILauncher)
+ char** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
+ QWaitCondition* GUILauncher)
: Session_ServerThread(argc, argv, orb, poa),
_GUIMutex( GUIMutex ),
_GUILauncher( GUILauncher )
}
void Session_SessionThread::ActivateSession(int argc,
- char ** argv)
+ char ** argv)
{
try {
MESSAGE("Session thread started");
Session_ServerThread();
Session_ServerThread(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa);
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa);
virtual ~Session_ServerThread();
void Init();
protected:
public:
Session_SessionThread() {}
Session_SessionThread(int argc,
- char** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
+ char** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
QWaitCondition* GUILauncher);
virtual ~Session_SessionThread();
constructor
*/
SALOME_Session_i::SALOME_Session_i(int argc,
- char ** argv,
- CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- QMutex* GUIMutex,
- QWaitCondition* GUILauncher)
+ char ** argv,
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ QMutex* GUIMutex,
+ QWaitCondition* GUILauncher)
{
_argc = argc ;
_argv = argv ;
Engines::Component_ptr SALOME_Session_i::GetComponent(const char* theLibraryName)
{
typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr,
- PortableServer::POA_ptr,
- SALOME_NamingService*,QMutex*);
+ PortableServer::POA_ptr,
+ SALOME_NamingService*,QMutex*);
OSD_SharedLibrary aSharedLibrary(const_cast<char*>(theLibraryName));
if(aSharedLibrary.DlOpen(OSD_RTLD_LAZY))
if(OSD_Function anOSDFun = aSharedLibrary.DlSymb("GetImpl"))
virtual void Execute() {
SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy();
if ( study ) {
- study->restoreState(_savePoint);
+ study->restoreState(_savePoint);
}
}
};
if ( SUIT_Session::session() ) {
if ( SUIT_Session::session()->activeApplication() ) {
if ( SUIT_Session::session()->activeApplication()->desktop() ) {
- ProcessVoidEvent( new TEvent(theMessage) );
+ ProcessVoidEvent( new TEvent(theMessage) );
}
}
}
class QWaitCondition;
class SESSION_EXPORT SALOME_Session_i: public virtual POA_SALOME::Session,
- public virtual PortableServer::ServantBase
+ public virtual PortableServer::ServantBase
{
public:
SALOME_Session_i(int argc,
static QColor mixColors( const QColor& c1, const QColor& c2 )
{
return QColor( (c1.red() + c2.red() ) / 2,
- (c1.green() + c2.green() ) / 2,
- (c1.blue() + c2.blue() ) / 2,
- (c1.alpha() + c2.alpha() ) / 2 );
+ (c1.green() + c2.green() ) / 2,
+ (c1.blue() + c2.blue() ) / 2,
+ (c1.alpha() + c2.alpha() ) / 2 );
}
/*!
for ( int i = (int)QPalette::Active; i <= (int)QPalette::Inactive; i++ ) {
for ( int j = (int)Style_Model::WindowText; j < (int)Style_Model::NColorRoles; j++ ) {
myColors[ (QPalette::ColorGroup)i ][ (Style_Model::ColorRole)j ] =
- myAppData->myPalette.color( (QPalette::ColorGroup)i, (QPalette::ColorRole)j );
+ myAppData->myPalette.color( (QPalette::ColorGroup)i, (QPalette::ColorRole)j );
}
}
setWidgetEffect( (WidgetEffect)effect );
}
else if ( resourceMgr()->hasValue( section, "is-highlight-widget" ) ||
- resourceMgr()->hasValue( section, "is-raising-widget" ) ) {
+ resourceMgr()->hasValue( section, "is-raising-widget" ) ) {
bool highlight = resourceMgr()->booleanValue( section, "is-highlight-widget", false );
bool autoraise = resourceMgr()->booleanValue( section, "is-highlight-widget", false );
if ( highlight )
\sa color()
*/
void Style_Model::setColor( Style_Model::ColorRole role, const QColor& active,
- const QColor& inactive, const QColor& disabled )
+ const QColor& inactive, const QColor& disabled )
{
QColor ac = active, ic = inactive, dc = disabled;
\sa readColorValue()
*/
void Style_Model::writeColorValue( ColorRole role, const QString& prefix,
- QtxResourceMgr* resMgr, const QString& resSection ) const
+ QtxResourceMgr* resMgr, const QString& resSection ) const
{
QString active = QString( "%1-color" ).arg( prefix );
QString inactive = QString( "%1-color-inactive" ).arg( prefix );
\internal
*/
void Style_PrefDlg::PaletteEditor::setColor( int id, const QColor& active,
- const QColor& inactive, const QColor& disabled )
+ const QColor& inactive, const QColor& disabled )
{
setColor( id, QPalette::Active, active );
setColor( id, QPalette::Inactive, inactive.isValid() ? inactive : active );
const QPalette pal = QPalette( c );
for ( int i = 0; i < (int)Style_Model::NColorRoles; i++ ) {
setColor( i,
- pal.color( QPalette::Active, (QPalette::ColorRole)i ),
- pal.color( QPalette::Inactive, (QPalette::ColorRole)i ),
- pal.color( QPalette::Disabled, (QPalette::ColorRole)i ) );
+ pal.color( QPalette::Active, (QPalette::ColorRole)i ),
+ pal.color( QPalette::Inactive, (QPalette::ColorRole)i ),
+ pal.color( QPalette::Disabled, (QPalette::ColorRole)i ) );
}
// Header
setColor( Style_Model::Header,
- pal.color( QPalette::Active, QPalette::Button ),
- pal.color( QPalette::Inactive, QPalette::Button ),
- pal.color( QPalette::Disabled, QPalette::Button ) );
+ pal.color( QPalette::Active, QPalette::Button ),
+ pal.color( QPalette::Inactive, QPalette::Button ),
+ pal.color( QPalette::Disabled, QPalette::Button ) );
// Checked
setColor( Style_Model::Checked,
- pal.color( QPalette::Active, QPalette::Base ),
- pal.color( QPalette::Inactive, QPalette::Base ),
- pal.color( QPalette::Disabled, QPalette::Base ) );
+ pal.color( QPalette::Active, QPalette::Base ),
+ pal.color( QPalette::Inactive, QPalette::Base ),
+ pal.color( QPalette::Disabled, QPalette::Base ) );
// Lines
setColor( Style_Model::Lines,
- pal.color( QPalette::Active, QPalette::Mid ),
- pal.color( QPalette::Inactive, QPalette::Mid ),
- pal.color( QPalette::Disabled, QPalette::Mid ) );
+ pal.color( QPalette::Active, QPalette::Mid ),
+ pal.color( QPalette::Inactive, QPalette::Mid ),
+ pal.color( QPalette::Disabled, QPalette::Mid ) );
// Slider
setColor( Style_Model::Slider,
- pal.color( QPalette::Active, QPalette::Button ),
- pal.color( QPalette::Inactive, QPalette::Button ),
- pal.color( QPalette::Disabled, QPalette::Button ) );
+ pal.color( QPalette::Active, QPalette::Button ),
+ pal.color( QPalette::Inactive, QPalette::Button ),
+ pal.color( QPalette::Disabled, QPalette::Button ) );
// ProgressBar
setColor( Style_Model::ProgressBar,
- pal.color( QPalette::Active, QPalette::Highlight ),
- pal.color( QPalette::Inactive, QPalette::Highlight ),
- pal.color( QPalette::Disabled, QPalette::Highlight ) );
+ pal.color( QPalette::Active, QPalette::Highlight ),
+ pal.color( QPalette::Inactive, QPalette::Highlight ),
+ pal.color( QPalette::Disabled, QPalette::Highlight ) );
// FieldLight
setColor( Style_Model::FieldLight,
- pal.color( QPalette::Active, QPalette::Light ),
- pal.color( QPalette::Inactive, QPalette::Light ),
- pal.color( QPalette::Disabled, QPalette::Light ) );
+ pal.color( QPalette::Active, QPalette::Light ),
+ pal.color( QPalette::Inactive, QPalette::Light ),
+ pal.color( QPalette::Disabled, QPalette::Light ) );
// FieldDark
setColor( Style_Model::FieldDark,
- pal.color( QPalette::Active, QPalette::Mid ).light( 125 ),
- pal.color( QPalette::Inactive, QPalette::Mid ).light( 125 ),
- pal.color( QPalette::Disabled, QPalette::Mid ).light( 125 ) );
+ pal.color( QPalette::Active, QPalette::Mid ).light( 125 ),
+ pal.color( QPalette::Inactive, QPalette::Mid ).light( 125 ),
+ pal.color( QPalette::Disabled, QPalette::Mid ).light( 125 ) );
// GridLine
setColor( Style_Model::GridLine,
- pal.color( QPalette::Active, QPalette::Mid ),
- pal.color( QPalette::Inactive, QPalette::Mid ),
- pal.color( QPalette::Disabled, QPalette::Mid ) );
+ pal.color( QPalette::Active, QPalette::Mid ),
+ pal.color( QPalette::Inactive, QPalette::Mid ),
+ pal.color( QPalette::Disabled, QPalette::Mid ) );
// HighlightWidget
setColor( Style_Model::HighlightWidget,
- pal.color( QPalette::Active, QPalette::Button ),
- pal.color( QPalette::Inactive, QPalette::Button ),
- pal.color( QPalette::Disabled, QPalette::Button ) );
+ pal.color( QPalette::Active, QPalette::Button ),
+ pal.color( QPalette::Inactive, QPalette::Button ),
+ pal.color( QPalette::Disabled, QPalette::Button ) );
// HighlightWidget
setColor( Style_Model::HighlightBorder,
- pal.color( QPalette::Active, QPalette::Button ).dark( 100 ),
- pal.color( QPalette::Inactive, QPalette::Button ).dark( 100 ),
- pal.color( QPalette::Disabled, QPalette::Button ).dark( 100 ) );
+ pal.color( QPalette::Active, QPalette::Button ).dark( 100 ),
+ pal.color( QPalette::Inactive, QPalette::Button ).dark( 100 ),
+ pal.color( QPalette::Disabled, QPalette::Button ).dark( 100 ) );
// Pointer
setColor( Style_Model::Pointer, Qt::black, Qt::black, Qt::black );
// BorderTop
setColor( Style_Model::BorderTop,
- aDarkActive.lighter(),
- aDarkInactive.lighter(),
- aDarkDisabled.lighter() );
+ aDarkActive.lighter(),
+ aDarkInactive.lighter(),
+ aDarkDisabled.lighter() );
// BorderBottom
setColor( Style_Model::BorderBottom,
- aDarkActive.darker(),
- aDarkInactive.darker(),
- aDarkDisabled.darker() );
+ aDarkActive.darker(),
+ aDarkInactive.darker(),
+ aDarkDisabled.darker() );
// TabBorderTop
setColor( Style_Model::TabBorderTop,
- aDarkActive.light().light().light(),
- aDarkInactive.light().light().light(),
- aDarkDisabled.light().light().light() );
+ aDarkActive.light().light().light(),
+ aDarkInactive.light().light().light(),
+ aDarkDisabled.light().light().light() );
// TabBorderBottom
setColor( Style_Model::TabBorderBottom,
- aDarkActive.dark().dark().dark(),
- aDarkInactive.dark().dark().dark(),
- aDarkDisabled.dark().dark().dark() );
+ aDarkActive.dark().dark().dark(),
+ aDarkInactive.dark().dark().dark(),
+ aDarkDisabled.dark().dark().dark() );
}
/*!
connect( myStyleCheck, SIGNAL( toggled( bool ) ), fr, SLOT( setEnabled( bool ) ) );
connect( myStylesList, SIGNAL( itemSelectionChanged() ), this, SLOT( onStyleChanged() ) );
connect( myStylesList, SIGNAL( itemChanged( QListWidgetItem* ) ),
- this, SLOT( onItemChanged( QListWidgetItem* ) ) );
+ this, SLOT( onItemChanged( QListWidgetItem* ) ) );
connect( myStylesList, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
- this, SLOT( onApply() ) );
+ this, SLOT( onApply() ) );
connect( myLinesCombo, SIGNAL( activated( int ) ), this, SLOT( onLinesType() ) );
connect( myPaletteEditor, SIGNAL( changed() ), this, SIGNAL( styleChanged() ) );
connect( myFontEdit, SIGNAL( changed( QFont ) ), this, SIGNAL( styleChanged() ) );
connect( mySplitterLength, SIGNAL( valueChanged( int ) ), this, SIGNAL( styleChanged() ) );
connect( mySliderSize, SIGNAL( valueChanged( int ) ), this, SIGNAL( styleChanged() ) );
connect( aGroup, SIGNAL( buttonClicked( QAbstractButton* ) ),
- this, SLOT( onEffectChanged( QAbstractButton* ) ) );
+ this, SLOT( onEffectChanged( QAbstractButton* ) ) );
connect( this, SIGNAL( styleChanged() ), this, SLOT( onChanged() ) );
connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
QListWidgetItem* item = myStylesList->currentItem();
if ( item && item->data( TypeRole ).toInt() == User ) {
if ( QMessageBox::question( this,
- tr( "Delete user theme" ),
- tr( "Remove theme %1?" ).arg( item->text() ),
- QMessageBox::Yes | QMessageBox::No,
- QMessageBox::Yes ) == QMessageBox::Yes ) {
- resourceMgr()->remove( item->data( NameRole ).toString() );
- resourceMgr()->save();
- delete item;
+ tr( "Delete user theme" ),
+ tr( "Remove theme %1?" ).arg( item->text() ),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::Yes ) == QMessageBox::Yes ) {
+ resourceMgr()->remove( item->data( NameRole ).toString() );
+ resourceMgr()->save();
+ delete item;
}
}
}
// ... first set Button color 'cause it is used to calculate other ones
if ( myPaletteEditor->isAuto() )
model->setColor( Style_Model::Button,
- myPaletteEditor->color( Style_Model::Button, QPalette::Active ) );
+ myPaletteEditor->color( Style_Model::Button, QPalette::Active ) );
else
model->setColor( Style_Model::Button,
- myPaletteEditor->color( Style_Model::Button, QPalette::Active ),
- myPaletteEditor->color( Style_Model::Button, QPalette::Inactive ),
- myPaletteEditor->color( Style_Model::Button, QPalette::Disabled ));
+ myPaletteEditor->color( Style_Model::Button, QPalette::Active ),
+ myPaletteEditor->color( Style_Model::Button, QPalette::Inactive ),
+ myPaletteEditor->color( Style_Model::Button, QPalette::Disabled ));
// ... then set all other colors
for ( int i = (int)Style_Model::WindowText; i < (int)Style_Model::LastColor; i++ ) {
if ( i == Style_Model::NoRole ) continue; // not supported
if ( i == Style_Model::Button ) continue; // already set
if ( myPaletteEditor->isAuto() )
model->setColor( (Style_Model::ColorRole)i,
- myPaletteEditor->color( i, QPalette::Active ) );
+ myPaletteEditor->color( i, QPalette::Active ) );
else
model->setColor( (Style_Model::ColorRole)i,
- myPaletteEditor->color( i, QPalette::Active ),
- myPaletteEditor->color( i, QPalette::Inactive ),
- myPaletteEditor->color( i, QPalette::Disabled ));
+ myPaletteEditor->color( i, QPalette::Active ),
+ myPaletteEditor->color( i, QPalette::Inactive ),
+ myPaletteEditor->color( i, QPalette::Disabled ));
}
model->setAutoPalette( myPaletteEditor->isAuto() ); // internal
// font
myStylesList->blockSignals( false );
}
onChanged();
-}
+}
/*!
\brief Called when widget effect is changed
setWorkingMode( IgnoreUserValues );
QMutableListIterator<QString> it( sl );
while ( it.hasNext() ) {
- QString s = it.next();
- if ( hasSection( s ) ) it.remove();
+ QString s = it.next();
+ if ( hasSection( s ) ) it.remove();
}
}
break;
\param w widget
*/
void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComplex* opt,
- QPainter* p, const QWidget* w ) const
+ QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(4) ) {
QWindowsStyle::drawComplexControl( cc, opt, p, w );
double aRad = model()->widgetRounding( Style_Model::EditRadius );
bool antialized = model()->antialiasing();
QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
if ( hover )
drawHoverRect(p, optr, opt->palette.color( QPalette::Window ), aRad, Style_Tools::Left, true);
else
Style_Tools::shadowRect( p, optr, aRad, LINE_GR_MARGIN, SHADOW, Style_Tools::Left,
model()->color( Style_Model::FieldLight ), // Style_Model::fld_light_clr,
model()->color( Style_Model::FieldDark ), // Style_Model::fld_dark_clr,
- aBrdTopCol, aBrdBotCol, antialized, false );
+ aBrdTopCol, aBrdBotCol, antialized, false );
QRect aBtnRect = QRect( QPoint( arUp.x(), optr.y() ), QPoint( arUp.right(), optr.bottom() ) );
QColor aBtnCol = opt->palette.color( QPalette::Button );
bool aStateOn = opt->state & ( State_Sunken | State_On );
copy.rect = aBtnRect;
drawPrimitive(pe, ©, p, w);
}
- break;
+ break;
}
case CC_ComboBox: {
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
bool antialized = model()->antialiasing();
double aRad = model()->widgetRounding( Style_Model::EditRadius );
QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
if ( hover )
drawHoverRect(p, optr, opt->palette.color( QPalette::Window ), aRad, Style_Tools::Left, true);
else
Style_Tools::shadowRect( p, optr, aRad, LINE_GR_MARGIN, SHADOW, Style_Tools::Left,
model()->color( Style_Model::FieldLight ), // Style_Model::fld_light_clr,
model()->color( Style_Model::FieldDark ), // Style_Model::fld_dark_clr,
- aBrdTopCol, aBrdBotCol, antialized, false );
+ aBrdTopCol, aBrdBotCol, antialized, false );
if (cmb->subControls & SC_ComboBoxArrow) {
State flags = State_None;
QColor aBtnCol = opt->palette.color( QPalette::Button );
p->setPen(cmb->palette.highlightedText().color());
}
else
- p->setPen(cmb->palette.text().color());
+ p->setPen(cmb->palette.text().color());
}
break;
}
if( hasHover() && (slider->state & State_Enabled) &&
(slider->state & State_MouseOver) ) {
- QRect moderated = w->rect();
+ QRect moderated = w->rect();
drawHoverRect(p, moderated, opt->palette.color( QPalette::Window ),
model()->widgetRounding( Style_Model::ButtonRadius ), Style_Tools::All, false);
}
bool tickAbove = slider->tickPosition == QSlider::TicksAbove;
bool tickBelow = slider->tickPosition == QSlider::TicksBelow;
QColor aBtnCol = model()->color( Style_Model::Slider ); // Style_Model::slider_clr
- QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
// rect was changed on +/-DELTA_SLIDER value for correct painting Antialised border of slider
int aDelta = DELTA_SLIDER-1;
QRect slRect = QRect(x+aDelta, y+aDelta, wi-aDelta, he-aDelta);
menuArea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, w);
if (w && ( qobject_cast<QToolBar *>(w->parentWidget() ) ||
- toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) )
- ) {
+ toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) )
+ ) {
QWindowsStyle::drawComplexControl( cc, opt, p, w );
return;
}
bool isAutoRaising = model()->widgetEffect() == Style_Model::AutoRaiseEffect;
bool isHighWdg = model()->widgetEffect() == Style_Model::HighlightEffect;
bool hover = hasHover() && (opt->state & State_Enabled) && ( opt->state & State_MouseOver );
- QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
QRect aRect = button;
int aType = isMenuBtn ? Style_Tools::Left : Style_Tools::All;
if ( toolbutton->subControls & SC_ToolButton ) {
else
Style_Tools::shadowRect( p, aRect, aMinDelta, -1, SHADOW, aType, top, bottom,
aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
- }
+ }
if (toolbutton->subControls & SC_ToolButtonMenu) {
p->save();
if ( aMinDelta > menuArea.height()/2 )
fr.rect.adjust(3, 3, -3, -3);
if (toolbutton->features & QStyleOptionToolButton::Menu)
fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, w), 0);
- Style_Tools::drawFocus( p, fr.rect, aMinDelta-1, isMenuBtn ? Style_Tools::Left :
+ Style_Tools::drawFocus( p, fr.rect, aMinDelta-1, isMenuBtn ? Style_Tools::Left :
Style_Tools::All, aBrdBotCol );
}
QStyleOptionToolButton label = *toolbutton;
QRect checkBoxRect = subControlRect( cc, opt, SC_GroupBoxCheckBox, w);
if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
QRect aRect = subControlRect( cc, opt, SC_GroupBoxFrame, w);
- QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
Style_Tools::shadowRect( p, aRect, model()->widgetRounding( Style_Model::FrameRadius ), 0.,
SHADOW, Style_Tools::All,
model()->color( Style_Model::FieldLight ), // Style_Model::fld_light_clr
model()->color( Style_Model::FieldDark ), // Style_Model::fld_dark_clr
- aBrdTopCol, aBrdBotCol, false, false, false, false);
+ aBrdTopCol, aBrdBotCol, false, false, false, false);
}
// Draw title
if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
drawControl(CE_PushButtonLabel, &subopt, p, w);
if (btn->state & State_HasFocus) {
QRect aRect = subElementRect( SE_PushButtonFocusRect, btn, w );
- Style_Tools::drawFocus( p, aRect, model()->widgetRounding( Style_Model::ButtonRadius ),
+ Style_Tools::drawFocus( p, aRect, model()->widgetRounding( Style_Model::ButtonRadius ),
Style_Tools::All, model()->color( Style_Model::BorderBottom ) );
}
- break;
+ break;
}
case CE_PushButtonBevel:
if ( qstyleoption_cast<const QStyleOptionButton *>(opt) ) {
QColor aBtnCol = opt->palette.color( QPalette::Button );
QColor top = aBtnCol.light( BUT_PERCENT_COL ),
- bottom = aBtnCol.dark( BUT_PERCENT_COL );
+ bottom = aBtnCol.dark( BUT_PERCENT_COL );
QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
QRect r = opt->rect;
bool antialized = model()->antialiasing();
if ( isAutoRaising && hover && !aStateOn )
aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
else if ( isHighWdg && hover && !aStateOn )
drawHoverRect( p, r, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, true );
- else
+ else
Style_Tools::shadowRect( p, r, aRad, -1, SHADOW, Style_Tools::All, top, bottom,
aBrdTopCol, aBrdBotCol, antialized, true, aStateOn );
- break;
+ break;
}
case CE_DockWidgetTitle:
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
dwOpt->state & State_Enabled, aTitle,
floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
p->setFont(oldFont);
- }
- break;
+ }
+ break;
}
case CE_Splitter: {
QWindowsStyle::drawControl( ce, opt, p, w );
bool isSelected = opt->state & State_Selected;
bool isLast = tab->position == QStyleOptionTab::End ||
tab->position == QStyleOptionTab::OnlyOneTab;
- QColor aColor = opt->palette.color( QPalette::Window ),
+ QColor aColor = opt->palette.color( QPalette::Window ),
aDarkColor = aColor.dark( BUT_PERCENT_ON );
- QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
bool isHover = hasHover() && (opt->state & State_Enabled) &&
(opt->state & State_MouseOver);
DELTA_H_TAB, aColor, aDarkColor,
aBrdTopCol, aBrdBotCol, isSelected, isLast, isHover );
p->restore();
- } else
+ } else
QCommonStyle::drawControl(ce, opt, p, w);
break;
}
case CE_TabBarTabLabel:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- if ( tab->position == QStyleOptionTab::End ||
+ if ( tab->position == QStyleOptionTab::End ||
tab->position == QStyleOptionTab::OnlyOneTab ) {
QRect oldRect = opt->rect;
int aDelta = 0;
aDelta = (int)(opt->rect.height()*DELTA_H_TAB/2);
oldRect = QRect( oldRect.topLeft(), QPoint( oldRect.right()-aDelta, oldRect.bottom() ) );
}
- else {
+ else {
aDelta = (int)(opt->rect.width()*DELTA_H_TAB/2);
oldRect = QRect( oldRect.topLeft(), QPoint( oldRect.right(), oldRect.bottom()-aDelta ) );
- }
+ }
QStyleOptionTab* copyTab = (QStyleOptionTab*)tab;
copyTab->rect = oldRect;
QWindowsStyle::drawControl( ce, copyTab, p, w );
- }
+ }
else
QWindowsStyle::drawControl( ce, opt, p, w );
break;
QColor aBtnCol = opt->palette.color( QPalette::Window ),
top = aBtnCol.light( BUT_PERCENT_ON ),
bottom = aBtnCol.dark( BUT_PERCENT_ON );
- QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
bool aHighWdg = model()->widgetEffect() == Style_Model::HighlightEffect;
if ( !aStateOn && aHighWdg && (opt->state & State_Enabled) &&
(opt->state & State_Selected) )
break;
case CE_ProgressBarGroove: {
QColor aBgColor = opt->palette.color( QPalette::Window ),
- top = aBgColor.light( BUT_PERCENT_ON ),
+ top = aBgColor.light( BUT_PERCENT_ON ),
bottom = aBgColor.dark( BUT_PERCENT_ON );
QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
int myHeight = pbBits.rect.height();
pbBits.state = State_None;
QRect aRect;
- QColor aColor = model()->color( Style_Model::ProgressBar ); // Style_Model::prbar_clr
- QColor top = aColor.light( BUT_PERCENT_COL );
- QColor bottom = aColor.dark( BUT_PERCENT_COL );
+ QColor aColor = model()->color( Style_Model::ProgressBar ); // Style_Model::prbar_clr
+ QColor top = aColor.light( BUT_PERCENT_COL );
+ QColor bottom = aColor.dark( BUT_PERCENT_COL );
int aType;
for (int i = 0; i <= nu; ++i) {
aType = Style_Tools::None;
if ( unit_width > 1 ) {
aTopClr = aColor.light();
aBotClr = aColor.dark();
- }
+ }
Style_Tools::shadowRect( p, aRect, model()->widgetRounding( Style_Model::EditRadius ), -1, 0,
aType, top, bottom, aTopClr, aBotClr, false, true );
x += reverse ? -unit_width : unit_width;
double aMargin = LINE_GR_MARGIN;
QLinearGradient gr(x,y,menuitem->rect.right(),y);
gr.setColorAt( 0.0, aBgColor );
- gr.setColorAt( aMargin/width, model()->color( Style_Model::FieldLight ) ); // Style_Model::fld_light_clr
+ gr.setColorAt( aMargin/width, model()->color( Style_Model::FieldLight ) ); // Style_Model::fld_light_clr
gr.setColorAt( 1.0, model()->color( Style_Model::FieldLight ) );
QBrush fill;
if ( act )
p->fillRect(menuitem->rect, fill);
if (menuitem->menuItemType == QStyleOptionMenuItem::Separator){
int yoff = y-1 + h / 2;
- QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
p->setPen( aBrdBotCol );
p->drawLine(x + 2, yoff, x + width - 4, yoff);
p->setPen( aBrdTopCol );
Qt::AlignLeft | Qt::AlignVCenter,
iconRect.size(), alignRect);
- // Here's absent filling of pixmap on basic color for editable comboBox
+ // Here's absent filling of pixmap on basic color for editable comboBox
drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
if (cb->direction == Qt::RightToLeft)
QColor top = aBtnCol.light( BUT_PERCENT_COL ),
bottom = aBtnCol.dark( BUT_PERCENT_COL );
QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
Style_Tools::shadowRect( p, opt->rect, 0, -1, 0, Style_Tools::All, top, bottom, aBrdTopCol,
aBrdBotCol, false, true, aStateOn, true );
PrimitiveElement arrow;
if ( hasHover() && enabled && (opt->state & State_MouseOver) )
drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, false);
else {
- QColor aColor = model()->color( Style_Model::Slider ); // Style_Model::slider_clr
+ QColor aColor = model()->color( Style_Model::Slider ); // Style_Model::slider_clr
if ( !enabled )
aColor = opt->palette.button().color();
- QColor top = aColor.light( BUT_PERCENT_ON ),
+ QColor top = aColor.light( BUT_PERCENT_ON ),
bottom = aColor.dark( BUT_PERCENT_ON );
- QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
QRect r = opt->rect;
QPainterPath path = Style_Tools::roundRect( r, aRad,
Style_Tools::All );
\param w widget (optional)
*/
void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt,
- QPainter* p, const QWidget* w ) const
+ QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(6) ) {
QWindowsStyle::drawPrimitive( pe, opt, p, w );
QColor aBtnCol = opt->palette.color( QPalette::Window ),
top = aBtnCol.light( BUT_PERCENT_ON ),
bottom = aBtnCol.dark( BUT_PERCENT_ON );
- QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
Style_Tools::shadowRect( p, opt->rect, 0, 0., SHADOW, Style_Tools::All, top,
bottom, aBrdTopCol, aBrdBotCol, false, false, false, false );
break;
case PE_PanelButtonTool : {
if ( w && ( opt->state & State_Enabled ) &&
( ( qobject_cast<QToolBar*>( w->parentWidget() ) ) ||
- ( w->inherits("QDockWidgetTitleButton") ) ||
+ ( w->inherits("QDockWidgetTitleButton") ) ||
( w->inherits("QtxWorkstackAreaTitleButton") ) ) ) {
bool aStateOn = opt->state & (State_Sunken | State_On);
bool aHighWdg = model()->widgetEffect() == Style_Model::HighlightEffect;
drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), 0, Style_Tools::All, true);
else {
QColor aBtnCol = opt->palette.color( QPalette::Window );
- QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
QColor top = aBtnCol.light( BUT_PERCENT_COL ),
bottom = aBtnCol.dark( BUT_PERCENT_COL );
Style_Tools::shadowRect( p, opt->rect, 0.0, 0, SHADOW, Style_Tools::All, top, bottom,
aBrdTopCol, aBrdBotCol, model()->antialiasing(), true, aStateOn );
- }
- break;
+ }
+ break;
}
else
QWindowsStyle::drawPrimitive( pe, opt, p, w );
case PE_FrameFocusRect: {
if (w && qobject_cast<QTabBar*>((QWidget*)w)) {
QTabBar* tabBar = qobject_cast<QTabBar*>((QWidget*)w);
- QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
bool isHover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
Style_Tools::tabRect( p, opt->rect, (int)tabBar->shape(),
model()->widgetRounding( Style_Model::FrameRadius ), DELTA_H_TAB,
aBrdTopCol, aBrdBotCol, false, false, isHover, true );
}
else {
- QWindowsStyle::drawPrimitive( pe, opt, p, w );
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
}
break;
}
QRect rect = opt->rect;
QColor pen, brush;
if ( opt->state & State_Enabled ) {
- pen = model()->color( Style_Model::Pointer ); // Style_Model::pointer_clr
- brush = opt->palette.color( QPalette::Button );
+ pen = model()->color( Style_Model::Pointer ); // Style_Model::pointer_clr
+ brush = opt->palette.color( QPalette::Button );
if ( ( opt->state & State_Sunken ) && (opt->state & State_Enabled ) )
rect.moveTo( rect.x()+1, rect.y()+1 );
} else {
pen = opt->palette.mid().color();
- brush = pen;
+ brush = pen;
}
if ( pe == PE_IndicatorSpinPlus || pe == PE_IndicatorSpinMinus )
- Style_Tools::drawSign( pe, p, rect, pen, brush );
+ Style_Tools::drawSign( pe, p, rect, pen, brush );
else
- Style_Tools::drawArrow( pe, p, rect, pen, brush );
+ Style_Tools::drawArrow( pe, p, rect, pen, brush );
break;
}
case PE_IndicatorCheckBox: {
if ( hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver) )
drawHoverRect(p, w->rect(), opt->palette.color( QPalette::Window ),
- model()->widgetRounding( Style_Model::EditRadius ),
+ model()->widgetRounding( Style_Model::EditRadius ),
Style_Tools::All, false);
QBrush fill;
if (opt->state & State_NoChange)
}
const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);
p->setPen(itemViewOpt && itemViewOpt->showDecorationSelected
- && opt->state & State_Selected ? opt->palette.highlightedText().color()
- : opt->palette.text().color());
+ && opt->state & State_Selected ? opt->palette.highlightedText().color()
+ : opt->palette.text().color());
if (opt->state & State_NoChange)
- p->setBrush( opt->palette.color( QPalette::Button ) );
+ p->setBrush( opt->palette.color( QPalette::Button ) );
p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11);
if (!(opt->state & State_Off)) {
QLineF lines[11];
QColor aColor = model()->color( Style_Model::Pointer ); // Style_Model::pointer_clr
if ( !(opt->state & State_Enabled ) )
aColor = opt->palette.mid().color();
- if ( opt->state & State_Selected && itemViewOpt && itemViewOpt->showDecorationSelected )
+ if ( opt->state & State_Selected && itemViewOpt && itemViewOpt->showDecorationSelected )
aColor = opt->palette.highlightedText().color();
p->setPen( QPen( aColor ) );
case PE_IndicatorRadioButton: {
if ( hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver) )
drawHoverRect(p, w->rect(), opt->palette.color( QPalette::Window ),
- model()->widgetRounding( Style_Model::ButtonRadius ),
+ model()->widgetRounding( Style_Model::ButtonRadius ),
Style_Tools::All, false);
#define PTSARRLEN(x) sizeof(x)/(sizeof(QPoint))
static const QPoint pts_border[] = { // border line
else {
QColor fillColor = opt->palette.color( QPalette::Base );
if ( enabled && on )
- fillColor = model()->color( Style_Model::Checked ); // Style_Model::checked_clr
+ fillColor = model()->color( Style_Model::Checked ); // Style_Model::checked_clr
QLinearGradient gr( 3, 3, 8, 8 );
gr.setColorAt( 0.0, fillColor.dark( BUT_PERCENT_ON ) );
gr.setColorAt( 1.0, fillColor );
}
if ( pe == PE_FrameLineEdit ) {
QColor aBrdTopCol = model()->color( Style_Model::BorderTop ); // Style_Model::border_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::BorderBottom ); // Style_Model::border_bot_clr
bool hover = hasHover() && (opt->state & State_Enabled) && (opt->state & State_MouseOver);
double aRad = model()->widgetRounding( Style_Model::EditRadius );
if ( hover )
drawHoverRect(p, opt->rect, opt->palette.color( QPalette::Window ), aRad, Style_Tools::All, true);
else {
Style_Tools::shadowRect( p, opt->rect, aRad, LINE_GR_MARGIN, SHADOW,
- Style_Tools::All, opt->palette.color( QPalette::Base ), // getColor( Style_Model::fld_light_clr ),
+ Style_Tools::All, opt->palette.color( QPalette::Base ), // getColor( Style_Model::fld_light_clr ),
model()->color( Style_Model::FieldDark ), aBrdTopCol, aBrdBotCol,
model()->antialiasing(), false );
}
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
QRect rect = panel->rect.adjusted( panel->lineWidth, panel->lineWidth,
-panel->lineWidth, -panel->lineWidth);
- if ( w->inherits("QLineEdit") && panel->lineWidth > 0 ) {
+ if ( w->inherits("QLineEdit") && panel->lineWidth > 0 ) {
drawPrimitive( PE_FrameLineEdit, panel, p, w );
- }
+ }
else {
- QColor c = panel->palette.color(QPalette::Base); c.setAlpha(255);
+ QColor c = panel->palette.color(QPalette::Base); c.setAlpha(255);
p->fillRect( rect, c ); // panel->palette.brush(QPalette::Base)
- }
- }
+ }
+ }
}
break;
}
if ( aTabPos != QTabWidget::East )
aRoundType = aRoundType | Style_Tools::TopRight;
QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
Style_Tools::shadowRect( p, opt->rect, model()->widgetRounding( Style_Model::FrameRadius ),
0., SHADOW, aRoundType,
model()->color( Style_Model::FieldLight ),
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast &&
- tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
+ tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
QWindowsStyle::drawPrimitive( pe, opt, p, w );
break;
}
isLast = tabBar->currentIndex() == tabBar->count() -1;
QColor aColor = opt->palette.color( QPalette::Window );
QColor aBrdTopCol = model()->color( Style_Model::TabBorderTop ); // Style_Model::border_tab_top_clr
- QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
+ QColor aBrdBotCol = model()->color( Style_Model::TabBorderBottom ); // Style_Model::border_tab_bot_clr
bool isHover = hasHover() && (opt->state & State_Enabled) &&
(opt->state & State_MouseOver);
QPainterPath aSelPath = Style_Tools::tabRect( p, aSelRect, (int)tbb->shape,
- model()->widgetRounding( Style_Model::FrameRadius ),
- DELTA_H_TAB, aColor, aColor,
+ model()->widgetRounding( Style_Model::FrameRadius ),
+ DELTA_H_TAB, aColor, aColor,
aColor, aColor, isSelected, isLast, isHover, false, false );
if ( !aSelPath.isEmpty() )
aSelRect = aSelPath.controlPointRect().toRect();
QStyleOptionTabBarBase* copyOpt = (QStyleOptionTabBarBase*)tbb;
copyOpt->selectedTabRect = aSelRect;
- QCommonStyle::drawPrimitive( pe, copyOpt, p, w );
+ QCommonStyle::drawPrimitive( pe, copyOpt, p, w );
break;
}
case PE_IndicatorBranch: {
QPalette aPal = aWdg->palette();
double aMarg = LINE_GR_MARGIN;
QColor base = model()->color( Style_Model::Base ), // Style_Model::pal_base_clr
- light = base,
- light_alt = base.dark(110),//AlternateBase color
- dark = model()->color( Style_Model::FieldDark ); // Style_Model::fld_dark_clr
+ light = base,
+ light_alt = base.dark(110),//AlternateBase color
+ dark = model()->color( Style_Model::FieldDark ); // Style_Model::fld_dark_clr
//light.setAlpha( 0 ); // VSR commented: IPAL19262
QLinearGradient gr_h(r.x(), r.y(), r.right(), r.y());
gr_h.setColorAt( 0.0, dark );
// draw frame
p->fillRect( r, base );
p->fillRect( r, gr_h );
- p->fillRect( r, gr_v );
+ p->fillRect( r, gr_v );
aPal.setBrush( QPalette::Base, QBrush( light ) );
QLinearGradient gr_alt(r.x(), r.y(), r.right(), r.y());
\return metric value
*/
int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt,
- const QWidget* w ) const
+ const QWidget* w ) const
{
if ( checkDebugLevel(7) ) {
return QWindowsStyle::pixelMetric( metric, opt, w );
if ( tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedSouth ) {
int aDelta = (int)(opt->rect.height()*DELTA_H_TAB/2);
sz.setWidth( sz.width() + aDelta );
- }
+ }
if ( tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedWest ) {
int aDelta = (int)(opt->rect.width()*DELTA_H_TAB/2);
sz.setHeight( sz.height() + aDelta );
- }
+ }
}
break;
}
aDelta += aHalfRect; // for right of line edit internal
sz.setWidth( res.width() + aDelta + aHalfRect );
}
- break;
+ break;
default:
break;
}
\return standard icon
*/
QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon,
- const QStyleOption* opt,
- const QWidget* w ) const
+ const QStyleOption* opt,
+ const QWidget* w ) const
{
if ( checkDebugLevel(10) ) {
return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
\return subcontrol rectangle
*/
QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex* opt,
- SubControl sc, const QWidget* wid ) const
+ SubControl sc, const QWidget* wid ) const
{
if ( checkDebugLevel(12) ) {
return QWindowsStyle::subControlRect( cc, opt, sc, wid );
else
res.setTop( res.top() - aRect - 1);
break;
- default:
- break;
+ default:
+ break;
}
break;
}
for ( int j = (int)Style_Model::WindowText; j < (int)Style_Model::NColorRoles; j++ ) {
if ( j == QPalette::NoRole ) continue;
pal.setColor( (QPalette::ColorGroup)i, (QPalette::ColorRole)j,
- model()->color( (Style_Model::ColorRole)j, (QPalette::ColorGroup)i ) );
+ model()->color( (Style_Model::ColorRole)j, (QPalette::ColorGroup)i ) );
}
}
QPixmapCache::clear();
for (QWidgetList::ConstIterator it2 = all.constBegin(); it2 != all.constEnd(); ++it2) {
w = *it2;
if (w->windowType() != Qt::Desktop && w->testAttribute(Qt::WA_WState_Polished)
- && !w->testAttribute(Qt::WA_SetStyle)) {
+ && !w->testAttribute(Qt::WA_SetStyle)) {
QEvent e(QEvent::StyleChange);
QApplication::sendEvent(w, &e);
polish( w );
{
const int d = 3;
for ( int i = 0; i <= h; i += d )
- lines.append( QLine( x, y+i, w, r.y()+i ) );
+ lines.append( QLine( x, y+i, w, r.y()+i ) );
}
break;
case Style_Model::Inclined:
w = w/d*d;
h = h/d*d;
for ( int i = 0; i <= w; i += d )
- lines.append( QLine( x+i, y, x, y+i ) );
+ lines.append( QLine( x+i, y, x, y+i ) );
for ( int i = 0; i < h; i += d )
- lines.append( QLine( left+w-i, top+h, left+w, top+h-i ) );
+ lines.append( QLine( left+w-i, top+h, left+w, top+h-i ) );
}
break;
default:
virtual void polish( QWidget* );
virtual void unpolish( QWidget* );
virtual void drawComplexControl( ComplexControl, const QStyleOptionComplex*,
- QPainter*, const QWidget* = 0 ) const;
+ QPainter*, const QWidget* = 0 ) const;
virtual void drawControl( ControlElement, const QStyleOption*, QPainter*, const QWidget* ) const;
virtual void drawPrimitive( PrimitiveElement, const QStyleOption*,
- QPainter*, const QWidget* = 0 ) const;
+ QPainter*, const QWidget* = 0 ) const;
virtual int pixelMetric( PixelMetric, const QStyleOption* = 0,
- const QWidget* = 0 ) const;
+ const QWidget* = 0 ) const;
virtual QSize sizeFromContents ( ContentsType, const QStyleOption*,
- const QSize&, const QWidget* = 0 ) const;
+ const QSize&, const QWidget* = 0 ) const;
virtual QPixmap standardPixmap( StandardPixmap, const QStyleOption*,
- const QWidget* = 0) const;
+ const QWidget* = 0) const;
virtual int styleHint( StyleHint, const QStyleOption* = 0,
- const QWidget* = 0, QStyleHintReturn* = 0 ) const;
+ const QWidget* = 0, QStyleHintReturn* = 0 ) const;
virtual QRect subControlRect( ComplexControl, const QStyleOptionComplex*,
- SubControl, const QWidget* = 0 ) const;
+ SubControl, const QWidget* = 0 ) const;
virtual QRect subElementRect( SubElement, const QStyleOption*, const QWidget* = 0 ) const;
protected slots:
QIcon standardIconImplementation( StandardPixmap, const QStyleOption* = 0,
- const QWidget* = 0 ) const;
+ const QWidget* = 0 ) const;
private:
void updatePaletteColors();
void updateAllWidgets( QApplication* );
bool hasHover() const;
void drawHoverRect( QPainter*, const QRect&, const QColor&, const double,
- const int, const bool ) const;
+ const int, const bool ) const;
void drawHandle( QPainter*, const QRect&, bool, bool = true ) const;
void drawBackground( QPainter*, const QRect&, const QColor&, const bool,
- const bool = false, const bool = true ) const;
+ const bool = false, const bool = true ) const;
void drawBorder( QPainter*, const QRect&, bool ) const;
QString titleText( const QString&, const int, const int, QFont& ) const;
\param brush background painter brush
*/
void Style_Tools::drawSign( QStyle::PrimitiveElement type, QPainter* p, const QRect& r,
- const QColor& pen, const QColor& brush )
+ const QColor& pen, const QColor& brush )
{
p->save();
QPainterPath sign;
deltaY = -deltaY;
}
if ( correct )
- sign.moveTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.moveTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
else {
- sign.moveTo( aDelta/3, -aDelta/2 );
- sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
- sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.moveTo( aDelta/3, -aDelta/2 );
+ sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
}
sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
if ( !correct ) {
- sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
- sign.lineTo( aDelta/3, -aDelta/2-deltaY );
- sign.lineTo( -aDelta/3, -aDelta/2-deltaY );
- sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ sign.lineTo( aDelta/3, -aDelta/2-deltaY );
+ sign.lineTo( -aDelta/3, -aDelta/2-deltaY );
+ sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
}
sign.lineTo( -deltaY/2, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
sign.lineTo( -deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
if ( correct )
- sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
else {
- sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
- sign.lineTo( -aDelta/3, -aDelta/2 );
- sign.lineTo( aDelta/3, -aDelta/2);
+ sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( -aDelta/3, -aDelta/2 );
+ sign.lineTo( aDelta/3, -aDelta/2);
}
if ( correct )
static void drawArrow( QStyle::PrimitiveElement, QPainter*, const QRect&,
const QColor&, const QColor& );
static void drawSign( QStyle::PrimitiveElement, QPainter*, const QRect&,
- const QColor&, const QColor& );
+ const QColor&, const QColor& );
static QPainterPath tabRect( QPainter*, const QRect&, const int, const double,
const double, const QColor&, const QColor&,
const QColor&, const QColor&,
QCString dir;
if (dir = getenv( modulename + "_ROOT_DIR")) {
IDLpath = IDLpath + "-I" + SUIT_Tools::addSlash( SUIT_Tools::addSlash(dir) +
- SUIT_Tools::addSlash("idl") +
- SUIT_Tools::addSlash("salome")) + " ";
+ SUIT_Tools::addSlash("idl") +
+ SUIT_Tools::addSlash("salome")) + " ";
}
}
void ToolsGUI_CatalogGeneratorDlg::updateButtonState()
{
myApplyBtn->setEnabled( !myIdlEdit->text().trimmed().isEmpty() &&
- !myXmlEdit->text().trimmed().isEmpty() );
+ !myXmlEdit->text().trimmed().isEmpty() );
}
/*!
if ( !XmlFile.isEmpty() && !IdlFile.isEmpty() ) {
if ( !QFile::exists( IdlFile ) ) {
SUIT_MessageBox::critical( this,
- tr("TOOLS_ERR_ERROR"),
- tr("TOOLS_ERR_FILE_NOT_EXIST").arg(IdlFile) );
+ tr("TOOLS_ERR_ERROR"),
+ tr("TOOLS_ERR_FILE_NOT_EXIST").arg(IdlFile) );
}
else {
QString command = "";
if ( getenv("KERNEL_ROOT_DIR") )
- command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser -K " + IDLpath + " -Wbcatalog=" + XmlFile;
+ command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser -K " + IDLpath + " -Wbcatalog=" + XmlFile;
else {
- SUIT_MessageBox::critical( this,
- tr("TOOLS_ERR_ERROR"),
- tr("KERNEL_ROOT_DIR variable is not defined") );
+ SUIT_MessageBox::critical( this,
+ tr("TOOLS_ERR_ERROR"),
+ tr("KERNEL_ROOT_DIR variable is not defined") );
}
if (!Author.isEmpty()) command += ",author=" + Author;
if (!Version.isEmpty()) command += ",version=" + Version;
if (!PngFile.isEmpty()) {
- OSD_Path aPath((Standard_CString)PngFile.toLatin1().constData());
- TCollection_AsciiString aFile = aPath.Name() + aPath.Extension();
- command += QString(",icon=") + QString(aFile.ToCString());
+ OSD_Path aPath((Standard_CString)PngFile.toLatin1().constData());
+ TCollection_AsciiString aFile = aPath.Name() + aPath.Extension();
+ command += QString(",icon=") + QString(aFile.ToCString());
}
if (!CompName.isEmpty()) command += ",name=" + CompName;
if (!CompUserName.isEmpty()) command += ",username=" + CompUserName;
int res;
res = system( ( char* )( command.toLatin1().constData() ) );
if ( res == -1 ) {
- MESSAGE( "work failed (system command result = " << res );
+ MESSAGE( "work failed (system command result = " << res );
} else if (res == 217) {
- MESSAGE( "shell exec failed (system command result = " << res );
+ MESSAGE( "shell exec failed (system command result = " << res );
}
}
}
\param parent parent widget
*/
ToolsGUI_RegWidget* ToolsGUI_RegWidget::GetRegWidget( CORBA::ORB_var& orb,
- QWidget* parent )
+ QWidget* parent )
{
if ( !myRegWidgetPtr )
myRegWidgetPtr = new ToolsGUI_RegWidget( orb, parent );
else if ( object == _clients && event->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)event;
if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) {
- slotClientChanged( _clients->currentItem(), 0 );
+ slotClientChanged( _clients->currentItem(), 0 );
}
}
else if ( object == _history && event->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)event;
if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) {
- slotHistoryChanged( _history->currentItem(), 0 );
+ slotHistoryChanged( _history->currentItem(), 0 );
}
}
}
\return item index or -1 if it is not found.
*/
int ToolsGUI_RegWidget::numitem( const QString& name,
- const QString& pid,
- const QString& machine,
- const Registry::AllInfos* listclient )
+ const QString& pid,
+ const QString& machine,
+ const Registry::AllInfos* listclient )
{
for (CORBA::ULong i=0; i<listclient->length(); i++) {
const Registry::Infos & c_info=(*listclient)[i];
QString b;
b.setNum(int(c_info.pid));
if ( (name.compare(QString(c_info.name)) == 0) &&
- (machine.compare(QString(c_info.machine)) == 0) &&
- (pid.compare(b) == 0) ) {
+ (machine.compare(QString(c_info.machine)) == 0) &&
+ (pid.compare(b) == 0) ) {
return i;
}
}
bool eventFilter( QObject* object, QEvent* event );
static ToolsGUI_RegWidget* GetRegWidget( CORBA::ORB_var& orb,
- QWidget* parent = 0 );
+ QWidget* parent = 0 );
virtual QMenu* createPopupMenu();
protected:
static QString setlongText( const Registry::Infos& c_info );
int numitem( const QString& name,
- const QString& pid,
- const QString& machine,
- const Registry::AllInfos* clistclient );
+ const QString& pid,
+ const QString& machine,
+ const Registry::AllInfos* clistclient );
void closeEvent( QCloseEvent* e );
protected :
bool
Execute(vtkUnstructuredGrid *theInput,
- vtkCellData* thInputCD,
- vtkIdType theCellId,
- int theShowInside,
- int theAllVisible,
- const char* theCellsVisibility,
- vtkPolyData *theOutput,
- vtkCellData* theOutputCD,
- int theStoreMapping,
- std::vector<vtkIdType>& theVTK2ObjIds,
- bool theIsCheckConvex);
+ vtkCellData* thInputCD,
+ vtkIdType theCellId,
+ int theShowInside,
+ int theAllVisible,
+ const char* theCellsVisibility,
+ vtkPolyData *theOutput,
+ vtkCellData* theOutputCD,
+ int theStoreMapping,
+ std::vector<vtkIdType>& theVTK2ObjIds,
+ bool theIsCheckConvex);
private:
vtkIdList* myCellIds;
virtual
vtkPoints*
InitPoints(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId);
+ vtkIdType theCellId);
virtual
vtkIdType
void
GetCellNeighbors(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId,
- vtkCell* theFace,
- vtkIdList* theCellIds);
+ vtkIdType theCellId,
+ vtkCell* theFace,
+ vtkIdList* theCellIds);
vtkIdType
GetConnectivity(vtkIdType thePntId);
virtual
vtkPoints*
InitPoints(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId);
+ vtkIdType theCellId);
virtual
vtkIdType
virtual
vtkPoints*
InitPoints(vtkUnstructuredGrid *theInput,
- vtkIdType theCellId);
+ vtkIdType theCellId);
virtual
vtkIdType