pcbnew: better messages in drc control and some other enhancements

This commit is contained in:
CHARRAS 2007-07-25 09:02:05 +00:00
parent d84960f3b0
commit f27208a11b
23 changed files with 712 additions and 1253 deletions

View File

@ -4,6 +4,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Jul-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
** Some minor enhancements
+ pcbnew
In Drc diags, better (more explicit) messages
Change (and simplify) code in 'update' as well as 'insert' modules into main PCB from within the module editor,
because it had a bug (crashes when there was no footprint in pcb)
2007-June-21 UPDATE Tim Hanson <tim@hardcarve.com>
================================================================================
+ pcbnew

View File

@ -15,7 +15,7 @@
#include "colors.h"
// Define print format d to display a schematic component line
#define CMP_FORMAT wxT("%3d %8.8s - %16.16s : %-.32s")
#define CMP_FORMAT wxT("%3d %+8s - %+16s : %-.32s")
#define FILTERFOOTPRINTKEY "FilterFootprint"

View File

@ -1,225 +0,0 @@
/*****************************************************************/
/** options.cpp: options pour la visualisation des composants **/
/****************************************************************/
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "cvpcb.h"
#include "protos.h"
enum {
SET_OPTION = 8000,
SET_EDGE_FORMAT,
SET_TEXTE_FORMAT,
PADFILL_OPT,
PADNUM_OPT,
EDGE_SELECT,
TEXT_SELECT,
ID_SAVE_CONFIG
};
/********************************************/
/* Classes derivees pour la fenetre Options */
/********************************************/
class wxMyCheckBox: public wxCheckBox
{
private:
protected:
public:
bool * BoolVar;
// Constructor and destructor
wxMyCheckBox(wxWindow *parent, int id, const wxString & Title,
bool * RefVar, wxPoint& pos);
~wxMyCheckBox(void) { };
};
/************************************************************/
/* classe derivee pour la fenetre de selection des options */
/* d'affichage du module */
/************************************************************/
class wxOptionsBox: public wxDialog
{
private:
protected:
public:
WinEDA_BasePcbFrame * m_Parent;
wxMyCheckBox * IsShowPadFill;
wxMyCheckBox * IsShowPadNum;
wxRadioBox * EdgeRadioBox;
wxRadioBox *TextRadioBox;
// Constructor and destructor
wxOptionsBox(WinEDA_BasePcbFrame * parent, wxPoint& pos);
~wxOptionsBox(void);
bool OnClose(void);
void SetOptPadFill( wxCommandEvent& event);
void SetOptPadNum( wxCommandEvent& event);
void ReturnDisplayEdgeFormat(wxCommandEvent& event);
void ReturnDisplayTexteFormat(wxCommandEvent& event);
void SaveConfig(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxOptionsBox, wxDialog )
EVT_CHECKBOX(PADFILL_OPT, wxOptionsBox::SetOptPadFill)
EVT_CHECKBOX(PADNUM_OPT, wxOptionsBox::SetOptPadNum)
EVT_RADIOBOX(EDGE_SELECT, wxOptionsBox::ReturnDisplayEdgeFormat)
EVT_RADIOBOX(TEXT_SELECT, wxOptionsBox::ReturnDisplayTexteFormat)
EVT_BUTTON(ID_SAVE_CONFIG, wxOptionsBox::SaveConfig)
END_EVENT_TABLE()
/*********************************************************************/
void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event)
/*********************************************************************/
/* Creation de la fenetre d'options de la fenetre de visu */
{
wxPoint pos;
GetPosition(&pos.x, &pos.y);
pos.x += 10; if (pos.x < 0 ) pos.x = 0;
pos.y += 50; if (pos.y < 0 ) pos.y = 0;
wxOptionsBox * OptionWindow = new wxOptionsBox(this, pos);
OptionWindow->ShowModal(); OptionWindow->Destroy();
}
/********************************/
/* Constructeur de wxMyCheckBox */
/********************************/
wxMyCheckBox::wxMyCheckBox(wxWindow *parent, int id, const wxString & Title,
bool * RefVar, wxPoint& pos):
wxCheckBox(parent, id, Title, pos)
{
BoolVar = RefVar;
if( * BoolVar ) this->SetValue(TRUE);
else this->SetValue(FALSE);
}
/******************************************************/
void wxOptionsBox::SetOptPadFill(wxCommandEvent& event)
/******************************************************/
{
*IsShowPadFill->BoolVar == 0 ?
* IsShowPadFill->BoolVar = 1 : * IsShowPadFill->BoolVar = 0;
DisplayOpt.DisplayPadFill = m_Parent->m_DisplayPadFill = IsShowPadFill->BoolVar;
m_Parent->ReDrawPanel();
}
/******************************************************/
void wxOptionsBox::SetOptPadNum(wxCommandEvent& event)
/******************************************************/
{
*IsShowPadNum->BoolVar == 0 ?
*IsShowPadNum->BoolVar = TRUE : *IsShowPadNum->BoolVar = FALSE;
DisplayOpt.DisplayPadNum = m_Parent->m_DisplayPadNum = IsShowPadNum->BoolVar;
m_Parent->ReDrawPanel();
}
/********************************/
/* Constructeur de wxOptionsBox */
/********************************/
wxOptionsBox::wxOptionsBox(WinEDA_BasePcbFrame * parent, wxPoint& bpos):
wxDialog(parent, -1, _("Options"), bpos, wxSize(220, 195),
DIALOG_STYLE)
{
wxPoint pos;
m_Parent = parent;
SetFont(*g_DialogFont);
pos.x = 100; pos.y = 15;
new wxButton(this, ID_SAVE_CONFIG, _("Save Cfg"), pos);
pos.x = 10; pos.y = 10;
IsShowPadFill = new wxMyCheckBox(this,
PADFILL_OPT,
_("&Pad Fill"),
&DisplayOpt.DisplayPadFill, pos);
pos.y += 20;
IsShowPadNum = new wxMyCheckBox(this,
PADNUM_OPT,
_("Pad &Num"),
&DisplayOpt.DisplayPadNum, pos);
pos.y += 25;
wxString DrawOpt[] = { _("&Filaire"), _("&Filled"), _("&Sketch")};
EdgeRadioBox = new wxRadioBox(this, EDGE_SELECT,
_("Edges:"),
pos, wxSize(-1,-1),
3,DrawOpt,1,wxRA_SPECIFY_COLS);
EdgeRadioBox->SetSelection(DisplayOpt.DisplayModEdge);
pos.x += 100;
TextRadioBox = new wxRadioBox(this, TEXT_SELECT,
_("Texts:"),
pos,wxSize(-1,-1),
3, DrawOpt, 1,wxRA_SPECIFY_COLS);
TextRadioBox->SetSelection(DisplayOpt.DisplayModText);
}
/*****************************/
/* Destructeur de OptionsBox */
/*****************************/
wxOptionsBox::~wxOptionsBox(void)
{
}
/**************************************/
/* Fonctions de base de wxMyDialogBox */
/**************************************/
/*******************************/
bool wxOptionsBox::OnClose(void)
/*******************************/
{
Show(FALSE);
return TRUE;
}
/****************************************************************/
void wxOptionsBox::ReturnDisplayEdgeFormat(wxCommandEvent& event)
/****************************************************************/
{
DisplayOpt.DisplayModEdge = m_Parent->m_DisplayModEdge = EdgeRadioBox->GetSelection();
m_Parent->ReDrawPanel();
}
/****************************************************************/
void wxOptionsBox::ReturnDisplayTexteFormat(wxCommandEvent& event)
/****************************************************************/
{
DisplayOpt.DisplayModText = m_Parent->m_DisplayModText = TextRadioBox->GetSelection();
m_Parent->ReDrawPanel();
}
/***************************************************/
void wxOptionsBox::SaveConfig(wxCommandEvent& event)
/***************************************************/
{
Save_Config(this);
}

