GAL: apply grid offset when board is loaded and respect grid color setting. (fixes lp:1533168)
This commit is contained in:
parent
99ba5259a6
commit
991b9d509a
|
@ -147,6 +147,9 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
|||
m_gal->BeginDrawing();
|
||||
m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );
|
||||
|
||||
KIGFX::COLOR4D gridColor = static_cast<KIGFX::PCB_RENDER_SETTINGS*> (m_painter->GetSettings())->GetLayerColor( ITEM_GAL_LAYER ( GRID_VISIBLE ) );
|
||||
m_gal->SetGridColor ( gridColor );
|
||||
|
||||
if( m_view->IsDirty() )
|
||||
{
|
||||
m_view->ClearTargets();
|
||||
|
|
|
@ -635,8 +635,11 @@ public:
|
|||
{
|
||||
gridOrigin = aGridOrigin;
|
||||
|
||||
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
|
||||
(long) gridOrigin.y % (long) gridSize.y );
|
||||
if( gridSize.x == 0.0 || gridSize.y == 0.0 )
|
||||
gridOffset = VECTOR2D(0.0, 0.0);
|
||||
else
|
||||
gridOffset = VECTOR2D( (long) gridOrigin.x % (long) gridSize.x,
|
||||
(long) gridOrigin.y % (long) gridSize.y );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -480,6 +480,13 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
|
|||
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
|
||||
{
|
||||
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
|
||||
|
||||
if( myframe->GetGalCanvas() )
|
||||
{
|
||||
KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView();
|
||||
view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->GetBoard()->GetColorsSettings() );
|
||||
}
|
||||
|
||||
myframe->GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <pcb_base_edit_frame.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <class_board.h>
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||
|
@ -73,6 +74,8 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
PCB_BASE_FRAME::SetBoard( aBoard );
|
||||
|
||||
GetGalCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetGridOrigin() ) );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
{
|
||||
|
@ -86,4 +89,3 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -786,7 +786,19 @@ EDA_COLOR_T PCB_EDIT_FRAME::GetGridColor() const
|
|||
|
||||
void PCB_EDIT_FRAME::SetGridColor( EDA_COLOR_T aColor )
|
||||
{
|
||||
|
||||
GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
StructColors c = g_ColorRefs[ aColor ];
|
||||
KIGFX::COLOR4D color( (double) c.m_Red / 255.0,
|
||||
(double) c.m_Green / 255.0,
|
||||
(double) c.m_Blue / 255.0,
|
||||
0.7 );
|
||||
|
||||
GetGalCanvas()->GetGAL()->SetGridColor( color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue