Commit 34909473 authored by charras's avatar charras

eeschema: code cleaning

parent bf688ea1
...@@ -87,14 +87,12 @@ public: ...@@ -87,14 +87,12 @@ public:
} }
/** /**
* Function SaveLibrary * Function SaveDoc
* writes the data structures for this object out to 2 FILE in "*.lib" and ".dcm" format. * writes the doc info out to a FILE in "*.dcm" format.
* the main file (.lib) is the library content (set of components) * @param aFile The FILE to write to.
* the second file (.dcm)is the auxiliary file that contents the keywords and description for components)
* @param FullFileName the new full filename (*.lib).
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool SaveLibrary( const wxString& FullFileName ); bool SaveDoc( FILE* aFile );
}; };
...@@ -131,6 +129,14 @@ public: ...@@ -131,6 +129,14 @@ public:
~EDA_LibComponentStruct(); ~EDA_LibComponentStruct();
void SortDrawItems(); 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 );
}; };
......
...@@ -18,8 +18,17 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs ...@@ -18,8 +18,17 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) int aDrawMode, void* aData, int aTransformMatrix[2][2] )
/**********************************************************************************************/ /**********************************************************************************************/
{ {
if( ( m_Attributs & PINNOTDRAW ) && !g_ShowAllPins )
return; // 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; EDA_LibComponentStruct* Entry = ( (DrawPinPrms*) aData )->m_Entry;
bool DrawPinText = ( (DrawPinPrms*) aData )->m_DrawPinText; bool DrawPinText = ( (DrawPinPrms*) aData )->m_DrawPinText;
......
...@@ -13,11 +13,7 @@ ...@@ -13,11 +13,7 @@
#include "trigo.h" #include "trigo.h"
#include "protos.h" #include "protos.h"
#define UNVISIBLE_COLOR DARKGRAY //#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
/* Local functions */ /* Local functions */
...@@ -129,7 +125,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -129,7 +125,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
if( Color >= 0 ) if( Color >= 0 )
color = Color; color = Color;
else else
color = UNVISIBLE_COLOR; color = g_InvisibleItemColor;
} }
else color = Color; else color = Color;
...@@ -146,7 +142,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -146,7 +142,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
if( Color >= 0 ) if( Color >= 0 )
color = Color; color = Color;
else else
color = UNVISIBLE_COLOR; color = g_InvisibleItemColor;
} }
else color = Color; else color = Color;
...@@ -164,7 +160,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -164,7 +160,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
if( Color >= 0 ) if( Color >= 0 )
color = Color; color = Color;
else else
color = UNVISIBLE_COLOR; color = g_InvisibleItemColor;
} }
else color = Color; else color = Color;
Field->Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat ); Field->Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat );
......
This diff is collapsed.
...@@ -60,7 +60,7 @@ const wxChar * Text; ...@@ -60,7 +60,7 @@ const wxChar * Text;
{ {
Text = List[ii].m_Comp->m_ChipName.GetData(); Text = List[ii].m_Comp->m_ChipName.GetData();
Entry = FindLibPart(Text, wxEmptyString, FIND_ROOT); 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); MyFree(List);
...@@ -90,21 +90,22 @@ const wxChar * Text; ...@@ -90,21 +90,22 @@ const wxChar * Text;
if( DocFile) if( DocFile)
fprintf(DocFile,"%s %s\n", DOCFILE_IDENT, DateAndTime(Line)); fprintf(DocFile,"%s %s\n", DOCFILE_IDENT, DateAndTime(Line));
/* Generation des elements */ /* Save components in file */
for ( ii = 0; ii < NbItems; ii++ ) for ( ii = 0; ii < NbItems; ii++ )
{ {
if ( ListEntry[ii] == NULL ) // Composant non trouv� en librairie if ( ListEntry[ii] == NULL ) // Not found in lib
{ {
continue; continue;
} }
if ( (ii == 0) || ( ListEntry[ii-1] != ListEntry[ii] ) ) if ( (ii == 0) || ( ListEntry[ii-1] != ListEntry[ii] ) )
{ {
WriteOneLibEntry(ArchiveFile, ListEntry[ii]); if ( ListEntry[ii]->Type == ROOT) // Must be always true, but just in case
if( DocFile ) WriteOneDocLibEntry(DocFile, ListEntry[ii]); ListEntry[ii]->Save(ArchiveFile);
if( DocFile )
ListEntry[ii]->SaveDoc(DocFile);
} }
} }
/* Generation fin de fichier */
fprintf(ArchiveFile,"#\n#EndLibrary\n"); fprintf(ArchiveFile,"#\n#EndLibrary\n");
fclose(ArchiveFile); fclose(ArchiveFile);
......
...@@ -85,7 +85,7 @@ wxString msg; ...@@ -85,7 +85,7 @@ wxString msg;
wxString CmpName; wxString CmpName;
EDA_LibComponentStruct *LibEntry = NULL; EDA_LibComponentStruct *LibEntry = NULL;
if( ScreenLib->IsModify() ) if( g_ScreenLib->IsModify() )
{ {
if( ! IsOK(this, _("Current Part not saved.\nContinue?") ) ) return FALSE; if( ! IsOK(this, _("Current Part not saved.\nContinue?") ) ) return FALSE;
} }
...@@ -96,7 +96,7 @@ EDA_LibComponentStruct *LibEntry = NULL; ...@@ -96,7 +96,7 @@ EDA_LibComponentStruct *LibEntry = NULL;
i = GetNameOfPartToLoad(this, CurrentLib, CmpName); i = GetNameOfPartToLoad(this, CurrentLib, CmpName);
if( i == 0) return FALSE; if( i == 0) return FALSE;
ScreenLib->ClrModify(); g_ScreenLib->ClrModify();
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
// Effacement ancien composant affich� // Effacement ancien composant affich�
if( CurrentLibEntry) if( CurrentLibEntry)
...@@ -166,7 +166,7 @@ const wxChar * CmpName, *RootName = NULL; ...@@ -166,7 +166,7 @@ const wxChar * CmpName, *RootName = NULL;
BuildAliasData(Library, CurrentLibEntry); BuildAliasData(Library, CurrentLibEntry);
ScreenLib->ClrModify(); g_ScreenLib->ClrModify();
g_AsDeMorgan = 0; g_AsDeMorgan = 0;
if( LookForConvertPart(CurrentLibEntry) > 1 ) g_AsDeMorgan = 1; if( LookForConvertPart(CurrentLibEntry) > 1 ) g_AsDeMorgan = 1;
...@@ -564,7 +564,7 @@ bool NewCmp = TRUE; ...@@ -564,7 +564,7 @@ bool NewCmp = TRUE;
} }
CurrentLib->m_Modified = 1; CurrentLib->m_Modified = 1;
ScreenLib->ClrModify(); g_ScreenLib->ClrModify();
PQCompFunc((PQCompFuncType) LibraryEntryCompare); PQCompFunc((PQCompFuncType) LibraryEntryCompare);
......
...@@ -71,7 +71,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, ...@@ -71,7 +71,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
// Give an icon // Give an icon
SetIcon( wxIcon( libedit_xpm ) ); SetIcon( wxIcon( libedit_xpm ) );
SetBaseScreen( ScreenLib ); SetBaseScreen( g_ScreenLib );
GetSettings(); GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( DrawPanel ) if( DrawPanel )
......
...@@ -59,10 +59,6 @@ void DrawLibraryDrawStruct(WinEDA_DrawPanel * aPanel, wxDC * aDC, ...@@ -59,10 +59,6 @@ void DrawLibraryDrawStruct(WinEDA_DrawPanel * aPanel, wxDC * aDC,
bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]); bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]);
/**************/
/* EELIBS_DRAW_COMPONENTS.CPP */
/**************/
EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line, EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line,
FILE *f, int *LineNum); FILE *f, int *LineNum);
/* Routine to Read a DEF/ENDDEF part entry from given open file. */ /* Routine to Read a DEF/ENDDEF part entry from given open file. */
...@@ -229,22 +225,12 @@ LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, LibEDA_BaseStruct * D ...@@ -229,22 +225,12 @@ LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame, LibEDA_BaseStruct * D
Retourne: Retourne:
Pointeur sur la structure creee (ou NULL si impossible) */ Pointeur sur la structure creee (ou NULL si impossible) */
int WriteOneLibEntry( FILE * ExportFile, EDA_LibComponentStruct * LibEntry);
/* Routine d'ecriture du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
return: FALSE si Ok, TRUE si err write */
EDA_LibComponentStruct * CopyLibEntryStruct (wxWindow * frame, EDA_LibComponentStruct * OldEntry); EDA_LibComponentStruct * CopyLibEntryStruct (wxWindow * frame, EDA_LibComponentStruct * OldEntry);
/* Routine de copie d'une partlib /* Routine de copie d'une partlib
Parametres d'entree: pointeur sur la structure de depart Parametres d'entree: pointeur sur la structure de depart
Parametres de sortie: pointeur sur la structure creee */ Parametres de sortie: pointeur sur la structure creee */
int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry);
/* Routine d'ecriture de la doc du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
return: 0 si Ok
1 si err write */
/***************/ /***************/
/* SYMBEDIT.CPP */ /* SYMBEDIT.CPP */
...@@ -254,11 +240,6 @@ void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry); ...@@ -254,11 +240,6 @@ void SuppressDuplicateDrawItem(EDA_LibComponentStruct * LibEntry);
frequente lorsque l'on charge des symboles predessines plusieurs fois frequente lorsque l'on charge des symboles predessines plusieurs fois
pour definir un composant */ pour definir un composant */
/***************/
/* SYMBTEXT.CPP */
/***************/
/**************/ /**************/
/* NETLIST.CPP */ /* NETLIST.CPP */
/**************/ /**************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* EESchema - eesavlib.cpp */ /* EESchema - eesavlib.cpp */
/****************************/ /****************************/
/* Write Routines to save schematic libraries and library components (::Save() members) /* Functions to save schematic libraries and library components (::Save() members)
*/ */
#include "fctsys.h" #include "fctsys.h"
...@@ -350,137 +350,132 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr ...@@ -350,137 +350,132 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
return NewStruct; return NewStruct;
} }
/************************************************/
/*************************************************************************/ bool EDA_LibComponentStruct::Save( FILE* aFile )
int WriteOneLibEntry( FILE* ExportFile, EDA_LibComponentStruct* LibEntry ) /***********************************************/
/*************************************************************************/ /**
* Function Save
/* Routine d'ecriture du composant pointe par LibEntry * writes the data structures for this object out to a FILE in "*.brd" format.
* dans le fichier ExportFile( qui doit etre deja ouvert) * @param aFile The FILE to write to.
* return: 0 si Ok * @return bool - true if success writing else false.
* -1 si err write
* 1 si composant non ecrit ( type ALIAS )
*/ */
#define UNUSED 0 #define UNUSED 0
{ {
LibEDA_BaseStruct* DrawEntry; LibEDA_BaseStruct* DrawEntry;
LibDrawField* Field; LibDrawField* Field;
if( LibEntry->Type != ROOT ) if( Type != ROOT ) // should not happen, but just in case
return 1; return false;
/* Creation du commentaire donnant le nom du composant */ /* First line: it s a comment (component name for readers) */
fprintf( ExportFile, "#\n# %s\n#\n", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) );
/* Generation des lignes utiles */ /* Save data */
fprintf( ExportFile, "DEF" ); fprintf( aFile, "DEF" );
if( (LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 ) if( (m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); fprintf( aFile, " %s", CONV_TO_UTF8( m_Name.m_Text ) );
else else
fprintf( ExportFile, " ~%s", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); fprintf( aFile, " ~%s", CONV_TO_UTF8( m_Name.m_Text ) );
if( !LibEntry->m_Prefix.m_Text.IsEmpty() ) if( !m_Prefix.m_Text.IsEmpty() )
fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_Prefix.m_Text ) ); fprintf( aFile, " %s", CONV_TO_UTF8( m_Prefix.m_Text ) );
else else
fprintf( ExportFile, " ~" ); fprintf( aFile, " ~" );
fprintf( ExportFile, " %d %d %c %c %d %c %c\n", fprintf( aFile, " %d %d %c %c %d %c %c\n",
UNUSED, LibEntry->m_TextInside, UNUSED, m_TextInside,
LibEntry->m_DrawPinNum ? 'Y' : 'N', m_DrawPinNum ? 'Y' : 'N',
LibEntry->m_DrawPinName ? 'Y' : 'N', m_DrawPinName ? 'Y' : 'N',
LibEntry->m_UnitCount, LibEntry->m_UnitSelectionLocked ? 'L' : 'F', m_UnitCount, m_UnitSelectionLocked ? 'L' : 'F',
LibEntry->m_Options == ENTRY_POWER ? 'P' : 'N' ); m_Options == ENTRY_POWER ? 'P' : 'N' );
WriteLibEntryDateAndTime( ExportFile, LibEntry ); WriteLibEntryDateAndTime( aFile, this );
/* Position / orientation / visibilite des champs */ /* Save fields */
LibEntry->m_Prefix.Save( ExportFile ); m_Prefix.Save( aFile );
LibEntry->m_Name.Save( ExportFile ); m_Name.Save( aFile );
for( Field = LibEntry->Fields; Field!= NULL; for( Field = Fields; Field!= NULL;
Field = (LibDrawField*) Field->Pnext ) Field = (LibDrawField*) Field->Pnext )
{ {
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() ) if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
continue; continue;
Field->Save( ExportFile ); Field->Save( aFile );
} }
/* Sauvegarde de la ligne "ALIAS" */ /* Save the alias list: a line starting by "ALIAS" */
if( LibEntry->m_AliasList.GetCount() != 0 ) if( m_AliasList.GetCount() != 0 )
{ {
fprintf( ExportFile, "ALIAS" ); fprintf( aFile, "ALIAS" );
unsigned ii; unsigned ii;
for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ ) for( ii = 0; ii < m_AliasList.GetCount(); ii++ )
fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_AliasList[ii] ) ); fprintf( aFile, " %s", CONV_TO_UTF8( m_AliasList[ii] ) );
fprintf( ExportFile, "\n" ); fprintf( aFile, "\n" );
} }
/* Write the footprint filter list */ /* Write the footprint filter list */
if( LibEntry->m_FootprintList.GetCount() != 0 ) if( m_FootprintList.GetCount() != 0 )
{ {
fprintf( ExportFile, "$FPLIST\n" ); fprintf( aFile, "$FPLIST\n" );
unsigned ii; unsigned ii;
for( ii = 0; ii < LibEntry->m_FootprintList.GetCount(); ii++ ) for( ii = 0; ii < m_FootprintList.GetCount(); ii++ )
fprintf( ExportFile, " %s\n", CONV_TO_UTF8( LibEntry->m_FootprintList[ii] ) ); fprintf( aFile, " %s\n", CONV_TO_UTF8( m_FootprintList[ii] ) );
fprintf( ExportFile, "$ENDFPLIST\n" ); fprintf( aFile, "$ENDFPLIST\n" );
} }
/* Sauvegarde des elements de trace */ /* Save graphics items (including pins) */
DrawEntry = LibEntry->m_Drawings; if( m_Drawings )
if( LibEntry->m_Drawings )
{ {
/* we sort the draw items, in order to have an edition more easy, /* we sort the draw items, in order to have an edition more easy,
* when a file editing "by hand" is made */ * when a file editing "by hand" is made */
LibEntry->SortDrawItems(); SortDrawItems();
fprintf( ExportFile, "DRAW\n" ); fprintf( aFile, "DRAW\n" );
DrawEntry = LibEntry->m_Drawings; DrawEntry = m_Drawings;
while( DrawEntry ) while( DrawEntry )
{ {
DrawEntry->Save( ExportFile ); DrawEntry->Save( aFile );
DrawEntry = DrawEntry->Next(); DrawEntry = DrawEntry->Next();
} }
fprintf( ExportFile, "ENDDRAW\n" ); fprintf( aFile, "ENDDRAW\n" );
} }
fprintf( ExportFile, "ENDDEF\n" ); fprintf( aFile, "ENDDEF\n" );
return 0; return true;
} }
/*************************************************************************/ /***************************************/
int WriteOneDocLibEntry( FILE* ExportFile, EDA_LibComponentStruct* LibEntry ) bool LibCmpEntry::SaveDoc( FILE* aFile )
/*************************************************************************/ /***************************************/
/**
/* Routine d'ecriture de la doc du composant pointe par LibEntry * Function SaveDoc
* dans le fichier ExportFile( qui doit etre deja ouvert) * writes the doc info out to a FILE in "*.dcm" format.
* return: 0 si Ok * Only non empty fields are written.
* 1 si err write * If all fielsd are empty, does not write anything
* Cependant, si i tous les Pointeurs sur textes sont nulls ( pas de Doc ) * @param aFile The FILE to write to.
* rien ne sera ecrit. * @return bool - true if success writing else false.
*/ */
{ {
if( ( LibEntry->m_Doc.IsEmpty() ) if( m_Doc.IsEmpty() && m_KeyWord.IsEmpty() && m_DocFile.IsEmpty() )
&& ( LibEntry->m_KeyWord.IsEmpty() ) return true;
&& ( LibEntry->m_DocFile.IsEmpty() ) )
return 0;
/* Generation des lignes utiles */ /* Generation des lignes utiles */
fprintf( ExportFile, "#\n$CMP %s\n", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) ); fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( m_Name.m_Text ) );
if( !LibEntry->m_Doc.IsEmpty() ) if( ! m_Doc.IsEmpty() )
fprintf( ExportFile, "D %s\n", CONV_TO_UTF8( LibEntry->m_Doc ) ); fprintf( aFile, "D %s\n", CONV_TO_UTF8( m_Doc ) );
if( !LibEntry->m_KeyWord.IsEmpty() ) if( ! m_KeyWord.IsEmpty() )
fprintf( ExportFile, "K %s\n", CONV_TO_UTF8( LibEntry->m_KeyWord ) ); fprintf( aFile, "K %s\n", CONV_TO_UTF8( m_KeyWord ) );
if( !LibEntry->m_DocFile.IsEmpty() ) if( ! m_DocFile.IsEmpty() )
fprintf( ExportFile, "F %s\n", CONV_TO_UTF8( LibEntry->m_DocFile ) ); fprintf( aFile, "F %s\n", CONV_TO_UTF8( m_DocFile ) );
fprintf( ExportFile, "$ENDCMP\n" ); fprintf( aFile, "$ENDCMP\n" );
return 0; return true;
} }
...@@ -560,11 +555,16 @@ bool LibraryStruct::SaveLibrary( const wxString& FullFileName ) ...@@ -560,11 +555,16 @@ bool LibraryStruct::SaveLibrary( const wxString& FullFileName )
bool success = true; bool success = true;
while( LibEntry ) while( LibEntry )
{ {
if ( WriteOneLibEntry( libfile, LibEntry ) != 0 ) if ( LibEntry->Type == ROOT )
success = false; {
if ( ! LibEntry->Save( libfile ) )
success = false;
}
if ( docfile ) if ( docfile )
if ( WriteOneDocLibEntry( docfile, LibEntry ) != 0 ) {
if ( ! LibEntry->SaveDoc( docfile ) )
success = false; success = false;
}
LibEntry = (EDA_LibComponentStruct*) LibEntry = (EDA_LibComponentStruct*)
PQNext( m_Entries, LibEntry, NULL ); PQNext( m_Entries, LibEntry, NULL );
......
...@@ -275,10 +275,10 @@ void WinEDA_SchematicFrame::CreateScreens() ...@@ -275,10 +275,10 @@ void WinEDA_SchematicFrame::CreateScreens()
m_CurrentSheet->Clear(); m_CurrentSheet->Clear();
m_CurrentSheet->Push( g_RootSheet ); m_CurrentSheet->Push( g_RootSheet );
if( ScreenLib == NULL ) if( g_ScreenLib == NULL )
ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME ); g_ScreenLib = new SCH_SCREEN( LIBEDITOR_FRAME );
ScreenLib->SetZoom( 4 ); g_ScreenLib->SetZoom( 4 );
ScreenLib->m_UndoRedoCountMax = 10; g_ScreenLib->m_UndoRedoCountMax = 10;
} }
...@@ -356,9 +356,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -356,9 +356,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/***************************************************************************** /*****************************************************************************
*
* Enable or disable some tools according to current conditions * Enable or disable some tools according to current conditions
*
*****************************************************************************/ *****************************************************************************/
void WinEDA_SchematicFrame::SetToolbars() void WinEDA_SchematicFrame::SetToolbars()
{ {
...@@ -451,21 +449,27 @@ int WinEDA_SchematicFrame::BestZoom() ...@@ -451,21 +449,27 @@ int WinEDA_SchematicFrame::BestZoom()
return bestzoom; return bestzoom;
} }
/**************************************************************/
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
/**************************************************************/
{ {
WinEDA_AnnotateFrame* dlg = new WinEDA_AnnotateFrame( this ); WinEDA_AnnotateFrame* dlg = new WinEDA_AnnotateFrame( this );
dlg->ShowModal(); dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
} }
/*********************************************************/
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
/*********************************************************/
{ {
WinEDA_ErcFrame* dlg = new WinEDA_ErcFrame( this ); WinEDA_ErcFrame* dlg = new WinEDA_ErcFrame( this );
dlg->ShowModal(); dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
} }
/*******************************************************************/
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
/*******************************************************************/
{ {
int i; int i;
...@@ -481,14 +485,18 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event ) ...@@ -481,14 +485,18 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
// If a plugin is removed or added, rebuild and reopen the new dialog // If a plugin is removed or added, rebuild and reopen the new dialog
} }
/**********************************************************************/
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent & ) void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent & )
/**********************************************************************/
{ {
WinEDA_Build_BOM_Frame* dlg = new WinEDA_Build_BOM_Frame( this ); WinEDA_Build_BOM_Frame* dlg = new WinEDA_Build_BOM_Frame( this );
dlg->ShowModal(); dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
} }
/*******************************************************************/
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
/*******************************************************************/
{ {
this->DrawPanel->m_IgnoreMouseEvents = TRUE; this->DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this ); WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
...@@ -497,7 +505,9 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) ...@@ -497,7 +505,9 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
this->DrawPanel->m_IgnoreMouseEvents = FALSE; this->DrawPanel->m_IgnoreMouseEvents = FALSE;
} }
/***************************************************************/
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
/***************************************************************/
{ {
int i = event.GetId() - ID_LOAD_FILE_1; int i = event.GetId() - ID_LOAD_FILE_1;
...@@ -505,23 +515,31 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) ...@@ -505,23 +515,31 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
SetToolbars(); SetToolbars();
} }
/*******************************************************************/
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
/*******************************************************************/
{ {
ReadInputStuffFile( ); ReadInputStuffFile( );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
/****************************************************************/
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
/****************************************************************/
{ {
LoadOneEEProject( wxEmptyString, true ); LoadOneEEProject( wxEmptyString, true );
} }
/*****************************************************************/
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
/*****************************************************************/
{ {
LoadOneEEProject( wxEmptyString, false ); LoadOneEEProject( wxEmptyString, false );
} }
/****************************************************************/
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
/****************************************************************/
{ {
wxString Line = g_RootSheet->m_AssociatedScreen->m_FileName; wxString Line = g_RootSheet->m_AssociatedScreen->m_FileName;
...@@ -535,7 +553,9 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event ) ...@@ -535,7 +553,9 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
ExecuteFile( this, PCBNEW_EXE ); ExecuteFile( this, PCBNEW_EXE );
} }
/***************************************************************/
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
/***************************************************************/
{ {
wxString Line = g_RootSheet->m_AssociatedScreen->m_FileName; wxString Line = g_RootSheet->m_AssociatedScreen->m_FileName;
...@@ -549,7 +569,9 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event ) ...@@ -549,7 +569,9 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
ExecuteFile( this, CVPCB_EXE ); ExecuteFile( this, CVPCB_EXE );
} }
/*************************************************************************/
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
/*************************************************************************/
{ {
if( m_Parent->m_ViewlibFrame ) if( m_Parent->m_ViewlibFrame )
{ {
...@@ -564,7 +586,9 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) ...@@ -564,7 +586,9 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
} }
} }
/*************************************************************************/
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event ) void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
/*************************************************************************/
{ {
if( m_Parent->m_LibeditFrame ) if( m_Parent->m_LibeditFrame )
{ {
...@@ -578,7 +602,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event ) ...@@ -578,7 +602,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
wxT( "Library Editor" ), wxT( "Library Editor" ),
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
ActiveScreen = ScreenLib; ActiveScreen = g_ScreenLib;
m_Parent->m_LibeditFrame->AdjustScrollBars(); m_Parent->m_LibeditFrame->AdjustScrollBars();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment