High contrast mode with showing the selected layer on the top.
This commit is contained in:
parent
4ca54b2f1d
commit
603029b106
|
@ -819,6 +819,13 @@ void CAIRO_GAL::ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor )
|
|||
}
|
||||
|
||||
|
||||
void CAIRO_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth )
|
||||
{
|
||||
// Cairo does not have any possibilities to change the depth coordinate of stored items,
|
||||
// it depends only on the order of drawing
|
||||
}
|
||||
|
||||
|
||||
void CAIRO_GAL::Flush()
|
||||
{
|
||||
storePath();
|
||||
|
|
|
@ -1635,6 +1635,13 @@ void OPENGL_GAL::ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor )
|
|||
}
|
||||
|
||||
|
||||
void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth )
|
||||
{
|
||||
vboItems[aGroupNumber]->ChangeDepth( aDepth );
|
||||
vboNeedsUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
void OPENGL_GAL::computeUnitCircle()
|
||||
{
|
||||
displayListCircle = glGenLists( 1 );
|
||||
|
|
|
@ -94,6 +94,20 @@ void VBO_ITEM::ChangeColor( const COLOR4D& aColor )
|
|||
}
|
||||
|
||||
|
||||
void VBO_ITEM::ChangeDepth( int aDepth )
|
||||
{
|
||||
VBO_VERTEX* vertexPtr = GetVertices();
|
||||
|
||||
for( unsigned int i = 0; i < m_size; ++i )
|
||||
{
|
||||
vertexPtr->z = aDepth;
|
||||
|
||||
// Move on to the next vertex
|
||||
vertexPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void VBO_ITEM::Finish()
|
||||
{
|
||||
// The unknown-sized item has just ended, so we need to inform the container about it
|
||||
|
|
|
@ -40,8 +40,9 @@
|
|||
using namespace KiGfx;
|
||||
|
||||
// Static constants
|
||||
const unsigned int VIEW::VIEW_MAX_LAYERS = 64;
|
||||
const int VIEW::TOP_LAYER = -1;
|
||||
const int VIEW::VIEW_MAX_LAYERS = 64;
|
||||
// Top layer depth
|
||||
const int VIEW::TOP_LAYER = -1;
|
||||
|
||||
void VIEW::AddLayer( int aLayer, bool aDisplayOnly )
|
||||
{
|
||||
|
@ -303,6 +304,7 @@ void VIEW::sortLayers()
|
|||
void VIEW::SetLayerOrder( int aLayer, int aRenderingOrder )
|
||||
{
|
||||
m_layers[aLayer].renderingOrder = aRenderingOrder;
|
||||
|
||||
sortLayers();
|
||||
}
|
||||
|
||||
|
@ -319,6 +321,7 @@ struct VIEW::updateItemsColor
|
|||
// Obtain the color that should be used for coloring the item
|
||||
const COLOR4D color = painter->GetColor( aItem, layer );
|
||||
int group = aItem->getGroup( layer );
|
||||
wxASSERT( group >= 0 );
|
||||
|
||||
gal->ChangeGroupColor( group, color );
|
||||
}
|
||||
|
@ -356,11 +359,45 @@ void VIEW::UpdateAllLayersColor()
|
|||
}
|
||||
|
||||
|
||||
struct VIEW::changeItemsDepth
|
||||
{
|
||||
changeItemsDepth( int aLayer, int aDepth, GAL* aGal ) :
|
||||
layer( aLayer ), depth( aDepth ), gal( aGal )
|
||||
{
|
||||
}
|
||||
|
||||
void operator()( VIEW_ITEM* aItem )
|
||||
{
|
||||
int group = aItem->getGroup( layer );
|
||||
|
||||
if( group >= 0 )
|
||||
gal->ChangeGroupDepth( group, depth );
|
||||
}
|
||||
|
||||
int layer, depth;
|
||||
GAL* gal;
|
||||
};
|
||||
|
||||
|
||||
void VIEW::ChangeLayerDepth( int aLayer, int aDepth )
|
||||
{
|
||||
BOX2I r;
|
||||
|
||||
r.SetMaximum();
|
||||
|
||||
changeItemsDepth visitor( aLayer, aDepth, m_gal );
|
||||
m_layers[aLayer].items->Query( r, visitor );
|
||||
}
|
||||
|
||||
|
||||
void VIEW::SetTopLayer( int aLayer )
|
||||
{
|
||||
// Restore previous order
|
||||
if( m_topLayer.enabled )
|
||||
{
|
||||
m_layers[m_topLayer.id].renderingOrder = m_topLayer.renderingOrder;
|
||||
ChangeLayerDepth( m_topLayer.id, m_topLayer.renderingOrder );
|
||||
}
|
||||
|
||||
if( aLayer >= 0 && aLayer < VIEW_MAX_LAYERS )
|
||||
{
|
||||
|
@ -370,7 +407,10 @@ void VIEW::SetTopLayer( int aLayer )
|
|||
|
||||
// Apply new settings only if the option is enabled
|
||||
if( m_enableTopLayer )
|
||||
{
|
||||
m_layers[aLayer].renderingOrder = TOP_LAYER;
|
||||
ChangeLayerDepth( aLayer, TOP_LAYER );
|
||||
}
|
||||
|
||||
// Set the flag saying that settings stored in m_topLayer are valid
|
||||
m_topLayer.enabled = true;
|
||||
|
@ -396,12 +436,15 @@ void VIEW::EnableTopLayer( bool aEnable )
|
|||
if( aEnable )
|
||||
{
|
||||
m_layers[m_topLayer.id].renderingOrder = TOP_LAYER;
|
||||
ChangeLayerDepth( m_topLayer.id, TOP_LAYER );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_layers[m_topLayer.id].renderingOrder = m_topLayer.renderingOrder;
|
||||
ChangeLayerDepth( m_topLayer.id, m_topLayer.renderingOrder );
|
||||
}
|
||||
}
|
||||
sortLayers();
|
||||
|
||||
m_enableTopLayer = aEnable;
|
||||
}
|
||||
|
@ -416,7 +459,7 @@ struct VIEW::drawItem
|
|||
|
||||
void operator()( VIEW_ITEM* aItem )
|
||||
{
|
||||
GAL* gal = view->GetGAL();
|
||||
GAL* gal = view->GetGAL();
|
||||
|
||||
if( view->m_useGroups )
|
||||
{
|
||||
|
|
|
@ -212,6 +212,9 @@ public:
|
|||
/// @copydoc GAL::ChangeGroupColor()
|
||||
virtual void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor );
|
||||
|
||||
/// @copydoc GAL::ChangeGroupDepth()
|
||||
virtual void ChangeGroupDepth( int aGroupNumber, int aDepth );
|
||||
|
||||
/// @copydoc GAL::DeleteGroup()
|
||||
virtual void DeleteGroup( int aGroupNumber );
|
||||
|
||||
|
|
|
@ -371,6 +371,14 @@ public:
|
|||
*/
|
||||
virtual void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Changes the depth (Z-axis position) of the group.
|
||||
*
|
||||
* @param aGroupNumber is the group number.
|
||||
* @param aDepth is the new depth.
|
||||
*/
|
||||
virtual void ChangeGroupDepth( int aGroupNumber, int aDepth ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Delete the group from the memory.
|
||||
*
|
||||
|
|
|
@ -237,6 +237,9 @@ public:
|
|||
/// @copydoc GAL::ChangeGroupColor()
|
||||
virtual void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor );
|
||||
|
||||
/// @copydoc GAL::ChangeGroupDepth()
|
||||
virtual void ChangeGroupDepth( int aGroupNumber, int aDepth );
|
||||
|
||||
/// @copydoc GAL::DeleteGroup()
|
||||
virtual void DeleteGroup( int aGroupNumber );
|
||||
|
||||
|
|
|
@ -116,6 +116,13 @@ public:
|
|||
*/
|
||||
void ChangeColor( const COLOR4D& aColor );
|
||||
|
||||
/**
|
||||
* Function ChangeDepth()
|
||||
* Moves all vertices to the specified depth.
|
||||
* @param aDepth is the new depth for vertices.
|
||||
*/
|
||||
void ChangeDepth( int aDepth );
|
||||
|
||||
///< Informs the container that there will be no more vertices for the current VBO_ITEM
|
||||
void Finish();
|
||||
|
||||
|
|
|
@ -215,7 +215,6 @@ public:
|
|||
*/
|
||||
double ToScreen( double aCoord, bool aAbsolute = true ) const;
|
||||
|
||||
|
||||
/**
|
||||
* Function GetScreenPixelSize()
|
||||
* Returns the size of the our rendering area, in pixels.
|
||||
|
@ -232,7 +231,6 @@ public:
|
|||
*/
|
||||
void AddLayer( int aLayer, bool aDisplayOnly = false );
|
||||
|
||||
|
||||
/**
|
||||
* Function ClearLayer()
|
||||
* Removes all items from a given layer.
|
||||
|
@ -279,6 +277,14 @@ public:
|
|||
*/
|
||||
void UpdateAllLayersColor();
|
||||
|
||||
/**
|
||||
* Function ChangeLayerDepth()
|
||||
* Changes the depth of items on the given layer.
|
||||
* @param aLayer is a number of the layer to be updated.
|
||||
* @param aDepth is the new depth.
|
||||
*/
|
||||
void ChangeLayerDepth( int aLayer, int aDepth );
|
||||
|
||||
/**
|
||||
* Function SetTopLayer()
|
||||
* Sets given layer to be displayed on the top or sets back the default order of layers.
|
||||
|
@ -324,8 +330,8 @@ public:
|
|||
*/
|
||||
bool IsDynamic() const { return m_dynamic; }
|
||||
|
||||
static const unsigned int VIEW_MAX_LAYERS; ///* maximum number of layers that may be shown
|
||||
static const int TOP_LAYER; ///* layer number for displaying items on the top
|
||||
static const int VIEW_MAX_LAYERS; ///* maximum number of layers that may be shown
|
||||
static const int TOP_LAYER; ///* layer number for displaying items on the top
|
||||
|
||||
private:
|
||||
struct VIEW_LAYER
|
||||
|
@ -353,6 +359,7 @@ private:
|
|||
struct recacheItem;
|
||||
struct drawItem;
|
||||
struct updateItemsColor;
|
||||
struct changeItemsDepth;
|
||||
|
||||
///* Saves current top layer settings in order to restore it when it's not top anymore
|
||||
VIEW_LAYER m_topLayer;
|
||||
|
|
|
@ -361,6 +361,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer )
|
|||
// Set display settings for high contrast mode
|
||||
KiGfx::VIEW* view = myframe->GetGalCanvas()->GetView();
|
||||
view->GetPainter()->GetSettings()->SetActiveLayer( aLayer );
|
||||
view->UpdateAllLayersColor();
|
||||
view->SetTopLayer( aLayer );
|
||||
#endif /* KICAD_GAL */
|
||||
|
||||
|
|
Loading…
Reference in New Issue