Commit 34909473 authored by charras's avatar charras
Browse files

eeschema: code cleaning

parent bf688ea1
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -87,14 +87,12 @@ public:
    }

    /**
     * Function SaveLibrary
     * writes the data structures for this object out to 2 FILE in "*.lib" and ".dcm" format.
     *  the main file (.lib) is the library content (set of components)
     *  the second file (.dcm)is the auxiliary file that contents the keywords and description for components)
     * @param FullFileName the new full filename (*.lib).
     * Function SaveDoc
     * writes the doc info out to a FILE in "*.dcm" format.
     * @param aFile The FILE to write to.
     * @return bool - true if success writing else false.
     */
    bool SaveLibrary( const wxString& FullFileName );
    bool SaveDoc( FILE* aFile );
};


@@ -131,6 +129,14 @@ public:

    ~EDA_LibComponentStruct();
    void     SortDrawItems();

    /**
     * Function Save
     * writes the data structures for this object out to a FILE in "*.lib" format.
     * @param aFile The FILE to write to.
     * @return bool - true if success writing else false.
     */
    bool Save( FILE* aFile );
};


+11 −2
Original line number Diff line number Diff line
@@ -18,8 +18,17 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
                       int aDrawMode, void* aData, int aTransformMatrix[2][2] )
/**********************************************************************************************/
{
    if( ( m_Attributs & PINNOTDRAW ) && !g_ShowAllPins )

    // Invisibles pins are only drawn on request.
    // But in libedit they are drawn in g_InvisibleItemColor because we must see them
    if( ( m_Attributs & PINNOTDRAW ) )
    {
        if ( g_EDA_Appl->m_LibeditFrame && g_EDA_Appl->m_LibeditFrame->IsActive() )
            aColor = g_InvisibleItemColor;
        else  if( !g_ShowAllPins )
            return;
    }


    EDA_LibComponentStruct* Entry = ( (DrawPinPrms*) aData )->m_Entry;
    bool    DrawPinText = ( (DrawPinPrms*) aData )->m_DrawPinText;
+4 −8
Original line number Diff line number Diff line
@@ -13,11 +13,7 @@
#include "trigo.h"
#include "protos.h"

#define UNVISIBLE_COLOR DARKGRAY

//#define DRAW_ARC_WITH_ANGLE		// Used to draw arcs


//#define DRAW_ARC_WITH_ANGLE		// Used to select function to draw arcs


/* Local functions */
@@ -129,7 +125,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
        if( Color >= 0 )
            color = Color;
        else
            color = UNVISIBLE_COLOR;
            color = g_InvisibleItemColor;
    }
    else color = Color;

@@ -146,7 +142,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
        if( Color >= 0 )
            color = Color;
        else
            color = UNVISIBLE_COLOR;
            color = g_InvisibleItemColor;
    }
    else color = Color;

@@ -164,7 +160,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
            if( Color >= 0 )
                color = Color;
            else
                color = UNVISIBLE_COLOR;
                color = g_InvisibleItemColor;
        }
        else color = Color;
        Field->Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat );
+143 −136
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#define MAX_PIN_INFO 10

#define TXTMARGE 10                 /* Decalage (en 1/1000") des textes places
									sur fils ( labels, num pins ) */
                                      * sur fils ( labels, num pins ) */

#define HIGHLIGHT_COLOR WHITE

@@ -110,6 +110,8 @@ eda_global wxSize g_GridList[]
    wxSize( 50, 50 ), wxSize( 20, 20 ), wxSize( 10, 10 ),
    wxSize( -1, -1 ), wxSize( 0,  0 )
}


#endif
;

@@ -120,16 +122,16 @@ eda_global LibraryStruct *g_LibraryList; // All part libs are saved here.

eda_global int            g_NetFormat;      /* Numero de reference du type de netliste */
eda_global int            g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
								les numeros (netlist PSPICE seulement) */
                                          * les numeros (netlist PSPICE seulement) */
eda_global int            g_BGColor;        /* couleur fond d'ecran (normalement blanc) */
eda_global SCH_ITEM*      g_ItemToRepeat; /* pointeur sur la derniere structure
								dessinee pouvant etre dupliquee par la commande
								Repeat ( NULL si aucune struct existe ) */
                                        * dessinee pouvant etre dupliquee par la commande
                                        * Repeat ( NULL si aucune struct existe ) */
eda_global wxSize         g_RepeatStep;
eda_global int            g_RepeatDeltaLabel;

