Commit 9d080b08 authored by Dick Hollenbeck's avatar Dick Hollenbeck

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
parents 152b8d91 dac20005
...@@ -22,8 +22,8 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) ...@@ -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) ...@@ -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 #
############# #############
......
...@@ -114,6 +114,10 @@ else() ...@@ -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})
......
...@@ -35,26 +35,28 @@ ...@@ -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() ...@@ -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 ) ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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 ) ...@@ -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 ) ...@@ -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( ) ...@@ -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";
} }
......
...@@ -84,8 +84,10 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, ...@@ -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() ...@@ -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 );
...@@ -214,10 +220,8 @@ void EDA_BASE_FRAME::LoadSettings() ...@@ -214,10 +220,8 @@ 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() ...@@ -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 ) ...@@ -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, ...@@ -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();
......
...@@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType ) ...@@ -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 ...@@ -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, ...@@ -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;
} }
...@@ -46,31 +46,6 @@ ...@@ -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 ) ...@@ -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>-------------------------------------------------------------
// Standard page sizes in mils
#if defined(KICAD_GOST)
const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8283, 11700 ), wxT( "A4" ) );
#else
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 )
{ {
// All sizes are in 1/1000 inch bool rc = true;
m_Size = size;
m_Offset = offset; if( aType == pageA4.GetType() )
m_Name = name; *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;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
m_LeftMargin = GOST_LEFTMARGIN; m_left_margin = GOST_LEFTMARGIN;
m_RightMargin = GOST_RIGHTMARGIN; m_right_margin = GOST_RIGHTMARGIN;
m_TopMargin = GOST_TOPMARGIN; m_top_margin = GOST_TOPMARGIN;
m_BottomMargin = GOST_BOTTOMMARGIN; m_bottom_margin = GOST_BOTTOMMARGIN;
#else #else
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400; 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;
......
...@@ -12,19 +12,17 @@ ...@@ -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, ...@@ -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 ) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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], ...@@ -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], ...@@ -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], ...@@ -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 */
{ {
......
...@@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout ) ...@@ -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 ) ...@@ -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" );
......
...@@ -21,18 +21,22 @@ ...@@ -21,18 +21,22 @@
*/ */
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;
int xg, yg; const PAGE_INFO& pageInfo = GetPageSettings();
wxSize PageSize; wxSize pageSize = pageInfo.GetSizeMils(); // mils
wxPoint pos, ref; int xg, yg;
EDA_Colors color;
wxPoint pos, ref;
/* Scale to convert dimension in 1/1000 in into internal units EDA_Colors color;
* (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */
// paper is sized in mils. Here is a conversion factor to
// 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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 )
{ {
...@@ -287,7 +301,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) ...@@ -287,7 +301,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( WsItem->m_Legende ) if( WsItem->m_Legende )
msg = WsItem->m_Legende; msg = WsItem->m_Legende;
if( screen->m_NumberOfScreen > 1 ) if( screen->m_NumberOfScreen > 1 )
msg << screen->m_ScreenNumber; msg << screen->m_ScreenNumber;
plotter->text( pos, color, plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
...@@ -297,7 +311,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) ...@@ -297,7 +311,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_SHEETS: case WS_SHEETS:
if( WsItem->m_Legende ) if( WsItem->m_Legende )
msg = WsItem->m_Legende; msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen; msg << screen->m_NumberOfScreen;
plotter->text( pos, color, plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size, msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
...@@ -334,8 +348,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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:
......
...@@ -16,6 +16,7 @@ ...@@ -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 @@ ...@@ -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 ) ...@@ -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();
...@@ -65,51 +57,64 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS() ...@@ -65,51 +57,64 @@ 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() ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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() );)
{
sheet = SheetList[ii];
if( m_Parent->GetScreen()->m_CurrentSheetDesc == sheet ) // search all the child wxRadioButtons for a label containing our paper type
m_CurrentSelection = ii; for( unsigned i = 0; i < m_PageSizeBox->GetCount(); ++i )
{
// parse each label looking for curPaperType within it
wxStringTokenizer st( m_PageSizeBox->GetString( i ) );
while( st.HasMoreTokens() )
{
if( st.GetNextToken() == curPaperType )
{
m_PageSizeBox->SetSelection( i );
return;
}
}
} }
// m_PageSizeBox->SetSelection( 1 ); // wxFormBuilder does this, control there
} }
...@@ -14,12 +14,11 @@ ...@@ -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: ...@@ -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);
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// 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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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() ...@@ -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 );
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// 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,16 +80,17 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog ...@@ -80,16 +80,17 @@ 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();
}; };
......
...@@ -51,7 +51,7 @@ ...@@ -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 ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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 );
} }
......
...@@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
...@@ -1116,7 +1120,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) ...@@ -1116,7 +1120,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
int localkey; int localkey;
wxPoint pos; wxPoint pos;
localkey = event.GetKeyCode(); localkey = event.GetKeyCode();
switch( localkey ) switch( localkey )
{ {
......
...@@ -47,6 +47,9 @@ class MODULE; ...@@ -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 ) ...@@ -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
......
...@@ -216,12 +216,6 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName, ...@@ -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 ) ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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 ...@@ -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 );
......
This diff is collapsed.
...@@ -87,7 +87,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, ...@@ -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();
......
...@@ -119,7 +119,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list ) ...@@ -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 );
} }
......
...@@ -605,7 +605,7 @@ void CVPCB_MAINFRAME::DisplayStatus() ...@@ -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() ...@@ -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
{ {
......
...@@ -199,7 +199,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -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, ...@@ -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, ...@@ -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;
......
...@@ -4,7 +4,6 @@ ...@@ -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"
......
...@@ -567,8 +567,8 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -567,8 +567,8 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm ) bool CompactForm )
{ {
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
wxString outStr; wxString outStr;
wxString tmpStr; wxString tmpStr;
#endif #endif
if( IsFieldChecked( FOOTPRINT ) ) if( IsFieldChecked( FOOTPRINT ) )
...@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
{ {
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
outStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, outStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol,
GetChars( DrawLibItem->GetField( FOOTPRINT )->m_Text ) ); GetChars( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
#else #else
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) ); TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
...@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm ) if( CompactForm )
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
{ {
tmpStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, tmpStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol,
GetChars( DrawLibItem->GetField( ii )->m_Text ) ); GetChars( DrawLibItem->GetField( ii )->m_Text ) );
outStr += tmpStr; outStr += tmpStr;
} }
#else #else
fprintf( f, "%c%s", s_ExportSeparatorSymbol, fprintf( f, "%c%s", s_ExportSeparatorSymbol,
...@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem, ...@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
#endif #endif
else else
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
{ {
tmpStr.Printf( wxT( "; %-12s" ), tmpStr.Printf( wxT( "; %-12s" ),
GetChars( DrawLibItem->GetField( ii )->m_Text ) ); GetChars( DrawLibItem->GetField( ii )->m_Text ) );
outStr += tmpStr; outStr += tmpStr;
} }
#else #else
fprintf( f, "; %-12s", fprintf( f, "; %-12s",
...@@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -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, ...@@ -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 ) );
} }
} }
...@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
else else
{ {
switch (amount) switch (amount)
{ {
case 1: case 1:
fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8( strPred ), fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8( strPred ),
s_ExportSeparatorSymbol, amount ); s_ExportSeparatorSymbol, amount );
...@@ -844,8 +844,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f, ...@@ -844,8 +844,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(), fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount ); TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break; break;
} }
} }
#endif #endif
return 0; return 0;
...@@ -1060,13 +1060,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f, ...@@ -1060,13 +1060,13 @@ 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 ) );
} }
} }
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
fprintf( f, "%s", TO_UTF8( PrintFieldData( DrawLibItem ) ) ); fprintf( f, "%s", TO_UTF8( PrintFieldData( DrawLibItem ) ) );
#else #else
PrintFieldData( f, DrawLibItem ); PrintFieldData( f, DrawLibItem );
#endif #endif
......
...@@ -63,11 +63,11 @@ private: ...@@ -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( ) ...@@ -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( ) ...@@ -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;
...@@ -206,14 +204,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) ...@@ -206,14 +204,14 @@ 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, ...@@ -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, ...@@ -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" ) );
} }
...@@ -70,12 +70,13 @@ private: ...@@ -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;
...@@ -172,13 +173,13 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars() ...@@ -172,13 +173,13 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{ {
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(); // 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.
* In complex hierarchies, we must update component references * In complex hierarchies, we must update component references
...@@ -213,16 +214,16 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() ...@@ -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() ...@@ -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;
...@@ -252,11 +254,11 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() ...@@ -252,11 +254,11 @@ 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 )
{ {
wxString msg; wxString msg;
...@@ -276,12 +278,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, ...@@ -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 );
......
...@@ -95,7 +95,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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();
} }
......
...@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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 ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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
......
...@@ -244,7 +244,10 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) ...@@ -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;
......
...@@ -33,54 +33,71 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) ...@@ -33,54 +33,71 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_LIBEDIT_GEN_PNG_FILE: case ID_LIBEDIT_GEN_PNG_FILE:
{ {
bool fmt_is_jpeg = false; // could be selectable later. so keep this option. bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" ); file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext; mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() ); wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext ); fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(), FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this, fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true ); wxFD_SAVE, true );
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; return;
// calling wxYield is mandatory under Linux, after closing the file selector dialog // calling wxYield is mandatory under Linux, after closing the file selector dialog
// to refresh the screen before creating the PNG or JPEG image from screen // to refresh the screen before creating the PNG or JPEG image from screen
wxYield(); wxYield();
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg ); CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
} }
break; break;
case ID_LIBEDIT_GEN_SVG_FILE: case ID_LIBEDIT_GEN_SVG_FILE:
{ {
file_ext = wxT( "svg" ); file_ext = wxT( "svg" );
mask = wxT( "*." ) + file_ext; mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() ); wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext ); fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(), FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this, fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true ); wxFD_SAVE, true );
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
wxSize pagesize = GetScreen()->ReturnPageSize( ); // the margin is 10% the size of the component size
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize(); wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2); // Add a small margin to the plot bounding box
componentSize.y = (int)(componentSize.y * 1.2); componentSize.x = (int)(componentSize.x * 1.2);
GetScreen()->SetPageSize( componentSize ); componentSize.y = (int)(componentSize.y * 1.2);
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize ); GetScreen()->SetPageSize( componentSize );
} SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize );
#else
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
GetScreen()->SetPageSettings( pageTemp );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSettings( pageSave );
#endif
}
break; break;
} }
} }
...@@ -116,7 +133,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode ...@@ -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.
......
...@@ -210,7 +210,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, ...@@ -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() ...@@ -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() ...@@ -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 ) );
} }
......
...@@ -257,7 +257,17 @@ public: ...@@ -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 );
......
...@@ -48,7 +48,7 @@ ...@@ -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 ) ...@@ -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[] =
{
&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();
sscanf( line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y ); sscanf( line, "%s %s %d %d", text, text, &pageSize.x, &pageSize.y );
wxString pagename = FROM_UTF8( Text ); wxString pagename = FROM_UTF8( text );
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
{
wsheet = SheetFormatList[ii];
if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */
{
// Get the user page size and make it the default
if( wsheet == &g_Sheet_user )
{
g_Sheet_user.m_Size = PageSize;
}
break; PAGE_INFO pageInfo;
}
}
if( SheetFormatList[ii] == NULL ) if( !pageInfo.SetType( pagename ) )
{ {
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" ), ...@@ -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( ; ; )
{ {
......
...@@ -97,12 +97,15 @@ static GRID_TYPE SchematicGridList[] = { ...@@ -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 ) ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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
...@@ -241,6 +241,8 @@ typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PINS; ...@@ -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 ...@@ -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 ) );
......
...@@ -285,6 +285,39 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME() ...@@ -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() ...@@ -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();
......
...@@ -265,6 +265,39 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME() ...@@ -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();
......
...@@ -34,12 +34,11 @@ ...@@ -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: ...@@ -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 );
......
...@@ -29,10 +29,12 @@ ...@@ -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 ...@@ -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 ) ...@@ -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 );
} }
......
...@@ -6,6 +6,7 @@ ...@@ -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"
...@@ -35,11 +36,11 @@ private: ...@@ -35,11 +36,11 @@ private:
void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event ) 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();
} }
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) : DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
...@@ -61,9 +62,9 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& event ) ...@@ -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( ) ...@@ -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( ) ...@@ -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( ) ...@@ -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 ) ...@@ -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 );
} }
......
...@@ -154,12 +154,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -154,12 +154,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
case ID_GERBVIEW_SET_PAGE_BORDER: case ID_GERBVIEW_SET_PAGE_BORDER:
{ {
DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this ); DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
if (dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
m_canvas->Refresh(); m_canvas->Refresh();
} }
break; break;
case ID_GERBVIEW_GLOBAL_DELETE: case ID_GERBVIEW_GLOBAL_DELETE:
......
...@@ -29,17 +29,20 @@ COLORS_DESIGN_SETTINGS g_ColorsSettings; ...@@ -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 )
......
...@@ -19,8 +19,10 @@ class GERBVIEW_FRAME; ...@@ -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; ...@@ -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; ...@@ -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
{ {
......
...@@ -29,6 +29,7 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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("ColorLayer13"), wxT("ColorLayer14"), wxT("ColorLayer15"),
wxT("ColorLayer12"), wxT("ColorLaye13"), 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 );
} }
......
...@@ -48,8 +48,9 @@ ...@@ -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" ) );
/*************************************/ /*************************************/
...@@ -67,8 +68,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, ...@@ -67,8 +68,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_FrameName = wxT( "GerberFrame" ); m_FrameName = wxT( "GerberFrame" );
m_show_layer_manager_tools = true; m_show_layer_manager_tools = true;
m_showAxis = true; // true to show X and Y axis on screen m_showAxis = true; // true to show X and Y axis on screen
m_showBorderAndTitleBlock = false; // true for reference drawings. m_showBorderAndTitleBlock = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_SelLayerBox = NULL; m_SelLayerBox = NULL;
m_DCodeSelector = NULL; m_DCodeSelector = NULL;
...@@ -83,13 +84,17 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, ...@@ -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() ...@@ -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; {
wxString pageType;
GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt]; config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
if( pageSize_opt > 0 ) pageInfo.SetType( pageType );
{
m_showBorderAndTitleBlock = true;
} }
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() ...@@ -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 );
if( m_showBorderAndTitleBlock ) config->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
{
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
......
...@@ -68,8 +68,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) ...@@ -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();
......
...@@ -254,9 +254,9 @@ public: ...@@ -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: ...@@ -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 );
......
...@@ -37,11 +37,10 @@ ...@@ -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: ...@@ -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; ...@@ -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 ...@@ -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)
...@@ -117,18 +119,16 @@ public: ...@@ -117,18 +119,16 @@ public:
* > 0 except for schematics. * > 0 except for schematics.
* false: when coordinates can only be >= 0 * false: when coordinates can only be >= 0
* Schematic */ * Schematic */
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: ...@@ -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: ...@@ -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: ...@@ -460,5 +446,4 @@ public:
#endif #endif
}; };
#endif // CLASS_BASE_SCREEN_H_ #endif // CLASS_BASE_SCREEN_H_
...@@ -9,7 +9,9 @@ ...@@ -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
{ {
......
...@@ -2,8 +2,8 @@ ...@@ -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: ...@@ -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: ...@@ -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__ */
...@@ -55,14 +55,23 @@ enum SCH_LINE_TEST_T ...@@ -55,14 +55,23 @@ 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
class SCH_SCREEN : public BASE_SCREEN 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
...@@ -77,7 +86,12 @@ class SCH_SCREEN : public BASE_SCREEN ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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
}; };
......
...@@ -32,31 +32,33 @@ ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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; const wxString& GetType() const { return m_type; }
int m_RightMargin;
int m_TopMargin; /**
int m_BottomMargin; * 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
public: // wxPoint GetOffsetMils() const { return m_Offset; }
Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
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; ...@@ -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 ...@@ -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
......
...@@ -12,7 +12,7 @@ ...@@ -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 { ...@@ -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 { ...@@ -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: ...@@ -77,5 +83,4 @@ public:
DISPLAY_OPTIONS(); DISPLAY_OPTIONS();
}; };
#endif // PCBSTRUCT_H #endif // PCBSTRUCT_H
...@@ -5,15 +5,12 @@ ...@@ -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 { ...@@ -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 ); ...@@ -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 ); ...@@ -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 ); ...@@ -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 ); ...@@ -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: ...@@ -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: ...@@ -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 ) ...@@ -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: ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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: ...@@ -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: ...@@ -559,4 +559,4 @@ protected:
int current_color; int current_color;
}; };
#endif // __INCLUDE__PLOT_COMMON_H__ #endif // PLOT_COMMON_H_
...@@ -112,6 +112,13 @@ public: ...@@ -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: ...@@ -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: ...@@ -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
......
...@@ -350,6 +350,20 @@ public: ...@@ -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 );
......
...@@ -72,7 +72,7 @@ class EDA_DRAW_PANEL; ...@@ -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: ...@@ -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;
...@@ -372,9 +375,9 @@ private: ...@@ -372,9 +375,9 @@ private:
protected: protected:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId; int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color int m_GridColor; // Grid color
/// The area to draw on. /// The area to draw on.
EDA_DRAW_PANEL* m_canvas; EDA_DRAW_PANEL* m_canvas;
...@@ -401,9 +404,6 @@ protected: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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;
/**
* 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;
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; } 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,11 +477,12 @@ public: ...@@ -473,11 +477,12 @@ 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; }
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
...@@ -660,13 +665,12 @@ public: ...@@ -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;
......
...@@ -48,7 +48,7 @@ ...@@ -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, ...@@ -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 ) ...@@ -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 ...@@ -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 ...@@ -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;
...@@ -195,7 +229,7 @@ double PCB_BASE_FRAME::BestZoom( void ) ...@@ -195,7 +229,7 @@ double PCB_BASE_FRAME::BestZoom( void )
} }
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
{ {
// factored out of pcbnew/find.cpp // factored out of pcbnew/find.cpp
...@@ -203,7 +237,7 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) ...@@ -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 ) ...@@ -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 )
{ {
} }
......
This diff is collapsed.
...@@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const ...@@ -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
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment