2
* @file class_pl_editor_screen.cpp
8
#include <class_pl_editor_screen.h>
9
#include <base_units.h>
10
#include <pl_editor_id.h>
13
#define MM_GRID( x ) wxRealPoint( x * IU_PER_MM, x * IU_PER_MM )
14
#define ZOOM_FACTOR( x ) ( x * IU_PER_MM / 1000 )
19
Roughly a 1.5 progression.
21
static const double pl_editorZoomList[] =
36
ZOOM_FACTOR( 1000.0 ),
37
ZOOM_FACTOR( 1500.0 ),
38
ZOOM_FACTOR( 2000.0 ),
39
ZOOM_FACTOR( 3000.0 ),
43
// Default grid sizes for PCB editor screens.
44
static GRID_TYPE pl_editorGridList[] =
46
// predefined grid list in mm
47
{ ID_POPUP_GRID_LEVEL_1MM, MM_GRID( 1.0 ) },
48
{ ID_POPUP_GRID_LEVEL_0_5MM, MM_GRID( 0.5 ) },
49
{ ID_POPUP_GRID_LEVEL_0_25MM, MM_GRID( 0.25 ) },
50
{ ID_POPUP_GRID_LEVEL_0_2MM, MM_GRID( 0.2 ) },
51
{ ID_POPUP_GRID_LEVEL_0_1MM, MM_GRID( 0.1 ) },
55
PL_EDITOR_SCREEN::PL_EDITOR_SCREEN( const wxSize& aPageSizeIU ) :
56
BASE_SCREEN( SCREEN_T )
58
for( unsigned i = 0; i < DIM( pl_editorZoomList ); ++i )
59
m_ZoomList.push_back( pl_editorZoomList[i] );
61
for( unsigned i = 0; i < DIM( pl_editorGridList ); ++i )
62
AddGrid( pl_editorGridList[i] );
64
// Set the working grid size to a reasonable value
65
SetGrid( MM_GRID( 1.0 ) );
67
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
69
InitDataPoints( aPageSizeIU );
70
m_NumberOfScreens = 2;
74
PL_EDITOR_SCREEN::~PL_EDITOR_SCREEN()
81
int PL_EDITOR_SCREEN::MilsToIuScalar()
83
return (int)IU_PER_MILS;
87
/* Virtual function needed by classes derived from BASE_SCREEN
88
* this is a virtual pure function in BASE_SCREEN
90
void PL_EDITOR_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList,
96
unsigned icnt = aList.m_CommandsList.size();
101
for( unsigned ii = 0; ii < icnt; ii++ )
103
if( aList.m_CommandsList.size() == 0 )
106
PICKED_ITEMS_LIST* curr_cmd = aList.m_CommandsList[0];
107
aList.m_CommandsList.erase( aList.m_CommandsList.begin() );
109
curr_cmd->ClearListAndDeleteItems();
110
delete curr_cmd; // Delete command