Improved grid implementation, 3D viewer debug assertion fix, moved drawpanel.cpp to common library, and added WinEDA_Appl declaration.

This commit is contained in:
stambaughw 2008-12-05 16:03:05 +00:00
parent 4ce4e6aa6c
commit f966097d5a
35 changed files with 1090 additions and 1147 deletions

View File

@ -504,7 +504,6 @@ void Pcb3D_GLCanvas::OnSize( wxSizeEvent& event )
if( GetContext() )
#endif
{
SetCurrent();
glViewport( 0, 0, (GLint) w, (GLint) h );
}
@ -536,8 +535,6 @@ void Pcb3D_GLCanvas::InitGL()
ZBottom = 1.0; ZTop = 10.0;
}
SetCurrent();
/* set viewing projection */
double ratio_HV = (double) size.x / size.y; // Ratio largeur /hauteur de la fenetre d'affichage
glMatrixMode( GL_PROJECTION );
@ -595,8 +592,6 @@ void Pcb3D_GLCanvas::SetLights()
double light;
GLfloat light_color[4];
SetCurrent();
/* set viewing projection */
light_color[3] = 1.0;
GLfloat Z_axis_pos[4] = { 0.0, 0.0, 3.0, 0.0 };

View File

@ -5,6 +5,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
@ -42,7 +55,6 @@ email address.
results are same, but using segments can be better (faster redraw time) for polygons having a lot
of segments (more than 10000)
>>>>>>> .r1441
2008-Dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++build fixes

View File

@ -17,6 +17,7 @@ set(COMMON_SRCS
dcsvg.cpp
displlst.cpp
dlist.cpp
drawpanel.cpp
drawtxt.cpp
edaappl.cpp
eda_dde.cpp

View File

@ -10,23 +10,34 @@
#include "common.h"
/* Implement wxSize array for grid list implementation. */
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY( GridArray );
/* defines locaux */
#define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */
/*******************************************************/
/* Class BASE_SCREEN: classe de gestion d'un affichage */
/*******************************************************/
BASE_SCREEN::BASE_SCREEN( int idscreen, KICAD_T aType ) :
EDA_BaseStruct( aType )
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
{
EEDrawList = NULL; /* Schematic items list */
m_Type = idscreen;
m_ZoomList = NULL;
m_GridList = NULL;
m_UndoList = NULL;
m_RedoList = NULL;
EEDrawList = NULL; /* Schematic items list */
m_ZoomList = NULL;
m_UndoList = NULL;
m_RedoList = NULL;
m_UndoRedoCountMax = 1;
m_FirstRedraw = TRUE;
m_FirstRedraw = TRUE;
m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* Default grid size */
m_UserGridIsON = FALSE;
m_Diviseur_Grille = 1;
m_Center = true;
m_CurrentSheetDesc = &g_Sheet_A4;
InitDatas();
}
@ -38,9 +49,6 @@ BASE_SCREEN::~BASE_SCREEN()
if( m_ZoomList )
free( m_ZoomList );
if( m_GridList )
free( m_GridList );
ClearUndoRedoList();
}
@ -49,35 +57,6 @@ BASE_SCREEN::~BASE_SCREEN()
void BASE_SCREEN::InitDatas()
/*******************************/
{
m_ScreenNumber = m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* Default grid size */
m_UserGrid = g_UserGrid; /* User Default grid size */
m_UserGridIsON = FALSE;
m_UserGridUnit = g_UserGrid_Unit;
m_Diviseur_Grille = 1;
m_Center = TRUE;
/* Init draw offset and default page size */
switch( m_Type )
{
case SCHEMATIC_FRAME:
m_Center = FALSE;
m_CurrentSheetDesc = &g_Sheet_A4;
break;
default:
case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME:
case PCB_FRAME:
m_CurrentSheetDesc = &g_Sheet_A4;
break;
case GERBER_FRAME:
m_CurrentSheetDesc = &g_Sheet_GERBER;
break;
}
if( m_Center )
{
m_Curseur.x = m_Curseur.y = 0;
@ -100,11 +79,30 @@ void BASE_SCREEN::InitDatas()
SetCurItem( NULL );
/* indicateurs divers */
m_FlagRefreshReq = 0; /* Redraw screen requste flag */
m_FlagModified = 0; // Set when any change is made on borad
m_FlagSave = 1; // Used in auto save: set when an auto save is made
m_FlagRefreshReq = 0; /* Redraw screen requste flag */
m_FlagModified = 0; // Set when any change is made on borad
m_FlagSave = 1; // Used in auto save: set when an auto save is made
}
/*
* Get screen units scalar.
*
* Default implimentation returns scalar used for schematic screen. The
* internal units used by the schematic screen is 1 mil (0.001"). Override
* this in derived classes that require internal units other than 1 mil.
*/
int BASE_SCREEN::GetInternalUnits( void )
{
return EESCHEMA_INTERNAL_UNIT;
}
wxSize BASE_SCREEN::ReturnPageSize( void )
{
int internal_units = GetInternalUnits();
return wxSize( m_CurrentSheetDesc->m_Size.x * (internal_units / 1000),
m_CurrentSheetDesc->m_Size.y * (internal_units / 1000) );
}
/******************************************************************/
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
@ -124,56 +122,6 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
}
/***************************************/
int BASE_SCREEN::GetInternalUnits()
/***************************************/
{
switch( m_Type )
{
default:
case SCHEMATIC_FRAME:
return EESCHEMA_INTERNAL_UNIT;
break;
case GERBER_FRAME:
case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME:
case PCB_FRAME:
return PCB_INTERNAL_UNIT;
}
}
/*****************************************/
wxSize BASE_SCREEN::ReturnPageSize()
/*****************************************/
/* Return in internal units the page size
* Note: the page size is handled in 1/1000 ", not in internal units
*/
{
wxSize PageSize;
switch( m_Type )
{
default:
case SCHEMATIC_FRAME:
PageSize = m_CurrentSheetDesc->m_Size;
break;
case GERBER_FRAME:
case CVPCB_DISPLAY_FRAME:
case MODULE_EDITOR_FRAME:
case PCB_FRAME:
PageSize.x = m_CurrentSheetDesc->m_Size.x * (PCB_INTERNAL_UNIT / 1000);
PageSize.y = m_CurrentSheetDesc->m_Size.y * (PCB_INTERNAL_UNIT / 1000);
break;
}
return PageSize;
}
/**************************************************/
void BASE_SCREEN::SetZoomList( const int* zoomlist )
/**************************************************/
@ -281,31 +229,16 @@ void BASE_SCREEN::SetLastZoom()
/********************************************/
void BASE_SCREEN::SetGridList( wxSize* gridlist )
void BASE_SCREEN::SetGridList( GridArray& gridlist )
/********************************************/
/* init liste des zoom (NULL terminated)
*/
{
int ii, nbitems;
wxSize* grid;
if( !m_GridList.IsEmpty() )
m_GridList.Clear();
// Decompte des items
for( nbitems = 0, grid = gridlist; ; grid++, nbitems++ )
{
if( (grid->x <= 0) || (grid->y <= 0) )
break;
}
// Init liste
if( m_GridList )
free( m_GridList );
m_GridList = (wxSize*) MyZMalloc( nbitems * sizeof(wxSize) );
for( ii = 0, grid = gridlist; ii < nbitems; grid++, ii++ )
{
m_GridList[ii] = *grid;
}
m_GridList = gridlist;
}
@ -313,125 +246,121 @@ void BASE_SCREEN::SetGridList( wxSize* gridlist )
void BASE_SCREEN::SetGrid( const wxSize& size )
/**********************************************/
{
if( m_GridList == NULL )
return;
wxASSERT( !m_GridList.IsEmpty() );
if( (size.x <= 0) || (size.y <= 0) )
size_t i;
for( i = 0; i < m_GridList.GetCount(); i++ )
{
m_UserGrid = g_UserGrid;
m_UserGridIsON = TRUE;
if( m_GridList[i].m_Size == size )
{
m_Grid = m_GridList[i].m_Size;
return;
}
}
m_Grid = m_GridList[0].m_Size;
wxLogWarning( _( "Grid size( %d, %d ) not in grid list, falling back to " \
"grid size( %d, %d )." ),
size.x, size.y, m_Grid.x, m_Grid.y );
}
/* Set grid size from command ID. */
void BASE_SCREEN::SetGrid( int id )
{
wxASSERT( !m_GridList.IsEmpty() );
size_t i;
for( i = 0; i < m_GridList.GetCount(); i++ )
{
if( m_GridList[i].m_Id == id )
{
m_Grid = m_GridList[i].m_Size;
return;
}
}
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 );
}
void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
{
size_t i;
for( i = 0; i < m_GridList.GetCount(); i++ )
{
if( m_GridList[i].m_Size == grid.m_Size )
{
wxLogDebug( wxT( "Discarding duplicate grid size( %d, %d )." ),
grid.m_Size.x, grid.m_Size.y );
return;
}
if( m_GridList[i].m_Id == grid.m_Id )
{
wxLogDebug( wxT( "Changing grid ID %d from size( %d, %d ) to " \
"size( %d, %d )." ),
grid.m_Id, m_GridList[i].m_Size.x,
m_GridList[i].m_Size.y, grid.m_Size.x, grid.m_Size.y );
m_GridList[i].m_Size = grid.m_Size;
return;
}
}
wxLogDebug( wxT( "Adding grid ID %d size( %d, %d ) to grid list." ),
grid.m_Id, grid.m_Size.x, grid.m_Size.y );
m_GridList.Add( grid );
}
void BASE_SCREEN::AddGrid( const wxSize& size, int id )
{
GRID_TYPE grid;
grid.m_Size = size;
grid.m_Id = id;
AddGrid( grid );
}
void BASE_SCREEN::AddGrid( const wxRealPoint& size, int units, int id )
{
double x, y;
wxSize new_size;
GRID_TYPE new_grid;
if( units == MILLIMETRE )
{
x = size.x / 25.4;
y = size.y / 25.4;
}
else if( units == CENTIMETRE )
{
x = size.x / 2.54;
y = size.y / 2.54;
}
else
{
m_Grid = size;
m_UserGridIsON = FALSE;
x = size.x;
y = size.y;
}
}
new_size = wxSize( (int) round( x * (double) GetInternalUnits() ),
(int) round( y * (double) GetInternalUnits() ) );
new_grid.m_Id = id;
new_grid.m_Size = new_size;
AddGrid( new_grid );
}
/*********************************/
wxSize BASE_SCREEN::GetGrid()
/*********************************/
{
wxSize grid = m_Grid;
double xx, scale;
if( m_GridList == NULL )
return wxSize( 1, 1 );
if( m_UserGridIsON || m_Grid.x < 0 || m_Grid.y < 0 )
{
if( m_UserGridUnit == INCHES )
scale = 10000;
else
scale = 10000 / 25.4;
xx = m_UserGrid.x * scale;
grid.x = (int) (xx + 0.5);
xx = m_UserGrid.y * scale;
grid.y = (int) (xx + 0.5);
}
return grid;
}
/*********************************/
void BASE_SCREEN::SetNextGrid()
/*********************************/
/* Selectionne la prochaine grille
*/
{
int ii;
if( m_GridList == NULL )
return;
for( ii = 0; ; ii++ )
{
if( m_GridList[ii].x <= 0 )
break;
if( (m_Grid.x == m_GridList[ii].x) && (m_Grid.y == m_GridList[ii].y) )
break;
}
if( (m_GridList[ii].x > 0) && (ii > 0) )
m_Grid = m_GridList[ii - 1];
}
/*************************************/
void BASE_SCREEN::SetPreviousGrid()
/*************************************/
/* Selectionne le precedent coeff de grille
*/
{
int ii;
if( m_GridList == NULL )
return;
for( ii = 0; ; ii++ )
{
if( m_GridList[ii].x <= 0 )
break;
if( (m_Grid.x == m_GridList[ii].x) && (m_Grid.y == m_GridList[ii].y) )
break;
}
if( (m_GridList[ii].x > 0) && (m_GridList[ii + 1].x > 0) )
m_Grid = m_GridList[ii + 1];
}
/**********************************/
void BASE_SCREEN::SetFirstGrid()
/**********************************/
/* ajuste le coeff de grille a 1
*/
{
if( m_GridList == NULL )
return;
int ii = 0;
while( m_GridList[ii].x > 0 )
ii++;
m_Grid = m_GridList[ii - 1];
}
/**********************************/
void BASE_SCREEN::SetLastGrid()
/**********************************/
/* ajuste le coeff de grille au max
*/
{
if( m_GridList == NULL )
return;
m_Grid = m_GridList[0];
return m_Grid;
}

