Commit 697f9123 authored by Dick Hollenbeck's avatar Dick Hollenbeck

moving objects into BOARD which are saved in a *.brd file, for PLUGIN access

parent 929d5c7a
......@@ -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,74 +35,54 @@
#include "id.h"
#define CURSOR_SIZE 12 /* size of the cross cursor. */
#define CURSOR_SIZE 12 /// size of the cross cursor.
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) :
EDA_ITEM( aType )
{
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a reasonable value */
m_UndoRedoCountMax = 10; // undo/Redo command Max depth, 10 is a reasonable value
m_FirstRedraw = true;
m_ScreenNumber = 1;
m_NumberOfScreen = 1; /* Hierarchy: Root: ScreenNumber = 1 */
m_NumberOfScreen = 1; // Hierarchy: Root: ScreenNumber = 1
m_Zoom = 32.0;
m_Grid.m_Size = wxRealPoint( 50, 50 ); /* Default grid size */
m_Grid.m_Size = wxRealPoint( 50, 50 ); // Default grid size
m_Grid.m_Id = ID_POPUP_GRID_LEVEL_50;
m_Center = true;
m_IsPrinting = false;
m_ScrollPixelsPerUnitX = 1;
m_ScrollPixelsPerUnitY = 1;
}
m_FlagModified = false; // Set when any change is made on board.
m_FlagSave = false; // Used in auto save set when an auto save is required.
BASE_SCREEN::~BASE_SCREEN()
{
SetCurItem( NULL );
}
/*
wxSize BASE_SCREEN::ReturnPageSize( void )
{
int internal_units = GetInternalUnits();
wxSize size = m_CurrentSheetDesc->m_Size;
size.x = (int)( (double)size.x * internal_units / 1000 );
size.y = (int)( (double)size.y * internal_units / 1000 );
return size;
}
void BASE_SCREEN::SetPageSize( wxSize& aPageSize )
BASE_SCREEN::~BASE_SCREEN()
{
int internal_units = GetInternalUnits();
m_CurrentSheetDesc->m_Size.x = (int) ((double)aPageSize.x * 1000 / internal_units);
m_CurrentSheetDesc->m_Size.y = (int) ((double)aPageSize.y * 1000 / internal_units);
}
*/
void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeInternalUnits )
void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU )
{
if( m_Center )
{
m_crossHairPosition.x = m_crossHairPosition.y = 0;
m_DrawOrg.x = -aPageSizeInternalUnits.x / 2;
m_DrawOrg.y = -aPageSizeInternalUnits.y / 2;
m_DrawOrg.x = -aPageSizeIU.x / 2;
m_DrawOrg.y = -aPageSizeIU.y / 2;
}
else
{
m_DrawOrg.x = m_DrawOrg.y = 0;
m_crossHairPosition.x = aPageSizeInternalUnits.x / 2;
m_crossHairPosition.y = aPageSizeInternalUnits.y / 2;
m_crossHairPosition.x = aPageSizeIU.x / 2;
m_crossHairPosition.y = aPageSizeIU.y / 2;
}
m_O_Curseur.x = m_O_Curseur.y = 0;
SetCurItem( NULL );
m_FlagModified = false; // Set when any change is made on board.
m_FlagSave = false; // Used in auto save set when an auto save is required.
}
......@@ -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
......
......@@ -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();
......
......@@ -119,7 +119,6 @@ void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill
corner_list.push_back( corner );
PlotPoly( corner_list, fill );
}
......@@ -428,7 +427,7 @@ void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
wxASSERT( !output_file );
pageInfo = aPageSettings;
// PAGE_INFO is in mils, plotter works with decimals
// PAGE_INFO is in mils, plotter works with deci-mils
paper_size = pageInfo.GetSizeMils() * 10;
}
......@@ -197,19 +197,32 @@ double PAGE_INFO::s_user_width = 17.0;
double PAGE_INFO::s_user_height = 11.0;
static const PAGE_INFO pageUser( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "User" ) );
/*
static const PAGE_INFO* pageSizes[] =
{
&pageA4, &pageA3, &pageA2, &pageA1, &pageA0,
&pageA, &pageB, &pageC, &pageD, &pageE, &pageUser,
static const PAGE_INFO* stdPageSizes[] = {
&pageA4,
&pageA3,
&pageA2,
&pageA1,
&pageA0,
&pageA,
&pageB,
&pageC,
&pageD,
&pageE,
// &pageGERBER, omitted, not standard
&pageUser,
};
PAGE_INFOS PAGE_INFO::GetStandardSizes()
wxArrayString PAGE_INFO::GetStandardSizes()
{
return PAGE_INFOS( pageSizes, pageSizes + DIM( pageSizes ) );
wxArrayString ret;
for( unsigned i=0; i < DIM( stdPageSizes ); ++i )
ret.Add( stdPageSizes[i]->GetType() );
return ret;
}
*/
bool PAGE_INFO::SetType( const wxString& aType )
{
......@@ -235,6 +248,8 @@ bool PAGE_INFO::SetType( const wxString& aType )
*this = pageD;
else if( aType == pageE.GetType() )
*this = pageE;
else if( aType == pageGERBER.GetType() )
*this = pageGERBER;
else if( aType == pageUser.GetType() )
{
*this = pageUser;
......@@ -278,14 +293,18 @@ PAGE_INFO::PAGE_INFO( const wxString& aType )
void PAGE_INFO::SetWidthInches( double aWidthInInches )
{
// limit resolution to 1/1000th of an inch
m_widthInches = double( int( aWidthInInches * 1000 + 500 ) / 1000 );
int mils = aWidthInInches * 1000 + 0.5;
m_widthInches = mils / 1000.0;
}
void PAGE_INFO::SetHeightInches( double aHeightInInches )
{
// limit resolution to 1/1000th of an inch
m_heightInches = double( int( aHeightInInches * 1000 + 500 ) / 1000 );
int mils = aHeightInInches * 1000 + 0.5;
m_heightInches = mils / 1000.0;
}
......
......@@ -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 ) );
}
......@@ -329,7 +330,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 )
{
......@@ -377,7 +378,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;
......@@ -427,7 +428,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 )
......@@ -509,11 +510,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 ) );
}
......@@ -522,10 +523,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;
......@@ -537,7 +538,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 */
{
......
......@@ -21,7 +21,8 @@
*/
void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
{
#define WSTEXTSIZE 50 // Text size in mils
#define WSTEXTSIZE 50 // Text size in mils
const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils(); // mils
int xg, yg;
......@@ -29,12 +30,13 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
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. */
// 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;
......@@ -43,16 +45,18 @@ 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 );
/* Plot edge. */
// Plot edge.
ref.x = pageInfo.GetLeftMarginMils() * conv_unit;
ref.y = pageInfo.GetTopMarginMils() * conv_unit;
xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
ref.y = pageInfo.GetTopMarginMils() * conv_unit;
xg = ( pageSize.x - pageInfo.GetRightMarginMils() ) * conv_unit;
yg = ( pageSize.y - pageInfo.GetBottomMarginMils() ) * conv_unit;
#if defined(KICAD_GOST)
......@@ -67,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;
}
......@@ -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,7 +249,7 @@ 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;
......@@ -248,6 +260,7 @@ 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 - pageInfo.GetRightMarginMils();
ref.y = pageSize.y - pageInfo.GetBottomMarginMils();
......@@ -401,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() )
{
......
......@@ -16,6 +16,7 @@
#include "wxstruct.h"
#include "wx/valgen.h"
#include <wx/tokenzr.h>
#ifdef EESCHEMA
#include "general.h"
......@@ -66,6 +67,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
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 );
......@@ -192,6 +194,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
if( radioSelection < 0 )
radioSelection = 0;
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
wxString paperType = m_PageSizeBox->GetString( radioSelection );
m_page.SetType( paperType );
......@@ -220,13 +223,13 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
#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,12 +268,24 @@ void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
{
wxString curPaperType = m_page.GetType();
// use wxFormBuilder to store the sheet type in the wxRadioButton's label
// i.e. "A4", "A3", etc, anywhere within the text of the label.
D(printf("m_PageSizeBox->GetCount() = %d\n", (int) m_PageSizeBox->GetCount() );)
// search all the child wxRadioButtons for a label containing our paper type
for( unsigned i = 0; i < m_PageSizeBox->GetCount(); ++i )
{
if( m_PageSizeBox->GetString( i ) == curPaperType )
// parse each label looking for curPaperType within it
wxStringTokenizer st( m_PageSizeBox->GetString( i ) );
while( st.HasMoreTokens() )
{
m_PageSizeBox->SetSelection( i );
return;
if( st.GetNextToken() == curPaperType )
{
m_PageSizeBox->SetSelection( i );
return;
}
}
}
......
///////////////////////////////////////////////////////////////////////////
// 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 );
......@@ -748,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 );
......@@ -768,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 )
......@@ -808,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 );
......@@ -820,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 );
}
......
......@@ -677,7 +677,9 @@ 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;
......@@ -687,18 +689,18 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, int aDrawMode )
// Draw the Y axis
GRDashedLine( &m_ClipBox, aDC,
GetParent()->m_originAxisPosition.x,
origin.x,
-pageSize.y,
GetParent()->m_originAxisPosition.x,
origin.x,
pageSize.y,
0, color );
// Draw the X axis
GRDashedLine( &m_ClipBox, aDC,
-pageSize.x,
GetParent()->m_originAxisPosition.y,
origin.y,
pageSize.x,
GetParent()->m_originAxisPosition.y,
origin.y,
0, color );
}
......@@ -1118,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 );
......
......@@ -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( GetPageSettings().GetSizeIU() ) );
LoadSettings();
......
......@@ -209,8 +209,10 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
SetIcon( icon );
SetScreen( new SCH_SCREEN() );
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) );
GetScreen()->m_Center = true;
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadSettings();
......
......@@ -97,7 +97,8 @@ 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( const wxSize& aPageSizeIU ) :
BASE_SCREEN( SCH_SCREEN_T )
{
size_t i;
......@@ -114,9 +115,10 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
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
// Suitable for schematic only. For libedit and viewlib, must be set to true
m_Center = false;
InitDataPoints( aPageSizeIU );
}
......
......@@ -794,7 +794,7 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
}
else
{
SetScreen( new SCH_SCREEN() );
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) );
success = aFrame->LoadOneEEFile( m_screen, m_fileName );
if( success )
......
......@@ -345,7 +345,7 @@ void SCH_EDIT_FRAME::CreateScreens()
if( g_RootSheet->GetScreen() == NULL )
{
g_RootSheet->SetScreen( new SCH_SCREEN() );
g_RootSheet->SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) );
SetScreen( g_RootSheet->GetScreen() );
}
......@@ -355,7 +355,7 @@ void SCH_EDIT_FRAME::CreateScreens()
m_CurrentSheet->Push( g_RootSheet );
if( GetScreen() == NULL )
SetScreen( new SCH_SCREEN() );
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) );
GetScreen()->SetZoom( 32.0 );
GetScreen()->m_UndoRedoCountMax = 10;
......
......@@ -116,7 +116,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
}
else // New file.
{
aSheet->SetScreen( new SCH_SCREEN() );
aSheet->SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) );
aSheet->GetScreen()->SetFileName( fileName.GetFullPath() );
}
}
......
......@@ -125,7 +125,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
if( m_Semaphore )
MakeModal(true);
SetScreen( new SCH_SCREEN() );
SetScreen( new SCH_SCREEN( GetPageSettings().GetSizeIU() ) );
GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings();
......
......@@ -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
PAGE_INFO* 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 )
......
......@@ -21,6 +21,8 @@ class GERBVIEW_FRAME;
class GERBER_IMAGE;
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 PAGE_INFO;
#define GERB_FLASH 3 // Flash
typedef enum
enum PlotFormat
{
FORMAT_HPGL,
FORMAT_GERBER,
FORMAT_POST
} PlotFormat;
};
/**
* Enum ITEM_VISIBLE
......
......@@ -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" ) );
/*************************************/
......@@ -84,11 +85,15 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
SetIcon( icon );
SetBoard( new BOARD() );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
GetBoard()->SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible.
SetScreen( new PCB_SCREEN() );
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
// 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 );
......@@ -209,23 +214,25 @@ void GERBVIEW_FRAME::LoadSettings()
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
wxString pageType;
PAGE_INFO pageInfo( wxT( "GERBER" ) );
config->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
if( m_showBorderAndTitleBlock )
{
wxString pageType;
config->Read( GerbviewShowPageSizeOption, &pageType, wxT( "GERBER" ) );
config->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
PAGE_INFO pageInfo( pageType );
pageInfo.SetType( pageType );
}
SetPageSettings( pageInfo );
GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
if( pageSize_opt > 0 )
{
m_showBorderAndTitleBlock = true;
}
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
......@@ -252,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, GetPageSettings().GetType() );
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,7 @@ 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();
......
......@@ -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 );
......
......@@ -92,6 +92,9 @@ 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
......@@ -101,6 +104,7 @@ public:
// Scrollbars management:
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 */
......@@ -142,7 +146,6 @@ public:
wxPoint m_GridOrigin;
wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
double m_Zoom; ///< Current zoom coefficient.
bool m_IsPrinting;
public:
......
......@@ -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
{
......
......@@ -22,7 +22,13 @@ 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; }
......
......@@ -83,7 +83,13 @@ class SCH_SCREEN : public BASE_SCREEN
void addConnectedItemsToBlock( const wxPoint& aPosition );
public:
SCH_SCREEN( KICAD_T aType = SCH_SCREEN_T );
/**
* Constructor
* @param aPageSizeIU is the size of the initial paper page in internal units.
*/
SCH_SCREEN( const wxSize& aPageSizeIU );
~SCH_SCREEN();
virtual wxString GetClass() const
......
......@@ -134,6 +134,8 @@ class PAGE_INFO;
* eventually print or plot. Since paper is often described in inches,
* (and due to legacy code), inches, mils, and internal units (IU) are supported
* in the accessors. Again, we are describing paper in this class.
*
* @author Dick Hollenbeck
*/
class PAGE_INFO
{
......@@ -168,7 +170,8 @@ public:
int GetHeightMils() const { return int( 1000 * m_heightInches ); }
const wxSize GetSizeMils() const { return wxSize( GetWidthMils(), GetHeightMils() ); }
// accessors returning Internal Units
// 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.54e7 * m_widthInches ); }
......@@ -203,7 +206,11 @@ public:
*/
static void SetUserHeightInches( double aHeightInInches );
#define PAGE_INFO_COUNT 11 ///< count of standard page sizes
/**
* Function GetStandardSizes
* returns the standard page types, such as "A4", "A3", etc.
*/
static wxArrayString GetStandardSizes();
private:
wxString m_Type; ///< paper type: A4, A3, etc.
......
......@@ -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,8 +5,8 @@
* @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"
......@@ -28,8 +28,7 @@ enum PlotFormat {
class PLOTTER
{
public:
PlotFormat m_PlotType; // type of plot
public: PLOTTER( PlotFormat aPlotType );
PLOTTER( PlotFormat aPlotType );
virtual ~PLOTTER()
{
......@@ -45,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;
......@@ -56,13 +54,11 @@ 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;
......@@ -80,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
......@@ -152,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,
......@@ -183,7 +174,8 @@ public: PLOTTER( PlotFormat aPlotType );
int aWidth,
bool aItalic,
bool aBold );
void marker( const wxPoint& position, int diametre, int aShapeId );
void marker( const wxPoint& position, int diametre, int aShapeId );
/**
* Function SetLayerPolarity
......@@ -207,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;
......@@ -228,13 +226,15 @@ protected:
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();
......@@ -243,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
......@@ -329,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 );
......@@ -349,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 );
......@@ -416,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;
......@@ -428,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 );
......@@ -469,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 );
......@@ -484,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 )
{
}
......@@ -556,4 +559,4 @@ protected:
int current_color;
};
#endif // __INCLUDE__PLOT_COMMON_H__
#endif // PLOT_COMMON_H_
......@@ -116,6 +116,9 @@ public:
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
......
......@@ -397,9 +397,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;
......@@ -459,9 +456,8 @@ public:
*/
virtual const wxSize GetPageSizeIU() const = 0;
wxPoint GetOriginAxisPosition() const { return m_originAxisPosition; }
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; }
......@@ -666,7 +662,6 @@ public:
/**
* Function GetXYSheetReferences
* returns the X,Y sheet references where the point position is located
* @param aScreen = screen to use
* @param aPosition = position to identify by YX ref
* @return a wxString containing the message locator like A3 or B6
* (or ?? if out of page limits)
......
......@@ -125,10 +125,14 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
m_Pcb = aBoard;
}
void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( m_Pcb );
m_Pcb->SetPageSettings( aPageSettings );
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
}
......@@ -142,14 +146,25 @@ const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const
const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
{
wxASSERT( m_Pcb );
const PAGE_INFO& page = m_Pcb->GetPageSettings();
// convert paper size into internal units.
#if defined( KICAD_NANOMETRE )
return page.GetSizeMils() * 25400; // nanometers
#else
return page.GetSizeMils() * 10; // deci-mils
#endif
// 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 );
}
......
......@@ -176,6 +176,9 @@ private:
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
PAGE_INFO m_paper;
/// Position of the origin axis.
wxPoint m_originAxisPosition;
/**
* Function chainMarkedSegments
* is used by MarkTrace() to set the BUSY flag of connected segments of the trace
......@@ -538,6 +541,9 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
/**
* Function SetBoardSettings
* @return the current COLORS_DESIGN_SETTINGS in use
......
......@@ -119,7 +119,7 @@ public:
int m_ShapeMaxRadius; // radius of the circle containing the pad shape
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
int m_Orient; // in 1/10 degrees
double m_Orient; // in 1/10 degrees
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer)
......@@ -205,11 +205,11 @@ public:
* sets the rotation angle of the pad.
* @param aAngle is tenths of degrees, but will soon be degrees.
*/
void SetOrientation( double aAngle ) { m_Orient = (int) aAngle; } // manage migration to degrees
void SetOrientation( double aAngle ) { m_Orient = aAngle; } // manage migration to degrees
/**
* Function GetOrientation
* returns the rotation angle of the pad in tenths of degress, but soon degress.
* returns the rotation angle of the pad in tenths of degress, but soon degrees.
*/
double GetOrientation() const { return m_Orient; }
......
......@@ -6,6 +6,7 @@
#include "fctsys.h"
#include "common.h"
#include "macros.h"
#include "trigo.h"
#include "class_pcb_screen.h"
#include "pcbnew.h"
......@@ -25,19 +26,18 @@
* Zoom 5 and 10 can create artefacts when drawing (integer overflow in low level graphic
* functions )
*/
static const double PcbZoomList[] =
static const double pcbZoomList[] =
{
0.5, 1.0, 1.5, 2.0, 3.0, 4.5, 7.0,
10.0, 15.0, 22.0, 35.0, 50.0, 80.0, 120.0,
200.0, 350.0, 500.0, 1000.0, 2000.0
};
#define PCB_ZOOM_LIST_CNT ( sizeof( PcbZoomList ) / sizeof( PcbZoomList[0] ) )
#define MM_TO_PCB_UNITS (10000.0 / 25.4)
/* Default grid sizes for PCB editor screens. */
static GRID_TYPE PcbGridList[] =
// Default grid sizes for PCB editor screens.
static GRID_TYPE pcbGridList[] =
{
// predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, wxRealPoint( 1000, 1000 ) },
......@@ -66,21 +66,15 @@ static GRID_TYPE PcbGridList[] =
{ ID_POPUP_GRID_LEVEL_0_0_1MM, wxRealPoint( MM_TO_PCB_UNITS * 0.01, MM_TO_PCB_UNITS * 0.01 ) }
};
#define PCB_GRID_LIST_CNT ( sizeof( PcbGridList ) / sizeof( GRID_TYPE ) )
/*******************************************************************/
/* Class PCB_SCREEN: class to handle parametres to display a board */
/********************************************************************/
PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
PCB_SCREEN::PCB_SCREEN( const wxSize& aPageSizeIU ) :
BASE_SCREEN( SCREEN_T )
{
size_t i;
for( i = 0; i < PCB_ZOOM_LIST_CNT; i++ )
m_ZoomList.Add( PcbZoomList[i] );
for( unsigned i = 0; i < DIM( pcbZoomList ); ++i )
m_ZoomList.Add( pcbZoomList[i] );
for( i = 0; i < PCB_GRID_LIST_CNT; i++ )
AddGrid( PcbGridList[i] );
for( unsigned i = 0; i < DIM( pcbGridList ); ++i )
AddGrid( pcbGridList[i] );
// Set the working grid size to a reasonnable value (in 1/10000 inch)
SetGrid( wxRealPoint( 500, 500 ) );
......@@ -88,7 +82,10 @@ PCB_SCREEN::PCB_SCREEN() : BASE_SCREEN( SCREEN_T )
m_Active_Layer = LAYER_N_BACK; // default active layer = bottom layer
m_Route_Layer_TOP = LAYER_N_FRONT; // default layers pair for vias (bottom to top)
m_Route_Layer_BOTTOM = LAYER_N_BACK;
m_Zoom = 150; // a default value for zoom
SetZoom( 150 ); // a default value for zoom
InitDataPoints( aPageSizeIU );
}
......@@ -104,14 +101,6 @@ int PCB_SCREEN::GetInternalUnits()
}
/*************************/
/* class DISPLAY_OPTIONS */
/*************************/
/*
* Handle display options like enable/disable some optional drawings:
*/
DISPLAY_OPTIONS::DISPLAY_OPTIONS()
{
DisplayPadFill = FILLED;
......@@ -121,7 +110,7 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayModEdge = true;
DisplayModText = true;
DisplayPcbTrackFill = true; /* false = sketch , true = filled */
DisplayPcbTrackFill = true; // false = sketch , true = filled
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
......
......@@ -299,7 +299,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadOrientCtrl->SetValue( msg );
// Pad Orient
switch( m_dummyPad->m_Orient )
switch( int( m_dummyPad->GetOrientation() ) )
{
case 0:
m_PadOrient->SetSelection( 0 );
......@@ -314,7 +314,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
break;
case 1800:
case - 1800:
case -1800:
m_PadOrient->SetSelection( 3 );
break;
......
......@@ -145,8 +145,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
GetBoard()->ComputeBoundingBox();
// Save the auxiliary origin for the rest of the module
GencadOffsetX = m_originAxisPosition.x;
GencadOffsetY = m_originAxisPosition.y;
GencadOffsetX = GetOriginAxisPosition().x;
GencadOffsetY = GetOriginAxisPosition().y;
// No idea on *why* this should be needed... maybe to fix net names?
Compile_Ratsnest( NULL, true );
......
......@@ -93,7 +93,7 @@ void PCB_EDIT_FRAME::GenModulesPosition( wxCommandEvent& event )
FILE* fpBack = 0;
bool switchedLocale = false;
File_Place_Offset = m_originAxisPosition;
File_Place_Offset = GetOriginAxisPosition();
/* Calculating the number of useful modules (CMS attribute, not VIRTUAL) */
int moduleCount = 0;
......
......@@ -52,7 +52,7 @@ static void TraceFilledCircle( BOARD* Pcb,
static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
int color, int op_logic );
/* Macro call to update cell. */
// Macro call to update cell.
#define OP_CELL( layer, dy, dx ) \
{ \
if( layer < 0 ) \
......@@ -109,10 +109,10 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
dy += abs( pt_pad->m_DeltaSize.x ) / 2;
}
if( ( pt_pad->m_Orient % 900 ) == 0 ) /* The pad is a rectangle
* horizontally or vertically. */
// The pad is a rectangle horizontally or vertically.
if( int( pt_pad->GetOrientation() ) % 900 == 0 )
{
/* Orientation turned 90 deg. */
// Orientation turned 90 deg.
if( ( pt_pad->m_Orient == 900 ) || ( pt_pad->m_Orient == 2700 ) )
{
EXCHG( dx, dy );
......@@ -158,17 +158,17 @@ void TraceFilledCircle( BOARD* Pcb,
int tstwrite = 0;
int distmin;
/* Determine occupied layer. */
// Determine occupied layer.
/* Single routing layer on bitmap and BOTTOM
* Route_Layer_B = Route_Layer_A */
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
trace = 1; /* Trace on BOTTOM */
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( Route_Layer_TOP ) )
if( Nb_Sides )
trace |= 2; /* Trace on TOP */
trace |= 2; // Trace on TOP
if( trace == 0 )
return;
......@@ -202,13 +202,13 @@ void TraceFilledCircle( BOARD* Pcb,
distmin = radius;
/* Calculate the bounding rectangle of the circle. */
// Calculate the bounding rectangle of the circle.
ux0 = cx - radius;
uy0 = cy - radius;
ux1 = cx + radius;
uy1 = cy + radius;
/* Calculate limit coordinates of cells belonging to the rectangle. */
// Calculate limit coordinates of cells belonging to the rectangle.
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / Board.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting) row_min++;
......@@ -226,7 +226,7 @@ void TraceFilledCircle( BOARD* Pcb,
if( col_max >= (Ncols - 1) )
col_max = Ncols - 1;
/* Calculate coordinate limits of cell belonging to the rectangle. */
// Calculate coordinate limits of cell belonging to the rectangle.
if( row_min > row_max )
row_max = row_min;
......@@ -265,7 +265,7 @@ void TraceFilledCircle( BOARD* Pcb,
* (Adverse event: pad off grid in the center of the 4 neighboring
* diagonal) */
distmin = Board.m_GridRouting / 2 + 1;
fdistmin = ( (float) distmin * distmin ) * 2; /* Distance to center point diagonally */
fdistmin = ( (float) distmin * distmin ) * 2; // Distance to center point diagonally
for( row = row_min; row <= row_max; row++ )
{
......@@ -297,13 +297,13 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
half_width = ( pt_segm->m_Width / 2 ) + marge;
/* Calculate the bounding rectangle of the segment (if H, V or Via) */
// Calculate the bounding rectangle of the segment (if H, V or Via)
ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().GetX();
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().GetY();
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().GetX();
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().GetY();
/* Test if VIA (filled circle was drawn) */
// Test if VIA (filled circle was drawn)
if( pt_segm->Type() == PCB_VIA_T )
{
int mask_layer = 0;
......@@ -333,7 +333,7 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
if( color == VIA_IMPOSSIBLE )
layer = -1;
/* The segment is here a straight line or a circle or an arc.: */
// The segment is here a straight line or a circle or an arc.:
if( pt_segm->m_Shape == S_CIRCLE )
{
TraceCircle( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
......@@ -346,7 +346,7 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
return;
}
/* The segment is here a line segment. */
// The segment is here a line segment.
if( ( ux0 != ux1 ) && ( uy0 != uy1 ) ) // Segment tilts.
{
DrawSegmentQcq( ux0, uy0, ux1, uy1, half_width, layer, color, op_logic );
......@@ -396,7 +396,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
lim = y1 / Board.m_GridRouting;
dx = x0 / Board.m_GridRouting;
/* Clipping limits of board. */
// Clipping limits of board.
if( ( dx < 0 ) || ( dx >= Ncols ) )
return;
......@@ -423,7 +423,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
lim = x1 / Board.m_GridRouting;
dy = y0 / Board.m_GridRouting;
/* Clipping limits of board. */
// Clipping limits of board.
if( ( dy < 0 ) || ( dy >= Nrows ) )
return;
......@@ -441,8 +441,8 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
return;
}
/* Here is some perspective: using the algorithm LUCAS. */
if( abs( x1 - x0 ) >= abs( y1 - y0 ) ) /* segment slightly inclined/ */
// Here is some perspective: using the algorithm LUCAS.
if( abs( x1 - x0 ) >= abs( y1 - y0 ) ) // segment slightly inclined/
{
if( x1 < x0 )
{
......@@ -526,10 +526,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
void (* WriteCell)( int, int, int, MATRIX_CELL );
if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) )
trace = 1; /* Trace on BOTTOM */
trace = 1; // Trace on BOTTOM
if( ( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) && Nb_Sides )
trace |= 2; /* Trace on TOP */
trace |= 2; // Trace on TOP
if( trace == 0 )
return;
......@@ -563,7 +563,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
/* Calculating limits coord cells belonging to the rectangle. */
// Calculating limits coord cells belonging to the rectangle.
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / Board.m_GridRouting;
......@@ -606,8 +606,8 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
int angle, int aLayerMask, int color, int op_logic )
{
int row, col;
int cx, cy; /* Center of rectangle */
int radius; /* Radius of the circle */
int cx, cy; // Center of rectangle
int radius; // Radius of the circle
int row_min, row_max, col_min, col_max;
int rotrow, rotcol;
int trace = 0;
......@@ -615,12 +615,12 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
void (* WriteCell)( int, int, int, MATRIX_CELL );
if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) )
trace = 1; /* Trace on BOTTOM */
trace = 1; // Trace on BOTTOM
if( aLayerMask & GetLayerMask( Route_Layer_TOP ) )
{
if( Nb_Sides )
trace |= 2; /* Trace on TOP */
trace |= 2; // Trace on TOP
}
if( trace == 0 )
......@@ -660,7 +660,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
radius = (int) sqrt( (double) ( cx - ux0 ) * ( cx - ux0 )
+ (double) ( cy - uy0 ) * ( cy - uy0 ) );
/* Calculating coordinate limits belonging to the rectangle. */
// Calculating coordinate limits belonging to the rectangle.
row_max = ( cy + radius ) / Board.m_GridRouting;
col_max = ( cx + radius ) / Board.m_GridRouting;
row_min = ( cy - radius ) / Board.m_GridRouting;
......@@ -756,14 +756,14 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
break;
}
/* Make coordinate ux1 tj > ux0 to simplify calculations */
// Make coordinate ux1 tj > ux0 to simplify calculations
if( ux1 < ux0 )
{
EXCHG( ux1, ux0 );
EXCHG( uy1, uy0 );
}
/* Calculating the incrementing the Y axis */
// Calculating the incrementing the Y axis
inc = 1;
if( uy1 < uy0 )
......@@ -819,7 +819,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
angle = -900;
}
RotatePoint( &dx, &dy, angle ); /* dx = length, dy = 0 */
RotatePoint( &dx, &dy, angle ); // dx = length, dy = 0
for( col = col_min; col <= col_max; col++ )
{
......@@ -833,7 +833,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
RotatePoint( &cx, &cy, angle );
if( abs( cy ) > lg )
continue; /* The point is too far on the Y axis. */
continue; // The point is too far on the Y axis.
/* This point a test is close to the segment: the position
* along the X axis must be tested.
......@@ -844,7 +844,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
continue;
}
/* Examination of extremities are rounded. */
// Examination of extremities are rounded.
if( ( cx < 0 ) && ( cx >= -lg ) )
{
if( ( ( cx * cx ) + ( cy * cy ) ) <= ( lg * lg ) )
......
......@@ -389,8 +389,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( data )
gy = atoi( data );
m_originAxisPosition.x = gx;
m_originAxisPosition.y = gy;
SetOriginAxisPosition( wxPoint( gx, gy ) );
continue;
}
......
......@@ -666,7 +666,7 @@ bool D_PAD::Save( FILE* aFile ) const
break;
}
fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %d\n",
fprintf( aFile, "Sh \"%.4s\" %c %d %d %d %d %g\n",
m_Padname, cshape, m_Size.x, m_Size.y,
m_DeltaSize.x, m_DeltaSize.y, m_Orient );
......@@ -938,7 +938,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
if( *PtLine == '"' )
PtLine++;
nn = sscanf( PtLine, " %s %d %d %d %d %d",
nn = sscanf( PtLine, " %s %d %d %d %d %lf",
BufCar, &m_Size.x, &m_Size.y,
&m_DeltaSize.x, &m_DeltaSize.y,
&m_Orient );
......
......@@ -564,10 +564,7 @@ void KICAD_PLUGIN::loadSETUP()
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
BIU gy = biuParse( data );
/* @todo
m_originAxisPosition.x = gx;
m_originAxisPosition.y = gy;
*/
m_board->SetOriginAxisPosition( wxPoint( gx, gy ) );
}
#if 1 // defined(PCBNEW)
......
......@@ -160,7 +160,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
SetBoard( g_ModuleEditor_Pcb );
if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN();
s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
SetScreen( s_screenModule );
GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting );
......
......@@ -423,7 +423,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_PLACE_OFFSET_COORD_BUTT:
m_canvas->DrawAuxiliaryAxis( aDC, GR_XOR );
m_originAxisPosition = GetScreen()->GetCrossHairPosition();
SetOriginAxisPosition( GetScreen()->GetCrossHairPosition() );
m_canvas->DrawAuxiliaryAxis( aDC, GR_COPY );
OnModify();
break;
......
......@@ -317,8 +317,11 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
SetIcon( icon );
m_internalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
SetScreen( new PCB_SCREEN() );
GetScreen()->m_Center = false; // PCB drawings start in the upper left corner.
SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
// PCB drawings start in the upper left corner.
GetScreen()->m_Center = false;
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager
......@@ -403,7 +406,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_Layers->ReFillRender(); // Update colors in Render after the config is read
syncLayerWidget();
m_auimgr.Update();
}
......
......@@ -17,7 +17,7 @@ class PCB_TARGET;
class ZONE_CONTAINER;
/* Shared Config keys for plot and print */
// Shared Config keys for plot and print
#define OPTKEY_LAYERBASE wxT( "PlotLayer_%d" )
#define OPTKEY_PRINT_X_FINESCALE_ADJ wxT( "PrintXFineScaleAdj" )
#define OPTKEY_PRINT_Y_FINESCALE_ADJ wxT( "PrintYFineScaleAdj" )
......@@ -27,10 +27,10 @@ class ZONE_CONTAINER;
#define OPTKEY_PRINT_MONOCHROME_MODE wxT( "PrintMonochrome" )
#define OPTKEY_PRINT_PADS_DRILL wxT( "PrintPadsDrillOpt" )
/* Conversion unit constants. */
/* Convert pcb dimension of 0.1 mil to PS units of inches. */
// Conversion unit constants.
// Convert pcb dimension of 0.1 mil to PS units of inches.
#define SCALE_PS .0001
/* Convert dimension 0.1 mil -> HPGL units: */
// Convert dimension 0.1 mil -> HPGL units:
#define SCALE_HPGL 0.102041
// Small drill marks diameter value (in internal value = 1/10000 inch)
......@@ -57,8 +57,8 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
GRTraceMode trace_mode );
/* PLOTGERB.CPP */
// PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
#endif /* #define PCBPLOT_H */
#endif // #define PCBPLOT_H
......@@ -35,12 +35,12 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
wxPoint offset;
/* Calculate scaling from Pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
// Calculate scaling from Pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units
double scale = g_PcbPlotOptions.m_PlotScale;
if( aPlotOriginIsAuxAxis )
{
offset = m_originAxisPosition;
offset = GetOriginAxisPosition();
}
else
{
......@@ -48,9 +48,11 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
offset.y = 0;
}
SetLocaleTo_C_standard();
LOCALE_IO toggle;
PLOTTER* plotter = new GERBER_PLOTTER();
/* No mirror and scaling for gerbers! */
// No mirror and scaling for gerbers!
plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
......@@ -78,7 +80,6 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
}
delete plotter;
SetLocaleTo_Default();
return true;
}
......@@ -477,7 +477,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
int px = pt_cur_ch->m_PadStart->GetPosition().x;
int py = pt_cur_ch->m_PadStart->GetPosition().y;
if( ( ( pt_cur_ch->m_PadStart->m_Orient / 900 ) & 1 ) != 0 )
if( ( ( int( pt_cur_ch->m_PadStart->m_Orient ) / 900 ) & 1 ) != 0 )
EXCHG( dx, dy );
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
......@@ -492,7 +492,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
px = pt_cur_ch->m_PadEnd->GetPosition().x;
py = pt_cur_ch->m_PadEnd->GetPosition().y;
if( ( (pt_cur_ch->m_PadEnd->m_Orient / 900) & 1 ) != 0 )
if( ( ( int( pt_cur_ch->m_PadEnd->m_Orient ) / 900) & 1 ) != 0 )
EXCHG( dx, dy );
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
......
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