moved m_Layer into EDA_BaseStruct

This commit is contained in:
dickelbeck 2007-08-22 05:11:01 +00:00
parent 755c3a1b2e
commit e6239e7456
19 changed files with 1132 additions and 914 deletions

View File

@ -4,6 +4,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ eeschema & pcbnew
* Fixed a filename case sensitivity problem that would show up on Linux
but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
* Since so many classes introduced m_Layer, I moved m_Layer into
EDA_BaseStruct so all classes can inherit it and that way we can test
layer using a general, polymorphic test, i.e. don't have to cast a
EDA_BaseStruct* to a class specific pointer to test layer. Could also have
used a virtual function but too many places use m_Layer directly.
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema & pcbnew
@ -15,6 +28,7 @@ email address.
================================================================================
+ administrative
Added copyright.h as a proposed copyright header for Mr. Charras's review.
Added uncrustify.cfg the configuration program for "uncrustify" C++ beautifier.
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>

View File

@ -557,5 +557,10 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void )
void BASE_SCREEN::SetCurItem( EDA_BaseStruct* aCurItem )
{
#if defined(DEBUG)
printf( "SetCurItem(%p)\n", aCurItem );
#endif
m_CurrentItem = aCurItem;
}

View File

@ -106,6 +106,7 @@ void EDA_BaseStruct::InitVars( void )
m_TimeStamp = 0; // Time stamp used for logical links
m_Status = 0;
m_Selected = 0; /* Used by block commands, and selective editing */
m_Layer = 0;
}
@ -297,7 +298,6 @@ EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStruct
/*********************************************************/
EDA_TextStruct::EDA_TextStruct( const wxString& text )
{
m_Layer = 0;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
m_Orient = 0; /* Orient in 0.1 degrees */
m_Attributs = 0;

View File

@ -1,8 +1,8 @@
/**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/
/**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/
/* Fichier common.cpp */
/* Fichier common.cpp */
#include "fctsys.h"
#include "gr_basic.h"
@ -14,402 +14,454 @@
#include "build_version.h"
/*****************************/
wxString GetBuildVersion(void)
wxString GetBuildVersion( void )
/*****************************/
/* Return the build date
*/
*/
{
return g_BuildVersion;
return g_BuildVersion;
}
/*********************************************************************************************/
Ki_PageDescr::Ki_PageDescr(const wxSize & size, const wxPoint & offset, const wxString & name)
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name )
/*********************************************************************************************/
{
// All sizes are in 1/1000 inch
m_Size = size; m_Offset = offset, m_Name = name;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
// All sizes are in 1/1000 inch
m_Size = size; m_Offset = offset, m_Name = name;
// Adjust the default value for margins to 400 mils (0,4 inch or 10 mm)
m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400;
}
/************************************/
wxString ReturnUnitSymbol(int Units )
wxString ReturnUnitSymbol( int Units )
/************************************/
{
wxString label;
wxString label;
switch ( Units )
{
case INCHES:
label = _(" (\"):");
break;
switch( Units )
{
case INCHES:
label = _( " (\"):" );
break;
case MILLIMETRE:
label = _(" (mm):");
break;
case MILLIMETRE:
label = _( " (mm):" );
break;
default:
break;
}
return label;
default:
break;
}
return label;
}
/**************************************************/
void AddUnitSymbol(wxStaticText & Stext, int Units)
void AddUnitSymbol( wxStaticText& Stext, int Units )
/**************************************************/
/* Add string " (mm):" or " ("):" to the static text Stext.
Used in dialog boxes for entering values depending on selected units
*/
* Used in dialog boxes for entering values depending on selected units
*/
{
wxString msg = Stext.GetLabel() + ReturnUnitSymbol(Units);
Stext.SetLabel(msg);
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
Stext.SetLabel( msg );
}
/****************************************************************************/
void PutValueInLocalUnits(wxTextCtrl & TextCtr, int Value, int Internal_Unit)
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
/****************************************************************************/
/* Convert the number Value in a string according to the internal units
and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
*/
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
*/
{
wxString msg = ReturnStringFromValue(g_UnitMetric, Value, Internal_Unit);
TextCtr.SetValue(msg);
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit );
TextCtr.SetValue( msg );
}
/*******************************************************************/
int ReturnValueFromTextCtrl(const wxTextCtrl & TextCtr, int Internal_Unit)
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
/********************************************************************/
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
according to the internal units and the selected unit (g_UnitMetric)
*/
* according to the internal units and the selected unit (g_UnitMetric)
*/
{
int value;
wxString msg = TextCtr.GetValue();
value = ReturnValueFromString(g_UnitMetric, msg, Internal_Unit);
return value;
int value;
wxString msg = TextCtr.GetValue();
value = ReturnValueFromString( g_UnitMetric, msg, Internal_Unit );
return value;
}
/****************************************************************************/
wxString ReturnStringFromValue(int Units, int Value, int Internal_Unit)
/****************************************************************************/
/* Return the string from Value, according to units (inch, mm ...) for display,
and the initial unit for value
Unit = display units (INCH, MM ..)
Value = value in Internal_Unit
Internal_Unit = units per inch for Value
*/
{
wxString StringValue;
double value_to_print;
if ( Units >= CENTIMETRE ) StringValue << Value;
else
{
value_to_print = To_User_Unit(Units, Value,Internal_Unit);
StringValue.Printf( ( Internal_Unit > 1000 ) ? wxT("%.4f") : wxT("%.3f"),
value_to_print );
}
return StringValue;
}
/****************************************************************************/
int ReturnValueFromString(int Units, const wxString & TextValue, int Internal_Unit)
wxString ReturnStringFromValue( int Units, int Value, int Internal_Unit )
/****************************************************************************/
/* Return the string from Value, according to units (inch, mm ...) for display,
and the initial unit for value
Unit = display units (INCH, MM ..)
Value = text
Internal_Unit = units per inch for computed value
*/
* and the initial unit for value
* Unit = display units (INCH, MM ..)
* Value = value in Internal_Unit
* Internal_Unit = units per inch for Value
*/
{
int Value;
double dtmp = 0;
TextValue.ToDouble(&dtmp);
if ( Units >= CENTIMETRE ) Value = (int) round(dtmp);
else Value = From_User_Unit(Units, dtmp, Internal_Unit);
return Value;
wxString StringValue;
double value_to_print;
if( Units >= CENTIMETRE )
StringValue << Value;
else
{
value_to_print = To_User_Unit( Units, Value, Internal_Unit );
StringValue.Printf( ( Internal_Unit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ),
value_to_print );
}
return StringValue;
}
/****************************************************************************/
int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit )
/****************************************************************************/
/* Return the string from Value, according to units (inch, mm ...) for display,
* and the initial unit for value
* Unit = display units (INCH, MM ..)
* Value = text
* Internal_Unit = units per inch for computed value
*/
{
int Value;
double dtmp = 0;
TextValue.ToDouble( &dtmp );
if( Units >= CENTIMETRE )
Value = (int) round( dtmp );
else
Value = From_User_Unit( Units, dtmp, Internal_Unit );
return Value;
}
/******************************************************************/
double To_User_Unit(bool is_metric, int val,int internal_unit_value)
double To_User_Unit( bool is_metric, int val, int internal_unit_value )
/******************************************************************/
/* Convert in inch or mm the variable "val" given in internal units
*/
*/
{
double value;
double value;
if (is_metric)
value = (double) (val) * 25.4 / internal_unit_value;
else value = (double) (val) / internal_unit_value;
if( is_metric )
value = (double) (val) * 25.4 / internal_unit_value;
else
value = (double) (val) / internal_unit_value;
return value;
return value;
}
/**********************************************************************/
int From_User_Unit(bool is_metric, double val,int internal_unit_value)
int From_User_Unit( bool is_metric, double val, int internal_unit_value )
/**********************************************************************/
/* Return in internal units the value "val" given in inch or mm
*/
*/
{
double value;
double value;
if (is_metric) value = val * internal_unit_value / 25.4 ;
else value = val * internal_unit_value;
if( is_metric )
value = val * internal_unit_value / 25.4;
else
value = val * internal_unit_value;
return (int) round(value);
return (int) round( value );
}
/**********************/
wxString GenDate(void)
wxString GenDate( void )
/**********************/
/* Return the string date "day month year" like "23 jun 2005"
*/
*/
{
wxString mois[12] =
{
wxT("jan"), wxT("feb"), wxT("mar"), wxT("apr"), wxT("may"), wxT("jun"),
wxT("jul"), wxT("aug"), wxT("sep"), wxT("oct"), wxT("nov"), wxT("dec")
};
time_t buftime;
struct tm * Date;
wxString string_date;
static const wxString mois[12] =
{
wxT( "jan" ), wxT( "feb" ), wxT( "mar" ), wxT( "apr" ), wxT( "may" ), wxT( "jun" ),
wxT( "jul" ), wxT( "aug" ), wxT( "sep" ), wxT( "oct" ), wxT( "nov" ), wxT( "dec" )
};
time_t buftime;
struct tm* Date;
wxString string_date;
time(&buftime);
Date = gmtime(&buftime);
string_date.Printf( wxT("%d %s %d"), Date->tm_mday,
mois[Date->tm_mon].GetData(),
Date->tm_year + 1900);
return(string_date);
time( &buftime );
Date = gmtime( &buftime );
string_date.Printf( wxT( "%d %s %d" ), Date->tm_mday,
mois[Date->tm_mon].GetData(),
Date->tm_year + 1900 );
return string_date;
}
/***********************************/
void * MyMalloc (size_t nb_octets)
void* MyMalloc( size_t nb_octets )
/***********************************/
/* My memory allocation */
{
void * pt_mem;
if (nb_octets == 0)
{
DisplayError(NULL, wxT("Allocate 0 bytes !!"));
return(NULL);
}
pt_mem = malloc(nb_octets);
if (pt_mem == NULL)
{
wxString msg;
msg.Printf( wxT("Out of memory: allocation %d bytes"), nb_octets);
DisplayError(NULL, msg);
}
return(pt_mem);
void* pt_mem;
if( nb_octets == 0 )
{
DisplayError( NULL, wxT( "Allocate 0 bytes !!" ) );
return NULL;
}
pt_mem = malloc( nb_octets );
if( pt_mem == NULL )
{
wxString msg;
msg.Printf( wxT( "Out of memory: allocation %d bytes" ), nb_octets );
DisplayError( NULL, msg );
}
return pt_mem;
}
/************************************/
void * MyZMalloc (size_t nb_octets)
void* MyZMalloc( size_t nb_octets )
/************************************/
/* My memory allocation, memory space is cleared
*/
*/
{
void * pt_mem = MyMalloc (nb_octets);
if ( pt_mem) memset(pt_mem, 0, nb_octets);
return(pt_mem);
void* pt_mem = MyMalloc( nb_octets );
if( pt_mem )
memset( pt_mem, 0, nb_octets );
return pt_mem;
}
/*******************************/
void MyFree (void * pt_mem)
void MyFree( void* pt_mem )
/*******************************/
{
if( pt_mem ) free(pt_mem);
if( pt_mem )
free( pt_mem );
}
/**************************************************************/
wxString ReturnPcbLayerName(int layer_number, bool is_filename, bool is_gui)
wxString ReturnPcbLayerName( int layer_number, bool is_filename, bool is_gui )
/**************************************************************/
/* Return the name of the layer number "layer_number".
if "is_filefame" == TRUE, the name can be used for a file name
(not internatinalized, no space)
*/
* if "is_filefame" == TRUE, the name can be used for a file name
* (not internatinalized, no space)
*/
{
wxString layer_name;
wxString layer_name_list[] = {
_("Copper "), _("Inner L1 "), _("Inner L2 "), _("Inner L3 "),
_("Inner L4 "), _("Inner L5 "), _("Inner L6 "), _("Inner L7 "),
_("Inner L8 "), _("Inner L9 "), _("Inner L10"), _("Inner L11"),
_("Inner L12"), _("Inner L13"), _("Inner L14"), _("Component"),
_("Adhes Cop"), _("Adhes Cmp"), _("SoldP Cop"), _("SoldP Cmp"),
_("SilkS Cop"), _("SilkS Cmp"), _("Mask Cop "), _("Mask Cmp "),
_("Drawings "), _("Comments "), _("Eco1 "), _("Eco2 "),
_("Edges Pcb"), _("--- "), _("--- "), _("--- ")
};
wxString layer_name;
static const wxString layer_name_list[] = {
_( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ),
_( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ),
_( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ),
_( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ),
_( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ),
_( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ),
_( "Drawings " ), _( "Comments " ), _( "Eco1 " ), _( "Eco2 " ),
_( "Edges Pcb" ), _( "--- " ), _( "--- " ), _( "--- " )
};
// Same as layer_name_list, without space, not internationalized
wxString layer_name_list_for_filename[] = {
wxT("Copper"), wxT("InnerL1"), wxT("InnerL2"), wxT("InnerL3"),
wxT("InnerL4"), wxT("InnerL5"), wxT("InnerL6"), wxT("InnerL7"),
wxT("InnerL8"), wxT("InnerL9"), wxT("InnerL10"), wxT("InnerL11"),
wxT("InnerL12"), wxT("InnerL13"), wxT("InnerL14"), wxT("Component"),
wxT("AdhesCop"), wxT("AdhesCmp"), wxT("SoldPCop"), wxT("SoldPCmp"),
wxT("SilkSCop"), wxT("SilkSCmp"), wxT("MaskCop"), wxT("MaskCmp"),
wxT("Drawings"), wxT("Comments"), wxT("Eco1"), wxT("Eco2"),
wxT("EdgesPcb"), wxT("---"), wxT("---"), wxT("---")
};
if ( layer_number >= 31 ) layer_number = 31;
static const wxString layer_name_list_for_filename[] = {
wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ),
wxT( "InnerL4" ), wxT( "InnerL5" ), wxT( "InnerL6" ), wxT( "InnerL7" ),
wxT( "InnerL8" ), wxT( "InnerL9" ), wxT( "InnerL10" ), wxT( "InnerL11" ),
wxT( "InnerL12" ), wxT( "InnerL13" ), wxT( "InnerL14" ), wxT( "Component" ),
wxT( "AdhesCop" ), wxT( "AdhesCmp" ), wxT( "SoldPCop" ), wxT( "SoldPCmp" ),
wxT( "SilkSCop" ), wxT( "SilkSCmp" ), wxT( "MaskCop" ), wxT( "MaskCmp" ),
wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ),
wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" )
};
if ( is_filename ) layer_name = layer_name_list_for_filename[layer_number];
else layer_name = layer_name_list[layer_number];
if( is_gui ){
wxString hotkey_list[] = {
wxT("(PgDn)"), wxT("(F5)"), wxT("(F6)"), wxT("(F7)"),
wxT("(F8)"), wxT("(F9)"), wxT("(F10)"), wxT(" "),
wxT(" "), wxT(" "), wxT(" "), wxT(" "),
wxT(" "), wxT(" "), wxT(" "), wxT(" (PgUp)"),
wxT(" "), wxT(" "), wxT(" "), wxT(" "),
wxT(" "), wxT(" "), wxT(" "), wxT(" "),
wxT(" "), wxT(" "), wxT(" "), wxT(" "),
wxT(" "), wxT(" "), wxT(" "), wxT(" ")
};
layer_name += wxT(" ") + hotkey_list[layer_number];
}
return layer_name;
if( layer_number >= 31 )
layer_number = 31;
if( is_filename )
layer_name = layer_name_list_for_filename[layer_number];
else
layer_name = layer_name_list[layer_number];
if( is_gui )
{
static const wxString hotkey_list[] = {
wxT( "(PgDn)" ), wxT( "(F5)" ), wxT( "(F6)" ), wxT( "(F7)" ),
wxT( "(F8)" ), wxT( "(F9)" ), wxT( "(F10)" ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " (PgUp)" ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ),
wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " )
};
layer_name += wxT( " " ) + hotkey_list[layer_number];
}
return layer_name;
}
enum textbox {
ID_TEXTBOX_LIST = 8010
ID_TEXTBOX_LIST = 8010
};
BEGIN_EVENT_TABLE(WinEDA_TextFrame, wxDialog)
EVT_LISTBOX_DCLICK(ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList)
EVT_LISTBOX(ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList)
EVT_CLOSE( WinEDA_TextFrame::OnClose )
BEGIN_EVENT_TABLE( WinEDA_TextFrame, wxDialog )
EVT_LISTBOX_DCLICK( ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList )
EVT_LISTBOX( ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList )
EVT_CLOSE( WinEDA_TextFrame::OnClose )
END_EVENT_TABLE()
/***************************************************************************/
WinEDA_TextFrame::WinEDA_TextFrame(wxWindow * parent, const wxString & title):
wxDialog(parent, -1, title, wxPoint(-1,-1), wxSize(250,350),
wxDEFAULT_DIALOG_STYLE| wxFRAME_FLOAT_ON_PARENT )
WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent, const wxString& title ) :
wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxSize( 250, 350 ),
wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT )
/***************************************************************************/
{
wxSize size;
wxSize size;
m_Parent = parent;
m_Parent = parent;
CentreOnParent();
CentreOnParent();
size = GetClientSize();
m_List = new wxListBox(this, ID_TEXTBOX_LIST,
wxPoint(0,0), size,
0, NULL,
wxLB_ALWAYS_SB|wxLB_SINGLE);
m_List->SetBackgroundColour(wxColour(200,255,255));
SetReturnCode(-1);
size = GetClientSize();
m_List = new wxListBox( this, ID_TEXTBOX_LIST,
wxPoint( 0, 0 ), size,
0, NULL,
wxLB_ALWAYS_SB | wxLB_SINGLE );
m_List->SetBackgroundColour( wxColour( 200, 255, 255 ) );
SetReturnCode( -1 );
}
/***************************************************/
void WinEDA_TextFrame::Append( const wxString & text)
void WinEDA_TextFrame::Append( const wxString& text )
/***************************************************/
{
m_List->Append(text);
m_List->Append( text );
}
/**********************************************************/
void WinEDA_TextFrame::D_ClickOnList(wxCommandEvent& event)
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
/**********************************************************/
{
int ii = m_List->GetSelection();
EndModal(ii);
int ii = m_List->GetSelection();
EndModal( ii );
}
/*************************************************/
void WinEDA_TextFrame::OnClose(wxCloseEvent& event)
void WinEDA_TextFrame::OnClose( wxCloseEvent& event )
/*************************************************/
{
EndModal(-1);
EndModal( -1 );
}
/*****************************************************************************/
void Affiche_1_Parametre(WinEDA_DrawFrame * frame , int pos_X,
const wxString & texte_H,const wxString & texte_L,int color)
void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
const wxString& texte_H, const wxString& texte_L, int color )
/*****************************************************************************/
/*
Routine d'affichage d'un parametre.
pos_X = cadrage horizontal
si pos_X < 0 : la position horizontale est la derniere
valeur demandee >= 0
texte_H = texte a afficher en ligne superieure.
si "", par d'affichage sur cette ligne
texte_L = texte a afficher en ligne inferieure.
si "", par d'affichage sur cette ligne
color = couleur d'affichage
*/
{
frame->MsgPanel->Affiche_1_Parametre(pos_X, texte_H,texte_L, color);
}
/****************************************************************************/
void AfficheDoc(WinEDA_DrawFrame * frame, const wxString & Doc, const wxString & KeyW)
/****************************************************************************/
/*
Routine d'affichage de la documentation associee a un composant
*/
* Routine d'affichage d'un parametre.
* pos_X = cadrage horizontal
* si pos_X < 0 : la position horizontale est la derniere
* valeur demandee >= 0
* texte_H = texte a afficher en ligne superieure.
* si "", par d'affichage sur cette ligne
* texte_L = texte a afficher en ligne inferieure.
* si "", par d'affichage sur cette ligne
* color = couleur d'affichage
*/
{
wxString Line1( wxT("Doc: ")), Line2( wxT("KeyW: "));
int color = BLUE;
if ( frame && frame->MsgPanel)
{
frame->MsgPanel->EraseMsgBox();
Line1 += Doc;
Line2 += KeyW;
frame->MsgPanel->Affiche_1_Parametre(10, Line1, Line2, color);
}
frame->MsgPanel->Affiche_1_Parametre( pos_X, texte_H, texte_L, color );
}
/****************************************************************************/
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW )
/****************************************************************************/
/*
* Routine d'affichage de la documentation associee a un composant
*/
{
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
int color = BLUE;
if( frame && frame->MsgPanel )
{
frame->MsgPanel->EraseMsgBox();
Line1 += Doc;
Line2 += KeyW;
frame->MsgPanel->Affiche_1_Parametre( 10, Line1, Line2, color );
}
}
/***********************/
int GetTimeStamp(void)
int GetTimeStamp( void )
/***********************/
/*
Retourne une identification temporelle (Time stamp) differente a chaque appel
*/
{
static int OldTimeStamp, NewTimeStamp;
NewTimeStamp = time(NULL);
if(NewTimeStamp <= OldTimeStamp) NewTimeStamp = OldTimeStamp + 1;
OldTimeStamp = NewTimeStamp;
return(NewTimeStamp);
/*
* Retourne une identification temporelle (Time stamp) differente a chaque appel
*/
{
static int OldTimeStamp, NewTimeStamp;
NewTimeStamp = time( NULL );
if( NewTimeStamp <= OldTimeStamp )
NewTimeStamp = OldTimeStamp + 1;
OldTimeStamp = NewTimeStamp;
return NewTimeStamp;
}
/*************************************************/
void valeur_param(int valeur,wxString & buf_texte)
void valeur_param( int valeur, wxString& buf_texte )
/*************************************************/
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
entree : valeur en mils , buffer de texte
retourne en buffer : texte : valeur exprimee en pouces ou millimetres
suivie de " ou mm
*/
* entree : valeur en mils , buffer de texte
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres
* suivie de " ou mm
*/
{
if ( g_UnitMetric )
{
buf_texte.Printf( wxT("%3.3f "),(float) valeur * 0.00254);
buf_texte << wxT("mm") ;
}
else
{
buf_texte.Printf( wxT("%2.4f "),(float) valeur * 0.0001);
buf_texte << wxT("\" ");
}
if( g_UnitMetric )
{
buf_texte.Printf( wxT( "%3.3f " ), (float) valeur * 0.00254 );
buf_texte << wxT( "mm" );
}
else
{
buf_texte.Printf( wxT( "%2.4f " ), (float) valeur * 0.0001 );
buf_texte << wxT( "\" " );
}
}

View File

@ -141,7 +141,6 @@ public:
int m_FileNameSize;
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */
int m_NbLabel; /* Nombre de points de connexion */

View File

@ -106,7 +106,6 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
a 45 degres de BUS ou WIRE */
{
public:
int m_Layer;
int m_Width;
wxPoint m_Pos;
wxSize m_Size;
@ -122,7 +121,6 @@ public:
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
{
public:
int m_Layer;
int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */
int *m_Points; /* XY pairs that forms the polyline. */
@ -137,7 +135,6 @@ public:
class DrawJunctionStruct: public EDA_BaseStruct
{
public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */
public:

View File

@ -154,6 +154,7 @@ public:
unsigned long m_TimeStamp; // Time stamp used for logical links
int m_Selected; /* Used by block commands, and selective editing */
int m_Layer; ///< used by many derived classes, so make common
private:
int m_Status;
@ -347,7 +348,6 @@ class EDA_TextStruct
{
public:
wxString m_Text; /* text! */
int m_Layer; /* couche d'appartenance */
wxPoint m_Pos; /* XY position of anchor text. */
wxSize m_Size; /* XY size of text */
int m_Width; /* epaisseur du trait */
@ -389,7 +389,6 @@ public:
class EDA_BaseLineStruct : public EDA_BaseStruct
{
public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point

View File

@ -276,7 +276,7 @@ public:
/**
* Function FindNet
* searches for a net with the given netcode.
* @param anetcode The netcode to search for.
* @param anetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* FindNet( int anetcode );

View File

@ -27,7 +27,7 @@
#include "New_Project.xpm"
#include "Open_Project.xpm"
#include "../bitmaps/icon_python.xpm"
#include "../bitmaps/reload.xpm"
#include "../bitmaps/Reload.xpm"
#include "id.h"

View File

@ -9,7 +9,6 @@
class COTATION : public EDA_BaseStruct
{
public:
int m_Layer; // 0.. 32 ( NON bit a bit)
int m_Width;
wxPoint m_Pos;
int m_Shape;

View File

@ -10,7 +10,6 @@
class MIREPCB : public EDA_BaseStruct
{
public:
int m_Layer; // 0.. 32 ( NON bit a bit)
int m_Width;
wxPoint m_Pos;
int m_Shape; // bit 0 : 0 = forme +, 1 = forme X

View File

@ -38,7 +38,6 @@ enum Mod_Attribut /* Attributs d'un module */
class MODULE : public EDA_BaseStruct
{
public:
int m_Layer; // layer number
wxPoint m_Pos; // Real coord on board
D_PAD* m_Pads; /* Pad list (linked list) */
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */

View File

@ -35,6 +35,18 @@ public:
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos )
{
return EDA_TextStruct::HitTest( refPos );
}
#if defined(DEBUG)

View File

@ -16,7 +16,6 @@
class TEXTE_MODULE : public EDA_BaseStruct
{
public:
int m_Layer; // layer number
int m_Width;
wxPoint m_Pos; // Real coord
wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0

View File

@ -483,16 +483,18 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
}
/********************************************************/
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
/********************************************************/
/*
* localisation d'une empreinte par son rectangle d'encadrement
* Si plusieurs empreintes sont possibles, la priorite est:
* - sur la couche active
* - la plus petite
/**
* Function Locate_Prefered_Module
* locates a footprint by its bounding rectangle. If several footprints
* are possible, then the priority is: on the active layer, then smallest.
* The current mouse or cursor coordinates are grabbed from the active window
* to performe hit-testing.
*
* @param Pcb The BOARD to search within.
* @param typeloc Flag bits, tuning the search, see pcbnew.h
* @return MODULE* - the best module or NULL if none.
*/
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
{
MODULE* pt_module;
int lx, ly; /* dimensions du rectangle d'encadrement du module */
@ -898,10 +900,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
if( pt_txt_pcb->m_Layer == LayerSearch )
{
// because HitTest() is present in both base classes of TEXTE_PCB
// use a clarifying cast to tell compiler which HitTest()
// to call.
if( static_cast<EDA_TextStruct*>(pt_txt_pcb)->HitTest( ref ) )
if( pt_txt_pcb->HitTest( ref ) )
{
return pt_txt_pcb;
}

View File

@ -134,7 +134,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
wxString msg;
int flags = 0;
bool locate_track = FALSE;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
wxClientDC dc( DrawPanel );
DrawPanel->CursorOff( &dc );
@ -202,6 +202,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
_( "Get and Move Footprint" ), Move_Module_xpm );
}
if( DrawStruct )
{
switch( DrawStruct->m_StructType )

View File

@ -12,7 +12,7 @@
#include "id.h"
#if defined(DEBUG)
#include <class_collector.h>
#include "class_collector.h"
#endif
@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame )
EVT_MENU( ID_CONFIG_REQ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU(ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config)
EVT_MENU(ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config)
EVT_MENU( ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
@ -172,11 +172,77 @@ END_EVENT_TABLE()
#if defined(DEBUG)
class RAT1COLLECTOR : public COLLECTOR
{
;
};
class ARROWCOLLECTOR : public COLLECTOR
{
const KICAD_T* m_ScanTypes;
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
* "list" at the end of the search.
*/
std::vector<EDA_BaseStruct*> list2nd;
public:
ARROWCOLLECTOR() :
COLLECTOR(0),
m_ScanTypes(0)
{
}
~ARROWCOLLECTOR()
{
// empty list2nd so that ~list2nd() does not try and delete all
// the objects that it holds, it is not the owner of such objects
// and this prevents a double free()ing.
Empty2nd();
}
void Empty2nd()
{
list2nd.clear();
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
{
const wxPoint& refPos = *(const wxPoint*) testData;
switch( testItem->m_StructType )
{
case TYPEMODULE:
if( testItem->HitTest( refPos ) )
Append( testItem );
break;
}
return SEARCH_CONTINUE;
}
void SetScanTypes( const KICAD_T* scanTypes )
{
m_ScanTypes = scanTypes;
}
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -329,7 +329,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
int ii;
wxString line;
grid_list_struct grid_list_pcb[] =
static const grid_list_struct grid_list_pcb[] =
{
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
@ -346,7 +346,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
};
grid_list_struct grid_list_schematic[] =
static const grid_list_struct grid_list_schematic[] =
{
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },