Ki_PageDescr was re-written as a proper C++ class and renamed to PAGE_INFO.

It describes paper.  The m_Offset field was dropped since it was only used
    in HPGL plotting within EESCHEMA.  PAGE_INFO instance was moved out of
    BASE_SCREEN (which is on its way out) into both SCH_SCREEN and BOARD.


----------- This line and the following will be ignored --------------

modified:
  CMakeLists.txt
  common/CMakeLists.txt
  common/base_screen.cpp
  common/basicframe.cpp
  common/class_plotter.cpp
  common/common.cpp
  common/common_plotHPGL_functions.cpp
  common/common_plotPS_functions.cpp
  common/common_plot_functions.cpp
  common/dialogs/dialog_page_settings.cpp
  common/dialogs/dialog_page_settings.h
  common/dialogs/dialog_page_settings_base.cpp
  common/dialogs/dialog_page_settings_base.fbp
  common/dialogs/dialog_page_settings_base.h
  common/drawframe.cpp
  common/drawpanel.cpp
  common/pcbcommon.cpp
  common/projet_config.cpp
  common/worksheet.cpp
  cvpcb/class_DisplayFootprintsFrame.cpp
  cvpcb/class_footprints_listbox.cpp
  cvpcb/cvframe.cpp
  eeschema/dialogs/dialog_SVG_print.cpp
  eeschema/dialogs/dialog_SVG_print.h
  eeschema/dialogs/dialog_build_BOM.cpp
  eeschema/dialogs/dialog_plot_schematic_DXF.cpp
  eeschema/dialogs/dialog_plot_schematic_HPGL.cpp
  eeschema/dialogs/dialog_plot_schematic_PS.cpp
  eeschema/dialogs/dialog_print_using_printer.cpp
  eeschema/eeschema_config.cpp
  eeschema/files-io.cpp
  eeschema/libedit_plot_component.cpp
  eeschema/libeditframe.cpp
  eeschema/libeditframe.h
  eeschema/load_one_schematic_file.cpp
  eeschema/sch_screen.cpp
  eeschema/sch_sheet.h
  eeschema/schframe.cpp
  eeschema/viewlib_frame.cpp
  eeschema/viewlib_frame.h
  gerbview/dialogs/dialog_show_page_borders.cpp
  gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
  gerbview/events_called_functions.cpp
  gerbview/gerbview.cpp
  gerbview/gerbview.h
  gerbview/gerbview_config.cpp
  gerbview/gerbview_frame.cpp
  gerbview/initpcb.cpp
  include/appl_wxstruct.h
  include/class_base_screen.h
  include/class_colors_design_settings.h
  include/class_pcb_screen.h
  include/class_sch_screen.h
  include/common.h
  include/pcbstruct.h
  include/plot_common.h
  include/wxBasePcbFrame.h
  include/wxEeschemaStruct.h
  include/wxstruct.h
  pcbnew/basepcbframe.cpp
  pcbnew/class_board.h
  pcbnew/class_pad.cpp
  pcbnew/class_pad.h
  pcbnew/class_track.h
  pcbnew/classpcb.cpp
  pcbnew/dialogs/dialog_SVG_print.cpp
  pcbnew/dialogs/dialog_gendrill.h
  pcbnew/dialogs/dialog_pad_properties.cpp
  pcbnew/export_gencad.cpp
  pcbnew/gen_drill_report_files.cpp
  pcbnew/gen_modules_placefile.cpp
  pcbnew/gendrill.cpp
  pcbnew/gendrill.h
  pcbnew/graphpcb.cpp
  pcbnew/initpcb.cpp
  pcbnew/io_mgr.h
  pcbnew/ioascii.cpp
  pcbnew/item_io.cpp
  pcbnew/kicad_plugin.cpp
  pcbnew/loadcmp.cpp
  pcbnew/minimun_spanning_tree.h
  pcbnew/moduleframe.cpp
  pcbnew/onleftclick.cpp
  pcbnew/pcbframe.cpp
  pcbnew/pcbnew_config.cpp
  pcbnew/pcbplot.h
  pcbnew/plotdxf.cpp
  pcbnew/plotgerb.cpp
  pcbnew/plothpgl.cpp
  pcbnew/plotps.cpp
  pcbnew/print_board_functions.cpp
  pcbnew/printout_controler.cpp
  pcbnew/printout_controler.h
  pcbnew/solve.cpp
  pcbnew/xchgmod.cpp
unknown:
  3239.patch
  3268.patch
  build/
  container_test.cpp
  debug/
  dick
  release/
  new/build/
  new/doxygen.sty
  pcbnew/basepcbframe.cpp.orig
  pcbnew/plotps.cpp.orig
pending merges:
  Dick Hollenbeck 2012-01-05 fix unreleased bug pertaining to "Sheet" line in a *.brd file
    Dick Hollenbeck 2012-01-05 [merge] merge in mainline into KICAD_PLUGIN work, which is for the PCBNEW nanometer support
    Dick Hollenbeck 2012-01-05 cannot use plugin until done
    Dick Hollenbeck 2012-01-05 finish up SCH_SHEET::{Set,Get}PageSettings() switch over
    Dick Hollenbeck 2012-01-04 remove page size globals from eeschema
    Dick Hollenbeck 2011-12-30 moving objects into BOARD which are saved in a *.brd file, for PLUGIN access
    Dick Hollenbeck 2011-12-22 [merge] merge in testing
    Dick Hollenbeck 2011-12-22 rename Ki_PageDescr to PAGE_INFO, encapsulate it in accessors, and move it into the BOARD
This commit is contained in:
Dick Hollenbeck 2012-01-05 10:40:36 -06:00
commit 9d080b0868
95 changed files with 4100 additions and 2870 deletions

View File

@ -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_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_LOAD "use new plugin support for legacy file format" OFF)
option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format (default OFF)" OFF) option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format" OFF)
# Russian GOST patch # Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)") option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
@ -265,6 +265,11 @@ add_subdirectory(bitmap2component)
add_subdirectory(pcb_calculator) add_subdirectory(pcb_calculator)
#add_subdirectory(new) #add_subdirectory(new)
add_executable( container_test EXCLUDE_FROM_ALL container_test.cpp )
target_link_libraries( container_test common polygon bitmaps ${wxWidgets_LIBRARIES} )
############# #############
# Resources # # Resources #
############# #############

View File

@ -114,6 +114,10 @@ else()
set( PCB_COMMON_SRCS ${PCB_COMMON_SRCS} ../pcbnew/item_io.cpp ) set( PCB_COMMON_SRCS ${PCB_COMMON_SRCS} ../pcbnew/item_io.cpp )
endif() 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}) add_library(pcbcommon ${PCB_COMMON_SRCS})

View File

@ -35,26 +35,28 @@
#include "id.h" #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_FirstRedraw = true;
m_ScreenNumber = 1; m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */ m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1
m_Zoom = 32.0; 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_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
m_Center = true; m_Center = true;
m_CurrentSheetDesc = &g_Sheet_A4;
m_IsPrinting = false; m_IsPrinting = false;
m_ScrollPixelsPerUnitX = 1; m_ScrollPixelsPerUnitX = 1;
m_ScrollPixelsPerUnitY = 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 ) if( m_Center )
{ {
m_crossHairPosition.x = m_crossHairPosition.y = 0; 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 else
{ {
m_DrawOrg.x = m_DrawOrg.y = 0; 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; 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 BASE_SCREEN::GetScalingFactor() const
{ {
double scale = 1.0 / GetZoom(); double scale = 1.0 / GetZoom();
@ -124,12 +104,12 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
double zoom = aScale; double zoom = aScale;
// Limit zoom to max and min allowed values: // Limit zoom to max and min allowed values:
if (zoom < m_ZoomList[0]) if( zoom < m_ZoomList[0] )
zoom = m_ZoomList[0]; zoom = m_ZoomList[0];
int idxmax = m_ZoomList.GetCount() - 1; int idxmax = m_ZoomList.GetCount() - 1;
if (zoom > m_ZoomList[idxmax]) if( zoom > m_ZoomList[idxmax] )
zoom = m_ZoomList[idxmax]; zoom = m_ZoomList[idxmax];
SetZoom( zoom ); SetZoom( zoom );
@ -151,13 +131,13 @@ bool BASE_SCREEN::SetFirstZoom()
{ {
if( m_Zoom != 1.0 ) if( m_Zoom != 1.0 )
{ {
m_Zoom = 1.0; SetZoom( 1.0 );
return true; return true;
} }
} }
else if( m_Zoom != m_ZoomList[0] ) else if( m_Zoom != m_ZoomList[0] )
{ {
m_Zoom = m_ZoomList[0]; SetZoom( m_ZoomList[0] );
return true; return true;
} }
@ -193,7 +173,7 @@ bool BASE_SCREEN::SetNextZoom()
{ {
if( m_Zoom < m_ZoomList[i] ) if( m_Zoom < m_ZoomList[i] )
{ {
m_Zoom = m_ZoomList[i]; SetZoom( m_ZoomList[i] );
return true; return true;
} }
} }
@ -213,7 +193,7 @@ bool BASE_SCREEN::SetPreviousZoom()
{ {
if( m_Zoom > m_ZoomList[i - 1] ) if( m_Zoom > m_ZoomList[i - 1] )
{ {
m_Zoom = m_ZoomList[i - 1]; SetZoom( m_ZoomList[i - 1] );
return true; return true;
} }
} }
@ -227,7 +207,7 @@ bool BASE_SCREEN::SetLastZoom()
if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() ) if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() )
return false; return false;
m_Zoom = m_ZoomList.Last(); SetZoom( m_ZoomList.Last() );
return true; return true;
} }
@ -466,7 +446,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
{ {
m_UndoList.PushCommand( 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; int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
if( extraitems > 0 ) // Delete the extra items if( extraitems > 0 ) // Delete the extra items
@ -478,7 +458,7 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
{ {
m_RedoList.PushCommand( 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; int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
if( extraitems > 0 ) // Delete the extra items 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 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. // for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; 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 ); item->Show( nestLevel+1, os );
} }
*/
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }

View File

@ -84,8 +84,10 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
SetSize( 0, 0, minsize.x, minsize.y ); SetSize( 0, 0, minsize.x, minsize.y );
// Create child subwindows. // 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_FramePos.x = m_FramePos.y = 0;
m_FrameSize.y -= m_MsgFrameHeight; m_FrameSize.y -= m_MsgFrameHeight;
@ -180,12 +182,16 @@ void EDA_BASE_FRAME::LoadSettings()
{ {
text = m_FrameName + wxT( "Pos_x" ); text = m_FrameName + wxT( "Pos_x" );
config->Read( text, &m_FramePos.x ); config->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" ); text = m_FrameName + wxT( "Pos_y" );
config->Read( text, &m_FramePos.y ); config->Read( text, &m_FramePos.y );
text = m_FrameName + wxT( "Size_x" ); text = m_FrameName + wxT( "Size_x" );
config->Read( text, &m_FrameSize.x, 600 ); config->Read( text, &m_FrameSize.x, 600 );
text = m_FrameName + wxT( "Size_y" ); text = m_FrameName + wxT( "Size_y" );
config->Read( text, &m_FrameSize.y, 400 ); config->Read( text, &m_FrameSize.y, 400 );
text = m_FrameName + wxT( "Maximized" ); text = m_FrameName + wxT( "Maximized" );
config->Read( text, &maximized, 0 ); config->Read( text, &maximized, 0 );
@ -215,9 +221,7 @@ void EDA_BASE_FRAME::LoadSettings()
void EDA_BASE_FRAME::SaveSettings() void EDA_BASE_FRAME::SaveSettings()
{ {
wxString text; wxString text;
wxConfig* config; wxConfig* config = wxGetApp().GetSettings();
config = wxGetApp().GetSettings();
if( ( config == NULL ) || IsIconized() ) if( ( config == NULL ) || IsIconized() )
return; return;
@ -227,12 +231,16 @@ void EDA_BASE_FRAME::SaveSettings()
text = m_FrameName + wxT( "Pos_x" ); text = m_FrameName + wxT( "Pos_x" );
config->Write( text, (long) m_FramePos.x ); config->Write( text, (long) m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" ); text = m_FrameName + wxT( "Pos_y" );
config->Write( text, (long) m_FramePos.y ); config->Write( text, (long) m_FramePos.y );
text = m_FrameName + wxT( "Size_x" ); text = m_FrameName + wxT( "Size_x" );
config->Write( text, (long) m_FrameSize.x ); config->Write( text, (long) m_FrameSize.x );
text = m_FrameName + wxT( "Size_y" ); text = m_FrameName + wxT( "Size_y" );
config->Write( text, (long) m_FrameSize.y ); config->Write( text, (long) m_FrameSize.y );
text = m_FrameName + wxT( "Maximized" ); text = m_FrameName + wxT( "Maximized" );
config->Write( text, IsMaximized() ); 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, void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxFileHistory * aFileHistory ) wxFileHistory * aFileHistory )
{ {
wxFileHistory * fileHistory = aFileHistory; wxFileHistory* fileHistory = aFileHistory;
if( fileHistory == NULL ) if( fileHistory == NULL )
fileHistory = & wxGetApp().GetFileHistory(); fileHistory = & wxGetApp().GetFileHistory();
@ -284,7 +292,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
{ {
wxString fn, msg; wxString fn, msg;
size_t i; size_t i;
wxFileHistory * fileHistory = aFileHistory; wxFileHistory* fileHistory = aFileHistory;
if( fileHistory == NULL ) if( fileHistory == NULL )
fileHistory = & wxGetApp().GetFileHistory(); fileHistory = & wxGetApp().GetFileHistory();

View File

@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
output_file = 0; output_file = 0;
color_mode = false; /* Start as a BW plot */ color_mode = false; /* Start as a BW plot */
negative_mode = false; 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 ); corner_list.push_back( corner );
PlotPoly( corner_list, fill ); 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 ); wxASSERT( !output_file );
sheet = asheet; pageInfo = aPageSettings;
// Sheets are in mils, plotter works with decimals // PAGE_INFO is in mils, plotter works with deci-mils
paper_size.x = sheet->m_Size.x * 10; paper_size = pageInfo.GetSizeMils() * 10;
paper_size.y = sheet->m_Size.y * 10;
} }

View File

@ -46,31 +46,6 @@
* application class. * 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 ProjectFileExtension( wxT( "pro" ) );
const wxString SchematicFileExtension( wxT( "sch" ) ); 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 ) //-----<PAGE_INFO>-------------------------------------------------------------
{
// 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) #if defined(KICAD_GOST)
m_LeftMargin = GOST_LEFTMARGIN; const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) );
m_RightMargin = GOST_RIGHTMARGIN;
m_TopMargin = GOST_TOPMARGIN;
m_BottomMargin = GOST_BOTTOMMARGIN;
#else #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 #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;
}
//-----</PAGE_INFO>------------------------------------------------------------
wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString ) wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString )
{ {
wxString tmp; wxString tmp;

View File

@ -12,19 +12,17 @@
#include "macros.h" #include "macros.h"
#include "kicad_string.h" #include "kicad_string.h"
/* HPGL scale factor. */ // HPGL scale factor.
const double SCALE_HPGL = 0.102041; 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 ) void HPGL_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{ {
wxASSERT( !output_file ); wxASSERT( !output_file );
plot_offset = aOffset; plot_offset = aOffset;
plot_scale = aScale; plot_scale = aScale;
device_scale = SCALE_HPGL; 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; 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++ ) for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
line_to( aCornerList[ii] ); line_to( aCornerList[ii] );
/* Close polygon if filled. */ // Close polygon if filled.
if( aFill ) if( aFill )
{ {
int ii = aCornerList.size() - 1; 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 ) void HPGL_PLOTTER::pen_to( wxPoint pos, char plume )
{ {
wxASSERT( output_file ); wxASSERT( output_file );
if( plume == 'Z' ) if( plume == 'Z' )
{ {
pen_control( 'Z' ); pen_control( 'Z' );
return; return;
} }
pen_control( plume ); pen_control( plume );
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
if( pen_lastpos != pos ) if( pen_lastpos != pos )
fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y ); fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y );
pen_lastpos = pos; pen_lastpos = pos;
} }
@ -246,7 +247,7 @@ void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
angle = (StAngle - EndAngle) / 10.0; angle = (StAngle - EndAngle) / 10.0;
else else
angle = (EndAngle - StAngle) / 10.0; angle = (EndAngle - StAngle) / 10.0;
/* Calculate start point, */ // Calculate start point,
cmap.x = (int) ( centre.x + ( rayon * cos( StAngle * M_PI / 1800 ) ) ); cmap.x = (int) ( centre.x + ( rayon * cos( StAngle * M_PI / 1800 ) ) );
cmap.y = (int) ( centre.y - ( rayon * sin( StAngle * M_PI / 1800 ) ) ); cmap.y = (int) ( centre.y - ( rayon * sin( StAngle * M_PI / 1800 ) ) );
user_to_device_coordinates( cmap ); user_to_device_coordinates( cmap );
@ -280,7 +281,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( orient >= 3600 ) if( orient >= 3600 )
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 ) 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, flash_pad_circle( wxPoint( cx + pos.x,
cy + pos.y ), size.x, trace_mode ); 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 ) ); 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 ); 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 ) if( delta > 0 )
{ {
@ -378,7 +379,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( size.y < 0 ) if( size.y < 0 )
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 ) if( size.x == 0 )
{ {
ox = pos.x; ox = pos.x;
@ -428,7 +429,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( trace_mode == FILLED ) if( trace_mode == FILLED )
{ {
/* Plot in filled mode. */ // Plot in filled mode.
delta = (int) (pen_diameter - pen_overlap); delta = (int) (pen_diameter - pen_overlap);
if( delta > 0 ) 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. // TODO: replace this par the HPGL plot polygon.
int jj; int jj;
/* Fill the shape */ // Fill the shape
move = wxRound( pen_diameter - pen_overlap ); 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 ) ); 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 ) ); 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 ); jj = jj / (int) ( pen_diameter - pen_overlap );
/* Trace the outline. */ // Trace the outline.
for( ; jj > 0; jj-- ) for( ; jj > 0; jj-- )
{ {
polygone[0].x += move; 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].x -= move;
polygone[3].y -= move; polygone[3].y -= move;
/* Test for crossed vertexes. */ // Test for crossed vertexes.
if( polygone[0].x > polygone[3].x ) /* X axis intersection on if( polygone[0].x > polygone[3].x ) /* X axis intersection on
*vertexes 0 and 3 */ *vertexes 0 and 3 */
{ {

View File

@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
fprintf( output_file, "%%%%Pages: 1\n" ); fprintf( output_file, "%%%%Pages: 1\n" );
fprintf( output_file, "%%%%PageOrder: Ascend\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; const double CONV_SCALE = DECIMIL_TO_INCH * 72;
// The coordinates of the lower left corner of the boundary // 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; // (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// the order in which they are specified is not wrong!) // 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 // Also note pageSize is given in mils, not in internal units and must be
// sheet->m_Size * 10 in decimals // converted to internal units.
if( sheet->m_Name.Cmp( wxT( "User" ) ) == 0 ) wxSize pageSize = pageInfo.GetSizeMils();
if( pageInfo.GetType().Cmp( wxT( "User" ) ) == 0 )
fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n", fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ), wxRound( pageSize.y * 10 * CONV_SCALE ),
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) ); wxRound( pageSize.x * 10 * CONV_SCALE ) );
else // ( if sheet->m_Name does not equal "User" ) else // ( if sheet->m_Name does not equal "User" )
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n", fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
TO_UTF8( sheet->m_Name ), TO_UTF8( pageInfo.GetType() ),
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ), wxRound( pageSize.y * 10 * CONV_SCALE ),
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) ); wxRound( pageSize.x * 10 * CONV_SCALE ) );
fprintf( output_file, "%%%%Orientation: Landscape\n" ); fprintf( output_file, "%%%%Orientation: Landscape\n" );

View File

