Commit 2a1b776b authored by CHARRAS's avatar CHARRAS

see changelog

parent df7e6f37
...@@ -5,6 +5,23 @@ Started 2007-June-11 ...@@ -5,6 +5,23 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
changed in class DrawSheetStruct m_s member name to m_AssociatedScreen
some others minor problems solved.
some files "uncrustified"
Major problem in undo/redo when a sheet is deleted not yet solved
Only for a complex hierarchy, could lost data.
When a sheet is deleted by block delete. it is put in undo list.
It is really deleted after 10 changes (when the undo list is full).
At this time, the associated data is also deleted.
If an other (not deleted) sheet shares the same data, this data is lost.
Need work to solve this problem and keep the undo/redo feature.
2008-Feb-25 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net> 2008-Feb-25 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net>
================================================================================ ================================================================================
+eeschema +eeschema
......
...@@ -34,9 +34,6 @@ void ReAnnotatePowerSymbolsOnly( void ) ...@@ -34,9 +34,6 @@ void ReAnnotatePowerSymbolsOnly( void )
/* Build the screen list (screen, not sheet) */ /* Build the screen list (screen, not sheet) */
EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL );
/* Update the screen number, sheet count and date */
//ScreenList.UpdateScreenNumberAndDate();
DrawSheetList* sheet; DrawSheetList* sheet;
int CmpNumber = 1; int CmpNumber = 1;
...@@ -161,7 +158,7 @@ void DeleteAnnotation( WinEDA_SchematicFrame* parent, bool annotateSchematic ) ...@@ -161,7 +158,7 @@ void DeleteAnnotation( WinEDA_SchematicFrame* parent, bool annotateSchematic )
sheet->DeleteAnnotation( annotateSchematic ); sheet->DeleteAnnotation( annotateSchematic );
g_RootSheet->m_s->SetModify(); g_RootSheet->m_AssociatedScreen->SetModify();
parent->DrawPanel->Refresh( true ); parent->DrawPanel->Refresh( true );
} }
...@@ -192,10 +189,11 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, ...@@ -192,10 +189,11 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
/* Build the sheet list */ /* Build the sheet list */
EDA_SheetList SheetList( g_RootSheet ); EDA_SheetList SheetList( g_RootSheet );
/* Update the sheet number */ /* Update the screen number, sheet count and date */
ii = 0; SheetList.UpdateSheetNumberAndDate();
/* First pass: Component counting */ /* First pass: Component counting */
ii = 0;
sheet = parent->GetSheet(); sheet = parent->GetSheet();
if( annotateSchematic ) if( annotateSchematic )
{ {
...@@ -595,7 +593,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) ...@@ -595,7 +593,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
/* build the screen list */ /* build the screen list */
EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL );
g_RootSheet->m_s->SetModify(); g_RootSheet->m_AssociatedScreen->SetModify();
ii = 0; ii = 0;
/* first pass : count composents */ /* first pass : count composents */
......
...@@ -258,7 +258,7 @@ void WinEDA_AnnotateFrame::OnClear( wxCommandEvent& event ) ...@@ -258,7 +258,7 @@ void WinEDA_AnnotateFrame::OnClear( wxCommandEvent& event )
message += _( "\n\nThis operation will clear the existing annotation " \ message += _( "\n\nThis operation will clear the existing annotation " \
"and cannot be undone." ); "and cannot be undone." );
response = wxMessageBox( message, _( "" ), response = wxMessageBox( message, wxT( "" ),
wxICON_EXCLAMATION | wxOK | wxCANCEL ); wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL) if (response == wxCANCEL)
return; return;
...@@ -283,7 +283,7 @@ void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event ) ...@@ -283,7 +283,7 @@ void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event )
message += _( "\n\nThis operation will change the current annotation and " \ message += _( "\n\nThis operation will change the current annotation and " \
"cannot be undone." ); "cannot be undone." );
response = wxMessageBox( message, _( "" ), response = wxMessageBox( message, wxT( "" ),
wxICON_EXCLAMATION | wxOK | wxCANCEL ); wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL) if (response == wxCANCEL)
return; return;
......
...@@ -832,12 +832,12 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE ...@@ -832,12 +832,12 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{ {
//DuplicateStruct calls GenCopy, which should handle //DuplicateStruct calls GenCopy, which should handle
//m_s and m_sRefCount properly. //m_AssociatedScreen and m_sRefCount properly.
DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; DrawSheetStruct* sheet = (DrawSheetStruct*) Struct;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
//sheet->m_s->m_UndoList = NULL; //sheet->m_AssociatedScreen->m_UndoList = NULL;
//sheet->m_s->m_RedoList = NULL; //sheet->m_AssociatedScreen->m_RedoList = NULL;
//keep m_s pointer & associated. //keep m_AssociatedScreen pointer & associated.
//sheet->m_Son = NULL; m_son is involved in undo and redo. //sheet->m_Son = NULL; m_son is involved in undo and redo.
break; break;
} }
......
This diff is collapsed.
...@@ -51,9 +51,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -51,9 +51,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
{ {
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*)frame->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) frame->GetScreen();
if(!screen->CheckIfOnDrawList(this)) //don't want a loop! if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList(this); screen->AddToDrawList( this );
g_ItemToRepeat = this; g_ItemToRepeat = this;
if( frame->m_Ident == SCHEMATIC_FRAME ) if( frame->m_Ident == SCHEMATIC_FRAME )
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW );
...@@ -117,8 +117,9 @@ void SCH_SCREEN::FreeDrawList() ...@@ -117,8 +117,9 @@ void SCH_SCREEN::FreeDrawList()
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Pnext; EEDrawList = EEDrawList->Pnext;
SAFE_DELETE(DrawStruct); SAFE_DELETE( DrawStruct );
} }
EEDrawList = NULL; EEDrawList = NULL;
} }
...@@ -147,18 +148,25 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct ) ...@@ -147,18 +148,25 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct )
} }
} }
} }
/**************************************************************/ /**************************************************************/
bool SCH_SCREEN::CheckIfOnDrawList( EDA_BaseStruct* st ) bool SCH_SCREEN::CheckIfOnDrawList( EDA_BaseStruct* st )
/**************************************************************/ /**************************************************************/
{ {
EDA_BaseStruct* DrawList = EEDrawList; EDA_BaseStruct* DrawList = EEDrawList;
while( DrawList ){
if( DrawList == st) while( DrawList )
{
if( DrawList == st )
return true; return true;
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
return false; return false;
} }
/**************************************************************/ /**************************************************************/
void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* st ) void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* st )
/**************************************************************/ /**************************************************************/
...@@ -167,6 +175,7 @@ void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* st ) ...@@ -167,6 +175,7 @@ void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* st )
EEDrawList = st; EEDrawList = st;
} }
/*********************************************************************/ /*********************************************************************/
/* Class EDA_ScreenList to handle the list of screens in a hierarchy */ /* Class EDA_ScreenList to handle the list of screens in a hierarchy */
/*********************************************************************/ /*********************************************************************/
...@@ -176,18 +185,19 @@ SCH_SCREEN* EDA_ScreenList::GetFirst() ...@@ -176,18 +185,19 @@ SCH_SCREEN* EDA_ScreenList::GetFirst()
/*****************************************/ /*****************************************/
{ {
m_Index = 0; m_Index = 0;
if(m_List.GetCount() > 0) if( m_List.GetCount() > 0 )
return m_List[0]; return m_List[0];
return NULL; return NULL;
} }
/*****************************************/ /*****************************************/
SCH_SCREEN* EDA_ScreenList::GetNext() SCH_SCREEN* EDA_ScreenList::GetNext()
/*****************************************/ /*****************************************/
{ {
if( m_Index < m_List.GetCount() ) if( m_Index < m_List.GetCount() )
m_Index++; m_Index++;
return GetScreen(m_Index); return GetScreen( m_Index );
} }
...@@ -202,54 +212,55 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index ) ...@@ -202,54 +212,55 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
return m_List[index]; return m_List[index];
return NULL; return NULL;
} }
/************************************************/ /************************************************/
void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen ) void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
/************************************************/ /************************************************/
{ {
if(testscreen == NULL) return; if( testscreen == NULL )
for(unsigned int i=0; i< m_List.GetCount(); i++){ return;
if(m_List[i] == testscreen) for( unsigned int i = 0; i< m_List.GetCount(); i++ )
{
if( m_List[i] == testscreen )
return; return;
} }
m_List.Add(testscreen);
m_List.Add( testscreen );
#ifdef DEBUG #ifdef DEBUG
printf("EDA_ScreenList::AddScreenToList adding %s\n", (const char*)testscreen->m_FileName.mb_str()); printf( "EDA_ScreenList::AddScreenToList adding %s\n",
(const char*) testscreen->m_FileName.mb_str(
) );
#endif #endif
} }
/************************************************/
void EDA_ScreenList::UpdateScreenNumberAndDate( )
/************************************************/
{
SCH_SCREEN* screen;
wxString date = GenDate();
for(int i=0; i<(int)m_List.GetCount(); i++){
screen = m_List[i];
screen->m_ScreenNumber = i;
screen->m_NumberOfScreen = m_List.GetCount();
screen->m_Date = date;
}
}
/************************************************************************/ /************************************************************************/
void EDA_ScreenList::BuildScreenList(EDA_BaseStruct* s) void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
/************************************************************************/ /************************************************************************/
{ {
if(s && s->Type() == DRAW_SHEET_STRUCT_TYPE){ if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
DrawSheetStruct* ds = (DrawSheetStruct*)s; {
s = ds->m_s; DrawSheetStruct* ds = (DrawSheetStruct*) s;
s = ds->m_AssociatedScreen;
} }
if(s && s->Type() == SCREEN_STRUCT_TYPE){ if( s && s->Type() == SCREEN_STRUCT_TYPE )
SCH_SCREEN* screen = (SCH_SCREEN*)s; {
AddScreenToList(screen); SCH_SCREEN* screen = (SCH_SCREEN*) s;
AddScreenToList( screen );
EDA_BaseStruct* strct = screen->EEDrawList; EDA_BaseStruct* strct = screen->EEDrawList;
while(strct){ while( strct )
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){ {
BuildScreenList(strct); if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
BuildScreenList( strct );
} }
strct = strct->Pnext; strct = strct->Pnext;
} }
} }
} }
/*********************************************************************/ /*********************************************************************/
/* Class EDA_SheetList to handle the list of Sheets in a hierarchy */ /* Class EDA_SheetList to handle the list of Sheets in a hierarchy */
/*********************************************************************/ /*********************************************************************/
...@@ -259,23 +270,26 @@ DrawSheetList* EDA_SheetList::GetFirst() ...@@ -259,23 +270,26 @@ DrawSheetList* EDA_SheetList::GetFirst()
/*****************************************/ /*****************************************/
{ {
m_index = 0; m_index = 0;
if(m_count > 0) if( m_count > 0 )
return &( m_List[0] ); return &( m_List[0] );
return NULL; return NULL;
} }
/*****************************************/ /*****************************************/
DrawSheetList* EDA_SheetList::GetNext() DrawSheetList* EDA_SheetList::GetNext()
/*****************************************/ /*****************************************/
{ {
if( m_index < m_count ) if( m_index < m_count )
m_index++; m_index++;
return GetSheet(m_index); return GetSheet( m_index );
} }
/************************************************/ /************************************************/
DrawSheetList* EDA_SheetList::GetSheet(int index ) DrawSheetList* EDA_SheetList::GetSheet( int index )
/************************************************/ /************************************************/
/* return the m_List[index] item /* return the m_List[index] item
*/ */
{ {
...@@ -284,32 +298,80 @@ DrawSheetList* EDA_SheetList::GetSheet(int index ) ...@@ -284,32 +298,80 @@ DrawSheetList* EDA_SheetList::GetSheet(int index )
return NULL; return NULL;
} }
/************************************************************************/ /************************************************************************/
void EDA_SheetList::BuildSheetList(DrawSheetStruct* sheet) void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
/************************************************************************/ /************************************************************************/
{ {
if(m_List == NULL){ if( m_List == NULL )
{
int count = sheet->CountSheets(); int count = sheet->CountSheets();
m_count = count; m_count = count;
m_index = 0; m_index = 0;
if(m_List) free(m_List); m_List = NULL; if( m_List )
free( m_List );m_List = NULL;
count *= sizeof(DrawSheetList); count *= sizeof(DrawSheetList);
m_List = (DrawSheetList*)MyZMalloc(count); m_List = (DrawSheetList*) MyZMalloc( count );
memset((void*)m_List, 0, count); memset( (void*) m_List, 0, count );
m_currList.Clear(); m_currList.Clear();
} }
m_currList.Push(sheet); m_currList.Push( sheet );
m_List[m_index] = m_currList; m_List[m_index] = m_currList;
m_index++; m_index++;
if(sheet->m_s != NULL){ if( sheet->m_AssociatedScreen != NULL )
{
EDA_BaseStruct* strct = m_currList.LastDrawList(); EDA_BaseStruct* strct = m_currList.LastDrawList();
while(strct){ while( strct )
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){ {
DrawSheetStruct* sht = (DrawSheetStruct*)strct; if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
BuildSheetList(sht); {
DrawSheetStruct* sht = (DrawSheetStruct*) strct;
BuildSheetList( sht );
} }
strct = strct->Pnext; strct = strct->Pnext;
} }
} }
m_currList.Pop(); m_currList.Pop();
} }
/************************************************/
void EDA_SheetList::UpdateSheetNumberAndDate()
/************************************************/
/* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all srceens
*/
{
wxString date = GenDate();
int sheet_count = 1, sheet_number = 2; // sheet 1 is the root sheet
for( int ii = 0; ii<(int) m_count; ii++ )
{
DrawSheetList* sheetlist = GetSheet( ii );
sheet_count += sheetlist->m_numSheets;
}
for( int ii = 0; ii<(int) m_count; ii++ )
{
DrawSheetList* sheetlist = GetSheet( ii );
// Read all sheets in path, but not the root sheet (jj = 1)
for( int jj = 1; jj < sheetlist->m_numSheets; jj++ )
{
DrawSheetStruct* sheet = sheetlist->m_sheets[jj];
sheet->m_SheetNumber = sheet_number++;
sheet->m_NumberOfSheets = m_count;
SCH_SCREEN* screen = sheet->m_AssociatedScreen;
if( screen != NULL )
{
screen->m_NumberOfScreen = sheet_count;
screen->m_Date = date;
}
}
}
g_RootSheet->m_AssociatedScreen->m_Date = date;
g_RootSheet->m_AssociatedScreen->m_NumberOfScreen = sheet_count;
g_RootSheet->m_SheetNumber = 1;
g_RootSheet->m_NumberOfSheets = m_count;
}
...@@ -33,13 +33,14 @@ public: ...@@ -33,13 +33,14 @@ public:
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT("SCH_SCREEN"); return wxT( "SCH_SCREEN" );
} }
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( EDA_BaseStruct* DrawStruct ); /* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( EDA_BaseStruct* st ); bool CheckIfOnDrawList( EDA_BaseStruct* st );
void AddToDrawList( EDA_BaseStruct* DrawStruct ); void AddToDrawList( EDA_BaseStruct* DrawStruct );
void ClearUndoORRedoList( EDA_BaseStruct* List ); void ClearUndoORRedoList( EDA_BaseStruct* List );
...@@ -54,12 +55,13 @@ public: ...@@ -54,12 +55,13 @@ public:
}; };
class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct class DrawSheetLabelStruct : public EDA_BaseStruct
, public EDA_TextStruct
{ {
public: public:
int m_Layer; int m_Layer;
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE si non connect� bool m_IsDangling; // TRUE non connected
public: public:
DrawSheetLabelStruct( DrawSheetStruct* parent, DrawSheetLabelStruct( DrawSheetStruct* parent,
...@@ -69,9 +71,10 @@ public: ...@@ -69,9 +71,10 @@ public:
~DrawSheetLabelStruct() { } ~DrawSheetLabelStruct() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT("DrawSheetLabelStruct"); return wxT( "DrawSheetLabelStruct" );
} }
DrawSheetLabelStruct* GenCopy(); DrawSheetLabelStruct* GenCopy();
DrawSheetLabelStruct* Next() DrawSheetLabelStruct* Next()
...@@ -82,7 +85,11 @@ public: ...@@ -82,7 +85,11 @@ public:
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
WX_DEFINE_ARRAY( DrawSheetStruct*, SheetGrowArray );
/* class DrawSheetStruct
This class is the sheet symbol placed in a schematic, and is the entry point for a sub schematic
*/
WX_DEFINE_ARRAY( DrawSheetStruct *, SheetGrowArray );
class DrawSheetStruct : public EDA_BaseStruct /*public SCH_SCREEN*/ /* Gestion de la hierarchie */ class DrawSheetStruct : public EDA_BaseStruct /*public SCH_SCREEN*/ /* Gestion de la hierarchie */
{ {
...@@ -100,16 +107,21 @@ public: ...@@ -100,16 +107,21 @@ public:
int m_Layer; int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/ DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/
int m_NbLabel; /* Nombre de points de connexion */ int m_NbLabel; /* Nombre de points de connexion */
SCH_SCREEN* m_s; SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which handle the physical data
In complex hierarchies we can have many DrawSheetStruct using the same data
*/
int m_SheetNumber; // sheet number (used for info)
int m_NumberOfSheets; // Sheets count in the whole schematic (used for info)
public: public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct(); ~DrawSheetStruct();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT("DrawSheetStruct"); return wxT( "DrawSheetStruct" );
} }
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_DrawFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy(); DrawSheetStruct* GenCopy();
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
...@@ -119,15 +131,21 @@ public: ...@@ -119,15 +131,21 @@ public:
void SwapData( DrawSheetStruct* copyitem ); void SwapData( DrawSheetStruct* copyitem );
void DeleteAnnotation( bool recurse ); void DeleteAnnotation( bool recurse );
int ComponentCount(); int ComponentCount();
bool Load(WinEDA_SchematicFrame* frame); bool Load( WinEDA_SchematicFrame* frame );
bool SearchHierarchy(wxString filename, SCH_SCREEN **screen); bool SearchHierarchy( wxString filename, SCH_SCREEN** screen );
bool LocatePathOfScreen(SCH_SCREEN *screen, DrawSheetList* list); bool LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* list );
int CountSheets(); int CountSheets();
//void RemoveSheet(DrawSheetStruct* sheet); //void RemoveSheet(DrawSheetStruct* sheet);
//to remove a sheet, just delete it //to remove a sheet, just delete it
//-- the destructor should take care of everything else. //-- the destructor should take care of everything else.
}; };
/**********************************************/
/* class to handle a series of sheets *********/
/* a 'path' so to speak.. *********************/
/**********************************************/
#define DSLSZ 32 #define DSLSZ 32
class DrawSheetList class DrawSheetList
{ {
...@@ -136,54 +154,78 @@ public: ...@@ -136,54 +154,78 @@ public:
DrawSheetStruct* m_sheets[DSLSZ]; DrawSheetStruct* m_sheets[DSLSZ];
DrawSheetList(); DrawSheetList();
~DrawSheetList(){}; ~DrawSheetList() { };
void Clear(){m_numSheets = 0; } void Clear() { m_numSheets = 0; }
int Cmp(DrawSheetList& d); int Cmp( DrawSheetList& d );
DrawSheetStruct* Last(); DrawSheetStruct* Last();
SCH_SCREEN* LastScreen(); SCH_SCREEN* LastScreen();
EDA_BaseStruct* LastDrawList(); EDA_BaseStruct* LastDrawList();
void Push(DrawSheetStruct* sheet); void Push( DrawSheetStruct* sheet );
DrawSheetStruct* Pop(); DrawSheetStruct* Pop();
wxString Path(); wxString Path();
wxString PathHumanReadable(); wxString PathHumanReadable();
void UpdateAllScreenReferences(); void UpdateAllScreenReferences();
bool operator= (const DrawSheetList& d1);
bool operator==(const DrawSheetList &d1); bool operator =( const DrawSheetList& d1 );
bool operator!=(const DrawSheetList &d1);
bool operator ==( const DrawSheetList& d1 );
bool operator !=( const DrawSheetList& d1 );
}; };
/*******************************************************/
/* Class to handle the list of *Sheets* in a hierarchy */ /* Class to handle the list of *Sheets* in a hierarchy */
/*******************************************************/
// sheets are not unique - can have many sheets with the same // sheets are not unique - can have many sheets with the same
// filename and the same SCH_SHEET reference. // filename and the same SCH_SHEET reference.
class EDA_SheetList class EDA_SheetList
{ {
private: private:
DrawSheetList* m_List; DrawSheetList* m_List;
int m_count; int m_count;
int m_index; int m_index;
DrawSheetList m_currList; DrawSheetList m_currList;
public: public:
EDA_SheetList( DrawSheetStruct* sheet ){ EDA_SheetList( DrawSheetStruct* sheet )
{
m_index = 0; m_index = 0;
m_count = 0; m_count = 0;
m_List = NULL; m_List = NULL;
if(sheet == NULL) if( sheet == NULL )
sheet = g_RootSheet; sheet = g_RootSheet;
BuildSheetList( sheet ); BuildSheetList( sheet );
} }
~EDA_SheetList() {if(m_List){free(m_List);} m_List = NULL;}
~EDA_SheetList()
{
if( m_List )
{
free( m_List );
}
m_List = NULL;
}
int GetCount() { return m_count; } int GetCount() { return m_count; }
DrawSheetList* GetFirst(); DrawSheetList* GetFirst();
DrawSheetList* GetNext(); DrawSheetList* GetNext();
DrawSheetList* GetSheet(int index ); DrawSheetList* GetSheet( int index );
void UpdateSheetNumberAndDate(); // Update the date displayed in the sheet count
private: private:
void BuildSheetList( DrawSheetStruct* sheet ); void BuildSheetList( DrawSheetStruct* sheet );
}; };
/********************************************************/
/* Class to handle the list of *screens* in a hierarchy */ /* Class to handle the list of *screens* in a hierarchy */
/********************************************************/
// screens are unique, and correspond to .sch files. // screens are unique, and correspond to .sch files.
WX_DEFINE_ARRAY( SCH_SCREEN*, ScreenGrowArray ); WX_DEFINE_ARRAY( SCH_SCREEN *, ScreenGrowArray );
class EDA_ScreenList class EDA_ScreenList
{ {
private: private:
...@@ -191,16 +233,18 @@ private: ...@@ -191,16 +233,18 @@ private:
unsigned int m_Index; unsigned int m_Index;
public: public:
EDA_ScreenList(){ EDA_ScreenList()
{
m_Index = 0; m_Index = 0;
BuildScreenList(g_RootSheet); BuildScreenList( g_RootSheet );
} }
~EDA_ScreenList() {}
~EDA_ScreenList() { }
int GetCount() { return m_List.GetCount(); } int GetCount() { return m_List.GetCount(); }
SCH_SCREEN* GetFirst(); SCH_SCREEN* GetFirst();
SCH_SCREEN* GetNext(); SCH_SCREEN* GetNext();
SCH_SCREEN* GetScreen( unsigned int index ); SCH_SCREEN* GetScreen( unsigned int index );
void UpdateScreenNumberAndDate();
private: private:
void AddScreenToList( SCH_SCREEN* testscreen ); void AddScreenToList( SCH_SCREEN* testscreen );
......
...@@ -140,9 +140,7 @@ void EDA_SchComponentStruct::SetRef( DrawSheetList* sheet, wxString ref ) ...@@ -140,9 +140,7 @@ void EDA_SchComponentStruct::SetRef( DrawSheetList* sheet, wxString ref )
//check to see if it is already there before inserting it //check to see if it is already there before inserting it
wxString path = GetPath( sheet ); wxString path = GetPath( sheet );
printf( "SetRef path: %s ref: %s\n", // printf( "SetRef path: %s ref: %s\n", CONV_TO_UTF8( path ), CONV_TO_UTF8( ref ) ); // Debug
CONV_TO_UTF8( path ),
CONV_TO_UTF8( ref ) );
unsigned int i; unsigned int i;
bool notInArray = true; bool notInArray = true;
for( i = 0; i<m_Paths.GetCount(); i++ ) for( i = 0; i<m_Paths.GetCount(); i++ )
......
...@@ -37,7 +37,8 @@ enum NumFieldType { ...@@ -37,7 +37,8 @@ enum NumFieldType {
* component fields are texts attached to the component (not the graphic texts) * component fields are texts attached to the component (not the graphic texts)
* There are 2 major fields : Reference and Value * There are 2 major fields : Reference and Value
*/ */
class PartTextStruct : public EDA_BaseStruct, public EDA_TextStruct class PartTextStruct : public EDA_BaseStruct
, public EDA_TextStruct
{ {
public: public:
int m_Layer; int m_Layer;
...@@ -78,7 +79,7 @@ public: ...@@ -78,7 +79,7 @@ public:
wxPoint m_Pos; /* Exact position of part. */ wxPoint m_Pos; /* Exact position of part. */
public: public:
DrawPartStruct( KICAD_T struct_type, const wxPoint &pos ); DrawPartStruct( KICAD_T struct_type, const wxPoint& pos );
~DrawPartStruct(); ~DrawPartStruct();
virtual wxString GetClass() const virtual wxString GetClass() const
...@@ -87,12 +88,13 @@ public: ...@@ -87,12 +88,13 @@ public:
} }
}; };
WX_DECLARE_OBJARRAY(DrawSheetList, ArrayOfSheetLists); WX_DECLARE_OBJARRAY( DrawSheetList, ArrayOfSheetLists );
/* the class EDA_SchComponentStruct describes a real component */ /* the class EDA_SchComponentStruct describes a real component */
class EDA_SchComponentStruct : public DrawPartStruct class EDA_SchComponentStruct : public DrawPartStruct
{ {
public: public:
int m_Multi; /* In multi unit chip - which unit to draw. */ int m_Multi; /* In multi unit chip - which unit to draw. */
//int m_FlagControlMulti; //int m_FlagControlMulti;
ArrayOfSheetLists m_UsedOnSheets; ArrayOfSheetLists m_UsedOnSheets;
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */ int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
...@@ -101,9 +103,9 @@ public: ...@@ -101,9 +103,9 @@ public:
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc. wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc.
wxArrayString m_References; // C102, U32 etc. wxArrayString m_References; // C102, U32 etc.
wxString m_PrefixString; //C, R, U, Q etc - the first character which typically indicates what the component is. wxString m_PrefixString; /*C, R, U, Q etc - the first character which typically indicates what the component is.
//determined, upon placement, from the library component. * determined, upon placement, from the library component.
//determined, upon file load, by the first non-digits in the reference fields. * determined, upon file load, by the first non-digits in the reference fields. */
public: public:
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
...@@ -146,11 +148,13 @@ public: ...@@ -146,11 +148,13 @@ public:
//returns a unique ID, in the form of a path. //returns a unique ID, in the form of a path.
wxString GetPath( DrawSheetList* sheet); wxString GetPath( DrawSheetList* sheet );
const wxString GetRef( DrawSheetList* sheet ); const wxString GetRef( DrawSheetList* sheet );
void SetRef( DrawSheetList* sheet, wxString ref ); void SetRef( DrawSheetList* sheet, wxString ref );
void ClearRefs(); void ClearRefs();
#if defined(DEBUG)
#if defined (DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
...@@ -159,6 +163,7 @@ public: ...@@ -159,6 +163,7 @@ public:
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
}; };
......
...@@ -37,20 +37,20 @@ wxString msg; ...@@ -37,20 +37,20 @@ wxString msg;
} }
/* effacement du sous schema correspondant */ /* effacement du sous schema correspondant */
if( FirstSheet->m_s->IsModify() && confirm_deletion ) if( FirstSheet->m_AssociatedScreen->IsModify() && confirm_deletion )
{ {
msg.Printf( _("Sheet %s (file %s) modified. Save it?"), msg.Printf( _("Sheet %s (file %s) modified. Save it?"),
FirstSheet->m_SheetName.GetData(), FirstSheet->m_SheetName.GetData(),
FirstSheet->m_FileName.GetData()); FirstSheet->m_FileName.GetData());
if( IsOK(NULL, msg) ) if( IsOK(NULL, msg) )
{ {
frame->SaveEEFile(FirstSheet->m_s, FILE_SAVE_AS); frame->SaveEEFile(FirstSheet->m_AssociatedScreen, FILE_SAVE_AS);
} }
} }
/* free the sub hierarchy */ /* free the sub hierarchy */
if(FirstSheet->m_s){ if(FirstSheet->m_AssociatedScreen){
EEDrawList = FirstSheet->m_s->EEDrawList; EEDrawList = FirstSheet->m_AssociatedScreen->EEDrawList;
while (EEDrawList != NULL) while (EEDrawList != NULL)
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
...@@ -61,7 +61,7 @@ wxString msg; ...@@ -61,7 +61,7 @@ wxString msg;
} }
} }
/* Effacement des elements de la feuille courante */ /* Effacement des elements de la feuille courante */
FirstSheet->m_s->FreeDrawList(); FirstSheet->m_AssociatedScreen->FreeDrawList();
} }
} }
......
...@@ -544,7 +544,7 @@ wxString mask, filename; ...@@ -544,7 +544,7 @@ wxString mask, filename;
else else
s_ExportSeparatorSymbol = s_ExportSeparator[0]; s_ExportSeparatorSymbol = s_ExportSeparator[0];
m_ListFileName = g_RootSheet->m_s->m_FileName; m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
ChangeFileNameExt(m_ListFileName, EXT_LIST); ChangeFileNameExt(m_ListFileName, EXT_LIST);
//need to get rid of the path. //need to get rid of the path.
m_ListFileName = m_ListFileName.AfterLast('/'); m_ListFileName = m_ListFileName.AfterLast('/');
......
/******************************************************/ /******************************************************/
/** eeconfig.cpp : routines et menus de configuration */ /** eeconfig.cpp : routines et menus de configuration */
/*******************************************************/ /*******************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -18,44 +18,45 @@ ...@@ -18,44 +18,45 @@
/* Variables locales */ /* Variables locales */
#define HOTKEY_FILENAME wxT("eeschema") #define HOTKEY_FILENAME wxT( "eeschema" )
/*********************************************************************/ /*********************************************************************/
void WinEDA_SchematicFrame::Process_Config(wxCommandEvent& event) void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
/*********************************************************************/ /*********************************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxString FullFileName; wxString FullFileName;
wxGetMousePosition(&pos.x, &pos.y); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 5; pos.y += 5;
switch ( id )
switch( id )
{ {
case ID_COLORS_SETUP : case ID_COLORS_SETUP:
DisplayColorSetupFrame(this, pos); DisplayColorSetupFrame( this, pos );
break; break;
case ID_CONFIG_REQ : // Creation de la fenetre de configuration case ID_CONFIG_REQ: // Creation de la fenetre de configuration
InstallConfigFrame(pos); InstallConfigFrame( pos );
break; break;
case ID_OPTIONS_SETUP: case ID_OPTIONS_SETUP:
DisplayOptionFrame(this, pos); DisplayOptionFrame( this, pos );
break; break;
case ID_CONFIG_SAVE: case ID_CONFIG_SAVE:
Save_Config(this); Save_Config( this );
break; break;
case ID_CONFIG_READ: case ID_CONFIG_READ:
{ {
wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext; wxString mask( wxT( "*" ) ); mask += g_Prj_Config_Filename_ext;
FullFileName = g_RootSheet->m_s->m_FileName; FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
FullFileName = EDA_FileSelector(_("Read config file"), FullFileName = EDA_FileSelector( _( "Read config file" ),
wxGetCwd(), /* Chemin par defaut */ wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */ g_Prj_Config_Filename_ext, /* extension par defaut */
...@@ -64,13 +65,14 @@ wxString FullFileName; ...@@ -64,13 +65,14 @@ wxString FullFileName;
wxFD_OPEN, wxFD_OPEN,
TRUE /* ne change pas de repertoire courant */ TRUE /* ne change pas de repertoire courant */
); );
if ( FullFileName.IsEmpty() ) break; if( FullFileName.IsEmpty() )
if ( ! wxFileExists(FullFileName) ) break;
if( !wxFileExists( FullFileName ) )
{ {
wxString msg = _("File ") + FullFileName +_("not found");; wxString msg = _( "File " ) + FullFileName + _( "not found" );;
DisplayError(this, msg); break; DisplayError( this, msg ); break;
} }
Read_Config(FullFileName, TRUE ); Read_Config( FullFileName, TRUE );
} }
break; break;
...@@ -78,11 +80,11 @@ wxString FullFileName; ...@@ -78,11 +80,11 @@ wxString FullFileName;
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
WriteHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, true); WriteHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, true );
break; break;
case ID_PREFERENCES_READ_CONFIG_HOTKEYS: case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
Read_Hotkey_Config( this, true); Read_Hotkey_Config( this, true );
break; break;
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS: case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
...@@ -91,8 +93,8 @@ wxString FullFileName; ...@@ -91,8 +93,8 @@ wxString FullFileName;
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
wxString editorname = GetEditorName(); wxString editorname = GetEditorName();
if ( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
ExecuteFile(this, editorname, FullFileName); ExecuteFile( this, editorname, FullFileName );
} }
break; break;
...@@ -106,90 +108,94 @@ wxString FullFileName; ...@@ -106,90 +108,94 @@ wxString FullFileName;
break; break;
default: default:
DisplayError(this, wxT("WinEDA_SchematicFrame::Process_Config internal error") ); DisplayError( this, wxT( "WinEDA_SchematicFrame::Process_Config internal error" ) );
} }
} }
/***************************************************************/ /***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose ) bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
/***************************************************************/ /***************************************************************/
/* /*
* Read the hotkey files config for eeschema and libedit * Read the hotkey files config for eeschema and libedit
*/ */
{ {
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ); wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
FullFileName += HOTKEY_FILENAME; FullFileName += HOTKEY_FILENAME;
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT; FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
frame->ReadHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, verbose); frame->ReadHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, verbose );
return TRUE; return TRUE;
} }
/***********************************************************************/ /***********************************************************************/
bool Read_Config( const wxString & CfgFileName, bool ForceRereadConfig ) bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
/***********************************************************************/ /***********************************************************************/
/* lit la configuration, si elle n'a pas deja ete lue
1 - lit <nom fichier root>.pro
2 - si non trouve lit <chemin des binaires>../template/kicad.pro
3 - si non trouve: init des variables aux valeurs par defaut
Retourne TRUE si lu, FALSE si config non lue /* lit la configuration, si elle n'a pas deja ete lue
*/ * 1 - lit <nom fichier root>.pro
* 2 - si non trouve lit <chemin des binaires>../template/kicad.pro
* 3 - si non trouve: init des variables aux valeurs par defaut
*
* Retourne TRUE si lu, FALSE si config non lue
*/
{ {
wxString FullFileName; wxString FullFileName;
bool IsRead = TRUE; bool IsRead = TRUE;
wxArrayString liblist_tmp = g_LibName_List; wxArrayString liblist_tmp = g_LibName_List;
if ( CfgFileName.IsEmpty() ) FullFileName = g_RootSheet->m_s->m_FileName; if( CfgFileName.IsEmpty() )
else FullFileName = CfgFileName; FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
else
FullFileName = CfgFileName;
g_LibName_List.Clear(); g_LibName_List.Clear();
if ( ! g_EDA_Appl->ReadProjectConfig(FullFileName, if( !g_EDA_Appl->ReadProjectConfig( FullFileName,
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE) ) // Config non lue GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue
{ {
g_LibName_List = liblist_tmp; g_LibName_List = liblist_tmp;
IsRead = FALSE; IsRead = FALSE;
} }
/* Traitement des variables particulieres: */ /* Traitement des variables particulieres: */
SetRealLibraryPath( wxT("library") ); SetRealLibraryPath( wxT( "library" ) );
// If the list is void, load the libraries "power.lib" and "device.lib" // If the list is void, load the libraries "power.lib" and "device.lib"
if ( g_LibName_List.GetCount() == 0 ) if( g_LibName_List.GetCount() == 0 )
{ {
g_LibName_List.Add( wxT("power") ); g_LibName_List.Add( wxT( "power" ) );
g_LibName_List.Add( wxT("device") ); g_LibName_List.Add( wxT( "device" ) );
} }
if ( g_EDA_Appl->m_SchematicFrame ) if( g_EDA_Appl->m_SchematicFrame )
{ {
g_EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor); g_EDA_Appl->m_SchematicFrame->SetDrawBgColor( g_DrawBgColor );
g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid; g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
} }
LoadLibraries(g_EDA_Appl->m_SchematicFrame); LoadLibraries( g_EDA_Appl->m_SchematicFrame );
return IsRead; return IsRead;
} }
/****************************************************************/ /****************************************************************/
void WinEDA_SchematicFrame::Save_Config(wxWindow * displayframe) void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe )
/***************************************************************/ /***************************************************************/
{ {
wxString path; wxString path;
wxString FullFileName; wxString FullFileName;
wxString mask( wxT("*") ); wxString mask( wxT( "*" ) );
mask += g_Prj_Config_Filename_ext; mask += g_Prj_Config_Filename_ext;
FullFileName = g_RootSheet->m_s->m_FileName.AfterLast('/') /*ConfigFileName*/; FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName.AfterLast( '/' ) /*ConfigFileName*/;
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext ); ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
path = wxGetCwd(); path = wxGetCwd();
FullFileName = EDA_FileSelector(_("Save preferences"), FullFileName = EDA_FileSelector( _( "Save preferences" ),
path, /* Chemin par defaut */ path, /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ FullFileName, /* nom fichier par defaut */
g_Prj_Config_Filename_ext, /* extension par defaut */ g_Prj_Config_Filename_ext, /* extension par defaut */
...@@ -198,9 +204,9 @@ wxString mask( wxT("*") ); ...@@ -198,9 +204,9 @@ wxString mask( wxT("*") );
wxFD_SAVE, wxFD_SAVE,
TRUE TRUE
); );
if ( FullFileName.IsEmpty() ) return; if( FullFileName.IsEmpty() )
return;
/* ecriture de la configuration */ /* ecriture de la configuration */
g_EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList); g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
} }
...@@ -129,7 +129,7 @@ wxString title; ...@@ -129,7 +129,7 @@ wxString title;
void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask) void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask)
/*******************************************************************************/ /*******************************************************************************/
{ {
BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen(); BASE_SCREEN * screen;
wxBeginBusyCursor(); wxBeginBusyCursor();
...@@ -140,7 +140,6 @@ BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen(); ...@@ -140,7 +140,6 @@ BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen();
if ( Print_Sheet_Ref ) if ( Print_Sheet_Ref )
m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth ); m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth );
//m_Parent->m_CurrentSheet->m_s = oldscreen;
wxEndBusyCursor(); wxEndBusyCursor();
} }
......
...@@ -400,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event ) ...@@ -400,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
if( WriteFichierERC == TRUE ) if( WriteFichierERC == TRUE )
{ {
wxString ErcFullFileName; wxString ErcFullFileName;
ErcFullFileName = g_RootSheet->m_s->m_FileName; ErcFullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) ); ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) );
ErcFullFileName = EDA_FileSelector( _( "ERC file:" ), ErcFullFileName = EDA_FileSelector( _( "ERC file:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
......
...@@ -63,7 +63,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) ...@@ -63,7 +63,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
mask = wxT( "*" ) + g_SchExtBuffer; mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ), FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, //default path wxEmptyString, //default path
sheet->m_s->m_FileName,// default filename sheet->m_AssociatedScreen->m_FileName,// default filename
g_SchExtBuffer, // extension par defaut g_SchExtBuffer, // extension par defaut
mask, // Masque d'affichage mask, // Masque d'affichage
this, this,
...@@ -111,8 +111,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe ...@@ -111,8 +111,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
{ {
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) ) if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
return FALSE; return FALSE;
if( g_RootSheet->m_s->m_FileName != g_DefaultSchematicFileName ) if( g_RootSheet->m_AssociatedScreen->m_FileName != g_DefaultSchematicFileName )
SetLastProject( g_RootSheet->m_s->m_FileName ); SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
} }
FullFileName = FileName; FullFileName = FileName;
...@@ -146,7 +146,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe ...@@ -146,7 +146,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) ); memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
//m_CurrentSheet->m_s->Pnext = NULL; should be by default //m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default
if( IsNew ) if( IsNew )
{ {
...@@ -190,7 +190,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe ...@@ -190,7 +190,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
// Loading the project library cache // Loading the project library cache
wxString FullLibName; wxString FullLibName;
wxString shortfilename; wxString shortfilename;
wxSplitPath( g_RootSheet->m_s->m_FileName, NULL, &shortfilename, NULL ); wxSplitPath( g_RootSheet->m_AssociatedScreen->m_FileName, NULL, &shortfilename, NULL );
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) << FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
g_LibExtBuffer; g_LibExtBuffer;
if( wxFileExists( FullLibName ) ) if( wxFileExists( FullLibName ) )
...@@ -211,16 +211,16 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe ...@@ -211,16 +211,16 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
LibCacheExist = TRUE; LibCacheExist = TRUE;
} }
if( !wxFileExists( g_RootSheet->m_s->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{ {
msg.Printf( _( "File %s not found (new project ?)" ), msg.Printf( _( "File %s not found (new project ?)" ),
g_RootSheet->m_s->m_FileName.GetData() ); g_RootSheet->m_AssociatedScreen->m_FileName.GetData() );
DisplayInfo( this, msg, 20 ); DisplayInfo( this, msg, 20 );
return -1; return -1;
} }
//load the project. //load the project.
SAFE_DELETE(g_RootSheet->m_s); SAFE_DELETE(g_RootSheet->m_AssociatedScreen);
if(!g_RootSheet->Load(this)) if(!g_RootSheet->Load(this))
return 0; return 0;
......
...@@ -273,7 +273,7 @@ void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet) ...@@ -273,7 +273,7 @@ void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet)
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe /* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
par la souris par la souris
have to be careful here because the DrawSheetStructs within the EEDrawList have to be careful here because the DrawSheetStructs within the EEDrawList
don't actually have a valid m_s (on purpose -- you need the m_SubSheet hierarchy don't actually have a valid m_AssociatedScreen (on purpose -- you need the m_SubSheet hierarchy
to maintain path info (well, this is but one way to maintain path info..) to maintain path info (well, this is but one way to maintain path info..)
*/ */
{ {
...@@ -297,11 +297,10 @@ static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame) ...@@ -297,11 +297,10 @@ static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
{ {
SCH_SCREEN * NewScreen; SCH_SCREEN * NewScreen;
//SCH_SCREEN * oldscreen = frame->GetScreen(); what is oldscreen used for?
NewScreen = frame->m_CurrentSheet->LastScreen(); NewScreen = frame->m_CurrentSheet->LastScreen();
if(!NewScreen) if(!NewScreen)
NewScreen = g_RootSheet->m_s; NewScreen = g_RootSheet->m_AssociatedScreen;
// Reinit des parametres d'affichage du nouvel ecran // Reinit des parametres d'affichage du nouvel ecran
// assumes m_CurrentSheet has already been updated. // assumes m_CurrentSheet has already been updated.
......
...@@ -656,6 +656,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -656,6 +656,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
EditField( &dc, (LibDrawField*) CurrentDrawItem ); EditField( &dc, (LibDrawField*) CurrentDrawItem );
} }
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
break; break;
...@@ -725,7 +726,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -725,7 +726,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
......
...@@ -65,7 +65,9 @@ OBJECTS = eeschema.o\ ...@@ -65,7 +65,9 @@ OBJECTS = eeschema.o\
savelib.o symbtext.o \ savelib.o symbtext.o \
symbdraw.o \ symbdraw.o \
hierarch.o files-io.o \ hierarch.o files-io.o \
annotate.o plothpgl.o \ annotate.o\
annotate_dialog.o\
plothpgl.o \
plot.o libalias.o \ plot.o libalias.o \
plotps.o netform.o \ plotps.o netform.o \
delsheet.o \ delsheet.o \
...@@ -110,7 +112,9 @@ find.o:find.cpp dialog_find.cpp dialog_find.h $(DEPEND) ...@@ -110,7 +112,9 @@ find.o:find.cpp dialog_find.cpp dialog_find.h $(DEPEND)
eeconfig.o: eeconfig.cpp eeconfig.h $(DEPEND) eeconfig.o: eeconfig.cpp eeconfig.h $(DEPEND)
annotate.o: annotate.cpp annotate_dialog.cpp annotate_dialog.h $(DEPEND) netlist.h annotate.o: annotate.cpp annotate_dialog.h $(DEPEND) netlist.h
annotate_dialog.o: annotate_dialog.cpp annotate_dialog.h $(DEPEND) netlist.h
netlist.o: netlist.cpp $(DEPEND) netlist.h netlist.o: netlist.cpp $(DEPEND) netlist.h
......
...@@ -170,7 +170,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase() ...@@ -170,7 +170,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */ g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
/* count nelist items */ /* count nelist items */
g_RootSheet->m_s->SetModify(); g_RootSheet->m_AssociatedScreen->SetModify();
for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() ) for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() )
{ {
......
...@@ -539,7 +539,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event ) ...@@ -539,7 +539,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
g_NetFormat = CurrPage->m_IdNetType; g_NetFormat = CurrPage->m_IdNetType;
/* Calculate the netlist filename */ /* Calculate the netlist filename */
FullFileName = g_RootSheet->m_s->m_FileName; FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
switch( g_NetFormat ) switch( g_NetFormat )
{ {
...@@ -649,7 +649,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event ) ...@@ -649,7 +649,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' ); CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
/* Calculate the netlist filename */ /* Calculate the netlist filename */
NetlistFullFileName = g_RootSheet->m_s->m_FileName; NetlistFullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) ); ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) );
AddDelimiterString( NetlistFullFileName ); AddDelimiterString( NetlistFullFileName );
CommandLine += wxT( " " ) + NetlistFullFileName; CommandLine += wxT( " " ) + NetlistFullFileName;
......
...@@ -209,7 +209,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -209,7 +209,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TO_PCB: case ID_TO_PCB:
{ {
wxString Line; wxString Line;
if( g_RootSheet->m_s->m_FileName != wxEmptyString ) if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
{ {
Line = GetScreen()->m_FileName; Line = GetScreen()->m_FileName;
AddDelimiterString( Line ); AddDelimiterString( Line );
...@@ -224,9 +224,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -224,9 +224,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TO_CVPCB: case ID_TO_CVPCB:
{ {
wxString Line; wxString Line;
if( g_RootSheet->m_s->m_FileName != wxEmptyString ) if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
{ {
Line = g_RootSheet->m_s->m_FileName; Line = g_RootSheet->m_AssociatedScreen->m_FileName;
AddDelimiterString( Line ); AddDelimiterString( Line );
ChangeFileNameExt( Line, wxEmptyString ); ChangeFileNameExt( Line, wxEmptyString );
ExecuteFile( this, CVPCB_EXE, Line ); ExecuteFile( this, CVPCB_EXE, Line );
......
...@@ -286,7 +286,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -286,7 +286,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
GetScreen()->AddItemToUndoList( NewList ); GetScreen()->AddItemToUndoList( NewList );
/* Clear redo list, because after new save there is no redo to do */ /* Clear redo list, because after new save there is no redo to do */
((SCH_SCREEN*)GetScreen())->ClearUndoORRedoList( GetScreen()->m_RedoList ); ( (SCH_SCREEN*) GetScreen() )->ClearUndoORRedoList( GetScreen()->m_RedoList );
GetScreen()->m_RedoList = NULL; GetScreen()->m_RedoList = NULL;
} }
...@@ -362,7 +362,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -362,7 +362,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
while( PickedList ) while( PickedList )
{ {
item = PickedList->m_Image; item = PickedList->m_Image;
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item ); ( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
PickedList->m_Flags = IS_DELETED; PickedList->m_Flags = IS_DELETED;
...@@ -372,7 +372,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -372,7 +372,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
else else
{ {
FirstItem = List->m_Image; FirstItem = List->m_Image;
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( FirstItem ); ( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( FirstItem );
FirstItem->m_Flags = IS_DELETED; FirstItem->m_Flags = IS_DELETED;
List->m_Son = FirstItem; List->m_Son = FirstItem;
} }
...@@ -407,7 +407,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -407,7 +407,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
case IS_WIRE_IMAGE: case IS_WIRE_IMAGE:
/* Exchange the current wires and the oild wires */ /* Exchange the current wires and the oild wires */
List->m_Son = ((SCH_SCREEN*)GetScreen())->ExtractWires( FALSE ); List->m_Son = ( (SCH_SCREEN*) GetScreen() )->ExtractWires( FALSE );
while( FirstItem ) while( FirstItem )
{ {
EDA_BaseStruct* nextitem = FirstItem->Pnext; EDA_BaseStruct* nextitem = FirstItem->Pnext;
...@@ -437,7 +437,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -437,7 +437,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
case IS_NEW: case IS_NEW:
item = PickedList->m_Image; item = PickedList->m_Image;
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item ); ( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
PickedList->m_Flags = IS_DELETED; PickedList->m_Flags = IS_DELETED;
...@@ -542,16 +542,19 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List ) ...@@ -542,16 +542,19 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
{ {
if( (item->m_Flags & IS_NEW) == 0 ) if( (item->m_Flags & IS_NEW) == 0 )
{ {
printf("schematic undo_redo.cpp: undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n"); printf(
"schematic undo_redo.cpp: undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n" );
/* /*
sheet->EEDrawList = NULL; * sheet->EEDrawList = NULL;
sheet->m_UndoList = NULL; * sheet->m_UndoList = NULL;
sheet->m_RedoList = NULL; * sheet->m_RedoList = NULL;
*/ */
} }
} }
} }
if( (item->m_Flags & IS_NEW) == 0 ){ if( (item->m_Flags & IS_NEW) == 0 )
{
SAFE_DELETE( item ); SAFE_DELETE( item );
} }
} }
...@@ -583,16 +586,19 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List ) ...@@ -583,16 +586,19 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
{ {
if( (FirstItem->m_Flags & IS_NEW) == 0 ) if( (FirstItem->m_Flags & IS_NEW) == 0 )
{ {
printf("schematic undo_redo.cpp undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n"); printf(
"schematic undo_redo.cpp undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n" );
/* /*
sheet->EEDrawList = NULL; * sheet->EEDrawList = NULL;
sheet->m_UndoList = NULL; * sheet->m_UndoList = NULL;
sheet->m_RedoList = NULL; * sheet->m_RedoList = NULL;
*/ */
} }
} }
} }
if( (FirstItem->m_Flags & IS_NEW) == 0 ){ if( (FirstItem->m_Flags & IS_NEW) == 0 )
{
SAFE_DELETE( FirstItem ); SAFE_DELETE( FirstItem );
} }
} }
......
...@@ -215,22 +215,22 @@ wxString WinEDA_SchematicFrame::GetScreenDesc() ...@@ -215,22 +215,22 @@ wxString WinEDA_SchematicFrame::GetScreenDesc()
} }
/******************************/ /*******************************************/
void WinEDA_SchematicFrame::CreateScreens() void WinEDA_SchematicFrame::CreateScreens()
/******************************/ /*******************************************/
{ {
/* creation des ecrans Sch , Lib */ /* creation des ecrans Sch , Lib */
if( g_RootSheet == NULL ) if( g_RootSheet == NULL )
{ {
g_RootSheet = new DrawSheetStruct(); g_RootSheet = new DrawSheetStruct();
} }
if( g_RootSheet->m_s == NULL ) if( g_RootSheet->m_AssociatedScreen == NULL )
{ {
g_RootSheet->m_s = new SCH_SCREEN( SCHEMATIC_FRAME ); g_RootSheet->m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
g_RootSheet->m_s->m_RefCount++; g_RootSheet->m_AssociatedScreen->m_RefCount++;
} }
g_RootSheet->m_s->m_FileName = g_DefaultSchematicFileName; g_RootSheet->m_AssociatedScreen->m_FileName = g_DefaultSchematicFileName;
g_RootSheet->m_s->m_Date = GenDate(); g_RootSheet->m_AssociatedScreen->m_Date = GenDate();
m_CurrentSheet->Clear(); m_CurrentSheet->Clear();
m_CurrentSheet->Push( g_RootSheet ); m_CurrentSheet->Push( g_RootSheet );
...@@ -294,10 +294,11 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -294,10 +294,11 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
} }
} }
if( !GetScreen()->m_FileName.IsEmpty() && (GetScreen()->EEDrawList != NULL) ) if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty() &&
SetLastProject( GetScreen()->m_FileName ); (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
ClearProjectDrawList( g_RootSheet->m_s, TRUE ); ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
/* allof sub sheets are deleted, only the main sheet is useable */ /* allof sub sheets are deleted, only the main sheet is useable */
m_CurrentSheet->Clear(); m_CurrentSheet->Clear();
......
...@@ -159,7 +159,8 @@ void WinEDA_SheetPropertiesFrame::CreateControls() ...@@ -159,7 +159,8 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _( wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _(
"Filename (will be created upon save if it does not already exist):" ), wxDefaultPosition, "Filename (will be created upon save if it does not already exist):" ),
wxDefaultPosition,
wxDefaultSize, 0 ); wxDefaultSize, 0 );
itemBoxSizer4->Add( itemStaticText5, itemBoxSizer4->Add( itemStaticText5,
0, 0,
...@@ -292,25 +293,31 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event ) ...@@ -292,25 +293,31 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
{ {
m_CurrentSheet->m_FileName = FileName; m_CurrentSheet->m_FileName = FileName;
if( wxFileExists( FileName ) )//do we reload the data from the existing file if( wxFileExists( FileName ) ) //do we reload the data from the existing file
{ {
msg.Printf( _( "A file named %s exists, load it (otherwise overwrite it)?" ), FileName.GetData() ); msg.Printf( _(
"A file named %s exists, load it (otherwise overwrite it)?" ),
FileName.GetData() );
if( IsOK( this, msg ) ) if( IsOK( this, msg ) )
{ {
if( m_CurrentSheet->m_s ){ if( m_CurrentSheet->m_AssociatedScreen )
m_CurrentSheet->m_s->m_RefCount--; {
if( m_CurrentSheet->m_s->m_RefCount == 0) m_CurrentSheet->m_AssociatedScreen->m_RefCount--;
SAFE_DELETE(m_CurrentSheet->m_s); if( m_CurrentSheet->m_AssociatedScreen->m_RefCount == 0 )
SAFE_DELETE( m_CurrentSheet->m_AssociatedScreen );
}
m_CurrentSheet->m_AssociatedScreen = NULL; //so that we reload..
m_CurrentSheet->Load( m_Parent );
} }
m_CurrentSheet->m_s = NULL; //so that we reload..
m_CurrentSheet->Load(m_Parent);
} }
}else{ else
{
//just make a new screen if needed. //just make a new screen if needed.
if( !m_CurrentSheet->m_s ){ if( !m_CurrentSheet->m_AssociatedScreen )
m_CurrentSheet->m_s = new SCH_SCREEN(SCHEMATIC_FRAME); {
m_CurrentSheet->m_s->m_RefCount++; //be careful with these m_CurrentSheet->m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
m_CurrentSheet->m_s->m_FileName = FileName; m_CurrentSheet->m_AssociatedScreen->m_RefCount++; //be careful with these
m_CurrentSheet->m_AssociatedScreen->m_FileName = FileName;
} }
} }
} }
...@@ -373,7 +380,7 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC ) ...@@ -373,7 +380,7 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
Sheet->m_Flags = IS_NEW | IS_RESIZED; Sheet->m_Flags = IS_NEW | IS_RESIZED;
Sheet->m_TimeStamp = GetTimeStamp(); Sheet->m_TimeStamp = GetTimeStamp();
Sheet->m_Parent = GetScreen(); Sheet->m_Parent = GetScreen();
Sheet->m_s = NULL; Sheet->m_AssociatedScreen = NULL;
s_SheetMindx = SHEET_MIN_WIDTH; s_SheetMindx = SHEET_MIN_WIDTH;
s_SheetMindy = SHEET_MIN_HEIGHT; s_SheetMindy = SHEET_MIN_HEIGHT;
...@@ -496,7 +503,6 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -496,7 +503,6 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/****************************************/ /****************************************/
/* Routine de sortie du Menu de Sheet */ /* Routine de sortie du Menu de Sheet */
/****************************************/ /****************************************/
...@@ -514,7 +520,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -514,7 +520,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
RedrawOneStruct( Panel, DC, Sheet, g_XorMode ); RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
SAFE_DELETE( Sheet ); SAFE_DELETE( Sheet );
} }
else if( Sheet->m_Flags & IS_RESIZED )/* resize en cours: on l'annule */ else if( Sheet->m_Flags & IS_RESIZED ) /* resize en cours: on l'annule */
{ {
RedrawOneStruct( Panel, DC, Sheet, g_XorMode ); RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
Sheet->m_Size.x = s_OldPos.x; Sheet->m_Size.x = s_OldPos.x;
...@@ -522,7 +528,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -522,7 +528,7 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
Sheet->m_Flags = 0; Sheet->m_Flags = 0;
} }
else if( Sheet->m_Flags & IS_MOVED )/* move en cours: on l'annule */ else if( Sheet->m_Flags & IS_MOVED ) /* move en cours: on l'annule */
{ {
wxPoint curspos = Screen->m_Curseur; wxPoint curspos = Screen->m_Curseur;
Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos; Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos;
...@@ -540,7 +546,6 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -540,7 +546,6 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
......
...@@ -358,8 +358,8 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S ...@@ -358,8 +358,8 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL; DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL;
DrawHierLabelStruct* HLabel = NULL; DrawHierLabelStruct* HLabel = NULL;
if(!Sheet->m_s) return NULL; if(!Sheet->m_AssociatedScreen) return NULL;
DrawStruct = Sheet->m_s->EEDrawList; DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
HLabel = NULL; HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
......
No preview for this file type
This diff is collapsed.
This diff is collapsed.
...@@ -63,9 +63,9 @@ static std::vector<HOLE_INFO> s_HoleListBuffer; ...@@ -63,9 +63,9 @@ static std::vector<HOLE_INFO> s_HoleListBuffer;
#include "dialog_gendrill.cpp" // Dialog box for drill file generation #include "dialog_gendrill.cpp" // Dialog box for drill file generation
/**********************************************/ /************************************************/
void WinEDA_DrillFrame::InitDisplayParams( void ) void WinEDA_DrillFrame::InitDisplayParams( void )
/**********************************************/ /************************************************/
/* some param values initialisation before display dialog window /* some param values initialisation before display dialog window
*/ */
...@@ -121,8 +121,6 @@ void WinEDA_DrillFrame::InitDisplayParams( void ) ...@@ -121,8 +121,6 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
m_MicroViasDrillSizer->Enable( m_MicroViasCount ); m_MicroViasDrillSizer->Enable( m_MicroViasCount );
m_MicroViaDrillValue->Enable( m_MicroViasCount ); m_MicroViaDrillValue->Enable( m_MicroViasCount );
/* Display statistics */
// Pads holes cound: // Pads holes cound:
m_PadsHoleCount = 0; m_PadsHoleCount = 0;
for( MODULE* module = m_Parent->m_Pcb->m_Modules; module != NULL; module = module->Next() ) for( MODULE* module = m_Parent->m_Pcb->m_Modules; module != NULL; module = module->Next() )
...@@ -133,12 +131,12 @@ void WinEDA_DrillFrame::InitDisplayParams( void ) ...@@ -133,12 +131,12 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
{ {
if( pad->m_Drill.x != 0 ) if( pad->m_Drill.x != 0 )
m_PadsHoleCount++; m_PadsHoleCount++;
}
else else
if( MIN( pad->m_Drill.x, pad->m_Drill.y ) != 0 ) if( MIN( pad->m_Drill.x, pad->m_Drill.y ) != 0 )
m_PadsHoleCount++; m_PadsHoleCount++;
} }
} }
}
msg = m_PadsCountInfoMsg->GetLabel(); msg = m_PadsCountInfoMsg->GetLabel();
msg << wxT( " " ) << m_PadsHoleCount; msg << wxT( " " ) << m_PadsHoleCount;
......
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