From: prascle Date: Thu, 6 Nov 2008 12:38:46 +0000 (+0000) Subject: merge from tag V5_1_0_for_TC1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6eb766fd8a852dac51aa6d9932e1eb93e5e53d69;p=modules%2Fgui.git merge from tag V5_1_0_for_TC1 --- diff --git a/adm_local/unix/config_files/check_TestRecorder.m4 b/adm_local/unix/config_files/check_TestRecorder.m4 index ff87acf7d..7b937bf84 100644 --- a/adm_local/unix/config_files/check_TestRecorder.m4 +++ b/adm_local/unix/config_files/check_TestRecorder.m4 @@ -1,6 +1,6 @@ # # Check existence of Test recorder sources and libraries. -# Set DISABLE_TESTRECORDER to yes|no +# Set ENABLE_TESTRECORDER to yes|no # # Author : Margarita KARPUNINA (OCN, 2008) # @@ -31,7 +31,7 @@ AS_IF([test "x$with_testrecorder" != xno || test "$with_testrecorder" != "no"],[ TESTRECORDER_INCLUDES="" TESTRECORDER_LIBS="" - DISABLE_TESTRECORDER="yes" + ENABLE_TESTRECORDER="no" TestRecorder_ok=no @@ -88,7 +88,7 @@ AS_IF([test "x$with_testrecorder" != xno || test "$with_testrecorder" != "no"],[ AC_MSG_WARN(TestRecorder is not found or not properly installed) else AC_MSG_RESULT(for TestRecorder: yes) - DISABLE_TESTRECORDER="no" + ENABLE_TESTRECORDER="yes" fi AC_SUBST(TESTRECORDER_INCLUDES) diff --git a/adm_local/unix/config_files/check_pyqt.m4 b/adm_local/unix/config_files/check_pyqt.m4 index 363b25437..2186ec039 100644 --- a/adm_local/unix/config_files/check_pyqt.m4 +++ b/adm_local/unix/config_files/check_pyqt.m4 @@ -130,6 +130,7 @@ if test "x$pyqt_ok" == "xyes" ; then TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages" TEST_LIB_DIRS="${TEST_LIB_DIRS} /usr/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/PyQt4" TEST_SIPS_DIRS="${TEST_SIPS_DIRS} /usr/share/sip" + TEST_SIPS_DIRS="${TEST_SIPS_DIRS} /usr/share/sip/PyQt4" dnl check PyQt libs pyqt_ok=no diff --git a/bin/runLightSalome.csh b/bin/runLightSalome.csh index 39c742dc8..e4c8939da 100755 --- a/bin/runLightSalome.csh +++ b/bin/runLightSalome.csh @@ -27,8 +27,16 @@ # is necessary for loading of .ini or .xml resources file ### -if ( ! $?LightAppConfig ) setenv LightAppConfig ${GUI_ROOT_DIR}/share/salome/resources/gui -if ( ! $?LightAppResources ) setenv LightAppResources ${GUI_ROOT_DIR}/share/salome/resources/gui +if ( ! ($?LightAppConfig) ) then + setenv LightAppConfig ${GUI_ROOT_DIR}/share/salome/resources/gui +else + setenv LightAppConfig ${LightAppConfig}:${GUI_ROOT_DIR}/share/salome/resources/gui +endif +if ( ! ($?LightAppResources) ) then + setenv LightAppResources ${GUI_ROOT_DIR}/share/salome/resources/gui +else + setenv LightAppResources ${LightAppResources}:${GUI_ROOT_DIR}/share/salome/resources/gui +endif ### # default settings @@ -144,4 +152,4 @@ if ( "${PYTHONPATH}" != "" ) setenv PYTHONPATH ${MY_PYTHONPATH}:${PYTHONPATH} # start application ### -SUITApp LightApp -style salome $* & +SUITApp LightApp $* & diff --git a/bin/runLightSalome.sh b/bin/runLightSalome.sh index cc2540a04..3f1eb230b 100755 --- a/bin/runLightSalome.sh +++ b/bin/runLightSalome.sh @@ -29,9 +29,13 @@ if [ -z "$LightAppConfig" ] ; then export LightAppConfig=${GUI_ROOT_DIR}/share/salome/resources/gui +else + export LightAppConfig=${LightAppConfig}:${GUI_ROOT_DIR}/share/salome/resources/gui fi if [ -z "$LightAppResources" ] ; then export LightAppResources=${GUI_ROOT_DIR}/share/salome/resources/gui +else + export LightAppResources=${LightAppResources}:${GUI_ROOT_DIR}/share/salome/resources/gui fi ### @@ -142,4 +146,4 @@ fi # start application ### -SUITApp LightApp -style salome $* & +SUITApp LightApp $* & diff --git a/configure.ac b/configure.ac index 31df98fd2..e761d9ec4 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ # Modified by : Mikhail PONIKAROV (OCN) - autotools usage # -AC_INIT([Salome2 Project GUI module], [5.0.0], [webmaster.salome@opencascade.com], [SalomeGUI]) +AC_INIT([Salome2 Project GUI module], [5.1.0], [webmaster.salome@opencascade.com], [SalomeGUI]) AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -558,7 +558,7 @@ AM_CONDITIONAL(ENABLE_OCCVIEWER, [test "$DISABLE_OCCVIEWER" = no]) AM_CONDITIONAL(ENABLE_VTKVIEWER, [test "$DISABLE_VTKVIEWER" = no]) AM_CONDITIONAL(ENABLE_SALOMEOBJECT, [test "$DISABLE_SALOMEOBJECT" = no]) AM_CONDITIONAL(ENABLE_QXGRAPHVIEWER, [test "$DISABLE_QXGRAPHVIEWER" = no]) -AM_CONDITIONAL(ENABLE_TESTRECORDER, [test "$DISABLE_TESTRECORDER" = no]) +AM_CONDITIONAL(ENABLE_TESTRECORDER, [test "$ENABLE_TESTRECORDER" = yes]) echo echo --------------------------------------------- diff --git a/doc/salome/tui/doxyfile.in b/doc/salome/tui/doxyfile.in index 01db146d7..fbacb718b 100755 --- a/doc/salome/tui/doxyfile.in +++ b/doc/salome/tui/doxyfile.in @@ -10,7 +10,7 @@ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO +REPEAT_BRIEF = YES ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = YES @@ -39,8 +39,8 @@ EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = YES @@ -48,7 +48,7 @@ CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = YES -SORT_MEMBER_DOCS = NO +SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = NO GENERATE_TODOLIST = YES @@ -70,7 +70,7 @@ WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = +WARN_LOGFILE = log.txt #--------------------------------------------------------------------------- # configuration options related to the input files @@ -95,19 +95,19 @@ FILTER_SOURCE_FILES = YES #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO +SOURCE_BROWSER = YES +INLINE_SOURCES = YES STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES -USE_HTAGS = NO +#USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 3 +COLS_IN_ALPHA_INDEX = 2 IGNORE_PREFIX = #--------------------------------------------------------------------------- @@ -116,19 +116,19 @@ IGNORE_PREFIX = GENERATE_HTML = YES HTML_OUTPUT = . HTML_FILE_EXTENSION = .html -HTML_HEADER = @srcdir@/static/myheader.html -HTML_FOOTER = @srcdir@/static/footer.html -HTML_STYLESHEET = @srcdir@/static/doxygen.css +#HTML_HEADER = @srcdir@/static/myheader.html +#HTML_FOOTER = @srcdir@/static/footer.html +#HTML_STYLESHEET = @srcdir@/static/doxygen.css HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO -BINARY_TOC = YES -TOC_EXPAND = YES +BINARY_TOC = NO +TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- @@ -191,14 +191,14 @@ PERLMOD_MAKEVAR_PREFIX = # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES +MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = NO +SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references @@ -216,24 +216,24 @@ CLASS_DIAGRAMS = YES HIDE_UNDOC_RELATIONS = NO HAVE_DOT = YES CLASS_GRAPH = YES -COLLABORATION_GRAPH = NO -GROUP_GRAPHS = NO +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = NO +INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = jpg +DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1200 -MAX_DOT_GRAPH_DEPTH = 0 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = NO +GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- diff --git a/src/CAF/CAF_Application.cxx b/src/CAF/CAF_Application.cxx index ac268daaf..0cdb2e9c4 100755 --- a/src/CAF/CAF_Application.cxx +++ b/src/CAF/CAF_Application.cxx @@ -177,8 +177,8 @@ void CAF_Application::createActions() editUndo->setComment( tr( "INF_APP_UNDOACTIONS" ) ); editRedo->setComment( tr( "INF_APP_REDOACTIONS" ) ); - connect( editUndo, SIGNAL( activated( int ) ), this, SLOT( onUndo( int ) ) ); - connect( editRedo, SIGNAL( activated( int ) ), this, SLOT( onRedo( int ) ) ); + connect( editUndo, SIGNAL( triggered( int ) ), this, SLOT( onUndo( int ) ) ); + connect( editRedo, SIGNAL( triggered( int ) ), this, SLOT( onRedo( int ) ) ); int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 ); diff --git a/src/CAF/CAF_Tools.h b/src/CAF/CAF_Tools.h index 4c0188b9a..d04a54b20 100755 --- a/src/CAF/CAF_Tools.h +++ b/src/CAF/CAF_Tools.h @@ -22,7 +22,7 @@ #ifndef CAF_TOOLS_H #define CAF_TOOLS_H -#include +#include "CAF.h" #include diff --git a/src/CAM/CAM_DataObject.cxx b/src/CAM/CAM_DataObject.cxx index 26ce74555..016ac84d2 100755 --- a/src/CAM/CAM_DataObject.cxx +++ b/src/CAM/CAM_DataObject.cxx @@ -128,17 +128,16 @@ QString CAM_ModuleObject::name() const /*! \brief Get data object icon for the specified column. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator - \param index column index + \param id column id \return object icon for the specified column */ -QPixmap CAM_ModuleObject::icon( const int index ) const +QPixmap CAM_ModuleObject::icon( const int id ) const { QPixmap p; // show icon only for the "Name" column - if ( index == NameIdx && dataModel() && dataModel()->module() ) + if ( id == NameId && dataModel() && dataModel()->module() ) p = dataModel()->module()->moduleIcon(); if ( !p.isNull() ) p = Qtx::scaleIcon( p, 16 ); @@ -148,13 +147,12 @@ QPixmap CAM_ModuleObject::icon( const int index ) const /*! \brief Get data object tooltip for the specified column. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator - \param index column index + \param id column id \return object tooltip for the specified column */ -QString CAM_ModuleObject::toolTip( const int /*index*/ ) const +QString CAM_ModuleObject::toolTip( const int /*id*/ ) const { // show the same tooltip for all columns QString tip; diff --git a/src/CAM/CAM_DataObject.h b/src/CAM/CAM_DataObject.h index 11bac528e..b211cefee 100755 --- a/src/CAM/CAM_DataObject.h +++ b/src/CAM/CAM_DataObject.h @@ -44,8 +44,8 @@ public: virtual ~CAM_ModuleObject(); virtual QString name() const; - QPixmap icon( const int = NameIdx ) const; - QString toolTip( const int = NameIdx ) const; + QPixmap icon( const int = NameId ) const; + QString toolTip( const int = NameId ) const; virtual CAM_DataModel* dataModel() const; virtual void setDataModel( CAM_DataModel* ); diff --git a/src/DDS/DDS_DicGroup.cxx b/src/DDS/DDS_DicGroup.cxx index 3bb337ad3..bc7dbc3ac 100644 --- a/src/DDS/DDS_DicGroup.cxx +++ b/src/DDS/DDS_DicGroup.cxx @@ -25,8 +25,6 @@ #include -#include - #include #include @@ -153,6 +151,8 @@ void DDS_DicGroup::FillDataMap( const LDOM_Element& theComponentData, const LDOM if ( !myUnitSystem.IsBound( aName ) ) myUnitSystem.Bind( aName, aLabel ); + + } } @@ -183,6 +183,16 @@ void DDS_DicGroup::FillDataMap( const LDOM_Element& theComponentData, const LDOM aDicItem->myComponent = this; aDicItem->FillDataMap( anID, aQuantity, theComponentData, theDocElement, unitSystems ); myDataMap.Add( anID, aDicItem ); + + bool exist = false; + for( int i=1, n=myKeys.Length(); i<=n && !exist; i++ ) + if( myKeys.Value( i )==anID ) + { + cout << "Doubled key:" << anID << endl; + exist = true; + } + if( !exist ) + myKeys.Append( anID ); } } @@ -203,3 +213,12 @@ Handle_DDS_DicItem DDS_DicGroup::GetDicItem( const TCollection_AsciiString& theI return aDicItem; } + +/*! + \brief Return all keys of the group + \param seq - string container to be filled with keys +*/ +void DDS_DicGroup::GetKeys( TColStd_SequenceOfAsciiString& seq ) const +{ + seq = myKeys; +} diff --git a/src/DDS/DDS_DicGroup.h b/src/DDS/DDS_DicGroup.h index a804776ea..a9bebf0f4 100644 --- a/src/DDS/DDS_DicGroup.h +++ b/src/DDS/DDS_DicGroup.h @@ -24,13 +24,10 @@ #include "DDS_DicItem.h" #include - -#include - +#include #include class LDOM_Element; -class TColStd_SequenceOfAsciiString; DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) @@ -40,6 +37,7 @@ public: DDS_DicGroup( const TCollection_AsciiString& ); TCollection_AsciiString GetName() const; + Standard_EXPORT void GetKeys( TColStd_SequenceOfAsciiString& ) const; Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; @@ -65,6 +63,7 @@ private: DDS_IndexedDataMapOfDicItems myDataMap; UnitSystemMap myUnitSystem; TCollection_AsciiString myActiveSystem; + TColStd_SequenceOfAsciiString myKeys; friend class DDS_Dictionary; diff --git a/src/DDS/DDS_DicItem.cxx b/src/DDS/DDS_DicItem.cxx index 12a942705..419946329 100644 --- a/src/DDS/DDS_DicItem.cxx +++ b/src/DDS/DDS_DicItem.cxx @@ -826,21 +826,41 @@ void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element LDOM_Element anOpt = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "OPTIONS" ) ); if ( !anOpt.isNull() ) { - LDOM_NodeList anOptions = anOpt.getElementsByTagName( DDS_Dictionary::KeyWord( "OPTION" ) ); + LDOM_NodeList anOptions = anOpt.GetAttributesList();//anOpt.getElementsByTagName( DDS_Dictionary::KeyWord( "OPTION" ) ); for ( Standard_Integer oi = 0; oi < anOptions.getLength(); oi++ ) { LDOM_Node node = anOptions.item( oi ); - if ( node.getNodeType() != LDOM_Node::ELEMENT_NODE ) - continue; - - LDOM_Element& elem = (LDOM_Element&)node; - TCollection_AsciiString name = elem.getAttribute( DDS_Dictionary::KeyWord( "OPTION_NAME" ) ); + LDOM_Node::NodeType t = node.getNodeType(); + TCollection_AsciiString name; TCollection_ExtendedString value; - const LDOM_Node aNode = elem.getFirstChild(); - LDOM_Text anOptTxt( (const LDOM_Text&)(aNode) ); - if ( !anOptTxt.isNull() ) - value = anOptTxt.getData(); + + if( t==LDOM_Node::ELEMENT_NODE ) + { + const LDOM_Element& elem = ( const LDOM_Element& )node; + name = elem.getAttribute( DDS_Dictionary::KeyWord( "OPTION_NAME" ) ); + + const LDOM_Node aNode = elem.getFirstChild(); + LDOM_Text anOptTxt( (const LDOM_Text&)(aNode) ); + if ( !anOptTxt.isNull() ) + value = anOptTxt.getData(); + } + else if( t==LDOM_Node::ATTRIBUTE_NODE ) + { + const LDOM_Attr& attr = ( const LDOM_Attr& )node; + name = ( Standard_CString )attr.getName().GetString(); + LDOMString v = attr.getValue(); + if( v.Type()==LDOMBasicString::LDOM_Integer ) + { + Standard_Integer ival; + v.GetInteger( ival ); + value = TCollection_ExtendedString( ival ); + } + else + value = ( Standard_CString )v.GetString(); + } + else + continue; if ( !name.IsEmpty() && value.Length() && !myOptions.IsBound( name ) ) myOptions.Bind( name, value ); diff --git a/src/DDS/DDS_Dictionary.cxx b/src/DDS/DDS_Dictionary.cxx index 25e6cdcb8..9baae9c7d 100644 --- a/src/DDS/DDS_Dictionary.cxx +++ b/src/DDS/DDS_Dictionary.cxx @@ -587,3 +587,18 @@ Standard_Real DDS_Dictionary::FromSI( const Standard_Real theValue, const Standa return aRetValue; } + +/*! + \brief Fill given string container \a seq with keys belonging to group with name \a theComponent + \param theComponent name of group whose keys should be stored in the container + \param seq returned string container with keys belonging to group; it is not cleared before filling +*/ +void DDS_Dictionary::GetKeys( const TCollection_AsciiString& theComponent, TColStd_SequenceOfAsciiString& seq ) const +{ + Handle( DDS_DicGroup ) aDicGroup; + if( myGroupMap.Contains( theComponent ) ) + aDicGroup = myGroupMap.FindFromKey( theComponent ); + + if( !aDicGroup.IsNull() ) + aDicGroup->GetKeys( seq ); +} diff --git a/src/DDS/DDS_Dictionary.h b/src/DDS/DDS_Dictionary.h index 9a5d5a886..2a264b482 100644 --- a/src/DDS/DDS_Dictionary.h +++ b/src/DDS/DDS_Dictionary.h @@ -37,6 +37,8 @@ public: // Return instance of data dictionary. Create instance if it is NULL. + Standard_EXPORT void GetKeys( const TCollection_AsciiString&, TColStd_SequenceOfAsciiString& ) const; + Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString&, const TCollection_AsciiString& ) const; diff --git a/src/Event/SALOME_Event.h b/src/Event/SALOME_Event.h index 859d62b93..9146e6af8 100644 --- a/src/Event/SALOME_Event.h +++ b/src/Event/SALOME_Event.h @@ -25,7 +25,7 @@ #ifndef SALOME_EVENT_H #define SALOME_EVENT_H -#include +#include "Event.h" #include diff --git a/src/GLViewer/GLViewer_Geom.cxx b/src/GLViewer/GLViewer_Geom.cxx index ebd777e22..7efc3880b 100644 --- a/src/GLViewer/GLViewer_Geom.cxx +++ b/src/GLViewer/GLViewer_Geom.cxx @@ -20,7 +20,7 @@ // //#include -#include +#include "GLViewer_Geom.h" #define FAR_POINT 1e10 // Value used as a "very distant" co-ordinate #define TOLERANCE 1e-3 diff --git a/src/GLViewer/GLViewer_Tools.cxx b/src/GLViewer/GLViewer_Tools.cxx index 1f270a253..28642e969 100644 --- a/src/GLViewer/GLViewer_Tools.cxx +++ b/src/GLViewer/GLViewer_Tools.cxx @@ -27,6 +27,7 @@ #include #include +#include /*! Constructor diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 629606c6c..80d7fc139 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -44,8 +44,8 @@ #include -#include #include +#include #include #include @@ -83,6 +83,7 @@ #ifndef DISABLE_PLOT2DVIEWER #include #include + #include "LightApp_Plot2dSelector.h" #ifndef DISABLE_SALOMEOBJECT #include #else @@ -619,6 +620,13 @@ void LightApp_Application::createActions() createMenu( MRUId, fileMenu, 100, -1 ); createMenu( separator(), fileMenu, -1, 100, -1 ); + createAction( StyleId, tr( "TOT_THEME" ), QIcon(), tr( "MEN_DESK_THEME" ), tr( "PRP_THEME" ), + 0, desk, false, this, SLOT( onStylePreferences() ) ); + + int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1 ); + createMenu( separator(), viewMenu, -1, 20, -1 ); + createMenu( StyleId, viewMenu, 20, -1 ); + int modTBar = createTool( tr( "INF_TOOLBAR_MODULES" ) ); createTool( ModulesListId, modTBar ); } @@ -1264,7 +1272,9 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() ); Plot2d_Viewer* vm; #ifndef DISABLE_SALOMEOBJECT - vm = new SPlot2d_Viewer(); + SPlot2d_Viewer* v = new SPlot2d_Viewer(); + vm = v; + new LightApp_Plot2dSelector( v, mySelMgr ); #else vm = new Plot2d_Viewer(); #endif @@ -1301,10 +1311,11 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType { viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() ); OCCViewer_Viewer* vm; + bool staticTrihedron = resMgr->booleanValue( "OCCViewer", "static_trihedron", true ); #ifndef DISABLE_SALOMEOBJECT vm = new SOCC_Viewer(); #else - vm = new OCCViewer_Viewer(); + vm = new OCCViewer_Viewer( true, staticTrihedron ); #endif vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) ); vm->setTrihedronSize( resMgr->doubleValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) ); @@ -1793,11 +1804,6 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab ); pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, LightApp_Preferences::Font, "PyConsole", "font" ); - int SalomeStyleGroup = pref->addPreference( tr( "PREF_GROUP_STYLE" ), genTab ); - pref->addPreference( tr( "PREF_USE_SALOME_STYLE" ), SalomeStyleGroup, LightApp_Preferences::Bool, "Style", "use_salome_style" ); - if ( resourceMgr() ) - resourceMgr()->booleanValue( "Style", "use_salome_style", true ); - int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat ); int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab ); @@ -2049,66 +2055,6 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "strings", aValuesList, mruLinkType ); pref->setItemProperty( "indexes", anIndicesList, mruLinkType ); - // theme values - Style_Model* aSModel = 0; - QStyle* style = qApp->style(); - if ( style ) { - Style_Salome* aSStyle = qobject_cast( style ); - if ( aSStyle ) - aSModel = aSStyle->getModel(); - } - if ( !aSModel ) - return; - - QString aSection = aSModel->sectionName(); - int themaTab = pref->addPreference( aSection, salomeCat ); - QtxResourceMgr* aResMgr = pref->resourceMgr(); - aSModel->initFromResource( aResMgr ); - - QList aTabLst = aSModel->getTabs(); - QList::iterator aTabIt = aTabLst.begin(), aTabEnd = aTabLst.end(); - QList aGrpLst, aPropLst; - QList::iterator anIt, anEnd, aPropIt, aPropEnd; - int aGrpId, aPropId, aPrefId; - int themaSubTab = pref->addPreference( "ThemeTabs", themaTab, - SUIT_PreferenceMgr::Tab ); - for ( ; aTabIt != aTabEnd; ++aTabIt ) { - QList aGrpLst = aSModel->getGroups( *aTabIt ); - int themaSubSubTab = pref->addPreference( aSModel->getTabTitle( *aTabIt ), themaSubTab, - SUIT_PreferenceMgr::Frame ); - for( anIt = aGrpLst.begin(), anEnd = aGrpLst.end(); anIt != anEnd; ++anIt ) { - aGrpId = *anIt; - int themaGroup = pref->addPreference( aSModel->getGroupTitle( aGrpId ), themaSubSubTab, SUIT_PreferenceMgr::GroupBox ); - pref->setItemProperty( "columns", aSModel->getGroupNbColumns( aGrpId ), themaGroup ); - aPropLst = aSModel->getGroupProps( aGrpId ); - for( aPropIt = aPropLst.begin(), aPropEnd = aPropLst.end(); aPropIt != aPropEnd; ++aPropIt ) { - aPropId = *aPropIt; - Style_Model::PropType aType = aSModel->getPropType( aPropId ); - LightApp_Preferences::PrefItemType aPType = LightApp_Preferences::Auto; - switch( aType ) { - case Style_Model::Bool: aPType = LightApp_Preferences::Bool; break; - case Style_Model::Color: aPType = LightApp_Preferences::Color; break; - case Style_Model::String: aPType = LightApp_Preferences::String; break; - case Style_Model::IntSpin: aPType = LightApp_Preferences::IntSpin; break; - case Style_Model::DblSpin: aPType = LightApp_Preferences::DblSpin; break; - case Style_Model::Selector: aPType = LightApp_Preferences::Selector; break; - case Style_Model::Font: aPType = LightApp_Preferences::Font; break; - default: break; - } - aPrefId = pref->addPreference( aSModel->getPropTitle( aPropId ), themaGroup, - aPType, aSection, aSModel->getPropName( aPropId ) ); - aSModel->getValueTo( aResMgr, aPropId, true );//set default values into resource - if ( aPType == LightApp_Preferences::Selector ) - { - aValuesList.clear(); - anIndicesList.clear(); - aSModel->getSelector( aPropId, aValuesList, anIndicesList ); - pref->setItemProperty( "strings", aValuesList, aPrefId ); - pref->setItemProperty( "indexes", anIndicesList, aPrefId ); - } - } - } - } pref->retrieve(); } @@ -2318,29 +2264,6 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString } #endif - Style_Salome* aSStyle = 0; - if ( QStyle* style = qApp->style() ) aSStyle = qobject_cast( style ); - - if( sec=="Style" ) - { - if( param=="use_salome_style" ) - { - if ( resMgr->booleanValue( "Style", "use_salome_style", true ) ) - { - if ( !aSStyle ) - { - aSStyle = new Style_Salome(); - aSStyle->getModel()->initFromResource( resMgr ); - qApp->setStyle( aSStyle ); - } - } - else if ( aSStyle ) - { - qApp->setStyle( new QWindowsStyle ); - } - } - } - if( sec=="MRU" ) { QtxMRUAction* mru = ::qobject_cast( action( MRUId ) ); @@ -2359,16 +2282,6 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString mru->setVisible( resMgr->booleanValue( "MRU", "show_mru", false ) ); // do not show MRU menu item by default } } - - if ( aSStyle ) { - Style_Model* aSModel = aSStyle->getModel(); - if ( sec==aSModel->sectionName() ) { - bool retrieve = aSModel->updateFromResource( resMgr, param ); - if ( retrieve && _prefs_ ) - _prefs_->retrieve(); - aSStyle->polish(qApp); - } - } } /*! @@ -2878,6 +2791,14 @@ void LightApp_Application::onMRUActivated( const QString& name ) onOpenDoc( name ); } +void LightApp_Application::onStylePreferences() +{ + Style_PrefDlg dlg( desktop() ); + dlg.exec(); + + resourceMgr()->setValue( "Style", "use_salome_style", Style_Salome::isActive() ); +} + /*! Connects just added view manager */ diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index 474e04e12..0ae88f775 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -77,7 +77,9 @@ public: enum { RenameId = CAM_Application::UserID, CloseId, CloseAllId, GroupAllId, PreferencesId, MRUId, ModulesListId, - NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, NewQxSceneViewId, UserID }; + NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, + NewQxSceneViewId, StyleId, + UserID }; protected: enum { NewStudyId = 1, OpenStudyId }; @@ -141,6 +143,8 @@ public: virtual bool checkDataObject( LightApp_DataObject* theObj ); + virtual void updateDesktopTitle(); + signals: void studyOpened(); void studySaved(); @@ -182,8 +186,6 @@ protected: virtual void loadPreferences(); virtual void savePreferences(); - virtual void updateDesktopTitle(); - virtual QMap activateModuleActions() const; virtual void moduleActionSelected( const int ); @@ -203,6 +205,8 @@ protected slots: void onMRUActivated( const QString& ); + void onStylePreferences(); + private slots: void onSelection(); void onRefresh(); diff --git a/src/LightApp/LightApp_DataModel.cxx b/src/LightApp/LightApp_DataModel.cxx index d78f3b3c1..5074d475f 100644 --- a/src/LightApp/LightApp_DataModel.cxx +++ b/src/LightApp/LightApp_DataModel.cxx @@ -27,6 +27,7 @@ #include "LightApp_Module.h" #include "LightApp_Application.h" +#include #include #include @@ -36,6 +37,9 @@ LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule ) : CAM_DataModel( theModule ) { + myGroupId = 0; + if( module() ) + myGroupId = qHash( module()->name() ); } /*! @@ -169,3 +173,36 @@ bool LightApp_DataModel::isSaved() const { return true; } + +/*! + \return data model group id used for custom columns creation +*/ +int LightApp_DataModel::groupId() const +{ + return myGroupId; +} + +/*! + Register custom column in the object browser + \param browser - object browser where new column should be created + \param name - translated column name + \param custom_id - custom column identificator passed into data object's methods text(), icon() etc +*/ +void LightApp_DataModel::registerColumn( SUIT_DataBrowser* browser, const QString& name, const int custom_id ) +{ + SUIT_AbstractModel* m = dynamic_cast( browser ? browser->model() : 0 ); + if( m ) + m->registerColumn( groupId(), name, custom_id ); +} + +/*! + Remove registered custom column from the object browser + \param browser - object browser where new column should be created + \param name - translated column name +*/ +void LightApp_DataModel::unregisterColumn( SUIT_DataBrowser* browser, const QString& name ) +{ + SUIT_AbstractModel* m = dynamic_cast( browser ? browser->model() : 0 ); + if( m ) + m->unregisterColumn( groupId(), name ); +} diff --git a/src/LightApp/LightApp_DataModel.h b/src/LightApp/LightApp_DataModel.h index c2eb2d6e7..838270010 100644 --- a/src/LightApp/LightApp_DataModel.h +++ b/src/LightApp/LightApp_DataModel.h @@ -34,6 +34,7 @@ class LightApp_Module; class LightApp_Study; class LightApp_DataObject; +class SUIT_DataBrowser; /*! Description : Base class of data model @@ -58,6 +59,10 @@ public: LightApp_Module* getModule() const; + int groupId() const; + void registerColumn( SUIT_DataBrowser*, const QString&, const int ); + void unregisterColumn( SUIT_DataBrowser*, const QString& ); + signals: void opened(); void saved(); @@ -67,6 +72,9 @@ protected: LightApp_Study* getStudy() const; virtual void build(); virtual void updateWidgets(); + +private: + int myGroupId; }; #endif diff --git a/src/LightApp/LightApp_DataObject.cxx b/src/LightApp/LightApp_DataObject.cxx index 1f746533d..b0d858896 100644 --- a/src/LightApp/LightApp_DataObject.cxx +++ b/src/LightApp/LightApp_DataObject.cxx @@ -22,8 +22,8 @@ #include "LightApp_DataObject.h" #include "LightApp_Study.h" +#include "LightApp_DataModel.h" -#include #include #include @@ -115,38 +115,10 @@ LightApp_DataObject::~LightApp_DataObject() { } -/*! - \brief Get the number of the columns provided by the data tree. - \return number of the columns -*/ -int LightApp_DataObject::columnCount() const -{ - // add "Entry" column - return CAM_DataObject::columnCount() + 1; -} - -/*! - \brief Get column title. - \param index column index - \return title of the specified column -*/ -QString LightApp_DataObject::columnTitle( const int index ) const -{ - // add "Entry" column - return index == EntryIdx ? QObject::tr( "ENTRY_COLUMN" ) - : CAM_DataObject::columnTitle( index ); -} - -/*! - \brief Check if the column should appear in the tree view header popup menu - (to show/hide the column). - \param index column index - \return \c true if the column can be shown/hidden -*/ -bool LightApp_DataObject::appropriate( const int index ) const +int LightApp_DataObject::groupId() const { - // add "Entry" column - return index == EntryIdx ? true : CAM_DataObject::appropriate( index ); + LightApp_DataModel* m = dynamic_cast( dataModel() ); + return m ? m->groupId() : CAM_DataObject::groupId(); } /*! @@ -175,18 +147,17 @@ SUIT_DataObjectKey* LightApp_DataObject::key() const /*! \brief Get object text data for the specified column. - Column with \a index = 0 (NameIdx) is supposed to be used + Column with \a id = 0 (NameId) is supposed to be used to get the object name. - Column with \a index = 1 (EntryIdx) is supposed to be used + Column with \a id = 1 (EntryId) is supposed to be used to get the object entry. - \param index column index + \param id column id \return object text data */ -QString LightApp_DataObject::text( const int index ) const +QString LightApp_DataObject::text( const int id ) const { - // add "Entry" column - return index == EntryIdx ? entry() : CAM_DataObject::text( index ); + return id == EntryId ? entry() : CAM_DataObject::text( id ); } /*! @@ -229,15 +200,14 @@ QString LightApp_DataObject::componentDataType() const /*! \brief Check if the specified column supports custom sorting. - \param index column index + \param id column id \return \c true if column sorting should be customized \sa compare() */ -bool LightApp_DataObject::customSorting( const int index ) const +bool LightApp_DataObject::customSorting( const int id ) const { // perform custom sorting for the "Entry" column - return index == EntryIdx ? true - : CAM_DataObject::customSorting( index ); + return id == EntryId ? true : CAM_DataObject::customSorting( id ); } /*! @@ -248,14 +218,14 @@ bool LightApp_DataObject::customSorting( const int index ) const \param left first data to compare \param right second data to compare - \param index column index + \param id column id \return result of the comparison \sa customSorting() */ -bool LightApp_DataObject::compare( const QVariant& left, const QVariant& right, - const int index ) const +bool LightApp_DataObject::compare( const QVariant& left, const QVariant& right, const int id ) const { - if ( index == EntryIdx ) { + if ( id == EntryId ) + { // perform custom sorting for the "Entry" column QString leftStr = left.toString(); QString rightStr = right.toString(); @@ -293,7 +263,7 @@ bool LightApp_DataObject::compare( const QVariant& left, const QVariant& right, } return QString::localeAwareCompare( leftStr, rightStr ) < 0; } - return CAM_DataObject::compare( left, right, index ); + return CAM_DataObject::compare( left, right, id ); } /*! @@ -343,22 +313,22 @@ QString LightApp_ModuleObject::name() const /*! \brief Get data object icon for the specified column. - \param index column index + \param id column id \return object icon for the specified column */ -QPixmap LightApp_ModuleObject::icon( const int index ) const +QPixmap LightApp_ModuleObject::icon( const int id ) const { - return CAM_ModuleObject::icon( index ); + return CAM_ModuleObject::icon( id ); } /*! \brief Get data object tooltip for the specified column. - \param index column index + \param id column id \return object tooltip for the specified column */ -QString LightApp_ModuleObject::toolTip( const int index ) const +QString LightApp_ModuleObject::toolTip( const int id ) const { - return CAM_ModuleObject::toolTip( index ); + return CAM_ModuleObject::toolTip( id ); } /*! diff --git a/src/LightApp/LightApp_DataObject.h b/src/LightApp/LightApp_DataObject.h index 77f3b7861..fe4f7cb40 100644 --- a/src/LightApp/LightApp_DataObject.h +++ b/src/LightApp/LightApp_DataObject.h @@ -34,30 +34,26 @@ class LIGHTAPP_EXPORT LightApp_DataObject : public virtual CAM_DataObject class Key; public: - //! Column index + //! Column id enum { - EntryIdx = NameIdx + 1 //!< entry column + EntryId = NameId + 1 //!< entry column }; public: LightApp_DataObject( SUIT_DataObject* = 0 ); virtual ~LightApp_DataObject(); - virtual int columnCount() const; - virtual QString columnTitle( const int = NameIdx ) const; - virtual bool appropriate( const int = NameIdx ) const; - virtual SUIT_DataObjectKey* key() const; virtual QString entry() const; - virtual QString text( const int = NameIdx ) const; + virtual QString text( const int = NameId ) const; virtual SUIT_DataObject* componentObject() const; virtual QString componentDataType() const; - virtual bool customSorting( const int = NameIdx ) const; - virtual bool compare( const QVariant&, const QVariant&, - const int = NameIdx ) const; + virtual bool customSorting( const int = NameId ) const; + virtual bool compare( const QVariant&, const QVariant&, const int = NameId ) const; + virtual int groupId() const; protected: QString myCompDataType; @@ -74,8 +70,8 @@ public: virtual ~LightApp_ModuleObject(); virtual QString name() const; - QPixmap icon( const int = NameIdx ) const; - QString toolTip( const int = NameIdx ) const; + QPixmap icon( const int = NameId ) const; + QString toolTip( const int = NameId ) const; virtual void insertChild( SUIT_DataObject*, int ); }; diff --git a/src/LightApp/LightApp_DataSubOwner.h b/src/LightApp/LightApp_DataSubOwner.h index 7e8e7f3ea..32cd3ecb6 100644 --- a/src/LightApp/LightApp_DataSubOwner.h +++ b/src/LightApp/LightApp_DataSubOwner.h @@ -20,8 +20,8 @@ #ifndef LIGHTAPP_DATASUBOWNER_H #define LIGHTAPP_DATASUBOWNER_H -#include -#include +#include "LightApp.h" +#include "LightApp_DataOwner.h" /*! Class provide sub owner. diff --git a/src/LightApp/LightApp_Dialog.cxx b/src/LightApp/LightApp_Dialog.cxx index 049dc244c..24c49c5d3 100644 --- a/src/LightApp/LightApp_Dialog.cxx +++ b/src/LightApp/LightApp_Dialog.cxx @@ -19,7 +19,7 @@ // File: LightApp_Dialog.cxx // Author: Alexander SOLOVYOV -#include +#include "LightApp_Dialog.h" #include #include diff --git a/src/LightApp/LightApp_Driver.h b/src/LightApp/LightApp_Driver.h index e130b86da..8089b35c3 100644 --- a/src/LightApp/LightApp_Driver.h +++ b/src/LightApp/LightApp_Driver.h @@ -19,7 +19,7 @@ #ifndef LIGHTAPP_DRIVER_H #define LIGHTAPP_DRIVER_H -#include +#include "LightApp.h" #include "string" #include "vector" diff --git a/src/LightApp/LightApp_HDFDriver.h b/src/LightApp/LightApp_HDFDriver.h index 6f3b2c339..9f1995129 100644 --- a/src/LightApp/LightApp_HDFDriver.h +++ b/src/LightApp/LightApp_HDFDriver.h @@ -19,8 +19,8 @@ #ifndef LIGHTAPP_HDFDRIVER_H #define LIGHTAPP_HDFDRIVER_H -#include -#include +#include "LightApp.h" +#include "LightApp_Driver.h" #ifdef WIN32 #pragma warning( disable:4251 ) diff --git a/src/LightApp/LightApp_Module.cxx b/src/LightApp/LightApp_Module.cxx index f2e42984d..12a94b34a 100644 --- a/src/LightApp/LightApp_Module.cxx +++ b/src/LightApp/LightApp_Module.cxx @@ -37,16 +37,19 @@ #include "LightApp_ShowHideOp.h" #include "LightApp_SelectionMgr.h" -#include #include #include +#include #include #include #include #include +#include +#ifndef DISABLE_SALOMEOBJECT #include #include +#endif #ifndef DISABLE_VTKVIEWER #ifndef DISABLE_SALOMEOBJECT @@ -86,6 +89,7 @@ #include #include + /*!Constructor.*/ LightApp_Module::LightApp_Module( const QString& name ) : CAM_Module( name ), @@ -173,6 +177,7 @@ bool LightApp_Module::isSelectionCompatible() { // return true if selected objects belong to this module bool isCompatible = true; +#ifndef DISABLE_SALOMEOBJECT SALOME_ListIO selected; if ( LightApp_SelectionMgr *Sel = getApp()->selectionMgr() ) Sel->selectedObjects( selected ); @@ -189,6 +194,7 @@ bool LightApp_Module::isSelectionCompatible() isCompatible = ( aStudy->componentDataType( io->getEntry() ) == moduleDataType ); } } +#endif return isCompatible; } @@ -211,6 +217,14 @@ bool LightApp_Module::activateModule( SUIT_Study* study ) if ( mySwitchOp == 0 ) mySwitchOp = new LightApp_SwitchOp( this ); + QString EntryCol = QObject::tr( "ENTRY_COLUMN" ); + LightApp_DataModel* m = dynamic_cast( dataModel() ); + if( m ) + { + SUIT_AbstractModel* treeModel = dynamic_cast( getApp()->objectBrowser()->model() ); + m->registerColumn( getApp()->objectBrowser(), EntryCol, LightApp_DataObject::EntryId ); + treeModel->setAppropriate( EntryCol, Qtx::Toggled ); + } return res; } @@ -231,7 +245,16 @@ bool LightApp_Module::deactivateModule( SUIT_Study* study ) anIt.value()->abort(); } - return CAM_Module::activateModule( study ); + QString EntryCol = QObject::tr( "ENTRY_COLUMN" ); + LightApp_DataModel* m = dynamic_cast( dataModel() ); + if( m ) + { + SUIT_AbstractModel* treeModel = dynamic_cast( getApp()->objectBrowser()->model() ); + + treeModel->setAppropriate( EntryCol, Qtx::Shown ); + m->unregisterColumn( getApp()->objectBrowser(), EntryCol ); + } + return CAM_Module::deactivateModule( study ); } /*!NOT IMPLEMENTED*/ @@ -319,7 +342,7 @@ void LightApp_Module::updateControls() /*!Create new instance of data model and return it.*/ CAM_DataModel* LightApp_Module::createDataModel() { - return new LightApp_DataModel(this); + return new LightApp_DataModel( this ); } /*!Create and return instance of LightApp_Selection.*/ @@ -600,3 +623,14 @@ void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* ) void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* ) { } + +/*! + \brief Returns instance of operation by its id; if there is no operation + corresponding to this id, null pointer is returned + \param id - operation id + \return operation instance +*/ +LightApp_Operation* LightApp_Module::operation( const int id ) const +{ + return myOperations.contains( id ) ? myOperations[id] : 0; +} diff --git a/src/LightApp/LightApp_Module.h b/src/LightApp/LightApp_Module.h index 08c8eb7d3..d32fb1eb8 100644 --- a/src/LightApp/LightApp_Module.h +++ b/src/LightApp/LightApp_Module.h @@ -134,6 +134,8 @@ protected: virtual bool isSelectionCompatible(); + LightApp_Operation* operation( const int ) const; + private: typedef QMap MapOfOperation; diff --git a/src/LightApp/LightApp_ModuleDlg.cxx b/src/LightApp/LightApp_ModuleDlg.cxx index e7d7f3dcb..c2616da4c 100644 --- a/src/LightApp/LightApp_ModuleDlg.cxx +++ b/src/LightApp/LightApp_ModuleDlg.cxx @@ -20,7 +20,7 @@ // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // -#include +#include "LightApp_ModuleDlg.h" #include #include diff --git a/src/LightApp/LightApp_NameDlg.cxx b/src/LightApp/LightApp_NameDlg.cxx index 46517ae8b..7abb77e7b 100644 --- a/src/LightApp/LightApp_NameDlg.cxx +++ b/src/LightApp/LightApp_NameDlg.cxx @@ -20,7 +20,7 @@ // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // -#include +#include "LightApp_NameDlg.h" #include #include diff --git a/src/LightApp/LightApp_Operation.cxx b/src/LightApp/LightApp_Operation.cxx index a1ab32f96..06a0710e1 100755 --- a/src/LightApp/LightApp_Operation.cxx +++ b/src/LightApp/LightApp_Operation.cxx @@ -20,11 +20,11 @@ // Author : Sergey LITONIN // Module : LightApp -#include -#include -#include -#include -#include +#include "LightApp_Operation.h" +#include "LightApp_Module.h" +#include "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "LightApp_Dialog.h" #include #include diff --git a/src/LightApp/LightApp_Plot2dSelector.cxx b/src/LightApp/LightApp_Plot2dSelector.cxx new file mode 100755 index 000000000..a88c5f334 --- /dev/null +++ b/src/LightApp/LightApp_Plot2dSelector.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "LightApp_Plot2dSelector.h" + +#include "LightApp_DataOwner.h" +#include "LightApp_DataObject.h" +#include "LightApp_Application.h" + +/*! + Constructor +*/ +LightApp_Plot2dSelector::LightApp_Plot2dSelector( SPlot2d_Viewer* v, SUIT_SelectionMgr* mgr ) +: SUIT_Selector( mgr, v ) +{ + if ( v ) + connect( v, SIGNAL( legendSelected( const QString& ) ), this, SLOT( onSelectionChanged( const QString& ) ) ); +} + +/*! + Destructor +*/ +LightApp_Plot2dSelector::~LightApp_Plot2dSelector() +{ +} + +/*! + Gets selection. +*/ +void LightApp_Plot2dSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const +{ + if( !myCurEntry.isNull() ) + theList.append( new LightApp_DataOwner( myCurEntry ) ); +} + +/*!Sets selection.*/ +void LightApp_Plot2dSelector::setSelection( const SUIT_DataOwnerPtrList& theList ) +{ + /* if( theList.count()>0 ) + myCurEntry = theList.first()->getEntry(); + else + myCurEntry = QString::null;*/ +} + +/*!On selection changed.*/ +void LightApp_Plot2dSelector::onSelectionChanged( const QString& entry ) +{ + myCurEntry = entry; + selectionChanged(); +} diff --git a/src/LightApp/LightApp_Plot2dSelector.h b/src/LightApp/LightApp_Plot2dSelector.h new file mode 100755 index 000000000..7a47b46ec --- /dev/null +++ b/src/LightApp/LightApp_Plot2dSelector.h @@ -0,0 +1,56 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef LIGHTAPP_PLOT2DSELECTOR_H +#define LIGHTAPP_PLOT2DSELECTOR_H + +#include "LightApp.h" + +#include +#include +#include + +class LightApp_DataObject; + +/*! + \class LightApp_Plot2dSelector + Custom selector to get/set selection from object browser +*/ +class LIGHTAPP_EXPORT LightApp_Plot2dSelector : public QObject, public SUIT_Selector +{ + Q_OBJECT + +public: + LightApp_Plot2dSelector( SPlot2d_Viewer*, SUIT_SelectionMgr* ); + virtual ~LightApp_Plot2dSelector(); + + /*!Return "ObjectBrowser"*/ + virtual QString type() const { return "PLot2dViewer"; } + +private slots: + void onSelectionChanged( const QString& ); + +protected: + virtual void getSelection( SUIT_DataOwnerPtrList& ) const; + virtual void setSelection( const SUIT_DataOwnerPtrList& ); + +private: + QString myCurEntry; +}; + +#endif diff --git a/src/LightApp/LightApp_Preferences.h b/src/LightApp/LightApp_Preferences.h index c2f90452d..3fb3cb154 100644 --- a/src/LightApp/LightApp_Preferences.h +++ b/src/LightApp/LightApp_Preferences.h @@ -22,7 +22,7 @@ #ifndef LIGHTAPP_PREFERENCES_H #define LIGHTAPP_PREFERENCES_H -#include +#include "LightApp.h" #include #include diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx index add5dac14..1761f91a0 100644 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ b/src/LightApp/LightApp_PreferencesDlg.cxx @@ -134,10 +134,10 @@ void LightApp_PreferencesDlg::onDefault() { if ( myPrefs && myPrefs->resourceMgr() ) { - bool prev = myPrefs->resourceMgr()->ignoreUserValues(); - myPrefs->resourceMgr()->setIgnoreUserValues( true ); + QtxResourceMgr::WorkingMode prev = myPrefs->resourceMgr()->workingMode(); + myPrefs->resourceMgr()->setWorkingMode( QtxResourceMgr::IgnoreUserValues ); myPrefs->retrieve(); - myPrefs->resourceMgr()->setIgnoreUserValues( prev ); + myPrefs->resourceMgr()->setWorkingMode( prev ); } } } diff --git a/src/LightApp/LightApp_PreferencesDlg.h b/src/LightApp/LightApp_PreferencesDlg.h index 40b5aff4f..876052509 100644 --- a/src/LightApp/LightApp_PreferencesDlg.h +++ b/src/LightApp/LightApp_PreferencesDlg.h @@ -22,7 +22,7 @@ #ifndef LIGHTAPP_PREFERENCESDLG_H #define LIGHTAPP_PREFERENCESDLG_H -#include +#include "LightApp.h" #include diff --git a/src/LightApp/LightApp_Study.h b/src/LightApp/LightApp_Study.h index c45394d47..3e307ceea 100644 --- a/src/LightApp/LightApp_Study.h +++ b/src/LightApp/LightApp_Study.h @@ -19,8 +19,8 @@ #ifndef LIGHTAPP_STUDY_H #define LIGHTAPP_STUDY_H -#include -#include +#include "LightApp.h" +#include "LightApp_Driver.h" #include diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index 1654581bf..ac1a1efaf 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -66,6 +66,9 @@ endif if ENABLE_GLVIEWER salomeinclude_HEADERS += LightApp_GLSelector.h endif +if ENABLE_PLOT2DVIEWER + salomeinclude_HEADERS += LightApp_Plot2dSelector.h +endif dist_libLightApp_la_SOURCES = \ LightApp_AboutDlg.cxx \ @@ -106,6 +109,9 @@ endif if ENABLE_GLVIEWER dist_libLightApp_la_SOURCES += LightApp_GLSelector.cxx endif +if ENABLE_PLOT2DVIEWER + dist_libLightApp_la_SOURCES += LightApp_Plot2dSelector.cxx +endif MOC_FILES = \ LightApp_AboutDlg_moc.cxx \ @@ -136,6 +142,9 @@ endif if ENABLE_GLVIEWER MOC_FILES += LightApp_GLSelector_moc.cxx endif +if ENABLE_PLOT2DVIEWER + MOC_FILES += LightApp_Plot2dSelector_moc.cxx +endif nodist_libLightApp_la_SOURCES = $(MOC_FILES) dist_salomeres_DATA = \ diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index a3b86f797..a63e06006 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -102,7 +102,7 @@ - + diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index ccb44678f..0c8e44c89 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -33,6 +33,18 @@ CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS LightApp_Application + + MEN_DESK_THEME + Theme + + + TOT_THEME + Theme + + + PRP_THEME + Change style properties + INF_TOOLBAR_MODULES Modules diff --git a/src/OBJECT/Handle_SALOME_TypeFilter.hxx b/src/OBJECT/Handle_SALOME_TypeFilter.hxx index 4ca800e04..c0bc7d060 100644 --- a/src/OBJECT/Handle_SALOME_TypeFilter.hxx +++ b/src/OBJECT/Handle_SALOME_TypeFilter.hxx @@ -35,7 +35,7 @@ #endif #ifndef _Handle_SALOME_Filter_HeaderFile -#include +#include "Handle_SALOME_Filter.hxx" #endif class Standard_Transient; diff --git a/src/OBJECT/SALOME_AISObject.hxx b/src/OBJECT/SALOME_AISObject.hxx index b89716f4c..0422f500e 100755 --- a/src/OBJECT/SALOME_AISObject.hxx +++ b/src/OBJECT/SALOME_AISObject.hxx @@ -31,7 +31,7 @@ #include #endif #ifndef _Handle_SALOME_AISObject_HeaderFile -#include +#include "Handle_SALOME_AISObject.hxx" #endif #ifndef _AIS_InteractiveObject_HeaderFile diff --git a/src/OBJECT/SALOME_AISShape.hxx b/src/OBJECT/SALOME_AISShape.hxx index 4a8b87d98..8f1f6eec5 100755 --- a/src/OBJECT/SALOME_AISShape.hxx +++ b/src/OBJECT/SALOME_AISShape.hxx @@ -31,7 +31,7 @@ #include #endif #ifndef _Handle_SALOME_AISShape_HeaderFile -#include +#include "Handle_SALOME_AISShape.hxx" #endif #ifndef _Standard_CString_HeaderFile diff --git a/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx b/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx index 34ebe62d6..f19dc6ec7 100644 --- a/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx +++ b/src/OBJECT/SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx @@ -31,10 +31,10 @@ #include #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile -#include +#include "Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx" #endif class Standard_NoSuchObject; class SALOME_InteractiveObject; diff --git a/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx b/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx index 3c100b02e..dfd35d871 100644 --- a/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx +++ b/src/OBJECT/SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx @@ -31,11 +31,11 @@ #include #endif #ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile -#include +#include "Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx" #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _TColStd_IndexedMapOfInteger_HeaderFile #include diff --git a/src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx b/src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx index f3aa034f7..36453564f 100644 --- a/src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx +++ b/src/OBJECT/SALOME_DataMapOfIOMapOfInteger.hxx @@ -31,10 +31,10 @@ #include #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_HeaderFile -#include +#include "Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx" #endif #ifndef _Standard_Integer_HeaderFile #include diff --git a/src/OBJECT/SALOME_Filter.hxx b/src/OBJECT/SALOME_Filter.hxx index 4386503a5..fdd727173 100644 --- a/src/OBJECT/SALOME_Filter.hxx +++ b/src/OBJECT/SALOME_Filter.hxx @@ -31,7 +31,7 @@ #include #endif #ifndef _Handle_SALOME_Filter_HeaderFile -#include +#include "Handle_SALOME_Filter.hxx" #endif #ifndef _MMgt_TShared_HeaderFile @@ -41,7 +41,7 @@ #include #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif class SALOME_Filter : public MMgt_TShared { diff --git a/src/OBJECT/SALOME_InteractiveObject.hxx b/src/OBJECT/SALOME_InteractiveObject.hxx index 712d96d3b..cee2db060 100755 --- a/src/OBJECT/SALOME_InteractiveObject.hxx +++ b/src/OBJECT/SALOME_InteractiveObject.hxx @@ -31,7 +31,7 @@ #include #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _Standard_CString_HeaderFile diff --git a/src/OBJECT/SALOME_ListIO.hxx b/src/OBJECT/SALOME_ListIO.hxx index 7f52828d4..0662bad70 100644 --- a/src/OBJECT/SALOME_ListIO.hxx +++ b/src/OBJECT/SALOME_ListIO.hxx @@ -31,10 +31,10 @@ #include #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile -#include +#include "Handle_SALOME_ListNodeOfListIO.hxx" #endif #ifndef _Standard_Integer_HeaderFile #include diff --git a/src/OBJECT/SALOME_ListIteratorOfListIO.hxx b/src/OBJECT/SALOME_ListIteratorOfListIO.hxx index e69f42d5c..ecd98ee77 100644 --- a/src/OBJECT/SALOME_ListIteratorOfListIO.hxx +++ b/src/OBJECT/SALOME_ListIteratorOfListIO.hxx @@ -31,10 +31,10 @@ #include #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile -#include +#include "Handle_SALOME_ListNodeOfListIO.hxx" #endif #ifndef _Standard_Boolean_HeaderFile #include diff --git a/src/OBJECT/SALOME_ListNodeOfListIO.hxx b/src/OBJECT/SALOME_ListNodeOfListIO.hxx index 6d288bcab..afe2c8f01 100644 --- a/src/OBJECT/SALOME_ListNodeOfListIO.hxx +++ b/src/OBJECT/SALOME_ListNodeOfListIO.hxx @@ -31,11 +31,11 @@ #include #endif #ifndef _Handle_SALOME_ListNodeOfListIO_HeaderFile -#include +#include "Handle_SALOME_ListNodeOfListIO.hxx" #endif #ifndef _Handle_SALOME_InteractiveObject_HeaderFile -#include +#include "Handle_SALOME_InteractiveObject.hxx" #endif #ifndef _TCollection_MapNode_HeaderFile #include diff --git a/src/OBJECT/SALOME_TypeFilter.hxx b/src/OBJECT/SALOME_TypeFilter.hxx index 5a32301fe..86f925eff 100644 --- a/src/OBJECT/SALOME_TypeFilter.hxx +++ b/src/OBJECT/SALOME_TypeFilter.hxx @@ -31,7 +31,7 @@ #include #endif #ifndef _Handle_SALOME_TypeFilter_HeaderFile -#include +#include "Handle_SALOME_TypeFilter.hxx" #endif #ifndef _Standard_CString_HeaderFile diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am index 0f0e24c01..069463643 100755 --- a/src/OCCViewer/Makefile.am +++ b/src/OCCViewer/Makefile.am @@ -55,7 +55,8 @@ dist_libOCCViewer_la_SOURCES = \ OCCViewer_SetRotationPointDlg.cxx \ OCCViewer_ClippingDlg.cxx \ OCCViewer_AxialScaleDlg.cxx \ - OCCViewer_Trihedron.cxx + OCCViewer_Trihedron.cxx \ + OCCViewer_ToolTip.cxx MOC_FILES = \ OCCViewer_AISSelector_moc.cxx \ @@ -68,7 +69,9 @@ MOC_FILES = \ OCCViewer_CreateRestoreViewDlg_moc.cxx \ OCCViewer_SetRotationPointDlg_moc.cxx \ OCCViewer_ClippingDlg_moc.cxx \ - OCCViewer_AxialScaleDlg_moc.cxx + OCCViewer_AxialScaleDlg_moc.cxx \ + OCCViewer_ToolTip_moc.cxx + nodist_libOCCViewer_la_SOURCES = $(MOC_FILES) dist_salomeres_DATA = \ diff --git a/src/OCCViewer/OCCViewer.cxx b/src/OCCViewer/OCCViewer.cxx index cf7f06e6a..7a5c47e72 100644 --- a/src/OCCViewer/OCCViewer.cxx +++ b/src/OCCViewer/OCCViewer.cxx @@ -17,7 +17,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include +#include "OCCViewer_Trihedron.h" #include #include diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index cc816a932..adab3934b 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -76,8 +76,8 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O myListBox->insertItem( 0, "No Items" ); } - connect( myListBox, SIGNAL( itemClicked( QListBoxItem* ) ), this, SLOT( changeImage( QListBoxItem* ) ) ); - connect( myListBox, SIGNAL( itemChanged( QListBoxItem* ) ), this, SLOT( editItemText( QListBoxItem* ) ) ); + 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 ); diff --git a/src/OCCViewer/OCCViewer_ToolTip.cxx b/src/OCCViewer/OCCViewer_ToolTip.cxx new file mode 100644 index 000000000..536acdc22 --- /dev/null +++ b/src/OCCViewer/OCCViewer_ToolTip.cxx @@ -0,0 +1,103 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: OCCViewer_ToolTip.cxx +// Author: Alexandre SOLOVYOV + +#include +#include +#include +#include + +#include + +#include + +/*! + Constructor + + \param wnd - window where the tooltip should be assigned +*/ +OCCViewer_ToolTip::OCCViewer_ToolTip( OCCViewer_ViewWindow* wnd ) +: QtxToolTip( wnd->getViewPort() ), + myWnd( wnd ) +{ + connect( this, SIGNAL( maybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ), + this, SLOT( onToolTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) ); +} + +/*! + Destructor + */ +OCCViewer_ToolTip::~OCCViewer_ToolTip() +{ +} + +/*! + \return font of the tooltip + */ +QFont OCCViewer_ToolTip::font() const +{ + return myFont; +} + +/*! + Change font of the tooltip + + \param f - new font + */ +void OCCViewer_ToolTip::setFont( const QFont& f ) +{ + myFont = f; +} + +/*! + Tooltip handler + + \param p - current point + \param str - returned tooltip text + \param f - returned tooltip font + \param txtRect - returned tooltip text rectangle + \param rect - returned tooltip rectangle + */ +void OCCViewer_ToolTip::onToolTip( QPoint p, QString& str, QFont& f, QRect& txtRect, QRect& rect ) +{ + OCCViewer_Viewer* v = dynamic_cast( myWnd->getViewManager()->getViewModel() ); + Handle( AIS_InteractiveContext ) aCont = v->getAISContext(); + if( aCont.IsNull() ) + return; + + QString txt; + Handle( SelectMgr_EntityOwner ) owner = aCont->DetectedOwner(); + if( !owner.IsNull() ) + emit toolTipFor( owner, txt ); + + Handle_AIS_InteractiveObject obj = aCont->DetectedInteractive(); + if( txt.isEmpty() && !obj.IsNull() ) + emit toolTipFor( obj, txt ); + + if( txt.isEmpty() ) + return; + + str = txt; + QFontMetrics m( myFont ); + int w = m.width( str ), h = m.height(); + + txtRect = QRect( p.x()+4, p.y()-h, w, h ); + rect = txtRect; +} diff --git a/src/OCCViewer/OCCViewer_ToolTip.h b/src/OCCViewer/OCCViewer_ToolTip.h new file mode 100644 index 000000000..42ff7fed9 --- /dev/null +++ b/src/OCCViewer/OCCViewer_ToolTip.h @@ -0,0 +1,63 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef OCCVIEWER_TOOLTIP_H +#define OCCVIEWER_TOOLTIP_H + +#include +#include +#include + +class OCCViewer_ViewWindow; +class Handle_SelectMgr_EntityOwner; +class Handle_AIS_InteractiveObject; + +/*! + \class OCCViewer_ToolTip + \brief Custom tooltip for AIS_InteractiveObjects and SelectMgr_EntityOwners in the OCC Viewer +*/ +class OCCVIEWER_EXPORT OCCViewer_ToolTip : public QtxToolTip +{ + Q_OBJECT + +public: + OCCViewer_ToolTip( OCCViewer_ViewWindow* ); + virtual ~OCCViewer_ToolTip(); + + QFont font() const; + void setFont( const QFont& ); + +signals: + /*! + Called when owner is detected; allows to redefine tooltip text for owner + */ + void toolTipFor( const Handle_SelectMgr_EntityOwner&, QString& ); + /*! + Called when object is detected; allows to redefine tooltip text for object + */ + void toolTipFor( const Handle_AIS_InteractiveObject&, QString& ); + +public slots: + void onToolTip( QPoint, QString&, QFont&, QRect&, QRect& ); + +private: + OCCViewer_ViewWindow* myWnd; + QFont myFont; +}; + +#endif diff --git a/src/OCCViewer/OCCViewer_Trihedron.h b/src/OCCViewer/OCCViewer_Trihedron.h index 5836264e1..5c2bfc88d 100644 --- a/src/OCCViewer/OCCViewer_Trihedron.h +++ b/src/OCCViewer/OCCViewer_Trihedron.h @@ -19,7 +19,7 @@ #ifndef OCCVIEWER_TRIHEDRON_H #define OCCVIEWER_TRIHEDRON_H -#include +#include "OCCViewer.h" #include #include diff --git a/src/OCCViewer/OCCViewer_VService.cxx b/src/OCCViewer/OCCViewer_VService.cxx index 77ef0aced..f4d4fc0ec 100755 --- a/src/OCCViewer/OCCViewer_VService.cxx +++ b/src/OCCViewer/OCCViewer_VService.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #else #include #include @@ -89,6 +90,8 @@ void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view, #ifdef WNT Handle(WNT_Window) w = new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); + // Prevent flicker + w->SetFlags( WDF_NOERASEBKGRND ); #else Handle(Xw_Window) w = new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, quality ); diff --git a/src/OCCViewer/OCCViewer_ViewManager.cxx b/src/OCCViewer/OCCViewer_ViewManager.cxx index 39c740c5d..8bb6aad76 100755 --- a/src/OCCViewer/OCCViewer_ViewManager.cxx +++ b/src/OCCViewer/OCCViewer_ViewManager.cxx @@ -24,7 +24,7 @@ Constructor */ OCCViewer_ViewManager::OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop, bool DisplayTrihedron ) -: SUIT_ViewManager( study, theDesktop, new OCCViewer_Viewer( DisplayTrihedron ) ) +: SUIT_ViewManager( study, theDesktop, new OCCViewer_Viewer( DisplayTrihedron, false ) ) { setTitle( tr( "OCC_VIEW_TITLE" ) ); } diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index d79e8e2f1..90f34b292 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -946,42 +946,42 @@ void OCCViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_DUMP" ) ), tr( "MNU_DUMP_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_DUMP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onDumpView())); toolMgr()->registerAction( aAction, DumpId ); // FitAll aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITALL" ) ), tr( "MNU_FITALL" ), 0, this); aAction->setStatusTip(tr("DSC_FITALL")); - connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onFitAll())); toolMgr()->registerAction( aAction, FitAllId ); // FitRect aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITAREA" ) ), tr( "MNU_FITRECT" ), 0, this); aAction->setStatusTip(tr("DSC_FITRECT")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateWindowFit())); toolMgr()->registerAction( aAction, FitRectId ); // Zoom aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ZOOM" ) ), tr( "MNU_ZOOM_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateZoom())); toolMgr()->registerAction( aAction, ZoomId ); // Panning aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_PAN" ) ), tr( "MNU_PAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activatePanning())); toolMgr()->registerAction( aAction, PanId ); // Global Panning aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_GLOBALPAN" ) ), tr( "MNU_GLOBALPAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateGlobalPanning())); toolMgr()->registerAction( aAction, GlobalPanId ); // Rotation Point @@ -996,58 +996,58 @@ void OCCViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ROTATE" ) ), tr( "MNU_ROTATE_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_ROTATE_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation())); + connect(aAction, SIGNAL(triggered()), this, SLOT(activateRotation())); toolMgr()->registerAction( aAction, RotationId ); // Projections aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FRONT" ) ), tr( "MNU_FRONT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_FRONT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onFrontView())); toolMgr()->registerAction( aAction, FrontId ); aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_BACK" ) ), tr( "MNU_BACK_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_BACK_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onBackView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onBackView())); toolMgr()->registerAction( aAction, BackId ); aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TOP" ) ), tr( "MNU_TOP_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_TOP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onTopView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onTopView())); toolMgr()->registerAction( aAction, TopId ); aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_BOTTOM" ) ), tr( "MNU_BOTTOM_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onBottomView())); toolMgr()->registerAction( aAction, BottomId ); aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_LEFT" ) ), tr( "MNU_LEFT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_LEFT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onLeftView())); toolMgr()->registerAction( aAction, LeftId ); aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RIGHT" ) ), tr( "MNU_RIGHT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_RIGHT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onRightView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onRightView())); toolMgr()->registerAction( aAction, RightId ); // Reset aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RESET" ) ), tr( "MNU_RESET_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onResetView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onResetView())); toolMgr()->registerAction( aAction, ResetId ); // Reset aAction = new QtxAction(tr("MNU_CLONE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLONE_VIEW" ) ), tr( "MNU_CLONE_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_CLONE_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onCloneView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onCloneView())); toolMgr()->registerAction( aAction, CloneId ); myClippingAction = new QtxAction(tr("MNU_CLIPPING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ) ), @@ -1060,20 +1060,20 @@ void OCCViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_SHOOT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SHOOT_VIEW" ) ), tr( "MNU_SHOOT_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_SHOOT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onMemorizeView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onMemorizeView())); toolMgr()->registerAction( aAction, MemId ); aAction = new QtxAction(tr("MNU_PRESETS_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_PRESETS_VIEW" ) ), tr( "MNU_PRESETS_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_PRESETS_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onRestoreView())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onRestoreView())); toolMgr()->registerAction( aAction, RestoreId ); if (myModel->trihedronActivated()) { aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TRIHEDRON" ) ), tr( "MNU_SHOW_TRIHEDRE" ), 0, this); aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRE")); - connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onTrihedronShow())); toolMgr()->registerAction( aAction, TrihedronShowId ); } @@ -1081,7 +1081,7 @@ void OCCViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_SCALING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SCALING" ) ), tr( "MNU_SCALING" ), 0, this); aAction->setStatusTip(tr("DSC_SCALING")); - connect(aAction, SIGNAL(activated()), this, SLOT(onAxialScale())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onAxialScale())); toolMgr()->registerAction( aAction, AxialScaleId ); } diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index 63ea37b3f..de8ba7667 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -162,8 +162,6 @@ OB_Browser::OB_Browser( QWidget* parent, QAbstractItemModel* model ) connect( myView, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); - connect( myView, SIGNAL( doubleClicked( QListViewItem* ) ), - this, SLOT( onDoubleClicked( QListViewItem* ) ) ); } diff --git a/src/Plot2d/Plot2d_ToolTip.cxx b/src/Plot2d/Plot2d_ToolTip.cxx index bf94e310f..043c5c487 100644 --- a/src/Plot2d/Plot2d_ToolTip.cxx +++ b/src/Plot2d/Plot2d_ToolTip.cxx @@ -19,9 +19,9 @@ // File: Plot2d_ToolTip.cxx // Author: Alexandre SOLOVYOV -#include -#include -#include +#include "Plot2d_ToolTip.h" +#include "Plot2d_ViewFrame.h" +#include "Plot2d_Curve.h" #include #include diff --git a/src/Plot2d/Plot2d_ToolTip.h b/src/Plot2d/Plot2d_ToolTip.h index c2f2d785f..06fcb70d1 100644 --- a/src/Plot2d/Plot2d_ToolTip.h +++ b/src/Plot2d/Plot2d_ToolTip.h @@ -22,7 +22,7 @@ #ifndef PLOT2D_TOOLTIP_H #define PLOT2D_TOOLTIP_H -#include +#include "Plot2d.h" #include class Plot2d_ViewFrame; diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index d234801fb..b3fe3d4e6 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -171,9 +171,9 @@ Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title ) aLayout->addWidget( myPlot ); -// createActions(); - //connect( myPlot, SIGNAL( legendClicked( long ) ), - // this, SLOT( onLegendClicked( long ) ) ); + // createActions(); + connect( myPlot, SIGNAL( legendClicked( QwtPlotItem* ) ), + this, SIGNAL( legendClicked( QwtPlotItem* ) ) ); /* Initial Setup - get from the preferences */ readPreferences(); @@ -1029,6 +1029,7 @@ void Plot2d_ViewFrame::showLegend( bool show, bool update ) legend = new QwtLegend( myPlot ); legend->setFrameStyle( QFrame::Box | QFrame::Sunken ); } + legend->setItemMode( QwtLegend::ClickableItem ); myPlot->insertLegend( legend ); setLegendPos( myLegendPos ); } diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index ba9f2e5f8..c08c827ae 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -150,7 +150,6 @@ public slots: void onSettings(); void onFitData(); void onChangeBackground(); - void onPanLeft(); void onPanRight(); void onPanUp(); @@ -169,6 +168,7 @@ signals: void vpModeVerChanged(); void vpCurveChanged(); void contextMenuRequested( QContextMenuEvent *e ); + void legendClicked( QwtPlotItem* ); protected: Plot2d_Plot2d* myPlot; diff --git a/src/Plot2d/Plot2d_ViewManager.cxx b/src/Plot2d/Plot2d_ViewManager.cxx index a94f5642c..8d2eb3174 100755 --- a/src/Plot2d/Plot2d_ViewManager.cxx +++ b/src/Plot2d/Plot2d_ViewManager.cxx @@ -19,6 +19,7 @@ #include "Plot2d_ViewManager.h" #include "Plot2d_ViewModel.h" #include "Plot2d_ViewWindow.h" +#include "Plot2d_ViewFrame.h" /*! Constructor @@ -55,6 +56,11 @@ bool Plot2d_ViewManager::insertView( SUIT_ViewWindow* theView ) { Plot2d_ViewWindow* view = (Plot2d_ViewWindow*)theView; connect( view, SIGNAL( cloneView() ), this, SLOT( onCloneView() ) ); + + Plot2d_ViewFrame* aViewFrame = view->getViewFrame(); + Plot2d_Viewer* aViewer = getPlot2dModel(); + connect( aViewFrame, SIGNAL( legendClicked( QwtPlotItem* ) ), + aViewer, SLOT( onLegendClicked( QwtPlotItem* ) ) ); } return res; } diff --git a/src/Plot2d/Plot2d_ViewModel.cxx b/src/Plot2d/Plot2d_ViewModel.cxx index 5725fb412..dfd54f124 100755 --- a/src/Plot2d/Plot2d_ViewModel.cxx +++ b/src/Plot2d/Plot2d_ViewModel.cxx @@ -208,6 +208,13 @@ void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* n } } +/* + SLOT: called when clicked item in the legend from Plot2d_ViewManager + */ +void Plot2d_Viewer::onLegendClicked( QwtPlotItem* plotItem ) +{ +} + /*! Sets view manager \param mgr - new view manager diff --git a/src/Plot2d/Plot2d_ViewModel.h b/src/Plot2d/Plot2d_ViewModel.h index b2c0b0416..3402dc6a9 100755 --- a/src/Plot2d/Plot2d_ViewModel.h +++ b/src/Plot2d/Plot2d_ViewModel.h @@ -21,6 +21,7 @@ #include "Plot2d.h" #include "SUIT_ViewModel.h" +#include "qwt_plot.h" class SUIT_ViewWindow; class SUIT_Desktop; @@ -57,6 +58,7 @@ protected slots: void onDumpView(); void onShowToolbar(); virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ); + virtual void onLegendClicked( QwtPlotItem* ); private: Plot2d_Prs* myPrs; diff --git a/src/QDS/QDS_ComboBox.cxx b/src/QDS/QDS_ComboBox.cxx index f7131aada..2d5fd05eb 100644 --- a/src/QDS/QDS_ComboBox.cxx +++ b/src/QDS/QDS_ComboBox.cxx @@ -335,12 +335,9 @@ void QDS_ComboBox::reset() int id = -1; QString aDefValue = defaultValue(); if ( !aDefValue.isEmpty() ) - id = aDefValue.toInt(); - - if ( id == -1 ) - id = getId( 0 ); - - setIntegerValue( id ); + setString( aDefValue ); + else + setIntegerValue( getId( 0 ) ); } /*! @@ -599,9 +596,9 @@ void QDS_ComboBox::updateComboBox() if ( cb ) { if ( myIcons.contains( id ) ) - cb->insertItem( -1, QIcon(myIcons[id]), myValue[id] ); + cb->addItem( QIcon(myIcons[id]), myValue[id] ); else - cb->insertItem( -1, myValue[id] ); + cb->addItem( myValue[id] ); } } diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index 81e944e91..b3780f699 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -18,20 +18,15 @@ // #include "QDS_Datum.h" -#include "QDS_Validator.h" - -#include - +#include +#include #include -#include -#include -#include -#include -#include -#include #include +#include +#include -#include +#include +#include /*! \class QDS_Datum::Wrapper @@ -45,15 +40,14 @@ public: Wrapper( QWidget* = 0 ); virtual ~Wrapper(); - QWidget* widget() const; - void setWidget( QWidget* ); + QWidget* widget() const; + void setWidget( QWidget* ); virtual void setGeometry( int x, int y, int w, int h ); virtual void setSizePolicy( QSizePolicy ); private: - QWidget* myWid; - QHBoxLayout* myBase; + QWidget* myWid; }; /*! @@ -64,9 +58,9 @@ QDS_Datum::Wrapper::Wrapper( QWidget* parent ) : QWidget( parent ), myWid( 0 ) { - //QHBoxLayout* base = new QHBoxLayout( this ); - //base->setAutoAdd( true ); - myBase = new QHBoxLayout( this ); + setLayout( new QHBoxLayout() ); + layout()->setSpacing( 0 ); + layout()->setMargin( 0 ); setFocusPolicy( Qt::StrongFocus ); } @@ -92,21 +86,16 @@ QWidget* QDS_Datum::Wrapper::widget() const */ void QDS_Datum::Wrapper::setWidget( QWidget* wid ) { - if ( myWid == wid ) + if ( myWid == wid || !wid ) return; + wid->setParent( this ); + QHBoxLayout* hl = qobject_cast( layout() ); + if( myWid ) + hl->removeWidget( myWid ); + hl->addWidget( wid ); myWid = wid; - if ( !myWid ) - return; - - if ( myWid->parent() != this ) { - myWid->setParent( this ); - myWid->move( QPoint( 0, 0 ) ); - myWid->hide(); - myBase->addWidget( myWid ); - } - setTabOrder( this, myWid ); setFocusProxy( myWid ); @@ -211,7 +200,8 @@ QDS_Datum::QDS_Datum( const QString& id, QWidget* parent, const int flags, const myUnits( 0 ), myControl( 0 ), myFlags( flags ), - myInitialised( false ) + myInitialised( false ), + myTr( false ) { if ( myFlags & Label ) myWrapper.insert( Label, new Wrapper( parent ) ); @@ -296,6 +286,44 @@ int QDS_Datum::type() const return res; } +/*! + \brief Return state of custom translation. + \return true if custom translation is enabled +*/ +bool QDS_Datum::isCustomTr() const +{ + return myTr; +} + +/*! + \brief Change state of custom translation. + + Custom translation means that text labels of datums are translated + with help of standard Qt mechanism of internationalization. In this + case special records should be placed into *.ts files under context "QDS". + For example, if label has name "myLabel", the corresponding translation + should be written: + + QDS + + myLabel + myLabel translation + + ... + + If custom translation mechanism is deactivated, then labels will be shown + with text got from xml data dictionary file + + By default, the custom translation is deactivated + + \param on - if it is true, custom translation is activated, otherwise, deactivated +*/ +void QDS_Datum::enableCustomTr( const bool on ) +{ + myTr = on; + labelWidget()->setText( label() ); +} + /*! \brief Get the datum label text. \return label text @@ -306,11 +334,19 @@ QString QDS_Datum::label() const QString labStr; if ( !myDicItem.IsNull() ) + { labStr = toQString( myDicItem->GetLabel() ); - + if( labStr.isNull() ) + labStr = toQString( myDicItem->GetId() ); + } + if( myTr ) + { + QString dest = QApplication::translate( "QDS", labStr.toLatin1().constData() ); + if( labStr != dest ) + labStr = dest; + } if ( flags() & NotAccel ) labStr = removeAccel( labStr ); - return labStr; } @@ -942,7 +978,7 @@ bool QDS_Datum::isValid( const bool msgBox, const QString& extMsg, const QString info += QString( "\n" ) + extMsg; QString msg; - for ( uint i = 0; i < info.length(); i++ ) + for ( int i = 0; i < info.length(); i++ ) if ( info.at( i ) == '\n' ) msg += QString( "
" ); else diff --git a/src/QDS/QDS_Datum.h b/src/QDS/QDS_Datum.h index c42e92241..920371d56 100644 --- a/src/QDS/QDS_Datum.h +++ b/src/QDS/QDS_Datum.h @@ -20,19 +20,18 @@ #define QDS_DATUM_H #include "QDS.h" - -#include -#include #include +#include +#include + +class QHBoxLayout; +class QVBoxLayout; +class QGridLayout; +class QValidator; #include -class QLabel; class QWidget; -class QValidator; -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; class QDS_EXPORT QDS_Datum : public QObject, public QDS { @@ -115,6 +114,9 @@ public: operator QWidget*() const; + bool isCustomTr() const; + void enableCustomTr( const bool ); + signals: void paramChanged(); void paramChanged( QString& ); @@ -196,7 +198,7 @@ private: QString mySourceValue; QString myTargetValue; - bool myInitialised; + bool myInitialised, myTr; friend class QDS; }; diff --git a/src/QDS/QDS_SpinBox.cxx b/src/QDS/QDS_SpinBox.cxx index e3966a1c5..82ebbbb0d 100644 --- a/src/QDS/QDS_SpinBox.cxx +++ b/src/QDS/QDS_SpinBox.cxx @@ -170,7 +170,8 @@ void QDS_SpinBox::unitSystemChanged( const QString& system ) sb->setSuffix( suffix() ); sb->setPrefix( prefix() ); - sb->setMinimum( minValue().toInt() ); - sb->setMaximum( maxValue().toInt() ); + sb->setMinimum( minValue().isEmpty() ? -INT_MAX : minValue().toInt() ); + sb->setMaximum( maxValue().isEmpty() ? INT_MAX : maxValue().toInt() ); + } } diff --git a/src/Qtx/Makefile.am b/src/Qtx/Makefile.am index 99d868f2a..1c8b6eac9 100755 --- a/src/Qtx/Makefile.am +++ b/src/Qtx/Makefile.am @@ -165,6 +165,7 @@ MOC_FILES = \ QtxPathEdit_moc.cxx \ QtxPathListEdit_moc.cxx \ QtxPopupMgr_moc.cxx \ + QtxRubberBand_moc.cxx \ QtxSearchTool_moc.cxx \ QtxSplash_moc.cxx \ QtxToolBar_moc.cxx \ diff --git a/src/Qtx/Qtx.h b/src/Qtx/Qtx.h index 49ab74cae..466127033 100755 --- a/src/Qtx/Qtx.h +++ b/src/Qtx/Qtx.h @@ -96,6 +96,12 @@ public: AppropriateRole = Qt::UserRole + 100 //!< can be used to return \c true if data is appropriate }; + 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 + } Appropriate; //!< appropriate status + static QString toQString( const char*, const int = -1 ); static QString toQString( const short*, const int = -1 ); static QString toQString( const unsigned char*, const int = -1 ); diff --git a/src/Qtx/QtxFontEdit.cxx b/src/Qtx/QtxFontEdit.cxx index 30970d8f1..972284cdf 100644 --- a/src/Qtx/QtxFontEdit.cxx +++ b/src/Qtx/QtxFontEdit.cxx @@ -130,11 +130,25 @@ QFont QtxFontEdit::currentFont() const */ void QtxFontEdit::setCurrentFont( const QFont& fnt ) { + myFamily->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 ) ); + + myFamily->blockSignals( false ); + mySize->blockSignals( false ); + myB->blockSignals( false ); + myI->blockSignals( false ); + myU->blockSignals( false ); + + emit( changed( currentFont() ) ); } /*! @@ -234,6 +248,9 @@ void QtxFontEdit::updateState() */ void QtxFontEdit::onFontChanged( const QFont& /*f*/ ) { + bool blocked = mySize->signalsBlocked(); + mySize->blockSignals( true ); + int s = fontSize(); mySize->clear(); @@ -244,6 +261,16 @@ void QtxFontEdit::onFontChanged( const QFont& /*f*/ ) mySize->addItems( sizes ); setFontSize( s ); + + mySize->blockSignals( blocked ); + + if ( !myFamily->signalsBlocked() ) + emit( changed( currentFont() ) ); +} + +void QtxFontEdit::onPropertyChanged() +{ + emit( changed( currentFont() ) ); } /*! @@ -290,8 +317,13 @@ void QtxFontEdit::initialize() myFamily->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( myPreview, SIGNAL( clicked( bool ) ), this, SLOT( onPreview( bool ) ) ); + connect( myFamily, SIGNAL( currentFontChanged( const QFont& ) ), this, SLOT( onFontChanged( const QFont& ) ) ); + connect( mySize, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onPropertyChanged() ) ); + connect( mySize, SIGNAL( editTextChanged( QString ) ), this, SLOT( onPropertyChanged() ) ); + connect( myB, SIGNAL( toggled( bool ) ), this, SLOT( onPropertyChanged() ) ); + connect( myI, SIGNAL( toggled( bool ) ), this, SLOT( onPropertyChanged() ) ); + connect( myU, SIGNAL( toggled( bool ) ), this, SLOT( onPropertyChanged() ) ); updateState(); onFontChanged( currentFont() ); diff --git a/src/Qtx/QtxFontEdit.h b/src/Qtx/QtxFontEdit.h index b0ef25eef..897b10a47 100644 --- a/src/Qtx/QtxFontEdit.h +++ b/src/Qtx/QtxFontEdit.h @@ -67,9 +67,13 @@ public: int features() const; void setFeatures( const int ); +signals: + void changed( const QFont& ); + private slots: void onPreview( bool ); void onFontChanged( const QFont& ); + void onPropertyChanged(); private: void initialize(); diff --git a/src/Qtx/QtxListAction.cxx b/src/Qtx/QtxListAction.cxx index 6aea24408..d1fca010a 100755 --- a/src/Qtx/QtxListAction.cxx +++ b/src/Qtx/QtxListAction.cxx @@ -884,7 +884,7 @@ void QtxListAction::onMultiple( const int numActions ) myFrame->hide(); if ( numActions > 0 ) - emit activated( numActions ); + emit triggered( numActions ); } /*! @@ -901,7 +901,7 @@ void QtxListAction::onTriggered( bool /*on*/ ) if ( idx < 0 ) return; - emit activated( idx + 1 ); + emit triggered( idx + 1 ); } /*! diff --git a/src/Qtx/QtxListAction.h b/src/Qtx/QtxListAction.h index 956f65c73..d4553a0fc 100755 --- a/src/Qtx/QtxListAction.h +++ b/src/Qtx/QtxListAction.h @@ -67,7 +67,7 @@ public: void setCharsNumber( const int ); signals: - void activated( int ); + void triggered( int ); private slots: void onChanged(); diff --git a/src/Qtx/QtxResourceMgr.cxx b/src/Qtx/QtxResourceMgr.cxx index 80812a2f1..de647ba3b 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -1041,8 +1041,11 @@ bool QtxResourceMgr::Format::save( Resources* res ) resources environment variable has higher priority. Priority has the meaning when searching requested resources (application preference, pixmap file name, translation file, etc). - Loading of the user configuration file can be omitted by calling setIgnoreUserValues() - with \c true parameter. + + When retrieving preferences, it is sometimes helpful to ignore values coming from the + user preference file and take into account only global preferences. + To do this, use setWorkingMode() method passing QtxResourceMgr::IgnoreUserValues enumerator + as parameter. Resources manager operates with such terms like options, sections and parameters. Parametets are named application resources, for example, application preferences like @@ -1082,7 +1085,8 @@ QtxResourceMgr::QtxResourceMgr( const QString& appName, const QString& resVarTem myCheckExist( true ), myDefaultPix( 0 ), myIsPixmapCached( true ), - myIsIgnoreUserValues( false ) + myHasUserValues( true ), + myWorkingMode( AllowUserValues ) { QString envVar = !resVarTemplate.isEmpty() ? resVarTemplate : QString( "%1Resources" ); if ( envVar.contains( "%1" ) ) @@ -1172,18 +1176,19 @@ QStringList QtxResourceMgr::dirList() const Prepare the resources containers and load resources (if \a autoLoad is \c true). \param autoLoad if \c true (default) then all resources are loaded - \param loadUser if \c true (default) then user settings are also loaded */ -void QtxResourceMgr::initialize( const bool autoLoad, const bool loadUser ) const +void QtxResourceMgr::initialize( const bool autoLoad ) const { if ( !myResources.isEmpty() ) return; QtxResourceMgr* that = (QtxResourceMgr*)this; - if ( loadUser && !userFileName( appName() ).isEmpty() ) + if ( !userFileName( appName() ).isEmpty() ) that->myResources.append( new Resources( that, userFileName( appName() ) ) ); + that->myHasUserValues = myResources.count() > 0; + for ( QStringList::ConstIterator it = myDirList.begin(); it != myDirList.end(); ++it ) { QString path = Qtx::addSlash( *it ) + globalFileName( appName() ); @@ -1230,27 +1235,31 @@ void QtxResourceMgr::clear() } /*! - \brief Set "ignore user values" option value. - - If this option is \c true, then all resources loaded from user home directory are ignored. + \brief Get current working mode. - \param val new option value - \sa ignoreUserValues() + \return current working mode + \sa setWorkingMode(), value(), hasValue(), hasSection(), setValue() */ -void QtxResourceMgr::setIgnoreUserValues( const bool val ) +QtxResourceMgr::WorkingMode QtxResourceMgr::workingMode() const { - myIsIgnoreUserValues = val; + return myWorkingMode; } /*! - \brief Get "ignore user values" option value. + \brief Set resource manager's working mode. + + The resource manager can operate in the following working modes: + * AllowUserValues : methods values(), hasValue(), hasSection() take into account user values (default) + * IgnoreUserValues : methods values(), hasValue(), hasSection() do not take into account user values + + Note, that setValue() method always put the value to the user settings file. - \return "ignore user values" option value - \sa setIgnoreUserValues() + \param mode new working mode + \sa workingMode(), value(), hasValue(), hasSection(), setValue() */ -bool QtxResourceMgr::ignoreUserValues() const +void QtxResourceMgr::setWorkingMode( WorkingMode mode ) { - return myIsIgnoreUserValues; + myWorkingMode = mode; } /*! @@ -1493,7 +1502,7 @@ bool QtxResourceMgr::value( const QString& sect, const QString& name, QString& v bool ok = false; ResList::ConstIterator it = myResources.begin(); - if ( ignoreUserValues() ) + if ( myHasUserValues && workingMode() == IgnoreUserValues ) ++it; for ( ; it != myResources.end() && !ok; ++it ) @@ -1702,7 +1711,12 @@ bool QtxResourceMgr::hasValue( const QString& sect, const QString& name ) const initialize(); bool ok = false; - for ( ResList::ConstIterator it = myResources.begin(); it != myResources.end() && !ok; ++it ) + + ResList::ConstIterator it = myResources.begin(); + if ( myHasUserValues && workingMode() == IgnoreUserValues ) + ++it; + + for ( ; it != myResources.end() && !ok; ++it ) ok = (*it)->hasValue( sect, name ); return ok; @@ -1718,7 +1732,12 @@ bool QtxResourceMgr::hasSection( const QString& sect ) const initialize(); bool ok = false; - for ( ResList::ConstIterator it = myResources.begin(); it != myResources.end() && !ok; ++it ) + + ResList::ConstIterator it = myResources.begin(); + if ( myHasUserValues && workingMode() == IgnoreUserValues ) + ++it; + + for ( ; it != myResources.end() && !ok; ++it ) ok = (*it)->hasSection( sect ); return ok; @@ -2062,6 +2081,9 @@ bool QtxResourceMgr::import( const QString& fname ) if ( !fmt ) return false; + if ( myResources.isEmpty() || !myHasUserValues ) + return false; + Resources* r = myResources[0]; if ( !r ) return false; @@ -2085,7 +2107,7 @@ bool QtxResourceMgr::save() if ( !fmt ) return false; - if ( myResources.isEmpty() ) + if ( myResources.isEmpty() || !myHasUserValues ) return true; return fmt->save( myResources[0] ); @@ -2100,18 +2122,19 @@ QStringList QtxResourceMgr::sections() const initialize(); QMap map; - for ( ResList::ConstIterator it = myResources.begin(); it != myResources.end(); ++it ) + + ResList::ConstIterator it = myResources.begin(); + if ( myHasUserValues && workingMode() == IgnoreUserValues ) + ++it; + + for ( ; it != myResources.end(); ++it ) { QStringList lst = (*it)->sections(); for ( QStringList::ConstIterator itr = lst.begin(); itr != lst.end(); ++itr ) map.insert( *itr, 0 ); } - QStringList res; - for ( QMap::ConstIterator iter = map.begin(); iter != map.end(); ++iter ) - res.append( iter.key() ); - - return res; + return map.keys(); } /*! @@ -2130,20 +2153,24 @@ QStringList QtxResourceMgr::parameters( const QString& sec ) const #endif PMap pmap; - ResList::ConstIterator it = myResources.end(); - while ( it != myResources.begin() ) + Resources* ur = !myResources.isEmpty() && workingMode() == IgnoreUserValues ? myResources[0] : 0; + + QListIterator it( myResources ); + it.toBack(); + while ( it.hasPrevious() ) { - --it; - QStringList lst = (*it)->parameters( sec ); + Resources* r = it.previous(); + if ( r == ur ) break; + QStringList lst = r->parameters( sec ); for ( QStringList::ConstIterator itr = lst.begin(); itr != lst.end(); ++itr ) +#if defined(QTX_NO_INDEXED_MAP) + if ( !pmap.contains( *itr ) ) pmap.insert( *itr, 0 ); +#else pmap.insert( *itr, 0, false ); +#endif } - QStringList res; - for ( PMap::ConstIterator iter = pmap.begin(); iter != pmap.end(); ++iter ) - res.append( iter.key() ); - - return res; + return pmap.keys(); } /*! @@ -2163,7 +2190,12 @@ QStringList QtxResourceMgr::parameters( const QString& sec ) const QString QtxResourceMgr::path( const QString& sect, const QString& prefix, const QString& name ) const { QString res; - for ( ResList::ConstIterator it = myResources.begin(); it != myResources.end() && res.isEmpty(); ++it ) + + ResList::ConstIterator it = myResources.begin(); + if ( myHasUserValues && workingMode() == IgnoreUserValues ) + ++it; + + for ( ; it != myResources.end() && res.isEmpty(); ++it ) res = (*it)->path( sect, prefix, name ); return res; } @@ -2276,39 +2308,18 @@ QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, initialize(); QPixmap pix; - for ( ResList::ConstIterator it = myResources.begin(); it != myResources.end() && pix.isNull(); ++it ) + + ResList::ConstIterator it = myResources.begin(); + if ( myHasUserValues && workingMode() == IgnoreUserValues ) + ++it; + + for ( ; it != myResources.end() && pix.isNull(); ++it ) pix = (*it)->loadPixmap( resSection(), prefix, name ); if ( pix.isNull() ) pix = defPix; return pix; } -/*! - \brief Load translation files according to the specified language. - - Names of the translation files are calculated according to the pattern specified - by the "translators" option (this option is read from the section "language" of resources files). - By default, "%P_msg_%L.qm" pattern is used. - Keywords \%A, \%P, \%L in the pattern are substituted by the application name, prefix and language name - correspondingly. - For example, for prefix "SUIT" an language "en", all translation files "SUIT_msg_en.qm" are searched and - loaded. - - If prefix is empty or null string, all translation files specified in the "resources" section of resources - files are loaded (actually, the section is retrieved from resSection() method). - If language is not specified, it is retrieved from the langSection() method, and if the latest is also empty, - by default "en" (English) language is used. - - \param pref parameter which defines translation context (for example, package name) - \param l language name - - \sa resSection(), langSection(), loadTranslators() -*/ -void QtxResourceMgr::loadLanguage( const QString& pref, const QString& l ) -{ - loadLanguage( true, pref, l ); -} - /*! \brief Load translation files according to the specified language. @@ -2327,15 +2338,14 @@ void QtxResourceMgr::loadLanguage( const QString& pref, const QString& l ) By default, settings from the user preferences file are also loaded (if user resource file is valid, see userFileName()). To avoid loading user settings, pass \c false as first parameter. - \param loadUser if \c true then user settings are also loaded \param pref parameter which defines translation context (for example, package name) \param l language name \sa resSection(), langSection(), loadTranslators() */ -void QtxResourceMgr::loadLanguage( const bool loadUser, const QString& pref, const QString& l ) +void QtxResourceMgr::loadLanguage( const QString& pref, const QString& l ) { - initialize( true, loadUser ); + initialize( true ); QMap substMap; substMap.insert( 'A', appName() ); @@ -2402,7 +2412,12 @@ void QtxResourceMgr::loadTranslators( const QString& prefix, const QStringList& initialize(); ResList lst; - for ( ResList::Iterator iter = myResources.begin(); iter != myResources.end(); ++iter ) + + ResList::ConstIterator iter = myResources.begin(); + if ( myHasUserValues && workingMode() == IgnoreUserValues ) + ++iter; + + for ( ; iter != myResources.end(); ++iter ) lst.prepend( *iter ); QTranslator* trans = 0; @@ -2434,11 +2449,16 @@ void QtxResourceMgr::loadTranslator( const QString& prefix, const QString& name QTranslator* trans = 0; - ResList::ConstIterator it = myResources.end(); - while ( it != myResources.begin() ) + Resources* ur = !myResources.isEmpty() && workingMode() == IgnoreUserValues ? myResources[0] : 0; + + QListIterator it( myResources ); + it.toBack(); + while ( it.hasPrevious() ) { - --it; - trans = (*it)->loadTranslator( resSection(), prefix, name ); + Resources* r = it.previous(); + if ( r == ur ) break; + + trans = r->loadTranslator( resSection(), prefix, name ); if ( trans ) { if ( !myTranslator[prefix].contains( trans ) ) @@ -2524,7 +2544,7 @@ void QtxResourceMgr::setResource( const QString& sect, const QString& name, cons { initialize(); - if ( !myResources.isEmpty() ) + if ( !myResources.isEmpty() && myHasUserValues ) myResources.first()->setValue( sect, name, val ); } diff --git a/src/Qtx/QtxResourceMgr.h b/src/Qtx/QtxResourceMgr.h index 550c14e30..78e8048fb 100644 --- a/src/Qtx/QtxResourceMgr.h +++ b/src/Qtx/QtxResourceMgr.h @@ -60,6 +60,12 @@ public: typedef IMap Section; //!< resource section #endif + //! Working mode; defines a way how resource manager handles user preferences + typedef enum { + AllowUserValues, //!< User values are processed by the resource manager + IgnoreUserValues //!< User values are ignored by the resource manager + } WorkingMode; + public: QtxResourceMgr( const QString&, const QString& = QString() ); virtual ~QtxResourceMgr(); @@ -75,8 +81,8 @@ public: void clear(); - void setIgnoreUserValues( const bool = true ); - bool ignoreUserValues() const; + WorkingMode workingMode() const; + void setWorkingMode( WorkingMode ); bool value( const QString&, const QString&, int& ) const; bool value( const QString&, const QString&, double& ) const; @@ -138,7 +144,6 @@ public: QPixmap loadPixmap( const QString&, const QString&, const bool ) const; QPixmap loadPixmap( const QString&, const QString&, const QPixmap& ) const; void loadLanguage( const QString& = QString(), const QString& = QString() ); - void loadLanguage( const bool, const QString& = QString(), const QString& = QString() ); void raiseTranslators( const QString& ); void removeTranslators( const QString& ); @@ -164,7 +169,7 @@ protected: virtual QString globalFileName( const QString& ) const; private: - void initialize( const bool = true, const bool = true ) const; + void initialize( const bool = true ) const; QString substMacro( const QString&, const QMap& ) const; private: @@ -185,7 +190,8 @@ private: QPixmap* myDefaultPix; //!< default icon bool myIsPixmapCached; //!< "cached pixmaps" flag - bool myIsIgnoreUserValues; //!< "ignore user values" flag + bool myHasUserValues; //!< \c true if user preferences has been read + WorkingMode myWorkingMode; //!< working mode friend class QtxResourceMgr::Format; }; diff --git a/src/Qtx/QtxRubberBand.h b/src/Qtx/QtxRubberBand.h index e16426167..7e88d6445 100755 --- a/src/Qtx/QtxRubberBand.h +++ b/src/Qtx/QtxRubberBand.h @@ -27,8 +27,10 @@ #include -class QTX_EXPORT QtxAbstractRubberBand: public QWidget +class QTX_EXPORT QtxAbstractRubberBand : public QWidget { + Q_OBJECT + protected: QtxAbstractRubberBand( QWidget* ); @@ -57,8 +59,9 @@ protected: class QTX_EXPORT QtxRectRubberBand: public QtxAbstractRubberBand { -public: + Q_OBJECT +public: QtxRectRubberBand( QWidget* ); virtual ~QtxRectRubberBand(); @@ -71,8 +74,9 @@ public: class QTX_EXPORT QtxPolyRubberBand: public QtxAbstractRubberBand { -public: + Q_OBJECT +public: QtxPolyRubberBand( QWidget* ); virtual ~QtxPolyRubberBand(); diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index 6cf3ca533..001aaf17d 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -112,8 +112,9 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e ) else if ( qVariantCanConvert( iconData ) ) icon = qVariantValue( iconData ); } - if ( ( !lab.isEmpty() || !icon.isNull() ) && - appropriate.isValid() ? appropriate.toBool() : true ) { + if( ( !lab.isEmpty() || !icon.isNull() ) && + appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true ) + { QAction* a = menu.addAction( icon, lab ); a->setCheckable( true ); a->setChecked( !isSectionHidden( i ) ); @@ -153,6 +154,7 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e ) e->accept(); } + /*! \class QtxTreeView \brief Tree view class with possibility to display columns popup menu. @@ -371,3 +373,24 @@ void QtxTreeView::emitSortingEnabled( bool enabled ) { emit( sortingEnabled( enabled ) ); } + +void QtxTreeView::setModel( QAbstractItemModel* m ) +{ + if( model() ) + disconnect( model(), SIGNAL( headerDataChanged( Qt::Orientation, int, int ) ), + this, SLOT( onAppropriate( Qt::Orientation, int, int ) ) ); + QTreeView::setModel( m ); + if ( model() ) + connect( model(), SIGNAL( headerDataChanged( 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 ); + } +} diff --git a/src/Qtx/QtxTreeView.h b/src/Qtx/QtxTreeView.h index f02eaf65c..e8e7b090c 100644 --- a/src/Qtx/QtxTreeView.h +++ b/src/Qtx/QtxTreeView.h @@ -53,10 +53,13 @@ public: void resizeColumnToEncloseContents( int ); + virtual void setModel( QAbstractItemModel* ); + protected slots: void onHeaderClicked( int ); void rowsAboutToBeRemoved( const QModelIndex&, int, int ); void selectionChanged( const QItemSelection&, const QItemSelection& ); + void onAppropriate( Qt::Orientation, int, int ); protected: void setOpened( const QModelIndex&, const int, bool ); diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 3eef2bace..a4bde05a2 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -1050,6 +1050,8 @@ void QtxWorkstackArea::updateState() QResizeEvent re( myBar->size(), myBar->size() ); QApplication::sendEvent( myBar, &re ); + myBar->updateGeometry(); + if ( isEmpty() ) { hide(); diff --git a/src/QxGraph/QxGraph_Prs.h b/src/QxGraph/QxGraph_Prs.h index 161610314..f93cea445 100644 --- a/src/QxGraph/QxGraph_Prs.h +++ b/src/QxGraph/QxGraph_Prs.h @@ -19,7 +19,7 @@ #ifndef QXGRAPH_PRS_H #define QXGRAPH_PRS_H -#include +#include "QxGraph.h" #include #include diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am index 3764ddddc..318e073a1 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am @@ -59,7 +59,7 @@ nodist_libSalomePyQtGUI_la_SOURCES = $(MOC_FILES) $(SIP_SRC) libSalomePyQtGUI_la_CPPFLAGS = $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ $(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -DCALL_OLD_METHODS \ - -I$(srcdir)/../../PyInterp -I$(srcdir)/../../SalomeApp \ + -I@builddir@ -I$(srcdir)/../../PyInterp -I$(srcdir)/../../SalomeApp \ -I$(srcdir)/../../SUIT -I$(srcdir)/../../Qtx -I$(srcdir)/../../LightApp \ -I$(srcdir)/../../Plot2d -I$(srcdir)/../../OCCViewer \ -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../CAM -I$(srcdir)/../../STD \ diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 4560fecc1..39309e17d 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -1596,7 +1596,13 @@ QAction* SALOME_PYQT_Module::separator() */ QAction* SALOME_PYQT_Module::action( const int id ) const { - return SalomeApp_Module::action( id ); + QAction* a = SalomeApp_Module::action( id ); + if ( !a ) { + // try menu + QMenu* m = menuMgr()->findMenu( id ); + if ( m ) a = m->menuAction(); + } + return a; } /*! diff --git a/src/SALOME_PYQT/SalomePyQt/Makefile.am b/src/SALOME_PYQT/SalomePyQt/Makefile.am index 9b1e6328c..67addf653 100644 --- a/src/SALOME_PYQT/SalomePyQt/Makefile.am +++ b/src/SALOME_PYQT/SalomePyQt/Makefile.am @@ -47,7 +47,7 @@ MOC_FILES = SalomePyQt_moc.cxx COMMON_CPP_FLAGS = $(QT_INCLUDES) $(QWT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ $(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -I$(top_builddir)/salomeadn/unix \ - -I$(top_builddir)/idl \ + -I$(srcdir) -I$(top_builddir)/idl \ -I$(srcdir)/../../SUIT -I$(srcdir)/../../CAM -I$(srcdir)/../../STD \ -I$(srcdir)/../../Qtx -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../Event \ -I$(srcdir)/../../SalomeSession -I$(srcdir)/../../LogWindow \ diff --git a/src/SALOME_SWIG/Makefile.am b/src/SALOME_SWIG/Makefile.am index 3d6c4878d..c708bca94 100755 --- a/src/SALOME_SWIG/Makefile.am +++ b/src/SALOME_SWIG/Makefile.am @@ -62,7 +62,7 @@ salomeinclude_HEADERS = $(SWIG_SOURCES) SALOMEGUI_Swig.hxx SALOMEGUI_Swig.i _libSALOME_Swig_la_CPPFLAGS = \ $(QT_INCLUDES) $(QWT_INCLUDES) $(PYTHON_INCLUDES) $(CAS_CPPFLAGS) $(VTK_INCLUDES) \ $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ \ - -I$(top_builddir)/salome_adm/unix -I$(top_builddir)/idl \ + -I$(top_builddir)/salome_adm/unix -I$(top_builddir)/idl -I$(srcdir) \ -I$(srcdir)/../SalomeApp -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT \ -I$(srcdir)/../ObjBrowser -I$(srcdir)/../LightApp -I$(srcdir)/../SOCC \ -I$(srcdir)/../SVTK -I$(srcdir)/../Event -I$(srcdir)/../OBJECT \ diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index 993e6bab0..29113385e 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -29,7 +29,8 @@ #include "SUIT_Application.h" #include "SUIT_ViewManager.h" -//#include "utilities.h" +#include "SALOME_ListIO.hxx" + #include #include #include @@ -375,3 +376,29 @@ SUIT_ViewWindow* SPlot2d_Viewer::createView( SUIT_Desktop* theDesktop ) aPlot2dView->getViewFrame()->Display(getPrs()); return aPlot2dView; } + +/*! + SLOT: called when action "Legend Clicked" is activated. + override "onLegendClicked" method from Plot2d_ViewModel. +*/ +void SPlot2d_Viewer::onLegendClicked( QwtPlotItem* plotItem ) +{ + Plot2d_ViewFrame* aViewFrame = getActiveViewFrame(); + if(aViewFrame == NULL) return; + + CurveDict aCurves = aViewFrame->getCurves(); + SPlot2d_Curve* aSCurve; + CurveDict::Iterator it = aCurves.begin(); + for( ; it != aCurves.end(); ++it ) + { + if ( it.key() == plotItem ) { + aSCurve = dynamic_cast( it.value() ); + break; + } + } + // Highlight curve in Object Browser + if(aSCurve && aSCurve->hasIO()) { + QString anEntry = aSCurve->getIO()->getEntry(); + emit legendSelected( anEntry ); + } +} diff --git a/src/SPlot2d/SPlot2d_ViewModel.h b/src/SPlot2d/SPlot2d_ViewModel.h index f12a8d601..b6b3747fe 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.h +++ b/src/SPlot2d/SPlot2d_ViewModel.h @@ -75,6 +75,12 @@ public: SPlot2d_Curve* getCurveByIO( const Handle(SALOME_InteractiveObject)&, Plot2d_ViewFrame* = 0 ); Plot2d_ViewFrame* getActiveViewFrame(); Handle(SALOME_InteractiveObject) FindIObject( const char* Entry ); + +protected slots: + virtual void onLegendClicked( QwtPlotItem* plotItem ); + +signals: + void legendSelected( const QString& ); }; diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 8af1e6246..9f8d9fb4f 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -275,8 +275,9 @@ bool STD_Application::onNewDoc( const QString& name ) studyCreated( activeStudy() ); else { - delete activeStudy(); + SUIT_Study* st = activeStudy(); setActiveStudy( 0 ); + delete st; } } else diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index 77f2ed646..96e295240 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -49,9 +49,12 @@ class STD_EXPORT STD_Application : public SUIT_Application Q_OBJECT public: - enum { FileNewId, FileOpenId, FileCloseId, FileSaveId, FileSaveAsId, FileExitId, - ViewWindowsId, ViewToolBarsId, ViewStatusBarId, NewWindowId, - EditCutId, EditCopyId, EditPasteId, HelpAboutId, UserID }; + enum { MenuFileId, FileNewId, FileOpenId, FileCloseId, FileSaveId, FileSaveAsId, FileExitId, + MenuViewId, ViewWindowsId, ViewToolBarsId, ViewStatusBarId, NewWindowId, + MenuEditId, EditCutId, EditCopyId, EditPasteId, + MenuHelpId, HelpAboutId, + UserID + }; public: STD_Application(); @@ -94,6 +97,8 @@ public: bool exitConfirmation() const; void setExitConfirmation( const bool ); + virtual void updateDesktopTitle(); + signals: /*!emit that view manager added*/ void viewManagerAdded( SUIT_ViewManager* ); @@ -129,18 +134,11 @@ private slots: virtual void onViewManagerActivated( SUIT_ViewManager* ); protected: - enum { MenuFileId = 1, - MenuViewId = 2, - MenuEditId = 3, - MenuHelpId = 7 - }; - enum { OpenCancel, OpenNew, OpenExist }; enum { CloseCancel, CloseSave, CloseDiscard }; protected: virtual void createActions(); - virtual void updateDesktopTitle(); virtual void updateCommandsStatus(); virtual void setDesktop( SUIT_Desktop* ); diff --git a/src/SUIT/Makefile.am b/src/SUIT/Makefile.am index 0e3d53627..253d9e53a 100755 --- a/src/SUIT/Makefile.am +++ b/src/SUIT/Makefile.am @@ -119,9 +119,7 @@ nodist_salomeres_DATA = \ libsuit_la_CPPFLAGS = $(QT_INCLUDES) -I$(srcdir)/../Qtx -I$(srcdir)/../ObjBrowser if ENABLE_TESTRECORDER - libsuit_la_CPPFLAGS+= $(TESTRECORDER_INCLUDES) -else !ENABLE_TESTRECORDER - libsuit_la_CPPFLAGS+= -DDISABLE_TESTRECORDER + libsuit_la_CPPFLAGS+= -DENABLE_TESTRECORDER $(TESTRECORDER_INCLUDES) endif libsuit_la_LDFLAGS = $(QT_MT_LIBS) diff --git a/src/SUIT/SUIT_ActionOperation.cxx b/src/SUIT/SUIT_ActionOperation.cxx index 85d96b221..c949bad6d 100644 --- a/src/SUIT/SUIT_ActionOperation.cxx +++ b/src/SUIT/SUIT_ActionOperation.cxx @@ -76,7 +76,7 @@ void SUIT_ActionOperation::setAction( QtxAction* a ) myAction = a; myAction->setEnabled( application()->activeStudy() ); - connect( myAction, SIGNAL( activated() ), SLOT( start() ) ); + connect( myAction, SIGNAL( triggered() ), SLOT( start() ) ); } /*! Add action to widget \a wid. diff --git a/src/SUIT/SUIT_DataBrowser.cxx b/src/SUIT/SUIT_DataBrowser.cxx index 1f9e4d042..e9ee49087 100644 --- a/src/SUIT/SUIT_DataBrowser.cxx +++ b/src/SUIT/SUIT_DataBrowser.cxx @@ -21,7 +21,7 @@ // #include "SUIT_DataBrowser.h" -#include +#include "SUIT_TreeModel.h" #include #include @@ -308,6 +308,8 @@ void SUIT_DataBrowser::init( SUIT_DataObject* root ) setItemDelegate( qobject_cast( model() )->delegate() ); connect( treeView(), SIGNAL( sortingEnabled( bool ) ), model(), SLOT( setSortingEnabled( bool ) ) ); + connect( treeView(), SIGNAL( clicked( const QModelIndex& ) ), + this, SLOT( onClicked( const QModelIndex& ) ) ); connect( treeView(), SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( onDblClicked( const QModelIndex& ) ) ); connect( treeView(), SIGNAL( expanded( const QModelIndex& ) ), @@ -330,6 +332,16 @@ void SUIT_DataBrowser::init( SUIT_DataObject* root ) \sa updateKey(), setUpdateKey() */ +/*! + \fn void SUIT_DataBrowser::clicked( SUIT_DataObject* o ); + \brief This signal is emitted when a mouse button is clicked. + + The data object the mouse was clicked on is specified by \a o. + The signal is only emitted when the object is valid. + + \param o data object which is clicked +*/ + /*! \fn void SUIT_DataBrowser::doubleClicked( SUIT_DataObject* o ); \brief This signal is emitted when a mouse button is double-clicked. @@ -348,6 +360,22 @@ void SUIT_DataBrowser::onModelUpdated() setModified(); } +/*! + \brief Called when item is clicked in the tree view + \internal + + Emits signal clicked( SUIT_DataObject* ); +*/ +void SUIT_DataBrowser::onClicked( const QModelIndex& index ) +{ + SUIT_ProxyModel* m = qobject_cast( model() ); + + if ( m ) { + SUIT_DataObject* obj = m->object( index ); + if ( obj ) emit( clicked( obj ) ); + } +} + /*! \brief Called when item is double-clicked in the tree view \internal diff --git a/src/SUIT/SUIT_DataBrowser.h b/src/SUIT/SUIT_DataBrowser.h index 9ab076bb3..77d423f1d 100644 --- a/src/SUIT/SUIT_DataBrowser.h +++ b/src/SUIT/SUIT_DataBrowser.h @@ -72,10 +72,12 @@ private: signals: void requestUpdate(); + void clicked( SUIT_DataObject* ); void doubleClicked( SUIT_DataObject* ); private slots: void onModelUpdated(); + void onClicked( const QModelIndex& ); void onDblClicked( const QModelIndex& ); void onExpanded( const QModelIndex& ); diff --git a/src/SUIT/SUIT_DataObject.cxx b/src/SUIT/SUIT_DataObject.cxx index 26c27a429..98b323b3a 100755 --- a/src/SUIT/SUIT_DataObject.cxx +++ b/src/SUIT/SUIT_DataObject.cxx @@ -112,64 +112,6 @@ SUIT_DataObject* SUIT_DataObject::lastChild() const return child; } -/*! - \brief Get the number of the columns provided by the data tree. - - This method can be re-implemented in the subclasses. - Default implementation returns 1 ("Name" column) only. - - \return number of the columns -*/ -int SUIT_DataObject::columnCount() const -{ - return 1; // one column ("Name") is provided by default -} - -/*! - \brief Get column title. - - This method can be re-implemented in the subclasses. - Default implementation returns the title for the first column ("Name") only. - - \param index column index - \return title of the specified column -*/ -QString SUIT_DataObject::columnTitle( const int index ) const -{ - if ( index == NameIdx ) - return QObject::tr( "NAME_COLUMN" ); // one column ("Name") is provided by default - return QString(); -} - -/*! - \brief Get column icon. - - This method can be re-implemented in the subclasses. - Default implementation returns null pixmap. - - \param index column index - \return icon of the specified column -*/ -QPixmap SUIT_DataObject::columnIcon( const int /*index*/ ) const -{ - return QPixmap(); -} - -/*! - \brief Check if the column should appear in the tree view header popup menu - (to show/hide the column). - - Default implementation returns \c false because 'Name' column should be - always visible. - - \param index column index - \return \c true if the column can be shown/hidden -*/ -bool SUIT_DataObject::appropriate( const int /*index*/ ) const -{ - return false; -} - /*! \brief Get the number of the child objects. \return number of the children @@ -448,15 +390,15 @@ QString SUIT_DataObject::name() const This method can be re-implemented in the subclasses. Default implementation returns null string. - Column with \a index = 0 (NameIdx) is supposed to be used + Column with \a id = 0 (NameId) is supposed to be used to get the object name (as it does the default implementation). - \param index column index + \param id column id \return object text data */ -QString SUIT_DataObject::text( const int index ) const +QString SUIT_DataObject::text( const int id ) const { - return index == NameIdx ? name() : QString(); + return id == NameId ? name() : QString(); } /*! @@ -465,13 +407,12 @@ QString SUIT_DataObject::text( const int index ) const This method can be re-implemented in the subclasses. Default implementation returns null pixmap. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator - \param index column index + \param id column id \return object icon for the specified column */ -QPixmap SUIT_DataObject::icon( const int /*index*/ ) const +QPixmap SUIT_DataObject::icon( const int /*id*/ ) const { return QPixmap(); } @@ -482,14 +423,13 @@ QPixmap SUIT_DataObject::icon( const int /*index*/ ) const This method can be re-implemented in the subclasses. Default implementation returns null color. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator \param role color role - \param index column index + \param id column id \return object color for the specified column */ -QColor SUIT_DataObject::color( const ColorRole /*role*/, const int /*index*/ ) const +QColor SUIT_DataObject::color( const ColorRole /*role*/, const int /*id*/ ) const { return QColor(); } @@ -500,13 +440,13 @@ QColor SUIT_DataObject::color( const ColorRole /*role*/, const int /*index*/ ) c This method can be re-implemented in the subclasses. Default implementation returns null string. - The parameter \a index specifies the column number + The parameter \a id specifies the column identificator (to display, for example, in the tree view widget). - \param index column index + \param id column id \return object tooltip for the specified column */ -QString SUIT_DataObject::toolTip( const int /*index*/ ) const +QString SUIT_DataObject::toolTip( const int /*id*/ ) const { return QString(); } @@ -517,13 +457,12 @@ QString SUIT_DataObject::toolTip( const int /*index*/ ) const This method can be re-implemented in the subclasses. Default implementation returns null string. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator - \param index column index + \param id column id \return object status tip for the specified column */ -QString SUIT_DataObject::statusTip( const int /*index*/ ) const +QString SUIT_DataObject::statusTip( const int /*id*/ ) const { return QString(); } @@ -535,13 +474,12 @@ QString SUIT_DataObject::statusTip( const int /*index*/ ) const This method can be re-implemented in the subclasses. Default implementation returns null string. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator - \param index column index + \param id column id \return object "what's this" information for the specified column */ -QString SUIT_DataObject::whatsThis( const int /*index*/ ) const +QString SUIT_DataObject::whatsThis( const int /*id*/ ) const { return QString(); } @@ -552,13 +490,12 @@ QString SUIT_DataObject::whatsThis( const int /*index*/ ) const This method can be re-implemented in the subclasses. Default implementation returns application default font. - The parameter \a index specifies the column number - (to display, for example, in the tree view widget). + The parameter \a id specifies the column identificator - \param index column index + \param id column id \return object font for the specified column */ -QFont SUIT_DataObject::font( const int /*index*/ ) const +QFont SUIT_DataObject::font( const int /*id*/ ) const { return QFont(); } @@ -570,13 +507,13 @@ QFont SUIT_DataObject::font( const int /*index*/ ) const Default implementation returns default alignment which is Qt:AlignLeft. - The parameter \a index specifies the column number + The parameter \a id specifies the column identificator (to display, for example, in the tree view widget). - \param index column index + \param id column id \return object text alignment flags for the specified column */ -int SUIT_DataObject::alignment( const int /*index*/ ) const +int SUIT_DataObject::alignment( const int /*id*/ ) const { return Qt::AlignLeft; } @@ -642,11 +579,11 @@ bool SUIT_DataObject::isSelectable() const This method can be re-implemented in the subclasses. Default implementation returns \c false (all objects are not checkable). - \param index column index + \param id column id \return \c true if the item can be checked or unchecked by the user \sa isOn(), setOn() */ -bool SUIT_DataObject::isCheckable( const int /*index*/ ) const +bool SUIT_DataObject::isCheckable( const int /*id*/ ) const { return false; } @@ -658,13 +595,13 @@ bool SUIT_DataObject::isCheckable( const int /*index*/ ) const Default implementation supports the checked state for the first ("Name") column only. - \param index column index + \param id column id \return checked state of the object for the specified column \sa setOn(), isCheckable() */ -bool SUIT_DataObject::isOn( const int index ) const +bool SUIT_DataObject::isOn( const int id ) const { - return index == NameIdx && myCheck; + return id == NameId && myCheck; } /*! @@ -675,12 +612,12 @@ bool SUIT_DataObject::isOn( const int index ) const ("Name") column only. \param on new checked state of the object for the specified column - \param index column index + \param id column id \sa isOn(), isCheckable() */ -void SUIT_DataObject::setOn( const bool on, const int index ) +void SUIT_DataObject::setOn( const bool on, const int id ) { - if ( index == NameIdx ) + if( id == NameId ) myCheck = on; } @@ -711,11 +648,11 @@ void SUIT_DataObject::setOpen( const bool on ) Default implementation returns false ("Name" column does not require custom sorting). - \param index column index + \param id column id \return \c true if column sorting should be customized \sa compare() */ -bool SUIT_DataObject::customSorting( const int /*index*/ ) const +bool SUIT_DataObject::customSorting( const int /*id*/ ) const { return false; } @@ -732,12 +669,12 @@ bool SUIT_DataObject::customSorting( const int /*index*/ ) const \param left first data to compare \param right second data to compare - \param index column index + \param id column id \return result of the comparison \sa customSorting() */ bool SUIT_DataObject::compare( const QVariant& /*left*/, const QVariant& /*right*/, - const int /*index*/ ) const + const int /*id*/ ) const { return false; } @@ -941,6 +878,21 @@ void SUIT_DataObject::update() { } +/*! + \brief return unique group identificator + + Groups of data objects are used for column information search. + Each column of data model has one or several registered group id + If object has the same group id as one of registered, the information + will be shown; the custom id of column will be passed into data() method + in order to identify column from point of view of data object + + */ +int SUIT_DataObject::groupId() const +{ + return 0; +} + /*! \fn void SUIT_DataObject::Signal::created( SUIT_DataObject* object ); \brief Emitted when data object is created. diff --git a/src/SUIT/SUIT_DataObject.h b/src/SUIT/SUIT_DataObject.h index 40916cf03..03798ea8e 100755 --- a/src/SUIT/SUIT_DataObject.h +++ b/src/SUIT/SUIT_DataObject.h @@ -55,9 +55,10 @@ public: HighlightedText //!< highlighted foreground (text) color } ColorRole; - //! Column index - enum { - NameIdx //!< name column + //! Column id + enum + { + NameId //!< name column }; SUIT_DataObject( SUIT_DataObject* = 0 ); @@ -67,11 +68,6 @@ public: SUIT_DataObject* lastChild() const; SUIT_DataObject* firstChild() const; - virtual int columnCount() const; - virtual QString columnTitle( const int = NameIdx ) const; - virtual QPixmap columnIcon( const int = NameIdx ) const; - virtual bool appropriate( const int = NameIdx ) const; - int childCount() const; int childPos( const SUIT_DataObject* ) const; SUIT_DataObject* childObject( const int ) const; @@ -98,34 +94,34 @@ public: virtual void setParent( SUIT_DataObject* ); virtual QString name() const; - virtual QString text( const int = NameIdx ) const; - virtual QPixmap icon( const int = NameIdx ) const; - virtual QColor color( const ColorRole, const int = NameIdx ) const; - virtual QString toolTip( const int = NameIdx ) const; - virtual QString statusTip( const int = NameIdx ) const; - virtual QString whatsThis( const int = NameIdx ) const; - virtual QFont font( const int = NameIdx ) const; - virtual int alignment( const int = NameIdx ) const; + virtual QString text( const int = NameId ) const; + virtual QPixmap icon( const int = NameId ) const; + virtual QColor color( const ColorRole, const int = NameId ) const; + virtual QString toolTip( const int = NameId ) const; + virtual QString statusTip( const int = NameId ) const; + virtual QString whatsThis( const int = NameId ) const; + virtual QFont font( const int = NameId ) const; + virtual int alignment( const int = NameId ) const; virtual bool isDragable() const; virtual bool isDropAccepted( SUIT_DataObject* obj ); virtual bool isEnabled() const; virtual bool isSelectable() const; - virtual bool isCheckable( const int = NameIdx ) const; + virtual bool isCheckable( const int = NameId ) const; - virtual bool isOn( const int = NameIdx ) const; - virtual void setOn( const bool, const int = NameIdx ); + virtual bool isOn( const int = NameId ) const; + virtual void setOn( const bool, const int = NameId ); virtual bool isOpen() const; virtual void setOpen( const bool ); virtual void update(); - virtual bool customSorting( const int = NameIdx ) const; - virtual bool compare( const QVariant&, const QVariant&, - const int = NameIdx ) const; + virtual bool customSorting( const int = NameId ) const; + virtual bool compare( const QVariant&, const QVariant&, const int = NameId ) const; virtual SUIT_DataObjectKey* key() const; + virtual int groupId() const; static Signal* signal(); static bool connect( const char*, QObject*, const char* ); diff --git a/src/SUIT/SUIT_ExceptionHandler.cxx b/src/SUIT/SUIT_ExceptionHandler.cxx index babe67e69..cee4dcb51 100755 --- a/src/SUIT/SUIT_ExceptionHandler.cxx +++ b/src/SUIT/SUIT_ExceptionHandler.cxx @@ -20,7 +20,7 @@ #include "SUIT_MessageBox.h" -#ifndef DISABLE_TESTRECORDER +#ifdef ENABLE_TESTRECORDER #include #endif @@ -43,7 +43,7 @@ bool SUIT_ExceptionHandler::handle( QObject* o, QEvent* e ) */ bool SUIT_ExceptionHandler::internalHandle( QObject* o, QEvent* e ) { -#ifndef DISABLE_TESTRECORDER +#ifdef ENABLE_TESTRECORDER TestApplication* aTApp = qobject_cast(qApp); return aTApp ? aTApp->TestApplication::notify( o, e ) : false; #else diff --git a/src/SUIT/SUIT_LicenseDlg.cxx b/src/SUIT/SUIT_LicenseDlg.cxx index 4faafba13..c33c34f70 100755 --- a/src/SUIT/SUIT_LicenseDlg.cxx +++ b/src/SUIT/SUIT_LicenseDlg.cxx @@ -165,7 +165,7 @@ void SUIT_LicenseDlg::onPrint() QFont aFooterFont = aBodyFont; // calculate margin - QPaintDevice* aMetrics(aPainter.device()); + QPaintDevice* aMetrics = aPainter.device(); int aDpiY = aMetrics->logicalDpiY(); int aMargin = (int) ( (2/2.54)*aDpiY ); // 2 cm margins diff --git a/src/SUIT/SUIT_Session.h b/src/SUIT/SUIT_Session.h index e6ece73e3..bc3ca3486 100755 --- a/src/SUIT/SUIT_Session.h +++ b/src/SUIT/SUIT_Session.h @@ -20,8 +20,7 @@ #define SUIT_SESSION_H #include "SUIT.h" - -#include +#include "SUIT_Application.h" #include #include diff --git a/src/SUIT/SUIT_Study.cxx b/src/SUIT/SUIT_Study.cxx index fec0b6a4f..ea1262d41 100755 --- a/src/SUIT/SUIT_Study.cxx +++ b/src/SUIT/SUIT_Study.cxx @@ -425,9 +425,12 @@ void SUIT_Study::stop( SUIT_Operation* theOp ) // get last operation which can be resumed SUIT_Operation* aResultOp = 0; - for ( Operations::iterator it = myOperations.end(); it != myOperations.begin(); --it ) + + QListIterator it (myOperations); + it.toBack(); + while( it.hasPrevious() ) { - SUIT_Operation* anOp = *it; + SUIT_Operation* anOp = it.previous(); if ( anOp && anOp != theOp && blockingOperation( anOp ) == 0 ) { aResultOp = anOp; diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index 4128bd7fe..603d9d9f5 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -23,6 +23,7 @@ #include #include +#include class SUIT_DataObject; class SUIT_Application; diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index b58523931..716a7dd2a 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -25,6 +25,31 @@ #include "SUIT_DataObject.h" #include +#include + +SUIT_AbstractModel::SUIT_AbstractModel() +{ +} + +SUIT_AbstractModel::operator const QAbstractItemModel*() const +{ + return dynamic_cast( this ); +} + +SUIT_AbstractModel::operator QAbstractItemModel*() +{ + return dynamic_cast( this ); +} + +SUIT_AbstractModel::operator const QObject*() const +{ + return dynamic_cast( this ); +} + + + + + /*! \class SUIT_TreeModel::TreeItem @@ -450,6 +475,140 @@ SUIT_TreeModel::~SUIT_TreeModel() delete myRootItem; } +/*! + \brief Register new column in the model + \param group_id - unique data object group identificator + \param name - translated column name + \param custom_id - custom column id that should be passed into method SUIT_DataObject::data() + */ +void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, const int custom_id ) +{ + bool found = false; + for( int i=0, n=myColumns.size(); i