eda_global SCH_ITEM*      g_ItemToUndoCopy; /* copy of last modified schematic item
		before it is modified (used for undo managing to restore old values ) */
                                          * before it is modified (used for undo managing to restore old values ) */

eda_global bool           g_LastSearchIsMarker; // True if last seach is a marker serach
                                                // False for a schematic item search
@@ -152,7 +154,7 @@ extern int g_HVLines;
eda_global int g_PlotPSColorOpt;    // True = plot postcript color (see plotps.cpp)


// Gestion de diverses variables, options... devant etre mmorises mais
// Gestion de diverses variables, options... devant etre memorisees mais
// Remises a 0 lors d'un rechargement de projetc
struct EESchemaVariables
{
@@ -166,7 +168,7 @@ eda_global struct EESchemaVariables g_EESchemaVar;
eda_global wxString g_CurrentViewLibraryName;           /* nom de la librairie en cours d'examen */
eda_global wxString g_CurrentViewComponentName;         /* nom du le composant en cours d'examen */
eda_global int      g_ViewConvert;                      /* Vue normal / convert */
eda_global int g_ViewUnit;						/* unit� a afficher (A, B ..) */
eda_global int      g_ViewUnit;                         /* part a afficher (A, B ..) */

/* Variables globales pour Schematic Edit */
eda_global int      g_DefaultTextLabelSize
@@ -209,7 +211,6 @@ eda_global int g_PlotMargin; /* Marge pour traces du cartouche */
eda_global float g_PlotScaleX, g_PlotScaleY;    /* coeff d'echelle de trace en unites table tracante */



/* For HPGL plotting: Pen caract : */
struct HPGL_Pen_Descr_Struct
{
@@ -220,16 +221,17 @@ struct HPGL_Pen_Descr_Struct
eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;

/* Ecrans usuels */

//eda_global SCH_SCREEN * ScreenSch;
eda_global DrawSheetStruct* g_RootSheet;
eda_global SCH_SCREEN * ScreenLib;
eda_global SCH_SCREEN*      g_ScreenLib;

/*************************************/
/* Gestion de recherche des elements */
/*************************************/

/* valeur de flag indicant si le pointeur de reference pour une localisation
est le curseur sur grille ou le curseur a deplacement fin hors grille */
  * est le curseur sur grille ou le curseur a deplacement fin hors grille */
#define CURSEUR_ON_GRILLE  0
#define CURSEUR_OFF_GRILLE 1

@@ -271,6 +273,11 @@ eda_global int g_ItemSelectetColor // Color to draw selected items
#endif
;

eda_global int g_InvisibleItemColor         // Color to draw items flagged invisible, in libedit (they are insisible in eeschema
#ifdef MAIN
= DARKGRAY
#endif
;

/* Config keys */
#define MINI_DRAW_LINE_WIDTH_KEY   wxT( "MinimunDrawLineWidth" )
+7 −6
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ const wxChar * Text;
	{
		Text = List[ii].m_Comp->m_ChipName.GetData();
		Entry = FindLibPart(Text, wxEmptyString, FIND_ROOT);
		ListEntry[ii] = Entry;	// = NULL si Composant non trouv� en librairie
		ListEntry[ii] = Entry;	// = NULL component not found
	}

	MyFree(List);
@@ -90,21 +90,22 @@ const wxChar * Text;
	if( DocFile)
		fprintf(DocFile,"%s  %s\n", DOCFILE_IDENT, DateAndTime(Line));

	/* Generation des elements */
	/* Save components in file */
	for ( ii = 0; ii < NbItems; ii++ )
	{
		if ( ListEntry[ii] == NULL )	// Composant non trouv� en librairie
		if ( ListEntry[ii] == NULL )	// Not found in lib
		{
            continue;
        }
		if ( (ii == 0) || ( ListEntry[ii-1] != ListEntry[ii] ) )
		{
			WriteOneLibEntry(ArchiveFile, ListEntry[ii]);
			if( DocFile ) WriteOneDocLibEntry(DocFile, ListEntry[ii]);
            if ( ListEntry[ii]->Type == ROOT)   // Must be always true, but just in case
                ListEntry[ii]->Save(ArchiveFile);
			if( DocFile )
                ListEntry[ii]->SaveDoc(DocFile);
		}
	}

	/* Generation fin de fichier */
	fprintf(ArchiveFile,"#\n#EndLibrary\n");
	fclose(ArchiveFile);

Loading