changes in track connectivity computation

This commit is contained in:
CHARRAS 2007-10-16 19:05:33 +00:00
parent 28b171872f
commit 45cdad8b2d
11 changed files with 1717 additions and 1712 deletions

View File

@ -4,6 +4,24 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew:
remove a change for Read VIA because via attributes
(TROUGH VIA, BLIND VIA or BURIED VIA) are autorisations for layer connection,
and are not a real layer indicator.
If a via connect layers from copper to component, it can have a BURIED VIA attribute.
the meaning is for this via the layer pair can be changed for other layer pair
if after editing this via connect 2 tracks which are only int internal layers,
its layer pair can be changed.
If a via has a TROUGH VIA attribute, it connects ALL layers, whenever tracks
connected to it.
Note: curenty: only TROUGH VIA are handled.
Other types (BLIND VIA and BURIED VIA) are only experimental.
A **lot** of code is needed for a full support.
enhancements in connectivity computation
2007-Oct-15 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Oct-15 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================

View File

@ -31,7 +31,7 @@
#define PCB_INTERNAL_UNIT 10000 #define PCB_INTERNAL_UNIT 10000
#endif #endif
// Option d'affichage des fenetres de dialogue // Option for dialog boxes
// #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP // #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
@ -52,10 +52,10 @@ class WinEDA_MainFrame;
class BASE_SCREEN; class BASE_SCREEN;
class SCH_SCREEN; class SCH_SCREEN;
class PCB_SCREEN; class PCB_SCREEN;
class WinEDA_SchematicFrame; // Edition des Schemas class WinEDA_SchematicFrame; // Schematic main frame
class WinEDA_LibeditFrame; // Edition des composants class WinEDA_LibeditFrame; // Component creation and edition main frame
class WinEDA_ViewlibFrame; // Visualisation des composants class WinEDA_ViewlibFrame; // Component viewer main frame
class WinEDA_GerberFrame; // Visualisation des fichiers GERBER class WinEDA_GerberFrame; // GERBER viewer main frame
class WinEDA_Toolbar; class WinEDA_Toolbar;
class WinEDA_CvpcbFrame; class WinEDA_CvpcbFrame;
class WinEDA_PcbFrame; class WinEDA_PcbFrame;
@ -65,7 +65,7 @@ class WinEDAChoiceBox;
#define WinEDA_Menu wxMenu #define WinEDA_Menu wxMenu
#define WinEDA_MenuItem wxMenuItem #define WinEDA_MenuItem wxMenuItem
// Utilisees mais non definies ici : // Used but not defined here:
class LibraryStruct; class LibraryStruct;
class EDA_LibComponentStruct; class EDA_LibComponentStruct;
class LibEDA_BaseStruct; class LibEDA_BaseStruct;
@ -124,10 +124,10 @@ enum id_drawframe {
}; };
enum id_toolbar { enum id_toolbar {
TOOLBAR_MAIN = 1, // Toolbar horizontal (main) TOOLBAR_MAIN = 1, // Main horizontal Toolbar
TOOLBAR_TOOL, // Toolbar vertical tools TOOLBAR_TOOL, // Rigth vertical Toolbar (list of tools)
TOOLBAR_OPTION, // Toolbar vertical options TOOLBAR_OPTION, // Left vertical Toolbar (option toolbar
TOOLBAR_AUX TOOLBAR_AUX // Secondary horizontal Toolbar
}; };
@ -135,7 +135,7 @@ enum id_toolbar {
/* Classes pour WXWIN */ /* Classes pour WXWIN */
/**********************/ /**********************/
#define MSG_PANEL_DEFAULT_HEIGHT ( 28 ) // hauteur de la zone d'affichage des infos en bas d'ecran #define MSG_PANEL_DEFAULT_HEIGHT ( 28 ) // height of the infos display window
/**********************************************/ /**********************************************/
/* Class representing the entire Application */ /* Class representing the entire Application */
@ -143,9 +143,10 @@ enum id_toolbar {
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
/********************************************/ /******************************************************************/
/* classe pour la Fenetre generale de trace */ /* Basic frame for kicad, eeschema, pcbnew and gerbview. */
/********************************************/ /* not directly used: the real frames are derived from this class */
/******************************************************************/
class WinEDA_BasicFrame : public wxFrame class WinEDA_BasicFrame : public wxFrame
{ {
@ -195,14 +196,14 @@ public:
}; };
/********************************************/ /*******************************************************/
/* classe pour la Fenetre generale de trace */ /* Basic draw frame for eeschema, pcbnew and gerbview. */
/********************************************/ /*******************************************************/
class WinEDA_DrawFrame : public WinEDA_BasicFrame class WinEDA_DrawFrame : public WinEDA_BasicFrame
{ {
public: public:
WinEDA_DrawPanel* DrawPanel; // surface de dessin WinEDA_DrawPanel* DrawPanel; // Draw area
WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques WinEDA_MsgPanel* MsgPanel; // Zone d'affichage de caracteristiques
WinEDA_Toolbar* m_VToolBar; // Vertical (right side) Toolbar WinEDA_Toolbar* m_VToolBar; // Vertical (right side) Toolbar
WinEDA_Toolbar* m_AuxVToolBar; // Auxiliary Vertical (right side) Toolbar WinEDA_Toolbar* m_AuxVToolBar; // Auxiliary Vertical (right side) Toolbar
@ -213,11 +214,11 @@ public:
WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value WinEDAChoiceBox* m_SelZoomBox; // Dialog box to choose the Zoom value
int m_ZoomMaxValue; // Max zoom value: Draw min scale is 1/m_ZoomMaxValue int m_ZoomMaxValue; // Max zoom value: Draw min scale is 1/m_ZoomMaxValue
BASE_SCREEN* m_CurrentScreen; // SCREEN en cours BASE_SCREEN* m_CurrentScreen; // current used SCREEN
int m_CurrentCursorShape; // shape for cursor (0 = default cursor) int m_CurrentCursorShape; // shape for cursor (0 = default cursor)
int m_ID_current_state; ///< Id of active button on the vertical toolbar int m_ID_current_state; // Id of active button on the vertical toolbar
int m_HTOOL_current_state; ///< Id of active button on horizontal toolbar int m_HTOOL_current_state; // Id of active button on horizontal toolbar
int m_InternalUnits; // nombre d'unites internes pour 1 pouce int m_InternalUnits; // nombre d'unites internes pour 1 pouce
// = 1000 pour schema, = 10000 pour PCB // = 1000 pour schema, = 10000 pour PCB
@ -276,18 +277,14 @@ public:
void OnPanning( int direction ); void OnPanning( int direction );
void OnGrid( int grid_type ); void OnGrid( int grid_type );
void Recadre_Trace( bool ToMouse ); void Recadre_Trace( bool ToMouse );
void PutOnGrid( wxPoint* coord ); /* corrige la valeur de la coordonnee coord void PutOnGrid( wxPoint* coord ); /* set the coordiante "coord" to the nearest grid coordinate */
* pour etre sur le point de grille le plus proche */
void Zoom_Automatique( bool move_mouse_cursor ); void Zoom_Automatique( bool move_mouse_cursor );
/* Affiche le schema au meilleur zoom au meilleur centrage pour le dessin /* Set the zoom level to show the area Rect */
* de facon a avoir tout le circuit affiche a l'ecran */
void Window_Zoom( EDA_Rect& Rect ); void Window_Zoom( EDA_Rect& Rect );
/* Recalcule le zoom et les offsets pour que l'affichage se fasse dans la /* Return the zoom level which displays the full page on screen */
* fenetre de coord x0, y0 a x1, y1 */ virtual int BestZoom() = 0;
virtual int BestZoom() = 0; // Retourne le meilleur zoom
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
@ -308,7 +305,7 @@ public:
void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */ void Affiche_Status_Box(); /* Affichage des coord curseur, zoom .. */
void DisplayUnitsMsg(); void DisplayUnitsMsg();
/* Gestion generale des operations sur block */ /* Handlers for block commands */
virtual int ReturnBlockCommand( int key ); virtual int ReturnBlockCommand( int key );
virtual void InitBlockPasteInfos(); virtual void InitBlockPasteInfos();
virtual bool HandleBlockBegin( wxDC* DC, int cmd_type, const wxPoint& startpos ); virtual bool HandleBlockBegin( wxDC* DC, int cmd_type, const wxPoint& startpos );
@ -328,10 +325,9 @@ public:
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate ) EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
/**************************************************************/ /******************************************************************/
/* class WinEDA_BasePcbFrame: classe de base commune */ /* class WinEDA_BasePcbFrame: Basic class for pcbnew and gerbview */
/* aux classes d'affichage de PCB, et de l'editeur de Modules */ /******************************************************************/
/**************************************************************/
class WinEDA_BasePcbFrame : public WinEDA_DrawFrame class WinEDA_BasePcbFrame : public WinEDA_DrawFrame
{ {
@ -339,11 +335,11 @@ public:
BOARD* m_Pcb; BOARD* m_Pcb;
bool m_DisplayPadFill; // How show pads bool m_DisplayPadFill; // How show pads
bool m_DisplayPadNum; // show pads number bool m_DisplayPadNum; // show pads numbers
int m_DisplayModEdge; // How show module drawings int m_DisplayModEdge; // How show module drawings
int m_DisplayModText; // How show module texts int m_DisplayModText; // How show module texts
bool m_DisplayPcbTrackFill; /* FALSE = sketch , TRUE = rempli */ bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, TRUE = filled */
WinEDA3D_DrawFrame* m_Draw3DFrame; WinEDA3D_DrawFrame* m_Draw3DFrame;
protected: protected:
@ -369,7 +365,7 @@ public:
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; } PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
int BestZoom(); // Retourne le meilleur zoom int BestZoom();
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
@ -396,7 +392,7 @@ public:
int ReadSetup( FILE* File, int* LineNum ); int ReadSetup( FILE* File, int* LineNum );
int ReadGeneralDescrPcb( wxDC* DC, FILE* File, int* LineNum ); int ReadGeneralDescrPcb( wxDC* DC, FILE* File, int* LineNum );
// Gestion du PCB // PCB handling
bool Clear_Pcb( wxDC* DC, bool query ); bool Clear_Pcb( wxDC* DC, bool query );
/** /**
@ -436,13 +432,10 @@ public:
*/ */
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide(); GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
// Gestion du curseur /* Place un repere sur l'ecran au point de coordonnees PCB pos */
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap, void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
int DrawMode, int color, int type ); int DrawMode, int color, int type );
/* Place un repere sur l'ecran au point de coordonnees PCB pos */
// Gestion des modules // Gestion des modules
void InstallModuleOptionsFrame( MODULE* Module, void InstallModuleOptionsFrame( MODULE* Module,
wxDC* DC, const wxPoint& pos ); wxDC* DC, const wxPoint& pos );
@ -454,7 +447,7 @@ public:
MODULE* Select_1_Module_From_BOARD( BOARD* Pcb ); MODULE* Select_1_Module_From_BOARD( BOARD* Pcb );
MODULE* GetModuleByName(); MODULE* GetModuleByName();
// Modules // Modules (footprints)
MODULE* Create_1_Module( wxDC* DC, const wxString& module_name ); MODULE* Create_1_Module( wxDC* DC, const wxString& module_name );
void Edit_Module( MODULE* module, wxDC* DC ); void Edit_Module( MODULE* module, wxDC* DC );
void Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental ); void Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental );
@ -463,7 +456,7 @@ public:
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule, void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule,
wxDC* DC, const wxPoint& pos ); wxDC* DC, const wxPoint& pos );
// Textes sur modules // module texts
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ); void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ); void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC );
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
@ -485,7 +478,7 @@ public:
void Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC ); void Global_Import_Pad_Settings( D_PAD* Pad, wxDC* DC );
// Chargement de modules // loading footprints
MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library, MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library,
const wxString& ModuleName, bool show_msg_err ); const wxString& ModuleName, bool show_msg_err );
@ -495,7 +488,7 @@ public:
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// Gestion des chevelus (ratsnest) // ratsnest functions
void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */ void Compile_Ratsnest( wxDC* DC, bool affiche ); /* Recalcul complet du chevelu */
void ReCompile_Ratsnest_After_Changes( wxDC* DC ); void ReCompile_Ratsnest_After_Changes( wxDC* DC );
int Test_1_Net_Ratsnest( wxDC* DC, int net_code ); int Test_1_Net_Ratsnest( wxDC* DC, int net_code );
@ -504,8 +497,7 @@ public:
void Build_Board_Ratsnest( wxDC* DC ); void Build_Board_Ratsnest( wxDC* DC );
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC ); void trace_ratsnest_pad( wxDC* DC );
void recalcule_pad_net_code(); /* Routine de void recalcule_pad_net_code(); /* compute and update the PAD net codes */
* calcul et de mise a jour des net_codes des PADS */
void build_liste_pads(); void build_liste_pads();
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init ); int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
@ -537,10 +529,10 @@ public:
void Block_Move( wxDC* DC ); void Block_Move( wxDC* DC );
void Block_Duplicate( wxDC* DC ); void Block_Duplicate( wxDC* DC );
// Gestion des zones: // zone handling:
void DelLimitesZone( wxDC* DC, bool Redraw ); void DelLimitesZone( wxDC* DC, bool Redraw );
// Gestion des layers: // layerhandling:
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided) // (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
int SelectLayer( int default_layer, int min_layer, int max_layer, int SelectLayer( int default_layer, int min_layer, int max_layer,
bool null_layer = false ); bool null_layer = false );
@ -672,7 +664,7 @@ public:
void StartMove_Module( MODULE* module, wxDC* DC ); void StartMove_Module( MODULE* module, wxDC* DC );
bool Delete_Module( MODULE* module, wxDC* DC ); bool Delete_Module( MODULE* module, wxDC* DC );
// Chargement de modules: voir WinEDA_BasePcbFrame // loading modules: see WinEDA_BasePcbFrame
// Gestion du PCB // Gestion du PCB
void Erase_Zones( wxDC* DC, bool query ); void Erase_Zones( wxDC* DC, bool query );
@ -685,7 +677,7 @@ public:
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC );
void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via ); void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via );
// Mise en surbrillance des nets: // Hightlight functions:
int Select_High_Light( wxDC* DC ); int Select_High_Light( wxDC* DC );
void Hight_Light( wxDC* DC ); void Hight_Light( wxDC* DC );
void DrawHightLight( wxDC* DC, int NetCode ); void DrawHightLight( wxDC* DC, int NetCode );
@ -716,34 +708,34 @@ public:
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer ); void SwitchLayer( wxDC* DC, int layer );
// Edition des zones // zone handling
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone ); EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
void CaptureNetName( wxDC* DC ); void CaptureNetName( wxDC* DC );
EDGE_ZONE* Begin_Zone(); EDGE_ZONE* Begin_Zone();
void End_Zone( wxDC* DC ); void End_Zone( wxDC* DC );
void Fill_Zone( wxDC* DC ); void Fill_Zone( wxDC* DC );
// Edition des mires de centrage // Target handling
MIREPCB* Create_Mire( wxDC* DC ); MIREPCB* Create_Mire( wxDC* DC );
void Delete_Mire( MIREPCB* MirePcb, wxDC* DC ); void Delete_Mire( MIREPCB* MirePcb, wxDC* DC );
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC ); void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
void Place_Mire( MIREPCB* MirePcb, wxDC* DC ); void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC, const wxPoint& pos ); void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC, const wxPoint& pos );
// Gestion des segments de dessin type DRAWSEGMENT: // Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ); DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC ); void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
// Gestion des cotations: // Dimension handling:
void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos ); void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos );
COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC ); COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC );
void Delete_Cotation( COTATION* Cotation, wxDC* DC ); void Delete_Cotation( COTATION* Cotation, wxDC* DC );
// Gestion des netlistes: // netlist handling:
void InstallNetlistFrame( wxDC* DC, const wxPoint& pos ); void InstallNetlistFrame( wxDC* DC, const wxPoint& pos );
// Autoplacement: // Autoplacement:
@ -760,20 +752,19 @@ public:
int GenPlaceBoard(); int GenPlaceBoard();
void DrawInfoPlace( wxDC* DC ); void DrawInfoPlace( wxDC* DC );
// Autoroutage: // Autorouting:
int Solve( wxDC* DC, int two_sides ); int Solve( wxDC* DC, int two_sides );
void Reset_Noroutable( wxDC* DC ); void Reset_Noroutable( wxDC* DC );
void Autoroute( wxDC* DC, int mode ); void Autoroute( wxDC* DC, int mode );
void ReadAutoroutedTracks( wxDC* DC ); void ReadAutoroutedTracks( wxDC* DC );
void GlobalRoute( wxDC* DC ); void GlobalRoute( wxDC* DC );
// fonctions generales // divers
void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC );
void Ratsnest_On_Off( wxDC* DC ); void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC ); void Clean_Pcb( wxDC* DC );
BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems ); BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems );
// divers
void InstallFindFrame( const wxPoint& pos, wxDC* DC ); void InstallFindFrame( const wxPoint& pos, wxDC* DC );
/** /**
@ -784,7 +775,7 @@ public:
*/ */
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ); void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
/* Special micro_ondes */ /* Micro waves functions */
void Edit_Gap( wxDC* DC, MODULE* Module ); void Edit_Gap( wxDC* DC, MODULE* Module );
MODULE* Create_MuWaveBasicShape( wxDC* DC, const wxString& name, int pad_count ); MODULE* Create_MuWaveBasicShape( wxDC* DC, const wxString& name, int pad_count );
MODULE* Create_MuWaveComponent( wxDC* DC, int shape_type ); MODULE* Create_MuWaveComponent( wxDC* DC, int shape_type );
@ -840,7 +831,7 @@ public:
void InstallPcbOptionsFrame( const wxPoint& pos, int id ); void InstallPcbOptionsFrame( const wxPoint& pos, int id );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
/* Gestion generale des operations sur block */ /* handlers for block commands */
int ReturnBlockCommand( int key ); int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC ); virtual int HandleBlockEnd( wxDC* DC );
@ -872,14 +863,14 @@ public:
/* Fonctions specifiques */ /* Fonctions specifiques */
void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ); void Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer );
// Gestion des textes sur pcb // Copper texts
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
// Gestion du PCB // PCB handling
bool Clear_Pcb( wxDC* DC, bool query ); bool Clear_Pcb( wxDC* DC, bool query );
void Erase_Current_Layer( wxDC* DC, bool query ); void Erase_Current_Layer( wxDC* DC, bool query );
void Erase_Zones( wxDC* DC, bool query ); void Erase_Zones( wxDC* DC, bool query );
@ -903,7 +894,7 @@ public:
/*********************************************************/ /*********************************************************/
/* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */ /* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */
/* Class de la fenetre d'<27>dition des modules pour PCB */ /* Class for the footprint editor */
/*********************************************************/ /*********************************************************/
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
@ -937,13 +928,14 @@ public:
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* Gestion generale des operations sur block */ /* handlers for block commands */
int ReturnBlockCommand( int key ); int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC ); virtual int HandleBlockEnd( wxDC* DC );
BOARD_ITEM* ModeditLocateAndDisplay(); BOARD_ITEM* ModeditLocateAndDisplay();
/* Undo and redo functions */
public: public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
@ -953,17 +945,17 @@ private:
public: public:
// Gestion des modules // Footprint edition
void Place_Ancre( MODULE* module, wxDC* DC ); void Place_Ancre( MODULE* module, wxDC* DC );
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC );
void Transform( MODULE* module, wxDC* DC, int transform ); void Transform( MODULE* module, wxDC* DC, int transform );
// Chargement de modules // loading Footprint
MODULE* Import_Module( wxDC* DC ); MODULE* Import_Module( wxDC* DC );
void Export_Module( MODULE* ptmod, bool createlib ); void Export_Module( MODULE* ptmod, bool createlib );
void Load_Module_Module_From_BOARD( MODULE* Module ); void Load_Module_Module_From_BOARD( MODULE* Module );
// Gestion des contours // functions to edit footprint edges
void Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); void Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC );
void Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ); void Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC );
void Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); void Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC );
@ -973,7 +965,7 @@ public:
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
void Place_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); void Place_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
// Gestion des librairies: // handlers for libraries:
void Delete_Module_In_Library( const wxString& libname ); void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName ); int Create_Librairie( const wxString& LibName );
void Select_Active_Library(); void Select_Active_Library();

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -49,9 +49,9 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS ) if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers"); text << _("all copper layers");
else if( (pad->m_Masque_Layer & CUIVRE_LAYER) == CUIVRE_LAYER ) else if( (pad->m_Masque_Layer & CUIVRE_LAYER) == CUIVRE_LAYER )
text << _("copper layers"); text << _("copper layer");
else if( (pad->m_Masque_Layer & CMP_LAYER) == CMP_LAYER ) else if( (pad->m_Masque_Layer & CMP_LAYER) == CMP_LAYER )
text << _("cmp layers"); text << _("cmp layer");
else text << _("???"); else text << _("???");
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference(); text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
break; break;

