From 174fe4979a7696123091471eead94d59c938a053 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 7 Jun 2005 09:08:12 +0000 Subject: [PATCH] *** empty log message *** --- src/Qtx/QtxPopupMgr.cxx | 119 ++++++++++++++++++++++++++-------------- src/Qtx/QtxPopupMgr.h | 9 ++- 2 files changed, 84 insertions(+), 44 deletions(-) diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index a1f6db885..095660234 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -6,6 +6,74 @@ #include +//================================================================ +// Function : +// Purpose : +//================================================================ +QtxValue QtxPopupMgr::Selection::globalParam( const QString& str ) const +{ + if( str==selCountParam() ) + return count(); + + else if( str[0]==equality() ) + { + QtxSets::ValueSet set; + QString par = str.mid( 1 ); + + for( int i=0, n=count(); iset( *anIt, myCurrentSelection->count() ); - else - p->set( *anIt, 0 ); - } - - else if( (*anIt)[0]==equality() ) - { - QtxSets::ValueSet set; - QString par = ( *anIt ).mid( 1 ); - - if( myCurrentSelection && myCurrentSelection->count() > 0 ) - for( int i=0, n=myCurrentSelection->count(); iparam( i, par ) ); - - p->set( *anIt, set ); - } - else - specific.append( *anIt ); + { + QtxValue v = myCurrentSelection->globalParam( *anIt ); + if( v.isValid() ) + p->set( *anIt, v ); + else + specific.append( *anIt ); + } } //================================================================ @@ -374,7 +427,7 @@ bool QtxPopupMgr::isVisible( const int actId, const int place ) const //================================================================ void QtxPopupMgr::updatePopup( QPopupMenu* p, Selection* sel ) { - if( !p ) + if( !p || !sel ) return; myCurrentSelection = sel; @@ -398,24 +451,6 @@ QtxPopupMgr::RulesMap& QtxPopupMgr::map( bool visibility ) const return ( RulesMap& )( visibility ? myVisibility : myToggle ); } -//================================================================ -// Function : -// Purpose : -//================================================================ -QString QtxPopupMgr::selCountParam() const -{ - return "selcount"; -} - -//================================================================ -// Function : -// Purpose : -//================================================================ -QChar QtxPopupMgr::equality() const -{ - return '$'; -} - //================================================================ // Function : // Purpose : diff --git a/src/Qtx/QtxPopupMgr.h b/src/Qtx/QtxPopupMgr.h index 351059861..8664535f6 100644 --- a/src/Qtx/QtxPopupMgr.h +++ b/src/Qtx/QtxPopupMgr.h @@ -25,6 +25,13 @@ public: public: virtual int count() const = 0; virtual QtxValue param( const int, const QString& ) const = 0; + virtual QtxValue globalParam( const QString& ) const; + + virtual QChar equality() const; + virtual QString selCountParam() const; + + static QChar defEquality(); + static QString defSelCountParam(); }; protected: @@ -68,8 +75,6 @@ public: void setRule( const int, const QString&, bool visibility ); void updatePopup( QPopupMenu*, Selection* ); - virtual QChar equality() const; - virtual QString selCountParam() const; //return name of parameter corresponding to selected objects count //it will be set automatically -- 2.39.2