Loading common/CMakeLists.txt +4 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,10 @@ else() set( PCB_COMMON_SRCS ${PCB_COMMON_SRCS} ../pcbnew/item_io.cpp ) endif() # add -DPCBNEW to compilation of these PCBNEW sources set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES COMPILE_DEFINITIONS "PCBNEW" ) add_library(pcbcommon ${PCB_COMMON_SRCS}) Loading common/base_screen.cpp +24 −44 Original line number Diff line number Diff line Loading @@ -35,74 +35,54 @@ #include "id.h" #define CURSOR_SIZE 12 /* size of the cross cursor. */ #define CURSOR_SIZE 12 /// size of the cross cursor. BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType ) BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType ) { m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */ m_UndoRedoCountMax = 10; // undo/Redo command Max depth, 10 is a reasonable value m_FirstRedraw = true; m_ScreenNumber = 1; m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1 m_Zoom = 32.0; m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */ m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50; m_Center = true; m_IsPrinting = false; m_ScrollPixelsPerUnitX = 1; m_ScrollPixelsPerUnitY = 1; } m_FlagModified = false; // Set when any change is made on board. m_FlagSave = false; // Used in auto save set when an auto save is required. BASE_SCREEN::~BASE_SCREEN() { SetCurItem( NULL ); } /* wxSize BASE_SCREEN::ReturnPageSize( void ) { int internal_units = GetInternalUnits(); wxSize size = m_CurrentSheetDesc->m_Size; size.x = (int)( (double)size.x * internal_units / 1000 ); size.y = (int)( (double)size.y * internal_units / 1000 ); return size; } void BASE_SCREEN::SetPageSize( wxSize& aPageSize ) BASE_SCREEN::~BASE_SCREEN() { int internal_units = GetInternalUnits(); m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units); m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units); } */ void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeInternalUnits ) void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU ) { if( m_Center ) { m_crossHairPosition.x = m_crossHairPosition.y = 0; m_DrawOrg.x = -aPageSizeInternalUnits.x / 2; m_DrawOrg.y = -aPageSizeInternalUnits.y / 2; m_DrawOrg.x = -aPageSizeIU.x / 2; m_DrawOrg.y = -aPageSizeIU.y / 2; } else { m_DrawOrg.x = m_DrawOrg.y = 0; m_crossHairPosition.x = aPageSizeInternalUnits.x / 2; m_crossHairPosition.y = aPageSizeInternalUnits.y / 2; m_crossHairPosition.x = aPageSizeIU.x / 2; m_crossHairPosition.y = aPageSizeIU.y / 2; } m_O_Curseur.x = m_O_Curseur.y = 0; SetCurItem( NULL ); m_FlagModified = false; // Set when any change is made on board. m_FlagSave = false; // Used in auto save set when an auto save is required. } Loading Loading @@ -151,13 +131,13 @@ bool BASE_SCREEN::SetFirstZoom() { if( m_Zoom != 1.0 ) { m_Zoom = 1.0; SetZoom( 1.0 ); return true; } } else if( m_Zoom != m_ZoomList[0] ) { m_Zoom = m_ZoomList[0]; SetZoom( m_ZoomList[0] ); return true; } Loading Loading @@ -193,7 +173,7 @@ bool BASE_SCREEN::SetNextZoom() { if( m_Zoom < m_ZoomList[i] ) { m_Zoom = m_ZoomList[i]; SetZoom( m_ZoomList[i] ); return true; } } Loading @@ -213,7 +193,7 @@ bool BASE_SCREEN::SetPreviousZoom() { if( m_Zoom > m_ZoomList[i - 1] ) { m_Zoom = m_ZoomList[i - 1]; SetZoom( m_ZoomList[i - 1] ); return true; } } Loading @@ -227,7 +207,7 @@ bool BASE_SCREEN::SetLastZoom() if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() ) return false; m_Zoom = m_ZoomList.Last(); SetZoom( m_ZoomList.Last() ); return true; } Loading Loading @@ -466,7 +446,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem ) { m_UndoList.PushCommand( aNewitem ); /* Delete the extra items, if count max reached */ // Delete the extra items, if count max reached int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax; if( extraitems > 0 ) // Delete the extra items Loading @@ -478,7 +458,7 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem ) { m_RedoList.PushCommand( aNewitem ); /* Delete the extra items, if count max reached */ // Delete the extra items, if count max reached int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax; if( extraitems > 0 ) // Delete the extra items Loading common/basicframe.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -84,8 +84,10 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, SetSize( 0, 0, minsize.x, minsize.y ); // Create child subwindows. GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); /* dimensions of the user area of the main * window */ // Dimensions of the user area of the main window. GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); m_FramePos.x = m_FramePos.y = 0; m_FrameSize.y -= m_MsgFrameHeight; Loading Loading @@ -180,12 +182,16 @@ void EDA_BASE_FRAME::LoadSettings() { text = m_FrameName + wxT( "Pos_x" ); config->Read( text, &m_FramePos.x ); text = m_FrameName + wxT( "Pos_y" ); config->Read( text, &m_FramePos.y ); text = m_FrameName + wxT( "Size_x" ); config->Read( text, &m_FrameSize.x, 600 ); text = m_FrameName + wxT( "Size_y" ); config->Read( text, &m_FrameSize.y, 400 ); text = m_FrameName + wxT( "Maximized" ); config->Read( text, &maximized, 0 ); Loading Loading @@ -215,9 +221,7 @@ void EDA_BASE_FRAME::LoadSettings() void EDA_BASE_FRAME::SaveSettings() { wxString text; wxConfig* config; config = wxGetApp().GetSettings(); wxConfig* config = wxGetApp().GetSettings(); if( ( config == NULL ) || IsIconized() ) return; Loading @@ -227,12 +231,16 @@ void EDA_BASE_FRAME::SaveSettings() text = m_FrameName + wxT( "Pos_x" ); config->Write( text, (long) m_FramePos.x ); text = m_FrameName + wxT( "Pos_y" ); config->Write( text, (long) m_FramePos.y ); text = m_FrameName + wxT( "Size_x" ); config->Write( text, (long) m_FrameSize.x ); text = m_FrameName + wxT( "Size_y" ); config->Write( text, (long) m_FrameSize.y ); text = m_FrameName + wxT( "Maximized" ); config->Write( text, IsMaximized() ); Loading common/class_plotter.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,6 @@ void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill corner_list.push_back( corner ); PlotPoly( corner_list, fill ); } Loading Loading @@ -428,7 +427,7 @@ void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings ) wxASSERT( !output_file ); pageInfo = aPageSettings; // PAGE_INFO is in mils, plotter works with decimals // PAGE_INFO is in mils, plotter works with deci-mils paper_size = pageInfo.GetSizeMils() * 10; } common/common.cpp +29 −10 Original line number Diff line number Diff line Loading @@ -197,19 +197,32 @@ double PAGE_INFO::s_user_width = 17.0; double PAGE_INFO::s_user_height = 11.0; static const PAGE_INFO pageUser( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) ); /* static const PAGE_INFO* pageSizes[] = { &pageA4, &pageA3, &pageA2, &pageA1, &pageA0, &pageA, &pageB, &pageC, &pageD, &pageE, &pageUser, static const PAGE_INFO* stdPageSizes[] = { &pageA4, &pageA3, &pageA2, &pageA1, &pageA0, &pageA, &pageB, &pageC, &pageD, &pageE, // &pageGERBER, omitted, not standard &pageUser, }; PAGE_INFOS PAGE_INFO::GetStandardSizes() wxArrayString PAGE_INFO::GetStandardSizes() { return PAGE_INFOS( pageSizes, pageSizes + DIM( pageSizes ) ); wxArrayString ret; for( unsigned i=0; i < DIM( stdPageSizes ); ++i ) ret.Add( stdPageSizes[i]->GetType() ); return ret; } */ bool PAGE_INFO::SetType( const wxString& aType ) { Loading @@ -235,6 +248,8 @@ bool PAGE_INFO::SetType( const wxString& aType ) *this = pageD; else if( aType == pageE.GetType() ) *this = pageE; else if( aType == pageGERBER.GetType() ) *this = pageGERBER; else if( aType == pageUser.GetType() ) { *this = pageUser; Loading Loading @@ -278,14 +293,18 @@ PAGE_INFO::PAGE_INFO( const wxString& aType ) void PAGE_INFO::SetWidthInches( double aWidthInInches ) { // limit resolution to 1/1000th of an inch m_widthInches = double( int( aWidthInInches * 1000 + 500 ) / 1000 ); int mils = aWidthInInches * 1000 + 0.5; m_widthInches = mils / 1000.0; } void PAGE_INFO::SetHeightInches( double aHeightInInches ) { // limit resolution to 1/1000th of an inch m_heightInches = double( int( aHeightInInches * 1000 + 500 ) / 1000 ); int mils = aHeightInInches * 1000 + 0.5; m_heightInches = mils / 1000.0; } Loading Loading
common/CMakeLists.txt +4 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,10 @@ else() set( PCB_COMMON_SRCS ${PCB_COMMON_SRCS} ../pcbnew/item_io.cpp ) endif() # add -DPCBNEW to compilation of these PCBNEW sources set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES COMPILE_DEFINITIONS "PCBNEW" ) add_library(pcbcommon ${PCB_COMMON_SRCS}) Loading
common/base_screen.cpp +24 −44 Original line number Diff line number Diff line Loading @@ -35,74 +35,54 @@ #include "id.h" #define CURSOR_SIZE 12 /* size of the cross cursor. */ #define CURSOR_SIZE 12 /// size of the cross cursor. BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType ) BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType ) { m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */ m_UndoRedoCountMax = 10; // undo/Redo command Max depth, 10 is a reasonable value m_FirstRedraw = true; m_ScreenNumber = 1; m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1 m_Zoom = 32.0; m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */ m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50; m_Center = true; m_IsPrinting = false; m_ScrollPixelsPerUnitX = 1; m_ScrollPixelsPerUnitY = 1; } m_FlagModified = false; // Set when any change is made on board. m_FlagSave = false; // Used in auto save set when an auto save is required. BASE_SCREEN::~BASE_SCREEN() { SetCurItem( NULL ); } /* wxSize BASE_SCREEN::ReturnPageSize( void ) { int internal_units = GetInternalUnits(); wxSize size = m_CurrentSheetDesc->m_Size; size.x = (int)( (double)size.x * internal_units / 1000 ); size.y = (int)( (double)size.y * internal_units / 1000 ); return size; } void BASE_SCREEN::SetPageSize( wxSize& aPageSize ) BASE_SCREEN::~BASE_SCREEN() { int internal_units = GetInternalUnits(); m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units); m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units); } */ void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeInternalUnits ) void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU ) { if( m_Center ) { m_crossHairPosition.x = m_crossHairPosition.y = 0; m_DrawOrg.x = -aPageSizeInternalUnits.x / 2; m_DrawOrg.y = -aPageSizeInternalUnits.y / 2; m_DrawOrg.x = -aPageSizeIU.x / 2; m_DrawOrg.y = -aPageSizeIU.y / 2; } else { m_DrawOrg.x = m_DrawOrg.y = 0; m_crossHairPosition.x = aPageSizeInternalUnits.x / 2; m_crossHairPosition.y = aPageSizeInternalUnits.y / 2; m_crossHairPosition.x = aPageSizeIU.x / 2; m_crossHairPosition.y = aPageSizeIU.y / 2; } m_O_Curseur.x = m_O_Curseur.y = 0; SetCurItem( NULL ); m_FlagModified = false; // Set when any change is made on board. m_FlagSave = false; // Used in auto save set when an auto save is required. } Loading Loading @@ -151,13 +131,13 @@ bool BASE_SCREEN::SetFirstZoom() { if( m_Zoom != 1.0 ) { m_Zoom = 1.0; SetZoom( 1.0 ); return true; } } else if( m_Zoom != m_ZoomList[0] ) { m_Zoom = m_ZoomList[0]; SetZoom( m_ZoomList[0] ); return true; } Loading Loading @@ -193,7 +173,7 @@ bool BASE_SCREEN::SetNextZoom() { if( m_Zoom < m_ZoomList[i] ) { m_Zoom = m_ZoomList[i]; SetZoom( m_ZoomList[i] ); return true; } } Loading @@ -213,7 +193,7 @@ bool BASE_SCREEN::SetPreviousZoom() { if( m_Zoom > m_ZoomList[i - 1] ) { m_Zoom = m_ZoomList[i - 1]; SetZoom( m_ZoomList[i - 1] ); return true; } } Loading @@ -227,7 +207,7 @@ bool BASE_SCREEN::SetLastZoom() if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() ) return false; m_Zoom = m_ZoomList.Last(); SetZoom( m_ZoomList.Last() ); return true; } Loading Loading @@ -466,7 +446,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem ) { m_UndoList.PushCommand( aNewitem ); /* Delete the extra items, if count max reached */ // Delete the extra items, if count max reached int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax; if( extraitems > 0 ) // Delete the extra items Loading @@ -478,7 +458,7 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem ) { m_RedoList.PushCommand( aNewitem ); /* Delete the extra items, if count max reached */ // Delete the extra items, if count max reached int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax; if( extraitems > 0 ) // Delete the extra items Loading
common/basicframe.cpp +16 −8 Original line number Diff line number Diff line Loading @@ -84,8 +84,10 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, SetSize( 0, 0, minsize.x, minsize.y ); // Create child subwindows. GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); /* dimensions of the user area of the main * window */ // Dimensions of the user area of the main window. GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); m_FramePos.x = m_FramePos.y = 0; m_FrameSize.y -= m_MsgFrameHeight; Loading Loading @@ -180,12 +182,16 @@ void EDA_BASE_FRAME::LoadSettings() { text = m_FrameName + wxT( "Pos_x" ); config->Read( text, &m_FramePos.x ); text = m_FrameName + wxT( "Pos_y" ); config->Read( text, &m_FramePos.y ); text = m_FrameName + wxT( "Size_x" ); config->Read( text, &m_FrameSize.x, 600 ); text = m_FrameName + wxT( "Size_y" ); config->Read( text, &m_FrameSize.y, 400 ); text = m_FrameName + wxT( "Maximized" ); config->Read( text, &maximized, 0 ); Loading Loading @@ -215,9 +221,7 @@ void EDA_BASE_FRAME::LoadSettings() void EDA_BASE_FRAME::SaveSettings() { wxString text; wxConfig* config; config = wxGetApp().GetSettings(); wxConfig* config = wxGetApp().GetSettings(); if( ( config == NULL ) || IsIconized() ) return; Loading @@ -227,12 +231,16 @@ void EDA_BASE_FRAME::SaveSettings() text = m_FrameName + wxT( "Pos_x" ); config->Write( text, (long) m_FramePos.x ); text = m_FrameName + wxT( "Pos_y" ); config->Write( text, (long) m_FramePos.y ); text = m_FrameName + wxT( "Size_x" ); config->Write( text, (long) m_FrameSize.x ); text = m_FrameName + wxT( "Size_y" ); config->Write( text, (long) m_FrameSize.y ); text = m_FrameName + wxT( "Maximized" ); config->Write( text, IsMaximized() ); Loading
common/class_plotter.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -119,7 +119,6 @@ void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill corner_list.push_back( corner ); PlotPoly( corner_list, fill ); } Loading Loading @@ -428,7 +427,7 @@ void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings ) wxASSERT( !output_file ); pageInfo = aPageSettings; // PAGE_INFO is in mils, plotter works with decimals // PAGE_INFO is in mils, plotter works with deci-mils paper_size = pageInfo.GetSizeMils() * 10; }
common/common.cpp +29 −10 Original line number Diff line number Diff line Loading @@ -197,19 +197,32 @@ double PAGE_INFO::s_user_width = 17.0; double PAGE_INFO::s_user_height = 11.0; static const PAGE_INFO pageUser( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) ); /* static const PAGE_INFO* pageSizes[] = { &pageA4, &pageA3, &pageA2, &pageA1, &pageA0, &pageA, &pageB, &pageC, &pageD, &pageE, &pageUser, static const PAGE_INFO* stdPageSizes[] = { &pageA4, &pageA3, &pageA2, &pageA1, &pageA0, &pageA, &pageB, &pageC, &pageD, &pageE, // &pageGERBER, omitted, not standard &pageUser, }; PAGE_INFOS PAGE_INFO::GetStandardSizes() wxArrayString PAGE_INFO::GetStandardSizes() { return PAGE_INFOS( pageSizes, pageSizes + DIM( pageSizes ) ); wxArrayString ret; for( unsigned i=0; i < DIM( stdPageSizes ); ++i ) ret.Add( stdPageSizes[i]->GetType() ); return ret; } */ bool PAGE_INFO::SetType( const wxString& aType ) { Loading @@ -235,6 +248,8 @@ bool PAGE_INFO::SetType( const wxString& aType ) *this = pageD; else if( aType == pageE.GetType() ) *this = pageE; else if( aType == pageGERBER.GetType() ) *this = pageGERBER; else if( aType == pageUser.GetType() ) { *this = pageUser; Loading Loading @@ -278,14 +293,18 @@ PAGE_INFO::PAGE_INFO( const wxString& aType ) void PAGE_INFO::SetWidthInches( double aWidthInInches ) { // limit resolution to 1/1000th of an inch m_widthInches = double( int( aWidthInInches * 1000 + 500 ) / 1000 ); int mils = aWidthInInches * 1000 + 0.5; m_widthInches = mils / 1000.0; } void PAGE_INFO::SetHeightInches( double aHeightInInches ) { // limit resolution to 1/1000th of an inch m_heightInches = double( int( aHeightInInches * 1000 + 500 ) / 1000 ); int mils = aHeightInInches * 1000 + 0.5; m_heightInches = mils / 1000.0; } Loading