@ -22,17 +22,21 @@
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
{ {
#define WSTEXTSIZE 50 // Text size in mils #define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils(); // mils
int xg, yg; int xg, yg;
wxSize PageSize;
wxPoint pos, ref; wxPoint pos, ref;
EDA_Colors color; EDA_Colors color;
/* Scale to convert dimension in 1/1000 in into internal units // paper is sized in mils. Here is a conversion factor to
* (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */ // scale mils to internal units.
int conv_unit = screen->GetInternalUnits() / 1000; int conv_unit = screen->GetInternalUnits() / 1000;
wxString msg; wxString msg;
wxSize text_size; wxSize text_size;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
wxSize text_size2; wxSize text_size2;
wxSize text_size3; wxSize text_size3;
@ -41,20 +45,19 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
int UpperLimit = VARIABLE_BLOCK_START_POSITION; int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool bold = false; bool bold = false;
#endif #endif
bool italic = false; bool italic = false;
bool thickness = 0; //@todo : use current pen bool thickness = 0; //@todo : use current pen
color = BLACK; color = BLACK;
plotter->set_color( color ); plotter->set_color( color );
PageSize.x = Sheet->m_Size.x; // Plot edge.
PageSize.y = Sheet->m_Size.y; ref.x = pageInfo.GetLeftMarginMils() * conv_unit;
ref.y = pageInfo.GetTopMarginMils() * conv_unit;
/* Plot edge. */ xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
ref.x = Sheet->m_LeftMargin * conv_unit; yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * 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;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
plotter->move_to( ref ); plotter->move_to( ref );
@ -68,22 +71,30 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
pos.y = yg; pos.y = yg;
plotter->line_to( pos ); plotter->line_to( pos );
plotter->finish_to( ref ); plotter->finish_to( ref );
#else #else
for( unsigned ii = 0; ii < 2; ii++ ) for( unsigned ii = 0; ii < 2; ii++ )
{ {
plotter->move_to( ref ); plotter->move_to( ref );
pos.x = xg; pos.x = xg;
pos.y = ref.y; pos.y = ref.y;
plotter->line_to( pos ); plotter->line_to( pos );
pos.x = xg; pos.x = xg;
pos.y = yg; pos.y = yg;
plotter->line_to( pos ); plotter->line_to( pos );
pos.x = ref.x; pos.x = ref.x;
pos.y = yg; pos.y = yg;
plotter->line_to( pos ); plotter->line_to( pos );
plotter->finish_to( ref ); plotter->finish_to( ref );
ref.x += GRID_REF_W * conv_unit; ref.x += GRID_REF_W * conv_unit;
ref.y += GRID_REF_W * conv_unit; ref.y += GRID_REF_W * conv_unit;
xg -= GRID_REF_W * conv_unit; xg -= GRID_REF_W * conv_unit;
yg -= 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.x = WSTEXTSIZE * conv_unit;
text_size.y = WSTEXTSIZE * conv_unit; text_size.y = WSTEXTSIZE * conv_unit;
ref.x = Sheet->m_LeftMargin; // upper left corner in mils
ref.y = Sheet->m_TopMargin; /* Upper left corner in ref.x = pageInfo.GetLeftMarginMils();
* 1/1000 inch */ ref.y = pageInfo.GetTopMarginMils();
xg = ( PageSize.x - Sheet->m_RightMargin );
yg = ( PageSize.y - Sheet->m_BottomMargin ); /* lower right corner // lower right corner in mils
* in 1/1000 inch */ xg = ( pageSize.x - pageInfo.GetRightMarginMils() );
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() );
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU; for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
@ -151,7 +163,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#else #else
/* Plot legend along the X axis. */ // Plot legend along the X axis.
int ipas = ( xg - ref.x ) / PAS_REF; int ipas = ( xg - ref.x ) / PAS_REF;
int gxpas = ( xg - ref.x ) / ipas; int gxpas = ( xg - ref.x ) / ipas;
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, 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 ); thickness, italic, false );
} }
/* Plot legend along the Y axis. */ // Plot legend along the Y axis.
ipas = ( yg - ref.y ) / PAS_REF; ipas = ( yg - ref.y ) / PAS_REF;
int gypas = ( yg - ref.y ) / ipas; int gypas = ( yg - ref.y ) / ipas;
for( int ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, 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 #endif
/* Plot the worksheet. */ // Plot the worksheet.
text_size.x = SIZETEXT * conv_unit; text_size.x = SIZETEXT * conv_unit;
text_size.y = SIZETEXT * conv_unit; text_size.y = SIZETEXT * conv_unit;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
text_size2.x = SIZETEXT * conv_unit * 2; text_size2.x = SIZETEXT * conv_unit * 2;
text_size2.y = 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_size3.y = SIZETEXT * conv_unit * 3;
text_size1_5.x = SIZETEXT * conv_unit * 1.5; text_size1_5.x = SIZETEXT * conv_unit * 1.5;
text_size1_5.y = 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 ) if( screen->m_ScreenNumber == 1 )
{ {
@ -334,8 +348,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg, TEXT_ORIENT_HORIZ, text_size3, msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit; pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
pos.y = (Sheet->m_TopMargin + 270) * conv_unit; pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color, plotter->text( pos, color,
msg.GetData(), 1800, text_size2, msg.GetData(), 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, 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 ) switch( WsItem->m_Type )
{ {
case WS_CADRE: case WS_CADRE:
/* Begin list number > 1 */ // Begin list number > 1
msg = screen->m_Commentaire1; msg = screen->m_Commentaire1;
if( !msg.IsEmpty() ) if( !msg.IsEmpty() )
{ {
@ -408,8 +422,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg, TEXT_ORIENT_HORIZ, text_size3, msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false ); thickness, italic, false );
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit; pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
pos.y = (Sheet->m_TopMargin + 270) * conv_unit; pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color, plotter->text( pos, color,
msg, 1800, text_size2, msg, 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@ -444,9 +458,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
} }
} }
} }
#else #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; for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL; WsItem != NULL;
@ -477,7 +493,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break; break;
case WS_SIZESHEET: case WS_SIZESHEET:
msg += screen->m_CurrentSheetDesc->m_Name; msg += pageInfo.GetType();
break; break;
case WS_IDENTSHEET: case WS_IDENTSHEET:

View File

@ -16,6 +16,7 @@
#include "wxstruct.h" #include "wxstruct.h"
#include "wx/valgen.h" #include "wx/valgen.h"
#include <wx/tokenzr.h>
#ifdef EESCHEMA #ifdef EESCHEMA
#include "general.h" #include "general.h"
@ -23,14 +24,6 @@
#include "dialog_page_settings.h" #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 ) 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::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_Parent = parent;
m_Screen = m_Parent->GetScreen(); m_Screen = m_Parent->GetScreen();
m_Modified = 0; m_modified = false;
m_SelectedSheet = NULL;
m_CurrentSelection = 0;
initDialog(); initDialog();
@ -66,50 +58,63 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
void DIALOG_PAGES_SETTINGS::initDialog() void DIALOG_PAGES_SETTINGS::initDialog()
{ {
wxString msg; wxString msg;
double userSizeX;
double userSizeY;
SetFocus(); SetFocus();
SearchPageSizeSelection();
// Init display value for sheet User size // Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel(); wxString format = m_TextSheetCount->GetLabel();
msg.Printf( format, m_Screen->m_NumberOfScreen ); msg.Printf( format, m_Screen->m_NumberOfScreen );
m_TextSheetCount->SetLabel( msg ); m_TextSheetCount->SetLabel( msg );
format = m_TextSheetNumber->GetLabel(); format = m_TextSheetNumber->GetLabel();
msg.Printf( format, m_Screen->m_ScreenNumber ); msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg ); m_TextSheetNumber->SetLabel( msg );
m_page = m_Parent->GetPageSettings();
setCurrentPageSizeSelection();
switch( g_UserUnit ) switch( g_UserUnit )
{ {
case MILLIMETRES: case MILLIMETRES:
UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000; userSizeX = m_user_size.GetWidthMils() * 25.4e-3;
UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000; userSizeY = m_user_size.GetHeightMils() * 25.4e-3;
msg.Printf( wxT( "%.2f" ), UserSizeX );
msg.Printf( wxT( "%.2f" ), userSizeX );
m_TextUserSizeX->SetValue( msg ); m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.2f" ), UserSizeY );
msg.Printf( wxT( "%.2f" ), userSizeY );
m_TextUserSizeY->SetValue( msg ); m_TextUserSizeY->SetValue( msg );
break; break;
default:
case INCHES: case INCHES:
UserSizeX = (double) g_Sheet_user.m_Size.x / 1000; userSizeX = m_user_size.GetWidthMils() / 1000.0;
UserSizeY = (double) g_Sheet_user.m_Size.y / 1000; userSizeY = m_user_size.GetHeightMils() / 1000.0;
msg.Printf( wxT( "%.3f" ), UserSizeX );
msg.Printf( wxT( "%.3f" ), userSizeX );
m_TextUserSizeX->SetValue( msg ); m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.3f" ), UserSizeY );
msg.Printf( wxT( "%.3f" ), userSizeY );
m_TextUserSizeY->SetValue( msg ); m_TextUserSizeY->SetValue( msg );
break; break;
/* // you want it in mils, why?
case UNSCALED_UNITS: case UNSCALED_UNITS:
UserSizeX = g_Sheet_user.m_Size.x; userSizeX = m_user_size.GetWidthMils();
UserSizeY = g_Sheet_user.m_Size.y; userSizeY = m_user_size.GetHeightMils();
msg.Printf( wxT( "%f" ), UserSizeX ); msg.Printf( wxT( "%f" ), m_userSizeX );
m_TextUserSizeX->SetValue( msg ); m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%f" ), UserSizeY ); msg.Printf( wxT( "%f" ), m_userSizeY );
m_TextUserSizeY->SetValue( msg ); m_TextUserSizeY->SetValue( msg );
break; break;
*/
} }
// Set validators // 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_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) ); m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) ); 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 ) 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 ) void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{ {
SavePageSettings( event ); SavePageSettings( event );
m_Modified = 1; m_modified = true;
Close( true ); Close( true );
} }
@ -167,8 +172,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{ {
double dtmp;
wxString msg; wxString msg;
double userSizeX;
double userSizeY;
m_Screen->m_Revision = m_TextRevision->GetValue(); m_Screen->m_Revision = m_TextRevision->GetValue();
m_Screen->m_Company = m_TextCompany->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(); m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
msg = m_TextUserSizeX->GetValue(); msg = m_TextUserSizeX->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &userSizeX );
UserSizeX = dtmp;
msg = m_TextUserSizeY->GetValue(); msg = m_TextUserSizeY->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &userSizeY );
UserSizeY = dtmp;
int ii = m_PageSizeBox->GetSelection(); int radioSelection = m_PageSizeBox->GetSelection();
if( radioSelection < 0 )
radioSelection = 0;
if( ii < 0 ) // wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
ii = 0; wxString paperType = m_PageSizeBox->GetString( radioSelection );
m_SelectedSheet = SheetList[ii]; m_page.SetType( paperType );
m_Screen->m_CurrentSheetDesc = m_SelectedSheet;
m_Parent->SetPageSettings( m_page );
switch( g_UserUnit ) switch( g_UserUnit )
{ {
case MILLIMETRES: case MILLIMETRES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 ); PAGE_INFO::SetUserWidthMils( int( userSizeX * 1000.0 / 25.4 ) );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 ); PAGE_INFO::SetUserHeightMils( int( userSizeY * 1000.0 / 25.4 ) );
break; break;
default:
case INCHES: case INCHES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 ); PAGE_INFO::SetUserWidthMils( int( 1000 * userSizeX ) );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 ); PAGE_INFO::SetUserHeightMils( int( 1000 * userSizeY ) );
break; break;
/* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS: case UNSCALED_UNITS:
g_Sheet_user.m_Size.x = (int) ( UserSizeX ); PAGE_INFO::SetUserWidthMils( (int) userSizeX );
g_Sheet_user.m_Size.y = (int) ( UserSizeY ); PAGE_INFO::SetUserHeightMils( (int) userSizeY );
break; 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 #ifdef EESCHEMA
/* Exports settings to other sheets if requested: */ // Exports settings to other sheets if requested:
SCH_SCREEN* screen; SCH_SCREEN* screen;
/* Build the screen list */ // Build the screen list
SCH_SCREENS ScreenList; SCH_SCREENS ScreenList;
/* Update the datas */ // Update the datas
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
if( screen == m_Screen ) 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 void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
* according to the current page size
*/
void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
{ {
Ki_PageDescr* sheet; wxString curPaperType = m_page.GetType();
int ii;
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 ) while( st.HasMoreTokens() )
m_CurrentSelection = ii; {
if( st.GetNextToken() == curPaperType )
{
m_PageSizeBox->SetSelection( i );
return;
} }
}
}
// m_PageSizeBox->SetSelection( 1 ); // wxFormBuilder does this, control there
} }

View File

@ -14,12 +14,11 @@
class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{ {
private: private:
EDA_DRAW_FRAME *m_Parent; EDA_DRAW_FRAME* m_Parent;
BASE_SCREEN * m_Screen; BASE_SCREEN* m_Screen;
int m_Modified; bool m_modified;
Ki_PageDescr * m_SelectedSheet; PAGE_INFO m_page; ///< the one being edited
float UserSizeX, UserSizeY; PAGE_INFO m_user_size; ///< instantiated just to get the size
int m_CurrentSelection;
public: public:
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ); DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent );
@ -37,7 +36,8 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void SearchPageSizeSelection();
void setCurrentPageSizeSelection();
void SavePageSettings(wxCommandEvent& event); void SavePageSettings(wxCommandEvent& event);
void ReturnSizeSelected(wxCommandEvent& event); void ReturnSizeSelected(wxCommandEvent& event);

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // 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->SetFlexibleDirection( wxBOTH );
LeftColumnSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); 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 ); 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 = new wxRadioBox( this, wxID_ANY, _("Page Size:"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxNChoices, m_PageSizeBoxChoices, 1, wxRA_SPECIFY_COLS );
m_PageSizeBox->SetSelection( 1 ); 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 ); RevisionSizer->Add( m_TextRevision, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_RevisionExport = new wxCheckBox( this, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_RevisionExport = new wxCheckBox( this, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
RevisionSizer->Add( m_RevisionExport, 0, wxALL, 5 ); RevisionSizer->Add( m_RevisionExport, 0, wxALL, 5 );
RightColumnSizer->Add( RevisionSizer, 1, wxEXPAND, 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 ); TitleSizer->Add( m_TextTitle, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TitleExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_TitleExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
TitleSizer->Add( m_TitleExport, 0, wxALL, 5 ); TitleSizer->Add( m_TitleExport, 0, wxALL, 5 );
RightColumnSizer->Add( TitleSizer, 1, wxEXPAND, 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 ); CompanySizer->Add( m_TextCompany, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_CompanyExport = new wxCheckBox( this, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_CompanyExport = new wxCheckBox( this, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
CompanySizer->Add( m_CompanyExport, 0, wxALL, 5 ); CompanySizer->Add( m_CompanyExport, 0, wxALL, 5 );
RightColumnSizer->Add( CompanySizer, 1, wxEXPAND, 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 ); Comment1Sizer->Add( m_TextComment1, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment1Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_Comment1Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment1Sizer->Add( m_Comment1Export, 0, wxALL, 5 ); Comment1Sizer->Add( m_Comment1Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment1Sizer, 1, wxEXPAND, 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 ); Comment2Sizer->Add( m_TextComment2, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment2Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_Comment2Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment2Sizer->Add( m_Comment2Export, 0, wxALL, 5 ); Comment2Sizer->Add( m_Comment2Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment2Sizer, 1, wxEXPAND, 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 ); Comment3Sizer->Add( m_TextComment3, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment3Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_Comment3Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment3Sizer->Add( m_Comment3Export, 0, wxALL, 5 ); Comment3Sizer->Add( m_Comment3Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment3Sizer, 1, wxEXPAND, 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 ); Comment4Sizer->Add( m_TextComment4, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment4Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 ); m_Comment4Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment4Sizer->Add( m_Comment4Export, 0, wxALL, 5 ); Comment4Sizer->Add( m_Comment4Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment4Sizer, 1, wxEXPAND, 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_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_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 ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
} }

File diff suppressed because it is too large Load Diff

View File

@ -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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -80,15 +80,16 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ){ event.Skip(); } virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ){ event.Skip(); } virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckboxTitleClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: 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(); ~DIALOG_PAGES_SETTINGS_BASE();

View File

@ -51,7 +51,7 @@
static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) ); static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
/* Configuration entry names. */ // Configuration entry names.
static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) ); static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) ); static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) ); 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 ); 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 ) ) if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
SetSize( 0, 0, minsize.x, 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.x = wxRound( (double) clientSize.x / scalar );
logicalClientSize.y = wxRound( (double) clientSize.y / scalar ); logicalClientSize.y = wxRound( (double) clientSize.y / scalar );
// The upper left corner of the drawing in device units. // A corner of the drawing in internal units.
int w = screen->ReturnPageSize().x; wxSize corner = GetPageSizeIU();
int h = screen->ReturnPageSize().y;
// The drawing rectangle logical units // 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 )." ), wxLogTrace( traceScrollSettings, wxT( "Logical drawing rect = ( %d, %d, %d, %d )." ),
drawingRect.x, drawingRect.y, drawingRect.width, drawingRect.height ); drawingRect.x, drawingRect.y, drawingRect.width, drawingRect.height );
@ -749,12 +748,12 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
if( !screen ) if( !screen )
return; return;
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */ // Display Zoom level: zoom = zoom_coeff/ZoomScalar
Line.Printf( wxT( "Z %g" ), screen->GetZoom() ); Line.Printf( wxT( "Z %g" ), screen->GetZoom() );
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
/* Display absolute coordinates: */ // Display absolute coordinates:
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_internalUnits ); double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_internalUnits );
double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, 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 ) ); 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 absformatter;
wxString locformatter; wxString locformatter;
switch( g_UserUnit ) switch( g_UserUnit )
@ -809,7 +808,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
Line.Printf( absformatter, dXpos, dYpos ); Line.Printf( absformatter, dXpos, dYpos );
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
/* Display relative coordinates: */ // Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx, m_internalUnits ); 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 ) ); dYpos = RoundTo0( dYpos, (double) ( m_internalUnits / 10 ) );
} }
/* We already decided the formatter above */ // We already decided the formatter above
Line.Printf( locformatter, dXpos, dYpos ); Line.Printf( locformatter, dXpos, dYpos );
SetStatusText( Line, 3 ); SetStatusText( Line, 3 );
} }

View File

@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC ) void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{ {
int axis_color = BLUE; int axis_color = BLUE;
BASE_SCREEN* screen = GetScreen();
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
if( GetParent()->IsGridVisible() ) if( GetParent()->IsGridVisible() )
DrawGrid( DC ); DrawGrid( DC );
/* Draw axis */ // Draw axis
if( GetParent()->m_showAxis ) if( GetParent()->m_showAxis )
{ {
/* Draw the Y axis */ wxSize pageSize = GetParent()->GetPageSizeIU();
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, 0, axis_color );
/* Draw the X axis */ // Draw the Y axis
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0, GRDashedLine( &m_ClipBox, DC, 0, -pageSize.y,
screen->ReturnPageSize().x, 0, 0, axis_color ); 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 ) if( GetParent()->m_showOriginAxis )
@ -676,29 +677,31 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode ) 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; return;
int Color = DARKRED; int color = DARKRED;
BASE_SCREEN* screen = GetScreen(); wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
/* Draw the Y axis */ // Draw the Y axis
GRDashedLine( &m_ClipBox, aDC, GRDashedLine( &m_ClipBox, aDC,
GetParent()->m_originAxisPosition.x, origin.x,
-screen->ReturnPageSize().y, -pageSize.y,
GetParent()->m_originAxisPosition.x, origin.x,
screen->ReturnPageSize().y, pageSize.y,
0, Color ); 0, color );
/* Draw the X axis */ // Draw the X axis
GRDashedLine( &m_ClipBox, aDC, GRDashedLine( &m_ClipBox, aDC,
-screen->ReturnPageSize().x, -pageSize.x,
GetParent()->m_originAxisPosition.y, origin.y,
screen->ReturnPageSize().x, pageSize.x,
GetParent()->m_originAxisPosition.y, origin.y,
0, Color ); 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 ) ) || ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
return; return;
int Color = GetParent()->GetGridColor(); int color = GetParent()->GetGridColor();
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
/* Draw the Y axis */ // Draw the Y axis
GRDashedLine( &m_ClipBox, aDC, GRDashedLine( &m_ClipBox, aDC,
screen->m_GridOrigin.x, screen->m_GridOrigin.x,
-screen->ReturnPageSize().y, -pageSize.y,
screen->m_GridOrigin.x, screen->m_GridOrigin.x,
screen->ReturnPageSize().y, pageSize.y,
0, Color ); 0, color );
/* Draw the X axis */ // Draw the X axis
GRDashedLine( &m_ClipBox, aDC, GRDashedLine( &m_ClipBox, aDC,
-screen->ReturnPageSize().x, -pageSize.x,
screen->m_GridOrigin.y, screen->m_GridOrigin.y,
screen->ReturnPageSize().x, pageSize.x,
screen->m_GridOrigin.y, screen->m_GridOrigin.y,
0, Color ); 0, color );
} }

View File