View File

@ -13,14 +13,6 @@
#include "macros.h"
#include "id.h"
#ifdef PCBNEW
#include "pcbstruct.h"
#endif
#ifdef EESCHEMA
#include "program.h"
#endif
// Local defines
#define CURSOR_SIZE 12 // Cursor size in pixels
@ -36,18 +28,20 @@ static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by WinEDA_DrawPanel
BEGIN_EVENT_TABLE( WinEDA_DrawPanel, wxScrolledWindow )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
EVT_PAINT( WinEDA_DrawPanel::OnPaint )
EVT_SIZE( WinEDA_DrawPanel::OnSize )
EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving )
EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent )
EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent )
EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent )
EVT_PAINT( WinEDA_DrawPanel::OnPaint )
EVT_SIZE( WinEDA_DrawPanel::OnSize )
EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground )
EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll )
EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawPanel::Process_Popup_Zoom )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
WinEDA_DrawPanel::Process_Popup_Zoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
WinEDA_DrawPanel::OnPopupGridSelect )
END_EVENT_TABLE()
/************************************************************************/
@ -80,8 +74,9 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
ManageCurseur = NULL;
ForceCloseManageCurseur = NULL;
if( m_Parent->m_Parent->m_EDA_Config )
m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read( wxT( "AutoPAN" ), TRUE );
if( wxGetApp().m_EDA_Config )
m_AutoPAN_Enable = wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ),
TRUE );
m_AutoPAN_Request = FALSE;
m_Block_Enable = FALSE;
@ -666,7 +661,7 @@ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg )
if( Screen == NULL )
return;
if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) )
if( ( g_DrawBgColor != WHITE ) && ( g_DrawBgColor != BLACK ) )
g_DrawBgColor = BLACK;
if( g_DrawBgColor == WHITE )
@ -773,14 +768,8 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
size.x *= zoom;
size.y *= zoom;
pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits;
pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits;
if( screen->m_UserGridUnit != INCHES )
{
pasx /= 25.4;
pasy /= 25.4;
}
pasx = screen->m_Grid.x * m_Parent->m_InternalUnits;
pasy = screen->m_Grid.y * m_Parent->m_InternalUnits;
if( drawgrid )
{
@ -789,15 +778,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
GRSetColorPen( DC, color );
for( ii = 0; ; ii++ )
{
xg = screen->m_UserGridIsON ? (int) ( (ii * pasx) + 0.5 )
: ii * pas_grille_affichee.x;
xg = ii * pas_grille_affichee.x;
int xpos = org.x + xg;
for( jj = 0; ; jj++ )
{
yg = screen->m_UserGridIsON ? (int) ( (jj * pasy) + 0.5 )
: jj * pas_grille_affichee.y;
yg = jj * pas_grille_affichee.y;
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
if( yg > size.y )
break;
@ -848,14 +834,18 @@ void WinEDA_DrawPanel::m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode )
/* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC,
m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y,
m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y,
m_Parent->m_Auxiliary_Axis_Position.x,
-screen->ReturnPageSize().y,
m_Parent->m_Auxiliary_Axis_Position.x,
screen->ReturnPageSize().y,
0, Color );
/* Draw the X axis */
GRDashedLine( &m_ClipBox, DC,
-screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y,
screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y,
-screen->ReturnPageSize().x,
m_Parent->m_Auxiliary_Axis_Position.y,
screen->ReturnPageSize().x,
m_Parent->m_Auxiliary_Axis_Position.y,
0, Color );
}

View File

@ -52,7 +52,6 @@ set(CVPCB_EXTRA_SRCS
../pcbnew/tracemod.cpp
../share/drawframe.cpp
../share/drawpanel.cpp
../share/zoom.cpp)
if(WIN32)

View File

@ -12,20 +12,19 @@
#include "protos.h"
#define BITMAP wxBitmap
/*****************************************************************/
/* Construction de la table des evenements pour WinEDA_DrawFrame */
/*****************************************************************/
BEGIN_EVENT_TABLE( WinEDA_DisplayFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DisplayFrame::Process_Zoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_DisplayFrame::OnCloseWindow )
EVT_SIZE( WinEDA_DrawFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DisplayFrame::Process_Zoom )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_DisplayFrame::InstallOptionsDisplay )
EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame )
END_EVENT_TABLE()
@ -35,13 +34,15 @@ END_EVENT_TABLE()
WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size, long style ) :
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos, size, style )
const wxPoint& pos,
const wxSize& size, long style ) :
WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos,
size, style )
{
m_FrameName = wxT( "CmpFrame" );
m_Draw_Axis = TRUE; // TRUE if we want the axis
m_Draw_Grid = TRUE; // TRUE if we want the grid
m_Draw_Sheet_Ref = FALSE; // TRUE if we want the sheet references
m_Draw_Axis = TRUE; // TRUE if we want the axis
m_Draw_Grid = TRUE; // TRUE if we want the grid
m_Draw_Sheet_Ref = FALSE; // TRUE if we want the sheet references
// Give an icon
#ifdef __WINDOWS__
@ -53,7 +54,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent,
m_Pcb = new BOARD( NULL, this );
SetBaseScreen( new PCB_SCREEN( CVPCB_DISPLAY_FRAME ) );
SetBaseScreen( new PCB_SCREEN() );
GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
@ -114,26 +115,31 @@ void WinEDA_DisplayFrame::ReCreateHToolbar()
SetToolBar( m_HToolBar );
m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString,
BITMAP( display_options_xpm ),
_( "Display Options" ) );
wxBitmap( display_options_xpm ),
_( "Display Options" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
_( "zoom + (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString,
wxBitmap( zoom_in_xpm ),
_( "zoom + (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
_( "zoom - (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
wxBitmap( zoom_out_xpm ),
_( "zoom - (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ),
_( "redraw (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
wxBitmap( zoom_redraw_xpm ),
_( "redraw (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ),
_( "1:1 zoom" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "1:1 zoom" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, BITMAP( show_3d_xpm ),
_( "1:1 zoom" ) );
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString,
wxBitmap( show_3d_xpm ),
_( "1:1 zoom" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
@ -260,8 +266,8 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
RedrawActiveWindow( DC, TRUE );
}
if( (oldpos.x != GetScreen()->m_Curseur.x)
|| (oldpos.y != GetScreen()->m_Curseur.y) )
if( ( oldpos.x != GetScreen()->m_Curseur.x )
|| ( oldpos.y != GetScreen()->m_Curseur.y ) )
{
if( flagcurseur != 2 )
{

View File

@ -101,7 +101,6 @@ set(EESCHEMA_SRCS
set(EESCHEMA_EXTRA_SRCS
../share/drawframe.cpp
../share/drawpanel.cpp
../share/setpage.cpp
../share/svg_print.cpp
../share/wxprint.cpp

View File

@ -23,7 +23,6 @@
#endif
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -104,7 +103,8 @@ bool DrawSheetStruct::Save( FILE* f ) const
/* Generation de la liste des 2 textes (sheetname et filename) */
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;
}
@ -112,7 +112,8 @@ bool DrawSheetStruct::Save( FILE* f ) const
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;
}
@ -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 )
/**************************************************************************************/
/* Draw the hierarchical sheet shape */
@ -335,7 +337,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
SheetLabelStruct = m_Label;
while( SheetLabelStruct != NULL )
{
if( !(SheetLabelStruct->m_Flags & IS_MOVED) )
if( !( SheetLabelStruct->m_Flags & IS_MOVED ) )
SheetLabelStruct->Draw( panel, DC, offset, DrawMode, Color );
SheetLabelStruct = SheetLabelStruct->Next();
}
@ -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".
@ -476,7 +479,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame )
}
else
{
m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++;
success = frame->LoadOneEEFile( m_AssociatedScreen, m_FileName );
if( success )
@ -544,7 +547,8 @@ void DrawSheetStruct::SetFileName( const wxString& aFilename )
* - 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 )
return true;
@ -629,7 +633,7 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxStr
//just make a new screen if needed.
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_FileName = aFileName;

View File

@ -1,6 +1,5 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -8,6 +7,7 @@
#include "general.h"
#include "protos.h"
#include "id.h"
/******************************************************************/
@ -47,7 +47,8 @@ void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/* place the struct in EEDrawList.
* 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 )
@ -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 */
/* 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 */
SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
BASE_SCREEN( screentype, aType )
SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
{
size_t i;
EEDrawList = NULL; /* Schematic items list */
m_Zoom = 32;
m_Grid = wxSize( 50, 50 ); /* pas de la grille */
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_RefCount = 0;
m_RefCount = 0;
m_Center = false;
InitDatas();
}
@ -102,7 +123,6 @@ SCH_SCREEN::~SCH_SCREEN()
FreeDrawList();
}
/***********************************/
void SCH_SCREEN::FreeDrawList()
/***********************************/
@ -236,8 +256,7 @@ void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
m_List.Add( testscreen );
#ifdef DEBUG
printf( "EDA_ScreenList::AddScreenToList adding %s\n",
(const char*) testscreen->m_FileName.mb_str(
) );
(const char*) testscreen->m_FileName.mb_str() );
#endif
}
@ -316,7 +335,8 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
m_count = count;
m_index = 0;
if( m_List )
free( m_List );m_List = NULL;
free( m_List );
m_List = NULL;
count *= sizeof(DrawSheetPath);
m_List = (DrawSheetPath*) MyZMalloc( count );
memset( (void*) m_List, 0, count );
@ -340,4 +360,3 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
}
m_currList.Pop();
}

View File

@ -3,7 +3,6 @@
/****************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
@ -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(
{
SCH_SCREEN* NewScreen;
NewScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
NewScreen = new SCH_SCREEN();
NewScreen->SetRefreshReq();
if( OldScreen )

View File

@ -104,17 +104,6 @@ typedef enum {
FILE_SAVE_NEW
} 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 */
eda_global wxArrayString g_LibName_List; // library list (short filenames) to load

View File

@ -282,7 +282,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
LibDrawPin* Pin = (LibDrawPin*) DEntry;
if( Pin->m_Attributs & PINNOTDRAW )
{
if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
// if( ActiveScreen->m_Type == SCHEMATIC_FRAME )
break;
}

View File

@ -270,7 +270,7 @@ void WinEDA_SchematicFrame::CreateScreens()
}
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_FileName = g_DefaultSchematicFileName;
@ -279,7 +279,7 @@ void WinEDA_SchematicFrame::CreateScreens()
m_CurrentSheet->Push( g_RootSheet );
if( g_ScreenLib == NULL )
g_ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME );
g_ScreenLib = new SCH_SCREEN();
g_ScreenLib->SetZoom( 4 );
g_ScreenLib->m_UndoRedoCountMax = 10;
}

