Commit aee56a93 authored by charras's avatar charras

Change grid size type from integer to double (using wxRealPoint insteed of wxSize).

Mandatory in Pcbnew to handle without error metric grid used now for some footprints (BGA, connectors)
Not fully tested
parent 35e8a286
......@@ -5,6 +5,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2009-Feb-7 Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++All:
change grid size type from integer to double (using wxRealPoint insteed of wxSize)
This is mandatory in Pcbnew to handle metric user grids without error
(was unusable before, using integer grid size).
A lot of footprints uses not metric grid.
TODO:
more refinements for user grid (mainly in read/wrire config).
2009-Feb-06 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
......@@ -20,10 +31,6 @@ email address.
(near to to Wayne Stambaugh's changes: 15 values are not enought for pcbnew)
removed minor problems in zoom box selection (removed blank line).
Added user grid selection in modedit and refinements when user grid is selected.
TODO:
more refinements in user grid mode.
new grid implementation does not used floats when user grid is selected to calculate coordinates.
so it is unable to handle a metric grid. Todo: see what happened.
++eeschema:
......
......@@ -34,7 +34,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_ZoomScalar = 10;
m_Zoom = 32 * m_ZoomScalar;
m_Grid = wxSize( 50, 50 ); /* Default grid size */
m_Grid = wxRealPoint( 50, 50 ); /* Default grid size */
m_UserGridIsON = FALSE;
m_Center = true;
m_CurrentSheetDesc = &g_Sheet_A4;
......@@ -170,6 +170,12 @@ void BASE_SCREEN::Scale( wxPoint& pt )
pt.y = Scale( pt.y );
}
void BASE_SCREEN::Scale( wxRealPoint& pt )
{
pt.x = Scale( pt.x );
pt.y = Scale( pt.y );
}
void BASE_SCREEN::Scale( wxSize& sz )
{
......@@ -303,14 +309,14 @@ void BASE_SCREEN::SetGridList( GridArray& gridlist )
/**********************************************/
void BASE_SCREEN::SetGrid( const wxSize& size )
void BASE_SCREEN::SetGrid( const wxRealPoint& size )
/**********************************************/
{
wxASSERT( !m_GridList.IsEmpty() );
size_t i;
wxSize nearest_grid = m_GridList[0].m_Size;
wxRealPoint nearest_grid = m_GridList[0].m_Size;
for( i = 0; i < m_GridList.GetCount(); i++ )
{
if( m_GridList[i].m_Size == size )
......@@ -318,7 +324,7 @@ void BASE_SCREEN::SetGrid( const wxSize& size )
m_Grid = m_GridList[i].m_Size;
return;
}
// keep trace of the nearest grill size, if the exact size is not found
if ( size.x < m_GridList[i].m_Size.x )
nearest_grid = m_GridList[i].m_Size;
......@@ -326,8 +332,8 @@ void BASE_SCREEN::SetGrid( const wxSize& size )
m_Grid = nearest_grid;
wxLogWarning( _( "Grid size( %d, %d ) not in grid list, falling back to " \
"grid size( %d, %d )." ),
wxLogWarning( _( "Grid size( %f, %f ) not in grid list, falling back to " \
"grid size( %f, %f )." ),
size.x, size.y, m_Grid.x, m_Grid.y );
}
......@@ -350,7 +356,7 @@ void BASE_SCREEN::SetGrid( int id )
m_Grid = m_GridList[0].m_Size;
wxLogWarning( _( "Grid ID %d not in grid list, falling back to " \
"grid size( %d, %d )." ), id, m_Grid.x, m_Grid.y );
"grid size( %f, %f )." ), id, m_Grid.x, m_Grid.y );
}
void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
......@@ -381,7 +387,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
m_GridList.Add( grid );
}
void BASE_SCREEN::AddGrid( const wxSize& size, int id )
void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
{
GRID_TYPE grid;
......@@ -393,7 +399,7 @@ void BASE_SCREEN::AddGrid( const wxSize& size, int id )
void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
{
double x, y;
wxSize new_size;
wxRealPoint new_size;
GRID_TYPE new_grid;
if( units == MILLIMETRE )
......@@ -412,8 +418,8 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
y = size.y;
}
new_size = wxSize( (int) round( x * (double) GetInternalUnits() ),
(int) round( y * (double) GetInternalUnits() ) );
new_size = wxRealPoint( x * (double) GetInternalUnits(),
y * (double) GetInternalUnits() );
new_grid.m_Id = id;
new_grid.m_Size = new_size;
......@@ -421,7 +427,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
}
/*********************************/
wxSize BASE_SCREEN::GetGrid()
wxRealPoint BASE_SCREEN::GetGrid()
/*********************************/
{
return m_Grid;
......
......@@ -262,9 +262,9 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
BASE_SCREEN* screen = GetBaseScreen();
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
wxSize current_grid = screen->GetGrid();
wxRealPoint current_grid = screen->GetGrid();
screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 );
wxSize selected_grid = screen->GetGrid();
wxRealPoint selected_grid = screen->GetGrid();
if( selected_grid != current_grid )
Recadre_Trace( FALSE );
......
......@@ -175,7 +175,7 @@ void WinEDA_DrawPanel::SetZoom( int zoom )
/************************************/
wxSize WinEDA_DrawPanel::GetGrid()
wxRealPoint WinEDA_DrawPanel::GetGrid()
/************************************/
{
return GetScreen()->GetGrid();
......@@ -685,11 +685,10 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
int Color = BLUE;
BASE_SCREEN* screen = GetScreen();
int ii, jj, xg, yg, color;
wxSize pas_grille_affichee;
wxRealPoint pas_grille_affichee;
bool drawgrid = FALSE;
wxSize size;
wxPoint org;
double pasx, pasy;
color = g_GridColor;
......@@ -702,32 +701,29 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
pas_grille_affichee = screen->GetGrid();
ii = screen->Scale( pas_grille_affichee.x );
if( ii < 5 )
double dgrid = screen->Scale( pas_grille_affichee.x );
if( dgrid < 5 )
{
pas_grille_affichee.x *= 2;
ii *= 2;
dgrid *= 2;
}
if( ii < 5 )
if( dgrid < 5 )
drawgrid = FALSE; // The gris is small
ii = screen->Scale( pas_grille_affichee.y );
if( ii < 5 )
dgrid = screen->Scale( pas_grille_affichee.y );
if( ii < dgrid )
{
pas_grille_affichee.y *= 2;
ii *= 2;
dgrid *= 2;
}
if( ii < 5 )
if( dgrid < 5 )
drawgrid = FALSE; // The gris is small
GetViewStart( &org.x, &org.y );
GetScrollPixelsPerUnit( &ii, &jj );
wxLogDebug( _T( "View start: %d, %d, scroll bar PPI: %d, %d" ),
org.x, org.y, ii, jj );
org.x *= ii;
org.y *= jj;
screen->m_StartVisu = org;
wxLogDebug( _T( "Scroll bar drawing position: %d. %d" ), org.x, org.y );
screen->Unscale( org );
org += screen->m_DrawOrg;
......@@ -735,9 +731,6 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
size = GetClientSize();
screen->Unscale( size );
pasx = screen->m_Grid.x * m_Parent->m_InternalUnits;
pasy = screen->m_Grid.y * m_Parent->m_InternalUnits;
if( drawgrid )
{
m_Parent->PutOnGrid( &org );
......
......@@ -47,14 +47,14 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
* @param coord = coordinate to adjust
*/
{
wxSize grid_size = GetBaseScreen()->GetGrid();
wxRealPoint grid_size = GetBaseScreen()->GetGrid();
if( !GetBaseScreen()->m_UserGridIsON )
{
coord->x = ( (int) round( (double) coord->x /
(double) grid_size.x ) ) * grid_size.x;
coord->y = ( (int) round( (double) coord->y /
(double) grid_size.y ) ) * grid_size.y;
coord->x = ( (int) round( coord->x /
grid_size.x ) ) * grid_size.x;
coord->y = ( (int) round( coord->y /
grid_size.y ) ) * grid_size.y;
}
}
......@@ -193,7 +193,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
size_t i;
int maxZoomIds;
int zoom;
wxSize grid;
wxRealPoint grid;
wxString msg;
GRID_TYPE tmp;
wxMenu* gridMenu;
......
......@@ -182,7 +182,7 @@ bool WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/****************************************************************/
{
wxSize delta;
wxRealPoint delta;
int flagcurseur = 0;
wxPoint curpos, oldpos;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
......
......@@ -82,7 +82,7 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/* Default EESchema zoom values. Limited to 15 values to keep a decent size to menus */
static int SchematicZoomList[] =
{
10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280
10, 15, 20, 30, 40, 60, 80, 120, 160, 230, 320, 480, 640, 800, 1280
};
#define SCHEMATIC_ZOOM_LIST_CNT ( sizeof( SchematicZoomList ) / \
......@@ -91,12 +91,12 @@ static int SchematicZoomList[] =
/* Default grid sizes for the schematic editor. */
static GRID_TYPE SchematicGridList[] = {
{ ID_POPUP_GRID_LEVEL_50, wxSize( 50, 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxSize( 25, 25 ) },
{ ID_POPUP_GRID_LEVEL_10, wxSize( 10, 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxSize( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxSize( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxSize( 1, 1 ) }
{ ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) },
{ ID_POPUP_GRID_LEVEL_10, wxRealPoint( 10, 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) }
};
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / \
......@@ -117,7 +117,7 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] );
SetGrid( wxSize( 50, 50 ) ); /* usual grid size */
SetGrid( wxRealPoint( 50, 50 ) ); /* usual grid size */
m_UndoRedoCountMax = 10; // Undo/redo levels count. 10 is a reasonnable value
m_RefCount = 0;
m_Center = false; // Suitable for schematic only. for libedit and viewlib, must be set to true
......
......@@ -223,7 +223,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/*************************************************************************************/
{
wxSize delta;
wxRealPoint delta;
SCH_SCREEN* screen = GetScreen();
wxPoint curpos, oldpos;
int hotkey = 0;
......@@ -317,7 +317,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/*************************************************************************************/
{
wxSize delta;
wxRealPoint delta;
SCH_SCREEN* screen = GetScreen();
wxPoint curpos, oldpos;
int hotkey = 0;
......@@ -411,7 +411,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
wxPoint MousePositionInPixels )
{
wxSize delta;
wxRealPoint delta;
SCH_SCREEN* screen = GetScreen();
wxPoint curpos, oldpos;
int hotkey = 0;
......
......@@ -93,7 +93,7 @@ WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame( WinEDA_DrawFrame* parent,
/* Init options */
if( screen )
{
switch( screen->GetGrid().x )
switch( (int)screen->GetGrid().x )
{
case 50:
m_SelGridSize->SetSelection( 0 );
......@@ -395,7 +395,7 @@ void WinEDA_SetOptionsFrame::OnCancelClick( wxCommandEvent& event )
void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
/**************************************************************************/
{
wxSize grid;
wxRealPoint grid;
wxString msg;
g_DrawMinimunLineWidth = m_DefaultDrawLineWidthCtrl->GetValue();
......@@ -450,27 +450,27 @@ void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
break;
case 0:
grid = wxSize( 50, 50 );
grid = wxRealPoint( 50, 50 );
break;
case 1:
grid = wxSize( 25, 25 );
grid = wxRealPoint( 25, 25 );
break;
case 2:
grid = wxSize( 10, 10 );
grid = wxRealPoint( 10, 10 );
break;
case 3:
grid = wxSize( 5, 5 );
grid = wxRealPoint( 5, 5 );
break;
case 4:
grid = wxSize( 2, 2 );
grid = wxRealPoint( 2, 2 );
break;
case 5:
grid = wxSize( 1, 1 );
grid = wxRealPoint( 1, 1 );
break;
}
......
......@@ -41,7 +41,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
* Remise a 0 de l'origine des coordonnees relatives
*/
{
wxSize delta;
wxRealPoint delta;
wxPoint curpos, oldpos;
int hotkey = 0;
......
......@@ -305,17 +305,15 @@ void WinEDA_GerberFrame::SetToolbars()
int WinEDA_GerberFrame::BestZoom()
/*************************************/
{
int ii, jj, gridX, gridY;
int bestzoom;
double ii, jj;
double bestzoom;
wxSize size;
GetBoard()->ComputeBoundaryBox();
gridX = GetScreen()->GetGrid().GetWidth() / 2;
gridY = GetScreen()->GetGrid().GetHeight() / 2;
size = DrawPanel->GetClientSize();
ii = ( GetBoard()->m_BoundaryBox.GetWidth() + gridX ) / size.x;
jj = ( GetBoard()->m_BoundaryBox.GetHeight() + gridY ) / size.y;
bestzoom = MAX( ii, jj ) + 1;
ii = GetBoard()->m_BoundaryBox.GetWidth() / size.x;
jj = GetBoard()->m_BoundaryBox.GetHeight() / size.y;
bestzoom = MAX( ii, jj );
GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre();
return bestzoom * GetScreen()->m_ZoomScalar;
}
......@@ -77,7 +77,7 @@ class GRID_TYPE
{
public:
int m_Id;
wxSize m_Size;
wxRealPoint m_Size;
};
......@@ -145,7 +145,7 @@ private:
/* Valeurs du pas de grille et du zoom */
public:
wxSize m_Grid; /* Current grid. */
wxRealPoint m_Grid; /* Current grid. */
GridArray m_GridList;
bool m_UserGridIsON;
......@@ -240,6 +240,8 @@ public:
int Scale( int coord );
void Scale( wxPoint& pt );
void Scale( wxSize& sz );
void Scale( wxRealPoint& sz );
int Unscale( int coord );
void Unscale( wxPoint& pt );
void Unscale( wxSize& sz );
......@@ -250,12 +252,12 @@ public:
void SetLastZoom(); /* ajuste le coeff de zoom au max */
//----<grid stuff>----------------------------------------------------------
wxSize GetGrid(); /* retourne la grille */
void SetGrid( const wxSize& size );
wxRealPoint GetGrid(); /* retourne la grille */
void SetGrid( const wxRealPoint& size );
void SetGrid( int );
void SetGridList( GridArray& sizelist );
void AddGrid( const GRID_TYPE& grid );
void AddGrid( const wxSize& size, int id );
void AddGrid( const wxRealPoint& size, int id );
void AddGrid( const wxRealPoint& size, int units, int id );
......
......@@ -90,8 +90,8 @@ public:
void SetZoom( int mode );
int GetZoom();
void SetGrid( const wxSize& size );
wxSize GetGrid();
void SetGrid( const wxRealPoint& size );
wxRealPoint GetGrid();
void AddMenuZoom( wxMenu* MasterMenu );
bool OnRightClick( wxMouseEvent& event );
......
......@@ -17,7 +17,7 @@
* 15 it better but does not allow a sufficient number of values
* roughtly a 1.5 progression.
* The last 2 values is handy when somebody uses a library import of a module
* (or foreign data) which has a bad coordinate
* (or foreign data) which has a bad coordinate
* Also useful in Gerbview for this reason.
*/
static const int PcbZoomList[] = { 10, 15, 22, 30, 45, 70, 100, 150, 220, 350, 500, 800, 1200,
......@@ -28,18 +28,18 @@ static const int PcbZoomList[] = { 10, 15, 22, 30, 45, 70, 100, 150, 220, 350, 5
/* Default grid sizes for PCB editor screens. */
static GRID_TYPE PcbGridList[] = {
{ ID_POPUP_GRID_LEVEL_1000, wxSize( 1000, 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxSize( 500, 500 ) },
{ ID_POPUP_GRID_LEVEL_250, wxSize( 250, 250 ) },
{ ID_POPUP_GRID_LEVEL_200, wxSize( 200, 200 ) },
{ ID_POPUP_GRID_LEVEL_100, wxSize( 100, 100 ) },
{ ID_POPUP_GRID_LEVEL_50, wxSize( 50, 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxSize( 25, 25 ) },
{ ID_POPUP_GRID_LEVEL_20, wxSize( 20, 20 ) },
{ ID_POPUP_GRID_LEVEL_10, wxSize( 10, 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxSize( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxSize( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxSize( 1, 1 ) }
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) },
{ ID_POPUP_GRID_LEVEL_250, wxRealPoint( 250, 250 ) },
{ ID_POPUP_GRID_LEVEL_200, wxRealPoint( 200, 200 ) },
{ ID_POPUP_GRID_LEVEL_100, wxRealPoint( 100, 100 ) },
{ ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) },
{ ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) },
{ ID_POPUP_GRID_LEVEL_20, wxRealPoint( 20, 20 ) },
{ ID_POPUP_GRID_LEVEL_10, wxRealPoint( 10, 10 ) },
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) },
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) },
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) }
};
#define PCB_GRID_LIST_CNT ( sizeof( PcbGridList ) / sizeof( GRID_TYPE ) )
......@@ -58,7 +58,7 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( TYPE_SCREEN )
for( i = 0; i < PCB_GRID_LIST_CNT; i++ )
AddGrid( PcbGridList[i] );
SetGrid( wxSize( 500, 500 ) ); /* Set the working grid size to a reasonnable value (in 1/10000 inch) */
SetGrid( wxRealPoint( 500, 500 ) ); /* Set the working grid size to a reasonnable value (in 1/10000 inch) */
Init();
}
......
......@@ -482,7 +482,7 @@ static bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/*****************************************************************/
{
wxSize delta;
wxRealPoint delta;
wxPoint curpos, oldpos;
int hotkey = 0;
......@@ -581,8 +581,11 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
wxPoint on_grid = curpos;
PutOnGrid( &on_grid );
wxSize grid;
grid.x = (int) GetScreen()->GetGrid().x;
grid.y = (int) GetScreen()->GetGrid().y;
if( Magnetize(m_Pcb, (WinEDA_PcbFrame *) this, m_ID_current_state,
GetScreen()->GetGrid(), on_grid, &curpos) )
grid, on_grid, &curpos) )
{
GetScreen()->m_Curseur = curpos;
}
......
......@@ -148,7 +148,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
SetCurItem( NULL );
/* Init parametres de gestion */
wxSize gridsize = GetScreen()->GetGrid();
wxRealPoint gridsize = GetScreen()->GetGrid();
((PCB_SCREEN*)GetScreen())->Init();
GetScreen()->SetGrid( gridsize );
......
......@@ -18,6 +18,9 @@
#include "3d_viewer.h"
// Keys used in read/write config
#define MODEDIT_CURR_GRID_X wxT( "ModEditCurrGrid_X" )
#define MODEDIT_CURR_GRID_Y wxT( "ModEditCurrGrid_Y" )
/********************************/
/* class WinEDA_ModuleEditFrame */
......@@ -185,12 +188,12 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
GetScreen()->SetCurItem( NULL );
GetSettings();
wxSize GridSize( 500, 500 );
wxRealPoint GridSize( 500, 500 );
if( config )
{
long SizeX, SizeY;
if( config->Read( wxT( "ModEditGrid_X" ), &SizeX )
&& config->Read( wxT( "ModEditGrid_Y" ), &SizeY ) )
double SizeX, SizeY;
if( config->Read( MODEDIT_CURR_GRID_X, &SizeX )
&& config->Read( MODEDIT_CURR_GRID_Y, &SizeY ) )
{
GridSize.x = SizeX;
GridSize.y = SizeY;
......@@ -241,9 +244,9 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings();
if( config )
{
wxSize GridSize = GetScreen()->GetGrid();
config->Write( wxT( "ModEditGrid_X" ), (long) GridSize.x );
config->Write( wxT( "ModEditGrid_Y" ), (long) GridSize.y );
wxRealPoint GridSize = GetScreen()->GetGrid();
config->Write( MODEDIT_CURR_GRID_X, GridSize.x );
config->Write( MODEDIT_CURR_GRID_Y, GridSize.y );
}
Destroy();
}
......@@ -407,7 +410,7 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
{
wxSize delta;
wxRealPoint delta;
wxPoint curpos, oldpos;
int hotkey = 0;
......@@ -510,7 +513,7 @@ void WinEDA_ModuleEditFrame::OnSelectGrid( wxCommandEvent& event )
{
if( m_SelGridBox == NULL )
return; // Should not occurs
GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
WinEDA_DrawFrame::OnSelectGrid( event );
......
......@@ -16,6 +16,13 @@
#include "3d_viewer.h"
#include "kbool/include/kbool/booleng.h"
// Keys used in read/write config
#define PCB_CURR_GRID_X wxT( "PcbCurrGrid_X" )
#define PCB_CURR_GRID_Y wxT( "PcbCurrGrid_Y" )
#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" )
#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" )
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
/*******************************/
/* class WinEDA_PcbFrame */
/*******************************/
......@@ -231,20 +238,20 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
wxSize GridSize( 500, 500 );
wxRealPoint GridSize( 500, 500 );
if( config )
{
long SizeX, SizeY;
double SizeX, SizeY;
if( config->Read( wxT( "PcbEditGrid_X" ), &SizeX )
&& config->Read( wxT( "PcbEditGrid_Y" ), &SizeY ) )
if( config->Read( PCB_CURR_GRID_X, &SizeX )
&& config->Read( PCB_CURR_GRID_Y, &SizeY ) )
{
GridSize.x = SizeX;
GridSize.y = SizeY;
}
config->Read( wxT( "PcbMagPadOpt" ), &g_MagneticPadOption );
config->Read( wxT( "PcbMagTrackOpt" ), &g_MagneticTrackOption );
config->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption );
config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
}
GetScreen()->SetGrid( GridSize );
......@@ -257,7 +264,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
if( config )
{
long display_microwave_tools = 0;
config->Read( wxT( "ShowMicrowaveTools" ), &display_microwave_tools );
config->Read( SHOW_MICROWAVE_TOOLS, &display_microwave_tools );
if ( display_microwave_tools )
ReCreateAuxVToolbar();
}
......@@ -334,12 +341,12 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings();
if( config )
{
wxSize GridSize = GetScreen()->GetGrid();
config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x );
config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y );
config->Write( wxT( "PcbMagPadOpt" ), (long) g_MagneticPadOption );
config->Write( wxT( "PcbMagTrackOpt" ), (long) g_MagneticTrackOption );
config->Write( wxT( "ShowMicrowaveTools" ), (long) m_AuxVToolBar ? 1 : 0 );
wxRealPoint GridSize = GetScreen()->GetGrid();
config->Write( PCB_CURR_GRID_X, GridSize.x );
config->Write( PCB_CURR_GRID_Y, GridSize.y );
config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
config->Write( SHOW_MICROWAVE_TOOLS, (long) m_AuxVToolBar ? 1 : 0 );
}
Destroy();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment