2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file classpcb.cpp
|
|
|
|
* @brief Member functions of classes used in Pcbnew (see pcbstruct.h)
|
|
|
|
* except for tracks (see class_track.cpp).
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <class_pcb_screen.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <class_board_design_settings.h>
|
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
2008-12-05 16:03:05 +00:00
|
|
|
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/* Default Pcbnew zoom values.
|
2009-03-12 15:24:52 +00:00
|
|
|
* Limited to 19 values to keep a decent size to menus
|
|
|
|
* 15 it better but does not allow a sufficient number of values
|
|
|
|
* roughtly a 1.5 progression.
|
|
|
|
* The last 2 values is handy when somebody uses a library import of a module
|
|
|
|
* (or foreign data) which has a bad coordinate
|
2011-09-30 18:15:37 +00:00
|
|
|
* Also useful in GerbView for this reason.
|
2011-09-23 13:57:12 +00:00
|
|
|
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
|
|
|
|
* functions )
|
2009-02-06 11:45:35 +00:00
|
|
|
*/
|
2011-12-31 05:44:00 +00:00
|
|
|
static const double pcbZoomList[] =
|
2009-06-18 13:30:52 +00:00
|
|
|
{
|
2011-07-05 12:46:14 +00:00
|
|
|
0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0,
|
|
|
|
10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0,
|
|
|
|
200.0, 350.0, 500.0, 1000.0, 2000.0
|
2009-03-12 15:24:52 +00:00
|
|
|
};
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
#define MM_TO_PCB_UNITS (10000.0 / 25.4)
|
2009-01-29 14:26:20 +00:00
|
|
|
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// Default grid sizes for PCB editor screens.
|
|
|
|
static GRID_TYPE pcbGridList[] =
|
2009-06-18 13:30:52 +00:00
|
|
|
{
|
2009-03-12 15:24:52 +00:00
|
|
|
// predefined grid list in 0.0001 inches
|
2009-10-14 19:43:31 +00:00
|
|
|
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_500, wxRealPoint( 500, 500 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_250, wxRealPoint( 250, 250 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_200, wxRealPoint( 200, 200 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_100, wxRealPoint( 100, 100 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_50, wxRealPoint( 50, 50 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_25, wxRealPoint( 25, 25 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_20, wxRealPoint( 20, 20 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_10, wxRealPoint( 10, 10 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_5, wxRealPoint( 5, 5 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_2, wxRealPoint( 2, 2 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_1, wxRealPoint( 1, 1 ) },
|
2009-03-12 15:24:52 +00:00
|
|
|
|
|
|
|
// predefined grid list in mm
|
2009-10-14 19:43:31 +00:00
|
|
|
{ ID_POPUP_GRID_LEVEL_5MM, wxRealPoint( MM_TO_PCB_UNITS * 5.0, MM_TO_PCB_UNITS * 5.0 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_2_5MM, wxRealPoint( MM_TO_PCB_UNITS * 2.5, MM_TO_PCB_UNITS * 2.5 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_1MM, wxRealPoint( MM_TO_PCB_UNITS, MM_TO_PCB_UNITS ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.5, MM_TO_PCB_UNITS * 0.5 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_25MM, wxRealPoint( MM_TO_PCB_UNITS * 0.25, MM_TO_PCB_UNITS * 0.25 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_2MM, wxRealPoint( MM_TO_PCB_UNITS * 0.2, MM_TO_PCB_UNITS * 0.2 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.1, MM_TO_PCB_UNITS * 0.1 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_0_5MM, wxRealPoint( MM_TO_PCB_UNITS * 0.05, MM_TO_PCB_UNITS * 0.05 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_0_25MM, wxRealPoint( MM_TO_PCB_UNITS * 0.025, MM_TO_PCB_UNITS * 0.025 ) },
|
|
|
|
{ ID_POPUP_GRID_LEVEL_0_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.01, MM_TO_PCB_UNITS * 0.01 ) }
|
2008-12-05 16:03:05 +00:00
|
|
|
};
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
|
|
|
|
BASE_SCREEN( SCREEN_T )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-31 05:44:00 +00:00
|
|
|
for( unsigned i = 0; i < DIM( pcbZoomList ); ++i )
|
|
|
|
m_ZoomList.Add( pcbZoomList[i] );
|
2008-12-05 16:03:05 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
for( unsigned i = 0; i < DIM( pcbGridList ); ++i )
|
|
|
|
AddGrid( pcbGridList[i] );
|
2007-08-06 21:02:23 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// Set the working grid size to a reasonnable value (in 1/10000 inch)
|
|
|
|
SetGrid( wxRealPoint( 500, 500 ) );
|
|
|
|
|
|
|
|
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
|
|
|
|
m_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top)
|
|
|
|
m_Route_Layer_BOTTOM = LAYER_N_BACK;
|
2011-12-31 05:44:00 +00:00
|
|
|
|
|
|
|
SetZoom( 150 ); // a default value for zoom
|
|
|
|
|
|
|
|
InitDataPoints( aPageSizeIU );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-06 21:02:23 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
PCB_SCREEN::~PCB_SCREEN()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-07-29 13:10:36 +00:00
|
|
|
ClearUndoRedoList();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-02-06 11:45:35 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
int PCB_SCREEN::GetInternalUnits()
|
2008-12-05 16:03:05 +00:00
|
|
|
{
|
|
|
|
return PCB_INTERNAL_UNIT;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-06 11:45:35 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
DISPLAY_OPTIONS::DISPLAY_OPTIONS()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-10-10 01:25:53 +00:00
|
|
|
DisplayPadFill = FILLED;
|
|
|
|
DisplayViaFill = FILLED;
|
|
|
|
DisplayPadNum = true;
|
|
|
|
DisplayPadIsol = true;
|
|
|
|
|
|
|
|
DisplayModEdge = true;
|
|
|
|
DisplayModText = true;
|
2011-12-31 05:44:00 +00:00
|
|
|
DisplayPcbTrackFill = true; // false = sketch , true = filled
|
2009-10-10 01:25:53 +00:00
|
|
|
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
|
|
|
|
m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
|
|
|
|
|
|
|
|
DisplayPolarCood = false; /* false = display absolute coordinates,
|
|
|
|
* true = display polar cordinates */
|
|
|
|
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
|
|
|
|
* 1 = do not show filled areas outlines
|
|
|
|
* 2 = show outlines of filled areas */
|
|
|
|
DisplayNetNamesMode = 3; /* 0 do not show netnames,
|
|
|
|
* 1 show netnames on pads
|
|
|
|
* 2 show netnames on tracks
|
|
|
|
* 3 show netnames on tracks and pads */
|
|
|
|
DisplayDrawItems = true;
|
|
|
|
ContrastModeDisplay = false;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|