View File

@ -23,25 +23,25 @@
/* class WinEDA_ViewlibFrame */
/*****************************/
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
END_EVENT_TABLE()
@ -49,7 +49,8 @@ END_EVENT_TABLE()
/* Constructeur */
/****************/
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" ),
wxDefaultPosition, wxDefaultSize )
{
@ -67,7 +68,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
SetBaseScreen( new SCH_SCREEN( VIEWER_FRAME ) );
SetBaseScreen( new SCH_SCREEN() );
GetScreen()->SetZoom( 16 );
if( Library == NULL )

View File

@ -57,7 +57,6 @@ set(GERBVIEW_EXTRA_SRCS
../pcbnew/sel_layer.cpp
../share/drawframe.cpp
../share/drawpanel.cpp
../share/setpage.cpp
../share/wxprint.cpp
../share/zoom.cpp)

View File

@ -29,7 +29,9 @@ bool WinEDA_App::OnInit()
InitEDA_Appl( wxT( "gerbview" ) );
ScreenPcb = new PCB_SCREEN( PCB_FRAME );
ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
ActiveScreen = ScreenPcb;
GetSettings();

View File

@ -33,29 +33,29 @@ public:
WinEDA_ViewlibFrame* m_ViewlibFrame; // Visualisation des composants
WinEDA_CvpcbFrame* m_CvpcbFrame;
wxPoint m_HelpPos;
wxSize m_HelpSize;
wxHtmlHelpController* m_HtmlCtrl;
wxConfig* m_EDA_Config; // Config courante (tailles et positions fenetres ...*/
wxConfig* m_EDA_CommonConfig; // common setup (language ...) */
wxString m_HelpFileName;
wxString m_CurrentOptionFile; // dernier fichier .cnf utilisé
wxString m_CurrentOptionFileDateAndTime;
wxPoint m_HelpPos;
wxSize m_HelpSize;
wxHtmlHelpController* m_HtmlCtrl;
wxConfig* m_EDA_Config; // Config courante (tailles et positions fenetres ...*/
wxConfig* m_EDA_CommonConfig; // common setup (language ...) */
wxString m_HelpFileName;
wxString m_CurrentOptionFile; // dernier fichier .cnf utilisé
wxString m_CurrentOptionFileDateAndTime;
wxString m_BinDir; /* Chemin ou reside l'executable
* (utilisé si KICAD non défini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargés */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv;/* Chemin de kicad défini dans la variable
* d'environnement KICAD,
* typiquement /usr/local/kicad ou c:\kicad */
bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie
wxString m_BinDir; /* Chemin ou reside l'executable
* (utilisé si KICAD non défini)*/
wxArrayString m_LastProject; /* liste des derniers projets chargés */
unsigned int m_LastProjectMaxCount; /* Max histhory file length */
wxString m_KicadEnv; /* Chemin de kicad défini dans la variable
* d'environnement KICAD,
* typiquement /usr/local/kicad ou c:\kicad */
bool m_Env_Defined; // TRUE si variable d'environnement KICAD definie
wxLocale* m_Locale; // Gestion de la localisation
int m_LanguageId; // indicateur de choix du langage ( 0 = defaut)
wxMenu* m_Language_Menu; // List menu for languages
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)
wxLocale* m_Locale; // Gestion de la localisation
int m_LanguageId; // indicateur de choix du langage ( 0 = defaut)
wxMenu* m_Language_Menu; // List menu for languages
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)
public:
WinEDA_App();
@ -75,7 +75,8 @@ public:
void SaveSettings();
void SetLastProject( const wxString& FullFileName );
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,
const wxString& GroupName, PARAM_CFG_BASE** List,
@ -85,5 +86,11 @@ public:
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 */

View File

@ -21,7 +21,7 @@ class SCH_SCREEN : public BASE_SCREEN
public:
int m_RefCount; /*how many sheets reference this screen?
* 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();
/**
@ -44,10 +44,9 @@ public:
return wxT( "SCH_SCREEN" );
}
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. */
bool CheckIfOnDrawList( SCH_ITEM* st );

View File

@ -19,6 +19,20 @@
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 */
/****************************************************/
@ -98,6 +112,7 @@ public:
void AddMenuZoom( wxMenu* MasterMenu );
bool OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event );
void OnPopupGridSelect( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
wxPoint CursorScreenPosition();
@ -206,7 +221,6 @@ public:
class BASE_SCREEN : public EDA_BaseStruct
{
public:
int m_Type; /* indicateur: type d'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_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
@ -235,8 +249,9 @@ public:
/* Page description */
Ki_PageDescr* m_CurrentSheetDesc;
int m_ScreenNumber, m_NumberOfScreen;/* gestion hierarchie: numero de sousfeuille
* et nombre de feuilles. Root: SheetNumber = 1 */
int m_ScreenNumber;
int m_NumberOfScreen;
wxString m_FileName;
wxString m_Title; /* titre de la feuille */
wxString m_Date; /* date de mise a jour */
@ -256,17 +271,16 @@ private:
/* Valeurs du pas de grille et du zoom */
public:
wxSize m_Grid; /* pas de la grille (peut differer en X et Y) */
wxSize* m_GridList; /* Liste des valeurs standard de grille */
wxRealPoint m_UserGrid; /* pas de la grille utilisateur */
int m_UserGridUnit; /* unit<69>grille utilisateur (0 = inch, 1 = mm */
int m_Diviseur_Grille;
bool m_UserGridIsON;
int* m_ZoomList; /* Liste des coefficients standard de zoom */
int m_Zoom; /* coeff de ZOOM */
wxSize m_Grid; /* Current grid. */
GridArray m_GridList;
bool m_UserGridIsON;
int m_Diviseur_Grille;
int* m_ZoomList; /* Liste des coefficients standard de zoom */
int m_Zoom; /* coeff de ZOOM */
public:
BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE );
BASE_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
~BASE_SCREEN();
BASE_SCREEN* Next() const { return (BASE_SCREEN*) Pnext; }
@ -281,9 +295,10 @@ public:
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
void InitDatas(); /* Inits completes des variables */
wxSize ReturnPageSize();
int GetInternalUnits();
void InitDatas(); /* Inits completes des variables */
wxSize ReturnPageSize( void );
virtual int GetInternalUnits( void );
wxPoint CursorRealPosition( const wxPoint& ScreenPos );
@ -334,11 +349,11 @@ public:
//----<grid stuff>----------------------------------------------------------
wxSize GetGrid(); /* retourne la grille */
void SetGrid( const wxSize& size );
void SetGridList( wxSize* sizelist ); /* init liste des grilles (NULL terminated) */
void SetNextGrid(); /* ajuste le prochain coeff de grille */
void SetPreviousGrid(); /* ajuste le precedent coeff de grille */
void SetFirstGrid(); /* ajuste la grille au mini*/
void SetLastGrid(); /* ajuste la grille au max */
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 units, int id );
/**

View File

@ -217,7 +217,7 @@ enum main_id {
ID_POPUP_ENTER_MENU,
ID_POPUP_ZOOM_START_RANGE, // first number
ID_POPUP_ZOOM_START_RANGE, // first zoom id
ID_POPUP_CANCEL,
ID_POPUP_ZOOM_IN,
ID_POPUP_ZOOM_OUT,
@ -237,6 +237,10 @@ enum main_id {
ID_POPUP_ZOOM_LEVEL_512,
ID_POPUP_ZOOM_LEVEL_1024,
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_MOINS,
ID_POPUP_GRID_SELECT,
@ -253,9 +257,6 @@ enum main_id {
ID_POPUP_GRID_LEVEL_2,
ID_POPUP_GRID_LEVEL_1,
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

View File

@ -208,7 +208,7 @@ public:
int m_Route_Layer_BOTTOM; /* pour placement vias et routage 2 couches */
public:
PCB_SCREEN( int idscreen );
PCB_SCREEN();
~PCB_SCREEN();
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
@ -217,6 +217,8 @@ public:
void SetPreviousZoom();
void SetLastZoom();
virtual int GetInternalUnits( void );
/**
* Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().

View File

@ -152,7 +152,6 @@ set(PCBNEW_SRCS
set(PCBNEW_EXTRA_SRCS
../share/drawframe.cpp
../share/drawpanel.cpp
../share/setpage.cpp
../share/wxprint.cpp
../share/zoom.cpp)

View File

@ -6,31 +6,49 @@
#include "fctsys.h"
#include "wxstruct.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#ifdef CVPCB
#include "cvpcb.h"
#endif
#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 */
/***************************************************/
/* Constructeur de SCREEN */
PCB_SCREEN::PCB_SCREEN( int idscreen ) : BASE_SCREEN( TYPE_SCREEN )
PCB_SCREEN::PCB_SCREEN( ) : BASE_SCREEN( TYPE_SCREEN )
{
// a zero terminated list
static const int zoom_list[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 0 };
size_t i;
m_Type = idscreen;
SetGridList( g_GridList );
// a zero terminated list
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] );
SetGrid( wxSize( 500, 500 ) ); /* pas de la grille en 1/10000 "*/
SetZoomList( zoom_list );
m_Grid = wxSize( 500, 500 ); /* pas de la grille en 1/10000 "*/
Init();
}
@ -41,7 +59,6 @@ PCB_SCREEN::~PCB_SCREEN()
{
}
/*************************/
void PCB_SCREEN::Init()
/*************************/
@ -50,9 +67,13 @@ void PCB_SCREEN::Init()
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_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
* A microvia ia a small via restricted to 2 near neighbour layers
@ -68,10 +89,10 @@ bool PCB_SCREEN::IsMicroViaAcceptable( void )
return false; // Obvious..
if( copperlayercnt < 4 )
return false; // Only on multilayer boards..
if( (m_Active_Layer == COPPER_LAYER_N)
|| (m_Active_Layer == LAYER_CMP_N)
|| (m_Active_Layer == g_DesignSettings.m_CopperLayerCount - 2)
|| (m_Active_Layer == LAYER_N_2) )
if( ( m_Active_Layer == COPPER_LAYER_N )
|| ( m_Active_Layer == LAYER_CMP_N )
|| ( m_Active_Layer == g_DesignSettings.m_CopperLayerCount - 2 )
|| ( m_Active_Layer == LAYER_N_2 ) )
return true;
return false;
@ -187,7 +208,7 @@ int EDA_BoardDesignSettings::GetVisibleLayers() const
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;
}

