Minor bug fixes, compiler warning fixes and code cleaning.

* Fix debug asserts when passing NULL pointers to wxAuiPaneInfo.
* Fix Kicad main window sash sizer bug when using wxAui.
* Remove specctra_test from Visual Studio builds to prevent build errors.
* Add WIN32 to layer widget test so it will build properly on Visual Studio.
* Fixed compiler conversion warnings in PCBNew.
* Fixed worksheet print scaling in PCBNew.
* Minor code renaming.
This commit is contained in:
stambaughw 2010-01-13 21:15:54 +00:00
parent 4936ca3a7f
commit e15341411d
17 changed files with 228 additions and 237 deletions

View File

@ -189,12 +189,15 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
if( m_ListCmp )
m_auimgr.AddPane( m_ListCmp,
wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() );
if( m_FootprintList )
m_auimgr.AddPane( m_FootprintList,
wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );

View File

@ -703,12 +703,12 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
* which is applied to the initial transform.
*/
/*****************************************************************/
void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
void SCH_COMPONENT::SetOrientation( int aOrientation )
{
int TempMat[2][2];
bool Transform = FALSE;
switch( type_rotate )
switch( aOrientation )
{
case CMP_ORIENT_0:
case CMP_NORMAL: /* Position Initiale */
@ -731,14 +731,14 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
Transform = TRUE;
break;
case CMP_MIROIR_Y: /* MirrorY */
case CMP_MIRROR_Y: /* MirrorY */
TempMat[0][0] = -1;
TempMat[1][1] = 1;
TempMat[0][1] = TempMat[1][0] = 0;
Transform = TRUE;
break;
case CMP_MIROIR_X: /* MirrorX */
case CMP_MIRROR_X: /* MirrorX */
TempMat[0][0] = 1;
TempMat[1][1] = -1;
TempMat[0][1] = TempMat[1][0] = 0;
@ -746,59 +746,59 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
break;
case CMP_ORIENT_90:
SetRotationMiroir( CMP_ORIENT_0 );
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
break;
case CMP_ORIENT_180:
SetRotationMiroir( CMP_ORIENT_0 );
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
break;
case CMP_ORIENT_270:
SetRotationMiroir( CMP_ORIENT_0 );
SetRotationMiroir( CMP_ROTATE_CLOCKWISE );
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_ROTATE_CLOCKWISE );
break;
case ( CMP_ORIENT_0 + CMP_MIROIR_X ):
SetRotationMiroir( CMP_ORIENT_0 );
SetRotationMiroir( CMP_MIROIR_X );
case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_MIRROR_X );
break;
case ( CMP_ORIENT_0 + CMP_MIROIR_Y ):
SetRotationMiroir( CMP_ORIENT_0 );
SetRotationMiroir( CMP_MIROIR_Y );
case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_MIRROR_Y );
break;
case ( CMP_ORIENT_90 + CMP_MIROIR_X ):
SetRotationMiroir( CMP_ORIENT_90 );
SetRotationMiroir( CMP_MIROIR_X );
case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_90 );
SetOrientation( CMP_MIRROR_X );
break;
case ( CMP_ORIENT_90 + CMP_MIROIR_Y ):
SetRotationMiroir( CMP_ORIENT_90 );
SetRotationMiroir( CMP_MIROIR_Y );
case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_90 );
SetOrientation( CMP_MIRROR_Y );
break;
case ( CMP_ORIENT_180 + CMP_MIROIR_X ):
SetRotationMiroir( CMP_ORIENT_180 );
SetRotationMiroir( CMP_MIROIR_X );
case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_180 );
SetOrientation( CMP_MIRROR_X );
break;
case ( CMP_ORIENT_180 + CMP_MIROIR_Y ):
SetRotationMiroir( CMP_ORIENT_180 );
SetRotationMiroir( CMP_MIROIR_Y );
case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_180 );
SetOrientation( CMP_MIRROR_Y );
break;
case ( CMP_ORIENT_270 + CMP_MIROIR_X ):
SetRotationMiroir( CMP_ORIENT_270 );
SetRotationMiroir( CMP_MIROIR_X );
case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_270 );
SetOrientation( CMP_MIRROR_X );
break;
case ( CMP_ORIENT_270 + CMP_MIROIR_Y ):
SetRotationMiroir( CMP_ORIENT_270 );
SetRotationMiroir( CMP_MIROIR_Y );
case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_270 );
SetOrientation( CMP_MIRROR_Y );
break;
default:
@ -841,20 +841,20 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
}
/** function GetRotationMiroir()
/** function GetOrientation()
* Used to display component orientation (in dialog editor or info)
* @return the orientation and mirror
* Note: Because there are different ways to have a given orientation/mirror,
* the orientation/mirror is not necessary what the used does
* (example : a mirrorX then a mirrorY give no mirror but rotate the component).
* So this function find a rotation and a mirror value
* ( CMP_MIROIR_X because this is the first mirror option tested)
* ( CMP_MIRROR_X because this is the first mirror option tested)
* but can differs from the orientation made by an user
* ( a CMP_MIROIR_Y is find as a CMP_MIROIR_X + orientation 180, because they
* ( a CMP_MIRROR_Y is find as a CMP_MIRROR_X + orientation 180, because they
* are equivalent)
*
*/
int SCH_COMPONENT::GetRotationMiroir()
int SCH_COMPONENT::GetOrientation()
{
int type_rotate = CMP_ORIENT_0;
int ComponentMatOrient[2][2];
@ -866,10 +866,10 @@ int SCH_COMPONENT::GetRotationMiroir()
int rotate_value[ROTATE_VALUES_COUNT] =
{
CMP_ORIENT_0, CMP_ORIENT_90, CMP_ORIENT_180, CMP_ORIENT_270,
CMP_MIROIR_X + CMP_ORIENT_0, CMP_MIROIR_X + CMP_ORIENT_90,
CMP_MIROIR_X + CMP_ORIENT_180, CMP_MIROIR_X + CMP_ORIENT_270,
CMP_MIROIR_Y + CMP_ORIENT_0, CMP_MIROIR_Y + CMP_ORIENT_90,
CMP_MIROIR_Y + CMP_ORIENT_180, CMP_MIROIR_Y + CMP_ORIENT_270
CMP_MIRROR_X + CMP_ORIENT_0, CMP_MIRROR_X + CMP_ORIENT_90,
CMP_MIRROR_X + CMP_ORIENT_180, CMP_MIRROR_X + CMP_ORIENT_270,
CMP_MIRROR_Y + CMP_ORIENT_0, CMP_MIRROR_Y + CMP_ORIENT_90,
CMP_MIRROR_Y + CMP_ORIENT_180, CMP_MIRROR_Y + CMP_ORIENT_270
};
// Try to find the current transform option:
@ -878,7 +878,7 @@ int SCH_COMPONENT::GetRotationMiroir()
for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ )
{
type_rotate = rotate_value[ii];
SetRotationMiroir( type_rotate );
SetOrientation( type_rotate );
if( memcmp( ComponentMatOrient, m_Transform,
sizeof(ComponentMatOrient) ) == 0 )
return type_rotate;
@ -1132,7 +1132,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
void SCH_COMPONENT::Mirror_Y(int aYaxis_position)
{
int dx = m_Pos.x;
SetRotationMiroir( CMP_MIROIR_Y );
SetOrientation( CMP_MIRROR_Y );
m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position;

View File

@ -176,8 +176,9 @@ public:
return new SCH_COMPONENT( *this );
}
void SetRotationMiroir( int type );
/** function GetRotationMiroir()
void SetOrientation( int aOrientation );
/** function GetOrientation()
* Used to display component orientation (in dialog editor or info)
* @return the orientation and mirror
* Note: Because there are different ways to have a given orientation/mirror,
@ -185,12 +186,12 @@ public:
* (example : a mirrorX then a mirrorY give no mirror but rotate the
* component).
* So this function find a rotation and a mirror value
* ( CMP_MIROIR_X because this is the first mirror option tested)
* ( CMP_MIRROR_X because this is the first mirror option tested)
* but can differs from the orientation made by an user
* ( a CMP_MIROIR_Y is find as a CMP_MIROIR_X + orientation 180, because
* ( a CMP_MIRROR_Y is find as a CMP_MIRROR_X + orientation 180, because
* they are equivalent)
*/
int GetRotationMiroir();
int GetOrientation();
wxPoint GetScreenCoord( const wxPoint& coord );
void DisplayInfo( WinEDA_DrawFrame* frame );

View File

@ -201,19 +201,19 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
switch( orientationRadioBox->GetSelection() )
{
case 0:
m_Cmp->SetRotationMiroir( CMP_ORIENT_0 );
m_Cmp->SetOrientation( CMP_ORIENT_0 );
break;
case 1:
m_Cmp->SetRotationMiroir( CMP_ORIENT_90 );
m_Cmp->SetOrientation( CMP_ORIENT_90 );
break;
case 2:
m_Cmp->SetRotationMiroir( CMP_ORIENT_180 );
m_Cmp->SetOrientation( CMP_ORIENT_180 );
break;
case 3:
m_Cmp->SetRotationMiroir( CMP_ORIENT_270 );
m_Cmp->SetOrientation( CMP_ORIENT_270 );
break;
}
@ -225,11 +225,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
break;
case 1:
m_Cmp->SetRotationMiroir( CMP_MIROIR_X );
m_Cmp->SetOrientation( CMP_MIRROR_X );
break;
case 2:
m_Cmp->SetRotationMiroir( CMP_MIROIR_Y );
m_Cmp->SetOrientation( CMP_MIRROR_Y );
break;
}
}
@ -663,8 +663,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
if( choiceCount <= 1 )
unitChoice->Enable( false );
int orientation = m_Cmp->GetRotationMiroir()
& ~( CMP_MIROIR_X | CMP_MIROIR_Y );
int orientation = m_Cmp->GetOrientation()
& ~( CMP_MIRROR_X | CMP_MIRROR_Y );
if( orientation == CMP_ORIENT_90 )
orientationRadioBox->SetSelection( 1 );
@ -675,14 +675,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
else
orientationRadioBox->SetSelection( 0 );
int mirror = m_Cmp->GetRotationMiroir() & ( CMP_MIROIR_X | CMP_MIROIR_Y );
int mirror = m_Cmp->GetOrientation() & ( CMP_MIRROR_X | CMP_MIRROR_Y );
if( mirror == CMP_MIROIR_X )
if( mirror == CMP_MIRROR_X )
{
mirrorRadioBox->SetSelection( 1 );
D( printf( "mirror=X,1\n" ); )
}
else if( mirror == CMP_MIROIR_Y )
else if( mirror == CMP_MIRROR_Y )
{
mirrorRadioBox->SetSelection( 2 );
D( printf( "mirror=Y,2\n" ); )
@ -742,7 +742,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
m_Cmp->GetField( VALUE )->m_Pos = valField.m_Pos + m_Cmp->m_Pos;
m_Cmp->GetField( VALUE )->ImportValues( valField );
m_Cmp->SetRotationMiroir( CMP_NORMAL );
m_Cmp->SetOrientation( CMP_NORMAL );
m_Parent->GetScreen()->SetModify();

View File

@ -255,7 +255,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
}
}
DrawComponent->SetRotationMiroir( type_rotate );
DrawComponent->SetOrientation( type_rotate );
/* Redraw the component in the new position. */
if( DC )

