7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 16:19:36 +00:00

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

This commit is contained in:
Dick Hollenbeck 2011-12-30 23:44:00 -06:00
parent 929d5c7a3f
commit 697f912307
57 changed files with 2735 additions and 1884 deletions

View File

@ -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})

View File

@ -35,22 +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_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.
SetCurItem( NULL );
}
@ -59,50 +65,24 @@ BASE_SCREEN::~BASE_SCREEN()
}
/*
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);
}
*/
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

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 */
{

View File

@ -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() )
{

View File

@ -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;
}
}
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// 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 );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// http://www.wxformbuilder.org/
//
// 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();
};

View File

@ -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 );
}

View File

@ -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 )
{

View File

@ -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

View File

@ -216,12 +216,6 @@ void EDA_APP::WriteProjectConfig( const wxString& fileName,
}
/**
* Function SaveCurrentSetupValues
* Save the current setup values in m_settings
* saved parameters are parameters that have the .m_Setup member set to true
* @param aList = array of PARAM_CFG_BASE pointers
*/
void EDA_APP::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
{
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 );

View File

@ -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();

View File

@ -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();

View File

@ -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 );
}

View File

@ -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 )

View File

@ -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;

View File

@ -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() );
}
}

View File

@ -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();

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -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:

Some files were not shown because too many files have changed in this diff Show More