* ./hurricane/src/viewer:
- Change: In Cyclop, now uses the GtkStyle when not under OSX and Qt is newer or equal to Qt 4.5.0. - Change: In the various Qt Model Table, do the rowHeigh bug correction. - Bug: In InspectorWidget/NetlistModel, when browsing through the records tree, the records were generated twice at each slot change. This was due to the History ComboBox sending a index change signal then the InspectorWidget setting the slot *again*. When trying to explore a Slot, but this Slot is empty (like an empty vector, for instance) do not gut the RecordModel. Because as we find out that the new Slot is empty we go back and restore the previous contents. Potentially slow if we comes from a Slot with lots of records. Now we dump the contents only if there is something to explore. * ./hurricane/src/hurricane: - Bug: In Record, the slots where stored in a list container, which was making indexed accesses very very slow. This slowdown was also affecting the destructor of Record (this is the explanation why the RecordWidget was slow, even when *leaving* the net IntrusiveSet). Now implemented in term of STL vector. - Bug: In Slot/Common, still some adjustements to make the Inspection mechanism work with all types. Correct the "IntrusiveMap<>" not working with the NetMap. Related to templates not using the same constness. - Change: In Entity/DBo/Cell, Some more adjustements on Slot/Records.
This commit is contained in:
parent
3f10d44549
commit
53ba314063
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane )
|
||||
set ( includes hurricane/Mask.h
|
||||
hurricane/DebugSession.h
|
||||
|
@ -151,7 +150,6 @@
|
|||
Timer.cpp
|
||||
)
|
||||
|
||||
add_library ( hurricane ${cpps} )
|
||||
install ( TARGETS hurricane DESTINATION /lib)
|
||||
|
||||
install(FILES ${includes} DESTINATION /include/hurricane)
|
||||
add_library ( hurricane ${cpps} )
|
||||
install ( TARGETS hurricane DESTINATION /lib)
|
||||
install ( FILES ${includes} DESTINATION /include/hurricane )
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
// not, see <http://www.gnu.org/licenses/>.
|
||||
// ****************************************************************************************************
|
||||
|
||||
//#define TEST_INTRUSIVESET
|
||||
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Library.h"
|
||||
|
@ -369,7 +371,7 @@ void Cell::_removeSlaveEntity(Entity* entity, Entity* slaveEntity)
|
|||
|
||||
pair<SlaveEntityMap::iterator,SlaveEntityMap::iterator>
|
||||
bounds = _slaveEntityMap.equal_range(entity);
|
||||
multimap<Entity*,Entity*>::iterator it = bounds.first;
|
||||
SlaveEntityMap::iterator it = bounds.first;
|
||||
for(; it != bounds.second ; it++ ) {
|
||||
if (it->second == slaveEntity) {
|
||||
_slaveEntityMap.erase(it);
|
||||
|
|
|
@ -17,12 +17,9 @@
|
|||
// not, see <http://www.gnu.org/licenses/>.
|
||||
// ****************************************************************************************************
|
||||
|
||||
#ifdef HAVE_LIBIBERTY
|
||||
#include "hurricane/demangle.h"
|
||||
#include "hurricane/libiberty.h"
|
||||
#endif
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
#include <cxxabi.h>
|
||||
#include "hurricane/Commons.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -100,26 +97,31 @@ void ltraceout (unsigned int level, unsigned int count )
|
|||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Function : "Demangle ()".
|
||||
// Function : "demangle ()".
|
||||
|
||||
|
||||
#define HAVE_CXA_DEMANGLE
|
||||
|
||||
#ifdef HAVE_CXA_DEMANGLE
|
||||
|
||||
string demangle ( const char* symbol )
|
||||
{
|
||||
string mangled = "_Z";
|
||||
mangled += symbol;
|
||||
|
||||
# ifdef HAVE_LIBIBERTY
|
||||
char* result = cplus_demangle ( mangled.c_str(), DMGL_PARAMS|DMGL_ANSI|DMGL_TYPES );
|
||||
{
|
||||
int status;
|
||||
unsigned int length = 4096;
|
||||
char demangled[length];
|
||||
|
||||
if ( result ) {
|
||||
mangled = result;
|
||||
free ( result );
|
||||
return mangled;
|
||||
}
|
||||
# endif
|
||||
|
||||
return mangled;
|
||||
abi::__cxa_demangle ( symbol, demangled, &length, &status );
|
||||
return demangled;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
string demangle ( const char* symbol )
|
||||
{
|
||||
return symbol;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include "hurricane/DBo.h"
|
||||
#include "hurricane/Property.h"
|
||||
#include "hurricane/DBo.h"
|
||||
#include "hurricane/Quark.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace Hurricane {
|
|||
|
||||
Property* DBo::getProperty ( const Name& name ) const
|
||||
{
|
||||
PropertySet::const_iterator iterator = _propertySet.begin();
|
||||
set<Property*>::const_iterator iterator = _propertySet.begin();
|
||||
while ( iterator != _propertySet.end() ) {
|
||||
Property* property = *iterator;
|
||||
if (property->getName() == name) return property;
|
||||
|
@ -173,7 +173,7 @@ namespace Hurricane {
|
|||
Record* DBo::_getRecord () const
|
||||
{
|
||||
Record* record = new Record ( getString(this) );
|
||||
record->add ( getSlot("Properties", &_propertySet) );
|
||||
record->add ( getSlot("_propertySet", &_propertySet) );
|
||||
return record;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
// ****************************************************************************************************
|
||||
|
||||
#include "hurricane/DRCError.h"
|
||||
#include "hurricane/Cell.h"
|
||||
//#include "hurricane/Cell.h"
|
||||
#include "hurricane/Slice.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Cell;
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// DRCError implementation
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/Timer.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
|
||||
|
@ -87,10 +85,10 @@ Record* DataBase::_getRecord() const
|
|||
{
|
||||
Record* record = Inherit::_getRecord();
|
||||
if (record) {
|
||||
record->add(getSlot("Technology", _technology));
|
||||
record->add(getSlot("RootLibrary", _rootLibrary));
|
||||
record->add(getSlot("Precision", DbU::getPrecision()));
|
||||
record->add(getSlot("Resolution", DbU::db(1)));
|
||||
record->add(getSlot("_technology" , _technology ));
|
||||
record->add(getSlot("_rootLibrary" , _rootLibrary ));
|
||||
record->add(getSlot("DbU::precision" , DbU::getPrecision()));
|
||||
record->add(getSlot("DbU::resolution", DbU::db(1) ));
|
||||
//record->add(getSlot("GridStep", getValueString(getGridStep())));
|
||||
}
|
||||
return record;
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#include "hurricane/DebugSession.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ namespace Hurricane {
|
|||
|
||||
|
||||
Record::Record ( const string& name )
|
||||
: _name(name)
|
||||
, _slotList()
|
||||
: _name (name)
|
||||
, _slots()
|
||||
{
|
||||
_allocateds++;
|
||||
}
|
||||
|
@ -62,11 +62,9 @@ namespace Hurricane {
|
|||
Record::~Record ()
|
||||
{
|
||||
//cerr << "Record::~Record() - " << _name << ": " << hex << (void*)this << dec << endl;
|
||||
while (!_slotList.empty()) {
|
||||
Slot* slot = *_slotList.begin();
|
||||
_slotList.remove(slot);
|
||||
delete slot;
|
||||
}
|
||||
for ( size_t i=0 ; i<_slots.size() ; i++ )
|
||||
delete _slots[i];
|
||||
|
||||
_allocateds--;
|
||||
}
|
||||
|
||||
|
@ -79,9 +77,8 @@ namespace Hurricane {
|
|||
|
||||
Slot* Record::getSlot ( unsigned no ) const
|
||||
{
|
||||
SlotList::const_iterator iterator = _slotList.begin();
|
||||
while (no-- && (iterator != _slotList.end())) ++iterator;
|
||||
return (iterator == _slotList.end()) ? NULL : *iterator;
|
||||
if ( no >= _slots.size() ) return NULL;
|
||||
return _slots[no];
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +88,7 @@ namespace Hurricane {
|
|||
cerr << "[ERROR] Record::add(): Attempt to add NULL Slot." << endl;
|
||||
return;
|
||||
}
|
||||
_slotList.push_back(slot);
|
||||
_slots.push_back(slot);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include "hurricane/Pathes.h"
|
||||
#include "hurricane/Entity.h"
|
||||
#include "hurricane/Cells.h"
|
||||
#include "hurricane/Instance.h"
|
||||
#include "hurricane/DeepNet.h"
|
||||
#include "hurricane/Instance.h"
|
||||
#include "hurricane/Pin.h"
|
||||
#include "hurricane/Pins.h"
|
||||
#include "hurricane/Slices.h"
|
||||
|
@ -38,11 +38,12 @@
|
|||
#include "hurricane/Transformation.h"
|
||||
#include "hurricane/Layer.h"
|
||||
#include "hurricane/QuadTree.h"
|
||||
#include "hurricane/IntrusiveMap.h"
|
||||
//#include "hurricane/IntrusiveMap.h"
|
||||
#include "hurricane/IntrusiveSet.h"
|
||||
#include "hurricane/MapCollection.h"
|
||||
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
class Library;
|
||||
|
@ -168,7 +169,7 @@ class Cell : public Entity {
|
|||
private: bool _isPad;
|
||||
private: Cell* _nextOfLibraryCellMap;
|
||||
private: Cell* _nextOfSymbolCellSet;
|
||||
private: multimap<Entity*,Entity*> _slaveEntityMap;
|
||||
private: SlaveEntityMap _slaveEntityMap;
|
||||
|
||||
// Constructors
|
||||
// ************
|
||||
|
|
|
@ -182,9 +182,10 @@ namespace Hurricane {
|
|||
|
||||
// Forward declaration of "getSlot<>()" template.
|
||||
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( std::string& name, Data d );
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& name, Data d );
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& name, Data* d );
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( std::string& name, Data );
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( std::string& name, Data* );
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& name, Data );
|
||||
template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& name, Data* );
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -193,7 +194,9 @@ template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& nam
|
|||
// Default match.
|
||||
|
||||
template<typename Data> inline std::string getString ( Data data )
|
||||
{ return "<Data type unsupported by getString()>"; }
|
||||
{ return std::string("<type ")
|
||||
+ Hurricane::demangle(typeid(data).name())
|
||||
+ std::string(" unsupported by getString()>"); }
|
||||
|
||||
// "const *" flavors.
|
||||
|
||||
|
@ -278,7 +281,7 @@ template<> inline std::string getString<std::string*> ( std::string* s )
|
|||
template<> inline std::string getString<bool> ( bool b )
|
||||
{ return (b)?"True":"False" ; }
|
||||
|
||||
template<> inline std::string getString<char> ( const char c )
|
||||
template<> inline std::string getString<char> ( char c )
|
||||
{ return std::string(1,c); }
|
||||
|
||||
template<> inline std::string getString<int> ( int i )
|
||||
|
@ -314,7 +317,32 @@ template<typename Data> inline Hurricane::Record* getRecord ( Data data )
|
|||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Inspector Support for : "const std::vector<Element>*".
|
||||
// Inspector Support for : "[const] std::vector<Element>*".
|
||||
|
||||
|
||||
template<typename Element>
|
||||
inline std::string getString ( std::vector<Element>* v )
|
||||
{
|
||||
std::string name = "const std::vector<Element>:";
|
||||
return name + getString<size_t>(v->size());
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
inline Hurricane::Record* getRecord ( std::vector<Element>* v )
|
||||
{
|
||||
Hurricane::Record* record = NULL;
|
||||
if ( !v->empty() ) {
|
||||
record = new Hurricane::Record ( "std::vector<Element>" );
|
||||
unsigned n = 1;
|
||||
typename std::vector<Element>::iterator iterator = v->begin();
|
||||
while ( iterator != v->end() ) {
|
||||
record->add ( getSlot<Element>(getString(n++), *iterator) );
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
template<typename Element>
|
||||
|
@ -334,7 +362,7 @@ inline Hurricane::Record* getRecord ( const std::vector<Element>* v )
|
|||
unsigned n = 1;
|
||||
typename std::vector<Element>::const_iterator iterator = v->begin();
|
||||
while ( iterator != v->end() ) {
|
||||
record->add ( getSlot<Element>(getString(n++), *iterator) );
|
||||
record->add ( getSlot<const Element>(getString(n++), *iterator) );
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +391,7 @@ inline Hurricane::Record* getRecord ( const std::list<Element>* l )
|
|||
unsigned n = 1;
|
||||
typename std::list<Element>::const_iterator iterator = l->begin();
|
||||
while ( iterator != l->end() ) {
|
||||
record->add ( getSlot<Element>(getString(n++), *iterator) );
|
||||
record->add ( getSlot<const Element>(getString(n++), *iterator) );
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
|
@ -401,7 +429,7 @@ inline Hurricane::Record* getRecord ( std::list<Element>* l )
|
|||
|
||||
|
||||
template<typename Key, typename Element, typename Compare>
|
||||
inline std::string getString ( const std::map<Key,Element,Compare>* m )
|
||||
inline std::string getString ( std::map<Key,Element,Compare>* m )
|
||||
{
|
||||
std::string name = "std::map<Element>:";
|
||||
return name + getString<size_t>(m->size());
|
||||
|
@ -409,12 +437,12 @@ inline std::string getString ( const std::map<Key,Element,Compare>* m )
|
|||
|
||||
|
||||
template<typename Key, typename Element, typename Compare>
|
||||
inline Hurricane::Record* getRecord ( const std::map<Key,Element,Compare>* m )
|
||||
inline Hurricane::Record* getRecord ( std::map<Key,Element,Compare>* m )
|
||||
{
|
||||
Hurricane::Record* record = NULL;
|
||||
if ( !m->empty() ) {
|
||||
record = new Hurricane::Record ( "std::map<Element>" );
|
||||
typename std::map<Key,Element,Compare>::const_iterator iterator = m->begin();
|
||||
typename std::map<Key,Element,Compare>::iterator iterator = m->begin();
|
||||
while ( iterator != m->end() ) {
|
||||
record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
|
||||
++iterator;
|
||||
|
@ -424,14 +452,38 @@ inline Hurricane::Record* getRecord ( const std::map<Key,Element,Compare>* m )
|
|||
}
|
||||
|
||||
|
||||
template<typename Key, typename Element, typename Compare>
|
||||
inline std::string getString ( const std::map<Key,Element,Compare>* m )
|
||||
{
|
||||
std::string name = "const std::map<Element>:";
|
||||
return name + getString<size_t>(m->size());
|
||||
}
|
||||
|
||||
|
||||
template<typename Key, typename Element, typename Compare>
|
||||
inline Hurricane::Record* getRecord ( const std::map<Key,Element,Compare>* m )
|
||||
{
|
||||
Hurricane::Record* record = NULL;
|
||||
if ( !m->empty() ) {
|
||||
record = new Hurricane::Record ( "const std::map<Element>" );
|
||||
typename std::map<Key,Element,Compare>::const_iterator iterator = m->begin();
|
||||
while ( iterator != m->end() ) {
|
||||
record->add ( getSlot<const Element>(getString(iterator->first), iterator->second) );
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Inspector Support for : "[const] std::multimap<Key,Element,Compare>*.
|
||||
// Inspector Support for : "const std::multimap<Key,Element,Compare>*".
|
||||
|
||||
|
||||
template<typename Key, typename Element, typename Compare>
|
||||
inline std::string getString ( const std::multimap<Key,Element,Compare>* m )
|
||||
{
|
||||
std::string name = "std::multimap<Element>:";
|
||||
std::string name = "const std::multimap<Element>:";
|
||||
return name + getString<size_t>(m->size());
|
||||
}
|
||||
|
||||
|
@ -441,10 +493,10 @@ inline Hurricane::Record* getRecord ( const std::multimap<Key,Element,Compare>*
|
|||
{
|
||||
Hurricane::Record* record = NULL;
|
||||
if ( !m->empty() ) {
|
||||
record = new Hurricane::Record ( "std::multimap<Element>" );
|
||||
record = new Hurricane::Record ( "const std::multimap<Element>" );
|
||||
typename std::multimap<Key,Element,Compare>::const_iterator iterator = m->begin();
|
||||
while ( iterator != m->end() ) {
|
||||
record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
|
||||
record->add ( getSlot<const Element>(getString(iterator->first), iterator->second) );
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
|
@ -497,32 +549,30 @@ inline Hurricane::Record* getRecord ( const std::set<Element,Compare>* s )
|
|||
unsigned n = 1;
|
||||
typename std::set<Element,Compare>::const_iterator iterator = s->begin();
|
||||
while ( iterator != s->end() ) {
|
||||
record->add ( getSlot<Element>(getString(n++), *iterator) );
|
||||
record->add ( getSlot<const Element>(getString(n++), *iterator) );
|
||||
++iterator;
|
||||
}
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Inspector Support for : "std::set<Element,Compare>*".
|
||||
|
||||
template<typename Element, typename Compare>
|
||||
inline std::string getString ( std::set<Element,Compare>* s )
|
||||
template< typename Element, typename Compare, typename Allocator >
|
||||
inline std::string getString ( std::set<Element,Compare,Allocator>* s )
|
||||
{
|
||||
std::string name = "std::set<Element>:";
|
||||
return name + getString<size_t>(s->size());
|
||||
}
|
||||
|
||||
|
||||
template<typename Element, typename Compare>
|
||||
inline Hurricane::Record* getRecord ( std::set<Element,Compare>* s )
|
||||
template< typename Element, typename Compare, typename Allocator >
|
||||
inline Hurricane::Record* getRecord ( std::set<Element,Compare,Allocator>* s )
|
||||
{
|
||||
Hurricane::Record* record = NULL;
|
||||
if ( !s->empty() ) {
|
||||
record = new Hurricane::Record ( "std::set<Element>" );
|
||||
unsigned n = 1;
|
||||
typename std::set<Element,Compare>::iterator iterator = s->begin();
|
||||
typename std::set<Element,Compare,Allocator>::iterator iterator = s->begin();
|
||||
while ( iterator != s->end() ) {
|
||||
record->add ( getSlot<Element>(getString(n++), *iterator) );
|
||||
++iterator;
|
||||
|
|
|
@ -42,16 +42,13 @@
|
|||
#define __HURRICANE_DBO__
|
||||
|
||||
#include "hurricane/DBos.h"
|
||||
#include "hurricane/Properties.h"
|
||||
#include "hurricane/Name.h"
|
||||
#include "hurricane/Properties.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class Property;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::DBo".
|
||||
|
||||
|
@ -59,27 +56,25 @@ namespace Hurricane {
|
|||
class DBo {
|
||||
|
||||
public:
|
||||
// Types.
|
||||
typedef set<Property*> PropertySet;
|
||||
// Methods.
|
||||
virtual void destroy();
|
||||
inline PropertySet& _getPropertySet ();
|
||||
void _onDestroyed ( Property* property );
|
||||
Property* getProperty ( const Name& ) const;
|
||||
Properties getProperties () const;
|
||||
inline bool hasProperty () const;
|
||||
void put ( Property* );
|
||||
void remove ( Property* );
|
||||
void removeProperty ( const Name& );
|
||||
void clearProperties ();
|
||||
// Hurricane Managment.
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
virtual void destroy();
|
||||
inline set<Property*>& _getPropertySet ();
|
||||
void _onDestroyed ( Property* property );
|
||||
Property* getProperty ( const Name& ) const;
|
||||
Properties getProperties () const;
|
||||
inline bool hasProperty () const;
|
||||
void put ( Property* );
|
||||
void remove ( Property* );
|
||||
void removeProperty ( const Name& );
|
||||
void clearProperties ();
|
||||
// Hurricane Managment.
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
||||
private:
|
||||
// Internal: Attributes.
|
||||
mutable PropertySet _propertySet;
|
||||
mutable set<Property*> _propertySet;
|
||||
|
||||
protected:
|
||||
// Internal: Constructors & Destructors.
|
||||
|
@ -95,8 +90,8 @@ namespace Hurricane {
|
|||
|
||||
|
||||
// Inline Functions.
|
||||
inline DBo::PropertySet& DBo::_getPropertySet () { return _propertySet; }
|
||||
inline bool DBo::hasProperty () const { return !_propertySet.empty(); }
|
||||
inline set<Property*>& DBo::_getPropertySet () { return _propertySet; }
|
||||
inline bool DBo::hasProperty () const { return !_propertySet.empty(); }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
@ -105,18 +100,4 @@ namespace Hurricane {
|
|||
INSPECTOR_P_SUPPORT(Hurricane::DBo);
|
||||
|
||||
|
||||
template<>
|
||||
inline Hurricane::Slot* getSlot ( const std::string& name, const std::set<Hurricane::Property*>* s )
|
||||
{
|
||||
return new Hurricane::SlotTemplate<const std::set<Hurricane::Property*>*>(name,s);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
inline Hurricane::Slot* getSlot ( const std::string& name, std::set<Hurricane::Property*>* s )
|
||||
{
|
||||
return new Hurricane::SlotTemplate<std::set<Hurricane::Property*>*>(name,s);
|
||||
}
|
||||
|
||||
|
||||
#endif // __HURRICANE_DBO__
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "hurricane/Go.h"
|
||||
#include "hurricane/Plug.h"
|
||||
#include "hurricane/SharedPath.h"
|
||||
#include "hurricane/IntrusiveMap.h"
|
||||
//#include "hurricane/IntrusiveMap.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ template<class Key, class Element> class IntrusiveMap {
|
|||
n = 1;
|
||||
Element* element = _array[index];
|
||||
while (element) {
|
||||
record->add(getSlot(getString(index) + ":" + getString(n++), element));
|
||||
record->add(getSlot<Element*>(getString(index) + ":" + getString(n++), element));
|
||||
element = _getNextElement(element);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,25 +57,25 @@ namespace Hurricane {
|
|||
|
||||
public:
|
||||
// Types.
|
||||
typedef list<Slot*> SlotList;
|
||||
typedef vector<Slot*> SlotVector;
|
||||
|
||||
public:
|
||||
// Constructor & Destructor.
|
||||
Record ( const string& name );
|
||||
virtual ~Record ();
|
||||
// Methods.
|
||||
static size_t getAllocateds ();
|
||||
inline const string& getName () const;
|
||||
Slot* getSlot ( unsigned no ) const;
|
||||
void add ( Slot* slot );
|
||||
inline SlotList& _getSlotList ();
|
||||
Record ( const string& name );
|
||||
virtual ~Record ();
|
||||
// Methods.
|
||||
static size_t getAllocateds ();
|
||||
inline const string& getName () const;
|
||||
Slot* getSlot ( unsigned no ) const;
|
||||
void add ( Slot* slot );
|
||||
inline SlotVector& _getSlotVector ();
|
||||
|
||||
private:
|
||||
// Internal: Static Attributes.
|
||||
static size_t _allocateds;
|
||||
// Internal: Attributes
|
||||
string _name;
|
||||
SlotList _slotList;
|
||||
SlotVector _slots;
|
||||
|
||||
private:
|
||||
// Forbidden: Constructors
|
||||
|
@ -85,8 +85,8 @@ namespace Hurricane {
|
|||
|
||||
|
||||
// Inline Functions.
|
||||
inline const string& Record::getName () const { return _name; }
|
||||
inline Record::SlotList& Record::_getSlotList () { return _slotList; }
|
||||
inline const string& Record::getName () const { return _name; }
|
||||
inline Record::SlotVector& Record::_getSlotVector () { return _slots; }
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -91,11 +91,58 @@ namespace Hurricane {
|
|||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SlotTemplate".
|
||||
// Class : "SlotTemplate<Data>".
|
||||
|
||||
template<typename Data>
|
||||
class SlotTemplate : public Slot {
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
SlotTemplate ( const string& name, Data data );
|
||||
SlotTemplate ( string& name, Data data );
|
||||
// Accessors.
|
||||
virtual string getDataString () const;
|
||||
virtual Record* getDataRecord () const;
|
||||
virtual SlotTemplate<Data>*
|
||||
getClone () const;
|
||||
|
||||
protected:
|
||||
// Internal: Attributes.
|
||||
Data _data;
|
||||
|
||||
private:
|
||||
// Internal: Constructors.
|
||||
SlotTemplate ( const SlotTemplate& );
|
||||
SlotTemplate& operator= ( const SlotTemplate& );
|
||||
};
|
||||
|
||||
|
||||
// Inline Member Functions.
|
||||
template<typename Data>
|
||||
SlotTemplate<Data>::SlotTemplate ( const string& name, Data data )
|
||||
: Slot(name), _data(data) { }
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data>::SlotTemplate ( string& name, Data data )
|
||||
: Slot(name), _data(data) { }
|
||||
|
||||
template<typename Data>
|
||||
string SlotTemplate<Data>::getDataString () const { return ::getString(_data); }
|
||||
|
||||
template<typename Data>
|
||||
Record* SlotTemplate<Data>::getDataRecord () const { return ::getRecord(_data); }
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data>* SlotTemplate<Data>::getClone () const
|
||||
{ return new SlotTemplate(_name,_data); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SlotTemplate<const Data>".
|
||||
|
||||
template<typename Data>
|
||||
class SlotTemplate<const Data> : public Slot {
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
SlotTemplate ( const string& name, const Data data );
|
||||
|
@ -103,7 +150,7 @@ namespace Hurricane {
|
|||
// Accessors.
|
||||
virtual string getDataString () const;
|
||||
virtual Record* getDataRecord () const;
|
||||
virtual SlotTemplate<Data>*
|
||||
virtual SlotTemplate<const Data>*
|
||||
getClone () const;
|
||||
|
||||
protected:
|
||||
|
@ -119,21 +166,21 @@ namespace Hurricane {
|
|||
|
||||
// Inline Member Functions.
|
||||
template<typename Data>
|
||||
SlotTemplate<Data>::SlotTemplate ( const string& name, const Data data )
|
||||
: Slot(name), _data(data) { }
|
||||
SlotTemplate<const Data>::SlotTemplate ( const string& name, const Data data )
|
||||
: Slot(name), _data(data) { }
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data>::SlotTemplate ( string& name, const Data data )
|
||||
: Slot(name), _data(data) { }
|
||||
SlotTemplate<const Data>::SlotTemplate ( string& name, const Data data )
|
||||
: Slot(name), _data(data) { }
|
||||
|
||||
template<typename Data>
|
||||
string SlotTemplate<Data>::getDataString () const { return getString(_data); }
|
||||
string SlotTemplate<const Data>::getDataString () const { return getString(_data); }
|
||||
|
||||
template<typename Data>
|
||||
Record* SlotTemplate<Data>::getDataRecord () const { return getRecord(_data); }
|
||||
Record* SlotTemplate<const Data>::getDataRecord () const { return getRecord(_data); }
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data>* SlotTemplate<Data>::getClone () const
|
||||
SlotTemplate<const Data>* SlotTemplate<const Data>::getClone () const
|
||||
{ return new SlotTemplate(_name,_data); }
|
||||
|
||||
|
||||
|
@ -175,16 +222,64 @@ namespace Hurricane {
|
|||
: Slot(name), _data(data) {}
|
||||
|
||||
template<typename Data>
|
||||
string SlotTemplate<Data*>::getDataString () const { return getString(_data); }
|
||||
string SlotTemplate<Data*>::getDataString () const { return ::getString(_data); }
|
||||
|
||||
template<typename Data>
|
||||
Record* SlotTemplate<Data*>::getDataRecord () const { return getRecord(_data); }
|
||||
Record* SlotTemplate<Data*>::getDataRecord () const { return ::getRecord(_data); }
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data*>* SlotTemplate<Data*>::getClone () const
|
||||
{ return new SlotTemplate(_name,_data); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SlotTemplate".
|
||||
|
||||
|
||||
template<typename Data>
|
||||
class SlotTemplate<Data* const> : public Slot {
|
||||
|
||||
public:
|
||||
// Constructor.
|
||||
SlotTemplate ( const string& name, Data* const data );
|
||||
SlotTemplate ( string& name, Data* const data );
|
||||
// Accessors.
|
||||
virtual string getDataString () const;
|
||||
virtual Record* getDataRecord () const;
|
||||
virtual SlotTemplate<Data* const>*
|
||||
getClone () const;
|
||||
|
||||
protected:
|
||||
// Internal: Attributes.
|
||||
Data* const _data;
|
||||
|
||||
private:
|
||||
// Internal: Constructors.
|
||||
SlotTemplate ( const SlotTemplate& );
|
||||
SlotTemplate& operator= ( const SlotTemplate& );
|
||||
};
|
||||
|
||||
|
||||
// Inline Member Functions.
|
||||
template<typename Data>
|
||||
SlotTemplate<Data* const>::SlotTemplate ( const string& name, Data* const data )
|
||||
: Slot(name), _data(data) {}
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data* const>::SlotTemplate ( string& name, Data* const data )
|
||||
: Slot(name), _data(data) {}
|
||||
|
||||
template<typename Data>
|
||||
string SlotTemplate<Data* const>::getDataString () const { return ::getString(_data); }
|
||||
|
||||
template<typename Data>
|
||||
Record* SlotTemplate<Data* const>::getDataRecord () const { return ::getRecord(_data); }
|
||||
|
||||
template<typename Data>
|
||||
SlotTemplate<Data* const>* SlotTemplate<Data* const>::getClone () const
|
||||
{ return new SlotTemplate(_name,_data); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "SlotTemplate".
|
||||
|
||||
|
@ -233,13 +328,23 @@ namespace Hurricane {
|
|||
template<typename Data>
|
||||
inline Hurricane::Slot* getSlot( std::string& name, Data d )
|
||||
{
|
||||
//std::cerr << "getSlot<string&,Data>( \"" << name << "\" )" << std::endl;
|
||||
return new Hurricane::SlotTemplate<Data> ( name, d );
|
||||
}
|
||||
|
||||
|
||||
template<typename Data>
|
||||
inline Hurricane::Slot* getSlot( std::string& name, Data* d )
|
||||
{
|
||||
//std::cerr << "getSlot<string&,Data*>( \"" << name << "\" )" << std::endl;
|
||||
return new Hurricane::SlotTemplate<Data*> ( name, d );
|
||||
}
|
||||
|
||||
|
||||
template<typename Data>
|
||||
inline Hurricane::Slot* getSlot( const std::string& name, Data d )
|
||||
{
|
||||
//std::cerr << "getSlot<const string&,Data>( \"" << name << "\" )" << std::endl;
|
||||
return new Hurricane::SlotTemplate<Data> ( name, d );
|
||||
}
|
||||
|
||||
|
@ -247,6 +352,7 @@ inline Hurricane::Slot* getSlot( const std::string& name, Data d )
|
|||
template<typename Data>
|
||||
inline Hurricane::Slot* getSlot( const std::string& name, Data* d )
|
||||
{
|
||||
//std::cerr << "getSlot<const string&,Data*>( \"" << name << "\" )" << std::endl;
|
||||
return new Hurricane::SlotTemplate<Data*> ( name, d );
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#if !defined (DEMANGLE_H)
|
||||
#define DEMANGLE_H
|
||||
|
||||
#include "hurricane/libiberty.h"
|
||||
//#include "hurricane/libiberty.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void InspectorWidget::History::push ( Slot* slot )
|
||||
void InspectorWidget::History::push ( Slot* slot, Record* record )
|
||||
{
|
||||
if ( _depth < _slots.size()-1 ) {
|
||||
while ( _depth < _slots.size()-1 ) pop ();
|
||||
|
@ -66,8 +66,9 @@ namespace Hurricane {
|
|||
_depth++;
|
||||
_slots.push_back ( slot->getClone() );
|
||||
_comboBox->addItem ( QString("%1: %2").arg(_depth).arg(_slots[_slots.size()-1]->getDataString().c_str()));
|
||||
_comboBox->setCurrentIndex ( _depth );
|
||||
//_comboBox->setCurrentIndex ( _depth );
|
||||
|
||||
//cerr << "After History::push()" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,8 +95,10 @@ namespace Hurricane {
|
|||
void InspectorWidget::History::goTo ( int depth )
|
||||
{
|
||||
if ( ( depth < 0 ) || ( depth >= (int)_slots.size() ) ) return;
|
||||
|
||||
_depth = depth;
|
||||
if ( depth != _depth ) {
|
||||
_depth = depth;
|
||||
_comboBox->setCurrentIndex ( _depth );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -185,6 +188,7 @@ namespace Hurricane {
|
|||
|
||||
QHeaderView* verticalHeader = _view->verticalHeader ();
|
||||
verticalHeader->setVisible ( false );
|
||||
verticalHeader->setDefaultSectionSize ( _rowHeight );
|
||||
|
||||
_historyComboBox = new QComboBox ( this );
|
||||
_history.setComboBox ( _historyComboBox );
|
||||
|
@ -218,13 +222,6 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void InspectorWidget::forceRowHeight ()
|
||||
{
|
||||
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void InspectorWidget::setRootOccurrence ( Occurrence& occurrence )
|
||||
{
|
||||
_rootOccurrence = occurrence;
|
||||
|
@ -241,12 +238,12 @@ namespace Hurricane {
|
|||
|
||||
void InspectorWidget::_setRootRecord ( Record* record )
|
||||
{
|
||||
//cerr << "InspectorWidget::_setRootRecord()." << endl;
|
||||
//if ( _baseModel ) _baseModel->setSlot ( NULL, 0 );
|
||||
|
||||
_history.setRootRecord ( record );
|
||||
if ( !record ) _rootOccurrence = Occurrence ();
|
||||
if ( record == NULL ) _rootOccurrence = Occurrence ();
|
||||
|
||||
if ( !_baseModel ) {
|
||||
if ( _baseModel == NULL ) {
|
||||
_baseModel = new RecordModel ( this );
|
||||
_sortModel = new QSortFilterProxyModel ( this );
|
||||
_sortModel->setSourceModel ( _baseModel );
|
||||
|
@ -259,49 +256,53 @@ namespace Hurricane {
|
|||
|
||||
// Only after creating the RecordModel can we connect the ComboBox.
|
||||
connect ( _historyComboBox, SIGNAL(currentIndexChanged(int))
|
||||
, this , SLOT(historyChanged(int)) );
|
||||
connect ( _baseModel, SIGNAL(layoutChanged()), this, SLOT(forceRowHeight()) );
|
||||
, this , SLOT (historyChanged(int)) );
|
||||
}
|
||||
|
||||
setSlot ();
|
||||
_history.setRootRecord ( record );
|
||||
}
|
||||
|
||||
|
||||
bool InspectorWidget::setSlot ()
|
||||
bool InspectorWidget::setSlot ( Record* record )
|
||||
{
|
||||
bool change = true;
|
||||
|
||||
change = _baseModel->setSlot ( _history.getSlot(), _history.getDepth() );
|
||||
// if ( change ) {
|
||||
// int rows = _sortModel->rowCount ();
|
||||
// for ( rows-- ; rows >= 0 ; rows-- )
|
||||
// _view->setRowHeight ( rows, _rowHeight );
|
||||
// _view->selectRow ( 0 );
|
||||
// }
|
||||
if ( (_history.getSlot() != NULL) and (record == NULL) )
|
||||
record = _history.getSlot()->getDataRecord();
|
||||
|
||||
//cerr << " Effective setSlot() ." << endl;
|
||||
change = _baseModel->setSlot ( _history.getSlot(), record, _history.getDepth() );
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
|
||||
void InspectorWidget::pushSlot ( Slot* slot )
|
||||
void InspectorWidget::pushSlot ( Slot* slot, Record* record )
|
||||
{
|
||||
_history.push ( slot );
|
||||
if ( !setSlot() )
|
||||
_history.pop ();
|
||||
//cerr << "InspectorWidget::pushSlot()" << endl;
|
||||
|
||||
if ( slot == NULL ) return;
|
||||
if ( record == NULL ) {
|
||||
record = slot->getDataRecord ();
|
||||
if ( record == NULL ) return;
|
||||
}
|
||||
|
||||
_history.push ( slot, record );
|
||||
setSlot ( record );
|
||||
}
|
||||
|
||||
|
||||
void InspectorWidget::popSlot ()
|
||||
{
|
||||
_history.pop ();
|
||||
setSlot ();
|
||||
//setSlot ();
|
||||
}
|
||||
|
||||
|
||||
void InspectorWidget::back ()
|
||||
{
|
||||
_history.back ();
|
||||
setSlot ();
|
||||
//setSlot ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -313,10 +314,11 @@ namespace Hurricane {
|
|||
if ( keyEvent->key() == Qt::Key_Right ) {
|
||||
QModelIndex index = _view->currentIndex();
|
||||
if ( index.isValid() ) {
|
||||
//cerr << "Key Right: do to sub-slot." << endl;
|
||||
Slot* slot = _baseModel->getRecord()->getSlot(_sortModel->mapToSource(index).row());
|
||||
|
||||
if ( slot )
|
||||
pushSlot ( slot );
|
||||
if ( slot != NULL )
|
||||
pushSlot ( slot, slot->getDataRecord() );
|
||||
}
|
||||
} else if ( keyEvent->key() == Qt::Key_Left ) {
|
||||
back ();
|
||||
|
@ -332,7 +334,6 @@ namespace Hurricane {
|
|||
void InspectorWidget::textFilterChanged ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
forceRowHeight ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,9 +36,10 @@ namespace Hurricane {
|
|||
|
||||
RecordModel::RecordModel ( QObject* parent )
|
||||
: QAbstractTableModel(parent)
|
||||
, _slot(NULL)
|
||||
, _record(NULL)
|
||||
, _depth(0)
|
||||
, _slot (NULL)
|
||||
, _record (NULL)
|
||||
, _depth (0)
|
||||
, _cache ()
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -49,30 +50,53 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
bool RecordModel::setSlot ( Slot* slot, size_t depth )
|
||||
bool RecordModel::setSlot ( Slot* slot, Record* record, size_t depth )
|
||||
{
|
||||
if ( !slot ) {
|
||||
_slot = NULL;
|
||||
_record = NULL;
|
||||
_depth = depth;
|
||||
//cerr << " Slot change" << endl;
|
||||
|
||||
vector< pair<QVariant,QVariant> >().swap ( _cache );
|
||||
|
||||
if ( _slot ) {
|
||||
delete _slot;
|
||||
if ( _depth ) delete _record;
|
||||
}
|
||||
|
||||
_slot = NULL;
|
||||
_record = NULL;
|
||||
_depth = depth;
|
||||
|
||||
if ( slot == NULL ) {
|
||||
//cerr << " NULL Slot" << endl;
|
||||
|
||||
emit layoutChanged ();
|
||||
return false;
|
||||
}
|
||||
|
||||
Record* record = slot->getDataRecord ();
|
||||
if ( !record ) {
|
||||
delete slot;
|
||||
return false;
|
||||
// Now supplied by argument.
|
||||
if ( record == NULL ) {
|
||||
record = slot->getDataRecord ();
|
||||
//cerr << " New record build" << endl;
|
||||
if ( record == NULL ) {
|
||||
// cerr << " Slot " << slot->getDataString() << " has NULL Record" << endl;
|
||||
|
||||
delete slot;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( _depth ) delete _record;
|
||||
if ( _slot ) delete _slot;
|
||||
//cerr << " New Slot [" << depth << "] " << slot->getDataString() << endl;
|
||||
|
||||
_slot = slot;
|
||||
_record = record;
|
||||
_depth = depth;
|
||||
|
||||
Record::SlotVector& slotVector = _record->_getSlotVector();
|
||||
Record::SlotVector::iterator islot = slotVector.begin();
|
||||
for ( ; islot != slotVector.end() ; islot++ ) {
|
||||
_cache.push_back ( make_pair(QVariant(getString((*islot)->getName()).c_str())
|
||||
,QVariant((*islot)->getDataString().c_str())) );
|
||||
}
|
||||
|
||||
emit layoutChanged ();
|
||||
|
||||
return true;
|
||||
|
@ -84,7 +108,7 @@ namespace Hurricane {
|
|||
static QFont nameFont = Graphics::getFixedFont ( QFont::Bold );
|
||||
static QFont valueFont = Graphics::getFixedFont ( QFont::Normal, true );
|
||||
|
||||
if ( !index.isValid() ) return QVariant ();
|
||||
if ( not index.isValid() ) return QVariant ();
|
||||
|
||||
if ( role == Qt::SizeHintRole ) {
|
||||
switch (index.column()) {
|
||||
|
@ -94,6 +118,7 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
if ( role == Qt::FontRole ) {
|
||||
//if ( index.row() == 0 ) return QVariant();
|
||||
switch (index.column()) {
|
||||
case 0: return nameFont;
|
||||
case 1: return valueFont;
|
||||
|
@ -102,11 +127,13 @@ namespace Hurricane {
|
|||
|
||||
if ( role == Qt::DisplayRole ) {
|
||||
int row = index.row ();
|
||||
Slot* slot = _record->getSlot ( row );
|
||||
if ( slot ) {
|
||||
//Slot* slot = _record->getSlot ( row );
|
||||
if ( row < _cache.size() ) {
|
||||
switch ( index.column() ) {
|
||||
case 0: return QVariant(slot->getName ().c_str());
|
||||
case 1: return QVariant(slot->getDataString().c_str());
|
||||
case 0: return _cache[row].first;
|
||||
case 1: return _cache[row].second;
|
||||
//case 0: return QVariant(slot->getName ().c_str());
|
||||
//case 1: return QVariant(slot->getDataString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,9 +145,14 @@ namespace Hurricane {
|
|||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if ( ( orientation == Qt::Vertical ) || ( section > 1 ) || (role != Qt::DisplayRole) )
|
||||
if ( ( orientation == Qt::Vertical ) or ( section > 1 ) )
|
||||
return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
||||
if ( section == 0 )
|
||||
return QVariant ( tr("Object Attribute") );
|
||||
|
||||
|
@ -130,7 +162,8 @@ namespace Hurricane {
|
|||
|
||||
int RecordModel::rowCount ( const QModelIndex& parent ) const
|
||||
{
|
||||
return (_record) ? _record->_getSlotList().size() : 0;
|
||||
//return (_record != NULL) ? _record->_getSlotList().size() : 0;
|
||||
return _cache.size();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -131,6 +131,7 @@ namespace Hurricane {
|
|||
if ( !index.isValid() ) return QVariant ();
|
||||
|
||||
if ( role == Qt::SizeHintRole ) {
|
||||
if ( index.row() == 0 ) return QVariant();
|
||||
switch (index.column()) {
|
||||
case 0: return 200;
|
||||
default: return -1;
|
||||
|
@ -165,9 +166,14 @@ namespace Hurricane {
|
|||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
|
||||
if ( orientation == Qt::Vertical )
|
||||
return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
||||
switch ( section ) {
|
||||
case 0: return "Path";
|
||||
case 1: return "Entity";
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
if ( role == Qt::FontRole ) {
|
||||
if ( index.row() == 0 ) return QVariant();
|
||||
switch (index.column()) {
|
||||
default: return entityFont;
|
||||
}
|
||||
|
@ -148,12 +149,17 @@ namespace Hurricane {
|
|||
|
||||
|
||||
QVariant SelectionPopupModel::headerData ( int section
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
, Qt::Orientation orientation
|
||||
, int role ) const
|
||||
{
|
||||
if ( ( orientation == Qt::Vertical ) || (role != Qt::DisplayRole) )
|
||||
if ( orientation == Qt::Vertical )
|
||||
return QVariant();
|
||||
|
||||
static QFont headerFont = Graphics::getFixedFont ( QFont::Bold, false, false, +2 );
|
||||
|
||||
if ( role == Qt::FontRole ) return headerFont;
|
||||
if ( role != Qt::DisplayRole ) return QVariant();
|
||||
|
||||
if ( section == 0 ) {
|
||||
return "Path+Entity";
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ namespace Hurricane {
|
|||
connect ( _filterPatternLineEdit, SIGNAL(textChanged(const QString &))
|
||||
, this , SLOT (textFilterChanged()) );
|
||||
|
||||
connect ( _baseModel , SIGNAL(layoutChanged()), this , SLOT(forceRowHeight()) );
|
||||
connect ( _showSelection, SIGNAL(toggled(bool)) , this , SLOT(setShowSelection(bool)) );
|
||||
connect ( _cumulative , SIGNAL(toggled(bool)) , this , SLOT(setCumulativeSelection(bool)) );
|
||||
connect ( clear , SIGNAL(clicked()) , _baseModel, SLOT(clear()) );
|
||||
|
@ -151,13 +150,6 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void SelectionWidget::forceRowHeight ()
|
||||
{
|
||||
for ( int rows=_sortModel->rowCount()-1; rows >= 0 ; rows-- )
|
||||
_view->setRowHeight ( rows, _rowHeight );
|
||||
}
|
||||
|
||||
|
||||
void SelectionWidget::setCellWidget ( CellWidget* cw )
|
||||
{
|
||||
if ( _cellWidget ) {
|
||||
|
@ -168,7 +160,7 @@ namespace Hurricane {
|
|||
_cellWidget = cw;
|
||||
if ( !_cellWidget ) return;
|
||||
|
||||
connect ( _cellWidget, SIGNAL(selectionModeChanged()), this , SLOT(changeSelectionMode()) );
|
||||
connect ( _cellWidget, SIGNAL(selectionModeChanged()), this, SLOT(changeSelectionMode()) );
|
||||
|
||||
connect ( _cellWidget, SIGNAL(selectionChanged(const SelectorSet&))
|
||||
, this , SLOT (setSelection (const SelectorSet&)) );
|
||||
|
@ -232,7 +224,6 @@ namespace Hurricane {
|
|||
void SelectionWidget::textFilterChanged ()
|
||||
{
|
||||
_sortModel->setFilterRegExp ( _filterPatternLineEdit->text() );
|
||||
forceRowHeight ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Hurricane {
|
|||
public:
|
||||
History ();
|
||||
~History ();
|
||||
void push ( Slot* slot );
|
||||
void push ( Slot*, Record* );
|
||||
void pop ();
|
||||
void back ();
|
||||
void goTo ( int depth );
|
||||
|
@ -83,7 +83,6 @@ namespace Hurricane {
|
|||
void setRootRecord ( Record* );
|
||||
void setRootOccurrence ( Occurrence& );
|
||||
private slots:
|
||||
void forceRowHeight ();
|
||||
void textFilterChanged ();
|
||||
void historyChanged ( int depth );
|
||||
void forkInspector ( const QModelIndex& );
|
||||
|
@ -91,10 +90,10 @@ namespace Hurricane {
|
|||
bool eventFilter ( QObject*, QEvent* );
|
||||
private:
|
||||
void _setRootRecord ( Record* );
|
||||
void pushSlot ( Slot* );
|
||||
void pushSlot ( Slot*, Record* record=NULL );
|
||||
void popSlot ();
|
||||
void back ();
|
||||
bool setSlot ();
|
||||
bool setSlot ( Record* record=NULL );
|
||||
|
||||
private:
|
||||
RecordModel* _baseModel;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./NetlistModel.h" |
|
||||
// | C++ Header : "./NetlistModel.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#ifndef __RECORD_MODEL_H__
|
||||
#define __RECORD_MODEL_H__
|
||||
|
||||
#include <vector>
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
#include "hurricane/Commons.h"
|
||||
|
@ -67,7 +68,7 @@ namespace Hurricane {
|
|||
public:
|
||||
RecordModel ( QObject* parent=NULL );
|
||||
~RecordModel ();
|
||||
bool setSlot ( Slot* slot, size_t depth );
|
||||
bool setSlot ( Slot* slot, Record* record, size_t depth );
|
||||
int rowCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
int columnCount ( const QModelIndex& parent=QModelIndex() ) const;
|
||||
QVariant data ( const QModelIndex& index, int role=Qt::DisplayRole ) const;
|
||||
|
@ -76,9 +77,10 @@ namespace Hurricane {
|
|||
inline Slot* getSlot ();
|
||||
|
||||
private:
|
||||
Slot* _slot;
|
||||
Record* _record;
|
||||
size_t _depth;
|
||||
Slot* _slot;
|
||||
Record* _record;
|
||||
size_t _depth;
|
||||
std::vector< pair<QVariant,QVariant> > _cache;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ namespace Hurricane {
|
|||
void toggleSelection ();
|
||||
void toggleSelection ( Occurrence );
|
||||
void toggleSelection ( const QModelIndex& );
|
||||
void forceRowHeight ();
|
||||
void inspect ();
|
||||
private slots:
|
||||
void textFilterChanged ();
|
||||
|
|
Loading…
Reference in New Issue