View File

@ -388,7 +388,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y );
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_Y );
}
break;
@ -402,7 +402,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_X );
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_X );
}
break;

View File

@ -1,6 +1,6 @@
/*********************************************/
/**********************************************/
/* eesave.cpp Module to Save EESchema files */
/*********************************************/
/**********************************************/
#include "fctsys.h"
#include "gr_basic.h"
@ -18,9 +18,6 @@
#include <boost/foreach.hpp>
static void SaveLayers( FILE* f );
/*****************************************************************************
* Routine to save an EESchema file. *
* FileSave controls how the file is to be saved - under what name. *
@ -112,73 +109,51 @@ bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
*/
bool SCH_SCREEN::Save( FILE* aFile ) const
{
wxString Name, msg;
Ki_PageDescr* PlotSheet;
wxString datetime = DateAndTime( );
// Creates header
if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP,
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) == EOF )
return FALSE;
if( fprintf( aFile, " date %s\n", CONV_TO_UTF8(datetime) ) == EOF )
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0
|| fprintf( aFile, " date %s\n", CONV_TO_UTF8( DateAndTime() ) ) < 0 )
return FALSE;
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{
Name = lib.GetName();
if( fprintf( aFile, "LIBS:%s\n", CONV_TO_UTF8( Name ) ) == EOF )
if( fprintf( aFile, "LIBS:%s\n", CONV_TO_UTF8( lib.GetName() ) ) < 0 )
return FALSE;
}
SaveLayers( aFile );
if( fprintf( aFile, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 )
return FALSE;
/* Write page info */
PlotSheet = m_CurrentSheetDesc;
fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( PlotSheet->m_Name ),
PlotSheet->m_Size.x, PlotSheet->m_Size.y );
/* Write ScreenNumber and NumberOfScreen; not very meaningfull for
* SheetNumber and Sheet Countin a complex hierarchy, but usefull in
* simple hierarchy and flat hierarchy. Used also to serach the root
/* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for
* SheetNumber and Sheet Count in a complex hierarchy, but useful in
* simple hierarchy and flat hierarchy. Used also to search the root
* sheet ( ScreenNumber = 1 ) within the files
*/
fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen );
fprintf( aFile, "Title \"%s\"\n", CONV_TO_UTF8( m_Title ) );
fprintf( aFile, "Date \"%s\"\n", CONV_TO_UTF8( m_Date ) );
fprintf( aFile, "Rev \"%s\"\n", CONV_TO_UTF8( m_Revision ) );
fprintf( aFile, "Comp \"%s\"\n", CONV_TO_UTF8( m_Company ) );
fprintf( aFile, "Comment1 \"%s\"\n", CONV_TO_UTF8( m_Commentaire1 ) );
fprintf( aFile, "Comment2 \"%s\"\n", CONV_TO_UTF8( m_Commentaire2 ) );
fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) );
fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) );
fprintf( aFile, "$EndDescr\n" );
if( fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( m_CurrentSheetDesc->m_Name ),
m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title \"%s\"\n", CONV_TO_UTF8( m_Title ) ) < 0
|| fprintf( aFile, "Date \"%s\"\n", CONV_TO_UTF8( m_Date ) ) < 0
|| fprintf( aFile, "Rev \"%s\"\n", CONV_TO_UTF8( m_Revision ) ) < 0
|| fprintf( aFile, "Comp \"%s\"\n", CONV_TO_UTF8( m_Company ) ) < 0
|| fprintf( aFile, "Comment1 \"%s\"\n", CONV_TO_UTF8( m_Commentaire1 ) ) < 0
|| fprintf( aFile, "Comment2 \"%s\"\n", CONV_TO_UTF8( m_Commentaire2 ) ) < 0
|| fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) ) < 0
|| fprintf( aFile, "$EndDescr\n" ) < 0 )
return FALSE;
/* Saving schematic items */
bool failed = false;
for( SCH_ITEM* item = EEDrawList; item && !failed; item = item->Next() )
for( SCH_ITEM* item = EEDrawList; item; item = item->Next() )
{
if( !item->Save( aFile ) )
failed = true;
return FALSE;
}
if( fprintf( aFile, "$EndSCHEMATC\n" ) == EOF )
failed = true;
if( fprintf( aFile, "$EndSCHEMATC\n" ) < 0 )
return FALSE;
return !failed;
}
/* Save a Layer Structure to a file
* theses infos are not used in eeschema
*/
static void SaveLayers( FILE* f )
{
fprintf( f, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer );
fprintf( f, "EELAYER END\n" );
return TRUE;
}