View File

@ -1,320 +0,0 @@
/************/
/* rdorcad()*/
/************/
/* convertit la netliste ORCADPCB en netliste ORCADPCB (fichier temporaire)
assure la raffectation des alimentations selon le format :
( XXXXXX VALEUR|(pin1,pin2,...=newalim) ID VALEUR
*/
#include "fctsys.h"
#include "wxstruct.h"
#include "common.h"
#include "cvpcb.h"
#include "protos.h"
#define SEPARATEUR '|' /* caractere separateur dans netliste */
/* routines locales : */
int pin_orcad(STORECMP * CurrentCmp);
/****************************************/
/* int WinEDA_CvpcbFrame::rdorcad(void) */
/****************************************/
int WinEDA_CvpcbFrame::rdorcad(void)
{
int i , j , k ,l ;
char * LibName;
char Line[1024];
int FlagEESchema = 0;
char label[80] ; /* buffer des references composants */
char ref_schema[80] ; /* buffer de la ref schematique */
char val[80] ; /* buffer des valeurs/ref.lib */
char postval[80] ; /* buffer de la valeur de fin de ligne (vraie valeur) */
char *ptchar ; /* pointeur de service */
STORECMP * Cmp;
modified = 0;
Rjustify = 0;
/* Raz buffer et variable de gestion */
if( BaseListeCmp ) FreeMemoryComponants();
/* Ouverture du fichier source */
source = wxFopen(FFileName, wxT("rt"));
if (source == 0)
{
wxString msg;
msg.Printf( _("File <%s> not found"),FFileName.GetData());
DisplayError(this, msg); return(-1);
}
/* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" ) */
/* or "# EESchema Netliste"*/
fgets(Line,255,source) ;
/* test for netlist type PCB2 */
i = strnicmp(Line,"( {",3) ;
if( i != 0 )
i = strnicmp(Line,"({",2) ;
if( i != 0 )
{
i = strnicmp(Line,"# EESchema",7) ; /* net type EESchema */
if( i == 0 ) FlagEESchema = 1;
}
if ( i != 0 )
{
wxString msg, Lineconv = CONV_FROM_UTF8(Line);
msg.Printf( _("Unknown file format <%s>"), Lineconv.GetData());
DisplayError(this, msg);
fclose(source); return(-3) ;
}
SetStatusText( _("Netlist Format: EESchema"), 0);
/* Lecture de la liste */
for (;;)
{
/* recherche du debut de la description d'un composant */
if( fgets(Line,80,source) == 0 ) break;
/* suppression des blancs en dbut de ligne */
i = 0 ; while (Line[i] == ' ') i++ ;
/* elimination des lignes vides : */
if (Line[i] < ' ') continue ;
if (strnicmp(&Line[i],"( ",2) != 0) continue ;
/****************************/
/* debut description trouve */
/****************************/
/* memo ident schema */
while ( Line[i] != ' ') i++ ;
while ( Line[i] == ' ') i++ ; /* i pointe 1er caractere de l'ident schema */
j = 0 ; while ( Line[i] != ' ') ref_schema[j++] = Line[i++] ;
ref_schema[j] = 0 ;
/* recherche val/ref.lib */
while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */
LibName = Line + i;
memset(label, 0, sizeof(label));
memset(val, 0, sizeof(val) ) ;
memset(postval, 0, sizeof(postval) ) ;
memset(alim, 0, sizeof(alim) ) ;
/* lecture valeur du composant */
/* recherche fin de valeur (' ') */
ptchar = strstr(&Line[i]," ") ;
if (ptchar == 0)
{
wxString msg;
msg.Printf( _("Netlist error: %s"),Line) ;
DisplayError(NULL, msg);
k = 0 ;
}
else k = ptchar - Line ;
for (j = 0 ; i < k ; i++)
{
if ( Line[i] == SEPARATEUR ) break ;
if ( j < 8 ) val[j++] = Line[i] ;
}
if ( (Line[++i] == '(') && (Line[k-1] == ')' ) )
{
i++ ; l = 0 ; while ( k-1 > i ) alim[l++] = Line[i++] ;
}
else i = k ;
/* recherche reference du composant */
while(Line[i] != ' ') i++ ; /* elimination fin valeur */
while(Line[i] == ' ') i++ ; /* recherche debut reference */
/* debut reference trouv */
for ( k = 0 ; k < 8 ; i++ , k++ )
{
if ( Line[i] <= ' ' ) break ;
label[k] = Line[i] ;
}
/* recherche vraie valeur du composant */
while(Line[i] != ' ') i++ ; /* elimination fin reference */
while(Line[i] == ' ') i++ ; /* recherche debut vraie valeur */
/* debut vraie valeur trouve */
for ( k = 0 ; k < 16 ; i++ , k++ )
{
if ( Line[i] <= ' ' ) break ;
postval[k] = Line[i] ;
}
/* classement du composant ,suivi de sa valeur */
Cmp = new STORECMP();
Cmp->Pnext = BaseListeCmp;
BaseListeCmp = Cmp;
Cmp->m_Reference = CONV_FROM_UTF8(label);
Cmp->m_Valeur = CONV_FROM_UTF8(postval) ;
if( FlagEESchema ) /* Copie du nom module: */
{
if( strnicmp(LibName, "$noname", 7 ) != 0 )
{
while( *LibName > ' ' )
{
Cmp->m_Module.Append(*LibName);
LibName++;
}
}
}
/* classement du TimeStamp */
Cmp->m_TimeStamp = CONV_FROM_UTF8(ref_schema);
pin_orcad( Cmp) ;
nbcomp++ ;
}
fclose(source);
/* reclassement alpabtique : */
BaseListeCmp = TriListeComposantss( BaseListeCmp, nbcomp);
return(0);
}
/***********************************/
int pin_orcad(STORECMP * Cmp)
/***********************************/
{
int i , jj;
char numpin[9] , net[1024] ;
char Line[1024];
STOREPIN * Pin = NULL;
STOREPIN ** LastPin = & Cmp->m_Pins;
for ( ;; )
{
/* debut description trouv */
for ( ;; )
{
if ( fgets(Line,80,source) == 0 ) return(-1) ;
/* suppression des blancs en dbut de ligne */
i = 0 ; while (Line[i] == ' ') i++ ;
while (Line[i] == '(') i++ ;
while (Line[i] == ' ') i++ ;
/* elimination des lignes vides : */
if (Line[i] < ' ') continue ;
/* fin de description ? */
if (Line[i] == ')' ) return(0) ;
memset( net, 0, sizeof(net) );
memset( numpin, 0, sizeof(numpin) );
/* lecture name pin , 4 lettres */
for (jj = 0 ; jj < 4 ; jj++ , i++)
{
if ( Line[i] == ' ' ) break ;
numpin[jj] = Line[i] ;
}
/* recherche affectation force de net */
if ( reaffect(numpin,net) != 0)
{
Pin = new STOREPIN();
*LastPin = Pin; LastPin = &Pin->Pnext;
Pin->m_PinNum = CONV_FROM_UTF8(numpin);
Pin->m_PinNet = CONV_FROM_UTF8(net);
continue ;
}
/* recherche netname */
while(Line[i] == ' ') i++ ; /* recherche debut reference */
/* debut netname trouv */
for ( jj = 0 ; jj < (int)sizeof(net)-1 ; i++ , jj++ )
{
if ( Line[i] <= ' ' ) break ;
net[jj] = Line[i] ;
}
Pin = new STOREPIN();
*LastPin = Pin; LastPin = &Pin->Pnext;
Pin->m_PinNum = CONV_FROM_UTF8(numpin);
Pin->m_PinNet = CONV_FROM_UTF8(net);
}
}
}
/****************************************************************/
STORECMP * TriListeComposantss(STORECMP * BaseListe, int nbitems)
/****************************************************************/
/* Tri la liste des composants par ordre alphabetique et me a jour
le nouveau chainage avant/arriere
retourne un pointeur sur le 1er element de la liste
*/
{
STORECMP ** bufferptr, * Item;
int ii;
if (nbitems <= 0 ) return(NULL);
bufferptr = (STORECMP**)MyZMalloc( (nbitems+2) * sizeof(STORECMP*) );
for( ii= 1, Item = BaseListe; Item != NULL; Item = Item->Pnext, ii++)
{
bufferptr[ii] = Item;
}
/* ici bufferptr[0] = NULL et bufferptr[nbitem+1] = NULL et ces 2 valeurs
representent le chainage arriere du 1er element, et le chainage avant
du dernier element */
qsort(bufferptr+1,nbitems,sizeof(STORECMP*),
(int(*)(const void*,const void*))CmpCompare) ;
/* Mise a jour du chainage */
for( ii = 1; ii <= nbitems; ii++ )
{
Item = bufferptr[ii];
Item->m_Num = ii;
Item->Pnext = bufferptr[ii+1];
Item->Pback = bufferptr[ii-1];
}
return(bufferptr[1]);
}
/****************************************/
int CmpCompare(void * mod1, void * mod2)
/****************************************/
/*
routine compare() pour qsort() en classement alphabetique des composants
*/
{
int ii;
STORECMP *pt1 , *pt2 ;
pt1 = * ((STORECMP**)mod1);
pt2 = * ((STORECMP**)mod2);
//FIXME:
ii = StrNumICmp( (const wxChar*) pt1->m_Reference, (const wxChar*) pt2->m_Reference );
return(ii);
}