@ -47,6 +47,9 @@ class MODULE;
*/ */
int GetLayerMask( int aLayerNumber ) int GetLayerMask( int aLayerNumber )
{ {
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
#if 0
// Look up Table for conversion one layer number -> one bit layer mask: // Look up Table for conversion one layer number -> one bit layer mask:
static int tabOneLayerMask[LAYER_COUNT] = static int tabOneLayerMask[LAYER_COUNT] =
{ {
@ -60,8 +63,10 @@ int GetLayerMask( int aLayerNumber )
0x10000000, 0x20000000, 0x40000000, 0x80000000 0x10000000, 0x20000000, 0x40000000, 0x80000000
}; };
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
return( tabOneLayerMask[aLayerNumber] ); return( tabOneLayerMask[aLayerNumber] );
#else
return 1 << aLayerNumber;
#endif
} }
/* Look up Table for conversion copper layer count -> general copper layer /* Look up Table for conversion copper layer count -> general copper layer

View File

@ -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 ) void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
{ {
PARAM_CFG_BASE* pt_cfg; PARAM_CFG_BASE* pt_cfg;
@ -253,12 +247,15 @@ void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
if( m_settings == NULL ) if( m_settings == NULL )
return; return;
BOOST_FOREACH( const PARAM_CFG_BASE& param, List ) unsigned count = List.size();
for( unsigned i=0; i<count; ++i )
{ {
const PARAM_CFG_BASE& param = List[i];
if( param.m_Setup == false ) if( param.m_Setup == false )
continue; continue;
if ( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
{ {
if( param.m_Ident ) if( param.m_Ident )
m_settings->DeleteGroup( param.m_Ident ); m_settings->DeleteGroup( 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 void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
{ {
if( m_Pt_param == NULL || aConfig == NULL ) 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 // We use indexlib+1 because first lib name is LibName1
configkey << (indexlib + 1); configkey << (indexlib + 1);
libname = libname_list->Item( indexlib ); libname = libname_list->Item( indexlib );
// filenames are stored using Unix notation // filenames are stored using Unix notation
libname.Replace(wxT("\\"), wxT("/") ); libname.Replace(wxT("\\"), wxT("/") );
aConfig->Write( configkey, libname ); aConfig->Write( configkey, libname );

View File

@ -16,7 +16,7 @@
#include "build_version.h" #include "build_version.h"
/* Must be defined in main applications: */ // Must be defined in main applications:
Ki_WorkSheetData WS_Date = Ki_WorkSheetData WS_Date =
{ {
@ -186,7 +186,9 @@ Ki_WorkSheetData WS_Comment4 =
NULL, NULL NULL, NULL
}; };
Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
/// Left vertical segment
Ki_WorkSheetData WS_MostLeftLine =
{ {
WS_LEFT_SEGMENT, WS_LEFT_SEGMENT,
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
@ -200,8 +202,9 @@ Ki_WorkSheetData WS_MostLeftLine = /* Left vertical segment */
NULL, NULL 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_SEGMENT,
&WS_MostUpperLine, &WS_MostUpperLine,
@ -211,7 +214,9 @@ Ki_WorkSheetData WS_SeparatorLine = /* horizontal segment between filename
NULL, NULL NULL, NULL
}; };
Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
/// superior horizontal segment
Ki_WorkSheetData WS_MostUpperLine =
{ {
WS_UPPER_SEGMENT, WS_UPPER_SEGMENT,
&WS_Segm3, &WS_Segm3,
@ -225,7 +230,9 @@ Ki_WorkSheetData WS_MostUpperLine = /* superior horizontal segment */
NULL, NULL NULL, NULL
}; };
Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
/// horizontal segment above COMPANY NAME
Ki_WorkSheetData WS_Segm3 =
{ {
WS_SEGMENT, WS_SEGMENT,
&WS_Segm4, &WS_Segm4,
@ -239,7 +246,9 @@ Ki_WorkSheetData WS_Segm3 = /* horizontal segment above COMPANY NAME */
NULL, NULL 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_SEGMENT,
&WS_Segm5, &WS_Segm5,
@ -253,6 +262,7 @@ Ki_WorkSheetData WS_Segm4 = /* vertical segment of the left REV and SHEET */
NULL, NULL NULL, NULL
}; };
Ki_WorkSheetData WS_Segm5 = Ki_WorkSheetData WS_Segm5 =
{ {
WS_SEGMENT, WS_SEGMENT,
@ -267,6 +277,7 @@ Ki_WorkSheetData WS_Segm5 =
NULL, NULL NULL, NULL
}; };
Ki_WorkSheetData WS_Segm6 = Ki_WorkSheetData WS_Segm6 =
{ {
WS_SEGMENT, WS_SEGMENT,
@ -281,6 +292,7 @@ Ki_WorkSheetData WS_Segm6 =
NULL, NULL NULL, NULL
}; };
Ki_WorkSheetData WS_Segm7 = Ki_WorkSheetData WS_Segm7 =
{ {
WS_SEGMENT, 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 ) void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width )
{ {
if( !m_showBorderAndTitleBlock ) if( !m_showBorderAndTitleBlock )
return; return;
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc; const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils();
int ii, jj, xg, yg, ipas, gxpas, gypas; int ii, jj, xg, yg, ipas, gxpas, gypas;
wxPoint pos; wxPoint pos;
int refx, refy; int refx, refy;
@ -1017,28 +1029,27 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
int width = line_width; int width = line_width;
Color = RED; Color = RED;
if( Sheet == NULL )
{
DisplayError( this,
wxT( "EDA_DRAW_FRAME::TraceWorkSheet() error: NULL Sheet" ) );
return;
}
// if not printing, draw the page limits: // if not printing, draw the page limits:
if( !screen->m_IsPrinting & g_ShowPageLimits ) if( !screen->m_IsPrinting & g_ShowPageLimits )
{ {
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
GRRect( m_canvas->GetClipBox(), DC, 0, 0, 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 ); g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
} }
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );
/* Draw the border. */
refx = Sheet->m_LeftMargin; // Draw the border.
refy = Sheet->m_TopMargin; /* Upper left corner */
xg = Sheet->m_Size.x - Sheet->m_RightMargin; // Upper left corner
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */ refx = pageInfo.GetLeftMarginMils();
refy = pageInfo.GetTopMarginMils();
// lower right corner
xg = pageSize.x - pageInfo.GetRightMarginMils();
yg = pageSize.y - pageInfo.GetBottomMarginMils();
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale, 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 #endif
/* Draw the reference legends. */ // Draw the reference legends.
refx = Sheet->m_LeftMargin; refx = pageInfo.GetLeftMarginMils();
#if defined(KICAD_GOST) #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 ) for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = ( refx - WsItem->m_Posx ) * scale; 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; break;
case WS_SEGMENT_LU: case WS_SEGMENT_LU:
xg = Sheet->m_LeftMargin - WsItem->m_Endx; xg = pageInfo.GetLeftMargin() - WsItem->m_Endx;
yg = Sheet->m_Size.y - Sheet->m_BottomMargin - WsItem->m_Endy; yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color ); xg * scale, yg * scale, width, Color );
break; break;
} }
} }
refy = Sheet->m_BottomMargin; /* Left Top corner */ refy = pageInfo.GetBottomMarginMils(); // Left Top corner
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext ) for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
{ {
pos.x = ( refx + WsItem->m_Posx ) * scale; 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 ) switch( WsItem->m_Type )
{ {
case WS_SEGMENT_LT: case WS_SEGMENT_LT:
xg = Sheet->m_LeftMargin + WsItem->m_Endx; xg = pageInfo.GetLeftMarginMils() + WsItem->m_Endx;
yg = Sheet->m_BottomMargin + WsItem->m_Endy; yg = pageInfo.GetBottomMarginMils() + WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color ); xg * scale, yg * scale, width, Color );
break; break;
} }
} }
#else #else
refy = Sheet->m_TopMargin; /* Upper left corner */
xg = Sheet->m_Size.x - Sheet->m_RightMargin; // Upper left corner
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */ refy = pageInfo.GetTopMarginMils();
// lower right corner
xg = pageSize.x - pageInfo.GetRightMarginMils();
yg = pageSize.y - pageInfo.GetBottomMarginMils();
ipas = ( xg - refx ) / PAS_REF; ipas = ( xg - refx ) / PAS_REF;
gxpas = ( xg - refx ) / ipas; gxpas = ( xg - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- ) for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{ {
Line.Printf( wxT( "%d" ), jj ); Line.Printf( wxT( "%d" ), jj );
if( ii < xg - PAS_REF / 2 ) if( ii < xg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), DC, ii * scale, refy * scale, 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, Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false ); width, false, false );
if( ii < xg - PAS_REF / 2 ) if( ii < xg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), DC, ii * scale, yg * scale, 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, Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false ); width, false, false );
if( ii < yg - PAS_REF / 2 ) if( ii < yg - PAS_REF / 2 )
{ {
GRLine( m_canvas->GetClipBox(), DC, xg * scale, ii * scale, 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 #endif
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
refx = Sheet->m_Size.x - Sheet->m_RightMargin; // lower right corner
refy = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */ refx = pageSize.x - pageInfo.GetRightMarginMils();
refy = pageSize.y - pageInfo.GetBottomMarginMils();
if( screen->m_ScreenNumber == 1 ) if( screen->m_ScreenNumber == 1 )
{ {
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) 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, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, width,
false, false ); false, false );
pos.x = (Sheet->m_LeftMargin + 1260) * scale; pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
pos.y = (Sheet->m_TopMargin + 270) * scale; pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
DrawGraphicText( m_canvas, DC, pos, Color, DrawGraphicText( m_canvas, DC, pos, Color,
msg, 1800, size2, msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, 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; pos.y = ( refy - WsItem->m_Posy ) * scale;
case WS_SEGMENT: case WS_SEGMENT:
xg = Sheet->m_Size.x - xg = pageSize.x -
Sheet->m_RightMargin - WsItem->m_Endx; pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = Sheet->m_Size.y - yg = pageSize.y -
Sheet->m_BottomMargin - WsItem->m_Endy; pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color ); xg * scale, yg * scale, width, Color );
break; 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.x = ( refx - WsItem->m_Posx ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * scale; pos.y = ( refy - WsItem->m_Posy ) * scale;
msg.Empty(); msg.Empty();
switch( WsItem->m_Type ) switch( WsItem->m_Type )
{ {
case WS_CADRE: case WS_CADRE:
/* Begin list number > 1 */ // Begin list number > 1
msg = screen->m_Commentaire1; msg = screen->m_Commentaire1;
if( !msg.IsEmpty() ) 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, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, width,
false, false ); false, false );
pos.x = (Sheet->m_LeftMargin + 1260) * scale; pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
pos.y = (Sheet->m_TopMargin + 270) * scale; pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
DrawGraphicText( m_canvas, DC, pos, Color, DrawGraphicText( m_canvas, DC, pos, Color,
msg, 1800, size2, msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, 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; pos.y = ( refy - WsItem->m_Posy ) * scale;
case WS_SEGMENT_D: case WS_SEGMENT_D:
xg = Sheet->m_Size.x - xg = pageSize.x -
Sheet->m_RightMargin - WsItem->m_Endx; pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = Sheet->m_Size.y - yg = pageSize.y -
Sheet->m_BottomMargin - WsItem->m_Endy; pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, GRLine( &m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color ); xg * scale, yg * scale, width, Color );
break; break;
} }
} }
} }
#else #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 ) 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: case WS_SIZESHEET:
if( WsItem->m_Legende ) if( WsItem->m_Legende )
msg = WsItem->m_Legende; msg = WsItem->m_Legende;
msg += Sheet->m_Name; msg += pageInfo.GetType();
DrawGraphicText( m_canvas, DC, pos, Color, DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, 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; pos.y = (refy - WsItem->m_Posy) * scale;
case WS_SEGMENT: case WS_SEGMENT:
xg = Sheet->m_Size.x - xg = pageSize.x -
GRID_REF_W - Sheet->m_RightMargin - WsItem->m_Endx; GRID_REF_W - pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = Sheet->m_Size.y - yg = pageSize.y -
GRID_REF_W - Sheet->m_BottomMargin - WsItem->m_Endy; GRID_REF_W - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y, GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color ); xg * scale, yg * scale, width, Color );
break; break;
@ -1583,33 +1607,26 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
} }
/** const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition )
* 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 )
{ {
Ki_PageDescr* Sheet = aScreen->m_CurrentSheetDesc; const PAGE_INFO& pageInfo = GetPageSettings();
int ii, xg, yg, ipas, gxpas, gypas;
int ii;
int xg, yg;
int ipas;
int gxpas, gypas;
int refx, refy; int refx, refy;
wxString msg; wxString msg;
if( Sheet == NULL ) // Upper left corner
{ refx = pageInfo.GetLeftMarginMils();
DisplayError( this, refy = pageInfo.GetTopMarginMils();
wxT( "EDA_DRAW_FRAME::GetXYSheetReferences() error: NULL Sheet" ) );
return msg;
}
refx = Sheet->m_LeftMargin; // lower right corner
refy = Sheet->m_TopMargin; /* Upper left corner */ xg = pageInfo.GetSizeMils().x - pageInfo.GetRightMarginMils();
xg = Sheet->m_Size.x - Sheet->m_RightMargin; yg = pageInfo.GetSizeMils().y - pageInfo.GetBottomMarginMils();
yg = Sheet->m_Size.y - Sheet->m_BottomMargin; /* lower right corner */
/* Get the Y axis identifier (A symbol A ... Z) */ // Get the Y axis identifier (A symbol A ... Z)
if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits
msg << wxT( "?" ); msg << wxT( "?" );
else else
@ -1620,7 +1637,7 @@ wxString EDA_DRAW_FRAME::GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoi
msg.Printf( wxT( "%c" ), 'A' + ii ); 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 if( aPosition.x < refx || aPosition.x > xg ) // Ouside of X limits
msg << wxT( "?" ); msg << wxT( "?" );
else else

View File

@ -87,7 +87,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
SetIcon( icon ); SetIcon( icon );
SetBoard( new BOARD() ); SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN() ); SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
LoadSettings(); LoadSettings();

View File

@ -119,7 +119,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
for( unsigned ii = 0; ii < list.GetCount(); ii++ ) for( unsigned ii = 0; ii < list.GetCount(); ii++ )
{ {
FOOTPRINT_INFO & footprint = list.GetItem(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) ); GetChars(footprint.m_Module) );
m_FullFootprintList.Add( msg ); m_FullFootprintList.Add( msg );
} }

View File

@ -605,7 +605,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
wxString msg; 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( msg, 0 );
SetStatusText( wxEmptyString, 1 ); SetStatusText( wxEmptyString, 1 );
@ -614,10 +614,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
if( m_FootprintList->m_UseFootprintFullList ) if( m_FootprintList->m_UseFootprintFullList )
msg.Printf( _( "Footprints (All): %d" ), msg.Printf( _( "Footprints (All): %d" ),
m_FootprintList->m_ActiveFootprintList->GetCount() ); (int) m_FootprintList->m_ActiveFootprintList->GetCount() );
else else
msg.Printf( _( "Footprints (filtered): %d" ), msg.Printf( _( "Footprints (filtered): %d" ),
m_FootprintList->m_ActiveFootprintList->GetCount() ); (int) m_FootprintList->m_ActiveFootprintList->GetCount() );
} }
else else
{ {

View File

@ -199,7 +199,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
{ {
int tmpzoom; int tmpzoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Sheet size in internal units wxSize sheetSize; // Sheet size in internal units
wxPoint old_org; wxPoint old_org;
bool success = true; 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_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.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 ); screen->SetScalingFactor( 1.0 );
EDA_DRAW_PANEL* panel = frame->GetCanvas(); EDA_DRAW_PANEL* panel = frame->GetCanvas();
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed LOCALE_IO toggle;
// to print floating point numbers like 1.3)
float dpi = (float) frame->GetInternalUnits(); 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(); EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );
@ -234,11 +233,9 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness ); frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->SetClipBox( tmp ); panel->SetClipBox( tmp );
GRForceBlackPen( false ); GRForceBlackPen( false );
screen->m_StartVisu = tmp_startvisu; screen->m_StartVisu = tmp_startvisu;

View File

@ -4,7 +4,6 @@
class EDA_DRAW_FRAME; class EDA_DRAW_FRAME;
class BASE_SCREEN;
#include "dialog_SVG_print_base.h" #include "dialog_SVG_print_base.h"

View File

@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{ {
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
strCur.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, GetChars( msg ) ); 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 ) ); strCur.Printf( wxT( "%c%s)" ), s_ExportSeparatorSymbol, GetChars( msg ) );
#else #else
fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) ); 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, fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
TO_UTF8( msg ) ); TO_UTF8( msg ) );
#endif #endif
@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
else else
{ {
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) ); 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 ) ); fprintf( f, " (loc %s)", TO_UTF8( msg ) );
} }
} }
@ -1060,7 +1060,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
{ {
msg = aList[ii].GetSheetPath().PathHumanReadable(); msg = aList[ii].GetSheetPath().PathHumanReadable();
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) ); 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 ) ); fprintf( f, " (loc %s)", TO_UTF8( msg ) );
} }
} }

View File

@ -63,11 +63,11 @@ private:
void initDlg(); void initDlg();
void initOptVars(); void initOptVars();
void CreateDXFFile(); void CreateDXFFile();
void PlotOneSheetDXF( const wxString& FileName, void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen,
SCH_SCREEN* screen, Ki_PageDescr* sheet,
wxPoint plot_offset, double scale ); 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_plotColorOpt = false;
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true; 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_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
wxString PlotFileName; wxString plotFileName;
Ki_PageDescr* PlotSheet;
wxPoint plot_offset; wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. /* 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(); sheetpath = SheetList.GetNext();
} }
PlotSheet = screen->m_CurrentSheetDesc;
double scale = 10; double scale = 10;
plot_offset.x = 0; plot_offset.x = 0;
plot_offset.y = 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 ) if( !m_select_PlotAll )
break; break;
@ -208,12 +206,12 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset, wxPoint plot_offset,
double scale ) double scale )
{ {
wxString msg;
wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
@ -227,13 +225,17 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) ); msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
SetLocaleTo_C_standard(); LOCALE_IO toggle;
DXF_PLOTTER* plotter = new DXF_PLOTTER(); 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_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( m_plotColorOpt ); plotter->set_color_mode( m_plotColorOpt );
/* Init : */ // Init :
plotter->set_creator( wxT( "Eeschema-DXF" ) ); plotter->set_creator( wxT( "Eeschema-DXF" ) );
plotter->set_filename( FileName ); plotter->set_filename( FileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
@ -246,10 +248,9 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
screen->Plot( plotter ); screen->Plot( plotter );
/* fin */ // finish
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) ); m_MsgBox->AppendText( wxT( "Ok\n" ) );
} }

View File

@ -39,7 +39,8 @@
#include "dialog_plot_schematic_HPGL_base.h" #include "dialog_plot_schematic_HPGL_base.h"
enum PageFormatReq
enum HPGL_PAGEZ_T
{ {
PAGE_DEFAULT = 0, PAGE_DEFAULT = 0,
PAGE_SIZE_A4, PAGE_SIZE_A4,
@ -51,26 +52,34 @@ enum PageFormatReq
PAGE_SIZE_B, PAGE_SIZE_B,
PAGE_SIZE_C, PAGE_SIZE_C,
PAGE_SIZE_D, 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, const wxChar* ret;
&g_Sheet_A4,
&g_Sheet_A3, switch( aSize )
&g_Sheet_A2, {
&g_Sheet_A1, default:
&g_Sheet_A0, case PAGE_DEFAULT: ret = NULL; break;
&g_Sheet_A, case PAGE_SIZE_A4: ret = wxT( "A4" ); break;
&g_Sheet_B, case PAGE_SIZE_A3: ret = wxT( "A3" ); break;
&g_Sheet_C, case PAGE_SIZE_A2: ret = wxT( "A2" ); break;
&g_Sheet_D, case PAGE_SIZE_A1: ret = wxT( "A1" ); break;
&g_Sheet_E, case PAGE_SIZE_A0: ret = wxT( "A0" ); break;
&g_Sheet_GERBER, case PAGE_SIZE_A: ret = wxT( "A" ); break;
&g_Sheet_user 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 class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE
{ {
private: private:
@ -80,8 +89,10 @@ public:
DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ); DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
private: private:
static PageFormatReq m_pageSizeSelect; static HPGL_PAGEZ_T s_pageSizeSelect;
static bool m_plot_Sheet_Ref; static bool s_plot_Sheet_Ref;
static wxSize s_Offset;
bool m_select_PlotAll; bool m_select_PlotAll;
private: private:
@ -97,16 +108,18 @@ private:
void SetPenWidth(); void SetPenWidth();
void SetPageOffsetValue(); void SetPageOffsetValue();
void HPGL_Plot( bool aPlotAll ); void HPGL_Plot( bool aPlotAll );
void Plot_Schematic_HPGL( bool aPlotAll, int HPGL_SheetSize ); void Plot_Schematic_HPGL( bool aPlotAll );
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_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 ) 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::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) :
:DIALOG_PLOT_SCHEMATIC_HPGL_BASE(parent) DIALOG_PLOT_SCHEMATIC_HPGL_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
initDlg(); initDlg();
@ -130,16 +143,14 @@ DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent )
void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg() void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg()
{ {
SetFocus(); // Make ESC key work
SetFocus(); // Make ESC key working
// Set validators // Set validators
m_SizeOption->SetSelection( m_pageSizeSelect ); m_SizeOption->SetSelection( s_pageSizeSelect );
AddUnitSymbol( *m_penWidthTitle, g_UserUnit ); AddUnitSymbol( *m_penWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam, EESCHEMA_INTERNAL_UNIT ); PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam, EESCHEMA_INTERNAL_UNIT );
m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed ); m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed );
m_penNumCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Num ); 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 ); HPGL_Plot( true );
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event ) void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( 0 ); EndModal( 0 );
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue() void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
{ {
wxString msg; wxString msg;
m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection(); s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
if( m_pageSizeSelect != PAGE_DEFAULT )
if( s_pageSizeSelect != PAGE_DEFAULT )
{ {
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
Plot_sheet_list[m_pageSizeSelect]->m_Offset.x, s_Offset.x,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_X->SetValue( msg ); m_PlotOrgPosition_X->SetValue( msg );
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
Plot_sheet_list[m_pageSizeSelect]-> m_Offset.y, s_Offset.y,
EESCHEMA_INTERNAL_UNIT ); EESCHEMA_INTERNAL_UNIT );
m_PlotOrgPosition_Y->SetValue( msg ); m_PlotOrgPosition_Y->SetValue( msg );
m_PlotOrgPosition_X->Enable( TRUE ); m_PlotOrgPosition_X->Enable( TRUE );
@ -187,16 +204,17 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event ) 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(); 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(); 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( ); SetPenNum( );
SetPenSpeed( ); 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(); 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(); 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 void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
* selected sheet
*/
void DIALOG_PLOT_SCHEMATIC_HPGL::ReturnSheetDims( SCH_SCREEN* screen,
wxSize& SheetSize,
wxPoint& SheetOffset )
{ {
Ki_PageDescr* PlotSheet; wxString plotFileName;
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_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
Ki_PageDescr* PlotSheet;
wxSize SheetSize; wxPoint plotOffset;
wxPoint SheetOffset, PlotOffset;
/* When printing all pages, the printed page is not the current page. /* 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 * in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings) * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets * 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->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount(); m_Parent->SetSheetNumberAndCount();
screen = m_Parent->GetCurrentSheet().LastScreen(); screen = m_Parent->GetCurrentSheet().LastScreen();
if( !screen ) // LastScreen() may return NULL
screen = m_Parent->GetScreen();
} }
else // Should not happen else // Should not happen
return; return;
@ -320,26 +322,28 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll, int HPGL_Sh
sheetpath = SheetList.GetNext(); sheetpath = SheetList.GetNext();
} }
ReturnSheetDims( screen, SheetSize, SheetOffset ); const PAGE_INFO& curPage = screen->GetPageSettings();
/* Calculation of conversion scales. */ PAGE_INFO plotPage = curPage;
if( HPGL_SheetSize )
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
else
PlotSheet = screen->m_CurrentSheetDesc;
/* 10x because Eeschema works in mils, not decimals */ // if plotting on a page size other than curPage
double plot_scale = 10 * (double) PlotSheet->m_Size.x / (double) SheetSize.x; if( s_pageSizeSelect != PAGE_DEFAULT )
plotPage.SetType( plot_sheet_list( s_pageSizeSelect ) );
/* Calculate offsets */ // Calculation of conversion scales.
PlotOffset.x = -SheetOffset.x;
PlotOffset.y = -SheetOffset.y;
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(); // Calculate offsets
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale ); plotOffset.x = -s_Offset.x;
SetLocaleTo_Default(); 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 ) if( !aPlotAll )
break; break;
@ -353,7 +357,7 @@ 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, void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
Ki_PageDescr* sheet, const PAGE_INFO& pageInfo,
wxPoint& offset, wxPoint& offset,
double plot_scale ) double plot_scale )
{ {
@ -370,15 +374,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
return; return;
} }
SetLocaleTo_C_standard(); LOCALE_IO toggle;
msg.Printf( _( "Plot: %s " ), FileName.GetData() ); msg.Printf( _( "Plot: %s " ), FileName.GetData() );
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
HPGL_PLOTTER* plotter = new HPGL_PLOTTER(); HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->set_paper_size( sheet );
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( offset, plot_scale, 0 ); plotter->set_viewport( offset, plot_scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness ); plotter->set_default_line_width( g_DrawDefaultLineThickness );
/* Init : */
// Init :
plotter->set_creator( wxT( "Eeschema-HPGL" ) ); plotter->set_creator( wxT( "Eeschema-HPGL" ) );
plotter->set_filename( FileName ); plotter->set_filename( FileName );
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed ); 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 ); plotter->set_color( BLACK );
if( m_plot_Sheet_Ref ) if( s_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen ); m_Parent->PlotWorkSheet( plotter, screen );
screen->Plot( plotter ); screen->Plot( plotter );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) ); 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 ) void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event )
{ {
m_pageSizeSelect = (PageFormatReq) m_SizeOption->GetSelection(); s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
SetPageOffsetValue(); SetPageOffsetValue();
} }

View File

@ -70,12 +70,13 @@ private:
void initOptVars(); void initOptVars();
void createPSFile(); void createPSFile();
void plotOneSheetPS( const wxString& FileName, void plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen, Ki_PageDescr* sheet, SCH_SCREEN* screen, const PAGE_INFO& pageInfo,
wxPoint plot_offset, double scale ); 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; 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; bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
@ -176,8 +177,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxString plotFileName; wxString plotFileName;
Ki_PageDescr* actualPage; // page size selected in schematic PAGE_INFO actualPage; // page size selected in schematic
Ki_PageDescr* plotPage; // page size selected to plot PAGE_INFO plotPage; // page size selected to plot
wxPoint plot_offset; wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. /* When printing all pages, the printed page is not the current page.
@ -213,16 +214,16 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
sheetpath = SheetList.GetNext(); sheetpath = SheetList.GetNext();
} }
actualPage = screen->m_CurrentSheetDesc; actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect ) switch( m_pageSizeSelect )
{ {
case PAGE_SIZE_A: case PAGE_SIZE_A:
plotPage = &g_Sheet_A; plotPage.SetType( wxT( "A" ) );
break; break;
case PAGE_SIZE_A4: case PAGE_SIZE_A4:
plotPage = &g_Sheet_A4; plotPage.SetType( wxT( "A4" ) );
break; break;
case PAGE_SIZE_AUTO: case PAGE_SIZE_AUTO:
@ -231,8 +232,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break; break;
} }
double scalex = (double) plotPage->m_Size.x / actualPage->m_Size.x; double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage->m_Size.y / actualPage->m_Size.y; double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = 10 * MIN( scalex, scaley ); double scale = 10 * MIN( scalex, scaley );
plot_offset.x = 0; plot_offset.x = 0;
@ -254,7 +256,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
Ki_PageDescr* sheet, const PAGE_INFO& pageInfo,
wxPoint plot_offset, wxPoint plot_offset,
double scale ) double scale )
{ {
@ -276,12 +278,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
m_MsgBox->AppendText( msg ); m_MsgBox->AppendText( msg );
PS_PLOTTER* plotter = new PS_PLOTTER(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( sheet ); plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 ); plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness ); plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode( m_plotColorOpt ); plotter->set_color_mode( m_plotColorOpt );
/* Init : */ // Init :
plotter->set_creator( wxT( "Eeschema-PS" ) ); plotter->set_creator( wxT( "Eeschema-PS" ) );
plotter->set_filename( FileName ); plotter->set_filename( FileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );

View File

@ -95,7 +95,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() ); m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
#ifdef __WXMAC__ #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(); m_buttonPreview->Hide();
#endif #endif
} }
@ -310,7 +310,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
{ {
int oldZoom; int oldZoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Page size in internal units wxSize pageSizeIU; // Page size in internal units
wxPoint old_org; wxPoint old_org;
EDA_RECT oldClipBox; EDA_RECT oldClipBox;
wxRect fitRect; wxRect fitRect;
@ -320,10 +320,11 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxBusyCursor dummy; wxBusyCursor dummy;
/* Save current scale factor, offsets, and clip box. */ // Save current scale factor, offsets, and clip box.
tmp_startvisu = aScreen->m_StartVisu; tmp_startvisu = aScreen->m_StartVisu;
oldZoom = aScreen->GetZoom(); oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg; old_org = aScreen->m_DrawOrg;
oldClipBox = *panel->GetClipBox(); oldClipBox = *panel->GetClipBox();
// Change clip box to print the whole page. // Change clip box to print the whole page.
@ -336,9 +337,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
if( printReference ) if( printReference )
{ {
/* Draw the page to a memory and let the dc calculate the drawing // Draw the page to a memory and let the dc calculate the drawing limits.
* limits.
*/
wxBitmap psuedoBitmap( 1, 1 ); wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC; wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap ); memDC.SelectObject( psuedoBitmap );
@ -348,16 +347,17 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ), wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() ); memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
SheetSize.x = memDC.MaxX() - memDC.MinX(); pageSizeIU.x = memDC.MaxX() - memDC.MinX();
SheetSize.y = memDC.MaxY() - memDC.MinY(); pageSizeIU.y = memDC.MaxY() - memDC.MinY();
FitThisSizeToPageMargins( SheetSize, parent->GetPageSetupData() ); FitThisSizeToPageMargins( pageSizeIU, parent->GetPageSetupData() );
fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() ); fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() );
} }
else else
{ {
SheetSize = aScreen->m_CurrentSheetDesc->m_Size; pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
FitThisSizeToPaper( SheetSize );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect(); fitRect = GetLogicalPaperRect();
} }

View File

@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break; break;
/* Hotkey IDs */ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR: case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr ); InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr );
break; break;
@ -145,7 +145,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break; break;
/* Hotkey IDs */ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr ); ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr );
break; break;
@ -267,7 +267,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
NET_TYPE_PCBNEW, NET_TYPE_PCBNEW,
NET_TYPE_CUSTOM_MAX ) ); 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" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ),
&g_HPGL_Pen_Descr.m_Pen_Speed, &g_HPGL_Pen_Descr.m_Pen_Speed,
20, 2, 45 ) ); 20, 2, 45 ) );
@ -277,6 +277,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ),
&g_HPGL_Pen_Descr.m_Pen_Num, &g_HPGL_Pen_Descr.m_Pen_Num,
1, 1, 8 ) ); 1, 1, 8 ) );
/* these globals don't exist
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ),
&g_Sheet_A4.m_Offset.x ) ); &g_Sheet_A4.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ), 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 ) ); &g_Sheet_E.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ),
&g_Sheet_E.m_Offset.y ) ); &g_Sheet_E.m_Offset.y ) );
*/
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ), m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x, &g_RepeatStep.x,
0, -1000, +1000 ) ); 0, -1000, +1000 ) );
@ -362,7 +366,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
IsRead = false; 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 ); wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 );
/* If the list is void, force loading the library "power.lib" that is /* If the list is void, force loading the library "power.lib" that is
@ -382,7 +386,7 @@ void SCH_EDIT_FRAME::SaveProjectFile()
{ {
wxFileName fn; wxFileName fn;
fn = g_RootSheet->GetScreen()->GetFileName(); /*ConfigFileName*/ fn = g_RootSheet->GetScreen()->GetFileName(); //ConfigFileName
fn.SetExt( ProjectFileExtension ); fn.SetExt( ProjectFileExtension );
if( !IsWritable( fn ) ) if( !IsWritable( fn ) )
@ -528,7 +532,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true ); cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
/* Load print preview window session settings. */ // Load print preview window session settings.
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
m_previewPosition.x = (int) tmp; m_previewPosition.x = (int) tmp;
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 ); cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
@ -538,7 +542,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 ); cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
m_previewSize.SetHeight( (int) tmp ); m_previewSize.SetHeight( (int) tmp );
/* Load print dialog session settings. */ // Load print dialog session settings.
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 ); cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
m_printDialogPosition.x = (int) tmp; m_printDialogPosition.x = (int) tmp;
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 ); cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
@ -552,7 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false ); cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand ); cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
/* Load find dialog session setting. */ // Load find dialog session setting.
cfg->Read( FindDialogPositionXEntry, &tmp, -1 ); cfg->Read( FindDialogPositionXEntry, &tmp, -1 );
m_findDialogPosition.x = (int) tmp; m_findDialogPosition.x = (int) tmp;
cfg->Read( FindDialogPositionYEntry, &tmp, -1 ); cfg->Read( FindDialogPositionYEntry, &tmp, -1 );
@ -568,7 +572,7 @@ void SCH_EDIT_FRAME::LoadSettings()
m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) ); m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) );
m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, 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++ ) for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ )
{ {
wxString tmpHistory; wxString tmpHistory;
@ -619,13 +623,13 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( ShowHiddenPinsEntry, m_showAllPins ); cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines ); 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( PreviewFramePositionXEntry, m_previewPosition.x );
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y ); cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() ); cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() ); cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
/* Save print dialog session settings. */ // Save print dialog session settings.
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x ); cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y ); cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() ); cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
@ -635,7 +639,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames ); cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
cfg->Write( SimulatorCommandEntry, m_simulatorCommand ); cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
/* Save find dialog session setting. */ // Save find dialog session setting.
cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x ); cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x );
cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y ); cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y );
cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() ); cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() );
@ -647,7 +651,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() ); cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() );
cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() ); 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; size_t i;
wxString tmpHistory; wxString tmpHistory;
wxString entry; // invoke constructor outside of any loops wxString entry; // invoke constructor outside of any loops

View File

@ -244,7 +244,10 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
if( 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->SetZoom( 32 );
screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
screen->m_Title = NAMELESS_PROJECT; screen->m_Title = NAMELESS_PROJECT;

View File

@ -68,18 +68,35 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
/* Give a size to the SVG draw area = component size + margin #if 0 // would the PAGE_INFO margins work for this old code:
* the margin is 10% the size of the component size
*/ // 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 pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize(); wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box // Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2); componentSize.x = (int)(componentSize.x * 1.2);
componentSize.y = (int)(componentSize.y * 1.2); componentSize.y = (int)(componentSize.y * 1.2);
GetScreen()->SetPageSize( componentSize ); GetScreen()->SetPageSize( componentSize );
SVG_Print_Component( FullFileName ); SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize ); 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; break;
} }
@ -116,7 +133,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode
if( ! m_component ) if( ! m_component )
return; return;
wxSize pagesize = GetScreen()->ReturnPageSize(); wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
/* Plot item centered to the page /* Plot item centered to the page
* In libedit, the component is centered at 0,0 coordinates. * In libedit, the component is centered at 0,0 coordinates.
* So we must plot it with an offset = pagesize/2. * So we must plot it with an offset = pagesize/2.

View File

@ -210,7 +210,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
SetIcon( icon ); SetIcon( icon );
SetScreen( new SCH_SCREEN() ); SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; GetScreen()->m_Center = true;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadSettings(); 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() void LIB_EDIT_FRAME::LoadSettings()
{ {
wxConfig* cfg; wxConfig* cfg;
@ -377,8 +412,11 @@ double LIB_EDIT_FRAME::BestZoom()
} }
else else
{ {
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
dx = pageInfo.GetSizeIU().x;
dy = pageInfo.GetSizeIU().y;
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) ); GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
} }

View File

@ -257,7 +257,17 @@ public:
double BestZoom(); // Returns the best zoom double BestZoom(); // Returns the best zoom
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); 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 ); void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );

View File

@ -48,7 +48,7 @@
#include "sch_bitmap.h" #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 ); static void LoadLayers( LINE_READER* aLine );
@ -300,45 +300,20 @@ static void LoadLayers( LINE_READER* aLine )
/* Read the schematic header. */ /* 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]; char buf[1024];
int ii; wxSize pageSize;
Ki_PageDescr* wsheet = &g_Sheet_A4; char* line = aLine->Line();
wxSize PageSize;
char* line;
static Ki_PageDescr* SheetFormatList[] = sscanf( line, "%s %s %d %d", text, text, &pageSize.x, &pageSize.y );
{
&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
};
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 ); if( !pageInfo.SetType( pagename ) )
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 )
{ {
aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \ aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ), line %d, \aAbort reading file.\n" ),
@ -346,7 +321,13 @@ line %d, \aAbort reading file.\n" ),
aMsgDiag << FROM_UTF8( line ); aMsgDiag << FROM_UTF8( line );
} }
aScreen->m_CurrentSheetDesc = wsheet; if( pagename == wxT( "User" ) )
{
pageInfo.SetWidthMils( pageSize.x );
pageInfo.SetHeightMils( pageSize.y );
}
aScreen->SetPageSettings( pageInfo );
for( ; ; ) for( ; ; )
{ {

View File

@ -97,12 +97,15 @@ static GRID_TYPE SchematicGridList[] = {
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / sizeof( GRID_TYPE ) ) #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; size_t i;
SetDrawItems( NULL ); /* Schematic items list */ SetDrawItems( NULL ); // Schematic items list
m_Zoom = 32;
SetZoom( 32 );
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ ) for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( SchematicZoomList[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++ ) for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] ); AddGrid( SchematicGridList[i] );
SetGrid( wxRealPoint( 50, 50 ) ); /* Default grid size. */ SetGrid( wxRealPoint( 50, 50 ) ); // Default grid size.
m_refCount = 0; m_refCount = 0;
m_Center = false; /* Suitable for schematic only. For
* libedit and viewlib, must be set // Suitable for schematic only. For libedit and viewlib, must be set to true
* to true */ m_Center = false;
InitDatas();
InitDataPoints( m_paper.GetSizeIU() );
} }
@ -571,8 +575,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* sheet ( ScreenNumber = 1 ) within the files * sheet ( ScreenNumber = 1 ) within the files
*/ */
if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_CurrentSheetDesc->m_Name ), if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_paper.GetType() ),
m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0 m_paper.GetWidthMils(), m_paper.GetHeightMils() ) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0 || fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0 || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 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 ) 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() ); aPlotter->set_current_line_width( item->GetPenSize() );
item->Plot( aPlotter ); item->Plot( aPlotter );
@ -1547,3 +1551,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
return count; 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

View File

@ -241,6 +241,8 @@ typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PINS;
*/ */
class SCH_SHEET : public SCH_ITEM class SCH_SHEET : public SCH_ITEM
{ {
friend class SCH_SHEET_PIN;
/// Screen that contains the physical data for the sheet. In complex hierarchies /// Screen that contains the physical data for the sheet. In complex hierarchies
/// multiple sheets can share a common screen. /// multiple sheets can share a common screen.
SCH_SCREEN* m_screen; SCH_SCREEN* m_screen;
@ -268,8 +270,6 @@ class SCH_SHEET : public SCH_ITEM
/// The size of the sheet. /// The size of the sheet.
wxSize m_size; wxSize m_size;
friend class SCH_SHEET_PIN;
public: public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );

View File

@ -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() void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
@ -489,8 +522,8 @@ double SCH_EDIT_FRAME::BestZoom()
int dx, dy; int dx, dy;
wxSize size; wxSize size;
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; dx = GetScreen()->GetPageSettings().GetWidthIU();
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; dy = GetScreen()->GetPageSettings().GetHeightIU();
size = m_canvas->GetClientSize(); size = m_canvas->GetClientSize();

View File

@ -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 ) void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
SaveSettings(); SaveSettings();

View File

@ -34,12 +34,11 @@
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include "wxstruct.h" #include "wxstruct.h"
#include "class_sch_screen.h"
class wxSashLayoutWindow; class wxSashLayoutWindow;
class wxListBox; class wxListBox;
class wxSemaphore; class wxSemaphore;
class SCH_SCREEN;
class CMP_LIBRARY; class CMP_LIBRARY;
@ -108,7 +107,17 @@ public:
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( 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 ); void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );

View File

@ -29,10 +29,12 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "gerbview.h" #include "gerbview.h"
#include "dialog_show_page_borders.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::DIALOG_PAGE_SHOW_PAGE_BORDERS( GERBVIEW_FRAME *parent) :
DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE( parent, wxID_ANY ) 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() ) 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( curPaperType == g_GerberPageSizeList[i] )
{ {
m_ShowPageLimits->SetSelection(ii); m_ShowPageLimits->SetSelection( i );
break; break;
} }
} }
@ -73,8 +77,9 @@ void DIALOG_PAGE_SHOW_PAGE_BORDERS::OnOKBUttonClick( wxCommandEvent& event )
int idx = m_ShowPageLimits->GetSelection(); int idx = m_ShowPageLimits->GetSelection();
m_Parent->SetShowBorderAndTitleBlock( (idx > 0) ? true : false ); m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
m_Parent->SetPageSettings( PAGE_INFO( g_GerberPageSizeList[idx] ) );
EndModal( wxID_OK ); EndModal( wxID_OK );
} }

View File

@ -6,6 +6,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "pcbplot.h" #include "pcbplot.h"
@ -38,7 +39,7 @@ void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
DIALOG_DISPLAY_OPTIONS dlg( this ); DIALOG_DISPLAY_OPTIONS dlg( this );
int opt = dlg.ShowModal(); int opt = dlg.ShowModal();
if (opt > 0 ) if( opt > 0 )
m_canvas->Refresh(); m_canvas->Refresh();
} }
@ -61,9 +62,9 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& event )
EndModal( 0 ); EndModal( 0 );
} }
void DIALOG_DISPLAY_OPTIONS::initOptDialog( ) void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
{ {
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 ); m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( m_Parent->GetCursorShape() ? 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 // Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetSelection( DisplayOpt.DisplayPcbTrackFill ? 1 : 0 ); m_OptDisplayLines->SetSelection( DisplayOpt.DisplayPcbTrackFill ? 1 : 0 );
m_OptDisplayFlashedItems->SetSelection( DisplayOpt.DisplayPadFill ? 1 : 0); m_OptDisplayFlashedItems->SetSelection( DisplayOpt.DisplayPadFill ? 1 : 0);
// Show Option Draw polygons // Show Option Draw polygons
m_OptDisplayPolygons->SetSelection( g_DisplayPolygonsModeSketch ? 0 : 1 ); m_OptDisplayPolygons->SetSelection( g_DisplayPolygonsModeSketch ? 0 : 1 );
@ -78,11 +80,13 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
if( m_Parent->GetShowBorderAndTitleBlock() ) 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; break;
} }
} }
@ -91,6 +95,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) ); m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
} }
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
{ {
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
@ -127,8 +132,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
int idx = m_ShowPageLimits->GetSelection(); int idx = m_ShowPageLimits->GetSelection();
m_Parent->SetShowBorderAndTitleBlock( ( idx > 0 ) ? true : false ); m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
PAGE_INFO pageInfo( g_GerberPageSizeList[idx] );
m_Parent->SetPageSettings( pageInfo );
EndModal( 1 ); EndModal( 1 );
} }

View File

@ -156,10 +156,9 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this ); DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
if (dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
m_canvas->Refresh(); m_canvas->Refresh();
} }
break; break;
case ID_GERBVIEW_GLOBAL_DELETE: case ID_GERBVIEW_GLOBAL_DELETE:

View File

@ -29,17 +29,20 @@ COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format; int g_Default_GERBER_Format;
int g_DisplayPolygonsModeSketch; int g_DisplayPolygonsModeSketch;
GERBER_IMAGE* g_GERBER_List[32];
// List of page sizes const wxChar* g_GerberPageSizeList[] = {
Ki_PageDescr* 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
&g_Sheet_GERBER, // Full size page selection, and do not show page limits wxT( "A4" ),
&g_Sheet_GERBER, // Full size page selection, and show page limits wxT( "A3" ),
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, wxT( "A2" ),
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, wxT( "A" ),
NULL // End of list wxT( "B" ),
}; wxT( "C" ),
};
GERBER_IMAGE* g_GERBER_List[32];
IMPLEMENT_APP( EDA_APP ) IMPLEMENT_APP( EDA_APP )

View File

@ -19,8 +19,10 @@ class GERBVIEW_FRAME;
//class BOARD; //class BOARD;
class GERBER_IMAGE; class GERBER_IMAGE;
class Ki_PageDescr; class PAGE_INFO;
/// List of page sizes
extern const wxChar* g_GerberPageSizeList[8];
// Type of photoplotter action: // Type of photoplotter action:
#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen) #define GERB_ACTIVE_DRAW 1 // Activate light (lower pen)
@ -28,12 +30,13 @@ class Ki_PageDescr;
#define GERB_FLASH 3 // Flash #define GERB_FLASH 3 // Flash
typedef enum enum PlotFormat
{ {
FORMAT_HPGL, FORMAT_HPGL,
FORMAT_GERBER, FORMAT_GERBER,
FORMAT_POST FORMAT_POST
} PlotFormat; };
/** /**
* Enum ITEM_VISIBLE * Enum ITEM_VISIBLE
@ -57,8 +60,6 @@ extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt; extern const wxString GerbviewProjectFileExt;
extern const wxString GerbviewProjectFileWildcard; extern const wxString GerbviewProjectFileWildcard;
extern Ki_PageDescr* g_GerberPageSizeList[];
// Interpolation type // Interpolation type
enum Gerb_Interpolation enum Gerb_Interpolation
{ {

View File

@ -29,6 +29,7 @@
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "macros.h"
#include "id.h" #include "id.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
@ -55,7 +56,7 @@ void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
switch( id ) switch( id )
{ {
/* Hotkey IDs */ // Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG: case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr ); ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr );
break; 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() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
@ -102,9 +103,8 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
&DisplayOpt.DisplayPolarCood, &DisplayOpt.DisplayPolarCood,
false ) ); false ) );
// Color select parameters: // Default colors for layers 0 to 31
static const int color_default[32] = // Default values for color layers 0 to 31 static const int color_default[] = {
{
GREEN, BLUE, LIGHTGRAY, MAGENTA, GREEN, BLUE, LIGHTGRAY, MAGENTA,
RED, DARKGREEN, BROWN, MAGENTA, RED, DARKGREEN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, CYAN, LIGHTGRAY, BLUE, GREEN, CYAN,
@ -112,26 +112,35 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
BLUE, BROWN, LIGHTCYAN, RED, BLUE, BROWN, LIGHTCYAN, RED,
MAGENTA, CYAN, BROWN, MAGENTA, MAGENTA, CYAN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, DARKCYAN, LIGHTGRAY, BLUE, GREEN, DARKCYAN,
YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY,
}; };
// List of keywords used as identifiers in config // List of keywords used as identifiers in config.
// they *must* be static const and not temporary created, // They *must* be static const and not temporarily created,
// because the parameter list that use these keywords does not store them, // because the parameter list that use these keywords does not store them,
// just points on them // just points to them.
static const wxChar * keys[32] = static const wxChar* keys[] = {
{
wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"), wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"),
wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"), wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"),
wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"), wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"),
wxT("ColorLayer12"), wxT("ColorLaye13"), wxT("ColorLayer14"), wxT("ColorLayer15") 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]; int* prm = &g_ColorsSettings.m_LayersColors[i];
PARAM_CFG_SETCOLOR * prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[ii], prm, color_default[1] ); PARAM_CFG_SETCOLOR* prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
m_configSettings.push_back( prm_entry ); m_configSettings.push_back( prm_entry );
} }

View File

@ -48,8 +48,9 @@
// Config keywords // Config keywords
const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) ); static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) ); static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
/*************************************/ /*************************************/
@ -83,13 +84,17 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) ); icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
SetIcon( icon ); SetIcon( icon );
SetScreen( new PCB_SCREEN() );
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
SetBoard( new BOARD() ); SetBoard( new BOARD() );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first. GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible. 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(): // Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize(); int pointSize = font.GetPointSize();
@ -209,25 +214,25 @@ void GERBVIEW_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() ); wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
long pageSize_opt; PAGE_INFO pageInfo( wxT( "GERBER" ) );
config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
int imax = 0;
for( ; g_GerberPageSizeList[imax] != NULL; imax++ ) config->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
;
if( pageSize_opt < 0 || pageSize_opt >= imax ) if( m_showBorderAndTitleBlock )
pageSize_opt = 0;
GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt];
if( pageSize_opt > 0 )
{ {
m_showBorderAndTitleBlock = true; wxString pageType;
config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
pageInfo.SetType( pageType );
} }
SetPageSettings( pageInfo );
GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
long tmp; long tmp;
config->Read( GerbviewShowDCodes, &tmp, 1 ); config->Read( cfgShowDCodes, &tmp, 1 );
SetElementVisibility( DCODES_VISIBLE, tmp ); SetElementVisibility( DCODES_VISIBLE, tmp );
// because we have 2 file historues, we must read this one // because we have 2 file historues, we must read this one
@ -254,22 +259,10 @@ void GERBVIEW_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() ); 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. // Save the drill file history list.
// Because we have 2 file histories, we must save this one // Because we have 2 file histories, we must save this one
// in a specific path // in a specific path

View File

@ -68,8 +68,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
GetBoard()->m_NbNodes = 0; GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0; GetBoard()->m_NbNoconnect = 0;
SetScreen( new PCB_SCREEN() ); SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
GetScreen()->Init();
setActiveLayer(FIRST_COPPER_LAYER); setActiveLayer(FIRST_COPPER_LAYER);
m_LayersManager->UpdateLayerIcons(); m_LayersManager->UpdateLayerIcons();
syncLayerBox(); syncLayerBox();

View File

@ -254,9 +254,9 @@ public:
/** /**
* Function SaveCurrentSetupValues * Function SaveCurrentSetupValues
* Save the current setup values in m_settings * saves the current setup values in m_settings.
* saved parameters are parameters that have the .m_Setup member set to * Saved parameters are parameters that have the .m_Setup member set to
* true * true.
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
*/ */
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList ); void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
@ -264,9 +264,9 @@ public:
/** /**
* Function ReadCurrentSetupValues * Function ReadCurrentSetupValues
* Read the current setup values previously saved, from m_settings * reads the current setup values previously saved, from m_settings.
* saved parameters are parameters that have the .m_Setup member set to * Saved parameters are parameters that have the .m_Setup member set to
* true * true.
* @param aList = array of PARAM_CFG_BASE pointers * @param aList = array of PARAM_CFG_BASE pointers
*/ */
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList ); void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );

View File

@ -37,11 +37,10 @@
#include "common.h" #include "common.h"
// Forward declarations: /**
class Ki_PageDescr; * Class GRID_TYPE
* is for grid arrays.
*/
/* Simple class for handling grid arrays. */
class GRID_TYPE class GRID_TYPE
{ {
public: public:
@ -59,7 +58,6 @@ public:
return *this; return *this;
} }
const bool operator==( const GRID_TYPE& item ) const const bool operator==( const GRID_TYPE& item ) const
{ {
return m_Size == item.m_Size && m_Id == item.m_Id; return m_Size == item.m_Size && m_Id == item.m_Id;
@ -72,12 +70,11 @@ typedef std::vector< GRID_TYPE > GRIDS;
/** /**
* Class BASE_SCREEN * 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 class BASE_SCREEN : public EDA_ITEM
{ {
GRIDS m_grids; ///< List of valid grid sizes. 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. wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn. char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
bool m_FlagModified; ///< Indicates current drawing has been modified. bool m_FlagModified; ///< Indicates current drawing has been modified.
@ -94,19 +91,24 @@ class BASE_SCREEN : public EDA_ITEM
*/ */
wxPoint m_crossHairPosition; wxPoint m_crossHairPosition;
double m_Zoom; ///< Current zoom coefficient.
public: 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) wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/ * in user units. (coordinates from last reset position)*/
// Scrollbars management: // Scrollbars management:
int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */ int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */ int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units. wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit = * m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* virtual draw area size in pixels */ * 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 wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device) * view position (upper left corner of device)
@ -120,15 +122,13 @@ public:
bool m_FirstRedraw; bool m_FirstRedraw;
// Undo/redo list of commands // Undo/redo list of commands
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */ 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) */ UNDO_REDO_CONTAINER m_RedoList; ///< Objects list for the redo command (old data)
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth unsigned m_UndoRedoCountMax; ///< undo/Redo command Max depth
/* block control */ // block control
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */ BLOCK_SELECTOR m_BlockLocate; ///< Block description for block commands
/* Page description */
Ki_PageDescr* m_CurrentSheetDesc;
int m_ScreenNumber; int m_ScreenNumber;
int m_NumberOfScreen; int m_NumberOfScreen;
@ -141,11 +141,9 @@ public:
wxString m_Commentaire3; wxString m_Commentaire3;
wxString m_Commentaire4; wxString m_Commentaire4;
/* Grid and zoom values. */
wxPoint m_GridOrigin; wxPoint m_GridOrigin;
wxArrayDouble m_ZoomList; /* Array of standard zoom (i.e. scale) coefficients. */ wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
double m_Zoom; /* Current zoom coefficient. */
bool m_IsPrinting; bool m_IsPrinting;
public: public:
@ -161,24 +159,12 @@ public:
EDA_ITEM* GetCurItem() const { return m_CurrentItem; } EDA_ITEM* GetCurItem() const { return m_CurrentItem; }
/** void InitDataPoints( const wxSize& aPageSizeInternalUnits );
* 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 SetFileName( const wxString& aFileName ) { m_fileName = aFileName; } void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
wxString GetFileName() const { return m_fileName; } wxString GetFileName() const { return m_fileName; }
void SetPageSize( wxSize& aPageSize );
wxSize ReturnPageSize( void );
/** /**
* Function GetInternalUnits * Function GetInternalUnits
* @return the screen units scalar. * @return the screen units scalar.
@ -460,5 +446,4 @@ public:
#endif #endif
}; };
#endif // CLASS_BASE_SCREEN_H_ #endif // CLASS_BASE_SCREEN_H_

View File

@ -9,7 +9,9 @@
#define LAYERSCOLORSBUFFERSIZE 32 #define LAYERSCOLORSBUFFERSIZE 32
#define ITEMSCOLORSBUFFERSIZE 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 class COLORS_DESIGN_SETTINGS
{ {

View File

@ -2,8 +2,8 @@
* @file class_pcb_screen.h * @file class_pcb_screen.h
*/ */
#ifndef __CLASSPCB_SCREEN_H__ #ifndef CLASS_PCB_SCREEN_H_
#define __CLASSPCB_SCREEN_H__ #define CLASS_PCB_SCREEN_H_
#include "class_base_screen.h" #include "class_base_screen.h"
@ -22,21 +22,27 @@ public:
int m_Route_Layer_BOTTOM; int m_Route_Layer_BOTTOM;
public: 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();
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; } PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
void Init();
void SetNextZoom(); void SetNextZoom();
void SetPreviousZoom(); void SetPreviousZoom();
void SetLastZoom(); void SetLastZoom();
virtual int GetInternalUnits( void ); virtual int GetInternalUnits();
/** /**
* Function GetCurItem * Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding * returns the currently selected BOARD_ITEM, overriding
*BASE_SCREEN::GetCurItem(). * BASE_SCREEN::GetCurItem().
* @return BOARD_ITEM* - the one selected, or NULL. * @return BOARD_ITEM* - the one selected, or NULL.
*/ */
BOARD_ITEM* GetCurItem() const BOARD_ITEM* GetCurItem() const
@ -73,5 +79,4 @@ public:
void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ); void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
}; };
#endif // CLASS_PCB_SCREEN_H_
#endif /* __CLASSPCB_SCREEN_H__ */

View File

@ -55,7 +55,7 @@ enum SCH_LINE_TEST_T
}; };
/* Max number of sheets in a hierarchy project: */ /// Max number of sheets in a hierarchy project
#define NB_MAX_SHEET 500 #define NB_MAX_SHEET 500
@ -64,6 +64,15 @@ class SCH_SCREEN : public BASE_SCREEN
int m_refCount; ///< Number of sheets referencing this screen. int m_refCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero. ///< 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<SCH_ITEM> or superior container
/** /**
* Function addConnectedItemsToBlock * Function addConnectedItemsToBlock
* add items connected at \a aPosition to the block pick list. * add items connected at \a aPosition to the block pick list.
@ -77,7 +86,12 @@ class SCH_SCREEN : public BASE_SCREEN
void addConnectedItemsToBlock( const wxPoint& aPosition ); void addConnectedItemsToBlock( const wxPoint& aPosition );
public: public:
SCH_SCREEN( KICAD_T aType = SCH_SCREEN_T );
/**
* Constructor
*/
SCH_SCREEN();
~SCH_SCREEN(); ~SCH_SCREEN();
virtual wxString GetClass() const virtual wxString GetClass() const
@ -85,6 +99,12 @@ public:
return wxT( "SCH_SCREEN" ); 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 DecRefCount();
void IncRefCount(); void IncRefCount();
@ -93,12 +113,10 @@ public:
/** /**
* Function GetDrawItems(). * Function GetDrawItems().
*
* @return - A pointer to the first item in the linked list of draw items. * @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(); } SCH_ITEM* GetDrawItems() const { return m_drawList; }
void SetDrawItems( SCH_ITEM* aItem ) { m_drawList = aItem; }
virtual void SetDrawItems( SCH_ITEM* aItem ) { BASE_SCREEN::SetDrawItems( aItem ); }
/** /**
* Function GetCurItem * Function GetCurItem
@ -449,6 +467,10 @@ public:
* @return The number of items in the pick list. * @return The number of items in the pick list.
*/ */
int UpdatePickList(); int UpdatePickList();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#endif
}; };

View File