View File

@ -7,15 +7,17 @@
#include "base_struct.h" #include "base_struct.h"
/* Type des Vias (shape)*/
/* Forme des Vias ( parametre .shape ) */ // Via attributes (m_Shape parmeter)
#define VIA_NORMALE 3 /* type via : traversante (throught via) */ #define THROUGH_VIA 3 /* Always a through hole via */
#define VIA_ENTERREE 2 /* type via : enterree ou aveugle (blind via) */ #define BURIED_VIA 2 /* this via can be on internal layers */
#define VIA_BORGNE 1 /* type via : borgne ou demi-traversante (buried via) */ #define BLIND_VIA 1 /* this via which connect from internal layers to an external layer */
#define VIA_NOT_DEFINED 0 /* reserved */ #define NOT_DEFINED_VIA 0 /* reserved (unused) */
#define SQUARE_VIA 0x80000000 /* Flag pour forme carree */ #define SQUARE_VIA_SHAPE 0x80000000 /* Flag pour forme carree */
#define VIA_NORMALE THROUGH_VIA
#define VIA_ENTERREE BURIED_VIA
#define VIA_BORGNE BLIND_VIA
/***/ /***/
@ -80,7 +82,7 @@ public:
TRACK* GetBestInsertPoint( BOARD* Pcb ); TRACK* GetBestInsertPoint( BOARD* Pcb );
/* Copie d'un Element d'une chaine de n elements /* Copie d'un Element d'une chaine de n elements
TRACK* CopyList( int NbSegm = 1 ) const; * TRACK* CopyList( int NbSegm = 1 ) const;
*/ */
/* Recherche du debut du net /* Recherche du debut du net
@ -186,6 +188,7 @@ public:
#if defined (DEBUG) #if defined (DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
@ -194,6 +197,7 @@ public:
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
}; };
@ -213,8 +217,8 @@ public:
return wxT( "ZONE" ); return wxT( "ZONE" );
} }
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
}; };
@ -254,6 +258,7 @@ public:
#if defined (DEBUG) #if defined (DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
@ -262,8 +267,8 @@ public:
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif
#endif
}; };

View File

@ -413,5 +413,5 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
} }
SetToolbars(); SetToolbars();
Affiche_Status_Box(); /* Affichage des coord curseur */ Affiche_Status_Box(); /* Display new cursor coordinates */
} }

