see changelog
This commit is contained in:
parent
df7e6f3705
commit
2a1b776be6
|
@ -5,6 +5,23 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
+eeschema
|
||||
|
|
|
@ -34,9 +34,6 @@ void ReAnnotatePowerSymbolsOnly( void )
|
|||
/* Build the screen list (screen, not sheet) */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
/* Update the screen number, sheet count and date */
|
||||
|
||||
//ScreenList.UpdateScreenNumberAndDate();
|
||||
|
||||
DrawSheetList* sheet;
|
||||
int CmpNumber = 1;
|
||||
|
@ -161,7 +158,7 @@ void DeleteAnnotation( WinEDA_SchematicFrame* parent, bool annotateSchematic )
|
|||
|
||||
sheet->DeleteAnnotation( annotateSchematic );
|
||||
|
||||
g_RootSheet->m_s->SetModify();
|
||||
g_RootSheet->m_AssociatedScreen->SetModify();
|
||||
parent->DrawPanel->Refresh( true );
|
||||
}
|
||||
|
||||
|
@ -192,10 +189,11 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
|
|||
/* Build the sheet list */
|
||||
EDA_SheetList SheetList( g_RootSheet );
|
||||
|
||||
/* Update the sheet number */
|
||||
ii = 0;
|
||||
/* Update the screen number, sheet count and date */
|
||||
SheetList.UpdateSheetNumberAndDate();
|
||||
|
||||
/* First pass: Component counting */
|
||||
ii = 0;
|
||||
sheet = parent->GetSheet();
|
||||
if( annotateSchematic )
|
||||
{
|
||||
|
@ -595,7 +593,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
|
|||
/* build the screen list */
|
||||
EDA_SheetList SheetList( NULL );
|
||||
|
||||
g_RootSheet->m_s->SetModify();
|
||||
g_RootSheet->m_AssociatedScreen->SetModify();
|
||||
ii = 0;
|
||||
|
||||
/* first pass : count composents */
|
||||
|
|
|
@ -258,7 +258,7 @@ void WinEDA_AnnotateFrame::OnClear( wxCommandEvent& event )
|
|||
|
||||
message += _( "\n\nThis operation will clear the existing annotation " \
|
||||
"and cannot be undone." );
|
||||
response = wxMessageBox( message, _( "" ),
|
||||
response = wxMessageBox( message, wxT( "" ),
|
||||
wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
||||
if (response == wxCANCEL)
|
||||
return;
|
||||
|
@ -283,7 +283,7 @@ void WinEDA_AnnotateFrame::OnApply( wxCommandEvent& event )
|
|||
|
||||
message += _( "\n\nThis operation will change the current annotation and " \
|
||||
"cannot be undone." );
|
||||
response = wxMessageBox( message, _( "" ),
|
||||
response = wxMessageBox( message, wxT( "" ),
|
||||
wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
||||
if (response == wxCANCEL)
|
||||
return;
|
||||
|
|
|
@ -832,12 +832,12 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
|
|||
case DRAW_SHEET_STRUCT_TYPE:
|
||||
{
|
||||
//DuplicateStruct calls GenCopy, which should handle
|
||||
//m_s and m_sRefCount properly.
|
||||
//m_AssociatedScreen and m_sRefCount properly.
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*) Struct;
|
||||
sheet->m_TimeStamp = GetTimeStamp();
|
||||
//sheet->m_s->m_UndoList = NULL;
|
||||
//sheet->m_s->m_RedoList = NULL;
|
||||
//keep m_s pointer & associated.
|
||||
//sheet->m_AssociatedScreen->m_UndoList = NULL;
|
||||
//sheet->m_AssociatedScreen->m_RedoList = NULL;
|
||||
//keep m_AssociatedScreen pointer & associated.
|
||||
//sheet->m_Son = NULL; m_son is involved in undo and redo.
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
/***********************************************************/
|
||||
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
||||
EDA_BaseStruct( DRAW_SHEET_STRUCT_TYPE )
|
||||
EDA_BaseStruct( DRAW_SHEET_STRUCT_TYPE )
|
||||
/***********************************************************/
|
||||
{
|
||||
m_Label = NULL;
|
||||
|
@ -43,9 +43,12 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
|||
m_Layer = LAYER_SHEET;
|
||||
m_Pos = pos;
|
||||
m_SheetNameSize = m_FileNameSize = 60;
|
||||
m_s = NULL;
|
||||
m_SheetName = wxT("Root");
|
||||
m_FileName = wxT(" ");
|
||||
m_AssociatedScreen = NULL;
|
||||
m_SheetName = wxT( "Root" );
|
||||
m_FileName = wxT( " " );
|
||||
m_SheetNumber = 1;
|
||||
m_NumberOfSheets = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,21 +57,25 @@ DrawSheetStruct::~DrawSheetStruct()
|
|||
/**************************************/
|
||||
{
|
||||
DrawSheetLabelStruct* label = m_Label, * next_label;
|
||||
while( label ){
|
||||
|
||||
while( label )
|
||||
{
|
||||
next_label = (DrawSheetLabelStruct*) label->Pnext;
|
||||
delete label;
|
||||
label = next_label;
|
||||
}
|
||||
|
||||
//also, look at the associated sheet & its reference count
|
||||
//perhaps it should be deleted also.
|
||||
if(m_s){
|
||||
m_s->m_RefCount--;
|
||||
if(m_s->m_RefCount == 0)
|
||||
delete m_s;
|
||||
}
|
||||
|
||||
//also, look at the associated sheet & its reference count
|
||||
//perhaps it should be deleted also.
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
m_AssociatedScreen->m_RefCount--;
|
||||
if( m_AssociatedScreen->m_RefCount == 0 )
|
||||
delete m_AssociatedScreen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************/
|
||||
DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||
/***********************************************/
|
||||
|
@ -88,11 +95,11 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
|||
newitem->m_FileNameSize = m_FileNameSize;
|
||||
newitem->m_SheetName = m_SheetName;
|
||||
newitem->m_SheetNameSize = m_SheetNameSize;
|
||||
|
||||
newitem->m_Label = NULL;
|
||||
|
||||
DrawSheetLabelStruct* Slabel = NULL, *label = m_Label;
|
||||
|
||||
|
||||
newitem->m_Label = NULL;
|
||||
|
||||
DrawSheetLabelStruct* Slabel = NULL, * label = m_Label;
|
||||
|
||||
if( label )
|
||||
{
|
||||
Slabel = newitem->m_Label = label->GenCopy();
|
||||
|
@ -108,11 +115,11 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
|||
label = (DrawSheetLabelStruct*) label->Pnext;
|
||||
}
|
||||
|
||||
/* don't copy screen data - just reference it. */
|
||||
newitem->m_s = m_s;
|
||||
if(m_s)
|
||||
m_s->m_RefCount++;
|
||||
|
||||
/* don't copy screen data - just reference it. */
|
||||
newitem->m_AssociatedScreen = m_AssociatedScreen;
|
||||
if( m_AssociatedScreen )
|
||||
m_AssociatedScreen->m_RefCount++;
|
||||
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
@ -120,6 +127,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
|||
/**********************************************************/
|
||||
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||
/**********************************************************/
|
||||
|
||||
/* Used if undo / redo command:
|
||||
* swap data between this and copyitem
|
||||
*/
|
||||
|
@ -132,65 +140,71 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
|||
EXCHG( m_Label, copyitem->m_Label );
|
||||
EXCHG( m_NbLabel, copyitem->m_NbLabel );
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void DrawSheetStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
||||
/****************************************************************/
|
||||
{
|
||||
/* Placement en liste des structures si nouveau composant:*/
|
||||
if( m_Flags & IS_NEW )
|
||||
{
|
||||
if( !( (WinEDA_SchematicFrame*) frame )->EditSheet( this, DC ) )
|
||||
{
|
||||
frame->GetScreen()->SetCurItem( NULL );
|
||||
frame->DrawPanel->ManageCurseur = NULL;
|
||||
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
RedrawOneStruct( frame->DrawPanel, DC, this, g_XorMode );
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* Placement en liste des structures si nouveau composant:*/
|
||||
if( m_Flags & IS_NEW )
|
||||
{
|
||||
if( !( (WinEDA_SchematicFrame*) frame )->EditSheet( this, DC ) )
|
||||
{
|
||||
frame->GetScreen()->SetCurItem( NULL );
|
||||
frame->DrawPanel->ManageCurseur = NULL;
|
||||
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
RedrawOneStruct( frame->DrawPanel, DC, this, g_XorMode );
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EDA_BaseStruct::Place( frame, DC ); //puts it on the EEDrawList.
|
||||
EDA_BaseStruct::Place( frame, DC ); //puts it on the EEDrawList.
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||
/********************************************************************/
|
||||
|
||||
/* Delete pinsheets which are not corresponding to a hierarchal label
|
||||
* if DC != NULL, redraw Sheet
|
||||
* if DC != NULL, redraw Sheet
|
||||
*/
|
||||
{
|
||||
DrawSheetLabelStruct* Pinsheet, * NextPinsheet;
|
||||
DrawSheetLabelStruct* Pinsheet, * NextPinsheet;
|
||||
|
||||
if( !IsOK( frame, _( "Ok to cleanup this sheet" ) ) )
|
||||
return;
|
||||
if( !IsOK( frame, _( "Ok to cleanup this sheet" ) ) )
|
||||
return;
|
||||
|
||||
Pinsheet = m_Label;
|
||||
while( Pinsheet )
|
||||
{
|
||||
/* Search Hlabel corresponding to this Pinsheet */
|
||||
Pinsheet = m_Label;
|
||||
while( Pinsheet )
|
||||
{
|
||||
/* Search Hlabel corresponding to this Pinsheet */
|
||||
|
||||
EDA_BaseStruct* DrawStruct = m_s->EEDrawList;
|
||||
DrawHierLabelStruct* HLabel = NULL;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE )
|
||||
continue;
|
||||
HLabel = (DrawHierLabelStruct*) DrawStruct;
|
||||
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
|
||||
break; // Found!
|
||||
HLabel = NULL;
|
||||
}
|
||||
EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList;
|
||||
DrawHierLabelStruct* HLabel = NULL;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
if( DrawStruct->Type() != DRAW_HIER_LABEL_STRUCT_TYPE )
|
||||
continue;
|
||||
HLabel = (DrawHierLabelStruct*) DrawStruct;
|
||||
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
|
||||
break; // Found!
|
||||
HLabel = NULL;
|
||||
}
|
||||
|
||||
NextPinsheet = (DrawSheetLabelStruct*) Pinsheet->Pnext;
|
||||
if( HLabel == NULL ) // Hlabel not found: delete pinsheet
|
||||
{
|
||||
frame->GetScreen()->SetModify();
|
||||
frame->DeleteSheetLabel( DC, Pinsheet );
|
||||
}
|
||||
Pinsheet = NextPinsheet;
|
||||
}
|
||||
NextPinsheet = (DrawSheetLabelStruct*) Pinsheet->Pnext;
|
||||
if( HLabel == NULL ) // Hlabel not found: delete pinsheet
|
||||
{
|
||||
frame->GetScreen()->SetModify();
|
||||
frame->DeleteSheetLabel( DC, Pinsheet );
|
||||
}
|
||||
Pinsheet = NextPinsheet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************************/
|
||||
void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int DrawMode, int Color )
|
||||
|
@ -247,143 +261,183 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& of
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************************/
|
||||
void DrawSheetStruct::DeleteAnnotation( bool recurse )
|
||||
/**************************************************************************************/
|
||||
{
|
||||
if(recurse && m_s){
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
for(; strct; strct = strct->Pnext){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*)strct;
|
||||
sheet->DeleteAnnotation(recurse);
|
||||
}
|
||||
}
|
||||
}
|
||||
EDA_BaseStruct* comp = m_s->EEDrawList;
|
||||
for( ; comp ; comp = comp->Pnext ){
|
||||
if(comp->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ){
|
||||
((EDA_SchComponentStruct*)comp)->ClearAnnotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*******************************************************************/
|
||||
int DrawSheetStruct::ComponentCount( )
|
||||
/*******************************************************************/
|
||||
{
|
||||
//count our own components, without the power components.
|
||||
/* Routine retournant le nombre de composants dans le schema,
|
||||
* powers non comprises */
|
||||
int n = 0;
|
||||
if(m_s){
|
||||
EDA_BaseStruct* bs;
|
||||
for( bs = m_s->EEDrawList; bs != NULL; bs = bs->Pnext ){
|
||||
if( bs->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ){
|
||||
DrawPartStruct* Cmp = (DrawPartStruct*) bs;
|
||||
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
|
||||
n++;
|
||||
}
|
||||
if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*)bs;
|
||||
n += sheet->ComponentCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::SearchHierarchy(wxString filename, SCH_SCREEN **screen)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if(m_s){
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)strct;
|
||||
if(ss->m_s && ss->m_s->m_FileName.CmpNoCase(filename) == 0){
|
||||
*screen = ss->m_s;
|
||||
return true;
|
||||
}
|
||||
if(ss->SearchHierarchy(filename, screen))
|
||||
return true;
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::LocatePathOfScreen(SCH_SCREEN *screen, DrawSheetList* list)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
//don't bother looking at the root sheet - it must be unique,
|
||||
//no other references to its m_s otherwise there would be loops
|
||||
//in the heirarchy.
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if(m_s){
|
||||
list->Push(this);
|
||||
if(m_s == screen)
|
||||
return true;
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)strct;
|
||||
if(ss->LocatePathOfScreen(screen, list))
|
||||
return true;
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
list->Pop();
|
||||
}
|
||||
return false;
|
||||
if( recurse && m_AssociatedScreen )
|
||||
{
|
||||
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
||||
for( ; strct; strct = strct->Pnext )
|
||||
{
|
||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*) strct;
|
||||
sheet->DeleteAnnotation( recurse );
|
||||
}
|
||||
}
|
||||
}
|
||||
EDA_BaseStruct* comp = m_AssociatedScreen->EEDrawList;
|
||||
for( ; comp; comp = comp->Pnext )
|
||||
{
|
||||
if( comp->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
( (EDA_SchComponentStruct*) comp )->ClearAnnotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
int DrawSheetStruct::ComponentCount()
|
||||
/*******************************************************************/
|
||||
{
|
||||
//count our own components, without the power components.
|
||||
|
||||
/* Routine retournant le nombre de composants dans le schema,
|
||||
* powers non comprises */
|
||||
int n = 0;
|
||||
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
EDA_BaseStruct* bs;
|
||||
for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Pnext )
|
||||
{
|
||||
if( bs->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
DrawPartStruct* Cmp = (DrawPartStruct*) bs;
|
||||
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
|
||||
n++;
|
||||
}
|
||||
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* sheet = (DrawSheetStruct*) bs;
|
||||
n += sheet->ComponentCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::Load(WinEDA_SchematicFrame* frame)
|
||||
bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen )
|
||||
/*******************************************************************************/
|
||||
{
|
||||
if(!m_s){
|
||||
SCH_SCREEN* screen = NULL;
|
||||
g_RootSheet->SearchHierarchy(m_FileName, &screen);
|
||||
if(screen){
|
||||
m_s = screen;
|
||||
m_s->m_RefCount++;
|
||||
//do not need to load the sub-sheets - this has already been done.
|
||||
}else{
|
||||
m_s = new SCH_SCREEN(SCHEMATIC_FRAME);
|
||||
m_s->m_RefCount++;
|
||||
if(!frame->LoadOneEEFile(m_s, m_FileName))
|
||||
return false;
|
||||
EDA_BaseStruct* bs = m_s->EEDrawList;
|
||||
while(bs){
|
||||
if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)bs;
|
||||
if(!ss->Load(frame))
|
||||
return false;
|
||||
}
|
||||
bs = bs->Pnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
||||
while( strct )
|
||||
{
|
||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
|
||||
if( ss->m_AssociatedScreen && ss->m_AssociatedScreen->m_FileName.CmpNoCase( filename ) == 0 )
|
||||
{
|
||||
*screen = ss->m_AssociatedScreen;
|
||||
return true;
|
||||
}
|
||||
if( ss->SearchHierarchy( filename, screen ) )
|
||||
return true;
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* list )
|
||||
/*******************************************************************************/
|
||||
{
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
//don't bother looking at the root sheet - it must be unique,
|
||||
//no other references to its m_s otherwise there would be loops
|
||||
//in the heirarchy.
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
list->Push( this );
|
||||
if( m_AssociatedScreen == screen )
|
||||
return true;
|
||||
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
||||
while( strct )
|
||||
{
|
||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
|
||||
if( ss->LocatePathOfScreen( screen, list ) )
|
||||
return true;
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
|
||||
list->Pop();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame )
|
||||
/*******************************************************************************/
|
||||
{
|
||||
if( !m_AssociatedScreen )
|
||||
{
|
||||
SCH_SCREEN* screen = NULL;
|
||||
g_RootSheet->SearchHierarchy( m_FileName, &screen );
|
||||
if( screen )
|
||||
{
|
||||
m_AssociatedScreen = screen;
|
||||
m_AssociatedScreen->m_RefCount++;
|
||||
|
||||
//do not need to load the sub-sheets - this has already been done.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
|
||||
m_AssociatedScreen->m_RefCount++;
|
||||
if( !frame->LoadOneEEFile( m_AssociatedScreen, m_FileName ) )
|
||||
return false;
|
||||
EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList;
|
||||
while( bs )
|
||||
{
|
||||
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*) bs;
|
||||
if( !ss->Load( frame ) )
|
||||
return false;
|
||||
}
|
||||
bs = bs->Pnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
int DrawSheetStruct::CountSheets()
|
||||
/*******************************************************************************/
|
||||
{
|
||||
int count = 1; //1 = this!!
|
||||
if(m_s){
|
||||
EDA_BaseStruct* strct = m_s->EEDrawList;
|
||||
for(; strct; strct = strct->Pnext){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*)strct;
|
||||
count += ss->CountSheets();
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
int count = 1; //1 = this!!
|
||||
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
||||
for( ; strct; strct = strct->Pnext )
|
||||
{
|
||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
|
||||
count += ss->CountSheets();
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
@ -394,8 +448,8 @@ int DrawSheetStruct::CountSheets()
|
|||
/*******************************************************************/
|
||||
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos, const wxString& text ) :
|
||||
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ),
|
||||
EDA_TextStruct( text )
|
||||
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE )
|
||||
, EDA_TextStruct( text )
|
||||
/*******************************************************************/
|
||||
{
|
||||
m_Layer = LAYER_SHEETLABEL;
|
||||
|
@ -511,115 +565,179 @@ void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoin
|
|||
GRPoly( &panel->m_ClipBox, DC, NbSegm, coord, FillShape, LineWidth, txtcolor, txtcolor ); /* Poly Non rempli */
|
||||
}
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* class to handle a series of sheets *********/
|
||||
/* a 'path' so to speak.. *********************/
|
||||
/**********************************************/
|
||||
DrawSheetList::DrawSheetList(){
|
||||
for(int i=0; i<DSLSZ ; i++)
|
||||
m_sheets[i] = NULL;
|
||||
m_numSheets = 0;
|
||||
DrawSheetList::DrawSheetList()
|
||||
{
|
||||
for( int i = 0; i<DSLSZ; i++ )
|
||||
m_sheets[i] = NULL;
|
||||
|
||||
m_numSheets = 0;
|
||||
}
|
||||
int DrawSheetList::Cmp(DrawSheetList& d){
|
||||
if(m_numSheets > d.m_numSheets)
|
||||
return 1;
|
||||
if(m_numSheets < d.m_numSheets)
|
||||
return -1;
|
||||
//otherwise, same number of sheets.
|
||||
for(int i=0; i<m_numSheets; i++){
|
||||
if(m_sheets[i]->m_TimeStamp > d.m_sheets[i]->m_TimeStamp)
|
||||
return 1;
|
||||
if(m_sheets[i]->m_TimeStamp < d.m_sheets[i]->m_TimeStamp)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
int DrawSheetList::Cmp( DrawSheetList& d )
|
||||
{
|
||||
if( m_numSheets > d.m_numSheets )
|
||||
return 1;
|
||||
if( m_numSheets < d.m_numSheets )
|
||||
return -1;
|
||||
|
||||
//otherwise, same number of sheets.
|
||||
for( int i = 0; i<m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i]->m_TimeStamp > d.m_sheets[i]->m_TimeStamp )
|
||||
return 1;
|
||||
if( m_sheets[i]->m_TimeStamp < d.m_sheets[i]->m_TimeStamp )
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
DrawSheetStruct* DrawSheetList::Last(){
|
||||
if(m_numSheets)
|
||||
return m_sheets[m_numSheets-1];
|
||||
return NULL;
|
||||
|
||||
|
||||
DrawSheetStruct* DrawSheetList::Last()
|
||||
{
|
||||
if( m_numSheets )
|
||||
return m_sheets[m_numSheets - 1];
|
||||
return NULL;
|
||||
}
|
||||
SCH_SCREEN* DrawSheetList::LastScreen(){
|
||||
if(m_numSheets)
|
||||
return m_sheets[m_numSheets-1]->m_s;
|
||||
return NULL;
|
||||
|
||||
|
||||
SCH_SCREEN* DrawSheetList::LastScreen()
|
||||
{
|
||||
if( m_numSheets )
|
||||
return m_sheets[m_numSheets - 1]->m_AssociatedScreen;
|
||||
return NULL;
|
||||
}
|
||||
EDA_BaseStruct* DrawSheetList::LastDrawList(){
|
||||
if(m_numSheets && m_sheets[m_numSheets-1]->m_s)
|
||||
return m_sheets[m_numSheets-1]->m_s->EEDrawList;
|
||||
return NULL;
|
||||
|
||||
|
||||
EDA_BaseStruct* DrawSheetList::LastDrawList()
|
||||
{
|
||||
if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen )
|
||||
return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList;
|
||||
return NULL;
|
||||
}
|
||||
void DrawSheetList::Push(DrawSheetStruct* sheet){
|
||||
if(m_numSheets < DSLSZ){
|
||||
m_sheets[m_numSheets] = sheet;
|
||||
m_numSheets++;
|
||||
}
|
||||
|
||||
|
||||
void DrawSheetList::Push( DrawSheetStruct* sheet )
|
||||
{
|
||||
if( m_numSheets < DSLSZ )
|
||||
{
|
||||
m_sheets[m_numSheets] = sheet;
|
||||
m_numSheets++;
|
||||
}
|
||||
}
|
||||
DrawSheetStruct* DrawSheetList::Pop(){
|
||||
if(m_numSheets > 0){
|
||||
m_numSheets --;
|
||||
return m_sheets[m_numSheets];
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
DrawSheetStruct* DrawSheetList::Pop()
|
||||
{
|
||||
if( m_numSheets > 0 )
|
||||
{
|
||||
m_numSheets--;
|
||||
return m_sheets[m_numSheets];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
wxString DrawSheetList::Path(){
|
||||
wxString s, t;
|
||||
s = wxT("/");
|
||||
//start at 1 to avoid the root sheet,
|
||||
//which does not need to be added to the path
|
||||
//it's timestamp changes anyway.
|
||||
for(int i=1; i< m_numSheets; i++){
|
||||
t.Printf(_("%8.8lX/"), m_sheets[i]->m_TimeStamp);
|
||||
s = s + t;
|
||||
}
|
||||
return s;
|
||||
|
||||
|
||||
wxString DrawSheetList::Path()
|
||||
{
|
||||
wxString s, t;
|
||||
|
||||
s = wxT( "/" );
|
||||
|
||||
//start at 1 to avoid the root sheet,
|
||||
//which does not need to be added to the path
|
||||
//it's timestamp changes anyway.
|
||||
for( int i = 1; i< m_numSheets; i++ )
|
||||
{
|
||||
t.Printf( _( "%8.8lX/" ), m_sheets[i]->m_TimeStamp );
|
||||
s = s + t;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
wxString DrawSheetList::PathHumanReadable(){
|
||||
wxString s, t;
|
||||
s = wxT("/");
|
||||
//start at 1 to avoid the root sheet, as above.
|
||||
for(int i=1; i< m_numSheets; i++){
|
||||
s = s + m_sheets[i]->m_SheetName + wxT("/");
|
||||
}
|
||||
return s;
|
||||
|
||||
|
||||
wxString DrawSheetList::PathHumanReadable()
|
||||
{
|
||||
wxString s, t;
|
||||
|
||||
s = wxT( "/" );
|
||||
|
||||
//start at 1 to avoid the root sheet, as above.
|
||||
for( int i = 1; i< m_numSheets; i++ )
|
||||
{
|
||||
s = s + m_sheets[i]->m_SheetName + wxT( "/" );
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
void DrawSheetList::UpdateAllScreenReferences(){
|
||||
EDA_BaseStruct* t = LastDrawList();
|
||||
while(t){
|
||||
if(t->Type() == DRAW_LIB_ITEM_STRUCT_TYPE){
|
||||
EDA_SchComponentStruct* d = (EDA_SchComponentStruct*)t;
|
||||
d->m_Field[REFERENCE].m_Text = d->GetRef(this);
|
||||
}
|
||||
t = t->Pnext;
|
||||
}
|
||||
printf( "on sheet: %s \n", CONV_TO_UTF8(PathHumanReadable()) );
|
||||
|
||||
|
||||
void DrawSheetList::UpdateAllScreenReferences()
|
||||
{
|
||||
EDA_BaseStruct* t = LastDrawList();
|
||||
|
||||
while( t )
|
||||
{
|
||||
if( t->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
|
||||
{
|
||||
EDA_SchComponentStruct* d = (EDA_SchComponentStruct*) t;
|
||||
d->m_Field[REFERENCE].m_Text = d->GetRef( this );
|
||||
}
|
||||
t = t->Pnext;
|
||||
}
|
||||
|
||||
printf( "on sheet: %s \n", CONV_TO_UTF8( PathHumanReadable() ) );
|
||||
}
|
||||
bool DrawSheetList::operator= (const DrawSheetList& d1){
|
||||
m_numSheets = d1.m_numSheets;
|
||||
int i;
|
||||
for(i=0; i<m_numSheets; i++){
|
||||
m_sheets[i] = d1.m_sheets[i];
|
||||
}
|
||||
for(; i<DSLSZ; i++){
|
||||
m_sheets[i] = 0;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
bool DrawSheetList::operator=( const DrawSheetList& d1 )
|
||||
{
|
||||
m_numSheets = d1.m_numSheets;
|
||||
int i;
|
||||
for( i = 0; i<m_numSheets; i++ )
|
||||
{
|
||||
m_sheets[i] = d1.m_sheets[i];
|
||||
}
|
||||
|
||||
for( ; i<DSLSZ; i++ )
|
||||
{
|
||||
m_sheets[i] = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DrawSheetList::operator==(const DrawSheetList &d1){
|
||||
if(m_numSheets != d1.m_numSheets)
|
||||
return false;
|
||||
for(int i=0; i<m_numSheets; i++){
|
||||
if(m_sheets[i] != d1.m_sheets[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
bool DrawSheetList::operator==( const DrawSheetList& d1 )
|
||||
{
|
||||
if( m_numSheets != d1.m_numSheets )
|
||||
return false;
|
||||
for( int i = 0; i<m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i] != d1.m_sheets[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DrawSheetList::operator!=(const DrawSheetList &d1){
|
||||
if(m_numSheets != d1.m_numSheets)
|
||||
return true;
|
||||
for(int i=0; i<m_numSheets; i++){
|
||||
if(m_sheets[i] != d1.m_sheets[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
bool DrawSheetList::operator!=( const DrawSheetList& d1 )
|
||||
{
|
||||
if( m_numSheets != d1.m_numSheets )
|
||||
return true;
|
||||
for( int i = 0; i<m_numSheets; i++ )
|
||||
{
|
||||
if( m_sheets[i] != d1.m_sheets[i] )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
|
|||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||
case DRAW_BUSENTRY_STRUCT_TYPE:
|
||||
|
@ -51,9 +51,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
|||
{
|
||||
if( m_Flags & IS_NEW )
|
||||
{
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*)frame->GetScreen();
|
||||
if(!screen->CheckIfOnDrawList(this)) //don't want a loop!
|
||||
screen->AddToDrawList(this);
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) frame->GetScreen();
|
||||
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
|
||||
screen->AddToDrawList( this );
|
||||
g_ItemToRepeat = this;
|
||||
if( frame->m_Ident == SCHEMATIC_FRAME )
|
||||
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_NEW );
|
||||
|
@ -80,7 +80,7 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
|
|||
static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */
|
||||
|
||||
/* Constructeur de SCREEN */
|
||||
SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
|
||||
SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
|
||||
BASE_SCREEN( screentype, aType )
|
||||
{
|
||||
EEDrawList = NULL; /* Schematic items list */
|
||||
|
@ -89,9 +89,9 @@ SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
|
|||
SetZoomList( table_zoom );
|
||||
SetGridList( g_GridList );
|
||||
m_UndoRedoCountMax = 10;
|
||||
m_RefCount = 0;
|
||||
m_ScreenNumber = 1;
|
||||
m_NumberOfScreen = 1;
|
||||
m_RefCount = 0;
|
||||
m_ScreenNumber = 1;
|
||||
m_NumberOfScreen = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,9 +117,10 @@ void SCH_SCREEN::FreeDrawList()
|
|||
{
|
||||
DrawStruct = EEDrawList;
|
||||
EEDrawList = EEDrawList->Pnext;
|
||||
SAFE_DELETE(DrawStruct);
|
||||
SAFE_DELETE( DrawStruct );
|
||||
}
|
||||
EEDrawList = NULL;
|
||||
|
||||
EEDrawList = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,26 +148,34 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
bool SCH_SCREEN::CheckIfOnDrawList( EDA_BaseStruct* st )
|
||||
/**************************************************************/
|
||||
{
|
||||
EDA_BaseStruct* DrawList = EEDrawList;
|
||||
while( DrawList ){
|
||||
if( DrawList == st)
|
||||
return true;
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
return false;
|
||||
EDA_BaseStruct* DrawList = EEDrawList;
|
||||
|
||||
while( DrawList )
|
||||
{
|
||||
if( DrawList == st )
|
||||
return true;
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* st )
|
||||
/**************************************************************/
|
||||
{ //simple function to add to the head of the drawlist.
|
||||
st->Pnext = EEDrawList;
|
||||
EEDrawList = st;
|
||||
st->Pnext = EEDrawList;
|
||||
EEDrawList = st;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* Class EDA_ScreenList to handle the list of screens in a hierarchy */
|
||||
/*********************************************************************/
|
||||
|
@ -176,18 +185,19 @@ SCH_SCREEN* EDA_ScreenList::GetFirst()
|
|||
/*****************************************/
|
||||
{
|
||||
m_Index = 0;
|
||||
if(m_List.GetCount() > 0)
|
||||
return m_List[0];
|
||||
return NULL;
|
||||
if( m_List.GetCount() > 0 )
|
||||
return m_List[0];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************/
|
||||
SCH_SCREEN* EDA_ScreenList::GetNext()
|
||||
/*****************************************/
|
||||
{
|
||||
if( m_Index < m_List.GetCount() )
|
||||
if( m_Index < m_List.GetCount() )
|
||||
m_Index++;
|
||||
return GetScreen(m_Index);
|
||||
return GetScreen( m_Index );
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,58 +208,59 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( unsigned int index )
|
|||
/* return the m_List[index] item
|
||||
*/
|
||||
{
|
||||
if( index < m_List.GetCount() )
|
||||
return m_List[index];
|
||||
return NULL;
|
||||
if( index < m_List.GetCount() )
|
||||
return m_List[index];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void EDA_ScreenList::AddScreenToList( SCH_SCREEN* testscreen )
|
||||
/************************************************/
|
||||
{
|
||||
if(testscreen == NULL) return;
|
||||
for(unsigned int i=0; i< m_List.GetCount(); i++){
|
||||
if(m_List[i] == testscreen)
|
||||
return;
|
||||
}
|
||||
m_List.Add(testscreen);
|
||||
if( testscreen == NULL )
|
||||
return;
|
||||
for( unsigned int i = 0; i< m_List.GetCount(); i++ )
|
||||
{
|
||||
if( m_List[i] == testscreen )
|
||||
return;
|
||||
}
|
||||
|
||||
m_List.Add( testscreen );
|
||||
#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
|
||||
}
|
||||
/************************************************/
|
||||
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){
|
||||
DrawSheetStruct* ds = (DrawSheetStruct*)s;
|
||||
s = ds->m_s;
|
||||
}
|
||||
if(s && s->Type() == SCREEN_STRUCT_TYPE){
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*)s;
|
||||
AddScreenToList(screen);
|
||||
EDA_BaseStruct* strct = screen->EEDrawList;
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
BuildScreenList(strct);
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* ds = (DrawSheetStruct*) s;
|
||||
s = ds->m_AssociatedScreen;
|
||||
}
|
||||
if( s && s->Type() == SCREEN_STRUCT_TYPE )
|
||||
{
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) s;
|
||||
AddScreenToList( screen );
|
||||
EDA_BaseStruct* strct = screen->EEDrawList;
|
||||
while( strct )
|
||||
{
|
||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
BuildScreenList( strct );
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* Class EDA_SheetList to handle the list of Sheets in a hierarchy */
|
||||
/*********************************************************************/
|
||||
|
@ -258,58 +269,109 @@ void EDA_ScreenList::BuildScreenList(EDA_BaseStruct* s)
|
|||
DrawSheetList* EDA_SheetList::GetFirst()
|
||||
/*****************************************/
|
||||
{
|
||||
m_index = 0;
|
||||
if(m_count > 0)
|
||||
return &( m_List[0] );
|
||||
return NULL;
|
||||
m_index = 0;
|
||||
if( m_count > 0 )
|
||||
return &( m_List[0] );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************/
|
||||
DrawSheetList* EDA_SheetList::GetNext()
|
||||
/*****************************************/
|
||||
{
|
||||
if( m_index < m_count )
|
||||
m_index++;
|
||||
return GetSheet(m_index);
|
||||
if( m_index < m_count )
|
||||
m_index++;
|
||||
return GetSheet( m_index );
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
DrawSheetList* EDA_SheetList::GetSheet(int index )
|
||||
DrawSheetList* EDA_SheetList::GetSheet( int index )
|
||||
/************************************************/
|
||||
|
||||
/* return the m_List[index] item
|
||||
*/
|
||||
{
|
||||
if( index < m_count )
|
||||
return &(m_List[index]);
|
||||
return NULL;
|
||||
if( index < m_count )
|
||||
return &(m_List[index]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
void EDA_SheetList::BuildSheetList(DrawSheetStruct* sheet)
|
||||
void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
|
||||
/************************************************************************/
|
||||
{
|
||||
if(m_List == NULL){
|
||||
int count = sheet->CountSheets();
|
||||
m_count = count;
|
||||
m_index = 0;
|
||||
if(m_List) free(m_List); m_List = NULL;
|
||||
count *= sizeof(DrawSheetList);
|
||||
m_List = (DrawSheetList*)MyZMalloc(count);
|
||||
memset((void*)m_List, 0, count);
|
||||
m_currList.Clear();
|
||||
}
|
||||
m_currList.Push(sheet);
|
||||
m_List[m_index] = m_currList;
|
||||
m_index++;
|
||||
if(sheet->m_s != NULL){
|
||||
EDA_BaseStruct* strct = m_currList.LastDrawList();
|
||||
while(strct){
|
||||
if(strct->Type() == DRAW_SHEET_STRUCT_TYPE){
|
||||
DrawSheetStruct* sht = (DrawSheetStruct*)strct;
|
||||
BuildSheetList(sht);
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
m_currList.Pop();
|
||||
if( m_List == NULL )
|
||||
{
|
||||
int count = sheet->CountSheets();
|
||||
m_count = count;
|
||||
m_index = 0;
|
||||
if( m_List )
|
||||
free( m_List );m_List = NULL;
|
||||
count *= sizeof(DrawSheetList);
|
||||
m_List = (DrawSheetList*) MyZMalloc( count );
|
||||
memset( (void*) m_List, 0, count );
|
||||
m_currList.Clear();
|
||||
}
|
||||
m_currList.Push( sheet );
|
||||
m_List[m_index] = m_currList;
|
||||
m_index++;
|
||||
if( sheet->m_AssociatedScreen != NULL )
|
||||
{
|
||||
EDA_BaseStruct* strct = m_currList.LastDrawList();
|
||||
while( strct )
|
||||
{
|
||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||
{
|
||||
DrawSheetStruct* sht = (DrawSheetStruct*) strct;
|
||||
BuildSheetList( sht );
|
||||
}
|
||||
strct = strct->Pnext;
|
||||
}
|
||||
}
|
||||
m_currList.Pop();
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void EDA_SheetList::UpdateSheetNumberAndDate()
|
||||
/************************************************/
|
||||
|
||||
/* Set a sheet number, the sheet count for sheets in the whoçle 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;
|
||||
}
|
||||
|
|
|
@ -18,30 +18,31 @@
|
|||
|
||||
/* Forward declarations */
|
||||
class DrawSheetStruct;
|
||||
extern DrawSheetStruct* g_RootSheet;
|
||||
extern DrawSheetStruct* g_RootSheet;
|
||||
|
||||
|
||||
class SCH_SCREEN : public BASE_SCREEN
|
||||
{
|
||||
public:
|
||||
int m_RefCount; //how many sheets reference this screen?
|
||||
//delete when it goes to zero.
|
||||
int m_ScreenNumber;
|
||||
int m_NumberOfScreen;
|
||||
int m_RefCount; //how many sheets reference this screen?
|
||||
//delete when it goes to zero.
|
||||
int m_ScreenNumber;
|
||||
int m_NumberOfScreen;
|
||||
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
|
||||
~SCH_SCREEN();
|
||||
|
||||
|
||||
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 Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
|
||||
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */
|
||||
bool CheckIfOnDrawList( EDA_BaseStruct* st );
|
||||
void AddToDrawList( EDA_BaseStruct* DrawStruct );
|
||||
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct ); /* remove DrawStruct from EEDrawList. */
|
||||
bool CheckIfOnDrawList( EDA_BaseStruct* st );
|
||||
void AddToDrawList( EDA_BaseStruct* DrawStruct );
|
||||
void ClearUndoORRedoList( EDA_BaseStruct* List );
|
||||
|
||||
bool SchematicCleanUp( wxDC* DC = NULL );
|
||||
|
@ -54,157 +55,200 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
|
||||
class DrawSheetLabelStruct : public EDA_BaseStruct
|
||||
, public EDA_TextStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer;
|
||||
int m_Edge, m_Shape;
|
||||
bool m_IsDangling; // TRUE si non connect<63>
|
||||
bool m_IsDangling; // TRUE non connected
|
||||
|
||||
public:
|
||||
DrawSheetLabelStruct( DrawSheetStruct* parent,
|
||||
const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
|
||||
const wxPoint& pos = wxPoint( 0, 0 ),
|
||||
const wxString& text = wxEmptyString );
|
||||
|
||||
~DrawSheetLabelStruct() { }
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT("DrawSheetLabelStruct");
|
||||
return wxT( "DrawSheetLabelStruct" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
DrawSheetLabelStruct* GenCopy();
|
||||
|
||||
DrawSheetLabelStruct* Next()
|
||||
{ return (DrawSheetLabelStruct*) Pnext; }
|
||||
|
||||
|
||||
void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
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 */
|
||||
{
|
||||
public:
|
||||
wxString m_SheetName; //this is equivalent to C101 for components:
|
||||
// it is stored in F0 ... of the file.
|
||||
wxString m_FileName; //also in SCH_SCREEN (redundant),
|
||||
//but need it here for loading after
|
||||
//reading the sheet description from file.
|
||||
int m_SheetNameSize;
|
||||
wxString m_SheetName; //this is equivalent to C101 for components:
|
||||
// it is stored in F0 ... of the file.
|
||||
wxString m_FileName; //also in SCH_SCREEN (redundant),
|
||||
//but need it here for loading after
|
||||
//reading the sheet description from file.
|
||||
int m_SheetNameSize;
|
||||
|
||||
int m_FileNameSize;
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size; /* Position and Size of sheet symbol */
|
||||
int m_Layer;
|
||||
DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/
|
||||
int m_NbLabel; /* Nombre de points de connexion */
|
||||
SCH_SCREEN* m_s;
|
||||
int m_FileNameSize;
|
||||
wxPoint m_Pos;
|
||||
wxSize m_Size; /* Position and Size of sheet symbol */
|
||||
int m_Layer;
|
||||
DrawSheetLabelStruct* m_Label; /* Points de connection, linked list.*/
|
||||
int m_NbLabel; /* Nombre de points de connexion */
|
||||
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:
|
||||
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
~DrawSheetStruct();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT("DrawSheetStruct");
|
||||
return wxT( "DrawSheetStruct" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
DrawSheetStruct* GenCopy();
|
||||
void Display_Infos( WinEDA_DrawFrame* frame );
|
||||
void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
void SwapData( DrawSheetStruct* copyitem );
|
||||
void DeleteAnnotation( bool recurse );
|
||||
int ComponentCount();
|
||||
bool Load(WinEDA_SchematicFrame* frame);
|
||||
bool SearchHierarchy(wxString filename, SCH_SCREEN **screen);
|
||||
bool LocatePathOfScreen(SCH_SCREEN *screen, DrawSheetList* list);
|
||||
int CountSheets();
|
||||
//void RemoveSheet(DrawSheetStruct* sheet);
|
||||
//to remove a sheet, just delete it
|
||||
//-- the destructor should take care of everything else.
|
||||
void SwapData( DrawSheetStruct* copyitem );
|
||||
void DeleteAnnotation( bool recurse );
|
||||
int ComponentCount();
|
||||
bool Load( WinEDA_SchematicFrame* frame );
|
||||
bool SearchHierarchy( wxString filename, SCH_SCREEN** screen );
|
||||
bool LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* list );
|
||||
int CountSheets();
|
||||
|
||||
//void RemoveSheet(DrawSheetStruct* sheet);
|
||||
//to remove a sheet, just delete it
|
||||
//-- the destructor should take care of everything else.
|
||||
};
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* class to handle a series of sheets *********/
|
||||
/* a 'path' so to speak.. *********************/
|
||||
/**********************************************/
|
||||
#define DSLSZ 32
|
||||
class DrawSheetList
|
||||
{
|
||||
public:
|
||||
int m_numSheets;
|
||||
DrawSheetStruct* m_sheets[DSLSZ];
|
||||
|
||||
DrawSheetList();
|
||||
~DrawSheetList(){};
|
||||
void Clear(){m_numSheets = 0; }
|
||||
int Cmp(DrawSheetList& d);
|
||||
DrawSheetStruct* Last();
|
||||
SCH_SCREEN* LastScreen();
|
||||
EDA_BaseStruct* LastDrawList();
|
||||
void Push(DrawSheetStruct* sheet);
|
||||
DrawSheetStruct* Pop();
|
||||
wxString Path();
|
||||
wxString PathHumanReadable();
|
||||
void UpdateAllScreenReferences();
|
||||
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 */
|
||||
// sheets are not unique - can have many sheets with the same
|
||||
// filename and the same SCH_SHEET reference.
|
||||
class EDA_SheetList
|
||||
{
|
||||
private:
|
||||
DrawSheetList* m_List;
|
||||
int m_count;
|
||||
int m_index;
|
||||
DrawSheetList m_currList;
|
||||
int m_numSheets;
|
||||
DrawSheetStruct* m_sheets[DSLSZ];
|
||||
|
||||
public:
|
||||
EDA_SheetList( DrawSheetStruct* sheet ){
|
||||
m_index = 0;
|
||||
m_count = 0;
|
||||
m_List = NULL;
|
||||
if(sheet == NULL)
|
||||
sheet = g_RootSheet;
|
||||
BuildSheetList( sheet );
|
||||
}
|
||||
~EDA_SheetList() {if(m_List){free(m_List);} m_List = NULL;}
|
||||
int GetCount() { return m_count; }
|
||||
DrawSheetList* GetFirst();
|
||||
DrawSheetList* GetNext();
|
||||
DrawSheetList* GetSheet(int index );
|
||||
DrawSheetList();
|
||||
~DrawSheetList() { };
|
||||
void Clear() { m_numSheets = 0; }
|
||||
int Cmp( DrawSheetList& d );
|
||||
DrawSheetStruct* Last();
|
||||
SCH_SCREEN* LastScreen();
|
||||
EDA_BaseStruct* LastDrawList();
|
||||
void Push( DrawSheetStruct* sheet );
|
||||
DrawSheetStruct* Pop();
|
||||
wxString Path();
|
||||
wxString PathHumanReadable();
|
||||
void UpdateAllScreenReferences();
|
||||
|
||||
private:
|
||||
void BuildSheetList( DrawSheetStruct* sheet );
|
||||
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 */
|
||||
/*******************************************************/
|
||||
|
||||
// sheets are not unique - can have many sheets with the same
|
||||
// filename and the same SCH_SHEET reference.
|
||||
class EDA_SheetList
|
||||
{
|
||||
private:
|
||||
DrawSheetList* m_List;
|
||||
int m_count;
|
||||
int m_index;
|
||||
DrawSheetList m_currList;
|
||||
|
||||
public:
|
||||
EDA_SheetList( DrawSheetStruct* sheet )
|
||||
{
|
||||
m_index = 0;
|
||||
m_count = 0;
|
||||
m_List = NULL;
|
||||
if( sheet == NULL )
|
||||
sheet = g_RootSheet;
|
||||
BuildSheetList( sheet );
|
||||
}
|
||||
|
||||
|
||||
~EDA_SheetList()
|
||||
{
|
||||
if( m_List )
|
||||
{
|
||||
free( m_List );
|
||||
}
|
||||
m_List = NULL;
|
||||
}
|
||||
|
||||
|
||||
int GetCount() { return m_count; }
|
||||
DrawSheetList* GetFirst();
|
||||
DrawSheetList* GetNext();
|
||||
DrawSheetList* GetSheet( int index );
|
||||
void UpdateSheetNumberAndDate(); // Update the date displayed in the sheet count
|
||||
|
||||
private:
|
||||
void BuildSheetList( DrawSheetStruct* sheet );
|
||||
};
|
||||
|
||||
/********************************************************/
|
||||
/* Class to handle the list of *screens* in a hierarchy */
|
||||
// screens are unique, and correspond to .sch files.
|
||||
WX_DEFINE_ARRAY( SCH_SCREEN*, ScreenGrowArray );
|
||||
/********************************************************/
|
||||
|
||||
// screens are unique, and correspond to .sch files.
|
||||
WX_DEFINE_ARRAY( SCH_SCREEN *, ScreenGrowArray );
|
||||
class EDA_ScreenList
|
||||
{
|
||||
private:
|
||||
ScreenGrowArray m_List;
|
||||
unsigned int m_Index;
|
||||
unsigned int m_Index;
|
||||
|
||||
public:
|
||||
EDA_ScreenList(){
|
||||
m_Index = 0;
|
||||
BuildScreenList(g_RootSheet);
|
||||
}
|
||||
~EDA_ScreenList() {}
|
||||
int GetCount() { return m_List.GetCount(); }
|
||||
EDA_ScreenList()
|
||||
{
|
||||
m_Index = 0;
|
||||
BuildScreenList( g_RootSheet );
|
||||
}
|
||||
|
||||
|
||||
~EDA_ScreenList() { }
|
||||
int GetCount() { return m_List.GetCount(); }
|
||||
SCH_SCREEN* GetFirst();
|
||||
SCH_SCREEN* GetNext();
|
||||
SCH_SCREEN* GetScreen( unsigned int index );
|
||||
void UpdateScreenNumberAndDate();
|
||||
|
||||
private:
|
||||
void AddScreenToList( SCH_SCREEN* testscreen );
|
||||
void BuildScreenList( EDA_BaseStruct* sheet );
|
||||
void AddScreenToList( SCH_SCREEN* testscreen );
|
||||
void BuildScreenList( EDA_BaseStruct* sheet );
|
||||
};
|
||||
|
||||
#endif /* CLASS_SCREEN_H */
|
||||
|
|
|
@ -140,9 +140,7 @@ void EDA_SchComponentStruct::SetRef( DrawSheetList* sheet, wxString ref )
|
|||
//check to see if it is already there before inserting it
|
||||
wxString path = GetPath( sheet );
|
||||
|
||||
printf( "SetRef path: %s ref: %s\n",
|
||||
CONV_TO_UTF8( path ),
|
||||
CONV_TO_UTF8( ref ) );
|
||||
// printf( "SetRef path: %s ref: %s\n", CONV_TO_UTF8( path ), CONV_TO_UTF8( ref ) ); // Debug
|
||||
unsigned int i;
|
||||
bool notInArray = true;
|
||||
for( i = 0; i<m_Paths.GetCount(); i++ )
|
||||
|
|
|
@ -28,8 +28,8 @@ enum NumFieldType {
|
|||
FIELD5,
|
||||
FIELD6,
|
||||
FIELD7,
|
||||
FIELD8,
|
||||
NUMBER_OF_FIELDS /* Nombre de champs de texte affectes au composant */
|
||||
FIELD8,
|
||||
NUMBER_OF_FIELDS /* Nombre de champs de texte affectes au composant */
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,7 +37,8 @@ enum NumFieldType {
|
|||
* component fields are texts attached to the component (not the graphic texts)
|
||||
* 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:
|
||||
int m_Layer;
|
||||
|
@ -48,7 +49,7 @@ public:
|
|||
public:
|
||||
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
||||
~PartTextStruct();
|
||||
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "PartText" );
|
||||
|
@ -78,37 +79,38 @@ public:
|
|||
wxPoint m_Pos; /* Exact position of part. */
|
||||
|
||||
public:
|
||||
DrawPartStruct( KICAD_T struct_type, const wxPoint &pos );
|
||||
DrawPartStruct( KICAD_T struct_type, const wxPoint& pos );
|
||||
~DrawPartStruct();
|
||||
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawPart" );
|
||||
}
|
||||
};
|
||||
|
||||
WX_DECLARE_OBJARRAY(DrawSheetList, ArrayOfSheetLists);
|
||||
WX_DECLARE_OBJARRAY( DrawSheetList, ArrayOfSheetLists );
|
||||
/* the class EDA_SchComponentStruct describes a real component */
|
||||
class EDA_SchComponentStruct : public DrawPartStruct
|
||||
{
|
||||
public:
|
||||
int m_Multi; /* In multi unit chip - which unit to draw. */
|
||||
//int m_FlagControlMulti;
|
||||
ArrayOfSheetLists m_UsedOnSheets;
|
||||
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
||||
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
||||
bool* m_PinIsDangling; // liste des indicateurs de pin non connectee
|
||||
int m_Multi; /* In multi unit chip - which unit to draw. */
|
||||
|
||||
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/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.
|
||||
//determined, upon placement, from the library component.
|
||||
//determined, upon file load, by the first non-digits in the reference fields.
|
||||
//int m_FlagControlMulti;
|
||||
ArrayOfSheetLists m_UsedOnSheets;
|
||||
int m_Convert; /* Gestion (management) des mutiples representations (ex: conversion De Morgan) */
|
||||
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
||||
bool* m_PinIsDangling; // liste des indicateurs de pin non connectee
|
||||
|
||||
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/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.
|
||||
* determined, upon placement, from the library component.
|
||||
* determined, upon file load, by the first non-digits in the reference fields. */
|
||||
|
||||
public:
|
||||
EDA_SchComponentStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
~EDA_SchComponentStruct( void ) { }
|
||||
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_SchComponent" );
|
||||
|
@ -124,7 +126,7 @@ public:
|
|||
EDA_Rect GetBoundaryBox();
|
||||
|
||||
const wxString& ReturnFieldName( int aFieldNdx ) const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function GetFieldValue
|
||||
|
@ -134,32 +136,35 @@ public:
|
|||
*/
|
||||
const wxString& GetFieldValue( int aFieldNdx ) const;
|
||||
|
||||
|
||||
|
||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
wxDC* DC,
|
||||
const wxPoint& offset,
|
||||
int draw_mode,
|
||||
int Color = -1 );
|
||||
void SwapData( EDA_SchComponentStruct* copyitem );
|
||||
|
||||
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
|
||||
|
||||
//returns a unique ID, in the form of a path.
|
||||
wxString GetPath( DrawSheetList* sheet);
|
||||
const wxString GetRef( DrawSheetList* sheet );
|
||||
void SetRef( DrawSheetList* sheet, wxString ref );
|
||||
void ClearRefs();
|
||||
#if defined(DEBUG)
|
||||
|
||||
//returns a unique ID, in the form of a path.
|
||||
wxString GetPath( DrawSheetList* sheet );
|
||||
const wxString GetRef( DrawSheetList* sheet );
|
||||
void SetRef( DrawSheetList* sheet, wxString ref );
|
||||
void ClearRefs();
|
||||
|
||||
#if defined (DEBUG)
|
||||
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -37,20 +37,20 @@ wxString msg;
|
|||
}
|
||||
|
||||
/* 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?"),
|
||||
FirstSheet->m_SheetName.GetData(),
|
||||
FirstSheet->m_FileName.GetData());
|
||||
if( IsOK(NULL, msg) )
|
||||
{
|
||||
frame->SaveEEFile(FirstSheet->m_s, FILE_SAVE_AS);
|
||||
frame->SaveEEFile(FirstSheet->m_AssociatedScreen, FILE_SAVE_AS);
|
||||
}
|
||||
}
|
||||
|
||||
/* free the sub hierarchy */
|
||||
if(FirstSheet->m_s){
|
||||
EEDrawList = FirstSheet->m_s->EEDrawList;
|
||||
if(FirstSheet->m_AssociatedScreen){
|
||||
EEDrawList = FirstSheet->m_AssociatedScreen->EEDrawList;
|
||||
while (EEDrawList != NULL)
|
||||
{
|
||||
DrawStruct = EEDrawList;
|
||||
|
@ -61,7 +61,7 @@ wxString msg;
|
|||
}
|
||||
}
|
||||
/* Effacement des elements de la feuille courante */
|
||||
FirstSheet->m_s->FreeDrawList();
|
||||
FirstSheet->m_AssociatedScreen->FreeDrawList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ wxString mask, filename;
|
|||
else
|
||||
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);
|
||||
//need to get rid of the path.
|
||||
m_ListFileName = m_ListFileName.AfterLast('/');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/******************************************************/
|
||||
/** eeconfig.cpp : routines et menus de configuration */
|
||||
/*******************************************************/
|
||||
|
||||
/******************************************************/
|
||||
/** eeconfig.cpp : routines et menus de configuration */
|
||||
/*******************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
|
@ -18,189 +18,195 @@
|
|||
/* 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();
|
||||
wxPoint pos;
|
||||
wxString FullFileName;
|
||||
|
||||
wxGetMousePosition(&pos.x, &pos.y);
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
wxString FullFileName;
|
||||
|
||||
pos.y += 5;
|
||||
switch ( id )
|
||||
{
|
||||
case ID_COLORS_SETUP :
|
||||
DisplayColorSetupFrame(this, pos);
|
||||
break;
|
||||
wxGetMousePosition( &pos.x, &pos.y );
|
||||
|
||||
case ID_CONFIG_REQ : // Creation de la fenetre de configuration
|
||||
InstallConfigFrame(pos);
|
||||
break;
|
||||
pos.y += 5;
|
||||
|
||||
case ID_OPTIONS_SETUP:
|
||||
DisplayOptionFrame(this, pos);
|
||||
break;
|
||||
switch( id )
|
||||
{
|
||||
case ID_COLORS_SETUP:
|
||||
DisplayColorSetupFrame( this, pos );
|
||||
break;
|
||||
|
||||
case ID_CONFIG_SAVE:
|
||||
Save_Config(this);
|
||||
break;
|
||||
case ID_CONFIG_REQ: // Creation de la fenetre de configuration
|
||||
InstallConfigFrame( pos );
|
||||
break;
|
||||
|
||||
case ID_CONFIG_READ:
|
||||
{
|
||||
wxString mask( wxT("*") ); mask += g_Prj_Config_Filename_ext;
|
||||
FullFileName = g_RootSheet->m_s->m_FileName;
|
||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
||||
|
||||
FullFileName = EDA_FileSelector(_("Read config file"),
|
||||
wxGetCwd(), /* Chemin par defaut */
|
||||
FullFileName, /* nom fichier par defaut */
|
||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_OPEN,
|
||||
TRUE /* ne change pas de repertoire courant */
|
||||
);
|
||||
if ( FullFileName.IsEmpty() ) break;
|
||||
if ( ! wxFileExists(FullFileName) )
|
||||
{
|
||||
wxString msg = _("File ") + FullFileName +_("not found");;
|
||||
DisplayError(this, msg); break;
|
||||
}
|
||||
Read_Config(FullFileName, TRUE );
|
||||
}
|
||||
break;
|
||||
case ID_OPTIONS_SETUP:
|
||||
DisplayOptionFrame( this, pos );
|
||||
break;
|
||||
|
||||
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
|
||||
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
||||
FullFileName += HOTKEY_FILENAME;
|
||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
WriteHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, true);
|
||||
break;
|
||||
case ID_CONFIG_SAVE:
|
||||
Save_Config( this );
|
||||
break;
|
||||
|
||||
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
|
||||
Read_Hotkey_Config( this, true);
|
||||
break;
|
||||
case ID_CONFIG_READ:
|
||||
{
|
||||
wxString mask( wxT( "*" ) ); mask += g_Prj_Config_Filename_ext;
|
||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
||||
|
||||
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
|
||||
{
|
||||
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
||||
FullFileName += HOTKEY_FILENAME;
|
||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
wxString editorname = GetEditorName();
|
||||
if ( !editorname.IsEmpty() )
|
||||
ExecuteFile(this, editorname, FullFileName);
|
||||
}
|
||||
break;
|
||||
FullFileName = EDA_FileSelector( _( "Read config file" ),
|
||||
wxGetCwd(), /* Chemin par defaut */
|
||||
FullFileName, /* nom fichier par defaut */
|
||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
this,
|
||||
wxFD_OPEN,
|
||||
TRUE /* ne change pas de repertoire courant */
|
||||
);
|
||||
if( FullFileName.IsEmpty() )
|
||||
break;
|
||||
if( !wxFileExists( FullFileName ) )
|
||||
{
|
||||
wxString msg = _( "File " ) + FullFileName + _( "not found" );;
|
||||
DisplayError( this, msg ); break;
|
||||
}
|
||||
Read_Config( FullFileName, TRUE );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
|
||||
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
|
||||
HandleHotkeyConfigMenuSelection( this, id );
|
||||
break;
|
||||
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
|
||||
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
||||
FullFileName += HOTKEY_FILENAME;
|
||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
WriteHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, true );
|
||||
break;
|
||||
|
||||
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: // Display Current hotkey list for eeschema
|
||||
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
|
||||
break;
|
||||
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
|
||||
Read_Hotkey_Config( this, true );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError(this, wxT("WinEDA_SchematicFrame::Process_Config internal error") );
|
||||
}
|
||||
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
|
||||
{
|
||||
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
||||
FullFileName += HOTKEY_FILENAME;
|
||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
wxString editorname = GetEditorName();
|
||||
if( !editorname.IsEmpty() )
|
||||
ExecuteFile( this, editorname, FullFileName );
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
|
||||
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
|
||||
HandleHotkeyConfigMenuSelection( this, id );
|
||||
break;
|
||||
|
||||
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST: // Display Current hotkey list for eeschema
|
||||
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
|
||||
break;
|
||||
|
||||
default:
|
||||
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
|
||||
*/
|
||||
*/
|
||||
{
|
||||
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
||||
FullFileName += HOTKEY_FILENAME;
|
||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
frame->ReadHotkeyConfigFile(FullFileName, s_Eeschema_Hokeys_Descr, verbose);
|
||||
wxString FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
||||
|
||||
return TRUE;
|
||||
FullFileName += HOTKEY_FILENAME;
|
||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
||||
frame->ReadHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, verbose );
|
||||
|
||||
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
|
||||
*/
|
||||
* 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;
|
||||
bool IsRead = TRUE;
|
||||
wxArrayString liblist_tmp = g_LibName_List;
|
||||
|
||||
if ( CfgFileName.IsEmpty() ) FullFileName = g_RootSheet->m_s->m_FileName;
|
||||
else FullFileName = CfgFileName;
|
||||
g_LibName_List.Clear();
|
||||
|
||||
if ( ! g_EDA_Appl->ReadProjectConfig(FullFileName,
|
||||
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE) ) // Config non lue
|
||||
{
|
||||
g_LibName_List = liblist_tmp;
|
||||
IsRead = FALSE;
|
||||
}
|
||||
wxString FullFileName;
|
||||
bool IsRead = TRUE;
|
||||
wxArrayString liblist_tmp = g_LibName_List;
|
||||
|
||||
/* Traitement des variables particulieres: */
|
||||
SetRealLibraryPath( wxT("library") );
|
||||
if( CfgFileName.IsEmpty() )
|
||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
else
|
||||
FullFileName = CfgFileName;
|
||||
g_LibName_List.Clear();
|
||||
|
||||
// If the list is void, load the libraries "power.lib" and "device.lib"
|
||||
if ( g_LibName_List.GetCount() == 0 )
|
||||
{
|
||||
g_LibName_List.Add( wxT("power") );
|
||||
g_LibName_List.Add( wxT("device") );
|
||||
}
|
||||
if( !g_EDA_Appl->ReadProjectConfig( FullFileName,
|
||||
GROUP, ParamCfgList, ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue
|
||||
{
|
||||
g_LibName_List = liblist_tmp;
|
||||
IsRead = FALSE;
|
||||
}
|
||||
|
||||
if ( g_EDA_Appl->m_SchematicFrame )
|
||||
{
|
||||
g_EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor);
|
||||
g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
|
||||
}
|
||||
/* Traitement des variables particulieres: */
|
||||
SetRealLibraryPath( wxT( "library" ) );
|
||||
|
||||
LoadLibraries(g_EDA_Appl->m_SchematicFrame);
|
||||
// If the list is void, load the libraries "power.lib" and "device.lib"
|
||||
if( g_LibName_List.GetCount() == 0 )
|
||||
{
|
||||
g_LibName_List.Add( wxT( "power" ) );
|
||||
g_LibName_List.Add( wxT( "device" ) );
|
||||
}
|
||||
|
||||
return IsRead;
|
||||
if( g_EDA_Appl->m_SchematicFrame )
|
||||
{
|
||||
g_EDA_Appl->m_SchematicFrame->SetDrawBgColor( g_DrawBgColor );
|
||||
g_EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
|
||||
}
|
||||
|
||||
LoadLibraries( g_EDA_Appl->m_SchematicFrame );
|
||||
|
||||
return IsRead;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_SchematicFrame::Save_Config(wxWindow * displayframe)
|
||||
void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe )
|
||||
/***************************************************************/
|
||||
{
|
||||
wxString path;
|
||||
wxString FullFileName;
|
||||
wxString mask( wxT("*") );
|
||||
|
||||
mask += g_Prj_Config_Filename_ext;
|
||||
FullFileName = g_RootSheet->m_s->m_FileName.AfterLast('/') /*ConfigFileName*/;
|
||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
||||
wxString path;
|
||||
wxString FullFileName;
|
||||
wxString mask( wxT( "*" ) );
|
||||
|
||||
path = wxGetCwd();
|
||||
FullFileName = EDA_FileSelector(_("Save preferences"),
|
||||
path, /* Chemin par defaut */
|
||||
FullFileName, /* nom fichier par defaut */
|
||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
displayframe,
|
||||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if ( FullFileName.IsEmpty() ) return;
|
||||
mask += g_Prj_Config_Filename_ext;
|
||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName.AfterLast( '/' ) /*ConfigFileName*/;
|
||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
||||
|
||||
/* ecriture de la configuration */
|
||||
g_EDA_Appl->WriteProjectConfig(FullFileName, GROUP, ParamCfgList);
|
||||
path = wxGetCwd();
|
||||
FullFileName = EDA_FileSelector( _( "Save preferences" ),
|
||||
path, /* Chemin par defaut */
|
||||
FullFileName, /* nom fichier par defaut */
|
||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
||||
mask, /* Masque d'affichage */
|
||||
displayframe,
|
||||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if( FullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
/* ecriture de la configuration */
|
||||
g_EDA_Appl->WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ wxString title;
|
|||
void WinEDA_DrawPanel::PrintPage(wxDC * DC, bool Print_Sheet_Ref, int PrintMask)
|
||||
/*******************************************************************************/
|
||||
{
|
||||
BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen();
|
||||
BASE_SCREEN * screen;
|
||||
|
||||
wxBeginBusyCursor();
|
||||
|
||||
|
@ -140,7 +140,6 @@ BASE_SCREEN * screen; // * oldscreen = m_Parent->GetScreen();
|
|||
if ( Print_Sheet_Ref )
|
||||
m_Parent->TraceWorkSheet(DC, screen, g_DrawMinimunLineWidth );
|
||||
|
||||
//m_Parent->m_CurrentSheet->m_s = oldscreen;
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
|||
if( WriteFichierERC == TRUE )
|
||||
{
|
||||
wxString ErcFullFileName;
|
||||
ErcFullFileName = g_RootSheet->m_s->m_FileName;
|
||||
ErcFullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) );
|
||||
ErcFullFileName = EDA_FileSelector( _( "ERC file:" ),
|
||||
wxEmptyString, /* Chemin par defaut */
|
||||
|
|
|
@ -63,7 +63,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
|
|||
mask = wxT( "*" ) + g_SchExtBuffer;
|
||||
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
|
||||
wxEmptyString, //default path
|
||||
sheet->m_s->m_FileName,// default filename
|
||||
sheet->m_AssociatedScreen->m_FileName,// default filename
|
||||
g_SchExtBuffer, // extension par defaut
|
||||
mask, // Masque d'affichage
|
||||
this,
|
||||
|
@ -111,8 +111,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
|
|||
{
|
||||
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
|
||||
return FALSE;
|
||||
if( g_RootSheet->m_s->m_FileName != g_DefaultSchematicFileName )
|
||||
SetLastProject( g_RootSheet->m_s->m_FileName );
|
||||
if( g_RootSheet->m_AssociatedScreen->m_FileName != g_DefaultSchematicFileName )
|
||||
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
|
||||
}
|
||||
|
||||
FullFileName = FileName;
|
||||
|
@ -146,7 +146,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
|
|||
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
|
||||
|
||||
GetScreen()->ClrModify();
|
||||
//m_CurrentSheet->m_s->Pnext = NULL; should be by default
|
||||
//m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default
|
||||
|
||||
if( IsNew )
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
|
|||
// Loading the project library cache
|
||||
wxString FullLibName;
|
||||
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" ) <<
|
||||
g_LibExtBuffer;
|
||||
if( wxFileExists( FullLibName ) )
|
||||
|
@ -211,16 +211,16 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
|
|||
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 ?)" ),
|
||||
g_RootSheet->m_s->m_FileName.GetData() );
|
||||
g_RootSheet->m_AssociatedScreen->m_FileName.GetData() );
|
||||
DisplayInfo( this, msg, 20 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
//load the project.
|
||||
SAFE_DELETE(g_RootSheet->m_s);
|
||||
SAFE_DELETE(g_RootSheet->m_AssociatedScreen);
|
||||
if(!g_RootSheet->Load(this))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet)
|
|||
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
|
||||
par la souris
|
||||
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..)
|
||||
*/
|
||||
{
|
||||
|
@ -297,11 +297,10 @@ static void UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
|
|||
|
||||
{
|
||||
SCH_SCREEN * NewScreen;
|
||||
//SCH_SCREEN * oldscreen = frame->GetScreen(); what is oldscreen used for?
|
||||
|
||||
NewScreen = frame->m_CurrentSheet->LastScreen();
|
||||
if(!NewScreen)
|
||||
NewScreen = g_RootSheet->m_s;
|
||||
NewScreen = g_RootSheet->m_AssociatedScreen;
|
||||
|
||||
// Reinit des parametres d'affichage du nouvel ecran
|
||||
// assumes m_CurrentSheet has already been updated.
|
||||
|
|
|
@ -656,6 +656,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
EditField( &dc, (LibDrawField*) CurrentDrawItem );
|
||||
}
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->CursorOn( &dc );
|
||||
break;
|
||||
|
||||
|
@ -725,7 +726,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
|
||||
if( m_ID_current_state == 0 )
|
||||
|
|
|
@ -65,7 +65,9 @@ OBJECTS = eeschema.o\
|
|||
savelib.o symbtext.o \
|
||||
symbdraw.o \
|
||||
hierarch.o files-io.o \
|
||||
annotate.o plothpgl.o \
|
||||
annotate.o\
|
||||
annotate_dialog.o\
|
||||
plothpgl.o \
|
||||
plot.o libalias.o \
|
||||
plotps.o netform.o \
|
||||
delsheet.o \
|
||||
|
@ -110,7 +112,9 @@ find.o:find.cpp dialog_find.cpp dialog_find.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
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
|
|||
g_TabObjNet = NULL; /* Init pour le 1er passage dans ListeObjetConnection */
|
||||
|
||||
/* count nelist items */
|
||||
g_RootSheet->m_s->SetModify();
|
||||
g_RootSheet->m_AssociatedScreen->SetModify();
|
||||
|
||||
for( sheet = SheetListList.GetFirst(); sheet != NULL; sheet = SheetListList.GetNext() )
|
||||
{
|
||||
|
|
|
@ -539,7 +539,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
|||
g_NetFormat = CurrPage->m_IdNetType;
|
||||
|
||||
/* Calculate the netlist filename */
|
||||
FullFileName = g_RootSheet->m_s->m_FileName;
|
||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
|
||||
switch( g_NetFormat )
|
||||
{
|
||||
|
@ -649,7 +649,7 @@ void WinEDA_NetlistFrame::RunSimulator( wxCommandEvent& event )
|
|||
CommandLine = g_SimulatorCommandLine.AfterFirst( ' ' );
|
||||
|
||||
/* Calculate the netlist filename */
|
||||
NetlistFullFileName = g_RootSheet->m_s->m_FileName;
|
||||
NetlistFullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||
ChangeFileNameExt( NetlistFullFileName, wxT( ".cir" ) );
|
||||
AddDelimiterString( NetlistFullFileName );
|
||||
CommandLine += wxT( " " ) + NetlistFullFileName;
|
||||
|
|
|
@ -209,7 +209,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_TO_PCB:
|
||||
{
|
||||
wxString Line;
|
||||
if( g_RootSheet->m_s->m_FileName != wxEmptyString )
|
||||
if( g_RootSheet->m_AssociatedScreen->m_FileName != wxEmptyString )
|
||||
{
|
||||
Line = GetScreen()->m_FileName;
|
||||
AddDelimiterString( Line );
|
||||
|
@ -224,9 +224,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_TO_CVPCB:
|
||||
{
|
||||
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 );
|
||||
ChangeFileNameExt( Line, wxEmptyString );
|
||||
ExecuteFile( this, CVPCB_EXE, Line );
|
||||
|
|
|
@ -16,40 +16,40 @@
|
|||
/* Functions to undo and redo edit commands.
|
||||
* commmands to undo are in CurrentScreen->m_UndoList
|
||||
* commmands to redo are in CurrentScreen->m_RedoList
|
||||
*
|
||||
*
|
||||
* m_UndoList and m_RedoList are a linked list of DrawPickedStruct.
|
||||
* each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo,
|
||||
* or to a list of DrawPickedStruct which points (.m_PickedStruct membre)
|
||||
* the items to undo or redo
|
||||
*
|
||||
*
|
||||
* there are 3 cases:
|
||||
* - delete item(s) command
|
||||
* - change item(s) command
|
||||
* - add item(s) command
|
||||
*
|
||||
*
|
||||
* Undo command
|
||||
* - delete item(s) command:
|
||||
* deleted items are moved in undo list
|
||||
*
|
||||
*
|
||||
* - change item(s) command
|
||||
* A copy of item(s) is made (a DrawPickedStruct list of wrappers)
|
||||
* the .m_Image member of each wrapper points the modified item.
|
||||
*
|
||||
*
|
||||
* - add item(s) command
|
||||
* A list of item(s) is made
|
||||
* the .m_Image member of each wrapper points the new item.
|
||||
*
|
||||
*
|
||||
* Redo command
|
||||
* - delete item(s) old command:
|
||||
* deleted items are moved in EEDrawList list
|
||||
*
|
||||
*
|
||||
* - change item(s) command
|
||||
* the copy of item(s) is moved in Undo list
|
||||
*
|
||||
*
|
||||
* - add item(s) command
|
||||
* The list of item(s) is used to create a deleted list in undo list
|
||||
* (same as a delete command)
|
||||
*
|
||||
*
|
||||
* A problem is the hierarchical sheet handling.
|
||||
* the data associated (subhierarchy, uno/redo list) is deleted only
|
||||
* when the sheet is really deleted (i.e. when deleted from undo or redo list)
|
||||
|
@ -90,7 +90,7 @@ void SwapData( EDA_BaseStruct* Item )
|
|||
|
||||
case DRAW_LABEL_STRUCT_TYPE:
|
||||
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_HIER_LABEL_STRUCT_TYPE:
|
||||
case DRAW_TEXT_STRUCT_TYPE:
|
||||
#undef SOURCE
|
||||
#undef DEST
|
||||
|
@ -181,20 +181,20 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
|
|||
/* Create a copy of the current schematic draw list, and put it in the undo list.
|
||||
* A DrawPickedStruct wrapper is created to handle the draw list.
|
||||
* the .m_Son of this wrapper points the list of items
|
||||
*
|
||||
*
|
||||
* flag_type_command =
|
||||
* 0 (unspecified)
|
||||
* IS_CHANGED
|
||||
* IS_NEW
|
||||
* IS_DELETED
|
||||
* IS_WIRE_IMAGE
|
||||
*
|
||||
*
|
||||
* for 0: only a wrapper is created. The used must init the .Flags member of the
|
||||
* wrapper, and add the item list to the wrapper
|
||||
* If it is a delete command, items are put on list with the .Flags member set to IS_DELETED.
|
||||
* When it will be really deleted, the EEDrawList and the subhierarchy will be deleted.
|
||||
* If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted.
|
||||
*
|
||||
*
|
||||
* Note:
|
||||
* Edit wires and busses is a bit complex.
|
||||
* because when a new wire is added, modifications in wire list
|
||||
|
@ -286,13 +286,13 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
|
|||
GetScreen()->AddItemToUndoList( NewList );
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
bool WinEDA_SchematicFrame::GetSchematicFromRedoList()
|
||||
bool WinEDA_SchematicFrame::GetSchematicFromRedoList()
|
||||
/**********************************************************/
|
||||
|
||||
/* Redo the last edition:
|
||||
|
@ -314,8 +314,8 @@ bool WinEDA_SchematicFrame::GetSchematicFromRedoList()
|
|||
GetScreen()->SetModify();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -362,7 +362,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
while( PickedList )
|
||||
{
|
||||
item = PickedList->m_Image;
|
||||
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item );
|
||||
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
|
||||
item->m_Flags = IS_DELETED;
|
||||
PickedList->m_PickedStruct = item;
|
||||
PickedList->m_Flags = IS_DELETED;
|
||||
|
@ -372,7 +372,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
else
|
||||
{
|
||||
FirstItem = List->m_Image;
|
||||
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( FirstItem );
|
||||
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( FirstItem );
|
||||
FirstItem->m_Flags = IS_DELETED;
|
||||
List->m_Son = FirstItem;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
|
||||
case IS_WIRE_IMAGE:
|
||||
/* 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 )
|
||||
{
|
||||
EDA_BaseStruct* nextitem = FirstItem->Pnext;
|
||||
|
@ -437,7 +437,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
|
|||
|
||||
case IS_NEW:
|
||||
item = PickedList->m_Image;
|
||||
((SCH_SCREEN*)GetScreen())->RemoveFromDrawList( item );
|
||||
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
|
||||
item->m_Flags = IS_DELETED;
|
||||
PickedList->m_PickedStruct = item;
|
||||
PickedList->m_Flags = IS_DELETED;
|
||||
|
@ -489,8 +489,8 @@ bool WinEDA_SchematicFrame::GetSchematicFromUndoList()
|
|||
GetScreen()->SetModify();
|
||||
ReCreateHToolbar();
|
||||
SetToolbars();
|
||||
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -517,7 +517,7 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
|
|||
FirstItem = List->m_Son;
|
||||
CmdType = List->m_Flags;
|
||||
|
||||
SAFE_DELETE( List );
|
||||
SAFE_DELETE( List );
|
||||
|
||||
if( FirstItem == NULL )
|
||||
continue;
|
||||
|
@ -542,22 +542,25 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
|
|||
{
|
||||
if( (item->m_Flags & IS_NEW) == 0 )
|
||||
{
|
||||
printf("schematic undo_redo.cpp: undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n");
|
||||
/*
|
||||
sheet->EEDrawList = NULL;
|
||||
sheet->m_UndoList = NULL;
|
||||
sheet->m_RedoList = NULL;
|
||||
*/
|
||||
printf(
|
||||
"schematic undo_redo.cpp: undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n" );
|
||||
|
||||
/*
|
||||
* sheet->EEDrawList = NULL;
|
||||
* sheet->m_UndoList = NULL;
|
||||
* sheet->m_RedoList = NULL;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (item->m_Flags & IS_NEW) == 0 ){
|
||||
SAFE_DELETE( item );
|
||||
}
|
||||
if( (item->m_Flags & IS_NEW) == 0 )
|
||||
{
|
||||
SAFE_DELETE( item );
|
||||
}
|
||||
}
|
||||
DrawPickedStruct* wrapper = PickedList;
|
||||
PickedList = PickedList->Next();
|
||||
SAFE_DELETE( wrapper );
|
||||
SAFE_DELETE( wrapper );
|
||||
}
|
||||
}
|
||||
else // This is a single item: deleted copy
|
||||
|
@ -583,18 +586,21 @@ void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
|
|||
{
|
||||
if( (FirstItem->m_Flags & IS_NEW) == 0 )
|
||||
{
|
||||
printf("schematic undo_redo.cpp undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n");
|
||||
/*
|
||||
sheet->EEDrawList = NULL;
|
||||
sheet->m_UndoList = NULL;
|
||||
sheet->m_RedoList = NULL;
|
||||
*/
|
||||
printf(
|
||||
"schematic undo_redo.cpp undo_redo with a DRAW_SHEET_STRUCT_TYPE, checkme!!\n" );
|
||||
|
||||
/*
|
||||
* sheet->EEDrawList = NULL;
|
||||
* sheet->m_UndoList = NULL;
|
||||
* sheet->m_RedoList = NULL;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (FirstItem->m_Flags & IS_NEW) == 0 ){
|
||||
SAFE_DELETE( FirstItem );
|
||||
}
|
||||
if( (FirstItem->m_Flags & IS_NEW) == 0 )
|
||||
{
|
||||
SAFE_DELETE( FirstItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,22 +215,22 @@ wxString WinEDA_SchematicFrame::GetScreenDesc()
|
|||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
/*******************************************/
|
||||
void WinEDA_SchematicFrame::CreateScreens()
|
||||
/******************************/
|
||||
/*******************************************/
|
||||
{
|
||||
/* creation des ecrans Sch , Lib */
|
||||
if( g_RootSheet == NULL )
|
||||
{
|
||||
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_s->m_RefCount++;
|
||||
g_RootSheet->m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
|
||||
g_RootSheet->m_AssociatedScreen->m_RefCount++;
|
||||
}
|
||||
g_RootSheet->m_s->m_FileName = g_DefaultSchematicFileName;
|
||||
g_RootSheet->m_s->m_Date = GenDate();
|
||||
g_RootSheet->m_AssociatedScreen->m_FileName = g_DefaultSchematicFileName;
|
||||
g_RootSheet->m_AssociatedScreen->m_Date = GenDate();
|
||||
m_CurrentSheet->Clear();
|
||||
m_CurrentSheet->Push( g_RootSheet );
|
||||
|
||||
|
@ -294,10 +294,11 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
|||
}
|
||||
}
|
||||
|
||||
if( !GetScreen()->m_FileName.IsEmpty() && (GetScreen()->EEDrawList != NULL) )
|
||||
SetLastProject( GetScreen()->m_FileName );
|
||||
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty() &&
|
||||
(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 */
|
||||
m_CurrentSheet->Clear();
|
||||
|
|
|
@ -84,12 +84,12 @@ WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame()
|
|||
|
||||
|
||||
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
|
||||
DrawSheetStruct* currentsheet,
|
||||
wxWindowID id,
|
||||
const wxString& caption,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style )
|
||||
DrawSheetStruct* currentsheet,
|
||||
wxWindowID id,
|
||||
const wxString& caption,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_CurrentSheet = currentsheet;
|
||||
|
@ -97,11 +97,11 @@ WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame*
|
|||
|
||||
AddUnitSymbol( *m_SheetNameTextSize );
|
||||
PutValueInLocalUnits( *m_SheetNameSize, m_CurrentSheet->m_SheetNameSize,
|
||||
m_Parent->m_InternalUnits );
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
AddUnitSymbol( *m_FileNameTextSize );
|
||||
PutValueInLocalUnits( *m_FileNameSize, m_CurrentSheet->m_FileNameSize,
|
||||
m_Parent->m_InternalUnits );
|
||||
m_Parent->m_InternalUnits );
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,52 +159,53 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
|
|||
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Filename (will be created upon save if it does not already exist):" ), wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
"Filename (will be created upon save if it does not already exist):" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
itemBoxSizer4->Add( itemStaticText5,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_FileNameWin = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition,
|
||||
wxSize( 300, -1 ), wxTE_PROCESS_ENTER );
|
||||
wxSize( 300, -1 ), wxTE_PROCESS_ENTER );
|
||||
itemBoxSizer4->Add( m_FileNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Sheetname:" ), wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
"Sheetname:" ), wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
itemBoxSizer4->Add( itemStaticText7,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_SheetNameWin = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition,
|
||||
wxSize( 300, -1 ), 0 );
|
||||
wxSize( 300, -1 ), 0 );
|
||||
itemBoxSizer4->Add( m_SheetNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_FileNameTextSize,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_FileNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_SheetNameTextSize,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_SheetNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
itemBoxSizer2->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
@ -213,12 +214,12 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
|
|||
itemBoxSizer2->Add( itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _(
|
||||
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton16->SetForegroundColour( wxColour( 0, 0, 255 ) );
|
||||
itemBoxSizer15->Add( itemButton16, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _(
|
||||
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton17->SetForegroundColour( wxColour( 196, 0, 0 ) );
|
||||
itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
|
@ -292,39 +293,45 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
|||
{
|
||||
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( m_CurrentSheet->m_s ){
|
||||
m_CurrentSheet->m_s->m_RefCount--;
|
||||
if( m_CurrentSheet->m_s->m_RefCount == 0)
|
||||
SAFE_DELETE(m_CurrentSheet->m_s);
|
||||
}
|
||||
m_CurrentSheet->m_s = NULL; //so that we reload..
|
||||
m_CurrentSheet->Load(m_Parent);
|
||||
if( m_CurrentSheet->m_AssociatedScreen )
|
||||
{
|
||||
m_CurrentSheet->m_AssociatedScreen->m_RefCount--;
|
||||
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 );
|
||||
}
|
||||
}else{
|
||||
//just make a new screen if needed.
|
||||
if( !m_CurrentSheet->m_s ){
|
||||
m_CurrentSheet->m_s = new SCH_SCREEN(SCHEMATIC_FRAME);
|
||||
m_CurrentSheet->m_s->m_RefCount++; //be careful with these
|
||||
m_CurrentSheet->m_s->m_FileName = FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//just make a new screen if needed.
|
||||
if( !m_CurrentSheet->m_AssociatedScreen )
|
||||
{
|
||||
m_CurrentSheet->m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
|
||||
m_CurrentSheet->m_AssociatedScreen->m_RefCount++; //be careful with these
|
||||
m_CurrentSheet->m_AssociatedScreen->m_FileName = FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg = m_FileNameSize->GetValue();
|
||||
m_CurrentSheet->m_FileNameSize =
|
||||
ReturnValueFromString( g_UnitMetric,
|
||||
msg, m_Parent->m_InternalUnits );
|
||||
msg, m_Parent->m_InternalUnits );
|
||||
|
||||
m_CurrentSheet->m_SheetName = m_SheetNameWin->GetValue();
|
||||
msg = m_SheetNameSize->GetValue();
|
||||
m_CurrentSheet->m_SheetNameSize =
|
||||
ReturnValueFromString( g_UnitMetric,
|
||||
msg, m_Parent->m_InternalUnits );
|
||||
msg, m_Parent->m_InternalUnits );
|
||||
|
||||
if( ( m_CurrentSheet->m_SheetName.IsEmpty() ) )
|
||||
m_CurrentSheet->m_SheetName = m_CurrentSheet->m_FileName;
|
||||
|
@ -368,19 +375,19 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
|
|||
{
|
||||
g_ItemToRepeat = NULL;
|
||||
|
||||
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
|
||||
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
|
||||
|
||||
Sheet->m_Flags = IS_NEW | IS_RESIZED;
|
||||
Sheet->m_TimeStamp = GetTimeStamp();
|
||||
Sheet->m_TimeStamp = GetTimeStamp();
|
||||
Sheet->m_Parent = GetScreen();
|
||||
Sheet->m_s = NULL;
|
||||
Sheet->m_AssociatedScreen = NULL;
|
||||
s_SheetMindx = SHEET_MIN_WIDTH;
|
||||
s_SheetMindy = SHEET_MIN_HEIGHT;
|
||||
|
||||
//need to check if this is being added to the EEDrawList.
|
||||
//also need to update the heirarchy, if we are adding
|
||||
// a sheet to a screen that already has multiple instances (!)
|
||||
GetScreen()->SetCurItem( Sheet );
|
||||
//need to check if this is being added to the EEDrawList.
|
||||
//also need to update the heirarchy, if we are adding
|
||||
// a sheet to a screen that already has multiple instances (!)
|
||||
GetScreen()->SetCurItem( Sheet );
|
||||
|
||||
DrawPanel->ManageCurseur = DeplaceSheet;
|
||||
DrawPanel->ForceCloseManageCurseur = ExitSheet;
|
||||
|
@ -422,7 +429,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
|||
while( sheetlabel )
|
||||
{
|
||||
s_SheetMindx = MAX( s_SheetMindx,
|
||||
(int) ( (sheetlabel->GetLength() + 1) * sheetlabel->m_Size.x ) );
|
||||
(int) ( (sheetlabel->GetLength() + 1) * sheetlabel->m_Size.x ) );
|
||||
s_SheetMindy = MAX( s_SheetMindy, sheetlabel->m_Pos.y - Sheet->m_Pos.y );
|
||||
sheetlabel = (DrawSheetLabelStruct*) sheetlabel->Pnext;
|
||||
}
|
||||
|
@ -462,7 +469,7 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
{
|
||||
wxPoint move_vector;
|
||||
DrawSheetLabelStruct* SheetLabel;
|
||||
BASE_SCREEN* screen = panel->m_Parent->GetScreen();
|
||||
BASE_SCREEN* screen = panel->m_Parent->GetScreen();
|
||||
|
||||
DrawSheetStruct* Sheet = (DrawSheetStruct*)
|
||||
screen->GetCurItem();
|
||||
|
@ -474,9 +481,9 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
if( Sheet->m_Flags & IS_RESIZED )
|
||||
{
|
||||
Sheet->m_Size.x = MAX( s_SheetMindx,
|
||||
screen->m_Curseur.x - Sheet->m_Pos.x );
|
||||
screen->m_Curseur.x - Sheet->m_Pos.x );
|
||||
Sheet->m_Size.y = MAX( s_SheetMindy,
|
||||
screen->m_Curseur.y - Sheet->m_Pos.y );
|
||||
screen->m_Curseur.y - Sheet->m_Pos.y );
|
||||
SheetLabel = Sheet->m_Label;
|
||||
while( SheetLabel )
|
||||
{
|
||||
|
@ -496,7 +503,6 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/****************************************/
|
||||
/* Routine de sortie du Menu de Sheet */
|
||||
/****************************************/
|
||||
|
@ -512,9 +518,9 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
if( Sheet->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
|
||||
{
|
||||
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 );
|
||||
Sheet->m_Size.x = s_OldPos.x;
|
||||
|
@ -522,10 +528,10 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
|
||||
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;
|
||||
Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos;
|
||||
Panel->m_Parent->GetScreen()->m_Curseur = s_OldPos;
|
||||
DeplaceSheet( Panel, DC, TRUE );
|
||||
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
|
||||
Sheet->m_Flags = 0;
|
||||
|
@ -540,7 +546,6 @@ static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
||||
*/
|
||||
|
|
|
@ -358,8 +358,8 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
|
|||
DrawSheetLabelStruct* NewSheetLabel, * SheetLabel = NULL;
|
||||
DrawHierLabelStruct* HLabel = NULL;
|
||||
|
||||
if(!Sheet->m_s) return NULL;
|
||||
DrawStruct = Sheet->m_s->EEDrawList;
|
||||
if(!Sheet->m_AssociatedScreen) return NULL;
|
||||
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
|
||||
HLabel = NULL;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -63,9 +63,9 @@ static std::vector<HOLE_INFO> s_HoleListBuffer;
|
|||
#include "dialog_gendrill.cpp" // Dialog box for drill file generation
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/************************************************/
|
||||
void WinEDA_DrillFrame::InitDisplayParams( void )
|
||||
/**********************************************/
|
||||
/************************************************/
|
||||
|
||||
/* some param values initialisation before display dialog window
|
||||
*/
|
||||
|
@ -121,8 +121,6 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
|
|||
m_MicroViasDrillSizer->Enable( m_MicroViasCount );
|
||||
m_MicroViaDrillValue->Enable( m_MicroViasCount );
|
||||
|
||||
/* Display statistics */
|
||||
|
||||
// Pads holes cound:
|
||||
m_PadsHoleCount = 0;
|
||||
for( MODULE* module = m_Parent->m_Pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
|
@ -133,10 +131,10 @@ void WinEDA_DrillFrame::InitDisplayParams( void )
|
|||
{
|
||||
if( pad->m_Drill.x != 0 )
|
||||
m_PadsHoleCount++;
|
||||
else
|
||||
}
|
||||
else
|
||||
if( MIN( pad->m_Drill.x, pad->m_Drill.y ) != 0 )
|
||||
m_PadsHoleCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue