Commit e1534141 authored by stambaughw's avatar stambaughw

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.
parent 4936ca3a
......@@ -189,15 +189,18 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane( m_ListCmp,
wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() );
if( m_ListCmp )
m_auimgr.AddPane( m_ListCmp,
wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() );
m_auimgr.AddPane( m_FootprintList,
wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );
if( m_FootprintList )
m_auimgr.AddPane( m_FootprintList,
wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );
m_auimgr.Update();
#endif
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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 )
......
......@@ -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;
......
/*********************************************/
/**********************************************/
/* 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 );
/* 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 );
if( fprintf( aFile, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer ) < 0
|| fprintf( aFile, "EELAYER END\n" ) < 0 )
return FALSE;
/* 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" );
/* Saving schematic items */
bool failed = false;
for( SCH_ITEM* item = EEDrawList; item && !failed; item = item->Next() )
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;
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;
return !failed;
}
if( fprintf( aFile, "$EndSCHEMATC\n" ) < 0 )
return FALSE;
/* 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;
}
......@@ -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;
......
......@@ -202,21 +202,25 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
......
......@@ -164,20 +164,25 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
......
......@@ -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
};
/**
......
/***********************************************************/
/* 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 );
wxAuiPaneInfo vert( horiz );
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane( m_RightWin,
wxAuiPaneInfo().Name( wxT( "m_RightWin" ) ).CentrePane() );
m_auimgr.AddPane( m_LeftWin,
wxAuiPaneInfo( horiz ).Name( wxT( "m_LeftWin" ) ).
Left().BestSize( m_LeftWin_Width, clientsize.y ) );
horiz.LeftDockable( false );
horiz.RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Layer( 1 ) );
if( m_RightWin )
m_auimgr.AddPane( m_RightWin,
wxAuiPaneInfo().Name( wxT( "m_RightWin" ) ).CentrePane().Layer( 1 ) );
if( m_LeftWin )
m_auimgr.AddPane( m_LeftWin,
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;
......@@ -256,7 +251,7 @@ void WinEDA_MainFrame::OnRunGerbview( wxCommandEvent& event )
wxFileName fn( m_ProjectFileName );
ExecuteFile( this, GERBVIEW_EXE,
fn.GetPath( wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME ) );
fn.GetPath( wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME ) );
}
......@@ -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
......@@ -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})
# 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(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})
......@@ -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):
......
......@@ -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. */
......
......@@ -274,27 +274,33 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
if( m_AuxiliaryToolBar )
m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
m_auimgr.AddPane( m_AuxVToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() );
if( m_AuxVToolBar )
m_auimgr.AddPane( m_AuxVToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() );
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
......
......@@ -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
......
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