View File

@ -172,32 +172,11 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File,
PtSegm->m_Width = width; PtSegm->m_Width = width;
// Before specifying the value for any new via's Shape property, check
// the values of its top_layer and bottom_layer properties, to determine
// what value should *really* be assigned to that property (as all
// versions of KiCad up until revision 335 (committed on 2007-Oct-13)
// could sometimes assign an inappropriate value to that property).
if( makeType == TYPEVIA ) if( makeType == TYPEVIA )
{ {
int b_layer = (layer >> 4) & 15; // a THROUGH HOLE VIA always connects all layers
int t_layer = layer & 15; if ( shape == THROUGH_VIA )
if( ( ( b_layer == COPPER_LAYER_N ) && ( t_layer == CMP_N ) ) layer = (COPPER_LAYER_N << 4) + LAYER_CMP_N;
|| ( ( b_layer == CMP_N ) && ( t_layer == COPPER_LAYER_N ) ) )
{
// The via is really of a "standard" (through-hole) type
shape = VIA_NORMALE;
}
else if( ( b_layer == COPPER_LAYER_N ) || ( t_layer == CMP_N )
|| ( b_layer == CMP_N ) || ( t_layer == COPPER_LAYER_N ) )
{
// The via is really of a "blind" type
shape = VIA_BORGNE;
}
else
{
// The via is really of a "buried" type
shape = VIA_ENTERREE;
}
} }
PtSegm->m_Shape = shape; PtSegm->m_Shape = shape;
@ -221,11 +200,11 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File,
{ {
case TYPETRACK: case TYPETRACK:
case TYPEVIA: case TYPEVIA:
DisplayActivity( PerCent, wxT( "Tracks:" ) ); DisplayActivity( PerCent, _( "Tracks:" ) );
break; break;
case TYPEZONE: case TYPEZONE:
DisplayActivity( PerCent, wxT( "Zones:" ) ); DisplayActivity( PerCent, _( "Zones:" ) );
break; break;
} }
#endif #endif

