7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-19 00:21:36 +00:00

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 );

Some files were not shown because too many files have changed in this diff Show More