View File

@ -483,10 +483,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
switch( id )
{
case ID_POPUP_SCH_MIROR_X_CMP:
option = CMP_MIROIR_X; break;
option = CMP_MIRROR_X; break;
case ID_POPUP_SCH_MIROR_Y_CMP:
option = CMP_MIROIR_Y; break;
option = CMP_MIRROR_Y; break;
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
option = CMP_ROTATE_COUNTERCLOCKWISE; break;

View File

@ -202,19 +202,23 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );

View File

@ -164,18 +164,23 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );

View File

@ -43,8 +43,8 @@ enum fl_rot_cmp
CMP_ORIENT_90, // Rotate 90, no mirror
CMP_ORIENT_180, // Rotate 180, no mirror
CMP_ORIENT_270, // Rotate -90, no mirror
CMP_MIROIR_X = 0x100, // Mirror around X axis
CMP_MIROIR_Y = 0x200 // Mirror around Y axis
CMP_MIRROR_X = 0x100, // Mirror around X axis
CMP_MIRROR_Y = 0x200 // Mirror around Y axis
};
/**

View File

@ -1,5 +1,4 @@
/***********************************************************/
/* mdiframe.cpp - WinEDA_MainFrame is the kicad main frame */
/***********************************************************/
@ -41,7 +40,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
m_RightWin = NULL; /* A shashwindow that contains the buttons
* and the window display text
*/
m_LeftWin_Width = MAX(60, GetSize().x/3 );
m_LeftWin_Width = MAX( 60, GetSize().x/3 );
LoadSettings();
@ -61,22 +60,29 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
#endif
clientsize = GetClientSize();
int rightWinWidth = clientsize.x - m_LeftWin_Width;
// Left window: is the box which display tree project
m_LeftWin = new WinEDA_PrjFrame( this );
// Bottom Window: box to display messages
m_RightWin = new RIGHT_KM_FRAME( this );
/* Setting the sash control interferes with wxAUIManager and prevents the
* right and left window panes from being resized.
*/
#ifndef KICAD_AUIMANAGER
m_LeftWin->SetDefaultSize( wxSize( m_LeftWin_Width, clientsize.y ) );
m_LeftWin->SetOrientation( wxLAYOUT_VERTICAL );
m_LeftWin->SetAlignment( wxLAYOUT_LEFT );
m_LeftWin->SetSashVisible( wxSASH_RIGHT, TRUE );
m_LeftWin->SetExtraBorderSize( 2 );
// Bottom Window: box to display messages
m_RightWin = new RIGHT_KM_FRAME( this );
int rightWinWidth = clientsize.x - m_LeftWin_Width;
m_RightWin->SetDefaultSize( wxSize( rightWinWidth, clientsize.y ) );
m_RightWin->SetOrientation( wxLAYOUT_VERTICAL );
m_RightWin->SetAlignment( wxLAYOUT_RIGHT );
m_RightWin->SetExtraBorderSize( 2 );
#endif
msg = wxGetCwd();
line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() );
@ -98,29 +104,28 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
horiz.LeftDockable( false );
horiz.RightDockable( false );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Layer( 1 ) );
if( m_RightWin )
m_auimgr.AddPane( m_RightWin,
wxAuiPaneInfo().Name( wxT( "m_RightWin" ) ).CentrePane() );
wxAuiPaneInfo().Name( wxT( "m_RightWin" ) ).CentrePane().Layer( 1 ) );
if( m_LeftWin )
m_auimgr.AddPane( m_LeftWin,
wxAuiPaneInfo( horiz ).Name( wxT( "m_LeftWin" ) ).
Left().BestSize( m_LeftWin_Width, clientsize.y ) );
wxAuiPaneInfo().Name( wxT( "m_LeftWin" ) ).Floatable( false ).
CloseButton( false ).Left().BestSize( m_LeftWin_Width, clientsize.y ).
Layer( 1 ).CaptionVisible( false ) );
m_auimgr.Update();
#endif
}
/*****************************************************************************/
WinEDA_MainFrame::~WinEDA_MainFrame()
/*****************************************************************************/
{
#if defined(KICAD_AUIMANAGER)
m_auimgr.UnInit();
@ -128,24 +133,18 @@ WinEDA_MainFrame::~WinEDA_MainFrame()
}
/*******************************************************/
void WinEDA_MainFrame::PrintMsg( const wxString& text )
/*******************************************************/
/*
* Put text in the dialog frame
*/
void WinEDA_MainFrame::PrintMsg( const wxString& text )
{
m_RightWin->m_DialogWin->AppendText( text );
}
/****************************************************/
void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
/****************************************************/
/* Resize windows when dragging window borders
*/
void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
{
#if defined(KICAD_AUIMANAGER)
@ -164,9 +163,7 @@ void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
}
/************************************************/
void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
/************************************************/
{
#if defined(KICAD_AUIMANAGER)
if( m_auimgr.GetManagedWindow() )
@ -181,9 +178,7 @@ void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
}
/**********************************************************/
void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event )
/**********************************************************/
{
int px, py;
@ -307,17 +302,13 @@ void WinEDA_MainFrame::OnOpenFileInTextEditor( wxCommandEvent& event )
}
/********************************************************/
void WinEDA_MainFrame::OnRefresh( wxCommandEvent& event )
/********************************************************/
{
m_LeftWin->ReCreateTreePrj();
}
/*********************************/
void WinEDA_MainFrame::ClearMsg()
/*********************************/
{
m_RightWin->m_DialogWin->Clear();
}
@ -359,12 +350,10 @@ void WinEDA_MainFrame::SaveSettings()
#ifdef KICAD_PYTHON
/*****************************************************************************/
void WinEDA_MainFrame::OnRefreshPy()
/*****************************************************************************/
{
m_LeftWin->ReCreateTreePrj();
}
#endif

