Commit 58de62aa authored by Maciej Suminski's avatar Maciej Suminski
Browse files

High contrast mode with showing the selected layer on the top.

parent 1367d33c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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();
+7 −0
Original line number Diff line number Diff line
@@ -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 );
+14 −0
Original line number Diff line number Diff line
@@ -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
+46 −3
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@
using namespace KiGfx;

// Static constants
const unsigned int VIEW::VIEW_MAX_LAYERS = 64;
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;
}
+3 −0
Original line number Diff line number Diff line
@@ -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 );

Loading