@ -32,31 +32,33 @@
#ifndef INCLUDE__COMMON_H_ #ifndef INCLUDE__COMMON_H_
#define INCLUDE__COMMON_H_ #define INCLUDE__COMMON_H_
#include <vector>
#include "wx/wx.h" #include "wx/wx.h"
#include "wx/confbase.h" #include "wx/confbase.h"
#include "wx/fileconf.h" #include "wx/fileconf.h"
class wxAboutDialogInfo; class wxAboutDialogInfo;
/* Flag for special keys */ // Flag for special keys
#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right #define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right
* shift key depressed */ * shift key depressed */
#define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed #define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed
*/ */
#define GR_KB_CTRL 0x40000000 /* CTRL depressed */ #define GR_KB_CTRL 0x40000000 // CTRL depressed
#define GR_KB_ALT 0x80000000 /* ALT depressed */ #define GR_KB_ALT 0x80000000 // ALT depressed
#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT) #define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL) #define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE 0x08000000 /* Middle button mouse #define MOUSE_MIDDLE 0x08000000 /* Middle button mouse
* flag for block commands * flag for block commands
*/ */
// default name for nameless projects /// default name for nameless projects
#define NAMELESS_PROJECT wxT( "noname" ) #define NAMELESS_PROJECT wxT( "noname" )
#define NB_ITEMS 11
/* Pseudo key codes for command panning */ /// Pseudo key codes for command panning
enum pseudokeys { enum pseudokeys {
EDA_PANNING_UP_KEY = 1, EDA_PANNING_UP_KEY = 1,
EDA_PANNING_DOWN_KEY, EDA_PANNING_DOWN_KEY,
@ -69,7 +71,7 @@ enum pseudokeys {
#define ESC 27 #define ESC 27
/* TODO Executable names TODO*/ // TODO Executable names TODO
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#define CVPCB_EXE wxT( "cvpcb.exe" ) #define CVPCB_EXE wxT( "cvpcb.exe" )
#define PCBNEW_EXE wxT( "pcbnew.exe" ) #define PCBNEW_EXE wxT( "pcbnew.exe" )
@ -96,7 +98,7 @@ enum pseudokeys {
#endif #endif
/* Graphic Texts Orientation in 0.1 degree*/ // Graphic Texts Orientation in 0.1 degree
#define TEXT_ORIENT_HORIZ 0 #define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_VERT 900 #define TEXT_ORIENT_VERT 900
@ -111,56 +113,146 @@ enum EDA_UNITS_T {
}; };
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
#define GOST_LEFTMARGIN 800 /* 20mm */ #define GOST_LEFTMARGIN 800 // 20mm
#define GOST_RIGHTMARGIN 200 /* 5mm */ #define GOST_RIGHTMARGIN 200 // 5mm
#define GOST_TOPMARGIN 200 /* 5mm */ #define GOST_TOPMARGIN 200 // 5mm
#define GOST_BOTTOMMARGIN 200 /* 5mm */ #define GOST_BOTTOMMARGIN 200 // 5mm
#endif #endif
/* forward declarations: */ // forward declarations:
class LibNameList; 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: public:
wxSize m_Size; /* page size in 1/1000 inch */ PAGE_INFO( const wxString& aType = wxT( "A3" ) );
wxPoint m_Offset; /* plot offset in 1/1000 inch */ PAGE_INFO( const wxSize& aSizeMils, const wxString& aName );
wxString m_Name;
int m_LeftMargin;
int m_RightMargin;
int m_TopMargin;
int m_BottomMargin;
public: const wxString& GetType() const { return m_type; }
Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
/**
* 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; 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 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 * File extension definitions. Please do not changes these. If a different
@ -188,10 +280,10 @@ extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard; 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; extern wxString g_Prj_Default_Config_FullFilename;
// Name of local configuration file. (<curr projet>.pro) /// Name of local configuration file. (<curr projet>.pro)
extern wxString g_Prj_Config_LocalFilename; extern wxString g_Prj_Config_LocalFilename;
extern EDA_UNITS_T g_UserUnit; ///< display units extern EDA_UNITS_T g_UserUnit; ///< display units
@ -200,7 +292,7 @@ extern EDA_UNITS_T g_UserUnit; ///< display units
extern int g_GhostColor; extern int g_GhostColor;
/* COMMON.CPP */ // COMMON.CPP
/** /**
* Function SetLocaleTo_C_standard * Function SetLocaleTo_C_standard

View File

@ -12,7 +12,7 @@
#define FOOTPRINT_LIBRARY_HEADER_CNT 18 #define FOOTPRINT_LIBRARY_HEADER_CNT 18
// Values for m_DisplayViaMode member: /// Values for m_DisplayViaMode member:
enum VIA_DISPLAY_MODE_T { enum VIA_DISPLAY_MODE_T {
VIA_HOLE_NOT_SHOW = 0, VIA_HOLE_NOT_SHOW = 0,
VIA_SPECIAL_HOLE_SHOW, 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 { enum TRACE_CLEARANCE_DISPLAY_MODE_T {
DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas 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 class DISPLAY_OPTIONS
{ {
public: public:
@ -77,5 +83,4 @@ public:
DISPLAY_OPTIONS(); DISPLAY_OPTIONS();
}; };
#endif // PCBSTRUCT_H #endif // PCBSTRUCT_H

View File

@ -5,15 +5,12 @@
* @file plot_common.h * @file plot_common.h
*/ */
#ifndef __INCLUDE__PLOT_COMMON_H__ #ifndef PLOT_COMMON_H_
#define __INCLUDE__PLOT_COMMON_H__ 1 #define PLOT_COMMON_H_
#include <vector> #include <vector>
#include "drawtxt.h" #include "drawtxt.h"
#include "common.h" // PAGE_INFO
class Ki_PageDescr;
/** /**
* Enum PlotFormat * Enum PlotFormat
@ -27,11 +24,11 @@ enum PlotFormat {
PLOT_FORMAT_DXF PLOT_FORMAT_DXF
}; };
class PLOTTER class PLOTTER
{ {
public: public:
PlotFormat m_PlotType; // type of plot PLOTTER( PlotFormat aPlotType );
public: PLOTTER( PlotFormat aPlotType );
virtual ~PLOTTER() virtual ~PLOTTER()
{ {
@ -47,8 +44,7 @@ public: PLOTTER( PlotFormat aPlotType );
* Function GetPlotterType * Function GetPlotterType
* @return the format of the plot file * @return the format of the plot file
*/ */
PlotFormat GetPlotterType() PlotFormat GetPlotterType() { return m_PlotType; }
{ return m_PlotType; }
virtual bool start_plot( FILE* fout ) = 0; virtual bool start_plot( FILE* fout ) = 0;
virtual bool end_plot() = 0; virtual bool end_plot() = 0;
@ -58,20 +54,18 @@ public: PLOTTER( PlotFormat aPlotType );
negative_mode = _negative; negative_mode = _negative;
} }
virtual void set_color_mode( bool _color_mode ) virtual void set_color_mode( bool _color_mode )
{ {
color_mode = _color_mode; color_mode = _color_mode;
} }
bool get_color_mode() const bool get_color_mode() const
{ {
return color_mode; 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_current_line_width( int width ) = 0;
virtual void set_default_line_width( int width ) = 0; virtual void set_default_line_width( int width ) = 0;
virtual void set_color( int color ) = 0; virtual void set_color( int color ) = 0;
@ -82,13 +76,12 @@ public: PLOTTER( PlotFormat aPlotType );
creator = _creator; creator = _creator;
} }
virtual void set_filename( const wxString& _filename ) virtual void set_filename( const wxString& _filename )
{ {
filename = _filename; filename = _filename;
} }
/// Set the plot offset for the current plotting
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ) = 0; virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ) = 0;
// Standard primitives // Standard primitives
@ -154,27 +147,23 @@ public: PLOTTER( PlotFormat aPlotType );
pen_to( pos, 'U' ); pen_to( pos, 'U' );
} }
void line_to( wxPoint pos ) void line_to( wxPoint pos )
{ {
pen_to( pos, 'D' ); pen_to( pos, 'D' );
} }
void finish_to( wxPoint pos ) void finish_to( wxPoint pos )
{ {
pen_to( pos, 'D' ); pen_to( pos, 'D' );
pen_to( pos, 'Z' ); pen_to( pos, 'Z' );
} }
void pen_finish() void pen_finish()
{ {
// Shortcut // Shortcut
pen_to( wxPoint( 0, 0 ), 'Z' ); pen_to( wxPoint( 0, 0 ), 'Z' );
} }
void text( const wxPoint& aPos, void text( const wxPoint& aPos,
enum EDA_Colors aColor, enum EDA_Colors aColor,
const wxString& aText, const wxString& aText,
@ -210,14 +199,20 @@ protected:
virtual void user_to_device_size( wxSize& size ); virtual void user_to_device_size( wxSize& size );
virtual double user_to_device_size( double size ); virtual double user_to_device_size( double size );
// Plot scale PlotFormat m_PlotType;
/// Plot scale
double plot_scale; double plot_scale;
// Device scale (from decimils to device units)
/// Device scale (from decimils to device units)
double device_scale; double device_scale;
// Plot offset (in decimils)
/// Plot offset (in decimils)
wxPoint plot_offset; wxPoint plot_offset;
// Output file
/// Output file
FILE* output_file; FILE* output_file;
// Pen handling // Pen handling
bool color_mode, negative_mode; bool color_mode, negative_mode;
int default_pen_width; int default_pen_width;
@ -227,17 +222,19 @@ protected:
bool plotMirror; bool plotMirror;
wxString creator; wxString creator;
wxString filename; wxString filename;
Ki_PageDescr* sheet; PAGE_INFO pageInfo;
wxSize paper_size; wxSize paper_size;
}; };
class HPGL_PLOTTER : public PLOTTER 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 start_plot( FILE* fout );
virtual bool end_plot(); virtual bool end_plot();
@ -246,42 +243,41 @@ public: HPGL_PLOTTER() : PLOTTER( PLOT_FORMAT_HPGL )
{ {
// Handy override // Handy override
current_pen_width = wxRound( pen_diameter ); current_pen_width = wxRound( pen_diameter );
}; }
virtual void set_default_line_width( int width ) {}; virtual void set_default_line_width( int width ) {};
virtual void set_dash( bool dashed ); virtual void set_dash( bool dashed );
virtual void set_color( int color ) {}; virtual void set_color( int color ) {};
virtual void set_pen_speed( int speed ) virtual void set_pen_speed( int speed )
{ {
wxASSERT( output_file == 0 ); wxASSERT( output_file == 0 );
pen_speed = speed; pen_speed = speed;
} }
virtual void set_pen_number( int number ) virtual void set_pen_number( int number )
{ {
wxASSERT( output_file == 0 ); wxASSERT( output_file == 0 );
pen_number = number; pen_number = number;
} }
virtual void set_pen_diameter( double diameter ) virtual void set_pen_diameter( double diameter )
{ {
wxASSERT( output_file == 0 ); wxASSERT( output_file == 0 );
pen_diameter = diameter; pen_diameter = diameter;
} }
virtual void set_pen_overlap( double overlap ) virtual void set_pen_overlap( double overlap )
{ {
wxASSERT( output_file == 0 ); wxASSERT( output_file == 0 );
pen_overlap = overlap; pen_overlap = overlap;
} }
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ); 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 rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 ); virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
/* /*
* Function PlotPoly * Function PlotPoly
* Draw a polygon (filled or not) in HPGL format * Draw a polygon (filled or not) in HPGL format
@ -332,13 +328,14 @@ protected:
class PS_PLOTTER : public PLOTTER 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_adjX = 1;
plot_scale_adjY = 1; plot_scale_adjY = 1;
} }
virtual bool start_plot( FILE* fout ); virtual bool start_plot( FILE* fout );
virtual bool end_plot(); virtual bool end_plot();
virtual void set_current_line_width( int width ); virtual void set_current_line_width( int width );
@ -352,7 +349,6 @@ public: PS_PLOTTER() : PLOTTER( PLOT_FORMAT_POST )
plot_scale_adjY = scaleY; plot_scale_adjY = scaleY;
} }
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ); 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 rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, 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 class GERBER_PLOTTER : public PLOTTER
{ {
public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER ) public:
GERBER_PLOTTER() :
PLOTTER( PLOT_FORMAT_GERBER )
{ {
work_file = 0; work_file = 0;
final_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_current_line_width( int width );
virtual void set_default_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_dash( bool dashed ) {};
virtual void set_color( int color ) {}; virtual void set_color( int color ) {};
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ); 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 ); virtual void SetLayerPolarity( bool aPositive );
protected: protected:
void select_aperture( const wxSize& size, void select_aperture( const wxSize& size, APERTURE::Aperture_Type type );
APERTURE::Aperture_Type type );
std::vector<APERTURE>::iterator std::vector<APERTURE>::iterator
get_aperture( const wxSize& size, APERTURE::Aperture_Type type ); get_aperture( const wxSize& size, APERTURE::Aperture_Type type );
@ -487,9 +484,12 @@ protected:
std::vector<APERTURE>::iterator current_aperture; std::vector<APERTURE>::iterator current_aperture;
}; };
class DXF_PLOTTER : public PLOTTER 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; int current_color;
}; };
#endif // __INCLUDE__PLOT_COMMON_H__ #endif // PLOT_COMMON_H_

View File

@ -112,6 +112,13 @@ public:
*/ */
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const; 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 * Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous * sets the m_Pcb member in such as way as to ensure deleting any previous
@ -126,8 +133,6 @@ public:
return m_Pcb; return m_Pcb;
} }
BOARD_DESIGN_SETTINGS* GetDesignSettings();
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
@ -140,10 +145,7 @@ public:
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg ); virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
virtual void UpdateStatusBar(); virtual void UpdateStatusBar();
virtual PCB_SCREEN* GetScreen() const PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
{
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
}
/** /**
* Function BestZoom * Function BestZoom

View File

@ -350,6 +350,20 @@ public:
SCH_SCREEN* GetScreen() const; 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(); virtual wxString GetScreenDesc();
void InstallConfigFrame( wxCommandEvent& event ); void InstallConfigFrame( wxCommandEvent& event );

View File

@ -72,7 +72,7 @@ class EDA_DRAW_PANEL;
class EDA_MSG_PANEL; class EDA_MSG_PANEL;
class BASE_SCREEN; class BASE_SCREEN;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class PAGE_INFO;
class PLOTTER; class PLOTTER;
enum id_librarytype { enum id_librarytype {
@ -363,7 +363,10 @@ public:
*/ */
class EDA_DRAW_FRAME : public EDA_BASE_FRAME 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. ///< Id of active button on the vertical toolbar.
int m_toolId; int m_toolId;
@ -401,9 +404,6 @@ protected:
/// drill, gerber, and component position files. /// drill, gerber, and component position files.
bool m_showOriginAxis; bool m_showOriginAxis;
/// Position of the origin axis.
wxPoint m_originAxisPosition;
/// True shows the drawing border and title block. /// True shows the drawing border and title block.
bool m_showBorderAndTitleBlock; bool m_showBorderAndTitleBlock;
@ -428,15 +428,9 @@ protected:
wxOverlay m_overlay; wxOverlay m_overlay;
#endif #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: protected:
void SetScreen( BASE_SCREEN* aScreen )
{ void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
m_currentScreen = aScreen;
}
/** /**
* Function unitsChangeRefresh * Function unitsChangeRefresh
@ -447,6 +441,7 @@ protected:
*/ */
virtual void unitsChangeRefresh(); virtual void unitsChangeRefresh();
public: public:
EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title, EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
@ -454,9 +449,18 @@ public:
~EDA_DRAW_FRAME(); ~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; } int GetCursorShape() const { return m_cursorShape; }
@ -473,9 +477,10 @@ public:
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
/** /**
* Function GetBaseScreen * Function GetScreen
* is virtual and returns a pointer to a BASE_SCREEN or one of its * returns a pointer to a BASE_SCREEN or one of its
* derivatives. It may be overloaded by derived classes. * 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; }
@ -660,13 +665,12 @@ public:
/** /**
* Function GetXYSheetReferences * Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located * returns the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* @param aPosition = position to identify by YX ref * @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6 * @return a wxString containing the message locator like A3 or B6
* (or ?? if out of page limits) * (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 ); void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;

View File

@ -48,7 +48,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
/* Configuration entry names. */ // Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) ); static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) ); static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) ); 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_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (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_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition 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 EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{ {
wxASSERT( m_Pcb ); wxASSERT( m_Pcb );
@ -134,18 +176,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
if( area.GetWidth() == 0 && area.GetHeight() == 0 ) if( area.GetWidth() == 0 && area.GetHeight() == 0 )
{ {
wxSize pageSize = GetPageSizeIU();
if( m_showBorderAndTitleBlock ) if( m_showBorderAndTitleBlock )
{ {
area.SetOrigin( 0, 0 ); area.SetOrigin( 0, 0 );
area.SetEnd( GetScreen()->ReturnPageSize().x, area.SetEnd( pageSize.x, pageSize.y );
GetScreen()->ReturnPageSize().y );
} }
else else
{ {
area.SetOrigin( -GetScreen()->ReturnPageSize().x / 2, area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
-GetScreen()->ReturnPageSize().y / 2 ); area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
area.SetEnd( GetScreen()->ReturnPageSize().x / 2,
GetScreen()->ReturnPageSize().y / 2 );
} }
} }
@ -153,14 +194,7 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
} }
BOARD_DESIGN_SETTINGS* PCB_BASE_FRAME::GetDesignSettings() double PCB_BASE_FRAME::BestZoom()
{
wxASSERT( m_Pcb );
return m_Pcb ? &m_Pcb->GetDesignSettings() : NULL;
}
double PCB_BASE_FRAME::BestZoom( void )
{ {
int dx, dy; int dx, dy;
@ -203,7 +237,7 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
wxClientDC dc( m_canvas ); 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 ) ) if( !m_canvas->IsPointOnDisplay( aPos ) )
{ {
screen->SetCrossHairPosition( 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 ) void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
{ {
} }

View File

@ -14,7 +14,7 @@
#include "class_pad.h" #include "class_pad.h"
#include "class_colors_design_settings.h" #include "class_colors_design_settings.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "common.h" // PAGE_INFO
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
@ -27,7 +27,7 @@ class D_PAD;
class MARKER_PCB; 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; typedef std::vector< TRACK* > TRACK_PTRS;
@ -174,6 +174,10 @@ private:
BOARD_DESIGN_SETTINGS m_designSettings; BOARD_DESIGN_SETTINGS m_designSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings 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 * Function chainMarkedSegments
@ -534,15 +538,17 @@ public:
*/ */
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings ); 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 * Function SetBoardSettings
* @return the current COLORS_DESIGN_SETTINGS in use * @return the current COLORS_DESIGN_SETTINGS in use
*/ */
COLORS_DESIGN_SETTINGS* GetColorsSettings() const COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; }
{
return m_colorsSettings;
}
/** /**
* Function SetColorsSettings * Function SetColorsSettings
@ -553,7 +559,6 @@ public:
m_colorsSettings = aColorsSettings; m_colorsSettings = aColorsSettings;
} }
/** /**
* Function GetLayerName * Function GetLayerName
* returns the name of the layer given by aLayerIndex. * returns the name of the layer given by aLayerIndex.

View File

@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
text.Empty(); text.Empty();
for( int ii = 0; ii < PADNAMEZ; ii++ ) for( int ii = 0; ii < PADNAMEZ && m_Padname[ii]; ii++ )
{ {
if( !m_Padname[ii] ) // m_Padname is 8 bit KiCad font junk, do not sign extend
break;
// add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
text.Append( (unsigned char) m_Padname[ii] ); text.Append( (unsigned char) m_Padname[ii] );
} }
#endif #endif

View File

@ -119,7 +119,7 @@ public:
int m_ShapeMaxRadius; // radius of the circle containing the pad shape 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_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 static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer) // (mode used to print pads on silkscreen layer)
@ -205,11 +205,11 @@ public:
* sets the rotation angle of the pad. * sets the rotation angle of the pad.
* @param aAngle is tenths of degrees, but will soon be degrees. * @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 * 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; } double GetOrientation() const { return m_Orient; }

View File

@ -197,9 +197,9 @@ public:
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
/** /**
* Function SetDrillValue * Function SetDrill
* sets the drill value for vias. * 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; } void SetDrill( int aDrill ) { m_Drill = aDrill; }

View File

@ -6,6 +6,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "trigo.h" #include "trigo.h"
#include "class_pcb_screen.h" #include "class_pcb_screen.h"
#include "pcbnew.h" #include "pcbnew.h"
@ -25,19 +26,18 @@
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic * Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
* functions ) * functions )
*/ */
static const double PcbZoomList[] = static const double pcbZoomList[] =
{ {
0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0, 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, 10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0,
200.0, 350.0, 500.0, 1000.0, 2000.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. */ // Default grid sizes for PCB editor screens.
static GRID_TYPE PcbGridList[] = static GRID_TYPE pcbGridList[] =
{ {
// predefined grid list in 0.0001 inches // predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) }, { 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 ) } { 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 ) )
PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
/*******************************************************************/ BASE_SCREEN( SCREEN_T )
/* Class PCB_SCREEN: class to handle parametres to display a board */
/********************************************************************/
PCB_SCREEN::PCB_SCREEN() : 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++ ) for( unsigned i = 0; i < DIM( pcbGridList ); ++i )
m_ZoomList.Add( PcbZoomList[i] ); AddGrid( pcbGridList[i] );
for( i = 0; i < PCB_GRID_LIST_CNT; i++ ) // Set the working grid size to a reasonnable value (in 1/10000 inch)
AddGrid( PcbGridList[i] ); SetGrid( wxRealPoint( 500, 500 ) );
SetGrid( wxRealPoint( 500, 500 ) ); /* Set the working grid size to a reasonnable value (in 1/10000 inch) */ m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
Init(); 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() int PCB_SCREEN::GetInternalUnits()
{
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 )
{ {
return PCB_INTERNAL_UNIT; return PCB_INTERNAL_UNIT;
} }
/*************************/
/* class DISPLAY_OPTIONS */
/*************************/
/*
* Handle display options like enable/disable some optional drawings:
*/
DISPLAY_OPTIONS::DISPLAY_OPTIONS() DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{ {
DisplayPadFill = FILLED; DisplayPadFill = FILLED;
@ -126,7 +110,7 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayModEdge = true; DisplayModEdge = true;
DisplayModText = true; DisplayModText = true;
DisplayPcbTrackFill = true; /* false = sketch , true = filled */ DisplayPcbTrackFill = true; // false = sketch , true = filled
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW; m_DisplayViaMode = VIA_HOLE_NOT_SHOW;

View File

@ -226,37 +226,37 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
BASE_SCREEN* screen, BASE_SCREEN* screen,
bool aPrint_Frame_Ref ) bool aPrint_Frame_Ref )
{ {
// const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
LOCALE_IO toggle;
int tmpzoom; int tmpzoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Sheet size in internal units
wxPoint old_org; wxPoint old_org;
bool success = true; bool success = true;
/* Change frames and local settings */ // Change frames and local settings
tmp_startvisu = screen->m_StartVisu; tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom(); tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg; old_org = screen->m_DrawOrg;
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.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 ); screen->SetScalingFactor( 1.0 );
float dpi = (float)m_Parent->GetInternalUnits(); float dpi = (float)m_Parent->GetInternalUnits();
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas(); EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed // paper pageSize is in internal units, either nanometers or deci-mils
// to print floating point numbers like 1.3) wxSize pageSize = m_Parent->GetPageSizeIU();
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
wxSVGFileDC dc( FullFileName, pageSize.x, pageSize.y, dpi );
EDA_RECT tmp = *panel->GetClipBox(); EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true );
s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
// Set clip box to the max size // Set clip box to the max size
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer #define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow // and that allows calculations without overflow
@ -272,7 +272,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters); m_Parent->PrintPage( &dc, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->SetClipBox( tmp ); panel->SetClipBox( tmp );

View File

@ -54,7 +54,8 @@ private:
static bool m_createRpt; // true to create a drill file report static bool m_createRpt; // true to create a drill file report
static int m_createMap; // > 0 to create a map 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(); ~DIALOG_GENDRILL();
private: private:

View File

@ -299,7 +299,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadOrientCtrl->SetValue( msg ); m_PadOrientCtrl->SetValue( msg );
// Pad Orient // Pad Orient
switch( m_dummyPad->m_Orient ) switch( int( m_dummyPad->GetOrientation() ) )
{ {
case 0: case 0:
m_PadOrient->SetSelection( 0 ); m_PadOrient->SetSelection( 0 );
@ -314,7 +314,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break; break;
case 1800: case 1800:
case - 1800: case -1800:
m_PadOrient->SetSelection( 3 ); m_PadOrient->SetSelection( 3 );
break; break;
@ -343,7 +343,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break; break;
} }
msg.Printf( wxT( "%d" ), m_dummyPad->m_Orient ); msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
m_PadOrientCtrl->SetValue( msg ); m_PadOrientCtrl->SetValue( msg );
// Type of pad selection // Type of pad selection
@ -493,7 +493,7 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
} }
wxString msg; wxString msg;
msg.Printf( wxT( "%d" ), m_dummyPad->m_Orient ); msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
m_PadOrientCtrl->SetValue( msg ); m_PadOrientCtrl->SetValue( msg );
TransfertDataToPad( m_dummyPad ); 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.x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits );
aPad->m_Offset.y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_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 = m_PadOrientCtrl->GetValue();
msg.ToLong( &orient_value ); msg.ToDouble( &orient_value );
aPad->m_Orient = orient_value;
aPad->SetOrientation( orient_value );
msg = m_PadNumCtrl->GetValue().Left( 4 ); msg = m_PadNumCtrl->GetValue().Left( 4 );
aPad->SetPadName( msg ); aPad->SetPadName( msg );

View File

@ -145,8 +145,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
GetBoard()->ComputeBoundingBox(); GetBoard()->ComputeBoundingBox();
// Save the auxiliary origin for the rest of the module // Save the auxiliary origin for the rest of the module
GencadOffsetX = m_originAxisPosition.x; GencadOffsetX = GetOriginAxisPosition().x;
GencadOffsetY = m_originAxisPosition.y; GencadOffsetY = GetOriginAxisPosition().y;
// No idea on *why* this should be needed... maybe to fix net names? // No idea on *why* this should be needed... maybe to fix net names?
Compile_Ratsnest( NULL, true ); Compile_Ratsnest( NULL, true );

View File

