Commit f966097d authored by stambaughw's avatar stambaughw

Improved grid implementation, 3D viewer debug assertion fix, moved...

Improved grid implementation, 3D viewer debug assertion fix, moved drawpanel.cpp to common library, and added WinEDA_Appl declaration.
parent 4ce4e6aa
...@@ -504,7 +504,6 @@ void Pcb3D_GLCanvas::OnSize( wxSizeEvent& event ) ...@@ -504,7 +504,6 @@ void Pcb3D_GLCanvas::OnSize( wxSizeEvent& event )
if( GetContext() ) if( GetContext() )
#endif #endif
{ {
SetCurrent();
glViewport( 0, 0, (GLint) w, (GLint) h ); glViewport( 0, 0, (GLint) w, (GLint) h );
} }
...@@ -536,8 +535,6 @@ void Pcb3D_GLCanvas::InitGL() ...@@ -536,8 +535,6 @@ void Pcb3D_GLCanvas::InitGL()
ZBottom = 1.0; ZTop = 10.0; ZBottom = 1.0; ZTop = 10.0;
} }
SetCurrent();
/* set viewing projection */ /* set viewing projection */
double ratio_HV = (double) size.x / size.y; // Ratio largeur /hauteur de la fenetre d'affichage double ratio_HV = (double) size.x / size.y; // Ratio largeur /hauteur de la fenetre d'affichage
glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION );
...@@ -595,8 +592,6 @@ void Pcb3D_GLCanvas::SetLights() ...@@ -595,8 +592,6 @@ void Pcb3D_GLCanvas::SetLights()
double light; double light;
GLfloat light_color[4]; GLfloat light_color[4];
SetCurrent();
/* set viewing projection */ /* set viewing projection */
light_color[3] = 1.0; light_color[3] = 1.0;
GLfloat Z_axis_pos[4] = { 0.0, 0.0, 3.0, 0.0 }; GLfloat Z_axis_pos[4] = { 0.0, 0.0, 3.0, 0.0 };
......
...@@ -5,6 +5,19 @@ Started 2007-June-11 ...@@ -5,6 +5,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Dec-05 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Simplified and improved grid implementation. User grid will no longer
be displayed if it is the same as any of the default grid sizes.
* Removed unused grid code in BASE_SCREEN class.
* Source file share/drawpanel.cpp now compiled into common library.
* Declare WinEDA_Appl so you can use wxGetApp() instead of passing app
pointers all over the place.
* Fixed assertion in debug build of 3D viewer.
* Some general code beautification and redundant header file removal in files
changed by the grid implementation.
2008-Dec-3 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Dec-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
...@@ -42,7 +55,6 @@ email address. ...@@ -42,7 +55,6 @@ email address.
results are same, but using segments can be better (faster redraw time) for polygons having a lot results are same, but using segments can be better (faster redraw time) for polygons having a lot
of segments (more than 10000) of segments (more than 10000)
>>>>>>> .r1441
2008-Dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net> 2008-Dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================ ================================================================================
++build fixes ++build fixes
......
...@@ -17,6 +17,7 @@ set(COMMON_SRCS ...@@ -17,6 +17,7 @@ set(COMMON_SRCS
dcsvg.cpp dcsvg.cpp
displlst.cpp displlst.cpp
dlist.cpp dlist.cpp
drawpanel.cpp
drawtxt.cpp drawtxt.cpp
edaappl.cpp edaappl.cpp
eda_dde.cpp eda_dde.cpp
......
This diff is collapsed.
...@@ -13,14 +13,6 @@ ...@@ -13,14 +13,6 @@
#include "macros.h" #include "macros.h"
#include "id.h" #include "id.h"
#ifdef PCBNEW
#include "pcbstruct.h"
#endif
#ifdef EESCHEMA
#include "program.h"
#endif
// Local defines // Local defines
#define CURSOR_SIZE 12 // Cursor size in pixels #define CURSOR_SIZE 12 // Cursor size in pixels
...@@ -36,18 +28,20 @@ static bool s_IgnoreNextLeftButtonRelease = false; ...@@ -36,18 +28,20 @@ static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by WinEDA_DrawPanel // Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow ) BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent ) EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
EVT_PAINT( WinEDA_DrawPanel::OnPaint ) EVT_PAINT( WinEDA_DrawPanel::OnPaint )
EVT_SIZE( WinEDA_DrawPanel::OnSize ) EVT_SIZE( WinEDA_DrawPanel::OnSize )
EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground ) EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll ) EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate ) EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawPanel::Process_Popup_Zoom ) WinEDA_DrawPanel::Process_Popup_Zoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
WinEDA_DrawPanel::OnPopupGridSelect )
END_EVENT_TABLE() END_EVENT_TABLE()
/************************************************************************/ /************************************************************************/
...@@ -80,8 +74,9 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -80,8 +74,9 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
ManageCurseur = NULL; ManageCurseur = NULL;
ForceCloseManageCurseur = NULL; ForceCloseManageCurseur = NULL;
if( m_Parent->m_Parent->m_EDA_Config ) if( wxGetApp().m_EDA_Config )
m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read( wxT( "AutoPAN" ), TRUE ); m_AutoPAN_Enable = wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ),
TRUE );
m_AutoPAN_Request = FALSE; m_AutoPAN_Request = FALSE;
m_Block_Enable = FALSE; m_Block_Enable = FALSE;
...@@ -666,7 +661,7 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) ...@@ -666,7 +661,7 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
if( Screen == NULL ) if( Screen == NULL )
return; return;
if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) if( ( g_DrawBgColor != WHITE ) && ( g_DrawBgColor != BLACK ) )
g_DrawBgColor = BLACK; g_DrawBgColor = BLACK;
if( g_DrawBgColor == WHITE ) if( g_DrawBgColor == WHITE )
...@@ -773,14 +768,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -773,14 +768,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
size.x *= zoom; size.x *= zoom;
size.y *= zoom; size.y *= zoom;
pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits; pasx = screen->m_Grid.x * m_Parent->m_InternalUnits;
pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits; pasy = screen->m_Grid.y * m_Parent->m_InternalUnits;
if( screen->m_UserGridUnit != INCHES )
{
pasx /= 25.4;
pasy /= 25.4;
}
if( drawgrid ) if( drawgrid )
{ {
...@@ -789,15 +778,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) ...@@ -789,15 +778,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetColorPen( DC, color ); GRSetColorPen( DC, color );
for( ii = 0; ; ii++ ) for( ii = 0; ; ii++ )
{ {
xg = screen->m_UserGridIsON ? (int) ( (ii * pasx) + 0.5 ) xg = ii * pas_grille_affichee.x;
: ii * pas_grille_affichee.x;
int xpos = org.x + xg; int xpos = org.x + xg;
for( jj = 0; ; jj++ ) for( jj = 0; ; jj++ )
{ {
yg = screen->m_UserGridIsON ? (int) ( (jj * pasy) + 0.5 ) yg = jj * pas_grille_affichee.y;
: jj * pas_grille_affichee.y;
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color ); GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
if( yg > size.y ) if( yg > size.y )
break; break;
...@@ -848,14 +834,18 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ) ...@@ -848,14 +834,18 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
/* Draw the Y axis */ /* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, GRDashedLine( &m_ClipBox, DC,
m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y, m_Parent->m_Auxiliary_Axis_Position.x,
m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y, -screen->ReturnPageSize().y,
m_Parent->m_Auxiliary_Axis_Position.x,
screen->ReturnPageSize().y,
0, Color ); 0, Color );
/* Draw the X axis */ /* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, GRDashedLine( &m_ClipBox, DC,
-screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, -screen->ReturnPageSize().x,
screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, m_Parent->m_Auxiliary_Axis_Position.y,
screen->ReturnPageSize().x,
m_Parent->m_Auxiliary_Axis_Position.y,
0, Color ); 0, Color );
} }
......
...@@ -52,7 +52,6 @@ set(CVPCB_EXTRA_SRCS ...@@ -52,7 +52,6 @@ set(CVPCB_EXTRA_SRCS
../pcbnew/tracemod.cpp ../pcbnew/tracemod.cpp
../share/drawframe.cpp ../share/drawframe.cpp
../share/drawpanel.cpp
../share/zoom.cpp) ../share/zoom.cpp)
if(WIN32) if(WIN32)
......
...@@ -12,20 +12,19 @@ ...@@ -12,20 +12,19 @@
#include "protos.h" #include "protos.h"
#define BITMAP wxBitmap
/*****************************************************************/ /*****************************************************************/
/* Construction de la table des evenements pour WinEDA_DrawFrame */ /* Construction de la table des evenements pour WinEDA_DrawFrame */
/*****************************************************************/ /*****************************************************************/
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize ) EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DisplayFrame::Process_Zoom ) WinEDA_DisplayFrame::Process_Zoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay ) EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame ) EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -35,13 +34,15 @@ END_EVENT_TABLE() ...@@ -35,13 +34,15 @@ END_EVENT_TABLE()
WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent, WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) : const wxPoint& pos,
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos, size, style ) const wxSize& size, long style ) :
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos,
size, style )
{ {
m_FrameName = wxT( "CmpFrame" ); m_FrameName = wxT( "CmpFrame" );
m_Draw_Axis = TRUE; // TRUE if we want the axis m_Draw_Axis = TRUE; // TRUE if we want the axis
m_Draw_Grid = TRUE; // TRUE if we want the grid m_Draw_Grid = TRUE; // TRUE if we want the grid
m_Draw_Sheet_Ref = FALSE; // TRUE if we want the sheet references m_Draw_Sheet_Ref = FALSE; // TRUE if we want the sheet references
// Give an icon // Give an icon
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -53,7 +54,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent, ...@@ -53,7 +54,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
m_Pcb = new BOARD( NULL, this ); m_Pcb = new BOARD( NULL, this );
SetBaseScreen( new PCB_SCREEN( CVPCB_DISPLAY_FRAME ) ); SetBaseScreen( new PCB_SCREEN() );
GetSettings(); GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
...@@ -114,26 +115,31 @@ void WinEDA_DisplayFrame::ReCreateHToolbar() ...@@ -114,26 +115,31 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
SetToolBar( m_HToolBar ); SetToolBar( m_HToolBar );
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
BITMAP( display_options_xpm ), wxBitmap( display_options_xpm ),
_( "Display Options" ) ); _( "Display Options" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ), m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString,
_( "zoom + (F1)" ) ); wxBitmap( zoom_in_xpm ),
_( "zoom + (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ), m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
_( "zoom - (F2)" ) ); wxBitmap( zoom_out_xpm ),
_( "zoom - (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ), m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
_( "redraw (F3)" ) ); wxBitmap( zoom_redraw_xpm ),
_( "redraw (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ), m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
_( "1:1 zoom" ) ); wxBitmap( zoom_auto_xpm ),
_( "1:1 zoom" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, BITMAP( show_3d_xpm ), m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString,
_( "1:1 zoom" ) ); wxBitmap( show_3d_xpm ),
_( "1:1 zoom" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes // the changes
...@@ -260,8 +266,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -260,8 +266,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
RedrawActiveWindow( DC, TRUE ); RedrawActiveWindow( DC, TRUE );
} }
if( (oldpos.x != GetScreen()->m_Curseur.x) if( ( oldpos.x != GetScreen()->m_Curseur.x )
|| (oldpos.y != GetScreen()->m_Curseur.y) ) || ( oldpos.y != GetScreen()->m_Curseur.y ) )
{ {
if( flagcurseur != 2 ) if( flagcurseur != 2 )
{ {
......
...@@ -101,7 +101,6 @@ set(EESCHEMA_SRCS ...@@ -101,7 +101,6 @@ set(EESCHEMA_SRCS
set(EESCHEMA_EXTRA_SRCS set(EESCHEMA_EXTRA_SRCS
../share/drawframe.cpp ../share/drawframe.cpp
../share/drawpanel.cpp
../share/setpage.cpp ../share/setpage.cpp
../share/svg_print.cpp ../share/svg_print.cpp
../share/wxprint.cpp ../share/wxprint.cpp
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -104,7 +103,8 @@ bool DrawSheetStruct::Save( FILE* f ) const ...@@ -104,7 +103,8 @@ bool DrawSheetStruct::Save( FILE* f ) const
/* Generation de la liste des 2 textes (sheetname et filename) */ /* Generation de la liste des 2 textes (sheetname et filename) */
if( !m_SheetName.IsEmpty() ) if( !m_SheetName.IsEmpty() )
{ {
if( fprintf( f, "F0 \"%s\" %d\n", CONV_TO_UTF8( m_SheetName ), m_SheetNameSize ) == EOF ) if( fprintf( f, "F0 \"%s\" %d\n", CONV_TO_UTF8( m_SheetName ),
m_SheetNameSize ) == EOF )
{ {
Success = false; return Success; Success = false; return Success;
} }
...@@ -112,7 +112,8 @@ bool DrawSheetStruct::Save( FILE* f ) const ...@@ -112,7 +112,8 @@ bool DrawSheetStruct::Save( FILE* f ) const
if( !m_FileName.IsEmpty() ) if( !m_FileName.IsEmpty() )
{ {
if( fprintf( f, "F1 \"%s\" %d\n", CONV_TO_UTF8( m_FileName ), m_FileNameSize ) == EOF ) if( fprintf( f, "F1 \"%s\" %d\n", CONV_TO_UTF8( m_FileName ),
m_FileNameSize ) == EOF )
{ {
Success = false; return Success; Success = false; return Success;
} }
...@@ -285,7 +286,8 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw ...@@ -285,7 +286,8 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw
/**************************************************************************************/ /**************************************************************************************/
void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/**************************************************************************************/ /**************************************************************************************/
/* Draw the hierarchical sheet shape */ /* Draw the hierarchical sheet shape */
...@@ -335,7 +337,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of ...@@ -335,7 +337,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
SheetLabelStruct = m_Label; SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL ) while( SheetLabelStruct != NULL )
{ {
if( !(SheetLabelStruct->m_Flags & IS_MOVED) ) if( !( SheetLabelStruct->m_Flags & IS_MOVED ) )
SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color ); SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
SheetLabelStruct = SheetLabelStruct->Next(); SheetLabelStruct = SheetLabelStruct->Next();
} }
...@@ -426,7 +428,8 @@ bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen ) ...@@ -426,7 +428,8 @@ bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen )
/*******************************************************************************/ /*******************************************************************************/
bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* list ) bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen,
DrawSheetPath* list )
/*******************************************************************************/ /*******************************************************************************/
{ {
//search the existing hierarchy for an instance of screen "FileName". //search the existing hierarchy for an instance of screen "FileName".
...@@ -476,7 +479,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) ...@@ -476,7 +479,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame )
} }
else else
{ {
m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++;
success = frame->LoadOneEEFile( m_AssociatedScreen, m_FileName ); success = frame->LoadOneEEFile( m_AssociatedScreen, m_FileName );
if( success ) if( success )
...@@ -544,7 +547,8 @@ void DrawSheetStruct::SetFileName( const wxString& aFilename ) ...@@ -544,7 +547,8 @@ void DrawSheetStruct::SetFileName( const wxString& aFilename )
* - if new filename is already used (a complex hierarchy) : reference the sheet. * - if new filename is already used (a complex hierarchy) : reference the sheet.
*/ */
bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxString& aFileName ) bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
const wxString& aFileName )
{ {
if( (GetFileName() == aFileName) && m_AssociatedScreen ) if( (GetFileName() == aFileName) && m_AssociatedScreen )
return true; return true;
...@@ -629,7 +633,7 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxStr ...@@ -629,7 +633,7 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxStr
//just make a new screen if needed. //just make a new screen if needed.
if( !m_AssociatedScreen ) if( !m_AssociatedScreen )
{ {
m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++; //be careful with these m_AssociatedScreen->m_RefCount++; //be careful with these
} }
m_AssociatedScreen->m_FileName = aFileName; m_AssociatedScreen->m_FileName = aFileName;
......
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -8,6 +7,7 @@ ...@@ -8,6 +7,7 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "id.h"
/******************************************************************/ /******************************************************************/
...@@ -47,7 +47,8 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -47,7 +47,8 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/* place the struct in EEDrawList. /* place the struct in EEDrawList.
* if it is a new item, it it also put in undo list * if it is a new item, it it also put in undo list
* for an "old" item, saving it in undo list must be done before editiing, and not here! * for an "old" item, saving it in undo list must be done before editiing,
* and not here!
*/ */
{ {
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
...@@ -80,17 +81,37 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -80,17 +81,37 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/***********************************************************************/ /***********************************************************************/
static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */ static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */
/* 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 ) }
};
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / \
sizeof( GRID_TYPE ) )
/* Constructeur de SCREEN */ /* Constructeur de SCREEN */
SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) : SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
BASE_SCREEN( screentype, aType )
{ {
size_t i;
EEDrawList = NULL; /* Schematic items list */ EEDrawList = NULL; /* Schematic items list */
m_Zoom = 32; m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* pas de la grille */
SetZoomList( table_zoom ); SetZoomList( table_zoom );
SetGridList( g_GridList );
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] );
SetGrid( wxSize( 50, 50 ) ); /* pas de la grille */
m_UndoRedoCountMax = 10; m_UndoRedoCountMax = 10;
m_RefCount = 0; m_RefCount = 0;
m_Center = false;
InitDatas();
} }
...@@ -102,7 +123,6 @@ SCH_SCREEN::~SCH_SCREEN() ...@@ -102,7 +123,6 @@ SCH_SCREEN::~SCH_SCREEN()
FreeDrawList(); FreeDrawList();
} }
/***********************************/ /***********************************/
void SCH_SCREEN::FreeDrawList() void SCH_SCREEN::FreeDrawList()
/***********************************/ /***********************************/
...@@ -236,8 +256,7 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen ) ...@@ -236,8 +256,7 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
m_List.Add( testscreen ); m_List.Add( testscreen );
#ifdef DEBUG #ifdef DEBUG
printf( "EDA_ScreenList::AddScreenToList adding %s\n", printf( "EDA_ScreenList::AddScreenToList adding %s\n",
(const char*) testscreen->m_FileName.mb_str( (const char*) testscreen->m_FileName.mb_str() );
) );
#endif #endif
} }
...@@ -316,7 +335,8 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet ) ...@@ -316,7 +335,8 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
m_count = count; m_count = count;
m_index = 0; m_index = 0;
if( m_List ) if( m_List )
free( m_List );m_List = NULL; free( m_List );
m_List = NULL;
count *= sizeof(DrawSheetPath); count *= sizeof(DrawSheetPath);
m_List = (DrawSheetPath*) MyZMalloc( count ); m_List = (DrawSheetPath*) MyZMalloc( count );
memset( (void*) m_List, 0, count ); memset( (void*) m_List, 0, count );
...@@ -340,4 +360,3 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet ) ...@@ -340,4 +360,3 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
} }
m_currList.Pop(); m_currList.Pop();
} }
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
/****************************/ /****************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
...@@ -47,7 +46,8 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) ...@@ -47,7 +46,8 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/************************************************************************************/ /************************************************************************************/
int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew ) int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
bool IsNew )
/************************************************************************************/ /************************************************************************************/
{ {
/* /*
...@@ -209,7 +209,7 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( ...@@ -209,7 +209,7 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
{ {
SCH_SCREEN* NewScreen; SCH_SCREEN* NewScreen;
NewScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); NewScreen = new SCH_SCREEN();
NewScreen->SetRefreshReq(); NewScreen->SetRefreshReq();
if( OldScreen ) if( OldScreen )
......
...@@ -104,17 +104,6 @@ typedef enum { ...@@ -104,17 +104,6 @@ typedef enum {
FILE_SAVE_NEW FILE_SAVE_NEW
} FileSaveType; } FileSaveType;
eda_global wxSize g_GridList[]
#ifdef MAIN
= {
wxSize( 50, 50 ), wxSize( 20, 20 ), wxSize( 10, 10 ),
wxSize( -1, -1 ), wxSize( 0, 0 )
}
#endif
;
/* variables generales */ /* variables generales */
eda_global wxArrayString g_LibName_List; // library list (short filenames) to load eda_global wxArrayString g_LibName_List; // library list (short filenames) to load
......
...@@ -282,7 +282,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -282,7 +282,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
LibDrawPin* Pin = (LibDrawPin*) DEntry; LibDrawPin* Pin = (LibDrawPin*) DEntry;
if( Pin->m_Attributs & PINNOTDRAW ) if( Pin->m_Attributs & PINNOTDRAW )
{ {
if( ActiveScreen->m_Type == SCHEMATIC_FRAME ) // if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
break; break;
} }
......
...@@ -270,7 +270,7 @@ void WinEDA_SchematicFrame::CreateScreens() ...@@ -270,7 +270,7 @@ void WinEDA_SchematicFrame::CreateScreens()
} }
if( g_RootSheet->m_AssociatedScreen == NULL ) if( g_RootSheet->m_AssociatedScreen == NULL )
{ {
g_RootSheet->m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); g_RootSheet->m_AssociatedScreen = new SCH_SCREEN();
g_RootSheet->m_AssociatedScreen->m_RefCount++; g_RootSheet->m_AssociatedScreen->m_RefCount++;
} }
g_RootSheet->m_AssociatedScreen->m_FileName = g_DefaultSchematicFileName; g_RootSheet->m_AssociatedScreen->m_FileName = g_DefaultSchematicFileName;
...@@ -279,7 +279,7 @@ void WinEDA_SchematicFrame::CreateScreens() ...@@ -279,7 +279,7 @@ void WinEDA_SchematicFrame::CreateScreens()
m_CurrentSheet->Push( g_RootSheet ); m_CurrentSheet->Push( g_RootSheet );
if( g_ScreenLib == NULL ) if( g_ScreenLib == NULL )
g_ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME ); g_ScreenLib = new SCH_SCREEN();
g_ScreenLib->SetZoom( 4 ); g_ScreenLib->SetZoom( 4 );
g_ScreenLib->m_UndoRedoCountMax = 10; g_ScreenLib->m_UndoRedoCountMax = 10;
} }
......
...@@ -23,25 +23,25 @@ ...@@ -23,25 +23,25 @@
/* class WinEDA_ViewlibFrame */ /* class WinEDA_ViewlibFrame */
/*****************************/ /*****************************/
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow ) COMMON_EVENTS_DRAWFRAME
EVT_SIZE( WinEDA_ViewlibFrame::OnSize ) EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate ) EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL, EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions ) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DrawFrame::Process_Zoom ) WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart ) WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER, EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions ) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -49,7 +49,8 @@ END_EVENT_TABLE() ...@@ -49,7 +49,8 @@ END_EVENT_TABLE()
/* Constructeur */ /* Constructeur */
/****************/ /****************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
LibraryStruct* Library, wxSemaphore* semaphore ) : LibraryStruct* Library,
wxSemaphore* semaphore ) :
WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ), WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize ) wxDefaultPosition, wxDefaultSize )
{ {
...@@ -67,7 +68,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent, ...@@ -67,7 +68,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
if( m_Semaphore ) if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP ); SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
SetBaseScreen( new SCH_SCREEN( VIEWER_FRAME ) ); SetBaseScreen( new SCH_SCREEN() );
GetScreen()->SetZoom( 16 ); GetScreen()->SetZoom( 16 );
if( Library == NULL ) if( Library == NULL )
......
...@@ -57,7 +57,6 @@ set(GERBVIEW_EXTRA_SRCS ...@@ -57,7 +57,6 @@ set(GERBVIEW_EXTRA_SRCS
../pcbnew/sel_layer.cpp ../pcbnew/sel_layer.cpp
../share/drawframe.cpp ../share/drawframe.cpp
../share/drawpanel.cpp
../share/setpage.cpp ../share/setpage.cpp
../share/wxprint.cpp ../share/wxprint.cpp
../share/zoom.cpp) ../share/zoom.cpp)
......
...@@ -29,7 +29,9 @@ bool WinEDA_App::OnInit() ...@@ -29,7 +29,9 @@ bool WinEDA_App::OnInit()
InitEDA_Appl( wxT( "gerbview" ) ); InitEDA_Appl( wxT( "gerbview" ) );
ScreenPcb = new PCB_SCREEN( PCB_FRAME ); ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
GetSettings(); GetSettings();
......
...@@ -33,29 +33,29 @@ public: ...@@ -33,29 +33,29 @@ public:
WinEDA_ViewlibFrame* m_ViewlibFrame; // Visualisation des composants WinEDA_ViewlibFrame* m_ViewlibFrame; // Visualisation des composants
WinEDA_CvpcbFrame* m_CvpcbFrame; WinEDA_CvpcbFrame* m_CvpcbFrame;
wxPoint m_HelpPos; wxPoint m_HelpPos;
wxSize m_HelpSize; wxSize m_HelpSize;
wxHtmlHelpController* m_HtmlCtrl; wxHtmlHelpController* m_HtmlCtrl;
wxConfig* m_EDA_Config; // Config courante (tailles et positions fenetres ...*/ wxConfig* m_EDA_Config; // Config courante (tailles et positions fenetres ...*/
wxConfig* m_EDA_CommonConfig; // common setup (language ...) */ wxConfig* m_EDA_CommonConfig; // common setup (language ...) */
wxString m_HelpFileName; wxString m_HelpFileName;
wxString m_CurrentOptionFile; // dernier fichier .cnf utilis wxString m_CurrentOptionFile; // dernier fichier .cnf utilis
wxString m_CurrentOptionFileDateAndTime; wxString m_CurrentOptionFileDateAndTime;
wxString m_BinDir; /* Chemin ou reside l'executable wxString m_BinDir; /* Chemin ou reside l'executable
* (utilis si KICAD non dfini)*/ * (utilis si KICAD non dfini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargs */ wxArrayString m_LastProject; /* liste des derniers projets chargs */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */ unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv;/* Chemin de kicad dfini dans la variable wxString m_KicadEnv; /* Chemin de kicad dfini dans la variable
* d'environnement KICAD, * d'environnement KICAD,
* typiquement /usr/local/kicad ou c:\kicad */ * typiquement /usr/local/kicad ou c:\kicad */
bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie
wxLocale* m_Locale; // Gestion de la localisation wxLocale* m_Locale; // Gestion de la localisation
int m_LanguageId; // indicateur de choix du langage ( 0 = defaut) int m_LanguageId; // indicateur de choix du langage ( 0 = defaut)
wxMenu* m_Language_Menu; // List menu for languages wxMenu* m_Language_Menu; // List menu for languages
wxString m_PdfBrowser; // Name of the selected browser, for browsing pdf datasheets wxString m_PdfBrowser; // Name of the selected browser, for browsing pdf datasheets
bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used) bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used)
public: public:
WinEDA_App(); WinEDA_App();
...@@ -75,7 +75,8 @@ public: ...@@ -75,7 +75,8 @@ public:
void SaveSettings(); void SaveSettings();
void SetLastProject( const wxString& FullFileName ); void SetLastProject( const wxString& FullFileName );
void WriteProjectConfig( const wxString& local_config_filename, void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List ); const wxString& GroupName,
PARAM_CFG_BASE** List );
bool ReadProjectConfig( const wxString& local_config_filename, bool ReadProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List, const wxString& GroupName, PARAM_CFG_BASE** List,
...@@ -85,5 +86,11 @@ public: ...@@ -85,5 +86,11 @@ public:
void WritePdfBrowserInfos(); void WritePdfBrowserInfos();
}; };
/*
* Use wxGetApp() to access WinEDA_App. It is not necessary to keep copies
* of the application pointer all over the place or worse yet in a global
* variable.
*/
DECLARE_APP(WinEDA_App);
#endif /* APPL_WXSTRUCT_H */ #endif /* APPL_WXSTRUCT_H */
...@@ -21,7 +21,7 @@ class SCH_SCREEN : public BASE_SCREEN ...@@ -21,7 +21,7 @@ class SCH_SCREEN : public BASE_SCREEN
public: public:
int m_RefCount; /*how many sheets reference this screen? int m_RefCount; /*how many sheets reference this screen?
* delete when it goes to zero. */ * delete when it goes to zero. */
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); SCH_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN(); ~SCH_SCREEN();
/** /**
...@@ -44,10 +44,9 @@ public: ...@@ -44,10 +44,9 @@ public:
return wxT( "SCH_SCREEN" ); return wxT( "SCH_SCREEN" );
} }
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { }; void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( SCH_ITEM* st ); bool CheckIfOnDrawList( SCH_ITEM* st );
......
...@@ -19,6 +19,20 @@ ...@@ -19,6 +19,20 @@
class SCH_ITEM; class SCH_ITEM;
/* Simple class for handling grid arrays. */
class GRID_TYPE
{
public:
int m_Id;
wxSize m_Size;
};
/* Declare array of wxSize for grid list implementation. */
#include <wx/dynarray.h>
WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray );
/****************************************************/ /****************************************************/
/* classe representant un ecran graphique de dessin */ /* classe representant un ecran graphique de dessin */
/****************************************************/ /****************************************************/
...@@ -98,6 +112,7 @@ public: ...@@ -98,6 +112,7 @@ public:
void AddMenuZoom( wxMenu* MasterMenu ); void AddMenuZoom( wxMenu* MasterMenu );
bool OnRightClick( wxMouseEvent& event ); bool OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event ); void Process_Popup_Zoom( wxCommandEvent& event );
void OnPopupGridSelect( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorRealPosition( const wxPoint& ScreenPos );
wxPoint CursorScreenPosition(); wxPoint CursorScreenPosition();
...@@ -206,7 +221,6 @@ public: ...@@ -206,7 +221,6 @@ public:
class BASE_SCREEN : public EDA_BaseStruct class BASE_SCREEN : public EDA_BaseStruct
{ {
public: public:
int m_Type; /* indicateur: type d'ecran */
wxPoint m_DrawOrg; /* offsets pour tracer le circuit sur l'ecran */ wxPoint m_DrawOrg; /* offsets pour tracer le circuit sur l'ecran */
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */ wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */ wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
...@@ -235,8 +249,9 @@ public: ...@@ -235,8 +249,9 @@ public:
/* Page description */ /* Page description */
Ki_PageDescr* m_CurrentSheetDesc; Ki_PageDescr* m_CurrentSheetDesc;
int m_ScreenNumber, m_NumberOfScreen;/* gestion hierarchie: numero de sousfeuille int m_ScreenNumber;
* et nombre de feuilles. Root: SheetNumber = 1 */ int m_NumberOfScreen;
wxString m_FileName; wxString m_FileName;
wxString m_Title; /* titre de la feuille */ wxString m_Title; /* titre de la feuille */
wxString m_Date; /* date de mise a jour */ wxString m_Date; /* date de mise a jour */
...@@ -256,17 +271,16 @@ private: ...@@ -256,17 +271,16 @@ private:
/* Valeurs du pas de grille et du zoom */ /* Valeurs du pas de grille et du zoom */
public: public:
wxSize m_Grid; /* pas de la grille (peut differer en X et Y) */ wxSize m_Grid; /* Current grid. */
wxSize* m_GridList; /* Liste des valeurs standard de grille */ GridArray m_GridList;
wxRealPoint m_UserGrid; /* pas de la grille utilisateur */ bool m_UserGridIsON;
int m_UserGridUnit; /* unit�grille utilisateur (0 = inch, 1 = mm */
int m_Diviseur_Grille; int m_Diviseur_Grille;
bool m_UserGridIsON; int* m_ZoomList; /* Liste des coefficients standard de zoom */
int* m_ZoomList; /* Liste des coefficients standard de zoom */ int m_Zoom; /* coeff de ZOOM */
int m_Zoom; /* coeff de ZOOM */
public: public:
BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE ); BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
~BASE_SCREEN(); ~BASE_SCREEN();
BASE_SCREEN* Next() const { return (BASE_SCREEN*) Pnext; } BASE_SCREEN* Next() const { return (BASE_SCREEN*) Pnext; }
...@@ -281,9 +295,10 @@ public: ...@@ -281,9 +295,10 @@ public:
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; } void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; } EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
void InitDatas(); /* Inits completes des variables */ void InitDatas(); /* Inits completes des variables */
wxSize ReturnPageSize();
int GetInternalUnits(); wxSize ReturnPageSize( void );
virtual int GetInternalUnits( void );
wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorRealPosition( const wxPoint& ScreenPos );
...@@ -334,11 +349,11 @@ public: ...@@ -334,11 +349,11 @@ public:
//----<grid stuff>---------------------------------------------------------- //----<grid stuff>----------------------------------------------------------
wxSize GetGrid(); /* retourne la grille */ wxSize GetGrid(); /* retourne la grille */
void SetGrid( const wxSize& size ); void SetGrid( const wxSize& size );
void SetGridList( wxSize* sizelist ); /* init liste des grilles (NULL terminated) */ void SetGrid( int );
void SetNextGrid(); /* ajuste le prochain coeff de grille */ void SetGridList( GridArray& sizelist );
void SetPreviousGrid(); /* ajuste le precedent coeff de grille */ void AddGrid( const GRID_TYPE& grid );
void SetFirstGrid(); /* ajuste la grille au mini*/ void AddGrid( const wxSize& size, int id );
void SetLastGrid(); /* ajuste la grille au max */ void AddGrid( const wxRealPoint& size, int units, int id );
/** /**
......
...@@ -217,7 +217,7 @@ enum main_id { ...@@ -217,7 +217,7 @@ enum main_id {
ID_POPUP_ENTER_MENU, ID_POPUP_ENTER_MENU,
ID_POPUP_ZOOM_START_RANGE, // first number ID_POPUP_ZOOM_START_RANGE, // first zoom id
ID_POPUP_CANCEL, ID_POPUP_CANCEL,
ID_POPUP_ZOOM_IN, ID_POPUP_ZOOM_IN,
ID_POPUP_ZOOM_OUT, ID_POPUP_ZOOM_OUT,
...@@ -237,6 +237,10 @@ enum main_id { ...@@ -237,6 +237,10 @@ enum main_id {
ID_POPUP_ZOOM_LEVEL_512, ID_POPUP_ZOOM_LEVEL_512,
ID_POPUP_ZOOM_LEVEL_1024, ID_POPUP_ZOOM_LEVEL_1024,
ID_POPUP_ZOOM_LEVEL_2048, ID_POPUP_ZOOM_LEVEL_2048,
ID_POPUP_ZOOM_UNUSED0,
ID_POPUP_ZOOM_UNUSED1,
ID_POPUP_ZOOM_END_RANGE, // last zoom id
ID_POPUP_GRID_PLUS, ID_POPUP_GRID_PLUS,
ID_POPUP_GRID_MOINS, ID_POPUP_GRID_MOINS,
ID_POPUP_GRID_SELECT, ID_POPUP_GRID_SELECT,
...@@ -253,9 +257,6 @@ enum main_id { ...@@ -253,9 +257,6 @@ enum main_id {
ID_POPUP_GRID_LEVEL_2, ID_POPUP_GRID_LEVEL_2,
ID_POPUP_GRID_LEVEL_1, ID_POPUP_GRID_LEVEL_1,
ID_POPUP_GRID_USER, ID_POPUP_GRID_USER,
ID_POPUP_ZOOM_UNUSED0,
ID_POPUP_ZOOM_UNUSED1,
ID_POPUP_ZOOM_END_RANGE, // last number
ID_POPUP_START_RANGE, // first number ID_POPUP_START_RANGE, // first number
......
...@@ -208,7 +208,7 @@ public: ...@@ -208,7 +208,7 @@ public:
int m_Route_Layer_BOTTOM; /* pour placement vias et routage 2 couches */ int m_Route_Layer_BOTTOM; /* pour placement vias et routage 2 couches */
public: public:
PCB_SCREEN( int idscreen ); PCB_SCREEN();
~PCB_SCREEN(); ~PCB_SCREEN();
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; } PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
...@@ -217,6 +217,8 @@ public: ...@@ -217,6 +217,8 @@ public:
void SetPreviousZoom(); void SetPreviousZoom();
void SetLastZoom(); void SetLastZoom();
virtual int GetInternalUnits( void );
/** /**
* Function GetCurItem * Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem(). * returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
......
...@@ -152,7 +152,6 @@ set(PCBNEW_SRCS ...@@ -152,7 +152,6 @@ set(PCBNEW_SRCS
set(PCBNEW_EXTRA_SRCS set(PCBNEW_EXTRA_SRCS
../share/drawframe.cpp ../share/drawframe.cpp
../share/drawpanel.cpp
../share/setpage.cpp ../share/setpage.cpp
../share/wxprint.cpp ../share/wxprint.cpp
../share/zoom.cpp) ../share/zoom.cpp)
......
...@@ -6,31 +6,49 @@ ...@@ -6,31 +6,49 @@
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#ifdef CVPCB
#include "cvpcb.h"
#endif
#include "trigo.h" #include "trigo.h"
#include "id.h"
/* 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 ) }
};
#define PCB_GRID_LIST_CNT ( sizeof( PcbGridList ) / sizeof( GRID_TYPE ) )
/**************************************************/ /**************************************************/
/* Class SCREEN: classe de gestion d'un affichage */ /* Class SCREEN: classe de gestion d'un affichage */
/***************************************************/ /***************************************************/
/* Constructeur de SCREEN */ /* Constructeur de SCREEN */
PCB_SCREEN::PCB_SCREEN( int idscreen ) : BASE_SCREEN( TYPE_SCREEN ) PCB_SCREEN::PCB_SCREEN( ) : BASE_SCREEN( TYPE_SCREEN )
{ {
size_t i;
// a zero terminated list // a zero terminated list
static const int zoom_list[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 0 }; static const int zoom_list[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256,
512, 1024, 2048, 0 };
for( i = 0; i < PCB_GRID_LIST_CNT; i++ )
AddGrid( PcbGridList[i] );
m_Type = idscreen; SetGrid( wxSize( 500, 500 ) ); /* pas de la grille en 1/10000 "*/
SetGridList( g_GridList );
SetZoomList( zoom_list ); SetZoomList( zoom_list );
m_Grid = wxSize( 500, 500 ); /* pas de la grille en 1/10000 "*/
Init(); Init();
} }
...@@ -41,7 +59,6 @@ PCB_SCREEN::~PCB_SCREEN() ...@@ -41,7 +59,6 @@ PCB_SCREEN::~PCB_SCREEN()
{ {
} }
/*************************/ /*************************/
void PCB_SCREEN::Init() void PCB_SCREEN::Init()
/*************************/ /*************************/
...@@ -50,9 +67,13 @@ void PCB_SCREEN::Init() ...@@ -50,9 +67,13 @@ void PCB_SCREEN::Init()
m_Active_Layer = COPPER_LAYER_N; /* ref couche active 0.. 31 */ m_Active_Layer = COPPER_LAYER_N; /* ref couche active 0.. 31 */
m_Route_Layer_TOP = CMP_N; /* ref couches par defaut pour vias (Cu.. Cmp) */ m_Route_Layer_TOP = CMP_N; /* ref couches par defaut pour vias (Cu.. Cmp) */
m_Route_Layer_BOTTOM = COPPER_LAYER_N; m_Route_Layer_BOTTOM = COPPER_LAYER_N;
m_Zoom = 128; /* valeur */ m_Zoom = 128; /* valeur */
} }
int PCB_SCREEN::GetInternalUnits( void )
{
return PCB_INTERNAL_UNIT;
}
/* Return true if a microvia can be put on board /* Return true if a microvia can be put on board
* A microvia ia a small via restricted to 2 near neighbour layers * A microvia ia a small via restricted to 2 near neighbour layers
...@@ -68,10 +89,10 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void ) ...@@ -68,10 +89,10 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void )
return false; // Obvious.. return false; // Obvious..
if( copperlayercnt < 4 ) if( copperlayercnt < 4 )
return false; // Only on multilayer boards.. return false; // Only on multilayer boards..
if( (m_Active_Layer == COPPER_LAYER_N) if( ( m_Active_Layer == COPPER_LAYER_N )
|| (m_Active_Layer == LAYER_CMP_N) || ( m_Active_Layer == LAYER_CMP_N )
|| (m_Active_Layer == g_DesignSettings.m_CopperLayerCount - 2) || ( m_Active_Layer == g_DesignSettings.m_CopperLayerCount - 2 )
|| (m_Active_Layer == LAYER_N_2) ) || ( m_Active_Layer == LAYER_N_2 ) )
return true; return true;
return false; return false;
...@@ -187,7 +208,7 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const ...@@ -187,7 +208,7 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const
for( int i = 0, mask = 1; i< 32; ++i, mask <<= 1 ) for( int i = 0, mask = 1; i< 32; ++i, mask <<= 1 )
{ {
if( !(m_LayerColor[i] & ITEM_NOT_SHOW) ) if( !( m_LayerColor[i] & ITEM_NOT_SHOW ) )
layerMask |= mask; layerMask |= mask;
} }
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "cvpcb.h" #include "cvpcb.h"
#endif #endif
#include "id.h"
/* Format des structures de sauvegarde type ASCII : /* Format des structures de sauvegarde type ASCII :
Structure PAD: Structure PAD:
...@@ -378,7 +381,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -378,7 +381,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
else else
g_UserGrid.y = g_UserGrid.x; g_UserGrid.y = g_UserGrid.x;
GetScreen()->m_UserGrid = g_UserGrid;
data = strtok( NULL, " =\n\r" ); data = strtok( NULL, " =\n\r" );
if( data ) if( data )
{ {
...@@ -386,7 +388,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -386,7 +388,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_UserGrid_Unit = MILLIMETRE; g_UserGrid_Unit = MILLIMETRE;
else else
g_UserGrid_Unit = INCHES; g_UserGrid_Unit = INCHES;
GetScreen()->m_UserGridUnit = g_UserGrid_Unit; GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit,
ID_POPUP_GRID_USER );
} }
continue; continue;
} }
...@@ -508,8 +511,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) ...@@ -508,8 +511,7 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT ); sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( aFile, text ); fprintf( aFile, text );
sprintf( text, "UserGridSize %lf %lf %s\n", sprintf( text, "UserGridSize %lf %lf %s\n", g_UserGrid.x, g_UserGrid.y,
aFrame->GetScreen()->m_UserGrid.x, aFrame->GetScreen()->m_UserGrid.y,
( g_UserGrid_Unit == 0 ) ? "INCH" : "mm" ); ( g_UserGrid_Unit == 0 ) ? "INCH" : "mm" );
fprintf( aFile, text ); fprintf( aFile, text );
......
This diff is collapsed.
...@@ -174,8 +174,7 @@ bool Read_Config( const wxString& project_name ) ...@@ -174,8 +174,7 @@ bool Read_Config( const wxString& project_name )
if( ScreenPcb ) if( ScreenPcb )
{ {
ScreenPcb->m_Diviseur_Grille = Pcbdiv_grille; ScreenPcb->m_Diviseur_Grille = Pcbdiv_grille;
ScreenPcb->m_UserGrid = g_UserGrid; ScreenPcb->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
ScreenPcb->m_UserGridUnit = g_UserGrid_Unit;
} }
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth; g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;
......
This diff is collapsed.
...@@ -45,7 +45,7 @@ bool WinEDA_App::OnInit() ...@@ -45,7 +45,7 @@ bool WinEDA_App::OnInit()
return false; return false;
} }
ScreenPcb = new PCB_SCREEN( PCB_FRAME ); ScreenPcb = new PCB_SCREEN();
GetSettings(); GetSettings();
if( argc > 1 ) if( argc > 1 )
......
...@@ -50,18 +50,6 @@ ...@@ -50,18 +50,6 @@
eda_global wxArrayString g_LibName_List; // library list to load eda_global wxArrayString g_LibName_List; // library list to load
eda_global wxSize g_GridList[]
#ifdef MAIN
= {
wxSize( 1000, 1000 ), wxSize( 500, 500 ), wxSize( 250, 250 ), wxSize( 200, 200 ),
wxSize( 100, 100 ), wxSize( 50, 50 ), wxSize( 25, 25 ), wxSize( 20, 20 ),
wxSize( 10, 10 ), wxSize( 5, 5 ), wxSize( 2, 2 ), wxSize( 1, 1 ),
wxSize( -1, -1 ), wxSize( 0, 0 )
}
#endif
;
#define UNDELETE_STACK_SIZE 10 #define UNDELETE_STACK_SIZE 10
eda_global BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items eda_global BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -15,24 +14,28 @@ ...@@ -15,24 +14,28 @@
#include "protos.h" #include "protos.h"
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include "id.h"
#include "set_grid.h" #include "set_grid.h"
/****************************************************************/ /****************************************************************/
void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event) void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event)
/****************************************************************/ /****************************************************************/
{ {
double dtmp = 0; double dtmp = 0;
g_UserGrid_Unit = m_UnitGrid->GetSelection(); g_UserGrid_Unit = m_UnitGrid->GetSelection();
m_OptGridSizeX->GetValue().ToDouble(&dtmp); g_UserGrid.x = dtmp; m_OptGridSizeX->GetValue().ToDouble( &dtmp );
m_OptGridSizeY->GetValue().ToDouble(&dtmp); g_UserGrid.y = dtmp; g_UserGrid.x = dtmp;
m_OptGridSizeY->GetValue().ToDouble( &dtmp );
g_UserGrid.y = dtmp;
m_Parent->GetScreen()->m_UserGrid = g_UserGrid; m_Parent->GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit,
m_Parent->GetScreen()->m_UserGridUnit = g_UserGrid_Unit; ID_POPUP_GRID_USER );
EndModal(1); EndModal(1);
m_Parent->DrawPanel->Refresh(TRUE); m_Parent->DrawPanel->Refresh( TRUE );
} }
...@@ -42,7 +45,7 @@ void WinEDA_BasePcbFrame::InstallGridFrame(const wxPoint & pos) ...@@ -42,7 +45,7 @@ void WinEDA_BasePcbFrame::InstallGridFrame(const wxPoint & pos)
/************************************************************/ /************************************************************/
{ {
WinEDA_PcbGridFrame * GridFrame = WinEDA_PcbGridFrame * GridFrame =
new WinEDA_PcbGridFrame(this, pos); new WinEDA_PcbGridFrame( this, pos );
GridFrame->ShowModal(); GridFrame->Destroy(); GridFrame->ShowModal(); GridFrame->Destroy();
} }
...@@ -77,21 +80,20 @@ WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( ) ...@@ -77,21 +80,20 @@ WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( )
} }
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent, WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
const wxPoint& pos, const wxPoint& pos,
wxWindowID id, const wxString& caption, const wxSize& size, long style ) wxWindowID id,
const wxString& caption,
const wxSize& size, long style )
{ {
wxString msg; wxString msg;
PCB_SCREEN * screen; PCB_SCREEN * screen;
m_Parent = parent;
screen = (PCB_SCREEN*)(m_Parent->GetScreen());
g_UserGrid = screen->m_UserGrid; m_Parent = parent;
g_UserGrid_Unit = screen->m_UserGridUnit; screen = (PCB_SCREEN*)(m_Parent->GetScreen());
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
if ( screen->m_UserGridUnit != INCHES ) if ( g_UserGrid_Unit != INCHES )
m_UnitGrid->SetSelection(1); m_UnitGrid->SetSelection(1);
msg.Printf( wxT("%.4f"), g_UserGrid.x ); msg.Printf( wxT("%.4f"), g_UserGrid.x );
...@@ -130,7 +132,7 @@ bool WinEDA_PcbGridFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin ...@@ -130,7 +132,7 @@ bool WinEDA_PcbGridFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin
*/ */
void WinEDA_PcbGridFrame::CreateControls() void WinEDA_PcbGridFrame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin WinEDA_PcbGridFrame content construction ////@begin WinEDA_PcbGridFrame content construction
// Generated by DialogBlocks, 17/08/2006 09:27:19 (unregistered) // Generated by DialogBlocks, 17/08/2006 09:27:19 (unregistered)
...@@ -232,7 +234,7 @@ void WinEDA_PcbGridFrame::OnCancelClick( wxCommandEvent& event ) ...@@ -232,7 +234,7 @@ void WinEDA_PcbGridFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGridFrame. ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGridFrame.
// Before editing this code, remove the block markers. // Before editing this code, remove the block markers.
event.Skip(); event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGridFrame. ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGridFrame.
} }
This diff is collapsed.
This diff is collapsed.
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
WinEDA_App* parent, const wxString& title, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) : const wxPoint& pos, const wxSize& size,
long style ) :
WinEDA_BasicFrame( father, idtype, parent, title, pos, size, style ) WinEDA_BasicFrame( father, idtype, parent, title, pos, size, style )
{ {
wxSize minsize; wxSize minsize;
...@@ -118,7 +119,8 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame() ...@@ -118,7 +119,8 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
/****************************************/ /****************************************/
{ {
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL ! if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
m_Parent->m_EDA_Config->Write( wxT( "AutoPAN" ), DrawPanel->m_AutoPAN_Enable ); m_Parent->m_EDA_Config->Write( wxT( "AutoPAN" ),
DrawPanel->m_AutoPAN_Enable );
} }
...@@ -135,7 +137,7 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) ...@@ -135,7 +137,7 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
ID_PREFERENCES_FONT_DIALOG, ID_PREFERENCES_FONT_DIALOG,
_( "Dialog boxes" ), _( "Dialog boxes" ),
fonts_xpm ); fonts_xpm );
ADD_MENUITEM( fontmenu, ADD_MENUITEM( fontmenu,
ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_INFOSCREEN,
_( "Lists" ), _( "Lists" ),
...@@ -150,8 +152,7 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu ) ...@@ -150,8 +152,7 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
fontmenu, fontmenu,
ID_PREFERENCES_FONT, ID_PREFERENCES_FONT,
_( "&Font" ), _( "&Font" ),
_( _( "Choose font type and size for dialogs, infos and status box" ),
"Choose font type and size for dialogs, infos and status box" ),
fonts_xpm ); fonts_xpm );
} }
...@@ -273,17 +274,14 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) ...@@ -273,17 +274,14 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
if( m_SelGridBox == NULL ) if( m_SelGridBox == NULL )
return; // Should not occurs return; // Should not occurs
int id = m_SelGridBox->GetChoice(); BASE_SCREEN* screen = GetBaseScreen();
if( id < 0 )
return;
BASE_SCREEN* screen = GetBaseScreen();
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition(); screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
wxSize grid = screen->GetGrid(); wxSize current_grid = screen->GetGrid();
screen->SetGrid( g_GridList[id] ); screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 );
wxSize newgrid = screen->GetGrid(); wxSize selected_grid = screen->GetGrid();
if( newgrid.x != grid.x || newgrid.y != grid.y )
if( selected_grid != current_grid )
Recadre_Trace( FALSE ); Recadre_Trace( FALSE );
} }
...@@ -464,19 +462,22 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv ) ...@@ -464,19 +462,22 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
{ {
opt_size.x = 0; opt_size.x = 0;
opt_size.y = m_OptionsToolBar->GetSize().y; opt_size.y = m_OptionsToolBar->GetSize().y;
m_OptionsToolBar->SetSize( Auxtoolbar_size.x, 0, size.x, opt_size.y ); m_OptionsToolBar->SetSize( Auxtoolbar_size.x, 0,
size.x, opt_size.y );
} }
else else
{ {
opt_size.x = m_OptionsToolBar->GetSize().x; opt_size.x = m_OptionsToolBar->GetSize().x;
opt_size.y = 0; opt_size.y = 0;
m_OptionsToolBar->SetSize( 0, Auxtoolbar_size.y, opt_size.x, size.y ); m_OptionsToolBar->SetSize( 0, Auxtoolbar_size.y,
opt_size.x, size.y );
} }
} }
if( DrawPanel ) if( DrawPanel )
{ {
DrawPanel->SetSize( size.x - Vtoolbar_size.x - opt_size.x, size.y - opt_size.y - 1 ); DrawPanel->SetSize( size.x - Vtoolbar_size.x - opt_size.x,
size.y - opt_size.y - 1 );
DrawPanel->Move( opt_size.x, opt_size.y + Auxtoolbar_size.y + 1 ); DrawPanel->Move( opt_size.x, opt_size.y + Auxtoolbar_size.y + 1 );
} }
...@@ -515,8 +516,8 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id, ...@@ -515,8 +516,8 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
#ifdef PCBNEW #ifdef PCBNEW
// handle color changes for transitions in and out of ID_TRACK_BUTT // handle color changes for transitions in and out of ID_TRACK_BUTT
if( (m_ID_current_state==ID_TRACK_BUTT && id!=ID_TRACK_BUTT) if( ( m_ID_current_state==ID_TRACK_BUTT && id!=ID_TRACK_BUTT )
|| (m_ID_current_state!=ID_TRACK_BUTT && id==ID_TRACK_BUTT) ) || ( m_ID_current_state!=ID_TRACK_BUTT && id==ID_TRACK_BUTT ) )
{ {
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
redraw = true; redraw = true;
...@@ -826,9 +827,9 @@ void WinEDA_DrawFrame::AdjustScrollBars() ...@@ -826,9 +827,9 @@ void WinEDA_DrawFrame::AdjustScrollBars()
DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit, DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit,
DrawPanel->m_Scroll_unit, DrawPanel->m_Scroll_unit,
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.x,
screen->m_ScrollbarNumber.y, screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.x,
screen->m_ScrollbarPos.y, TRUE ); screen->m_ScrollbarPos.y, TRUE );
} }
......
This diff is collapsed.
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