diff --git a/CMakeLists.txt b/CMakeLists.txt
index f91ae3b14a..a6a99bab13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,8 +22,8 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(USE_PNG_BITMAPS "use PNG bitmaps instead of XPM (default ON)" ON)
-option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format (default OFF)" OFF)
-option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format (default OFF)" OFF)
+option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format" OFF)
+option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format" OFF)
# Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
@@ -265,6 +265,11 @@ add_subdirectory(bitmap2component)
add_subdirectory(pcb_calculator)
#add_subdirectory(new)
+
+add_executable( container_test EXCLUDE_FROM_ALL container_test.cpp )
+target_link_libraries( container_test common polygon bitmaps ${wxWidgets_LIBRARIES} )
+
+
#############
# Resources #
#############
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 7222af5420..a293a12363 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -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})
diff --git a/common/base_screen.cpp b/common/base_screen.cpp
index 1ef0b27de1..8c1d579262 100644
--- a/common/base_screen.cpp
+++ b/common/base_screen.cpp
@@ -35,26 +35,28 @@
#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_drawList = NULL; /* Draw items list */
- 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_CurrentSheetDesc = &g_Sheet_A4;
m_IsPrinting = false;
m_ScrollPixelsPerUnitX = 1;
m_ScrollPixelsPerUnitY = 1;
- InitDatas();
+ 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.
+
+ SetCurItem( NULL );
}
@@ -63,27 +65,24 @@ BASE_SCREEN::~BASE_SCREEN()
}
-void BASE_SCREEN::InitDatas()
+void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU )
{
if( m_Center )
{
m_crossHairPosition.x = m_crossHairPosition.y = 0;
- m_DrawOrg.x = -ReturnPageSize().x / 2;
- m_DrawOrg.y = -ReturnPageSize().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 = ReturnPageSize().x / 2;
- m_crossHairPosition.y = ReturnPageSize().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 broad.
- m_FlagSave = false; // Used in auto save set when an auto save is required.
}
@@ -93,25 +92,6 @@ int BASE_SCREEN::GetInternalUnits( void )
}
-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 )
-{
- 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);
-}
-
-
double BASE_SCREEN::GetScalingFactor() const
{
double scale = 1.0 / GetZoom();
@@ -124,12 +104,12 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
double zoom = aScale;
// Limit zoom to max and min allowed values:
- if (zoom < m_ZoomList[0])
+ if( zoom < m_ZoomList[0] )
zoom = m_ZoomList[0];
int idxmax = m_ZoomList.GetCount() - 1;
- if (zoom > m_ZoomList[idxmax])
+ if( zoom > m_ZoomList[idxmax] )
zoom = m_ZoomList[idxmax];
SetZoom( zoom );
@@ -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;
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
@@ -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
@@ -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
@@ -502,15 +482,15 @@ PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( )
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
{
- EDA_ITEM* item = m_drawList;
-
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
- for( ; item; item = item->Next() )
+ /* this class will eventually go away, but here's a place holder until then.
+ for( EDA_ITEM* item = m_drawList; item; item = item->Next() )
{
item->Show( nestLevel+1, os );
}
+ */
NestedSpace( nestLevel, os ) << "" << GetClass().Lower().mb_str() << ">\n";
}
diff --git a/common/basicframe.cpp b/common/basicframe.cpp
index ba30fa7e74..cc0790e505 100644
--- a/common/basicframe.cpp
+++ b/common/basicframe.cpp
@@ -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;
@@ -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 );
@@ -214,10 +220,8 @@ void EDA_BASE_FRAME::LoadSettings()
void EDA_BASE_FRAME::SaveSettings()
{
- wxString text;
- wxConfig* config;
-
- config = wxGetApp().GetSettings();
+ wxString text;
+ wxConfig* config = wxGetApp().GetSettings();
if( ( config == NULL ) || IsIconized() )
return;
@@ -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() );
@@ -270,7 +278,7 @@ void EDA_BASE_FRAME::DisplayActivity( int PerCent, const wxString& Text )
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxFileHistory * aFileHistory )
{
- wxFileHistory * fileHistory = aFileHistory;
+ wxFileHistory* fileHistory = aFileHistory;
if( fileHistory == NULL )
fileHistory = & wxGetApp().GetFileHistory();
@@ -284,7 +292,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
{
wxString fn, msg;
size_t i;
- wxFileHistory * fileHistory = aFileHistory;
+ wxFileHistory* fileHistory = aFileHistory;
if( fileHistory == NULL )
fileHistory = & wxGetApp().GetFileHistory();
diff --git a/common/class_plotter.cpp b/common/class_plotter.cpp
index 1908b9d64b..78273375b5 100644
--- a/common/class_plotter.cpp
+++ b/common/class_plotter.cpp
@@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
output_file = 0;
color_mode = false; /* Start as a BW plot */
negative_mode = false;
- sheet = NULL;
}
@@ -120,7 +119,6 @@ void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill
corner_list.push_back( corner );
PlotPoly( corner_list, fill );
-
}
@@ -424,12 +422,12 @@ void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
}
-void PLOTTER::set_paper_size( Ki_PageDescr* asheet )
+void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( !output_file );
- sheet = asheet;
+ pageInfo = aPageSettings;
- // Sheets are in mils, plotter works with decimals
- paper_size.x = sheet->m_Size.x * 10;
- paper_size.y = sheet->m_Size.y * 10;
+ // PAGE_INFO is in mils, plotter works with deci-mils
+ paper_size = pageInfo.GetSizeMils() * 10;
}
+
diff --git a/common/common.cpp b/common/common.cpp
index 14d5fc8a96..38c80cf39f 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -46,31 +46,6 @@
* application class.
*/
-/* Standard page sizes in 1/1000 inch */
-#if defined(KICAD_GOST)
-Ki_PageDescr g_Sheet_A4( wxSize( 8283, 11700 ), wxPoint( 0, 0 ), wxT( "A4" ) );
-#else
-Ki_PageDescr g_Sheet_A4( wxSize( 11700, 8267 ), wxPoint( 0, 0 ), wxT( "A4" ) );
-#endif
-Ki_PageDescr g_Sheet_A3( wxSize( 16535, 11700 ), wxPoint( 0, 0 ), wxT( "A3" ) );
-Ki_PageDescr g_Sheet_A2( wxSize( 23400, 16535 ), wxPoint( 0, 0 ), wxT( "A2" ) );
-Ki_PageDescr g_Sheet_A1( wxSize( 33070, 23400 ), wxPoint( 0, 0 ), wxT( "A1" ) );
-Ki_PageDescr g_Sheet_A0( wxSize( 46800, 33070 ), wxPoint( 0, 0 ), wxT( "A0" ) );
-Ki_PageDescr g_Sheet_A( wxSize( 11000, 8500 ), wxPoint( 0, 0 ), wxT( "A" ) );
-Ki_PageDescr g_Sheet_B( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "B" ) );
-Ki_PageDescr g_Sheet_C( wxSize( 22000, 17000 ), wxPoint( 0, 0 ), wxT( "C" ) );
-Ki_PageDescr g_Sheet_D( wxSize( 34000, 22000 ), wxPoint( 0, 0 ), wxT( "D" ) );
-Ki_PageDescr g_Sheet_E( wxSize( 44000, 34000 ), wxPoint( 0, 0 ), wxT( "E" ) );
-Ki_PageDescr g_Sheet_GERBER( wxSize( 32000, 32000 ), wxPoint( 0, 0 ), wxT( "GERBER" ) );
-Ki_PageDescr g_Sheet_user( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) );
-
-Ki_PageDescr* g_SheetSizeList[NB_ITEMS + 1] =
-{
- &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
- &g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
- &g_Sheet_user, NULL
-};
-
const wxString ProjectFileExtension( wxT( "pro" ) );
const wxString SchematicFileExtension( wxT( "sch" ) );
@@ -199,25 +174,145 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
}
-Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
-{
- // All sizes are in 1/1000 inch
- m_Size = size;
- m_Offset = offset;
- m_Name = name;
+//------------------------------------------------------------------
- // Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
+// Standard page sizes in mils
#if defined(KICAD_GOST)
- m_LeftMargin = GOST_LEFTMARGIN;
- m_RightMargin = GOST_RIGHTMARGIN;
- m_TopMargin = GOST_TOPMARGIN;
- m_BottomMargin = GOST_BOTTOMMARGIN;
+const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) );
#else
- m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
+const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11700, 8267 ), wxT( "A4" ) );
+#endif
+const PAGE_INFO PAGE_INFO::pageA3( wxSize( 16535, 11700 ), wxT( "A3" ) );
+const PAGE_INFO PAGE_INFO::pageA2( wxSize( 23400, 16535 ), wxT( "A2" ) );
+const PAGE_INFO PAGE_INFO::pageA1( wxSize( 33070, 23400 ), wxT( "A1" ) );
+const PAGE_INFO PAGE_INFO::pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) );
+const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ) );
+const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ) );
+const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ) );
+const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ) );
+const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ) );
+const PAGE_INFO PAGE_INFO::pageGERBER(wxSize( 32000, 32000 ), wxT( "GERBER" ) );
+const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), wxT( "User" ) );
+
+int PAGE_INFO::s_user_width = 17000;
+int PAGE_INFO::s_user_height = 11000;
+
+/*
+wxArrayString PAGE_INFO::GetStandardSizes()
+{
+ wxArrayString ret;
+
+ static const PAGE_INFO* stdPageSizes[] = {
+ &pageA4,
+ &pageA3,
+ &pageA2,
+ &pageA1,
+ &pageA0,
+ &pageA,
+ &pageB,
+ &pageC,
+ &pageD,
+ &pageE,
+ // &pageGERBER, // standard?
+ &pageUser,
+ };
+
+ for( unsigned i=0; i < DIM( stdPageSizes ); ++i )
+ ret.Add( stdPageSizes[i]->GetType() );
+
+ return ret;
+}
+*/
+
+bool PAGE_INFO::SetType( const wxString& aType )
+{
+ bool rc = true;
+
+ if( aType == pageA4.GetType() )
+ *this = pageA4;
+ else if( aType == pageA3.GetType() )
+ *this = pageA3;
+ else if( aType == pageA2.GetType() )
+ *this = pageA2;
+ else if( aType == pageA1.GetType() )
+ *this = pageA1;
+ else if( aType == pageA0.GetType() )
+ *this = pageA0;
+ else if( aType == pageA.GetType() )
+ *this = pageA;
+ else if( aType == pageB.GetType() )
+ *this = pageB;
+ else if( aType == pageC.GetType() )
+ *this = pageC;
+ else if( aType == pageD.GetType() )
+ *this = pageD;
+ else if( aType == pageE.GetType() )
+ *this = pageE;
+ else if( aType == pageGERBER.GetType() )
+ *this = pageGERBER;
+ else if( aType == pageUser.GetType() )
+ {
+ // pageUser is const, and may not and does not hold the custom size,
+ // so customize *this later
+ *this = pageUser;
+
+ // customize:
+ m_size.x = s_user_width;
+ m_size.y = s_user_height;
+ }
+ else
+ rc = false;
+
+ return rc;
+}
+
+
+PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) :
+ m_size( aSizeMils )
+{
+ m_type = aType;
+
+#if defined(KICAD_GOST)
+ m_left_margin = GOST_LEFTMARGIN;
+ m_right_margin = GOST_RIGHTMARGIN;
+ m_top_margin = GOST_TOPMARGIN;
+ m_bottom_margin = GOST_BOTTOMMARGIN;
+#else
+ m_left_margin = m_right_margin = m_top_margin = m_bottom_margin = 400;
#endif
}
+PAGE_INFO::PAGE_INFO( const wxString& aType )
+{
+ SetType( aType );
+}
+
+
+void PAGE_INFO::SetUserWidthMils( int aWidthInMils )
+{
+ if( aWidthInMils < 6000 )
+ aWidthInMils = 6000;
+ else if( aWidthInMils > 44000 )
+ aWidthInMils = 44000;
+
+ s_user_width = aWidthInMils;
+}
+
+void PAGE_INFO::SetUserHeightMils( int aHeightInMils )
+{
+ if( aHeightInMils < 4000 )
+ aHeightInMils = 4000;
+ else if( aHeightInMils > 44000 )
+ aHeightInMils = 44000;
+
+ s_user_height = aHeightInMils;
+}
+
+
+//-----------------------------------------------------------------
+
+
wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString )
{
wxString tmp;
diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp
index d19689266a..41ea7ed8d2 100644
--- a/common/common_plotHPGL_functions.cpp
+++ b/common/common_plotHPGL_functions.cpp
@@ -12,19 +12,17 @@
#include "macros.h"
#include "kicad_string.h"
-/* HPGL scale factor. */
+// HPGL scale factor.
const double SCALE_HPGL = 0.102041;
-/* Set the plot offset for the current plotting
- */
void HPGL_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_offset = aOffset;
plot_scale = aScale;
device_scale = SCALE_HPGL;
- set_default_line_width( 100 ); /* default line width in 1 / 1000 inch */
+ set_default_line_width( 100 ); // default line width in 1 / 1000 inch
plotMirror = aMirror;
}
@@ -88,7 +86,7 @@ void HPGL_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill,
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
line_to( aCornerList[ii] );
- /* Close polygon if filled. */
+ // Close polygon if filled.
if( aFill )
{
int ii = aCornerList.size() - 1;
@@ -172,16 +170,19 @@ void HPGL_PLOTTER::pen_control( int plume )
void HPGL_PLOTTER::pen_to( wxPoint pos, char plume )
{
wxASSERT( output_file );
+
if( plume == 'Z' )
{
pen_control( 'Z' );
return;
}
+
pen_control( plume );
user_to_device_coordinates( pos );
if( pen_lastpos != pos )
fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y );
+
pen_lastpos = pos;
}
@@ -246,7 +247,7 @@ void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
angle = (StAngle - EndAngle) / 10.0;
else
angle = (EndAngle - StAngle) / 10.0;
- /* Calculate start point, */
+ // Calculate start point,
cmap.x = (int) ( centre.x + ( rayon * cos( StAngle * M_PI / 1800 ) ) );
cmap.y = (int) ( centre.y - ( rayon * sin( StAngle * M_PI / 1800 ) ) );
user_to_device_coordinates( cmap );
@@ -280,7 +281,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( orient >= 3600 )
orient -= 3600;
}
- deltaxy = size.y - size.x; /* distance between centers of the oval */
+ deltaxy = size.y - size.x; // distance between centers of the oval
if( trace_mode == FILLED )
{
@@ -295,7 +296,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
flash_pad_circle( wxPoint( cx + pos.x,
cy + pos.y ), size.x, trace_mode );
}
- else /* Plot in SKETCH mode. */
+ else // Plot in SKETCH mode.
{
sketch_oval( pos, size, orient, wxRound( pen_diameter ) );
}
@@ -330,7 +331,7 @@ void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
fprintf( output_file, "PA %d,%d;CI %d;\n", pos.x, pos.y, rsize.x );
- if( trace_mode == FILLED ) /* Plot in filled mode. */
+ if( trace_mode == FILLED ) // Plot in filled mode.
{
if( delta > 0 )
{
@@ -378,7 +379,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( size.y < 0 )
size.y = 0;
- /* If a dimension is zero, the trace is reduced to 1 line. */
+ // If a dimension is zero, the trace is reduced to 1 line.
if( size.x == 0 )
{
ox = pos.x;
@@ -428,7 +429,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( trace_mode == FILLED )
{
- /* Plot in filled mode. */
+ // Plot in filled mode.
delta = (int) (pen_diameter - pen_overlap);
if( delta > 0 )
@@ -510,11 +511,11 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
{
// TODO: replace this par the HPGL plot polygon.
int jj;
- /* Fill the shape */
+ // Fill the shape
move = wxRound( pen_diameter - pen_overlap );
- /* Calculate fill height. */
+ // Calculate fill height.
- if( polygone[0].y == polygone[3].y ) /* Horizontal */
+ if( polygone[0].y == polygone[3].y ) // Horizontal
{
jj = polygone[3].y - (int) ( pen_diameter + ( 2 * pen_overlap ) );
}
@@ -523,10 +524,10 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
jj = polygone[3].x - (int) ( pen_diameter + ( 2 * pen_overlap ) );
}
- /* Calculation of dd = number of segments was traced to fill. */
+ // Calculation of dd = number of segments was traced to fill.
jj = jj / (int) ( pen_diameter - pen_overlap );
- /* Trace the outline. */
+ // Trace the outline.
for( ; jj > 0; jj-- )
{
polygone[0].x += move;
@@ -538,7 +539,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
polygone[3].x -= move;
polygone[3].y -= move;
- /* Test for crossed vertexes. */
+ // Test for crossed vertexes.
if( polygone[0].x > polygone[3].x ) /* X axis intersection on
*vertexes 0 and 3 */
{
diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp
index 4eefbb4bfd..fd187a2798 100644
--- a/common/common_plotPS_functions.cpp
+++ b/common/common_plotPS_functions.cpp
@@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
fprintf( output_file, "%%%%Pages: 1\n" );
fprintf( output_file, "%%%%PageOrder: Ascend\n" );
- // Print boundary box in 1/72 pixels per inch, box is in decimals
+ // Print boundary box in 1/72 pixels per inch, box is in deci-mils
const double CONV_SCALE = DECIMIL_TO_INCH * 72;
// The coordinates of the lower left corner of the boundary
@@ -388,18 +388,20 @@ bool PS_PLOTTER::start_plot( FILE* fout )
//
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// the order in which they are specified is not wrong!)
- // Also note sheet->m_Size is given in mils, not in decimils and must be
- // sheet->m_Size * 10 in decimals
- if( sheet->m_Name.Cmp( wxT( "User" ) ) == 0 )
+ // Also note pageSize is given in mils, not in internal units and must be
+ // converted to internal units.
+ wxSize pageSize = pageInfo.GetSizeMils();
+
+ if( pageInfo.GetType().Cmp( wxT( "User" ) ) == 0 )
fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
- wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
- wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );
+ wxRound( pageSize.y * 10 * CONV_SCALE ),
+ wxRound( pageSize.x * 10 * CONV_SCALE ) );
else // ( if sheet->m_Name does not equal "User" )
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
- TO_UTF8( sheet->m_Name ),
- wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
- wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );
+ TO_UTF8( pageInfo.GetType() ),
+ wxRound( pageSize.y * 10 * CONV_SCALE ),
+ wxRound( pageSize.x * 10 * CONV_SCALE ) );
fprintf( output_file, "%%%%Orientation: Landscape\n" );
diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp
index d1156541ae..d46ee07b79 100644
--- a/common/common_plot_functions.cpp
+++ b/common/common_plot_functions.cpp
@@ -21,18 +21,22 @@
*/
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
{
-#define WSTEXTSIZE 50 // Text size in mils
- Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
- int xg, yg;
- wxSize PageSize;
- wxPoint pos, ref;
- EDA_Colors color;
+#define WSTEXTSIZE 50 // Text size in mils
- /* Scale to convert dimension in 1/1000 in into internal units
- * (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */
+ const PAGE_INFO& pageInfo = GetPageSettings();
+ wxSize pageSize = pageInfo.GetSizeMils(); // mils
+ int xg, yg;
+
+ wxPoint pos, ref;
+ EDA_Colors color;
+
+ // paper is sized in mils. Here is a conversion factor to
+ // scale mils to internal units.
int conv_unit = screen->GetInternalUnits() / 1000;
+
wxString msg;
wxSize text_size;
+
#if defined(KICAD_GOST)
wxSize text_size2;
wxSize text_size3;
@@ -41,20 +45,19 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool bold = false;
#endif
- bool italic = false;
+
+ bool italic = false;
bool thickness = 0; //@todo : use current pen
color = BLACK;
plotter->set_color( color );
- PageSize.x = Sheet->m_Size.x;
- PageSize.y = Sheet->m_Size.y;
+ // Plot edge.
+ ref.x = pageInfo.GetLeftMarginMils() * conv_unit;
+ ref.y = pageInfo.GetTopMarginMils() * conv_unit;
- /* Plot edge. */
- ref.x = Sheet->m_LeftMargin * conv_unit;
- ref.y = Sheet->m_TopMargin * conv_unit;
- xg = ( PageSize.x - Sheet->m_RightMargin ) * conv_unit;
- yg = ( PageSize.y - Sheet->m_BottomMargin ) * conv_unit;
+ xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
+ yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * conv_unit;
#if defined(KICAD_GOST)
plotter->move_to( ref );
@@ -68,22 +71,30 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
+
#else
+
for( unsigned ii = 0; ii < 2; ii++ )
{
plotter->move_to( ref );
+
pos.x = xg;
pos.y = ref.y;
plotter->line_to( pos );
+
pos.x = xg;
pos.y = yg;
plotter->line_to( pos );
+
pos.x = ref.x;
pos.y = yg;
plotter->line_to( pos );
+
plotter->finish_to( ref );
+
ref.x += GRID_REF_W * conv_unit;
ref.y += GRID_REF_W * conv_unit;
+
xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit;
}
@@ -93,12 +104,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size.x = WSTEXTSIZE * conv_unit;
text_size.y = WSTEXTSIZE * conv_unit;
- ref.x = Sheet->m_LeftMargin;
- ref.y = Sheet->m_TopMargin; /* Upper left corner in
- * 1/1000 inch */
- xg = ( PageSize.x - Sheet->m_RightMargin );
- yg = ( PageSize.y - Sheet->m_BottomMargin ); /* lower right corner
- * in 1/1000 inch */
+ // upper left corner in mils
+ ref.x = pageInfo.GetLeftMarginMils();
+ ref.y = pageInfo.GetTopMarginMils();
+
+ // lower right corner in mils
+ xg = ( pageSize.x - pageInfo.GetRightMarginMils() );
+ yg = ( pageSize.y - pageInfo.GetBottomMarginMils() );
#if defined(KICAD_GOST)
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
@@ -151,7 +163,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#else
- /* Plot legend along the X axis. */
+ // Plot legend along the X axis.
int ipas = ( xg - ref.x ) / PAS_REF;
int gxpas = ( xg - ref.x ) / ipas;
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
@@ -193,7 +205,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
thickness, italic, false );
}
- /* Plot legend along the Y axis. */
+ // Plot legend along the Y axis.
ipas = ( yg - ref.y ) / PAS_REF;
int gypas = ( yg - ref.y ) / ipas;
for( int ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
@@ -237,9 +249,10 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif
- /* Plot the worksheet. */
+ // Plot the worksheet.
text_size.x = SIZETEXT * conv_unit;
text_size.y = SIZETEXT * conv_unit;
+
#if defined(KICAD_GOST)
text_size2.x = SIZETEXT * conv_unit * 2;
text_size2.y = SIZETEXT * conv_unit * 2;
@@ -247,8 +260,9 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size3.y = SIZETEXT * conv_unit * 3;
text_size1_5.x = SIZETEXT * conv_unit * 1.5;
text_size1_5.y = SIZETEXT * conv_unit * 1.5;
- ref.x = PageSize.x - Sheet->m_RightMargin;
- ref.y = PageSize.y - Sheet->m_BottomMargin;
+
+ ref.x = pageSize.x - pageInfo.GetRightMarginMils();
+ ref.y = pageSize.y - pageInfo.GetBottomMarginMils();
if( screen->m_ScreenNumber == 1 )
{
@@ -287,7 +301,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
if( screen->m_NumberOfScreen > 1 )
- msg << screen->m_ScreenNumber;
+ msg << screen->m_ScreenNumber;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
@@ -297,7 +311,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_SHEETS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
- msg << screen->m_NumberOfScreen;
+ msg << screen->m_NumberOfScreen;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
@@ -334,8 +348,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
- pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
- pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
+ pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
+ pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color,
msg.GetData(), 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@@ -400,7 +414,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
switch( WsItem->m_Type )
{
case WS_CADRE:
- /* Begin list number > 1 */
+ // Begin list number > 1
msg = screen->m_Commentaire1;
if( !msg.IsEmpty() )
{
@@ -408,8 +422,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
- pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
- pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
+ pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
+ pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color,
msg, 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@@ -444,9 +458,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
}
}
}
+
#else
- ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
- ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
+
+ ref.x = pageSize.x - GRID_REF_W - pageInfo.GetRightMarginMils();
+ ref.y = pageSize.y - GRID_REF_W - pageInfo.GetBottomMarginMils();
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
@@ -477,7 +493,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break;
case WS_SIZESHEET:
- msg += screen->m_CurrentSheetDesc->m_Name;
+ msg += pageInfo.GetType();
break;
case WS_IDENTSHEET:
diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp
index 7ebc275b81..140df7f1c9 100644
--- a/common/dialogs/dialog_page_settings.cpp
+++ b/common/dialogs/dialog_page_settings.cpp
@@ -16,6 +16,7 @@
#include "wxstruct.h"
#include "wx/valgen.h"
+#include
#ifdef EESCHEMA
#include "general.h"
@@ -23,14 +24,6 @@
#include "dialog_page_settings.h"
-#define NB_ITEMS 11
-Ki_PageDescr* SheetList[NB_ITEMS + 1] =
-{
- &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
- &g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
- &g_Sheet_user, NULL
-};
-
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
{
@@ -43,13 +36,12 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
- DIALOG_PAGES_SETTINGS_BASE( parent )
+ DIALOG_PAGES_SETTINGS_BASE( parent ),
+ m_user_size( wxT( "User" ) )
{
m_Parent = parent;
m_Screen = m_Parent->GetScreen();
- m_Modified = 0;
- m_SelectedSheet = NULL;
- m_CurrentSelection = 0;
+ m_modified = false;
initDialog();
@@ -65,51 +57,64 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
void DIALOG_PAGES_SETTINGS::initDialog()
{
- wxString msg;
+ wxString msg;
+ double userSizeX;
+ double userSizeY;
SetFocus();
- SearchPageSizeSelection();
// Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel();
msg.Printf( format, m_Screen->m_NumberOfScreen );
m_TextSheetCount->SetLabel( msg );
+
format = m_TextSheetNumber->GetLabel();
msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg );
+ m_page = m_Parent->GetPageSettings();
+
+ setCurrentPageSizeSelection();
+
switch( g_UserUnit )
{
case MILLIMETRES:
- UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000;
- UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000;
- msg.Printf( wxT( "%.2f" ), UserSizeX );
+ userSizeX = m_user_size.GetWidthMils() * 25.4e-3;
+ userSizeY = m_user_size.GetHeightMils() * 25.4e-3;
+
+ msg.Printf( wxT( "%.2f" ), userSizeX );
m_TextUserSizeX->SetValue( msg );
- msg.Printf( wxT( "%.2f" ), UserSizeY );
+
+ msg.Printf( wxT( "%.2f" ), userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
+ default:
case INCHES:
- UserSizeX = (double) g_Sheet_user.m_Size.x / 1000;
- UserSizeY = (double) g_Sheet_user.m_Size.y / 1000;
- msg.Printf( wxT( "%.3f" ), UserSizeX );
+ userSizeX = m_user_size.GetWidthMils() / 1000.0;
+ userSizeY = m_user_size.GetHeightMils() / 1000.0;
+
+ msg.Printf( wxT( "%.3f" ), userSizeX );
m_TextUserSizeX->SetValue( msg );
- msg.Printf( wxT( "%.3f" ), UserSizeY );
+
+ msg.Printf( wxT( "%.3f" ), userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
+/* // you want it in mils, why?
case UNSCALED_UNITS:
- UserSizeX = g_Sheet_user.m_Size.x;
- UserSizeY = g_Sheet_user.m_Size.y;
- msg.Printf( wxT( "%f" ), UserSizeX );
+ userSizeX = m_user_size.GetWidthMils();
+ userSizeY = m_user_size.GetHeightMils();
+ msg.Printf( wxT( "%f" ), m_userSizeX );
m_TextUserSizeX->SetValue( msg );
- msg.Printf( wxT( "%f" ), UserSizeY );
+ msg.Printf( wxT( "%f" ), m_userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
+*/
}
// Set validators
- m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
+// m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
m_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) );
@@ -139,7 +144,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
{
- EndModal( m_Modified );
+ EndModal( m_modified );
}
@@ -150,7 +155,7 @@ void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{
SavePageSettings( event );
- m_Modified = 1;
+ m_modified = true;
Close( true );
}
@@ -167,8 +172,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{
- double dtmp;
wxString msg;
+ double userSizeX;
+ double userSizeY;
m_Screen->m_Revision = m_TextRevision->GetValue();
m_Screen->m_Company = m_TextCompany->GetValue();
@@ -179,58 +185,51 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
msg = m_TextUserSizeX->GetValue();
- msg.ToDouble( &dtmp );
- UserSizeX = dtmp;
+ msg.ToDouble( &userSizeX );
+
msg = m_TextUserSizeY->GetValue();
- msg.ToDouble( &dtmp );
- UserSizeY = dtmp;
+ msg.ToDouble( &userSizeY );
- int ii = m_PageSizeBox->GetSelection();
+ int radioSelection = m_PageSizeBox->GetSelection();
+ if( radioSelection < 0 )
+ radioSelection = 0;
- if( ii < 0 )
- ii = 0;
+ // wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
+ wxString paperType = m_PageSizeBox->GetString( radioSelection );
- m_SelectedSheet = SheetList[ii];
- m_Screen->m_CurrentSheetDesc = m_SelectedSheet;
+ m_page.SetType( paperType );
+
+ m_Parent->SetPageSettings( m_page );
switch( g_UserUnit )
{
case MILLIMETRES:
- g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 );
- g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 );
+ PAGE_INFO::SetUserWidthMils( int( userSizeX * 1000.0 / 25.4 ) );
+ PAGE_INFO::SetUserHeightMils( int( userSizeY * 1000.0 / 25.4 ) );
break;
+ default:
case INCHES:
- g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 );
- g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 );
+ PAGE_INFO::SetUserWidthMils( int( 1000 * userSizeX ) );
+ PAGE_INFO::SetUserHeightMils( int( 1000 * userSizeY ) );
break;
+/* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS:
- g_Sheet_user.m_Size.x = (int) ( UserSizeX );
- g_Sheet_user.m_Size.y = (int) ( UserSizeY );
+ PAGE_INFO::SetUserWidthMils( (int) userSizeX );
+ PAGE_INFO::SetUserHeightMils( (int) userSizeY );
break;
+*/
}
- if( g_Sheet_user.m_Size.x < 6000 )
- g_Sheet_user.m_Size.x = 6000;
-
- if( g_Sheet_user.m_Size.x > 44000 )
- g_Sheet_user.m_Size.x = 44000;
-
- if( g_Sheet_user.m_Size.y < 4000 )
- g_Sheet_user.m_Size.y = 4000;
-
- if( g_Sheet_user.m_Size.y > 44000 )
- g_Sheet_user.m_Size.y = 44000;
-
#ifdef EESCHEMA
- /* Exports settings to other sheets if requested: */
+ // Exports settings to other sheets if requested:
SCH_SCREEN* screen;
- /* Build the screen list */
+ // Build the screen list
SCH_SCREENS ScreenList;
- /* Update the datas */
+ // Update the datas
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen == m_Screen )
@@ -265,21 +264,31 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
-/* Search the correct index to activate the radiobox list size selection
- * according to the current page size
- */
-void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
+void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
{
- Ki_PageDescr* sheet;
- int ii;
+ wxString curPaperType = m_page.GetType();
- m_CurrentSelection = NB_ITEMS - 1;
+ // use wxFormBuilder to store the sheet type in the wxRadioButton's label
+ // i.e. "A4", "A3", etc, anywhere within the text of the label.
- for( ii = 0; ii < NB_ITEMS; ii++ )
+ D(printf("m_PageSizeBox->GetCount() = %d\n", (int) m_PageSizeBox->GetCount() );)
+
+ // search all the child wxRadioButtons for a label containing our paper type
+ for( unsigned i = 0; i < m_PageSizeBox->GetCount(); ++i )
{
- sheet = SheetList[ii];
+ // parse each label looking for curPaperType within it
+ wxStringTokenizer st( m_PageSizeBox->GetString( i ) );
- if( m_Parent->GetScreen()->m_CurrentSheetDesc == sheet )
- m_CurrentSelection = ii;
+ while( st.HasMoreTokens() )
+ {
+ if( st.GetNextToken() == curPaperType )
+ {
+ m_PageSizeBox->SetSelection( i );
+ return;
+ }
+ }
}
+
+ // m_PageSizeBox->SetSelection( 1 ); // wxFormBuilder does this, control there
}
+
diff --git a/common/dialogs/dialog_page_settings.h b/common/dialogs/dialog_page_settings.h
index f29a83fae1..eeaff9e319 100644
--- a/common/dialogs/dialog_page_settings.h
+++ b/common/dialogs/dialog_page_settings.h
@@ -14,12 +14,11 @@
class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{
private:
- EDA_DRAW_FRAME *m_Parent;
- BASE_SCREEN * m_Screen;
- int m_Modified;
- Ki_PageDescr * m_SelectedSheet;
- float UserSizeX, UserSizeY;
- int m_CurrentSelection;
+ EDA_DRAW_FRAME* m_Parent;
+ BASE_SCREEN* m_Screen;
+ bool m_modified;
+ PAGE_INFO m_page; ///< the one being edited
+ PAGE_INFO m_user_size; ///< instantiated just to get the size
public:
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent );
@@ -37,7 +36,8 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
- void SearchPageSizeSelection();
+
+ void setCurrentPageSizeSelection();
void SavePageSettings(wxCommandEvent& event);
void ReturnSizeSelected(wxCommandEvent& event);
diff --git a/common/dialogs/dialog_page_settings_base.cpp b/common/dialogs/dialog_page_settings_base.cpp
index 59c2fab514..22eaffb89a 100644
--- a/common/dialogs/dialog_page_settings_base.cpp
+++ b/common/dialogs/dialog_page_settings_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Apr 16 2008)
+// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -28,7 +28,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
LeftColumnSizer->SetFlexibleDirection( wxBOTH );
LeftColumnSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
- wxString m_PageSizeBoxChoices[] = { _("Size A4"), _("Size A3"), _("Size A2"), _("Size A1"), _("Size A0"), _("Size A"), _("Size B"), _("Size C"), _("Size D"), _("Size E"), _("User size") };
+ wxString m_PageSizeBoxChoices[] = { _("A4"), _("A3"), _("A2"), _("A1"), _("A0"), _("A"), _("B"), _("C"), _("D"), _("E"), _("User") };
int m_PageSizeBoxNChoices = sizeof( m_PageSizeBoxChoices ) / sizeof( wxString );
m_PageSizeBox = new wxRadioBox( this, wxID_ANY, _("Page Size:"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxNChoices, m_PageSizeBoxChoices, 1, wxRA_SPECIFY_COLS );
m_PageSizeBox->SetSelection( 1 );
@@ -108,7 +108,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
RevisionSizer->Add( m_TextRevision, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_RevisionExport = new wxCheckBox( this, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
RevisionSizer->Add( m_RevisionExport, 0, wxALL, 5 );
RightColumnSizer->Add( RevisionSizer, 1, wxEXPAND, 5 );
@@ -122,7 +121,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
TitleSizer->Add( m_TextTitle, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TitleExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
TitleSizer->Add( m_TitleExport, 0, wxALL, 5 );
RightColumnSizer->Add( TitleSizer, 1, wxEXPAND, 5 );
@@ -136,7 +134,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
CompanySizer->Add( m_TextCompany, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_CompanyExport = new wxCheckBox( this, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
CompanySizer->Add( m_CompanyExport, 0, wxALL, 5 );
RightColumnSizer->Add( CompanySizer, 1, wxEXPAND, 5 );
@@ -150,7 +147,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment1Sizer->Add( m_TextComment1, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment1Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
Comment1Sizer->Add( m_Comment1Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment1Sizer, 1, wxEXPAND, 5 );
@@ -164,7 +160,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment2Sizer->Add( m_TextComment2, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment2Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
Comment2Sizer->Add( m_Comment2Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment2Sizer, 1, wxEXPAND, 5 );
@@ -178,7 +173,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment3Sizer->Add( m_TextComment3, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment3Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
Comment3Sizer->Add( m_Comment3Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment3Sizer, 1, wxEXPAND, 5 );
@@ -192,7 +186,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment4Sizer->Add( m_TextComment4, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment4Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
-
Comment4Sizer->Add( m_Comment4Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment4Sizer, 1, wxEXPAND, 5 );
@@ -230,4 +223,5 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE()
m_TitleExport->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
+
}
diff --git a/common/dialogs/dialog_page_settings_base.fbp b/common/dialogs/dialog_page_settings_base.fbp
index b3b4cb5c9b..e3f25e1340 100644
--- a/common/dialogs/dialog_page_settings_base.fbp
+++ b/common/dialogs/dialog_page_settings_base.fbp
@@ -1,1442 +1,2246 @@
-
-
-
-
-
+
+
+
+
+
+ C++
+ 1
+ source_name
+ 0
+ res
+ UTF-8
+ connect
+ dialog_page_settings_base
+ 1000
+ none
+ 1
+ dialog_page_settings_base
+
+ .
+
+ 1
+ 1
+ 0
+ 0
+
+ 1
+ 1
+ 1
+ 1
+ 0
+
+
+
+
+ 1
+
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+ impl_virtual
+
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+
+
+ 0
+
+
+ 0
+
+ 1
+ DIALOG_PAGES_SETTINGS_BASE
+ 1
+
+
+ 1
+
+
+ Resizable
+
+ 1
+ 439,497
+ wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
+
+ Page Settings
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OnCloseWindow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bMainSizer
+ wxVERTICAL
+ none
+
+ 5
+ wxEXPAND
+ 1
+
+
+ bUpperSizerH
+ wxHORIZONTAL
+ none
+
+ 5
+ wxEXPAND
+ 0
+
+ 1
+ wxBOTH
+
+ 1,3,4,5
+ 0
+
+ LeftColumnSizer
+ wxFLEX_GROWMODE_SPECIFIED
+ none
+ 6
+ 0
+
+ 5
+ wxALL|wxEXPAND
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "User"
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Page Size:
+
+ 1
+
+ 0
+
+
+ 0
+
+ 1
+ m_PageSizeBox
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+ 1
+
+ wxRA_SPECIFY_COLS
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 0
+ protected
+ 5
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+
+ bSizerXsize
+ wxVERTICAL
+ none
+
+ 5
+ wxTOP|wxRIGHT|wxLEFT
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ User Page Size X:
+
+
+ 0
+
+
+ 0
+
+ 1
+ UserPageSizeX
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+ -1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_USER_PAGE_SIZE_X
+
+
+ 0
+
+ 0
+
+ 0
+
+ 1
+ m_TextUserSizeX
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OnTextctrlUserPageSizeXTextUpdated
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+
+ bSizerYsize
+ wxVERTICAL
+ none
+
+ 5
+ wxTOP|wxRIGHT|wxLEFT
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ User Page Size Y:
+
+
+ 0
+
+
+ 0
+
+ 1
+ UserPageSizeY
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+ -1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_USER_PAGE_SIZE_Y
+
+
+ 0
+
+ 0
+
+ 0
+
+ 1
+ m_TextUserSizeY
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OnTextctrlUserPageSizeYTextUpdated
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 5
+ protected
+ 5
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 5
+ protected
+ 5
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 1
+ wxBOTH
+ 0
+ 0,1,2,3,4,5,6,7
+ 0
+
+ RightColumnSizer
+ wxFLEX_GROWMODE_SPECIFIED
+ none
+ 8
+ 0
+
+ 5
+
+ 1
+
+
+ SheetInfoSizer
+ wxHORIZONTAL
+ none
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Number of sheets: %d
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_TextSheetCount
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+ -1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ 5
+ protected
+ 5
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Sheet number: %d
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_TextSheetNumber
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+ -1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Revision:
+
+ RevisionSizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_REVISION
+
+
+ 0
+
+ 0
+
+ 0
+ 100,-1
+ 1
+ m_TextRevision
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_CHECKBOX_REVISION
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_RevisionExport
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Title:
+
+ TitleSizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_TITLE
+
+
+ 0
+
+ 0
+
+ 0
+ 400,-1
+ 1
+ m_TextTitle
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_TitleExport
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+ OnCheckboxTitleClick
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Company:
+
+ CompanySizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_COMPANY
+
+
+ 0
+
+ 0
+
+ 0
+ 400,-1
+ 1
+ m_TextCompany
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_CHECKBOX_COMPANY
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_CompanyExport
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Comment1:
+
+ Comment1Sizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_COMMENT1
+
+
+ 0
+
+ 0
+
+ 0
+ 400,-1
+ 1
+ m_TextComment1
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_CHECKBOX_COMMENT1
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_Comment1Export
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Comment2:
+
+ Comment2Sizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_COMMENT2
+
+
+ 0
+
+ 0
+
+ 0
+ 400,-1
+ 1
+ m_TextComment2
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_CHECKBOX_COMMENT2
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_Comment2Export
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Comment3:
+
+ Comment3Sizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_COMMENT3
+
+
+ 0
+
+ 0
+
+ 0
+ 400,-1
+ 1
+ m_TextComment3
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_CHECKBOX_COMMENT3
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_Comment3Export
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND
+ 1
+
+ wxID_ANY
+ Comment4:
+
+ Comment4Sizer
+ wxHORIZONTAL
+ none
+
+
+ 5
+ wxBOTTOM|wxRIGHT|wxLEFT
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_TEXTCTRL_COMMENT4
+
+
+ 0
+
+ 0
+
+ 0
+ 400,-1
+ 1
+ m_TextComment4
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxALL
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+ 1
+ 0
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ ID_CHECKBOX_COMMENT4
+ Export to other sheets
+
+
+ 0
+
+
+ 0
+
+ 1
+ m_Comment4Export
+ 1
+
+
+ protected
+ 1
+
+
+ Resizable
+
+ 1
+
+
+
+ 0
+
+
+ wxFILTER_NONE
+ wxDefaultValidator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ wxEXPAND|wxALIGN_RIGHT|wxALL
+ 0
+
+ 0
+ 1
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0
+
+ m_sdbSizer1
+ protected
+
+ OnCancelClick
+
+
+
+ OnOkClick
+
+
+
+
+
+
+
+
diff --git a/common/dialogs/dialog_page_settings_base.h b/common/dialogs/dialog_page_settings_base.h
index fb41fe5ae6..8b6ac2e3d7 100644
--- a/common/dialogs/dialog_page_settings_base.h
+++ b/common/dialogs/dialog_page_settings_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Apr 16 2008)
+// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -80,16 +80,17 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
- virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
- virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ){ event.Skip(); }
- virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ){ event.Skip(); }
- virtual void OnCheckboxTitleClick( wxCommandEvent& event ){ event.Skip(); }
- virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
- virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
+ virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
+ virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
- DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,497 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+
+ DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,497 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PAGES_SETTINGS_BASE();
};
diff --git a/common/drawframe.cpp b/common/drawframe.cpp
index 361ae0be0b..6e4c87030c 100644
--- a/common/drawframe.cpp
+++ b/common/drawframe.cpp
@@ -51,7 +51,7 @@
static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
-/* Configuration entry names. */
+// Configuration entry names.
static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
@@ -115,7 +115,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
- /* Make sure window has a sane minimum size. */
+ // Make sure window has a sane minimum size.
if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
SetSize( 0, 0, minsize.x, minsize.y );
@@ -524,12 +524,11 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
logicalClientSize.x = wxRound( (double) clientSize.x / scalar );
logicalClientSize.y = wxRound( (double) clientSize.y / scalar );
- // The upper left corner of the drawing in device units.
- int w = screen->ReturnPageSize().x;
- int h = screen->ReturnPageSize().y;
+ // A corner of the drawing in internal units.
+ wxSize corner = GetPageSizeIU();
// The drawing rectangle logical units
- wxRect drawingRect( wxPoint( 0, 0 ), wxSize( w, h ) );
+ wxRect drawingRect( wxPoint( 0, 0 ), corner );
wxLogTrace( traceScrollSettings, wxT( "Logical drawing rect = ( %d, %d, %d, %d )." ),
drawingRect.x, drawingRect.y, drawingRect.width, drawingRect.height );
@@ -749,12 +748,12 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
if( !screen )
return;
- /* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
+ // Display Zoom level: zoom = zoom_coeff/ZoomScalar
Line.Printf( wxT( "Z %g" ), screen->GetZoom() );
SetStatusText( Line, 1 );
- /* Display absolute coordinates: */
+ // Display absolute coordinates:
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_internalUnits );
double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, m_internalUnits );
@@ -769,7 +768,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
dYpos = RoundTo0( dYpos, (double)( m_internalUnits / 10 ) );
}
- /* The following sadly is an if Eeschema/if Pcbnew */
+ // The following sadly is an if Eeschema/if Pcbnew
wxString absformatter;
wxString locformatter;
switch( g_UserUnit )
@@ -809,7 +808,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
Line.Printf( absformatter, dXpos, dYpos );
SetStatusText( Line, 2 );
- /* Display relative coordinates: */
+ // Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx, m_internalUnits );
@@ -821,7 +820,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
dYpos = RoundTo0( dYpos, (double) ( m_internalUnits / 10 ) );
}
- /* We already decided the formatter above */
+ // We already decided the formatter above
Line.Printf( locformatter, dXpos, dYpos );
SetStatusText( Line, 3 );
}
diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp
index c682d18818..a677648038 100644
--- a/common/drawpanel.cpp
+++ b/common/drawpanel.cpp
@@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
int axis_color = BLUE;
- BASE_SCREEN* screen = GetScreen();
GRSetDrawMode( DC, GR_COPY );
if( GetParent()->IsGridVisible() )
DrawGrid( DC );
- /* Draw axis */
+ // Draw axis
if( GetParent()->m_showAxis )
{
- /* Draw the Y axis */
- GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
- 0, screen->ReturnPageSize().y, 0, axis_color );
+ wxSize pageSize = GetParent()->GetPageSizeIU();
- /* Draw the X axis */
- GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
- screen->ReturnPageSize().x, 0, 0, axis_color );
+ // Draw the Y axis
+ GRDashedLine( &m_ClipBox, DC, 0, -pageSize.y,
+ 0, pageSize.y, 0, axis_color );
+
+ // Draw the X axis
+ GRDashedLine( &m_ClipBox, DC, -pageSize.x, 0,
+ pageSize.x, 0, 0, axis_color );
}
if( GetParent()->m_showOriginAxis )
@@ -676,29 +677,31 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
{
- if( GetParent()->m_originAxisPosition == wxPoint( 0, 0 ) )
+ wxPoint origin = GetParent()->GetOriginAxisPosition();
+
+ if( origin == wxPoint( 0, 0 ) )
return;
- int Color = DARKRED;
- BASE_SCREEN* screen = GetScreen();
+ int color = DARKRED;
+ wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
- /* Draw the Y axis */
+ // Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
- GetParent()->m_originAxisPosition.x,
- -screen->ReturnPageSize().y,
- GetParent()->m_originAxisPosition.x,
- screen->ReturnPageSize().y,
- 0, Color );
+ origin.x,
+ -pageSize.y,
+ origin.x,
+ pageSize.y,
+ 0, color );
- /* Draw the X axis */
+ // Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
- -screen->ReturnPageSize().x,
- GetParent()->m_originAxisPosition.y,
- screen->ReturnPageSize().x,
- GetParent()->m_originAxisPosition.y,
- 0, Color );
+ -pageSize.x,
+ origin.y,
+ pageSize.x,
+ origin.y,
+ 0, color );
}
@@ -710,25 +713,26 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
return;
- int Color = GetParent()->GetGridColor();
+ int color = GetParent()->GetGridColor();
+ wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
- /* Draw the Y axis */
+ // Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
screen->m_GridOrigin.x,
- -screen->ReturnPageSize().y,
+ -pageSize.y,
screen->m_GridOrigin.x,
- screen->ReturnPageSize().y,
- 0, Color );
+ pageSize.y,
+ 0, color );
- /* Draw the X axis */
+ // Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
- -screen->ReturnPageSize().x,
+ -pageSize.x,
screen->m_GridOrigin.y,
- screen->ReturnPageSize().x,
+ pageSize.x,
screen->m_GridOrigin.y,
- 0, Color );
+ 0, color );
}
@@ -1116,7 +1120,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
int localkey;
wxPoint pos;
- localkey = event.GetKeyCode();
+ localkey = event.GetKeyCode();
switch( localkey )
{
diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp
index 32159649a0..9ce3f2ac47 100644
--- a/common/pcbcommon.cpp
+++ b/common/pcbcommon.cpp
@@ -47,6 +47,9 @@ class MODULE;
*/
int GetLayerMask( int aLayerNumber )
{
+ wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
+
+#if 0
// Look up Table for conversion one layer number -> one bit layer mask:
static int tabOneLayerMask[LAYER_COUNT] =
{
@@ -60,8 +63,10 @@ int GetLayerMask( int aLayerNumber )
0x10000000, 0x20000000, 0x40000000, 0x80000000
};
- wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
return( tabOneLayerMask[aLayerNumber] );
+#else
+ return 1 << aLayerNumber;
+#endif
}
/* Look up Table for conversion copper layer count -> general copper layer
diff --git a/common/projet_config.cpp b/common/projet_config.cpp
index 6d96a05eb0..0fa0f1fcea 100644
--- a/common/projet_config.cpp
+++ b/common/projet_config.cpp
@@ -216,12 +216,6 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
}
-/**
- * Function SaveCurrentSetupValues
- * Save the current setup values in m_settings
- * saved parameters are parameters that have the .m_Setup member set to true
- * @param aList = array of PARAM_CFG_BASE pointers
- */
void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
{
PARAM_CFG_BASE* pt_cfg;
@@ -253,12 +247,15 @@ void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
if( m_settings == NULL )
return;
- BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
+ unsigned count = List.size();
+ for( unsigned i=0; iDeleteGroup( param.m_Ident );
@@ -441,10 +438,6 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -459,10 +452,6 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -495,10 +484,6 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -511,10 +496,6 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -553,10 +534,6 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -582,10 +559,6 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -617,10 +590,6 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -632,10 +601,6 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -666,10 +631,6 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -678,10 +639,6 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -701,10 +658,6 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -720,10 +673,6 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -745,10 +694,6 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
}
-/** ReadParam
- * read the value of parameter this stored in aConfig
- * @param aConfig = the wxConfigBase that store the parameter
- */
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -778,10 +723,6 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
}
-/** SaveParam
- * save the value of parameter this in aConfig (list of parameters)
- * @param aConfig = the wxConfigBase that can store the parameter
- */
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
@@ -799,6 +740,7 @@ void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
// We use indexlib+1 because first lib name is LibName1
configkey << (indexlib + 1);
libname = libname_list->Item( indexlib );
+
// filenames are stored using Unix notation
libname.Replace(wxT("\\"), wxT("/") );
aConfig->Write( configkey, libname );
diff --git a/common/worksheet.cpp b/common/worksheet.cpp
index 23009eff34..d9edb57cd3 100644
--- a/common/worksheet.cpp
+++ b/common/worksheet.cpp
@@ -16,7 +16,7 @@
#include "build_version.h"
-/* Must be defined in main applications: */
+// Must be defined in main applications:
Ki_WorkSheetData WS_Date =
{
@@ -186,7 +186,9 @@ Ki_WorkSheetData WS_Comment4 =
NULL, NULL
};
-Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
+
+/// Left vertical segment
+Ki_WorkSheetData WS_MostLeftLine =
{
WS_LEFT_SEGMENT,
#if defined(KICAD_GOST)
@@ -200,8 +202,9 @@ Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
NULL, NULL
};
-Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
- * and comments */
+
+/// horizontal segment between filename and comments
+Ki_WorkSheetData WS_SeparatorLine =
{
WS_SEGMENT,
&WS_MostUpperLine,
@@ -211,7 +214,9 @@ Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
NULL, NULL
};
-Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
+
+/// superior horizontal segment
+Ki_WorkSheetData WS_MostUpperLine =
{
WS_UPPER_SEGMENT,
&WS_Segm3,
@@ -225,7 +230,9 @@ Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
NULL, NULL
};
-Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
+
+/// horizontal segment above COMPANY NAME
+Ki_WorkSheetData WS_Segm3 =
{
WS_SEGMENT,
&WS_Segm4,
@@ -239,7 +246,9 @@ Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
NULL, NULL
};
-Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
+
+/// vertical segment of the left REV and SHEET
+Ki_WorkSheetData WS_Segm4 =
{
WS_SEGMENT,
&WS_Segm5,
@@ -253,6 +262,7 @@ Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
NULL, NULL
};
+
Ki_WorkSheetData WS_Segm5 =
{
WS_SEGMENT,
@@ -267,6 +277,7 @@ Ki_WorkSheetData WS_Segm5 =
NULL, NULL
};
+
Ki_WorkSheetData WS_Segm6 =
{
WS_SEGMENT,
@@ -281,6 +292,7 @@ Ki_WorkSheetData WS_Segm6 =
NULL, NULL
};
+
Ki_WorkSheetData WS_Segm7 =
{
WS_SEGMENT,
@@ -989,14 +1001,14 @@ Ki_WorkSheetData WS_Segm5_LT =
};
-/* Draw the page reference sheet.
- */
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width )
{
if( !m_showBorderAndTitleBlock )
return;
- Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
+ const PAGE_INFO& pageInfo = GetPageSettings();
+ wxSize pageSize = pageInfo.GetSizeMils();
+
int ii, jj, xg, yg, ipas, gxpas, gypas;
wxPoint pos;
int refx, refy;
@@ -1017,28 +1029,27 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
int width = line_width;
Color = RED;
- if( Sheet == NULL )
- {
- DisplayError( this,
- wxT( "EDA_DRAW_FRAME::TraceWorkSheet() error: NULL Sheet" ) );
- return;
- }
// if not printing, draw the page limits:
if( !screen->m_IsPrinting & g_ShowPageLimits )
{
GRSetDrawMode( DC, GR_COPY );
GRRect( m_canvas->GetClipBox(), DC, 0, 0,
- Sheet->m_Size.x * scale, Sheet->m_Size.y * scale, width,
+ pageSize.x * scale, pageSize.y * scale, width,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
GRSetDrawMode( DC, GR_COPY );
- /* Draw the border. */
- refx = Sheet->m_LeftMargin;
- refy = Sheet->m_TopMargin; /* Upper left corner */
- xg = Sheet->m_Size.x - Sheet->m_RightMargin;
- yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
+
+ // Draw the border.
+
+ // Upper left corner
+ refx = pageInfo.GetLeftMarginMils();
+ refy = pageInfo.GetTopMarginMils();
+
+ // lower right corner
+ xg = pageSize.x - pageInfo.GetRightMarginMils();
+ yg = pageSize.y - pageInfo.GetBottomMarginMils();
#if defined(KICAD_GOST)
GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale,
@@ -1056,10 +1067,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
#endif
- /* Draw the reference legends. */
- refx = Sheet->m_LeftMargin;
+ // Draw the reference legends.
+ refx = pageInfo.GetLeftMarginMils();
+
#if defined(KICAD_GOST)
- refy = Sheet->m_Size.y - Sheet->m_BottomMargin; /* Lower left corner */
+ refy = pageSize.y - pageInfo.GetBottomMargin(); // Lower left corner
for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx - WsItem->m_Posx ) * scale;
@@ -1080,15 +1092,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
break;
case WS_SEGMENT_LU:
- xg = Sheet->m_LeftMargin - WsItem->m_Endx;
- yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy;
+ xg = pageInfo.GetLeftMargin() - WsItem->m_Endx;
+ yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
}
- refy = Sheet->m_BottomMargin; /* Left Top corner */
+ refy = pageInfo.GetBottomMarginMils(); // Left Top corner
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx + WsItem->m_Posx ) * scale;
@@ -1097,24 +1109,29 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
- xg = Sheet->m_LeftMargin + WsItem->m_Endx;
- yg = Sheet->m_BottomMargin + WsItem->m_Endy;
- GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
+ xg = pageInfo.GetLeftMarginMils() + WsItem->m_Endx;
+ yg = pageInfo.GetBottomMarginMils() + WsItem->m_Endy;
+ GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
}
#else
- refy = Sheet->m_TopMargin; /* Upper left corner */
- xg = Sheet->m_Size.x - Sheet->m_RightMargin;
- yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
+
+ // Upper left corner
+ refy = pageInfo.GetTopMarginMils();
+
+ // lower right corner
+ xg = pageSize.x - pageInfo.GetRightMarginMils();
+ yg = pageSize.y - pageInfo.GetBottomMarginMils();
ipas = ( xg - refx ) / PAS_REF;
gxpas = ( xg - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
Line.Printf( wxT( "%d" ), jj );
+
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, ii * scale, refy * scale,
@@ -1126,6 +1143,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
+
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, ii * scale, yg * scale,
@@ -1161,6 +1179,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
+
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, xg * scale, ii * scale,
@@ -1177,8 +1196,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
#endif
#if defined(KICAD_GOST)
- refx = Sheet->m_Size.x - Sheet->m_RightMargin;
- refy = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
+ // lower right corner
+ refx = pageSize.x - pageInfo.GetRightMarginMils();
+ refy = pageSize.y - pageInfo.GetBottomMarginMils();
+
if( screen->m_ScreenNumber == 1 )
{
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
@@ -1261,8 +1282,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
- pos.x = (Sheet->m_LeftMargin + 1260) * scale;
- pos.y = (Sheet->m_TopMargin + 270) * scale;
+ pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
+ pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
DrawGraphicText( m_canvas, DC, pos, Color,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@@ -1311,11 +1332,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos.y = ( refy - WsItem->m_Posy ) * scale;
case WS_SEGMENT:
- xg = Sheet->m_Size.x -
- Sheet->m_RightMargin - WsItem->m_Endx;
- yg = Sheet->m_Size.y -
- Sheet->m_BottomMargin - WsItem->m_Endy;
- GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
+ xg = pageSize.x -
+ pageInfo.GetRightMarginMils() - WsItem->m_Endx;
+ yg = pageSize.y -
+ pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
+ GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
@@ -1328,10 +1349,11 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos.x = ( refx - WsItem->m_Posx ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * scale;
msg.Empty();
+
switch( WsItem->m_Type )
{
case WS_CADRE:
- /* Begin list number > 1 */
+ // Begin list number > 1
msg = screen->m_Commentaire1;
if( !msg.IsEmpty() )
{
@@ -1340,8 +1362,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
- pos.x = (Sheet->m_LeftMargin + 1260) * scale;
- pos.y = (Sheet->m_TopMargin + 270) * scale;
+ pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
+ pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
DrawGraphicText( m_canvas, DC, pos, Color,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@@ -1374,19 +1396,21 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos.y = ( refy - WsItem->m_Posy ) * scale;
case WS_SEGMENT_D:
- xg = Sheet->m_Size.x -
- Sheet->m_RightMargin - WsItem->m_Endx;
- yg = Sheet->m_Size.y -
- Sheet->m_BottomMargin - WsItem->m_Endy;
- GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
+ xg = pageSize.x -
+ pageInfo.GetRightMarginMils() - WsItem->m_Endx;
+ yg = pageSize.y -
+ pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
+ GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
}
}
}
+
#else
- refx = Sheet->m_Size.x - Sheet->m_RightMargin - GRID_REF_W;
- refy = Sheet->m_Size.y - Sheet->m_BottomMargin - GRID_REF_W;
+
+ refx = pageSize.x - pageInfo.GetRightMarginMils() - GRID_REF_W;
+ refy = pageSize.y - pageInfo.GetBottomMarginMils() - GRID_REF_W;
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
@@ -1431,7 +1455,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_SIZESHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
- msg += Sheet->m_Name;
+ msg += pageInfo.GetType();
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
@@ -1569,10 +1593,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos.y = (refy - WsItem->m_Posy) * scale;
case WS_SEGMENT:
- xg = Sheet->m_Size.x -
- GRID_REF_W - Sheet->m_RightMargin - WsItem->m_Endx;
- yg = Sheet->m_Size.y -
- GRID_REF_W - Sheet->m_BottomMargin - WsItem->m_Endy;
+ xg = pageSize.x -
+ GRID_REF_W - pageInfo.GetRightMarginMils() - WsItem->m_Endx;
+ yg = pageSize.y -
+ GRID_REF_W - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
break;
@@ -1583,50 +1607,43 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
}
-/**
- * Function GetXYSheetReferences
- * Return the X,Y sheet references where the point position is located
- * @param aScreen = screen to use
- * @param aPosition = position to identify by YX ref
- * @return a wxString containing the message locator like A3 or B6 (or ?? if out of page limits)
- */
-wxString EDA_DRAW_FRAME::GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition )
+const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition )
{
- Ki_PageDescr* Sheet = aScreen->m_CurrentSheetDesc;
- int ii, xg, yg, ipas, gxpas, gypas;
- int refx, refy;
- wxString msg;
+ const PAGE_INFO& pageInfo = GetPageSettings();
- if( Sheet == NULL )
- {
- DisplayError( this,
- wxT( "EDA_DRAW_FRAME::GetXYSheetReferences() error: NULL Sheet" ) );
- return msg;
- }
+ int ii;
+ int xg, yg;
+ int ipas;
+ int gxpas, gypas;
+ int refx, refy;
+ wxString msg;
- refx = Sheet->m_LeftMargin;
- refy = Sheet->m_TopMargin; /* Upper left corner */
- xg = Sheet->m_Size.x - Sheet->m_RightMargin;
- yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
+ // Upper left corner
+ refx = pageInfo.GetLeftMarginMils();
+ refy = pageInfo.GetTopMarginMils();
- /* Get the Y axis identifier (A symbol A ... Z) */
+ // lower right corner
+ xg = pageInfo.GetSizeMils().x - pageInfo.GetRightMarginMils();
+ yg = pageInfo.GetSizeMils().y - pageInfo.GetBottomMarginMils();
+
+ // Get the Y axis identifier (A symbol A ... Z)
if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits
msg << wxT( "?" );
else
{
- ipas = ( yg - refy ) / PAS_REF; // ipas = Y count sections
- gypas = ( yg - refy ) / ipas; // gypas = Y section size
+ ipas = ( yg - refy ) / PAS_REF; // ipas = Y count sections
+ gypas = ( yg - refy ) / ipas; // gypas = Y section size
ii = ( aPosition.y - refy ) / gypas;
msg.Printf( wxT( "%c" ), 'A' + ii );
}
- /* Get the X axis identifier (A number 1 ... n) */
+ // Get the X axis identifier (A number 1 ... n)
if( aPosition.x < refx || aPosition.x > xg ) // Ouside of X limits
msg << wxT( "?" );
else
{
- ipas = ( xg - refx ) / PAS_REF; // ipas = X count sections
- gxpas = ( xg - refx ) / ipas; // gxpas = X section size
+ ipas = ( xg - refx ) / PAS_REF; // ipas = X count sections
+ gxpas = ( xg - refx ) / ipas; // gxpas = X section size
ii = ( aPosition.x - refx ) / gxpas;
msg << ii + 1;
diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp
index 66cea3c30a..1775996934 100644
--- a/cvpcb/class_DisplayFootprintsFrame.cpp
+++ b/cvpcb/class_DisplayFootprintsFrame.cpp
@@ -87,7 +87,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
SetIcon( icon );
SetBoard( new BOARD() );
- SetScreen( new PCB_SCREEN() );
+ SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
LoadSettings();
diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp
index 9cf915b949..f54b4e56a0 100644
--- a/cvpcb/class_footprints_listbox.cpp
+++ b/cvpcb/class_footprints_listbox.cpp
@@ -119,7 +119,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
{
FOOTPRINT_INFO & footprint = list.GetItem(ii);
- msg.Printf( wxT( "%3d %s" ), m_FullFootprintList.GetCount() + 1,
+ msg.Printf( wxT( "%3d %s" ), (int) m_FullFootprintList.GetCount() + 1,
GetChars(footprint.m_Module) );
m_FullFootprintList.Add( msg );
}
diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp
index 05cda00dd4..e6866d42bf 100644
--- a/cvpcb/cvframe.cpp
+++ b/cvpcb/cvframe.cpp
@@ -605,7 +605,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
{
wxString msg;
- msg.Printf( _( "Components: %d (free: %d)" ), m_components.size(), m_undefinedComponentCnt );
+ msg.Printf( _( "Components: %d (free: %d)" ), (int) m_components.size(), m_undefinedComponentCnt );
SetStatusText( msg, 0 );
SetStatusText( wxEmptyString, 1 );
@@ -614,10 +614,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
{
if( m_FootprintList->m_UseFootprintFullList )
msg.Printf( _( "Footprints (All): %d" ),
- m_FootprintList->m_ActiveFootprintList->GetCount() );
+ (int) m_FootprintList->m_ActiveFootprintList->GetCount() );
else
msg.Printf( _( "Footprints (filtered): %d" ),
- m_FootprintList->m_ActiveFootprintList->GetCount() );
+ (int) m_FootprintList->m_ActiveFootprintList->GetCount() );
}
else
{
diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp
index 85739100cc..fd97d1eebc 100644
--- a/eeschema/dialogs/dialog_SVG_print.cpp
+++ b/eeschema/dialogs/dialog_SVG_print.cpp
@@ -199,7 +199,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
{
int tmpzoom;
wxPoint tmp_startvisu;
- wxSize SheetSize; // Sheet size in internal units
+ wxSize sheetSize; // Sheet size in internal units
wxPoint old_org;
bool success = true;
@@ -209,16 +209,15 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
- SheetSize = screen->ReturnPageSize(); // page size in 1/1000 inch, ie in internal units
+ sheetSize = screen->GetPageSettings().GetSizeIU(); // page size in 1/1000 inch, ie in internal units
screen->SetScalingFactor( 1.0 );
EDA_DRAW_PANEL* panel = frame->GetCanvas();
- SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
- // to print floating point numbers like 1.3)
+ LOCALE_IO toggle;
float dpi = (float) frame->GetInternalUnits();
- wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
+ wxSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi );
EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc );
@@ -234,11 +233,9 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
- SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );
-
GRForceBlackPen( false );
screen->m_StartVisu = tmp_startvisu;
diff --git a/eeschema/dialogs/dialog_SVG_print.h b/eeschema/dialogs/dialog_SVG_print.h
index a762fd41f2..cf58c6825e 100644
--- a/eeschema/dialogs/dialog_SVG_print.h
+++ b/eeschema/dialogs/dialog_SVG_print.h
@@ -4,7 +4,6 @@
class EDA_DRAW_FRAME;
-class BASE_SCREEN;
#include "dialog_SVG_print_base.h"
diff --git a/eeschema/dialogs/dialog_build_BOM.cpp b/eeschema/dialogs/dialog_build_BOM.cpp
index f5b8a657d8..a66603da0f 100644
--- a/eeschema/dialogs/dialog_build_BOM.cpp
+++ b/eeschema/dialogs/dialog_build_BOM.cpp
@@ -567,8 +567,8 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm )
{
#if defined(KICAD_GOST)
- wxString outStr;
- wxString tmpStr;
+ wxString outStr;
+ wxString tmpStr;
#endif
if( IsFieldChecked( FOOTPRINT ) )
@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
{
#if defined(KICAD_GOST)
outStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol,
- GetChars( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
+ GetChars( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
#else
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm )
#if defined(KICAD_GOST)
- {
+ {
tmpStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol,
GetChars( DrawLibItem->GetField( ii )->m_Text ) );
- outStr += tmpStr;
+ outStr += tmpStr;
}
#else
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
#endif
else
#if defined(KICAD_GOST)
- {
+ {
tmpStr.Printf( wxT( "; %-12s" ),
GetChars( DrawLibItem->GetField( ii )->m_Text ) );
- outStr += tmpStr;
+ outStr += tmpStr;
}
#else
fprintf( f, "; %-12s",
@@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
#if defined(KICAD_GOST)
strCur.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, GetChars( msg ) );
- msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
+ msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
strCur.Printf( wxT( "%c%s)" ), s_ExportSeparatorSymbol, GetChars( msg ) );
#else
fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) );
- msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
+ msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
TO_UTF8( msg ) );
#endif
@@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
else
{
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
- msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
+ msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
fprintf( f, " (loc %s)", TO_UTF8( msg ) );
}
}
@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST)
else
{
- switch (amount)
- {
+ switch (amount)
+ {
case 1:
fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8( strPred ),
s_ExportSeparatorSymbol, amount );
@@ -844,8 +844,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break;
- }
- }
+ }
+ }
#endif
return 0;
@@ -1060,13 +1060,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
{
msg = aList[ii].GetSheetPath().PathHumanReadable();
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
- msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->GetPosition() );
+ msg = m_Parent->GetXYSheetReferences( DrawLibItem->GetPosition() );
fprintf( f, " (loc %s)", TO_UTF8( msg ) );
}
}
#if defined(KICAD_GOST)
- fprintf( f, "%s", TO_UTF8( PrintFieldData( DrawLibItem ) ) );
+ fprintf( f, "%s", TO_UTF8( PrintFieldData( DrawLibItem ) ) );
#else
PrintFieldData( f, DrawLibItem );
#endif
diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp
index 262898465f..67a0ae27d6 100644
--- a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp
+++ b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp
@@ -63,11 +63,11 @@ private:
void initDlg();
void initOptVars();
void CreateDXFFile();
- void PlotOneSheetDXF( const wxString& FileName,
- SCH_SCREEN* screen, Ki_PageDescr* sheet,
+ void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen,
wxPoint plot_offset, double scale );
};
-/* static members (static to remember last state): */
+
+// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = false;
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true;
@@ -147,8 +147,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
- wxString PlotFileName;
- Ki_PageDescr* PlotSheet;
+ wxString plotFileName;
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
@@ -186,15 +185,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
sheetpath = SheetList.GetNext();
}
- PlotSheet = screen->m_CurrentSheetDesc;
double scale = 10;
plot_offset.x = 0;
plot_offset.y = 0;
- PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
+ plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
- PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
+ PlotOneSheetDXF( plotFileName, screen, plot_offset, scale );
if( !m_select_PlotAll )
break;
@@ -206,14 +204,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
}
-void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
- SCH_SCREEN* screen,
- Ki_PageDescr* sheet,
- wxPoint plot_offset,
- double scale )
+void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
+ SCH_SCREEN* screen,
+ wxPoint plot_offset,
+ double scale )
{
- wxString msg;
+
+ wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
@@ -227,13 +225,17 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg );
- SetLocaleTo_C_standard();
+ LOCALE_IO toggle;
+
DXF_PLOTTER* plotter = new DXF_PLOTTER();
- plotter->set_paper_size( sheet );
+
+ const PAGE_INFO& pageInfo = screen->GetPageSettings();
+ plotter->SetPageSettings( pageInfo );
+
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( m_plotColorOpt );
- /* Init : */
+ // Init :
plotter->set_creator( wxT( "Eeschema-DXF" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
@@ -246,10 +248,9 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
screen->Plot( plotter );
- /* fin */
+ // finish
plotter->end_plot();
delete plotter;
- SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) );
}
diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
index 77082f5ead..af5b676bfb 100644
--- a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
+++ b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
@@ -39,7 +39,8 @@
#include "dialog_plot_schematic_HPGL_base.h"
-enum PageFormatReq
+
+enum HPGL_PAGEZ_T
{
PAGE_DEFAULT = 0,
PAGE_SIZE_A4,
@@ -51,37 +52,47 @@ enum PageFormatReq
PAGE_SIZE_B,
PAGE_SIZE_C,
PAGE_SIZE_D,
- PAGE_SIZE_E
+ PAGE_SIZE_E,
};
-static Ki_PageDescr* Plot_sheet_list[] =
+
+static const wxChar* plot_sheet_list( HPGL_PAGEZ_T aSize )
{
- NULL,
- &g_Sheet_A4,
- &g_Sheet_A3,
- &g_Sheet_A2,
- &g_Sheet_A1,
- &g_Sheet_A0,
- &g_Sheet_A,
- &g_Sheet_B,
- &g_Sheet_C,
- &g_Sheet_D,
- &g_Sheet_E,
- &g_Sheet_GERBER,
- &g_Sheet_user
+ const wxChar* ret;
+
+ switch( aSize )
+ {
+ default:
+ case PAGE_DEFAULT: ret = NULL; break;
+ case PAGE_SIZE_A4: ret = wxT( "A4" ); break;
+ case PAGE_SIZE_A3: ret = wxT( "A3" ); break;
+ case PAGE_SIZE_A2: ret = wxT( "A2" ); break;
+ case PAGE_SIZE_A1: ret = wxT( "A1" ); break;
+ case PAGE_SIZE_A0: ret = wxT( "A0" ); break;
+ case PAGE_SIZE_A: ret = wxT( "A" ); break;
+ case PAGE_SIZE_B: ret = wxT( "B" ); break;
+ case PAGE_SIZE_C: ret = wxT( "C" ); break;
+ case PAGE_SIZE_D: ret = wxT( "D" ); break;
+ case PAGE_SIZE_E: ret = wxT( "E" ); break;
+ }
+
+ return ret;
};
+
class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE
{
private:
SCH_EDIT_FRAME* m_Parent;
public:
- DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
+ DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
private:
- static PageFormatReq m_pageSizeSelect;
- static bool m_plot_Sheet_Ref;
+ static HPGL_PAGEZ_T s_pageSizeSelect;
+ static bool s_plot_Sheet_Ref;
+ static wxSize s_Offset;
+
bool m_select_PlotAll;
private:
@@ -97,16 +108,18 @@ private:
void SetPenWidth();
void SetPageOffsetValue();
void HPGL_Plot( bool aPlotAll );
- void Plot_Schematic_HPGL( bool aPlotAll, int HPGL_SheetSize );
- void Plot_1_Page_HPGL( const wxString& FileName,
- SCH_SCREEN* screen, Ki_PageDescr* sheet,
- wxPoint& offset, double plot_scale );
- void ReturnSheetDims( SCH_SCREEN* screen, wxSize& SheetSize, wxPoint& SheetOffset );
-};
-/* static members (static to remember last state): */
-PageFormatReq DIALOG_PLOT_SCHEMATIC_HPGL:: m_pageSizeSelect = PAGE_DEFAULT;
-bool DIALOG_PLOT_SCHEMATIC_HPGL::m_plot_Sheet_Ref = true;
+ void Plot_Schematic_HPGL( bool aPlotAll );
+ void Plot_1_Page_HPGL( const wxString& FileName,
+ SCH_SCREEN* screen, const PAGE_INFO& aPageInfo,
+ wxPoint& offset, double plot_scale );
+};
+
+
+// static members (static to remember last state):
+HPGL_PAGEZ_T DIALOG_PLOT_SCHEMATIC_HPGL:: s_pageSizeSelect = PAGE_DEFAULT;
+bool DIALOG_PLOT_SCHEMATIC_HPGL::s_plot_Sheet_Ref = true;
+wxSize DIALOG_PLOT_SCHEMATIC_HPGL::s_Offset;
void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
{
@@ -115,8 +128,8 @@ void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
}
-DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent )
- :DIALOG_PLOT_SCHEMATIC_HPGL_BASE(parent)
+DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) :
+ DIALOG_PLOT_SCHEMATIC_HPGL_BASE( parent )
{
m_Parent = parent;
initDlg();
@@ -130,16 +143,14 @@ DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent )
void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg()
{
-
- SetFocus(); // Make ESC key working
+ SetFocus(); // Make ESC key work
// Set validators
- m_SizeOption->SetSelection( m_pageSizeSelect );
+ m_SizeOption->SetSelection( s_pageSizeSelect );
AddUnitSymbol( *m_penWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam, EESCHEMA_INTERNAL_UNIT );
m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed );
m_penNumCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Num );
-
}
@@ -153,25 +164,31 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotAll( wxCommandEvent& event )
HPGL_Plot( true );
}
+
void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
}
+
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
{
wxString msg;
- m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection();
- if( m_pageSizeSelect != PAGE_DEFAULT )
+ s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
+
+ if( s_pageSizeSelect != PAGE_DEFAULT )
{
msg = ReturnStringFromValue( g_UserUnit,
- Plot_sheet_list[m_pageSizeSelect]->m_Offset.x,
+ s_Offset.x,
EESCHEMA_INTERNAL_UNIT );
+
m_PlotOrgPosition_X->SetValue( msg );
+
msg = ReturnStringFromValue( g_UserUnit,
- Plot_sheet_list[m_pageSizeSelect]-> m_Offset.y,
+ s_Offset.y,
EESCHEMA_INTERNAL_UNIT );
+
m_PlotOrgPosition_Y->SetValue( msg );
m_PlotOrgPosition_X->Enable( TRUE );
@@ -187,16 +204,17 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
{
- m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection();
+ s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
- if( m_pageSizeSelect != PAGE_DEFAULT )
+ if( s_pageSizeSelect != PAGE_DEFAULT )
{
wxString msg = m_PlotOrgPosition_X->GetValue();
- Plot_sheet_list[m_pageSizeSelect]->m_Offset.x =
- ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
+
+ s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
+
msg = m_PlotOrgPosition_Y->GetValue();
- Plot_sheet_list[m_pageSizeSelect]->m_Offset.y =
- ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
+
+ s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
}
}
@@ -243,52 +261,32 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
SetPenNum( );
SetPenSpeed( );
- if( m_pageSizeSelect != PAGE_DEFAULT )
+ if( s_pageSizeSelect != PAGE_DEFAULT )
{
- Ki_PageDescr* plot_sheet = Plot_sheet_list[m_pageSizeSelect];
wxString msg = m_PlotOrgPosition_X->GetValue();
- plot_sheet->m_Offset.x =
- ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
+
+ s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
+
msg = m_PlotOrgPosition_Y->GetValue();
- plot_sheet->m_Offset.y =
- ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
+
+ s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
}
- Plot_Schematic_HPGL( aPlotAll, m_pageSizeSelect );
+ Plot_Schematic_HPGL( aPlotAll );
}
-/* Function calculates the offsets and dimensions of any trace of the
- * selected sheet
- */
-void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
- wxSize& SheetSize,
- wxPoint& SheetOffset )
+void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
{
- Ki_PageDescr* PlotSheet;
+ wxString plotFileName;
+ SCH_SCREEN* screen = m_Parent->GetScreen();
+ SCH_SHEET_PATH* sheetpath;
+ SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
- if( screen == NULL )
- screen = m_Parent->GetScreen();
-
- PlotSheet = screen->m_CurrentSheetDesc;
-
- SheetSize = PlotSheet->m_Size;
- SheetOffset = PlotSheet->m_Offset;
-}
-
-
-void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_SheetSize )
-{
- wxString PlotFileName;
- SCH_SCREEN* screen = m_Parent->GetScreen();
- SCH_SHEET_PATH* sheetpath;
- SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
- Ki_PageDescr* PlotSheet;
- wxSize SheetSize;
- wxPoint SheetOffset, PlotOffset;
+ wxPoint plotOffset;
/* When printing all pages, the printed page is not the current page.
- * In complex hierarchies, we must setup references and others parameters
+ * In complex hierarchies, we must setup references and other parameters
* in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets
@@ -312,7 +310,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
+
screen = m_Parent->GetCurrentSheet().LastScreen();
+
+ if( !screen ) // LastScreen() may return NULL
+ screen = m_Parent->GetScreen();
}
else // Should not happen
return;
@@ -320,26 +322,28 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
sheetpath = SheetList.GetNext();
}
- ReturnSheetDims( screen, SheetSize, SheetOffset );
+ const PAGE_INFO& curPage = screen->GetPageSettings();
- /* Calculation of conversion scales. */
- if( HPGL_SheetSize )
- PlotSheet = Plot_sheet_list[HPGL_SheetSize];
- else
- PlotSheet = screen->m_CurrentSheetDesc;
+ PAGE_INFO plotPage = curPage;
- /* 10x because Eeschema works in mils, not decimals */
- double plot_scale = 10 * (double) PlotSheet->m_Size.x / (double) SheetSize.x;
+ // if plotting on a page size other than curPage
+ if( s_pageSizeSelect != PAGE_DEFAULT )
+ plotPage.SetType( plot_sheet_list( s_pageSizeSelect ) );
- /* Calculate offsets */
- PlotOffset.x = -SheetOffset.x;
- PlotOffset.y = -SheetOffset.y;
+ // Calculation of conversion scales.
- PlotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
+ // 10x because Eeschema works in mils, not deci-mils
+ double plot_scale = 10 * (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
- SetLocaleTo_C_standard();
- Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale );
- SetLocaleTo_Default();
+ // Calculate offsets
+ plotOffset.x = -s_Offset.x;
+ plotOffset.y = -s_Offset.y;
+
+ plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
+
+ LOCALE_IO toggle;
+
+ Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset, plot_scale );
if( !aPlotAll )
break;
@@ -351,11 +355,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
}
-void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
- SCH_SCREEN* screen,
- Ki_PageDescr* sheet,
- wxPoint& offset,
- double plot_scale )
+void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
+ SCH_SCREEN* screen,
+ const PAGE_INFO& pageInfo,
+ wxPoint& offset,
+ double plot_scale )
{
wxString msg;
@@ -370,15 +374,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
return;
}
- SetLocaleTo_C_standard();
+ LOCALE_IO toggle;
+
msg.Printf( _( "Plot: %s " ), FileName.GetData() );
m_MsgBox->AppendText( msg );
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
- plotter->set_paper_size( sheet );
+
+ plotter->SetPageSettings( pageInfo );
+
plotter->set_viewport( offset, plot_scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
- /* Init : */
+
+ // Init :
plotter->set_creator( wxT( "Eeschema-HPGL" ) );
plotter->set_filename( FileName );
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed );
@@ -389,14 +397,13 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
plotter->set_color( BLACK );
- if( m_plot_Sheet_Ref )
+ if( s_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen );
screen->Plot( plotter );
plotter->end_plot();
delete plotter;
- SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) );
}
@@ -406,7 +413,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
*/
void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event )
{
- m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection();
+ s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
SetPageOffsetValue();
}
diff --git a/eeschema/dialogs/dialog_plot_schematic_PS.cpp b/eeschema/dialogs/dialog_plot_schematic_PS.cpp
index f1b839f90e..ec5ecec5fe 100644
--- a/eeschema/dialogs/dialog_plot_schematic_PS.cpp
+++ b/eeschema/dialogs/dialog_plot_schematic_PS.cpp
@@ -70,12 +70,13 @@ private:
void initOptVars();
void createPSFile();
void plotOneSheetPS( const wxString& FileName,
- SCH_SCREEN* screen, Ki_PageDescr* sheet,
+ SCH_SCREEN* screen, const PAGE_INFO& pageInfo,
wxPoint plot_offset, double scale );
};
-/* static members (static to remember last state): */
+
+// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = false;
-int DIALOG_PLOT_SCHEMATIC_PS:: m_pageSizeSelect = PAGE_SIZE_AUTO;
+int DIALOG_PLOT_SCHEMATIC_PS::m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
@@ -172,13 +173,13 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
- SCH_SCREEN* screen = m_Parent->GetScreen();
- SCH_SHEET_PATH* sheetpath;
- SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
- wxString plotFileName;
- Ki_PageDescr* actualPage; // page size selected in schematic
- Ki_PageDescr* plotPage; // page size selected to plot
- wxPoint plot_offset;
+ SCH_SCREEN* screen = m_Parent->GetScreen();
+ SCH_SHEET_PATH* sheetpath;
+ SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
+ wxString plotFileName;
+ PAGE_INFO actualPage; // page size selected in schematic
+ PAGE_INFO plotPage; // page size selected to plot
+ wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must update component references
@@ -213,16 +214,16 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
sheetpath = SheetList.GetNext();
}
- actualPage = screen->m_CurrentSheetDesc;
+ actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
- plotPage = &g_Sheet_A;
+ plotPage.SetType( wxT( "A" ) );
break;
case PAGE_SIZE_A4:
- plotPage = &g_Sheet_A4;
+ plotPage.SetType( wxT( "A4" ) );
break;
case PAGE_SIZE_AUTO:
@@ -231,8 +232,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break;
}
- double scalex = (double) plotPage->m_Size.x / actualPage->m_Size.x;
- double scaley = (double) plotPage->m_Size.y / actualPage->m_Size.y;
+ double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
+ double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
+
double scale = 10 * MIN( scalex, scaley );
plot_offset.x = 0;
@@ -252,11 +254,11 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
}
-void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
- SCH_SCREEN* screen,
- Ki_PageDescr* sheet,
- wxPoint plot_offset,
- double scale )
+void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
+ SCH_SCREEN* screen,
+ const PAGE_INFO& pageInfo,
+ wxPoint plot_offset,
+ double scale )
{
wxString msg;
@@ -276,12 +278,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
m_MsgBox->AppendText( msg );
PS_PLOTTER* plotter = new PS_PLOTTER();
- plotter->set_paper_size( sheet );
+ plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode( m_plotColorOpt );
- /* Init : */
+ // Init :
plotter->set_creator( wxT( "Eeschema-PS" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp
index 4f945f598e..893f25bd7a 100644
--- a/eeschema/dialogs/dialog_print_using_printer.cpp
+++ b/eeschema/dialogs/dialog_print_using_printer.cpp
@@ -95,7 +95,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
#ifdef __WXMAC__
- /* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
+ // Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_buttonPreview->Hide();
#endif
}
@@ -310,7 +310,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
{
int oldZoom;
wxPoint tmp_startvisu;
- wxSize SheetSize; // Page size in internal units
+ wxSize pageSizeIU; // Page size in internal units
wxPoint old_org;
EDA_RECT oldClipBox;
wxRect fitRect;
@@ -320,10 +320,11 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxBusyCursor dummy;
- /* Save current scale factor, offsets, and clip box. */
+ // Save current scale factor, offsets, and clip box.
tmp_startvisu = aScreen->m_StartVisu;
oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg;
+
oldClipBox = *panel->GetClipBox();
// Change clip box to print the whole page.
@@ -336,9 +337,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
if( printReference )
{
- /* Draw the page to a memory and let the dc calculate the drawing
- * limits.
- */
+ // Draw the page to a memory and let the dc calculate the drawing limits.
wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap );
@@ -348,16 +347,17 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
- SheetSize.x = memDC.MaxX() - memDC.MinX();
- SheetSize.y = memDC.MaxY() - memDC.MinY();
+ pageSizeIU.x = memDC.MaxX() - memDC.MinX();
+ pageSizeIU.y = memDC.MaxY() - memDC.MinY();
- FitThisSizeToPageMargins( SheetSize, parent->GetPageSetupData() );
+ FitThisSizeToPageMargins( pageSizeIU, parent->GetPageSetupData() );
fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() );
}
else
{
- SheetSize = aScreen->m_CurrentSheetDesc->m_Size;
- FitThisSizeToPaper( SheetSize );
+ pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
+
+ FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();
}
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index f05963100f..a55ffdc368 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
- /* Hotkey IDs */
+ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr );
break;
@@ -145,7 +145,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
- /* Hotkey IDs */
+ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr );
break;
@@ -267,7 +267,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
NET_TYPE_PCBNEW,
NET_TYPE_CUSTOM_MAX ) );
- /* NOTE: Left as global until supporting code can be fixed. */
+ // NOTE: Left as global until supporting code can be fixed.
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ),
&g_HPGL_Pen_Descr.m_Pen_Speed,
20, 2, 45 ) );
@@ -277,6 +277,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ),
&g_HPGL_Pen_Descr.m_Pen_Num,
1, 1, 8 ) );
+
+/* these globals don't exist
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ),
&g_Sheet_A4.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ),
@@ -317,6 +319,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
&g_Sheet_E.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ),
&g_Sheet_E.m_Offset.y ) );
+*/
+
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x,
0, -1000, +1000 ) );
@@ -362,7 +366,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
IsRead = false;
}
- /* User library path takes precedent over default library search paths. */
+ // User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 );
/* If the list is void, force loading the library "power.lib" that is
@@ -382,7 +386,7 @@ void SCH_EDIT_FRAME::SaveProjectFile()
{
wxFileName fn;
- fn = g_RootSheet->GetScreen()->GetFileName(); /*ConfigFileName*/
+ fn = g_RootSheet->GetScreen()->GetFileName(); //ConfigFileName
fn.SetExt( ProjectFileExtension );
if( !IsWritable( fn ) )
@@ -528,7 +532,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
- /* Load print preview window session settings. */
+ // Load print preview window session settings.
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
m_previewPosition.x = (int) tmp;
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
@@ -538,7 +542,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
m_previewSize.SetHeight( (int) tmp );
- /* Load print dialog session settings. */
+ // Load print dialog session settings.
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
m_printDialogPosition.x = (int) tmp;
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
@@ -552,7 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
- /* Load find dialog session setting. */
+ // Load find dialog session setting.
cfg->Read( FindDialogPositionXEntry, &tmp, -1 );
m_findDialogPosition.x = (int) tmp;
cfg->Read( FindDialogPositionYEntry, &tmp, -1 );
@@ -568,7 +572,7 @@ void SCH_EDIT_FRAME::LoadSettings()
m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) );
m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) );
- /* Load the find and replace string history list. */
+ // Load the find and replace string history list.
for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ )
{
wxString tmpHistory;
@@ -619,13 +623,13 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
- /* Save print preview window session settings. */
+ // Save print preview window session settings.
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
- /* Save print dialog session settings. */
+ // Save print dialog session settings.
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
@@ -635,7 +639,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
- /* Save find dialog session setting. */
+ // Save find dialog session setting.
cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x );
cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y );
cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() );
@@ -647,7 +651,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() );
cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() );
- /* Save the find and replace string history list. */
+ // Save the find and replace string history list.
size_t i;
wxString tmpHistory;
wxString entry; // invoke constructor outside of any loops
diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp
index f21c48174a..c81c41a5e7 100644
--- a/eeschema/files-io.cpp
+++ b/eeschema/files-io.cpp
@@ -244,7 +244,10 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
if( aIsNew )
{
- screen->m_CurrentSheetDesc = &g_Sheet_A4;
+ /* SCH_SCREEN constructor does this now
+ screen->SetPageSettings( PAGE_INFO( wxT( "A4" ) ) );
+ */
+
screen->SetZoom( 32 );
screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
screen->m_Title = NAMELESS_PROJECT;
diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp
index 792394cdba..fd39dc8e58 100644
--- a/eeschema/libedit_plot_component.cpp
+++ b/eeschema/libedit_plot_component.cpp
@@ -33,54 +33,71 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
switch( event.GetId() )
{
case ID_LIBEDIT_GEN_PNG_FILE:
- {
- bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
+ {
+ bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
- file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
- mask = wxT( "*." ) + file_ext;
- wxFileName fn( cmp->GetName() );
- fn.SetExt( file_ext );
+ file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
+ mask = wxT( "*." ) + file_ext;
+ wxFileName fn( cmp->GetName() );
+ fn.SetExt( file_ext );
- FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
- fn.GetFullName(), file_ext, mask, this,
- wxFD_SAVE, true );
+ FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
+ fn.GetFullName(), file_ext, mask, this,
+ wxFD_SAVE, true );
- if( FullFileName.IsEmpty() )
- return;
+ if( FullFileName.IsEmpty() )
+ return;
- // calling wxYield is mandatory under Linux, after closing the file selector dialog
- // to refresh the screen before creating the PNG or JPEG image from screen
- wxYield();
- CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
- }
+ // calling wxYield is mandatory under Linux, after closing the file selector dialog
+ // to refresh the screen before creating the PNG or JPEG image from screen
+ wxYield();
+ CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
+ }
break;
case ID_LIBEDIT_GEN_SVG_FILE:
- {
- file_ext = wxT( "svg" );
- mask = wxT( "*." ) + file_ext;
- wxFileName fn( cmp->GetName() );
- fn.SetExt( file_ext );
- FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
- fn.GetFullName(), file_ext, mask, this,
- wxFD_SAVE, true );
+ {
+ file_ext = wxT( "svg" );
+ mask = wxT( "*." ) + file_ext;
+ wxFileName fn( cmp->GetName() );
+ fn.SetExt( file_ext );
+ FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
+ fn.GetFullName(), file_ext, mask, this,
+ wxFD_SAVE, true );
- if( FullFileName.IsEmpty() )
- return;
+ if( FullFileName.IsEmpty() )
+ return;
- /* Give a size to the SVG draw area = component size + margin
- * the margin is 10% the size of the component size
- */
- wxSize pagesize = GetScreen()->ReturnPageSize( );
- wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
+#if 0 // would the PAGE_INFO margins work for this old code:
- // Add a small margin to the plot bounding box
- componentSize.x = (int)(componentSize.x * 1.2);
- componentSize.y = (int)(componentSize.y * 1.2);
- GetScreen()->SetPageSize( componentSize );
- SVG_Print_Component( FullFileName );
- GetScreen()->SetPageSize( pagesize );
- }
+ // Give a size to the SVG draw area = component size + margin
+ // the margin is 10% the size of the component size
+ wxSize pagesize = GetScreen()->ReturnPageSize( );
+ wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
+
+ // Add a small margin to the plot bounding box
+ componentSize.x = (int)(componentSize.x * 1.2);
+ componentSize.y = (int)(componentSize.y * 1.2);
+
+ GetScreen()->SetPageSize( componentSize );
+ SVG_Print_Component( FullFileName );
+ GetScreen()->SetPageSize( pagesize );
+
+#else
+ PAGE_INFO pageSave = GetScreen()->GetPageSettings();
+ PAGE_INFO pageTemp = pageSave;
+
+ wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
+
+ // Add a small margin to the plot bounding box
+ pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
+ pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
+
+ GetScreen()->SetPageSettings( pageTemp );
+ SVG_Print_Component( FullFileName );
+ GetScreen()->SetPageSettings( pageSave );
+#endif
+ }
break;
}
}
@@ -116,7 +133,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode
if( ! m_component )
return;
- wxSize pagesize = GetScreen()->ReturnPageSize();
+ wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
+
/* Plot item centered to the page
* In libedit, the component is centered at 0,0 coordinates.
* So we must plot it with an offset = pagesize/2.
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index 12afe1036c..6e9d6540aa 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -210,7 +210,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
SetIcon( icon );
SetScreen( new SCH_SCREEN() );
+
GetScreen()->m_Center = true;
+
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadSettings();
@@ -285,6 +287,39 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
}
+void LIB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
+{
+ GetScreen()->SetPageSettings( aPageSettings );
+}
+
+
+const PAGE_INFO& LIB_EDIT_FRAME::GetPageSettings () const
+{
+ return GetScreen()->GetPageSettings();
+}
+
+
+const wxSize LIB_EDIT_FRAME::GetPageSizeIU() const
+{
+ // GetSizeIU is compile time dependent:
+ return GetScreen()->GetPageSettings().GetSizeIU();
+}
+
+
+const wxPoint& LIB_EDIT_FRAME::GetOriginAxisPosition() const
+{
+ wxASSERT( GetScreen() );
+ return GetScreen()->GetOriginAxisPosition();
+}
+
+
+void LIB_EDIT_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
+{
+ wxASSERT( GetScreen() );
+ GetScreen()->SetOriginAxisPosition( aPosition );
+}
+
+
void LIB_EDIT_FRAME::LoadSettings()
{
wxConfig* cfg;
@@ -377,8 +412,11 @@ double LIB_EDIT_FRAME::BestZoom()
}
else
{
- dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
- dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
+ const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
+
+ dx = pageInfo.GetSizeIU().x;
+ dy = pageInfo.GetSizeIU().y;
+
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
}
diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h
index b1336874db..0bb97b3863 100644
--- a/eeschema/libeditframe.h
+++ b/eeschema/libeditframe.h
@@ -257,7 +257,17 @@ public:
double BestZoom(); // Returns the best zoom
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
- SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
+ SCH_SCREEN* GetScreen() const { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
+
+ // note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
+ // would allow sharing of these 5 functions:
+
+ void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
+ const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
+ const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
+
+ const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
+ void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp
index 6d28cd8145..a9ba6aad7f 100644
--- a/eeschema/load_one_schematic_file.cpp
+++ b/eeschema/load_one_schematic_file.cpp
@@ -48,7 +48,7 @@
#include "sch_bitmap.h"
-bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window );
+bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
static void LoadLayers( LINE_READER* aLine );
@@ -300,45 +300,20 @@ static void LoadLayers( LINE_READER* aLine )
/* Read the schematic header. */
-bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScreen )
+bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScreen )
{
- char Text[256];
+ char text[256];
char buf[1024];
- int ii;
- Ki_PageDescr* wsheet = &g_Sheet_A4;
- wxSize PageSize;
- char* line;
+ wxSize pageSize;
+ char* line = aLine->Line();
- static Ki_PageDescr* SheetFormatList[] =
- {
- &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
- &g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
- &g_Sheet_user, NULL
- };
+ sscanf( line, "%s %s %d %d", text, text, &pageSize.x, &pageSize.y );
- line = aLine->Line();
+ wxString pagename = FROM_UTF8( text );
- sscanf( line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
+ PAGE_INFO pageInfo;
- wxString pagename = FROM_UTF8( Text );
-
- for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
- {
- wsheet = SheetFormatList[ii];
-
- if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */
- {
- // Get the user page size and make it the default
- if( wsheet == &g_Sheet_user )
- {
- g_Sheet_user.m_Size = PageSize;
- }
-
- break;
- }
- }
-
- if( SheetFormatList[ii] == NULL )
+ if( !pageInfo.SetType( pagename ) )
{
aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ),
@@ -346,7 +321,13 @@ line %d, \aAbort reading file.\n" ),
aMsgDiag << FROM_UTF8( line );
}
- aScreen->m_CurrentSheetDesc = wsheet;
+ if( pagename == wxT( "User" ) )
+ {
+ pageInfo.SetWidthMils( pageSize.x );
+ pageInfo.SetHeightMils( pageSize.y );
+ }
+
+ aScreen->SetPageSettings( pageInfo );
for( ; ; )
{
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index b32289f946..5ddff19a21 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -97,12 +97,15 @@ static GRID_TYPE SchematicGridList[] = {
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / sizeof( GRID_TYPE ) )
-SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
+SCH_SCREEN::SCH_SCREEN() :
+ BASE_SCREEN( SCH_SCREEN_T ),
+ m_paper( wxT( "A4" ) )
{
size_t i;
- SetDrawItems( NULL ); /* Schematic items list */
- m_Zoom = 32;
+ SetDrawItems( NULL ); // Schematic items list
+
+ SetZoom( 32 );
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( SchematicZoomList[i] );
@@ -110,12 +113,13 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] );
- SetGrid( wxRealPoint( 50, 50 ) ); /* Default grid size. */
+ SetGrid( wxRealPoint( 50, 50 ) ); // Default grid size.
m_refCount = 0;
- m_Center = false; /* Suitable for schematic only. For
- * libedit and viewlib, must be set
- * to true */
- InitDatas();
+
+ // Suitable for schematic only. For libedit and viewlib, must be set to true
+ m_Center = false;
+
+ InitDataPoints( m_paper.GetSizeIU() );
}
@@ -571,8 +575,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* sheet ( ScreenNumber = 1 ) within the files
*/
- if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_CurrentSheetDesc->m_Name ),
- m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0
+ if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_paper.GetType() ),
+ m_paper.GetWidthMils(), m_paper.GetHeightMils() ) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0
@@ -617,7 +621,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aC
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
{
- for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() )
+ for( SCH_ITEM* item = GetDrawItems(); item; item = item->Next() )
{
aPlotter->set_current_line_width( item->GetPenSize() );
item->Plot( aPlotter );
@@ -1547,3 +1551,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
return count;
}
+
+#if defined(DEBUG)
+void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
+{
+ // for now, make it look like XML, expand on this later.
+ NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
+
+ for( EDA_ITEM* item = m_drawList; item; item = item->Next() )
+ {
+ item->Show( nestLevel+1, os );
+ }
+
+ NestedSpace( nestLevel, os ) << "" << GetClass().Lower().mb_str() << ">\n";
+}
+#endif
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 1b378347dd..71aa97e4b9 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -241,6 +241,8 @@ typedef boost::ptr_vector SCH_SHEET_PINS;
*/
class SCH_SHEET : public SCH_ITEM
{
+ friend class SCH_SHEET_PIN;
+
/// Screen that contains the physical data for the sheet. In complex hierarchies
/// multiple sheets can share a common screen.
SCH_SCREEN* m_screen;
@@ -268,8 +270,6 @@ class SCH_SHEET : public SCH_ITEM
/// The size of the sheet.
wxSize m_size;
- friend class SCH_SHEET_PIN;
-
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index c4fa729df3..273a614d26 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -285,6 +285,39 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
}
+void SCH_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
+{
+ GetScreen()->SetPageSettings( aPageSettings );
+}
+
+
+const PAGE_INFO& SCH_EDIT_FRAME::GetPageSettings () const
+{
+ return GetScreen()->GetPageSettings();
+}
+
+
+const wxSize SCH_EDIT_FRAME::GetPageSizeIU() const
+{
+ // GetSizeIU is compile time dependent:
+ return GetScreen()->GetPageSettings().GetSizeIU();
+}
+
+
+const wxPoint& SCH_EDIT_FRAME::GetOriginAxisPosition() const
+{
+ wxASSERT( GetScreen() );
+ return GetScreen()->GetOriginAxisPosition();
+}
+
+
+void SCH_EDIT_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
+{
+ wxASSERT( GetScreen() );
+ GetScreen()->SetOriginAxisPosition( aPosition );
+}
+
+
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{
SCH_SCREEN* screen = GetScreen();
@@ -489,8 +522,8 @@ double SCH_EDIT_FRAME::BestZoom()
int dx, dy;
wxSize size;
- dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
- dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
+ dx = GetScreen()->GetPageSettings().GetWidthIU();
+ dy = GetScreen()->GetPageSettings().GetHeightIU();
size = m_canvas->GetClientSize();
diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp
index 29bdbdfef8..a9a3d50b99 100644
--- a/eeschema/viewlib_frame.cpp
+++ b/eeschema/viewlib_frame.cpp
@@ -265,6 +265,39 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
}
+void LIB_VIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
+{
+ GetScreen()->SetPageSettings( aPageSettings );
+}
+
+
+const PAGE_INFO& LIB_VIEW_FRAME::GetPageSettings () const
+{
+ return GetScreen()->GetPageSettings();
+}
+
+
+const wxSize LIB_VIEW_FRAME::GetPageSizeIU() const
+{
+ // GetSizeIU is compile time dependent:
+ return GetScreen()->GetPageSettings().GetSizeIU();
+}
+
+
+const wxPoint& LIB_VIEW_FRAME::GetOriginAxisPosition() const
+{
+ wxASSERT( GetScreen() );
+ return GetScreen()->GetOriginAxisPosition();
+}
+
+
+void LIB_VIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
+{
+ wxASSERT( GetScreen() );
+ GetScreen()->SetOriginAxisPosition( aPosition );
+}
+
+
void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
SaveSettings();
diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h
index 1956e2b12e..89866393ab 100644
--- a/eeschema/viewlib_frame.h
+++ b/eeschema/viewlib_frame.h
@@ -34,12 +34,11 @@
#include
#include "wxstruct.h"
-
+#include "class_sch_screen.h"
class wxSashLayoutWindow;
class wxListBox;
class wxSemaphore;
-class SCH_SCREEN;
class CMP_LIBRARY;
@@ -108,7 +107,17 @@ public:
void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
- SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
+ SCH_SCREEN* GetScreen() const { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
+
+ // note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
+ // would allow sharing of these 5 functions:
+
+ void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
+ const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
+ const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
+
+ const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
+ void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
diff --git a/gerbview/dialogs/dialog_show_page_borders.cpp b/gerbview/dialogs/dialog_show_page_borders.cpp
index 64e8420d5f..244b45e5ce 100644
--- a/gerbview/dialogs/dialog_show_page_borders.cpp
+++ b/gerbview/dialogs/dialog_show_page_borders.cpp
@@ -29,10 +29,12 @@
#include "fctsys.h"
#include "common.h"
+#include "macros.h"
#include "gerbview.h"
#include "dialog_show_page_borders.h"
+
DIALOG_PAGE_SHOW_PAGE_BORDERS::DIALOG_PAGE_SHOW_PAGE_BORDERS( GERBVIEW_FRAME *parent) :
DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE( parent, wxID_ANY )
{
@@ -43,11 +45,13 @@ DIALOG_PAGE_SHOW_PAGE_BORDERS::DIALOG_PAGE_SHOW_PAGE_BORDERS( GERBVIEW_FRAME *pa
if( m_Parent->GetShowBorderAndTitleBlock() )
{
- for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
+ wxString curPaperType = m_Parent->GetPageSettings().GetType();
+
+ for( unsigned i = 1; iGetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
+ if( curPaperType == g_GerberPageSizeList[i] )
{
- m_ShowPageLimits->SetSelection(ii);
+ m_ShowPageLimits->SetSelection( i );
break;
}
}
@@ -73,8 +77,9 @@ void DIALOG_PAGE_SHOW_PAGE_BORDERS::OnOKBUttonClick( wxCommandEvent& event )
int idx = m_ShowPageLimits->GetSelection();
- m_Parent->SetShowBorderAndTitleBlock( (idx > 0) ? true : false );
- m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
+ m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
+
+ m_Parent->SetPageSettings( PAGE_INFO( g_GerberPageSizeList[idx] ) );
EndModal( wxID_OK );
}
diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
index 5f14791481..3e0b330ada 100644
--- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
+++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
@@ -6,6 +6,7 @@
#include "fctsys.h"
#include "common.h"
+#include "macros.h"
#include "class_drawpanel.h"
#include "pcbplot.h"
@@ -35,11 +36,11 @@ private:
void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
{
- DIALOG_DISPLAY_OPTIONS dlg( this );
- int opt = dlg.ShowModal();
+ DIALOG_DISPLAY_OPTIONS dlg( this );
+ int opt = dlg.ShowModal();
- if (opt > 0 )
- m_canvas->Refresh();
+ if( opt > 0 )
+ m_canvas->Refresh();
}
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
@@ -61,9 +62,9 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& event )
EndModal( 0 );
}
+
void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
{
-
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( m_Parent->GetCursorShape() ? 1 : 0 );
@@ -71,6 +72,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetSelection( DisplayOpt.DisplayPcbTrackFill ? 1 : 0 );
m_OptDisplayFlashedItems->SetSelection( DisplayOpt.DisplayPadFill ? 1 : 0);
+
// Show Option Draw polygons
m_OptDisplayPolygons->SetSelection( g_DisplayPolygonsModeSketch ? 0 : 1 );
@@ -78,11 +80,13 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
if( m_Parent->GetShowBorderAndTitleBlock() )
{
- for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
+ wxString curPaperType = m_Parent->GetPageSettings().GetType();
+
+ for( unsigned i = 1; i < DIM( g_GerberPageSizeList ); ++i )
{
- if( m_Parent->GetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
+ if( g_GerberPageSizeList[i] == curPaperType )
{
- m_ShowPageLimits->SetSelection(ii);
+ m_ShowPageLimits->SetSelection( i );
break;
}
}
@@ -91,6 +95,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
}
+
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
{
DisplayOpt.DisplayPolarCood =
@@ -127,8 +132,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
int idx = m_ShowPageLimits->GetSelection();
- m_Parent->SetShowBorderAndTitleBlock( ( idx > 0 ) ? true : false );
- m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
+ m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
+
+ PAGE_INFO pageInfo( g_GerberPageSizeList[idx] );
+
+ m_Parent->SetPageSettings( pageInfo );
EndModal( 1 );
}
diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp
index 8ffedf7b4f..7f7f8340ed 100644
--- a/gerbview/events_called_functions.cpp
+++ b/gerbview/events_called_functions.cpp
@@ -154,12 +154,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
case ID_GERBVIEW_SET_PAGE_BORDER:
{
- DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
+ DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
- if (dlg.ShowModal() == wxID_OK )
- m_canvas->Refresh();
+ if( dlg.ShowModal() == wxID_OK )
+ m_canvas->Refresh();
}
-
break;
case ID_GERBVIEW_GLOBAL_DELETE:
diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp
index 667231e8cb..b5f525c0b3 100644
--- a/gerbview/gerbview.cpp
+++ b/gerbview/gerbview.cpp
@@ -29,17 +29,20 @@ COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format;
int g_DisplayPolygonsModeSketch;
-GERBER_IMAGE* g_GERBER_List[32];
-// List of page sizes
-Ki_PageDescr* g_GerberPageSizeList[] =
-{
- &g_Sheet_GERBER, // Full size page selection, and do not show page limits
- &g_Sheet_GERBER, // Full size page selection, and show page limits
- &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2,
- &g_Sheet_A, &g_Sheet_B, &g_Sheet_C,
- NULL // End of list
- };
+const wxChar* g_GerberPageSizeList[] = {
+ wxT( "GERBER" ), // index 0: full size page selection, and do not show page limits
+ wxT( "GERBER" ), // index 1: full size page selection, and show page limits
+ wxT( "A4" ),
+ wxT( "A3" ),
+ wxT( "A2" ),
+ wxT( "A" ),
+ wxT( "B" ),
+ wxT( "C" ),
+};
+
+
+GERBER_IMAGE* g_GERBER_List[32];
IMPLEMENT_APP( EDA_APP )
diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h
index 379f01053f..e64ec05e0f 100644
--- a/gerbview/gerbview.h
+++ b/gerbview/gerbview.h
@@ -19,8 +19,10 @@ class GERBVIEW_FRAME;
//class BOARD;
class GERBER_IMAGE;
-class Ki_PageDescr;
+class PAGE_INFO;
+/// List of page sizes
+extern const wxChar* g_GerberPageSizeList[8];
// Type of photoplotter action:
#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen)
@@ -28,12 +30,13 @@ class Ki_PageDescr;
#define GERB_FLASH 3 // Flash
-typedef enum
+enum PlotFormat
{
FORMAT_HPGL,
FORMAT_GERBER,
FORMAT_POST
-} PlotFormat;
+};
+
/**
* Enum ITEM_VISIBLE
@@ -57,8 +60,6 @@ extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt;
extern const wxString GerbviewProjectFileWildcard;
-extern Ki_PageDescr* g_GerberPageSizeList[];
-
// Interpolation type
enum Gerb_Interpolation
{
diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp
index 25c3f58f37..ae97ee4809 100644
--- a/gerbview/gerbview_config.cpp
+++ b/gerbview/gerbview_config.cpp
@@ -29,6 +29,7 @@
*/
#include "fctsys.h"
+#include "macros.h"
#include "id.h"
#include "common.h"
#include "class_drawpanel.h"
@@ -55,7 +56,7 @@ void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
switch( id )
{
- /* Hotkey IDs */
+ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr );
break;
@@ -81,7 +82,7 @@ void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
}
-PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
+PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
{
if( !m_configSettings.empty() )
return m_configSettings;
@@ -102,9 +103,8 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
&DisplayOpt.DisplayPolarCood,
false ) );
- // Color select parameters:
- static const int color_default[32] = // Default values for color layers 0 to 31
- {
+ // Default colors for layers 0 to 31
+ static const int color_default[] = {
GREEN, BLUE, LIGHTGRAY, MAGENTA,
RED, DARKGREEN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, CYAN,
@@ -112,26 +112,35 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
BLUE, BROWN, LIGHTCYAN, RED,
MAGENTA, CYAN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, DARKCYAN,
- YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY
+ YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY,
};
- // List of keywords used as identifiers in config
- // they *must* be static const and not temporary created,
+ // List of keywords used as identifiers in config.
+ // They *must* be static const and not temporarily created,
// because the parameter list that use these keywords does not store them,
- // just points on them
- static const wxChar * keys[32] =
- {
- wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"),
- wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"),
- wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"),
- wxT("ColorLayer12"), wxT("ColorLaye13"), wxT("ColorLayer14"), wxT("ColorLayer15")
+ // just points to them.
+ static const wxChar* keys[] = {
+ wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"),
+ wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"),
+ wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"),
+ wxT("ColorLayer12"), wxT("ColorLayer13"), wxT("ColorLayer14"), wxT("ColorLayer15"),
+
+ wxT("ColorLayer16"), wxT("ColorLayer17"), wxT("ColorLayer18"), wxT("ColorLayer19"),
+ wxT("ColorLayer20"), wxT("ColorLayer21"), wxT("ColorLayer22"), wxT("ColorLayer23"),
+ wxT("ColorLayer24"), wxT("ColorLayer25"), wxT("ColorLayer26"), wxT("ColorLayer27"),
+ wxT("ColorLayer28"), wxT("ColorLayer29"), wxT("ColorLayer30"), wxT("ColorLayer31"),
};
- for( unsigned ii = 0; ii < 32; ii++ )
+ wxASSERT( DIM(keys) == DIM(color_default) );
+ wxASSERT( DIM(keys) <= DIM(g_ColorsSettings.m_LayersColors) && DIM(keys) <= DIM(color_default) );
+
+ for( unsigned i = 0; i < DIM(keys); ++i )
{
- int * prm = &g_ColorsSettings.m_LayersColors[1];
- PARAM_CFG_SETCOLOR * prm_entry =
- new PARAM_CFG_SETCOLOR( true, keys[ii], prm, color_default[1] );
+ int* prm = &g_ColorsSettings.m_LayersColors[i];
+
+ PARAM_CFG_SETCOLOR* prm_entry =
+ new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
+
m_configSettings.push_back( prm_entry );
}
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 3c45a42c86..830f0b7cb9 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -48,8 +48,9 @@
// Config keywords
-const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
-const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
+static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
+static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
+static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
/*************************************/
@@ -67,8 +68,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_FrameName = wxT( "GerberFrame" );
m_show_layer_manager_tools = true;
- m_showAxis = true; // true to show X and Y axis on screen
- m_showBorderAndTitleBlock = false; // true for reference drawings.
+ m_showAxis = true; // true to show X and Y axis on screen
+ m_showBorderAndTitleBlock = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_SelLayerBox = NULL;
m_DCodeSelector = NULL;
@@ -83,13 +84,17 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
SetIcon( icon );
- SetScreen( new PCB_SCREEN() );
- GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
-
SetBoard( new BOARD() );
+
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
+ // BOARD was constructed with "A3", change to "GERBER"
+ PAGE_INFO pageInfo( wxT( "GERBER" ) );
+ GetBoard()->SetPageSettings( pageInfo );
+
+ SetScreen( new PCB_SCREEN( pageInfo.GetSizeIU() ) );
+
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
@@ -209,25 +214,25 @@ void GERBVIEW_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
- long pageSize_opt;
- config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
- int imax = 0;
+ PAGE_INFO pageInfo( wxT( "GERBER" ) );
- for( ; g_GerberPageSizeList[imax] != NULL; imax++ )
- ;
+ config->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
- if( pageSize_opt < 0 || pageSize_opt >= imax )
- pageSize_opt = 0;
-
- GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt];
-
- if( pageSize_opt > 0 )
+ if( m_showBorderAndTitleBlock )
{
- m_showBorderAndTitleBlock = true;
+ wxString pageType;
+
+ config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
+
+ pageInfo.SetType( pageType );
}
+ SetPageSettings( pageInfo );
+
+ GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
+
long tmp;
- config->Read( GerbviewShowDCodes, &tmp, 1 );
+ config->Read( cfgShowDCodes, &tmp, 1 );
SetElementVisibility( DCODES_VISIBLE, tmp );
// because we have 2 file historues, we must read this one
@@ -254,22 +259,10 @@ void GERBVIEW_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
- long pageSize_opt = 0;
+ config->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
+ config->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
+ config->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
- if( m_showBorderAndTitleBlock )
- {
- for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
- {
- if( GetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
- {
- pageSize_opt = ii;
- break;
- }
- }
- }
-
- config->Write( GerbviewShowPageSizeOption, pageSize_opt );
- config->Write( GerbviewShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
// Save the drill file history list.
// Because we have 2 file histories, we must save this one
// in a specific path
diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp
index 7042329929..fbec7a140b 100644
--- a/gerbview/initpcb.cpp
+++ b/gerbview/initpcb.cpp
@@ -68,8 +68,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
- SetScreen( new PCB_SCREEN() );
- GetScreen()->Init();
+ SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
+
setActiveLayer(FIRST_COPPER_LAYER);
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
diff --git a/include/appl_wxstruct.h b/include/appl_wxstruct.h
index 9a558f28ea..7ea12ded28 100644
--- a/include/appl_wxstruct.h
+++ b/include/appl_wxstruct.h
@@ -254,9 +254,9 @@ public:
/**
* Function SaveCurrentSetupValues
- * Save the current setup values in m_settings
- * saved parameters are parameters that have the .m_Setup member set to
- * true
+ * saves the current setup values in m_settings.
+ * Saved parameters are parameters that have the .m_Setup member set to
+ * true.
* @param aList = array of PARAM_CFG_BASE pointers
*/
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
@@ -264,9 +264,9 @@ public:
/**
* Function ReadCurrentSetupValues
- * Read the current setup values previously saved, from m_settings
- * saved parameters are parameters that have the .m_Setup member set to
- * true
+ * reads the current setup values previously saved, from m_settings.
+ * Saved parameters are parameters that have the .m_Setup member set to
+ * true.
* @param aList = array of PARAM_CFG_BASE pointers
*/
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
diff --git a/include/class_base_screen.h b/include/class_base_screen.h
index 8b1339e003..786180e6d7 100644
--- a/include/class_base_screen.h
+++ b/include/class_base_screen.h
@@ -37,11 +37,10 @@
#include "common.h"
-// Forward declarations:
-class Ki_PageDescr;
-
-
-/* Simple class for handling grid arrays. */
+/**
+ * Class GRID_TYPE
+ * is for grid arrays.
+ */
class GRID_TYPE
{
public:
@@ -59,7 +58,6 @@ public:
return *this;
}
-
const bool operator==( const GRID_TYPE& item ) const
{
return m_Size == item.m_Size && m_Id == item.m_Id;
@@ -72,12 +70,11 @@ typedef std::vector< GRID_TYPE > GRIDS;
/**
* Class BASE_SCREEN
- * handle how to draw a screen (a board, a schematic ...)
+ * handles how to draw a screen (a board, a schematic ...)
*/
class BASE_SCREEN : public EDA_ITEM
{
GRIDS m_grids; ///< List of valid grid sizes.
- EDA_ITEM* m_drawList; ///< Object list for the screen.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
bool m_FlagModified; ///< Indicates current drawing has been modified.
@@ -94,19 +91,24 @@ class BASE_SCREEN : public EDA_ITEM
*/
wxPoint m_crossHairPosition;
+ double m_Zoom; ///< Current zoom coefficient.
+
+
public:
- wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
+ wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/
// Scrollbars management:
- int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */
- int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */
+ int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
+ int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
+
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* virtual draw area size in pixels */
- wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll units. */
+
+ wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device)
@@ -117,18 +119,16 @@ public:
* > 0 except for schematics.
* false: when coordinates can only be >= 0
* Schematic */
- bool m_FirstRedraw;
+ bool m_FirstRedraw;
// Undo/redo list of commands
- UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
- UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
- unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
+ UNDO_REDO_CONTAINER m_UndoList; ///< Objects list for the undo command (old data)
+ UNDO_REDO_CONTAINER m_RedoList; ///< Objects list for the redo command (old data)
+ unsigned m_UndoRedoCountMax; ///< undo/Redo command Max depth
- /* block control */
- BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
+ // block control
+ BLOCK_SELECTOR m_BlockLocate; ///< Block description for block commands
- /* Page description */
- Ki_PageDescr* m_CurrentSheetDesc;
int m_ScreenNumber;
int m_NumberOfScreen;
@@ -141,11 +141,9 @@ public:
wxString m_Commentaire3;
wxString m_Commentaire4;
- /* Grid and zoom values. */
- wxPoint m_GridOrigin;
+ wxPoint m_GridOrigin;
- wxArrayDouble m_ZoomList; /* Array of standard zoom (i.e. scale) coefficients. */
- double m_Zoom; /* Current zoom coefficient. */
+ wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
bool m_IsPrinting;
public:
@@ -161,24 +159,12 @@ public:
EDA_ITEM* GetCurItem() const { return m_CurrentItem; }
- /**
- * Function GetDrawItems().
- *
- * @return - A pointer to the first item in the linked list of draw items.
- */
- virtual EDA_ITEM* GetDrawItems() const { return m_drawList; }
-
- virtual void SetDrawItems( EDA_ITEM* aItem ) { m_drawList = aItem; }
-
- void InitDatas();
+ void InitDataPoints( const wxSize& aPageSizeInternalUnits );
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
wxString GetFileName() const { return m_fileName; }
- void SetPageSize( wxSize& aPageSize );
- wxSize ReturnPageSize( void );
-
/**
* Function GetInternalUnits
* @return the screen units scalar.
@@ -460,5 +446,4 @@ public:
#endif
};
-
#endif // CLASS_BASE_SCREEN_H_
diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h
index 86bc5f5f6e..8e8dcc0d10 100644
--- a/include/class_colors_design_settings.h
+++ b/include/class_colors_design_settings.h
@@ -9,7 +9,9 @@
#define LAYERSCOLORSBUFFERSIZE 32
#define ITEMSCOLORSBUFFERSIZE 32
-/* Class for handle list of color settings for designs in Eeschema, Pcbnew and GerbView
+/**
+ * Class COLORS_DESIGN_SETTINGS
+ * is a list of color settings for designs in Eeschema, Pcbnew and GerbView
*/
class COLORS_DESIGN_SETTINGS
{
diff --git a/include/class_pcb_screen.h b/include/class_pcb_screen.h
index eda157452b..4e5a3d2639 100644
--- a/include/class_pcb_screen.h
+++ b/include/class_pcb_screen.h
@@ -2,8 +2,8 @@
* @file class_pcb_screen.h
*/
-#ifndef __CLASSPCB_SCREEN_H__
-#define __CLASSPCB_SCREEN_H__
+#ifndef CLASS_PCB_SCREEN_H_
+#define CLASS_PCB_SCREEN_H_
#include "class_base_screen.h"
@@ -22,21 +22,27 @@ public:
int m_Route_Layer_BOTTOM;
public:
- PCB_SCREEN();
+
+ /**
+ * Constructor
+ * @param aPageSizeIU is the size of the initial paper page in internal units.
+ */
+ PCB_SCREEN( const wxSize& aPageSizeIU );
+
~PCB_SCREEN();
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
- void Init();
+
void SetNextZoom();
void SetPreviousZoom();
void SetLastZoom();
- virtual int GetInternalUnits( void );
+ virtual int GetInternalUnits();
/**
* Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding
- *BASE_SCREEN::GetCurItem().
+ * BASE_SCREEN::GetCurItem().
* @return BOARD_ITEM* - the one selected, or NULL.
*/
BOARD_ITEM* GetCurItem() const
@@ -73,5 +79,4 @@ public:
void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
};
-
-#endif /* __CLASSPCB_SCREEN_H__ */
+#endif // CLASS_PCB_SCREEN_H_
diff --git a/include/class_sch_screen.h b/include/class_sch_screen.h
index 7f9b4b50a5..5127e2e8fb 100644
--- a/include/class_sch_screen.h
+++ b/include/class_sch_screen.h
@@ -55,14 +55,23 @@ enum SCH_LINE_TEST_T
};
-/* Max number of sheets in a hierarchy project: */
-#define NB_MAX_SHEET 500
+/// Max number of sheets in a hierarchy project
+#define NB_MAX_SHEET 500
class SCH_SCREEN : public BASE_SCREEN
{
- int m_refCount; ///< Number of sheets referencing this screen.
- ///< Delete when it goes to zero.
+ int m_refCount; ///< Number of sheets referencing this screen.
+ ///< Delete when it goes to zero.
+
+ /// The size of the paper to print or plot on
+ PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
+
+ /// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
+ wxPoint m_originAxisPosition;
+
+ SCH_ITEM* m_drawList; ///< Object list for the screen.
+ /// @todo use DLIST or superior container
/**
* Function addConnectedItemsToBlock
@@ -77,7 +86,12 @@ class SCH_SCREEN : public BASE_SCREEN
void addConnectedItemsToBlock( const wxPoint& aPosition );
public:
- SCH_SCREEN( KICAD_T aType = SCH_SCREEN_T );
+
+ /**
+ * Constructor
+ */
+ SCH_SCREEN();
+
~SCH_SCREEN();
virtual wxString GetClass() const
@@ -85,6 +99,12 @@ public:
return wxT( "SCH_SCREEN" );
}
+ const PAGE_INFO& GetPageSettings() const { return m_paper; }
+ void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
+
+ const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
+ void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
+
void DecRefCount();
void IncRefCount();
@@ -93,12 +113,10 @@ public:
/**
* Function GetDrawItems().
- *
* @return - A pointer to the first item in the linked list of draw items.
*/
- virtual SCH_ITEM* GetDrawItems() const { return (SCH_ITEM*) BASE_SCREEN::GetDrawItems(); }
-
- virtual void SetDrawItems( SCH_ITEM* aItem ) { BASE_SCREEN::SetDrawItems( aItem ); }
+ SCH_ITEM* GetDrawItems() const { return m_drawList; }
+ void SetDrawItems( SCH_ITEM* aItem ) { m_drawList = aItem; }
/**
* Function GetCurItem
@@ -449,6 +467,10 @@ public:
* @return The number of items in the pick list.
*/
int UpdatePickList();
+
+#if defined(DEBUG)
+ void Show( int nestLevel, std::ostream& os ) const; // overload
+#endif
};
diff --git a/include/common.h b/include/common.h
index de164adec5..0ae5db0a17 100644
--- a/include/common.h
+++ b/include/common.h
@@ -32,31 +32,33 @@
#ifndef INCLUDE__COMMON_H_
#define INCLUDE__COMMON_H_
+#include
+
#include "wx/wx.h"
#include "wx/confbase.h"
#include "wx/fileconf.h"
+
class wxAboutDialogInfo;
-/* Flag for special keys */
+// Flag for special keys
#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right
* shift key depressed */
#define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed
*/
-#define GR_KB_CTRL 0x40000000 /* CTRL depressed */
-#define GR_KB_ALT 0x80000000 /* ALT depressed */
+#define GR_KB_CTRL 0x40000000 // CTRL depressed
+#define GR_KB_ALT 0x80000000 // ALT depressed
#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE 0x08000000 /* Middle button mouse
* flag for block commands
*/
-// default name for nameless projects
+/// default name for nameless projects
#define NAMELESS_PROJECT wxT( "noname" )
-#define NB_ITEMS 11
-/* Pseudo key codes for command panning */
+/// Pseudo key codes for command panning
enum pseudokeys {
EDA_PANNING_UP_KEY = 1,
EDA_PANNING_DOWN_KEY,
@@ -69,7 +71,7 @@ enum pseudokeys {
#define ESC 27
-/* TODO Executable names TODO*/
+// TODO Executable names TODO
#ifdef __WINDOWS__
#define CVPCB_EXE wxT( "cvpcb.exe" )
#define PCBNEW_EXE wxT( "pcbnew.exe" )
@@ -96,7 +98,7 @@ enum pseudokeys {
#endif
-/* Graphic Texts Orientation in 0.1 degree*/
+// Graphic Texts Orientation in 0.1 degree
#define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_VERT 900
@@ -111,56 +113,146 @@ enum EDA_UNITS_T {
};
#if defined(KICAD_GOST)
-#define GOST_LEFTMARGIN 800 /* 20mm */
-#define GOST_RIGHTMARGIN 200 /* 5mm */
-#define GOST_TOPMARGIN 200 /* 5mm */
-#define GOST_BOTTOMMARGIN 200 /* 5mm */
+#define GOST_LEFTMARGIN 800 // 20mm
+#define GOST_RIGHTMARGIN 200 // 5mm
+#define GOST_TOPMARGIN 200 // 5mm
+#define GOST_BOTTOMMARGIN 200 // 5mm
#endif
-/* forward declarations: */
+// forward declarations:
class LibNameList;
-/* Class to handle pages sizes:
+//class PAGE_INFO;
+
+/**
+ * Class PAGE_INFO
+ * describes the page size and margins of a paper page on which to
+ * eventually print or plot. Paper sizes are often described in inches.
+ * Here paper is described in 1/1000th of an inch (mils). For convenience
+ * there are some read only accessors for internal units (IU), which is a compile
+ * time calculation, not runtime.
+ *
+ * @author Dick Hollenbeck
*/
-class Ki_PageDescr
+class PAGE_INFO
{
-// All sizes are in 1/1000 inch
public:
- wxSize m_Size; /* page size in 1/1000 inch */
- wxPoint m_Offset; /* plot offset in 1/1000 inch */
- wxString m_Name;
- int m_LeftMargin;
- int m_RightMargin;
- int m_TopMargin;
- int m_BottomMargin;
+ PAGE_INFO( const wxString& aType = wxT( "A3" ) );
+ PAGE_INFO( const wxSize& aSizeMils, const wxString& aName );
-public:
- Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
+ const wxString& GetType() const { return m_type; }
+
+ /**
+ * Function SetType
+ * sets the name of the page type and also the sizes and margins
+ * commonly associated with that type name.
+ *
+ * @param aStandardPageDescriptionName is a wxString constant giving one of:
+ * "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", or "User". If "User"
+ * then the width and height are custom, and will be set according to previous calls
+ * to static PAGE_INFO::SetUserWidthMils() and
+ * static PAGE_INFO::SetUserHeightMils();
+ *
+ * @return bool - true iff @a aStandarePageDescription was a recognized type.
+ */
+ bool SetType( const wxString& aStandardPageDescriptionName );
+
+ void SetWidthMils( int aWidthInMils ) { m_size.x = aWidthInMils; }
+ int GetWidthMils() const { return m_size.x; }
+
+ void SetHeightMils( int aHeightInMils ) { m_size.y = aHeightInMils; }
+ int GetHeightMils() const { return m_size.y; }
+
+ const wxSize& GetSizeMils() const { return m_size; }
+
+ // Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
+ // and either deci-mils or nanometers in PCBNew.
+#if defined(PCBNEW)
+# if defined(KICAD_NANOMETRE)
+ int GetWidthIU() const { return int( 2.54e4 * GetWidthMils() ); }
+ int GetHeightIU() const { return int( 2.54e4 * GetHeightMils() ); }
+# else
+ int GetWidthIU() const { return int( 10 * GetWidthMils() ); }
+ int GetHeightIU() const { return int( 10 * GetHeightMils() ); }
+# endif
+ const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
+#elif defined(EESCHEMA)
+ int GetWidthIU() const { return GetWidthMils(); }
+ int GetHeightIU() const { return GetHeightMils(); }
+ const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
+#endif
+
+// wxPoint GetOffsetMils() const { return m_Offset; }
+
+ int GetLeftMarginMils() const { return m_left_margin; }
+ int GetRightMarginMils() const { return m_right_margin; }
+ int GetTopMarginMils() const { return m_top_margin; }
+ int GetBottomMarginMils() const { return m_bottom_margin; }
+
+ void SetLeftMarginMils( int aMargin ) { m_left_margin = aMargin; }
+ void SetRightMarginMils( int aMargin ) { m_right_margin = aMargin; }
+ void SetTopMarginMils( int aMargin ) { m_top_margin = aMargin; }
+ void SetBottomMarginMils( int aMargin ) { m_bottom_margin = aMargin; }
+
+ /**
+ * Function SetUserWidthMils
+ * sets the width of type "User" page in mils.
+ */
+ static void SetUserWidthMils( int aWidthInMils );
+
+ /**
+ * Function SetUserHeightMils
+ * sets the height type "User" page in mils.
+ */
+ static void SetUserHeightMils( int aHeightInMils );
+
+ /**
+ * Function GetStandardSizes
+ * returns the standard page types, such as "A4", "A3", etc.
+ static wxArrayString GetStandardSizes();
+ */
+
+private:
+
+ // standard pre-defined sizes
+ static const PAGE_INFO pageA4;
+ static const PAGE_INFO pageA3;
+ static const PAGE_INFO pageA2;
+ static const PAGE_INFO pageA1;
+ static const PAGE_INFO pageA0;
+ static const PAGE_INFO pageA;
+ static const PAGE_INFO pageB;
+ static const PAGE_INFO pageC;
+ static const PAGE_INFO pageD;
+ static const PAGE_INFO pageE;
+ static const PAGE_INFO pageGERBER;
+ static const PAGE_INFO pageUser;
+
+ // all dimensions here are in mils
+
+ wxString m_type; ///< paper type: A4, A3, etc.
+
+ wxSize m_size; ///< mils
+
+// wxPoint m_offset_mils; ///< plot offset in mils
+
+ int m_left_margin;
+ int m_right_margin;
+ int m_top_margin;
+ int m_bottom_margin;
+
+ static int s_user_height;
+ static int s_user_width;
};
-extern Ki_PageDescr g_Sheet_A4;
-extern Ki_PageDescr g_Sheet_A3;
-extern Ki_PageDescr g_Sheet_A2;
-extern Ki_PageDescr g_Sheet_A1;
-extern Ki_PageDescr g_Sheet_A0;
-extern Ki_PageDescr g_Sheet_A;
-extern Ki_PageDescr g_Sheet_B;
-extern Ki_PageDescr g_Sheet_C;
-extern Ki_PageDescr g_Sheet_D;
-extern Ki_PageDescr g_Sheet_E;
-extern Ki_PageDescr g_Sheet_GERBER;
-extern Ki_PageDescr g_Sheet_user;
-extern Ki_PageDescr* g_SheetSizeList[];
-
-
extern wxString g_ProductName;
-/* Default user lib path can be left void, if the standard lib path is used */
+/// Default user lib path can be left void, if the standard lib path is used
extern wxString g_UserLibDirBuffer;
-extern bool g_ShowPageLimits; // true to display the page limits
+extern bool g_ShowPageLimits; ///< true to display the page limits
/**
* File extension definitions. Please do not changes these. If a different
@@ -188,10 +280,10 @@ extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard;
-// Name of default configuration file. (kicad.pro)
+/// Name of default configuration file. (kicad.pro)
extern wxString g_Prj_Default_Config_FullFilename;
-// Name of local configuration file. (.pro)
+/// Name of local configuration file. (.pro)
extern wxString g_Prj_Config_LocalFilename;
extern EDA_UNITS_T g_UserUnit; ///< display units
@@ -200,7 +292,7 @@ extern EDA_UNITS_T g_UserUnit; ///< display units
extern int g_GhostColor;
-/* COMMON.CPP */
+// COMMON.CPP
/**
* Function SetLocaleTo_C_standard
diff --git a/include/pcbstruct.h b/include/pcbstruct.h
index 49e29e4a0b..670dd11a38 100644
--- a/include/pcbstruct.h
+++ b/include/pcbstruct.h
@@ -12,7 +12,7 @@
#define FOOTPRINT_LIBRARY_HEADER_CNT 18
-// Values for m_DisplayViaMode member:
+/// Values for m_DisplayViaMode member:
enum VIA_DISPLAY_MODE_T {
VIA_HOLE_NOT_SHOW = 0,
VIA_SPECIAL_HOLE_SHOW,
@@ -21,8 +21,10 @@ enum VIA_DISPLAY_MODE_T {
};
-/* Values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option
- * This parameter controls how to show tracks and vias clearance area
+/**
+ * Enum TRACE_CLEARANCE_DISPLAY_MODE_T
+ * is the set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option.
+ * This parameter controls how to show tracks and vias clearance area.
*/
enum TRACE_CLEARANCE_DISPLAY_MODE_T {
DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas
@@ -43,6 +45,10 @@ enum TRACE_CLEARANCE_DISPLAY_MODE_T {
};
+/**
+ * Class DISPLAY_OPTIONS
+ * handles display options like enable/disable some optional drawings.
+ */
class DISPLAY_OPTIONS
{
public:
@@ -77,5 +83,4 @@ public:
DISPLAY_OPTIONS();
};
-
#endif // PCBSTRUCT_H
diff --git a/include/plot_common.h b/include/plot_common.h
index 207669049a..d34dde25ab 100644
--- a/include/plot_common.h
+++ b/include/plot_common.h
@@ -5,15 +5,12 @@
* @file plot_common.h
*/
-#ifndef __INCLUDE__PLOT_COMMON_H__
-#define __INCLUDE__PLOT_COMMON_H__ 1
+#ifndef PLOT_COMMON_H_
+#define PLOT_COMMON_H_
#include
#include "drawtxt.h"
-
-
-class Ki_PageDescr;
-
+#include "common.h" // PAGE_INFO
/**
* Enum PlotFormat
@@ -27,11 +24,11 @@ enum PlotFormat {
PLOT_FORMAT_DXF
};
+
class PLOTTER
{
public:
- PlotFormat m_PlotType; // type of plot
-public: PLOTTER( PlotFormat aPlotType );
+ PLOTTER( PlotFormat aPlotType );
virtual ~PLOTTER()
{
@@ -47,8 +44,7 @@ public: PLOTTER( PlotFormat aPlotType );
* Function GetPlotterType
* @return the format of the plot file
*/
- PlotFormat GetPlotterType()
- { return m_PlotType; }
+ PlotFormat GetPlotterType() { return m_PlotType; }
virtual bool start_plot( FILE* fout ) = 0;
virtual bool end_plot() = 0;
@@ -58,20 +54,18 @@ public: PLOTTER( PlotFormat aPlotType );
negative_mode = _negative;
}
-
virtual void set_color_mode( bool _color_mode )
{
color_mode = _color_mode;
}
-
bool get_color_mode() const
{
return color_mode;
}
+ void SetPageSettings( const PAGE_INFO& aPageSettings );
- virtual void set_paper_size( Ki_PageDescr* sheet );
virtual void set_current_line_width( int width ) = 0;
virtual void set_default_line_width( int width ) = 0;
virtual void set_color( int color ) = 0;
@@ -82,13 +76,12 @@ public: PLOTTER( PlotFormat aPlotType );
creator = _creator;
}
-
virtual void set_filename( const wxString& _filename )
{
filename = _filename;
}
-
+ /// Set the plot offset for the current plotting
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ) = 0;
// Standard primitives
@@ -154,27 +147,23 @@ public: PLOTTER( PlotFormat aPlotType );
pen_to( pos, 'U' );
}
-
void line_to( wxPoint pos )
{
pen_to( pos, 'D' );
}
-
void finish_to( wxPoint pos )
{
pen_to( pos, 'D' );
pen_to( pos, 'Z' );
}
-
void pen_finish()
{
// Shortcut
pen_to( wxPoint( 0, 0 ), 'Z' );
}
-
void text( const wxPoint& aPos,
enum EDA_Colors aColor,
const wxString& aText,
@@ -210,14 +199,20 @@ protected:
virtual void user_to_device_size( wxSize& size );
virtual double user_to_device_size( double size );
- // Plot scale
+ PlotFormat m_PlotType;
+
+ /// Plot scale
double plot_scale;
- // Device scale (from decimils to device units)
+
+ /// Device scale (from decimils to device units)
double device_scale;
- // Plot offset (in decimils)
+
+ /// Plot offset (in decimils)
wxPoint plot_offset;
- // Output file
+
+ /// Output file
FILE* output_file;
+
// Pen handling
bool color_mode, negative_mode;
int default_pen_width;
@@ -227,17 +222,19 @@ protected:
bool plotMirror;
wxString creator;
wxString filename;
- Ki_PageDescr* sheet;
+ PAGE_INFO pageInfo;
wxSize paper_size;
};
+
class HPGL_PLOTTER : public PLOTTER
{
-public: HPGL_PLOTTER() : PLOTTER( PLOT_FORMAT_HPGL )
+public:
+ HPGL_PLOTTER() :
+ PLOTTER( PLOT_FORMAT_HPGL )
{
}
-
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
@@ -246,42 +243,41 @@ public: HPGL_PLOTTER() : PLOTTER( PLOT_FORMAT_HPGL )
{
// Handy override
current_pen_width = wxRound( pen_diameter );
- };
+ }
+
virtual void set_default_line_width( int width ) {};
virtual void set_dash( bool dashed );
virtual void set_color( int color ) {};
+
virtual void set_pen_speed( int speed )
{
wxASSERT( output_file == 0 );
pen_speed = speed;
}
-
virtual void set_pen_number( int number )
{
wxASSERT( output_file == 0 );
pen_number = number;
}
-
virtual void set_pen_diameter( double diameter )
{
wxASSERT( output_file == 0 );
pen_diameter = diameter;
}
-
virtual void set_pen_overlap( double overlap )
{
wxASSERT( output_file == 0 );
pen_overlap = overlap;
}
-
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
+
/*
* Function PlotPoly
* Draw a polygon (filled or not) in HPGL format
@@ -332,13 +328,14 @@ protected:
class PS_PLOTTER : public PLOTTER
{
-public: PS_PLOTTER() : PLOTTER( PLOT_FORMAT_POST )
+public:
+ PS_PLOTTER() :
+ PLOTTER( PLOT_FORMAT_POST )
{
plot_scale_adjX = 1;
plot_scale_adjY = 1;
}
-
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
virtual void set_current_line_width( int width );
@@ -352,7 +349,6 @@ public: PS_PLOTTER() : PLOTTER( PLOT_FORMAT_POST )
plot_scale_adjY = scaleY;
}
-
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
@@ -419,7 +415,9 @@ struct APERTURE
class GERBER_PLOTTER : public PLOTTER
{
-public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
+public:
+ GERBER_PLOTTER() :
+ PLOTTER( PLOT_FORMAT_GERBER )
{
work_file = 0;
final_file = 0;
@@ -431,7 +429,7 @@ public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
virtual void set_current_line_width( int width );
virtual void set_default_line_width( int width );
-/* RS274X has no dashing, nor colours */
+ // RS274X has no dashing, nor colours
virtual void set_dash( bool dashed ) {};
virtual void set_color( int color ) {};
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
@@ -472,8 +470,7 @@ public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
virtual void SetLayerPolarity( bool aPositive );
protected:
- void select_aperture( const wxSize& size,
- APERTURE::Aperture_Type type );
+ void select_aperture( const wxSize& size, APERTURE::Aperture_Type type );
std::vector::iterator
get_aperture( const wxSize& size, APERTURE::Aperture_Type type );
@@ -487,9 +484,12 @@ protected:
std::vector::iterator current_aperture;
};
+
class DXF_PLOTTER : public PLOTTER
{
-public: DXF_PLOTTER() : PLOTTER( PLOT_FORMAT_DXF )
+public:
+ DXF_PLOTTER() :
+ PLOTTER( PLOT_FORMAT_DXF )
{
}
@@ -559,4 +559,4 @@ protected:
int current_color;
};
-#endif // __INCLUDE__PLOT_COMMON_H__
+#endif // PLOT_COMMON_H_
diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h
index 0cffc8a1df..9045cd6f02 100644
--- a/include/wxBasePcbFrame.h
+++ b/include/wxBasePcbFrame.h
@@ -112,6 +112,13 @@ public:
*/
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
+ void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
+ const PAGE_INFO& GetPageSettings() const; // overload
+ const wxSize GetPageSizeIU() const; // overload
+
+ const wxPoint& GetOriginAxisPosition() const; // overload
+ void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
+
/**
* Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous
@@ -126,8 +133,6 @@ public:
return m_Pcb;
}
- BOARD_DESIGN_SETTINGS* GetDesignSettings();
-
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
@@ -140,10 +145,7 @@ public:
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
virtual void UpdateStatusBar();
- virtual PCB_SCREEN* GetScreen() const
- {
- return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
- }
+ PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
/**
* Function BestZoom
diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h
index b165d75c6e..1ae678bb48 100644
--- a/include/wxEeschemaStruct.h
+++ b/include/wxEeschemaStruct.h
@@ -350,6 +350,20 @@ public:
SCH_SCREEN* GetScreen() const;
+ // note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
+ // would allow sharing of these three functions:
+
+ // note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
+ // would allow sharing of these 5 functions:
+
+ void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
+ const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
+ const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
+
+ const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
+ void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
+
+
virtual wxString GetScreenDesc();
void InstallConfigFrame( wxCommandEvent& event );
diff --git a/include/wxstruct.h b/include/wxstruct.h
index dd574775d3..9f7348830b 100644
--- a/include/wxstruct.h
+++ b/include/wxstruct.h
@@ -72,7 +72,7 @@ class EDA_DRAW_PANEL;
class EDA_MSG_PANEL;
class BASE_SCREEN;
class PARAM_CFG_BASE;
-class Ki_PageDescr;
+class PAGE_INFO;
class PLOTTER;
enum id_librarytype {
@@ -363,7 +363,10 @@ public:
*/
class EDA_DRAW_FRAME : public EDA_BASE_FRAME
{
-private:
+ /// Let the #EDA_DRAW_PANEL object have access to the protected data since
+ /// it is closely tied to the #EDA_DRAW_FRAME.
+ friend class EDA_DRAW_PANEL;
+
///< Id of active button on the vertical toolbar.
int m_toolId;
@@ -372,9 +375,9 @@ private:
protected:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
- int m_LastGridSizeId;
- bool m_DrawGrid; // hide/Show grid
- int m_GridColor; // Grid color
+ int m_LastGridSizeId;
+ bool m_DrawGrid; // hide/Show grid
+ int m_GridColor; // Grid color
/// The area to draw on.
EDA_DRAW_PANEL* m_canvas;
@@ -401,9 +404,6 @@ protected:
/// drill, gerber, and component position files.
bool m_showOriginAxis;
- /// Position of the origin axis.
- wxPoint m_originAxisPosition;
-
/// True shows the drawing border and title block.
bool m_showBorderAndTitleBlock;
@@ -428,15 +428,9 @@ protected:
wxOverlay m_overlay;
#endif
- /// Let the #EDA_DRAW_PANEL object have access to the protected data since
- /// it is closely tied to the #EDA_DRAW_FRAME.
- friend class EDA_DRAW_PANEL;
-
protected:
- void SetScreen( BASE_SCREEN* aScreen )
- {
- m_currentScreen = aScreen;
- }
+
+ void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
/**
* Function unitsChangeRefresh
@@ -447,6 +441,7 @@ protected:
*/
virtual void unitsChangeRefresh();
+
public:
EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size,
@@ -454,9 +449,18 @@ public:
~EDA_DRAW_FRAME();
- wxPoint GetOriginAxisPosition() const { return m_originAxisPosition; }
+ virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
+ virtual const PAGE_INFO& GetPageSettings() const = 0;
- void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
+ /**
+ * Function GetPageSizeIU
+ * works off of GetPageSettings() to return the size of the paper page in
+ * the internal units of this particular view.
+ */
+ virtual const wxSize GetPageSizeIU() const = 0;
+
+ virtual const wxPoint& GetOriginAxisPosition() const = 0;
+ virtual void SetOriginAxisPosition( const wxPoint& aPosition ) = 0;
int GetCursorShape() const { return m_cursorShape; }
@@ -473,11 +477,12 @@ public:
virtual wxString GetScreenDesc();
/**
- * Function GetBaseScreen
- * is virtual and returns a pointer to a BASE_SCREEN or one of its
- * derivatives. It may be overloaded by derived classes.
+ * Function GetScreen
+ * returns a pointer to a BASE_SCREEN or one of its
+ * derivatives. It is overloaded by derived classes to return
+ * SCH_SCREEN or PCB_SCREEN.
*/
- virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
+ virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event );
@@ -660,13 +665,12 @@ public:
/**
* Function GetXYSheetReferences
- * Return the X,Y sheet references where the point position is located
- * @param aScreen = screen to use
+ * returns the X,Y sheet references where the point position is located
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6
* (or ?? if out of page limits)
*/
- wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
+ const wxString GetXYSheetReferences( const wxPoint& aPosition );
void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
index 93e788c47b..a6b3f3683c 100644
--- a/pcbnew/basepcbframe.cpp
+++ b/pcbnew/basepcbframe.cpp
@@ -48,7 +48,7 @@
#include "class_drawpanel.h"
-/* Configuration entry names. */
+// Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
@@ -94,7 +94,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
- m_DisplayPcbTrackFill = true; /* false = sketch , true = filled */
+ m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition
@@ -126,6 +126,48 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
}
+void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
+{
+ wxASSERT( m_Pcb );
+ m_Pcb->SetPageSettings( aPageSettings );
+
+ if( GetScreen() )
+ GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
+}
+
+
+const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const
+{
+ wxASSERT( m_Pcb );
+ return m_Pcb->GetPageSettings();
+}
+
+
+const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
+{
+ wxASSERT( m_Pcb );
+
+ // this function is only needed because EDA_DRAW_FRAME is not compiled
+ // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
+ // into an application specific source file.
+ return m_Pcb->GetPageSettings().GetSizeIU();
+}
+
+
+const wxPoint& PCB_BASE_FRAME::GetOriginAxisPosition() const
+{
+ wxASSERT( m_Pcb );
+ return m_Pcb->GetOriginAxisPosition();
+}
+
+
+void PCB_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
+{
+ wxASSERT( m_Pcb );
+ m_Pcb->SetOriginAxisPosition( aPosition );
+}
+
+
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
wxASSERT( m_Pcb );
@@ -134,18 +176,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
{
+ wxSize pageSize = GetPageSizeIU();
+
if( m_showBorderAndTitleBlock )
{
area.SetOrigin( 0, 0 );
- area.SetEnd( GetScreen()->ReturnPageSize().x,
- GetScreen()->ReturnPageSize().y );
+ area.SetEnd( pageSize.x, pageSize.y );
}
else
{
- area.SetOrigin( -GetScreen()->ReturnPageSize().x / 2,
- -GetScreen()->ReturnPageSize().y / 2 );
- area.SetEnd( GetScreen()->ReturnPageSize().x / 2,
- GetScreen()->ReturnPageSize().y / 2 );
+ area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
+ area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
}
}
@@ -153,14 +194,7 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
}
-BOARD_DESIGN_SETTINGS* PCB_BASE_FRAME::GetDesignSettings()
-{
- wxASSERT( m_Pcb );
- return m_Pcb ? &m_Pcb->GetDesignSettings() : NULL;
-}
-
-
-double PCB_BASE_FRAME::BestZoom( void )
+double PCB_BASE_FRAME::BestZoom()
{
int dx, dy;
@@ -195,7 +229,7 @@ double PCB_BASE_FRAME::BestZoom( void )
}
-void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
+void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
{
// factored out of pcbnew/find.cpp
@@ -203,7 +237,7 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
wxClientDC dc( m_canvas );
- /* There may be need to reframe the drawing. */
+ // There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) )
{
screen->SetCrossHairPosition( aPos );
@@ -226,7 +260,7 @@ void PCB_BASE_FRAME::ReCreateMenuBar( void )
}
-/* Virtual functions: Do nothing for PCB_BASE_FRAME window */
+// Virtual functions: Do nothing for PCB_BASE_FRAME window
void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
{
}
diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h
index 47c8e3a412..e56ac9480f 100644
--- a/pcbnew/class_board.h
+++ b/pcbnew/class_board.h
@@ -14,7 +14,7 @@
#include "class_pad.h"
#include "class_colors_design_settings.h"
#include "class_board_design_settings.h"
-
+#include "common.h" // PAGE_INFO
class PCB_BASE_FRAME;
class PCB_EDIT_FRAME;
@@ -27,7 +27,7 @@ class D_PAD;
class MARKER_PCB;
-// buffer of item candidates when search for items on the same track.
+// non-owning container of item candidates when searching for items on the same track.
typedef std::vector< TRACK* > TRACK_PTRS;
@@ -174,6 +174,10 @@ private:
BOARD_DESIGN_SETTINGS m_designSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
+ PAGE_INFO m_paper;
+
+ /// Position of the origin axis, which is used in exports mostly
+ wxPoint m_originAxisPosition;
/**
* Function chainMarkedSegments
@@ -534,15 +538,17 @@ public:
*/
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings );
+ const PAGE_INFO& GetPageSettings() const { return m_paper; }
+ void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
+
+ const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
+ void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
+
/**
* Function SetBoardSettings
* @return the current COLORS_DESIGN_SETTINGS in use
*/
- COLORS_DESIGN_SETTINGS* GetColorsSettings() const
- {
- return m_colorsSettings;
- }
-
+ COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; }
/**
* Function SetColorsSettings
@@ -553,7 +559,6 @@ public:
m_colorsSettings = aColorsSettings;
}
-
/**
* Function GetLayerName
* returns the name of the layer given by aLayerIndex.
diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp
index 1e2292c91c..9504b70f08 100644
--- a/pcbnew/class_pad.cpp
+++ b/pcbnew/class_pad.cpp
@@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
text.Empty();
- for( int ii = 0; ii < PADNAMEZ; ii++ )
+ for( int ii = 0; ii < PADNAMEZ && m_Padname[ii]; ii++ )
{
- if( !m_Padname[ii] )
- break;
-
- // add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
+ // m_Padname is 8 bit KiCad font junk, do not sign extend
text.Append( (unsigned char) m_Padname[ii] );
}
#endif
diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h
index 15126cd84f..2a12e2e118 100644
--- a/pcbnew/class_pad.h
+++ b/pcbnew/class_pad.h
@@ -119,7 +119,7 @@ public:
int m_ShapeMaxRadius; // radius of the circle containing the pad shape
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
- int m_Orient; // in 1/10 degrees
+ double m_Orient; // in 1/10 degrees
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer)
@@ -205,11 +205,11 @@ public:
* sets the rotation angle of the pad.
* @param aAngle is tenths of degrees, but will soon be degrees.
*/
- void SetOrientation( double aAngle ) { m_Orient = (int) aAngle; } // manage migration to degrees
+ void SetOrientation( double aAngle ) { m_Orient = aAngle; } // manage migration to degrees
/**
* Function GetOrientation
- * returns the rotation angle of the pad in tenths of degress, but soon degress.
+ * returns the rotation angle of the pad in tenths of degress, but soon degrees.
*/
double GetOrientation() const { return m_Orient; }
diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h
index 5b76ef6990..7dadefb440 100644
--- a/pcbnew/class_track.h
+++ b/pcbnew/class_track.h
@@ -197,9 +197,9 @@ public:
int aCircleToSegmentsCount,
double aCorrectionFactor );
/**
- * Function SetDrillValue
+ * Function SetDrill
* sets the drill value for vias.
- * @param aDrill = new drill value
+ * @param aDrill is the new drill diameter
*/
void SetDrill( int aDrill ) { m_Drill = aDrill; }
diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp
index 156dfaaf4d..5eb153f1ce 100644
--- a/pcbnew/classpcb.cpp
+++ b/pcbnew/classpcb.cpp
@@ -6,6 +6,7 @@
#include "fctsys.h"
#include "common.h"
+#include "macros.h"
#include "trigo.h"
#include "class_pcb_screen.h"
#include "pcbnew.h"
@@ -25,19 +26,18 @@
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
* functions )
*/
-static const double PcbZoomList[] =
+static const double pcbZoomList[] =
{
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
};
-#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
-#define MM_TO_PCB_UNITS 10000.0 / 25.4
+#define MM_TO_PCB_UNITS (10000.0 / 25.4)
-/* Default grid sizes for PCB editor screens. */
-static GRID_TYPE PcbGridList[] =
+// Default grid sizes for PCB editor screens.
+static GRID_TYPE pcbGridList[] =
{
// predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
@@ -66,24 +66,26 @@ static GRID_TYPE PcbGridList[] =
{ ID_POPUP_GRID_LEVEL_0_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.01, MM_TO_PCB_UNITS * 0.01 ) }
};
-#define PCB_GRID_LIST_CNT ( sizeof( PcbGridList ) / sizeof( GRID_TYPE ) )
-
-/*******************************************************************/
-/* Class PCB_SCREEN: class to handle parametres to display a board */
-/********************************************************************/
-PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
+PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
+ BASE_SCREEN( SCREEN_T )
{
- size_t i;
+ for( unsigned i = 0; i < DIM( pcbZoomList ); ++i )
+ m_ZoomList.Add( pcbZoomList[i] );
- for( i = 0; i < PCB_ZOOM_LIST_CNT; i++ )
- m_ZoomList.Add( PcbZoomList[i] );
+ for( unsigned i = 0; i < DIM( pcbGridList ); ++i )
+ AddGrid( pcbGridList[i] );
- for( i = 0; i < PCB_GRID_LIST_CNT; i++ )
- AddGrid( PcbGridList[i] );
+ // Set the working grid size to a reasonnable value (in 1/10000 inch)
+ SetGrid( wxRealPoint( 500, 500 ) );
- SetGrid( wxRealPoint( 500, 500 ) ); /* Set the working grid size to a reasonnable value (in 1/10000 inch) */
- Init();
+ 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;
+
+ SetZoom( 150 ); // a default value for zoom
+
+ InitDataPoints( aPageSizeIU );
}
@@ -93,30 +95,12 @@ PCB_SCREEN::~PCB_SCREEN()
}
-void PCB_SCREEN::Init()
-{
- InitDatas();
- 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;
- m_Zoom = 150; /* a default value for zoom */
-}
-
-
-int PCB_SCREEN::GetInternalUnits( void )
+int PCB_SCREEN::GetInternalUnits()
{
return PCB_INTERNAL_UNIT;
}
-/*************************/
-/* class DISPLAY_OPTIONS */
-/*************************/
-
-/*
- * Handle display options like enable/disable some optional drawings:
- */
-
DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{
DisplayPadFill = FILLED;
@@ -126,7 +110,7 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayModEdge = true;
DisplayModText = true;
- DisplayPcbTrackFill = true; /* false = sketch , true = filled */
+ DisplayPcbTrackFill = true; // false = sketch , true = filled
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp
index 67e3beca14..0e4dd1eabf 100644
--- a/pcbnew/dialogs/dialog_SVG_print.cpp
+++ b/pcbnew/dialogs/dialog_SVG_print.cpp
@@ -226,37 +226,37 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
BASE_SCREEN* screen,
bool aPrint_Frame_Ref )
{
- int tmpzoom;
- wxPoint tmp_startvisu;
- wxSize SheetSize; // Sheet size in internal units
- wxPoint old_org;
- bool success = true;
+ // const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
- /* Change frames and local settings */
+ LOCALE_IO toggle;
+ int tmpzoom;
+ wxPoint tmp_startvisu;
+ wxPoint old_org;
+ bool success = true;
+
+ // Change frames and local settings
tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg;
+
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
- SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
- SheetSize.x *= m_Parent->GetInternalUnits() / 1000;
- SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in pixels
screen->SetScalingFactor( 1.0 );
float dpi = (float)m_Parent->GetInternalUnits();
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
- SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
- // to print floating point numbers like 1.3)
- wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
+ // paper pageSize is in internal units, either nanometers or deci-mils
+ wxSize pageSize = m_Parent->GetPageSizeIU();
+
+ wxSVGFileDC dc( FullFileName, pageSize.x, pageSize.y, dpi );
EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc );
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true );
s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
-
// Set clip box to the max size
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
@@ -270,9 +270,9 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
if( aPrint_Frame_Ref )
m_Parent->TraceWorkSheet( &dc, screen, s_Parameters.m_PenDefaultSize );
- m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
+ m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = bg_color;
- SetLocaleTo_Default(); // revert to the current locale
+
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );
diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h
index 404c2cfb55..f48c116709 100644
--- a/pcbnew/dialogs/dialog_gendrill.h
+++ b/pcbnew/dialogs/dialog_gendrill.h
@@ -54,7 +54,8 @@ private:
static bool m_createRpt; // true to create a drill file report
static int m_createMap; // > 0 to create a map file report
-public: DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
+public:
+ DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
~DIALOG_GENDRILL();
private:
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index f6d02fdab2..aa92ef8bfc 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -299,7 +299,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadOrientCtrl->SetValue( msg );
// Pad Orient
- switch( m_dummyPad->m_Orient )
+ switch( int( m_dummyPad->GetOrientation() ) )
{
case 0:
m_PadOrient->SetSelection( 0 );
@@ -314,7 +314,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break;
case 1800:
- case - 1800:
+ case -1800:
m_PadOrient->SetSelection( 3 );
break;
@@ -343,7 +343,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break;
}
- msg.Printf( wxT( "%d" ), m_dummyPad->m_Orient );
+ msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
m_PadOrientCtrl->SetValue( msg );
// Type of pad selection
@@ -493,7 +493,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
}
wxString msg;
- msg.Printf( wxT( "%d" ), m_dummyPad->m_Orient );
+ msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
m_PadOrientCtrl->SetValue( msg );
TransfertDataToPad( m_dummyPad );
@@ -775,10 +775,11 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
aPad->m_Offset.x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits );
aPad->m_Offset.y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits );
- long orient_value = 0;
+ double orient_value = 0;
msg = m_PadOrientCtrl->GetValue();
- msg.ToLong( &orient_value );
- aPad->m_Orient = orient_value;
+ msg.ToDouble( &orient_value );
+
+ aPad->SetOrientation( orient_value );
msg = m_PadNumCtrl->GetValue().Left( 4 );
aPad->SetPadName( msg );
diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp
index 2a859153ec..3fb0755ddb 100644
--- a/pcbnew/export_gencad.cpp
+++ b/pcbnew/export_gencad.cpp
@@ -145,8 +145,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
GetBoard()->ComputeBoundingBox();
// Save the auxiliary origin for the rest of the module
- GencadOffsetX = m_originAxisPosition.x;
- GencadOffsetY = m_originAxisPosition.y;
+ GencadOffsetX = GetOriginAxisPosition().x;
+ GencadOffsetY = GetOriginAxisPosition().y;
// No idea on *why* this should be needed... maybe to fix net names?
Compile_Ratsnest( NULL, true );
diff --git a/pcbnew/gen_drill_report_files.cpp b/pcbnew/gen_drill_report_files.cpp
index 8e22ebf06e..96a7c5d1b6 100644
--- a/pcbnew/gen_drill_report_files.cpp
+++ b/pcbnew/gen_drill_report_files.cpp
@@ -20,25 +20,24 @@
void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
- Ki_PageDescr* aSheet,
+ const PAGE_INFO& aSheet,
std::vector aHoleListBuffer,
std::vector aToolListBuffer,
bool aUnit_Drill_is_Inch, int format,
const wxPoint& auxoffset )
{
- int x, y;
- int plotX, plotY, TextWidth;
- double scale = 1.0;
- int intervalle = 0, CharSize = 0;
- EDA_ITEM* PtStruct;
- char line[1024];
- int dX, dY;
- wxPoint BoardCentre;
- wxPoint offset;
- wxString msg;
- PLOTTER* plotter = NULL;
-
- SetLocaleTo_C_standard(); // Use the standard notation for float numbers
+ int x, y;
+ int plotX, plotY, TextWidth;
+ double scale = 1.0;
+ int intervalle = 0, CharSize = 0;
+ EDA_ITEM* PtStruct;
+ char line[1024];
+ int dX, dY;
+ wxPoint BoardCentre;
+ wxPoint offset;
+ wxString msg;
+ PLOTTER* plotter = NULL;
+ LOCALE_IO toggle; // use standard notation for float numbers
// Calculate dimensions and center of PCB
EDA_RECT bbbox = aPcb->ComputeBoundingBox();
@@ -58,7 +57,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->set_viewport( offset, scale, 0 );
break;
- case PLOT_FORMAT_HPGL: /* Scale for HPGL format. */
+ case PLOT_FORMAT_HPGL: // Scale for HPGL format.
{
offset.x = 0;
offset.y = 0;
@@ -68,29 +67,29 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
hpgl_plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
hpgl_plotter->set_pen_overlap( 0 );
- plotter->set_paper_size( aSheet );
+ plotter->SetPageSettings( aSheet );
plotter->set_viewport( offset, scale, 0 );
}
break;
case PLOT_FORMAT_POST:
{
- Ki_PageDescr* SheetPS = &g_Sheet_A4;
- wxSize SheetSize;
- SheetSize.x = SheetPS->m_Size.x * U_PCB;
- SheetSize.y = SheetPS->m_Size.y * U_PCB;
- /* Keep size for drill legend */
- double Xscale = (double) ( SheetSize.x * 0.8 ) / dX;
- double Yscale = (double) ( SheetSize.y * 0.6 ) / dY;
+ PAGE_INFO pageA4( wxT( "A4" ) );
+ wxSize pageSizeIU = pageA4.GetSizeIU();
+
+ // Keep size for drill legend
+ double Xscale = (double) ( pageSizeIU.x * 0.8 ) / dX;
+ double Yscale = (double) ( pageSizeIU.y * 0.6 ) / dY;
scale = MIN( Xscale, Yscale );
- offset.x = (int) ( (double) BoardCentre.x - ( (double) SheetSize.x / 2.0 ) / scale );
- offset.y = (int) ( (double) BoardCentre.y - ( (double) SheetSize.y / 2.0 ) / scale );
- offset.y += SheetSize.y / 8; /* offset to legend */
+ offset.x = (int) ( (double) BoardCentre.x - ( (double) pageSizeIU.x / 2.0 ) / scale );
+ offset.y = (int) ( (double) BoardCentre.y - ( (double) pageSizeIU.y / 2.0 ) / scale );
+
+ offset.y += pageSizeIU.y / 8; // offset to legend
PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter;
- ps_plotter->set_paper_size( SheetPS );
+ ps_plotter->SetPageSettings( pageA4 );
plotter->set_viewport( offset, scale, 0 );
break;
}
@@ -102,7 +101,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale = 1;
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter;
- plotter->set_paper_size( aSheet );
+ plotter->SetPageSettings( aSheet );
plotter->set_viewport( offset, scale, 0 );
break;
}
@@ -116,7 +115,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->set_default_line_width( 10 );
plotter->start_plot( aFile );
- /* Draw items on edge layer */
+ // Draw items on edge layer
for( PtStruct = aPcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{
@@ -154,19 +153,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
// Plot board outlines and drill map
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer );
- /* Print a list of symbols used. */
- CharSize = 800; /* text size in 1/10000 mils */
+ // Print a list of symbols used.
+ CharSize = 800; // text size in 1/10000 mils
double CharScale = 1.0 / scale; /* real scale will be CharScale
* scale_x, because the global
* plot scale is scale_x */
TextWidth = (int) ( (CharSize * CharScale) / 10 ); // Set text width (thickness)
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
- /* Trace information. */
+ // Trace information.
plotX = (int) ( (double) bbbox.GetX() + 200.0 * CharScale );
plotY = bbbox.GetBottom() + intervalle;
- /* Plot title "Info" */
+ // Plot title "Info"
wxString Text = wxT( "Drill Map:" );
plotter->text( wxPoint( plotX, plotY ), BLACK, Text, 0,
wxSize( (int) ( CharSize * CharScale ),
@@ -188,7 +187,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
y = (int) ( (double) plotY + (double) CharSize * CharScale );
plotter->marker( wxPoint( x, y ), plot_diam, ii );
- /* Trace the legends. */
+ // Trace the legends.
// List the diameter of each drill in the selected Drill Unit,
// and then its diameter in the other Drill Unit.
@@ -235,7 +234,6 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->end_plot();
delete plotter;
- SetLocaleTo_Default(); // Revert to local notation for float numbers
}
@@ -251,7 +249,7 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
{
wxPoint pos;
- /* create the drill list */
+ // create the drill list
if( aToolListBuffer.size() > 13 )
{
DisplayInfoMessage( NULL,
diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp
index 524b0e25fb..0ee89ff2b7 100644
--- a/pcbnew/gen_modules_placefile.cpp
+++ b/pcbnew/gen_modules_placefile.cpp
@@ -93,7 +93,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
FILE* fpBack = 0;
bool switchedLocale = false;
- File_Place_Offset = m_originAxisPosition;
+ File_Place_Offset = GetOriginAxisPosition();
/* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */
int moduleCount = 0;
diff --git a/pcbnew/gendrill.cpp b/pcbnew/gendrill.cpp
index 1b549a97c8..c4355810de 100644
--- a/pcbnew/gendrill.cpp
+++ b/pcbnew/gendrill.cpp
@@ -635,7 +635,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
GenDrillMapFile( m_Parent->GetBoard(),
plotfile,
dlg.GetPath(),
- m_Parent->GetScreen()->m_CurrentSheetDesc,
+ m_Parent->GetPageSettings(),
s_HoleListBuffer,
s_ToolListBuffer,
m_UnitDrillIsInch,
diff --git a/pcbnew/gendrill.h b/pcbnew/gendrill.h
index 38ed73d905..8bb0a53ed4 100644
--- a/pcbnew/gendrill.h
+++ b/pcbnew/gendrill.h
@@ -217,7 +217,7 @@ void Build_Holes_List( BOARD* aPcb, std::vector& aHoleListBuffer,
void GenDrillMapFile( BOARD* aPcb,
FILE* aFile,
const wxString& aFullFileName,
- Ki_PageDescr* aSheet,
+ const PAGE_INFO& aSheet,
std::vector aHoleListBuffer,
std::vector aToolListBuffer,
bool aUnit_Drill_is_Inch,
diff --git a/pcbnew/graphpcb.cpp b/pcbnew/graphpcb.cpp
index d7c92c8b03..04e17c786b 100644
--- a/pcbnew/graphpcb.cpp
+++ b/pcbnew/graphpcb.cpp
@@ -52,7 +52,7 @@ static void TraceFilledCircle( BOARD* Pcb,
static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
int color, int op_logic );
-/* Macro call to update cell. */
+// Macro call to update cell.
#define OP_CELL( layer, dy, dx ) \
{ \
if( layer < 0 ) \
@@ -109,10 +109,10 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
dy += abs( pt_pad->m_DeltaSize.x ) / 2;
}
- if( ( pt_pad->m_Orient % 900 ) == 0 ) /* The pad is a rectangle
- * horizontally or vertically. */
+ // The pad is a rectangle horizontally or vertically.
+ if( int( pt_pad->GetOrientation() ) % 900 == 0 )
{
- /* Orientation turned 90 deg. */
+ // Orientation turned 90 deg.
if( ( pt_pad->m_Orient == 900 ) || ( pt_pad->m_Orient == 2700 ) )
{
EXCHG( dx, dy );
@@ -158,17 +158,17 @@ void TraceFilledCircle( BOARD* Pcb,
int tstwrite = 0;
int distmin;
- /* Determine occupied layer. */
+ // Determine occupied layer.
/* Single routing layer on bitmap and BOTTOM
* Route_Layer_B = Route_Layer_A */
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
- trace = 1; /* Trace on BOTTOM */
+ trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( Route_Layer_TOP ) )
if( Nb_Sides )
- trace |= 2; /* Trace on TOP */
+ trace |= 2; // Trace on TOP
if( trace == 0 )
return;
@@ -202,13 +202,13 @@ void TraceFilledCircle( BOARD* Pcb,
distmin = radius;
- /* Calculate the bounding rectangle of the circle. */
+ // Calculate the bounding rectangle of the circle.
ux0 = cx - radius;
uy0 = cy - radius;
ux1 = cx + radius;
uy1 = cy + radius;
- /* Calculate limit coordinates of cells belonging to the rectangle. */
+ // Calculate limit coordinates of cells belonging to the rectangle.
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / Board.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting) row_min++;
@@ -226,7 +226,7 @@ void TraceFilledCircle( BOARD* Pcb,
if( col_max >= (Ncols - 1) )
col_max = Ncols - 1;
- /* Calculate coordinate limits of cell belonging to the rectangle. */
+ // Calculate coordinate limits of cell belonging to the rectangle.
if( row_min > row_max )
row_max = row_min;
@@ -265,7 +265,7 @@ void TraceFilledCircle( BOARD* Pcb,
* (Adverse event: pad off grid in the center of the 4 neighboring
* diagonal) */
distmin = Board.m_GridRouting / 2 + 1;
- fdistmin = ( (float) distmin * distmin ) * 2; /* Distance to center point diagonally */
+ fdistmin = ( (float) distmin * distmin ) * 2; // Distance to center point diagonally
for( row = row_min; row <= row_max; row++ )
{
@@ -297,13 +297,13 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
half_width = ( pt_segm->m_Width / 2 ) + marge;
- /* Calculate the bounding rectangle of the segment (if H, V or Via) */
+ // Calculate the bounding rectangle of the segment (if H, V or Via)
ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().GetX();
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().GetY();
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().GetX();
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().GetY();
- /* Test if VIA (filled circle was drawn) */
+ // Test if VIA (filled circle was drawn)
if( pt_segm->Type() == PCB_VIA_T )
{
int mask_layer = 0;
@@ -333,7 +333,7 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
if( color == VIA_IMPOSSIBLE )
layer = -1;
- /* The segment is here a straight line or a circle or an arc.: */
+ // The segment is here a straight line or a circle or an arc.:
if( pt_segm->m_Shape == S_CIRCLE )
{
TraceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
@@ -346,7 +346,7 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
return;
}
- /* The segment is here a line segment. */
+ // The segment is here a line segment.
if( ( ux0 != ux1 ) && ( uy0 != uy1 ) ) // Segment tilts.
{
DrawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
@@ -396,7 +396,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
lim = y1 / Board.m_GridRouting;
dx = x0 / Board.m_GridRouting;
- /* Clipping limits of board. */
+ // Clipping limits of board.
if( ( dx < 0 ) || ( dx >= Ncols ) )
return;
@@ -423,7 +423,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
lim = x1 / Board.m_GridRouting;
dy = y0 / Board.m_GridRouting;
- /* Clipping limits of board. */
+ // Clipping limits of board.
if( ( dy < 0 ) || ( dy >= Nrows ) )
return;
@@ -441,8 +441,8 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
return;
}
- /* Here is some perspective: using the algorithm LUCAS. */
- if( abs( x1 - x0 ) >= abs( y1 - y0 ) ) /* segment slightly inclined/ */
+ // Here is some perspective: using the algorithm LUCAS.
+ if( abs( x1 - x0 ) >= abs( y1 - y0 ) ) // segment slightly inclined/
{
if( x1 < x0 )
{
@@ -526,10 +526,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
void (* WriteCell)( int, int, int, MATRIX_CELL );
if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) )
- trace = 1; /* Trace on BOTTOM */
+ trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) && Nb_Sides )
- trace |= 2; /* Trace on TOP */
+ trace |= 2; // Trace on TOP
if( trace == 0 )
return;
@@ -563,7 +563,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
- /* Calculating limits coord cells belonging to the rectangle. */
+ // Calculating limits coord cells belonging to the rectangle.
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / Board.m_GridRouting;
@@ -606,8 +606,8 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
int angle, int aLayerMask, int color, int op_logic )
{
int row, col;
- int cx, cy; /* Center of rectangle */
- int radius; /* Radius of the circle */
+ int cx, cy; // Center of rectangle
+ int radius; // Radius of the circle
int row_min, row_max, col_min, col_max;
int rotrow, rotcol;
int trace = 0;
@@ -615,12 +615,12 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
void (* WriteCell)( int, int, int, MATRIX_CELL );
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
- trace = 1; /* Trace on BOTTOM */
+ trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( Route_Layer_TOP ) )
{
if( Nb_Sides )
- trace |= 2; /* Trace on TOP */
+ trace |= 2; // Trace on TOP
}
if( trace == 0 )
@@ -660,7 +660,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
radius = (int) sqrt( (double) ( cx - ux0 ) * ( cx - ux0 )
+ (double) ( cy - uy0 ) * ( cy - uy0 ) );
- /* Calculating coordinate limits belonging to the rectangle. */
+ // Calculating coordinate limits belonging to the rectangle.
row_max = ( cy + radius ) / Board.m_GridRouting;
col_max = ( cx + radius ) / Board.m_GridRouting;
row_min = ( cy - radius ) / Board.m_GridRouting;
@@ -756,14 +756,14 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
break;
}
- /* Make coordinate ux1 tj > ux0 to simplify calculations */
+ // Make coordinate ux1 tj > ux0 to simplify calculations
if( ux1 < ux0 )
{
EXCHG( ux1, ux0 );
EXCHG( uy1, uy0 );
}
- /* Calculating the incrementing the Y axis */
+ // Calculating the incrementing the Y axis
inc = 1;
if( uy1 < uy0 )
@@ -819,7 +819,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
angle = -900;
}
- RotatePoint( &dx, &dy, angle ); /* dx = length, dy = 0 */
+ RotatePoint( &dx, &dy, angle ); // dx = length, dy = 0
for( col = col_min; col <= col_max; col++ )
{
@@ -833,7 +833,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
RotatePoint( &cx, &cy, angle );
if( abs( cy ) > lg )
- continue; /* The point is too far on the Y axis. */
+ continue; // The point is too far on the Y axis.
/* This point a test is close to the segment: the position
* along the X axis must be tested.
@@ -844,7 +844,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
continue;
}
- /* Examination of extremities are rounded. */
+ // Examination of extremities are rounded.
if( ( cx < 0 ) && ( cx >= -lg ) )
{
if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) )
diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp
index 29b4fab5dd..29b9f02ad6 100644
--- a/pcbnew/initpcb.cpp
+++ b/pcbnew/initpcb.cpp
@@ -50,21 +50,22 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
SetCurItem( NULL );
- /* clear filename, to avoid overwriting an old file */
+ // clear filename, to avoid overwriting an old file
GetScreen()->GetFileName().Empty();
- /* Init new grid size */
- wxRealPoint gridsize = GetScreen()->GetGridSize();
- GetScreen()->Init();
- GetScreen()->SetGrid( gridsize );
+ // preserve grid size accross call to InitDataPoints()
+
+// wxRealPoint gridsize = GetScreen()->GetGridSize();
+ GetScreen()->InitDataPoints( GetPageSizeIU() );
+// GetScreen()->SetGrid( gridsize );
GetBoard()->ResetHighLight();
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
- GetBoard()->SetEnabledLayers(ALL_LAYERS);
+ GetBoard()->SetEnabledLayers( ALL_LAYERS );
// Default copper layers count set to 2: double layer board
- GetBoard()->SetCopperLayerCount(2);
+ GetBoard()->SetCopperLayerCount( 2 );
// Update display:
GetBoard()->SetVisibleLayers( ALL_LAYERS );
@@ -99,15 +100,15 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Delete the current footprint
GetBoard()->m_Modules.DeleteAll();
- /* init pointeurs et variables */
+ // init pointeurs et variables
GetScreen()->GetFileName().Empty();
SetCurItem( NULL );
- /* Init parametres de gestion */
- wxRealPoint gridsize = GetScreen()->GetGridSize();
- GetScreen()->Init();
- GetScreen()->SetGrid( gridsize );
+ // preserve grid size accross call to InitDataPoints()
+// wxRealPoint gridsize = GetScreen()->GetGridSize();
+ GetScreen()->InitDataPoints( GetPageSizeIU() );
+// GetScreen()->SetGrid( gridsize );
Zoom_Automatique( false );
diff --git a/pcbnew/io_mgr.h b/pcbnew/io_mgr.h
index e3f5afa073..92c8cb575c 100644
--- a/pcbnew/io_mgr.h
+++ b/pcbnew/io_mgr.h
@@ -119,6 +119,8 @@ public:
* implementation knows about, or it can be used to write a portion of
* aBoard to a special kind of export file.
*
+ * @param aFileType is the PCB_FILE_T of file to save.
+ *
* @param aFileName is the name of a file to save to on disk.
* @param aBoard is the BOARD document (data tree) to save or export to disk.
*
diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp
index 7432d434d1..a02e17e59b 100644
--- a/pcbnew/ioascii.cpp
+++ b/pcbnew/ioascii.cpp
@@ -88,6 +88,9 @@
* $Endmodule
*/
+/// Get the length of a string constant, at compile time
+#define SZ( x ) (sizeof(x)-1)
+
static int NbDraw, NbTrack, NbZone, NbMod, NbNets;
static const char delims[] = " =\n\r";
@@ -389,8 +392,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( data )
gy = atoi( data );
- m_originAxisPosition.x = gx;
- m_originAxisPosition.y = gy;
+ SetOriginAxisPosition( wxPoint( gx, gy ) );
continue;
}
@@ -786,7 +788,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
EDA_ITEM* PtStruct = GetBoard()->m_Modules;
int NbModules, NbDrawItem, NbLayers;
- /* Write copper layer count */
+ // Write copper layer count
NbLayers = GetBoard()->GetCopperLayerCount();
fprintf( File, "$GENERAL\n" );
fprintf( File, "encoding utf-8\n");
@@ -801,7 +803,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
fprintf( File, "Links %d\n", GetBoard()->GetRatsnestsCount() );
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
- // Write Bounding box info
+ // Write board's bounding box info
EDA_RECT bbbox = GetBoard()->ComputeBoundingBox();
fprintf( File, "Di %d %d %d %d\n",
bbbox.GetX(),
@@ -809,8 +811,8 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
bbbox.GetRight(),
bbbox.GetBottom() );
- /* Write segment count for footprints, drawings, track and zones */
- /* Calculate the footprint count */
+ // Write segment count for footprints, drawings, track and zones
+ // Calculate the footprint count
for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Next() )
NbModules++;
@@ -836,13 +838,14 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
* @param screen BASE_SCREEN to save
* @param File = an open FILE to write info
*/
-bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
+static bool WriteSheetDescr( const PAGE_INFO& aPageSettings, BASE_SCREEN* screen, FILE* File )
{
- Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
-
fprintf( File, "$SHEETDESCR\n" );
fprintf( File, "Sheet %s %d %d\n",
- TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y );
+ TO_UTF8( aPageSettings.GetType() ),
+ aPageSettings.GetSizeMils().x,
+ aPageSettings.GetSizeMils().y );
+
fprintf( File, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( File, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
@@ -859,10 +862,9 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
#if !defined( USE_NEW_PCBNEW_LOAD )
-static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
+static bool ReadSheetDescr( BOARD* aBoard, BASE_SCREEN* screen, LINE_READER* aReader )
{
char buf[1024];
- char* text;
while( aReader->ReadLine() )
{
@@ -873,32 +875,43 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
if( strnicmp( line, "Sheet", 4 ) == 0 )
{
- text = strtok( line, " \t\n\r" );
- text = strtok( NULL, " \t\n\r" );
- Ki_PageDescr* sheet = g_SheetSizeList[0];
- int ii;
+ // e.g. "Sheet A3 16535 11700"
+ // width and height are in 1/1000th of an inch, always
- for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
+ PAGE_INFO page;
+ char* sname = strtok( line + SZ( "Sheet" ), delims );
+
+ if( sname )
{
- if( stricmp( TO_UTF8( sheet->m_Name ), text ) == 0 )
+ wxString wname = FROM_UTF8( sname );
+ if( !page.SetType( wname ) )
{
- screen->m_CurrentSheetDesc = sheet;
-
- if( sheet == &g_Sheet_user )
- {
- text = strtok( NULL, " \t\n\r" );
-
- if( text )
- sheet->m_Size.x = atoi( text );
-
- text = strtok( NULL, " \t\n\r" );
-
- if( text )
- sheet->m_Size.y = atoi( text );
- }
-
- break;
+ /* this entire file is soon to be deleted.
+ m_error.Printf( _( "Unknown sheet type '%s' on line:%d" ),
+ wname.GetData(), m_reader->LineNumber() );
+ THROW_IO_ERROR( m_error );
+ */
}
+
+ // only parse the width and height if page size is "User"
+ if( wname == wxT( "User" ) )
+ {
+ char* width = strtok( NULL, delims );
+ char* height = strtok( NULL, delims );
+
+ if( width && height )
+ {
+ // legacy disk file describes paper in mils
+ // (1/1000th of an inch)
+ int w = atoi( width );
+ int h = atoi( height );
+
+ page.SetWidthMils( w );
+ page.SetHeightMils( h );
+ }
+ }
+
+ aBoard->SetPageSettings( page );
}
continue;
@@ -1098,7 +1111,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if( TESTLINE( "SHEETDESCR" ) )
{
- ReadSheetDescr( GetScreen(), aReader );
+ ReadSheetDescr( board, GetScreen(), aReader );
continue;
}
@@ -1162,7 +1175,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// like 1.3)
LOCALE_IO toggle;
- /* Writing file header. */
+ // Writing file header.
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION,
TO_UTF8( DateAndTime() ) );
fprintf( aFile, "# Created by Pcbnew%s\n\n", TO_UTF8( GetBuildVersion() ) );
@@ -1174,7 +1187,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
WriteGeneralDescrPcb( aFile );
- WriteSheetDescr( GetScreen(), aFile );
+ WriteSheetDescr( GetBoard()->GetPageSettings(), GetScreen(), aFile );
WriteSetup( aFile, this, GetBoard() );
rc = GetBoard()->Save( aFile );
diff --git a/pcbnew/item_io.cpp b/pcbnew/item_io.cpp
index 312be75934..534214e2f5 100644
--- a/pcbnew/item_io.cpp
+++ b/pcbnew/item_io.cpp
@@ -666,7 +666,7 @@ bool D_PAD::Save( FILE* aFile ) const
break;
}
- fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n",
+ fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %g\n",
m_Padname, cshape, m_Size.x, m_Size.y,
m_DeltaSize.x, m_DeltaSize.y, m_Orient );
@@ -938,7 +938,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
if( *PtLine == '"' )
PtLine++;
- nn = sscanf( PtLine, " %s %d %d %d %d %d",
+ nn = sscanf( PtLine, " %s %d %d %d %d %lf",
BufCar, &m_Size.x, &m_Size.y,
&m_DeltaSize.x, &m_DeltaSize.y,
&m_Orient );
diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp
index 88275675b2..0b3a95914e 100644
--- a/pcbnew/kicad_plugin.cpp
+++ b/pcbnew/kicad_plugin.cpp
@@ -98,7 +98,7 @@
/// C string compare test for a specific length of characters.
/// The -1 is to omit the trailing \0 which is included in sizeof() on a
/// string constant.
-#define TESTLINE( x ) (strncmp( line, x, sizeof(x) - 1 ) == 0)
+#define TESTLINE( x ) (strnicmp( line, x, sizeof(x)-1 ) == 0)
/// Get the length of a string constant, at compile time
#define SZ( x ) (sizeof(x)-1)
@@ -440,7 +440,6 @@ void KICAD_PLUGIN::loadGENERAL()
void KICAD_PLUGIN::loadSHEET()
{
char buf[260];
- char* text;
while( READLINE() )
{
@@ -448,33 +447,41 @@ void KICAD_PLUGIN::loadSHEET()
if( TESTLINE( "Sheet" ) )
{
- text = strtok( line, delims );
- text = strtok( NULL, delims );
+ // e.g. "Sheet A3 16535 11700"
+ // width and height are in 1/1000th of an inch, always
- Ki_PageDescr* sheet = g_SheetSizeList[0];
- int ii;
+ PAGE_INFO page;
+ char* sname = strtok( line + SZ( "Sheet" ), delims );
- for( ii = 0; sheet != NULL; ii++, sheet = g_SheetSizeList[ii] )
+ if( sname )
{
- if( !stricmp( TO_UTF8( sheet->m_Name ), text ) )
+ wxString wname = FROM_UTF8( sname );
+ if( !page.SetType( wname ) )
{
-// @todo screen->m_CurrentSheetDesc = sheet;
-
- if( sheet == &g_Sheet_user )
- {
- text = strtok( NULL, delims );
-
- if( text )
- sheet->m_Size.x = intParse( text );
-
- text = strtok( NULL, delims );
-
- if( text )
- sheet->m_Size.y = intParse( text );
- }
-
- break;
+ m_error.Printf( _( "Unknown sheet type '%s' on line:%d" ),
+ wname.GetData(), m_reader->LineNumber() );
+ THROW_IO_ERROR( m_error );
}
+
+ // only parse the width and height if page size is "User"
+ if( wname == wxT( "User" ) )
+ {
+ char* width = strtok( NULL, delims );
+ char* height = strtok( NULL, delims );
+
+ if( width && height )
+ {
+ // legacy disk file describes paper in mils
+ // (1/1000th of an inch)
+ int w = intParse( width );
+ int h = intParse( height );
+
+ page.SetWidthMils( w );
+ page.SetHeightMils( h );
+ }
+ }
+
+ m_board->SetPageSettings( page );
}
}
@@ -557,10 +564,7 @@ void KICAD_PLUGIN::loadSETUP()
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
BIU gy = biuParse( data );
- /* @todo
- m_originAxisPosition.x = gx;
- m_originAxisPosition.y = gy;
- */
+ m_board->SetOriginAxisPosition( wxPoint( gx, gy ) );
}
#if 1 // defined(PCBNEW)
@@ -2729,14 +2733,17 @@ void KICAD_PLUGIN::saveGENERAL() const
void KICAD_PLUGIN::saveSHEET() const
{
-#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
- Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
+ const PAGE_INFO& pageInfo = m_board->GetPageSettings();
fprintf( m_fp, "$SHEETDESCR\n" );
- fprintf( m_fp, "Sheet %s %d %d\n",
- TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); // in mm ?
+ // paper is described in mils
+ fprintf( m_fp, "Sheet %s %d %d\n",
+ TO_UTF8( pageInfo.GetType() ),
+ pageInfo.GetSizeMils().x,
+ pageInfo.GetSizeMils().y );
+#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
fprintf( m_fp, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( m_fp, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( m_fp, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
@@ -2746,8 +2753,9 @@ void KICAD_PLUGIN::saveSHEET() const
fprintf( m_fp, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
- fprintf( m_fp, "$EndSHEETDESCR\n\n" );
#endif
+
+ fprintf( m_fp, "$EndSHEETDESCR\n\n" );
}
@@ -3079,26 +3087,29 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_FORMAT, me->GetShape() ) );
}
- // universal character set padname
- wxString padname = me->GetPadName();
+#if BOARD_FORMAT_VERSION == 1 // saving mode is a compile time option
-#if BOARD_FORMAT_VERSION == 1
+ wxString wpadname = me->GetPadName(); // universal character set padname
+ std::string spadname;
- char mypadname[PADNAMEZ+1];
-
- int i;
- for( i = 0; iGetPadName() ).c_str(),
#endif
cshape,
diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp
index d2270ff2c5..2c44cb9213 100644
--- a/pcbnew/loadcmp.cpp
+++ b/pcbnew/loadcmp.cpp
@@ -371,7 +371,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
if( footprint_names_list.GetCount() )
{
- msg.Printf( _( "Modules [%d items]" ), footprint_names_list.GetCount() );
+ msg.Printf( _( "Modules [%d items]" ), (int) footprint_names_list.GetCount() );
EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName,
DisplayCmpDoc, GetComponentDialogPosition() );
diff --git a/pcbnew/minimun_spanning_tree.h b/pcbnew/minimun_spanning_tree.h
index 3536e8ab6c..e94c99359b 100644
--- a/pcbnew/minimun_spanning_tree.h
+++ b/pcbnew/minimun_spanning_tree.h
@@ -70,7 +70,7 @@ private:
* updates d so that the values are correct (goes through target's
* neighbours making sure that the distances between them and the tree
* are indeed minimum)
- * @param target = index of curr item
+ * @param aTarget = index of curr item
*/
void updateDistances( int aTarget );
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 870b983f06..35688fdbd2 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -160,7 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
SetBoard( g_ModuleEditor_Pcb );
if( s_screenModule == NULL )
- s_screenModule = new PCB_SCREEN();
+ s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
SetScreen( s_screenModule );
GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting );
diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp
index ca3292d0bc..30c32bc6b9 100644
--- a/pcbnew/onleftclick.cpp
+++ b/pcbnew/onleftclick.cpp
@@ -423,7 +423,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
m_canvas->DrawAuxiliaryAxis( aDC, GR_XOR );
- m_originAxisPosition = GetScreen()->GetCrossHairPosition();
+ SetOriginAxisPosition( GetScreen()->GetCrossHairPosition() );
m_canvas->DrawAuxiliaryAxis( aDC, GR_COPY );
OnModify();
break;
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 127a6df09c..b0eacdc950 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -317,8 +317,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
SetIcon( icon );
m_internalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
- SetScreen( new PCB_SCREEN() );
- GetScreen()->m_Center = false; // PCB drawings start in the upper left corner.
+
+ SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
+
+ // PCB drawings start in the upper left corner.
+ GetScreen()->m_Center = false;
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager
@@ -403,7 +406,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_Layers->ReFillRender(); // Update colors in Render after the config is read
syncLayerWidget();
m_auimgr.Update();
-
}
diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp
index 648d9e90f6..2fd6f6cd98 100644
--- a/pcbnew/pcbnew_config.cpp
+++ b/pcbnew/pcbnew_config.cpp
@@ -41,7 +41,7 @@
#include "worksheet.h"
#include "dialog_hotkeys_editor.h"
-#include "class_pad.h"
+#include "class_board.h"
#include "pcbplot.h"
#include "pcbnew.h"
@@ -210,7 +210,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
{
PARAM_CFG_ARRAY pca;
- BOARD_DESIGN_SETTINGS& bds = *GetDesignSettings();
+ BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
GROUPLIB ) );
diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h
index da690cc504..f0d7656403 100644
--- a/pcbnew/pcbplot.h
+++ b/pcbnew/pcbplot.h
@@ -17,7 +17,7 @@ class PCB_TARGET;
class ZONE_CONTAINER;
-/* Shared Config keys for plot and print */
+// Shared Config keys for plot and print
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )
@@ -27,10 +27,10 @@ class ZONE_CONTAINER;
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
-/* Conversion unit constants. */
-/* Convert pcb dimension of 0.1 mil to PS units of inches. */
+// Conversion unit constants.
+// Convert pcb dimension of 0.1 mil to PS units of inches.
#define SCALE_PS .0001
-/* Convert dimension 0.1 mil -> HPGL units: */
+// Convert dimension 0.1 mil -> HPGL units:
#define SCALE_HPGL 0.102041
// Small drill marks diameter value (in internal value = 1/10000 inch)
@@ -57,8 +57,8 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
EDA_DRAW_MODE_T trace_mode );
-/* PLOTGERB.CPP */
+// PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
-#endif /* #define PCBPLOT_H */
+#endif // #define PCBPLOT_H
diff --git a/pcbnew/plotdxf.cpp b/pcbnew/plotdxf.cpp
index 033dffd8b5..3eb1371a75 100644
--- a/pcbnew/plotdxf.cpp
+++ b/pcbnew/plotdxf.cpp
@@ -18,7 +18,7 @@
bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
EDA_DRAW_MODE_T aTraceMode )
{
- Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
+ LOCALE_IO toggle;
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
@@ -27,10 +27,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
return false;
}
- SetLocaleTo_C_standard();
-
DXF_PLOTTER* plotter = new DXF_PLOTTER();
- plotter->set_paper_size( currentsheet );
+ plotter->SetPageSettings( GetPageSettings() );
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( aFullFileName );
@@ -42,7 +40,5 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot();
delete plotter;
- SetLocaleTo_Default();
-
return true;
}
diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp
index 8a1084df09..c3f91a6859 100644
--- a/pcbnew/plotgerb.cpp
+++ b/pcbnew/plotgerb.cpp
@@ -35,12 +35,12 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
wxPoint offset;
- /* Calculate scaling from Pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
+ // Calculate scaling from Pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units
double scale = g_PcbPlotOptions.m_PlotScale;
if( aPlotOriginIsAuxAxis )
{
- offset = m_originAxisPosition;
+ offset = GetOriginAxisPosition();
}
else
{
@@ -48,9 +48,11 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
offset.y = 0;
}
- SetLocaleTo_C_standard();
+ LOCALE_IO toggle;
+
PLOTTER* plotter = new GERBER_PLOTTER();
- /* No mirror and scaling for gerbers! */
+
+ // No mirror and scaling for gerbers!
plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
@@ -78,7 +80,6 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
}
delete plotter;
- SetLocaleTo_Default();
return true;
}
diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp
index 2ffa973f35..2a607095b4 100644
--- a/pcbnew/plothpgl.cpp
+++ b/pcbnew/plothpgl.cpp
@@ -20,15 +20,14 @@
bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
EDA_DRAW_MODE_T aTraceMode )
{
- wxSize SheetSize;
- wxSize BoardSize;
- wxPoint BoardCenter;
- bool Center = false;
- Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
- double scale;
- wxPoint offset;
+ wxSize boardSize;
+ wxPoint boardCenter;
+ bool center = false;
+ double scale;
+ wxPoint offset;
+ LOCALE_IO toggle;
- FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
+ FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL )
{
@@ -52,29 +51,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
g_PcbPlotOptions.m_PlotScale );
- SetLocaleTo_C_standard();
-
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
- Center = true; // when scale != 1.0 we must calculate the position in page
- // because actual position has no meaning
+ {
+ // when scale != 1.0 we must calculate the position in page
+ // because actual position has no meaning
+ center = true;
+ }
- // Scale units from 0.0001" to HPGL plot units.
- SheetSize.x = currentsheet->m_Size.x * U_PCB;
- SheetSize.y = currentsheet->m_Size.y * U_PCB;
+ wxSize pageSizeIU = GetPageSizeIU();
// Calculate the center of the PCB
EDA_RECT bbbox = GetBoardBoundingBox();
- BoardSize = bbbox.GetSize();
- BoardCenter = bbbox.Centre();
+ boardSize = bbbox.GetSize();
+ boardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{
- double Xscale, Yscale;
-
// Fit to 80% of the page
- Xscale = ( ( SheetSize.x * 0.8 ) / BoardSize.x );
- Yscale = ( ( SheetSize.y * 0.8 ) / BoardSize.y );
+ double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
+ double Yscale = ( ( pageSizeIU.y * 0.8 ) / boardSize.y );
scale = MIN( Xscale, Yscale );
}
else
@@ -83,12 +79,12 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
// Calculate the page size offset.
- if( Center )
+ if( center )
{
- offset.x = wxRound( (double) BoardCenter.x -
- ( (double) SheetSize.x / 2.0 ) / scale );
- offset.y = wxRound( (double) BoardCenter.y -
- ( (double) SheetSize.y / 2.0 ) / scale );
+ offset.x = wxRound( (double) boardCenter.x -
+ ( (double) pageSizeIU.x / 2.0 ) / scale );
+ offset.y = wxRound( (double) boardCenter.y -
+ ( (double) pageSizeIU.y / 2.0 ) / scale );
}
else
{
@@ -97,7 +93,9 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
- plotter->set_paper_size( currentsheet );
+
+ plotter->SetPageSettings( GetPageSettings() );
+
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
@@ -108,14 +106,13 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
plotter->set_pen_diameter( pen_diam );
plotter->start_plot( output_file );
- /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
- if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
+ // The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
+ if( g_PcbPlotOptions.m_PlotFrameRef && !center )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot();
delete plotter;
- SetLocaleTo_Default();
return true;
}
diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp
index 7ef143ca21..c82107f19a 100644
--- a/pcbnew/plotps.cpp
+++ b/pcbnew/plotps.cpp
@@ -24,15 +24,19 @@
bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer,
bool aUseA4, EDA_DRAW_MODE_T aTraceMode )
{
- wxSize SheetSize;
- wxSize PaperSize;
- wxSize BoardSize;
- wxPoint BoardCenter;
- bool Center = false;
- Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
- double scale, paperscale;
- Ki_PageDescr* SheetPS;
- wxPoint offset;
+ const PAGE_INFO& pageInfo = GetPageSettings();
+
+ wxSize paperSizeIU;
+ wxSize boardSize;
+ wxPoint boardCenter;
+ bool center = false;
+ double scale;
+ double paperscale;
+ wxPoint offset;
+ LOCALE_IO toggle;
+ PAGE_INFO pageA4( wxT( "A4" ) );
+
+ const PAGE_INFO* sheetPS;
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
@@ -41,45 +45,43 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
return false;
}
- SetLocaleTo_C_standard();
-
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
- Center = true; // when scale != 1.0 we must calculate the position in page
- // because actual position has no meaning
+ {
+ // when scale != 1.0 we must calculate the position in page
+ // because actual position has no meaning
+ center = true;
+ }
// Set default line width
if( g_PcbPlotOptions.m_PlotLineWidth < 1 )
g_PcbPlotOptions.m_PlotLineWidth = 1;
- SheetSize.x = currentsheet->m_Size.x * U_PCB;
- SheetSize.y = currentsheet->m_Size.y * U_PCB;
+ wxSize pageSizeIU = GetPageSizeIU();
if( aUseA4 )
{
- SheetPS = &g_Sheet_A4;
- PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB;
- PaperSize.y = g_Sheet_A4.m_Size.y * U_PCB;
- paperscale = (float) PaperSize.x / SheetSize.x;
+ sheetPS = &pageA4;
+ paperSizeIU = pageA4.GetSizeIU();
+ paperscale = (double) paperSizeIU.x / pageSizeIU.x;
}
else
{
- SheetPS = currentsheet;
- PaperSize = SheetSize;
+ sheetPS = &pageInfo;
+ paperSizeIU = pageSizeIU;
paperscale = 1;
}
EDA_RECT bbbox = GetBoardBoundingBox();
- BoardSize = bbbox.GetSize();
- BoardCenter = bbbox.Centre();
+ boardSize = bbbox.GetSize();
+ boardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{
- double Xscale, Yscale;
-
// Fit to 80% of the page
- Xscale = (PaperSize.x * 0.8) / BoardSize.x;
- Yscale = (PaperSize.y * 0.8) / BoardSize.y;
+ double Xscale = (paperSizeIU.x * 0.8) / boardSize.x;
+ double Yscale = (paperSizeIU.y * 0.8) / boardSize.y;
+
scale = MIN( Xscale, Yscale );
}
else
@@ -87,10 +89,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
scale = g_PcbPlotOptions.m_PlotScale * paperscale;
}
- if( Center )
+ if( center )
{
- offset.x = wxRound( (double) BoardCenter.x - ( (double) PaperSize.x / 2.0 ) / scale );
- offset.y = wxRound( (double) BoardCenter.y - ( (double) PaperSize.y / 2.0 ) / scale );
+ offset.x = wxRound( (double) boardCenter.x - ( (double) paperSizeIU.x / 2.0 ) / scale );
+ offset.y = wxRound( (double) boardCenter.y - ( (double) paperSizeIU.y / 2.0 ) / scale );
}
else
{
@@ -99,7 +101,9 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
PS_PLOTTER* plotter = new PS_PLOTTER();
- plotter->set_paper_size( SheetPS );
+
+ plotter->SetPageSettings( *sheetPS );
+
plotter->set_scale_adjust( g_PcbPlotOptions.m_FineScaleAdjustX,
g_PcbPlotOptions.m_FineScaleAdjustY );
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
@@ -109,7 +113,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
- if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
+ if( g_PcbPlotOptions.m_PlotFrameRef && !center )
PlotWorkSheet( plotter, GetScreen() );
// If plot a negative board:
@@ -131,7 +135,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot();
delete plotter;
- SetLocaleTo_Default();
return true;
}
diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp
index a6a7f517f4..7de7d9f57e 100644
--- a/pcbnew/print_board_functions.cpp
+++ b/pcbnew/print_board_functions.cpp
@@ -31,11 +31,10 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
bool aPrintMirrorMode,
void * aData)
{
- MODULE* Module;
- int drawmode = GR_COPY;
- DISPLAY_OPTIONS save_opt;
- BOARD* Pcb = GetBoard();
- int defaultPenSize = 50;
+ int drawmode = GR_COPY;
+ int defaultPenSize = 50;
+
+ DISPLAY_OPTIONS save_opt;
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
@@ -74,22 +73,17 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
// Draw footprints, this is done at last in order to print the pad holes in
// white (or g_DrawBgColor) after the tracks and zones
- Module = (MODULE*) Pcb->m_Modules;
int tmp = D_PAD::m_PadSketchModePenSize;
D_PAD::m_PadSketchModePenSize = defaultPenSize;
- wxPoint offset;
- offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2;
- offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2;
- // offset is in mils, converts in internal units
- offset.x *= m_internalUnits / 1000;
- offset.y *= m_internalUnits / 1000;
+ wxSize pageSizeIU = GetPageSizeIU() / 2;
+ wxPoint offset( pageSizeIU.x, pageSizeIU.y );
- for( ; Module != NULL; Module = Module->Next() )
+ for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{
- Module->Move( offset );
- Print_Module( m_canvas, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt );
- Module->Move( -offset );
+ module->Move( offset );
+ Print_Module( m_canvas, aDC, module, drawmode, aPrintMaskLayer, drillShapeOpt );
+ module->Move( -offset );
}
D_PAD::m_PadSketchModePenSize = tmp;
@@ -101,7 +95,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
- GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp);
+ GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
}
diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp
index 067cfb5b58..a806cbfa70 100644
--- a/pcbnew/printout_controler.cpp
+++ b/pcbnew/printout_controler.cpp
@@ -142,9 +142,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
{
int tmpzoom;
wxPoint tmp_startvisu;
- wxSize SheetSize; // Page size in internal units
wxPoint old_org;
- wxPoint DrawOffset; // Offset de trace
+ wxPoint DrawOffset; // Offset de trace
double userscale;
double DrawZoom = 1;
wxDC* dc = GetDC();
@@ -153,65 +152,68 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
wxBusyCursor dummy;
- /* Save old draw scale and draw offset */
+ // Save old draw scale and draw offset
tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg;
- /* Change draw scale and offset to draw the whole page */
+
+ // Change draw scale and offset to draw the whole page
screen->SetScalingFactor( DrawZoom );
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
- SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
- SheetSize.x *= m_Parent->GetInternalUnits() / 1000;
- SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in internal units
-
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;
- EDA_RECT brd_BBox = pcbframe->GetBoard()->ComputeBoundingBox();
+ wxSize pageSizeIU = pcbframe->GetPageSizeIU(); // internal units
+ EDA_RECT bbbox = pcbframe->GetBoard()->ComputeBoundingBox();
// In module editor, the module is located at 0,0 but for printing
- // it is moved to SheetSize.x/2, SheetSize.y/2.
+ // it is moved to pageSizeIU.x/2, pageSizeIU.y/2.
// So the equivalent board must be moved:
if( m_Parent->IsType( MODULE_EDITOR_FRAME ) )
{
- wxPoint mv_offset;
- mv_offset.x = SheetSize.x / 2;
- mv_offset.y = SheetSize.y / 2;
- brd_BBox.Move( mv_offset );
+ bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
}
- /* Compute the PCB size in internal units*/
+ // Compute the PCB size in internal units
userscale = m_PrintParams.m_PrintScale;
- if( userscale == 0 ) // fit in page
+ if( userscale == 0 ) // fit in page
{
- int extra_margin = 4000*2; // Margin = 4000 units pcb = 0.4 inch
- SheetSize.x = brd_BBox.GetWidth() + extra_margin;
- SheetSize.y = brd_BBox.GetHeight() + extra_margin;
+ // Margin = 0.4 inch
+#if defined(KICAD_NANOMETRE)
+ int extra_margin = int( 0.4 * 25400 ); // nanometers
+#else
+ int extra_margin = int( 0.4 * 1000 ); // deci-mils
+#endif
+
+ pageSizeIU.x = bbbox.GetWidth() + extra_margin * 2;
+ pageSizeIU.y = bbbox.GetHeight() + extra_margin * 2;
+
userscale = 0.99;
}
-
if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
{
- DrawOffset += brd_BBox.Centre();
+ DrawOffset += bbbox.Centre();
}
if( m_PrintParams.m_PageSetupData )
{
wxSize pagesize;
- pagesize.x = (int) (SheetSize.x / userscale);
- pagesize.y = (int) (SheetSize.y / userscale);
- FitThisSizeToPageMargins(pagesize, *m_PrintParams.m_PageSetupData );
+
+ pagesize.x = int( pageSizeIU.x / userscale );
+ pagesize.y = int( pageSizeIU.y / userscale );
+
+ FitThisSizeToPageMargins( pagesize, *m_PrintParams.m_PageSetupData );
}
// Compute Accurate scale 1
if( userscale == 1.0 )
{
// We want a 1:1 scale and margins for printing
- MapScreenSizeToPaper( );
+ MapScreenSizeToPaper();
int w, h;
GetPPIPrinter( &w, &h );
double accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT;
@@ -264,7 +266,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
if( m_PrintParams.m_Print_Black_and_White )
GRForceBlackPen( true );
-
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
EDA_RECT tmp = *panel->GetClipBox();
@@ -304,7 +305,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
* for scales > 1, the DrawOffset was already computed to have the board centre
* to the middle of the page.
*/
- wxPoint pcb_centre = brd_BBox.Centre();
+ wxPoint pcb_centre = bbbox.Centre();
if( userscale <= 1.0 )
DrawOffset.y += pcb_centre.y - (ysize / 2);
diff --git a/pcbnew/printout_controler.h b/pcbnew/printout_controler.h
index 80668c04a1..c3d4a3300b 100644
--- a/pcbnew/printout_controler.h
+++ b/pcbnew/printout_controler.h
@@ -52,8 +52,8 @@ public:
class BOARD_PRINTOUT_CONTROLER : public wxPrintout
{
private:
- EDA_DRAW_FRAME* m_Parent;
- PRINT_PARAMETERS m_PrintParams;
+ EDA_DRAW_FRAME* m_Parent;
+ PRINT_PARAMETERS m_PrintParams;
public:
BOARD_PRINTOUT_CONTROLER( const PRINT_PARAMETERS& print_params,
diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp
index 400f90751e..c3284a06d4 100644
--- a/pcbnew/solve.cpp
+++ b/pcbnew/solve.cpp
@@ -474,7 +474,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
int px = pt_cur_ch->m_PadStart->GetPosition().x;
int py = pt_cur_ch->m_PadStart->GetPosition().y;
- if( ( ( pt_cur_ch->m_PadStart->m_Orient / 900 ) & 1 ) != 0 )
+ if( ( ( int( pt_cur_ch->m_PadStart->m_Orient ) / 900 ) & 1 ) != 0 )
EXCHG( dx, dy );
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
@@ -489,7 +489,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
px = pt_cur_ch->m_PadEnd->GetPosition().x;
py = pt_cur_ch->m_PadEnd->GetPosition().y;
- if( ( (pt_cur_ch->m_PadEnd->m_Orient / 900) & 1 ) != 0 )
+ if( ( ( int( pt_cur_ch->m_PadEnd->m_Orient ) / 900) & 1 ) != 0 )
EXCHG( dx, dy );
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp
index 34b76b2d6f..b31e1ed5b5 100644
--- a/pcbnew/xchgmod.cpp
+++ b/pcbnew/xchgmod.cpp
@@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
FILE* FichCmp, * NewFile;
char line[1024];
wxString msg;
+ char* ignore;
if( old_name == new_name )
return 0;
@@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1;
}
- fgets( line, sizeof(line), FichCmp );
+ ignore = fgets( line, sizeof(line), FichCmp );
fprintf( NewFile, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
@@ -587,6 +588,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
MODULE* Module = GetBoard()->m_Modules;
wxString msg;
wxString wildcard;
+ char* ignore;
if( Module == NULL )
{
@@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return;
}
- fgets( line, sizeof(line), FichCmp );
+ ignore = fgets( line, sizeof(line), FichCmp );
fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
for( ; Module != NULL; Module = Module->Next() )