Commit e6239e74 authored by dickelbeck's avatar dickelbeck
Browse files

moved m_Layer into EDA_BaseStruct

parent 755c3a1b
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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>
+5 −0
Original line number Diff line number Diff line
@@ -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; 
}
+1 −1
Original line number Diff line number Diff line
@@ -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;
+308 −256
Original line number Diff line number Diff line
@@ -16,22 +16,26 @@
/*****************************/
wxString GetBuildVersion( void )
/*****************************/

/* Return the build date
 */
{
    return g_BuildVersion;
}


/*********************************************************************************************/
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;
}


/************************************/
wxString ReturnUnitSymbol( int Units )
/************************************/
@@ -55,56 +59,68 @@ wxString label;
    return label;
}


/**************************************************/
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 );
}


/****************************************************************************/
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 );
}


/*******************************************************************/
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;
}


/****************************************************************************/
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
 *  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;
    if( Units >= CENTIMETRE )
        StringValue << Value;
    else
    {
        value_to_print = To_User_Unit( Units, Value, Internal_Unit );
@@ -115,28 +131,35 @@ double 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
 *  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);
    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 )
/******************************************************************/

/* Convert in inch or mm the variable "val" given in internal units
 */
{
@@ -144,32 +167,39 @@ double value;

    if( is_metric )
        value = (double) (val) * 25.4 / internal_unit_value;
	else value = (double) (val) / internal_unit_value;
    else
        value = (double) (val) / internal_unit_value;

    return 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;

	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 );
}


/**********************/
wxString GenDate( void )
/**********************/

/* Return the string date "day month year" like "23 jun 2005"
 */
{
wxString mois[12] =
    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" )
@@ -183,19 +213,21 @@ wxString string_date;
    string_date.Printf( wxT( "%d %s %d" ), Date->tm_mday,
                        mois[Date->tm_mon].GetData(),
                        Date->tm_year + 1900 );
	return(string_date);
    return string_date;
}


/***********************************/
void* MyMalloc( size_t nb_octets )
/***********************************/
/* My memory allocation */
{
    void* pt_mem;

    if( nb_octets == 0 )
    {
        DisplayError( NULL, wxT( "Allocate 0 bytes !!" ) );
		return(NULL);
        return NULL;
    }
    pt_mem = malloc( nb_octets );
    if( pt_mem == NULL )
@@ -204,38 +236,45 @@ void * pt_mem;
        msg.Printf( wxT( "Out of memory: allocation %d bytes" ), nb_octets );
        DisplayError( NULL, msg );
    }
	return(pt_mem);
    return pt_mem;
}


/************************************/
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);

    if( pt_mem )
        memset( pt_mem, 0, nb_octets );
    return 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 )
/**************************************************************/

/* 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[] = {
    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" ),
@@ -247,7 +286,7 @@ wxString layer_name_list[] = {
    };

// Same as layer_name_list, without space, not internationalized
wxString layer_name_list_for_filename[] = {
    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" ),
@@ -257,13 +296,18 @@ wxString layer_name_list_for_filename[] = {
        wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ),     wxT( "Eco2" ),
        wxT( "EdgesPcb" ), wxT( "---" ),      wxT( "---" ),      wxT( "---" )
    };
	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( layer_number >= 31 )
        layer_number = 31;

	if( is_gui ){
		wxString hotkey_list[] = {
    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( " " ),
@@ -277,7 +321,6 @@ wxString layer_name_list_for_filename[] = {
    }

    return layer_name;

}


@@ -308,10 +351,12 @@ wxSize size;
                            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 )
/***************************************************/
@@ -319,14 +364,17 @@ void WinEDA_TextFrame::Append( const wxString & text)
    m_List->Append( text );
}


/**********************************************************/
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
/**********************************************************/
{
    int ii = m_List->GetSelection();

    EndModal( ii );
}


/*************************************************/
void WinEDA_TextFrame::OnClose( wxCloseEvent& event )
/*************************************************/
@@ -335,34 +383,37 @@ void WinEDA_TextFrame::OnClose(wxCloseEvent& event)
}



/*****************************************************************************/
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
 *  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 de la documentation associee a un composant
 */
{
    wxString Line1( wxT( "Doc:  " ) ), Line2( wxT( "KeyW: " ) );

    int color = BLUE;

    if( frame && frame->MsgPanel )
@@ -375,30 +426,32 @@ int color = BLUE;
}




/***********************/
int GetTimeStamp( void )
/***********************/

/*
 Retourne une identification temporelle (Time stamp) differente a chaque appel
 *  Retourne une identification temporelle (Time stamp) differente a chaque appel
 */
{
    static int OldTimeStamp, NewTimeStamp;

    NewTimeStamp = time( NULL );
	if(NewTimeStamp <= OldTimeStamp) NewTimeStamp = OldTimeStamp + 1;
    if( NewTimeStamp <= OldTimeStamp )
        NewTimeStamp = OldTimeStamp + 1;
    OldTimeStamp = NewTimeStamp;
	return(NewTimeStamp);
    return NewTimeStamp;
}


/*************************************************/
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 )
@@ -412,4 +465,3 @@ void valeur_param(int valeur,wxString & buf_texte)
        buf_texte << wxT( "\" " );
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -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 */

Loading