View File

@ -219,18 +219,21 @@ install(TARGETS pcbnew
COMPONENT binary)
# This one gets made only when testing.
#add_executable(dsntest EXCLUDE_FROM_ALL dsn.cpp)
#target_link_libraries(dsntest common ${wxWidgets_LIBRARIES})
# The specctra test fails to build properly using MS Visual Studio.
if(NOT MSVC)
# This one gets made only when testing.
#add_executable(dsntest EXCLUDE_FROM_ALL dsn.cpp)
#target_link_libraries(dsntest common ${wxWidgets_LIBRARIES})
# This one gets made only when testing.
add_executable(specctra_test EXCLUDE_FROM_ALL specctra.cpp)
target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES})
endif(NOT MSVC)
# This one gets made only when testing.
add_executable(specctra_test EXCLUDE_FROM_ALL specctra.cpp)
target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES})
# This one gets made only when testing.
add_executable(layer_widget_test EXCLUDE_FROM_ALL
add_executable(layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_panel_base.cpp
layer_widget.cpp
)
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES})

View File

@ -798,12 +798,12 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
isegm->DisplayInfoBase( frame );
// Add current track length
int trackLen = 0;
double trackLen = 0.0;
wxString msg;
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
trackLen += track->GetLength();
valeur_param( trackLen, msg );
valeur_param( wxRound( trackLen ), msg );
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
// Add current segments count (number of segments in this new track):

View File

@ -88,8 +88,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale = MIN( Xscale, Yscale );
offset.x = BoardCentre.x - (SheetSize.x / 2) / scale;
offset.y = BoardCentre.y - (SheetSize.y / 2) / scale;
offset.x = (int) ( (double) BoardCentre.x - ( (double) SheetSize.x / 2.0 ) / scale );
offset.y = (int) ( (double) BoardCentre.y - ( (double) SheetSize.y / 2.0 ) / scale );
offset.y += SheetSize.y / 8; /* offset to legend */
PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter;
@ -169,7 +169,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
/* Trace information. */
plotX = aPcb->m_BoundaryBox.GetX() + 200 * CharScale;
plotX = (int) ( (double) aPcb->m_BoundaryBox.GetX() + 200.0 * CharScale );
plotY = aPcb->m_BoundaryBox.GetBottom() + intervalle;
/* Plot title "Info" */
@ -189,8 +189,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotY += intervalle;
plot_diam = (int) ( aToolListBuffer[ii].m_Diameter );
x = plotX - 200 * CharScale - plot_diam / 2;
y = plotY + CharSize * CharScale;
x = (int) ( (double) plotX - 200.0 * CharScale - (double)plot_diam / 2.0 );
y = (int) ( (double) plotY + (double) CharSize * CharScale );
plotter->marker( wxPoint( x, y ), plot_diam, ii );
/* Trace the legends. */

View File

@ -274,25 +274,31 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
if( m_AuxiliaryToolBar )
m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
if( m_AuxVToolBar )
m_auimgr.AddPane( m_AuxVToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );

View File

@ -160,7 +160,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
userscale = m_PrintParams.m_PrintScale;
if( userscale == 0 ) // fit in page
{
int extra_margin = 8000; // Margin = 8000/2 units pcb = 0,4 inch
int extra_margin = 0; // Margin = 8000/2 units pcb = 0,4 inch
SheetSize.x = pcbframe->GetBoard()->m_BoundaryBox.GetWidth() + extra_margin;
SheetSize.y = pcbframe->GetBoard()->m_BoundaryBox.GetHeight() + extra_margin;
userscale = 0.99;
@ -174,8 +174,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
}
// Calculate a suitable scaling factor
scaleX = (double) SheetSize.x / PlotAreaSize.x;
scaleY = (double) SheetSize.y / PlotAreaSize.y;
scaleX = (double) SheetSize.x / (double) PlotAreaSize.x;
scaleY = (double) SheetSize.y / (double) PlotAreaSize.y;
scale = wxMax( scaleX, scaleY ) / userscale; // Use x or y scaling factor, whichever fits on the DC
// ajust the real draw scale
@ -187,15 +187,18 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
{
int w, h;
GetPPIPrinter( &w, &h );
accurate_Xscale = ( (double) ( DrawZoom * w ) ) / PCB_INTERNAL_UNIT;
accurate_Yscale = ( (double) ( DrawZoom * h ) ) / PCB_INTERNAL_UNIT;
accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT;
accurate_Yscale = ( (double) ( DrawZoom * h ) ) / (double) PCB_INTERNAL_UNIT;
if( IsPreview() ) // Scale must take in account the DC size in Preview
{
// Get the size of the DC in pixels
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
GetPageSizePixels( &w, &h );
accurate_Xscale *= PlotAreaSize.x; accurate_Xscale /= w;
accurate_Yscale *= PlotAreaSize.y; accurate_Yscale /= h;
accurate_Xscale *= PlotAreaSize.x;
accurate_Xscale /= (double) w;
accurate_Yscale *= PlotAreaSize.y;
accurate_Yscale /= (double) h;
}
accurate_Xscale *= m_PrintParams.m_XScaleAdjust;
accurate_Yscale *= m_PrintParams.m_YScaleAdjust;
@ -211,11 +214,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|| (m_PrintParams.m_PrintScale > 1.0) // scale > 1
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page
{
DrawOffset.x -= (int) ( (PlotAreaSize.x / 2) * scale );
DrawOffset.y -= (int) ( (PlotAreaSize.y / 2) * scale );
DrawOffset.x -= wxRound( ( (double) PlotAreaSize.x / 2.0 ) * scale );
DrawOffset.y -= wxRound( ( (double) PlotAreaSize.y / 2.0 ) * scale );
}
DrawOffset.x += (int) ( (SheetSize.x / 2) * (m_PrintParams.m_XScaleAdjust - 1.0) );
DrawOffset.y += (int) ( (SheetSize.y / 2) * (m_PrintParams.m_YScaleAdjust - 1.0) );
DrawOffset.x += wxRound( ( (double) SheetSize.x / 2.0 ) *
( m_PrintParams.m_XScaleAdjust - 1.0 ) );
DrawOffset.y += wxRound( ( (double) SheetSize.y / 2.0 ) *
( m_PrintParams.m_YScaleAdjust - 1.0 ) );
ActiveScreen->m_DrawOrg = DrawOffset;
@ -235,14 +240,14 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
SetPenMinWidth( m_PrintParams.m_PenMinSize );
if( m_PrintParams.m_Print_Sheet_Ref )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
if( userscale == 1.0 ) // Draw the Sheet refs at optimum scale, and board at 1.0 scale
if( userscale == 1.0 )
{
dc->SetUserScale( accurate_Xscale, accurate_Yscale );
}
if( m_PrintParams.m_Print_Sheet_Ref )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
if( printMirror )
{
// To plot mirror, we reverse the y axis, and modify the plot y origin