Updating the user grid size on change in GAL.

This commit is contained in:
Maciej Suminski 2015-04-30 10:46:06 +02:00
parent 3e46f2233a
commit 787415c2aa
2 changed files with 14 additions and 7 deletions

View File

@ -34,8 +34,10 @@
#include <pcbnew_id.h>
#include <dialog_set_grid_base.h>
#include <invoke_pcb_dialog.h>
#include <gal/graphics_abstraction_layer.h>
#include <class_draw_panel_gal.h>
#include <tool/tool_manager.h>
class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE
@ -227,12 +229,12 @@ bool PCB_BASE_FRAME::InvokeDialogGrid()
if( screen->GetGridId() == ID_POPUP_GRID_USER )
screen->SetGrid( ID_POPUP_GRID_USER );
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x,
screen->GetGrid().m_Size.y ) );
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
// Notify GAL
TOOL_MANAGER* mgr = GetToolManager();
if( mgr && IsGalCanvasActive() )
mgr->RunAction( "common.Control.gridPreset", true,
ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 );
m_canvas->Refresh();

View File

@ -135,10 +135,15 @@ int PCBNEW_CONTROL::ZoomPreset( const TOOL_EVENT& aEvent )
m_frame->SetPresetZoom( idx );
if( idx == 0 )
if( idx == 0 ) // Zoom Auto
{
return ZoomFitScreen( aEvent );
}
else if( idx < 0 || idx >= zoomList.size() )
{
assert( false );
return 0;
}
double selectedZoom = zoomList[idx];
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();