#include <Visual3d_View.hxx>
#include <Graphic3d_MapOfStructure.hxx>
#include <Graphic3d_Structure.hxx>
+#include <Graphic3d_ExportFormat.hxx>
static QEvent* l_mbPressEvent = 0;
return px.toImage();
}
+bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
+ const QString& fileName,
+ const QString& format )
+{
+ if ( format != "PS" && format != "EPS")
+ return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format );
+
+ Handle(Visual3d_View) a3dView = myViewPort->getView()->View();
+
+ if (format == "PS")
+ a3dView->Export(qPrintable(fileName), Graphic3d_EF_PostScript);
+ else if (format == "EPS")
+ a3dView->Export(qPrintable(fileName), Graphic3d_EF_EnhPostScript);
+
+ return true;
+}
+
+
+QString OCCViewer_ViewWindow::filter() const
+{
+ return tr( "OCC_IMAGE_FILES" );
+}
+
+
/*!
\brief Set parameters of the cutting plane
\param on if \c true, cutting plane is enabled
virtual void showEvent( QShowEvent * );
virtual void hideEvent( QHideEvent * );
+
signals:
void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type);
void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type);
void Hide( QHideEvent * );
protected:
- QImage dumpView();
+ virtual QImage dumpView();
+ virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
+ virtual QString filter() const;
/* Transformation selected but not started yet */
bool transformRequested() const;
<source>MNU_SCALING</source>
<translation>Scaling</translation>
</message>
+ <message>
+ <source>OCC_IMAGE_FILES</source>
+ <translation>Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)</translation>
+ </message>
</context>
<context>
<name>OCCViewer_CreateRestoreViewDlg</name>
*/
QtxFontEdit::QtxFontEdit( const int feat, QWidget* parent )
: QFrame( parent ),
- myFeatures( feat )
+ myFeatures( feat ),
+ myMode( Native )
{
initialize();
}
fnt.setBold( script & Bold );
fnt.setItalic( script & Italic );
fnt.setUnderline( script & Underline );
+ fnt.setOverline( script & Shadow ); //addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font" );
return fnt;
}
void QtxFontEdit::setCurrentFont( const QFont& fnt )
{
myFamily->blockSignals( true );
+ myCustomFams->blockSignals( true );
mySize->blockSignals( true );
myB->blockSignals( true );
myI->blockSignals( true );
myU->blockSignals( true );
-
+
setFontFamily( fnt.family() );
setFontSize( fnt.pointSize() );
setFontScripting( ( fnt.bold() ? Bold : 0 ) |
( fnt.italic() ? Italic : 0 ) |
- ( fnt.underline() ? Underline : 0 ) );
+ ( fnt.underline() ? Underline : 0 ) |
+ ( fnt.overline() ? Shadow : 0 ) );
myFamily->blockSignals( false );
+ myCustomFams->blockSignals( false );
mySize->blockSignals( false );
myB->blockSignals( false );
myI->blockSignals( false );
*/
QString QtxFontEdit::fontFamily() const
{
- return myFamily->currentFont().family();
+ if ( myMode == Native )
+ return myFamily->currentFont().family();
+ else
+ return myCustomFams->currentText();
}
/*!
{
return ( myB->isChecked() ? Bold : 0 ) |
( myI->isChecked() ? Italic : 0 ) |
- ( myU->isChecked() ? Underline : 0 );
+ ( myU->isChecked() ? Underline : 0 ) |
+ ( myS->isChecked() ? Shadow : 0 ) ;
}
/*!
*/
void QtxFontEdit::setFontFamily( const QString& fam )
{
- myFamily->setCurrentFont( QFont( fam ) );
- onFontChanged( myFamily->currentFont() );
+ if ( myMode == Native )
+ {
+ myFamily->setCurrentFont( QFont( fam ) );
+ onFontChanged( myFamily->currentFont() );
+ }
+ else
+ {
+ myCustomFams->setCurrentIndex( myCustomFams->findText( fam ) );
+ if ( !myCustomFams->signalsBlocked() )
+ emit( changed( currentFont() ) );
+ }
}
/*!
myB->setChecked( script & Bold );
myI->setChecked( script & Italic );
myU->setChecked( script & Underline );
+ myS->setChecked( script & Shadow );
}
/*!
{
int feat = features();
- myFamily->setVisible( feat & Family );
+ myFamily->setVisible( ( feat & Family ) && myMode == Native );
+ myCustomFams->setVisible( ( feat & Family ) && myMode == Custom );
mySize->setVisible( feat & Size );
myB->setVisible( feat & Bold );
myI->setVisible( feat & Italic );
myU->setVisible( feat & Underline );
+ myS->setVisible( feat & Shadow );
myPreview->setVisible( feat & Preview );
mySize->setEditable( feat & UserSize );
base->setSpacing( 5 );
base->addWidget( myFamily = new QFontComboBox( this ) );
+ base->addWidget( myCustomFams = new QComboBox( this ) );
base->addWidget( mySize = new QtxComboBox( this ) );
mySize->setInsertPolicy( QComboBox::NoInsert );
mySize->setValidator( new QIntValidator( 1, 250, mySize ) );
myU->setText( tr( "U" ) );
myU->setCheckable( true );
+ base->addWidget( myS = new QToolButton( this ) );
+ myS->setText( tr( "S" ) );
+ myS->setCheckable( true );
+
base->addWidget( myPreview = new QToolButton( this ) );
myPreview->setText( "..." );
myFamily->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
+ myCustomFams->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
connect( myPreview, SIGNAL( clicked( bool ) ), this, SLOT( onPreview( bool ) ) );
connect( myFamily, SIGNAL( currentFontChanged( const QFont& ) ), this, SLOT( onFontChanged( const QFont& ) ) );
connect( myI, SIGNAL( toggled( bool ) ), this, SLOT( onPropertyChanged() ) );
connect( myU, SIGNAL( toggled( bool ) ), this, SLOT( onPropertyChanged() ) );
+ myCustomFams->hide();
+ myS->hide();
+
updateState();
onFontChanged( currentFont() );
}
+
+/*!
+ \brief Specifies whether widget works in Native or Custom mode. Native mode
+ is intended for working with system fonts. Custom mode is intended for
+ working with manually defined set of fonts. Set of custom fonts can be
+ specified with setCustomFonts() method
+ \param mode mode from QtxFontEdit::Mode enumeration
+ \sa mode()
+*/
+void QtxFontEdit::setMode( const int mode )
+{
+ if ( myMode == mode )
+ return;
+
+ myMode = mode;
+
+ myFamily->setShown( myMode == Native );
+ myCustomFams->setShown( myMode == Custom );
+
+ updateGeometry();
+}
+
+/*!
+ \brief Verifies whether widget works in Native or Custom mode
+ \return Native or Custom mode
+ \sa setMode()
+*/
+int QtxFontEdit::mode() const
+{
+ return myMode;
+}
+
+/*!
+ \brief Sets list of custom fonts.
+ <b>This method is intended for working in Custom mode.</b>
+ \param fams list of families
+ \sa fonts(), setMode()
+*/
+void QtxFontEdit::setFonts( const QStringList& fams )
+{
+ QString currFam = myCustomFams->currentText();
+
+ myCustomFams->clear();
+ myCustomFams->addItems( fams );
+
+ int ind = myCustomFams->findText( currFam );
+ if ( ind != -1 )
+ myCustomFams->setCurrentIndex( ind );
+
+ setSizes( QList<int>() );
+}
+
+/*!
+ \brief Sets list of available font sizes.
+ <b>This method is intended for working in Custom mode.</b> The list of sizes can
+ be empty. In this case system generate listof size automatically from 8 till 72.
+ \param sizes list of sizes
+ \sa sizes(), setMode()
+*/
+void QtxFontEdit::setSizes( const QList<int>& sizes )
+{
+ QString currSize = mySize->currentText();
+
+ mySize->clear();
+ if ( !sizes.isEmpty() )
+ {
+ QStringList szList;
+ for ( QList<int>::const_iterator it = sizes.begin(); it != sizes.end(); ++it )
+ szList.append( QString::number( *it ) );
+ mySize->addItems( szList );
+ }
+ else
+ {
+ static QStringList defLst;
+ if ( defLst.isEmpty() )
+ {
+ QString str( "8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72" );
+ defLst = str.split( " " );
+ }
+ mySize->addItems( defLst );
+ }
+
+ int ind = mySize->findText( currSize );
+ if ( ind != -1 )
+ mySize->setCurrentIndex( ind );
+}
+
+/*!
+ \brief Gets list of custom fonts
+ \return list of families
+ \sa setFonts(), setMode()
+*/
+QStringList QtxFontEdit::fonts() const
+{
+ QStringList fams;
+ for ( int i = 0, n = myCustomFams->count(); i < n; i++ )
+ fams.append( myCustomFams->itemText( i ) );
+ return fams;
+}
+
+/*!
+ \brief Gets list of custom fonts
+ \return list of families
+ \sa setCustomFonts(), setMode()
+*/
+QList<int> QtxFontEdit::sizes() const
+{
+ QList<int> lst;
+ for ( int i = 0, n = mySize->count(); i < n; i++ )
+ lst.append( mySize->itemText( i ).toInt() );
+ return lst;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#include <QFrame>
class QtxComboBox;
+class QComboBox;
class QToolButton;
class QFontComboBox;
Bold = 0x08, //!< show 'bold' widget
Italic = 0x10, //!< show 'italic' widget
Underline = 0x20, //!< show 'underline' widget
- Preview = 0x40, //!< show font preview widget
+ Shadow = 0x40, //!< show 'shadow' widget
+ Preview = 0x80, //!< show font preview widget
Scripting = Bold | Italic | Underline, //!< show font scripting widgets ('bold','italic','underline')
All = Family | Size | UserSize | Scripting | Preview //!< show all font widgets
} Features;
+ typedef enum
+ {
+ Native, //!< Native mode intended for working with system fonts
+ Custom //!< Custom mode intended for working with manually defined set of fonts
+ } Mode;
+
public:
QtxFontEdit( const int, QWidget* = 0 );
QtxFontEdit( QWidget* = 0 );
int features() const;
void setFeatures( const int );
+ void setMode( const int );
+ int mode() const;
+
+ void setFonts( const QStringList& );
+ QStringList fonts() const;
+
+ void setSizes( const QList<int>& = QList<int>() );
+ QList<int> sizes() const;
+
signals:
void changed( const QFont& );
QFontComboBox* myFamily;
QToolButton* myPreview;
int myFeatures;
- QToolButton *myB, *myI, *myU;
+ QToolButton *myB, *myI, *myU, *myS;
+ int myMode;
+ QComboBox* myCustomFams;
};
#endif // QTXFONTEDIT_H
myFont->setFeatures( f );
}
+/*!
+ \brief Specifies whether widget works in Native or Custom mode. Native mode
+ is intended for working with system fonts. Custom mode is intended for
+ working with manually defined set of fonts. Set of custom fonts can be
+ specified with setFonts() method
+ \param mode mode from QtxFontEdit::Mode enumeration
+ \sa mode()
+*/
+void QtxPagePrefFontItem::setMode( const int mode )
+{
+ myFont->setMode( mode );
+}
+
+/*!
+ \brief Verifies whether widget works in Native or Custom mode
+ \return Native or Custom mode
+ \sa setMode()
+*/
+int QtxPagePrefFontItem::mode() const
+{
+ return myFont->mode();
+}
+
+/*!
+ \brief Sets list of custom fonts.
+ <b>This method is intended for working in Custom mode only.</b>
+ \param fams list of families
+ \sa fonts(), setMode()
+*/
+void QtxPagePrefFontItem::setFonts( const QStringList& fams )
+{
+ myFont->setFonts( fams );
+}
+
+/*!
+ \brief Gets list of custom fonts
+ \return list of families
+ \sa setFonts(), setMode()
+*/
+QStringList QtxPagePrefFontItem::fonts() const
+{
+ return myFont->fonts();
+}
+
+/*!
+ \brief Sets list of available font sizes.
+ <b>This method is intended for working in Custom mode only.</b> The list of sizes can
+ be empty. In this case system generate listof size automatically from 8 till 72.
+ \param sizes list of sizes
+ \sa sizes(), setMode()
+*/
+void QtxPagePrefFontItem::setSizes( const QList<int>& sizes )
+{
+ myFont->setSizes( sizes );
+}
+
+/*!
+ \brief Gets list of custom fonts
+ \return list of families
+ \sa setFonts(), setMode()
+*/
+QList<int> QtxPagePrefFontItem::sizes() const
+{
+ return myFont->sizes();
+}
+
/*!
\brief Store preference item to the resource manager.
\sa retrieve()
{
if ( name == "features" )
return features();
+ else if ( name == "mode" )
+ return mode();
+ else if ( name == "fonts" || name == "families" )
+ return fonts();
+ else if ( name == "sizes" )
+ {
+ QList<QVariant> lst;
+ QList<int> nums = sizes();
+ for ( QList<int>::const_iterator it = nums.begin(); it != nums.end(); ++it )
+ lst.append( *it );
+ return lst;
+ }
else
return QtxPageNamedPrefItem::optionValue( name );
}
if ( val.canConvert( QVariant::Int ) )
setFeatures( val.toInt() );
}
+ else if ( name == "mode" )
+ {
+ if ( val.canConvert( QVariant::Int ) )
+ setMode( val.toInt() );
+ }
+ else if ( name == "fonts" || name == "families" )
+ {
+ if ( val.canConvert( QVariant::StringList ) )
+ setFonts( val.toStringList() );
+ }
+ else if ( name == "sizes" )
+ {
+ if ( val.type() == QVariant::List )
+ {
+ QList<int> lst;
+ QList<QVariant> varList = val.toList();
+ for ( QList<QVariant>::const_iterator it = varList.begin(); it != varList.end(); ++it )
+ {
+ if ( (*it).canConvert( QVariant::Int ) )
+ lst.append( (*it).toInt() );
+ }
+ setSizes( lst );
+ }
+ }
else
QtxPageNamedPrefItem::setOptionValue( name, val );
}
int features() const;
void setFeatures( const int );
+ void setMode( const int );
+ int mode() const;
+
+ void setFonts( const QStringList& );
+ QStringList fonts() const;
+
+ void setSizes( const QList<int>& = QList<int>() );
+ QList<int> sizes() const;
+
virtual void store();
virtual void retrieve();
fVal.setItalic( true );
else if ( curval == QString( "underline" ) )
fVal.setUnderline( true );
+ else if ( curval == QString( "shadow" ) || curval == QString( "overline" ) )
+ fVal.setOverline( true );
else
{
bool isOk = false;
fontDescr.append( "Italic" );
if ( val.underline() )
fontDescr.append( "Underline" );
+ if ( val.overline() )
+ fontDescr.append( "Overline" );
fontDescr.append( QString( "%1" ).arg( val.pointSize() ) );
setResource( sect, name, fontDescr.join( "," ) );
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include "SalomeApp_DataObject.h"
-
#include "SalomeApp_Study.h"
+#include "SalomeApp_Application.h"
#include <CAM_DataObject.h>
+#include <SUIT_Session.h>
#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
+#include <SALOME_LifeCycleCORBA.hxx>
+
#include <QObject>
#include <QVariant>
{
// we ignore parameter <id> in order to use the same tooltip for
// all columns
+
+ // Get customized tooltip in case of it exists
+ const SalomeApp_DataObject* compObj = dynamic_cast<SalomeApp_DataObject*>( componentObject() );
+ // Check if the component has been loaded.
+ // In order to avoid loading the component only for getting a custom tooltip.
+ if ( compObj && compObj != this && !ior(compObj->object()).isEmpty() ) {
+ SalomeApp_Application* app =
+ dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if ( app ) {
+ Engines::Component_var aComponent =
+ app->lcc()->FindOrLoad_Component( "FactoryServer", componentDataType().toLatin1().constData() );
+
+ if ( !CORBA::is_nil(aComponent) && aComponent->hasObjectInfo() ) {
+ LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() );
+ if ( aRoot && aRoot->study() )
+ return QString( aComponent->getObjectInfo( aRoot->study()->id(), entry().toLatin1().constData()) );
+ }
+ }
+ }
+
return QString( "Object \'%1\', module \'%2\', ID=%3" ).arg( name() ).arg( componentDataType() ).arg( entry() );
}
# File : Makefile.in
# Author : Vladimir Klyachin (OCN)
# Module : VTKViewer
-# $Header$
-#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
lib_LTLIBRARIES = libVTKViewer.la