* ./hurricane/src/viewer:

- Change: In DisplayStyle, new attribute "goMatched" to tell if the style
        is associated to a given Go and therefore should be displayed in the
        Layer table.
This commit is contained in:
Jean-Paul Chaput 2010-06-22 20:37:28 +00:00
parent de68831335
commit 85b246eb16
3 changed files with 36 additions and 24 deletions

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -65,7 +65,9 @@ namespace Hurricane {
, int blue
, int borderWidth
, float threshold
) : _name(name)
, bool goMatched
)
: _name (name)
, _red (red)
, _green (green)
, _blue (blue)
@ -75,6 +77,7 @@ namespace Hurricane {
, _pen (NULL)
, _brush (NULL)
, _threshold (threshold)
, _goMatched (goMatched)
, _refcount (1)
{
}
@ -88,9 +91,10 @@ namespace Hurricane {
, int blue
, int borderWidth
, float threshold
, bool goMatched
)
{
DrawingStyle* style = new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold );
DrawingStyle* style = new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold, goMatched );
//if ( Graphics::isEnabled() )
// style->qtAllocate ();
@ -234,6 +238,7 @@ namespace Hurricane {
, int blue
, int borderWidth
, float threshold
, bool goMatched
)
{
size_t i = findIndex ( key );
@ -245,7 +250,7 @@ namespace Hurricane {
}
return _drawingStyles[i] =
DrawingStyle::create ( key, pattern, red, green, blue, borderWidth, threshold );
DrawingStyle::create ( key, pattern, red, green, blue, borderWidth, threshold, goMatched );
}
@ -398,12 +403,13 @@ namespace Hurricane {
, int blue
, int borderWidth
, float threshold
, bool goMatched
)
{
size_t gi;
findOrCreate ( groupKey, gi );
_groups[gi]->addDrawingStyle ( key, pattern, red, green, blue, borderWidth, threshold );
_groups[gi]->addDrawingStyle ( key, pattern, red, green, blue, borderWidth, threshold, goMatched );
}

View File

@ -244,12 +244,11 @@ namespace Hurricane {
gridBuffer.addSection ( _createGroupItem(groups[gi]->getName()), Qt::AlignHCenter );
for ( size_t si=0 ; si<styles.size() ; si++ ) {
if ( not styles[si]->isGoMatched() ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
if ( styles[si]->getName() == DisplayStyle::Background ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
if ( styles[si]->getName() == DisplayStyle::SelectionDraw ) continue;
if ( styles[si]->getName() == DisplayStyle::SelectionFill ) continue;
if ( styles[si]->getName() == DisplayStyle::Foreground ) continue;
PaletteNamedItem* item = _createNamedItem ( styles[si]->getName() );
gridBuffer.addWidget ( item );

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -54,12 +54,14 @@ namespace Hurricane {
, int blue =0
, int borderWidth=0
, float threshold =1.0
, bool goMatched =true
);
DrawingStyle* link ();
size_t unlink ();
// Accessors.
void qtAllocate ();
inline bool isGoMatched () const;
inline const Name& getName () const;
inline const string& getPattern () const;
QColor getColor ( int darkening ) const;
@ -79,16 +81,18 @@ namespace Hurricane {
QPen *_pen;
QBrush *_brush;
float _threshold;
bool _goMatched;
size_t _refcount;
// Internal - Constructors & Destructors.
DrawingStyle ( const Name& name
, const string& pattern ="FFFFFFFFFFFFFFFF"
, int red =0
, int green =0
, int blue =0
, int borderWidth=0
, float threshold =1.0
, const string& pattern
, int red
, int green
, int blue
, int borderWidth
, float threshold
, bool goMatched
);
DrawingStyle ( const DrawingStyle& );
~DrawingStyle ();
@ -120,6 +124,7 @@ namespace Hurricane {
, int blue
, int borderWidth
, float threshold
, bool goMatched
);
protected:
@ -192,6 +197,7 @@ namespace Hurricane {
, int blue
, int borderWidth
, float threshold
, bool goMatched =true
);
protected:
@ -215,6 +221,7 @@ namespace Hurricane {
// Functions.
inline bool DrawingStyle::isGoMatched () const { return _goMatched; }
inline const Name& DrawingStyle::getName () const { return _name; }
inline const string& DrawingStyle::getPattern () const { return _pattern; }
inline float DrawingStyle::getThreshold () const { return _threshold; }