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)
option(USE_PNG_BITMAPS "use PNG bitmaps instead of XPM (default ON)" ON)
option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format (default OFF)" OFF)
option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format (default OFF)" OFF)
option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format" OFF)
option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format" OFF)
# Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
......@@ -265,6 +265,11 @@ add_subdirectory(bitmap2component)
add_subdirectory(pcb_calculator)
#add_subdirectory(new)
add_executable( container_test EXCLUDE_FROM_ALL container_test.cpp )
target_link_libraries( container_test common polygon bitmaps ${wxWidgets_LIBRARIES} )
#############
# Resources #
#############
......
......@@ -114,6 +114,10 @@ else()
set( PCB_COMMON_SRCS ${PCB_COMMON_SRCS} ../pcbnew/item_io.cpp )
endif()
# add -DPCBNEW to compilation of these PCBNEW sources
set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
COMPILE_DEFINITIONS "PCBNEW"
)
add_library(pcbcommon ${PCB_COMMON_SRCS})
......
......@@ -35,26 +35,28 @@
#include "id.h"
#define CURSOR_SIZE 12 /* size of the cross cursor. */
#define CURSOR_SIZE 12 /// size of the cross cursor.
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) :
EDA_ITEM( aType )
{
m_drawList = NULL; /* Draw items list */
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */
m_UndoRedoCountMax = 10; // undo/Redo command Max depth, 10 is a reasonable value
m_FirstRedraw = true;
m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1
m_Zoom = 32.0;
m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */
m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
m_Center = true;
m_CurrentSheetDesc = &g_Sheet_A4;
m_IsPrinting = false;
m_ScrollPixelsPerUnitX = 1;
m_ScrollPixelsPerUnitY = 1;
InitDatas();
m_FlagModified = false; // Set when any change is made on board.
m_FlagSave = false; // Used in auto save set when an auto save is required.
SetCurItem( NULL );
}
......@@ -63,27 +65,24 @@ BASE_SCREEN::~BASE_SCREEN()
}
void BASE_SCREEN::InitDatas()
void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU )
{
if( m_Center )
{
m_crossHairPosition.x = m_crossHairPosition.y = 0;
m_DrawOrg.x = -ReturnPageSize().x / 2;
m_DrawOrg.y = -ReturnPageSize().y / 2;
m_DrawOrg.x = -aPageSizeIU.x / 2;
m_DrawOrg.y = -aPageSizeIU.y / 2;
}
else
{
m_DrawOrg.x = m_DrawOrg.y = 0;
m_crossHairPosition.x = ReturnPageSize().x / 2;
m_crossHairPosition.y = ReturnPageSize().y / 2;
m_crossHairPosition.x = aPageSizeIU.x / 2;
m_crossHairPosition.y = aPageSizeIU.y / 2;
}
m_O_Curseur.x = m_O_Curseur.y = 0;
SetCurItem( NULL );
m_FlagModified = false; // Set when any change is made on broad.
m_FlagSave = false; // Used in auto save set when an auto save is required.
}
......@@ -93,25 +92,6 @@ int BASE_SCREEN::GetInternalUnits( void )
}
wxSize BASE_SCREEN::ReturnPageSize( void )
{
int internal_units = GetInternalUnits();
wxSize size = m_CurrentSheetDesc->m_Size;
size.x = (int)( (double)size.x * internal_units / 1000 );
size.y = (int)( (double)size.y * internal_units / 1000 );
return size;
}
void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
{
int internal_units = GetInternalUnits();
m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units);
m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units);
}
double BASE_SCREEN::GetScalingFactor() const
{
double scale = 1.0 / GetZoom();
......@@ -124,12 +104,12 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
double zoom = aScale;
// Limit zoom to max and min allowed values:
if (zoom < m_ZoomList[0])
if( zoom < m_ZoomList[0] )
zoom = m_ZoomList[0];
int idxmax = m_ZoomList.GetCount() - 1;
if (zoom > m_ZoomList[idxmax])
if( zoom > m_ZoomList[idxmax] )
zoom = m_ZoomList[idxmax];
SetZoom( zoom );
......@@ -151,13 +131,13 @@ bool BASE_SCREEN::SetFirstZoom()
{
if( m_Zoom != 1.0 )
{
m_Zoom = 1.0;
SetZoom( 1.0 );
return true;
}
}
else if( m_Zoom != m_ZoomList[0] )
{
m_Zoom = m_ZoomList[0];
SetZoom( m_ZoomList[0] );
return true;
}
......@@ -193,7 +173,7 @@ bool BASE_SCREEN::SetNextZoom()
{
if( m_Zoom < m_ZoomList[i] )
{
m_Zoom = m_ZoomList[i];
SetZoom( m_ZoomList[i] );
return true;
}
}
......@@ -213,7 +193,7 @@ bool BASE_SCREEN::SetPreviousZoom()
{
if( m_Zoom > m_ZoomList[i - 1] )
{
m_Zoom = m_ZoomList[i - 1];
SetZoom( m_ZoomList[i - 1] );
return true;
}
}
......@@ -227,7 +207,7 @@ bool BASE_SCREEN::SetLastZoom()
if( m_ZoomList.IsEmpty() || m_Zoom == m_ZoomList.Last() )
return false;
m_Zoom = m_ZoomList.Last();
SetZoom( m_ZoomList.Last() );
return true;
}
......@@ -466,7 +446,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
{
m_UndoList.PushCommand( aNewitem );
/* Delete the extra items, if count max reached */
// Delete the extra items, if count max reached
int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
if( extraitems > 0 ) // Delete the extra items
......@@ -478,7 +458,7 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
{
m_RedoList.PushCommand( aNewitem );
/* Delete the extra items, if count max reached */
// Delete the extra items, if count max reached
int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
if( extraitems > 0 ) // Delete the extra items
......@@ -502,15 +482,15 @@ PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( )
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) const
{
EDA_ITEM* item = m_drawList;
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
for( ; item; item = item->Next() )
/* this class will eventually go away, but here's a place holder until then.
for( EDA_ITEM* item = m_drawList; item; item = item->Next() )
{
item->Show( nestLevel+1, os );
}
*/
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
......
......@@ -84,8 +84,10 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
SetSize( 0, 0, minsize.x, minsize.y );
// Create child subwindows.
GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); /* dimensions of the user area of the main
* window */
// Dimensions of the user area of the main window.
GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
m_FramePos.x = m_FramePos.y = 0;
m_FrameSize.y -= m_MsgFrameHeight;
......@@ -180,12 +182,16 @@ void EDA_BASE_FRAME::LoadSettings()
{
text = m_FrameName + wxT( "Pos_x" );
config->Read( text, &m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
config->Read( text, &m_FramePos.y );
text = m_FrameName + wxT( "Size_x" );
config->Read( text, &m_FrameSize.x, 600 );
text = m_FrameName + wxT( "Size_y" );
config->Read( text, &m_FrameSize.y, 400 );
text = m_FrameName + wxT( "Maximized" );
config->Read( text, &maximized, 0 );
......@@ -214,10 +220,8 @@ void EDA_BASE_FRAME::LoadSettings()
void EDA_BASE_FRAME::SaveSettings()
{
wxString text;
wxConfig* config;
config = wxGetApp().GetSettings();
wxString text;
wxConfig* config = wxGetApp().GetSettings();
if( ( config == NULL ) || IsIconized() )
return;
......@@ -227,12 +231,16 @@ void EDA_BASE_FRAME::SaveSettings()
text = m_FrameName + wxT( "Pos_x" );
config->Write( text, (long) m_FramePos.x );
text = m_FrameName + wxT( "Pos_y" );
config->Write( text, (long) m_FramePos.y );
text = m_FrameName + wxT( "Size_x" );
config->Write( text, (long) m_FrameSize.x );
text = m_FrameName + wxT( "Size_y" );
config->Write( text, (long) m_FrameSize.y );
text = m_FrameName + wxT( "Maximized" );
config->Write( text, IsMaximized() );
......@@ -270,7 +278,7 @@ void EDA_BASE_FRAME::DisplayActivity( int PerCent, const wxString& Text )
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxFileHistory * aFileHistory )
{
wxFileHistory * fileHistory = aFileHistory;
wxFileHistory* fileHistory = aFileHistory;
if( fileHistory == NULL )
fileHistory = & wxGetApp().GetFileHistory();
......@@ -284,7 +292,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
{
wxString fn, msg;
size_t i;
wxFileHistory * fileHistory = aFileHistory;
wxFileHistory* fileHistory = aFileHistory;
if( fileHistory == NULL )
fileHistory = & wxGetApp().GetFileHistory();
......
......@@ -32,7 +32,6 @@ PLOTTER::PLOTTER( PlotFormat aPlotType )
output_file = 0;
color_mode = false; /* Start as a BW plot */
negative_mode = false;
sheet = NULL;
}
......@@ -120,7 +119,6 @@ void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill
corner_list.push_back( corner );
PlotPoly( corner_list, fill );
}
......@@ -424,12 +422,12 @@ void PLOTTER::thick_circle( wxPoint pos, int diametre, int width,
}
void PLOTTER::set_paper_size( Ki_PageDescr* asheet )
void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( !output_file );
sheet = asheet;
pageInfo = aPageSettings;
// Sheets are in mils, plotter works with decimals
paper_size.x = sheet->m_Size.x * 10;
paper_size.y = sheet->m_Size.y * 10;
// PAGE_INFO is in mils, plotter works with deci-mils
paper_size = pageInfo.GetSizeMils() * 10;
}
......@@ -46,31 +46,6 @@
* application class.
*/
/* Standard page sizes in 1/1000 inch */
#if defined(KICAD_GOST)
Ki_PageDescr g_Sheet_A4( wxSize( 8283, 11700 ), wxPoint( 0, 0 ), wxT( "A4" ) );
#else
Ki_PageDescr g_Sheet_A4( wxSize( 11700, 8267 ), wxPoint( 0, 0 ), wxT( "A4" ) );
#endif
Ki_PageDescr g_Sheet_A3( wxSize( 16535, 11700 ), wxPoint( 0, 0 ), wxT( "A3" ) );
Ki_PageDescr g_Sheet_A2( wxSize( 23400, 16535 ), wxPoint( 0, 0 ), wxT( "A2" ) );
Ki_PageDescr g_Sheet_A1( wxSize( 33070, 23400 ), wxPoint( 0, 0 ), wxT( "A1" ) );
Ki_PageDescr g_Sheet_A0( wxSize( 46800, 33070 ), wxPoint( 0, 0 ), wxT( "A0" ) );
Ki_PageDescr g_Sheet_A( wxSize( 11000, 8500 ), wxPoint( 0, 0 ), wxT( "A" ) );
Ki_PageDescr g_Sheet_B( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "B" ) );
Ki_PageDescr g_Sheet_C( wxSize( 22000, 17000 ), wxPoint( 0, 0 ), wxT( "C" ) );
Ki_PageDescr g_Sheet_D( wxSize( 34000, 22000 ), wxPoint( 0, 0 ), wxT( "D" ) );
Ki_PageDescr g_Sheet_E( wxSize( 44000, 34000 ), wxPoint( 0, 0 ), wxT( "E" ) );
Ki_PageDescr g_Sheet_GERBER( wxSize( 32000, 32000 ), wxPoint( 0, 0 ), wxT( "GERBER" ) );
Ki_PageDescr g_Sheet_user( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) );
Ki_PageDescr* g_SheetSizeList[NB_ITEMS + 1] =
{
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
&g_Sheet_user, NULL
};
const wxString ProjectFileExtension( wxT( "pro" ) );
const wxString SchematicFileExtension( wxT( "sch" ) );
......@@ -199,25 +174,145 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
}
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
//-----<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
m_Size = size;
m_Offset = offset;
m_Name = name;
bool rc = true;
if( aType == pageA4.GetType() )
*this = pageA4;
else if( aType == pageA3.GetType() )
*this = pageA3;
else if( aType == pageA2.GetType() )
*this = pageA2;
else if( aType == pageA1.GetType() )
*this = pageA1;
else if( aType == pageA0.GetType() )
*this = pageA0;
else if( aType == pageA.GetType() )
*this = pageA;
else if( aType == pageB.GetType() )
*this = pageB;
else if( aType == pageC.GetType() )
*this = pageC;
else if( aType == pageD.GetType() )
*this = pageD;
else if( aType == pageE.GetType() )
*this = pageE;
else if( aType == pageGERBER.GetType() )
*this = pageGERBER;
else if( aType == pageUser.GetType() )
{
// pageUser is const, and may not and does not hold the custom size,
// so customize *this later
*this = pageUser;
// customize:
m_size.x = s_user_width;
m_size.y = s_user_height;
}
else
rc = false;
return rc;
}
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) :
m_size( aSizeMils )
{
m_type = aType;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
#if defined(KICAD_GOST)
m_LeftMargin = GOST_LEFTMARGIN;
m_RightMargin = GOST_RIGHTMARGIN;
m_TopMargin = GOST_TOPMARGIN;
m_BottomMargin = GOST_BOTTOMMARGIN;
m_left_margin = GOST_LEFTMARGIN;
m_right_margin = GOST_RIGHTMARGIN;
m_top_margin = GOST_TOPMARGIN;
m_bottom_margin = GOST_BOTTOMMARGIN;
#else
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
m_left_margin = m_right_margin = m_top_margin = m_bottom_margin = 400;
#endif
}
PAGE_INFO::PAGE_INFO( const wxString& aType )
{
SetType( aType );
}
void PAGE_INFO::SetUserWidthMils( int aWidthInMils )
{
if( aWidthInMils < 6000 )
aWidthInMils = 6000;
else if( aWidthInMils > 44000 )
aWidthInMils = 44000;
s_user_width = aWidthInMils;
}
void PAGE_INFO::SetUserHeightMils( int aHeightInMils )
{
if( aHeightInMils < 4000 )
aHeightInMils = 4000;
else if( aHeightInMils > 44000 )
aHeightInMils = 44000;
s_user_height = aHeightInMils;
}
//-----</PAGE_INFO>------------------------------------------------------------
wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString )
{
wxString tmp;
......
......@@ -12,19 +12,17 @@
#include "macros.h"
#include "kicad_string.h"
/* HPGL scale factor. */
// HPGL scale factor.
const double SCALE_HPGL = 0.102041;
/* Set the plot offset for the current plotting
*/
void HPGL_PLOTTER::set_viewport( wxPoint aOffset, double aScale, bool aMirror )
{
wxASSERT( !output_file );
plot_offset = aOffset;
plot_scale = aScale;
device_scale = SCALE_HPGL;
set_default_line_width( 100 ); /* default line width in 1 / 1000 inch */
set_default_line_width( 100 ); // default line width in 1 / 1000 inch
plotMirror = aMirror;
}
......@@ -88,7 +86,7 @@ void HPGL_PLOTTER::PlotPoly( std::vector< wxPoint >& aCornerList, FILL_T aFill,
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
line_to( aCornerList[ii] );
/* Close polygon if filled. */
// Close polygon if filled.
if( aFill )
{
int ii = aCornerList.size() - 1;
......@@ -172,16 +170,19 @@ void HPGL_PLOTTER::pen_control( int plume )
void HPGL_PLOTTER::pen_to( wxPoint pos, char plume )
{
wxASSERT( output_file );
if( plume == 'Z' )
{
pen_control( 'Z' );
return;
}
pen_control( plume );
user_to_device_coordinates( pos );
if( pen_lastpos != pos )
fprintf( output_file, "PA %d,%d;\n", pos.x, pos.y );
pen_lastpos = pos;
}
......@@ -246,7 +247,7 @@ void HPGL_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
angle = (StAngle - EndAngle) / 10.0;
else
angle = (EndAngle - StAngle) / 10.0;
/* Calculate start point, */
// Calculate start point,
cmap.x = (int) ( centre.x + ( rayon * cos( StAngle * M_PI / 1800 ) ) );
cmap.y = (int) ( centre.y - ( rayon * sin( StAngle * M_PI / 1800 ) ) );
user_to_device_coordinates( cmap );
......@@ -280,7 +281,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( orient >= 3600 )
orient -= 3600;
}
deltaxy = size.y - size.x; /* distance between centers of the oval */
deltaxy = size.y - size.x; // distance between centers of the oval
if( trace_mode == FILLED )
{
......@@ -295,7 +296,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
flash_pad_circle( wxPoint( cx + pos.x,
cy + pos.y ), size.x, trace_mode );
}
else /* Plot in SKETCH mode. */
else // Plot in SKETCH mode.
{
sketch_oval( pos, size, orient, wxRound( pen_diameter ) );
}
......@@ -330,7 +331,7 @@ void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
fprintf( output_file, "PA %d,%d;CI %d;\n", pos.x, pos.y, rsize.x );
if( trace_mode == FILLED ) /* Plot in filled mode. */
if( trace_mode == FILLED ) // Plot in filled mode.
{
if( delta > 0 )
{
......@@ -378,7 +379,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( size.y < 0 )
size.y = 0;
/* If a dimension is zero, the trace is reduced to 1 line. */
// If a dimension is zero, the trace is reduced to 1 line.
if( size.x == 0 )
{
ox = pos.x;
......@@ -428,7 +429,7 @@ void HPGL_PLOTTER::flash_pad_rect( wxPoint pos, wxSize padsize,
if( trace_mode == FILLED )
{
/* Plot in filled mode. */
// Plot in filled mode.
delta = (int) (pen_diameter - pen_overlap);
if( delta > 0 )
......@@ -510,11 +511,11 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
{
// TODO: replace this par the HPGL plot polygon.
int jj;
/* Fill the shape */
// Fill the shape
move = wxRound( pen_diameter - pen_overlap );
/* Calculate fill height. */
// Calculate fill height.
if( polygone[0].y == polygone[3].y ) /* Horizontal */
if( polygone[0].y == polygone[3].y ) // Horizontal
{
jj = polygone[3].y - (int) ( pen_diameter + ( 2 * pen_overlap ) );
}
......@@ -523,10 +524,10 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
jj = polygone[3].x - (int) ( pen_diameter + ( 2 * pen_overlap ) );
}
/* Calculation of dd = number of segments was traced to fill. */
// Calculation of dd = number of segments was traced to fill.
jj = jj / (int) ( pen_diameter - pen_overlap );
/* Trace the outline. */
// Trace the outline.
for( ; jj > 0; jj-- )
{
polygone[0].x += move;
......@@ -538,7 +539,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
polygone[3].x -= move;
polygone[3].y -= move;
/* Test for crossed vertexes. */
// Test for crossed vertexes.
if( polygone[0].x > polygone[3].x ) /* X axis intersection on
*vertexes 0 and 3 */
{
......
......@@ -366,7 +366,7 @@ bool PS_PLOTTER::start_plot( FILE* fout )
fprintf( output_file, "%%%%Pages: 1\n" );
fprintf( output_file, "%%%%PageOrder: Ascend\n" );
// Print boundary box in 1/72 pixels per inch, box is in decimals
// Print boundary box in 1/72 pixels per inch, box is in deci-mils
const double CONV_SCALE = DECIMIL_TO_INCH * 72;
// The coordinates of the lower left corner of the boundary
......@@ -388,18 +388,20 @@ bool PS_PLOTTER::start_plot( FILE* fout )
//
// (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
// the order in which they are specified is not wrong!)
// Also note sheet->m_Size is given in mils, not in decimils and must be
// sheet->m_Size * 10 in decimals
if( sheet->m_Name.Cmp( wxT( "User" ) ) == 0 )
// Also note pageSize is given in mils, not in internal units and must be
// converted to internal units.
wxSize pageSize = pageInfo.GetSizeMils();
if( pageInfo.GetType().Cmp( wxT( "User" ) ) == 0 )
fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );
wxRound( pageSize.y * 10 * CONV_SCALE ),
wxRound( pageSize.x * 10 * CONV_SCALE ) );
else // ( if sheet->m_Name does not equal "User" )
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
TO_UTF8( sheet->m_Name ),
wxRound( sheet->m_Size.y * 10 * CONV_SCALE ),
wxRound( sheet->m_Size.x * 10 * CONV_SCALE ) );
TO_UTF8( pageInfo.GetType() ),
wxRound( pageSize.y * 10 * CONV_SCALE ),
wxRound( pageSize.x * 10 * CONV_SCALE ) );
fprintf( output_file, "%%%%Orientation: Landscape\n" );
......
......@@ -21,18 +21,22 @@
*/
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
{
#define WSTEXTSIZE 50 // Text size in mils
Ki_PageDescr* Sheet = screen->m_CurrentSheetDesc;
int xg, yg;
wxSize PageSize;
wxPoint pos, ref;
EDA_Colors color;
/* Scale to convert dimension in 1/1000 in into internal units
* (1/1000 inc for Eeschema, 1/10000 for Pcbnew. */
#define WSTEXTSIZE 50 // Text size in mils
const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils(); // mils
int xg, yg;
wxPoint pos, ref;
EDA_Colors color;
// paper is sized in mils. Here is a conversion factor to
// scale mils to internal units.
int conv_unit = screen->GetInternalUnits() / 1000;
wxString msg;
wxSize text_size;
#if defined(KICAD_GOST)
wxSize text_size2;
wxSize text_size3;
......@@ -41,20 +45,19 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
bool bold = false;
#endif
bool italic = false;
bool italic = false;
bool thickness = 0; //@todo : use current pen
color = BLACK;
plotter->set_color( color );
PageSize.x = Sheet->m_Size.x;
PageSize.y = Sheet->m_Size.y;
// Plot edge.
ref.x = pageInfo.GetLeftMarginMils() * conv_unit;
ref.y = pageInfo.GetTopMarginMils() * conv_unit;
/* Plot edge. */
ref.x = Sheet->m_LeftMargin * conv_unit;
ref.y = Sheet->m_TopMargin * conv_unit;
xg = ( PageSize.x - Sheet->m_RightMargin ) * conv_unit;
yg = ( PageSize.y - Sheet->m_BottomMargin ) * conv_unit;
xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * conv_unit;
#if defined(KICAD_GOST)
plotter->move_to( ref );
......@@ -68,22 +71,30 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
#else
for( unsigned ii = 0; ii < 2; ii++ )
{
plotter->move_to( ref );
pos.x = xg;
pos.y = ref.y;
plotter->line_to( pos );
pos.x = xg;
pos.y = yg;
plotter->line_to( pos );
pos.x = ref.x;
pos.y = yg;
plotter->line_to( pos );
plotter->finish_to( ref );
ref.x += GRID_REF_W * conv_unit;
ref.y += GRID_REF_W * conv_unit;
xg -= GRID_REF_W * conv_unit;
yg -= GRID_REF_W * conv_unit;
}
......@@ -93,12 +104,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size.x = WSTEXTSIZE * conv_unit;
text_size.y = WSTEXTSIZE * conv_unit;
ref.x = Sheet->m_LeftMargin;
ref.y = Sheet->m_TopMargin; /* Upper left corner in
* 1/1000 inch */
xg = ( PageSize.x - Sheet->m_RightMargin );
yg = ( PageSize.y - Sheet->m_BottomMargin ); /* lower right corner
* in 1/1000 inch */
// upper left corner in mils
ref.x = pageInfo.GetLeftMarginMils();
ref.y = pageInfo.GetTopMarginMils();
// lower right corner in mils
xg = ( pageSize.x - pageInfo.GetRightMarginMils() );
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() );
#if defined(KICAD_GOST)
for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU;
......@@ -151,7 +163,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#else
/* Plot legend along the X axis. */
// Plot legend along the X axis.
int ipas = ( xg - ref.x ) / PAS_REF;
int gxpas = ( xg - ref.x ) / ipas;
for( int ii = ref.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
......@@ -193,7 +205,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
thickness, italic, false );
}
/* Plot legend along the Y axis. */
// Plot legend along the Y axis.
ipas = ( yg - ref.y ) / PAS_REF;
int gypas = ( yg - ref.y ) / ipas;
for( int ii = ref.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
......@@ -237,9 +249,10 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
#endif
/* Plot the worksheet. */
// Plot the worksheet.
text_size.x = SIZETEXT * conv_unit;
text_size.y = SIZETEXT * conv_unit;
#if defined(KICAD_GOST)
text_size2.x = SIZETEXT * conv_unit * 2;
text_size2.y = SIZETEXT * conv_unit * 2;
......@@ -247,8 +260,9 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
text_size3.y = SIZETEXT * conv_unit * 3;
text_size1_5.x = SIZETEXT * conv_unit * 1.5;
text_size1_5.y = SIZETEXT * conv_unit * 1.5;
ref.x = PageSize.x - Sheet->m_RightMargin;
ref.y = PageSize.y - Sheet->m_BottomMargin;
ref.x = pageSize.x - pageInfo.GetRightMarginMils();
ref.y = pageSize.y - pageInfo.GetBottomMarginMils();
if( screen->m_ScreenNumber == 1 )
{
......@@ -287,7 +301,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
if( screen->m_NumberOfScreen > 1 )
msg << screen->m_ScreenNumber;
msg << screen->m_ScreenNumber;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
......@@ -297,7 +311,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
case WS_SHEETS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
msg << screen->m_NumberOfScreen;
plotter->text( pos, color,
msg, TEXT_ORIENT_HORIZ, text_size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
......@@ -334,8 +348,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color,
msg.GetData(), 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
......@@ -400,7 +414,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
switch( WsItem->m_Type )
{
case WS_CADRE:
/* Begin list number > 1 */
// Begin list number > 1
msg = screen->m_Commentaire1;
if( !msg.IsEmpty() )
{
......@@ -408,8 +422,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
msg, TEXT_ORIENT_HORIZ, text_size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
thickness, italic, false );
pos.x = (Sheet->m_LeftMargin + 1260) * conv_unit;
pos.y = (Sheet->m_TopMargin + 270) * conv_unit;
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * conv_unit;
pos.y = (pageInfo.GetTopMarginMils() + 270) * conv_unit;
plotter->text( pos, color,
msg, 1800, text_size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
......@@ -444,9 +458,11 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
}
}
}
#else
ref.x = PageSize.x - GRID_REF_W - Sheet->m_RightMargin;
ref.y = PageSize.y - GRID_REF_W - Sheet->m_BottomMargin;
ref.x = pageSize.x - GRID_REF_W - pageInfo.GetRightMarginMils();
ref.y = pageSize.y - GRID_REF_W - pageInfo.GetBottomMarginMils();
for( Ki_WorkSheetData* WsItem = &WS_Date;
WsItem != NULL;
......@@ -477,7 +493,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break;
case WS_SIZESHEET:
msg += screen->m_CurrentSheetDesc->m_Name;
msg += pageInfo.GetType();
break;
case WS_IDENTSHEET:
......
......@@ -16,6 +16,7 @@
#include "wxstruct.h"
#include "wx/valgen.h"
#include <wx/tokenzr.h>
#ifdef EESCHEMA
#include "general.h"
......@@ -23,14 +24,6 @@
#include "dialog_page_settings.h"
#define NB_ITEMS 11
Ki_PageDescr* SheetList[NB_ITEMS + 1] =
{
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
&g_Sheet_user, NULL
};
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
{
......@@ -43,13 +36,12 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
DIALOG_PAGES_SETTINGS_BASE( parent )
DIALOG_PAGES_SETTINGS_BASE( parent ),
m_user_size( wxT( "User" ) )
{
m_Parent = parent;
m_Screen = m_Parent->GetScreen();
m_Modified = 0;
m_SelectedSheet = NULL;
m_CurrentSelection = 0;
m_modified = false;
initDialog();
......@@ -65,51 +57,64 @@ DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
void DIALOG_PAGES_SETTINGS::initDialog()
{
wxString msg;
wxString msg;
double userSizeX;
double userSizeY;
SetFocus();
SearchPageSizeSelection();
// Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel();
msg.Printf( format, m_Screen->m_NumberOfScreen );
m_TextSheetCount->SetLabel( msg );
format = m_TextSheetNumber->GetLabel();
msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg );
m_page = m_Parent->GetPageSettings();
setCurrentPageSizeSelection();
switch( g_UserUnit )
{
case MILLIMETRES:
UserSizeX = (double) g_Sheet_user.m_Size.x * 25.4 / 1000;
UserSizeY = (double) g_Sheet_user.m_Size.y * 25.4 / 1000;
msg.Printf( wxT( "%.2f" ), UserSizeX );
userSizeX = m_user_size.GetWidthMils() * 25.4e-3;
userSizeY = m_user_size.GetHeightMils() * 25.4e-3;
msg.Printf( wxT( "%.2f" ), userSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.2f" ), UserSizeY );
msg.Printf( wxT( "%.2f" ), userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
default:
case INCHES:
UserSizeX = (double) g_Sheet_user.m_Size.x / 1000;
UserSizeY = (double) g_Sheet_user.m_Size.y / 1000;
msg.Printf( wxT( "%.3f" ), UserSizeX );
userSizeX = m_user_size.GetWidthMils() / 1000.0;
userSizeY = m_user_size.GetHeightMils() / 1000.0;
msg.Printf( wxT( "%.3f" ), userSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.3f" ), UserSizeY );
msg.Printf( wxT( "%.3f" ), userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
/* // you want it in mils, why?
case UNSCALED_UNITS:
UserSizeX = g_Sheet_user.m_Size.x;
UserSizeY = g_Sheet_user.m_Size.y;
msg.Printf( wxT( "%f" ), UserSizeX );
userSizeX = m_user_size.GetWidthMils();
userSizeY = m_user_size.GetHeightMils();
msg.Printf( wxT( "%f" ), m_userSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%f" ), UserSizeY );
msg.Printf( wxT( "%f" ), m_userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
*/
}
// Set validators
m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
// m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
m_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) );
......@@ -139,7 +144,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
{
EndModal( m_Modified );
EndModal( m_modified );
}
......@@ -150,7 +155,7 @@ void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{
SavePageSettings( event );
m_Modified = 1;
m_modified = true;
Close( true );
}
......@@ -167,8 +172,9 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{
double dtmp;
wxString msg;
double userSizeX;
double userSizeY;
m_Screen->m_Revision = m_TextRevision->GetValue();
m_Screen->m_Company = m_TextCompany->GetValue();
......@@ -179,58 +185,51 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
msg = m_TextUserSizeX->GetValue();
msg.ToDouble( &dtmp );
UserSizeX = dtmp;
msg.ToDouble( &userSizeX );
msg = m_TextUserSizeY->GetValue();
msg.ToDouble( &dtmp );
UserSizeY = dtmp;
msg.ToDouble( &userSizeY );
int ii = m_PageSizeBox->GetSelection();
int radioSelection = m_PageSizeBox->GetSelection();
if( radioSelection < 0 )
radioSelection = 0;
if( ii < 0 )
ii = 0;
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
wxString paperType = m_PageSizeBox->GetString( radioSelection );
m_SelectedSheet = SheetList[ii];
m_Screen->m_CurrentSheetDesc = m_SelectedSheet;
m_page.SetType( paperType );
m_Parent->SetPageSettings( m_page );
switch( g_UserUnit )
{
case MILLIMETRES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 / 25.4 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 / 25.4 );
PAGE_INFO::SetUserWidthMils( int( userSizeX * 1000.0 / 25.4 ) );
PAGE_INFO::SetUserHeightMils( int( userSizeY * 1000.0 / 25.4 ) );
break;
default:
case INCHES:
g_Sheet_user.m_Size.x = (int) ( UserSizeX * 1000 );
g_Sheet_user.m_Size.y = (int) ( UserSizeY * 1000 );
PAGE_INFO::SetUserWidthMils( int( 1000 * userSizeX ) );
PAGE_INFO::SetUserHeightMils( int( 1000 * userSizeY ) );
break;
/* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS:
g_Sheet_user.m_Size.x = (int) ( UserSizeX );
g_Sheet_user.m_Size.y = (int) ( UserSizeY );
PAGE_INFO::SetUserWidthMils( (int) userSizeX );
PAGE_INFO::SetUserHeightMils( (int) userSizeY );
break;
*/
}
if( g_Sheet_user.m_Size.x < 6000 )
g_Sheet_user.m_Size.x = 6000;
if( g_Sheet_user.m_Size.x > 44000 )
g_Sheet_user.m_Size.x = 44000;
if( g_Sheet_user.m_Size.y < 4000 )
g_Sheet_user.m_Size.y = 4000;
if( g_Sheet_user.m_Size.y > 44000 )
g_Sheet_user.m_Size.y = 44000;
#ifdef EESCHEMA
/* Exports settings to other sheets if requested: */
// Exports settings to other sheets if requested:
SCH_SCREEN* screen;
/* Build the screen list */
// Build the screen list
SCH_SCREENS ScreenList;
/* Update the datas */
// Update the datas
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen == m_Screen )
......@@ -265,21 +264,31 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
/* Search the correct index to activate the radiobox list size selection
* according to the current page size
*/
void DIALOG_PAGES_SETTINGS::SearchPageSizeSelection()
void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
{
Ki_PageDescr* sheet;
int ii;
wxString curPaperType = m_page.GetType();
m_CurrentSelection = NB_ITEMS - 1;
// use wxFormBuilder to store the sheet type in the wxRadioButton's label
// i.e. "A4", "A3", etc, anywhere within the text of the label.
for( ii = 0; ii < NB_ITEMS; ii++ )
{
sheet = SheetList[ii];
D(printf("m_PageSizeBox->GetCount() = %d\n", (int) m_PageSizeBox->GetCount() );)
if( m_Parent->GetScreen()->m_CurrentSheetDesc == sheet )
m_CurrentSelection = ii;
// search all the child wxRadioButtons for a label containing our paper type
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 @@
class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
{
private:
EDA_DRAW_FRAME *m_Parent;
BASE_SCREEN * m_Screen;
int m_Modified;
Ki_PageDescr * m_SelectedSheet;
float UserSizeX, UserSizeY;
int m_CurrentSelection;
EDA_DRAW_FRAME* m_Parent;
BASE_SCREEN* m_Screen;
bool m_modified;
PAGE_INFO m_page; ///< the one being edited
PAGE_INFO m_user_size; ///< instantiated just to get the size
public:
DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent );
......@@ -37,7 +36,8 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
void SearchPageSizeSelection();
void setCurrentPageSizeSelection();
void SavePageSettings(wxCommandEvent& event);
void ReturnSizeSelected(wxCommandEvent& event);
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -28,7 +28,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
LeftColumnSizer->SetFlexibleDirection( wxBOTH );
LeftColumnSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxString m_PageSizeBoxChoices[] = { _("Size A4"), _("Size A3"), _("Size A2"), _("Size A1"), _("Size A0"), _("Size A"), _("Size B"), _("Size C"), _("Size D"), _("Size E"), _("User size") };
wxString m_PageSizeBoxChoices[] = { _("A4"), _("A3"), _("A2"), _("A1"), _("A0"), _("A"), _("B"), _("C"), _("D"), _("E"), _("User") };
int m_PageSizeBoxNChoices = sizeof( m_PageSizeBoxChoices ) / sizeof( wxString );
m_PageSizeBox = new wxRadioBox( this, wxID_ANY, _("Page Size:"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxNChoices, m_PageSizeBoxChoices, 1, wxRA_SPECIFY_COLS );
m_PageSizeBox->SetSelection( 1 );
......@@ -108,7 +108,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
RevisionSizer->Add( m_TextRevision, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_RevisionExport = new wxCheckBox( this, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
RevisionSizer->Add( m_RevisionExport, 0, wxALL, 5 );
RightColumnSizer->Add( RevisionSizer, 1, wxEXPAND, 5 );
......@@ -122,7 +121,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
TitleSizer->Add( m_TextTitle, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TitleExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
TitleSizer->Add( m_TitleExport, 0, wxALL, 5 );
RightColumnSizer->Add( TitleSizer, 1, wxEXPAND, 5 );
......@@ -136,7 +134,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
CompanySizer->Add( m_TextCompany, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_CompanyExport = new wxCheckBox( this, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
CompanySizer->Add( m_CompanyExport, 0, wxALL, 5 );
RightColumnSizer->Add( CompanySizer, 1, wxEXPAND, 5 );
......@@ -150,7 +147,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment1Sizer->Add( m_TextComment1, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment1Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment1Sizer->Add( m_Comment1Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment1Sizer, 1, wxEXPAND, 5 );
......@@ -164,7 +160,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment2Sizer->Add( m_TextComment2, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment2Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment2Sizer->Add( m_Comment2Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment2Sizer, 1, wxEXPAND, 5 );
......@@ -178,7 +173,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment3Sizer->Add( m_TextComment3, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment3Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment3Sizer->Add( m_Comment3Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment3Sizer, 1, wxEXPAND, 5 );
......@@ -192,7 +186,6 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
Comment4Sizer->Add( m_TextComment4, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment4Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment4Sizer->Add( m_Comment4Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment4Sizer, 1, wxEXPAND, 5 );
......@@ -230,4 +223,5 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE()
m_TitleExport->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
}
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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -80,16 +80,17 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ){ event.Skip(); }
virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ){ event.Skip(); }
virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCheckboxTitleClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,497 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,497 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PAGES_SETTINGS_BASE();
};
......
......@@ -51,7 +51,7 @@
static const wxString traceScrollSettings( wxT( "KicadScrollSettings" ) );
/* Configuration entry names. */
// Configuration entry names.
static const wxString CursorShapeEntryKeyword( wxT( "CursorShape" ) );
static const wxString ShowGridEntryKeyword( wxT( "ShowGrid" ) );
static const wxString GridColorEntryKeyword( wxT( "GridColor" ) );
......@@ -115,7 +115,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 );
/* Make sure window has a sane minimum size. */
// Make sure window has a sane minimum size.
if( ( size.x < minsize.x ) || ( size.y < minsize.y ) )
SetSize( 0, 0, minsize.x, minsize.y );
......@@ -524,12 +524,11 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
logicalClientSize.x = wxRound( (double) clientSize.x / scalar );
logicalClientSize.y = wxRound( (double) clientSize.y / scalar );
// The upper left corner of the drawing in device units.
int w = screen->ReturnPageSize().x;
int h = screen->ReturnPageSize().y;
// A corner of the drawing in internal units.
wxSize corner = GetPageSizeIU();
// The drawing rectangle logical units
wxRect drawingRect( wxPoint( 0, 0 ), wxSize( w, h ) );
wxRect drawingRect( wxPoint( 0, 0 ), corner );
wxLogTrace( traceScrollSettings, wxT( "Logical drawing rect = ( %d, %d, %d, %d )." ),
drawingRect.x, drawingRect.y, drawingRect.width, drawingRect.height );
......@@ -749,12 +748,12 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
if( !screen )
return;
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
// Display Zoom level: zoom = zoom_coeff/ZoomScalar
Line.Printf( wxT( "Z %g" ), screen->GetZoom() );
SetStatusText( Line, 1 );
/* Display absolute coordinates: */
// Display absolute coordinates:
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_internalUnits );
double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, m_internalUnits );
......@@ -769,7 +768,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
dYpos = RoundTo0( dYpos, (double)( m_internalUnits / 10 ) );
}
/* The following sadly is an if Eeschema/if Pcbnew */
// The following sadly is an if Eeschema/if Pcbnew
wxString absformatter;
wxString locformatter;
switch( g_UserUnit )
......@@ -809,7 +808,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
Line.Printf( absformatter, dXpos, dYpos );
SetStatusText( Line, 2 );
/* Display relative coordinates: */
// Display relative coordinates:
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx, m_internalUnits );
......@@ -821,7 +820,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
dYpos = RoundTo0( dYpos, (double) ( m_internalUnits / 10 ) );
}
/* We already decided the formatter above */
// We already decided the formatter above
Line.Printf( locformatter, dXpos, dYpos );
SetStatusText( Line, 3 );
}
......
......@@ -527,23 +527,24 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
int axis_color = BLUE;
BASE_SCREEN* screen = GetScreen();
GRSetDrawMode( DC, GR_COPY );
if( GetParent()->IsGridVisible() )
DrawGrid( DC );
/* Draw axis */
// Draw axis
if( GetParent()->m_showAxis )
{
/* Draw the Y axis */
GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y,
0, screen->ReturnPageSize().y, 0, axis_color );
wxSize pageSize = GetParent()->GetPageSizeIU();
/* Draw the X axis */
GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0,
screen->ReturnPageSize().x, 0, 0, axis_color );
// Draw the Y axis
GRDashedLine( &m_ClipBox, DC, 0, -pageSize.y,
0, pageSize.y, 0, axis_color );
// Draw the X axis
GRDashedLine( &m_ClipBox, DC, -pageSize.x, 0,
pageSize.x, 0, 0, axis_color );
}
if( GetParent()->m_showOriginAxis )
......@@ -676,29 +677,31 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
{
if( GetParent()->m_originAxisPosition == wxPoint( 0, 0 ) )
wxPoint origin = GetParent()->GetOriginAxisPosition();
if( origin == wxPoint( 0, 0 ) )
return;
int Color = DARKRED;
BASE_SCREEN* screen = GetScreen();
int color = DARKRED;
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
/* Draw the Y axis */
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
GetParent()->m_originAxisPosition.x,
-screen->ReturnPageSize().y,
GetParent()->m_originAxisPosition.x,
screen->ReturnPageSize().y,
0, Color );
origin.x,
-pageSize.y,
origin.x,
pageSize.y,
0, color );
/* Draw the X axis */
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-screen->ReturnPageSize().x,
GetParent()->m_originAxisPosition.y,
screen->ReturnPageSize().x,
GetParent()->m_originAxisPosition.y,
0, Color );
-pageSize.x,
origin.y,
pageSize.x,
origin.y,
0, color );
}
......@@ -710,25 +713,26 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, int aDrawMode )
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
return;
int Color = GetParent()->GetGridColor();
int color = GetParent()->GetGridColor();
wxSize pageSize = GetParent()->GetPageSizeIU();
GRSetDrawMode( aDC, aDrawMode );
/* Draw the Y axis */
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
screen->m_GridOrigin.x,
-screen->ReturnPageSize().y,
-pageSize.y,
screen->m_GridOrigin.x,
screen->ReturnPageSize().y,
0, Color );
pageSize.y,
0, color );
/* Draw the X axis */
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-screen->ReturnPageSize().x,
-pageSize.x,
screen->m_GridOrigin.y,
screen->ReturnPageSize().x,
pageSize.x,
screen->m_GridOrigin.y,
0, Color );
0, color );
}
......@@ -1116,7 +1120,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
int localkey;
wxPoint pos;
localkey = event.GetKeyCode();
localkey = event.GetKeyCode();
switch( localkey )
{
......
......@@ -47,6 +47,9 @@ class MODULE;
*/
int GetLayerMask( int aLayerNumber )
{
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
#if 0
// Look up Table for conversion one layer number -> one bit layer mask:
static int tabOneLayerMask[LAYER_COUNT] =
{
......@@ -60,8 +63,10 @@ int GetLayerMask( int aLayerNumber )
0x10000000, 0x20000000, 0x40000000, 0x80000000
};
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
return( tabOneLayerMask[aLayerNumber] );
#else
return 1 << aLayerNumber;
#endif
}
/* Look up Table for conversion copper layer count -> general copper layer
......
......@@ -216,12 +216,6 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
}
/**
* Function SaveCurrentSetupValues
* Save the current setup values in m_settings
* saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers
*/
void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
{
PARAM_CFG_BASE* pt_cfg;
......@@ -253,12 +247,15 @@ void EDA_APP::SaveCurrentSetupValues( const PARAM_CFG_ARRAY& List )
if( m_settings == NULL )
return;
BOOST_FOREACH( const PARAM_CFG_BASE& param, List )
unsigned count = List.size();
for( unsigned i=0; i<count; ++i )
{
const PARAM_CFG_BASE& param = List[i];
if( param.m_Setup == false )
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 )
m_settings->DeleteGroup( param.m_Ident );
......@@ -441,10 +438,6 @@ PARAM_CFG_INT::PARAM_CFG_INT( bool Insetup, const wxChar* ident, int* ptparam,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -459,10 +452,6 @@ void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -495,10 +484,6 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -511,10 +496,6 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -553,10 +534,6 @@ PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( bool Insetup,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -582,10 +559,6 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -617,10 +590,6 @@ PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -632,10 +601,6 @@ void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -666,10 +631,6 @@ PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxChar* ident,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -678,10 +639,6 @@ void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -701,10 +658,6 @@ PARAM_CFG_FILENAME::PARAM_CFG_FILENAME( const wxChar* ident,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -720,10 +673,6 @@ void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -745,10 +694,6 @@ PARAM_CFG_LIBNAME_LIST::PARAM_CFG_LIBNAME_LIST( const wxChar* ident,
}
/** ReadParam
* read the value of parameter this stored in aConfig
* @param aConfig = the wxConfigBase that store the parameter
*/
void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -778,10 +723,6 @@ void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
}
/** SaveParam
* save the value of parameter this in aConfig (list of parameters)
* @param aConfig = the wxConfigBase that can store the parameter
*/
void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
{
if( m_Pt_param == NULL || aConfig == NULL )
......@@ -799,6 +740,7 @@ void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
// We use indexlib+1 because first lib name is LibName1
configkey << (indexlib + 1);
libname = libname_list->Item( indexlib );
// filenames are stored using Unix notation
libname.Replace(wxT("\\"), wxT("/") );
aConfig->Write( configkey, libname );
......
This diff is collapsed.
......@@ -87,7 +87,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
SetIcon( icon );
SetBoard( new BOARD() );
SetScreen( new PCB_SCREEN() );
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
LoadSettings();
......
......@@ -119,7 +119,7 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
{
FOOTPRINT_INFO & footprint = list.GetItem(ii);
msg.Printf( wxT( "%3d %s" ), m_FullFootprintList.GetCount() + 1,
msg.Printf( wxT( "%3d %s" ), (int) m_FullFootprintList.GetCount() + 1,
GetChars(footprint.m_Module) );
m_FullFootprintList.Add( msg );
}
......
......@@ -605,7 +605,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
{
wxString msg;
msg.Printf( _( "Components: %d (free: %d)" ), m_components.size(), m_undefinedComponentCnt );
msg.Printf( _( "Components: %d (free: %d)" ), (int) m_components.size(), m_undefinedComponentCnt );
SetStatusText( msg, 0 );
SetStatusText( wxEmptyString, 1 );
......@@ -614,10 +614,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
{
if( m_FootprintList->m_UseFootprintFullList )
msg.Printf( _( "Footprints (All): %d" ),
m_FootprintList->m_ActiveFootprintList->GetCount() );
(int) m_FootprintList->m_ActiveFootprintList->GetCount() );
else
msg.Printf( _( "Footprints (filtered): %d" ),
m_FootprintList->m_ActiveFootprintList->GetCount() );
(int) m_FootprintList->m_ActiveFootprintList->GetCount() );
}
else
{
......
......@@ -199,7 +199,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
{
int tmpzoom;
wxPoint tmp_startvisu;
wxSize SheetSize; // Sheet size in internal units
wxSize sheetSize; // Sheet size in internal units
wxPoint old_org;
bool success = true;
......@@ -209,16 +209,15 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
SheetSize = screen->ReturnPageSize(); // page size in 1/1000 inch, ie in internal units
sheetSize = screen->GetPageSettings().GetSizeIU(); // page size in 1/1000 inch, ie in internal units
screen->SetScalingFactor( 1.0 );
EDA_DRAW_PANEL* panel = frame->GetCanvas();
SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
// to print floating point numbers like 1.3)
LOCALE_IO toggle;
float dpi = (float) frame->GetInternalUnits();
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
wxSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi );
EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc );
......@@ -234,11 +233,9 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );
GRForceBlackPen( false );
screen->m_StartVisu = tmp_startvisu;
......
......@@ -4,7 +4,6 @@
class EDA_DRAW_FRAME;
class BASE_SCREEN;
#include "dialog_SVG_print_base.h"
......
......@@ -567,8 +567,8 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
bool CompactForm )
{
#if defined(KICAD_GOST)
wxString outStr;
wxString tmpStr;
wxString outStr;
wxString tmpStr;
#endif
if( IsFieldChecked( FOOTPRINT ) )
......@@ -577,7 +577,7 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
{
#if defined(KICAD_GOST)
outStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol,
GetChars( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
GetChars( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
#else
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
TO_UTF8( DrawLibItem->GetField( FOOTPRINT )->m_Text ) );
......@@ -602,10 +602,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
if( CompactForm )
#if defined(KICAD_GOST)
{
{
tmpStr.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol,
GetChars( DrawLibItem->GetField( ii )->m_Text ) );
outStr += tmpStr;
outStr += tmpStr;
}
#else
fprintf( f, "%c%s", s_ExportSeparatorSymbol,
......@@ -613,10 +613,10 @@ void DIALOG_BUILD_BOM::PrintFieldData( FILE* f, SCH_COMPONENT* DrawLibItem,
#endif
else
#if defined(KICAD_GOST)
{
{
tmpStr.Printf( wxT( "; %-12s" ),
GetChars( DrawLibItem->GetField( ii )->m_Text ) );
outStr += tmpStr;
outStr += tmpStr;
}
#else
fprintf( f, "; %-12s",
......@@ -750,11 +750,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{
#if defined(KICAD_GOST)
strCur.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, GetChars( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
strCur.Printf( wxT( "%c%s)" ), s_ExportSeparatorSymbol, GetChars( msg ) );
#else
fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
TO_UTF8( msg ) );
#endif
......@@ -762,7 +762,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
else
{
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
msg = m_Parent->GetXYSheetReferences( comp->GetPosition() );
fprintf( f, " (loc %s)", TO_UTF8( msg ) );
}
}
......@@ -828,8 +828,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
#if defined(KICAD_GOST)
else
{
switch (amount)
{
switch (amount)
{
case 1:
fprintf( f, "%s%s%c%d\n", CmpNameFirst.c_str(), TO_UTF8( strPred ),
s_ExportSeparatorSymbol, amount );
......@@ -844,8 +844,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
fprintf( f, "%s..%s%s%c%d\n", CmpNameFirst.c_str(), CmpNameLast.c_str(),
TO_UTF8( strPred ), s_ExportSeparatorSymbol, amount );
break;
}
}
}
}
#endif
return 0;
......@@ -1060,13 +1060,13 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
{
msg = aList[ii].GetSheetPath().PathHumanReadable();
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->GetPosition() );
msg = m_Parent->GetXYSheetReferences( DrawLibItem->GetPosition() );
fprintf( f, " (loc %s)", TO_UTF8( msg ) );
}
}
#if defined(KICAD_GOST)
fprintf( f, "%s", TO_UTF8( PrintFieldData( DrawLibItem ) ) );
fprintf( f, "%s", TO_UTF8( PrintFieldData( DrawLibItem ) ) );
#else
PrintFieldData( f, DrawLibItem );
#endif
......
......@@ -63,11 +63,11 @@ private:
void initDlg();
void initOptVars();
void CreateDXFFile();
void PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen, Ki_PageDescr* sheet,
void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen,
wxPoint plot_offset, double scale );
};
/* static members (static to remember last state): */
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = false;
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true;
......@@ -147,8 +147,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
wxString PlotFileName;
Ki_PageDescr* PlotSheet;
wxString plotFileName;
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
......@@ -186,15 +185,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
sheetpath = SheetList.GetNext();
}
PlotSheet = screen->m_CurrentSheetDesc;
double scale = 10;
plot_offset.x = 0;
plot_offset.y = 0;
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
PlotOneSheetDXF( plotFileName, screen, plot_offset, scale );
if( !m_select_PlotAll )
break;
......@@ -206,14 +204,14 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
}
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale )
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen,
wxPoint plot_offset,
double scale )
{
wxString msg;
wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
......@@ -227,13 +225,17 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg );
SetLocaleTo_C_standard();
LOCALE_IO toggle;
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( sheet );
const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( m_plotColorOpt );
/* Init : */
// Init :
plotter->set_creator( wxT( "Eeschema-DXF" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
......@@ -246,10 +248,9 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
screen->Plot( plotter );
/* fin */
// finish
plotter->end_plot();
delete plotter;
SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) );
}
......@@ -70,12 +70,13 @@ private:
void initOptVars();
void createPSFile();
void plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen, Ki_PageDescr* sheet,
SCH_SCREEN* screen, const PAGE_INFO& pageInfo,
wxPoint plot_offset, double scale );
};
/* static members (static to remember last state): */
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = false;
int DIALOG_PLOT_SCHEMATIC_PS:: m_pageSizeSelect = PAGE_SIZE_AUTO;
int DIALOG_PLOT_SCHEMATIC_PS::m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
......@@ -172,13 +173,13 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxString plotFileName;
Ki_PageDescr* actualPage; // page size selected in schematic
Ki_PageDescr* plotPage; // page size selected to plot
wxPoint plot_offset;
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxString plotFileName;
PAGE_INFO actualPage; // page size selected in schematic
PAGE_INFO plotPage; // page size selected to plot
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must update component references
......@@ -213,16 +214,16 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
sheetpath = SheetList.GetNext();
}
actualPage = screen->m_CurrentSheetDesc;
actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
plotPage = &g_Sheet_A;
plotPage.SetType( wxT( "A" ) );
break;
case PAGE_SIZE_A4:
plotPage = &g_Sheet_A4;
plotPage.SetType( wxT( "A4" ) );
break;
case PAGE_SIZE_AUTO:
......@@ -231,8 +232,9 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
break;
}
double scalex = (double) plotPage->m_Size.x / actualPage->m_Size.x;
double scaley = (double) plotPage->m_Size.y / actualPage->m_Size.y;
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = 10 * MIN( scalex, scaley );
plot_offset.x = 0;
......@@ -252,11 +254,11 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
}
void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen,
Ki_PageDescr* sheet,
wxPoint plot_offset,
double scale )
void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen,
const PAGE_INFO& pageInfo,
wxPoint plot_offset,
double scale )
{
wxString msg;
......@@ -276,12 +278,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
m_MsgBox->AppendText( msg );
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->set_paper_size( sheet );
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode( m_plotColorOpt );
/* Init : */
// Init :
plotter->set_creator( wxT( "Eeschema-PS" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
......
......@@ -95,7 +95,7 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
m_checkMonochrome->SetValue( aParent->GetPrintMonochrome() );
#ifdef __WXMAC__
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
// Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_buttonPreview->Hide();
#endif
}
......@@ -310,7 +310,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
{
int oldZoom;
wxPoint tmp_startvisu;
wxSize SheetSize; // Page size in internal units
wxSize pageSizeIU; // Page size in internal units
wxPoint old_org;
EDA_RECT oldClipBox;
wxRect fitRect;
......@@ -320,10 +320,11 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxBusyCursor dummy;
/* Save current scale factor, offsets, and clip box. */
// Save current scale factor, offsets, and clip box.
tmp_startvisu = aScreen->m_StartVisu;
oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg;
oldClipBox = *panel->GetClipBox();
// Change clip box to print the whole page.
......@@ -336,9 +337,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
if( printReference )
{
/* Draw the page to a memory and let the dc calculate the drawing
* limits.
*/
// Draw the page to a memory and let the dc calculate the drawing limits.
wxBitmap psuedoBitmap( 1, 1 );
wxMemoryDC memDC;
memDC.SelectObject( psuedoBitmap );
......@@ -348,16 +347,17 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxLogDebug( wxT( "MinX = %d, MaxX = %d, MinY = %d, MaxY = %d" ),
memDC.MinX(), memDC.MaxX(), memDC.MinY(), memDC.MaxY() );
SheetSize.x = memDC.MaxX() - memDC.MinX();
SheetSize.y = memDC.MaxY() - memDC.MinY();
pageSizeIU.x = memDC.MaxX() - memDC.MinX();
pageSizeIU.y = memDC.MaxY() - memDC.MinY();
FitThisSizeToPageMargins( SheetSize, parent->GetPageSetupData() );
FitThisSizeToPageMargins( pageSizeIU, parent->GetPageSetupData() );
fitRect = GetLogicalPageMarginsRect( parent->GetPageSetupData() );
}
else
{
SheetSize = aScreen->m_CurrentSheetDesc->m_Size;
FitThisSizeToPaper( SheetSize );
pageSizeIU = aScreen->GetPageSettings().GetSizeIU();
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();
}
......
......@@ -77,7 +77,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
/* Hotkey IDs */
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, s_Eeschema_Hokeys_Descr );
break;
......@@ -145,7 +145,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
break;
/* Hotkey IDs */
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Eeschema_Hokeys_Descr );
break;
......@@ -267,7 +267,7 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
NET_TYPE_PCBNEW,
NET_TYPE_CUSTOM_MAX ) );
/* NOTE: Left as global until supporting code can be fixed. */
// NOTE: Left as global until supporting code can be fixed.
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLSpd" ),
&g_HPGL_Pen_Descr.m_Pen_Speed,
20, 2, 45 ) );
......@@ -277,6 +277,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "HPGLNum" ),
&g_HPGL_Pen_Descr.m_Pen_Num,
1, 1, 8 ) );
/* these globals don't exist
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offX_A4" ),
&g_Sheet_A4.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_A4" ),
......@@ -317,6 +319,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
&g_Sheet_E.m_Offset.x ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "offY_E" ),
&g_Sheet_E.m_Offset.y ) );
*/
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "RptD_X" ),
&g_RepeatStep.x,
0, -1000, +1000 ) );
......@@ -362,7 +366,7 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
IsRead = false;
}
/* User library path takes precedent over default library search paths. */
// User library path takes precedent over default library search paths.
wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 );
/* If the list is void, force loading the library "power.lib" that is
......@@ -382,7 +386,7 @@ void SCH_EDIT_FRAME::SaveProjectFile()
{
wxFileName fn;
fn = g_RootSheet->GetScreen()->GetFileName(); /*ConfigFileName*/
fn = g_RootSheet->GetScreen()->GetFileName(); //ConfigFileName
fn.SetExt( ProjectFileExtension );
if( !IsWritable( fn ) )
......@@ -528,7 +532,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
/* Load print preview window session settings. */
// Load print preview window session settings.
cfg->Read( PreviewFramePositionXEntry, &tmp, -1 );
m_previewPosition.x = (int) tmp;
cfg->Read( PreviewFramePositionYEntry, &tmp, -1 );
......@@ -538,7 +542,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( PreviewFrameHeightEntry, &tmp, -1 );
m_previewSize.SetHeight( (int) tmp );
/* Load print dialog session settings. */
// Load print dialog session settings.
cfg->Read( PrintDialogPositionXEntry, &tmp, -1 );
m_printDialogPosition.x = (int) tmp;
cfg->Read( PrintDialogPositionYEntry, &tmp, -1 );
......@@ -552,7 +556,7 @@ void SCH_EDIT_FRAME::LoadSettings()
cfg->Read( SpiceNetNamesEntry, &g_OptNetListUseNames, false );
cfg->Read( SimulatorCommandEntry, &m_simulatorCommand );
/* Load find dialog session setting. */
// Load find dialog session setting.
cfg->Read( FindDialogPositionXEntry, &tmp, -1 );
m_findDialogPosition.x = (int) tmp;
cfg->Read( FindDialogPositionYEntry, &tmp, -1 );
......@@ -568,7 +572,7 @@ void SCH_EDIT_FRAME::LoadSettings()
m_findReplaceData->SetFindString( cfg->Read( FindStringEntry, wxEmptyString ) );
m_findReplaceData->SetReplaceString( cfg->Read( ReplaceStringEntry, wxEmptyString ) );
/* Load the find and replace string history list. */
// Load the find and replace string history list.
for ( size_t i = 0; i < FR_HISTORY_LIST_CNT; i++ )
{
wxString tmpHistory;
......@@ -619,13 +623,13 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
/* Save print preview window session settings. */
// Save print preview window session settings.
cfg->Write( PreviewFramePositionXEntry, m_previewPosition.x );
cfg->Write( PreviewFramePositionYEntry, m_previewPosition.y );
cfg->Write( PreviewFrameWidthEntry, m_previewSize.GetWidth() );
cfg->Write( PreviewFrameHeightEntry, m_previewSize.GetHeight() );
/* Save print dialog session settings. */
// Save print dialog session settings.
cfg->Write( PrintDialogPositionXEntry, m_printDialogPosition.x );
cfg->Write( PrintDialogPositionYEntry, m_printDialogPosition.y );
cfg->Write( PrintDialogWidthEntry, m_printDialogSize.GetWidth() );
......@@ -635,7 +639,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( SpiceNetNamesEntry, g_OptNetListUseNames );
cfg->Write( SimulatorCommandEntry, m_simulatorCommand );
/* Save find dialog session setting. */
// Save find dialog session setting.
cfg->Write( FindDialogPositionXEntry, m_findDialogPosition.x );
cfg->Write( FindDialogPositionYEntry, m_findDialogPosition.y );
cfg->Write( FindDialogWidthEntry, m_findDialogSize.GetWidth() );
......@@ -647,7 +651,7 @@ void SCH_EDIT_FRAME::SaveSettings()
cfg->Write( FindStringEntry, m_findReplaceData->GetFindString() );
cfg->Write( ReplaceStringEntry, m_findReplaceData->GetReplaceString() );
/* Save the find and replace string history list. */
// Save the find and replace string history list.
size_t i;
wxString tmpHistory;
wxString entry; // invoke constructor outside of any loops
......
......@@ -244,7 +244,10 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
if( aIsNew )
{
screen->m_CurrentSheetDesc = &g_Sheet_A4;
/* SCH_SCREEN constructor does this now
screen->SetPageSettings( PAGE_INFO( wxT( "A4" ) ) );
*/
screen->SetZoom( 32 );
screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
screen->m_Title = NAMELESS_PROJECT;
......
......@@ -33,54 +33,71 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
switch( event.GetId() )
{
case ID_LIBEDIT_GEN_PNG_FILE:
{
bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
// calling wxYield is mandatory under Linux, after closing the file selector dialog
// to refresh the screen before creating the PNG or JPEG image from screen
wxYield();
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
}
{
bool fmt_is_jpeg = false; // could be selectable later. so keep this option.
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
// calling wxYield is mandatory under Linux, after closing the file selector dialog
// to refresh the screen before creating the PNG or JPEG image from screen
wxYield();
CreatePNGorJPEGFile( FullFileName, fmt_is_jpeg );
}
break;
case ID_LIBEDIT_GEN_SVG_FILE:
{
file_ext = wxT( "svg" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
/* Give a size to the SVG draw area = component size + margin
* the margin is 10% the size of the component size
*/
wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2);
componentSize.y = (int)(componentSize.y * 1.2);
GetScreen()->SetPageSize( componentSize );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize );
}
{
file_ext = wxT( "svg" );
mask = wxT( "*." ) + file_ext;
wxFileName fn( cmp->GetName() );
fn.SetExt( file_ext );
FullFileName = EDA_FileSelector( _( "Filename:" ), wxGetCwd(),
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, true );
if( FullFileName.IsEmpty() )
return;
#if 0 // would the PAGE_INFO margins work for this old code:
// Give a size to the SVG draw area = component size + margin
// the margin is 10% the size of the component size
wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2);
componentSize.y = (int)(componentSize.y * 1.2);
GetScreen()->SetPageSize( componentSize );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize );
#else
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) );
pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) );
GetScreen()->SetPageSettings( pageTemp );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSettings( pageSave );
#endif
}
break;
}
}
......@@ -116,7 +133,8 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode
if( ! m_component )
return;
wxSize pagesize = GetScreen()->ReturnPageSize();
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
/* Plot item centered to the page
* In libedit, the component is centered at 0,0 coordinates.
* So we must plot it with an offset = pagesize/2.
......
......@@ -210,7 +210,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
SetIcon( icon );
SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadSettings();
......@@ -285,6 +287,39 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
}
void LIB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );
}
const PAGE_INFO& LIB_EDIT_FRAME::GetPageSettings () const
{
return GetScreen()->GetPageSettings();
}
const wxSize LIB_EDIT_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
}
const wxPoint& LIB_EDIT_FRAME::GetOriginAxisPosition() const
{
wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition();
}
void LIB_EDIT_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
}
void LIB_EDIT_FRAME::LoadSettings()
{
wxConfig* cfg;
......@@ -377,8 +412,11 @@ double LIB_EDIT_FRAME::BestZoom()
}
else
{
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
dx = pageInfo.GetSizeIU().x;
dy = pageInfo.GetSizeIU().y;
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
}
......
......@@ -257,7 +257,17 @@ public:
double BestZoom(); // Returns the best zoom
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
SCH_SCREEN* GetScreen() const { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these 5 functions:
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
......
......@@ -48,7 +48,7 @@
#include "sch_bitmap.h"
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window );
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
static void LoadLayers( LINE_READER* aLine );
......@@ -300,45 +300,20 @@ static void LoadLayers( LINE_READER* aLine )
/* Read the schematic header. */
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScreen )
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScreen )
{
char Text[256];
char text[256];
char buf[1024];
int ii;
Ki_PageDescr* wsheet = &g_Sheet_A4;
wxSize PageSize;
char* line;
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();
wxSize pageSize;
char* 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 );
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;
}
wxString pagename = FROM_UTF8( text );
break;
}
}
PAGE_INFO pageInfo;
if( SheetFormatList[ii] == NULL )
if( !pageInfo.SetType( pagename ) )
{
aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ),
......@@ -346,7 +321,13 @@ line %d, \aAbort reading file.\n" ),
aMsgDiag << FROM_UTF8( line );
}
aScreen->m_CurrentSheetDesc = wsheet;
if( pagename == wxT( "User" ) )
{
pageInfo.SetWidthMils( pageSize.x );
pageInfo.SetHeightMils( pageSize.y );
}
aScreen->SetPageSettings( pageInfo );
for( ; ; )
{
......
......@@ -97,12 +97,15 @@ static GRID_TYPE SchematicGridList[] = {
#define SCHEMATIC_GRID_LIST_CNT ( sizeof( SchematicGridList ) / sizeof( GRID_TYPE ) )
SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
SCH_SCREEN::SCH_SCREEN() :
BASE_SCREEN( SCH_SCREEN_T ),
m_paper( wxT( "A4" ) )
{
size_t i;
SetDrawItems( NULL ); /* Schematic items list */
m_Zoom = 32;
SetDrawItems( NULL ); // Schematic items list
SetZoom( 32 );
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( SchematicZoomList[i] );
......@@ -110,12 +113,13 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
for( i = 0; i < SCHEMATIC_GRID_LIST_CNT; i++ )
AddGrid( SchematicGridList[i] );
SetGrid( wxRealPoint( 50, 50 ) ); /* Default grid size. */
SetGrid( wxRealPoint( 50, 50 ) ); // Default grid size.
m_refCount = 0;
m_Center = false; /* Suitable for schematic only. For
* libedit and viewlib, must be set
* to true */
InitDatas();
// Suitable for schematic only. For libedit and viewlib, must be set to true
m_Center = false;
InitDataPoints( m_paper.GetSizeIU() );
}
......@@ -571,8 +575,8 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* sheet ( ScreenNumber = 1 ) within the files
*/
if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_CurrentSheetDesc->m_Name ),
m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0
if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_paper.GetType() ),
m_paper.GetWidthMils(), m_paper.GetHeightMils() ) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0
......@@ -617,7 +621,7 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, int aDrawMode, int aC
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
{
for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() )
for( SCH_ITEM* item = GetDrawItems(); item; item = item->Next() )
{
aPlotter->set_current_line_width( item->GetPenSize() );
item->Plot( aPlotter );
......@@ -1547,3 +1551,18 @@ int SCH_SCREENS::GetMarkerCount( int aMarkerType )
return count;
}
#if defined(DEBUG)
void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
{
// for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
for( EDA_ITEM* item = m_drawList; item; item = item->Next() )
{
item->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
......@@ -241,6 +241,8 @@ typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PINS;
*/
class SCH_SHEET : public SCH_ITEM
{
friend class SCH_SHEET_PIN;
/// Screen that contains the physical data for the sheet. In complex hierarchies
/// multiple sheets can share a common screen.
SCH_SCREEN* m_screen;
......@@ -268,8 +270,6 @@ class SCH_SHEET : public SCH_ITEM
/// The size of the sheet.
wxSize m_size;
friend class SCH_SHEET_PIN;
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
......
......@@ -285,6 +285,39 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
}
void SCH_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );
}
const PAGE_INFO& SCH_EDIT_FRAME::GetPageSettings () const
{
return GetScreen()->GetPageSettings();
}
const wxSize SCH_EDIT_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
}
const wxPoint& SCH_EDIT_FRAME::GetOriginAxisPosition() const
{
wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition();
}
void SCH_EDIT_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
}
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{
SCH_SCREEN* screen = GetScreen();
......@@ -489,8 +522,8 @@ double SCH_EDIT_FRAME::BestZoom()
int dx, dy;
wxSize size;
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
dx = GetScreen()->GetPageSettings().GetWidthIU();
dy = GetScreen()->GetPageSettings().GetHeightIU();
size = m_canvas->GetClientSize();
......
......@@ -265,6 +265,39 @@ LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
}
void LIB_VIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );
}
const PAGE_INFO& LIB_VIEW_FRAME::GetPageSettings () const
{
return GetScreen()->GetPageSettings();
}
const wxSize LIB_VIEW_FRAME::GetPageSizeIU() const
{
// GetSizeIU is compile time dependent:
return GetScreen()->GetPageSettings().GetSizeIU();
}
const wxPoint& LIB_VIEW_FRAME::GetOriginAxisPosition() const
{
wxASSERT( GetScreen() );
return GetScreen()->GetOriginAxisPosition();
}
void LIB_VIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( GetScreen() );
GetScreen()->SetOriginAxisPosition( aPosition );
}
void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
SaveSettings();
......
......@@ -34,12 +34,11 @@
#include <wx/gdicmn.h>
#include "wxstruct.h"
#include "class_sch_screen.h"
class wxSashLayoutWindow;
class wxListBox;
class wxSemaphore;
class SCH_SCREEN;
class CMP_LIBRARY;
......@@ -108,7 +107,17 @@ public:
void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
SCH_SCREEN* GetScreen() const { return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these 5 functions:
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
......
......@@ -29,10 +29,12 @@
#include "fctsys.h"
#include "common.h"
#include "macros.h"
#include "gerbview.h"
#include "dialog_show_page_borders.h"
DIALOG_PAGE_SHOW_PAGE_BORDERS::DIALOG_PAGE_SHOW_PAGE_BORDERS( GERBVIEW_FRAME *parent) :
DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE( parent, wxID_ANY )
{
......@@ -43,11 +45,13 @@ DIALOG_PAGE_SHOW_PAGE_BORDERS::DIALOG_PAGE_SHOW_PAGE_BORDERS( GERBVIEW_FRAME *pa
if( m_Parent->GetShowBorderAndTitleBlock() )
{
for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
wxString curPaperType = m_Parent->GetPageSettings().GetType();
for( unsigned i = 1; 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;
}
}
......@@ -73,8 +77,9 @@ void DIALOG_PAGE_SHOW_PAGE_BORDERS::OnOKBUttonClick( wxCommandEvent& event )
int idx = m_ShowPageLimits->GetSelection();
m_Parent->SetShowBorderAndTitleBlock( (idx > 0) ? true : false );
m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
m_Parent->SetPageSettings( PAGE_INFO( g_GerberPageSizeList[idx] ) );
EndModal( wxID_OK );
}
......
......@@ -6,6 +6,7 @@
#include "fctsys.h"
#include "common.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "pcbplot.h"
......@@ -35,11 +36,11 @@ private:
void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
{
DIALOG_DISPLAY_OPTIONS dlg( this );
int opt = dlg.ShowModal();
DIALOG_DISPLAY_OPTIONS dlg( this );
int opt = dlg.ShowModal();
if (opt > 0 )
m_canvas->Refresh();
if( opt > 0 )
m_canvas->Refresh();
}
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
......@@ -61,9 +62,9 @@ void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& event )
EndModal( 0 );
}
void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
{
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_BoxUnits->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( m_Parent->GetCursorShape() ? 1 : 0 );
......@@ -71,6 +72,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
// Show Option Draw Lines. We use DisplayPcbTrackFill as Lines draw option
m_OptDisplayLines->SetSelection( DisplayOpt.DisplayPcbTrackFill ? 1 : 0 );
m_OptDisplayFlashedItems->SetSelection( DisplayOpt.DisplayPadFill ? 1 : 0);
// Show Option Draw polygons
m_OptDisplayPolygons->SetSelection( g_DisplayPolygonsModeSketch ? 0 : 1 );
......@@ -78,11 +80,13 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
if( m_Parent->GetShowBorderAndTitleBlock() )
{
for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
wxString curPaperType = m_Parent->GetPageSettings().GetType();
for( unsigned i = 1; i < DIM( g_GerberPageSizeList ); ++i )
{
if( m_Parent->GetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
if( g_GerberPageSizeList[i] == curPaperType )
{
m_ShowPageLimits->SetSelection(ii);
m_ShowPageLimits->SetSelection( i );
break;
}
}
......@@ -91,6 +95,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
}
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
{
DisplayOpt.DisplayPolarCood =
......@@ -127,8 +132,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
int idx = m_ShowPageLimits->GetSelection();
m_Parent->SetShowBorderAndTitleBlock( ( idx > 0 ) ? true : false );
m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
m_Parent->SetShowBorderAndTitleBlock( idx > 0 ? true : false );
PAGE_INFO pageInfo( g_GerberPageSizeList[idx] );
m_Parent->SetPageSettings( pageInfo );
EndModal( 1 );
}
......
......@@ -154,12 +154,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
case ID_GERBVIEW_SET_PAGE_BORDER:
{
DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
if (dlg.ShowModal() == wxID_OK )
m_canvas->Refresh();
if( dlg.ShowModal() == wxID_OK )
m_canvas->Refresh();
}
break;
case ID_GERBVIEW_GLOBAL_DELETE:
......
......@@ -29,17 +29,20 @@ COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_Default_GERBER_Format;
int g_DisplayPolygonsModeSketch;
GERBER_IMAGE* g_GERBER_List[32];
// List of page sizes
Ki_PageDescr* g_GerberPageSizeList[] =
{
&g_Sheet_GERBER, // Full size page selection, and do not show page limits
&g_Sheet_GERBER, // Full size page selection, and show page limits
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2,
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C,
NULL // End of list
};
const wxChar* g_GerberPageSizeList[] = {
wxT( "GERBER" ), // index 0: full size page selection, and do not show page limits
wxT( "GERBER" ), // index 1: full size page selection, and show page limits
wxT( "A4" ),
wxT( "A3" ),
wxT( "A2" ),
wxT( "A" ),
wxT( "B" ),
wxT( "C" ),
};
GERBER_IMAGE* g_GERBER_List[32];
IMPLEMENT_APP( EDA_APP )
......
......@@ -19,8 +19,10 @@ class GERBVIEW_FRAME;
//class BOARD;
class GERBER_IMAGE;
class Ki_PageDescr;
class PAGE_INFO;
/// List of page sizes
extern const wxChar* g_GerberPageSizeList[8];
// Type of photoplotter action:
#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen)
......@@ -28,12 +30,13 @@ class Ki_PageDescr;
#define GERB_FLASH 3 // Flash
typedef enum
enum PlotFormat
{
FORMAT_HPGL,
FORMAT_GERBER,
FORMAT_POST
} PlotFormat;
};
/**
* Enum ITEM_VISIBLE
......@@ -57,8 +60,6 @@ extern int g_DisplayPolygonsModeSketch;
extern const wxString GerbviewProjectFileExt;
extern const wxString GerbviewProjectFileWildcard;
extern Ki_PageDescr* g_GerberPageSizeList[];
// Interpolation type
enum Gerb_Interpolation
{
......
......@@ -29,6 +29,7 @@
*/
#include "fctsys.h"
#include "macros.h"
#include "id.h"
#include "common.h"
#include "class_drawpanel.h"
......@@ -55,7 +56,7 @@ void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
switch( id )
{
/* Hotkey IDs */
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( s_Gerbview_Hokeys_Descr );
break;
......@@ -81,7 +82,7 @@ void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
}
PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
{
if( !m_configSettings.empty() )
return m_configSettings;
......@@ -102,9 +103,8 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
&DisplayOpt.DisplayPolarCood,
false ) );
// Color select parameters:
static const int color_default[32] = // Default values for color layers 0 to 31
{
// Default colors for layers 0 to 31
static const int color_default[] = {
GREEN, BLUE, LIGHTGRAY, MAGENTA,
RED, DARKGREEN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, CYAN,
......@@ -112,26 +112,35 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings( void )
BLUE, BROWN, LIGHTCYAN, RED,
MAGENTA, CYAN, BROWN, MAGENTA,
LIGHTGRAY, BLUE, GREEN, DARKCYAN,
YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY
YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY,
};
// List of keywords used as identifiers in config
// they *must* be static const and not temporary created,
// List of keywords used as identifiers in config.
// They *must* be static const and not temporarily created,
// because the parameter list that use these keywords does not store them,
// just points on them
static const wxChar * keys[32] =
{
wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"),
wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"),
wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"),
wxT("ColorLayer12"), wxT("ColorLaye13"), wxT("ColorLayer14"), wxT("ColorLayer15")
// just points to them.
static const wxChar* keys[] = {
wxT("ColorLayer0"), wxT("ColorLayer1"), wxT("ColorLayer2"), wxT("ColorLayer3"),
wxT("ColorLayer4"), wxT("ColorLayer5"), wxT("ColorLayer6"), wxT("ColorLayer7"),
wxT("ColorLayer8"), wxT("ColorLayer9"), wxT("ColorLayer10"), wxT("ColorLayer11"),
wxT("ColorLayer12"), wxT("ColorLayer13"), wxT("ColorLayer14"), wxT("ColorLayer15"),
wxT("ColorLayer16"), wxT("ColorLayer17"), wxT("ColorLayer18"), wxT("ColorLayer19"),
wxT("ColorLayer20"), wxT("ColorLayer21"), wxT("ColorLayer22"), wxT("ColorLayer23"),
wxT("ColorLayer24"), wxT("ColorLayer25"), wxT("ColorLayer26"), wxT("ColorLayer27"),
wxT("ColorLayer28"), wxT("ColorLayer29"), wxT("ColorLayer30"), wxT("ColorLayer31"),
};
for( unsigned ii = 0; ii < 32; ii++ )
wxASSERT( DIM(keys) == DIM(color_default) );
wxASSERT( DIM(keys) <= DIM(g_ColorsSettings.m_LayersColors) && DIM(keys) <= DIM(color_default) );
for( unsigned i = 0; i < DIM(keys); ++i )
{
int * prm = &g_ColorsSettings.m_LayersColors[1];
PARAM_CFG_SETCOLOR * prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[ii], prm, color_default[1] );
int* prm = &g_ColorsSettings.m_LayersColors[i];
PARAM_CFG_SETCOLOR* prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
m_configSettings.push_back( prm_entry );
}
......
......@@ -48,8 +48,9 @@
// Config keywords
const wxString GerbviewShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
const wxString GerbviewShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) );
static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
/*************************************/
......@@ -67,8 +68,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_FrameName = wxT( "GerberFrame" );
m_show_layer_manager_tools = true;
m_showAxis = true; // true to show X and Y axis on screen
m_showBorderAndTitleBlock = false; // true for reference drawings.
m_showAxis = true; // true to show X and Y axis on screen
m_showBorderAndTitleBlock = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_SelLayerBox = NULL;
m_DCodeSelector = NULL;
......@@ -83,13 +84,17 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
SetIcon( icon );
SetScreen( new PCB_SCREEN() );
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
SetBoard( new BOARD() );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
// BOARD was constructed with "A3", change to "GERBER"
PAGE_INFO pageInfo( wxT( "GERBER" ) );
GetBoard()->SetPageSettings( pageInfo );
SetScreen( new PCB_SCREEN( pageInfo.GetSizeIU() ) );
// Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize();
......@@ -209,25 +214,25 @@ void GERBVIEW_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
long pageSize_opt;
config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
int imax = 0;
PAGE_INFO pageInfo( wxT( "GERBER" ) );
for( ; g_GerberPageSizeList[imax] != NULL; imax++ )
;
config->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
if( pageSize_opt < 0 || pageSize_opt >= imax )
pageSize_opt = 0;
if( m_showBorderAndTitleBlock )
{
wxString pageType;
GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt];
config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
if( pageSize_opt > 0 )
{
m_showBorderAndTitleBlock = true;
pageInfo.SetType( pageType );
}
SetPageSettings( pageInfo );
GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
long tmp;
config->Read( GerbviewShowDCodes, &tmp, 1 );
config->Read( cfgShowDCodes, &tmp, 1 );
SetElementVisibility( DCODES_VISIBLE, tmp );
// because we have 2 file historues, we must read this one
......@@ -254,22 +259,10 @@ void GERBVIEW_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
long pageSize_opt = 0;
if( m_showBorderAndTitleBlock )
{
for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
{
if( GetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
{
pageSize_opt = ii;
break;
}
}
}
config->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
config->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
config->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
config->Write( GerbviewShowPageSizeOption, pageSize_opt );
config->Write( GerbviewShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
// Save the drill file history list.
// Because we have 2 file histories, we must save this one
// in a specific path
......
......@@ -68,8 +68,8 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
SetScreen( new PCB_SCREEN() );
GetScreen()->Init();
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
setActiveLayer(FIRST_COPPER_LAYER);
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
......
......@@ -254,9 +254,9 @@ public:
/**
* Function SaveCurrentSetupValues
* Save the current setup values in m_settings
* saved parameters are parameters that have the .m_Setup member set to
* true
* saves the current setup values in m_settings.
* Saved parameters are parameters that have the .m_Setup member set to
* true.
* @param aList = array of PARAM_CFG_BASE pointers
*/
void SaveCurrentSetupValues( PARAM_CFG_BASE** aList );
......@@ -264,9 +264,9 @@ public:
/**
* Function ReadCurrentSetupValues
* Read the current setup values previously saved, from m_settings
* saved parameters are parameters that have the .m_Setup member set to
* true
* reads the current setup values previously saved, from m_settings.
* Saved parameters are parameters that have the .m_Setup member set to
* true.
* @param aList = array of PARAM_CFG_BASE pointers
*/
void ReadCurrentSetupValues( PARAM_CFG_BASE** aList );
......
......@@ -37,11 +37,10 @@
#include "common.h"
// Forward declarations:
class Ki_PageDescr;
/* Simple class for handling grid arrays. */
/**
* Class GRID_TYPE
* is for grid arrays.
*/
class GRID_TYPE
{
public:
......@@ -59,7 +58,6 @@ public:
return *this;
}
const bool operator==( const GRID_TYPE& item ) const
{
return m_Size == item.m_Size && m_Id == item.m_Id;
......@@ -72,12 +70,11 @@ typedef std::vector< GRID_TYPE > GRIDS;
/**
* Class BASE_SCREEN
* handle how to draw a screen (a board, a schematic ...)
* handles how to draw a screen (a board, a schematic ...)
*/
class BASE_SCREEN : public EDA_ITEM
{
GRIDS m_grids; ///< List of valid grid sizes.
EDA_ITEM* m_drawList; ///< Object list for the screen.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
bool m_FlagModified; ///< Indicates current drawing has been modified.
......@@ -94,19 +91,24 @@ class BASE_SCREEN : public EDA_ITEM
*/
wxPoint m_crossHairPosition;
double m_Zoom; ///< Current zoom coefficient.
public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/
// Scrollbars management:
int m_ScrollPixelsPerUnitX; /* Pixels per scroll unit in the horizontal direction. */
int m_ScrollPixelsPerUnitY; /* Pixels per scroll unit in the vertical direction. */
int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
* virtual draw area size in pixels */
wxPoint m_ScrollbarPos; /* Current scroll bar position in scroll units. */
wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
* view position (upper left corner of device)
......@@ -117,18 +119,16 @@ public:
* > 0 except for schematics.
* false: when coordinates can only be >= 0
* Schematic */
bool m_FirstRedraw;
bool m_FirstRedraw;
// Undo/redo list of commands
UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo command (old data) */
UNDO_REDO_CONTAINER m_RedoList; /* Objects list for the redo command (old data) */
unsigned m_UndoRedoCountMax; // undo/Redo command Max depth
UNDO_REDO_CONTAINER m_UndoList; ///< Objects list for the undo command (old data)
UNDO_REDO_CONTAINER m_RedoList; ///< Objects list for the redo command (old data)
unsigned m_UndoRedoCountMax; ///< undo/Redo command Max depth
/* block control */
BLOCK_SELECTOR m_BlockLocate; /* Block description for block commands */
// block control
BLOCK_SELECTOR m_BlockLocate; ///< Block description for block commands
/* Page description */
Ki_PageDescr* m_CurrentSheetDesc;
int m_ScreenNumber;
int m_NumberOfScreen;
......@@ -141,11 +141,9 @@ public:
wxString m_Commentaire3;
wxString m_Commentaire4;
/* Grid and zoom values. */
wxPoint m_GridOrigin;
wxPoint m_GridOrigin;
wxArrayDouble m_ZoomList; /* Array of standard zoom (i.e. scale) coefficients. */
double m_Zoom; /* Current zoom coefficient. */
wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
bool m_IsPrinting;
public:
......@@ -161,24 +159,12 @@ public:
EDA_ITEM* GetCurItem() const { return m_CurrentItem; }
/**
* Function GetDrawItems().
*
* @return - A pointer to the first item in the linked list of draw items.
*/
virtual EDA_ITEM* GetDrawItems() const { return m_drawList; }
virtual void SetDrawItems( EDA_ITEM* aItem ) { m_drawList = aItem; }
void InitDatas();
void InitDataPoints( const wxSize& aPageSizeInternalUnits );
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
wxString GetFileName() const { return m_fileName; }
void SetPageSize( wxSize& aPageSize );
wxSize ReturnPageSize( void );
/**
* Function GetInternalUnits
* @return the screen units scalar.
......@@ -460,5 +446,4 @@ public:
#endif
};
#endif // CLASS_BASE_SCREEN_H_
......@@ -9,7 +9,9 @@
#define LAYERSCOLORSBUFFERSIZE 32
#define ITEMSCOLORSBUFFERSIZE 32
/* Class for handle list of color settings for designs in Eeschema, Pcbnew and GerbView
/**
* Class COLORS_DESIGN_SETTINGS
* is a list of color settings for designs in Eeschema, Pcbnew and GerbView
*/
class COLORS_DESIGN_SETTINGS
{
......
......@@ -2,8 +2,8 @@
* @file class_pcb_screen.h
*/
#ifndef __CLASSPCB_SCREEN_H__
#define __CLASSPCB_SCREEN_H__
#ifndef CLASS_PCB_SCREEN_H_
#define CLASS_PCB_SCREEN_H_
#include "class_base_screen.h"
......@@ -22,21 +22,27 @@ public:
int m_Route_Layer_BOTTOM;
public:
PCB_SCREEN();
/**
* Constructor
* @param aPageSizeIU is the size of the initial paper page in internal units.
*/
PCB_SCREEN( const wxSize& aPageSizeIU );
~PCB_SCREEN();
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
void Init();
void SetNextZoom();
void SetPreviousZoom();
void SetLastZoom();
virtual int GetInternalUnits( void );
virtual int GetInternalUnits();
/**
* Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding
*BASE_SCREEN::GetCurItem().
* BASE_SCREEN::GetCurItem().
* @return BOARD_ITEM* - the one selected, or NULL.
*/
BOARD_ITEM* GetCurItem() const
......@@ -73,5 +79,4 @@ public:
void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
};
#endif /* __CLASSPCB_SCREEN_H__ */
#endif // CLASS_PCB_SCREEN_H_
......@@ -55,14 +55,23 @@ enum SCH_LINE_TEST_T
};
/* Max number of sheets in a hierarchy project: */
#define NB_MAX_SHEET 500
/// Max number of sheets in a hierarchy project
#define NB_MAX_SHEET 500
class SCH_SCREEN : public BASE_SCREEN
{
int m_refCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
int m_refCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
/// The size of the paper to print or plot on
PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_originAxisPosition;
SCH_ITEM* m_drawList; ///< Object list for the screen.
/// @todo use DLIST<SCH_ITEM> or superior container
/**
* Function addConnectedItemsToBlock
......@@ -77,7 +86,12 @@ class SCH_SCREEN : public BASE_SCREEN
void addConnectedItemsToBlock( const wxPoint& aPosition );
public:
SCH_SCREEN( KICAD_T aType = SCH_SCREEN_T );
/**
* Constructor
*/
SCH_SCREEN();
~SCH_SCREEN();
virtual wxString GetClass() const
......@@ -85,6 +99,12 @@ public:
return wxT( "SCH_SCREEN" );
}
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
void DecRefCount();
void IncRefCount();
......@@ -93,12 +113,10 @@ public:
/**
* Function GetDrawItems().
*
* @return - A pointer to the first item in the linked list of draw items.
*/
virtual SCH_ITEM* GetDrawItems() const { return (SCH_ITEM*) BASE_SCREEN::GetDrawItems(); }
virtual void SetDrawItems( SCH_ITEM* aItem ) { BASE_SCREEN::SetDrawItems( aItem ); }
SCH_ITEM* GetDrawItems() const { return m_drawList; }
void SetDrawItems( SCH_ITEM* aItem ) { m_drawList = aItem; }
/**
* Function GetCurItem
......@@ -449,6 +467,10 @@ public:
* @return The number of items in the pick list.
*/
int UpdatePickList();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#endif
};
......
......@@ -32,31 +32,33 @@
#ifndef INCLUDE__COMMON_H_
#define INCLUDE__COMMON_H_
#include <vector>
#include "wx/wx.h"
#include "wx/confbase.h"
#include "wx/fileconf.h"
class wxAboutDialogInfo;
/* Flag for special keys */
// Flag for special keys
#define GR_KB_RIGHTSHIFT 0x10000000 /* Keybd states: right
* shift key depressed */
#define GR_KB_LEFTSHIFT 0x20000000 /* left shift key depressed
*/
#define GR_KB_CTRL 0x40000000 /* CTRL depressed */
#define GR_KB_ALT 0x80000000 /* ALT depressed */
#define GR_KB_CTRL 0x40000000 // CTRL depressed
#define GR_KB_ALT 0x80000000 // ALT depressed
#define GR_KB_SHIFT (GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT)
#define GR_KB_SHIFTCTRL (GR_KB_SHIFT | GR_KB_CTRL)
#define MOUSE_MIDDLE 0x08000000 /* Middle button mouse
* flag for block commands
*/
// default name for nameless projects
/// default name for nameless projects
#define NAMELESS_PROJECT wxT( "noname" )
#define NB_ITEMS 11
/* Pseudo key codes for command panning */
/// Pseudo key codes for command panning
enum pseudokeys {
EDA_PANNING_UP_KEY = 1,
EDA_PANNING_DOWN_KEY,
......@@ -69,7 +71,7 @@ enum pseudokeys {
#define ESC 27
/* TODO Executable names TODO*/
// TODO Executable names TODO
#ifdef __WINDOWS__
#define CVPCB_EXE wxT( "cvpcb.exe" )
#define PCBNEW_EXE wxT( "pcbnew.exe" )
......@@ -96,7 +98,7 @@ enum pseudokeys {
#endif
/* Graphic Texts Orientation in 0.1 degree*/
// Graphic Texts Orientation in 0.1 degree
#define TEXT_ORIENT_HORIZ 0
#define TEXT_ORIENT_VERT 900
......@@ -111,56 +113,146 @@ enum EDA_UNITS_T {
};
#if defined(KICAD_GOST)
#define GOST_LEFTMARGIN 800 /* 20mm */
#define GOST_RIGHTMARGIN 200 /* 5mm */
#define GOST_TOPMARGIN 200 /* 5mm */
#define GOST_BOTTOMMARGIN 200 /* 5mm */
#define GOST_LEFTMARGIN 800 // 20mm
#define GOST_RIGHTMARGIN 200 // 5mm
#define GOST_TOPMARGIN 200 // 5mm
#define GOST_BOTTOMMARGIN 200 // 5mm
#endif
/* forward declarations: */
// forward declarations:
class LibNameList;
/* Class to handle pages sizes:
//class PAGE_INFO;
/**
* Class PAGE_INFO
* describes the page size and margins of a paper page on which to
* eventually print or plot. Paper sizes are often described in inches.
* Here paper is described in 1/1000th of an inch (mils). For convenience
* there are some read only accessors for internal units (IU), which is a compile
* time calculation, not runtime.
*
* @author Dick Hollenbeck
*/
class Ki_PageDescr
class PAGE_INFO
{
// All sizes are in 1/1000 inch
public:
wxSize m_Size; /* page size in 1/1000 inch */
wxPoint m_Offset; /* plot offset in 1/1000 inch */
wxString m_Name;
int m_LeftMargin;
int m_RightMargin;
int m_TopMargin;
int m_BottomMargin;
PAGE_INFO( const wxString& aType = wxT( "A3" ) );
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName );
const wxString& GetType() const { return m_type; }
/**
* Function SetType
* sets the name of the page type and also the sizes and margins
* commonly associated with that type name.
*
* @param aStandardPageDescriptionName is a wxString constant giving one of:
* "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", or "User". If "User"
* then the width and height are custom, and will be set according to previous calls
* to static PAGE_INFO::SetUserWidthMils() and
* static PAGE_INFO::SetUserHeightMils();
*
* @return bool - true iff @a aStandarePageDescription was a recognized type.
*/
bool SetType( const wxString& aStandardPageDescriptionName );
void SetWidthMils( int aWidthInMils ) { m_size.x = aWidthInMils; }
int GetWidthMils() const { return m_size.x; }
void SetHeightMils( int aHeightInMils ) { m_size.y = aHeightInMils; }
int GetHeightMils() const { return m_size.y; }
const wxSize& GetSizeMils() const { return m_size; }
// Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
// and either deci-mils or nanometers in PCBNew.
#if defined(PCBNEW)
# if defined(KICAD_NANOMETRE)
int GetWidthIU() const { return int( 2.54e4 * GetWidthMils() ); }
int GetHeightIU() const { return int( 2.54e4 * GetHeightMils() ); }
# else
int GetWidthIU() const { return int( 10 * GetWidthMils() ); }
int GetHeightIU() const { return int( 10 * GetHeightMils() ); }
# endif
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#elif defined(EESCHEMA)
int GetWidthIU() const { return GetWidthMils(); }
int GetHeightIU() const { return GetHeightMils(); }
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif
public:
Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name );
// wxPoint GetOffsetMils() const { return m_Offset; }
int GetLeftMarginMils() const { return m_left_margin; }
int GetRightMarginMils() const { return m_right_margin; }
int GetTopMarginMils() const { return m_top_margin; }
int GetBottomMarginMils() const { return m_bottom_margin; }
void SetLeftMarginMils( int aMargin ) { m_left_margin = aMargin; }
void SetRightMarginMils( int aMargin ) { m_right_margin = aMargin; }
void SetTopMarginMils( int aMargin ) { m_top_margin = aMargin; }
void SetBottomMarginMils( int aMargin ) { m_bottom_margin = aMargin; }
/**
* Function SetUserWidthMils
* sets the width of type "User" page in mils.
*/
static void SetUserWidthMils( int aWidthInMils );
/**
* Function SetUserHeightMils
* sets the height type "User" page in mils.
*/
static void SetUserHeightMils( int aHeightInMils );
/**
* Function GetStandardSizes
* returns the standard page types, such as "A4", "A3", etc.
static wxArrayString GetStandardSizes();
*/
private:
// standard pre-defined sizes
static const PAGE_INFO pageA4;
static const PAGE_INFO pageA3;
static const PAGE_INFO pageA2;
static const PAGE_INFO pageA1;
static const PAGE_INFO pageA0;
static const PAGE_INFO pageA;
static const PAGE_INFO pageB;
static const PAGE_INFO pageC;
static const PAGE_INFO pageD;
static const PAGE_INFO pageE;
static const PAGE_INFO pageGERBER;
static const PAGE_INFO pageUser;
// all dimensions here are in mils
wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils
// wxPoint m_offset_mils; ///< plot offset in mils
int m_left_margin;
int m_right_margin;
int m_top_margin;
int m_bottom_margin;
static int s_user_height;
static int s_user_width;
};
extern Ki_PageDescr g_Sheet_A4;
extern Ki_PageDescr g_Sheet_A3;
extern Ki_PageDescr g_Sheet_A2;
extern Ki_PageDescr g_Sheet_A1;
extern Ki_PageDescr g_Sheet_A0;
extern Ki_PageDescr g_Sheet_A;
extern Ki_PageDescr g_Sheet_B;
extern Ki_PageDescr g_Sheet_C;
extern Ki_PageDescr g_Sheet_D;
extern Ki_PageDescr g_Sheet_E;
extern Ki_PageDescr g_Sheet_GERBER;
extern Ki_PageDescr g_Sheet_user;
extern Ki_PageDescr* g_SheetSizeList[];
extern wxString g_ProductName;
/* Default user lib path can be left void, if the standard lib path is used */
/// Default user lib path can be left void, if the standard lib path is used
extern wxString g_UserLibDirBuffer;
extern bool g_ShowPageLimits; // true to display the page limits
extern bool g_ShowPageLimits; ///< true to display the page limits
/**
* File extension definitions. Please do not changes these. If a different
......@@ -188,10 +280,10 @@ extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard;
// Name of default configuration file. (kicad.pro)
/// Name of default configuration file. (kicad.pro)
extern wxString g_Prj_Default_Config_FullFilename;
// Name of local configuration file. (<curr projet>.pro)
/// Name of local configuration file. (<curr projet>.pro)
extern wxString g_Prj_Config_LocalFilename;
extern EDA_UNITS_T g_UserUnit; ///< display units
......@@ -200,7 +292,7 @@ extern EDA_UNITS_T g_UserUnit; ///< display units
extern int g_GhostColor;
/* COMMON.CPP */
// COMMON.CPP
/**
* Function SetLocaleTo_C_standard
......
......@@ -12,7 +12,7 @@
#define FOOTPRINT_LIBRARY_HEADER_CNT 18
// Values for m_DisplayViaMode member:
/// Values for m_DisplayViaMode member:
enum VIA_DISPLAY_MODE_T {
VIA_HOLE_NOT_SHOW = 0,
VIA_SPECIAL_HOLE_SHOW,
......@@ -21,8 +21,10 @@ enum VIA_DISPLAY_MODE_T {
};
/* Values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option
* This parameter controls how to show tracks and vias clearance area
/**
* Enum TRACE_CLEARANCE_DISPLAY_MODE_T
* is the set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option.
* This parameter controls how to show tracks and vias clearance area.
*/
enum TRACE_CLEARANCE_DISPLAY_MODE_T {
DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas
......@@ -43,6 +45,10 @@ enum TRACE_CLEARANCE_DISPLAY_MODE_T {
};
/**
* Class DISPLAY_OPTIONS
* handles display options like enable/disable some optional drawings.
*/
class DISPLAY_OPTIONS
{
public:
......@@ -77,5 +83,4 @@ public:
DISPLAY_OPTIONS();
};
#endif // PCBSTRUCT_H
......@@ -5,15 +5,12 @@
* @file plot_common.h
*/
#ifndef __INCLUDE__PLOT_COMMON_H__
#define __INCLUDE__PLOT_COMMON_H__ 1
#ifndef PLOT_COMMON_H_
#define PLOT_COMMON_H_
#include <vector>
#include "drawtxt.h"
class Ki_PageDescr;
#include "common.h" // PAGE_INFO
/**
* Enum PlotFormat
......@@ -27,11 +24,11 @@ enum PlotFormat {
PLOT_FORMAT_DXF
};
class PLOTTER
{
public:
PlotFormat m_PlotType; // type of plot
public: PLOTTER( PlotFormat aPlotType );
PLOTTER( PlotFormat aPlotType );
virtual ~PLOTTER()
{
......@@ -47,8 +44,7 @@ public: PLOTTER( PlotFormat aPlotType );
* Function GetPlotterType
* @return the format of the plot file
*/
PlotFormat GetPlotterType()
{ return m_PlotType; }
PlotFormat GetPlotterType() { return m_PlotType; }
virtual bool start_plot( FILE* fout ) = 0;
virtual bool end_plot() = 0;
......@@ -58,20 +54,18 @@ public: PLOTTER( PlotFormat aPlotType );
negative_mode = _negative;
}
virtual void set_color_mode( bool _color_mode )
{
color_mode = _color_mode;
}
bool get_color_mode() const
{
return color_mode;
}
void SetPageSettings( const PAGE_INFO& aPageSettings );
virtual void set_paper_size( Ki_PageDescr* sheet );
virtual void set_current_line_width( int width ) = 0;
virtual void set_default_line_width( int width ) = 0;
virtual void set_color( int color ) = 0;
......@@ -82,13 +76,12 @@ public: PLOTTER( PlotFormat aPlotType );
creator = _creator;
}
virtual void set_filename( const wxString& _filename )
{
filename = _filename;
}
/// Set the plot offset for the current plotting
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror ) = 0;
// Standard primitives
......@@ -154,27 +147,23 @@ public: PLOTTER( PlotFormat aPlotType );
pen_to( pos, 'U' );
}
void line_to( wxPoint pos )
{
pen_to( pos, 'D' );
}
void finish_to( wxPoint pos )
{
pen_to( pos, 'D' );
pen_to( pos, 'Z' );
}
void pen_finish()
{
// Shortcut
pen_to( wxPoint( 0, 0 ), 'Z' );
}
void text( const wxPoint& aPos,
enum EDA_Colors aColor,
const wxString& aText,
......@@ -210,14 +199,20 @@ protected:
virtual void user_to_device_size( wxSize& size );
virtual double user_to_device_size( double size );
// Plot scale
PlotFormat m_PlotType;
/// Plot scale
double plot_scale;
// Device scale (from decimils to device units)
/// Device scale (from decimils to device units)
double device_scale;
// Plot offset (in decimils)
/// Plot offset (in decimils)
wxPoint plot_offset;
// Output file
/// Output file
FILE* output_file;
// Pen handling
bool color_mode, negative_mode;
int default_pen_width;
......@@ -227,17 +222,19 @@ protected:
bool plotMirror;
wxString creator;
wxString filename;
Ki_PageDescr* sheet;
PAGE_INFO pageInfo;
wxSize paper_size;
};
class HPGL_PLOTTER : public PLOTTER
{
public: HPGL_PLOTTER() : PLOTTER( PLOT_FORMAT_HPGL )
public:
HPGL_PLOTTER() :
PLOTTER( PLOT_FORMAT_HPGL )
{
}
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
......@@ -246,42 +243,41 @@ public: HPGL_PLOTTER() : PLOTTER( PLOT_FORMAT_HPGL )
{
// Handy override
current_pen_width = wxRound( pen_diameter );
};
}
virtual void set_default_line_width( int width ) {};
virtual void set_dash( bool dashed );
virtual void set_color( int color ) {};
virtual void set_pen_speed( int speed )
{
wxASSERT( output_file == 0 );
pen_speed = speed;
}
virtual void set_pen_number( int number )
{
wxASSERT( output_file == 0 );
pen_number = number;
}
virtual void set_pen_diameter( double diameter )
{
wxASSERT( output_file == 0 );
pen_diameter = diameter;
}
virtual void set_pen_overlap( double overlap )
{
wxASSERT( output_file == 0 );
pen_overlap = overlap;
}
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
/*
* Function PlotPoly
* Draw a polygon (filled or not) in HPGL format
......@@ -332,13 +328,14 @@ protected:
class PS_PLOTTER : public PLOTTER
{
public: PS_PLOTTER() : PLOTTER( PLOT_FORMAT_POST )
public:
PS_PLOTTER() :
PLOTTER( PLOT_FORMAT_POST )
{
plot_scale_adjX = 1;
plot_scale_adjY = 1;
}
virtual bool start_plot( FILE* fout );
virtual bool end_plot();
virtual void set_current_line_width( int width );
......@@ -352,7 +349,6 @@ public: PS_PLOTTER() : PLOTTER( PLOT_FORMAT_POST )
plot_scale_adjY = scaleY;
}
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
virtual void rect( wxPoint p1, wxPoint p2, FILL_T fill, int width = -1 );
virtual void circle( wxPoint pos, int diametre, FILL_T fill, int width = -1 );
......@@ -419,7 +415,9 @@ struct APERTURE
class GERBER_PLOTTER : public PLOTTER
{
public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
public:
GERBER_PLOTTER() :
PLOTTER( PLOT_FORMAT_GERBER )
{
work_file = 0;
final_file = 0;
......@@ -431,7 +429,7 @@ public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
virtual void set_current_line_width( int width );
virtual void set_default_line_width( int width );
/* RS274X has no dashing, nor colours */
// RS274X has no dashing, nor colours
virtual void set_dash( bool dashed ) {};
virtual void set_color( int color ) {};
virtual void set_viewport( wxPoint aOffset, double aScale, bool aMirror );
......@@ -472,8 +470,7 @@ public: GERBER_PLOTTER() : PLOTTER( PLOT_FORMAT_GERBER )
virtual void SetLayerPolarity( bool aPositive );
protected:
void select_aperture( const wxSize& size,
APERTURE::Aperture_Type type );
void select_aperture( const wxSize& size, APERTURE::Aperture_Type type );
std::vector<APERTURE>::iterator
get_aperture( const wxSize& size, APERTURE::Aperture_Type type );
......@@ -487,9 +484,12 @@ protected:
std::vector<APERTURE>::iterator current_aperture;
};
class DXF_PLOTTER : public PLOTTER
{
public: DXF_PLOTTER() : PLOTTER( PLOT_FORMAT_DXF )
public:
DXF_PLOTTER() :
PLOTTER( PLOT_FORMAT_DXF )
{
}
......@@ -559,4 +559,4 @@ protected:
int current_color;
};
#endif // __INCLUDE__PLOT_COMMON_H__
#endif // PLOT_COMMON_H_
......@@ -112,6 +112,13 @@ public:
*/
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload
const wxPoint& GetOriginAxisPosition() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
/**
* Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous
......@@ -126,8 +133,6 @@ public:
return m_Pcb;
}
BOARD_DESIGN_SETTINGS* GetDesignSettings();
// General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
......@@ -140,10 +145,7 @@ public:
virtual void SetToolID( int aId, int aCursor, const wxString& aToolMsg );
virtual void UpdateStatusBar();
virtual PCB_SCREEN* GetScreen() const
{
return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen();
}
PCB_SCREEN* GetScreen() const { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); }
/**
* Function BestZoom
......
......@@ -350,6 +350,20 @@ public:
SCH_SCREEN* GetScreen() const;
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these three functions:
// note: a common base class shared between LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME
// would allow sharing of these 5 functions:
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload EDA_DRAW_FRAME
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
virtual wxString GetScreenDesc();
void InstallConfigFrame( wxCommandEvent& event );
......
......@@ -72,7 +72,7 @@ class EDA_DRAW_PANEL;
class EDA_MSG_PANEL;
class BASE_SCREEN;
class PARAM_CFG_BASE;
class Ki_PageDescr;
class PAGE_INFO;
class PLOTTER;
enum id_librarytype {
......@@ -363,7 +363,10 @@ public:
*/
class EDA_DRAW_FRAME : public EDA_BASE_FRAME
{
private:
/// Let the #EDA_DRAW_PANEL object have access to the protected data since
/// it is closely tied to the #EDA_DRAW_FRAME.
friend class EDA_DRAW_PANEL;
///< Id of active button on the vertical toolbar.
int m_toolId;
......@@ -372,9 +375,9 @@ private:
protected:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color
/// The area to draw on.
EDA_DRAW_PANEL* m_canvas;
......@@ -401,9 +404,6 @@ protected:
/// drill, gerber, and component position files.
bool m_showOriginAxis;
/// Position of the origin axis.
wxPoint m_originAxisPosition;
/// True shows the drawing border and title block.
bool m_showBorderAndTitleBlock;
......@@ -428,15 +428,9 @@ protected:
wxOverlay m_overlay;
#endif
/// Let the #EDA_DRAW_PANEL object have access to the protected data since
/// it is closely tied to the #EDA_DRAW_FRAME.
friend class EDA_DRAW_PANEL;
protected:
void SetScreen( BASE_SCREEN* aScreen )
{
m_currentScreen = aScreen;
}
void SetScreen( BASE_SCREEN* aScreen ) { m_currentScreen = aScreen; }
/**
* Function unitsChangeRefresh
......@@ -447,6 +441,7 @@ protected:
*/
virtual void unitsChangeRefresh();
public:
EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size,
......@@ -454,9 +449,18 @@ public:
~EDA_DRAW_FRAME();
wxPoint GetOriginAxisPosition() const { return m_originAxisPosition; }
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) = 0;
virtual const PAGE_INFO& GetPageSettings() const = 0;
/**
* 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; }
......@@ -473,11 +477,12 @@ public:
virtual wxString GetScreenDesc();
/**
* Function GetBaseScreen
* is virtual and returns a pointer to a BASE_SCREEN or one of its
* derivatives. It may be overloaded by derived classes.
* Function GetScreen
* returns a pointer to a BASE_SCREEN or one of its
* derivatives. It is overloaded by derived classes to return
* SCH_SCREEN or PCB_SCREEN.
*/
virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
virtual BASE_SCREEN* GetScreen() const { return m_currentScreen; }
void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event );
......@@ -660,13 +665,12 @@ public:
/**
* Function GetXYSheetReferences
* Return the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* returns the X,Y sheet references where the point position is located
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6
* (or ?? if out of page limits)
*/
wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
const wxString GetXYSheetReferences( const wxPoint& aPosition );
void DisplayToolMsg( const wxString& msg );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
......
......@@ -48,7 +48,7 @@
#include "class_drawpanel.h"
/* Configuration entry names. */
// Configuration entry names.
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
......@@ -94,7 +94,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
m_DisplayPcbTrackFill = true; /* false = sketch , true = filled */
m_DisplayPcbTrackFill = true; // false = sketch , true = filled
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
m_ModuleEditFrame = NULL; // Frame for footprint edition
......@@ -126,6 +126,48 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
}
void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( m_Pcb );
m_Pcb->SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
}
const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetPageSettings();
}
const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
{
wxASSERT( m_Pcb );
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_Pcb->GetPageSettings().GetSizeIU();
}
const wxPoint& PCB_BASE_FRAME::GetOriginAxisPosition() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetOriginAxisPosition();
}
void PCB_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
{
wxASSERT( m_Pcb );
m_Pcb->SetOriginAxisPosition( aPosition );
}
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
wxASSERT( m_Pcb );
......@@ -134,18 +176,17 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
{
wxSize pageSize = GetPageSizeIU();
if( m_showBorderAndTitleBlock )
{
area.SetOrigin( 0, 0 );
area.SetEnd( GetScreen()->ReturnPageSize().x,
GetScreen()->ReturnPageSize().y );
area.SetEnd( pageSize.x, pageSize.y );
}
else
{
area.SetOrigin( -GetScreen()->ReturnPageSize().x / 2,
-GetScreen()->ReturnPageSize().y / 2 );
area.SetEnd( GetScreen()->ReturnPageSize().x / 2,
GetScreen()->ReturnPageSize().y / 2 );
area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
}
}
......@@ -153,14 +194,7 @@ EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
}
BOARD_DESIGN_SETTINGS* PCB_BASE_FRAME::GetDesignSettings()
{
wxASSERT( m_Pcb );
return m_Pcb ? &m_Pcb->GetDesignSettings() : NULL;
}
double PCB_BASE_FRAME::BestZoom( void )
double PCB_BASE_FRAME::BestZoom()
{
int dx, dy;
......@@ -195,7 +229,7 @@ double PCB_BASE_FRAME::BestZoom( void )
}
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
{
// factored out of pcbnew/find.cpp
......@@ -203,7 +237,7 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos )
wxClientDC dc( m_canvas );
/* There may be need to reframe the drawing. */
// There may be need to reframe the drawing.
if( !m_canvas->IsPointOnDisplay( aPos ) )
{
screen->SetCrossHairPosition( aPos );
......@@ -226,7 +260,7 @@ void PCB_BASE_FRAME::ReCreateMenuBar( void )
}
/* Virtual functions: Do nothing for PCB_BASE_FRAME window */
// Virtual functions: Do nothing for PCB_BASE_FRAME window
void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
{
}
......
This diff is collapsed.
......@@ -184,12 +184,9 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
text.Empty();
for( int ii = 0; ii < PADNAMEZ; ii++ )
for( int ii = 0; ii < PADNAMEZ && m_Padname[ii]; ii++ )
{
if( !m_Padname[ii] )
break;
// add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
// m_Padname is 8 bit KiCad font junk, do not sign extend
text.Append( (unsigned char) m_Padname[ii] );
}
#endif
......
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