View File

@ -21,6 +21,9 @@
#include "cvpcb.h"
#endif
#include "id.h"
/* Format des structures de sauvegarde type ASCII :
Structure PAD:
@ -378,7 +381,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
else
g_UserGrid.y = g_UserGrid.x;
GetScreen()->m_UserGrid = g_UserGrid;
data = strtok( NULL, " =\n\r" );
if( data )
{
@ -386,7 +388,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_UserGrid_Unit = MILLIMETRE;
else
g_UserGrid_Unit = INCHES;
GetScreen()->m_UserGridUnit = g_UserGrid_Unit;
GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit,
ID_POPUP_GRID_USER );
}
continue;
}
@ -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 );
fprintf( aFile, text );
sprintf( text, "UserGridSize %lf %lf %s\n",
aFrame->GetScreen()->m_UserGrid.x, aFrame->GetScreen()->m_UserGrid.y,
sprintf( text, "UserGridSize %lf %lf %s\n", g_UserGrid.x, g_UserGrid.y,
( g_UserGrid_Unit == 0 ) ? "INCH" : "mm" );
fprintf( aFile, text );

View File

@ -19,86 +19,125 @@
/* class WinEDA_ModuleEditFrame */
/********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_ModuleEditFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_ModuleEditFrame::Process_Zoom )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_DELETE_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_IMPORT_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_EXPORT_PART, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UNDO, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_REDO, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_DELETE_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_IMPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_EXPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UNDO,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_REDO,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (left click):
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_ADD_PAD, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_TEXT_COMMENT_BUTT, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LINE_COMMENT_BUTT, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_NO_SELECT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_TEXT_COMMENT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_LINE_COMMENT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (right click):
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TEXT_COMMENT_BUTT, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_LINE_COMMENT_BUTT, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TEXT_COMMENT_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_LINE_COMMENT_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick )
// Options Toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
// Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
// Transformations du module
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALE, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALEX, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALEY, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALE,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALEX,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_SCALEY,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_PAD_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions )
// Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
// PopUp Menu Zoom trait<69>s dans drawpanel.cpp
END_EVENT_TABLE()
@ -106,11 +145,14 @@ END_EVENT_TABLE()
/* Constructeur */
/****************/
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent,
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
const wxPoint& pos,
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style )
WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME,
wxEmptyString, pos, size, style )
{
m_FrameName = wxT( "ModEditFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
@ -125,7 +167,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* pa
if( ScreenModule == NULL )
{
ScreenModule = new PCB_SCREEN( PCB_FRAME );
ScreenModule = new PCB_SCREEN();
ActiveScreen = ScreenModule;
}
ScreenModule->m_UndoRedoCountMax = 10;
@ -190,8 +232,10 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
if( m_Parent && m_Parent->m_EDA_Config )
{
wxSize GridSize = GetScreen()->GetGrid();
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_X" ), (long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_Y" ), (long) GridSize.y );
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_X" ),
(long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "ModEditGrid_Y" ),
(long) GridSize.y );
}
Destroy();
}
@ -201,6 +245,7 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
void WinEDA_ModuleEditFrame::SetToolbars()
/*********************************************/
{
size_t i;
bool active, islib = TRUE;
if( m_HToolBar == NULL )
@ -218,7 +263,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
active = TRUE;
m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, active );
m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active );
m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
active );
m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib );
MODULE* module_in_edit = m_Pcb->m_Modules;
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module ...
@ -300,7 +346,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( m_AuxiliaryToolBar )
{
int ii, jj;
int jj;
if( m_SelZoomBox )
{
int old_choice = m_SelZoomBox->GetChoice();
@ -320,21 +366,16 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( m_SelGridBox && GetScreen() )
{
int kk = m_SelGridBox->GetChoice();
for( ii = 0; g_GridList[ii].x > 0; ii++ )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
if( !GetScreen()->m_UserGridIsON
&& (GetScreen()->GetGrid().x == g_GridList[ii].x)
&& (GetScreen()->GetGrid().y == g_GridList[ii].y) )
if( ( GetScreen()->GetGrid() == GetScreen()->m_GridList[i].m_Size ) )
{
if( kk != ii )
m_SelGridBox->SetSelection( ii );
kk = ii;
if( kk != ( int ) i )
m_SelGridBox->SetSelection( ( int ) i );
kk = ( int ) i;
break;
}
}
if( kk != ii )
m_SelGridBox->SetSelection( ii );/* User Grid */
}
}

View File

@ -174,8 +174,7 @@ bool Read_Config( const wxString& project_name )
if( ScreenPcb )
{
ScreenPcb->m_Diviseur_Grille = Pcbdiv_grille;
ScreenPcb->m_UserGrid = g_UserGrid;
ScreenPcb->m_UserGridUnit = g_UserGrid_Unit;
ScreenPcb->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
}
g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth;

View File

@ -19,157 +19,169 @@
/*******************************/
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
COMMON_EVENTS_DRAWFRAME
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
COMMON_EVENTS_DRAWFRAME EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_PcbFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_PcbFrame::Process_Zoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
WinEDA_DrawFrame::ProcessFontPreferences )
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
WinEDA_DrawFrame::ProcessFontPreferences )
// Menu Files:
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_APPEND_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_PcbFrame::ToPlotter )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_APPEND_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_MENU_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_PcbFrame::ToPlotter )
EVT_MENU_RANGE( ID_LOAD_FILE_1, ID_LOAD_FILE_10,
WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_GEN_EXPORT_SPECCTRA, WinEDA_PcbFrame::ExportToSpecctra )
EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD )
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT,
WinEDA_PcbFrame::GenModuleReport )
EVT_MENU( ID_GEN_EXPORT_SPECCTRA, WinEDA_PcbFrame::ExportToSpecctra )
EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD )
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, WinEDA_PcbFrame::GenModuleReport )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,
WinEDA_PcbFrame::ImportSpecctraSession )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN,
WinEDA_PcbFrame::ImportSpecctraDesign )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION, WinEDA_PcbFrame::ImportSpecctraSession )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, WinEDA_PcbFrame::ImportSpecctraDesign )
EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_EXIT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_EXIT, WinEDA_PcbFrame::Process_Special_Functions )
// menu Config
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, ID_CONFIG_AND_PREFERENCES_END,
WinEDA_PcbFrame::Process_Config )
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_AND_PREFERENCES_END,
WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_USER_GRID_SETUP, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage )
// menu Postprocess
EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, WinEDA_PcbFrame::GenModulesPosition )
EVT_MENU( ID_PCB_GEN_DRILL_FILE, WinEDA_PcbFrame::InstallDrillFrame )
EVT_MENU( ID_PCB_GEN_CMP_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, WinEDA_PcbFrame::GenModulesPosition )
EVT_MENU( ID_PCB_GEN_DRILL_FILE, WinEDA_PcbFrame::InstallDrillFrame )
EVT_MENU( ID_PCB_GEN_CMP_FILE, WinEDA_PcbFrame::Files_io )
// menu Miscellaneous
EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::Liste_Equipot )
EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::Liste_Equipot )
EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS,
WinEDA_PcbFrame::Process_Special_Functions )
// Menu Help
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout )
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout )
// Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
// Horizontal toolbar
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( wxID_CUT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_GEN_PLOT, WinEDA_DrawFrame::Process_Special_Functions )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, WinEDA_PcbFrame::Access_to_External_Tool )
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( wxID_CUT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_GEN_PLOT, WinEDA_DrawFrame::Process_Special_Functions )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
WinEDA_PcbFrame::Access_to_External_Tool )
// Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_PcbFrame::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_PcbFrame::OnSelectOptionToolbar )
// Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TEXT_COMMENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_LINE_COMMENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TEXT_COMMENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_LINE_COMMENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
WinEDA_PcbFrame::ProcessMuWaveFunctions )
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
WinEDA_PcbFrame::ProcessMuWaveFunctions )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TEXT_COMMENT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_LINE_COMMENT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TEXT_COMMENT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_LINE_COMMENT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
WinEDA_PcbFrame::AutoPlace )
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
WinEDA_PcbFrame::AutoPlace )
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
// Annulation de commande en cours
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
// PopUp Menus pour Zooms traites dans drawpanel.cpp
END_EVENT_TABLE()
@ -229,8 +241,10 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
GridSize.x = SizeX;
GridSize.y = SizeY;
}
m_Parent->m_EDA_Config->Read( wxT( "PcbMagPadOpt" ), &g_MagneticPadOption );
m_Parent->m_EDA_Config->Read( wxT( "PcbMagTrackOpt" ), &g_MagneticTrackOption );
m_Parent->m_EDA_Config->Read( wxT( "PcbMagPadOpt" ),
&g_MagneticPadOption );
m_Parent->m_EDA_Config->Read( wxT( "PcbMagTrackOpt" ),
&g_MagneticTrackOption );
}
GetScreen()->SetGrid( GridSize );
@ -278,7 +292,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
{
unsigned ii;
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
_( "Confirmation" ), wxYES_NO | wxCANCEL | wxICON_EXCLAMATION |
_( "Confirmation" ),
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION |
wxYES_DEFAULT );
ii = dialog.ShowModal();
@ -313,10 +328,14 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
if( m_Parent && m_Parent->m_EDA_Config )
{
wxSize GridSize = GetScreen()->GetGrid();
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_X" ), (long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_Y" ), (long) GridSize.y );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagPadOpt" ), (long) g_MagneticPadOption );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagTrackOpt" ), (long) g_MagneticTrackOption );
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_X" ),
(long) GridSize.x );
m_Parent->m_EDA_Config->Write( wxT( "PcbEditGrid_Y" ),
(long) GridSize.y );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagPadOpt" ),
(long) g_MagneticPadOption );
m_Parent->m_EDA_Config->Write( wxT( "PcbMagTrackOpt" ),
(long) g_MagneticTrackOption );
}
Destroy();
}
@ -331,6 +350,7 @@ void WinEDA_PcbFrame::SetToolbars()
* en cours
*/
{
size_t i;
int ii, jj;
if( m_ID_current_state == ID_TRACK_BUTT )
@ -378,11 +398,10 @@ void WinEDA_PcbFrame::SetToolbars()
{
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
!Drc_On );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF, Drc_On ?
_(
"DRC Off (Disable !!!), Currently: DRC is active" )
:
_( "DRC On (Currently: DRC is inactive !!!)" ) );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Drc_On ?
_( "DRC Off (Disable !!!), Currently: DRC is active" ) :
_( "DRC On (Currently: DRC is inactive !!!)" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric == MILLIMETRE ? TRUE : FALSE );
@ -392,14 +411,14 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ?
_( "Polar Coords not show" ) :
_( "Display Polar Coords" ) );
DisplayOpt.DisplayPolarCood ?
_( "Polar Coords not show" ) :
_( "Display Polar Coords" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) );
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
g_CursorShape );
@ -407,24 +426,24 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
g_Show_Ratsnest ?
_( "Hide General ratsnest" ):
_( "Show General ratsnest" ));
g_Show_Ratsnest ?
_( "Hide General ratsnest" ) :
_( "Show General ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
g_Show_Module_Ratsnest ?
_( "Hide Module ratsnest" ) :
_( "Show Module ratsnest" ) );
g_Show_Module_Ratsnest ?
_( "Hide Module ratsnest" ) :
_( "Show Module ratsnest" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
g_AutoDeleteOldTrack ?
_( "Disable Auto Delete old Track" ) :
_( "Enable Auto Delete old Track" ) );
g_AutoDeleteOldTrack ?
_( "Disable Auto Delete old Track" ) :
_( "Enable Auto Delete old Track" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES,
DisplayOpt.DisplayZones );
@ -436,23 +455,23 @@ void WinEDA_PcbFrame::SetToolbars()
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
!m_DisplayPadFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ?
_( "Show Pads Sketch mode" ) :
_( "Show pads filled mode" ) );
m_DisplayPadFill ?
_( "Show Pads Sketch mode" ) :
_( "Show pads filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
!m_DisplayPcbTrackFill );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
m_DisplayPcbTrackFill ?
_( "Show Tracks Sketch mode" ) :
_( "Show Tracks filled mode" ) );
m_DisplayPcbTrackFill ?
_( "Show Tracks Sketch mode" ) :
_( "Show Tracks filled mode" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay ?
_( "Normal Contrast Mode Display" ) :
_( "Hight Contrast Mode Display" ) );
DisplayOpt.ContrastModeDisplay ?
_( "Normal Contrast Mode Display" ) :
_( "Hight Contrast Mode Display" ) );
}
if( m_AuxiliaryToolBar )
@ -544,21 +563,16 @@ void WinEDA_PcbFrame::SetToolbars()
{
int kk = m_SelGridBox->GetChoice();
for( ii = 0; g_GridList[ii].x > 0; ii++ )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
if( !GetScreen()->m_UserGridIsON
&& (GetScreen()->GetGrid().x == g_GridList[ii].x)
&& (GetScreen()->GetGrid().y == g_GridList[ii].y) )
if( GetScreen()->GetGrid() == GetScreen()->m_GridList[i].m_Size )
{
if( kk != ii )
m_SelGridBox->SetSelection( ii );
kk = ii;
if( kk != ( int ) i )
m_SelGridBox->SetSelection( ( int ) i );
kk = ( int ) i;
break;
}
}
if( kk != ii )
m_SelGridBox->SetSelection( ii ); /* User Grid */
}
}

View File

@ -45,7 +45,7 @@ bool WinEDA_App::OnInit()
return false;
}
ScreenPcb = new PCB_SCREEN( PCB_FRAME );
ScreenPcb = new PCB_SCREEN();
GetSettings();
if( argc > 1 )

View File

@ -50,18 +50,6 @@
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
eda_global BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items

View File

@ -7,7 +7,6 @@
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
@ -15,24 +14,28 @@
#include "protos.h"
#include <wx/spinctrl.h>
#include "id.h"
#include "set_grid.h"
/****************************************************************/
void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event)
/****************************************************************/
{
double dtmp = 0;
g_UserGrid_Unit = m_UnitGrid->GetSelection();
m_OptGridSizeX->GetValue().ToDouble(&dtmp); g_UserGrid.x = dtmp;
m_OptGridSizeY->GetValue().ToDouble(&dtmp); g_UserGrid.y = dtmp;
double dtmp = 0;
m_Parent->GetScreen()->m_UserGrid = g_UserGrid;
m_Parent->GetScreen()->m_UserGridUnit = g_UserGrid_Unit;
g_UserGrid_Unit = m_UnitGrid->GetSelection();
m_OptGridSizeX->GetValue().ToDouble( &dtmp );
g_UserGrid.x = dtmp;
m_OptGridSizeY->GetValue().ToDouble( &dtmp );
g_UserGrid.y = dtmp;
m_Parent->GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit,
ID_POPUP_GRID_USER );
EndModal(1);
m_Parent->DrawPanel->Refresh(TRUE);
m_Parent->DrawPanel->Refresh( TRUE );
}
@ -42,7 +45,7 @@ void WinEDA_BasePcbFrame::InstallGridFrame(const wxPoint & pos)
/************************************************************/
{
WinEDA_PcbGridFrame * GridFrame =
new WinEDA_PcbGridFrame(this, pos);
new WinEDA_PcbGridFrame( this, pos );
GridFrame->ShowModal(); GridFrame->Destroy();
}
@ -77,21 +80,20 @@ WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( )
}
WinEDA_PcbGridFrame::WinEDA_PcbGridFrame( WinEDA_BasePcbFrame* parent,
const wxPoint& pos,
wxWindowID id, const wxString& caption, const wxSize& size, long style )
const wxPoint& pos,
wxWindowID id,
const wxString& caption,
const wxSize& size, long style )
{
wxString msg;
PCB_SCREEN * screen;
m_Parent = parent;
screen = (PCB_SCREEN*)(m_Parent->GetScreen());
wxString msg;
PCB_SCREEN * screen;
g_UserGrid = screen->m_UserGrid;
g_UserGrid_Unit = screen->m_UserGridUnit;
m_Parent = parent;
screen = (PCB_SCREEN*)(m_Parent->GetScreen());
Create(parent, id, caption, pos, size, style);
if ( screen->m_UserGridUnit != INCHES )
if ( g_UserGrid_Unit != INCHES )
m_UnitGrid->SetSelection(1);
msg.Printf( wxT("%.4f"), g_UserGrid.x );
@ -130,7 +132,7 @@ bool WinEDA_PcbGridFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin
*/
void WinEDA_PcbGridFrame::CreateControls()
{
{
SetFont(*g_DialogFont);
////@begin WinEDA_PcbGridFrame content construction
// Generated by DialogBlocks, 17/08/2006 09:27:19 (unregistered)
@ -232,7 +234,7 @@ void WinEDA_PcbGridFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PcbGridFrame.
// Before editing this code, remove the block markers.
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.
}

View File

@ -3,15 +3,12 @@
/*****************************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "protos.h"
#define BITMAP wxBitmap
#include "bitmaps.h"
#include "id.h"
@ -40,92 +37,99 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
// Set up toolbar
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString,
BITMAP( open_library_xpm ),
_( "Select working library" ) );
wxBitmap( open_library_xpm ),
_( "Select working library" ) );
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, BITMAP( save_library_xpm ),
_( "Save Module in working library" ) );
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString,
wxBitmap( save_library_xpm ),
_( "Save Module in working library" ) );
m_HToolBar->AddTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString,
BITMAP( new_library_xpm ),
_( "Create new library and save current module" ) );
m_HToolBar->AddTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
wxEmptyString,
wxBitmap( new_library_xpm ),
_( "Create new library and save current module" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString,
BITMAP( delete_xpm ),
_( "Delete part in current library" ) );
wxBitmap( delete_xpm ),
_( "Delete part in current library" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString,
BITMAP( new_footprint_xpm ),
_( "New Module" ) );
wxBitmap( new_footprint_xpm ),
_( "New Module" ) );
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString,
BITMAP( module_xpm ),
_( "Load module from lib" ) );
wxBitmap( module_xpm ),
_( "Load module from lib" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString,
BITMAP( load_module_board_xpm ),
_( "Load module from current board" ) );
wxBitmap( load_module_board_xpm ),
_( "Load module from current board" ) );
m_HToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString,
BITMAP( update_module_board_xpm ),
_( "Update module in current board" ) );
wxBitmap( update_module_board_xpm ),
_( "Update module in current board" ) );
m_HToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString,
BITMAP( insert_module_board_xpm ),
_( "Insert module into current board" ) );
wxBitmap( insert_module_board_xpm ),
_( "Insert module into current board" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_IMPORT_PART, wxEmptyString,
BITMAP( import_module_xpm ),
_( "import module" ) );
wxBitmap( import_module_xpm ),
_( "import module" ) );
m_HToolBar->AddTool( ID_LIBEDIT_EXPORT_PART, wxEmptyString,
BITMAP( export_module_xpm ),
_( "export module" ) );
wxBitmap( export_module_xpm ),
_( "export module" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_UNDO, wxEmptyString, BITMAP( undo_xpm ),
_( "Undo last edition" ) );
m_HToolBar->AddTool( ID_MODEDIT_REDO, wxEmptyString, BITMAP( redo_xpm ),
_( "Redo the last undo command" ) );
m_HToolBar->AddTool( ID_MODEDIT_UNDO, wxEmptyString, wxBitmap( undo_xpm ),
_( "Undo last edition" ) );
m_HToolBar->AddTool( ID_MODEDIT_REDO, wxEmptyString, wxBitmap( redo_xpm ),
_( "Redo the last undo command" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString,
BITMAP( module_options_xpm ),
_( "Module Properties" ) );
wxBitmap( module_options_xpm ),
_( "Module Properties" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, BITMAP( print_button ),
_( "Print Module" ) );
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print Module" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Module_Editor_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom in" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString,
wxBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ),
msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Module_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ),
_( "Zoom auto" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString,
BITMAP( options_pad_xpm ),
_( "Pad Settings" ) );
wxBitmap( options_pad_xpm ),
_( "Pad Settings" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, BITMAP( module_check_xpm ),
_( "Module Check" ) );
m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString,
wxBitmap( module_check_xpm ),
_( "Module Check" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
@ -145,39 +149,39 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
// Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
BITMAP( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_ADD_PAD, wxEmptyString,
BITMAP( pad_xpm ),
wxBitmap( pad_xpm ),
_( "Add Pads" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
BITMAP( add_polygon_xpm ),
wxBitmap( add_polygon_xpm ),
_( "Add graphic line or polygon" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString,
BITMAP( add_circle_xpm ),
wxBitmap( add_circle_xpm ),
_( "Add graphic circle" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString,
BITMAP( add_arc_xpm ),
wxBitmap( add_arc_xpm ),
_( "Add graphic arc" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString,
BITMAP( add_text_xpm ),
wxBitmap( add_text_xpm ),
_( "Add Text" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_PLACE_ANCHOR, wxEmptyString,
BITMAP( anchor_xpm ),
wxBitmap( anchor_xpm ),
_( "Place anchor" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_DELETE_ITEM_BUTT, wxEmptyString,
BITMAP( delete_body_xpm ),
wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK );
m_VToolBar->Realize();
@ -194,53 +198,55 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
return;
// creation du tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, BITMAP( grid_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Display Grid OFF" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxBitmap( grid_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Display Grid OFF" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
BITMAP( polar_coord_xpm ),
wxBitmap( polar_coord_xpm ),
_( "Display Polar Coord ON" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
BITMAP( unit_inch_xpm ),
wxBitmap( unit_inch_xpm ),
_( "Units in inches" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
BITMAP( unit_mm_xpm ),
wxBitmap( unit_mm_xpm ),
_( "Units in millimeters" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, BITMAP( cursor_shape_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Change Cursor Shape" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR,
wxBitmap( cursor_shape_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Change Cursor Shape" ) );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
BITMAP( pad_sketch_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Pads Sketch" ) );
wxBitmap( pad_sketch_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Pads Sketch" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
BITMAP( text_sketch_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Texts Sketch" ) );
wxBitmap( text_sketch_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Texts Sketch" ) );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
BITMAP( show_mod_edge_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Edges Sketch" ) );
wxBitmap( show_mod_edge_xpm ),
wxNullBitmap,
TRUE,
-1, -1, (wxObject*) NULL,
_( "Show Edges Sketch" ) );
m_OptionsToolBar->Realize();
@ -252,27 +258,30 @@ void WinEDA_ModuleEditFrame::ReCreateOptToolbar()
void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
/*********************************************************/
{
int ii;
size_t i;
wxString msg;
if( m_AuxiliaryToolBar == NULL )
{
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, TRUE );
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
ID_AUX_TOOLBAR, TRUE );
// Set up toolbar
m_AuxiliaryToolBar->AddSeparator();
// Boite de selection du pas de grille
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ) );
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Boite de selection du Zoom
m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ) );
ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
msg = _( "Auto" );
m_SelZoomBox->Append( msg );
for( int jj = 0, ii = 1; ii <= m_ZoomMaxValue; ii <<= 1, jj++ )
@ -292,17 +301,25 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar()
// mise a jour des affichages
m_SelGridBox->Clear();
for( ii = 0; g_GridList[ii].x > 0; ii++ )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
double value = To_User_Unit( g_UnitMetric, g_GridList[ii].x, PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( _( "Grid %.1f" ), value * 1000 );
double value = To_User_Unit( g_UnitMetric,
GetScreen()->m_GridList[i].m_Size.x,
PCB_INTERNAL_UNIT );
if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER )
{
if( g_UnitMetric == INCHES )
msg.Printf( _( "Grid %.1f" ), value * 1000 );
else
msg.Printf( _( "Grid %.3f" ), value );
}
else
msg.Printf( _( "Grid %.3f" ), value );
{
msg = _( "User Grid" );
}
m_SelGridBox->Append( msg );
}
m_SelGridBox->Append( _( "User Grid" ) );
SetToolbars();
}