@ -20,7 +20,7 @@
void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
Ki_PageDescr* aSheet, const PAGE_INFO& aSheet,
std::vector<HOLE_INFO> aHoleListBuffer, std::vector<HOLE_INFO> aHoleListBuffer,
std::vector<DRILL_TOOL> aToolListBuffer, std::vector<DRILL_TOOL> aToolListBuffer,
bool aUnit_Drill_is_Inch, int format, bool aUnit_Drill_is_Inch, int format,
@ -37,8 +37,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
wxPoint offset; wxPoint offset;
wxString msg; wxString msg;
PLOTTER* plotter = NULL; PLOTTER* plotter = NULL;
LOCALE_IO toggle; // use standard notation for float numbers
SetLocaleTo_C_standard(); // Use the standard notation for float numbers
// Calculate dimensions and center of PCB // Calculate dimensions and center of PCB
EDA_RECT bbbox = aPcb->ComputeBoundingBox(); EDA_RECT bbbox = aPcb->ComputeBoundingBox();
@ -58,7 +57,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
break; break;
case PLOT_FORMAT_HPGL: /* Scale for HPGL format. */ case PLOT_FORMAT_HPGL: // Scale for HPGL format.
{ {
offset.x = 0; offset.x = 0;
offset.y = 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_number( g_PcbPlotOptions.m_HPGLPenNum );
hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed ); hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
hpgl_plotter->set_pen_overlap( 0 ); hpgl_plotter->set_pen_overlap( 0 );
plotter->set_paper_size( aSheet ); plotter->SetPageSettings( aSheet );
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
} }
break; break;
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
{ {
Ki_PageDescr* SheetPS = &g_Sheet_A4; PAGE_INFO pageA4( wxT( "A4" ) );
wxSize SheetSize; wxSize pageSizeIU = pageA4.GetSizeIU();
SheetSize.x = SheetPS->m_Size.x * U_PCB;
SheetSize.y = SheetPS->m_Size.y * U_PCB; // Keep size for drill legend
/* Keep size for drill legend */ double Xscale = (double) ( pageSizeIU.x * 0.8 ) / dX;
double Xscale = (double) ( SheetSize.x * 0.8 ) / dX; double Yscale = (double) ( pageSizeIU.y * 0.6 ) / dY;
double Yscale = (double) ( SheetSize.y * 0.6 ) / dY;
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
offset.x = (int) ( (double) BoardCentre.x - ( (double) SheetSize.x / 2.0 ) / scale ); offset.x = (int) ( (double) BoardCentre.x - ( (double) pageSizeIU.x / 2.0 ) / scale );
offset.y = (int) ( (double) BoardCentre.y - ( (double) SheetSize.y / 2.0 ) / scale ); offset.y = (int) ( (double) BoardCentre.y - ( (double) pageSizeIU.y / 2.0 ) / scale );
offset.y += SheetSize.y / 8; /* offset to legend */
offset.y += pageSizeIU.y / 8; // offset to legend
PS_PLOTTER* ps_plotter = new PS_PLOTTER; PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter; plotter = ps_plotter;
ps_plotter->set_paper_size( SheetPS ); ps_plotter->SetPageSettings( pageA4 );
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
break; break;
} }
@ -102,7 +101,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale = 1; scale = 1;
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER; DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter; plotter = dxf_plotter;
plotter->set_paper_size( aSheet ); plotter->SetPageSettings( aSheet );
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
break; break;
} }
@ -116,7 +115,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter->set_default_line_width( 10 ); plotter->set_default_line_width( 10 );
plotter->start_plot( aFile ); plotter->start_plot( aFile );
/* Draw items on edge layer */ // Draw items on edge layer
for( PtStruct = aPcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) 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 // Plot board outlines and drill map
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer ); Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer );
/* Print a list of symbols used. */ // Print a list of symbols used.
CharSize = 800; /* text size in 1/10000 mils */ CharSize = 800; // text size in 1/10000 mils
double CharScale = 1.0 / scale; /* real scale will be CharScale double CharScale = 1.0 / scale; /* real scale will be CharScale
* scale_x, because the global * scale_x, because the global
* plot scale is scale_x */ * plot scale is scale_x */
TextWidth = (int) ( (CharSize * CharScale) / 10 ); // Set text width (thickness) TextWidth = (int) ( (CharSize * CharScale) / 10 ); // Set text width (thickness)
intervalle = (int) ( CharSize * CharScale ) + TextWidth; intervalle = (int) ( CharSize * CharScale ) + TextWidth;
/* Trace information. */ // Trace information.
plotX = (int) ( (double) bbbox.GetX() + 200.0 * CharScale ); plotX = (int) ( (double) bbbox.GetX() + 200.0 * CharScale );
plotY = bbbox.GetBottom() + intervalle; plotY = bbbox.GetBottom() + intervalle;
/* Plot title "Info" */ // Plot title "Info"
wxString Text = wxT( "Drill Map:" ); wxString Text = wxT( "Drill Map:" );
plotter->text( wxPoint( plotX, plotY ), BLACK, Text, 0, plotter->text( wxPoint( plotX, plotY ), BLACK, Text, 0,
wxSize( (int) ( CharSize * CharScale ), wxSize( (int) ( CharSize * CharScale ),
@ -188,7 +187,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
y = (int) ( (double) plotY + (double) CharSize * CharScale ); y = (int) ( (double) plotY + (double) CharSize * CharScale );
plotter->marker( wxPoint( x, y ), plot_diam, ii ); 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, // List the diameter of each drill in the selected Drill Unit,
// and then its diameter in the other 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(); plotter->end_plot();
delete plotter; 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; wxPoint pos;
/* create the drill list */ // create the drill list
if( aToolListBuffer.size() > 13 ) if( aToolListBuffer.size() > 13 )
{ {
DisplayInfoMessage( NULL, DisplayInfoMessage( NULL,

View File

@ -93,7 +93,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
FILE* fpBack = 0; FILE* fpBack = 0;
bool switchedLocale = false; bool switchedLocale = false;
File_Place_Offset = m_originAxisPosition; File_Place_Offset = GetOriginAxisPosition();
/* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */ /* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */
int moduleCount = 0; int moduleCount = 0;

View File

@ -635,7 +635,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
GenDrillMapFile( m_Parent->GetBoard(), GenDrillMapFile( m_Parent->GetBoard(),
plotfile, plotfile,
dlg.GetPath(), dlg.GetPath(),
m_Parent->GetScreen()->m_CurrentSheetDesc, m_Parent->GetPageSettings(),
s_HoleListBuffer, s_HoleListBuffer,
s_ToolListBuffer, s_ToolListBuffer,
m_UnitDrillIsInch, m_UnitDrillIsInch,

View File

@ -217,7 +217,7 @@ void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
void GenDrillMapFile( BOARD* aPcb, void GenDrillMapFile( BOARD* aPcb,
FILE* aFile, FILE* aFile,
const wxString& aFullFileName, const wxString& aFullFileName,
Ki_PageDescr* aSheet, const PAGE_INFO& aSheet,
std::vector<HOLE_INFO> aHoleListBuffer, std::vector<HOLE_INFO> aHoleListBuffer,
std::vector<DRILL_TOOL> aToolListBuffer, std::vector<DRILL_TOOL> aToolListBuffer,
bool aUnit_Drill_is_Inch, bool aUnit_Drill_is_Inch,

View File

@ -52,7 +52,7 @@ static void TraceFilledCircle( BOARD* Pcb,
static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
int color, int op_logic ); int color, int op_logic );
/* Macro call to update cell. */ // Macro call to update cell.
#define OP_CELL( layer, dy, dx ) \ #define OP_CELL( layer, dy, dx ) \
{ \ { \
if( layer < 0 ) \ 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; dy += abs( pt_pad->m_DeltaSize.x ) / 2;
} }
if( ( pt_pad->m_Orient % 900 ) == 0 ) /* The pad is a rectangle // The pad is a rectangle horizontally or vertically.
* 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 ) ) if( ( pt_pad->m_Orient == 900 ) || ( pt_pad->m_Orient == 2700 ) )
{ {
EXCHG( dx, dy ); EXCHG( dx, dy );
@ -158,17 +158,17 @@ void TraceFilledCircle( BOARD* Pcb,
int tstwrite = 0; int tstwrite = 0;
int distmin; int distmin;
/* Determine occupied layer. */ // Determine occupied layer.
/* Single routing layer on bitmap and BOTTOM /* Single routing layer on bitmap and BOTTOM
* Route_Layer_B = Route_Layer_A */ * Route_Layer_B = Route_Layer_A */
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
trace = 1; /* Trace on BOTTOM */ trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) if( aLayerMask & GetLayerMask( Route_Layer_TOP ) )
if( Nb_Sides ) if( Nb_Sides )
trace |= 2; /* Trace on TOP */ trace |= 2; // Trace on TOP
if( trace == 0 ) if( trace == 0 )
return; return;
@ -202,13 +202,13 @@ void TraceFilledCircle( BOARD* Pcb,
distmin = radius; distmin = radius;
/* Calculate the bounding rectangle of the circle. */ // Calculate the bounding rectangle of the circle.
ux0 = cx - radius; ux0 = cx - radius;
uy0 = cy - radius; uy0 = cy - radius;
ux1 = cx + radius; ux1 = cx + radius;
uy1 = cy + 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; row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / Board.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting) row_min++; 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) ) if( col_max >= (Ncols - 1) )
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 ) if( row_min > row_max )
row_max = row_min; row_max = row_min;
@ -265,7 +265,7 @@ void TraceFilledCircle( BOARD* Pcb,
* (Adverse event: pad off grid in the center of the 4 neighboring * (Adverse event: pad off grid in the center of the 4 neighboring
* diagonal) */ * diagonal) */
distmin = Board.m_GridRouting / 2 + 1; 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++ ) 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; 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(); ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().GetX();
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().GetY(); uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().GetY();
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().GetX(); ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().GetX();
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().GetY(); 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 ) if( pt_segm->Type() == PCB_VIA_T )
{ {
int mask_layer = 0; 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 ) if( color == VIA_IMPOSSIBLE )
layer = -1; 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 ) if( pt_segm->m_Shape == S_CIRCLE )
{ {
TraceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic ); 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; return;
} }
/* The segment is here a line segment. */ // The segment is here a line segment.
if( ( ux0 != ux1 ) && ( uy0 != uy1 ) ) // Segment tilts. if( ( ux0 != ux1 ) && ( uy0 != uy1 ) ) // Segment tilts.
{ {
DrawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic ); 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; lim = y1 / Board.m_GridRouting;
dx = x0 / Board.m_GridRouting; dx = x0 / Board.m_GridRouting;
/* Clipping limits of board. */ // Clipping limits of board.
if( ( dx < 0 ) || ( dx >= Ncols ) ) if( ( dx < 0 ) || ( dx >= Ncols ) )
return; 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; lim = x1 / Board.m_GridRouting;
dy = y0 / Board.m_GridRouting; dy = y0 / Board.m_GridRouting;
/* Clipping limits of board. */ // Clipping limits of board.
if( ( dy < 0 ) || ( dy >= Nrows ) ) if( ( dy < 0 ) || ( dy >= Nrows ) )
return; return;
@ -441,8 +441,8 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
return; return;
} }
/* Here is some perspective: using the algorithm LUCAS. */ // Here is some perspective: using the algorithm LUCAS.
if( abs( x1 - x0 ) >= abs( y1 - y0 ) ) /* segment slightly inclined/ */ if( abs( x1 - x0 ) >= abs( y1 - y0 ) ) // segment slightly inclined/
{ {
if( x1 < x0 ) 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 ); void (* WriteCell)( int, int, int, MATRIX_CELL );
if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) ) if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) )
trace = 1; /* Trace on BOTTOM */ trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) && Nb_Sides ) if( ( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) && Nb_Sides )
trace |= 2; /* Trace on TOP */ trace |= 2; // Trace on TOP
if( trace == 0 ) if( trace == 0 )
return; return;
@ -563,7 +563,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
ux1 -= Pcb->GetBoundingBox().GetX(); ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY(); 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; row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting; col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / 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 angle, int aLayerMask, int color, int op_logic )
{ {
int row, col; int row, col;
int cx, cy; /* Center of rectangle */ int cx, cy; // Center of rectangle
int radius; /* Radius of the circle */ int radius; // Radius of the circle
int row_min, row_max, col_min, col_max; int row_min, row_max, col_min, col_max;
int rotrow, rotcol; int rotrow, rotcol;
int trace = 0; 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 ); void (* WriteCell)( int, int, int, MATRIX_CELL );
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
trace = 1; /* Trace on BOTTOM */ trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) if( aLayerMask & GetLayerMask( Route_Layer_TOP ) )
{ {
if( Nb_Sides ) if( Nb_Sides )
trace |= 2; /* Trace on TOP */ trace |= 2; // Trace on TOP
} }
if( trace == 0 ) 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 ) radius = (int) sqrt( (double) ( cx - ux0 ) * ( cx - ux0 )
+ (double) ( cy - uy0 ) * ( cy - uy0 ) ); + (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; row_max = ( cy + radius ) / Board.m_GridRouting;
col_max = ( cx + radius ) / Board.m_GridRouting; col_max = ( cx + radius ) / Board.m_GridRouting;
row_min = ( cy - 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; break;
} }
/* Make coordinate ux1 tj > ux0 to simplify calculations */ // Make coordinate ux1 tj > ux0 to simplify calculations
if( ux1 < ux0 ) if( ux1 < ux0 )
{ {
EXCHG( ux1, ux0 ); EXCHG( ux1, ux0 );
EXCHG( uy1, uy0 ); EXCHG( uy1, uy0 );
} }
/* Calculating the incrementing the Y axis */ // Calculating the incrementing the Y axis
inc = 1; inc = 1;
if( uy1 < uy0 ) if( uy1 < uy0 )
@ -819,7 +819,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
angle = -900; 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++ ) 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 ); RotatePoint( &cx, &cy, angle );
if( abs( cy ) > lg ) 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 /* This point a test is close to the segment: the position
* along the X axis must be tested. * 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; continue;
} }
/* Examination of extremities are rounded. */ // Examination of extremities are rounded.
if( ( cx < 0 ) && ( cx >= -lg ) ) if( ( cx < 0 ) && ( cx >= -lg ) )
{ {
if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) ) if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) )

View File

@ -50,21 +50,22 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
SetCurItem( NULL ); SetCurItem( NULL );
/* clear filename, to avoid overwriting an old file */ // clear filename, to avoid overwriting an old file
GetScreen()->GetFileName().Empty(); GetScreen()->GetFileName().Empty();
/* Init new grid size */ // preserve grid size accross call to InitDataPoints()
wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen()->Init(); // wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen()->SetGrid( gridsize ); GetScreen()->InitDataPoints( GetPageSizeIU() );
// GetScreen()->SetGrid( gridsize );
GetBoard()->ResetHighLight(); GetBoard()->ResetHighLight();
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled) // 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 // Default copper layers count set to 2: double layer board
GetBoard()->SetCopperLayerCount(2); GetBoard()->SetCopperLayerCount( 2 );
// Update display: // Update display:
GetBoard()->SetVisibleLayers( ALL_LAYERS ); GetBoard()->SetVisibleLayers( ALL_LAYERS );
@ -99,15 +100,15 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
/* init pointeurs et variables */ // init pointeurs et variables
GetScreen()->GetFileName().Empty(); GetScreen()->GetFileName().Empty();
SetCurItem( NULL ); SetCurItem( NULL );
/* Init parametres de gestion */ // preserve grid size accross call to InitDataPoints()
wxRealPoint gridsize = GetScreen()->GetGridSize(); // wxRealPoint gridsize = GetScreen()->GetGridSize();
GetScreen()->Init(); GetScreen()->InitDataPoints( GetPageSizeIU() );
GetScreen()->SetGrid( gridsize ); // GetScreen()->SetGrid( gridsize );
Zoom_Automatique( false ); Zoom_Automatique( false );

View File

@ -119,6 +119,8 @@ public:
* implementation knows about, or it can be used to write a portion of * implementation knows about, or it can be used to write a portion of
* aBoard to a special kind of export file. * 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 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. * @param aBoard is the BOARD document (data tree) to save or export to disk.
* *

View File

@ -88,6 +88,9 @@
* $Endmodule * $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 int NbDraw, NbTrack, NbZone, NbMod, NbNets;
static const char delims[] = " =\n\r"; static const char delims[] = " =\n\r";
@ -389,8 +392,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( data ) if( data )
gy = atoi( data ); gy = atoi( data );
m_originAxisPosition.x = gx; SetOriginAxisPosition( wxPoint( gx, gy ) );
m_originAxisPosition.y = gy;
continue; continue;
} }
@ -786,7 +788,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
EDA_ITEM* PtStruct = GetBoard()->m_Modules; EDA_ITEM* PtStruct = GetBoard()->m_Modules;
int NbModules, NbDrawItem, NbLayers; int NbModules, NbDrawItem, NbLayers;
/* Write copper layer count */ // Write copper layer count
NbLayers = GetBoard()->GetCopperLayerCount(); NbLayers = GetBoard()->GetCopperLayerCount();
fprintf( File, "$GENERAL\n" ); fprintf( File, "$GENERAL\n" );
fprintf( File, "encoding utf-8\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, "Links %d\n", GetBoard()->GetRatsnestsCount() );
fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect ); fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect );
// Write Bounding box info // Write board's bounding box info
EDA_RECT bbbox = GetBoard()->ComputeBoundingBox(); EDA_RECT bbbox = GetBoard()->ComputeBoundingBox();
fprintf( File, "Di %d %d %d %d\n", fprintf( File, "Di %d %d %d %d\n",
bbbox.GetX(), bbbox.GetX(),
@ -809,8 +811,8 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
bbbox.GetRight(), bbbox.GetRight(),
bbbox.GetBottom() ); bbbox.GetBottom() );
/* Write segment count for footprints, drawings, track and zones */ // Write segment count for footprints, drawings, track and zones
/* Calculate the footprint count */ // Calculate the footprint count
for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Next() )
NbModules++; NbModules++;
@ -836,13 +838,14 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
* @param screen BASE_SCREEN to save * @param screen BASE_SCREEN to save
* @param File = an open FILE to write info * @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, "$SHEETDESCR\n" );
fprintf( File, "Sheet %s %d %d\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, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() ); fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( File, "Rev %s\n", EscapedUTF8( screen->m_Revision ).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 ) #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 buf[1024];
char* text;
while( aReader->ReadLine() ) while( aReader->ReadLine() )
{ {
@ -873,34 +875,45 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
if( strnicmp( line, "Sheet", 4 ) == 0 ) if( strnicmp( line, "Sheet", 4 ) == 0 )
{ {
text = strtok( line, " \t\n\r" ); // e.g. "Sheet A3 16535 11700"
text = strtok( NULL, " \t\n\r" ); // width and height are in 1/1000th of an inch, always
Ki_PageDescr* sheet = g_SheetSizeList[0];
int ii;
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; /* this entire file is soon to be deleted.
m_error.Printf( _( "Unknown sheet type '%s' on line:%d" ),
if( sheet == &g_Sheet_user ) wname.GetData(), m_reader->LineNumber() );
{ THROW_IO_ERROR( m_error );
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; // 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; continue;
} }
@ -1098,7 +1111,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if( TESTLINE( "SHEETDESCR" ) ) if( TESTLINE( "SHEETDESCR" ) )
{ {
ReadSheetDescr( GetScreen(), aReader ); ReadSheetDescr( board, GetScreen(), aReader );
continue; continue;
} }
@ -1162,7 +1175,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// like 1.3) // like 1.3)
LOCALE_IO toggle; LOCALE_IO toggle;
/* Writing file header. */ // Writing file header.
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION, fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION,
TO_UTF8( DateAndTime() ) ); TO_UTF8( DateAndTime() ) );
fprintf( aFile, "# Created by Pcbnew%s\n\n", TO_UTF8( GetBuildVersion() ) ); 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() ); GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
WriteGeneralDescrPcb( aFile ); WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetScreen(), aFile ); WriteSheetDescr( GetBoard()->GetPageSettings(), GetScreen(), aFile );
WriteSetup( aFile, this, GetBoard() ); WriteSetup( aFile, this, GetBoard() );
rc = GetBoard()->Save( aFile ); rc = GetBoard()->Save( aFile );

View File

@ -666,7 +666,7 @@ bool D_PAD::Save( FILE* aFile ) const
break; 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_Padname, cshape, m_Size.x, m_Size.y,
m_DeltaSize.x, m_DeltaSize.y, m_Orient ); m_DeltaSize.x, m_DeltaSize.y, m_Orient );
@ -938,7 +938,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
if( *PtLine == '"' ) if( *PtLine == '"' )
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, BufCar, &m_Size.x, &m_Size.y,
&m_DeltaSize.x, &m_DeltaSize.y, &m_DeltaSize.x, &m_DeltaSize.y,
&m_Orient ); &m_Orient );

View File