View File

@ -29,10 +29,10 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist(void)
int i , j , k ,l ;
char * LibName;
char Line[1024];
char label[80] ; /* buffer des references composants */
char ref_schema[80] ; /* buffer de la ref schematique */
char val[80] ; /* buffer des valeurs/ref.lib */
char postval[80] ; /* buffer de la valeur de fin de ligne (vraie valeur) */
char component_reference[80] ; /* buffer des references composants */
char ref_schema[80] ; /* buffer de la ref schematique */
char footprint_name[80] ; /* buffer des ref.lib */
char component_value[80] ; /* buffer des valeurs */
char *ptchar ; /* pointeur de service */
STORECMP * Cmp;
@ -111,9 +111,9 @@ STORECMP * Cmp;
while ( Line[i] == ' ') i++ ; /* i pointe la valeur du composant */
LibName = Line + i;
memset(label, 0, sizeof(label));
memset(val, 0, sizeof(val) ) ;
memset(postval, 0, sizeof(postval) ) ;
memset(component_reference, 0, sizeof(component_reference));
memset(footprint_name, 0, sizeof(footprint_name) ) ;
memset(component_value, 0, sizeof(component_value) ) ;
memset(alim, 0, sizeof(alim) ) ;
/* lecture valeur du composant */
@ -131,8 +131,9 @@ STORECMP * Cmp;
for (j = 0 ; i < k ; i++)
{
if ( Line[i] == SEPARATEUR ) break ;
if ( j < 8 ) val[j++] = Line[i] ;
if ( Line[i] == SEPARATEUR ) break ;
if ( j < (int)(sizeof(footprint_name)-1) )
footprint_name[j++] = Line[i] ;
}
if ( (Line[++i] == '(') && (Line[k-1] == ')' ) )
@ -147,21 +148,20 @@ STORECMP * Cmp;
while(Line[i] == ' ') i++ ; /* recherche debut reference */
/* debut reference trouv */
for ( k = 0 ; k < 8 ; i++ , k++ )
for ( k = 0 ; k < (int)(sizeof(component_reference)-1) ; i++ , k++ )
{
if ( Line[i] <= ' ' ) break ;
label[k] = Line[i] ;
component_reference[k] = Line[i] ;
}
/* recherche vraie valeur du composant */
while(Line[i] != ' ') i++ ; /* elimination fin reference */
while(Line[i] == ' ') i++ ; /* recherche debut vraie valeur */
/* recherche valeur du composant */
while(Line[i] == ' ') i++ ; /* recherche debut valeur */
/* debut vraie valeur trouve */
for ( k = 0 ; k < 16 ; i++ , k++ )
/* debut vraie valeur trouvee */
for ( k = 0 ; k < (int)(sizeof(component_value)-1) ; i++ , k++ )
{
if ( Line[i] <= ' ' ) break ;
postval[k] = Line[i] ;
component_value[k] = Line[i] ;
}
@ -169,8 +169,8 @@ STORECMP * Cmp;
Cmp = new STORECMP();
Cmp->Pnext = g_BaseListeCmp;
g_BaseListeCmp = Cmp;
Cmp->m_Reference = CONV_FROM_UTF8(label);
Cmp->m_Valeur = CONV_FROM_UTF8(postval) ;
Cmp->m_Reference = CONV_FROM_UTF8(component_reference);
Cmp->m_Valeur = CONV_FROM_UTF8(component_value) ;
if( g_FlagEESchema ) /* Copie du nom module: */
{

View File

@ -5,7 +5,7 @@
COMMON_GLOBL wxString g_BuildVersion
#ifdef EDA_BASE
(wxT("(2007-07-09)"))
(wxT("(2007-07-24)"))
#endif
;

View File

@ -12,17 +12,17 @@ enum main_id {
ID_PROJECT_TREE_REFRESH,
ID_PROJECT_RUNPY,
ID_PROJECT_NEWFILE,
ID_PROJECT_NEWSCH,
ID_PROJECT_NEWBRD,
ID_PROJECT_UNUSED0,
ID_PROJECT_UNUSED1,
ID_PROJECT_NEWPY,
ID_PROJECT_NEWGERBER,
ID_PROJECT_UNUSED2,
ID_PROJECT_NEWTXT,
ID_PROJECT_NEWNET,
ID_PROJECT_UNUSED3,
ID_PROJECT_NEWDIR,
ID_PROJECT_DELETE,
ID_PROJECT_RENAME,
ID_PROJECT_UNUSED0,
ID_PROJECT_UNUSED1,
ID_PROJECT_OPEN_FILE_WITH_TEXT_EDITOR,
ID_PROJECT_UNUSED4,
ID_MAIN_COMMAND,
ID_TO_EDITOR,

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -23,10 +23,6 @@
#include "bitmaps/icon_gerbview_small.xpm"
#include "bitmaps/icon_cvpcb_small.xpm"
#include "bitmaps/unknown.xpm"
//#include "bitmaps/new_gerb.xpm"
//#include "bitmaps/new_pcb.xpm"
//#include "bitmaps/new_sch.xpm"
//#include "bitmaps/new_cvpcb.xpm"
#include "id.h"

View File

@ -20,7 +20,9 @@
#include "wx/dir.h"
#include "bitmaps.h"
#ifdef KICAD_PYTHON
#include "bitmaps/new_python.xpm"
#endif
#include "id.h"
@ -68,7 +70,7 @@ WinEDA_PrjFrame::WinEDA_PrjFrame(WinEDA_MainFrame * parent,
item = new wxMenuItem(menu, ID_PROJECT_TXTEDIT,
_("&Edit in a text editor"),
_("Edit the Python Script in a Text Editor") );
_("&Open the file in a Text Editor") );
item->SetBitmap( icon_txt_xpm );
menu->Append( item );
@ -110,6 +112,14 @@ WinEDA_PrjFrame::WinEDA_PrjFrame(WinEDA_MainFrame * parent,
, TREE_DIRECTORY != i ? _("Rename the File") : _("&Rename the Directory") );
item->SetBitmap( right_xpm );
menu->Append( item );
if ( TREE_DIRECTORY != i )
{
item = new wxMenuItem(menu, ID_PROJECT_TXTEDIT
, _("&Edit in a text editor")
, _("Open the file in a Text Editor"));
item->SetBitmap( icon_txt_xpm );
menu->Append( item );
}
item = new wxMenuItem(menu, ID_PROJECT_DELETE
, TREE_DIRECTORY != i ? _("&Delete File") : _("&Delete Directory")
, TREE_DIRECTORY != i ? _("Delete the File") : _("&Delete the Directory and its content") );
@ -132,12 +142,8 @@ BEGIN_EVENT_TABLE(WinEDA_PrjFrame, wxSashLayoutWindow)
EVT_MENU(ID_PROJECT_TXTEDIT, WinEDA_PrjFrame::OnTxtEdit)
EVT_MENU(ID_PROJECT_NEWFILE, WinEDA_PrjFrame::OnNewFile)
EVT_MENU(ID_PROJECT_NEWDIR, WinEDA_PrjFrame::OnNewDirectory)
EVT_MENU(ID_PROJECT_NEWSCH, WinEDA_PrjFrame::OnNewSchFile)
EVT_MENU(ID_PROJECT_NEWBRD, WinEDA_PrjFrame::OnNewBrdFile)
EVT_MENU(ID_PROJECT_NEWPY, WinEDA_PrjFrame::OnNewPyFile)
EVT_MENU(ID_PROJECT_NEWGERBER, WinEDA_PrjFrame::OnNewGerberFile)
EVT_MENU(ID_PROJECT_NEWTXT, WinEDA_PrjFrame::OnNewTxtFile)
EVT_MENU(ID_PROJECT_NEWNET, WinEDA_PrjFrame::OnNewNetFile)
EVT_MENU(ID_PROJECT_DELETE, WinEDA_PrjFrame::OnDeleteFile)
EVT_MENU(ID_PROJECT_RENAME, WinEDA_PrjFrame::OnRenameFile)
@ -312,12 +318,8 @@ wxMenu * WinEDA_PrjFrame::GetContextMenu( int type )
void WinEDA_PrjFrame::OnNewDirectory(wxCommandEvent & event) { NewFile( TREE_DIRECTORY ); }
void WinEDA_PrjFrame::OnNewFile(wxCommandEvent & event) { NewFile( TREE_UNKNOWN ); }
void WinEDA_PrjFrame::OnNewSchFile(wxCommandEvent & event) { NewFile( TREE_SCHEMA ); }
void WinEDA_PrjFrame::OnNewBrdFile(wxCommandEvent & event) { NewFile( TREE_PCB ); }
void WinEDA_PrjFrame::OnNewPyFile(wxCommandEvent & event) { NewFile( TREE_PY ); }
void WinEDA_PrjFrame::OnNewGerberFile(wxCommandEvent & event) { NewFile( TREE_GERBER ); }
void WinEDA_PrjFrame::OnNewTxtFile(wxCommandEvent & event) { NewFile( TREE_TXT ); }
void WinEDA_PrjFrame::OnNewNetFile(wxCommandEvent & event) { NewFile( TREE_NET ); }
/******************************************************************/
void WinEDA_PrjFrame::NewFile( enum TreeFileType type )
@ -393,30 +395,48 @@ void WinEDA_PrjFrame::NewFile( const wxString & name,
wxString WinEDA_PrjFrame::GetFileExt( enum TreeFileType type )
/******************************************************************/
{
wxString extensions[] =
{
wxT( "" ), // 0 is not used
wxT( ".pro" ), // TREE_PROJECT
g_SchExtBuffer, // TREE_SCHEMA
g_BoardExtBuffer, // TREE_PCB
wxT( ".py" ), // TREE_PY
g_GerberExtBuffer, // TREE_GERBER
wxT( ".pdf" ), // TREE_PDF
wxT( ".txt" ), // TREE_TXT
wxT( ".net" ), // TREE_NET
wxT( "" ), // TREE_UNKNOWN
wxT( "" ), // TREE_DIRECTORY
wxString ext;
switch ( type )
{
case 0 :
break; // 0 is not used
case TREE_PROJECT:
ext = wxT( ".pro" );
break;
case TREE_SCHEMA:
ext = g_SchExtBuffer;
break;
case TREE_PCB:
ext = g_BoardExtBuffer;
break;
case TREE_PY:
ext = wxT( ".py" );
break;
case TREE_GERBER:
ext = g_GerberExtBuffer;
break;
case TREE_PDF:
ext = wxT( ".pdf" );
break;
case TREE_TXT:
ext = wxT( ".txt" );
break;
case TREE_NET:
ext = wxT( ".net" );
break;
default:
break;
};
if ( type < TREE_MAX ) return extensions[type];
return wxEmptyString;
return ext;
}
/**************************************************************************/
void WinEDA_PrjFrame::AddFile( const wxString & name, wxTreeItemId & root )
/**************************************************************************/
/* add filename "name" to the tree
if name is adirectory, add the sub directory file names
if name is a directory, add the sub directory file names
*/
{
wxTreeItemId cellule;

View File

@ -17,7 +17,7 @@ KICAD_BIN = /f/kicad/winexe
#Define the wxWidget path (if not found in environment variables):
ifndef WXWIN
WXWIN=/f/wxMSW-2.8.4
WXWIN=f:/wxMSW-2.8.4
endif
LIBVERSION = 2.8

View File

@ -17,7 +17,7 @@
; General Product Description Definitions
!define PRODUCT_NAME "KiCad"
!define PRODUCT_VERSION "2007.05.25"
!define PRODUCT_VERSION "2007.07.09"
!define PRODUCT_WEB_SITE "http://www.lis.inpg.fr/realise_au_lis/kicad/"
!define COMPANY_NAME ""
!define TRADE_MARKS ""

View File

@ -78,7 +78,7 @@ void D_PAD::ComputeRayon(void)
}
/*********************************************/
const wxPoint D_PAD::ReturnShapePos(void) const
const wxPoint D_PAD::ReturnShapePos(void)
/*********************************************/
// retourne la position de la forme (pastilles excentrees)
{

View File

@ -76,7 +76,7 @@ public:
wxString ReturnStringPadName(void); // Return pad name as string in a wxString
void ReturnStringPadName(wxString & text); // Return pad name as string in a buffer
void ComputeRayon(void); // met a jour m_Rayon, rayon du cercle exinscrit
const wxPoint ReturnShapePos(void) const; // retourne la position
const wxPoint ReturnShapePos(void); // retourne la position
// de la forme (pastilles excentrees)
void Display_Infos(WinEDA_BasePcbFrame * frame);
};

View File

@ -125,6 +125,7 @@ public:
////@end WinEDA_DrcFrame member variables
WinEDA_PcbFrame * m_Parent;
wxDC * m_DC;
int m_UnconnectedCount;
};
#endif

View File

@ -1,7 +1,6 @@
/*******************************/
/* Edition des pistes */
/* Routines DRC */
/*******************************/
/****************************/
/* DRC control */
/****************************/
#include "fctsys.h"
#include "gr_basic.h"
@ -28,7 +27,7 @@ static int segm_long; // longueur du segment de reference
static int xcliplo,ycliplo,xcliphi,ycliphi ; /* coord de la surface de securite du segment a comparer */
/* Routines Locales */
static int Pad_to_Pad_Isol(const D_PAD * pad_ref, const D_PAD * pad, const int dist_min);
static int Pad_to_Pad_Isol(D_PAD * pad_ref, D_PAD * pad, const int dist_min);
static bool TestPadDrc(WinEDA_BasePcbFrame *frame, wxDC * DC, D_PAD * pad_ref,
LISTE_PAD * start_buffer, LISTE_PAD * end_buffer, int max_size, bool show_err);
static int distance_a_pad(const D_PAD* pad_to_test, int seg_width, int isol);
@ -37,7 +36,7 @@ static int Tst_Ligne(int x1,int y1,int x2,int y2);
static void Affiche_Erreur_DRC(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb,
TRACK * pt_ref, void * pt_item, int errnumber);
static void Affiche_Erreur_DRC(WinEDA_DrawPanel * panel, wxDC * DC,
BOARD * Pcb, const D_PAD * pad1, const D_PAD * pad2);
BOARD * Pcb, D_PAD * pad1, D_PAD * pad2);
@ -51,9 +50,9 @@ void WinEDA_DrcFrame::ListUnconnectedPads(wxCommandEvent & event)
/***************************************************************/
{
if( (m_Parent->m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
{
{
m_Parent->Compile_Ratsnest( m_DC, TRUE);
}
}
if( m_Parent->m_Pcb->m_Ratsnest == NULL ) return;
CHEVELU* Ratsnest = m_Parent->m_Pcb->m_Ratsnest;
@ -62,23 +61,34 @@ WinEDA_DrawPanel * panel = m_Parent->DrawPanel;
int ii;
wxString msg;
float convert = 0.0001;
int unconnect = 0;
for( ii = m_Parent->m_Pcb->GetNumRatsnests() ;ii > 0; Ratsnest++, ii--)
{
if( (Ratsnest->status & CH_ACTIF) == 0) continue;
unconnect++;
Ratsnest->pad_start->Draw(panel, m_DC, wxPoint(0,0),draw_mode);
Ratsnest->pad_end->Draw(panel, m_DC, wxPoint(0,0),draw_mode);
msg.Printf(_("Unconnected:\nPad @ %.4f,%.4f and\nPad @ %.4f,%.4f\n"),
Ratsnest->pad_start->m_Pos.x * convert, Ratsnest->pad_start->m_Pos.y * convert,
Ratsnest->pad_end->m_Pos.x * convert, Ratsnest->pad_end->m_Pos.y * convert);
m_logWindow->AppendText(msg);
}
if ( unconnect ) msg.Printf(_("Active routes: %d\n"), unconnect);
else msg = _("OK! (No unconnect)\n");
m_logWindow->AppendText(_("Look for active routes\n"));
m_UnconnectedCount = 0;
for( ii = m_Parent->m_Pcb->GetNumRatsnests() ;ii > 0; Ratsnest++, ii--)
{
if( (Ratsnest->status & CH_ACTIF) == 0) continue;
m_UnconnectedCount++;
if ( m_UnconnectedCount == 1 ) m_logWindow->AppendText(_("Unconnected found:\n") );
D_PAD * pad = Ratsnest->pad_start;
pad->Draw(panel, m_DC, wxPoint(0,0),draw_mode);
wxString pad_name = pad->ReturnStringPadName();
wxString module_name = ((MODULE*)(pad->m_Parent))->m_Reference->m_Text;
msg.Printf(_("%d > Pad %s (%s) @ %.4f,%.4f and "), m_UnconnectedCount,
pad_name.GetData(), module_name.GetData(), pad->m_Pos.x * convert, pad->m_Pos.y * convert);
m_logWindow->AppendText(msg);
pad = Ratsnest->pad_end;
pad->Draw(panel, m_DC, wxPoint(0,0),draw_mode);
pad_name = pad->ReturnStringPadName();
module_name = ((MODULE*)(pad->m_Parent))->m_Reference->m_Text;
msg.Printf(_("Pad %s (%s) @ %.4f,%.4f\n"),
pad_name.GetData(), module_name.GetData(), pad->m_Pos.x * convert, pad->m_Pos.y * convert);
m_logWindow->AppendText(msg);
}
if ( m_UnconnectedCount ) msg.Printf(_("Active routes: %d\n"), m_UnconnectedCount);
else msg = _("OK! (No active routes)\n");
m_logWindow->AppendText(msg);
m_logWindow->AppendText(_("End tst"));
}
@ -94,10 +104,14 @@ wxString msg;
m_logWindow->Clear();
g_DesignSettings.m_TrackClearence =
ReturnValueFromTextCtrl(*m_SetClearance, m_Parent->m_InternalUnits);
/* Test DRC errors (clearance errors, bad connections .. */
errors = m_Parent->Test_DRC(m_DC);
/* Serach for active routes (unconnected pads) */
ListUnconnectedPads(event);
if ( errors )
msg.Printf(_("** End Drc: %d errors **\n"),errors);
else msg = _("** End Drc: No Error **\n");
else if ( m_UnconnectedCount == 0 )
msg = _("** End Drc: No Error **\n");
m_logWindow->AppendText(msg);
}
else wxBell();
@ -655,7 +669,7 @@ LISTE_PAD * pad_list = start_buffer;
}
/**************************************************************************************/
static int Pad_to_Pad_Isol(const D_PAD * pad_ref, const D_PAD * pad, const int dist_min)
static int Pad_to_Pad_Isol(D_PAD * pad_ref, D_PAD * pad, const int dist_min)
/***************************************************************************************/
/* Return OK_DRC si distance entre pad_ref et pas >= dist_min
et BAD_DRC sinon */
@ -922,45 +936,49 @@ static void Affiche_Erreur_DRC(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb,
number = numero d'identification
*/
{
int ercx, ercy;
D_PAD * pt_pad;
wxPoint erc_pos;
D_PAD * pad;
TRACK * pt_segm;
wxString msg;
if( ((EDA_BaseStruct*)pt_item)->m_StructType == TYPEPAD )
{
pt_pad = (D_PAD*) pt_item;
ercx = pt_pad->m_Pos.x; ercy = pt_pad->m_Pos.y;
msg.Printf(_("%d Err type %d sur PAD @ %d,%d\n"),
NumberOfErrors, errnumber, ercx,ercy);
}
{
pad = (D_PAD*) pt_item;
erc_pos = pad->m_Pos;
wxString pad_name = pad->ReturnStringPadName();
wxString module_name = ((MODULE*)(pad->m_Parent))->m_Reference->m_Text;
msg.Printf(_("%d Drc Err %d PAD %s (%s) @ %d,%d\n"),
NumberOfErrors, errnumber,
pad_name.GetData(), module_name.GetData(),
erc_pos.x, erc_pos.y);
}
else /* erreur sur segment de piste */
{
{
pt_segm = (TRACK *) pt_item;
ercx = pt_segm->m_Start.x; ercy = pt_segm->m_Start.y;
erc_pos = pt_segm->m_Start;
if(pt_segm->m_StructType == TYPEVIA)
{
{
msg.Printf(_("%d Err type %d: sur VIA @ %d,%d\n"),
NumberOfErrors, errnumber,ercx,ercy);
}
else
{
int ercfx = pt_segm->m_End.x, ercfy = pt_segm->m_End.y;
if(hypot( (double)(ercfx - pt_ref->m_End.x),(double)(ercfy - pt_ref->m_End.y) )
< hypot( (double)(ercx - pt_ref->m_End.x),(double)(ercy - pt_ref->m_End.y) ) )
{
EXCHG(ercfx, ercx); EXCHG(ercfy, ercy);
}
msg.Printf(_("%d Err type %d: sur SEGMENT @ %d,%d\n"),
NumberOfErrors, errnumber,ercx,ercy);
}
NumberOfErrors, errnumber,erc_pos.x,erc_pos.y);
}
else
{
wxPoint erc_pos_f = pt_segm->m_End;
if(hypot( (double)(erc_pos_f.x - pt_ref->m_End.x),(double)(erc_pos_f.y - pt_ref->m_End.y) )
< hypot( (double)(erc_pos.x - pt_ref->m_End.x),(double)(erc_pos.y - pt_ref->m_End.y) ) )
{
EXCHG(erc_pos_f.x, erc_pos.x); EXCHG(erc_pos_f.y, erc_pos.y);
}
msg.Printf(_("%d Err type %d: sur SEGMENT @ %d,%d\n"),
NumberOfErrors, errnumber,erc_pos.x,erc_pos.y);
}
}
if ( DrcFrame ) DrcFrame->m_logWindow->AppendText(msg);
else panel->m_Parent->Affiche_Message(msg);
if(current_marqueur == NULL) current_marqueur = new MARQUEUR(Pcb);
current_marqueur->m_Pos = wxPoint(ercx, ercy);
current_marqueur->m_Pos = wxPoint(erc_pos.x, erc_pos.y);
current_marqueur->m_Color = WHITE;
current_marqueur->m_Diag = msg;
current_marqueur->Draw(panel, DC, GR_OR);
@ -969,7 +987,7 @@ wxString msg;
/******************************************************************************/
static void Affiche_Erreur_DRC(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb,
const D_PAD * pad1, const D_PAD * pad2)
D_PAD * pad1, D_PAD * pad2)
/******************************************************************************/
/* affiche les erreurs de DRC :
@ -979,18 +997,21 @@ static void Affiche_Erreur_DRC(WinEDA_DrawPanel * panel, wxDC * DC, BOARD * Pcb,
number = numero d'identification
*/
{
int ercx, ercy;
wxString msg;
ercx = pad1->m_Pos.x; ercy = pad1->m_Pos.y;
msg.Printf( _("%d Err pad to pad (PAD @ %d,%d and PAD @ %d,%d\n"),
NumberOfErrors, ercx,ercy,
pad2->m_Pos.x, pad2->m_Pos.y);
wxString pad_name1 = pad1->ReturnStringPadName();
wxString module_name1 = ((MODULE*)(pad1->m_Parent))->m_Reference->m_Text;
wxString pad_name2 = pad2->ReturnStringPadName();
wxString module_name2 = ((MODULE*)(pad2->m_Parent))->m_Reference->m_Text;
msg.Printf( _("%d Drc Err: PAD %s (%s) @ %d,%d and PAD %s (%s) @ %d,%d\n"),
NumberOfErrors, pad_name1.GetData(), module_name1.GetData(), pad1->m_Pos.x,pad1->m_Pos.y,
pad_name2.GetData(), module_name2.GetData(), pad2->m_Pos.x, pad2->m_Pos.y);
if ( DrcFrame ) DrcFrame->m_logWindow->AppendText(msg);
else panel->m_Parent->Affiche_Message(msg);
if(current_marqueur == NULL) current_marqueur = new MARQUEUR(Pcb);
current_marqueur->m_Pos = wxPoint(ercx, ercy);
current_marqueur->m_Pos = pad1->m_Pos;
current_marqueur->m_Color = WHITE;
current_marqueur->m_Diag = msg;
current_marqueur->Draw(panel, DC, GR_OR);

View File

@ -149,143 +149,77 @@ wxClientDC dc(DrawPanel);
if ( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
break;
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:{
// update modules in the current board,
// not just add it to the board with total disregard for the
// netlist...?
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame;
BOARD * mainpcb = pcbframe->m_Pcb;
MODULE * presmod = m_Pcb->m_Modules; //the module being edited.
//i guess we need to search through the modules here.. they are in a linked list.
//replace based on m_libref?
MODULE* mod = mainpcb->m_Modules;
do{
//need to be careful in this doubly linked-list to maintain order & link
// also have to maintain netname on all the pads according to m_NumPadName.
if(mod->m_LibRef == presmod->m_LibRef){//have to be careful with this test of similarity?
wprintf(L"replace: mod->m_LibRef = %S @ %d %d orient: %d\n", mod->m_LibRef.c_str(),
mod->m_Pos.x, mod->m_Pos.y, mod->m_Orient);
MODULE* newmod = new MODULE(mainpcb);
newmod->Copy(presmod); //this will copy the padstack layers etc
newmod->m_Parent = mainpcb; //modify after the copy above
if(mod->m_Layer != CMP_N){//just changing m_Layer is insufficient.
Change_Side_Module(newmod, &dc);
}
newmod->m_Pos = mod->m_Pos;
newmod->m_Orient =0; //otherwise the pads will be rotated with respect to the module.
//copy data into the pads...
D_PAD* newpad = newmod->m_Pads;
for(; newpad != NULL; newpad = (D_PAD*)newpad->Pnext){
D_PAD* pad = mod->m_Pads;
for(; pad != NULL; pad = (D_PAD*)pad->Pnext){
if(pad->m_NumPadName == newpad->m_NumPadName){
wprintf(L" pad->NumPadName %d @ %d %d :new %d %d, orient: %d\n", pad->m_NumPadName,
pad->m_Pos.x, pad->m_Pos.y, newpad->m_Pos.x, newpad->m_Pos.y, pad->m_Orient);
wprintf(L" pad->m_Netname %S\n", pad->m_Netname.c_str());
newpad->m_Netname = pad->m_Netname;
newpad->m_NetCode = pad->m_NetCode;
newpad->m_logical_connexion = pad->m_logical_connexion;
newpad->m_physical_connexion = pad->m_physical_connexion;
newpad->m_Pos.x += newmod->m_Pos.x; //the pad positions are apparently in global coordinates.
newpad->m_Pos.y += newmod->m_Pos.y;
newpad->m_Orient = pad->m_Orient;
}
}
}
//not sure what to do about m_Drawings..assume they are ok?
//copy only the text in m_Ref and m_Val;
//leave the size and position as in the module in edit.
newmod->m_Reference->m_Text = mod->m_Reference->m_Text;
newmod->m_Value->m_Text = mod->m_Value->m_Text;
wprintf(L"replace: mod->m_Reference = %S\n", newmod->m_Reference->m_Text.c_str());
wprintf(L"replace: mod->m_Value = %S\n", newmod->m_Value->m_Text.c_str());
newmod->m_Attributs = mod->m_Attributs;
newmod->m_Orient = mod->m_Orient;
newmod->flag = mod->flag;
newmod->m_Flags = 0; //inherited from EDA_BaseStruct.
newmod->m_ModuleStatus = mod->m_ModuleStatus;
//redo the boundary boxes
newmod->Set_Rectangle_Encadrement();
newmod->SetRectangleExinscrit();
newmod->m_CntRot90 = mod->m_CntRot90;
newmod->m_CntRot180 = mod->m_CntRot180;
newmod->m_Surface = mod->m_Surface;
pcbframe->Rotate_Module(NULL, newmod, mod->m_Orient, false);
//now, need to replace 'mod' in the linked list with 'newmod'.
//this does not seem to be working correctly..
MODULE* oldmod = mod;
mod = (MODULE*)mod->Pnext;
oldmod->UnLink();
delete oldmod;
//insert the new one.
newmod->Pnext = mainpcb->m_Modules;
mainpcb->m_Modules->Pback = newmod; // check this!
mainpcb->m_Modules = newmod;
newmod->Pback = mainpcb;
wprintf(L"-----\n");
}else{
mod = (MODULE*)mod->Pnext;
}
}while(mod != NULL);
GetScreen()->ClrModify();
pcbframe->GetScreen()->m_CurrentItem = NULL;
mainpcb->m_Status_Pcb = 0;
}
break;
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
{
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:{
// update module in the current board,
// not just add it to the board with total disregard for the netlist...
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame;
BOARD * mainpcb = pcbframe->m_Pcb;
MODULE * oldmodule = NULL;
MODULE * source_module = NULL;
MODULE * module_in_edit = m_Pcb->m_Modules;
// creation du nouveau module sur le PCB en cours
// create a new unit on the PCB, of course.
// Search the old module (source) if exists
// Because this source could be deleted when editing the main board...
if ( module_in_edit->m_Link ) // this is not a new module ...
{
source_module = mainpcb->m_Modules;
for( ; source_module != NULL ; source_module = (MODULE *) source_module->Pnext )
{
if( module_in_edit->m_Link == source_module->m_TimeStamp )
break;
}
}
if ( (source_module == NULL) && id == (ID_MODEDIT_UPDATE_MODULE_IN_BOARD) ) // source not found
{
wxString msg;
msg.Printf( _("Unable to find the footprint source on the main board") );
msg << _("\nCannot update the footprint");
DisplayError(this, msg);
break;
}
if ( (source_module != NULL) && id == (ID_MODEDIT_INSERT_MODULE_IN_BOARD) ) // source not found
{
wxString msg;
msg.Printf( _("A footprint source was found on the main board") );
msg << _("\nCannot insert this footprint");
DisplayError(this, msg);
break;
}
// Create the "new" module
MODULE * newmodule = new MODULE(mainpcb);
newmodule->Copy(module_in_edit);
newmodule->m_Parent = mainpcb; // modifie par la copie
newmodule->m_Parent = mainpcb; // modifie par la copie
newmodule->m_Link = 0;
// Recherche de l'ancien module correspondant
//(qui a pu changer ou disparaitre a la suite d'<27>ditions)
//locate the corresponding former unit, which may have a different revision.
// I've taken this out, as it is superceded by 'update' above.
/*
if ( module_in_edit->m_Link )
{
oldmodule = mainpcb->m_Modules;
for( ; oldmodule != NULL ; oldmodule = (MODULE *) oldmodule->Pnext )
{
if( module_in_edit->m_Link == oldmodule->m_TimeStamp )
break;
}
}
*/
// Placement du module dans la liste des modules du PCB.
// Put the footprint in the main pcb linked list.
newmodule->Pnext = mainpcb->m_Modules;
mainpcb->m_Modules = newmodule;
newmodule->Pback = mainpcb;
if ( newmodule->Pnext ) newmodule->Pnext->Pback = newmodule;
if ( oldmodule )
{
newmodule = pcbframe->Exchange_Module(this,
oldmodule, newmodule);
if ( source_module ) // this is an update command
{
// The new module replace the old module (pos, orient, ref, value and connexions are kept)
// and the source_module (old module) is deleted
newmodule = pcbframe->Exchange_Module(this, source_module, newmodule);
newmodule->m_TimeStamp = module_in_edit->m_Link;
}
else
{
}
else // This is an insert command
{
wxPoint cursor_pos = pcbframe->GetScreen()->m_Curseur;
pcbframe->GetScreen()->m_Curseur = wxPoint(0,0);
pcbframe->Place_Module(newmodule, NULL);
pcbframe->GetScreen()->m_Curseur = cursor_pos;
newmodule->m_TimeStamp = GetTimeStamp();
}
}
newmodule->m_Flags = 0;
GetScreen()->ClrModify();
pcbframe->GetScreen()->m_CurrentItem = NULL;
mainpcb->m_Status_Pcb = 0;
}
break;
}
break;
case ID_LIBEDIT_IMPORT_PART:
GetScreen()->ClearUndoRedoList();
GetScreen()->m_CurrentItem = NULL;

View File

@ -209,8 +209,35 @@ bool active, islib = TRUE;
m_HToolBar->EnableTool(ID_LIBEDIT_EXPORT_PART,active);
m_HToolBar->EnableTool(ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,active);
m_HToolBar->EnableTool(ID_MODEDIT_SAVE_LIBMODULE,active && islib);
m_HToolBar->EnableTool(ID_MODEDIT_INSERT_MODULE_IN_BOARD,active);
m_HToolBar->EnableTool(ID_MODEDIT_UPDATE_MODULE_IN_BOARD,active);
MODULE * module_in_edit = m_Pcb->m_Modules;
if ( module_in_edit && module_in_edit->m_Link ) // this is not a new module ...
{
WinEDA_PcbFrame * pcbframe = m_Parent->m_PcbFrame;
BOARD * mainpcb = pcbframe->m_Pcb;
MODULE * source_module = mainpcb->m_Modules;
// search if the source module was not deleted:
for( ; source_module != NULL ; source_module = (MODULE *) source_module->Pnext )
{
if( module_in_edit->m_Link == source_module->m_TimeStamp )
break;
}
if ( source_module )
{
m_HToolBar->EnableTool(ID_MODEDIT_INSERT_MODULE_IN_BOARD, false);
m_HToolBar->EnableTool(ID_MODEDIT_UPDATE_MODULE_IN_BOARD, true);
}
else // The source was deleted, therefore we can insert but not update the module
{
m_HToolBar->EnableTool(ID_MODEDIT_INSERT_MODULE_IN_BOARD, true);
m_HToolBar->EnableTool(ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false);
}
}
else
{
m_HToolBar->EnableTool(ID_MODEDIT_INSERT_MODULE_IN_BOARD,active);
m_HToolBar->EnableTool(ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false);
}
if ( GetScreen() )
{
m_HToolBar->EnableTool(ID_MODEDIT_UNDO,GetScreen()->m_UndoList && active);

View File

@ -16,7 +16,7 @@
/* Routines Locales */
/* Variables locales */
D_PAD* pt_pad_selecte; /* pointeur sur le pad selecte pour edition */
static D_PAD* s_CurrentSelectedPad; /* pointeur sur le pad selecte pour edition */
static wxPoint Pad_OldPos;
@ -29,7 +29,7 @@ static void Exit_Move_Pad(WinEDA_DrawPanel * Panel, wxDC * DC)
Remise en etat des conditions initiales avant move si move en cours
*/
{
D_PAD * pad = pt_pad_selecte;
D_PAD * pad = s_CurrentSelectedPad;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
@ -55,7 +55,7 @@ D_PAD * pad = pt_pad_selecte;
}
EraseDragListe();
pt_pad_selecte = NULL;
s_CurrentSelectedPad = NULL;
g_Drag_Pistes_On = FALSE;
}
@ -68,7 +68,7 @@ static void Show_Pad_Move(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
TRACK * Track;
DRAG_SEGM * pt_drag;
BASE_SCREEN * screen = panel->GetScreen();
D_PAD * pad = pt_pad_selecte;
D_PAD * pad = s_CurrentSelectedPad;
if ( erase ) pad->Draw(panel, DC, wxPoint(0,0), GR_XOR);
pad->m_Pos = screen->m_Curseur;
@ -238,7 +238,7 @@ int rX, rY;
/*********************************************************/
void WinEDA_BasePcbFrame::DeletePad(D_PAD* Pad, wxDC * DC)
/*********************************************************/
/* Routine de suppression d'une pastille sur le module selectionne */
/* Function to delete the pad "pad" */
{
MODULE * Module;
wxString line;
@ -268,27 +268,26 @@ wxString line;
/*************************************************************/
void WinEDA_BasePcbFrame::StartMovePad(D_PAD * Pad, wxDC * DC)
/*************************************************************/
/* Routine de deplacement d'une pastille */
/* Function to initialise the "move pad" command */
{
MODULE * Module;
/* localisation d'une pastille ? */
if(Pad == NULL ) return;
Module = (MODULE*) Pad->m_Parent;
pt_pad_selecte = Pad ;
s_CurrentSelectedPad = Pad ;
Pad_OldPos = Pad->m_Pos;
Pad->Display_Infos(this);
DrawPanel->ManageCurseur = Show_Pad_Move;
DrawPanel->ForceCloseManageCurseur = Exit_Move_Pad;
/* Affichage du pad en SKETCH */
/* Draw the pad (SKETCH mode) */
Pad->Draw(DrawPanel, DC, wxPoint(0,0),GR_XOR);
Pad->m_Flags |= IS_MOVED;
Pad->Draw(DrawPanel, DC, wxPoint(0,0),GR_XOR);
/* Construction de la liste des segments a "dragger" */
/* Build the list of track segments to drag */
Build_1_Pad_SegmentsToDrag(DrawPanel, DC, Pad);
}
@ -318,7 +317,7 @@ MODULE * Module;
dX = Pad->m_Pos.x - Pad_OldPos.x;
dY = Pad->m_Pos.y - Pad_OldPos.y;
RotatePoint(&dX, &dY, - Module->m_Orient );
Pad->m_Pos0.x += dX; pt_pad_selecte->m_Pos0.y += dY;
Pad->m_Pos0.x += dX; s_CurrentSelectedPad->m_Pos0.y += dY;
Pad->m_Flags = 0;
@ -330,11 +329,11 @@ MODULE * Module;
/* Tracage des segments dragges */
pt_drag = g_DragSegmentList;
for( ; pt_drag; pt_drag = pt_drag->Pnext)
{
{
Track = pt_drag->m_Segm;
Track->SetState(EDIT,OFF);
Track->Draw(DrawPanel, DC, GR_OR);
}
}
EraseDragListe();
GetScreen()->SetModify();

View File

@ -568,7 +568,8 @@ int max_layer = m_Pcb->m_BoardSettings->m_CopperLayerCount;
case 'T': // Track list start: fmt = T image layer t_count
sscanf(Line+2, "%d %d %d", & image, & track_layer, & track_count);
track_layer--;
if ( track_layer == max_layer-1 ) track_layer = CMP_N;
if ( (track_layer != CUIVRE_N) && (track_layer == max_layer-1) )
track_layer = CMP_N;
// Read corners: fmt = C x_pos y_pos
for ( int ii = 0; ii < track_count; ii++ )
{

View File

@ -26,9 +26,9 @@
#include "Update_Module_Board.xpm"
#ifdef __UNIX__
#define LISTBOX_WIDTH 120
#define LISTBOX_WIDTH 140
#else
#define LISTBOX_WIDTH 100
#define LISTBOX_WIDTH 120
#endif
/***************************************************/

View File

@ -16,23 +16,23 @@ extern wxString g_Main_Title;
wxString MsgInfos(
#ifdef GERBVIEW
wxT("** GERBVIEW (jul 2001 .. 2006) **")
wxT("** GERBVIEW (jul 2001 .. 2007) **")
#else
#ifdef PCBNEW
wxT("** PCBNEW (sept 1992 .. 2006) **")
wxT("** PCBNEW (sept 1992 .. 2007) **")
#endif
#endif
#ifdef CVPCB
wxT("** CVPCB (sept 1992 .. 2006) **")
wxT("** CVPCB (sept 1992 .. 2007) **")
#endif
#ifdef KICAD
wxT("** KICAD (jul 2000 .. 2006) **")
wxT("** KICAD (jul 2000 .. 2007) **")
#endif
#ifdef EESCHEMA
wxT("** EESCHEMA (sept 1994 .. 2006) **")
wxT("** EESCHEMA (sept 1994 .. 2007) **")
#endif
);