View File

@ -3,7 +3,6 @@
/*********************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
@ -14,8 +13,6 @@
#include "id.h"
#define BITMAP wxBitmap
#ifdef __UNIX__
#define LISTBOX_WIDTH 140
#else
@ -164,14 +161,16 @@ void WinEDA_PcbFrame::PrepareLayerIndicator()
if( m_HToolBar )
{
#if wxCHECK_VERSION( 2, 8, 3 ) & !defined(__WXX11__)
m_HToolBar->SetToolNormalBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
m_HToolBar->SetToolNormalBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
*LayerPairBitmap );
#else
int pos = m_HToolBar->GetToolPos( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR );
if( pos != wxNOT_FOUND )
{
m_HToolBar->DeleteTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR );
m_HToolBar->InsertTool( pos, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap,
wxNullBitmap, false, NULL, SEL_LAYER_HELP );
m_HToolBar->InsertTool( pos, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
*LayerPairBitmap, wxNullBitmap, false,
NULL, SEL_LAYER_HELP );
m_HToolBar->Realize();
}
#endif
@ -221,91 +220,104 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
SetToolBar( m_HToolBar );
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, BITMAP( new_xpm ), _( "New board" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, BITMAP( open_xpm ),
_( "Open existing board" ) );
m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, BITMAP( save_xpm ), _( "Save board" ) );
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ),
_( "New board" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, wxBitmap( open_xpm ),
_( "Open existing board" ) );
m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, wxBitmap( save_xpm ),
_( "Save board" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, BITMAP( sheetset_xpm ),
_( "Page settings (size, texts)" ) );
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, wxBitmap( sheetset_xpm ),
_( "Page settings (size, texts)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, BITMAP( modedit_xpm ),
_( "Open module editor" ) );
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString,
wxBitmap( modedit_xpm ),
_( "Open module editor" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, BITMAP( cut_button ), _( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, wxBitmap( cut_button ),
_( "Cut selected item" ) );
#if 0
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, BITMAP( copy_button ),
_( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, wxBitmap( copy_button ),
_( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, BITMAP( paste_xpm ), _( "Paste" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, wxBitmap( paste_xpm ),
_( "Paste" ) );
#endif
m_HToolBar->AddTool( ID_UNDO_BUTT, wxEmptyString, BITMAP( undelete_xpm ), _( "Undelete" ) );
m_HToolBar->AddTool( ID_UNDO_BUTT, wxEmptyString, wxBitmap( undelete_xpm ),
_( "Undelete" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, BITMAP( print_button ), _( "Print board" ) );
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, BITMAP( plot_xpm ),
_( "Plot (HPGL, PostScript, or GERBER format)" ) );
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print board" ) );
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, wxBitmap( plot_xpm ),
_( "Plot (HPGL, PostScript, or GERBER format)" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr, HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
msg = AddHotkeyName( _( "Zoom in" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_IN );
m_HToolBar->AddTool( ID_ZOOM_IN_BUTT, wxEmptyString, wxBitmap( zoom_in_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_OUT );
m_HToolBar->AddTool( ID_ZOOM_OUT_BUTT, wxEmptyString,
wxBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( zoom_redraw_xpm ),
msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Board_Editor_Hokeys_Descr,
HK_ZOOM_REDRAW );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString,
wxBitmap( zoom_redraw_xpm ), msg );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_auto_xpm ),
_( "Zoom auto" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString,
wxBitmap( zoom_auto_xpm ),
_( "Zoom auto" ) );
m_HToolBar->AddSeparator();
msg = AddHotkeyName( _(
"Find components and texts" ), s_Board_Editor_Hokeys_Descr,
msg = AddHotkeyName( _( "Find components and texts" ),
s_Board_Editor_Hokeys_Descr,
HK_FIND_ITEM );
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, BITMAP( find_xpm ),
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
msg );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, BITMAP( netlist_xpm ),
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
_( "Read netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, BITMAP( erc_xpm ),
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
_( "Pcb Design Rules Check" ) );
m_HToolBar->AddSeparator();
ReCreateLayerBox( m_HToolBar );
PrepareLayerIndicator(); // Initialise the bitmap with current active layer colors for the next tool
m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, *LayerPairBitmap,
SEL_LAYER_HELP );
m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString,
*LayerPairBitmap, SEL_LAYER_HELP );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString, BITMAP( mode_module_xpm ),
_(
"Mode Module: Manual and Automatic Move or Place for modules" ),
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString,
wxBitmap( mode_module_xpm ),
_( "Mode Module: Manual and Automatic Move or Place for modules" ),
wxITEM_CHECK );
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString, BITMAP( mode_track_xpm ),
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString,
wxBitmap( mode_track_xpm ),
_( "Mode Track and Autorouting" ), wxITEM_CHECK );
// Fast call to FreeROUTE Web Bases router
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, BITMAP( web_support_xpm ),
_( "Fast access to theWeb Based FreeROUTE advanced router" ));
m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString,
wxBitmap( web_support_xpm ),
_( "Fast access to theWeb Based FreeROUTE advanced router" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
m_HToolBar->Realize();
D(printf("ReCreateHToolbar\n");)
D( printf( "ReCreateHToolbar\n" ); )
SetToolbars();
}
@ -320,61 +332,70 @@ void WinEDA_PcbFrame::ReCreateOptToolbar()
return;
// creation du tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
ID_OPT_TOOLBAR, FALSE );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, BITMAP( drc_off_xpm ),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString,
wxBitmap( drc_off_xpm ),
_( "Drc OFF" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, BITMAP( grid_xpm ),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
wxBitmap( grid_xpm ),
_( "Display Grid OFF" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
BITMAP( polar_coord_xpm ), _(
"Display Polar Coord ON" ), wxITEM_CHECK );
wxBitmap( polar_coord_xpm ),
_( "Display Polar Coord ON" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
BITMAP( unit_inch_xpm ), _( "Units in inches" ), wxITEM_CHECK );
wxBitmap( unit_inch_xpm ),
_( "Units in inches" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
BITMAP( unit_mm_xpm ), _( "Units in millimeters" ), wxITEM_CHECK );
wxBitmap( unit_mm_xpm ),
_( "Units in millimeters" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
BITMAP( cursor_shape_xpm ),
wxBitmap( cursor_shape_xpm ),
_( "Change Cursor Shape" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
BITMAP( general_ratsnet_xpm ),
wxBitmap( general_ratsnet_xpm ),
_( "Show General Ratsnest" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, wxEmptyString,
BITMAP( local_ratsnet_xpm ),
_( "Show Module Ratsnest when moving" ), wxITEM_CHECK );
wxBitmap( local_ratsnet_xpm ),
_( "Show Module Ratsnest when moving" ),
wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString,
BITMAP( auto_delete_track_xpm ),
wxBitmap( auto_delete_track_xpm ),
_( "Enable Auto Del Track" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, BITMAP( show_zone_xpm ),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
wxBitmap( show_zone_xpm ),
_( "Show Zones" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
BITMAP( pad_sketch_xpm ),
wxBitmap( pad_sketch_xpm ),
_( "Show Pads Sketch" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
BITMAP( showtrack_xpm ),
wxBitmap( showtrack_xpm ),
_( "Show Tracks Sketch" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE, wxEmptyString,
BITMAP( palette_xpm ),
_( "Hight Contrast Mode Display" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
wxEmptyString,
wxBitmap( palette_xpm ),
_( "Hight Contrast Mode Display" ),
wxITEM_CHECK );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
DisplayOpt.ContrastModeDisplay );
#ifdef MUWAVE_ENBL
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, wxEmptyString,
BITMAP( mw_toolbar_xpm ),
_(
"Display auxiliary vertical toolbar (tools for micro wave applications)\n This is a very experimental feature (under development)" ),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
wxEmptyString,
wxBitmap( mw_toolbar_xpm ),
_( "Display auxiliary vertical toolbar (tools for micro wave applications)\n This is a very experimental feature (under development)" ),
wxITEM_CHECK );
#endif
@ -399,65 +420,68 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
// Set up toolbar
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
BITMAP( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString,
BITMAP( net_hightlight_xpm ), _( "Net highlight" ), wxITEM_CHECK );
wxBitmap( net_hightlight_xpm ), _( "Net highlight" ),
wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString,
BITMAP( tool_ratsnet_xpm ),
_( "Display local ratsnest (pad or module)" ), wxITEM_CHECK );
wxBitmap( tool_ratsnet_xpm ),
_( "Display local ratsnest (pad or module)" ),
wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
BITMAP( module_xpm ),
wxBitmap( module_xpm ),
_( "Add modules" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString,
BITMAP( add_tracks_xpm ),
wxBitmap( add_tracks_xpm ),
_( "Add tracks and vias" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString,
BITMAP( add_zone_xpm ),
wxBitmap( add_zone_xpm ),
_( "Add zones" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
BITMAP( add_dashed_line_xpm ),
wxBitmap( add_dashed_line_xpm ),
_( "Add graphic line or polygon" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString,
BITMAP( add_circle_xpm ),
wxBitmap( add_circle_xpm ),
_( "Add graphic circle" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString,
BITMAP( add_arc_xpm ),
wxBitmap( add_arc_xpm ),
_( "Add graphic arc" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString,
BITMAP( add_text_xpm ),
wxBitmap( add_text_xpm ),
_( "Add text" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_COTATION_BUTT, wxEmptyString,
BITMAP( add_cotation_xpm ),
wxBitmap( add_cotation_xpm ),
_( "Add dimension" ), wxITEM_CHECK );
m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString,
BITMAP( add_mires_xpm ),
wxBitmap( add_mires_xpm ),
_( "Add layer alignment target" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString,
BITMAP( delete_body_xpm ),
wxBitmap( delete_body_xpm ),
_( "Delete items" ), wxITEM_CHECK );
m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
BITMAP( pcb_offset_xpm ),
_( "Offset adjust for drill and place files" ), wxITEM_CHECK );
wxBitmap( pcb_offset_xpm ),
_( "Offset adjust for drill and place files" ),
wxITEM_CHECK );
m_VToolBar->Realize();
@ -476,41 +500,42 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
if( m_AuxVToolBar )
return;
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_AUX_V_TOOLBAR, FALSE );
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this,
ID_AUX_V_TOOLBAR, FALSE );
// Set up toolbar
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD,
BITMAP( mw_Add_Line_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create line of specified length for microwave applications" ) );
wxBitmap( mw_Add_Line_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create line of specified length for microwave applications" ) );
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD,
BITMAP( mw_Add_Gap_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create gap of specified length for microwave applications" ) );
wxBitmap( mw_Add_Gap_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create gap of specified length for microwave applications" ) );
m_AuxVToolBar->AddSeparator();
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD,
BITMAP( mw_Add_Stub_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create stub of specified length for microwave applications" ) );
wxBitmap( mw_Add_Stub_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create stub of specified length for microwave applications" ) );
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD,
BITMAP( mw_Add_stub_arc_xpm ),
wxBitmap( mw_Add_stub_arc_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create stub (arc) of specified length for microwave applications" )
);
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD,
BITMAP( mw_Add_Shape_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create a polynomial shape for microwave applications" ) );
wxBitmap( mw_Add_Shape_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_( "Create a polynomial shape for microwave applications" ) );
m_AuxVToolBar->Realize();
@ -532,48 +557,51 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
* zoom level choice
*/
{
int ii;
size_t i;
wxString msg;
if( m_AuxiliaryToolBar == NULL )
{
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, TRUE );
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
ID_AUX_TOOLBAR, TRUE );
// Set up toolbar
m_AuxiliaryToolBar->AddSeparator();
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1,
-1 ), wxSize( LISTBOX_WIDTH + 20, -1 ) );
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_SelTrackWidthBox_Changed = TRUE;
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
BITMAP( auto_track_width_xpm ),
_(
"Auto track width: when starting on an existing track use its width\notherwise, use current width setting" ),
wxBitmap( auto_track_width_xpm ),
_( "Auto track width: when starting on an existing track use its width\notherwise, use current width setting" ),
wxITEM_CHECK );
m_AuxiliaryToolBar->AddSeparator();
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH + 10, -1 ) );
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator();
// Boite de selection du pas de grille
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ) );
ID_ON_GRID_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Boite de selection du Zoom
m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ) );
ID_ON_ZOOM_SELECT,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
msg = _( "Auto" );
m_SelZoomBox->Append( msg );
for( int jj = 0, ii = 1; ii <= m_ZoomMaxValue; ii <<= 1, jj++ )
@ -598,18 +626,28 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
else
format += wxT( " %.3f" );
for( ii = 0; g_GridList[ii].x > 0; ii++ )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
double value = To_User_Unit( g_UnitMetric, g_GridList[ii].x, PCB_INTERNAL_UNIT );
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
GRID_TYPE grid = GetScreen()->m_GridList[i];
double value = To_User_Unit( g_UnitMetric,
grid.m_Size.x,
PCB_INTERNAL_UNIT );
if( grid.m_Id != ID_POPUP_GRID_USER )
{
if( g_UnitMetric == INCHES )
msg.Printf( format.GetData(), value * 1000 );
else
msg.Printf( format.GetData(), value );
}
else
msg.Printf( format.GetData(), value );
{
msg = _( "User Grid" );
}
m_SelGridBox->Append( msg );
}
m_SelGridBox->Append( _( "User Grid" ) );
m_SelViaSizeBox_Changed = TRUE;
m_SelTrackWidthBox_Changed = TRUE;
@ -657,8 +695,8 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
if( parent == NULL )
return NULL;
m_SelLayerBox = new WinEDAChoiceBox( parent, ID_TOOLBARH_PCB_SELECT_LAYER,
m_SelLayerBox = new WinEDAChoiceBox( parent,
ID_TOOLBARH_PCB_SELECT_LAYER,
wxPoint( -1, -1 ),
#if defined (__UNIX__)
@ -707,7 +745,8 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
if( g_TabOneLayerMask[layer] & layer_mask )
{
wxString msg = m_Pcb->GetLayerName( layer );
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[layer] );
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr,
HK_SwitchLayer[layer] );
m_SelLayerBox->Append( msg );
//D(printf("appending layername=%s, ndx=%d, layer=%d\n", CONV_TO_UTF8(msg), listNdx, layer );)

View File

@ -40,7 +40,8 @@
WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
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 )
{
wxSize minsize;
@ -118,7 +119,8 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
/****************************************/
{
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 )
ID_PREFERENCES_FONT_DIALOG,
_( "Dialog boxes" ),
fonts_xpm );
ADD_MENUITEM( fontmenu,
ID_PREFERENCES_FONT_INFOSCREEN,
_( "Lists" ),
@ -150,8 +152,7 @@ void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
fontmenu,
ID_PREFERENCES_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 );
}
@ -273,17 +274,14 @@ void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
if( m_SelGridBox == NULL )
return; // Should not occurs
int id = m_SelGridBox->GetChoice();
if( id < 0 )
return;
BASE_SCREEN* screen = GetBaseScreen();
BASE_SCREEN* screen = GetBaseScreen();
screen->m_Curseur = DrawPanel->GetScreenCenterRealPosition();
wxSize grid = screen->GetGrid();
screen->SetGrid( g_GridList[id] );
wxSize newgrid = screen->GetGrid();
if( newgrid.x != grid.x || newgrid.y != grid.y )
wxSize current_grid = screen->GetGrid();
screen->SetGrid( event.GetSelection() + ID_POPUP_GRID_LEVEL_1000 );
wxSize selected_grid = screen->GetGrid();
if( selected_grid != current_grid )
Recadre_Trace( FALSE );
}
@ -464,19 +462,22 @@ void WinEDA_DrawFrame::OnSize( wxSizeEvent& SizeEv )
{
opt_size.x = 0;
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
{
opt_size.x = m_OptionsToolBar->GetSize().x;
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 )
{
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 );
}
@ -515,8 +516,8 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
#ifdef PCBNEW
// handle color changes for transitions in and out of 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) )
if( ( 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 )
redraw = true;
@ -826,9 +827,9 @@ void WinEDA_DrawFrame::AdjustScrollBars()
DrawPanel->SetScrollbars( DrawPanel->m_Scroll_unit,
DrawPanel->m_Scroll_unit,
screen->m_ScrollbarNumber.x,
screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x,
screen->m_ScrollbarPos.y, TRUE );
screen->m_ScrollbarNumber.y,
screen->m_ScrollbarPos.x,
screen->m_ScrollbarPos.y, TRUE );
}