View File

@ -663,6 +663,21 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
} }
/******************************************/
inline int Dist(wxPoint & p1, wxPoint & p2)
/******************************************/
/*
return the dist min between p1 and p2
*/
{
int dist;
dist = abs(p1.x - p2.x) + abs (p1.y - p2.y);
dist *= 7;
dist /= 10;
return dist;
}
/**************************************************************/ /**************************************************************/
TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
TRACK* pt_lim, int extr ) TRACK* pt_lim, int extr )
@ -686,6 +701,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
int Reflayer; int Reflayer;
wxPoint pos_ref; wxPoint pos_ref;
int ii; int ii;
int min_dist;
if( extr == START ) if( extr == START )
pos_ref = PtRefSegm->m_Start; pos_ref = PtRefSegm->m_Start;
@ -708,13 +724,16 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
goto suite; goto suite;
if( PtSegmN == PtRefSegm ) if( PtSegmN == PtRefSegm )
goto suite; goto suite;
if( pos_ref == PtSegmN->m_Start )
min_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref, PtSegmN->m_Start) < min_dist )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
} }
if( pos_ref == PtSegmN->m_End ) if( Dist(pos_ref, PtSegmN->m_End) < min_dist )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
@ -732,13 +751,16 @@ suite:
goto suite1; goto suite1;
if( PtSegmB == PtRefSegm ) if( PtSegmB == PtRefSegm )
goto suite1; goto suite1;
if( pos_ref == PtSegmB->m_Start )
min_dist = (PtSegmB->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref, PtSegmB->m_Start) < min_dist )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmB->ReturnMaskLayer() ) if( Reflayer & PtSegmB->ReturnMaskLayer() )
return PtSegmB; return PtSegmB;
} }
if( pos_ref == PtSegmB->m_End ) if( Dist(pos_ref, PtSegmB->m_End) < min_dist )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmB->ReturnMaskLayer() ) if( Reflayer & PtSegmB->ReturnMaskLayer() )
return PtSegmB; return PtSegmB;
@ -769,13 +791,16 @@ suite1:
continue; continue;
} }
if( pos_ref == PtSegmN->m_Start )
min_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref,PtSegmN->m_Start) < min_dist )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;
} }
if( pos_ref == PtSegmN->m_End ) if( Dist(pos_ref, PtSegmN->m_End) < min_dist )
{ /* Test des couches */ { /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() ) if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN; return PtSegmN;

View File

@ -30,8 +30,7 @@
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/ /*************************************************************************/
/* Traite les commandes declenchée par le bouton gauche de la souris, /* Handle the left click in footprint editor
* quand un outil est deja selectionné
*/ */
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
@ -39,7 +38,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
{ {
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
{ {
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
@ -75,7 +74,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct = GetCurItem(); DrawStruct = GetCurItem();
if( !DrawStruct || (DrawStruct->m_Flags == 0) ) if( !DrawStruct || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = (BOARD_ITEM*) ModeditLocateAndDisplay(); DrawStruct = ModeditLocateAndDisplay();
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
} }
@ -177,9 +176,9 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu ) wxMenu* PopMenu )
/*********************************************************************/ /*********************************************************************/
/* Prepare le menu PullUp affiché par un click sur le bouton droit /* Handle the right click in the footprint editor:
* de la souris. * Create the pull up menu
* Ce menu est ensuite complété par la liste des commandes de ZOOM * After this menu is built, the standart ZOOM menu is added
*/ */
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
@ -376,9 +375,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/****************************************************************************/ /****************************************************************************/
/* Appelé sur un double click: /* Handle the double click in the footprin editor:
* pour un élément editable (textes, composant): * If the double clicked item is editable: call the corresponding editor.
* appel de l'editeur correspondant.
*/ */
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
@ -392,13 +390,13 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case 0: case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = PcbGeneralLocateAndDisplay(); DrawStruct = ModeditLocateAndDisplay();
} }
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break; break;
// Element localisé // Item found
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )

View File

@ -33,7 +33,7 @@ static bool DisplayRastnestInProgress; // Enable the display of the ratsnes
* Build_Board_Ratsnest( wxDC* DC ) Create this rastnest * Build_Board_Ratsnest( wxDC* DC ) Create this rastnest
* for each net: * for each net:
* First: * First:
* we create links (and therefore a logical block) between 2 pad. This is achieved by: * we create a link (and therefore a logical block) between 2 pad. This is achieved by:
* search for a pad without link. * search for a pad without link.
* search its nearest pad * search its nearest pad
* link these 2 pads (i.e. create a ratsnest item) * link these 2 pads (i.e. create a ratsnest item)