Commit de96452c authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor common PCB library code fixes.

* More common header file compiler fixes.
* Translate French code naming and comments.
* Remove global variable ScreenPcb.
* Dead code removal.
parent 063c56be
......@@ -80,7 +80,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
char * line = reader.Line();
StrPurge( line );
if( strnicmp( line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
if( strnicmp( line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
{
wxString msg;
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library." ),
......
......@@ -112,11 +112,8 @@ class BOARD_DESIGN_SETTINGS g_DesignSettings;
*/
DLIST<TRACK> g_CurrentTrackList;
PCB_SCREEN* ScreenPcb = NULL;
BOARD* g_ModuleEditor_Pcb = NULL;
int g_GridRoutingSize = 250;
bool g_Zone_45_Only = FALSE;
// Default setting used when creating a new zone
......
......@@ -74,8 +74,9 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
// Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
DisplayOpt.ShowTrackClearanceMode = 0; /* tracks and vias clearance has
* no meaning here. */
// Track and via clearance has no meaning here.
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar();
......@@ -84,7 +85,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
m_auimgr.SetManagedWindow( this );
EDA_PANEINFO horiz;
horiz.HorizontalToolbarPane();
......
......@@ -74,7 +74,7 @@ found in the default search paths." ),
Line = reader.Line();
StrPurge( Line );
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
if( strnicmp( Line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
{
msg.Printf( _( "<%s> is not a valid Kicad PCB foot print library." ),
GetChars( tmp ) );
......
/************************************************/
/* GERBVIEW main file */
/************************************************/
/**
* @file gerbview.cpp
* @brief GERBVIEW main file.
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -71,9 +72,6 @@ bool EDA_APP::OnInit()
return false;
}
ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
// read current setup and reopen last directory if no filename to open in
// command line
bool reopenLastUsedDirectory = argc == 1;
......@@ -92,7 +90,9 @@ bool EDA_APP::OnInit()
// Initialize some display options
DisplayOpt.DisplayPadIsol = false; // Pad clearance has no meaning here
DisplayOpt.ShowTrackClearanceMode = 0; // tracks and vias clearance has no meaning here
// Track and via clearance has no meaning here.
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
SetTopWindow( frame ); // Set GerbView mainframe on top
frame->Show( true ); // Show GerbView mainframe
......
......@@ -48,7 +48,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
m_SelLayerBox = NULL;
m_DCodeSelector = NULL;
m_displayMode = 0;
m_drillFileHistory.SetBaseId(ID_GERBVIEW_DRILL_FILE1);
m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 );
if( DrawPanel )
DrawPanel->m_Block_Enable = true;
......@@ -58,7 +58,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
SetIcon( icon );
SetScreen( ScreenPcb );
SetScreen( new PCB_SCREEN() );
GetScreen()->m_CurrentSheetDesc = &g_Sheet_GERBER;
SetBoard( new BOARD( NULL, this ) );
GetBoard()->SetEnabledLayers( FULL_LAYERS ); // All 32 layers enabled at first.
......@@ -133,7 +134,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
GERBVIEW_FRAME::~GERBVIEW_FRAME()
{
SetScreen( ScreenPcb );
wxGetApp().SaveCurrentSetupValues( m_configSettings );
}
......
......@@ -44,7 +44,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query )
GetBoard()->m_NbNodes = 0;
GetBoard()->m_NbNoconnect = 0;
SetScreen( ScreenPcb );
SetScreen( new PCB_SCREEN() );
GetScreen()->Init();
setActiveLayer(FIRST_COPPER_LAYER);
m_LayersManager->UpdateLayerIcons();
......@@ -59,6 +59,7 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
wxString msg;
msg.Printf( _( "Clear layer %d?" ), layer + 1 );
if( query && !IsOK( this, msg ) )
return;
......@@ -66,12 +67,15 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
BOARD_ITEM* item = GetBoard()->m_Drawings;
BOARD_ITEM * next;
for( ; item; item = next )
{
next = item->Next();
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->GetLayer() != layer )
continue;
gerb_item->DeleteStructure();
}
......@@ -81,7 +85,7 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query )
g_GERBER_List[layer]->ResetDefaultValues();
}
ScreenPcb->SetModify();
GetScreen()->SetModify();
DrawPanel->Refresh();
m_LayersManager->UpdateLayerIcons();
syncLayerBox();
......
/**
* @file pcbcommon.h
*/
#ifndef __PCBCOMMON_H__
#define __PCBCOMMON_H__
......@@ -10,7 +13,7 @@
#include <wx/arrstr.h> // wxArrayString class.
#define L_MIN_DESSIN 1 /* Min width segments to allow draws with thickness */
#define MIN_DRAW_WIDTH 1 /* Minimum trace drawing width. */
class PCB_SCREEN;
......@@ -22,11 +25,11 @@ class DISPLAY_OPTIONS;
/* Look up Table for conversion one layer number -> one bit layer mask: */
extern int g_TabOneLayerMask[LAYER_COUNT];
/* Look up Table for conversion copper layer count -> general copper layer mask: */
extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern wxArrayString g_LibName_List; // library list to load
extern DISPLAY_OPTIONS DisplayOpt;
......@@ -46,17 +49,17 @@ extern int g_RotationAngle;
extern int g_TimeOut; // Timer for automatic saving
extern int g_SaveTime; // Time for next saving
/// List of segments of the trace currently being drawn.
extern DLIST<TRACK> g_CurrentTrackList;
#define g_CurrentTrackSegment \
g_CurrentTrackList.GetLast() ///< most recently created segment
#define g_FirstTrackSegment \
g_CurrentTrackList.GetFirst() ///< first segment created
#define g_CurrentTrackSegment g_CurrentTrackList.GetLast() ///< most recently created segment
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
extern PCB_SCREEN* ScreenPcb;
extern BOARD* g_ModuleEditor_Pcb;
/* Pad editing */
extern D_PAD g_Pad_Master;
#endif /* __PCBCOMMON_H__ */
......@@ -8,12 +8,12 @@
// Definitions relatives aux libraries
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
#define L_ENTETE_LIB 18
#define FOOTPRINT_LIBRARY_HEADER "PCBNEW-LibModule-V1"
#define FOOTPRINT_LIBRARY_HEADER_CNT 18
// Values for m_DisplayViaMode member:
enum DisplayViaMode {
enum VIA_DISPLAY_MODE_T {
VIA_HOLE_NOT_SHOW = 0,
VIA_SPECIAL_HOLE_SHOW,
ALL_VIA_HOLE_SHOW,
......@@ -24,7 +24,7 @@ enum DisplayViaMode {
/* Values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option
* This parameter controls how to show tracks and vias clearance area
*/
enum ShowTrackClearanceModeList {
enum TRACE_CLEARANCE_DISPLAY_MODE_T {
DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas
SHOW_CLEARANCE_NEW_TRACKS, /* Show clearance areas only for new track
* during track creation. */
......@@ -50,16 +50,11 @@ public:
int DisplayModEdge;
int DisplayModText;
bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */
int ShowTrackClearanceMode; /* = 0 , 1 or 2
* 0 = do not show clearance
* 1 = show track clearance
* 2 = show clearance + via area
* (useful to know what clearance area is
* needed if we want to put a via on
* terminal track point)
*/
int m_DisplayViaMode; /* 0 do not show via hole,
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T ShowTrackClearanceMode;
VIA_DISPLAY_MODE_T m_DisplayViaMode; /* 0 do not show via hole,
* 1 show via hole for non default value
* 2 show all via hole */
......@@ -78,4 +73,5 @@ public:
DISPLAY_OPTIONS();
};
#endif // PCBSTRUCT_H
......@@ -14,7 +14,6 @@
#include "protos.h"
#include "ar_protos.h"
#include "autorout.h"
#include "cell.h"
#include "colors_selection.h"
......
......@@ -9,7 +9,6 @@
#include "gr_basic.h"
#include "pcbnew.h"
#include "autorout.h"
#include "cell.h"
#include "zones.h"
#include "ar_protos.h"
......
......@@ -260,7 +260,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
if( m_Flags & FORCE_SKETCH )
mode = SKETCH;
if( l_trace < DC->DeviceToLogicalXRel( L_MIN_DESSIN ) )
if( l_trace < DC->DeviceToLogicalXRel( MIN_DRAW_WIDTH ) )
mode = FILAIRE;
switch( m_Shape )
......
......@@ -122,7 +122,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
typeaff = SKETCH;
}
if( DC->LogicalToDeviceXRel( m_Width ) < L_MIN_DESSIN )
if( DC->LogicalToDeviceXRel( m_Width ) < MIN_DRAW_WIDTH )
typeaff = FILAIRE;
switch( type_trace )
......
......@@ -52,7 +52,7 @@ int FOOTPRINT_LIBRARY::IsLibrary( )
StrPurge( line );
if( strnicmp( line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) == 0 )
if( strnicmp( line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) == 0 )
return 1;
return 0;
......@@ -167,8 +167,8 @@ bool FOOTPRINT_LIBRARY::ReadSectionIndex()
bool FOOTPRINT_LIBRARY::WriteHeader()
{
char line[256];
fprintf( m_file, "%s %s\n", ENTETE_LIBRAIRIE, DateAndTime( line ) );
fprintf( m_file, "# encoding utf-8\n");
fprintf( m_file, "%s %s\n", FOOTPRINT_LIBRARY_HEADER, DateAndTime( line ) );
fprintf( m_file, "# encoding utf-8\n" );
return true;
}
......
/**
* @file class_netclass.h
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
......@@ -30,9 +33,11 @@
#include <set>
#include <map>
#include "richio.h"
#include <wx/string.h>
class LINE_READER;
class BOARD;
......
......@@ -9,9 +9,14 @@
#ifndef __CLASSES_NETINFO__
#define __CLASSES_NETINFO__
#include <vector>
#include "class_netclass.h"
class wxDC;
class wxPoint;
class LINE_READER;
class EDA_DRAW_PANEL;
class EDA_DRAW_FRAME;
......
......@@ -358,7 +358,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
width = m_Thickness;
if( ( frame->m_DisplayModText == FILAIRE )
|| ( DC->LogicalToDeviceXRel( width ) < L_MIN_DESSIN ) )
|| ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) )
width = 0;
else if( frame->m_DisplayModText == SKETCH )
width = -width;
......
......@@ -635,7 +635,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
radius = (int) hypot( (double) ( m_End.x - m_Start.x ),
(double) ( m_End.y - m_Start.y ) );
if( DC->LogicalToDeviceXRel( l_trace ) < L_MIN_DESSIN )
if( DC->LogicalToDeviceXRel( l_trace ) < MIN_DRAW_WIDTH )
{
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
m_Start.y + aOffset.y, radius, color );
......@@ -665,7 +665,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
return;
}
if( DC->LogicalToDeviceXRel( l_trace ) < L_MIN_DESSIN )
if( DC->LogicalToDeviceXRel( l_trace ) < MIN_DRAW_WIDTH )
{
GRLine( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, 0, color );
return;
......
......@@ -37,29 +37,30 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
GetSizer()->SetSizeHints( this );
}
/****************************************************************/
void DIALOG_DISPLAY_OPTIONS::init()
/****************************************************************/
{
SetFocus();
if ( DisplayOpt.DisplayPcbTrackFill )
m_OptDisplayTracks->SetSelection(1);
m_OptDisplayTracks->SetSelection( 1 );
else
m_OptDisplayTracks->SetSelection(0);
m_OptDisplayTracks->SetSelection( 0 );
switch ( DisplayOpt.ShowTrackClearanceMode )
{
case DO_NOT_SHOW_CLEARANCE:
m_OptDisplayTracksClearance->SetSelection(0);
m_OptDisplayTracksClearance->SetSelection( 0 );
break;
case SHOW_CLEARANCE_NEW_TRACKS:
m_OptDisplayTracksClearance->SetSelection(1);
m_OptDisplayTracksClearance->SetSelection( 1 );
break;
default:
case SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
m_OptDisplayTracksClearance->SetSelection(2);
break;
case SHOW_CLEARANCE_ALWAYS:
m_OptDisplayTracksClearance->SetSelection(3);
break;
......@@ -71,65 +72,67 @@ void DIALOG_DISPLAY_OPTIONS::init()
m_OptDisplayPads->SetSelection(0);
if ( DisplayOpt.DisplayViaFill )
m_OptDisplayVias->SetSelection(1);
m_OptDisplayVias->SetSelection( 1 );
else
m_OptDisplayVias->SetSelection(0);
m_OptDisplayVias->SetSelection( 0 );
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1);
m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1 );
m_OptDisplayViaHole->SetSelection( DisplayOpt.m_DisplayViaMode );
m_OptDisplayModTexts->SetSelection( DisplayOpt.DisplayModText );
m_OptDisplayModEdges->SetSelection( DisplayOpt.DisplayModEdge );
m_OptDisplayPadClearence->SetValue( DisplayOpt.DisplayPadIsol );
m_OptDisplayPadNumber->SetValue( DisplayOpt.DisplayPadNum );
m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE(NO_CONNECTS_VISIBLE) ) );
m_OptDisplayPadNoConn->SetValue( m_Parent->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) ) );
m_OptDisplayDrawings->SetSelection( DisplayOpt.DisplayDrawItems );
m_ShowNetNamesOption->SetSelection( DisplayOpt.DisplayNetNamesMode);
m_ShowNetNamesOption->SetSelection( DisplayOpt.DisplayNetNamesMode );
}
/*****************************************************************/
void DIALOG_DISPLAY_OPTIONS::OnCancelClick( wxCommandEvent& event )
/*****************************************************************/
{
EndModal(0);
EndModal( 0 );
}
/*************************************************************************/
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
/*************************************************************************/
/* Update variables with new options
*/
void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
{
if ( m_Show_Page_Limits->GetSelection() == 0 ) g_ShowPageLimits = true;
else g_ShowPageLimits = FALSE;
if ( m_Show_Page_Limits->GetSelection() == 0 )
g_ShowPageLimits = true;
else
g_ShowPageLimits = FALSE;
if ( m_OptDisplayTracks->GetSelection() == 1)
if ( m_OptDisplayTracks->GetSelection() == 1 )
DisplayOpt.DisplayPcbTrackFill = true;
else DisplayOpt.DisplayPcbTrackFill = FALSE;
else
DisplayOpt.DisplayPcbTrackFill = FALSE;
m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.m_DisplayViaMode = m_OptDisplayViaHole->GetSelection();
DisplayOpt.m_DisplayViaMode = (VIA_DISPLAY_MODE_T) m_OptDisplayViaHole->GetSelection();
switch ( m_OptDisplayTracksClearance->GetSelection() )
{
case 0:
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
break;
case 1:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
break;
case 2:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
break;
case 3:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
break;
}
m_Parent->m_DisplayModText = DisplayOpt.DisplayModText =
m_OptDisplayModTexts->GetSelection();
m_Parent->m_DisplayModEdge = DisplayOpt.DisplayModEdge =
m_OptDisplayModEdges->GetSelection();
m_Parent->m_DisplayModText = DisplayOpt.DisplayModText = m_OptDisplayModTexts->GetSelection();
m_Parent->m_DisplayModEdge = DisplayOpt.DisplayModEdge = m_OptDisplayModEdges->GetSelection();
if (m_OptDisplayPads->GetSelection() == 1 )
DisplayOpt.DisplayPadFill = true;
......@@ -149,12 +152,12 @@ void DIALOG_DISPLAY_OPTIONS::OnOkClick(wxCommandEvent& event)
m_Parent->m_DisplayPadNum = DisplayOpt.DisplayPadNum = m_OptDisplayPadNumber->GetValue();
m_Parent->SetElementVisibility( PCB_VISIBLE(NO_CONNECTS_VISIBLE),
m_OptDisplayPadNoConn->GetValue());
m_OptDisplayPadNoConn->GetValue() );
DisplayOpt.DisplayDrawItems = m_OptDisplayDrawings->GetSelection();
DisplayOpt.DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
m_Parent->DrawPanel->Refresh();
EndModal(1);
EndModal( 1 );
}
/***************************************************************/
/* EDITEUR de PCB: AUTOROUTAGE: routine de calcul de distances */
/***************************************************************/
/**
* @file dist.cpp
* @brief Routines to calculate PCB editor auto routing distances.
*/
#include "fctsys.h"
#include "macros.h"
......@@ -10,10 +11,10 @@
#include "cell.h"
/* Les tables de distances et penalites sont etablies sur la base du pas
de routage de 50 unites(le pas entre les cellules est 50 unites)
La distance vraie est calculee par un facteur d'echelle
*/
/* The tables of distances and keep out areas are established on the basis of not
* routing of 50 units (the pitch between the cells is 50 units) The true distance
* is computed by a scaling factor
*/
/* calculate approximate distance
*/
......@@ -160,5 +161,3 @@ int CalcDist(int x,int y,int z ,int side )
return ldist * 10;
}
/****************/
/* Edit traces. */
/****************/
/**
* @file editrack.cpp
*/
#include "fctsys.h"
#include "class_drawpanel.h"
......@@ -639,7 +639,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true;
int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
TRACE_CLEARANCE_DISPLAY_MODE_T showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
if ( g_FirstTrackSegment == NULL )
return;
......
......@@ -387,7 +387,9 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
m_Auxiliary_Axis_Position.y = gy;
continue;
}
#ifdef PCBNEW
if( stricmp( Line, "Layers" ) == 0 )
{
int tmp;
......@@ -621,6 +623,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
continue;
}
#endif
}
/* Ensure tracks and vias sizes lists are ok:
......@@ -653,7 +656,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
#ifdef PCBNEW
static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard )
static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
{
NETCLASS* netclass_default = aBoard->m_NetClasses.GetDefault();
char text[1024];
......@@ -1017,10 +1021,12 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if( TESTLINE( "TRACK" ) )
{
#ifdef PCBNEW
TRACK* insertBeforeMe = Append ? NULL : board->m_Track.GetFirst();
ReadListeSegmentDescr( aReader, insertBeforeMe, TYPE_TRACK, NbTrack );
#endif
continue;
}
......@@ -1074,11 +1080,13 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if( TESTLINE( "ZONE" ) )
{
#ifdef PCBNEW
SEGZONE* insertBeforeMe = Append ? NULL : board->m_Zone.GetFirst();
ReadListeSegmentDescr( aReader, insertBeforeMe, TYPE_ZONE, NbZone );
#endif
continue;
}
......
......@@ -88,7 +88,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
reader.ReadLine();
Line = reader.Line();
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
if( strnicmp( Line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
{
if( strnicmp( Line, "Element", 7 ) == 0 )
{
......
......@@ -310,7 +310,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
SetIcon( icon );
m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
SetScreen( ScreenPcb );
SetScreen( new PCB_SCREEN() );
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
// initialize parameters in m_LayersManager
......@@ -402,6 +402,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
{
m_RecordingMacros = -1;
for( int i = 0; i < 10; i++ )
m_Macros[i].m_Record.clear();
......@@ -438,7 +439,7 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
DrawPanel->m_AbortRequest = true;
if( ScreenPcb->IsModify() )
if( GetScreen()->IsModify() )
{
unsigned ii;
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
......@@ -480,6 +481,7 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
// This should work on any platform.
if( m_Draw3DFrame->IsIconized() )
m_Draw3DFrame->Iconize( false );
m_Draw3DFrame->Raise();
// Raising the window does not set the focus on Linux. This should work on any platform.
......@@ -516,9 +518,7 @@ void PCB_EDIT_FRAME::LoadSettings()
if( config == NULL )
return;
/* The configuration setting that used to be mixed in with the project
* file settings.
*/
// The configuration setting that used to be mixed in with the project file settings.
wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
PCB_BASE_FRAME::LoadSettings();
......@@ -546,9 +546,7 @@ void PCB_EDIT_FRAME::SaveSettings()
if( config == NULL )
return;
/* The configuration setting that used to be mixed in with the project
* file settings.
*/
// The configuration setting that used to be mixed in with the project file settings.
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
PCB_BASE_FRAME::SaveSettings();
......
......@@ -90,8 +90,6 @@ bool EDA_APP::OnInit()
return false;
}
ScreenPcb = new PCB_SCREEN();
// read current setup and reopen last directory if no filename to open in command line
bool reopenLastUsedDirectory = argc == 1;
GetSettings( reopenLastUsedDirectory );
......
......@@ -273,13 +273,14 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
return m_configSettings;
// Units used in dialogs and toolbars
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ), (int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ),
&DisplayOpt.DisplayPolarCood, false ) );
// Display options and modes:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ViaHoleDisplayMode" ),
&DisplayOpt.m_DisplayViaMode,
(int*) &DisplayOpt.m_DisplayViaMode,
VIA_SPECIAL_HOLE_SHOW, VIA_HOLE_NOT_SHOW,
OPT_VIA_HOLE_END - 1 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ),
......@@ -287,7 +288,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayTrackFilled" ),
&DisplayOpt.DisplayPcbTrackFill, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ),
&DisplayOpt.ShowTrackClearanceMode,
(int*) &DisplayOpt.ShowTrackClearanceMode,
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ),
&DisplayOpt.DisplayPadFill, true ) );
......
/*************/
/* queue.cpp */
/*************/
/**
* @file queue.cpp
*/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "autorout.h"
#include "cell.h"
struct PcbQueue /* search queue structure */
{
struct PcbQueue* Next;
......@@ -38,6 +38,7 @@ void FreeQueue()
struct PcbQueue* p;
InitQueue();
while( (p = Save) != NULL )
{
Save = p->Next; MyFree( p );
......@@ -71,6 +72,7 @@ void GetQueue( int* r, int* c, int* s, int* d, int* a )
*r = p->Row; *c = p->Col;
*s = p->Side;
*d = p->Dist; *a = p->ApxDist;
if( (Head = p->Next) == NULL )
Tail = NULL;
......@@ -102,13 +104,16 @@ int SetQueue( int r, int c, int side, int d, int a, int r2, int c2 )
Save = p->Next;
}
else if( ( p = (struct PcbQueue*) MyMalloc( sizeof(PcbQueue) ) ) == NULL )
{
return 0;
}
p->Row = r;
p->Col = c;
p->Side = side;
i = (p->Dist = d) + (p->ApxDist = a);
p->Next = NULL;
if( (q = Head) != NULL ) /* insert in proper position in list */
{
if( q->Dist + q->ApxDist > i ) /* insert at head */
......@@ -117,8 +122,7 @@ int SetQueue( int r, int c, int side, int d, int a, int r2, int c2 )
}
else /* search for proper position */
{
for( t = q, q = q->Next; q && i > ( j = q->Dist + q->ApxDist );
t = q, q = q->Next )
for( t = q, q = q->Next; q && i > ( j = q->Dist + q->ApxDist ); t = q, q = q->Next )
;
if( q && i == j && q->Row == r2 && q->Col == c2 )
......@@ -126,21 +130,28 @@ int SetQueue( int r, int c, int side, int d, int a, int r2, int c2 )
/* insert after q, which is a goal node */
if( ( p->Next = q->Next ) == NULL )
Tail = p;
q->Next = p;
}
else /* insert in front of q */
{
if( ( p->Next = q ) == NULL )
Tail = p;
t->Next = p;
}
}
}
else /* empty search list */
{
Head = Tail = p;
}
OpenNodes++;
if( ++qlen > MaxNodes )
MaxNodes = qlen;
return 1;
}
......@@ -162,7 +173,10 @@ void ReSetQueue( int r, int c, int s, int d, int a, int r2, int c2 )
Tail = q;
}
else if( ( Head = p->Next ) == NULL )
{
Tail = NULL;
}
p->Next = Save;
Save = p;
OpenNodes--;
......@@ -174,6 +188,7 @@ void ReSetQueue( int r, int c, int s, int d, int a, int r2, int c2 )
if( !p ) /* not found, it has already been closed once */
ClosNodes--; /* we will close it again, but just count once */
/* if it was there, it's gone now; insert it at the proper position */
SetQueue( r, c, s, d, a, r2, c2 );
}
......@@ -16,7 +16,6 @@
#include "pcbnew.h"
#include "protos.h"
#include "ar_protos.h"
#include "autorout.h"
#include "cell.h"
......
......@@ -90,6 +90,7 @@ int SetWork( int r1,
p->Cost = GetCost( r1, c1, r2, c2 );
p->Priority = pri;
p->Next = NULL;
if( Head ) /* attach at end */
Tail->Next = p;
......
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