View File

@ -8,29 +8,12 @@
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "macros.h"
#ifdef EESCHEMA
#include "program.h"
#include "libcmp.h"
#include "general.h"
#endif
#ifdef PCBNEW
#include "pcbnew.h"
#endif
#ifdef CVPCB
#include "cvpcb.h"
#endif
#include "bitmaps.h"
#include "protos.h"
#include "id.h"
@ -67,34 +50,24 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
* @param coord = coordinate to adjust
*/
{
double ftmp;
double tmp;
wxSize grid_size = GetBaseScreen()->GetGrid();
if( !GetBaseScreen()->m_UserGridIsON )
{
wxSize grid_size = GetBaseScreen()->GetGrid();
tmp = (double) coord->x / (double) grid_size.x;
coord->x = ( (int) round( tmp ) ) * grid_size.x;
ftmp = (double) coord->x / grid_size.x;
coord->x = ( (int) round( ftmp ) ) * grid_size.x;
ftmp = (double) coord->y / grid_size.y;
coord->y = ( (int) round( ftmp ) ) * grid_size.y;
tmp = (double) coord->y / (double) grid_size.y;
coord->y = ( (int) round( tmp ) ) * grid_size.y;
}
else
{
double pasx = GetBaseScreen()->m_UserGrid.x * m_InternalUnits;
double pasy = GetBaseScreen()->m_UserGrid.y * m_InternalUnits;
double pasx = (double) ( grid_size.x * m_InternalUnits );
double pasy = (double) ( grid_size.y * m_InternalUnits );
if( GetBaseScreen()->m_UserGridUnit != INCHES )
{
pasx /= 25.4;
pasy /= 25.4;
}
int nn = (int) round( coord->x / pasx );
coord->x = (int) round( pasx * nn );
nn = (int) round( coord->y / pasy );
coord->y = (int) round( pasy * nn );
coord->x = (int) round( pasx * ( (double) coord->x / pasx ) );
coord->y = (int) round( pasy * ( (double) coord->y / pasy ) );
}
}
@ -230,87 +203,20 @@ void WinEDA_DrawPanel::Process_Popup_Zoom( wxCommandEvent& event )
m_Parent->Recadre_Trace( TRUE );
break;
case ID_POPUP_GRID_LEVEL_1:
GetScreen()->SetGrid( wxSize( 1, 1 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_2:
GetScreen()->SetGrid( wxSize( 2, 2 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_5:
GetScreen()->SetGrid( wxSize( 5, 5 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_10:
GetScreen()->SetGrid( wxSize( 10, 10 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_20:
GetScreen()->SetGrid( wxSize( 20, 20 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_25:
GetScreen()->SetGrid( wxSize( 25, 25 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_50:
GetScreen()->SetGrid( wxSize( 50, 50 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_100:
GetScreen()->SetGrid( wxSize( 100, 100 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_200:
GetScreen()->SetGrid( wxSize( 200, 200 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_250:
GetScreen()->SetGrid( wxSize( 250, 250 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_500:
GetScreen()->SetGrid( wxSize( 500, 500 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_LEVEL_1000:
GetScreen()->SetGrid( wxSize( 1000, 1000 ) );
m_Parent->ReDrawPanel();
break;
case ID_POPUP_GRID_USER:
GetScreen()->SetGrid( wxSize( -1, -1 ) );
m_Parent->ReDrawPanel();
break;
default:
DisplayError( this, wxT( "WinEDA_DrawPanel::Process_Popup_Zoom() ID error" ) );
DisplayError( this,
wxT( "WinEDA_DrawPanel::Process_Popup_Zoom() ID error" ) );
break;
}
m_Parent->Affiche_Status_Box();
}
class grid_list_struct
void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event )
{
public:
int m_Value;
int m_Id;
};
GetScreen()->SetGrid( event.GetId() );
m_Parent->ReDrawPanel();
}
/*************************************************************/
void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
@ -320,53 +226,29 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
* used in OnRightClick(wxMouseEvent& event)
*/
{
size_t i;
int zoom;
wxSize grid;
int zoom_value;
wxString zoom_msg = _( "Zoom: " );
wxString grid_msg = _( "Grid: " ), msg;
wxString msg;
int ii;
wxString line;
GRID_TYPE tmp;
static const grid_list_struct grid_list_pcb[] =
{
{ 1000, ID_POPUP_GRID_LEVEL_1000 },
{ 500, ID_POPUP_GRID_LEVEL_500 },
{ 250, ID_POPUP_GRID_LEVEL_250 },
{ 200, ID_POPUP_GRID_LEVEL_200 },
{ 100, ID_POPUP_GRID_LEVEL_100 },
{ 50, ID_POPUP_GRID_LEVEL_50 },
{ 25, ID_POPUP_GRID_LEVEL_25 },
{ 20, ID_POPUP_GRID_LEVEL_20 },
{ 10, ID_POPUP_GRID_LEVEL_10 },
{ 5, ID_POPUP_GRID_LEVEL_5 },
{ 2, ID_POPUP_GRID_LEVEL_2 },
{ 1, ID_POPUP_GRID_LEVEL_1 },
{ 0, ID_POPUP_GRID_USER }
};
static const grid_list_struct grid_list_schematic[] =
{
{ 50, ID_POPUP_GRID_LEVEL_50 },
{ 25, ID_POPUP_GRID_LEVEL_25 },
{ 10, ID_POPUP_GRID_LEVEL_10 },
{ 5, ID_POPUP_GRID_LEVEL_5 },
{ 2, ID_POPUP_GRID_LEVEL_2 },
{ 1, ID_POPUP_GRID_LEVEL_1 },
{ 0, ID_POPUP_GRID_USER }
};
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, _( "Center" ), zoom_center_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_CENTER, _( "Center" ),
zoom_center_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_IN, _( "Zoom in" ), zoom_in_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_OUT, _( "Zoom out" ), zoom_out_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_AUTO, _( "Zoom auto" ), zoom_auto_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_AUTO, _( "Zoom auto" ),
zoom_auto_xpm );
wxMenu* zoom_choice = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, zoom_choice,
ID_POPUP_ZOOM_SELECT, _( "Zoom select" ), zoom_select_xpm );
ID_POPUP_ZOOM_SELECT, _( "Zoom select" ),
zoom_select_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw view" ), zoom_redraw_xpm );
ADD_MENUITEM( MasterMenu, ID_POPUP_ZOOM_REDRAW, _( "Redraw view" ),
zoom_redraw_xpm );
/* Create the basic zoom list: */
zoom = GetScreen()->GetZoom();
@ -375,74 +257,43 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
{
line.Printf( wxT( "%u" ), zoom_value );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_1 + ii,
zoom_msg + line, wxEmptyString, TRUE );
_( "Zoom: " ) + line, wxEmptyString, TRUE );
if( zoom == zoom_value )
zoom_choice->Check( ID_POPUP_ZOOM_LEVEL_1 + ii, TRUE );
}
wxMenu* grid_choice = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice,
ID_POPUP_GRID_SELECT, _( "Grid Select" ), grid_select_xpm );
grid = GetScreen()->GetGrid();
// Create grid list
switch( m_Parent->m_Ident )
/* Create grid submenu as required. */
if( !GetScreen()->m_GridList.IsEmpty() )
{
case MODULE_EDITOR_FRAME:
case GERBER_FRAME:
case PCB_FRAME:
case CVPCB_DISPLAY_FRAME:
for( ii = 0; ; ii++ )
{
if ( grid_list_pcb[ii].m_Value )
{
double grid_value = To_User_Unit(g_UnitMetric, grid_list_pcb[ii].m_Value,
((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits);
if ( g_UnitMetric == 0) // inches
line.Printf(wxT("%g mils"), grid_value*1000);
else
line.Printf(wxT("%g mm"), grid_value);
}
else line = _("grid user");
msg = grid_msg + line;
grid_choice->Append( grid_list_pcb[ii].m_Id, msg, wxEmptyString, TRUE );
if( grid_list_pcb[ii].m_Value <= 0 )
{
if( GetScreen()->m_UserGridIsON )
grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
break;
}
if( grid.x == grid_list_pcb[ii].m_Value )
grid_choice->Check( grid_list_pcb[ii].m_Id, TRUE );
}
wxMenu* grid_choice = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, grid_choice,
ID_POPUP_GRID_SELECT, _( "Grid Select" ),
grid_select_xpm );
break;
grid = GetScreen()->GetGrid();
case SCHEMATIC_FRAME:
case LIBEDITOR_FRAME:
for( ii = 0; ; ii++ )
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
{
if( grid_list_schematic[ii].m_Value <= 0 )
break;
double grid_value = To_User_Unit(g_UnitMetric, grid_list_schematic[ii].m_Value,
((WinEDA_DrawFrame*)m_Parent)->m_InternalUnits);
if ( g_UnitMetric == 0) // inches
line.Printf(wxT("%g mils"), grid_value*1000);
tmp = GetScreen()->m_GridList[i];
double grid_value = To_User_Unit( g_UnitMetric,
tmp.m_Size.x,
( (WinEDA_DrawFrame*)m_Parent )->m_InternalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER )
{
msg = _( "User Grid" );
}
else
line.Printf(wxT("%g mm"), grid_value);
msg = grid_msg + line;
grid_choice->Append( grid_list_schematic[ii].m_Id,
msg, wxEmptyString, TRUE );
if( grid.x == grid_list_schematic[ii].m_Value )
grid_choice->Check( grid_list_schematic[ii].m_Id, TRUE );
{
if ( g_UnitMetric == 0 ) // inches
line.Printf( wxT( "%g mils" ), grid_value*1000 );
else
line.Printf( wxT( "%g mm" ), grid_value );
msg = _( "Grid: " ) + line;
}
grid_choice->Append( tmp.m_Id, msg, wxEmptyString, true );
if( grid == tmp.m_Size )
grid_choice->Check( tmp.m_Id, true );
}
break;
case VIEWER_FRAME:
break;
}
MasterMenu->AppendSeparator();