@ -98,7 +98,7 @@
/// C string compare test for a specific length of characters. /// 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 /// The -1 is to omit the trailing \0 which is included in sizeof() on a
/// string constant. /// 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 /// Get the length of a string constant, at compile time
#define SZ( x ) (sizeof(x)-1) #define SZ( x ) (sizeof(x)-1)
@ -440,7 +440,6 @@ void KICAD_PLUGIN::loadGENERAL()
void KICAD_PLUGIN::loadSHEET() void KICAD_PLUGIN::loadSHEET()
{ {
char buf[260]; char buf[260];
char* text;
while( READLINE() ) while( READLINE() )
{ {
@ -448,34 +447,42 @@ void KICAD_PLUGIN::loadSHEET()
if( TESTLINE( "Sheet" ) ) if( TESTLINE( "Sheet" ) )
{ {
text = strtok( line, delims ); // e.g. "Sheet A3 16535 11700"
text = strtok( NULL, delims ); // width and height are in 1/1000th of an inch, always
Ki_PageDescr* sheet = g_SheetSizeList[0]; PAGE_INFO page;
int ii; 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; m_error.Printf( _( "Unknown sheet type '%s' on line:%d" ),
wname.GetData(), m_reader->LineNumber() );
if( sheet == &g_Sheet_user ) THROW_IO_ERROR( m_error );
{
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; // 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 );
}
} }
else if( TESTLINE( "Title" ) ) else if( TESTLINE( "Title" ) )
@ -557,10 +564,7 @@ void KICAD_PLUGIN::loadSETUP()
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data ); BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
BIU gy = biuParse( data ); BIU gy = biuParse( data );
/* @todo m_board->SetOriginAxisPosition( wxPoint( gx, gy ) );
m_originAxisPosition.x = gx;
m_originAxisPosition.y = gy;
*/
} }
#if 1 // defined(PCBNEW) #if 1 // defined(PCBNEW)
@ -2729,14 +2733,17 @@ void KICAD_PLUGIN::saveGENERAL() const
void KICAD_PLUGIN::saveSHEET() 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 const PAGE_INFO& pageInfo = m_board->GetPageSettings();
Ki_PageDescr* sheet = screen->m_CurrentSheetDesc;
fprintf( m_fp, "$SHEETDESCR\n" ); fprintf( m_fp, "$SHEETDESCR\n" );
// paper is described in mils
fprintf( m_fp, "Sheet %s %d %d\n", fprintf( m_fp, "Sheet %s %d %d\n",
TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); // in mm ? 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, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( m_fp, "Date %s\n", EscapedUTF8( screen->m_Date ).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() ); 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, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() ); fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
fprintf( m_fp, "$EndSHEETDESCR\n\n" );
#endif #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() ) ); THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_FORMAT, me->GetShape() ) );
} }
// universal character set padname #if BOARD_FORMAT_VERSION == 1 // saving mode is a compile time option
wxString padname = me->GetPadName();
#if BOARD_FORMAT_VERSION == 1 wxString wpadname = me->GetPadName(); // universal character set padname
std::string spadname;
char mypadname[PADNAMEZ+1]; for( unsigned i = 0; wpadname.size(); ++i )
int i;
for( i = 0; i<PADNAMEZ && padname[i]; ++i )
{ {
// truncate from universal character down to 8 bit foreign jibber jabber byte // truncate from universal character down to 8 bit foreign jibber
mypadname[i] = (char) padname[i]; // jabber byte. This basically duplicates what was done in the old
// BOARD_FORMAT_VERSION 1 code. Any characters that were in the 8 bit
// character space were OK.
spadname += (char) wpadname[i];
} }
mypadname[i] = 0;
fprintf( m_fp, "Sh \"%s\" %c %s %s %s\n", fprintf( m_fp, "Sh \"%s\" %c %s %s %s\n",
mypadname, // probably ASCII, but possibly jibber jabber spadname.c_str(), // probably ASCII, but possibly jibber jabber
#else #else
fprintf( m_fp, "Sh %s %c %s %s %s\n", fprintf( m_fp, "Sh %s %c %s %s %s\n",
// legacy VERSION 2 simply uses UTF8, wrapped in quotes,
// and 99.99 % of the time there is no difference between 1 & 2,
// since ASCII is a subset of UTF8. But if they were not using
// ASCII pad names, then there is a difference in the file.
EscapedUTF8( me->GetPadName() ).c_str(), EscapedUTF8( me->GetPadName() ).c_str(),
#endif #endif
cshape, cshape,

View File

@ -371,7 +371,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
if( footprint_names_list.GetCount() ) 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, EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName,
DisplayCmpDoc, GetComponentDialogPosition() ); DisplayCmpDoc, GetComponentDialogPosition() );

View File

@ -70,7 +70,7 @@ private:
* updates d so that the values are correct (goes through target's * updates d so that the values are correct (goes through target's
* neighbours making sure that the distances between them and the tree * neighbours making sure that the distances between them and the tree
* are indeed minimum) * are indeed minimum)
* @param target = index of curr item * @param aTarget = index of curr item
*/ */
void updateDistances( int aTarget ); void updateDistances( int aTarget );

View File

@ -160,7 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
SetBoard( g_ModuleEditor_Pcb ); SetBoard( g_ModuleEditor_Pcb );
if( s_screenModule == NULL ) if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN(); s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
SetScreen( s_screenModule ); SetScreen( s_screenModule );
GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting ); GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting );

View File

@ -423,7 +423,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_PLACE_OFFSET_COORD_BUTT: case ID_PCB_PLACE_OFFSET_COORD_BUTT:
m_canvas->DrawAuxiliaryAxis( aDC, GR_XOR ); m_canvas->DrawAuxiliaryAxis( aDC, GR_XOR );
m_originAxisPosition = GetScreen()->GetCrossHairPosition(); SetOriginAxisPosition( GetScreen()->GetCrossHairPosition() );
m_canvas->DrawAuxiliaryAxis( aDC, GR_COPY ); m_canvas->DrawAuxiliaryAxis( aDC, GR_COPY );
OnModify(); OnModify();
break; break;

View File

@ -317,8 +317,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
SetIcon( icon ); SetIcon( icon );
m_internalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch 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() // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager // 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 m_Layers->ReFillRender(); // Update colors in Render after the config is read
syncLayerWidget(); syncLayerWidget();
m_auimgr.Update(); m_auimgr.Update();
} }

View File

@ -41,7 +41,7 @@
#include "worksheet.h" #include "worksheet.h"
#include "dialog_hotkeys_editor.h" #include "dialog_hotkeys_editor.h"
#include "class_pad.h" #include "class_board.h"
#include "pcbplot.h" #include "pcbplot.h"
#include "pcbnew.h" #include "pcbnew.h"
@ -210,7 +210,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
{ {
PARAM_CFG_ARRAY pca; 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, pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
GROUPLIB ) ); GROUPLIB ) );

View File

@ -17,7 +17,7 @@ class PCB_TARGET;
class ZONE_CONTAINER; 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_LAYERBASE wxT( "PlotLayer_%d" )
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" ) #define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" ) #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_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" ) #define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
/* Conversion unit constants. */ // Conversion unit constants.
/* Convert pcb dimension of 0.1 mil to PS units of inches. */ // Convert pcb dimension of 0.1 mil to PS units of inches.
#define SCALE_PS .0001 #define SCALE_PS .0001
/* Convert dimension 0.1 mil -> HPGL units: */ // Convert dimension 0.1 mil -> HPGL units:
#define SCALE_HPGL 0.102041 #define SCALE_HPGL 0.102041
// Small drill marks diameter value (in internal value = 1/10000 inch) // 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, void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
EDA_DRAW_MODE_T trace_mode ); EDA_DRAW_MODE_T trace_mode );
/* PLOTGERB.CPP */ // PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize ); void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
#endif /* #define PCBPLOT_H */ #endif // #define PCBPLOT_H

View File

@ -18,7 +18,7 @@
bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer, bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
EDA_DRAW_MODE_T aTraceMode ) EDA_DRAW_MODE_T aTraceMode )
{ {
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; LOCALE_IO toggle;
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
@ -27,10 +27,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
return false; return false;
} }
SetLocaleTo_C_standard();
DXF_PLOTTER* plotter = new DXF_PLOTTER(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( currentsheet ); plotter->SetPageSettings( GetPageSettings() );
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 ); plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) ); plotter->set_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( aFullFileName ); plotter->set_filename( aFullFileName );
@ -42,7 +40,5 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
Plot_Layer( plotter, aLayer, aTraceMode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
return true; return true;
} }

View File

@ -35,12 +35,12 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
wxPoint offset; 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; double scale = g_PcbPlotOptions.m_PlotScale;
if( aPlotOriginIsAuxAxis ) if( aPlotOriginIsAuxAxis )
{ {
offset = m_originAxisPosition; offset = GetOriginAxisPosition();
} }
else else
{ {
@ -48,9 +48,11 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
offset.y = 0; offset.y = 0;
} }
SetLocaleTo_C_standard(); LOCALE_IO toggle;
PLOTTER* plotter = new GERBER_PLOTTER(); 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_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) ); plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
@ -78,7 +80,6 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
} }
delete plotter; delete plotter;
SetLocaleTo_Default();
return true; return true;
} }

View File

@ -20,13 +20,12 @@
bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer, bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
EDA_DRAW_MODE_T aTraceMode ) EDA_DRAW_MODE_T aTraceMode )
{ {
wxSize SheetSize; wxSize boardSize;
wxSize BoardSize; wxPoint boardCenter;
wxPoint BoardCenter; bool center = false;
bool Center = false;
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
double scale; double scale;
wxPoint offset; wxPoint offset;
LOCALE_IO toggle;
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
@ -52,29 +51,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
g_PcbPlotOptions.m_PlotScale ); g_PcbPlotOptions.m_PlotScale );
SetLocaleTo_C_standard();
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale ) if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
Center = true; // when scale != 1.0 we must calculate the position in page {
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning // because actual position has no meaning
center = true;
}
// Scale units from 0.0001" to HPGL plot units. wxSize pageSizeIU = GetPageSizeIU();
SheetSize.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * U_PCB;
// Calculate the center of the PCB // Calculate the center of the PCB
EDA_RECT bbbox = GetBoardBoundingBox(); EDA_RECT bbbox = GetBoardBoundingBox();
BoardSize = bbbox.GetSize(); boardSize = bbbox.GetSize();
BoardCenter = bbbox.Centre(); boardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{ {
double Xscale, Yscale;
// Fit to 80% of the page // Fit to 80% of the page
Xscale = ( ( SheetSize.x * 0.8 ) / BoardSize.x ); double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
Yscale = ( ( SheetSize.y * 0.8 ) / BoardSize.y ); double Yscale = ( ( pageSizeIU.y * 0.8 ) / boardSize.y );
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
} }
else else
@ -83,12 +79,12 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
} }
// Calculate the page size offset. // Calculate the page size offset.
if( Center ) if( center )
{ {
offset.x = wxRound( (double) BoardCenter.x - offset.x = wxRound( (double) boardCenter.x -
( (double) SheetSize.x / 2.0 ) / scale ); ( (double) pageSizeIU.x / 2.0 ) / scale );
offset.y = wxRound( (double) BoardCenter.y - offset.y = wxRound( (double) boardCenter.y -
( (double) SheetSize.y / 2.0 ) / scale ); ( (double) pageSizeIU.y / 2.0 ) / scale );
} }
else else
{ {
@ -97,7 +93,9 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
} }
HPGL_PLOTTER* plotter = new HPGL_PLOTTER(); 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_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-HPGL" ) ); 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->set_pen_diameter( pen_diam );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */ // 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() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, aLayer, aTraceMode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
return true; return true;
} }

View File

@ -24,15 +24,19 @@
bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer, bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer,
bool aUseA4, EDA_DRAW_MODE_T aTraceMode ) bool aUseA4, EDA_DRAW_MODE_T aTraceMode )
{ {
wxSize SheetSize; const PAGE_INFO& pageInfo = GetPageSettings();
wxSize PaperSize;
wxSize BoardSize; wxSize paperSizeIU;
wxPoint BoardCenter; wxSize boardSize;
bool Center = false; wxPoint boardCenter;
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; bool center = false;
double scale, paperscale; double scale;
Ki_PageDescr* SheetPS; double paperscale;
wxPoint offset; wxPoint offset;
LOCALE_IO toggle;
PAGE_INFO pageA4( wxT( "A4" ) );
const PAGE_INFO* sheetPS;
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
@ -41,45 +45,43 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
return false; return false;
} }
SetLocaleTo_C_standard();
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale ) if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
Center = true; // when scale != 1.0 we must calculate the position in page {
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning // because actual position has no meaning
center = true;
}
// Set default line width // Set default line width
if( g_PcbPlotOptions.m_PlotLineWidth < 1 ) if( g_PcbPlotOptions.m_PlotLineWidth < 1 )
g_PcbPlotOptions.m_PlotLineWidth = 1; g_PcbPlotOptions.m_PlotLineWidth = 1;
SheetSize.x = currentsheet->m_Size.x * U_PCB; wxSize pageSizeIU = GetPageSizeIU();
SheetSize.y = currentsheet->m_Size.y * U_PCB;
if( aUseA4 ) if( aUseA4 )
{ {
SheetPS = &g_Sheet_A4; sheetPS = &pageA4;
PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB; paperSizeIU = pageA4.GetSizeIU();
PaperSize.y = g_Sheet_A4.m_Size.y * U_PCB; paperscale = (double) paperSizeIU.x / pageSizeIU.x;
paperscale = (float) PaperSize.x / SheetSize.x;
} }
else else
{ {
SheetPS = currentsheet; sheetPS = &pageInfo;
PaperSize = SheetSize; paperSizeIU = pageSizeIU;
paperscale = 1; paperscale = 1;
} }
EDA_RECT bbbox = GetBoardBoundingBox(); EDA_RECT bbbox = GetBoardBoundingBox();
BoardSize = bbbox.GetSize(); boardSize = bbbox.GetSize();
BoardCenter = bbbox.Centre(); boardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
{ {
double Xscale, Yscale;
// Fit to 80% of the page // Fit to 80% of the page
Xscale = (PaperSize.x * 0.8) / BoardSize.x; double Xscale = (paperSizeIU.x * 0.8) / boardSize.x;
Yscale = (PaperSize.y * 0.8) / BoardSize.y; double Yscale = (paperSizeIU.y * 0.8) / boardSize.y;
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
} }
else else
@ -87,10 +89,10 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
scale = g_PcbPlotOptions.m_PlotScale * paperscale; scale = g_PcbPlotOptions.m_PlotScale * paperscale;
} }
if( Center ) if( center )
{ {
offset.x = wxRound( (double) BoardCenter.x - ( (double) PaperSize.x / 2.0 ) / scale ); offset.x = wxRound( (double) boardCenter.x - ( (double) paperSizeIU.x / 2.0 ) / scale );
offset.y = wxRound( (double) BoardCenter.y - ( (double) PaperSize.y / 2.0 ) / scale ); offset.y = wxRound( (double) boardCenter.y - ( (double) paperSizeIU.y / 2.0 ) / scale );
} }
else else
{ {
@ -99,7 +101,9 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
} }
PS_PLOTTER* plotter = new PS_PLOTTER(); PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( SheetPS );
plotter->SetPageSettings( *sheetPS );
plotter->set_scale_adjust( g_PcbPlotOptions.m_FineScaleAdjustX, plotter->set_scale_adjust( g_PcbPlotOptions.m_FineScaleAdjustX,
g_PcbPlotOptions.m_FineScaleAdjustY ); g_PcbPlotOptions.m_FineScaleAdjustY );
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror ); 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 ); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */ /* 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() ); PlotWorkSheet( plotter, GetScreen() );
// If plot a negative board: // If plot a negative board:
@ -131,7 +135,6 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
Plot_Layer( plotter, aLayer, aTraceMode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default();
return true; return true;
} }

View File

@ -31,12 +31,11 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
bool aPrintMirrorMode, bool aPrintMirrorMode,
void * aData) void * aData)
{ {
MODULE* Module;
int drawmode = GR_COPY; int drawmode = GR_COPY;
DISPLAY_OPTIONS save_opt;
BOARD* Pcb = GetBoard();
int defaultPenSize = 50; int defaultPenSize = 50;
DISPLAY_OPTIONS save_opt;
PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null
PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; 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 // Draw footprints, this is done at last in order to print the pad holes in
// white (or g_DrawBgColor) after the tracks and zones // white (or g_DrawBgColor) after the tracks and zones
Module = (MODULE*) Pcb->m_Modules;
int tmp = D_PAD::m_PadSketchModePenSize; int tmp = D_PAD::m_PadSketchModePenSize;
D_PAD::m_PadSketchModePenSize = defaultPenSize; 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 wxSize pageSizeIU = GetPageSizeIU() / 2;
offset.x *= m_internalUnits / 1000; wxPoint offset( pageSizeIU.x, pageSizeIU.y );
offset.y *= m_internalUnits / 1000;
for( ; Module != NULL; Module = Module->Next() ) for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
{ {
Module->Move( offset ); module->Move( offset );
Print_Module( m_canvas, aDC, Module, drawmode, aPrintMaskLayer, drillShapeOpt ); Print_Module( m_canvas, aDC, module, drawmode, aPrintMaskLayer, drillShapeOpt );
Module->Move( -offset ); module->Move( -offset );
} }
D_PAD::m_PadSketchModePenSize = tmp; D_PAD::m_PadSketchModePenSize = tmp;
@ -101,7 +95,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayPadNum = DisplayOpt.DisplayPadNum;
GetBoard()->SetElementVisibility(NO_CONNECTS_VISIBLE, nctmp); GetBoard()->SetElementVisibility( NO_CONNECTS_VISIBLE, nctmp );
} }

View File

@ -142,7 +142,6 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
{ {
int tmpzoom; int tmpzoom;
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Page size in internal units
wxPoint old_org; wxPoint old_org;
wxPoint DrawOffset; // Offset de trace wxPoint DrawOffset; // Offset de trace
double userscale; double userscale;
@ -153,65 +152,68 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
wxBusyCursor dummy; wxBusyCursor dummy;
/* Save old draw scale and draw offset */ // Save old draw scale and draw offset
tmp_startvisu = screen->m_StartVisu; tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom(); tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg; 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->SetScalingFactor( DrawZoom );
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.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; 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 // 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: // So the equivalent board must be moved:
if( m_Parent->IsType( MODULE_EDITOR_FRAME ) ) if( m_Parent->IsType( MODULE_EDITOR_FRAME ) )
{ {
wxPoint mv_offset; bbbox.Move( wxPoint( pageSizeIU.x/2, pageSizeIU.y/2 ) );
mv_offset.x = SheetSize.x / 2;
mv_offset.y = SheetSize.y / 2;
brd_BBox.Move( mv_offset );
} }
/* Compute the PCB size in internal units*/ // Compute the PCB size in internal units
userscale = m_PrintParams.m_PrintScale; 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 // Margin = 0.4 inch
SheetSize.x = brd_BBox.GetWidth() + extra_margin; #if defined(KICAD_NANOMETRE)
SheetSize.y = brd_BBox.GetHeight() + extra_margin; 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; userscale = 0.99;
} }
if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage if( (m_PrintParams.m_PrintScale > 1.0) // scale > 1 -> Recadrage
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page || (m_PrintParams.m_PrintScale == 0) ) // fit in page
{ {
DrawOffset += brd_BBox.Centre(); DrawOffset += bbbox.Centre();
} }
if( m_PrintParams.m_PageSetupData ) if( m_PrintParams.m_PageSetupData )
{ {
wxSize pagesize; wxSize pagesize;
pagesize.x = (int) (SheetSize.x / userscale);
pagesize.y = (int) (SheetSize.y / userscale); pagesize.x = int( pageSizeIU.x / userscale );
FitThisSizeToPageMargins(pagesize, *m_PrintParams.m_PageSetupData ); pagesize.y = int( pageSizeIU.y / userscale );
FitThisSizeToPageMargins( pagesize, *m_PrintParams.m_PageSetupData );
} }
// Compute Accurate scale 1 // Compute Accurate scale 1
if( userscale == 1.0 ) if( userscale == 1.0 )
{ {
// We want a 1:1 scale and margins for printing // We want a 1:1 scale and margins for printing
MapScreenSizeToPaper( ); MapScreenSizeToPaper();
int w, h; int w, h;
GetPPIPrinter( &w, &h ); GetPPIPrinter( &w, &h );
double accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT; 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 ) if( m_PrintParams.m_Print_Black_and_White )
GRForceBlackPen( true ); GRForceBlackPen( true );
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas(); EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
EDA_RECT tmp = *panel->GetClipBox(); 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 * for scales > 1, the DrawOffset was already computed to have the board centre
* to the middle of the page. * to the middle of the page.
*/ */
wxPoint pcb_centre = brd_BBox.Centre(); wxPoint pcb_centre = bbbox.Centre();
if( userscale <= 1.0 ) if( userscale <= 1.0 )
DrawOffset.y += pcb_centre.y - (ysize / 2); DrawOffset.y += pcb_centre.y - (ysize / 2);

View File

@ -474,7 +474,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
int px = pt_cur_ch->m_PadStart->GetPosition().x; int px = pt_cur_ch->m_PadStart->GetPosition().x;
int py = pt_cur_ch->m_PadStart->GetPosition().y; 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 ); EXCHG( dx, dy );
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > 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; px = pt_cur_ch->m_PadEnd->GetPosition().x;
py = pt_cur_ch->m_PadEnd->GetPosition().y; 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 ); EXCHG( dx, dy );
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) ) if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )

View File

@ -152,6 +152,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
FILE* FichCmp, * NewFile; FILE* FichCmp, * NewFile;
char line[1024]; char line[1024];
wxString msg; wxString msg;
char* ignore;
if( old_name == new_name ) if( old_name == new_name )
return 0; return 0;
@ -189,7 +190,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference,
return 1; 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() ) ); 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; MODULE* Module = GetBoard()->m_Modules;
wxString msg; wxString msg;
wxString wildcard; wxString wildcard;
char* ignore;
if( Module == NULL ) if( Module == NULL )
{ {
@ -617,7 +619,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
return; 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() ) ); fprintf( FichCmp, "Cmp-Mod V01 Genere par PcbNew le %s\n", TO_UTF8( DateAndTime() ) );
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )