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,12 +189,15 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, ...@@ -189,12 +189,15 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() ); wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
if( m_ListCmp )
m_auimgr.AddPane( m_ListCmp, m_auimgr.AddPane( m_ListCmp,
wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() ); wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() );
if( m_FootprintList )
m_auimgr.AddPane( m_FootprintList, m_auimgr.AddPane( m_FootprintList,
wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ). wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) ); Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );
......
...@@ -703,12 +703,12 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet ) ...@@ -703,12 +703,12 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
* which is applied to the initial transform. * which is applied to the initial transform.
*/ */
/*****************************************************************/ /*****************************************************************/
void SCH_COMPONENT::SetRotationMiroir( int type_rotate ) void SCH_COMPONENT::SetOrientation( int aOrientation )
{ {
int TempMat[2][2]; int TempMat[2][2];
bool Transform = FALSE; bool Transform = FALSE;
switch( type_rotate ) switch( aOrientation )
{ {
case CMP_ORIENT_0: case CMP_ORIENT_0:
case CMP_NORMAL: /* Position Initiale */ case CMP_NORMAL: /* Position Initiale */
...@@ -731,14 +731,14 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate ) ...@@ -731,14 +731,14 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
Transform = TRUE; Transform = TRUE;
break; break;
case CMP_MIROIR_Y: /* MirrorY */ case CMP_MIRROR_Y: /* MirrorY */
TempMat[0][0] = -1; TempMat[0][0] = -1;
TempMat[1][1] = 1; TempMat[1][1] = 1;
TempMat[0][1] = TempMat[1][0] = 0; TempMat[0][1] = TempMat[1][0] = 0;
Transform = TRUE; Transform = TRUE;
break; break;
case CMP_MIROIR_X: /* MirrorX */ case CMP_MIRROR_X: /* MirrorX */
TempMat[0][0] = 1; TempMat[0][0] = 1;
TempMat[1][1] = -1; TempMat[1][1] = -1;
TempMat[0][1] = TempMat[1][0] = 0; TempMat[0][1] = TempMat[1][0] = 0;
...@@ -746,59 +746,59 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate ) ...@@ -746,59 +746,59 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
break; break;
case CMP_ORIENT_90: case CMP_ORIENT_90:
SetRotationMiroir( CMP_ORIENT_0 ); SetOrientation( CMP_ORIENT_0 );
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE ); SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
break; break;
case CMP_ORIENT_180: case CMP_ORIENT_180:
SetRotationMiroir( CMP_ORIENT_0 ); SetOrientation( CMP_ORIENT_0 );
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE ); SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE ); SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
break; break;
case CMP_ORIENT_270: case CMP_ORIENT_270:
SetRotationMiroir( CMP_ORIENT_0 ); SetOrientation( CMP_ORIENT_0 );
SetRotationMiroir( CMP_ROTATE_CLOCKWISE ); SetOrientation( CMP_ROTATE_CLOCKWISE );
break; break;
case ( CMP_ORIENT_0 + CMP_MIROIR_X ): case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
SetRotationMiroir( CMP_ORIENT_0 ); SetOrientation( CMP_ORIENT_0 );
SetRotationMiroir( CMP_MIROIR_X ); SetOrientation( CMP_MIRROR_X );
break; break;
case ( CMP_ORIENT_0 + CMP_MIROIR_Y ): case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
SetRotationMiroir( CMP_ORIENT_0 ); SetOrientation( CMP_ORIENT_0 );
SetRotationMiroir( CMP_MIROIR_Y ); SetOrientation( CMP_MIRROR_Y );
break; break;
case ( CMP_ORIENT_90 + CMP_MIROIR_X ): case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
SetRotationMiroir( CMP_ORIENT_90 ); SetOrientation( CMP_ORIENT_90 );
SetRotationMiroir( CMP_MIROIR_X ); SetOrientation( CMP_MIRROR_X );
break; break;
case ( CMP_ORIENT_90 + CMP_MIROIR_Y ): case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
SetRotationMiroir( CMP_ORIENT_90 ); SetOrientation( CMP_ORIENT_90 );
SetRotationMiroir( CMP_MIROIR_Y ); SetOrientation( CMP_MIRROR_Y );
break; break;
case ( CMP_ORIENT_180 + CMP_MIROIR_X ): case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
SetRotationMiroir( CMP_ORIENT_180 ); SetOrientation( CMP_ORIENT_180 );
SetRotationMiroir( CMP_MIROIR_X ); SetOrientation( CMP_MIRROR_X );
break; break;
case ( CMP_ORIENT_180 + CMP_MIROIR_Y ): case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
SetRotationMiroir( CMP_ORIENT_180 ); SetOrientation( CMP_ORIENT_180 );
SetRotationMiroir( CMP_MIROIR_Y ); SetOrientation( CMP_MIRROR_Y );
break; break;
case ( CMP_ORIENT_270 + CMP_MIROIR_X ): case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
SetRotationMiroir( CMP_ORIENT_270 ); SetOrientation( CMP_ORIENT_270 );
SetRotationMiroir( CMP_MIROIR_X ); SetOrientation( CMP_MIRROR_X );
break; break;
case ( CMP_ORIENT_270 + CMP_MIROIR_Y ): case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
SetRotationMiroir( CMP_ORIENT_270 ); SetOrientation( CMP_ORIENT_270 );
SetRotationMiroir( CMP_MIROIR_Y ); SetOrientation( CMP_MIRROR_Y );
break; break;
default: default:
...@@ -841,20 +841,20 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate ) ...@@ -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) * Used to display component orientation (in dialog editor or info)
* @return the orientation and mirror * @return the orientation and mirror
* Note: Because there are different ways to have a given orientation/mirror, * Note: Because there are different ways to have a given orientation/mirror,
* the orientation/mirror is not necessary what the used does * the orientation/mirror is not necessary what the used does
* (example : a mirrorX then a mirrorY give no mirror but rotate the component). * (example : a mirrorX then a mirrorY give no mirror but rotate the component).
* So this function find a rotation and a mirror value * 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 * 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) * are equivalent)
* *
*/ */
int SCH_COMPONENT::GetRotationMiroir() int SCH_COMPONENT::GetOrientation()
{ {
int type_rotate = CMP_ORIENT_0; int type_rotate = CMP_ORIENT_0;
int ComponentMatOrient[2][2]; int ComponentMatOrient[2][2];
...@@ -866,10 +866,10 @@ int SCH_COMPONENT::GetRotationMiroir() ...@@ -866,10 +866,10 @@ int SCH_COMPONENT::GetRotationMiroir()
int rotate_value[ROTATE_VALUES_COUNT] = int rotate_value[ROTATE_VALUES_COUNT] =
{ {
CMP_ORIENT_0, CMP_ORIENT_90, CMP_ORIENT_180, CMP_ORIENT_270, 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_MIRROR_X + CMP_ORIENT_0, CMP_MIRROR_X + CMP_ORIENT_90,
CMP_MIROIR_X + CMP_ORIENT_180, CMP_MIROIR_X + CMP_ORIENT_270, CMP_MIRROR_X + CMP_ORIENT_180, CMP_MIRROR_X + CMP_ORIENT_270,
CMP_MIROIR_Y + CMP_ORIENT_0, CMP_MIROIR_Y + CMP_ORIENT_90, CMP_MIRROR_Y + CMP_ORIENT_0, CMP_MIRROR_Y + CMP_ORIENT_90,
CMP_MIROIR_Y + CMP_ORIENT_180, CMP_MIROIR_Y + CMP_ORIENT_270 CMP_MIRROR_Y + CMP_ORIENT_180, CMP_MIRROR_Y + CMP_ORIENT_270
}; };
// Try to find the current transform option: // Try to find the current transform option:
...@@ -878,7 +878,7 @@ int SCH_COMPONENT::GetRotationMiroir() ...@@ -878,7 +878,7 @@ int SCH_COMPONENT::GetRotationMiroir()
for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ ) for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ )
{ {
type_rotate = rotate_value[ii]; type_rotate = rotate_value[ii];
SetRotationMiroir( type_rotate ); SetOrientation( type_rotate );
if( memcmp( ComponentMatOrient, m_Transform, if( memcmp( ComponentMatOrient, m_Transform,
sizeof(ComponentMatOrient) ) == 0 ) sizeof(ComponentMatOrient) ) == 0 )
return type_rotate; return type_rotate;
...@@ -1132,7 +1132,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1132,7 +1132,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
void SCH_COMPONENT::Mirror_Y(int aYaxis_position) void SCH_COMPONENT::Mirror_Y(int aYaxis_position)
{ {
int dx = m_Pos.x; int dx = m_Pos.x;
SetRotationMiroir( CMP_MIROIR_Y ); SetOrientation( CMP_MIRROR_Y );
m_Pos.x -= aYaxis_position; m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x ); NEGATE( m_Pos.x );
m_Pos.x += aYaxis_position; m_Pos.x += aYaxis_position;
......
...@@ -176,8 +176,9 @@ public: ...@@ -176,8 +176,9 @@ public:
return new SCH_COMPONENT( *this ); return new SCH_COMPONENT( *this );
} }
void SetRotationMiroir( int type ); void SetOrientation( int aOrientation );
/** function GetRotationMiroir()
/** function GetOrientation()
* Used to display component orientation (in dialog editor or info) * Used to display component orientation (in dialog editor or info)
* @return the orientation and mirror * @return the orientation and mirror
* Note: Because there are different ways to have a given orientation/mirror, * Note: Because there are different ways to have a given orientation/mirror,
...@@ -185,12 +186,12 @@ public: ...@@ -185,12 +186,12 @@ public:
* (example : a mirrorX then a mirrorY give no mirror but rotate the * (example : a mirrorX then a mirrorY give no mirror but rotate the
* component). * component).
* So this function find a rotation and a mirror value * 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 * 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) * they are equivalent)
*/ */
int GetRotationMiroir(); int GetOrientation();
wxPoint GetScreenCoord( const wxPoint& coord ); wxPoint GetScreenCoord( const wxPoint& coord );
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );
......
...@@ -201,19 +201,19 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() ...@@ -201,19 +201,19 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
switch( orientationRadioBox->GetSelection() ) switch( orientationRadioBox->GetSelection() )
{ {
case 0: case 0:
m_Cmp->SetRotationMiroir( CMP_ORIENT_0 ); m_Cmp->SetOrientation( CMP_ORIENT_0 );
break; break;
case 1: case 1:
m_Cmp->SetRotationMiroir( CMP_ORIENT_90 ); m_Cmp->SetOrientation( CMP_ORIENT_90 );
break; break;
case 2: case 2:
m_Cmp->SetRotationMiroir( CMP_ORIENT_180 ); m_Cmp->SetOrientation( CMP_ORIENT_180 );
break; break;
case 3: case 3:
m_Cmp->SetRotationMiroir( CMP_ORIENT_270 ); m_Cmp->SetOrientation( CMP_ORIENT_270 );
break; break;
} }
...@@ -225,11 +225,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() ...@@ -225,11 +225,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
break; break;
case 1: case 1:
m_Cmp->SetRotationMiroir( CMP_MIROIR_X ); m_Cmp->SetOrientation( CMP_MIRROR_X );
break; break;
case 2: case 2:
m_Cmp->SetRotationMiroir( CMP_MIROIR_Y ); m_Cmp->SetOrientation( CMP_MIRROR_Y );
break; break;
} }
} }
...@@ -663,8 +663,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel() ...@@ -663,8 +663,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
if( choiceCount <= 1 ) if( choiceCount <= 1 )
unitChoice->Enable( false ); unitChoice->Enable( false );
int orientation = m_Cmp->GetRotationMiroir() int orientation = m_Cmp->GetOrientation()
& ~( CMP_MIROIR_X | CMP_MIROIR_Y ); & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
if( orientation == CMP_ORIENT_90 ) if( orientation == CMP_ORIENT_90 )
orientationRadioBox->SetSelection( 1 ); orientationRadioBox->SetSelection( 1 );
...@@ -675,14 +675,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel() ...@@ -675,14 +675,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
else else
orientationRadioBox->SetSelection( 0 ); 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 ); mirrorRadioBox->SetSelection( 1 );
D( printf( "mirror=X,1\n" ); ) D( printf( "mirror=X,1\n" ); )
} }
else if( mirror == CMP_MIROIR_Y ) else if( mirror == CMP_MIRROR_Y )
{ {
mirrorRadioBox->SetSelection( 2 ); mirrorRadioBox->SetSelection( 2 );
D( printf( "mirror=Y,2\n" ); ) D( printf( "mirror=Y,2\n" ); )
...@@ -742,7 +742,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) ...@@ -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 )->m_Pos = valField.m_Pos + m_Cmp->m_Pos;
m_Cmp->GetField( VALUE )->ImportValues( valField ); m_Cmp->GetField( VALUE )->ImportValues( valField );
m_Cmp->SetRotationMiroir( CMP_NORMAL ); m_Cmp->SetOrientation( CMP_NORMAL );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
......
...@@ -255,7 +255,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, ...@@ -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. */ /* Redraw the component in the new position. */
if( DC ) if( DC )
......
...@@ -388,7 +388,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -388,7 +388,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y ); CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_Y );
} }
break; break;
...@@ -402,7 +402,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -402,7 +402,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_X ); CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_X );
} }
break; break;
......
/*********************************************/ /**********************************************/
/* eesave.cpp Module to Save EESchema files */ /* eesave.cpp Module to Save EESchema files */
/*********************************************/ /**********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
static void SaveLayers( FILE* f );
/***************************************************************************** /*****************************************************************************
* Routine to save an EESchema file. * * Routine to save an EESchema file. *
* FileSave controls how the file is to be saved - under what name. * * 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 ) ...@@ -112,73 +109,51 @@ bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
*/ */
bool SCH_SCREEN::Save( FILE* aFile ) const bool SCH_SCREEN::Save( FILE* aFile ) const
{ {
wxString Name, msg;
Ki_PageDescr* PlotSheet;
wxString datetime = DateAndTime( );
// Creates header // Creates header
if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP, if( fprintf( aFile, "%s %s %d", EESCHEMA_FILE_STAMP,
SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) == EOF ) SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0
return FALSE; || fprintf( aFile, " date %s\n", CONV_TO_UTF8( DateAndTime() ) ) < 0 )
if( fprintf( aFile, " date %s\n", CONV_TO_UTF8(datetime) ) == EOF )
return FALSE; return FALSE;
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() ) BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{ {
Name = lib.GetName(); if( fprintf( aFile, "LIBS:%s\n", CONV_TO_UTF8( lib.GetName() ) ) < 0 )
if( fprintf( aFile, "LIBS:%s\n", CONV_TO_UTF8( Name ) ) == EOF )
return FALSE; return FALSE;
} }
SaveLayers( aFile ); if( fprintf( aFile, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
g_LayerDescr.CurrentLayer ) < 0
/* Write page info */ || fprintf( aFile, "EELAYER END\n" ) < 0 )
return FALSE;
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 /* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for
* SheetNumber and Sheet Countin a complex hierarchy, but usefull in * SheetNumber and Sheet Count in a complex hierarchy, but useful in
* simple hierarchy and flat hierarchy. Used also to serach the root * simple hierarchy and flat hierarchy. Used also to search the root
* sheet ( ScreenNumber = 1 ) within the files * 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 ) ); if( fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( m_CurrentSheetDesc->m_Name ),
fprintf( aFile, "Date \"%s\"\n", CONV_TO_UTF8( m_Date ) ); m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0
fprintf( aFile, "Rev \"%s\"\n", CONV_TO_UTF8( m_Revision ) ); || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
fprintf( aFile, "Comp \"%s\"\n", CONV_TO_UTF8( m_Company ) ); || fprintf( aFile, "Title \"%s\"\n", CONV_TO_UTF8( m_Title ) ) < 0
fprintf( aFile, "Comment1 \"%s\"\n", CONV_TO_UTF8( m_Commentaire1 ) ); || fprintf( aFile, "Date \"%s\"\n", CONV_TO_UTF8( m_Date ) ) < 0
fprintf( aFile, "Comment2 \"%s\"\n", CONV_TO_UTF8( m_Commentaire2 ) ); || fprintf( aFile, "Rev \"%s\"\n", CONV_TO_UTF8( m_Revision ) ) < 0
fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) ); || fprintf( aFile, "Comp \"%s\"\n", CONV_TO_UTF8( m_Company ) ) < 0
fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) ); || fprintf( aFile, "Comment1 \"%s\"\n", CONV_TO_UTF8( m_Commentaire1 ) ) < 0
|| fprintf( aFile, "Comment2 \"%s\"\n", CONV_TO_UTF8( m_Commentaire2 ) ) < 0
fprintf( aFile, "$EndDescr\n" ); || fprintf( aFile, "Comment3 \"%s\"\n", CONV_TO_UTF8( m_Commentaire3 ) ) < 0
|| fprintf( aFile, "Comment4 \"%s\"\n", CONV_TO_UTF8( m_Commentaire4 ) ) < 0
/* Saving schematic items */ || fprintf( aFile, "$EndDescr\n" ) < 0 )
bool failed = false; return FALSE;
for( SCH_ITEM* item = EEDrawList; item && !failed; item = item->Next() ) for( SCH_ITEM* item = EEDrawList; item; item = item->Next() )
{ {
if( !item->Save( aFile ) ) if( !item->Save( aFile ) )
failed = true; return FALSE;
} }
if( fprintf( aFile, "$EndSCHEMATC\n" ) == EOF ) if( fprintf( aFile, "$EndSCHEMATC\n" ) < 0 )
failed = true; return FALSE;
return !failed;
}
/* Save a Layer Structure to a file return TRUE;
* 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" );
} }
...@@ -483,10 +483,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -483,10 +483,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
option = CMP_MIROIR_X; break; option = CMP_MIRROR_X; break;
case ID_POPUP_SCH_MIROR_Y_CMP: case ID_POPUP_SCH_MIROR_Y_CMP:
option = CMP_MIROIR_Y; break; option = CMP_MIRROR_Y; break;
case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE: case ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE:
option = CMP_ROTATE_COUNTERCLOCKWISE; break; option = CMP_ROTATE_COUNTERCLOCKWISE; break;
......
...@@ -202,19 +202,23 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, ...@@ -202,19 +202,23 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false ); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
Row( 0 ) );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() ); wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
......
...@@ -164,18 +164,23 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, ...@@ -164,18 +164,23 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false ); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( 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, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() ); wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
......
...@@ -43,8 +43,8 @@ enum fl_rot_cmp ...@@ -43,8 +43,8 @@ enum fl_rot_cmp
CMP_ORIENT_90, // Rotate 90, no mirror CMP_ORIENT_90, // Rotate 90, no mirror
CMP_ORIENT_180, // Rotate 180, no mirror CMP_ORIENT_180, // Rotate 180, no mirror
CMP_ORIENT_270, // Rotate -90, no mirror CMP_ORIENT_270, // Rotate -90, no mirror
CMP_MIROIR_X = 0x100, // Mirror around X axis CMP_MIRROR_X = 0x100, // Mirror around X axis
CMP_MIROIR_Y = 0x200 // Mirror around Y axis CMP_MIRROR_Y = 0x200 // Mirror around Y axis
}; };
/** /**
......
/***********************************************************/ /***********************************************************/
/* mdiframe.cpp - WinEDA_MainFrame is the kicad main frame */ /* mdiframe.cpp - WinEDA_MainFrame is the kicad main frame */
/***********************************************************/ /***********************************************************/
...@@ -41,7 +40,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, ...@@ -41,7 +40,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
m_RightWin = NULL; /* A shashwindow that contains the buttons m_RightWin = NULL; /* A shashwindow that contains the buttons
* and the window display text * and the window display text
*/ */
m_LeftWin_Width = MAX(60, GetSize().x/3 ); m_LeftWin_Width = MAX( 60, GetSize().x/3 );
LoadSettings(); LoadSettings();
...@@ -61,22 +60,29 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, ...@@ -61,22 +60,29 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
#endif #endif
clientsize = GetClientSize(); clientsize = GetClientSize();
int rightWinWidth = clientsize.x - m_LeftWin_Width;
// Left window: is the box which display tree project // Left window: is the box which display tree project
m_LeftWin = new WinEDA_PrjFrame( this ); 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->SetDefaultSize( wxSize( m_LeftWin_Width, clientsize.y ) );
m_LeftWin->SetOrientation( wxLAYOUT_VERTICAL ); m_LeftWin->SetOrientation( wxLAYOUT_VERTICAL );
m_LeftWin->SetAlignment( wxLAYOUT_LEFT ); m_LeftWin->SetAlignment( wxLAYOUT_LEFT );
m_LeftWin->SetSashVisible( wxSASH_RIGHT, TRUE ); m_LeftWin->SetSashVisible( wxSASH_RIGHT, TRUE );
m_LeftWin->SetExtraBorderSize( 2 ); m_LeftWin->SetExtraBorderSize( 2 );
// Bottom Window: box to display messages int rightWinWidth = clientsize.x - m_LeftWin_Width;
m_RightWin = new RIGHT_KM_FRAME( this );
m_RightWin->SetDefaultSize( wxSize( rightWinWidth, clientsize.y ) ); m_RightWin->SetDefaultSize( wxSize( rightWinWidth, clientsize.y ) );
m_RightWin->SetOrientation( wxLAYOUT_VERTICAL ); m_RightWin->SetOrientation( wxLAYOUT_VERTICAL );
m_RightWin->SetAlignment( wxLAYOUT_RIGHT ); m_RightWin->SetAlignment( wxLAYOUT_RIGHT );
m_RightWin->SetExtraBorderSize( 2 ); m_RightWin->SetExtraBorderSize( 2 );
#endif
msg = wxGetCwd(); msg = wxGetCwd();
line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() ); line.Printf( _( "Ready\nWorking dir: %s\n" ), msg.GetData() );
...@@ -98,29 +104,28 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, ...@@ -98,29 +104,28 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
horiz.Floatable( false ); horiz.Floatable( false );
horiz.CloseButton( false ); horiz.CloseButton( false );
horiz.CaptionVisible( false ); horiz.CaptionVisible( false );
horiz.LeftDockable( false );
horiz.RightDockable( false );
wxAuiPaneInfo vert( horiz ); if( m_HToolBar )
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane( 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, 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, m_auimgr.AddPane( m_LeftWin,
wxAuiPaneInfo( horiz ).Name( wxT( "m_LeftWin" ) ). wxAuiPaneInfo().Name( wxT( "m_LeftWin" ) ).Floatable( false ).
Left().BestSize( m_LeftWin_Width, clientsize.y ) ); CloseButton( false ).Left().BestSize( m_LeftWin_Width, clientsize.y ).
Layer( 1 ).CaptionVisible( false ) );
m_auimgr.Update(); m_auimgr.Update();
#endif #endif
} }
/*****************************************************************************/
WinEDA_MainFrame::~WinEDA_MainFrame() WinEDA_MainFrame::~WinEDA_MainFrame()
/*****************************************************************************/
{ {
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
m_auimgr.UnInit(); m_auimgr.UnInit();
...@@ -128,24 +133,18 @@ WinEDA_MainFrame::~WinEDA_MainFrame() ...@@ -128,24 +133,18 @@ WinEDA_MainFrame::~WinEDA_MainFrame()
} }
/*******************************************************/
void WinEDA_MainFrame::PrintMsg( const wxString& text )
/*******************************************************/
/* /*
* Put text in the dialog frame * Put text in the dialog frame
*/ */
void WinEDA_MainFrame::PrintMsg( const wxString& text )
{ {
m_RightWin->m_DialogWin->AppendText( text ); m_RightWin->m_DialogWin->AppendText( text );
} }
/****************************************************/
void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
/****************************************************/
/* Resize windows when dragging window borders /* Resize windows when dragging window borders
*/ */
void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
{ {
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
...@@ -164,9 +163,7 @@ void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event ) ...@@ -164,9 +163,7 @@ void WinEDA_MainFrame::OnSashDrag( wxSashEvent& event )
} }
/************************************************/
void WinEDA_MainFrame::OnSize( wxSizeEvent& event ) void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
/************************************************/
{ {
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
if( m_auimgr.GetManagedWindow() ) if( m_auimgr.GetManagedWindow() )
...@@ -181,9 +178,7 @@ void WinEDA_MainFrame::OnSize( wxSizeEvent& event ) ...@@ -181,9 +178,7 @@ void WinEDA_MainFrame::OnSize( wxSizeEvent& event )
} }
/**********************************************************/
void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_MainFrame::OnCloseWindow( wxCloseEvent& Event )
/**********************************************************/
{ {
int px, py; int px, py;
...@@ -307,17 +302,13 @@ void WinEDA_MainFrame::OnOpenFileInTextEditor( wxCommandEvent& event ) ...@@ -307,17 +302,13 @@ void WinEDA_MainFrame::OnOpenFileInTextEditor( wxCommandEvent& event )
} }
/********************************************************/
void WinEDA_MainFrame::OnRefresh( wxCommandEvent& event ) void WinEDA_MainFrame::OnRefresh( wxCommandEvent& event )
/********************************************************/
{ {
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
} }
/*********************************/
void WinEDA_MainFrame::ClearMsg() void WinEDA_MainFrame::ClearMsg()
/*********************************/
{ {
m_RightWin->m_DialogWin->Clear(); m_RightWin->m_DialogWin->Clear();
} }
...@@ -359,12 +350,10 @@ void WinEDA_MainFrame::SaveSettings() ...@@ -359,12 +350,10 @@ void WinEDA_MainFrame::SaveSettings()
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
/*****************************************************************************/
void WinEDA_MainFrame::OnRefreshPy() void WinEDA_MainFrame::OnRefreshPy()
/*****************************************************************************/
{ {
m_LeftWin->ReCreateTreePrj(); m_LeftWin->ReCreateTreePrj();
} }
#endif #endif
...@@ -219,18 +219,21 @@ install(TARGETS pcbnew ...@@ -219,18 +219,21 @@ install(TARGETS pcbnew
COMPONENT binary) COMPONENT binary)
# This one gets made only when testing. # The specctra test fails to build properly using MS Visual Studio.
#add_executable(dsntest EXCLUDE_FROM_ALL dsn.cpp) if(NOT MSVC)
#target_link_libraries(dsntest common ${wxWidgets_LIBRARIES}) # 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. # This one gets made only when testing.
add_executable(specctra_test EXCLUDE_FROM_ALL specctra.cpp) add_executable(specctra_test EXCLUDE_FROM_ALL specctra.cpp)
target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES}) target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES})
endif(NOT MSVC)
# This one gets made only when testing. # 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_panel_base.cpp
layer_widget.cpp layer_widget.cpp
) )
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES}) target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES})
...@@ -798,12 +798,12 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, ...@@ -798,12 +798,12 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
isegm->DisplayInfoBase( frame ); isegm->DisplayInfoBase( frame );
// Add current track length // Add current track length
int trackLen = 0; double trackLen = 0.0;
wxString msg; wxString msg;
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() ) for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
trackLen += track->GetLength(); trackLen += track->GetLength();
valeur_param( trackLen, msg ); valeur_param( wxRound( trackLen ), msg );
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
// Add current segments count (number of segments in this new track): // Add current segments count (number of segments in this new track):
......
...@@ -88,8 +88,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -88,8 +88,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
offset.x = BoardCentre.x - (SheetSize.x / 2) / scale; offset.x = (int) ( (double) BoardCentre.x - ( (double) SheetSize.x / 2.0 ) / scale );
offset.y = BoardCentre.y - (SheetSize.y / 2) / scale; offset.y = (int) ( (double) BoardCentre.y - ( (double) SheetSize.y / 2.0 ) / scale );
offset.y += SheetSize.y / 8; /* offset to legend */ offset.y += SheetSize.y / 8; /* offset to legend */
PS_PLOTTER* ps_plotter = new PS_PLOTTER; PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter; plotter = ps_plotter;
...@@ -169,7 +169,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -169,7 +169,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
intervalle = (int) ( CharSize * CharScale ) + TextWidth; intervalle = (int) ( CharSize * CharScale ) + TextWidth;
/* Trace information. */ /* 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; plotY = aPcb->m_BoundaryBox.GetBottom() + intervalle;
/* Plot title "Info" */ /* Plot title "Info" */
...@@ -189,8 +189,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, ...@@ -189,8 +189,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotY += intervalle; plotY += intervalle;
plot_diam = (int) ( aToolListBuffer[ii].m_Diameter ); plot_diam = (int) ( aToolListBuffer[ii].m_Diameter );
x = plotX - 200 * CharScale - plot_diam / 2; x = (int) ( (double) plotX - 200.0 * CharScale - (double)plot_diam / 2.0 );
y = plotY + CharSize * CharScale; y = (int) ( (double) plotY + (double) CharSize * CharScale );
plotter->marker( wxPoint( x, y ), plot_diam, ii ); plotter->marker( wxPoint( x, y ), plot_diam, ii );
/* Trace the legends. */ /* Trace the legends. */
......
...@@ -274,25 +274,31 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, ...@@ -274,25 +274,31 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
vert.TopDockable( false ).BottomDockable( false ); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
Row( 0 ) );
if( m_AuxiliaryToolBar )
m_auimgr.AddPane( m_AuxiliaryToolBar, m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
if( m_AuxVToolBar )
m_auimgr.AddPane( m_AuxVToolBar, m_auimgr.AddPane( m_AuxVToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() ); wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() );
if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() ); wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel )
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel )
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
......
...@@ -160,7 +160,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -160,7 +160,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
userscale = m_PrintParams.m_PrintScale; userscale = m_PrintParams.m_PrintScale;
if( userscale == 0 ) // fit in page 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.x = pcbframe->GetBoard()->m_BoundaryBox.GetWidth() + extra_margin;
SheetSize.y = pcbframe->GetBoard()->m_BoundaryBox.GetHeight() + extra_margin; SheetSize.y = pcbframe->GetBoard()->m_BoundaryBox.GetHeight() + extra_margin;
userscale = 0.99; userscale = 0.99;
...@@ -174,8 +174,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -174,8 +174,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
} }
// Calculate a suitable scaling factor // Calculate a suitable scaling factor
scaleX = (double) SheetSize.x / PlotAreaSize.x; scaleX = (double) SheetSize.x / (double) PlotAreaSize.x;
scaleY = (double) SheetSize.y / PlotAreaSize.y; scaleY = (double) SheetSize.y / (double) PlotAreaSize.y;
scale = wxMax( scaleX, scaleY ) / userscale; // Use x or y scaling factor, whichever fits on the DC scale = wxMax( scaleX, scaleY ) / userscale; // Use x or y scaling factor, whichever fits on the DC
// ajust the real draw scale // ajust the real draw scale
...@@ -187,15 +187,18 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -187,15 +187,18 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
{ {
int w, h; int w, h;
GetPPIPrinter( &w, &h ); GetPPIPrinter( &w, &h );
accurate_Xscale = ( (double) ( DrawZoom * w ) ) / PCB_INTERNAL_UNIT; accurate_Xscale = ( (double) ( DrawZoom * w ) ) / (double) PCB_INTERNAL_UNIT;
accurate_Yscale = ( (double) ( DrawZoom * h ) ) / PCB_INTERNAL_UNIT; accurate_Yscale = ( (double) ( DrawZoom * h ) ) / (double) PCB_INTERNAL_UNIT;
if( IsPreview() ) // Scale must take in account the DC size in Preview if( IsPreview() ) // Scale must take in account the DC size in Preview
{ {
// Get the size of the DC in pixels // Get the size of the DC in pixels
dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y ); dc->GetSize( &PlotAreaSize.x, &PlotAreaSize.y );
GetPageSizePixels( &w, &h ); GetPageSizePixels( &w, &h );
accurate_Xscale *= PlotAreaSize.x; accurate_Xscale /= w; accurate_Xscale *= PlotAreaSize.x;
accurate_Yscale *= PlotAreaSize.y; accurate_Yscale /= h; accurate_Xscale /= (double) w;
accurate_Yscale *= PlotAreaSize.y;
accurate_Yscale /= (double) h;
} }
accurate_Xscale *= m_PrintParams.m_XScaleAdjust; accurate_Xscale *= m_PrintParams.m_XScaleAdjust;
accurate_Yscale *= m_PrintParams.m_YScaleAdjust; accurate_Yscale *= m_PrintParams.m_YScaleAdjust;
...@@ -211,11 +214,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -211,11 +214,13 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|| (m_PrintParams.m_PrintScale > 1.0) // scale > 1 || (m_PrintParams.m_PrintScale > 1.0) // scale > 1
|| (m_PrintParams.m_PrintScale == 0) ) // fit in page || (m_PrintParams.m_PrintScale == 0) ) // fit in page
{ {
DrawOffset.x -= (int) ( (PlotAreaSize.x / 2) * scale ); DrawOffset.x -= wxRound( ( (double) PlotAreaSize.x / 2.0 ) * scale );
DrawOffset.y -= (int) ( (PlotAreaSize.y / 2) * scale ); DrawOffset.y -= wxRound( ( (double) PlotAreaSize.y / 2.0 ) * scale );
} }
DrawOffset.x += (int) ( (SheetSize.x / 2) * (m_PrintParams.m_XScaleAdjust - 1.0) ); DrawOffset.x += wxRound( ( (double) SheetSize.x / 2.0 ) *
DrawOffset.y += (int) ( (SheetSize.y / 2) * (m_PrintParams.m_YScaleAdjust - 1.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; ActiveScreen->m_DrawOrg = DrawOffset;
...@@ -235,14 +240,14 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() ...@@ -235,14 +240,14 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
SetPenMinWidth( m_PrintParams.m_PenMinSize ); SetPenMinWidth( m_PrintParams.m_PenMinSize );
if( m_PrintParams.m_Print_Sheet_Ref ) if( userscale == 1.0 )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
if( userscale == 1.0 ) // Draw the Sheet refs at optimum scale, and board at 1.0 scale
{ {
dc->SetUserScale( accurate_Xscale, accurate_Yscale ); dc->SetUserScale( accurate_Xscale, accurate_Yscale );
} }
if( m_PrintParams.m_Print_Sheet_Ref )
m_Parent->TraceWorkSheet( dc, ActiveScreen, 0 );
if( printMirror ) if( printMirror )
{ {
// To plot mirror, we reverse the y axis, and modify the plot y origin // 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